akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  string S;
  long long K;
  cin >> S >> K;
  char c;
  for (int i = 0; i < min(K, (long long)S.length()); i++) {
    c = S[i];
    if (c >'1') break;
  }
  cout << c << endl;
  return 0;
}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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()
{
    ll n, m;
    cin >> n >> m;
    ll ans = 0;

    if (n >= m/2) {
        cout << m/2 << endl;
    } else {
        cout << n + (m-2*n) / 4 << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
#define N 100200
#define U 100000
int a[N],ton[5][N];
int main()
{
	int n,mx=0,v,ans=0,ans2=0;
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	for (int i=1;i<=n;i+=2) ++ton[0][a[i]];
	for (int i=2;i<=n;i+=2) ++ton[1][a[i]];
	for (int i=1;i<=U;++i)
		if (ton[0][i]>mx) mx=ton[0][i],v=i;
	ans+=(n+1)/2-mx;
	mx=0;
	for (int i=1;i<=U;++i)
		if (i!=v&&ton[1][i]>mx) mx=ton[1][i];
	ans+=n/2-mx;
	
	mx=0;v=0;
	for (int i=1;i<=U;++i)
		if (ton[1][i]>mx) mx=ton[1][i],v=i;
	ans2+=n/2-mx;
	mx=0;
	for (int i=1;i<=U;++i)
		if (i!=v&&ton[0][i]>mx) mx=ton[0][i];
	ans2+=(n+1)/2-mx;
	printf("%d",min(ans,ans2));
	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main()
{
  int a,b,c,i,ct;
  ct=0;
  scanf("%d %d %d",&a,&b,&c);

  for(i=a;i<=b;i++){
    if(c%i==0){
      ct++;
    }
  }
  printf("%d\n",ct);
  return 0;
}

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

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    ll N[7];
    ll mi = LLONG_MAX;
    rep(i,6){
        cin >> N[i];
        if(i>0)mi = min(mi,N[i]);
    }
    ll ans;
    if(N[0]%mi==0)ans = N[0]/mi;
    else ans = (N[0]/mi) + 1;

    ans += 4;
    
    
    cout << ans  << endl;
    return 0;
}

Measured memory_bytes: 3608
var lines = [];

var readline = require('readline')
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});


rl.on('line', (x) => {
    lines.push(x)
});

rl.on('close', () => {
    var N = Number(lines[0].split(" ")[0])
    var M = Number(lines[0].split(" ")[1])
    var A = lines[1].split(" ").map(i => Number(i));

    lines.shift(); lines.shift();

    var BC = lines.map(i => i.split(" ").map(i => Number(i)));

    A.sort((a, b) => a - b);
    BC.sort((a, b) => b[1] - a[1]);

    var k = 0; var ans = 0; var flag = false;
    for (var i = 0; i < M; i++) {
        var b = BC[i][0]; var c = BC[i][1];
        if (flag === true) { break; }

        for (var j = k; j < Math.min(k + b, N); j++) {
            if (A[j] < c) { ans += c; }
            else { flag = true; break; }
        }
        k = j;
    }
    for (var x = k; x < N; x++) { ans += A[x] }; console.log(ans);

});





Measured memory_bytes: 59052
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int n;
int x[10];
int y[10];
double dist(int a,int b){
	int dis_x=x[a]-x[b];
	int dis_y=y[a]-y[b];
	return pow(dis_x*dis_x+dis_y*dis_y,0.5);
}
int find_fac(int x){
	int ans=1;
	while(x>1){
		ans*=x;x--;
	}
	return ans;
}
int solve()
{
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x[i]>>y[i];
	}
	double sum=0.0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			sum+=dist(i,j);
		}
	}
	cout<<fixed<<setprecision(8)<<2*sum/n<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Measured memory_bytes: 4228
#include <iostream>

using namespace std;
int main(void){
    // Your code here!
    int A, B;
    std::cin >> A >> B;
    if(A > 12)
        std::cout << B << std::endl;
    else if(A < 6)
        std::cout << "0" << std::endl;
    else
        std::cout << B/2 << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
const int MAXN = 2005;
ll dp[100005];

int main() {
    ll n, k, v, w;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) {
        scanf("%lld%lld", &w, &v);
        for (int j = k; j >= w; j--)
            dp[j] = max(dp[j], dp[j-w]+v);
    }
    printf("%lld\n", dp[k]);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
/**Classes and Structs**/
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
/**End**/
                                       /**Definitions**/
                                       const long long int mod1=1000000007;
                                       const int MAX=100005;
                                       #define pb push_back
                                       #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
                                       typedef long long int ll;
                                       typedef unsigned long long int ull;
                                       typedef unordered_map<int,int,custom_hash> mii;
                                       typedef unordered_map<ll,int,custom_hash> mli;
                                       typedef unordered_map<int,ll,custom_hash> mil;
                                       typedef unordered_map<ll,ll,custom_hash> mll;
                                       /**End**/
/**Custom Functions**/
ll gcd(ll a,ll b){
    ll c;
     while(b){
        c=b;
        b=a%b;
        a=c;
     }
     return a;
}
ll power1(ll a,ll b){
     if(b==0) return 1;
     else if(b%2) return a*power1(a,b-1);
     else {
        ll temp=power1(a,b/2);
        return temp*temp;
     }
}
ll power2(ll a,ll b,ll m){
     if(b==0) return 1;
     else if(b%2) return (a*power2(a,b-1,m))%m;
     else{
        ll temp=power2(a,b/2,m);
        return (temp*temp)%m;
     }
}
/**End**/
int main()
{
fast;
ll t=1;
//cin>>t;
while(t--){
   ll n;
   cin>>n;
   int a[n];
    for(int i=0;i<n;i++){cin>>a[i];}
    sort(a,a+n);
    cout<<a[n/2]-a[(n/2)-1]<<endl;
}
}


Measured memory_bytes: 640
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}


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 <iostream>
using namespace std;

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

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

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

    int score[n]; fill_n(score, sizeof(score) / sizeof(score[0]), 0);
    for (int i=0; i<m; i++) {
        const int target = A[i];
        int hit = 0;
        for (int j=0; j<n; j++)
            if (B[i][j] == target) {
                score[j]++;
                hit++;
            }
        score[target-1] += n - hit;
    }

    for (int j=0; j<n; j++) cout << score[j] << endl;
}


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

int main(){
	int p[5], d[5], t, a;

	cin>>p[1]>>p[2]>>p[3]>>d[1]>>d[2];

	
	t = min(p[1], p[2]);
	a = min(t, p[3]);
	
	a += min(d[1], d[2]);
	
	cout<<a - 50<<endl;
	return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;

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

    vector<int> ai(N);
    for (int i = 1; i < N; i++)
    {
        cin >> ai[i];
    }
    vector<int> pi(N);
    for (int j = 1; j < N; j++)
    {
        int g = ai[j];
        pi[g-1]++;
    }
    for (int i = 0; i < N; i++)
    {
        cout << pi[i] << endl;
    }
}


Measured memory_bytes: 4764
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = (a) ; i <= (b) ; i++)
#define per(i,a,b) for(int i = (a) ; i >= (b) ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int INF = 1e9;
const LL mod = 1e9 + 7;
const int maxn = 1e5 + 7;

LL qpow(LL a,LL b) {
    LL res = 1;
    while(b) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}

int ANS[maxn];

int main() {
    int n,k;
    while(~scanf("%d%d",&n,&k)) {
        mem(ANS);
        per(i,k,1) {
            ANS[i] = qpow(k/i,n);
            LL res = 0;
            for(int j = i + i ; j <= k ; j += i) {
                res = (res + ANS[j]) % mod;
            }
            ANS[i] = (ANS[i] - res + mod) % mod;
        }
        LL ans = 0;
        rep(i,1,k) {
//            cout << "i = " << i << " ans[i] = " << ANS[i] << endl;
            ans = (ans % mod + ((i % mod) * (ANS[i] % mod)) % mod) % mod;
        }
        plld(ans);
    }
    return 0;
}


Measured memory_bytes: 3624
import java.util.*;
import java.io.*;
import java.lang.*;

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

        if (a.charAt(0) == '9' || a.charAt(1) == '9')
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 35704
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cstdint>
using namespace std;

void solve() {
	char c;
	cin >> c;
	cout << char(c + 1) << endl;
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


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

    int a, b, c;
    cin >> a >> b >> c;

    bool res = false;
    if(a < c && c < b) res = true;
    if(b < c && c < a) res = true;

    ans(res);

    return 0;
}


Measured memory_bytes: 256
require 'prime'
n = gets.strip.to_i

MOD = 10**9+7

log = {}
(1..n).each do|num|
  divs = Prime.prime_division(num)
  divs.each do|number, factors|
    log[number] ||= 1
    log[number] += factors
  end
end

result=1
log.each do|num, count|
  result = (result * count)%MOD
end

p result

Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define moda 998244353
#define pi 3.14159265358979323846
#define io ios::sync_with_stdio(0); cin.tie(0);
#define deb(x) cout<<x<<"\n";
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(), x.rend()
#define F first
#define S second

const ll INF = 1e18;

llu max(llu a, llu b)
{
	if(a > b)
		return a;
	else
		return b;
}

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

int main()
{
	ll n, w;
	cin>>n>>w;

	ll s = 1000*n + 1;

	ll values[s];

	values[0] = 0;

	for(int i = 1 ; i <= s ; i++)
		values[i] = INF;


	for(int i = 0 ; i < n ; i++)
	{
		ll we, v;
		cin>>we>>v;
		for(int j = s ; j - v >= 0 ; j--)
		{
			if(values[j - v] >= 0)
					if(min(values[j - v] + we, values[j]) <= w)values[j] = min(values[j - v] + we, values[j]);
		}
	}

	for(int i = s ; i >= 0 ; i--)
	{
		if(values[i] != INF)
		{
			cout<<i<<"\n";
			break;
		}
	}

return 0;
}
// 	a(n) = (n - 1)(n + 4)(n^2 - 3n + 4)/2 

Measured memory_bytes: 4400
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
string s;
int ans;
int main()
{
	cin>>s;
	int now=0;int last=0;
	while(now<s.size()){
	//	printf("%d %d\n",now,last);
		if(now-last==0){
			if(s[now+1]!=s[now]){
				if(ans+1<s.size())ans++;now++,last++;continue;
			}
			if(s[now+1]==s[now]){
				ans++;now+=2;last++;continue;
			}
		}
		else now++,last=now,ans++;
	}
	printf("%d",ans);
}

Measured memory_bytes: 640
import java.util.Scanner;

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

		int p = Math.max(h, w);
		int ans = n % p == 0 ? n / p : n / p + 1;
		
		System.out.println(ans);
		sc.close();
		
	}
}


Measured memory_bytes: 22996
x, y  = map(int, input().split())
mod = 10 ** 9 + 7
if (x + y) % 3 != 0:
    ans = 0
else:
    n, m = (2 * x - y) / 3, (2 * y - x) / 3
    ans = 0
    if n >= 0 and m >= 0:
        n, m = int(n), int(m)
        ans = 1
        for i in range(min(m, n)):
            ans = ans * (n + m - i) % mod 
            ans *= pow(i + 1, mod - 2, mod)

print(ans % mod)

Measured memory_bytes: 9192
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-4;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int calc(string s, int k) {
	int a[4];
	a[3] = k % 10; k /= 10;
	a[2] = k % 10; k /= 10;
	a[1] = k % 10; k /= 10;
	a[0] = k;
	int n = s.length();
	stack<char> ord;
	stack<int> num;
	rep(i, n) {
		if (s[i] == ']') {
			int u = num.top(); num.pop();
			int v = num.top(); num.pop();
			char od = ord.top(); ord.pop();
			if (od == '+') {
				num.push(u|v);
			}
			else if (od == '*') {
				num.push(u&v);
			}
			else {
				num.push(u^v);
			}
		}
		else if (s[i] != '[') {
			if ('a' <= s[i] && s[i] <= 'd') {
				num.push(a[s[i] - 'a']);
			}
			else {
				ord.push(s[i]);
			}
		}
	}
	return num.top();
}
int main() {
	string s;
	while (cin >> s) {
		if (s == ".")break;
		int h; cin >> h;
		int val = calc(s, h);
		cout << val << " ";
		int c = 0;
		rep(i, 10000) {
			int v = calc(s, i);
			if (v == val)c++;
		}
		cout << c << endl;
	}
	return 0;
}



Measured memory_bytes: 3204
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define int long long
#define rep(i , a , b) for(int i = a ; i <= b ; i ++)
#define P pair<int,int>
#define  sc(a) scanf("%lld",&a)
#define pf(a) printf("%lld ",a)
using namespace std;
int a[1000005];
int v[100005];
signed main()
{
    int n, k, a,b,c;
    string s;
    int ans = 0;
    cin >> n >> k;
    cin >> a >> b >> c;
    cin>> s;
    for (int i = 0; i < n; i++) 
{
        if (i - k >= 0 && v[i - k] && s[i] == s[i - k]) continue;
        if (s[i] == 's') ans += a;
        if (s[i] == 'p') ans += b;
        if (s[i] == 'r') ans += c;
        v[i] = 1;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define pi 3.141592654
int main()
{
    int n,k;
    cin>>n>>k;
  long long  int sum=0;
    for(int i=0;i<k;i++)
    {
        int x;
        cin>>x;
    sum=sum+x;
    }

    if(sum>n)
    cout<<"-1"<<endl;
    else
      cout<<  n-sum<<endl;
}


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

int main(){
	int n;
	cin >> n;
	long long sum = 0;
	long long a, max = -1000000000, min = 100000000;
	for(int i = 0;i < n; i++ ){
		cin >> a;
		sum += a;
		if(a > max){
			max = a;
		}
		if(a < min){
			min = a;
		}
	}
	cout << min << " ";
	cout << max << " ";
	cout << sum << endl;
	return 0;
}

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

using namespace std;

int main( )
{	
    int n;
    int maxProfit = 1-1000000000;
    int Rj, Ri = 2000000000;
	ios::sync_with_stdio( false );
    cin>>n;
    
    cin>>Ri;
    for( int i=1; i<n; i++ ) {
    	cin>>Rj;
        if( maxProfit < Rj - Ri ) {
       		maxProfit = Rj - Ri;
       	}
       	if( Rj < Ri ) {
    		Ri = Rj;
    	}
    }    

    cout<<maxProfit<<endl;
	
	return 0;
}

Measured memory_bytes: 1196
#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 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll a, b, t;
    cin >> a >> b >> t;
    cout << (t / a) * b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;


int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> s(m);
    rep(i, m){
        int k;
        cin >> k;
        rep(j, k){
            int tmps; cin >> tmps;
            tmps--;
            s[i].push_back(tmps);
        }
    }
    vector<int> p;
    rep(i, m){
        int tmpp; cin >> tmpp;
        p.push_back(tmpp);
    }

    int ans = 0;
    rep(i, 1<<n){
        bool ng = false;
        rep(j, m){
            int right = 0;
            for(auto sw: s[j]){
                if (i>>sw & 1) right += 1;
            }
            if (right % 2 != p[j]) ng = true;
        }
        if (!ng) ans++;
    }

    cout << ans << endl;
}


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

int main() {
  
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int sum = 0;
  
  if(a < b) sum += a;
  else sum += b;
  
  if(c < d) sum += c;
  else sum += d;
  
  cout << sum << endl;
  
}


Measured memory_bytes: 256
class Main
{
	public static void main(String[] args)
	{
		for (int i = 1; i <= 9; ++i)
		{
			for (int j = 1; j <= 9; ++j)
			{
				System.out.println(i + "x" + j + "=" + i * j);
			}
		}
	}
}

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

struct book
{
    string s;
    int p;
    int num;

    book(string name, int point, int hoge)
    {
        s = name;
        p = point;
        num = hoge;
    }
    bool operator<(const book &another) const
    {
        return s == another.s ? p > another.p : s < another.s;
    }
};

int main()
{
    int n;
    vector<book> Book;
    string a;
    int b;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a >> b;
        Book.push_back(book(a, b, i));
    }
    sort(Book.begin(), Book.end());
    for (auto itr : Book)
    {
        cout << itr.num << endl;
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=998244353;
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
int n,m;
ll a[405],b[405],fact[405],inv[405],invp,sa,sb,A[405][405],B[405][405];
int main()
{
	fact[0]=1;
	for(int i=1;i<=400;i++)fact[i]=fact[i-1]*i%MOD;
	inv[400]=quick_pow(fact[400],MOD-2);
	for(int i=400;i>=1;i--)inv[i-1]=inv[i]*i%MOD;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		sa+=a[i],sb+=b[i];
	}
	invp=quick_pow(sa,MOD-2);
	A[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int k=0;k<b[i];k++)
		{
			ll v=MOD-inv[k]*quick_pow(a[i]*invp%MOD,k)%MOD;
			for(int p=0;p<=sa;p++)
			  for(int q=0;q+k<=sb;q++)
				B[p][q+k]=(B[p][q+k]+A[p][q]*v)%MOD;
		}
		for(int p=0;p+a[i]<=sa;p++)
		  for(int q=0;q<=sb;q++)
			B[p+a[i]][q]=(B[p+a[i]][q]+A[p][q])%MOD;
		for(int p=0;p<=sa;p++)
		  for(int q=0;q<=sb;q++)
		    A[p][q]=B[p][q],B[p][q]=0;
	}
	ll ans=0;
	for(int p=0;p<=sa;p++)
	for(int q=0;q<=sb-n;q++)
	{
		A[p][q]=(MOD-A[p][q])%MOD;
		if(p==sa&&q==0)A[p][q]=(A[p][q]+1)%MOD;
		ans=(ans+A[p][q]*fact[q]%MOD*quick_pow(quick_pow(1+MOD-p*invp%MOD,q+1),MOD-2))%MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

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

string s,t;
int dp[3003][3003];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	cin>>s>>t;
	
	for(int i=0;i<(int)s.size();i++){
		for(int j=0;j<(int)t.size();j++){
			if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j] + 1;
			else{
				dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
			}
		}
	}
	
	stack<char> st;
	
	int ii = (int)s.size(), jj = (int)t.size();
	while(dp[ii][jj] != 0){
		if(s[ii-1] == t[jj-1]){
			st.push(s[ii-1]);
			ii--;
			jj--;
		}
		else{
			if(dp[ii][jj-1] > dp[ii-1][jj]){
				jj--;
			}
			else{
				ii--;
			}
		}
	}
	
	while(!st.empty()){
		cout<<st.top();
		st.pop();
	}
	
	return 0;
}


Measured memory_bytes: 35456
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void)
{
	int i,j,len,x,flg;
	char s[1001],aiz[9]="AIZUNYAN",aid[9]="AIDUNYAN";
	int az[26],ad[26],wk[26];
	scanf("%s",s);
	len=strlen(s);
	for(i=0;i<26;i++)	{
		az[i]=0;	ad[i]=0;
	}
	for(i=0;i<8;i++)	{
		x=aiz[i]-'A';
		az[x]++;
		x=aid[i]-'A';
		ad[x]++;
	}
	i=0;
	while(i<len-7)	{
		for(j=0;j<26;j++)	wk[j]=0;
		for(j=0;j<8;j++)	{
			x=s[i+j]-'A';
			wk[x]++;
		}
		flg=1;
		for(j=0;j<26;j++)	{
			if(wk[j]!=ad[j])	{
				flg=0;	break;
			}
		}
		if(flg==1)	{
			for(j=0;j<8;j++)	{
				putchar(aiz[j]);
			}
			i+=8;
		}
		else {
			putchar(s[i]);
			i++;
		}
	}
	for(j=i;j<len;j++)	{
		putchar(s[j]);
	}
	putchar('\n');
			
	return 0;
}


Measured memory_bytes: 936
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int main(void){
    ll N, a0=2, a1=1, ans;
    in(N);
    if(N==1){
        put(N);
        return 0;
    }
    rep(_, N-1){
        ans = a0 + a1;
        a0 = a1;
        a1 = ans;
    }
    put(ans);
    return 0;
}


Measured memory_bytes: 128
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad         (replicateM)
import qualified Data.ByteString.Char8 as BC
import           Data.List             (sort)
import           Data.Maybe            (fromJust)

main :: IO ()
main = print =<< solve <$> getInput

getInput :: IO (Int, Int, [(Int, Int)])
getInput = do
  [n, h] <- readInts
  abs <- replicateM n readInt2
  return (n, h, abs)

readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

readInt2 = do
  [a, b] <- readInts
  return (a, b)

solve (n, h, abs) = nAttack + mAttack
  where maxA = maximum $ map fst abs
        (nAttack, restHP) = throwAttack maxA (map snd abs) h
        mAttack = swingAttack maxA restHP

throwAttack :: Int -> [Int] -> Int -> (Int, Int)
throwAttack a bs h = if null powerfulBs
  then (0, h)
  else if null rest
       then (length throwns, h - last throwns)
       else (length throwns + 1, h - head rest)
  where powerfulBs = filter (> a) bs
        (throwns, rest) = span (< h) . scanl1 (+) . reverse $ sort powerfulBs

swingAttack a h
  | h <= 0   = 0
  | otherwise = h `div` a + if h `mod` a == 0 then 0 else 1
      --ceiling $ fromIntegral h / fromIntegral a


Measured memory_bytes: 45436
package main

import (
	"fmt"
	// "math"
)

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

	ans := "No"
	for i := 1; i < 10; i++ {
		for j := 1; j < 10; j++ {
			// fmt.Println(i, j)
			if i * j == n {
				ans = "Yes"
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
n = int(input())
A = [[int(i) for i in input().split()] for j in range(n)]
for i in range(n-2):
    if A[i][0] == A[i][1] and A[i+1][0] == A[i+1][1] and A[i+2][0] == A[i+2][1]:
        print("Yes")
        break
else:
    print("No")


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

using namespace std;


#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 1e6 + 1, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;


signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);
   int n, A, B;
   cin >> n >> A >> B;
   if (A % 2 != B % 2) {
      cout << "Borys";
   }
   else cout << "Alice";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define ii pair<int, int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR(x, n) for(int i=x; i<=n; ++i)
#define MOD 1000000007

ll a[200005];

int main() {

    int n;
    sc("%d", &n);

    a[0] = 0;

    FOR(1, n) {
        sc("%lld", &a[i]);
        a[i] += a[i-1];
    }

    ll ans = 0;

    FOR(1, n) {

        ans += (((a[n] - a[i])%MOD) * (a[i] - a[i-1]) );

        ans %= MOD;
    }

    printf("%lld\n", ans);
}



Measured memory_bytes: 5360
N, M = map(int, input().split())
A = [0]*M
B = [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())

from collections import deque
def bfs(graph, start_node, depth):
    next_nodes = deque([])
    seen_nodes = set()
    
    next_nodes.append(start_node)
    seen_nodes.add(start_node)
    depth[start_node] = 0
    while next_nodes:
        node = next_nodes.popleft()
#         if node == key:
#             return node
        if node in graph:
            for n in graph[node]:
                if not n in seen_nodes:
                    next_nodes.append(n)
                    seen_nodes.add(n)
                    depth[n] = node
    return

def Main(N, M, A, B):
    g = {}
    for i in range(M):
        if A[i] not in g:
            g[A[i]] = []
        if B[i] not in g:
            g[B[i]] = []
        g[A[i]].append(B[i])
        g[B[i]].append(A[i])
    depth = {}
    bfs(g, 1, depth)
    ans = []
    for i in range(2, N+1):
        ans.append(depth[i])
    return 'Yes', ans
          
                    
yn, out = Main(N, M, A, B)
print(yn)
for e in out:
    print(e)

Measured memory_bytes: 57396
# coding: utf-8

def dp_flog(N, lst):
    lst_cost = [0] * N
    lst_cost[1] = abs(lst[0] - lst[1])

    for i in range(2, N):
        lst_cost[i] = min(lst_cost[i-2] + abs(lst[i-2] - lst[i]), lst_cost[i-1] + abs(lst[i-1] - lst[i]))
    return lst_cost

N = int(input())
lst_flog = list(map(int, input().split()))
print(dp_flog(N, lst_flog)[N-1])

Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[1005];
signed main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    int ans=0;
    for(int i=0; i<k; i++)
        ans+=a[i];
    cout<<ans;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll R0, W0, C, R;
    for(;cin >> R0 >> W0 >> C >> R, R0;){
        ll ans;
        for(ll x = 0; ;x++){
            if(R0 + x * R >= C * W0){
                ans = x;
                break;
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3080
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean[] numbers = new boolean[n + 1];
		boolean[] counts = new boolean[n + 1];
		for (int i = 1; i <= n; i++) {
		    numbers[i] = (sc.nextInt() == 1);
		}
		StringBuilder sb = new StringBuilder();
		boolean first = true;
		int count = 0;
		for (int i = n; i > 0; i--) {
		    if (numbers[i]) {
		        if (!first) {
		            sb.append(" ");
		        }
		        first = false;
		        count++;
		        sb.append(i);
		        for (int j = 1; j <= Math.sqrt(i); j++) {
		            if (i % j == 0) {
		                numbers[j] ^= true;
		                if (j * j != i) {
		                    numbers[i / j] ^= true;
		                }
		            }
		        }
		    }
		}
		System.out.println(count);
		if (count != 0) {
		    System.out.println(sb);
		}
   }
}


Measured memory_bytes: 65904
#include<stdio.h>
#include<algorithm>
#include<string>
using namespace std;
char str[200];
pair<int,int>ad(int a);
pair<int,int>mul(int a);
pair<int,int>fact(int a);
pair<int,int>ad(int a){
	pair<int,int> res=mul(a);
	while(str[res.second]=='+'||str[res.second]=='-'){
		pair<int,int>v=mul(res.second+1);
		if(str[res.second]=='+')res.first+=v.first;
		else res.first-=v.first;
		res.second=v.second;
	}
	return res;
}
pair<int,int>mul(int a){
	pair<int,int> res=fact(a);
	while(str[res.second]=='*'||str[res.second]=='/'){
		pair<int,int>v=fact(res.second+1);
		if(str[res.second]=='*')res.first*=v.first;
		else res.first/=v.first;
		res.second=v.second;
	}
	return res;
}
pair<int,int>fact(int a){
	if(str[a]=='('){
		pair<int,int> res=ad(a+1);
		res.second++;
		return res;
	}else{
		int val=0;
		while(isdigit(str[a])){
			val=val*10+str[a++]-'0';
		}
		return make_pair(val,a);
	}
}
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		scanf("%s",str);
		printf("%d\n",ad(0).first);
	}
}

Measured memory_bytes: 1024
MOD = 10**9+7; ans = 0
def factorial(n)
  res = 1
  return 1 if n == 1
  2.upto(n) {|i| res = res * i % MOD }
  return res
end
n, m = gets.split.map &:to_i
if (n-m).abs > 1
  puts ans; exit
elsif n - m == 1
  ans += factorial(n) * factorial(m) % MOD
elsif m - n == 1
  ans += factorial(n) * factorial(m) % MOD
else
  ans += factorial(n) * factorial(m) * 2 % MOD
end
puts ans


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
char ch[1000001]; int n;
int main()
{
  cin>>n>>ch; int cnt = 0;
  for(int i=0;i<n;i++){
    int p = i; cnt++;
    while(ch[p] == ch[p+1]) p++;
    i = p;
  }
  cout<<cnt;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <unistd.h>

#define ll long long
#define lst(x) x.size()-1
#define F first
#define S second
#define ld long double
#define pr pair<ll,ll>
#define loop(i, n) for(int i=0 ; i<n ; ++i)
#define rep(i, x, n) for(int i=x ; i<=n ; ++i)
#define iteloop(type, data, name, it) for(type<data>::iterator it=name.begin() ;it!=name.end() ; ++it)

using namespace __gnu_pbds;
using namespace std;

template<typename T>
using os = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

const ll N = 4e3+5,MOD=998244353,MX=1e9+1,MN=0, M = 2e3 + 5;
int memo[N][N],cntR[N],cntB[N],comR[N],comB[N],n;
int dp(int i,int r){
    int b=comB[i]-(i-(comR[i]-r));
    if(b<0 or r<0)return 0;
    if(i>=2*n)return 1;
    int &res=memo[i][r];
    if(~res)return res;
    res=0;
    if(r)
        res+=dp(i+1,r-1+cntR[i+1]);
    res%=MOD;
    if(b)
        res+=dp(i+1,r+cntR[i+1]);
    res%=MOD;
    return res;
}
int main() {
#ifdef CLION
    freopen("std/in.txt", "rt", stdin);
    // freopen("out.txt", "wt", stdout);
#endif
    memset(memo,-1,sizeof(memo));
    string str;
    cin>>str;
    n=str.size();
    loop(i,n){
        if(str[i]=='0'){
            comR[i]=2;
            comB[i]=0;
            cntR[i]=2;
            cntB[i]=0;
        }else if(str[i]=='1'){
            comR[i]=1;
            comB[i]=1;
            cntR[i]=1;
            cntB[i]=1;
        }else{
            comR[i]=0;
            comB[i]=2;
            cntR[i]=0;
            cntB[i]=2;
        }
        if(i){
            comR[i]+=comR[i-1];
            comB[i]+=comB[i-1];
        }
    }
    rep(i,n,2*n){
        comR[i]=comR[i-1];
        comB[i]=comB[i-1];
    }
    int res=0;
    res+=dp(0,cntR[0]);
    res%=MOD;
    cout<<res<<endl;
    return 0;
}

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

#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int compare(int h, int w, int x, int y) {
    return (h*h+w*w) == (x*x+y*y) ? h-x : (h*h+w*w) - (x*x+y*y);
}

int main() {
    int h, w, d;
    while (cin >> h >> w) {
        if (h==0) break;
        int ans_h = 150, ans_w = 150;
        for (int i=1; i < 150; i++) {
            for (int j=i+1; j < 150; j++) {
                if (compare(h,w,i,j) < 0 && compare(ans_h,ans_w,i,j) > 0) {
                    ans_h = i;
                    ans_w = j;
                }
            }
        }
        cout << ans_h << ' ' << ans_w << endl;
    }

}

Measured memory_bytes: 3024
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define debug(x) cout<<(#x)<<"="<<x<<"\n";
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define f first
#define s second
#define ll long long
#define INF 2000000000
char s[1005];
int main(){
        while(~scanf("%s",s)){
                bool flag=1;
                int l=strlen(s);
                F(i,0,l){
                        if(i%2&&s[i]=='R') flag=0;
                        if(i%2==0&&s[i]=='L') flag=0;
                }
                printf("%s\n",flag==1?"Yes":"No");
        }
}

Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var mod = 998244353;
function mul(){for(var a=arguments,r=a[0],i=a.length;--i;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i])%mod;return r;}
var fac=[],finv=[],invs=[],pow2=[];
function fset(n){
  fac.length=n+1,fac[0]=fac[1]=1;
  for(var i=2;i<=n;)fac[i]=mul(fac[i-1],i++);
  finv.length=n+1,finv[0]=finv[1]=1,finv[n]=inv(fac[n]);
  for(i=n;2<i;)finv[i-1]=mul(finv[i],i--);
  //invs.length=n+1,invs[0]=invs[1]=1;
  //for(i=2;i<=n;)invs[i]=mul(fac[i-1],finv[i++]);
  //pow2.length=n+1,pow2[0]=1;
  //for(i=1;i<=n;i++)pow2[i]=pow2[i-1]*2%mod;
}
function inv(b){for(var a=mod,u=0,v=1,t;b;v=t)t=a/b|0,a-=t*b,u-=t*v,t=a,a=b,b=t,t=u,u=v;u%=mod;return u<0?u+mod:u;}
function pow(a,n){for(var r=1;n;a=mul(a,a),n>>=1)if(n&1)r=mul(a,r);return r;}
function ncr(n,r){return mul(fac[n],finv[r],finv[n-r]);}
function npr(n,r){return mul(fac[n],finv[n-r]);}
function mput(n){return (n%mod+mod)%mod;}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var s = nextstr(), sl = s.length;
  var k = next();
  var a = [], x = 0, one = 0;
  for(var i = 0; i < sl; i++){
    if(s[i] === "1")x++, one++;
    else{
      a.push(x);
      x = 0;
    };
  }
  if(x)a.push(x);
  if(a[0])one -= a[0], a[0] = 0;
  k = Math.min(one, k);
  var dp = xArray(0, k+1, k+1);
  dp[0][0] = 1;
  var mn = 0;
  for(var i = 0; i < a.length; i++){
    mn += a[i];
    var dp2 = xArray(0, k+1, k+1);
    for(var k1 = 0; k1 <= k; k1++){
      for(var k2 = 0; k2 <= k1; k2++){
        for(var morau = 0; morau <= one-mn && k1+morau <= k; morau++){
          dp2[k1+morau][k2] += dp[k1][k2];
          dp2[k1+morau][k2] %= mod;
        }
        for(var kubaru = 1; kubaru <= a[i] && kubaru+k2 <= k; kubaru++){
          dp2[k1][k2+kubaru] += dp[k1][k2];
          dp2[k1][k2+kubaru] %= mod;
        }
      }
    }
    dp = dp2;
  }
  var ans = 0;
  for(var i = 0; i <= k; i++)ans += dp[i][i];
  return mput(ans);
}

Measured memory_bytes: 41084
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

def main():
    n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    l = list(itertools.permutations(range(1,n+1)))
    print(abs(l.index(p) - l.index(q)))


if __name__=="__main__":
    main()


Measured memory_bytes: 71504
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  int n;
  cin >> n;
  if (n % 111 == 0) {
    cout << n << endl;
    return 0;
  }

  int b = n / 111;
  cout << 111 * (b + 1) << endl;
}


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

namespace solution
{
  class Class1
  {
    static void Main()
    {
      string str = Console.ReadLine();
      int times = int.Parse(Console.ReadLine());

      for (int i = 0; i < times; i++)
      {
        var s = Console.ReadLine().Split();
        int a = int.Parse(s[1]);
        int b = int.Parse(s[2]);

        switch (s[0])
        {
          case "print":
            Console.WriteLine(str.Substring(a, b - a + 1));
            break;

          case "reverse":
            //var rev = string.Join("", str.Substring(a, b - a + 1).Reverse());
            var arr = str.Substring(a, b - a + 1).ToArray();
            Array.Reverse(arr);
            string rev = new string(arr);
            var str2 = str.Remove(a, b - a + 1);
            str = str2.Insert(a, rev);
            break;

          case "replace":
            var str3 = str.Remove(a, b - a + 1);
            str = str3.Insert(a, s[3]);
            break;
        }
      }
    }
  }
}


Measured memory_bytes: 9568
import math
import sys
input = sys.stdin.readline


def main():
    sc = Scan()
    n = sc.intarr()[0]
    ns = int(math.sqrt(n)) + 1
    minimum = n
    for i in range(1, ns):
        if n % i == 0:
            cost = (n//i) + i - 2
            if cost < minimum:
                minimum = cost
    print(minimum)


class Scan():

    def intarr(self):
        self.line = input()
        array = self.line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def strarr(self):
        self.line = input()
        array = self.line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()


Measured memory_bytes: 3064
n,m = map(int,raw_input().split())
pre = [[] for i in xrange(n)]
ans = ['' for i in xrange(m)]
for i in xrange(m):
	p,y = map(int,raw_input().split())
	p -= 1
	pre[p].append((y,i))
for i in xrange(n):
	pre[i].sort()
	s = str(i+1)
	s = '0'*(6-len(s)) + s
	for j in xrange(len(pre[i])):
		x = str(j+1)
		x = (6-len(x))*'0' + x
		ans[pre[i][j][1]] = s+x
for a in ans:
	print a 



Measured memory_bytes: 52764
s = list(input())
t = list(input())
s.sort()
flag = True
i = 0
ans = False
while flag:
    ans = False
    for x in t:
        if s[i] < x:
            flag = False
            ans = True
        elif s[i] == x:
            ans = True
    if ans and flag:
        t.remove(s[i])
        if i + 1 < len(s):
            i += 1
        elif t == []:
            flag = False
            ans = False
        else:
            flag = False
            ans = True
    elif not ans:
        flag = False
if ans:
    print('Yes')
else:
    print('No')


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

int N, A[200000], B[1000001], ans;

int main() {
    cin >> N;
    rep(i, N) cin >> A[i];
    sort(A, A + N);
    rep(i, N) {
        for (int j = A[i]; j <= A[N-1]; j += A[i]) {
            B[j]++;
        }
    }
    rep(i, N) if (B[A[i]] == 1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 8312
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
const int INF = 1e9;
const ll LINF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> b(N+1,0);
    for (int i = 1; i <= N; ++i)
    {
        ll a;
        cin >> a;
        b[a] = i;
    }
    set<ll> s;
    s.insert(0);
    s.insert(N+1);
    ll ans=0;
    for (int i = 1; i <= N; ++i)
    {
        auto it = s.lower_bound(b[i]);
        ans += i*(*it-b[i]) * (b[i] - *(--it));
        s.insert(b[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11264
#include <iostream>

using namespace std;

int main(void) {
  int n;
  int count; //昇降の回数をカウント
  string f;
  for(;;) {
    cin >> n;
    int array[n];
    if(n == 0) break;
    for(int i=0;i<n;i++) {
      cin >> f;
      if(f == "lu") array[i] = 1;
      else if(f == "ru") array[i] = -1;
      else if (f == "ld") array[i] = 2;
      else if (f == "rd") array[i] = -2;
    }
    for(int i=0;i<n-1;i++) {
      if((array[i] + array[i+1]) == 0) count++;
    }
    cout << count << endl;
    count = 0;
  }
}



Measured memory_bytes: 3020