akhauriyash/Code-Regression huggingface dataset:
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N;
	cin >> N;
	string s[N];
	for (ll i = 0; i < N; ++i) cin >> s[i];
 
	// 解法
	ll BX = 0;
	ll BA = 0;
	ll XA = 0;
	ll AB = 0;
	REP(i,N){
		if (s[i][0]=='B' & s[i][s[i].size()-1]=='A') BA++;
		if (s[i][0]=='B' & s[i][s[i].size()-1]!='A') BX++;
		if (s[i][0]!='B' & s[i][s[i].size()-1]=='A') XA++;
		REP(j,s[i].size()-1){
			if (s[i].substr(j,2)=="AB") AB++;
		}
	}
	// printf("BX: %lld\n", BX);
	// printf("BA: %lld\n", BA);
	// printf("XA: %lld\n", XA);
	// printf("AB: %lld\n", AB);
	
	ll ans;
	if (BX==0 & XA==0 & BA==0) ans = AB;
	else if (BX==0 & XA==0 & BA!=0) ans = AB + BA - 1;
	else if (BA==0) ans = AB + min(BX, XA);
	else ans = AB + BA + min(BX, XA);
	
	//出力
	cout<<ans<<endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <map>
#include <iomanip>
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long long a, long long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long long a, long long b){
	return a / gcd(a,b) * b;
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;
 
int n;
int a[112345];
 
int main(){
	cin >> n;
	
	REP(i,n){
		int num;
		cin >> num;
		
		num--;
		
		a[num] = i+1;
	}
	
	REP(i,n) cout << a[i] << " ";
	
	puts("");
	
	return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    map<char, int> mp;
    rep(i,h)rep(j,w){
        char c;
        cin >> c;
        ++mp[c];
    }
    int four = (h/2)*(w/2);
    int two = (h*w - four * 4) / 2;
    int f = 0, t = 0;
    for(auto p : mp){
        int num = p.second;
        f += num / 4;
        num %= 4;
        t += num / 2;
    }
    bool yes = true;
    if(f < four) yes = false;
    else f -= four;
    t += f * 2;
    if(t < two) yes = false;
    cout << (yes ? "Yes" : "No") << endl;
    return 0;
}


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

const int mod = 1000000007;

int main() {
    int a,b;
    cin >> a >> b;
    int ans = -1;
    for (int i = 0; i < 100000; i++) {
      int c = i * 0.08;
      int d = i * 0.1;
      if(c==a&&d==b){
        ans = i;
        break;
      }
    }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
	ll cost;
};
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 2.0 * asin(1.0);
const ll INF = 1L<<60;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/
/****** define variable start ******/
ll n, m;
vll G;
/******* define variable end *******/
int solve() {
	cin >> n >> m;
	G.resize(n);
	REP(i, m){
		ll a, b;
		cin >> a >> b;
		G[a-1].push_back(b-1);
		G[b-1].push_back(a-1);
	}
	REP(i, n){
		cout << G[i].size() << endl;
	}
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


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

using namespace std;
using ll  = long long;
using ii  = pair < int , int >;
using i3  = pair < int , ii >;
using vi  = vector < int >;
using vii = vector < ii >;
using vi3 = vector < i3 >;

const int N = 2e5 + 5;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int n , m;

void solve(){
    char s[5];
    scanf("%s" , s);

    for(int i = 1 ; s[i] ; i ++){
        if(s[i] == s[i-1]){
            printf("Bad\n");
            return;
        }
    }
    printf("Good\n");


}

main(){
    int t = 1;
    //scanf("%d" , &t);

    while( t -- ){
            solve();
    }

    return 0;
}




Measured memory_bytes: 256
import numpy as np
from collections import deque
infinity = -10**5
H,W = map(int,input().split())

A = np.zeros((H+1,W+1))

for i in range(H):
    s = input()
    for j in range(W):
        if s[j] == ".":
            A[i][j] = 1
        else:
            A[i][j] = -1
#print(A)
N = H*W
G=[[] for i in range(N)]

for i in range(H):
    for j in range(W):
        if A[i][j] ==1:
            if A[i+1][j] == 1:
                G[W*(i+1)+j].append(W*i+j)
                G[W*i+j].append(W*(i+1)+j)

            if A[i][j+1] == 1:
                G[W*i+(j+1)].append(W*i+j)
                G[W*i+j].append(W*i+(j+1))

def BFS (s):
    queue = deque()
    d = [infinity]*N
    
    queue.append(s)
    d[s]= 0
    
    while len(queue)!=0:
      u = queue.popleft()
      for v in G[u]:
      	if d[v] == infinity:
        	d[v] = d[u]+1
        	queue.append(v) 	  
  
    return d

ans = 0

"""
for i in range(N):
    I = i//W
    J = i%W
    if A[I][J] == 1:
        d = BFS(i)
        for k in range(N):
            if d[k] == infinity:
                d[k] = -1
        ans = max(ans,max(d))
"""

for i in range(H):
    for j in range(W):
        if A[i][j] == 1:
            d = BFS(W*i+j)
            ans = max(ans,max(d))

print(ans)

    


Measured memory_bytes: 12512
#include <bits/stdc++.h>  // ver2.2.9
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,k) upper_bound(ALL(a),k)-lower_bound(ALL(a),k)
#define BIGGER(a,k) a.end()-upper_bound(ALL(a),k)
#define SMALLER(a,k) lower_bound(ALL(a),k)-a.begin()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){if(!a[lY].empty()){Vout(a[lY]);}else cout<<endl;}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(J,0,a.size()){if(!a[J].empty()){Verr(a[J]);}else cerr<<'.'<<endl;}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int scomb(int n, int r){  //  nCr (小さい場合)
int a=1;for(int i=n;i>n-r;--i){a=a*i;}for(int i=1;i<r+1;++i){a=a/i;}return a;}
int comb(int n, int r){  //  nCr (%MOD)
int a=1;for(int i=n;i>n-r;--i){a=a*i%MOD;}for(int i=1;
i<r+1;++i){a=a*mypow(i,MOD-2,MOD)%MOD;}return a%MOD;}
int stpow(int n){  //  階乗(%MOD)
if(n==0)return 1;int a=1;rep(i,1,n+1)a=a*i%MOD;return a;}
Vi stpowV(){Vi a(100001);  //  階乗配列(%MOD)
a[0]=1;repeq(i,1,100000)a[i]=a[i-1]*i%MOD;return a;}
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n;
  cin >> n;
  Vi ans(3);
  Vi memo(3);
  int qw,as,zx;
  
  rep(i,0,n){
    cin >> qw >> as >> zx;
    memo[0] = max(ans[1]+qw,ans[2]+qw);
    memo[1] = max(ans[0]+as,ans[2]+as);
    memo[2] = max(ans[1]+zx,ans[0]+zx);
    ans = memo;
  }
  cout << *max_element(ALL(ans)) << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int[] t = new int[N];
		sc.fill(t);

		long X = T;
		for (int i = 1; i < N; i++) {
			X += T;
			X -= Math.max(0, T - (t[i] - t[i - 1]));
		}

		System.out.println(X);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b, int[] c) throws IOException {
			if (a.length != b.length || b.length != c.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
				c[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}


Measured memory_bytes: 21332
/******************************************
* AUTHOR : GURUTEJA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second


  int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int n;
    cin>>n;
     long long int a[n],cons=1000000000+7,s=0,ans=0;
    for(int i=0; i<n; i++){
    	cin>>a[i];
    }
    s=0;
    for(int i=n-1; i>=0; i--){
       ans+=a[i]*s;
       s+=a[i];
       ans%=cons;
       s%=cons;
    }
    cout<<ans<<endl;
    return 0;
  }

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

ll dx[] = {0, 0, 1, -1};
ll dy[] = {1, -1, 0, 0};

int main()

{

    ll n, m, x;cin >> n >> m >> x;
    ll ans1 = 0, ans2 = 0;
    map<ll,ll> ma;
    for(ll i = 0; i < m; i++)
    {

        ll x;
        cin >> x;
        ma[x] = 1;
    }
    for(ll i = 0; i <= x; i++)
    {

        if(ma[i]) ans1++;
    }
    for(ll i = x; i <= n; i++)
        if(ma[i]) ans2++;
    cout << min(ans1,ans2);
}


Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<int>;

const int MOD = 1000000007;

int H, W;

bool check(int i,int j,mat & room)
{
	if (i < 0 || j < 0)return false;
	if (i >= H)return false;
	if (j >= W)return false;
	return room[i][j]==0;
}

int main()
{
	string S;
	cin >> S;
	int MOD = 1000000007;
	vec F(S.length());
	vec T(S.length());

	F[0] = (S[0] == 0) ? 1 : 2;
	T[0] = 1;
	for (int i = 1; i < S.length(); ++i)
	{
		T[i] = (T[i - 1] * 3) % MOD;
		if (S[i] == '1')
		{
			F[i] = (2 * F[i - 1]) % MOD;
		}
		else
		{
			F[i] = F[i - 1];
		}
	}

	ll ans = 0;
	ans += F[S.length() - 1];
	for (int i = S.length() - 1; i >= 0; --i)
	{
		if (S[i] == '0')continue;
		ll tmp = 1;
		if (i != 0)
			tmp *= F[i - 1];
		tmp = (tmp * T[S.length() - 1 - i]) % MOD;
		
		ans = (ans + tmp) % MOD;
	}
	cout << ans << endl;

	
	return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

template<typename T> struct comb {
	T n,k;
	LL numerator = 1;   //分子
	LL denominator = 1; //分母
	LL ans = 1;
	comb(T a, T b) : n(a), k(b) {set_nd();}

	// function
	/// 分子分母の設定
	void set_nd() {
		for (T i = 0, j = n; i < k; i++,j--) {
			numerator *= j;
			numerator %= MOD;
		}
		for (T i = 1; i < k + 1; i++) {
			denominator *= i;
			denominator %= MOD;
		}
	}
	/// a^b%pの計算
	LL calcInv(LL a,LL b,LL p) {
		if (b == 0) {
			return 1;
		}
		if (b % 2 == 0) {
			LL d = calcInv(a,b/2,p);
			return (d*d)%p;
		}
		return (a * calcInv(a,b-1,p)) % p;
	}

	LL getans() {
		denominator = calcInv(denominator,MOD-2,MOD);
		return (numerator * denominator) % MOD;
	}

};

int main(int argc, char const* argv[])
{
	LL n;
	cin >> n;
	map<char,int> mp;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		if (s[0] == 'M' or s[0] == 'A' or s[0] == 'R' or s[0] == 'C' or s[0] == 'H') {
			mp[s[0]]++;
		}
	}
	LL ans = 0;
	VL cmb{0,0,1,1,1};
	VL sel{'M','A','R','C','H'};
	do {
		LL tmp = 1;
		for (int i = 0; i < 5; i++) {
			if (cmb[i]) {
				tmp *= mp[sel[i]];
			}
		}
		ans += tmp;
	} while (next_permutation(cmb.begin(),cmb.end()));
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;


int main (){
  int n, m; cin >> n >> m;
  vector<vector<int>> vr(m,vector<int>(2, 0));
  for(int i = 0; i < m; i++){
    cin >> vr[i][0] >> vr[i][1];
  } 
  
  int cnt = 0;
  for(int i = 0; i < m; i++){
    vector<bool> conect(n+1, false);
    int x = vr[i][0]; int y = vr[i][1];
    vr[i][0] = 0; vr[i][1] = 0;
    vector<vector<int>> v(n+1,vector<int>(0));
    for(int j = 0; j < m; j++){
    v[vr[j][0]].push_back(vr[j][1]);
    v[vr[j][1]].push_back(vr[j][0]);
    }

    conect[1] = true;
    for(int l = 1; l <= n; l++){
    for(int j = 1; j <= n; j++){
      for(int k = 0; k < v[j].size(); k++){
        if(conect[j]){conect[v[j][k]] = true;}
      }
    }
    }
    

    bool f = false;
    for(int j = 1; j <= n; j++){
      if(!conect[j]){f = true; break;}
    }
    if(f){cnt++;}
    vr[i][0] = x; vr[i][1] = y;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
S = input()
N = len(S)-1
ans = 0

for i in range(2**N):
  tmp = S[0]
  for j in range(N):
    if (i>>j) & 1:
      ans += int(tmp)
      tmp = S[j+1]
    else:
      tmp += S[j+1]
  ans += int(tmp)
print(ans)

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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0};
int dy[] = {0,1,0,-1};

int main() {
	int n,m;
	cin >> n >> m;
	ll ken[n],ans[m],ans2[m];
	t3_ll si[m];
	for (int i = 0;i < n;i++) {
		ken[i] = 1;
	}
	for (int i = 0;i < m;i++) {
		get<0>(si[i]) = i;
		cin >> get<1>(si[i]) >> get<2>(si[i]);
	}
	sort(si,si+m,[](const t3_ll& x,const t3_ll& y) {return get<2>(x) < get<2>(y);});
	for (int i = 0;i < m;i++) {
		ans[i] = 1000000 * get<1>(si[i]) + ken[get<1>(si[i])-1];
		ken[get<1>(si[i])-1]++;
	}
	for (int i = 0;i < m;i++) {
		ans2[get<0>(si[i])] = ans[i];
	}
	for (int i = 0;i < m;i++) {
		cout << setw(12) << setfill('0') << ans2[i] << endl;
	}
}

Measured memory_bytes: 6144
fn main() {
    proconio::input! {
        x: i32,
        n: usize,
        mut p: [i32;n],
    }
    p.sort();
    for i in 0..=n as i32 {
        for k in &[x-i,x+i] {
            if let Err(_)=p.binary_search(k) {
                println!("{}",k);
                return;
            }
        }
    }
}

Measured memory_bytes: 2192
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let k: usize = sc.read();
    let s = sc.chars();
    for i in 0..n {
        if i + 1 == k {
            let c = s[i] as u8 - 'A' as u8;
            let d = ('a' as u8 + c) as char;
            print!("{}", d);
        } else {
            print!("{}", s[i]);
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<string> g(n);
  for (int i = 0; i < n; i++) {
    cin >> g[i];
  }
  vector<vector<int>> gv(n, vector<int>(m));
  vector<vector<int>> ge_l(n, vector<int>(m)), ge_u(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (g[i][j] == '1') {
        gv[i][j] = 1;
        if (j - 1 >= 0 && g[i][j - 1] == '1') {
          ge_l[i][j]++;
        }
        if (i - 1 >= 0 && g[i - 1][j] == '1') {
          ge_u[i][j]++;
        }
      }
      gv[i][j] += (j - 1 < 0 ? 0 : gv[i][j - 1]) + (i - 1 < 0 ? 0 : gv[i - 1][j]) - (i - 1 < 0 || j - 1 < 0 ? 0 : gv[i - 1][j - 1]);
      ge_l[i][j] += (j - 1 < 0 ? 0 : ge_l[i][j - 1]) + (i - 1 < 0 ? 0 : ge_l[i - 1][j]) - (i - 1 < 0 || j - 1 < 0 ? 0 : ge_l[i - 1][j - 1]);
      ge_u[i][j] += (j - 1 < 0 ? 0 : ge_u[i][j - 1]) + (i - 1 < 0 ? 0 : ge_u[i - 1][j]) - (i - 1 < 0 || j - 1 < 0 ? 0 : ge_u[i - 1][j - 1]);
    }
  }
  auto range = [&](const vector<vector<int>>& gv, int x1, int y1, int x2, int y2) {
    return gv[x2][y2] - (x1 - 1 < 0 ? 0 : gv[x1 - 1][y2]) - (y1 - 1 < 0 ? 0 : gv[x2][y1 - 1])
     + (x1 - 1 < 0 || y1 - 1 < 0 ? 0 : gv[x1 - 1][y1 - 1]);
  };
  while (q--) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    int v = range(gv, x1, y1, x2, y2);
    int e = range(ge_u, x1 + 1, y1, x2, y2) + range(ge_l, x1, y1 + 1, x2, y2);
    cout << v - e << '\n';
  }
  return 0;
}

Measured memory_bytes: 53248
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>

using namespace std;
int main() {
	int n,m,l,p;
	cin >> n;
	bool a[n][n];
	for ( int i = 0;i < n;i++) {
		for(int j= 0; j < n;j++) {
			a[i][j] = 0;
		}
	}
	for (int i = 0;i < n; i++){
		cin >> m;
		cin >> l;
		for(int j = 0; j < l;j++) {
			cin >> p;
			a[m-1][p-1] = 1;
		}
	}
	for ( int i = 0;i < n;i++) {
		for(int j= 0; j < n-1;j++) {
			cout << a[i][j] << " ";
		}
		cout << a[i][n-1] << endl;
	}
}
		

Measured memory_bytes: 1168
# Aizu Problem 00127: Pocket Pager Input
#
import sys, math, os, copy

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


code = {1: "afkpuz", 2: "bglqv.", 3: "chmrw?", 4: "dinsx!", 5: "ejoty "}

def pocket_pager(string):
    if len(string) % 2 == 1:
        return "NA"
    res = ""
    for k in range(len(string) // 2):
        i = int(string[2*k])
        j = int(string[2*k+1])
        if not 1 <= i <= 6 or not 1 <= j <= 5:
            return "NA"
        res += code[j][i-1]
    return res


for line in sys.stdin:
    print(pocket_pager(line.strip()))

Measured memory_bytes: 8160
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
	int a[N],flag[N];
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		int k;
		cin>>k;
		for(int j=0;j<k;j++)
		{
			cin>>a[i];
			flag[a[i]]++;
		}
	}
	int ans=0;
	for(int i=1;i<=40;i++)
	{
		if(flag[i]==n)ans++;
	}
	cout<<ans;
	return 0;
}


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

long long ans,j,i,a,b,k,arr1[2000000], arr2[2000000], sum1, sum2, jumlah,best;
int main(){
	cin >> a >> b >> k;
	for(i=1; i<=a; i++){
		cin >> arr1[i];
	}
	for(i=1; i<=b; i++){
		cin >> arr2[i];
		sum2 += arr2[i];
		jumlah = sum2;
	}
	best = b;
	sum2 = jumlah;
	for(i=0; i<=a; i++){
		//sum2 = jumlah;
		sum1 += arr1[i];
		if(sum1 > k) break;
		
		for(j=best; j>=0; j--){
			if(sum2 > k-sum1){
				sum2 -= arr2[j];
				
			} else {
				best = j;
				ans = max(ans, i+j);
				break;
			}	
 		}
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 6732
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int n=s.length();
  int count=0;
  for(int i=0;i<n;i++){
    if(s[i] !=t[i]){
      count+=1;
    }
  }
  cout<<count;
}

Measured memory_bytes: 3844
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define inf 1000000000000000000
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  
  ll h, w; cin >> h >> w;
  vector<vector<ll>> a(h, vector<ll>(w));
  vector<vector<ll>> b(h, vector<ll>(w));
  vector<vector<ll>> c(h, vector<ll>(w));
  rep(i, h) {
    rep(j, w) {
      cin >> a[i][j];
    }
  }
  rep(i, h) {
    rep(j, w) {
      cin >> b[i][j];
    }
  }
  rep(i, h) {
    rep(j, w) {
      c[i][j] = abs(a[i][j] - b[i][j]);
    }
  }

  vector<vector<vector<ll>>> dp(h, vector<vector<ll>>(w,vector<ll>(80 * (h + w) + 1, false)));
  dp[0][0][c[0][0]] = true;
  rep(i, h) {
    rep(j, w) {
      rep(k, 80 * (h + w) + 1) {
        if (0 <= i + 1 && i + 1 < h && dp[i][j][k]) {
          if (0 <= k + c[i + 1][j] && k + c[i + 1][j] <= 80 * (h + w)) dp[i + 1][j][k + c[i + 1][j]] = true;
          if (0 <= abs(k - c[i + 1][j]) && abs(k - c[i + 1][j]) <= 80 * (h + w)) dp[i + 1][j][abs(k - c[i + 1][j])] = true;
        }
        if (0 <= j + 1 && j + 1 < w && dp[i][j][k]) {
          if (0 <= k + c[i][j + 1] && k + c[i][j + 1] <= 80 * (h + w)) dp[i][j + 1][k + c[i][j + 1]] = true;
          if (0 <= abs(k - c[i][j + 1]) && abs(k - c[i][j + 1]) <= 80 * (h + w)) dp[i][j + 1][abs(k - c[i][j + 1])] = true;
        }
      }
    }
  }
  rep(k, 80 * (h + w) + 1) {
    if (dp[h - 1][w - 1][k]) {
      cout << k << endl;
      exit(0);
    }
  }
}


Measured memory_bytes: 652368
<?php
function sum($n) {
    $s = 0;
    while ($n > 0) {
        $s += $n % 10;
        $n /= 10;
    }
    return $s;
}

list($n, $a, $b) = explode(' ', fgets(STDIN));
$total = 0;
for ($i = 1; $i <= $n; $i++) {
    $s = sum($i);
    if ($s >= $a && $s <= $b) {
        $total += $i;
    }
}
echo $total;
?>

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

void Main() {
  ll n = read<int>();
  vi ans;

  rep(i, 1, n+1) {
    ll ma = (i + 1) * i / 2;
    if (ma >= n) {
      rrep(j, 1, i+1) {
        if (j <= n) {
          ans.push_back(j);
          n -= j;
        }
      }
      rep(x, sz(ans)) {
        _p("%d\n", ans[x]);
      }
      return;
    }
  }
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

template <typename T>
struct BinaryIndexedTree {
  vector<T> dat;
  BinaryIndexedTree(int n) : dat(n + 1, 0) {}
  BinaryIndexedTree(int n, T a) : BinaryIndexedTree(vector<T>(n, a)) {}
  BinaryIndexedTree(vector<T> y) : dat(y.size() + 1) {
    for (int i = 0; i < y.size(); ++i) dat[i + 1] = y[i];
    for (int i = 1; i + (i & -i) < dat.size(); ++i) dat[i + (i & -i)] += dat[i];
  }
  void add(int i, T a = 1) {
    for (++i; i < (int)dat.size(); i += i & -i) dat[i] += a;
  }
  T sum(int i) {  // sum [0,i)
    T s = 0;
    for (; i > 0; i &= i - 1) s += dat[i];
    return s;
  }
  // min { i : sum(i+1) > k } -> kth element(0-indexed)
  int find(T k) const {
    int i = 0;
    for (int p = 1 << (__lg(dat.size() - 1) + 1); p > 0; p >>= 1)
      if (i + p < (int)dat.size() && dat[i + p] <= k) k -= dat[i += p];
    return i + 1 == (int)dat.size() ? -1 : i;  // -1 -> no solutions
  }
};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int M = 1 << N;
  int S[M];
  for (int i = 0; i < M; i++) cin >> S[i];
  vector<int> vec(S, S + M);
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  BinaryIndexedTree<int> bit(M);
  for (int i = 0; i < M; i++) {
    int j = lower_bound(vec.begin(), vec.end(), S[i]) - vec.begin();
    bit.add(j);
  }
  vector<int> alive;
  bool isok = true;
  int x = bit.find(M - 1);
  alive.push_back(x);
  bit.add(x, -1);
  for (int i = 0; i < N; i++) {
    int n = alive.size();
    for (int j = 0; j < n; j++) {
      int k = bit.sum(alive[j]);
      if (k == 0) {
        isok = false;
        break;
      }
      x = bit.find(k - 1);
      alive.push_back(x);
      bit.add(x, -1);
    }
  }
  cout << (isok ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 7272
//E.H//
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<long long ,long long >
typedef long long ll;
ll memo[1005][10005],h,n;
pii arr[1005]; 
ll f(int idx,int x){
    if(idx > n) return 1e15;
    if(x<=0 ) return 0;
    if(memo[idx][x]!=-1 ) return memo[idx][x];
    ll cnt=min(f(idx,x-arr[idx].fi) + arr[idx].se,f(idx+1,x) );
    return memo[idx][x] = cnt;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>h>>n;
    for(int i=1;i<=n;i++){
        cin>>arr[i].fi >> arr[i].se;
    }
    memset(memo,-1,sizeof(memo));
    cout<<f(1,h)<<endl;
}

Measured memory_bytes: 82844
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const ll Mod = 1e9 + 7;
const ll Inf = 2242545357980376863LL;
const ll Log = 20;
const int Maxn = 1e5 + 10;
const int sig = 27;

const int Base = 101;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	cout << (n - 1) / 2LL;
	return 0;
}
/*
abacabacca

*/


Measured memory_bytes: 764
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    Node[] nodes = new Node[N];
    for (int i = 0; i < N; i++) nodes[i] = new Node();

    for (int i = 0; i < N - 1; i++) {
      int a = scanner.nextInt() - 1;
      int b = scanner.nextInt() - 1;
      nodes[a].adjacent.add(nodes[b]);
      nodes[b].adjacent.add(nodes[a]);
    }
    dfs(nodes[0], null);

    int M = 1_000_000_007;
    long x = 2;
    long y = N;
    for (Node node : nodes) {
      long b = node.adjacent.size() - 1;
      long a = modpow(2, N, M);
      long tx = addd(x, a, M);
      y = addn(x, y, a, b, M);
      x = tx;
      for (Node c : node.children) {
        b = -1;
        a = modpow(2, N - c.size, M);
        tx = addd(x, a, M);
        y = addn(x, y, a, b, M);
        x = tx;
      }
      if (node.parent != null) {
        b = -1;
        a = modpow(2, node.size, M);
        tx = addd(x, a, M);
        y = addn(x, y, a, b, M);
        x = tx;
      }
    }
    System.out.println(y * modpow(x, M - 2, M) % M);
  }

  private static long addd(long x, long a, int M) {
    return a * x % M;
  }

  private static long addn(long x, long y, long a, long b, int M) {
    y = a * y % M;
    y += b * x % M;
    if (y < 0) y += M;
    if (y >= M) y -= M;
    return y;
  }

  private static long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
      if (n % 2 == 1) res = (res * a) % mod;
      a = (a * a) % mod;
      n >>= 1;
    }
    return res % mod;
  }

  private static int dfs(Node node, Node parent) {
    node.parent = parent;
    node.size = 1;
    for (Node a : node.adjacent) {
      if (a != parent) {
        node.children.add(a);
        node.size += dfs(a, node);
      }
    }
    return node.size;
  }

  private static class Node {
    private Node parent;
    private int size;
    private List<Node> children = new ArrayList<>();
    private List<Node> adjacent = new ArrayList<>();
  }
}


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

long long solve(vector <int> v)
{
	long long ans = 0;
	int aact = 0;
	for (auto i : v) {
		if (i == 0)
			aact++;
		else if (i == 1)
			ans += aact;
		else
			aact = 0;
	}
	return ans;
}

int main()
{
	string s;
	cin >> s;
	vector <int> rez;
	for (auto i : s) {
		if (i == 'A')
			rez.push_back(0);
		else if (i == 'B')
			rez.push_back(2);
		else if (!rez.empty() && rez.back() == 2)
			rez.back() = 1;
		else
			rez.push_back(3);
	}

	cout << solve(rez);

	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;
    


int main(){
    int k,n;
    int ans=0;
    cin>>n>>k;
    vector<int>p(n);

    rep(i,n){
        cin>>p[i];
    }
    sort(p.begin(),p.end());

    rep(i,k){
        ans+=p[i];
    }
    cout<<ans;
}

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

int main(){
  string S ;
  int i,a;
  a = 1 ;

  cin >> S ;

  for(i=0;i<S.length();i++){
    if(i%2==0 && S[i]=='L'){
      a=0;
    }
    else if(i%2==1 && S[i]=='R'){
      a=0;
    }
  }

  if(a == 0) cout << "No";
  else if(a == 1) cout << "Yes";
}


Measured memory_bytes: 256
x, y = map(int, input().split())
def shokin(z):
  if z == 1:
    return 300000
  elif z == 2:
    return 200000
  elif z == 3:
    return 100000
  else:
    return 0
v = 0
if x == 1 and y == 1:
  v = 400000
  
print(shokin(x)+shokin(y)+v)

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

int main() {
	int n, m, l, A[100][100], B[100][100];
	long long int C[100][100];
	for (int i = 0;i < 100;i++) {
		for (int j = 0;j < 100;j++) {
			A[i][j] = 0;
			B[i][j] = 0;
			C[i][j] = 0;
		}
	}

	cin >> n >> m >> l;

	for (int i = 0;i < n;i++) {
		for (int j = 0;j < m;j++) {
			cin >> A[i][j];
		}
	}
	for (int i = 0;i < m;i++) {
		for (int j = 0;j < l;j++) {
			cin >> B[i][j];
		}
	}

	for (int i = 0;i < n;i++) {
		for (int j = 0;j < l;j++) {
			for (int k = 0;k < m;k++) {
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}

	for (int i=0;i < n;i++) {
		for (int j = 0;j < l;j++) {
			cout << C[i][j];
			if (j != l - 1)
				cout << " ";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1312
N=int(input())
S=input()

X=set()
Y=set()
Z=set()
for i in range(N):
    if S[i]=="R":
        X.add(i)
    elif S[i]=="G":
        Y.add(i)
    else:
        Z.add(i)

E=0
for a in X:
    for b in Y:
        E+=(2*a-b in Z)
        E+=(2*b-a in Z)
        E+=(((a+b)%2==0) and ((a+b)//2 in Z))
                
print(len(X)*len(Y)*len(Z)-E)
        


Measured memory_bytes: 80528
def terminate():
    print(-1)
    exit()


N, *A = map(int, open(0).read().split())
if A[0] != 0:
    terminate()

ans = 0
for i in range(N - 1):
    if A[i + 1] - A[i] > 1:
        terminate()
    if A[i] + 1 == A[i + 1]:
        ans += 1
    else:
        ans += A[i + 1]
print(ans)


Measured memory_bytes: 31680
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int C = 4005;
const int mod = 1e9 + 7;
int dp[2*C][2*C];


int main() {
	int n;
	scanf("%d", &n);
	vector<pair<int,int>> in;
	while(n--) {
		int x, y;
		scanf("%d%d", &x, &y);
		in.push_back({x, y});
		dp[C-x][C-y]++;
	}
	for(int i = 0; i < 2 * C - 1; ++i)
		for(int j = 0; j < 2 * C - 1; ++j) {
			dp[i][j] %= mod;
			dp[i+1][j] += dp[i][j];
			dp[i][j+1] += dp[i][j];
		}
	int answer = 0;
	for(pair<int,int> p : in) {
		answer = (answer + dp[C+p.first][C+p.second]) % mod;
	}
	for(int i = 0; i < 2 * C; ++i) {
		dp[i][0] = dp[i][i] = 1;
		for(int j = 1; j < i; ++j)
			dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % mod;
	}
	for(pair<int,int> p : in) {
		//~ cerr << dp[2*(p.first+p.second)][2*p.first] << "\n";
		answer = (answer + mod - dp[2*(p.first+p.second)][2*p.first]) % mod;
	}
	answer = (long long) answer * ((mod + 1) / 2) % mod;
	printf("%d\n", answer);
}


Measured memory_bytes: 252528
#include <algorithm>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define PB push_back
#define MP make_pair
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>())

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
using ll = long long;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


void Main() {
  int N;
  IN(N);
  vector<pair<int,int>> P(N);
  REP(i,N){
    double a, b;
    cin >> a >> b;
    P[i] = make_pair(a, b);
  }
  double sum;
  int cnt=0;
  REP(i, N-1){
    FOR(j,i+1,N){
      sum += pow(pow((P[i].first - P[j].first),2) + pow((P[i].second - P[j].second),2),0.5);
      cnt +=1;
    }
  }
  OUT((N-1)*sum/cnt);
}

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

  return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    string s; cin >> s;
    int N = s.size();
    string original = "CODEFESTIVAL2016";
    int ans = 0;
    rep(i, N) if(s[i] != original[i]) ans++;
    cout << ans << '\n';
    return 0;
}

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

vector<int> to[200020];
vector<int> ans;
void dfs(int v, int p = -1) {
    for(int x : to[v]) {
        if(x==p) continue;
        ans[x] += ans[v];
        dfs(x, v);
    }
}
int main() {
    int n, q;
    cin >> n >> q;
    ans.assign(n, 0);
    rep(i,n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i,q) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;   
    }
    dfs(0);
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 23552
use std::io::*;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn is_male(s: &str) -> Option<bool> {
    match s {
        "Vacant" => None,
        "Male" => Some(true),
        "Female" => Some(false),
        _ => unreachable!(),
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();

    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');

    println!("{}", 0);
    std::io::stdout().flush().ok();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let s_0 = is_male(s.as_str());
    if s_0.is_none() {
        return;
    }

    println!("{}", n - 1);
    std::io::stdout().flush().ok();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let s_n1 = is_male(s.as_str());
    if s_n1.is_none() {
        return;
    }

    let mut l = 0;
    let mut r = n - 1;
    for _ in 0..20 {
        let m = l + (r - l) / 2;
        println!("{}", m);
        std::io::stdout().flush().ok();
        let s: String = read(&mut stdin_lock, &mut buf, b'\n');
        let s_m = is_male(s.as_str());
        if s_m.is_none() {
            return;
        }
        if (m % 2 == 0 && s_m == s_0) || (m % 2 != 0 && s_m == s_n1) {
            l = m;
        } else {
            r = m;
        }
    }
}


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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = n / (a + b) * a;
  ll rem = n % (a + b);
  ans += min(a, rem);
  cout << ans;
}


Measured memory_bytes: 3588
import java.util.Scanner;

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

		while (true) {
			n = sc.nextInt();
			sc.nextLine();
			if (n == 0) {
				break;
			}
			s = sc.nextLine().split(" ");
			othello = 32;
			
			int index = 0;
			while (0 < othello) {
				othello -= (othello - 1) % 5;
				System.out.println(othello);
				othello -= Integer.valueOf(s[index]);
				if (othello < 0) {
					othello = 0;
				}
				index++;
				index %= n;
				System.out.println(othello);
			}
		}
	}
}

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

using namespace std;

const auto MOD = (long long) 1e9 + 7;

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

    vector<bool> isSafe(N + 1, true);
    for (int i = 0; i < M; ++i) {
        int a;
        cin >> a;
        isSafe[a] = false;
    }

    vector<int> dp(N + 1, 0);
    dp[0] = 1;
    if (isSafe[1]) dp[1] = 1;

    for (int n = 2; n <= N; ++n) {
        if (isSafe[n - 1]) dp[n] += dp[n - 1];
        if (isSafe[n - 2]) dp[n] += dp[n - 2];
        dp[n] = (dp[n] + MOD) % MOD;
    }

    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, c, k = 0;
    cin >> a >> b >> c;
    if (a == b + c || b == c + a || c == a + b) k++;
    if (k == 1) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3628