akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,N) for(ll i=0; i<N; i++)
using namespace std;
using ll = long long;

int main(){
    string s; cin >> s;

    bool f = false;
    rep(i,s.size()-1){
        if(s[i] == s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            f = true;
            break;
        }
        if(s[i] == s[i+2] && i+2<s.size()-1){
            cout << i+1 << " " << i+3 << endl;
            f = true;
            break;
        }
    }
    if(!f) cout << "-1 -1" << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;

int main() {
    ll x,y,count=0;
    cin >> x >> y;
    while (x <= y) {
        x *= 2;
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll  long long
#define endl '\n'
#define pi 3.14159265
//seen soln
int main()
{       
    IOS;
    ll n,l;
    cin>>n>>l;
    vector<ll> v(n);
    for(ll i=0;i<n;i++)
    	cin>>v[i];
    ll ind=-1;
    for(ll i=0;i<n-1;i++)
    {
    	if(v[i]+v[i+1]>=l)
    	{
    		ind=i;
    		break;
    	}
    }
    if(ind==-1)
    {
    	cout<<"Impossible";
    	return 0;
    }
    cout<<"Possible"<<endl;
    for(ll i=0;i<ind;i++)
    {
    	cout<<i+1<<endl;
    }
    for(ll i=n-1;i>ind+1;i--)
    	cout<<i<<endl;
    cout<<ind+1;
}   

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    lli n, k;
    cin2(n,k);
    lli h[n];
    ncin1(n,h);
    lli ans = 0;
    REP(i,0,n) {
        if (h[i] >= k)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import sys, math
from bisect import bisect_right
sys.setrecursionlimit(10**9)

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N, A, B = mi()
    if (A-B)%2:
        print("Borys")
    else:
        print("Alice")

if __name__ == "__main__":
    main()

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int n, m, q;
vector<tuple<int, int, int, int>> query(50);
vector<int> num;
int ans = 0;

void dfs() {
  if(num.size() == n+1) {
    int tmp = 0;
    for(auto x : query) {
      int a = get<0>(x), b = get<1>(x), c = get<2>(x), d = get<3>(x);
      if(num[b] - num[a] == c) tmp += d;
    }
    chmax(ans, tmp);
    return;
  }
  for(int add = num.back(); add <= m; ++add) {
    num.push_back(add);
    dfs();
    num.pop_back();
  }
}

int main()
{
  cin >> n >> m >> q;
  rep(i, q) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    query[i] = make_tuple(a, b, c, d);
  }
  num.push_back(1);
  dfs();
  cout << ans << endl;
}


Measured memory_bytes: 3524
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int defIdx = -1;
        int defNum = -1;
        boolean swaped = false;
        boolean ans = true;
        for (int i = 1; i <= n; i++) {
            int x = sc.nextInt();
            if(x != i){
                if(swaped){
                    ans = false;
                    break;
                }else{
                    if(defIdx < 0){
                        defIdx = i;
                        defNum = x;
                    }else{
                        if(defIdx == x && i == defNum){
                            swaped = true;
                        }else{
                            ans = false;
                            break;
                        }
                    }
                }
            }
        }
        System.out.println(ans ? "YES" : "NO");
        sc.close();

    }

}


Measured memory_bytes: 23124
for e in iter(input,'0 0'):
 r=int(e.split()[0])
 d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
 a=0
 for m in range(1<<~-r):
  t=0
  for s in d:
   c=bin(m^s).count('1')
   t+=c if c>r//2 else r-c
  if a<t:a=t
 print(a)


Measured memory_bytes: 6916
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    set<int> st;
    rep(i, 0, n){
        int a;
        cin >> a;
        if(st.count(a)) st.erase(a);
        else st.insert(a);
    } 
    cout << st.size() << endl;
}

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

using namespace std;

const int px[4] = {0, 1, 0, -1};
const int py[4] = {1, 0, -1, 0};

int h, w, cx, cy, dx, dy, stp[1005][1005];
char s[1005][1005];

queue<pair<int, int>> Q;

void expand(pair<int, int> gg) {
    queue<pair<int, int>> Q2;
    Q2.push(gg);
    while (!Q2.empty()) {
        auto g = Q2.front();
        Q2.pop();
        Q.push(g);
        for (int j = 0; j < 4; j++) {
            int u = g.first + px[j], v = g.second + py[j];
            if (u > 0 && u <= h && v > 0 && v <= w && s[u][v] == '.' && !stp[u][v]) {
                stp[u][v] = stp[g.first][g.second];
                Q2.push({u, v});
                Q.push({u, v});
            }
        }
    }
}

int main() {
    scanf("%d%d%d%d%d%d", &h, &w, &cx, &cy, &dx, &dy);
    for (int i = 1; i <= h; i++)
        scanf("%s", s[i] + 1);
    stp[cx][cy] = 1;
    expand({cx, cy});
    while (!Q.empty()) {
        auto g = Q.front();
        Q.pop();
        for (int i = -2; i <= 2; i++)
            for (int j = -2; j <= 2; j++) {
                int u = g.first + i, v = g.second + j;
                if (u > 0 && u <= h && v > 0 && v <= w && s[u][v] == '.' && !stp[u][v]) {
                    stp[u][v] = stp[g.first][g.second] + 1;
                    expand({u, v});
                }
            }
    }
    printf("%d", stp[dx][dy] - 1);
    return 0;
}

Measured memory_bytes: 8836
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

//#define int long long

#define mp(a, b) make_pair(a, b)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define endl '\n'

using namespace std;
typedef long long ll;
typedef long double ld;

mt19937 mrand(random_device{}());

double PI = acos((double)-1);
const ld eps = 1e-7;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
//const ll mod = 1e9 + 9;
const ll mod = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

const int N = 2e5 + 7;
vector<int> g[N];

vector<int> f1, f2;
int d[N];

void dfs(int v, int last = -1) {
	if (last == -1) d[v] = 0;
	else d[v] = d[last] + 1;
	if (d[v] & 1) f1.push_back(v);
	else f2.push_back(v);
	for (int u : g[v]) {
		if (u == last) continue;
		dfs(u, v);
	}
}

int c[N];

int c1, c2, c3;

void solve() {
	int n; cin >> n;
	c1 = (n + 2) / 3;
	c2 = (n + 1) / 3;
	c3 = n / 3;
	for (int i = 1; i < n; i++) {
		int a, b; cin >> a >> b; a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0);
	int x = n / 3;
	fill(c, c + N, 0);
	if (f1.size() <= x) {
		for (int i : f1)
			c[i] = 3;
	}
	else if (f2.size() <= x) {
		for (int i : f2)
			c[i] = 3;
	}
	else {
		for (int i = 0; i < c1; i++){
			c[f1[i]] = 1;
		}
		for (int i = 0; i < c2; i++){
			c[f2[i]] = 2;
		}
	}
	for (int i = 0; i < n; i++) {
		if (c[i] == 3) {
			c[i] = 3 * c3;
			c3--;
		}
		else if (c[i] == 2) {
			c2--;
			c[i] = 3 * c2 + 2;
		}
		else if (c[i] == 1) {
			c1--;
			c[i] = 3 * c1 + 1;
		}
	}
	for (int i = 0; i < n; i++) {
		if (!c[i]) {
			if (c1) {
				c1--;
				c[i] = 3 * c1 + 1;
			}
			else if (c2) {
				c2--;
				c[i] = 3 * c2 + 2;
			}
			else {
				c[i] = 3 * c3;
				c3--;
			}
		}
		cout << c[i] << " ";
	}
	return;
}

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

using namespace std;

const int MAX_N = 24;
int N;
int color[MAX_N];
int ride[MAX_N];
int x[MAX_N];
int y[MAX_N];
int r[MAX_N];
char d[1 << MAX_N];

bool isCollision ( int x1, int y1, int r1, int x2, int y2, int r2 )
{
	int xx = x1 - x2, yy = y1 - y2, rr = r1 + r2;
	return (xx * xx + yy * yy) < (rr * rr);
}

int main ( void )
{
	while (cin >> N, N) {
		fill(ride, ride+N, 0);
		for (int i = 0; i < N; ++i) {
			cin >> x[i] >> y[i] >> r[i] >> color[i];
			for (int j = 0; j < i; ++j) {
				if (isCollision(x[i], y[i], r[i], x[j], y[j], r[j])) {
					ride[i] |= (1 << j);
				}
			}
		}
		fill(d, d+(1 << N), -1);
		int state = (1 << N) - 1;
		char ans = 0;
		d[state] = 0;
		for (; state > 0; --state) {
			if (d[state] == -1) { continue; }
			for (int i = 0; i < N; ++i) {
				if (state & (1 << i) && !(state & ride[i])) {
					for (int j = i+1; j < N; ++j) {
						if (state & (1 << j) && !(state & ride[j]) && color[i] == color[j]) {
							int next = state & ~((1 << i) | (1 << j));
							d[next] = max<char>(d[next], d[state] + 2);
							ans = max<char>(ans, d[next]);
						}
					}
				}
			}
		}
		cout << (int)ans << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

struct UnionFind{
    vector<int> d;
    UnionFind(int n): d(n,-1) {}
    int find(int x){
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(d[x] < d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return -d[find(x)];
    }
};

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    UnionFind uf(n);
    for(int i = 0; i < m; i++) {
        int x,y,z;
        cin >> x >> y >> z;
        --x;
        --y;
        uf.unite(x,y);
    }

    map<int,int> mp;
    for(int i = 0; i < n; i++) {
        int pr=uf.find(i);
        mp[pr]++;
    }
    int ans=mp.size();
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 8308
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

struct TWO{
    long long int a,b;
};

bool cmp(TWO x,TWO y){
    if(x.a!=y.a){
        return x.a<y.a;
    }else{
        return x.b<y.b;
    }
}

int main() {
    const long long int mod = 1000000007,INF=50000000000000;
    typedef pair<long long int,long long int>P;
	map<long long int, long long int>mp;
    priority_queue<P,vector<P>,greater<P> >mazuisushi;
    
    priority_queue<P>umaisushi;
	cout << fixed << setprecision(10);
    string str;
    long long int h,w,n;
    long long int a[20003],b[20003],p[20003],tmp=0,fin[10]={};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    for(int i=1;i<=n;i++){
        a[i]=40000*i;
        b[i]=40000*(n+1-i);
    }
    for(int i=0;i<n;i++){
        a[p[i]]+=i;
    }
    
    for(int i=1;i<=n;i++){
        cout<<a[i]<<" ";
    }
    cout<<endl;
    
    for(int i=1;i<=n;i++){
        cout<<b[i]<<" ";
    }
} 


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

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

using namespace std;

int main(){
	int n, d;
	while (cin >> n >> d, n){
		vector<vector<int>> v(n);
		rep(i, n){
			int m;
			cin >> m;
			v[i].resize(m + 1);
			rep(j, m) cin >> v[i][j + 1];
			rep(j, m) v[i][j + 1] += v[i][j];
		}
		if (n == 1){
			cout << "Yes" << endl;
			continue;
		}

		vector<int> idx(n);
		while (1){
			//rep(i, n){
			//	cout << v[i][idx[i]] << ' ';
			//}cout << endl;
			bool upd = false;
			vector<int> x(n);
			rep(i, n) x[i] = v[i][idx[i]];
			sort(x.begin(), x.end());
			int m1 = x[0], m2 = x[1];

			rep(i, n){
				if (idx[i] + 1 == v[i].size()) continue;
				int nm = v[i][idx[i]] == m1 ? m2 : m1;
				if (v[i][idx[i] + 1] <= nm + d){
					++idx[i];
					upd = true;
					break;
				}
			}
			if (!upd) break;
		}
		bool ok = true;
		rep(i, n){
			if (idx[i] + 1 != v[i].size()) ok = false;
		}
		cout << (ok ? "Yes" : "No") << endl;
	}

	return 0;
}

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

int main() {
	int a,b[51],c[51],count=0;
	cin>>a;
	for(int i=0; i<a; i++){
		cin>>b[i];
		c[i] = b[i];
	}
	for(int i=a-1; i>0; i--){
		for(int j=0; j<i; j++){
			if(b[j]>b[j+1]){
				int t=b[j];
				b[j] = b[j+1];
				b[j+1] = t;
			}
		}
	}
	for(int i=0; i<a; i++){
		count += (b[i]!=c[i]);
	}
	if(count<=2){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};

signed main(){
    int N, h[100];
    cin >> N;
    REP(i, N) cin >> h[i];
    bool updated = true;
    int cnt = 0;
    while(updated){
        updated = false;
        REP(i, N){
            if((i < N - 1 && h[i] > 0 && h[i + 1] == 0) || (i == N - 1 && h[i] > 0)){
                cnt++;
                updated = true;
            }
            if(h[i] > 0){
                h[i]--;
            }
        }
    }
    PRINT(cnt);
    return 0;
}

Measured memory_bytes: 256
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal as D  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as F  #F(a,b)で正確なa/b
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########

n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
j=0 ;bef=-1
for i in range(n):
    if bef!=A[i]:j=0
    if A[i]==B[i]:
        
        while j<n:
            if A[i]!=B[j] and A[i]!=A[j]:
                B[i],B[j]= B[j],B[i]
                break
            j+=1
        else:
            print("No");exit()
    bef=A[i]

print("Yes")
print(*B)


Measured memory_bytes: 119568
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N,D;
  cin>>N>>D;
  int tit;
  tit=2*D+1;
  int ans;
  if(N%tit==0){
    ans=N/tit;
  }
  else{
    ans=N/tit+1;
  }
  cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);

    int A, B;
    cin >> A >> B;
    for (int i = 1; i <= 10000; i++)
    {
        int x = (i * 8) / 100;
        int y = (i * 10) / 100;
        if (x == A && y == B)
        {
            cout << i << "\n";
            return 0;
        }
    }
    cout << "-1\n";
}

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


int cld(int a,int b){
    return (a + (b - 1)) / b;
}

int main(){
    int N,D;
    cin >> N >> D;
    cout << cld(N,2 * D + 1) << endl;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import Data.Array.Unboxed
import Data.Array.ST
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Control.Monad.ST
import Data.STRef 
import Data.List
import Data.Char
import qualified Data.Map.Strict as M

convert :: Int -> Int -> VU.Vector (Int,Int) -> V.Vector [Int]
convert n m graph = V.create $ do
    v <- VM.replicate n []
    forM_ [0..m-1] $ \i -> do
        let (x,y) = graph VU.! i
        VM.modify v (y-1:) (x-1)
        VM.modify v (x-1:) (y-1)
    return v

main :: IO ()
main = do
    [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    graph' <- VU.replicateM m $ (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    let graph = convert n m graph'
    let vec = VU.create $ do
        vec <- VUM.replicate n (-1)
        VUM.write vec 0 0
        go [0] [] vec
        where go :: [Int] -> [Int] -> VUM.MVector s Int -> ST s (VUM.MVector s Int)
              go [] [] vec = return vec
              go [] ys vec = go ys [] vec
              go (n:ns) ys vec = do
                  now <- VUM.read vec n
                  ls <- newSTRef ys
                  forM_ (graph V.! n) $ \i -> do
                      b <- VUM.read vec i
                      when (b == -1) $ VUM.write vec i n >> modifySTRef ls (i:)
                  ln <- readSTRef ls
                  go ns ln vec
    putStrLn "Yes"
    VU.mapM_ print $ VU.map (+1) $ VU.tail vec

Measured memory_bytes: 42984
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<pair<string, int> > s(n);
    vector<int> longStr;
    for(int i=0; i<n; ++i){
        cin >> s[i].first;
        if(s[i].first.size() >= 1000)
            longStr.push_back(i);
        s[i].second = i + 1;
    }
    sort(s.begin(), s.end());

    vector<int> index(n+1);
    for(int i=0; i<n; ++i)
        index[s[i].second] = i;

    map<pair<int, int>, bool> compLongStr;
    for(int x : longStr){
        for(int y : longStr){
            compLongStr[make_pair(x, y)] = (s[y].first.substr(0, s[x].first.size()) == s[x].first);
        }
    }

    int q;
    cin >> q;
    set<int> dic;
    while(--q >= 0){
        int k, x;
        cin >> k >> x;
        x = index[x];

        if(k == 1){
            dic.insert(x);
        }
        else if(k == 2){
            dic.erase(x);
        }
        else{
            auto it = dic.lower_bound(x);
            if(it == dic.end()){
                cout << -1 << endl;
                continue;
            }

            int y = *it;
            if(compLongStr.find(make_pair(x, y)) != compLongStr.end()){
                if(compLongStr[make_pair(x, y)])
                    cout << s[y].second << endl;
                else
                    cout << -1 << endl;
            }
            else{
                if(s[y].first.substr(0, s[x].first.size()) == s[x].first)
                    cout << s[y].second << endl;
                else
                    cout << -1 << endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 12912
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector <int> G[MAX];
int color[MAX];

void dfs(int r, int c) {
  stack<int> S;
  S.push(r);
  color[r] = c;
  while ( !S.empty() ) {
    int u = S.top(); S.pop();
    for ( int i = 0; i < G[u].size(); i++ ) {
      int v = G[u][i];
      if ( color[v] == NIL ) {
        color[v] = c;
        S.push(v);
      }
    }
  }
}

void assignColor() {
  int id = 1;
  for ( int i = 0; i < n; i++ ) color[i] = NIL;
  for ( int u = 0; u < n; u++ )
    if ( color[u] == NIL ) dfs(u, id++);
}

int main() {
  int s, t, m, q;

  cin >> n >> m;

  for ( int i = 0; i < m; i++ ) {
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  assignColor();

  cin >> q;

  for ( int i = 0; i < q; i++ ) {
    cin >> s >> t;
    if ( color[s] == color[t] )
      cout << "yes" << endl;
    else
      cout << "no" << endl;
  }

  return 0;
}


Measured memory_bytes: 8980
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;


public class Main{
    public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    }
 
}



Measured memory_bytes: 24624
#include <cstdio>
#include <iostream>
typedef long long ll;
const int N = 5e3 + 5;
const int M = 205;
inline int Get() {
	char ch;
	while ((ch = getchar()) < '0' || ch > '9');
	int Num = ch - '0';
	while ((ch = getchar()) >= '0' && ch <= '9')
		Num = (Num << 3) + (Num << 1) + ch - '0';
	return Num;
}
int n, m, l[N], r[N], que[N], qn;
ll a[N], w[N][M], g[N][N], ans;
int main() {
	n = Get(), m = Get();
	for (int i = 2; i <= n; ++i) a[i] = a[i - 1] + Get(); 
	
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j) w[i][j] = Get();
	
	for (int k = 1; k <= m; ++k) {
		qn = 0;
		for (int i = 1; i <= n; ++i) {
			while (qn > 0 && w[que[qn]][k] <= w[i][k]) --qn;
			l[i] = (qn ? que[qn] + 1 : 1); que[++qn] = i;
		}
		
		qn = 0;
		for (int i = n; i; --i) {
			while (qn > 0 && w[que[qn]][k] < w[i][k]) --qn;
			r[i] = (qn ? que[qn] - 1 : n); que[++qn] = i;
		}
		
		for (int i = 1; i <= n; ++i) {
			g[l[i]][i] += w[i][k], g[l[i]][r[i] + 1] -= w[i][k];
			g[i + 1][i] -= w[i][k], g[i + 1][r[i] + 1] += w[i][k];
		}
	}
	
	for (int l = 1; l <= n; ++l) 
		for (int r = 1; r <= n; ++r)
			g[l][r] += g[l - 1][r] + g[l][r - 1] - g[l - 1][r - 1];
		
	ans = g[1][n] - (a[n] - a[1]);
	for (int l = 1; l <= n; ++l)
		for (int r = l; r <= n; ++r)
			ans = std :: max(ans, g[l][r] - (a[r] - a[l]));
	printf("%lld\n", ans);
}

Measured memory_bytes: 204032
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  double res=0;
  rep(i,n){
    double b;cin>>b;
    res+=1/b;
  }
  cout<<setprecision(12)<<1/res<<endl;
  return 0;

}


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

int main() {
    double w, h, x, y;
    cin >> w >> h >> x >> y;

    cout << w*h/2 << " ";

    if ((w - x) == x && (h-y) ==y) cout << "1" << endl;
    else cout << "0" << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000
#define PI 3.141592653589793

int main() {
	int k;
	cin >> k;
	vector<int> table = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

	cout << table[k - 1];

	return 0;
}

Measured memory_bytes: 3608
a,b,c,d=map(int,input().split())
turn=0
while a>0 and c>0:
  if turn%2==0:
    c-=b
  else:
    a-=d
  if c<=0:
    ans="Yes"
  if a<=0:
    ans="No"
  turn+=1
print(ans)

Measured memory_bytes: 9176
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
#include<cstdint>
//#include<>
using namespace std;

typedef int64_t i64;typedef int32_t i32;
typedef int16_t i16;typedef int8_t i8;
typedef uint64_t ui64;typedef uint32_t ui32;
typedef uint16_t ui16;typedef uint8_t ui8;

typedef i32 int__;
#define rep(i,j) for(int__ i=0;i<j;i++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);i++)
#define repeat_eq(i,j,k) for(int__ i=(j);i<=(k);i++)
#define all(v) begin(v),end(v)

const i32 INF=1<<30;//=10E10

vector<i32> MSnum;
vector<char> MSprime;

void factorize_MS(){
  //月曜土曜数列挙
  {
    int temp=0;
    MSnum.resize(300000/7*2+2);
    MSprime.resize(300001,1);//月曜素数でないやつも１になる
    for(i32 i=0;i+1<MSnum.size();i+=2){
      MSnum[i]=temp+1;
      MSnum[i+1]=temp+6;
      temp+=7;
    }
  }

  //月曜土曜素数のエラストテネス
  {
    MSprime[1]=0;
    repeat(idx,1,MSnum.size()){
      if(MSprime[MSnum[idx]]==0)continue;
      for(i32 i=2;;i++){
	i64 temp=MSnum[idx]*i;
	if(temp>=MSprime.size())break;
	MSprime[temp]=0;
      }
    }
  }
}


int main()
{
  factorize_MS();

  while(true){
    i32 n;cin>>n;
    if(n==1)break;

    printf("%d:",n);
    bool flg=false;
    for(i32 i=0;MSnum[i]<=n;i++){
      if(MSprime[MSnum[i]]==0)continue;
      if(n%MSnum[i]==0){
	printf(" %d",MSnum[i]);
	flg=true;
      }
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,m,day,l,a,i;
    scanf("%d",&n);
    scanf("%d%d",&day,&l);
    m=0;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a);
        m+=(day-1)/a+1;
    }
    printf("%d",l+m);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long n,a[100005],b[100005],sum;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i]>>b[i];
    	sum+=b[i]-a[i]+1;
	}
	cout<<sum;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	if (N < K) {
		cout << N * X << endl;
		return 0;
	}
	else {
		cout << Y * (N - K) + X * K << endl;
		return 0;
	}
}

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

const int mod = 1e9 + 7;

int mul(int x, int y) {
  return x * 1ll * y % mod;
}

int add(int x, int y) {
  return (x + y) % mod;
}

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

  int sum = 0;
  int jsum = 0;
  for (int i = n-2; i >= 0; --i) {
    jsum = add(jsum, a[i+1]);
    sum = add(sum, mul(a[i], jsum));
  }
  cout << sum << '\n';
  return 0;
}


Measured memory_bytes: 4052
import sys

input = sys.stdin.buffer.readline


class FenwickTree:
    """FenwickTree (Binary Indexed Tree, 0-index)

    Queries:
        1. add(i, val): add val to i-th value
        2. sum(n): sum(bit[0] + ... + bit[n-1])

    complexity: O(log n)

    See: http://hos.ac/slides/20140319_bit.pdf
    """

    def __init__(self, a_list):
        self.N = len(a_list)
        self.bit = a_list[:]
        for _ in range(self.N, 1 << (self.N - 1).bit_length()):
            self.bit.append(0)
        for i in range(self.N-1):
            self.bit[i | (i+1)] += self.bit[i]

    def add(self, i, val):
        while i < self.N:
            self.bit[i] += val
            i |= i + 1

    def sum(self, n):
        ret = 0
        while n >= 0:
            ret += self.bit[n]
            n = (n & (n + 1)) - 1
        return ret

    def query(self, low, high):
        return self.sum(high) - self.sum(low)


def yosupo():
    # https://judge.yosupo.jp/problem/point_add_range_sum
    _, Q = map(int, input().split())
    fwt = FenwickTree([int(x) for x in input().split()])
    for _ in range(Q):
        type_, l, r = map(int, input().split())
        if type_ == 0:
            fwt.add(l, r)
        else:
            print(fwt.query(l-1, r-1))


def aoj():
    # https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_B
    N, Q = map(int, input().split())
    fwt = FenwickTree([0] * N)
    for _ in range(Q):
        type_, l, r = map(int, input().split())
        if type_ == 0:
            fwt.add(l-1, r)
        else:
            print(fwt.query(l-2, r-1))


if __name__ == "__main__":
    yosupo()
    # aoj()


Measured memory_bytes: 58932
N = int(input())

d = {'AC': 0, 'WA':0, 'TLE':0, 'RE':0}

for _ in range(N):
    d[input().strip()] += 1

print(f"AC x {d['AC']}")
print(f"WA x {d['WA']}")
print(f"TLE x {d['TLE']}")
print(f"RE x {d['RE']}")

Measured memory_bytes: 9192
_ = input().strip()
kind_set = set()
rates = list(map(int, input().strip().split(' ')))

def whatcolor(rate):
  if rate < 400:
    return 0
  elif rate < 800:
    return 1
  elif rate < 1200:
    return 2
  elif rate < 1600:
    return 3
  elif rate < 2000:
    return 4
  elif rate < 2400:
    return 5
  elif rate < 2800:
    return 6
  elif rate < 3200:
    return 7
  else:
    return 'free'
  
free_n = 0
for r in rates:
  color = whatcolor(r)
  if color == 'free':
    free_n += 1
  else:
    kind_set.add(color)

ans_min = max(1, len(kind_set))
ans_max = len(kind_set) + free_n
print(ans_min, ans_max)

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

#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(),n.end())

const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;

void solve(){
  int N,T;
  cin >> N >> T;
  int ANS = -1;
  REP(i,N){
  	int x,y;
  	cin >> x >> y;
  	//cout << x << y;
  	if(T>=y){
  		if(ANS==-1)ANS=x;else
  			ANS=min(ANS,x);
  	}
  	//cout << ANS << endl;
  }
  if(ANS==-1)cout << "TLE" << endl; else cout << ANS <<endl;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;
int main() {
  int N;
  cin >>N;
  string w[120];

  for(int i=0; i<N;i++)
    cin >>w[i];

  for(int i=0; i<N;i++){
    for(int j=i+1;j<N;j++){
      if(w[i]==w[j]) {cout <<"No"<<endl; return 0;}
    }
  }
  for(int i=1;i<N;i++){
    int num=w[i-1].length();
    if(w[i][0]!=w[i-1][num-1]){cout <<"No"<<endl; return 0;}
  }
  cout <<"Yes"<<endl;
}


Measured memory_bytes: 256
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(Solve());
        Console.Out.Flush();
    }

    static object Solve() {
        var M = int.Parse(Console.ReadLine().Split()[1]);
        var lMax = 0;
        var rMin = 100000;
        for (int i = 0; i < M; i++)
        {
            var L = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            lMax = Math.Max(lMax, L[0]);
            rMin = Math.Min(rMin, L[1]);
            if (lMax > rMin) break;
        }
        return lMax <= rMin ? rMin - lMax + 1 : 0;
    }
}

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

using namespace std;

#define MAX_SIZE 200005

int parent[MAX_SIZE];

int Find(int x) {
  if (parent[x] == -1) {
    return x;
  }
  return parent[x] = Find(parent[x]);
}

void Union(int x, int y) {
  int px = Find(x), py = Find(y);
  if (px != py) {
    parent[py] = px;
  }
}

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  memset(parent, -1, sizeof(parent));

  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    Union(x, y);
  }

  unordered_map<int, int> group;
  for (int i = 1; i <= n; ++i) {
    group[Find(i)]++;
  }

  int ans = 0;
  for(const auto& p : group) {
    if (p.second > ans) {
      ans = p.second;
    }
  }

  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 12124
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int a[110][110];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)a[i][j]=0;
    }
    int cnt=0,x=n+(n-1)%2;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            a[i][j]=(i+j!=x);
            cnt+=(i+j!=x);
        }
    }
    cout<<cnt<<endl;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            if(a[i][j])cout<<i<<' '<<j<<endl;
        }
    }

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

ll gcd(ll a,ll b) {
  if(b==0) {
    return a;
  }
  else {
    return gcd(b,a%b);
  }
}

int main() {
  ll n;
  cin >> n;
  vec a(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i];
  }
  vec l(n);
  vec r(n);
  l[0]=a[0];
  r[n-1]=a[n-1];
  for(ll i=0;i<n-1;i++) {
    l[i+1]=gcd(l[i],a[i+1]);
    r[n-2-i]=gcd(r[n-1-i],a[n-i-2]);
  }
  ll ans=max(l[n-2],r[1]);
  for(ll i=1;i<n-1;i++) {
    ans=max(ans,gcd(l[i-1],r[i+1]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int count(ll x){
	int cnt = 0;
	while(x != 0){
		cnt++;
		x /= 10;
	}
	return cnt;
}
int main()
{

	int a , b , c;
	cin >> a >> b >> c;
	cout << min(a + b ,min( b + c , c + a) ) << endl;
	return 0;
} 




Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#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-11;
const ld pi = acos(-1.0);
int main() {
	int k; cin >> k;
	ll now = 0;
	vector<ll>v;
	rep(i, 15) {
		ll ord = (ll)pow(ll(10), i);
		rep1(j, 9) {
		    ll ord2 = (ll)pow(ll(10), i - 1);
			now += ord;
			ll cnt = (ll)(i * 9 + j);
			ll now2 = now;
			rep1(k, 9) {
				ll memo = now2;
				now2 -= ord2;
				cnt--;
				if (now2*(cnt+(ll)1) < memo*cnt) {
					v.push_back(now2);
				}
			}
			ord2 /= (ll)10;
			rep1(k, 9) {
				ll memo = now2;
				now2 -= ord2;
				cnt--;
				if (now2*(cnt+(ll)1) < memo*cnt) {
					v.push_back(now2);
				}
			}
			v.push_back(now);
		}
	}
	sort(v.begin(), v.end());
	rep(i, k) {
		cout << v[i] << endl;
	}
	return 0;
}

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

int main(){
  
  
 int N;
  std::cin>>N;
std::vector<std::vector<int>> map_data(2,std::vector<int>(N,0)) ;
  
    for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
    	cin>>map_data.at(i).at(j);
    }
  }

  int x[]={0,1};
  int y[]={1,0};
  int count=0;
  int m=0;
  int max_count=-1;
  for(int i=0;i<N;i++){
    m=0;
    //count+=map_data.at(0).at(0);
    //cout<<count<<endl;
    for(int j=0;j<N;j++){
      count+=map_data.at(m).at(j);
      //cout<<m<<" "<<j<<" "<<count<<endl;
      	if(i==j){
          m=1;
          count+=map_data.at(m).at(j);
        //  cout<<m<<" "<<j<<" "<<count<<endl;
        }
    	 
     
  	}
    
    if(count>max_count) max_count=count;
    count=0;
  }
 
  cout<<max_count;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
vector<int> a(5);int k;
int solve()
{
	trav(i,a){i=in();}
	k=in();
	for(int i=0;i<5;i++)
	{
		for(int j=i+1;j<5;j++)
		if(a[j]-a[i]>k)return 0;
	}
	return 1;
}
int32_t main()
{
	if(solve())
	puts("Yay!");
	else puts(":(");
	
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pp;
typedef pair<ll,pair<ll,ll> > ppp;

#define mk make_pair
#define all(a) (a).begin(), (a).end()
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define parr(A,n) for(int xxx=0;xxx<n;xxx++){cout<<A[xxx]<<" ";}cout << "\n";
#define MOD 1000000007
#define endl "\n"
inline ll power(ll x, ll y)
{
    ll res = 1;x = x % MOD;
    while (y > 0){if (y & 1) res = (res*x) % MOD;y = y>>1;x = (x*x) % MOD;}
    return res%MOD;
}
inline ll sum(ll a, ll b){b = ((b%MOD) + MOD)%MOD;a = ((a%MOD) + MOD)%MOD;return ((a+b)%MOD + MOD)%MOD;}
inline ll mul(ll a, ll b){return ((a*b)%MOD + MOD)%MOD;}
typedef struct node{
    node *next[2];
    int count[2];
    node(){
        next[0] = NULL;
        next[1] = NULL;
        count[0] = count[1] = 0;
    }
}node;

void add(node *root, ll num){
    node *temp = root;
    for(ll i=0;i<32;i++){
        ll ind = num & (1 << (31-i));
        ind = ind >> (31-i);
        if(temp->next[ind]==NULL){
            temp->next[ind] = new node();
            
        }
        temp->count[ind]++;
        temp = temp->next[ind];
    }
}

ll eval(node *root, ll num, ll k){
    ll ans = 0;
    node *temp = root;
    for(ll i=0;i<32;i++){
        ll ind = (num & (1 << (31-i)));
        ind = ind >> (31-i);
        ll tar = (k & (1 << (31-i)));
        tar = tar >> (31-i);
        if(tar==1){
        	if(ind == 0){
        		ans+=temp->count[0];
        		if(temp->next[1])
        			temp = temp->next[1];
        		else return ans;
        	}
        	else{
        		ans+=temp->count[1];
        		if(temp->next[0])
        			temp = temp->next[0];
        		else return ans;	
        	}
        }
        else{
        	if(ind == 0){
        		if(temp->next[0])
        			temp = temp->next[0];
        		else return ans;
        	}
        	else{
        		if(temp->next[1])
        			temp = temp->next[1];
        		else return ans;	
        	}	
        }
    }
    return ans;
}

ll solve(vector<int> a, int k) {
    int n = a.size();
    node *root = new node();
    add(root,0);
    ll ans = 0;
    ll curr = 0;
    for(int i=0;i<n;i++){
        curr = curr^a[i];
        ll temp = eval(root,curr,k);
        // cout << temp << endl;
        ans += temp;
        add(root,curr);
    }
    return ans;
}
int main() {
	ll n,x;
	cin >> n >> x;
	ll A[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> A[i];
	}
	ll gc = abs(x-A[0]);
	for (int i = 1; i < n; ++i)
	{
		gc = __gcd(gc , abs(x-A[i]));
	}
	cout << gc << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <valarray>
#include <array>
#include <climits>

using namespace std;

int main() {
	int n, ans = INT_MAX, temp, j;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> temp;
		j = 0;
		while (temp % 2 == 0) {
			j++;
			temp /= 2;
		}
		ans = min(ans, j);
	}
	cout << ans << endl;
}

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 P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>
inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    string s;cin>>s;
    rep(i,3){
        if(s[i]=='1') cout<<'9';
        else if(s[i]=='9') cout<<'1';
        else cout<<s[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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





int main() {
    string s;
    cin>>s;
    int n=s.size();
    vector<int>dpl(n+1);//i番目より左に連続して何個の'<'があるか
    vector<int>dpr(n+1);//i番目より右に連続して何個の'>'があるか

    dpl.at(0)=0;
    //<>>なら0 1 0 0
    for(int i=1;i<n+1;i++){
        if(s.at(i-1)=='<'){
            dpl.at(i)=dpl.at(i-1)+1;
        }
        else{
            dpl.at(i)=0;
        }
    }
    dpr.at(n)=0;
    //<>>なら0 2 1 0
    for(int i=n-1;i>=0;i--){
        if(s.at(i)=='>'){
            dpr.at(i)=dpr.at(i+1)+1;
        }
        else{
            dpr.at(i)=0;
        }
    }

    ll ans=0;
    for(int i=0;i<n+1;i++){
        ans+=max(dpl.at(i),dpr.at(i));
    }
    cout<<ans<<endl;



    return 0;
}

Measured memory_bytes: 4740
def A():
    w = ['Sunny', 'Cloudy', 'Rainy']
    today = input()
    index = w.index(today)
    if index == 2:
        index = -1
    print(w[index+1])

def B():
    odd = 'RUD'
    even = 'LUD'

    s = input()
    for i in range(len(s)):
        if (i+1)%2 == 0:
            if s[i] not in even:
                print('No')
                return
        else:
            if s[i] not in odd:
                print('No')
                return
        
    print('Yes')

B()


Measured memory_bytes: 3064