akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define inf 1000000007

using namespace std;

signed main() {
  IOS;
  char c;
  cin >> c;
  char r;
  switch (c) {
    case 'A': r = 'T'; break;
    case 'T': r = 'A'; break;
    case 'C': r = 'G'; break;
    case 'G': r = 'C'; break;
  }

  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    vec a(3);
    ll ans;
    cin>>a[0]>>ans>>A>>a[1]>>a[2]>>A>>A;
    ll temp = 0;
    rep(i,3) temp += a[i]/2;
    temp *= 2;
    rep(i,3){
        if(a[i] == 0){
            cout<<ans + temp<<endl;
            return 0;
        }
    }
    ll t = 3;
    rep(i,3) t += ((a[i] - 1)/2)*2;
    cout<<max(ans + temp, ans + t)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n = 7, k, d = 1;
    cin >> k;
    if (k % 2 == 0 || k % 5 == 0) cout << "-1";
    else
    {
        for (long long i = 1; i <= k; ++i)
        {
            if (n % k == 0)
            {
                cout << d;
                break;
            }
            else 
            {
                n = (n * 10 + 7) % k;
                d++;
            }
        }
    }
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n,k;
	cin>>n>>k;
	vector<int>m(n,0);
	while(k--)
	{
		int d;
		cin>>d;
		while(d--)
		{
			int x;
			cin>>x;
			m[x-1]++;
		}
	}
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(m[i]==0)
			cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3592
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b;
	long long c;
	scanf("%d %d",&a,&b);
	c=(long long)a*b;
	if(c<=0)	printf("Zero\n");
	else if(a<0 && (b-a+1)%2==1)	printf("Negative\n");
	else printf("Positive\n");
	return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc089/tasks/abc089_a

N = read_a_int()
print(N // 3)


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
using namespace std;

int main() {
    int n, tmp, cur = 0, out = 0;
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        cin >> tmp;
        if ( tmp >= cur ) {
            out++;
            cur = tmp;
        }
    }
    cout << out << endl;
    return 0;
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    string s, t;
    cin >> s >> t;
    cout << ((t.substr(0,s.length()) == s) ? "Yes" : "No") << endl;
}

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


int main()
{
	char s[16];
	scanf("%s", s);
	int batsu = 0;
	int i;
	for (i = 0;s[i] != '\0';i++)
	{
		if (s[i] == 'x')batsu++;
	}
	if (batsu >= 8)printf("NO\n");
	else printf("YES\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

ll solve(ll n, int w[3], int v[3]) {
	ll* dp[4];
	for (int i = 0; i < 4; i++)dp[i] = new ll[n + 1];
	for (int i = 0; i < n + 1; i++)dp[0][i] = i;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j <= n; j++) {
			if (j - w[i] >= 0) {
				dp[i + 1][j] = max(dp[i + 1][j - w[i]] + v[i], dp[i][j]);
			}
			else dp[i + 1][j] = dp[i][j];
		}
	}
	return dp[3][n];
}

int main() {
	while (cin >> N) {
		int a[3];
		int b[3];
		cin >> a[0] >> a[1] >> a[2];
		cin >> b[0] >> b[1] >> b[2];
		int v[3];
		N = solve(N, a, b);
		N = solve(N, b, a);
		cout << N << endl;
	}
}


Measured memory_bytes: 781696
#include <stdio.h>
#include <string.h>

int main(void){
    // Your code here!
    char s[101], ans[8] = "keyence", temp[8] = {};
    scanf("%s\n",s);
    int n = strlen(s);
    int r = n-7;
    int flag = 0;
    for(int i = 0; i <= n-r && flag == 0; i++)
    {
        //printf("%d:\n",i);
        for(int j = 0; j < i; j++)
        {
            temp[j] = s[j];
            //printf("%c ",temp[j]);
            //printf("%c\n",temp[8]);
        }
        for(int j = 0; n-j > i+r; j++)
        {
            temp[7-j-1] = s[n-(j+1)];
            //printf("%c ",temp[7-j-1]);
            //printf("%c\n",temp[8]);
        }
        //printf("\n %s \n",temp);
        
        //for(int j = 0; j < 7; j++) printf("%c",temp[j]);
        //printf("\n");
        if(strcmp(ans,temp) == 0)
            flag = 1;
    }
    printf("%s\n",(flag==1)? "YES":"NO");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

ll beki(int a, int n){
    if(n == 0){
        return 1;
    }
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1){
        ans = ans * a;
    }
    return ans;
}

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

    int N, M; cin >> N >> M;
    priority_queue<ll> A;
    rep(i,N) {
        ll a; cin >> a;
        A.push(a);
    }


    rep(i,M) {
        ll p = A.top(); A.pop();
        p /= 2;
        A.push(p);
    }
    ll ans = 0LL;
    rep(i,N) {
        ll q = A.top(); A.pop();
        ans += q;
    }
    cout << ans << endl;
}



Measured memory_bytes: 1528
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

signed main() {
  int D;
  cin >> D;
  vector<int> down(27);
  for( int i = 1; i <= 26; i++ ) cin >> down[i];

  //各コンテストの満足度
  vector<vector<int>> contest(D+1, vector<int>(27));
  for( int i = 1; i <= D; i++ ){
    for( int j = 1; j <= 26; j++ ) cin >> contest[i][j];
  }

  vector<int> T(D+1);
  for( int i = 1; i <= D; i++ ) cin >> T[i];

  //各コンテストを最後に実施した日
  vector<int> last(27);

  int score = 0;
  for( int d = 1; d <= D; d++ ){
    int choice = 0;
    int plus = -1000000000;
    for( int c = 1; c <= 26; c++ ){ //d日目にコンテストcを選んだ場合
      int now = contest[d][c];
      for( int j = 1; j <= 26; j++ ){
        if( c == j ) continue;
        if( now <= plus ) break;
        now -= down[j]*(d-last[j]);
      }
      if( plus < now ){
        choice = c;
        plus = now;
      }
    }
    last[choice] = d;
    score += plus;
    cout << choice << endl;
  }

}


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

int main(){
    int n; cin >> n;
    string s; cin >> s;
    vector<int> r,g,b;
    rep(i,n) {
        if(s[i] == 'R') r.push_back(i);
        else if(s[i] == 'G') g.push_back(i);
        else b.push_back(i);
    }
    ll sum = 0;
    rep(i,r.size()){
        rep(j,g.size()){
            sum += b.size();
            int x = r[i],y = g[j];
            if(2*y-x >= 0 && 2*y-x < n && s[2*y-x] == 'B') sum -= 1;
            if(2*x-y >= 0 && 2*x-y < n && s[2*x-y] == 'B') sum -= 1;
            if((x+y)%2 == 0 && s[(x+y)/2] == 'B') sum -= 1;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3644
N = int(input())
A = list(map(int, input().split()))

res = float('inf')

for i in A:
    cnt = 0
    while True:
        if i % 2 == 1:
            if cnt == 0:
                print(0)
                exit()
            elif cnt < res:
                res = cnt
                break
            else:
                break
        i = i // 2
        cnt += 1

print(res)



Measured memory_bytes: 9140
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>
#include <iomanip>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

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

typedef unsigned long long u64;
typedef long long i64;

int n, q;
string s;
int l[100005];
int r[100005];
int m[100005];

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

        cin >> n >> q;
        cin >> s;
        REP(i,q) {
                int ll,rr;
                cin >> ll >> rr;
                l[i] = ll-1;
                r[i] = rr-1;
        }

        int k = 0;
        REP(i,n) {
                if (i==0) continue;

                if(s[i-1] == 'A' && s[i] == 'C')
                        k++;
                m[i] = k;
        }

        REP(i,q) {
                cout << m[r[i]] - m[l[i]] << endl;
        }





        return 0;
}


Measured memory_bytes: 2256
from math import sqrt
n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
dist = 0
for i in range(n):
	for j in range(i+1, n):
		dist += sqrt((p[i][0]-p[j][0])**2 + (p[i][1]-p[j][1])**2)
print(dist * (n-1) / ((n*(n-1))//2))

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(void) {
  unsigned int l, r;
  cin >> l >> r;

  if (r-l > 2019) r = l+2019;
  int m = 2019;
  for (unsigned long long int i = l; i <= r; ++i) {
    for (unsigned long long int j = i+1; j <= r; ++j) {
      unsigned long long int rem = (i*j)%2019;
      m = rem < m ? rem : m;
    }
  }

  cout << m << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int n, a; 
    cin >> n >> a;
    int square = n*n;
    cout << square-a;
    cout << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
using namespace std;
int main() {
    long long int a; string s;
    cin>>a>>s;
    if(a>=s.size())
    cout<<s;
    else {
    for(int i=0; i<a; i++){
    cout<<s[i];
    }
    cout<<"...\n";
    }
    return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
int main(){
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b!=c||a==c&&c!=b||b==c&&b!=a){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}

}


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

ll s; 

int keta(ll s){
  int ans = 0;  
  int x = s;
  while(x){
    ans ++;
    x /= 10;
  }
  return ans;
}

int y(ll s){
  int x = 1;
  rep(i,keta(s)){
  x *= 2;
  }
  x /= 4; //2の|s|-2乗
  return x;
}

ll f(ll s){    
  ll p = s;
  ll x = 10;
  int z = y(s);
  rep(i,keta(s) - 1){
    p += f(s / x) + (s % x) * z;
    x *= 10;
    z /= 2;
  }
  return p;
}

int main() {
  cin >> s;
  cout << f(s) << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		while (true) {
			int in = scan.nextInt();
			if (in == 0)
				return;

			int aSum = 0;
			int bSum = 0;
			for (int i = 0; i < in; i++) {
				int a = scan.nextInt();
				int b = scan.nextInt();
				if (a > b) {
					aSum += a + b;
				} else if (a < b) {
					bSum += a + b;
				} else {
					aSum += a;
					bSum += b;
				}
			}
			System.out.println(aSum + " " + bSum);
		}
	}
}

Measured memory_bytes: 12000
s = input()

ans = 0

rc = [0]
rq = [0]
la = [0]
lq = [0]
q3 = [1]
t = 10**9+7

for i in range(len(s)-1):
    if s[len(s)-i-1]=='C':
        rc.append(rc[-1]+1)
        rq.append(rq[-1])
    elif s[len(s)-i-1]=='?':
        rc.append(rc[-1])
        rq.append(rq[-1]+1)
    else:
        rc.append(rc[-1])
        rq.append(rq[-1])
    if s[i]=='A':
        la.append(la[-1]+1)
        lq.append(lq[-1])
    elif s[i]=='?':
        la.append(la[-1])
        lq.append(lq[-1]+1)
    else:
        la.append(la[-1])
        lq.append(lq[-1])
    q3.append(q3[-1] * 3 % t)
rc.reverse()
rq.reverse()

q3.append(1/3)

for i in range(len(s)):
    if s[i]=='B' or s[i]=='?':
        l = q3[lq[i]-1]
        r = q3[rq[i]-1]
        ans += l*r*(3*la[i]+lq[i])*(3*rc[i]+rq[i]) % t

print(round(ans%t))


Measured memory_bytes: 79856
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//
		while(true){
		//??£?¨??????????????????????
		long sum = 0;
		//1??????????????????
		String line = sc.nextLine();
		//?????£?????\???????????????1???
		
			//?????£?????\????????????1??????0?????£?????´????????????
			if(line.equals("0")){
				break;
				}
			
			//
			for(int i=0;i<line.length();i++){
				sum += Integer.parseInt(String.valueOf(line.charAt(i)));
			}
			//
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 26828
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll              long long
#define pi              pair<int,int>
#define pll             pair<ll,ll>
#define pb              push_back
#define F               first
#define S               second
#define vi              vector<int>
#define vll             vector<ll>
#define endl            '\n'
#define all(v)          (v).begin(),(v).end()
#define MP(a,b)         make_pair(a,b)
#define debug(x)        cerr<< #x << " : " << x << endl;
#define debugp(p)       cerr<< #p << " : " << "(" << (p).first << "," << (p).second << ")\n";
#define debugv(v)       cerr<< #v << " : " << "["; for(int i = 0; i < (v).size(); i++) cerr << v[i] << " "; cerr<<"]\n";
#define debugs(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<*itr << " "; cerr << "]\n";
#define debugm(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<"(" << itr->first << "," << itr->second << ") "; cerr << "]\n";

/* ordered set: 
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/

inline ll modexp(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}

const int inf = 1e9 + 7;

void Solve(){
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }

    sort (all (a));
    ll ans = 0;
    ans = a[n - 1];
    int j = n - 2;
    for (int i = n - 3; i >= 0; i -= 2){
        if (i >= 0) ans += a[j];
        if (i - 1 >= 0) ans += a[j];
        --j;
    }
    cout << ans << endl;
}
int main(){
    ios :: sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
    
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        Solve();
    }
    #ifdef LOCAL
    cerr << "Time elapsed\t: " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";       
    #endif
}



Measured memory_bytes: 4776
#include <iostream>
#include <vector>
#include <chrono>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <random>
#include <map>
#include <string>

using namespace std;

typedef long long ll;
typedef long double ld;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

char grid[10][10], cp[10][10];

int main()
{
    fastInp;

    ll n;
    cin >> n;

    vector<ll> vec(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) cin >> vec[i];

    multiset<pair<ll, ll>> vls;
    sort(vec.rbegin(), vec.rend());
    ans += vec[0];
    vls.insert({ vec[1], vec[0] });
    vls.insert({ vec[1], vec[0] });

    for (int j = 2; j < n; j++) {
        pair<ll, ll> v = *(--vls.end());
        vls.erase(--vls.end());
        ans += v.first;
        pair<ll, ll> u = { v.first, vec[j] }, v2 = { v.second, vec[j] };
        if (u.first > u.second) swap(u.first, u.second);
        if (v2.first > v2.second) swap(v2.first, v2.second);
        vls.insert(u);
        vls.insert(v2);
    }

    cout << ans;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 2000000000
typedef long long ll;
bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



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


    cout << max(A-2*B,0) << endl;
    
    
    return 0;
    

}

Measured memory_bytes: 3536
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 1000;
static const int VMAX = 10000;

int n, A[MAX], s;
int B[MAX], T[VMAX+1];

int solve() {
  int ans = 0;

  bool V[MAX];
  for ( int i = 0; i < n; i++ ) {
    B[i] = A[i];
    V[i] = false;
  }

  sort(B, B+n);
  for ( int i = 0; i < n; i++ ) T[B[i]] = i;
  for ( int i = 0; i < n; i++ ) {
    if ( V[i] ) continue;
    int cur = i;
    int S = 0;
    int m = VMAX;
    int an = 0;
    while ( 1 ) {
      V[cur] = true;
      an++;
      int v = A[cur];
      m = min(m, v);
      S += v;
      cur = T[v];
      if ( V[cur] ) break;
    }
    ans += min(S + (an - 2) * m, m + S + (an + 1) * s);
  }

  return ans;
}

int main() {
  cin >> n;
  s = VMAX;
  for ( int i = 0; i < n; i++ ) {
    cin >> A[i];
    s = min(s, A[i]);
  }
  int ans = solve();
cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3184
//-------------------------------------------
//-               Train Fare                -
//-                                         -
//-       autumn_eel niha katemasen!        -
//-------------------------------------------
#include<iostream>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
#pragma warning(disable:4996)
int n, m, q, a[200001], b[200001], c[200001], d[200001], e[100001], dist[100001], E[200001];
vector<pair<int, int>>z[100001]; vector<int> x[100001];
vector<int>D[100001];
void reader(int *x) {
	int k = getchar_unlocked(); *x = k - '0';
	while (true) {
		k = getchar_unlocked();
		if (k < '0' || k > '9') break;
		*x = ((*x) << 1) + ((*x) << 3) + k - '0';
	}
}
int main() {
	reader(&n); reader(&m); reader(&q);
	fill(d, d + m + 1, 1 << 30);
	for (int i = 1; i <= m; i++) reader(&a[i]), reader(&b[i]);
	for (int i = 1; i <= q; i++) reader(&c[i]), d[c[i]] = i;
	for (int i = 1; i <= m; i++) {
		x[a[i]].push_back(b[i]);
		x[b[i]].push_back(a[i]);
	}
	fill(dist, dist + n + 1, -1); dist[1] = 0;
	queue<int> Q1; Q1.push(1);
	while (!Q1.empty()) {
		int a1 = Q1.front(); Q1.pop();
		for (int i : x[a1]) {
			if (dist[i] == -1) {
				dist[i] = dist[a1] + 1;
				Q1.push(i);
			}
		}
	}
	for (int i = 1; i <= m; i++) {
		if (dist[a[i]] > dist[b[i]])z[a[i]].push_back(make_pair(b[i], d[i]));
		if (dist[b[i]] > dist[a[i]])z[b[i]].push_back(make_pair(a[i], d[i]));
	}
	for (int i = 1; i <= n; i++) {
		D[dist[i]].push_back(i);
	}
	e[1] = (1 << 30);
	for (int i = 1; i < n; i++) {
		for (int j : D[i]) {
			for (pair<int, int>k : z[j]) {
				e[j] = max(e[j], min(e[k.first], k.second));
			}
		}
	}
	for (int i = 2; i <= n; i++) { if (e[i] < 300000)E[e[i]]++; }
	for (int i = 1; i <= q; i++) {
		E[i] += E[i - 1];
		printf("%d\n", E[i]);
	}
	return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    
    Yn(c >= a && c <= b)
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  long n, a, b;
  readf("%s %s %s\n", &n, &a, &b);
  auto q = a + b;
  auto res = (n / q) * a;
  res += min(n % q, a);
  res.writeln;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a[3],count=0,i,j,flag=0,t;
    scanf("%d %d %d",&a[0],&a[1],&a[2]);
    for(i=0;i<2;i++)
    {
        flag=0;
        for(j=0;j<2;j++)
        {
            if(a[j]<a[j+1])
            {
                t=a[j];
                a[j]=a[j+1];
                a[j+1]=t;
                flag=1;
            }
        }
        if(flag==0)
            break;
    }
    if(((a[0]-a[2])-(a[0]-a[1]))%2==0)
    {
        count=((a[0]-a[2])+(a[0]-a[1]))/2;
    }
    else
    {
        while(a[0]!=a[1])
        {
            a[1]++;
            a[2]++;
            count++;
        }
        while(a[2]<a[0])
        {
            count++;
            a[2]+=2;
        }
        count++;
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 128
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    A,B = LMIIS()
    if A > 9 or B > 9:
        print(-1)
    else:
        print(A*B)




if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e18;
using Graph = vector<vector<int>>;

signed main() {
  int N, T;
  cin >> N >> T;
  vector<pair<int, int>> dish(N);
  for( int i = 0; i < N; i++ ){
    int A, B;
    cin >> A >> B;
    dish[i] = make_pair(A, B);
  }

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


  vector<int> dp(10000);
  dp[0] = 0;
  for( int i = 0; i < N; i++ ){
    for( int j = T-1; j >= 0;  j-- ){
      int A = dish[i].first;
      int B = dish[i].second;
      dp[j+A] = max(dp[j+A], dp[j]+B);
    }
  }

  int ans = 0;
  for( int i = 0; i < 10000; i++ ){
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;


}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
//
ll mod_fact(ll, ll);
ll mod_pow(ll, ll, ll);
ll mod_inv(ll, ll);
int main(){
    ll x, y;
    cin >> x >> y;
    ll a = (2 * y - x) / 3;
    ll b = (2 * x - y) / 3;
    //二項係数(a+b)Cb mod 1e9 + 7でよし
    if(!(a + 2 * b == x && b + 2 * a == y && a >= 0 && b >= 0)){
        cout << 0;
        return 0;
    }
    cout << mod_fact(a + b, MOD) * mod_inv(mod_fact(a, MOD), MOD) % MOD * mod_inv(mod_fact(b, MOD), MOD) % MOD;
}


//library//
ll mod_fact(ll a, ll mod){
    ll ans = 1;
    while(a > 1){
        ans = ans * a % mod;
        a--;
    }
    return ans; 
}
ll mod_pow(ll a, ll b, ll mod){
    ll ans = 1;
    while(b > 0){
        if(b & 1) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
ll mod_inv(ll a, ll mod){
    return mod_pow(a, mod - 2, mod);
}



Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<numeric>
#include<climits>
using namespace std;

int main(void)
{
    int N, L;
    cin >> N >> L;

    vector<int> apple(N, L);
    for (int i = 0; i < N; i++)
        apple[i] += i;

    int sum = accumulate(apple.begin(), apple.end(), 0);
    int ans = INT_MAX / 2;
    for (int i = 0; i < N; i++) {
        int taste = sum - apple[i];
        if (abs(sum - taste) < abs(sum - ans))
            ans = taste;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	int n; cin >> n;
	std::vector<int> a;
	std::vector<int> b;
	for (int i = 0; i < n; ++i)
	{
		int A; cin >> A;
		a.push_back(A);
		b.push_back(A);
	}
	sort(a.rbegin(), a.rend());
	int max1 = a[0];
	int max2 = a[1];

	for (int i = 0; i < n; ++i)
	{
		if(b[i] == max1){
			cout << max2 << endl;
		}else{
			cout << max1 << endl;
		}
	}

}

Measured memory_bytes: 3436
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int N, M;

int dfs(int now, vector<int> &st)
{
    //最上段に到達しているか
    if (now > N)
    {
        return 0;
    }
    else if (now == N)
    {
        return 1;
    }
    //DP確認
    if (st.at(now) != -1)
        return st.at(now);
    int cnt = 0;
    rep(i, 2)
    {
        cnt += dfs(now + i + 1, st) % 1000000007;
    }
    //DP追加
    if (st.at(now) == -1)
    {
        st[now] = cnt;
    }
    return cnt;
}

int main()
{
    cin >> N >> M;
    vector<int> st(N + 2, -1);
    rep(i, M)
    {
        int ipt;
        cin >> ipt;
        st.at(ipt) = 0;
    }
    int ans = dfs(0, st);
    cout << ans % 1000000007 << endl;
}


Measured memory_bytes: 5376
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type pair struct {
	a int
	b int
}

var sc = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func nextInt() int {
	i, _ := strconv.ParseInt(nextLine(), 10, 64)
	return int(i)
}

func nextLong() int64 {
	i, _ := strconv.ParseInt(nextLine(), 10, 64)
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	graph := make([][]int, N+1)
	for i := 1; i < N+1; i++ {
		graph[i] = make([]int, 0, N-1)
		for j := 0; j < N-1; j++ {
			graph[i] = append(graph[i], nextInt())
		}
	}
	queue := make([]pair, 0)
	for i := 1; i < N; i++ {
		if graph[graph[i][0]][0] == i && i < graph[i][0] {
			queue = append(queue, pair{i, graph[i][0]})
		}
	}
	ans := 0
	for cnt := 0; cnt < N*(N-1)/2; ans++ {
		if len(queue) == 0 {
			fmt.Println("-1")
			return
		}
		for b := len(queue); b > 0; b-- {
			n := queue[0].a
			graph[n] = graph[n][1:]
			if len(graph[n]) != 0 && graph[graph[n][0]][0] == n {
				queue = append(queue, pair{n, graph[n][0]})
			}
			n = queue[0].b
			graph[n] = graph[n][1:]
			if len(graph[n]) != 0 && graph[graph[n][0]][0] == n {
				queue = append(queue, pair{n, graph[n][0]})
			}
			queue = queue[1:]
			cnt++
		}
	}
	fmt.Printf("%d\n", ans)
}


Measured memory_bytes: 19456
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	string str;
	cin >> str;
	for (int i = 0; i < str.length(); i++)
	{
		if (i & 1)
		{
			if (str[i] == 'R') puts("No"), exit(0);
		}
		else
		{
			if (str[i] == 'L') puts("No"), exit(0);
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vi p(n+1);
    p[0]=0;
    rep(i,m){
        int a;
        cin>>a;
        p[a]=1;
    } 
    rep(i,n){
        p[i+1]+=p[i];
    }
    out(min(p[x],p[n]-p[x]));
}
    

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

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> L(N);

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

    int count = 0;
    for (int i = 0; i < N - 2; i++)
    {
        for (int j = i + 1; j < N - 1; j++)
        {
            for (int k = j + 1; k < N; k++)
            {
                bool is_sat = true;
                is_sat &= L[i] != L[j] && L[j] != L[k] && L[k] != L[i];
                is_sat &= L[i] + L[j] > L[k];
                is_sat &= L[j] + L[k] > L[i];
                is_sat &= L[k] + L[i] > L[j];
                if (is_sat)
                    count++;
            }
        }
    }
    std::cout << count << std::endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
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;}

int main(){
	int n;
	const ll mod = 1000000007;
	cin >> n;
	vector<ll> a(n),s(n+1);
	s[0]=0;
	REP(i,n){
		cin >> a[i];
		s[i+1] = s[i] + a[i];
		s[i+1] %= mod;
	}

	ll ans = 0;
	
	for(int i=n-1;i>=0; i--){
		ll tmp = a[i]*s[i];
		ans += tmp%mod;
		ans %= mod;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 6368
import math
x = int(input())
if x < 4:
    print(1)
    exit()
else:
    m = int(math.sqrt(x))
    p = int(math.log2(x))
    ans = 0
    for i in range(2, m+1):
        for j in range(2, p+1):
            if i**j <= x:
                ans = max(ans, i**j)
    print(ans)


Measured memory_bytes: 3060
#include <cstdio>
#include <cassert>
#include <vector>

using namespace std;

long long tbl[4010][4010];
long long fact[8010];
long long iFact[8010];
long long mod=1000000007;

long long poww(long long x,long long y) {
	long long res = 1;
	while(y)
	{
		if(y & 1) res = (res * x) % mod; 
		x = x * x % mod;
		y = y >> 1;
	}
	return res;

	//if (x==0) return 1;
	//if (x==1) return b;
	//long long tmp = poww(b,x/2);
	//tmp=(tmp*tmp)%mod;
	//if (x%2) {
		//return (tmp*b)%mod;
	//} else {
		//return tmp;
	//}	
}

int main() {
	int n;
	scanf("%d",&n);
	fact[0]=1;
	for (int i=1;i<8010;i++) {
		fact[i]=fact[i-1]*i;
		fact[i]%=mod;
		iFact[i]=poww(fact[i],mod-2);
		//printf("%lld\n",fact[i]);
	}
	//printf("%lld\n",iFact[2]);
	int a,b;
	long long ans=0;
	//int c,d;
	//scanf("%d%d%d%d",&a,&b,&c,&d);
	//printf("%d %d %lld %lld %lld\n",a+c,b+d,fact[a+b+c+d],iFact[a+c],iFact[b+d]);
	vector<pair<int,int>> ttt;
	for (int i=0;i<n;i++) {
		scanf("%d%d",&a,&b);
		ans-=(((fact[2*a+2*b]*iFact[2*a])%mod)*iFact[2*b])%mod;
		ans%=mod;
		//printf("%lld\n",(((fact[2*a+2*b]*iFact[2*a])%mod)*iFact[2*b])%mod);
		tbl[2001-a][2001-b]++;
		ttt.push_back({2001+a,2001+b});
	}
	for (int i=1;i<4010;i++) {
		for (int j=1;j<4010;j++) {
			tbl[i][j]+=(tbl[i-1][j]+tbl[i][j-1])%mod;
			tbl[i][j]%=mod;
		}
	}
	for (int i=0;i<n;i++) {
		ans+=tbl[ttt[i].first][ttt[i].second];
		ans%=mod;
	}
	ans*=iFact[2];
	ans%=mod;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 127600
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    dp = [True] * (a[-1] + 1)
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        if dp[a[i]]:

            for j in range(2 * a[i], a[-1] + 1, a[i]):
                dp[j] = False

            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Measured memory_bytes: 100808
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;
typedef queue<ll> qi;
typedef queue<char> qc;
typedef queue<string> qs;
typedef vector<char> vc;
typedef vector<string> vs;
typedef map<char,ll> mpci;
typedef map<ll,ll> mpii;
typedef map<string,ll> mpsi;
typedef set<ll> sei;
typedef set<char> sec;
typedef set<string> ses;
typedef stack<ll> si;
typedef stack<char> sc;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pll> vpll;
typedef vector<pdd> vdd;
typedef unsigned int uint;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vii> vvii;
/*=====================================================================*/
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define all(s) (s).begin(),(s).end()
#define fi first
#define se second
#define be begin
#define en end
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,p,n) for(int i=p;i<n;i++)
#define ford(i,p,n) for(int i=n-1;i>=p;i--)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i)
#define zero(a) memset(a,0,sizeof(a))
#define number(a,num) memeset(a,num,sizeof(a))

/*=====================================================================*/

inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
/*======================================================================*/
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
/*======================================================================*/
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
/*======================================================================*/
int main()
{
  /*
	ios_base::sync_with_stdio(0);
	cin(tie);
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  string s;
  cin>>s;
  rep(i,s.size())
  {
  	if(((i+1)%2)==1)
  	{
  	  if(s[i]=='L')
  	  {
  	    cout<<"No";
  	    return 0;
  	  }
    }
  	else
  	  if(s[i]=='R')
  	  {
  	    cout<<"No";
		return 0;	
	  }
  }
  cout<<"Yes";
  return 0;
}


Measured memory_bytes: 256
package main

import (
    "fmt"
    "sort"
)

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

    var max int
    bs := make([]int, n)
    for i := 0; i < n; i++ {
        var a, b int
        fmt.Scan(&a, &b)
        bs[i] = b
        if a > max {
            max = a
        }
    }

    sort.Sort(sort.IntSlice(bs))

    var ok bool
    var sum int
    var cnt int
    for i := len(bs) - 1; i >= 0; i-- {
        if bs[i] <= max {
            continue
        }
        sum += bs[i]
        cnt++
        if sum >= hp {
            ok = true
            break
        }
    }
    if !ok {
        rest := hp - sum
        //fmt.Println(rest, hp, sum, max)
        if rest%max == 0 {
            cnt += int(rest / max)
        } else {
            cnt += int(rest/max) + 1
        }
    }
    fmt.Println(cnt)
}


Measured memory_bytes: 5504
import java.util.Arrays;

public class Main {

  private static void solve() {
    int n = ni();
    long[] a = nal(n);
    for (int i = 0; i < n; i ++) {
      a[i] -= i;
    }
    Arrays.sort(a);

    long[] sum = new long[n + 1];
    for (int i = 0; i < n; i ++) {
      sum[i + 1] = sum[i] + a[i];
    }
    
    long min = Long.MAX_VALUE;
    for (int i = 0; i < n; i ++) {
      long left = (i + 1) * a[i] - sum[i + 1];
      long right = sum[n] - sum[i] - (n - i) * a[i];
      min = Math.min(min, left + right);
    }
    System.out.println(min);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = System.getProperty("debug");
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

using i64 = long long;

const int N = 1e5 + 5;

i64 a[N];

i64 ant;
int n;

int main() {
#ifdef HOME
	freopen("agc3b.in", "r", stdin);
	freopen("agc3b.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

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

	for (int i = 2; i <= n; ++i) if ((a[i]) && (a[i - 1] & 1)) {
		ant+= 1;
		a[i]-= 1;
		a[i - 1]-= 1; }

	for (int i = 1; i <= n; ++i)
		ant+= a[i] / 2;

	cout << ant << endl;

	return 0; }


Measured memory_bytes: 1024
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n,k = map(int, input().split())
a = list(map(int, input().split()))

dp = [None]*(k+1)
dp[0] = 0
for i in range(1,k+1):
    s = set(range(n+1))
    for j in range(n):
        if i-a[j]>=0:
            s.discard(dp[i-a[j]])
    dp[i] = min(s)
if dp[k]==0:
    ans = "Second"
else:
    ans = "First"
print(ans)

Measured memory_bytes: 76104
s = str(input())

num = [int(s[-1])]
for i in range(1, len(s)):
    tmp = num[-1] + pow(10, i, 2019) * int(s[-i - 1])
    num.append(tmp % 2019)

mod = [1] + [0] * 2018
ans = 0
for i in num:
    ans += mod[i]
    mod[i] += 1
print(ans)


Measured memory_bytes: 76480
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <string>
#include <map>
#include <list>
using namespace std;

int main() {
  int a,b,k;
  cin >> a >> b >> k;

  int count=0;

  for(int i = 100; i >= 1; --i){
    if(a%i==0 && b%i==0){
      count++;
      if(count==k){
        cout << i << endl;
        return 0;
      }
    }
  }
}

// int main () {
// int A , B , K ; cin >> A >> B >> K ;
// for ( int i = min (A , B ); i >= 1; --i ) {
// if ( A % i == 0 && B % i == 0) {
// --K ;
// if ( K == 0) {
// cout << i << endl ;
// return 0;
// }
// }
// }
// assert ( false );
// }


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    string s;
    cin >> s;

    int ans = 0;

    REP(i,4) {
        if(s[i] == '+') ans ++;
        else ans --;
    }

    cout << ans << endl;
    
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    ll h;  cin >> h;
    ll count = 1;
    while(h != 1){
        count++;
        h /= 2;
    }
    vector<ll>dp(count);
    dp[0] = 1;
    rep(i, count - 1){
        dp[i+1] = 2*dp[i] + 1;
    }
    cout << dp[count-1] << endl;
}


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


public class Main {
    static long mod = 1000000000+7;
    static int n,a,b,k;
    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ");
        n = sc.nextInt(); k = sc.nextInt();
        System.out.println(n-k+1);

    }
}



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

int main() {
  string S ; 
  int N ; 
  cin >> N ; 
  int A , W , T , R ; 
  A = 0 ; 
  W = 0 ; 
  T = 0 ;
  R = 0 ;
  
  for (int i = 0 ; i<N ; i++ ){
    cin >> S ;
    
    if (S[0] == 'A'){
      A++ ; 
    }
    else if (S[0] =='W'){
      W++ ; 
    }
    else if (S[0] == 'T'){
      T++ ; 
    }
    else {
      R++ ; 
    }
      
  }
  
  cout << "AC " << "x " << A << endl ; 
  cout << "WA " << "x " << W << endl ; 
  cout << "TLE " << "x " << T << endl ; 
  cout << "RE " << "x " << R << endl ; 
  
  
  
  
  
  
  
  
}


Measured memory_bytes: 3600