akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	set<int> s;
	int n, a;
	cin >> n;
	REP(i, n) {
		cin >> a;
		if (s.count(a) == 0) s.insert(a);
		else s.erase(a);
	}
	cout << s.size() << endl;
	return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;

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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))
#define POSITIVE_RANGE(n)	( n >= 0 ? n : 0)
//#define int long long int //dont forget to change int to signed

const int BIGINT = 1000000007;

int main() {
	int N;
	cin >> N;
	lli sumt, suma;
	cin >> sumt >> suma;
	for (int i = 1; i < N; i++) {
		lli A, T;
		cin >> T >> A;
		lli za = ROUNDUP(suma , A), zt = ROUNDUP(sumt, T);
		lli k = za > zt ? za : zt;
		lli t = k * T - sumt;
		lli a = k * A - suma;
		sumt += t; suma += a;
	}
	cout << sumt + suma << endl;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int n,m,q;
    cin >> n >> m >> q;
    vector<int> a(q);
    rep(i,0,q){
        cin >> a[i];
        --a[i];
    }
    reverse(a.begin(),a.end());

    vector<int> v;
    {
        vector<bool> f(m);
        rep(i,0,q){
            if(f[a[i]]) continue;
            f[a[i]]=true;
            v.push_back(a[i]);
        }
        rep(i,0,m) if(not f[i]) v.push_back(i);
    }

    vector<int> pos(m);
    rep(i,0,m) pos[v[i]]=i;

    vector<int> freq(m+1);
    freq[0]=n;
    rep(i,0,q){
        int p=pos[a[i]];
        if(not freq[p]) continue;
        --freq[p];
        ++freq[p+1];
    }
    rep(i,0,m+1){
        if(not freq[i]) continue;
        vector<int> w;
        vector<bool> f(m);
        rep(j,0,q){
            if(w.size()==i) break;
            if(f[a[j]]) continue;
            f[a[j]]=true;
            w.push_back(a[j]);
        }
        rep(j,0,m) if(not f[j]) w.push_back(j);
        if(v==w) cout << "Yes" << endl;
        else cout << "No" << endl;
        return;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 2552
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#define mem(a,b) memset(a,b,sizeof (a))
#define gcd(a,b) __gcd(a,b)
#define all(a) a.begin(),a.end()
#define in(a) insert(a)
#define sz() size()
#include<cstdlib>
#define endl '\n'
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn=100010;
const ll inf=1e18;
const ll mod=1e9+7;
const double pi=3.14159265358979;
const double ep=0.0;
vector<vector<pair<ll,ll>>>vec;
ll n,m;
void dfs(ll v,ll t,vector<ll>&d,vector<ll>&w)
{
    if (w[v]!=-1)
        return ;
    if (t==v)
    {
        w[v]=1;
        return ;
    }
    w[v]=0;
    for (auto i:vec[v])
    {
        ll u=i.first,r=i.second;
        if (d[u]+r==d[v])
        {
            dfs(u,t,d,w);
            w[v]=(w[v]+w[u])%mod;
        }
    }
}
void dij(ll s,vector<ll>&d,vector<ll>&w)
{
    d.resize(n,mod*mod);
    w.resize(n,-1);
    d[s]=0;
    set<pair<ll,ll>>se;
    se.insert({d[s],s});
    while (!se.empty())
    {
        ll v=se.begin()->second;
        se.erase(se.begin());
        for (auto i:vec[v])
        {
            ll u=i.first,r=i.second;
            if (d[u]>d[v]+r)
            {
                se.erase({d[u],u});
                d[u]=d[v]+r;
                se.insert({d[u],u});
            }
        }
    }
    for (ll i=0;i<n;i++)
        dfs(i,s,d,w);
}
int main()
{
    ll s,t;
    cin>>n>>m>>s>>t;
    s--;
    t--;
    vec.resize(n);
    for (ll i=0;i<m;i++)
    {
        ll v,u,w;
        cin>>v>>u>>w;
        v--;
        u--;
        vec[v].pb({u,w});
        vec[u].pb({v,w});
    }
    vector<ll>ds,ws,dt,wt;
    dij(s,ds,ws);
    dij(t,dt,wt);
    ll ans=ws[t]*wt[s],al=ds[t];
    for (ll i=0;i<n;i++)
    {
        if (ds[i]+dt[i]!=al)
            continue;
        if (ds[i]==dt[i])
            ans=(ans-ws[i]*wt[i]%mod*ws[i]%mod*wt[i]%mod+mod)%mod;
    }
    for (ll i=0;i<n;i++)
        for (auto j:vec[i])
        {
            ll u=j.first,w=j.second;
            if (ds[i]+dt[u]+w!=al)
                continue;
            if (w>abs(dt[u]-ds[i]))
                ans=(ans-ws[i]*wt[u]%mod*ws[i]%mod*wt[u]%mod+mod)%mod;
        }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 21232
#include <bits/stdc++.h>
using namespace std;
int h, w;
int sx, sy;
int ct;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

void dfs(int x, int y, vector<vector<char> > &v) {
  v[x][y] = '#';
  ++ct;
  for(int i = 0; i < 4; ++i) {
    int nx = dx[i] + x;
    int ny = dy[i] + y;
    if(nx >= 0 && ny >= 0 && ny < h && nx < w && v[nx][ny] == '.') {
      dfs(nx, ny, v);
    }
  }
  return;
}
int main() {
  for(;;) {
    scanf("%d %d", &w, &h);
    if(w == 0 && h == 0) break;
    vector<vector<char> > v(w, vector<char>(h));
    for(int i = 0; i < h; ++i) {
      for(int j = 0; j < w; ++j) {
        scanf(" %c", &v[j][i]);
      }
    }

    for(int i = 0; i < h; ++i) {
      for(int j = 0; j < w; ++j) {
        if(v[j][i] == '@') {
          sx = j, sy = i;
          break;
        }
      }
    }
    dfs(sx, sy, v);
    printf("%d\n", ct);
    h = 0, w = 0, sx = 0, sy = 0, ct = 0;
  }
  return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N,A,B;
  cin>>N>>A>>B;
  if(A==B)cout<<1<<endl;
  else if(N==1)cout<<0<<endl;
  else if(A>B)cout<<0<<endl;
  else{
    unsigned long long int C=(N-2)*(B-A)+1;
    cout<<C<<endl;
  }
}

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

int main() {
    int a, b;
    char op;
    cin >> a >> op >> b;
    
    if (op == '+') {
        cout << a + b << endl;
    }
    else if (op == '-') {
        cout << a - b << endl;
    }
}

Measured memory_bytes: 256
// Name: Transit Tree Path
// Level: 2
// Category: Graph, 最短経路問題
// Note: 深さ優先探索

#include <iostream>
#include <vector>
#include <stack>

#define MAX_V 100001

using namespace std;

struct edge { int to; long long cost; };
struct set {int v, p; long long d; };
vector<edge> tree[MAX_V];
long long depth[MAX_V];

void dfs(int v, int p, long long d) {
    stack<set> St;
    St.push(set{v, p, d});

    while (!St.empty()) {
        set cur = St.top(); St.pop();
        depth[cur.v] = cur.d;
        for (int i = 0; i < tree[cur.v].size(); i++) {
            edge e = tree[cur.v][i];
            if (e.to == cur.p) { continue; }
            St.push(set{e.to, cur.v, cur.d + e.cost});
        }
    }
}

int main() {
    int N, a, b, c;
    int Q, K, x, y;

    cin >> N;

    for (int i = 0; i < N-1; i++) {
        cin >> a >> b >> c;
        a--, b--;
        tree[a].push_back(edge{b, c});
        tree[b].push_back(edge{a, c});
    }

    cin >> Q >> K; K--;
    dfs(K, -1, 0);

    for (int i = 0; i < Q; i++) {
        cin >> x >> y;
        x--; y--;
        cout << depth[x] + depth[y] << endl;
    }
    return 0;
}

Measured memory_bytes: 10736
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;

void add(int& x, int y) {
    x += y;
    if (x >= MOD) {
        x -= MOD;
    }
}

const int MX = (1 << 21) + 7;

int bc[MX];
int f[MX];
int g[25][25];

int main() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> g[i][j];
        }
    }

    for (int i = 1; i < MX; i++) {
        bc[i] = bc[i / 2] + (i % 2);
    }

    f[0] = 1;
    for (int i = 0; i < (1 << n) - 1; i++) {
        int cur = bc[i];
        for (int j = 0; j < n; j++) {
            if (g[cur][j] && !(i & (1 << j))) {
                add(f[i | (1 << j)], f[i]);
            }
        }
    }

    cout << f[(1 << n) - 1] << "\n";
    return 0;
}



Measured memory_bytes: 16640
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> A(N), B(N), C(N);
    REP(i, 0, N) cin >> A[i] >> B[i] >> C[i];

    vector<vector<int>> dp(3, vector<int>(N + 1, 0));
    REP(i, 0, N) {
        dp[0][i + 1] = max(dp[1][i], dp[2][i]) + A[i];
        dp[1][i + 1] = max(dp[0][i], dp[2][i]) + B[i];
        dp[2][i + 1] = max(dp[0][i], dp[1][i]) + C[i];
    }
    int ans = 0;
    REP(i, 0, 3) ans = max(ans, dp[i][N]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }

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

    ll N, K, Q; cin >> N >> K >> Q;
    vel point(N, K - Q);
    rep(i,Q) {
        int a; cin >> a; a--;
        point[a]++;
    }
    rep(i,N) {
        if(point[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;

}



Measured memory_bytes: 1408
use std::env;
    
fn main() {

    let s = {
    let mut s = String::new(); // バッファを確保
        std::io::stdin().read_line(&mut s).unwrap(); 
    let mut s = String::new(); // バッファを確保
        std::io::stdin().read_line(&mut s).unwrap(); // 一行読む。失敗を無視
        s.trim_right().to_owned() // 改行コードが末尾にくっついてくるので削る
    };

    let vvec:Vec<i64> = s.split_whitespace().map(|m|m.parse::<i64>().unwrap()).collect();

    let mut ret:i64 = 0;
    for i in 0..vvec.len(){
        for j in (i+1)..vvec.len(){
            ret += vvec[i]*vvec[j];
        }
    }
    println!("{}",ret);
    

}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z) cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair<int, int>
#define ld long double
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int CALCSIZE = 5010;
int C[CALCSIZE][CALCSIZE];

void init() {
  for (int i = 0; i < CALCSIZE; ++i) {
    C[i][i] = C[i][0] = 1;
    for (int j = 1; j < i; ++j) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
    }
  }
}
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  init();
  int N, P;
  cin >> N >> P;
  int cnt = 0;
  REP(i, N) {
    int q;
    cin >> q;
    cnt += q % 2 == 1;
  }
  int val = 0;
  FORS(i, 0, cnt) {
    if (i % 2 == P) val += C[cnt][i];
  }

  print(BIT(N - cnt) * val);
}

Measured memory_bytes: 194560
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(char, a, b);
  if (a == b) {
    print("H");
  } else {
    print("D");
  }
}


Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted(a)

    max_a = max(a) + 1
    dp = [True] * max_a

    for idx in range(len(a)):
        if idx + 1 != len(a) and a[idx] == a[idx + 1]:
            dp[a[idx]] = False
        i = a[idx]
        x = 2
        while i * x < max_a:
            dp[i * x] = False
            x += 1

    ans = 0
    for i in a:
        if dp[i]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 32380
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int OFS = 75;
	int MAX = 150;
	boolean map[][] = new boolean[MAX][MAX];
	
	int t, n;
	int sx, sy;
	
	void init() {
		for(boolean[] a: map) fill(a, false);
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			t = sc.nextInt();
			n = sc.nextInt();
			if( (n|t) == 0 ) break;
			init();
			for(int i=0;i<n;i++) {
				map[sc.nextInt()+OFS][sc.nextInt()+OFS] = true;
			}
			sx = sc.nextInt();
			sy = sc.nextInt();
			System.out.println(bfs());
		}
	}
	int dx[] = {0,1,1,0,-1,-1};
	int dy[] = {1,1,0,-1,-1,0};
	
	int bfs() {
		int cnt = 0;
		LinkedList<P> que = new LinkedList<P>();
		que.add(new P(sx+OFS, sy+OFS, t));
		map[sx+OFS][sy+OFS] = true;
		for(;!que.isEmpty();) {
			P now = que.removeFirst();
//			debug(now.x, now.y);
			cnt++;
			if(now.c == 0) continue;
			for(int i=0;i<6;i++) if(!map[now.x+dx[i]][now.y+dy[i]]) {
				map[now.x+dx[i]][now.y+dy[i]] = true;
				que.add(new P( now.x+dx[i], now.y+dy[i], now.c-1));
			}
		}
		return cnt;
	}
	
	class P {
		int x, y, c;
		P(int x, int y, int c) {
			this.x = x;
			this.y = y;
			this.c = c;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
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 (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

ll dp[3][202020];

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];


    ll res = 0;
    if(N%2==0){
        const ll INF = (1ll<<60);
        REP(i, 2)REP(j, 202020) dp[i][j] = -INF;
        dp[0][0] = 0;

        REP(i, N){
            if(i<N) chmax(dp[0][i+2], dp[0][i] + A[i]);
            if(i+1<N) chmax(dp[1][i+3], dp[0][i] + A[i+1]);
            if(i<N) chmax(dp[1][i+2], dp[1][i] + A[i]);
        }
        
        res = max(dp[0][N], dp[1][N+1]);
    }else{
        const ll INF = (1ll<<60);
        REP(i, 3)REP(j, 202020) dp[i][j] = -INF;
        dp[0][0] = 0;

        REP(i, N){
            if(i<N) chmax(dp[0][i+2], dp[0][i] + A[i]);
            if(i+1<N) chmax(dp[1][i+3], dp[0][i] + A[i+1]);

            if(i<N) chmax(dp[1][i+2], dp[1][i] + A[i]);
            if(i+1<N) chmax(dp[2][i+3], dp[1][i] + A[i+1]);

            if(i<N) chmax(dp[2][i+2], dp[2][i] + A[i]);
        }

        /*
        REP(i, 3){
            REP(j, N+2){
                cout << dp[i][j] << " ";
            }
            cout << endl;
        }
        */
        
        
        res = max(max(dp[0][N-1], dp[1][N]), dp[2][N+1]);

        ll tmp = 0;
        ll mi = INF;
        REP(i, N){
            if(i%2==0){
                tmp += A[i];
                chmin(mi, A[i]);
            }
        }
        tmp -= mi;
        chmax(res, tmp);
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 9536
N=int(input())
A=list(map(int,input().split()))

A.sort()
if A[0]==0:
    A.remove(0)

l=len(A)
k=0

ans=1

m=max(A)

for i in range(l-1):
    if A[i+1]>A[i]:
        k=A[i]
        print(ans)
        while A[i+1]!=k+1:
            k=k+1
            print(0)
        ans=1
    else:
        ans=ans+1
if A[l-1]==A[l-2]:
    print(ans)
else:
    print(ans)
    
   
for j in range(m+1,N+1):
    print(0)


Measured memory_bytes: 32356
import copy

l = int(input().split()[0])
lh = int(l / 2)
houses = list(map(int, input().split()))

houses2 = copy.deepcopy(houses)
houses2.append(houses2[0])
houses2 = houses2[1::]
distances = [abs(h1 - h2) for (h1, h2) in zip(houses, houses2)]
route = sum(sorted([abs(d - l) if d > lh else d for d in distances])[:-1:])

print(route)

Measured memory_bytes: 26932
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, n) for(int i=1; i<=n; ++i)
#define all(obj) (obj).begin(), (obj).end()
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;

int main(){
    int k; cin >> k;
    str s; cin >> s;
    if(s.size() <= k){
        cout << s << endl;
    }else{
        rep(i, k){
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,A,B;cin >> N >> A >> B;
  string s;cin >> s;
  int a = 0, b = 0;
  for(const auto&c:s){
    if(c == 'a'){
      if(a+b < A+B){
        ++a;
        cout << "Yes" << endl;
      }else cout << "No" << endl;
    }
    if(c == 'b'){
      if(a+b < A+B && b < B){
        ++b;
        cout << "Yes" << endl;
      }else cout << "No" << endl;
    }
    if(c == 'c') cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 848
n=int(input())
a=list(map(int,input().split()))

a.sort()

#2倍以下なら吸える
#3,1,4
#→3,4

suma=0
cnt=0
for i in range(n-1):
    suma+=a[i]
    if a[i+1]<=2*suma:
        cnt+=1
    else:
        cnt=0
    

print(cnt+1)


    


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

int main(int argc, const char * argv[]) {
    int N, Y; cin >> N >> Y;
    int flag = 0;
    
    for (int x = 0; x <= N; x++) {
        if(flag == 1) {break;}
        for (int y = 0; y <= N; y++) {
            if ((10000 * x + 5000 * y + 1000 * (N-x-y)) == Y && (N-x-y) >= 0) {
                cout << x << " " << y << " " << N-x-y << endl;
                flag = 1;
                break;
            } else {
                flag = -1;
            }
        }
    }
    if (flag == -1) {
        cout << "-1 -1 -1" << endl;
    }
    return 0;
}


Measured memory_bytes: 888
import java.util.Arrays;
import java.util.Scanner;

class Main {
	double[][] p = new double[2][6];

	void run() {
		Scanner sc = new Scanner(System.in);
		for (int i = 0; i < 2; ++i) {
			for (int j = 0; j < 6; ++j) {
				p[i][j] = sc.nextDouble() / 100;
			}
		}

		double l = 0;
		double r = 1;
		for (int i = 0; i < 100; ++i) {
			double lm = (2 * l + r) / 3;
			double rm = (l + 2 * r) / 3;
			if (simulate(lm) > simulate(rm)) {
				l = lm;
			} else {
				r = rm;
			}
		}
		System.out.println(simulate(l));
	}

	double simulate(double x) {
		double ret = 0;
		for (int j = 0; j < 6; ++j) {
			ret += Math.max(x * p[0][j], (1 - x) * p[1][j]);
		}
		return ret;

	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 24660
#include <cstdio>

using namespace std;

int main()
{
	int h, m, s;

	while (1){
		int tmp;
		int stan, stan_3;

		scanf("%d %d %d", &h, &m, &s);

		if (h == -1 && m == -1 && s == -1){
			break;
		}

		tmp = h * 3600 + m * 60 + s;
		//printf("tmp=%d\n", tmp);

		stan = 7200 - tmp;
		stan_3 = stan * 3;

		int h_2, m_2, s_2;

		h_2 = stan / 3600;
		//printf("h_2 = %d\n", h_2);
		m_2 = (stan - 3600 * h_2) / 60;
		s_2 = (stan - 3600 * h_2 - 60 * m_2);
		//printf("s_2=%d\n", s_2);

		printf("%02d:%02d:%02d\n", h_2, m_2, s_2);

		int h_3, m_3, s_3;

		h_3 = stan_3 / 3600;
		m_3 = (stan_3 - 3600 * h_3) / 60;
		s_3 = (stan_3 - 3600 * h_3 - 60 * m_3);

		printf("%02d:%02d:%02d\n", h_3, m_3, s_3);
	}

	return (0);
}

Measured memory_bytes: 1040
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
template<typename T>
struct BIT {
int n;
vector<T> d;
BIT(int n=0):n(n),d(n+1) {}
void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
    d[i] += x;
    }
}
T sum(int i) { //[0,i]のsum
    T x = 0;
    for (i++; i; i -= i&-i) {
    x += d[i];
    }
    return x;
}
T sum(int l, int r) { // [l,r)のsum
    return sum(r-1) - sum(l-1);
}
};

int main()
{
    int n,d,a;
    cin >> n >> d >>a;
    vector<pll> p(n);
    rep(i,n)cin >> p[i].first >> p[i].second;
    BIT<ll> bit(n+5);
    sort(p.begin(),p.end());
    ll ans = 0;
    rep(i,n){
        ll x = p[i].first;
        ll h = p[i].second;
        int tot = bit.sum(i);
        h -= tot;
        if(h> 0){
            int num = (h+a-1)/a;
            ans += num;
            ll damage = num*a;
            bit.add(i,damage);
            ll hashi = min(x + 2*d+1,1001001001ll);
            int  ni = upper_bound(p.begin(),p.end(),pll(hashi,999))-p.begin();
            bit.add(ni,-damage);
        }

    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define MAXN 500010  
#define LL long long 
#define pi acos(-1)
#define MOD 100000007

using namespace std;

int n;
char s[MAXN],ss[MAXN];
int sum[MAXN];

int main() {
	cin >> n;
	cin >> s+1;
	for (int i = 1; i <= n ;i++) sum[i]=sum[i-1]+(s[i]=='.');
	int ans=inf;
	sum[n+1]=sum[n];
	for (int i = 0; i <= n; i++) ans=min(ans,i-sum[i]+sum[n+1]-sum[i+1]);
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1788
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int n, a, b;
	cin >> n >> a >> b;

	cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << endl;


	return 0;
}

Measured memory_bytes: 256
a,b,c,d = map(int, input().split())
c2,d2 = c,d
while d2:
    c2,d2 = d2,c2%d2

gcd = c2
lcm = int(c*d/gcd)

numc,numd,numlcm = 0,0,0
if a%c == 0:
    numc = b//c - a //c + 1
else:
    numc = b//c - a //c

if a%d == 0:
    numd = b//d - a //d + 1
else:
    numd = b//d - a //d

if a%lcm == 0:
    numlcm = b//lcm - a //lcm + 1
else:
    numlcm = b//lcm - a //lcm

print(b-a+1-numc-numd+numlcm)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
int main(void){
	int h,a;
	cin>>h>>a;
	cout<<(h+a-1)/a;
	return 0;
}

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

int main(){

  int n, m;
  
  cin >> n;
  
  m = 100000;
  for(int i=0; i<n; i++){
    m *= 1.05;
    if(m % 1000 != 0)
      m -= (m % 1000) - 1000;
  }
  
  cout << m << endl;

  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<string.h>

using namespace std;
const int M = 1046527, NIL = -1, L = 14;
char hash_table[M][L];

int ctoi(char ch){
    if(ch == 'A') return 1;
    else if(ch == 'T') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'C') return 4;
    else return 0;
}
long long stoi(char str[]){
    long long sum = 0, p = 1, i;
    for (int i = 0; i < strlen(str); i++)
    {
        sum += p*(ctoi(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){return key % M;}
int h2(int key){return 1 + key % (M-1);}

bool find(char str[]){
    long long key, h;
    key = stoi(str);
    for (int i = 0;;i++){
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(hash_table[h], str) == 0) return true;
        else if(strlen(hash_table[h]) == 0) return false;
    }
}

int insert(char str[]){
    long long key, h;
    key = stoi(str);
    for(int i = 0;;i++){
        h = (h1(key) + i*h2(key)) % M;
        if(strcmp(hash_table[h], str) == 0) return 1;
        else if(strlen(hash_table[h]) == 0){
            strcpy(hash_table[h], str);
            return 0;
        }
    }
}

int main(){
    int n;
    char str[L], inst[9];
    for (int i = 0; i < M; i++)hash_table[i][0] = '\0';
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%s %s", inst, str);
        if (inst[0] == 'i')
            insert(str);
        else
        {
            if (find(str)) printf("yes\n");
            else printf("no\n");
        }   
    }
}


Measured memory_bytes: 17060
#include <stdio.h>

int main(void)
{
    int x, s[11] = {0};

    while (scanf("%d", &x) != EOF) {
        if (x == 0)
            printf("%d\n", s[s[0]--]);
        else
            s[++s[0]] = x;
    }

    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    string s,t;
    cin >> s >> t;
    int n = s.length();
    int m = t.length();

    rep(i,n) {
        cout<<s[i];
        if (i != m) cout<<t[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	


	string S;
	string T;
	cin >> S >> T;

	int ans = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != T[i]) {
			ans++;
		}
	}

	cout << ans << endl;


EndPoint:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG

	return 0;
}




Measured memory_bytes: 3848
/*
AizuOnline A131
Title Unit Fraction Partition 
*/
#include <stdio.h>
#include <float.h>
#include <math.h>

int p,q,a,n;
int gcd(int x, int y){
	return y == 0 ? x: gcd(y, x%y);
}

int f2(p,q,a,n,m)
{
        int i,s,l;
        int g;

        if((g=gcd(p,q))>1)
                return(f2(p/g,q/g,a,n,m));
#if DEBUG
        printf("%d %d %d %d %d:",p,q,a,n,m);
#endif

        //check just p/q==1/i
        
        s=0;
        for(i=m;i<=a;i++)
                if(p*i==q)
                {
#ifdef DEBUG
                        printf("*\n");
#endif
                        s=1;
                }
                else if(p*i > q)
                        break;
        if(n==1)
                return(s);


                l=(int)sqrt((double)a);
#if DEBUG
        printf("%d \n",l);
#endif
                for(i=m;i<=l;i++)
                        if(p*i - q > 0)
                                s += f2(p*i -q,q*i,a/i,n-1,i);
                return(s);

}


int f(p,q,a,n)
{
        return(f2(p,q,a,n,1));
}

//
main()
{
        int ret;
        while(EOF!=scanf("%d %d %d %d",&p,&q,&a,&n) && (p||q||a||n))
        {
                ret=f(p,q,a,n);
                printf("%d\n",ret);
        }
return(0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

long long gcd(long long aaa,long long bbb){
    if(bbb==0){
        return aaa;
    }
    return gcd(bbb,aaa%bbb);
}
 
long long lcm(long long aaa,long long bbb){
    long long g = gcd(aaa,bbb);
    return aaa/g * bbb;
}

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

    cin>>n;
    rep(i,n)cin>>a[i];
    if(n==1)Cout(a[0]);
    else{
        ans=lcm(a[0],a[1]);
        rrep(i,2,n){
            ans=lcm(ans,a[i]);
        }
        Cout(ans);
    }
    return 0;
}


Measured memory_bytes: 256
// snukeさん解説AC
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

P f(int x) {
  int a = x%10;
  int b = 0;
  while (x) {
    b = x;
    x /= 10;
  }
  return P(a,b);
}

int main() {
  int n;
  cin >> n;
  map<P,int> freq;
  for (int i = 1; i <= n; ++i) {
    P p = f(i);
    freq[p]++;
  }
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    P p = f(i);
    P q(p.second, p.first);
    ans += freq[q];
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

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

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

  long long ans = 0;
  for(int i = n -1; i >= 0; i--) {
    long long c = b[i] - ((a[i]+ans) % b[i]);
    if(c == b[i]) continue;
    ans += c;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
class BIT{
public:
    int bit[32],n=32;
    BIT(){
        for(int i=0;i<32;i++)
            bit[i]=0;
    }
    int sum(int i){
        int s=0;
        while(i>0){
            s+=bit[i];
            i-=i&-i;
        }
        return s;
    }
    void add(int i,int x){
        while(i<=n){
            bit[i]+=x;
            i+=i&-i;
        }
    }
};
signed main(){
    int n,a[18],b[18];
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i],a[i]--;
    for(int i=0;i<n;i++)
        cin>>b[i],b[i]--;
    int ans=mod;
    for(int s=0;s<1<<n;s++){
        int arr[18],arr2[18];
        for(int i=0;i<n;i++)
            arr[i]=arr2[i]=(s>>i&1?b[i]:a[i]);
        sort(arr2,arr2+n);
        int flip[18],arro[18],arre[18],arr2o[18],arr2e[18];
        for(int i=0;i<n;i++){
            arro[i]=arre[i]=arr2o[i]=arr2e[i]=-1;
            (i%2==1?arr2o[i]:arr2e[i])=arr2[i];
            (i%2==1&&!(s>>i&1)||i%2==0&&s>>i&1?arro[i]:arre[i])=arr[i];
        }
        int arros[18],arres[18],arr2os[18],arr2es[18];
        for(int i=0;i<n;i++){
            arros[i]=arro[i];
            arres[i]=arre[i];
            arr2os[i]=arr2o[i];
            arr2es[i]=arr2e[i];
        }
        sort(arros,arros+n);
        sort(arres,arres+n);
        sort(arr2os,arr2os+n);
        sort(arr2es,arr2es+n);
        bool ok=1;
        for(int i=0;i<n;i++){
            if(arros[i]!=arr2os[i])
                ok=0;
            if(arres[i]!=arr2es[i])
                ok=0;
        }
        if(!ok)
            continue;
        int aa[50],bb[50][18];
        for(int i=0;i<50;i++){
            aa[i]=0;
            for(int j=0;j<n;j++)
                bb[i][j]=-1;
        }
        for(int i=0;i<n;i++){
            if(arr2o[i]!=-1){
                bb[arr2o[i]][aa[arr2o[i]]]=i;
                aa[arr2o[i]]++;
            }
        }
        for(int i=0;i<50;i++)
            aa[i]=0;
        for(int i=0;i<n;i++){
            if(arro[i]!=-1){
                flip[i]=bb[arro[i]][aa[arro[i]]]+1;
                aa[arro[i]]++;
            }
        }
        for(int i=0;i<50;i++){
            aa[i]=0;
            for(int j=0;j<n;j++)
                bb[i][j]=-1;
        }
        for(int i=0;i<n;i++){
            if(arr2e[i]!=-1){
                bb[arr2e[i]][aa[arr2e[i]]]=i;
                aa[arr2e[i]]++;
            }
        }
        for(int i=0;i<50;i++)
            aa[i]=0;
        for(int i=0;i<n;i++){
            if(arre[i]!=-1){
                flip[i]=bb[arre[i]][aa[arre[i]]]+1;
                aa[arre[i]]++;
            }
        }
        BIT bit;
        int tmp=0;
        for(int j=0;j<n;j++){
            tmp+=j-bit.sum(flip[j]);
            bit.add(flip[j],1);
        }
        ans=min(ans,tmp);
    }
    cout<<(ans==mod?-1:ans)<<endl;
}

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

int main() 
{
	string s;
	cin>>s;
	int c=0;
	for(int i=1; i<=s.length(); i++)
	{
	    if((s[i-1]!='U' && s[i-1]!='D'))
	    {
	        if((i%2==1 && s[i-1]!='R') || (i%2==0 && s[i-1]!='L'))
	        {
	            cout<<"No\n"<<endl;
	            c=1;
	            break;
	        }
	    }
	}
	if(!c)cout<<"Yes\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int r,d,x,xx;
  scanf("%d %d %d",&r,&d,&x);
  xx=x;
  for(int i=0;i<10;i++){
    xx=xx*r-d;
    printf("%d\n",xx);
  }
  return 0;
}

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long X) {
    X -= 400;
    X /= 200;
    cout << 8 - X << endl;
}

int main() {
  long long X;
  scanf("%lld", &X);
  solve(X);
  return 0;
}


Measured memory_bytes: 3760
while True :
    H,W = map(int,input().split(" "))
    h = H - 2
    if H == 0 and W == 0 :
        break
    print("#" * W)
    for i in range(h) :
        print("#" + "." * (W - 2) + "#")
    print("#" * W)
    print()


Measured memory_bytes: 5608
import math

A, B, H, M = map(int, input().split())

angle_A = 6*M
angle_B = 30*(H+M/60)
angle_C = abs(angle_A-angle_B)

rad_C = math.radians(angle_C)

C = math.sqrt(A**2+B**2-2*A*B*math.cos(rad_C))

print(C)

Measured memory_bytes: 9396
#include <iostream>
#include <list>
#include <vector>
#include <ctime>
#include <unordered_set>
#include <string>
#include <map>
#include <unordered_map>
#include <random>
#include <set>
#include <cassert>
#include <string.h>
#include <limits.h>
#include <stack>
#include <functional>
#include <queue>
#include <numeric>
#include <bitset>
#include <iterator>
#include <algorithm>
#include <sstream>
 
 
#define inf 0x3f3f3f3f
#define sup_inf 2e18
#define pb push_back	
#define ii pair<int,int>
#define f first
#define s second
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define iii pair<int, ii >
#define in freopen("arquivoentrada","r",stdin);
#define out freopen("myfile.txt", "w", stdout);	
#define eps 1e-9
#define pi 3.14159265359
const int mod = 7723 ;
 
using namespace std;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long long ll;

using namespace std;

const int maxn = 3e5 + 100;


int n, m;

ii arr[maxn];
signed main (){
	//~ in
	cin >> n >> m;
	
	for(int i = 0; i < m;i++)
		cin >> arr[i].f >> arr[i].s;
		
	sort ( arr, arr + m , [&](ii a, ii b ){ if ( a.f == b.f ) {return a.s < b.s;} return a.f < b.f; } );
	
	
	int ans = 1;
	ii aux = arr[0];
	for(int i = 1 ;i < m;i++){
		if ( aux.s > arr[i].f )
				aux.s = min ( arr[i].s , aux.s);
		else
			++ans, aux = arr[i];
	}
	
	cout << ans << '\n';
	
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>

using namespace std;
int n;
char a[10];
int ac, tle, wa, re;
int main(){
	scanf("%d", &n);
	ac = 0, re = 0, wa = 0, tle = 0;
	for(int i = 0; i < n; ++ i){
		scanf(" %s", a);
		if(a[0] == 'A')
			ac ++;
		else if(a[0] == 'T')
			tle ++;
		else if(a[0] == 'W')
			wa ++;
		else
			re ++;
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", ac, wa, tle, re);
}


Measured memory_bytes: 1732
import itertools
import math
N = int(input())
count = 0
f = []
ans = 0
def ai(i, j):
    return (math.sqrt((i[0] - j[0])** 2 + (i[1] - j[1])** 2))
for i in range(N):
    f += [list(map(int, input().split()))]
for i in itertools.permutations(range(N)):
    count += 1
    for j in range(N-1):
        ans += ai(f[i[j]], f[i[j + 1]])
print(ans/count)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, P;
    string S;
    cin >> N >> P >> S;

    map<ll, ll> mp;
    ll ans = 0;

    if(P == 2 || P == 5){
        for(int i=N-1;i>=0;i--){
            int d = S[i] - '0';
            if(P == 2 || P == 5){
                if(d % P == 0) ans += i + 1;
            }
        }
    }
    else{
        ll cur = 0;
        ll base = 1;
        mp[0]++;
        for(int i=N-1;i>=0;i--){
            int d = S[i] - '0';
            cur = cur + (base * d) % P;
            cur %= P;
            base *= 10;
            base %= P;
            mp[cur]++;
        }
        REP(i,P) ans += mp[i] * (mp[i] - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1044
n, m, x = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(n)]

min_cost = 10000000 * n
for i in range(1, 2 << n-1):
    a_total = [0] * m
    cost = 0
    p = list(format(i, 'b').zfill(n))
    for j in range(len(p)):
        if p[j] == '1':
            a_total = [a + b for a, b in zip(a_total, c[j][1:])]
            cost += c[j][0]
    for a in a_total:
        if a < x:
            break
    else:
        min_cost = min(cost, min_cost)

if min_cost == 10000000 * n:
    print(-1)
else:
    print(min_cost)

Measured memory_bytes: 9148
#include <stdio.h>
#include <string.h>

int A[2000000];
int heap_size=0;

void maxHeapify(int i)
{
  int l, r, largest, max;
  l = i*2;
  r = i*2+1;

  if(l<=heap_size && A[l]>A[i])
    largest = l;
  else
    largest = i;
  if(r<=heap_size && A[r]>A[largest])
    largest = r;

  if(largest!=i){
    max = A[largest];
    A[largest] = A[i];
    A[i] = max;
    maxHeapify(largest);
  }
}

int heapExtractMax(void)
{
  int max;
  if(heap_size<1)
    return -1;
  max = A[1];
  A[1] = A[heap_size];
  heap_size--;
  maxHeapify(1);
  return max;
}

void heapIncreaseKey(int i,int key)
{
  int max;
  if(key<A[i])
    return ;
  
  A[i] = key;
  while(i>1 && A[i/2]<A[i]){
    max = A[i/2];
    A[i/2] = A[i];
    A[i] = max;
    i = i/2;
  }
}

void maxHeapInsert(int key)
{
  heap_size++;
  A[heap_size] = -1;
  heapIncreaseKey(heap_size,key);
}

int main()
{
  char str[20];
  int i=0, key;
  while(1){
    scanf("%s",str);
    if(str[2]=='d') break;
    else if(str[0]=='e'){
      printf("%d\n",heapExtractMax());
    }
    else{
      scanf("%d",&key);
      maxHeapInsert(key);
    }
  }

  return 0;
}

Measured memory_bytes: 4696
#include<stdio.h>
int main()
{
	int n;
	
	scanf("%d",&n);
	if(n>=64){
		puts("64");
	}else if(n>=32){
		puts("32");
	}else if(n>=16){
		puts("16");
	}else if(n>=8){
		puts("8");
	}else if(n>=4){
		puts("4");
	}else if(n!=1){
		puts("2");
	}else puts("1");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int a = 0;
  ll ans = 0;
  int n = s.size();
  rep(i, n) {
    if(s[i] == 'A') {
      a++;
    } else if(i < n-1 && s[i] == 'B' && s[i+1] == 'C') {
      ans += a;
      i++;
    } else {
      a = 0;
    }
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9 + 7;
const ld PI = 3.141592653589793;
main(){

	ios_base::sync_with_stdio(false);
	/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    
    int n;
    cin>>n;
    pair<pair<string,int>,int> p[n];
    string s;
    int a;
    for (int i=0; i<n; i++) {
    	cin>>s>>a;
    	p[i]=make_pair(make_pair(s,-a),i+1);
    }
    sort(p, p+n);
    for (int i=0; i<n; i++) cout<<p[i].second<<endl; 
    return 0;
    }

Measured memory_bytes: 256
#include<stdio.h>
int main(){
 	int i;	
  	int ans = 0;
  	int n;
  	long d;
  	long a[400001];
  scanf("%d %ld",&n,&d);
  for(i=0;i<n*2;i+=2){
    scanf("%ld %ld",&a[i],&a[i+1]);
  }
  for(i=0;i<n*2;i+=2){
   if(a[i]*a[i]+a[i+1]*a[i+1]<=d*d){
    ans++; 
   }
  }
  
  printf("%d",ans);
  return 0;
}



Measured memory_bytes: 4856
#import 
#=input()
x=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

if 600 > x:
    print(8)
elif 800 > x:
    print(7)
elif 1000 > x:
    print(6)
elif 1200 > x:
    print(5)
elif 1400 > x:
    print(4)
elif 1600 > x:
    print(3)
elif 1800 > x:
    print(2)
else:
    print(1)

Measured memory_bytes: 9176