akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int gcd(int a,int b){
  if(b==0) return a;
  return gcd(b,a%b);
}

int main()
{
    long long int a,b,lcm,GCD;
    
    cin>>a>>b;
    GCD=gcd(a,b);
    lcm=(a*b)/GCD;
    cout<<lcm<<endl;
    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int A1 = intArray[0];
            int A2 = intArray[1];
            int A3 = intArray[2];
            if(A1 + A2 + A3 <= 21)
            {
                Console.WriteLine("win");
            }
            else
            {
                Console.WriteLine("bust");
            }
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 28276
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
  Scanner scan = new Scanner(System.in);
   
  
  int A = scan.nextInt();
  int B = scan.nextInt();
  scan.close();
 
  if((A + B) >= 0 && (A + B) <= 23 ){
  System.out.println(A + B); 
   }
  	else if((A + B) < 0 || (A + B) >= 24){
  	 System.out.println((A + B - 24));
  }
 }
}

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

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

	ll arr[5];
	for(ll i=0;i<=4;i++){
		cin>>arr[i];
	}
	for(ll i=0;i<=5;i++){
		if(arr[i]==0){
			cout<<i+1<<endl;
			break;
		}
	}

}

Measured memory_bytes: 3544
N = int(input())
d = {'M':0,'A':0,'R':0,'C':0,'H':0} 
for _ in range(N):
    c = input()[0]
    if c in 'MARCH':d[c] +=  1
gl = [d['M']*d['A']*d['R'],
        d['M']*d['A']*d['C'],
        d['M']*d['A']*d['H'],
        d['M']*d['R']*d['C'],
        d['M']*d['R']*d['H'],
        d['M']*d['C']*d['H'],
        d['A']*d['R']*d['C'],
        d['A']*d['R']*d['H'],
        d['A']*d['C']*d['H'],
        d['R']*d['C']*d['H']]
print(sum(gl))

Measured memory_bytes: 3064
#include <stdio.h>

int main(void){

  long a,b,c,k;
  scanf("%ld %ld %ld %ld", &a, &b, &c, &k);
  long answer = 0;
  if (k <= a) {
    answer = k;
  } else if (k <= a+b) {
    answer = a;
  } else {
    answer = a;
    answer -= k-(a+b);
  }
  printf("%ld\n", answer);

  return 0;
}

Measured memory_bytes: 1736
import sys
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
b = [0] * N
i = 0
c = 1
while True:
    if b[i] == 1:
        print(-1)
        sys.exit()
    b[i] = 1
    i = a[i] - 1
    if i == 1:
        print(c)
        sys.exit()
    c += 1

Measured memory_bytes: 50008
n = int(input())
h = list(map(int, input().split()))
for i in range(1, n):
    if h[i] >= h[i - 1] + 1:
        h[i] = h[i] - 1
    elif h[i] < h[i - 1]:
        print('No')
        exit()
print('Yes')


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

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x = i;
        if (x % 3 == 0) {
            cout << " " << i;
            continue;
        }
        while (x) {
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
}



Measured memory_bytes: 3084
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#pragma warning(disable : 4996)

#define MAX_N 100000
#define INF 1000000000

template <typename T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template <typename T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
int Abs(int a) {
	if (a < 0) return a *= -1;
	return a;
}

int min(int a, int b) {
	if (a < b) return a;
	return b;
}

int N;
int DP[MAX_N + 1];
int GetDP(int n) {
	if (n < 0) return INF;
	return DP[n];
}
int main(void) {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) {
		DP[i] = INF;
	}
	DP[0] = 0;
	for (int i = 1; i <= N; ++i) {
		int p = 6;
		while (p <= i) {
			chmin(DP[i], GetDP(i-p) + 1);
			p *= 6;
		}
		p = 9;
		while (p <= i) {
			chmin(DP[i], GetDP(i-p) + 1);
			p *= 9;
		}
		chmin(DP[i], GetDP(i-1)+1);

	}
	printf("%d", DP[N]);
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
using namespace std;
const int N=2*(1e5)+10;
int n,K;
ll ans;

int main(){
#ifndef ONLINE_JUDGE
	//freopen("a.in","r",stdin);
#endif
	scanf("%d%d",&n,&K);
	ll tmp=n/K,tmp1=n/K+(n%K>=K/2);
	ans=tmp+(tmp>1?tmp*(tmp-1)*3:0)+(tmp>2?tmp*(tmp-1)*(tmp-2):0);
	if (K%2==0)
		ans+=tmp1+(tmp1>1?tmp1*(tmp1-1)*3:0)+(tmp1>2?tmp1*(tmp1-1)*(tmp1-2):0);
	printf("%lld\n",ans);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static final int MOD = 1_000_000_007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] S = sc.next().toCharArray();

        for (int i = 0; i < S.length; i++) {
            char c = S[i];

            boolean isYes = false;
            for (int j = 0; j < S.length; j++) {
                if (i == j) continue;

                if (c == S[j]) {
                    isYes = true;
                    break;
                }
            }

            if (!isYes) {
                System.out.println("No");
                return;
            }
        }

        if (S[0] == S[1] && S[0] == S[2] && S[0] == S[3]) {
            System.out.println("No");
            return;
        }

        System.out.println("Yes");
    }
}


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

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

using namespace std;

typedef pair<int, int> pii;

template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

int main(void)
{
    const int N_MAX = 2000;
    int N, K, Q;
    int A[N_MAX];
    int result = INT_MAX;
    cin >> N >> K >> Q;
    vector<pii> v;
    REP(i, N) {
        cin >> A[i];
        v.pb(pii(A[i], i));
    }
    sort(v.begin(), v.end());
    REP(i, N) {
        PRINT(i);
        vector<int> w;
        REP(j, i) {
            w.pb(v[j].second);
        }
        w.pb(-1);
        w.pb(N);
        sort(w.begin(), w.end());
        PRINTA(w, 0, w.size());
        vector<int> z;
        REP(j, w.size() - 1) {
            int first = w[j] + 1;
            int last = w[j + 1];
            int L = last - first;
            vector<int> s;
            FOR(k, first, last) {
                s.pb(A[k]);
            }
            sort(s.begin(), s.end());
            REP(k, max(0, L - K + 1)) {
                z.pb(s[k]);
            }
        }
        if (z.size() >= Q) {
            sort(z.begin(), z.end());
            amin(result, z[Q - 1] - z[0]);
        }
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 384
import heapq

nm = list(map(lambda x: int(x), input().split()))
n = nm[0]
m = nm[1]

a = list(map(lambda x: int(x), input().split()))
bc = [list(map(lambda x: int(x), input().split())) for i in range(m)]

head_a = []

for a_item in a:
  heapq.heappush(head_a, a_item)

# そーと
bc.sort(key=lambda x: x[1])
bc = list(reversed(bc))

for bc_item in bc:
  done = False
  for i in range(bc_item[0]):
    head_a_item = heapq.heappop(head_a)
    if (head_a_item >= bc_item[1]):
      heapq.heappush(head_a, max(head_a_item, bc_item[1]))
      done = True
      break
    else:
      heapq.heappush(head_a, max(head_a_item, bc_item[1]))
  if (done):
    break

print(sum(head_a))

Measured memory_bytes: 33864
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    const vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << v[k-1] << endl;

    return 0;

}


Measured memory_bytes: 256
if __name__ == "__main__":
    x, y = map(int, input().split())
    ans = False
    for a in range(x + 1):
        b = x - a
        if 2 * a + 4 * b == y:
            ans = True
    
    if ans:
        print('Yes')
    else:
        print("No")

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int> array(n);
  for(int i;i<n;i++){
    cin>>array[i];
  }

    // 配列のインデックス indiecs = {0, 1, 2, 3, 4} を作成する。
    std::vector<size_t> indices(array.size());
    std::iota(indices.begin(), indices.end(), 0);

    // ソートする。
    std::sort(indices.begin(), indices.end(), [&array](size_t i1, size_t i2) {
        return array[i1] < array[i2];
    });

    for (auto v : indices)
        std::cout << v +1 << " ";
    std::cout << std::endl;
}

Measured memory_bytes: 2048
a,b,c,x,y = [int(i) for i in input().split()]
P = [0, x, y]
while P[1]>0 or P[2]>0:
  if P[1]>0 and P[2]>0 and a+b>c*2:
    P[0] += c*2
    P[1] -= 1
    P[2] -= 1
  elif P[1]>0 and P[2]>0 and c*2>a+b:
    P[0] += a+b
    P[1] -= 1
    P[2] -= 1
  elif P[1]>0 and a>c*2:
    P[0] += c*2
    P[1] -= 1
    P[2] -= 1
  elif P[2]>0 and b>c*2:
    P[0] += c*2
    P[1] -= 1
    P[2] -= 1
  elif P[1]>0:
    P[0] += a
    P[1] -= 1
  elif P[2]>0:
    P[0] += b
    P[2] -= 1
print(P[0])

Measured memory_bytes: 3064
#define  _USE_MATH_DEFINES

#define  rep(i, n) for(int i = 0; i < n; i++)
#define  repx(i, a, n) for(int i = a; i < n; i++)
#define  loop while(1)
#define  lli long long int
 
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <utility>
#include <set>

using namespace std;

int main() {

  string str;
  cin >> str;

  int n;
  cin >> n;

  stack<int> st;
  st.push((int)(str[0] - '0'));
  int tmp = 0;

  int ans1 = 0;
  int ans2 = (int)(str[0] - '0');

  char opr;
  int  num;

  for (int i = 1; i < str.size() / 2 + 1; i++) {
    opr = str[2 * i - 1];
    num = (int)(str[2 * i] - '0');
    if (opr == '+') {
      st.push(num);
      ans2 += num;
    }
    else {
      tmp = st.top();
      st.pop();
      st.push(tmp * num);
      ans2 *= num;
    }
  }
  while (st.size()) {
    ans1 += st.top();
    st.pop();
  }

  if (n == ans1 && n == ans2) cout << 'U' << endl;
  else if (n == ans1) cout << 'M' << endl;
  else if (n == ans2) cout << 'L' << endl;
  else cout << 'I' << endl;

  return 0;
}



Measured memory_bytes: 3208
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>

using namespace std;

int main(){
    long long int n,sum = 0;
    map<long long int,long long int>m;
    vector<long long int>v(n);
    cin >> n;

    for(int i = 0;i < n;i++){
        cin >> v[i];
        m[v[i]]++;
    }

    for(auto &i:m)
        sum += i.second*(i.second-1)/2;

    for(int i = 0;i < n;i++){
        cout << sum-(m[v[i]]-1) << endl;
    }

    return 0;
}

Measured memory_bytes: 42240
#include"bits/stdc++.h"

using namespace std;

#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define sp " "
#define int long long
#define PI 3.141592653589793
#define scanstr(s) cin>>ws; getline(cin,s);

void solve()
{
	string s;
	cin>>s;
	if(s=="ABC") cout<<"ARC"<<nl;
	else cout<<"ABC"<<nl;
}

int32_t main()
{
	FastIO;
	solve();
	return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[3000+1];
ll dp[3000+1][3000+1];

ll ans(ll f,ll l,ll n)
{
   if(dp[f][l]!=-1)
   return dp[f][l];
   
   if(f==l)
   {
       if(n%2==0)
       dp[f][l]=-a[f];
       
       else
       dp[f][l]=a[f];
       
       return dp[f][l];
   }
   
   ll x=f-l+1;
   
   if((n%2==0)&&(x%2==0))
   dp[f][l]=max(ans(f+1,l,n)+a[f],ans(f,l-1,n)+a[l]);
   
   else if((n%2==0)&&(x%2!=0))
   dp[f][l]=min(ans(f+1,l,n)-a[f],ans(f,l-1,n)-a[l]);
   
   else if((n%2!=0)&&(x%2==0))
   dp[f][l]=min(ans(f+1,l,n)-a[f],ans(f,l-1,n)-a[l]);
   
   else if((n%2!=0)&&(x%2!=0))
   dp[f][l]=max(ans(f+1,l,n)+a[f],ans(f,l-1,n)+a[l]);
   
   return dp[f][l];
}
int main()
{
    ll n;
    cin>>n;
    
    for(ll i=0;i<=3000;i++)
    {
        for(ll j=0;j<=3000;j++)
        dp[i][j]=-1;
    }

    
    for(ll i=0;i<n;i++)
    cin>>a[i];
    
    cout<<ans(0,n-1,n)<<endl;
    
    
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end



int main(){
   int h,w; scanf("%d%d",&h,&w);
   if(h==1||w==1)printf("1\n");
   else printf("%lld\n",(1LL*h*w+1)/2);
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define vi   vector<int>
#define vvi  vector<vi >
#define vvvi vector<vvi >
#define pii  pair<int,int>
#define INF  (int)1e9
#define MOD  (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	string s;
	cin>>s;
		
	int n=s.size();
	vvi dp(n,vi(13,0));
	if(s[0]=='?'){
		REP(i,10) dp[0][i]=1;
	}else dp[0][s[0]-'0']=1;
	
	for(int i=1;i<n;++i){
		REP(j,10){
			if(s[i]=='?'||s[i]-'0'==j){
				REP(k,13){
					dp[i][(10*k+j)%13]+=dp[i-1][k];
					dp[i][(10*k+j)%13]%=MOD;
				}
			}
		}
	}
	
	cout<<dp[n-1][5]<<endl;
}//解説参考.

Measured memory_bytes: 8960
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define per(i,l,r) for (int i=l;i>=r;i--)
using namespace std;
typedef long long ll;
ll a[200500],ans,cnt,now;
int n,pos;
void out(){
	puts("-1"); exit(0);
}
int main(){
    scanf("%d",&n);
    rep(i,1,n) scanf("%lld",&a[i]);
    if (n==1&&a[n]) out();
    per(i,n,1) { 
    	if (i>pos) now-=cnt;
        if (a[i]<now) out();
        if (a[i]==now) continue;
        if (a[i]>now) {
			cnt=1; now=a[i]; ans+=now;
    		if (i-a[i]<1) out();
    		pos=i-a[i]-1;
		}
	}
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1920
s = list(map(int,input()))
sp = s.copy()
count = 0
counta = 0
if sp[0] == 0:
  for i in range(len(sp)):
    if sp[i] != i%2:
      count += 1
      sp[i] = i%2
    
  for i in range(len(sp)):
    if sp[i] != (i+1)%2:
      counta += 1
      sp[i] = (i+1)%2
    
if s[0] == 1 :
  for i in range(len(s)):
    if s[i] != (i+1)%2:
      counta += 1
      s[i] = (i+1)%2
  for i in range(len(s)):
    if s[i] != i%2:
      count += 1
      s[i] = i%2

#print(count)
#print(counta)
print(min(count,counta))

Measured memory_bytes: 4768
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int r; std::cin >> r;
  std::cout << r*r << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main() { 
    int h,w,k;
    std::cin >> h>>w>>k;
    vvector(a,char,w,h,0);
    vvector(ans,int,w,h,0);
    int c=1;
    reprep(i,j,w,h)std::cin >> a[i][j];
    rep(j,h){
        rep(i,w){
            if(a[i][j]=='#'){
                ans[i][j]=c;
                c++;
            }
            else{
                if(i!=0)ans[i][j]=ans[i-1][j];
            }
        }
    }

    rep(j,h){
        for (int i = w-2; i >=0 ; i--) {
            /* code */
            if(ans[i][j]==0)ans[i][j]=ans[i+1][j];
        }
    }
    rep(k,h){
    rep(j,h-1){
        for (int i = w-1; i >=0 ; i--) {
            /* code */
            if(ans[i][j]==0)ans[i][j]=ans[i][j+1];
        }
    }
    }
    rep(k,h){
    for (int j = h-1; j > 0; j--) {
        /* code */
        for (int i = w-1; i >=0 ; i--) {
            /* code */
            if(ans[i][j]==0)ans[i][j]=ans[i][j-1];
        }
    }
    }
       // std::cout << 333 << std::endl;
    rep(j,h){
        rep(i,w)std::cout << ans[i][j] << " ";
        std::cout << std::endl;
    }
}


Measured memory_bytes: 1280
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)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        a:i64,
        b:i64,
        c:i64,
        d:i64,
    }
    let s1 = b/c-(a-1)/c;
    let s2 = b/d-(a-1)/d;
    let lc = lcm(c,d);
    let s3 = b/lc - (a-1)/lc;
    let ans = (b-a+1) - (s1 +s2 -s3);
    println!("{}",ans);
}
fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
fn lcm(a: i64, b: i64) -> i64 {
    a / gcd(a, b) * b
}


Measured memory_bytes: 4352
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);

    int n = scan.nextInt();
    int cnt = 0;

    outside:for(int i = 0; i <= n/4; i++){
      for(int j = 0; j <= n/7; j++){
        if(4*i + 7*j == n){
          System.out.println("Yes");
          cnt++;
          break outside;
      }
    }
  }

    if(cnt==0)
      System.out.println("No");
    }
  }


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

using namespace std;

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

  int mx = 0;
  for(int i = 0; i < n - 1; i++) {
    map <char, bool> mpx, mpy;
    for(int j = 0; j < n; j++) {
      if(j <= i) {
	mpx[s[j]] = true;
      }
      else {
	mpy[s[j]] = true;
      }
    }
    int count = 0;
    for(auto j : mpx) {
      for(auto k : mpy) {
	if(j.second && k.second && j.first == k.first) {
	  count++;
	}
      }
    }
    mx = max(mx, count);
  }
  cout << mx << endl;
}

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

class Program
{
    static int maxVal = 1000000 + 1;
    static int[] arr;
    static void Main(string[] args)
    {
        Console.ReadLine();
        arr = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        if (ansCheck()) Console.WriteLine("APPROVED");
        else Console.WriteLine("DENIED");
    }

    static bool ansCheck()
    {
       foreach(int element in arr)
        {
            if(element % 2 == 0)
            {
                if(!(element % 3 == 0 || element % 5 == 0))
                {
                    return false;
                }
            }
        }
        return true ;
    }
}

Measured memory_bytes: 18900
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll H,W;
  cin>>H>>W;
  vector<string> graph(0);
  for(ll i=0;i<H;i++){
    string str;
    cin>>str;
    ll count=0;
    for(ll j=0;j<W;j++){
      if(str.at(j)=='#'){count++;}
    }
    if(count>0){graph.push_back(str);}
  }
  vector<ll> vec(0);
  for(ll i=0;i<W;i++){
    ll count=0;
    for(ll j=0;j<(ll)graph.size();j++){
      if(graph.at(j).at(i)=='#'){count++;}
    }
    if(count>0){vec.push_back(i);}
  }
  for(ll i=0;i<(ll)graph.size();i++){
    for(ll j=0;j<(ll)vec.size();j++){
      cout<<graph.at(i).at(vec.at(j));
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Stack;

//Switching Railroad Cars
public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> st = new Stack<Integer>();
        while(sc.hasNext()){
            int x = sc.nextInt();
            if(x==0){
            	System.out.println(st.pop());
            }else{
            	st.push(x);
            }
        }
    }
}

Measured memory_bytes: 25804
from collections import defaultdict


class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst):
        self.graph[src].append((dst))

    def get_nodes(self):
        return self.graph.keys()


def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    AB = [list(map(int, input().split())) for _ in range(M)]

    g1 = Graph()
    for ab in AB:
        if H[ab[0]-1] >= H[ab[1]-1]:
            g1.add_edge(ab[1], ab[0])
        if H[ab[0]-1] <= H[ab[1]-1]:
            g1.add_edge(ab[0], ab[1])

    print(N-len(g1))


if __name__ == "__main__":
    main()


Measured memory_bytes: 40748
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;
int MOD = 1000000007;

signed main(){
    int n,k,r;
    cin >> n >> k >> r;
    cout << n*k/2 << endl;


    
    

    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc060.contest.atcoder.jp/tasks/arc060_a

Measured memory_bytes: 764
#include <iostream>
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int a;
  int b;
  std::cin >> a >> b;
  printf("%d ",a/b);
  printf("%d ",a%b);
  printf("%f \n",(double)a / (double)b);
  return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;

  for (int i = 1; i < B; i++) {
    if ((A * i) % B == C) {
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const ll mod = 1'000'000'007;
const ll mod1= 998244353;
const int N = 5e5, M = N;
//=======================

vi g[N];
int a[N];
int f[1000000];


void solve() {
    string s;
    cin>>s;
    int local=0,global=0;
    int n=s.size();
    fo(i,n)
    {
        if(s[i]=='R') {local++;global=max(local,global);}
        else{
            local=0;
        }
    }
    cout<<global<<endl;
}




int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
      solve();
    }
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}


void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	int n;
	cin >> n;

	vector<int> a(n),b(n),c(n);
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	rep(i,n) cin >> c[i];

	sort(begin(a),end(a));
	sort(begin(b),end(b));
	sort(begin(c),end(c));
	
	
	ll ans = 0LL;

	rep(i,n){
		const ll an = lower_bound(begin(a),end(a),b[i]) - begin(a);
		const ll cn = end(c) - upper_bound(begin(c),end(c),b[i]);
		ans += 1LL * an * cn;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1408
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N,M=mint()
C=[0]*(N+1)
for _ in range(M):
    a,b=mint()
    C[a]+=1
    C[b]+=1
judge(all([c%2==0 for c in C]),['YES','NO'])

Measured memory_bytes: 77016
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int k;
    string s;
    cin >> k;
    cin >> s;
    if(s.size() <= k)
        cout << s << "\n";
    else
    {
        string str = s.substr(0, k);
        cout << str << "..." << "\n";
    }
}

Measured memory_bytes: 3600
main :: IO ()
main = do
  [w,a,b] <- map read . words <$> getLine :: IO [Int]
  print $ shift w a b
   
shift :: Int -> Int -> Int -> Int
shift w a b 
  |(a + w) < b = b - (a + w)
  |(b + w) < a = a - (b + w)
  |otherwise = 0



Measured memory_bytes: 508
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int b[200005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  ll n,k;
  cin>>n>>k;
  ll a[n];
  ll i,j,l=0;
  ll r=0;
 for(i=1;i<=n;i++)
 {
     cin>>a[i];
     b[i]+=a[i]+b[i-1];
 }
 ll m=INT_MIN;
 for(i=k;i<=n;i++)
 {
     if(m<(b[i]-b[i-k]))
     {
         l=i-k+1;
         r=i;
         m=b[i]-b[i-k];
     }
 }
// cout<<m<<" "<<l<<" "<<r<<endl;
 long double ans=0.0;
 for(i=l;i<=r;i++)
 {
     ans+=(float)(a[i]+1)/(2.0);
 }
 cout<<fixed<<setprecision(8)<<ans;
}

Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

typedef long long ll;

ll X,K,D;
void input()
{
    cin >> X >> K >> D;
}

void solve()
{
    if (X == 0){
        if (K % 2 == 0) cout << 0 << endl;
        else cout << D << endl;
        return ;
    } else {
        if (X < 0) X = -X;
        ll pl = X % D, mi = D - pl;
        ll to_pl = X / D;
        if (to_pl > K){
            cout << X - K * D << endl;
        } else {
            if ((K - to_pl) % 2 == 0) cout << pl << endl;
            else cout << mi << endl;
        }
    }
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){


    int a, b, c;

    cin >> a >> b >> c;

    int mx = max(a, max(b, c));

    if (a == b && b == c) {
        cout << 0 << endl;
    } else {
        
        int rem1, rem2;

        if (mx == a) {
            rem1 = a - b;
            rem2 = a - c;
        } 
        else if (mx == b) {
            rem1 = b - a;
            rem2 = b - c;
        } 
        else {
            rem1 = c - a;
            rem2 = c - b;
        } 

        int total = rem1 + rem2;

        if (total % 2 == 0){
            cout << total / 2 << endl;
        } else {
            cout << (total / 2) + 2 << endl;
        }

    }


    return 0;
}

Measured memory_bytes: 256
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID

#include<bits/stdc++.h>

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define print(v) for(auto it=(v).begin();it!=(v).end();it++) {cout<<*it<<" ";}
#define ll long long
#define w(t) ll t;cin>>t;while(t--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
using namespace std;

map<int,int> cnt;

bool find(int n)
{
	if (cnt[1]==1) return false;
	if(cnt[n]>1) return false;
	for(int i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			if(cnt[i]>=1 || cnt[n/i]>=1) return false;
		}
	}
	return true;
}

int main()
{
    int n;
	cin>>n;
	int a[n],c=0;
	for(int i=0;i<n;i++) cin>>a[i],cnt[a[i]]++;
	for(int i=0;i<n;i++)
	{
		int no=a[i];
		if(no==1) {
            if(cnt[1]==1)
            {
                cout<<"1\n";
            }
            else{
                cout<<"0\n";
            }
			return 0;
		}
		else if(find(no)) c++;
	}
	cout<<c<<endl;
    return 0;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 33204
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/

int main()
{
    int n;
    cin >> n;
    long long int va = 0, vb = 0;
    cin >> va >> vb;
    rep(i, n - 1)
    {
        int a = 0, b = 0;
        cin >> a >> b;
        if (va == a && vb == b)
            continue;
        if (va < a && vb < b)
        {
            va = a;
            vb = b;
        }
        else
        {
            long long int foo;
            if (va / a == 0)
            {
                foo = vb / b;
                if (vb % b != 0)
                {
                    foo += 1;
                }
            }

            else if (vb / b == 0)
            {
                foo = va / a;
                if (va % a != 0)
                {
                    foo += 1;
                }
            }
            else
            {
                long long int left, right;
                left = va / a;
                if (va % a != 0)
                    left++;
                right = vb / b;
                if (vb % b != 0)
                    right++;
                foo = max(left, right);
            }

            //aが大きいとき
            va = a * foo;
            vb = b * foo;
            //bが大きいとき
        }
       // cout << va << ":" << vb << endl;
    }
    cout << va + vb << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) (1e9 + 7);
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

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

    int n;
    cin >> n;
    ld sum = 0;

    rep(i, n) {
        ld a;
        cin >> a;
        sum += 1.0 / a;
    }
    cout << 1.0 / sum << endl;
    return 0;
}


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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//  random_device rnd;
//  mt19937 mt(rnd());
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long int A, B;
    cin >> A >> B;
    if(A == B){
    	cout << A << endl;
    	ED
    }
    
    vector<bool> ans (42,0);
    long long int one = (B-A)/2;
    if(A%2==1 || B%2==1){
    	one++;
    }
    if(one % 2 == 1)ans[0] = 1;
    
    for(long long int i = 1;i < 42;i++){
    	long long int dummy = 0;
    	if(A%ipow(2,i+1) >= ipow(2,i) && A%2 == 1){
    		dummy++;
    	}
    	if(B%ipow(2,i+1) >= ipow(2,i) && B%2 == 0){
    		dummy++;
    	}
    	if(dummy == 1){
    		ans[i] = 1;
    	}
    }
    
/*
	for(long long int i = 42;i > 0;i--){
    	cout << ans[i];
    }
    cout << endl;
*/
    
    long long int answer = 0;
    for(long long int i = 0;i < 42;i++){
    	if(ans[i]){
    		answer += ipow(2,i);
    	}
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        var n = Read();
        string[] w = new string[n];
        bool b = true;
        for(int i = 0; i < n; i++)
        {
            w[i] = ReadStr();
            for(int j = 0; j < i; j++)
            {
                if (w[j] == w[i])
                {
                    b = false;
                    break;
                }
            }
            if (i > 0 && w[i - 1][w[i - 1].Length - 1] != w[i][0]) { b = false; }
            if (!b) { break; }
        }
        Yn(b);
    }

    static void Write(string s) { Console.WriteLine(s); return; }
    static void Write(long n) { Console.WriteLine(n.ToString()); return; }
    static string ReadStr() { return Console.ReadLine(); }
    static string[] ReadStrs() { return Console.ReadLine().Split(' '); }
    static long Read() { return long.Parse(Console.ReadLine()); }
    static long[] Read(long n)
    {
        long[] p = new long[n];
        string[] t = Console.ReadLine().Split(' ');
        for(long i = 0; i < n; i++) { p[i] = long.Parse(t[i]); }
        return p;
    }
    static long abs(long n) { return (n > 0) ? n : -n; }
    static long gcd(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = gcd(p, n[i]); } return p; }
    static long gcd(long a, long b) { return (a==0)?b:gcd(b % a, a); }
    static long lcm(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = lcm(p, n[i]); } return p; }
    static long lcm(long a, long b) { return a * b / gcd(a, b); }
    static long max(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = (p>n[i])?p:n[i]; } return p; }
    static long min(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = (p<n[i])?p:n[i]; } return p; }
    static void YN(bool t) { Console.WriteLine(t ? "YES" : "NO"); }
    static void Yn(bool t) { Console.WriteLine(t ? "Yes" : "No"); }
    static void yn(bool t) { Console.WriteLine(t ? "yes" : "no"); }
    static string clip(string s, int start, int count)
    {
        if (start + count < s.Length) { s = s.Remove(start + count); }
        if (start > 0) { s = s.Remove(0, start); }
        return s;
    }
    static long ConvToLong(string n, int b)
    {
        long m = 0; long t = 1;
        for (int i = n.Length - 1; i >= 0; i--)
        {
            int k = int.Parse(n[i].ToString());
            m += t * k;
            t *= b;
        }
        return m;
    }
}


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

// definitions
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define high(x) __builtin_popcountll(x)
#define pb push_back
#define pf push_front
#define mod1 998244353
#define mod 1000000007
#define MAX_CHAR 256
#define pi 3.1415926535897932384

using namespace std;
typedef vector<long long> vl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dql;
typedef deque <char> dqc;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ll INF=1e18;
// prevent collisions in unordered_map
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
typedef unordered_map <long long, long long, custom_hash> umap;

// cin and cout overloaded for vectors and sets
template <typename T> 
ostream& operator<<(ostream& os, vector<T>& v) 
{ 
    for (auto i:v) os << i << " "; 
    return os; 
} 
template <typename T>
istream &operator>>(istream &is, vector<T> &v) 
{
    ll n=v.size();
    rep(i,0,n){ ll a; cin >>a; v[i]=a;}
    return is;            
}
template <typename T> 
ostream& operator<<(ostream& os, set<T>& s) 
{ 
    for (auto i:s) os << i << " "; 
    return os; 
}

// standard functions
ll mystoi(string str)
{
    stringstream ss(str);
    ll ans=0;
    ss >> ans;

    return ans;
}

ll exp(ll x, ll ex) 
{
    ll ans = 1ll;
    while (ex > 0) 
    {
        if (ex & 1ll) ans = (ans * x);
        ex >>= 1ll;
        x = (x * x);
    }
    return ans;
}

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

// code beigns in main
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    while(t--)
    {
        string s;
        cin >> s;

        cout << s.substr(0,3) << endl;
    } 
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
set <char> diff;
int exist = 0;

int main(){
    for (int i = 0; i < 4; i ++){
        char test;
        cin >> test;
        if (diff.find(test) == diff.end()){
            diff.insert(test);
            exist++;
        }
    }
    if (exist == 2){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 256