akhauriyash/Code-Regression huggingface dataset:
# coding:utf-8

import sys


input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


# aのp乗を求めるアルゴリズム
# MOD版
def pow_mod(a, p):
    if p == 0: return 1

    if p % 2 == 0:
        half_p = p // 2
        half = pow_mod(a, half_p)
        return half * half % MOD
    else:
        return a * pow_mod(a, p - 1) % MOD


def solve(N, A):
    # 階乗N!を求める
    fact = [1] * N
    for i in range(1, N):
        fact[i] = fact[i - 1] * (i + 1) % MOD

    # 1/N!の逆元を求める
    fact_inv = [1] * N
    fact_inv[-1] = pow_mod(fact[-1], MOD - 2)
    for i in range(N - 1, 0, -1):
        tmp = fact_inv[i] * (i + 1)
        tmp %= MOD
        fact_inv[i - 1] = tmp

    # 1/kを求める
    inv = [1]
    for i in range(1, N):
        inv.append((fact[i - 1] * fact_inv[i]) % MOD)

    # 1/kの累積和を求める
    inv_sum = [1]
    for i in range(1, N):
        inv_sum.append((inv_sum[-1] + inv[i]) % MOD)

    # 累積和の結果を係数としてAiに掛けて、加算する
    ans = 0
    for i in range(N):
        ans += A[i] * (inv_sum[i] + inv_sum[N - 1 - i] - 1)
        ans %= MOD

    # ansにN!を掛けたものを返す
    return ans * fact[-1] % MOD


N = int(input())
A = inpl()
print(solve(N, A))


Measured memory_bytes: 23372
//Reference https://qiita.com/hatoo@github/items/fa14ad36a1b568d14f3e
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main(){
    let (r, D, x) = get!(usize, usize, usize);
    let mut ans = x;
    for t in 0..10{
        ans = r * ans - D;
        println!("{}", ans);
    }

}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main(void) {
    
    string s,t,y;
    cin>>s>>t>>y;
    cout<<s[0]<<t[0]<<y[0]<<endl;
    
    
}


Measured memory_bytes: 256
n;m;k;l;main(h,w){scanf("%d%d",&h,&w);n=h/2;k=w/2;m=h/3;l=w/3;printf("%.f",h%3&&w%3?fmin(fmin(h%2?h:n,w%2?w:k),fmin(w%3-1|l<h?(n>l?n:l)+l+1:h+l,h%3-1|m<w?(k>m?k:m)+m+1:w+m)):0);}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int min = 10;
		int idx = 0;
		for (int i = 0; i < 5; i++) {
			int m = a[i] % 10;
			if (m == 0) m = 10;
			if (m < min) {
				min = m;
				idx = i;
			}
		}

		int ans = 0;
		for (int i = 0; i < 5; i++) {
			if (i != idx) {
				ans += a[i];
			}
			int m = ans % 10;
			if (m == 0) m = 10;
			ans += 10 - m;
		}
		System.out.println(ans + a[idx]);
	}
}


Measured memory_bytes: 23764
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	void doIt() {
		sC();
	}
	
	void sC() {
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int gcd = gcd(a[0], a[1]);
		for(int i = 2; i < n; i++) {
			gcd = gcd(gcd, a[i]);
		}
		System.out.println(gcd);
	}
	
	int gcd(int m, int n) {
		while(m % n != 0) {
			int work = n;
			n = m % n;
			m = work;
		}
		return n;
	}
	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 52124
#include <iostream>

using namespace std;
int n,u,k,v,**M,flag[100],s_time[100],f_time[100];
void creat()
{
    cin>>n;
  M=new int*[n];
  for(int i=0;i<n;i++)
    {
      M[i]=new int[n];
      flag[i]=0;
      for(int j=0;j<n;j++)
	M[i][j]=0;
    }
  int count=0;
  while(count<n)
    {
      count++;
      cin>>u>>k;
      for(int i=0;i<k;i++)
	{
	  cin>>v;
	  M[u-1][v-1]=1;
	}
    }
    /*for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)
      cout<<M[i][j]<<' ';
    cout<<endl;
  }*/
}
int Time=0;
void dfs(int cur) {
    Time += 1;
    s_time[cur]=Time;
    //cout << "visiting " << cur+1 << ' ' << time << endl;
    flag[cur]=1;
    for (int dst=0;dst<n;dst++) {
            if (M[cur][dst]&&!flag[dst]) {
                dfs(dst);
            }
    }
    Time += 1;
    f_time[cur]=Time;
}
int main()
{
    creat();
    for(int i=0;i<n;i++)
    {
        if(!flag[i])
            dfs(i);
    }
    for(int i=0;i<n;i++)
    {
        cout<<i+1<<' '<<s_time[i]<<' '<<f_time[i]<<endl;
    }
    delete M;
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  R n;
  int a[n];
  rep(i,n) R a[i];
  map<int,int> m;
  rep(i,n) m[a[i]]++;
  vector<P> v;
  tr(it,m) v.pb(P(it->F,it->S));
  sort(all(v),greater<P>());
  if(v.size()>2||v.size()==2&&v[1].F+1<v[0].F) {pr("No");return;}
  if(v.size()==2) {
    n-=v[1].S;
    v[0].F-=v[1].S;
    if(v[1].F<v[1].S||n<v[0].F*2) {pr("No");return;}
  }
  if(n-v[0].F>0&&n>=v[0].F*min(2,n-v[0].F)) pr("Yes");
  else pr("No");
}
int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}

Measured memory_bytes: 6524
import sys
input = sys.stdin.readline
import collections

def main():
    h, w = input_list()
    masu = []
    c = 0
    for _ in range(h):
        c += input().count('#')
    if h + w - 1 == c:
        print('Possible')
    else:
        print('Impossible')

def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define MOD 1000000007

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,t[2]={0},x[2]={0},y[2]={0};
    bool f=false;
    cin >> n;
    rep(i,n) {
        cin >> t[0] >> x[0] >> y[0];
        if(t[0]-t[1]<abs(x[0]-x[1])+abs(y[0]-y[1])||(t[0]-t[1])%2!=(abs(x[0]-x[1])+abs(y[0]-y[1]))%2) {
            f=true;
        }
        t[1]=t[0];
        x[1]=x[0];
        y[1]=y[0];
    }
    cout << (f?"No":"Yes") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	if((a>=0&&b<=0)||(a<=0&&b>=0)) cout<<"Zero";
	else if(a>0&&b>0) cout<<"Positive";
	else{
		if(abs(a-b)%2==0) cout<<"Negative";
		else cout<<"Positive";
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>

int is_prime(int a)
{
	int last = sqrt(a) + 1;
	int i;

	for (i = 2; i <= last; i++){
		if (a % i == 0){
			if (a == i) return (1);
			return (0);
		}
	}
	return (1);
}

int main(void)
{
	static char dp[10000001];
	int n, x;
	int i, j;

	while (scanf("%d %d", &n, &x), n){
		memset(dp, 0, sizeof(dp));
		*dp = 1;
		for (i = 0; i < n; i++){
			int cost;
			scanf("%d", &cost);

			for (j = 0; j + cost <= x; j++){
				if (dp[j]) dp[j + cost] = 1;
			}
		}
		for (i = x; i > 0; i--){
			if (dp[i] && is_prime(i)){
				printf("%d\n", i);
				break;
			}
		}
		if (!i) puts("NA");
	}
	return (0);
}

Measured memory_bytes: 10384
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

ll const MAX = 20004;
ll a[MAX], b[MAX];
int main() {
	ll n; cin >> n;
	ll T = 20000;
	REP(i, 1, n) {
		a[i] = b[n + 1 - i] = i * T;
	}
	REP(i, 1, n) {
		ll p;
		cin >> p;
		a[p] += i;
	}
	REP(i, 1, n) {
		cout << a[i];
		if (i < n) {
			cout << " ";
		}
	}
	cout << endl;
	REP(i, 1, n) {
		cout << b[i];
		if (i < n) {
			cout << " ";
		}
	}cout << endl;

}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	int INF = (int)1 << 60;
	int res = -INF;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	if (N % 2 == 0) {
		int sum = 0;
		for (int i = 0; i < N; i++) {
			if (i % 2 == 0) {
				sum += A[i];
			}
		}
		int x = 0;
		int mx = 0;
		for (int i = N - 1; i >= 0; i--) {
			if (i % 2 == 0) {
				x -= A[i];
				mx = max(mx, x);
			} else {
				x += A[i];
			}
		}
		res = sum + mx;
	} else {
		int sum = 0;
		for (int i = 0; i < N; i++) {
			if (i % 2 == 0) {
				sum += A[i];
			}
		}
		int x = 0;
		int mx = -INF;
		int mn = 0;
		for (int i = 0; i < N; i++) {
			if (i % 2 == 0) {
				x -= A[i];
				mx = max(mx, x - mn);
			} else {
				x += A[i];
				mn = min(mn, x);
			}
		}
		res = sum + mx;
	}
	cout << res << endl;
}

Measured memory_bytes: 4780
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


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

  int a,b,c;
  cin>>a>>b>>c;
  if(a>b) swap(a,b);
  Yes(a<c&&c<b);


}

Measured memory_bytes: 256
n = int(input())
arra = input().split(' ')
for i in range(len(arra)):
    arra[i] = int(arra[i])
j = 1
num = 0
oldlen = len(arra)

buf =[0] * oldlen
for i in range(oldlen):
    if arra[i] != j:
        num += 1
        buf[i] = 1
    else:
        j += 1
for i in range(oldlen-1, -1, -1):
    if buf[i] == 1:
        del arra[i]
newlen = len(arra)
if newlen == oldlen:
    print(0)
elif num == oldlen:
    print(-1)
else:
    print(num)

Measured memory_bytes: 19868
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll M, V, P;
ll A[MAX_N], B[MAX_N];
ll S[MAX_N];

bool C(int at) {
	if(at < P) return true;
	else {
		int v = V - (N - at) - (P - 1);
		int l = P - 1, r = at;
		if(A[l] <= A[r] + M && M * v <= (A[r] + M) * (r - l) - (S[r] - S[l])) return true;
		else return false;
	}
}

void solve() {
	cin >> N >> M >> V >> P;
	rep(i, 0, N) cin >> A[i];
	sort(A, A + N);
	reverse(A, A + N);
	rep(i, 0, N) B[i] = A[i] * -1;
	rep(i, 0, N) S[i + 1] = S[i] + A[i];

	int ok = 0, ng = N;
	while(abs(ng - ok) > 1) {
		int m = (ng + ok) / 2;
		if(C(m)) ok = m;
		else ng = m;
	}
	cout << ok + 1 << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 9216
#include<iostream>
#include<string>
#include<algorithm>
#include<map>

int main() {
	std::string s;
	bool flag = false;

	std::cin >> s;

	for (int i = 0; i < s.length() - 1; i++) {
		if (s[i] == s[i + 1]) {
			std::cout << i + 1 << " " << i + 2 << std::endl;
			return 0;
		}
	}

	for (int i = 0; i < s.length() - 2; i++) {
		if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
			std::cout << i + 1 << " " << i + 3 << std::endl;
			return 0;
		}
	}

	std::cout << -1 << " " << -1 << std::endl;
	return 0;
}

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

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const int MAX_N = 50000;
const int MAX_M = 20;
const int INF = INT_MAX / 2;

int dp[MAX_N + 1];

int solve(const int N, const int M, const vector<int> &coins) {
    for (int n = 1; n <= N; n++) {
        for (int m = 1; m <= M; m++) {
            if (n - coins[m] >= 0) {
                chmin(dp[n], dp[n - coins[m]] + 1);
            }
        }
    }

    return dp[N];
}

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<int> coins(M + 1);
    for (int i = 1; i <= M; i++) {
        cin >> coins[i];
    }

    for (int i = 0; i < MAX_N + 1; i++) {
        dp[i] = INF;
    }
    dp[0] = 0;

    cout << solve(N, M, coins) << endl;
    
    return 0;
}



Measured memory_bytes: 3300
def f(x, y):
    return y * (x // y + (1 if x % y else 0))
n = int(input())
x, y = 1, 1
for i in range(n):
    t, a = (int(_) for _ in input().split())
    nx = f(x, t)
    ny = max(nx // t * a, f(y, a))    
    nx = ny // a * t
    x, y = nx, ny
print(x + y)


Measured memory_bytes: 3068
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1;
#define cni cin

//{
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();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

int n,ans=INT_MAX,k,l,r;
vint v;

main(){
	cin>>n>>k;
	rep(i,n){
		int t;
		cin>>t;
		v.pb(t);
	}
	sort(rall(v));
	rep(i,n-k+1){
		l=v[i];
		r=v[i+k-1];
		debug(l,r);
		ans=min(ans,l-r);
	}
	dans;
}


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

using namespace std;
int main (){

   int N;
cin>>N;
int H[N];
for(int i=0;i<N;i++)
    cin>>H[i];
int cnt=1;
int nax = H[0] ;
for(int i=1;i<N;i++){
    if ( H[i] >= nax ){
        cnt++;
        nax = H[i] ;
    }
}
cout<<cnt;



    return 0;
}


Measured memory_bytes: 256
/*
 * atcoder/abc130/a.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>

using namespace std;

#define ll long long

#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

ll a, b;

void input() {
  cin >> a >> b;
}

void solve() {
  cout << ((a*3) + b) / 2 << endl;
}

int main() {
  // cout.precision(15);
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args : Array<String>) {
    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    val A = arrayListOf<Int>()
    for (i in 1..N) {
        A.add(0)
        if (1 == i) {
            continue
        }
        val a = sc.nextInt()
        A.set(a-1, A.get(a -1) + 1)
    }
    for (i in 0 until N) {
        println(A.get(i))
    }
}


Measured memory_bytes: 60920
using System;
using System.Linq;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int w = n[0];
            int h = n[1];
            int x = n[2];
            int y = n[3];
            int r = n[4];

            if (x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}



Measured memory_bytes: 20456
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
	char s1[10],s2[100];
	char *ret;
	int num,i,an=0;
	scanf("%s %d",s1,&num);
	for(i=1;i<=num;i++){
		scanf("%s",s2);
		strncat(s2,s2,10);
		if((ret=strstr(s2,s1))!=NULL){
		an++;
		}
	}
	printf("%d\n",an);
	return EXIT_SUCCESS;
}


Measured memory_bytes: 2048
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  int h, w;
  cin >> h >> w;
  set<int> H;
  set<int> W;
  vector<vector<char>> A(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      char a;
      cin >> a;
      A[i][j] = a;
      if (a == '#') {
        H.insert(i);
        W.insert(j);
      }
    }
  }

  for (int i : H) {
    for (int j : W) {
      cout << A[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import itertools

n, m, q = map(int, input().split())
I = list(range(1, m + 1))
A = list(map(list, itertools.combinations_with_replacement(I, n)))
l = len(A)
ans = [0 for i in range(l)]
for _ in range(q):
    a, b, c, d = map(int, input().split())
    for i in range(l):
        if A[i][b - 1] - A[i][a - 1] == c:
            ans[i] += d
print(max(ans))


Measured memory_bytes: 26340
#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<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#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++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a, b, c, d, n, k, x,l;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "Good";

    cin  >> x >> a;

    if(x < a) ans=0;
    else ans = 10;



    std::cout << ans << endl; 
    // std::cout << sans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

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

using namespace std;

struct Shop {
 string name;
 int point;
 int index;
};

bool cmp(const Shop &a, const Shop &b)
{
   // 名前が一緒ならば point の大きい方を返す
   if (a.name == b.name)
   {
       return a.point > b.point;
   }
   
   return a.name < b.name;
}

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

   vector<Shop> shop;

   for (int i = 1; i <= n; i++)
   {
       Shop s;

       cin >> s.name >> s.point;

       // 出力に使うための index を保存
       s.index = i;

       shop.push_back(s);
   }

   // 並び替え
   sort(shop.begin(), shop.end(), cmp);

   for (int i = 0; i < n; i++)
   {
       cout << shop[i].index << endl;
   }

   return 0;
}

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

using namespace std;
int main()
{
    string s;
    cin>>s;int i=0;
    while(s[i]!='\0'){
          if(s[i]>='a' && s[i]<='z') cout<<"a\n";
          else cout<<"A\n";
      i++;
    }






    return 0;
}



Measured memory_bytes: 3624
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] nums = new String[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.next();
        }
        long result = Stream.of(nums).distinct().count();
        if (result == 3) {
            System.out.println("Three");
        } else {
            System.out.println("Four");
        }
    }
}


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

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

    // D*2+1
    if (N % (D*2+1) == 0)
        cout << N / (D*2+1) << endl;
    else
        cout << N / (D*2+1)+1 << endl;
    
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  indata PIC X(100).
       01  a1 PIC 9(08).
       01  a2 PIC 9(08).
       01  a3 PIC 9(08).
       01  r pic 9(08).
       PROCEDURE DIVISION.
        ACCEPT indata.
        
        UNSTRING indata DELIMITED BY SPACE INTO a1 a2 a3.

        COMPUTE r = a1 + a2 + a3

         IF r >= 22 THEN
           DISPLAY "bust"
         ELSE
           DISPLAY "win"
         END-IF


       STOP RUN.


Measured memory_bytes: 764
C = [[int(x) for x in input().split()] for y in range(3)]

if C[0][1] - C[0][0] != C[1][1] - C[1][0] or C[1][1] - C[1][0] != C[2][1] - C[2][0]:
    print("No")
elif C[0][2] - C[0][1] != C[1][2] - C[1][1] or C[1][2] - C[1][1] != C[2][2] - C[2][1]:
    print("No")
elif C[0][2] - C[0][0] != C[1][2] - C[1][0] or C[1][2] - C[1][0] != C[2][2] - C[2][0]:
    print("No")
elif C[1][0] - C[0][0] != C[1][1] - C[0][1] or C[1][1] - C[0][1] != C[1][2] - C[0][2]:
    print("No")
elif C[2][0] - C[1][0] != C[2][1] - C[1][1] or C[2][1] - C[1][1] != C[2][2] - C[1][2]:
    print("No")
elif C[2][0] - C[0][0] != C[2][1] - C[0][1] or C[2][1] - C[0][1] != C[2][2] - C[0][2]:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) b.rbegin(),v.rend()
typedef long long ll;
//isPrime
//modpow modinv
int main() {
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  int n = s.size();
  int count = 0;
  
  for(int i=0; i<n/2; i++){
    if(s.at(i)!=s.at(n-i-1)){
      count++;
    }
  }
  
  cout << count << endl;
}



Measured memory_bytes: 256
import Text.Printf

main = getLine >>= show' . solve . read'
  where
    show' (a, b, c) = putStrLn $ printf "%.9f %.9f %.9f" a b c
    solve [a, b, cDeg] = (area, len, height)
      where
        height = 2 * area / a
        len = a + b + c
        area = a * b * (sin cRad) / 2
        c = sqrt $ (a ** 2) + (b ** 2) - 2 * a * b * (cos cRad)
        cRad = (2 * pi * cDeg) / 360
    read' = map read . words :: String -> [Double]



Measured memory_bytes: 4172
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
//#define ll long long
#define P pair<ll,ll>

struct unionFind{
	int n;
	vector<int>par;
	vector<int>rank;
	vector<int>size;
	
	unionFind(int x){
		n=x;
		par.resize(x);
		rank.resize(x);
		size.resize(x);
		rep(i,n){
			par[i]=i;
			rank[i]=0;
			size[i]=1;
		}
	}
	
	int find(int x){
		if(par[x]==x)return x;
		else return par[x]=find(par[x]);
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	
	void unite(int x,int y){//x,yを併合
		x=find(x);
		y=find(y);

		if(x==y)return;
		if(rank[x]<rank[y]){
			par[x]=par[y];

		}
		else{
			par[y]=x;

			if(rank[x]==rank[y])rank[x]++;
		}
	}
};

int n,k,l;
int a,b;
map<pair<int,int>,int>ta;

vector<int>g[300000];
int t1[300000],t2[300000];

int main(){
	cin>>n>>k>>l;
	unionFind u1(n),u2(n);
	rep(i,k){
		cin>>a>>b;
		a--;
		b--;
		u1.unite(a,b);
	}
	rep(i,l){
		cin>>a>>b;
		a--;
		b--;
		u2.unite(a,b);
	}
	
	rep(i,n)t1[i]=u1.find(i),t2[i]=u2.find(i);

	rep(i,n)ta[mp(t1[i],t2[i])]++;
	
	rep(i,n){
		cout<<ta[mp(t1[i],t2[i])];
		if(i==n-1)cout<<endl;
		else cout<<" ";
	}

}


Measured memory_bytes: 25472
import scala.io.StdIn.readLine
import scala.collection.mutable.PriorityQueue
object Main{

  def main(args: Array[String]):Unit = {
    var n = readInt
    while(n > 0){
      val sq = new PriorityQueue[Int]()(Ordering.Int.reverse)
      val tq = new PriorityQueue[Int]()(Ordering.Int.reverse)
      var ans = 0
      var train = 0

      for(i <- 1 to n){
        val hmss = gethms() map (a => calcTime(a))
        sq += hmss(0)
        tq += hmss(1)
      }
      while( !(sq.isEmpty && tq.isEmpty) ){
        var s = 100000000
        var t = 100000000
        if( sq.length > 0 ){
          s = sq.head
        }
        if( tq.length > 0){
          t = tq.head
        }

        if( s >= t ){
          tq.dequeue()
          train -= 1
        }else if( t > s){
          sq.dequeue()
          train += 1
          ans = List(train,ans).max
        }
      }

      println(ans)
      n = readInt
    }
  }

  def gethms(): Array[Array[Int]] = {
    readLine.split(" ") map ( a => a.split(":") map (b => b.toInt) )
  }

  def calcTime(hms: Array[Int]):Int = {
        hms(2) + 60*hms(1) + 3600*hms(0)
  }
}

Measured memory_bytes: 186680
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}
ll s[N];
int main()
{
	ll n,i,k;
	sl(n);sl(k);
	ll minn = INF;
	for(i =0 ;i < n;i++)
		sl(s[i]);
	sort(s,s+n);
	for(i = 0;i + k -1< n;i++)
	{
		ll t = s[i+k-1]-s[i];
		minn = min(minn,t);
	}
	printf("%lld\n",minn);
	return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3

d = int(input())
c = list(map(int, input().split()))
s = [[0 for _ in range(26)] for _ in range(d)]
for i in range(d):
    s[i] = list(map(int, input().split()))

def maxcontest(s):
    ans = -1
    for i in range(26):
        if ans <= s[i]:
            ans = s[i]
            num = i 
    return num+1

for i in range(d):
    print(maxcontest(s[i]))


Measured memory_bytes: 9500
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){

  int N;
  cin >> N;
  vector<float> vec;

  float a;
  float sum =0;
  for(int i=0;i<N;i++){
    cin >> a;
    vec.push_back(a);
  }

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

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

  cout << vec[N-1] << endl;

  return 0;

}

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

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

	string ans;
	
	if (b < a) {
		cout << "GREATER" << endl;
	}
	else if (a < b) {
		cout << "LESS" << endl;
	}
	else {
		cout << "EQUAL" << endl;
	}
	
	return 0;	
}

Measured memory_bytes: 380
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
const int N=2e5+5;
typedef long long ll;
struct Edge {
    int u,v;ll c;
    bool operator < (const Edge &b) const {
        return c<b.c;
    }
};
std::vector<Edge> g;
int par[N],n;ll a[N],D;
void init() {
    for(int i=1;i<=n;i++) par[i]=i;
}
int fd(int x) {
    return par[x]==x?x:par[x]=fd(par[x]);
}
void solve(int l,int r) {
    if(l>=r) return;
    int mid=(l+r)>>1;
    int L=l,R=mid+1;
    for(int i=l+1;i<=mid;i++) {
        if(a[i]-D*i<a[L]-L*D) L=i;
    }
    for(int i=mid+2;i<=r;i++) {
        if(a[i]+D*i<a[R]+R*D) R=i;
    }
    for(int i=l;i<=r;i++) {
        if(i<=mid) g.push_back((Edge){i,R,a[i]+a[R]+(R-i)*D});
        else g.push_back((Edge){L,i,a[L]+a[i]+(i-L)*D});
    }
    solve(l,mid);
    solve(mid+1,r);
}
ll kruskal() {
    init();
    std::sort(g.begin(),g.end());
    ll ans=0;
    for(Edge &w:g) {
        int u=fd(w.u),v=fd(w.v);
        if(u!=v) par[u]=v,ans+=w.c;
    }
    return ans;
}
int main() {
    scanf("%d%lld",&n,&D);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    solve(1,n);printf("%lld\n",kruskal());
    return 0;
}


Measured memory_bytes: 69472
S = input()
if 'A' not in S or 'C' not in S:
    print('WA')
else:
    if S.find('A') != 0:
        print('WA')
    else:
        T = S.replace('A', 'a', 1)
        if T.find('C') == 1 or T.rfind('C') == len(S)-1:
            print('WA')
        else:
            U = T.replace('C', 'c', 1)
            if U.islower() == False:
                print('WA')
            else:
                print('AC')

Measured memory_bytes: 3060
def is_reachable(time, x, y):
  if time < x + y:
    return False
  if (time - x - y) % 2 == 0:
    return True
  else:
    return False
  
N=int(input())
X=[list(map(int, input().split())) for i in range(N)]
t = 0
x = 0
y = 0
for i in range(N):
  if is_reachable(X[i][0]-t, abs(X[i][1]-x), abs(X[i][2]-y)):
    t = X[i][0]
    x = X[i][1]
    y = X[i][2]
  else:
    print("No")
    break
else:
  print("Yes")
  

Measured memory_bytes: 27380
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var data = input.split( '\n' );
  var n = parseInt( data[0] );
  var x = data[1].split( ' ' ).map( Number );
  var y = data[2].split( ' ' ).map( Number );
  var Dxy = 0;
  var Dxy2 = 0;
  var Dxy3 = 0;
  var Dmax = 0;
  var t;
  for( var i=0; i<n; i++ ) {
    t = Math.abs( x[i]-y[i] );
    Dxy += t;
    Dxy2 += Math.pow( t, 2 );
    Dxy3 += Math.pow( t, 3 );
    Dmax = Math.max( Dmax, t );
  }
  console.log( Dxy );  
  console.log( Math.sqrt( Dxy2 ) );
  console.log( Math.pow( Dxy3, 1/3 ) );
  console.log( Dmax );
});

Measured memory_bytes: 16200
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	vector<int> vec;vec.push_back(0);
	for(int i = 0;i<n;i++)
	{
		int x;s(x);
		vec.push_back(x);
	}
	
	int count = n;
	vector<int> arr(n+1 , 0);
	
	for(int i = 0;i<m;i++)
	{
		int x,y;
		cin>>x>>y;
		if(vec[x] <= vec[y] && arr[x] == 0)
		{
			count--;arr[x]=1;
		}
		
		if(vec[y] <= vec[x] && arr[y] == 0)
		{
			count--;arr[y]=1;
		}
	}
	
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 4332
N = int(input())
H = [int(_) for _ in input().split()]

DP = [-1 for _ in range(len(H))]
DP[-1] = 0

for i in range(len(H)-2, -1, -1):
    if H[i] >= H[i+1]:
        DP[i] = DP[i+1] + 1
    else:
        DP[i] = 0
    
print(max(DP))

Measured memory_bytes: 14252
#include<iostream>
#include<string>

using namespace std;

int main(){
    string input;

    cin >> input;

    int n = input.size();
    for(int i=0;i<n;i++){
        if(i%2){
            if(input[i]=='R'){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if(input[i]=='L'){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
import heapq
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

arr = p[:X] + q[:Y]
heapq.heapify(arr)
for n in r:
    if n < arr[0]:
        break
    if n > arr[0]:
        heapq.heappop(arr)
        heapq.heappush(arr, n)
print(sum(arr))

Measured memory_bytes: 23456
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ll q, h, s, d, n, ans = 0;
  vector<ll> a(5, 0);
  cin >> q >> h >> s >> d >> n;
  if(n>=2){
    a[0] = q * 8;
    a[1] = h * 4;
    a[2] = s * 2;
    a[3] = d;
    a[5] = min(a[0], min(a[1], min(a[2], a[3])));
    ans += n / 2 * a[5];
    n -= n / 2 * 2;
  }
  if(n>=1){
    a[0] = q * 4;
    a[1] = h * 2;
    a[2] = s;
    a[5] = min(a[0], min(a[1], a[2]));
    ans += a[5];
  }
  cout << ans << endl;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#include <atcoder/math>

using namespace std;
using namespace atcoder;

int main(){
	int t;
	cin >> t;
	while(t--){
		int n,m,a,b;
		cin >> n >> m >> a >> b;
		cout << floor_sum(n,m,a,b) << "\n";
	}
	return 0;
}


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

int main(){
  unsigned long long n, a, b, ans;
  cin >> n >> a >> b;
  ans = n / (a+b);
  ans *= a;
  ans += min(a, n % (a+b));

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys

N = int(input())

ans = 0
for j in range(1, N+1):
    if j % 2 == 0:
        continue
    s = int(j / 3)
    count = 0
    for i in range(1, s+1):
        if j % i == 0:
            count += 1
    if count == 7:
        ans += 1
print(ans)

Measured memory_bytes: 3060
"""
問題の解釈
長さがlであるような文字列の中で辞書順でk番目のものを求めよ

26進表記における位の値の求め方
1. 変数xをk-1で初期化し、xが0となるまで以下の操作を繰り返す
2. xを26で割った商がq、余りがrであるとする。この操作がi回目に実行された時のrがk-1の下からi番目の桁である。xをqで置き換える
"""
ALPHABET = "abcdefghijklmnopqrstuvwxyz"

n = int(input())

# 長さの判定
# 26 **11 > 10*15より
ll = 0
for l in range(1, 12):
    ll += 26**l
    if ll >= n:
        break

ans = []
for li in range(1, l+1):
    r = n % 26
    q = n // 26
    if r == 0:
        q -= 1
    ans.append(r)
    n = q

answer = ""
for s in ans[::-1]:
    answer += ALPHABET[s-1] 
print(answer)





Measured memory_bytes: 9140
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int n;
    cin >> n;
    vector<int> v(10001, 0);
    v[0] = 1;
    int s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        for (int j = 10000; j - s >= 0; j--) {
            v[j] = max(v[j], v[j - s]);
        }
    }
    int res = 0;
    for (int i = 0; i <= 10000; i++) {
        if (i % 10 != 0 && v[i] > 0) {
            res = max(i, res);
        }
    }
    cout << res << endl;
}




Measured memory_bytes: 3656
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
for i in range(n):
    a,b = inpl()
    if i == 0:
        x = a; y = b
        continue
    if x <= a and y <= b:
        x = a; y = b
        continue
    c = -(-x//a); d = -(-y//b)
    tmp = max(c,d)
    x = a*tmp; y = b*tmp
    # print(x,y)
print(x+y)


Measured memory_bytes: 64364
/**********************************************************************/
/********                                                      ********/
/********                     Writer:孙~~                      ********/
/********                       Lang:C++                       ********/
/********                     Status:Unknow                    ********/
/********                                                      ********/
/**********************************************************************/
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

const int INF=0x3f3f3f3f;
//const int SIZE=;
const double EPS=1e-6;

int main(){
	/*main function start*/
	int n,k;
	cin>>n>>k;
	int up=(n+1)/2;
	if(k<=up) puts("YES"); else puts("NO");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
typedef pair<ll, ll> P;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(){
    int n;
    cin>>n;
    vector<ll>a(n),b(n);
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        a[i]=x+y;
        b[i]=x-y;
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    ll ans=max(abs(a[0]-a[n-1]),abs(b[0]-b[n-1]));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6384
def insertionSort arr, n, g
    for i in g ... n
        v = arr[i]
        j = i - g
        while j >= 0 && arr[j] > v
            arr[j + g] = arr[j]
            j -= g
            @count += 1
        end
        arr[j + g] = v
    end
end
 
def shellSort arr, n
    @count = 0
 
    g = []
    interval = 1
    begin
        g << interval
        interval = g.last * 2 + 1
    end while interval < n
    g.reverse!
    m = g.length
 
    for i in 0 ... m
        insertionSort(arr, n, g[i])
    end
 
    puts m
    puts g.join(" ")
    puts @count
end
 
n = gets.to_i
arr = Array.new(n)
n.times{|i| arr[i] = gets.to_i}
shellSort(arr, n)
puts arr

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

int main(void) {
    int n, x;
    cin >> n >> x;
    int xi, d;
    cin >> xi;
    d = abs(x - xi);
    for (int i = 1; i < n; ++i) {
        cin >> xi;
        xi = abs(x - xi);
        d = __gcd(d, xi);
    }
    cout << d << endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    ll n, mins = INF;
    cin >> n;
    set<ll>s;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            s.insert(i);
            if (i * i != n)s.insert(n / i);
        }
    }
    for (auto ss : s) {
        mins = min(mins, (ss + n / ss)-2);
    }
    cout << mins << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int a,b;
  cin>>a>>b;
  int c=gcm(a,b);
  cout<<3*(a-c)<<endl;
}
  /*while(c){
  if(a%2==0){
    d++;
    a/=2;
  }
  else
    c=0;
  }
  
    cout<<3*a/2<<endl;
      else
  cout<<3*a-3<<endl;
}*/


Measured memory_bytes: 256