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

int main(void) {
    int N,M, ans=0;
    cin >> N >> M;

    vector<int> s(M);
    vector<int> c(M);

    for(int i=0; i<M; i++) cin >> s[i] >> c[i];

    for(int i=0; i<1000; i++){
      int tmp = i/10;
      vector<int> a(1,i%10);
      while(tmp){
        a.push_back(tmp%10);
        tmp/=10;
      }
      reverse(a.begin(),a.end());
      if(a.size()!=N) continue;

      bool flag = true;
      for(int j=0; j<M; j++){
        if(a[s[j]-1]!=c[j])
          flag = false;
      }
      if(flag){
        cout << i << endl;
        return 0;
      }
    }
    cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
const int N=1e5+9;
int L[17][N],R[17][N],n,t,q,X[N],ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",X+i);
	scanf("%d",&t);
	for(int i=1,it=1;i<=n;++i){
		while(it<n&&X[it+1]-X[i]<=t)++it;
		R[0][i]=it;
	}
	for(int i=n,it=n;i;--i){
		while(it>1&&X[i]-X[it-1]<=t)--it;
		L[0][i]=it;
	}
	for(int i=1;i<17;++i)
	for(int j=1;j<=n;++j)
	R[i][j]=R[i-1][R[i-1][j]],L[i][j]=L[i-1][L[i-1][j]];
	for(scanf("%d",&q);q--;printf("%d\n",ans)){
		int x,y;ans=1;
		scanf("%d%d",&x,&y);
		if(x<=y){
			for(int i=16;~i;--i)
			if(R[i][x]<y)ans+=1<<i,x=R[i][x];
		}else{
			for(int i=16;~i;--i)
			if(L[i][x]>y)ans+=1<<i,x=L[i][x];
		}
	}
	return 0;
}

Measured memory_bytes: 14464
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cost[102]; 
int min(int a, int b){ return (a<b)? a: b;}
int main(){
    int N, M, X;
    scanf("%d %d %d",&N,&M,&X);
    memset(cost,0,sizeof(cost));
    for(int i = 1; i <= M; i++){
        int n;
        scanf("%d",&n);
        cost[n] = 1;
    } 
    int totcost_to_end = 0;
    for(int pos = X; pos <= N+1 ; pos++){
        totcost_to_end += cost[pos];
    }
    int totcost_to_top = 0;
    for(int pos = X; 0 <= pos ; pos--){
        totcost_to_top += cost[pos];
    }
    printf("%d\n",min(totcost_to_top,totcost_to_end));
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<int> ans(n);
	for (int i = 0; i < n;) {
		int l = 0;
		int r = 0;
		while (i < n && s[i] == 'R') {
			r++;
			i++;
		}
		int p1 = i-1;
		int p2 = i;
		while (i < n && s[i] == 'L') {
			l++;
			i++;
		}
		ans[p1] = dup(r, 2) + l / 2;
		ans[p2] = r / 2 + dup(l, 2);
	}

	rep(i,n) cout << ans[i] << " ";
	cout << endl;
}

Measured memory_bytes: 3816
s = input()

i = 0
while i < len(s):
    if s[i:i+11] == 'dreameraser':
        i += 11
    elif s[i:i+10] == 'dreamerase':
        i += 10        
    elif s[i:i+7] == 'dreamer':
        i += 7
    elif s[i:i+6] == 'eraser':
        i += 6
    elif s[i:i+5] == 'dream' or s[i:i+5] == 'erase':
        i += 5
    else:
        print('NO')
        exit()

print('YES')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main () {
double N;
cin>>N;
vector<int>a(N);
for(int i=0;i<N;i++){
  a[i]=i+1;
}
double count=0;
for(int i=0;i<N;i++){
  if(a[i]%2!=0){
    count++;
  }
}
cout<<count/N<<endl;

}


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

namespace IO {

	inline char gc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return (p1 == p2) && (p2 = (p1 = buf) +
			fread(buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
	}

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

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

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

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

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

}

using IO::wln;
using IO::read;

namespace Cesare {
	
	/*
		f[i][S] 表示当前走到 i ，走过的路径 
		状态为 S 最大可以保留的权值和。 
		每次转移枚举加入一个点集还是一个点。 
		这基于一个性质：每次加入的一个点或点集必定 
		只与一条简单路径上的一个点相连，所以不会影 
		响简单路径数量。 

		f[j][S | (1 << j - 1)] = max f[i][S] + w[i][j]) 

		now <- 包含 j 但不包含 S 的所有状态 
		f[j][S | now] = max f[i][S] + g[now] + d[i][now] 
	*/
	
	ll n, m, Max, w[N][N];
	ll g[(1 << 16) + 3], d[N][(1 << 16) + 3], f[N][(1 << 16) + 3];
	
	inline void Cmax ( ll &a, ll b ) { (a < b) && (a = b); }
	
	int main() {
		n = read(), m = read();
		for (int i = 1, u, v; i <= m; ++i) 
			u = read(), v = read(), w[u][v] = w[v][u] = read();
		
		Set (f, -1);
		f[1][1] = 0, Max = (1 << n) - 1;
		For ( S, 0, Max ) For ( i, 1, n ) 
			if (S & (1 << i - 1)) For ( j, 1, i ) 
				if ((i ^ j) && (S & (1 << j - 1))) g[S] += w[i][j];
		For ( S, 0, Max ) For ( i, 1, n ) 
			if (!(S & (1 << i - 1))) For ( j, 1, n ) 
				if ((S & (1 << j - 1))) d[i][S] += w[i][j];
		
		For ( S, 0, Max ) For ( i, 1, n ) 
			if (S & (1 << i - 1) && f[i][S] >= 0) {
				ll nowS = Max ^ S;
				for (int now = nowS; now; now = nowS & (now - 1)) 
					Cmax(f[i][S | now], f[i][S] + g[now] + d[i][now]);
				// 转移点集 
				for (int j = 1; j <= n; ++j) 
					if (!(S & (1 << j - 1)) && w[i][j]) 
						Cmax(f[j][S | (1 << j - 1)], f[i][S] + w[i][j]);
				// 转移点 
			}
		return wln(g[Max] - f[n][Max]), 0;
	}
	
}

int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	
	return Cesare :: main();
}

/*

*/






Measured memory_bytes: 20992
/*
{By GWj
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
#define int LL
using namespace std;
const LL INF=1e15;
typedef pair<int,int> mp;
/*}
*/
const int N=200000+20;
mp p[N];
signed main(){
	fastio;
	int n;
	R(n);
	rb(i,1,n){
		int x,y;
		R2(x,y);
		p[i]=II(x,y);
	}
	sort(p+1,p+1+n);
	LL best=-INF;
	LL rest=0; 
	rb(i,1,n){
		if(best!=-INF){
			check_max(rest,best+(LL)p[i].FIR+(LL)p[i].SEC);
		}
		check_max(best,-(LL)p[i].FIR-(LL)p[i].SEC);
	}
	best=-INF;
	rb(i,1,n){
		if(best!=-INF){
			check_max(rest,best+(LL)p[i].FIR-(LL)p[i].SEC);
		}
		check_max(best,-(LL)p[i].FIR+p[i].SEC);
	}
	cout<<rest<<endl;
	return 0;
}


Measured memory_bytes: 6740
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <deque>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+50;
const int inf=0x3f3f3f3f;
int n,k;
int a[200050];
bool vis[200050];
vector<int >g[200050];
void dfs(int t,int val)
{
    vis[t]=1;
    a[t]+=val;
    for(int i=0;i<g[t].size();i++)
    {
        int v=g[t][i];
        if(!vis[v])
        {
            dfs(v,a[t]);
        }
    }
}
int main()
{
    //freopen("/Users/zilongzhang/Desktop//l.txt","r",stdin);
       scanf("%d %d",&n,&k);
        for(int i=1;i<=n-1;i++) {
            int x, y;
            scanf("%d %d", &x, &y);
            x--;
            y--;
            g[x].push_back(y);
            g[y].push_back(x);
        }
        while(k--)
        {
            int l,b;
            scanf("%d %d",&l,&b);
            l--;
            a[l]+=b;
        }
        dfs(0,0);
        for(int i=0;i<n;i++)
            printf("%d ",a[i]);
    return 0;
}


Measured memory_bytes: 23680
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define per(i,b,a) for(int i=b; i>=a; i--)
#define pb push_back
#define fi first
#define se second
using namespace std ;
typedef pair<int, int> pi ;
typedef vector<pair<int,int> > vpi ;
typedef vector<int> vi ;
typedef long long ll ;
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
const int maxn = 2e5 + 5 ;
int n ;
int h[maxn], a[maxn] ;
ll dp[maxn] ;
int mn[maxn] ;
ll st[2*maxn] ;
void build()
{
   rep(i,n,2*n) st[i] = -inf ;
   rep(i,n-1,1)
    st[i] = max(st[i<<1], st[i<<1|1]);
}
void upd(int x, ll v)
{
    x += n ;
    st[x] = v ;
    for(x>>=1; x; x>>=1)
    {
        st[x] = max(st[2*x], st[2*x+1]) ;
    }
}
ll get_max(int l, int r)
{
    l += n ;
    r += n ;
    ll ret = -63 ;
    while(l < r)
    {
        if(l&1) ret = max(ret, st[l++]) ;
        if(r&1) ret = max(ret, st[--r]) ;
        l>>=1 ;
        r>>=1 ;
    }
    return ret ;
}
int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cin >> n ;
    rep(i,0,n-1)
    {
        cin >> h[i] ;
    }
    rep(i,0,n-1)
    {
        cin >> a[i] ;
    }
    dp[0] = a[0] ;
    upd(h[0],a[0]) ;
    rep(i,0,n-1)
    {
        int x = h[i] ;
        dp[i] = max(0ll,get_max(1,x)) + a[i] ;
        upd(x,dp[i]) ;
    }
    ll res = -63 ;
    rep(i,0,n-1)
    {
        res = max(res, dp[i]) ;
    }
    cout << res << "\n" ;
    return 0 ;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   int n;
   cin>>n;
  ll sum=0;
  for(int i=1;i<=n;i++)
  {
  	if(i%3==0&&i%5==0)
  	continue;
  	else if(i%3==0)
  	continue;
  	else if(i%5==0)
  	continue;
  	else
  	sum+=i;
  }
  cout<<sum<<endl;
return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}

int main(){

	ll n,a,b;
	cin>>n>>a>>b;

	ll ans=0;

	const ll MOD=1000000007;

	ans=mod_pow(2, n, MOD)-1;

	ans-=ncr(n,a,MOD);
	if(ans<0){
		ans+=MOD;
	}
	ans-=ncr(n,b,MOD);
	if(ans<0){
		ans+=MOD;
	}

	
	cout<<ans%MOD<<endl;

    return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int main(){
  vector<ll> beki(130);
  REP(i, 130){
    beki[i] = i*i;
  }
  int N, D;
  cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  REP(i, N){
    REP(j, D){
      cin >> X[i][j];
    }
  }
  int ans = 0;
  ll sum;
  REP(i, N){
    FOR(j, 0, i){
      sum = 0;
      REP(k, D){
        sum+=(X[i][k] - X[j][k])*(X[i][k]-X[j][k]);
      }
      if(binary_search(beki.begin(), beki.end(), sum)){
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
	int n;
	float ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		float x;
		string u;
		cin >> x >> u;
		if (u == "JPY") {
			ans += x;
		}
		else {
			ans += x * 380000.0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void)
{
	int a,i,b,c;
	for(a=1;a<=9;a++){
		for(b=1;b<=9;b++){
			c=a*b;
			printf("%dx%d=%d\n",a,b,c);
		}
	}
	return 0;
}

Measured memory_bytes: 524
fn main() {
    let mut o = String::new();
    std::io::stdin().read_line(&mut o).unwrap();
    let mut e = String::new();
    std::io::stdin().read_line(&mut e).unwrap();

    for (c, d) in o.trim().chars().zip(e.trim().chars()) {
        print!("{}{}", c, d);
    }
    if o.len() > e.len() {
        print!("{}", o.trim().chars().collect::<Vec<char>>().last().unwrap());
    }
    println!("");
}



Measured memory_bytes: 4352
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //b
  string odd = "RUD", even = "LUD";
  string s;
  cin >> s;
  for (int i = 0; i < (int) s.size(); i++) {
    if (s[i] == 'R') {
      if (i % 2) {
        cout << "No\n";
        return 0;
      }
    }
    if (s[i] == 'L') {
      if (i % 2 == 0) {
        cout << "No\n";
        return 0;
      }
    }
  }
  cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define forloop(n) for(int i = 0; i < n; i++)
int main(){
	string a; cin>>a;
	if(a == "SUN")
		cout<<7;
	if(a == "MON")
		cout<<6;
	if(a == "TUE")
		cout<<5;
	if(a == "WED")
		cout<<4;
	if(a == "THU")
		cout<<3;
	if(a == "FRI")
		cout<<2;
	if(a == "SAT")
		cout<<1;
	return 0;
}

Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    N,A,B=pin()
    cnt=0
    for i in range(1,N+1):
        temp=str(i)
        sum=0
        for s in str(i):
            sum+=int(s)
        
        if A<=sum and sum<=B:
            #print(sum)
            cnt+=i
    print(cnt)
#%%submit!
resolve()

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

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

  if (a == 1 && b == 2) {
    cout << '3' << endl;
  }
  else if (a == 2 && b == 1) {
    cout << '3' << endl;
  }
  else if (a == 1 && b == 3) {
    cout << '2' << endl;
  }
  else if (a == 3 && b == 1) {
    cout << '2' << endl;
  }
  else if (a == 2 && b == 3) {
    cout << '1' << endl;
  }
  else if (a == 3 && b == 2) {
    cout << '1' << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a, b;
	cin >> a >> b;
	cout << a*b << endl;
}

Measured memory_bytes: 3640
n = int(input())
Ps = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
  if (Ps[i] < Ps[i + 1] and Ps[i + 1] < Ps[i + 2]) or (Ps[i] > Ps[i + 1] and Ps[i + 1] > Ps[i + 2]):
     ans += 1
print(ans)


Measured memory_bytes: 61860
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  string s;
  cin >> s;
  bool ok1=false,ok2=false;
  if(s.size()%2==0)ok1=true;
  if(s[0]==s[s.size()-1])ok2=true;
  if(ok1^ok2)cout<<"Second"<<endl;
  else cout<<"First"<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}    

inline int add(int x,int y)
{
    return (x + y)%MOD;
}
 
inline int sub(int x,int y)
{
    return (x+MOD-y)%MOD;
}
 
inline LL mul(LL x,LL y)
{
    return (LL)x*y%MOD;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    LL N,M; cin >> N >>M;
    COMinit();

    LL ans = 1;

    auto pr = prime_factorize(M);
    for(auto p : pr)
    {
        LL qua = p.second;
        ans = mul(ans, COM(qua+N-1, N-1));
    }

    cout << ans << endl;

}


Measured memory_bytes: 12160
import java.util.Scanner;

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

        String n = sc.next();
        if (n.charAt(1) == n.charAt(2)) {
            if (n.charAt(0) == n.charAt(1) || n.charAt(2) == n.charAt(3)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}



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

using ll = long long int;
using P = std::pair<int, int>;

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

int main()
{
    int n;

    std::cin >> n;

    std::vector<int> ls(n);

    rep(i, n)
            std::cin >>
        ls[i];

    std::sort(ls.begin(), ls.end());

    int ans = 0;

    rep(i, n) for (int j = i + 1; j < n; ++j) for (int k = j + 1; k < n; ++k)
    {
        if (ls[i] + ls[j] > ls[k] && ls[i] != ls[j] && ls[j] != ls[k])
            ++ans;
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int open = A - 2 * B;

		if (open > 0) {
			System.out.println(open);
		} else {
			System.out.println(0);
		}

		sc.close();

	}

}

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

using namespace std;
typedef long long int lli;

const int NMAX = 1e3 + 5;
const int NMAX2 = 1e6 + 5;
lli n, m;
lli a[NMAX], b[NMAX], c[NMAX], dp[NMAX2];

void min_self(lli &a, lli b){
	a = min(a, b);
}

int main(){
	
	for(int j=0; j<NMAX2; j++)
		dp[j] = INT_MAX;
	
	dp[0] = 0;
	cin >> n >> m;
	for(int i=0; i<m; i++){
		cin >> a[i] >> b[i];
		for(int j=0; j<b[i]; j++){
			int x;
			cin >> x;
			c[i] += 1 << (x-1);
		}
		
		for(int j=(1<<n)-1; j>=0; j--){
			min_self(dp[j | c[i]], dp[j] + a[i]);
			//cerr << "dp: " << dp[j] << endl;
		}
	}
	
	cout << (dp[(1<<n)-1] == INT_MAX ? -1 : dp[(1 << n)-1]);
	
	//for(int i=0; i<=m; i++){
		for(int j=0; j<(1<<n); j++)
			//cerr << dp[j] << endl;
	//}
	
	return 0;
}


Measured memory_bytes: 8064
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return list(map(float, sys.stdin.readline().split()))
def LS():return sys.stdin.readline().split()
def SR(n): return [list(sys.stdin.readline())[:-1] for i in range(n)]
def IR(n): return [int(sys.stdin.readline()) for i in range(n)]
def LIR(n): return [list(map(int, sys.stdin.readline().split())) for i in range(n)]
def LSR(n): return [list(map(list, sys.stdin.readline().split())) for i in range(n)]
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
sys.setrecursionlimit(1000000)
INF = float('inf')
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

N = I()
A = LI()
B = LI()
ans = 0
left = 0
for i in range(N):
    if (A[i]<=B[i]+left): 
        ans += A[i]
        if (A[i]>=left): 
            left = B[i] -(A[i]-left)
        else:
            left = B[i]
    else:
        ans += B[i]+left
        left = 0
ans += min(left, A[-1])
print(ans)

Measured memory_bytes: 73444
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

int main(){
    // read in integer 
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a=0,b=0,c=0,sum=0,max=0,n=0,m=0;
		scanf("%d %d",&n,&m);
		for(int i=0;i<m;i++){
			scanf("%d %d",&a,&b);
			c=n-a;
			if(c>0){
				sum+=c;
			}
			if(c>max){
				max=c;
			}
		}
		printf("%d\n",sum-max);
		return 0;
}

Measured memory_bytes: 1808
#include <iostream>
#include <string>
#include <map>
#include <math.h>
using namespace std;

#define ll long long

int main(){
    int N,ans = 0;
    cin >> N;
    int V[N],C[N];
    for(int i = 0;i < N;i++)cin >> V[i];
    for(int i = 0;i < N;i++){
        cin >> C[i];
        if(V[i] > C[i])ans += V[i] - C[i];
    }
    cout << ans <<endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    bool lunlun = true;
    rep(i, 0, n)
    {
        int a;
        cin >> a;
        lunlun &= a % 2 == 0;
    }

    if (not lunlun)
        cout << "first" << endl;
    else
        cout << "second" << endl;

    return 0;
}

Measured memory_bytes: 256
s=input()
t=input()
ns,nt,nd=len(s),len(t),len(s)-len(t)
ans="z"*ns
flag=0
for i in range(nd+1):
  judge=True
  for j in range(nt):
    ss=s[i+j]
    tt=t[j]
    if ss!="?" and ss!=tt:
      judge=False
  if judge:
    Key=s[:i]+t+s[i+nt:]
    ans=min(ans,Key.replace("?","a"))
    flag=1
print(ans if flag==1 else "UNRESTORABLE")
    

Measured memory_bytes: 3064
package main

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

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	i := sc.Text()
	return i
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

type Dice struct {
	nums []int
}

func (d *Dice) rotate(direction string) {
	if direction == "W" {
		d.nums[0], d.nums[2], d.nums[5], d.nums[3] = d.nums[2], d.nums[5], d.nums[3], d.nums[0]
	}
	if direction == "E" {
		d.nums[0], d.nums[2], d.nums[5], d.nums[3] = d.nums[3], d.nums[0], d.nums[2], d.nums[5]
	}
	if direction == "N" {
		d.nums[0], d.nums[4], d.nums[5], d.nums[1] = d.nums[1], d.nums[0], d.nums[4], d.nums[5]
	}
	if direction == "S" {
		d.nums[0], d.nums[1], d.nums[5], d.nums[4] = d.nums[4], d.nums[0], d.nums[1], d.nums[5]
	}

}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	dice := Dice{
		make([]int, 6),
	}
	for i := 0; i < 6; i++ {
		dice.nums[i] = nextInt()
	}
	s := nextString()
	for _, a := range s {
		dice.rotate(string(a))
	}
	fmt.Println(dice.nums[0])
}



Measured memory_bytes: 1100
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X;
    cin >> X;
  int check=0;
  for(int64_t i=-120;i<121;i++){
	for(int64_t j=-120;j<121;j++){
      if(i*i*i*i*i-j*j*j*j*j==X && check<1){
        cout << i << ' ' << j<<endl;
        
         check++;
      }
    }
  }
}



Measured memory_bytes: 3636
// Problem : A - Don't be late
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize(3, "Ofast", "inline")
#include<iostream>
#define start ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(z, x, y) for(int z=x;z<=y;++z)
#define repd(z, x, y) for(int z=x;z>=y;--z)
typedef long long ll;
const int maxn = (ll) 2e5 + 5;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
using namespace std;
int main() { 
	start;
	int d,t,s;cin>>d>>t>>s;
	if(d<=t*s){
		cout<<"Yes";
	}else cout<<"No";
	return 0; 
}

Measured memory_bytes: 3124
import * as fs from "fs";
const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [M, D] = input[0].split(" ").map((x: string): number => +x);
var ret = 0;
for (var m = 1; m <= M; m++) {
    for (var d = 1; d <= D; d++) {
        var d1 = Math.floor(d / 10);
        var d2 = d % 10;
        // console.error(`${d1}, ${d2}, == ${m}`);
        if(d1 >= 2 && d2 >= 2 && d1 * d2 == m){
            ret += 1;
        }
    }
}

console.log(ret);

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

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

   string s;
   cin >> s;
   int len = s.size();
   int cnt = 0;

   for(int i = 0; i < len; i++){
    if(s[i] == 'A'){
        if(s[i+1] == 'B'){
            if(s[i + 2] == 'C'){
              cnt++;
            }
        }
    }
   }
   cout << cnt << endl;
   return 0;
}


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

using namespace std;

int main()
{
    int N;
    vector<long long> A;

    cin >> N;
    A.resize(N);
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<int>());

    long long maxConf = 0;

    maxConf += A[0];
    for (int i = 1; i <= (N - 2) / 2;i++){
        maxConf += 2 * A[i];
    }

    if(N%2 == 1){
        maxConf += A[(N - 2) / 2 + 1];
    }

    cout << maxConf << endl;
}

Measured memory_bytes: 4828
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

template <int64_t MOD>
class Modint {
  using Self = Modint<MOD>;

  int64_t m_value;

 public:
  Modint() : m_value(0) {}
  Modint(int64_t value) : m_value((value % MOD + MOD) % MOD) {}
  Self pow(int64_t e) const {
    if (e == 0) {
      return (Self)1;
    } else if (e % 2 == 0) {
      return ((*this) * (*this)).pow(e / 2);
    } else {
      return (*this).pow(e - 1) * (*this);
    }
  }
  Self inv() const { return pow(MOD - 2); }
  Self& operator=(const Self& rh) {
    m_value = rh.m_value;
    return *this;
  }
  Self operator-() const { return Self(-m_value); }
  Self operator+(const Self& other) const {
    return Self(m_value + other.m_value);
  }
  Self operator-(const Self& other) const {
    return Self(m_value - other.m_value);
  }
  Self operator*(const Self& other) const {
    return Self(m_value * other.m_value);
  }
  Self operator/(const Self& other) const { return (*this) * other.inv(); }
  Self& operator+=(const Self& rh) { return (*this) = (*this) + rh; }
  Self& operator-=(const Self& rh) { return (*this) = (*this) - rh; }
  Self& operator*=(const Self& rh) { return (*this) = (*this) * rh; }
  int64_t value() const { return m_value; }
};

int main() {
  int N, M;
  cin >> N >> M;

  using Mint = Modint<1'000'000'007>;

  vector<Mint> fact(M + 1);
  fact[0] = 1;
  rep(i, M) { fact[i + 1] = fact[i] * (i + 1); }

  Mint result = 0;
  irep(i, N) {
    Mint perm = fact[M - i] / fact[(M - i) - (N - i)];
    Mint perm2 = fact[M] / fact[M - i];
    Mint comb = fact[N] / fact[i] / fact[N - i];
    Mint term = Mint(-1).pow(i) * perm.pow(2) * perm2 * comb;
    result += term;
  }
  cout << result.value() << endl;
  return 0;
}

Measured memory_bytes: 6772
#include <iostream>
#include <algorithm>

using namespace std;

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

	if (b == 'H') cout << a << endl;
	else if (b == 'D') {
		if (a == 'H') cout << 'D' << endl;
		else if (a == 'D') cout << 'H' << endl;
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <map>
#define MOD 1000000007
typedef long long ll; 
inline int quick_pow(int a, int n)
{
	int res = 1; 
	while (n)
	{
		if (n & 1)
			res = (ll)res * a % MOD; 
		a = (ll)a * a % MOD; 
		n >>= 1; 
	}
	return res; 
}
std::map<int, int> idx_e[200005]; 
int lst[200005], to[400005], pre[400005], w[400005], tot; 
int st[200005], vis[200005], sz[200005], e, tp; 
int fact[200005], inv[200005], dp[200005], res; 
bool cyc, del[400005]; 
inline void add_edge(int u, int v, int _w)
{
	to[tot] = v; 
	pre[tot] = lst[u]; 
	w[tot] = _w; 
	idx_e[u][v] = tot; 
	lst[u] = tot++; 
}
void dfs(int u, int fa = -1)
{
	vis[u] = 1; 
	st[tp++] = u; 
	for (int i = lst[u]; ~i; i = pre[i])
	{
		int v = to[i]; 
		if (v == fa)
			continue; 
		if (vis[v] == 1)
		{
			e = i; 
			for (int j = tp - 2; j >= 0; j--)
			{
				int cur = idx_e[st[j]][st[j + 1]]; 
				if (w[cur] > w[e])
					e = cur;
				if (st[j] == v)
					break; 
			}
			if (cyc)
			{
				puts("0");
				exit(0); 
			}
			cyc = true; 
		}
		else if (!vis[v])
			dfs(v, u); 
	}
	vis[u] = 2; 
	tp--; 
}
void work(int u, int fae)
{
	sz[u] = 0; 
	dp[u] = 1; 
	for (int i = lst[u]; ~i; i = pre[i])
	{
		int v = to[i]; 
		if (i == fae || del[i])
			continue; 
		work(v, i ^ 1); 
		if (w[i] > w[fae])
			res = (ll)res * inv[sz[v]] % MOD * dp[v] % MOD; 
		else
		{
			sz[u] += sz[v]; 
			dp[u] = (ll)dp[u] * dp[v] % MOD * fact[sz[u]] % MOD * inv[sz[v]] % MOD * inv[sz[u] - sz[v]] % MOD; 
		}
	}
	sz[u]++; 
}
int main()
{
	// freopen("ARC083-F.in", "r", stdin); 
	memset(lst, -1, sizeof(lst)); 
	int n; 
	scanf("%d", &n);
	for (int i = 0; i < n << 1; i++)
	{
		int x, y; 
		scanf("%d%d", &x, &y); 
		x--; 
		y--; 
		add_edge(x, y + n, x + y); 
		add_edge(y + n, x, x + y); 
	}
	n <<= 1; 
	fact[0] = inv[0] = 1; 
	for (int i = 1; i <= n; i++)
	{
		fact[i] = (ll)fact[i - 1] * i % MOD; 
		inv[i] = quick_pow(fact[i], MOD - 2); 
	}
	int ans = fact[n]; 
	for (int i = 0; i < n; i++)
	{
		if (vis[i])
			continue; 
		cyc = false; 
		dfs(i, 0); 
		del[e] = del[e ^ 1] = true; 
		int sum = 0; 
		res = 1; 
		work(to[e], e ^ 1); 
		sum += (ll)inv[sz[to[e]]] * dp[to[e]] % MOD * res % MOD; 
		res = 1; 
		work(to[e ^ 1], e); 
		sum += (ll)inv[sz[to[e ^ 1]]] * dp[to[e ^ 1]] % MOD * res % MOD; 
		ans = (ll)ans * sum % MOD;
	}
	printf("%d\n", ans);
	return 0; 
}


Measured memory_bytes: 44544
#gcdは3.4.3だとfractionsにある
from fractions import gcd

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n,k = mi()
    muki = input()
    muki = 'r'+muki+'l'
    ans = 0
    for i in range(1,n+1):
        if muki[i] == 'L':
            if muki[i-1] == 'L':
                ans+=1
        if muki[i] == 'R':
            if muki[i+1] == 'R':
                ans+=1
    ans+=2*k

    ans = min(ans,n-1)
    print(ans)


main()


Measured memory_bytes: 13808
#include <set>
#include <queue>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
const int maxv = 5050;
ll m,n,s,t,u,v,ca,co;
ll mm,mf;
ll dist[maxv],inq[maxv],prevv[maxv],preve[maxv];
struct edge{ll to,ca,cost,rev;};
vector<edge> G[maxv];
void add_edge(ll u,ll v,ll ca,ll co){
    G[u].push_back((edge){v,ca,co,(int)G[v].size()});
    G[v].push_back((edge){u,0,-co,(int)G[u].size()-1});
}
ll inf = 1e16;
int main(){
  	s = 1;t = 2;
	int allo = 3;
  	int t1 =allo++,t2 = allo++,t3 = allo++,t4 = allo++;
	
	read(n);
	for(int i=0;i<n;i++){
		ll rx,ry,rc;
		read(rx);read(ry);read(rc);
		add_edge(s,allo,rc,0);
		add_edge(allo,t1,rc,1e10-(rx+ry));
		add_edge(allo,t2,rc,1e10-(-rx+ry));
		add_edge(allo,t3,rc,1e10-(rx-ry));
		add_edge(allo,t4,rc,1e10-(-rx-ry));
		allo+=1;
	}
	for(int i=0;i<n;i++){
		ll rx,ry,rc;
		read(rx);read(ry);read(rc);
		add_edge(t1,allo,rc,1e10+(rx+ry));
		add_edge(t2,allo,rc,1e10+(-rx+ry));
		add_edge(t3,allo,rc,1e10+(rx-ry));
		add_edge(t4,allo,rc,1e10+(-rx-ry));
		add_edge(allo,t,rc,0);
		allo+=1;
	}
    while(1){
        queue<int> que;
        for(int i=0;i<=allo;i++)dist[i] = inf;
		memset(inq,0,sizeof(inq));
        dist[s] = 0;
        que.push(s);
        inq[s] = 1;
        while(!que.empty()){
            int cur = que.front();
            que.pop();
            inq[cur] = 0;
            for(int i=0;i<G[cur].size();i++){
                edge cw = G[cur][i];
                if(cw.ca<=0)continue;
                if(dist[cw.to]>cw.cost+dist[cur]){
                    dist[cw.to] = cw.cost+dist[cur];
                    prevv[cw.to] = cur;
                    preve[cw.to] = i;
                    if(!inq[cw.to]){
                        que.push(cw.to);
                        inq[cw.to] = 1;
                    }
                }
            }
        }
        //cout<<dist[t]<<endl;
        if(dist[t]==inf)break;
        ll md = inf,di = 0;
        for(int p = t;p!=s;p = prevv[p]){
            md = min(md,G[prevv[p]][preve[p]].ca);
            di += G[prevv[p]][preve[p]].cost;
        }
        mm+=di*md;
        mf+=md;
        for(int p = t;p!=s;p = prevv[p]){
            G[prevv[p]][preve[p]].ca-=md;
            G[G[prevv[p]][preve[p]].to][G[prevv[p]][preve[p]].rev].ca+=md;
        }
    }
    cout<<mf*20000000000-mm<<endl;
    return 0;
}




Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'R' || s.charAt(i) == 'L') {
				if (i % 2 == 1 && s.charAt(i) != 'L') {
					System.out.println("No");
					return;
				} else if (i % 2 == 0 && s.charAt(i) != 'R') {
					System.out.println("No");
					return;
				}
			}

			sc.close();
		}

		System.out.println("Yes");

	}
}


Measured memory_bytes: 35820
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#define INF 1.0e9
using namespace std;
typedef long long ll;

int X, Y;

int main() {
    cin >> X >> Y;
    cout << X + Y/2 << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
                            
#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);
 
#define f first
#define s second
 
#define inf (int)1e9 + 7
 
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
 
#define mp(x,y) make_pair(x,y)
 
#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)
 
#define pb push_back
#define ppb pop_back
 
#define bitcoin __builtin_popcount
 
#define endl "\n"
 
#define in(x) insert(x)
 
#define sz(x) (int)x.size()
 
#define all(x) x.begin(),x.end()
 
#define pw2(x) (1ll<<x) //2^x
 
#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)
 
#define sqr(x) ((x) * 1ll * (x))
 
#define UpdateRandom srand (time(NULL));
 
#define int ll

using namespace std;
 
const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;

int n,ans=1,cnt=1;
int a[N];

 main(){
		
	NFS
	
	bool found=0;

	cin >> n;
	
	for(int i=1;i<=n;i++){
		cin >> a[i];
	}
	
	sort(a+1,a+n+1);
	
	for(int i=1;i<=n;i++){
		if(((long double)ans/(long double)1e18)*(long double)a[i]>(long double)1.0){
			cout << -1 << endl;
			ioi
		}
		ans*=a[i];
	}
	
	cout << ans << endl;
	
	ioi
}

Measured memory_bytes: 4428
/**
class cfmaster {
 struct code {
   see the details down there
 };
};
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  for (int i = 0; i < (int) s.size(); i++) {
    cout << 'x';
  }
  cout << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
map<string,ll>mp;
map<ll,ll>mpp;
int main()
{
  ll n,m,i,j,k,s=0;

  string str;

  cin>>str;

  if(str=="ARC")cout<<"ABC"<<endl;
  else cout<<"ARC"<<endl;
}


Measured memory_bytes: 3600
import math

bingo_card = []
for i in range(3):
    bingo_card.append(list(map(int, input().split())))
    
num = int(input())

numbers = []
for i in range(num):
    numbers.append(int(input()))

position = []
for i in numbers:
    for j, column in enumerate(bingo_card):
        for k, num in enumerate(column):
            if i == num:
                position.append([j, k])

def main():
    for i in range(3):
        column_cnt = len(list(filter(lambda x : x[0] == i , position)))
        if (column_cnt == 3):
            return True
    
    for i in range(3):
        column_cnt = len(list(filter(lambda x : x[1] == i , position)))
        if (column_cnt == 3):
            return True
    
    x_1 = 0    
    for i in position:
        if (i == [0,0] or i == [1,1] or i == [2,2]):
            x_1 += 1
    
    if(x_1 == 3):
        return True
        
    x_2 = 0    
    for i in position:
        if (i == [0,2] or i == [1,1] or i == [2,0]):
            x_2 += 1
    
    if(x_2 == 3):
        return True
    
    return False

result = main()
if (result):
    print("Yes")
else:
    print("No")



Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){ return (y != 0 ? gcd(y, x % y) : x); }
//最小公倍数
lol lcm(lol x, lol y){ return ((x * y) / gcd(max(x, y), min(x, y))); }

lol Pow(lol x, lol n){
  lol res = 1;
  while(n > 0){
    if(n & 1){
      res = res * x % MOD;
    }
    x = x * x % MOD;
    n = (n >> 1);
  }
  return res;
}

lol nCr(int n, int r){
  lol nPr = 1, R = 1;
  reps(i, r){
    R = (R * i) % MOD;
    nPr *= (n - i + 1);
    nPr %= MOD;
  }
  return nPr * Pow(R, MOD - 2) % MOD;
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  lol n, a, b;
  cin >> n >> a >> b;
  lol ans = (Pow(2, n) - 1 + MOD) % MOD;
  ans = (ans - nCr(n, min(a, n - a)) + MOD) % MOD;
  ans = (ans - nCr(n, min(b, n - b)) + MOD) % MOD;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a = 0;
	int b[100];
	int s = 0;
	for (int i = 0; i < 100; i++)
	{
		b[i] = 0;
	}
	while (cin >> a)
	{
		b[a]++;
	}
	for (int i = 0; i < 100; i++)
	{
		if (b[i] > s)
		{
			s = b[i];
		}
	}
	for (int i = 0; i < 100; i++)
	{
		if (b[i] == s)
		{
			cout << i << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3032
# dp[i][k] := 先頭i桁を13で割った余りがkとなるものの個数 or
# dp[i][k] := 先頭i桁（残りはすべて0）を13で割った余りがkとなるものの個数
# どちらが良いか?
# 後者で。
# 先頭からでも下位からでもアルゴリズムは同じはず。下位からのほうが添え字が見やすい。
# →尺取っぽくやるのは下位の桁を追加したときだ。上位から決めないとダメじゃね?
# →前者じゃないとダメか。

# 配るDP
# 桁dがあれば：dp[i+1][k+ (d * 10 ** a)% 13] = dp[i][k]
# 桁が?ならば：10通りあるから10回配る? dp[i+1][k+ (d * 10 ** a)% 13] = dp[i][k]
# 10^5 * 10 * 13は無理じゃない?
# 全体-残り3つとして、+-しながら管理　（これができるのは1の桁の場合だけ）

s = input()
l = len(s)
dp = [[0 for _ in range(13)] for _ in range(l+1)]
dp[0][0] = 1
temp = [0] * 13
summ = 1
mod = 10 ** 9 + 7

for i in range(0, l):
    if s[i] != '?':
        for k in range(13):
            dp[i+1][(k*10+int(s[i])) % 13] = dp[i][k]
    else:
        # ?の場合
        for k in range(13):
            temp[(k*10) % 13] = dp[i][k]
        
        excluded = temp[1] + temp[2] + temp[3]
        for k in range(13):
            dp[i+1][k] = (summ - excluded) % mod
            excluded -= temp[(k+1)%13]
            excluded += temp[(k+4)%13]

        summ *= 10
        summ %= mod

print(dp[l][5])
# print(dp)            




Measured memory_bytes: 66140
#include <bits/stdc++.h>
 
using namespace std;
 
 
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d %d", &a, &b)
#define siii(a, b, c) scanf("%d %d %d", &a, &b, &c)
 
#define sl(a) scanf("%I64d", &a)
#define sll(a, b) scanf("%I64d %I64d", &a, &b)
#define slll(a, b, c) scanf("%I64d %I64d %I64d", &a, &b, &c)
 
#define outi(a) printf("%d\n", a)
#define outii(a, b) printf("%d %d\n", a, b)
#define outiii(a, b, c) printf("%d %d %d\n", a, b, c)
 
#define outl(a) printf("%I64d\n", a)
#define outll(a, b) printf("%I64d %I64d\n", a, b)
#define outlll(a, b, c) printf("%I64d %I64d %I64d\n", a, b, c)
 
#define cel(n, k) ((n-1)/k+1)
#define sets(a) memset(a, -1, sizeof(a))
#define clr(a) memset(a, 0, sizeof(a))
 
 
#define fr(i, n) for(ll i=0; i<n;i++)
#define fr1(i, n) for(ll i=1; i<=n;i++) 
 
#define readf(f) freopen(f, "r", stdin)
#define writef(f) freopen(f, "w", stdout)
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
 
template< class T > T sq(T x) { return x * x; }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
typedef long long ll;
typedef pair<int,int> pii;
 
const int N = 2e5+5;
 
int main()
{
 	
 	//readf("in.txt");
	int n, a[N], cnt = 0, ind = 1;

	si(n);
 	
 	fr(i,n)si(a[i]);

 	fr(i,n){
 		if(a[i] == ind)
 			ind++;
 		else
 			cnt++;
 	}

 	if(cnt==n)
 		puts("-1");
 	else
		outi(cnt);

 
    return 0;
}

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

using namespace std;

int main()
{
   string s;
  cin>>s;
  
  if(s[2]==s[3] && s[4]==s[5])
  {
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
  return 0;
}

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

int main() {
    int a,p;
    cin >> a >> p;
    cout << (3*a+p)/2 << endl;

}

Measured memory_bytes: 256
def resolve():
	n = int(input())
	a = [0] + list(map(int, input().split())) + [0]
	s = 0
	for i in range(len(a)-1):
		s += abs(a[i+1] - a[i])
	for i in range(1, len(a)-1):
		ta = abs(a[i+1] - a[i-1])
		tb = abs(a[i] - a[i-1]) + abs(a[i+1] - a[i])
		print(s - (tb-ta))
resolve()

Measured memory_bytes: 14048