akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
struct node
{
    ll x,l;
    bool operator < (const node &b)const
    {
        return x<b.x;
    }
}arr[MAXN];
int main()
{
    ll n;
    while(cin>>n)
    {
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i].x>>arr[i].l;
        }
        sort(arr+1,arr+1+n);
        ll last=arr[1].x+arr[1].l;
        ll next=arr[1].x-arr[1].l;
        ll ans=0;
        for(int i=2;i<=n;i++)
        {
            ll a=arr[i].x-arr[i].l;
            ll b=arr[i].x+arr[i].l;
            if(a<last&&b>last)
            {
                ans++;
            }
            else if(a>=next&&b<=last)
            {
                ans++;
                next=a;
                last=b;
            }
            else
            {
                last=b;
                next=a;
            }
        }
        cout<<n-ans<<endl;
    }
    return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;


const int MAX_STRING_SIZE = 1000000;

ll base = 524287;

vector<ll> MODS({6700417, 1000000007, 2147483647}

);

vector<vector<ll>> invs(MODS.size()), pows(MODS.size());

ll powm(ll e, ll x, ll m) {
  ll r = 1;
  e %= m;
  while (x) {
    if (x % 2) {
      r = (r * e) % m;
    }
    e = (e * e) % m;
    x >>= 1;
  }
  return r;
}

void RHinit() {
  int i = 0;
  for (auto &p : MODS) {
    invs[i].resize(MAX_STRING_SIZE + 1);
    invs[i][0] = 1;
    ll inv = powm(base, p - 2, p);
    for (int j = 1; j <= MAX_STRING_SIZE; j++) {
      invs[i][j] = (invs[i][j - 1] * inv) % p;
    }
    pows[i].resize(MAX_STRING_SIZE + 1);
    pows[i][0] = 1;
    for (int j = 1; j <= MAX_STRING_SIZE; j++) {
      pows[i][j] = (pows[i][j - 1] * base) % p;
    }
    i++;
  }
}

struct RH {
  int n;
  vector<ll> s;
  vector<vector<ll>> hs;

  RH(vector<ll> &s) : s(s) {
    if (pows[0].empty()) {
      RHinit();
    }
    n = s.size();
    hs.resize(MODS.size());
    for (int i = 0; i < MODS.size(); i++) {
      hs[i].resize(n + 1);
      hs[i][0] = 0;
      for (int j = 0; j < n; j++) {
        hs[i][j + 1] = (hs[i][j] + pows[i][j] * (s[j] % MODS[i])) % MODS[i];
      }
    }
  }

  vector<ll> substr(int l, int r) {
    vector<ll> ret(MODS.size());
    for (int i = 0; i < MODS.size(); i++) {
      ret[i] = (hs[i][r] - hs[i][l] + MODS[i]) % MODS[i];
      ret[i] *= invs[i][l];
      ret[i] %= MODS[i];
    }
    return ret;
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n), b(n), da(n), db(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) da[i] = a[(i + 1) % n] ^ a[i];
  for (int i = 0; i < n; i++) db[i] = b[(i + 1) % n] ^ b[i];
  RHinit();
  RH ra(da), rb(db);
  for (int k = 0; k < n; k++) {
    auto rar = ra.substr(0, k);
    auto ral = ra.substr(k, n);
    auto rbl = rb.substr(0, n - k);
    auto rbr = rb.substr(n - k, n);
    if (rar == rbr && ral == rbl) {
      cout << k << " " << (a[k] ^ b[0]) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 69120
n = int(input())
import sys
input = sys.stdin.readline
l = list(map(int,input().split()))
from collections import Counter
c = Counter(l)
v = list(c.values())
s = 0
for i in v:
  s += i*(i-1)//2
for i in l:
  print(s-(c[i]-1))

Measured memory_bytes: 83788
#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);};

int N, Q;
string S;
int ac[100000];

signed main(){
    cin >> N >> Q;
    cin >> S;
    ac[0] = 0; 
    FOR(i, 1, N){
        ac[i] = ac[i - 1] + (S[i - 1] == 'A' && S[i] == 'C');
    }
    int l, r;
    REP(i, Q){
        cin >> l >> r;
        if(l - 2 < 0){
            PRINT(ac[r - 1]);
            continue;
        }
        PRINT(ac[r - 1] - ac[(l - 1) - 1] - (S[(l - 1) - 1] == 'A' && S[l - 1] == 'C'));
    }
    return 0;
}


Measured memory_bytes: 1408
//
// Created by yamunaku on 2019/07/21.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

struct edge{
    int nx;
    int f;
};

int main(){
    ll n,k;
    cin >> n >> k;
    k--;
    vi a(n);
    rep(i,n) cin >> a[i];
    vi pre(200001,-1);
    vi fst(200001,-1);
    vector<edge> e(n);
    rep(i,n){
        if(fst[a[i]]==-1){
            fst[a[i]]=i;
        }
        if(pre[a[i]]!=-1){
            e[pre[a[i]]]={i,0};
        }
        pre[a[i]]=i;
    }
    rep(i,n){
        if(pre[a[i]]!=-1){
            e[pre[a[i]]]={fst[a[i]],1};
            pre[a[i]]=-1;
        }
    }
    vl tm(n,-1);
    ll now=0, tt=0;
    tm[0]=0;
    int p;
    ll one,two;
    while(1){
        tt+=e[now].f;
        now=e[now].nx+1;
        if(now==n){
            tt++;
            now=0;
        }
//        cout << now SP tt << endl;
        if(tm[now]!=-1){
            p=now;
            one = tm[now];
            two = tt-tm[now];
            break;
        }
        tm[now]=tt;
    }
//    cout << p SP one SP two << endl;
//    rep(i,n){
//        cout << tm[i] << endl;
//        cout << e[i].nx SP e[i].f << endl;
//    }
    vi ans;
    if(k<one){
        now=0;
        tt=0;
        while(tt<k){
            tt+=e[now].f;
            now=e[now].nx+1;
            if(now==n){
                tt++;
                now=0;
            }
        }
        while(now<n){
            if(e[now].f>0){
                ans.push_back(a[now]);
                now++;
            }else{
                now=e[now].nx+1;
            }
        }
    }else{
        k=(k-one)%two;
        now=p;
        tt=0;
        while(tt<k){
            tt+=e[now].f;
            now=e[now].nx+1;
            if(now==n){
                tt++;
                now=0;
            }
        }
        while(now<n){
            if(e[now].f>0){
                ans.push_back(a[now]);
                now++;
            }else{
                now=e[now].nx+1;
            }
        }
    }
    rep(i,ans.size()){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    ll sum = 0;
    for (int i = 1; i <= N; i++) {
        if(i % 3 != 0 && i % 5 != 0) {
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3624
import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, input().split())
A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

T = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''





X, K, D = map(int, input().split())

X = abs(X)
amari = K - X // D

if (D * K <= X):
	print(X - D * K)
elif (amari % 2 == 0):
	print( X % D)
else:
	print(abs(D - (X % D)))







Measured memory_bytes: 10688
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Phuong // <3
typedef pair<int,int> ii;

const int inf = 1e9+1;

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    ll a,b,c;
    ll x,y,z;
    cin >> n;
    cin >> a >> b >> c;
    if (n>1)
    for(int i=1;i<n;++i)
    {
        cin >> x >> y >> z;
        x+=max(b,c);
        y+=max(a,c);
        z+=max(a,b);
        a=x; b=y; c=z;
    }
    cout << max(max(a,b),c);
    return(0);
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++) //0から
#define REP(i,n) for(int j=i;j<n;j++) //iから
#define in(a) cin>>a
#define out(a) cout<<a<<endl

long long int kaijo(long long int n){
    if(n == 0) return 1;
    return n * kaijo(n-1);
}


vector<bool> is_prime;
void Eratosthenes(long long int n){
    is_prime.resize(n+1,true);
    is_prime[0]=false;
    is_prime[1]=false;
    for(long long int i = 2; i <= n; i++){
        if(is_prime[i]){
            for(long long int j = i*i; j <= n; j++){
                is_prime[j] = false;
            }
        }
    }
}

//素数列挙
vector<long long int> Prime;
void Prime_Enumeration(long long int n){
    Eratosthenes(n);
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            Prime.push_back(i);
        }
    }
}

long long int gcd(long long int a, long long int b){
    if(a<b){
        swap(a,b);
    }
    long long int r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return r;
}

long long int lcm(long long int a, long long int b){
    long long int g = gcd(a,b);
    long long int l = (a * b) / g;

    return l;
}

//aが負の時でも余りを非負にしたいとき
long long  mod(long long a, long long m){
    return (a % m + m) % m;
}

//拡張ユークリッド ap + bq = gcd(a,b)
long long extGCD(long long a, long long b, long long &p, long long &q){
    if(b == 0){ p = 1; q = 0; return a;}
    long long d = extGCD(b, a % b, q, p);
    q -= a /b * p;
    
    return d;
}

//中国剰余定理
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2){
    long long p, q;
    long long d = extGCD(m1, m2, p, q);

    if((b2-b1) % d != 0) return make_pair(0, -1); //解なし

    long long m = m1 * (m2 / d);
    long long tmp = (b2 - b1) / d * p % (m2 / d);
    long long r =mod(b1 + m1 * tmp, m);

    return make_pair(r, m);
}

//mod.mでのa^{-1}
long long modinv(long long a, long long m){
    long long b = m, u = 1, v = 0;
    while(b){
        long long t = a /b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0)u += m;
    return u;

}
const long long MOD = 1000000007;

//key以上のうち最小の要素のindex
int binary_search(long long int *a, long long int n, long long int key){
    long long int right = n, left = -1;
    long long int md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}


int main(){
    long long int n,k;
    cin>>n;
    vector<long long int> a(n);
    //rep(i,n) in(a[i]);

    int b[10] = {111,222,333,444,555,666,777,888,999};

    for(int i=0;i<10;i++){
        if(n<=b[i]){
            cout<<b[i]<<endl;
            return 0;
        }
    }
    

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cmath>

using namespace std;

const int MAX_V = 100;
const double INF = 100000000;

class Cell{
public:
  double x, y, z, r;
  Cell(double x = 0.0, double y = 0.0, double z = 0.0, double r = 0.0)
    : x(x), y(y), z(z), r(r) {}
  double dist(Cell p){
    return sqrt((x-p.x) * (x-p.x) + (y-p.y) * (y-p.y) + (z-p.z) * (z-p.z));
  }
};

double cost[MAX_V][MAX_V];
double mincost[MAX_V];
bool used[MAX_V];
int V;
Cell data[MAX_V];


double prim(){
  for(int i=0;i<V;i++){
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  double res = 0;
  while(1){
    int v = -1;
    for(int u=0;u<V;u++){
      if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
    }
    if(v == -1) break;
    used[v] = true;
    res += mincost[v];
    for(int u=0;u<V;u++){
      mincost[u] = min(mincost[u], cost[v][u]);
    }
  }
  return res;
}

void makeEdge(){
  for(int i=0;i<V;i++) cost[i][i] = 0.0;
  for(int i=0;i<V;i++){
    for(int j=i+1;j<V;j++){
      double dist = data[i].dist(data[j]) - data[i].r - data[j].r;
      if(dist < 0.0) dist = 0.0;
      cost[i][j] = cost[j][i] = dist;
    }
  }
}

main(){
  while(cin >> V && V){
    for(int i=0;i<V;i++){
      cin >> data[i].x >> data[i].y >> data[i].z >> data[i].r;
    }
    makeEdge();
    printf("%.3f\n", prim());
  }
}

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

int main() {
    int n;
    cin >> n;
    while (n>0) {
        if (n%10 == 7) {
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {

	static final HashMap<Character, Integer> roman = new HashMap<Character, Integer>() {
		{
			put('I', 1);
			put('V', 5);
			put('X', 10);
			put('L', 50);
			put('C', 100);
			put('D', 500);
			put('M', 1000);
		}
	};

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		StringBuilder sb = new StringBuilder();
		while ((line = br.readLine()) != null) {

			int result = 0;
			char next, prev = 'I';
			for (int i = line.length() - 1; i >= 0; i--) {
				next = line.charAt(i);
				if (roman.get(next) < roman.get(prev)) {
					result -= roman.get(next);
				} else {
					result += roman.get(next);
				}
				prev = next;
			}
			sb.append(result + "\n");
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 16884
grid = []
for _ in range(3): 
    grid.append(list(map(int, input().split())))
ns = [int(input()) for _ in range(int(input()))]
for i in range(3):
    for j in range(3):
        if grid[i][j] in ns:
            grid[i][j]= True
        else:
            grid[i][j] = False
flg = False
for i in range(3):
    if (grid[0][i] and grid[1][i] and grid[2][i]) or (grid[i][0] and grid[i][1] and grid[i][2]) or (grid[0][0] and grid[1][1] and grid[2][2]) or (grid[0][2] and grid[1][1] and grid[2][0]):
        flg = True
        break
if flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

int64_t X[200001];
int64_t X2[200001];
int main(){
    int N;
    cin >> N;

    for(int i = 0; i < N; ++i){
        cin >> X[i];
        X2[i] = X[i];
    }
    sort(X, X + N);
    long double med = (X[N / 2 - 1] + X[N / 2]) / 2.0;
    for(int i = 0; i < N; ++i){
        if(med <= X2[i]){
            cout << X[N / 2 - 1] << endl;
        } else {
            cout << X[N / 2] << endl;
        }
    }
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    long double l;
    cin >> l;
    cout << setprecision(10) << fixed << (l/3) * (l/3) * (l/3) << "\n";
}


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

int main(){
    char a, b; cin >> a >> b;
    if(a == 'H' && b == 'H') cout << "H";
    else if(a == 'H' && b == 'D') cout << "D";
    else if(a == 'D' && b == 'H') cout << "D";
    else cout << 'H';
}

Measured memory_bytes: 256
h, w, k = map(int, input().split())
mod = 10**9+7

if w == 1:
    print(1)
    exit()

dp = [[0]*w for _ in range(h+1)]
dp[0][0] = 1
for i in range(1, h+1):
    for p in range(2**(w-1)):
        L = [0]*(w-1)
        for q in range(w-1):
            if (p >> q) & 1:
                L[q] = 1
        flag = True
        for q in range(w-2):
            if L[q] == 1 and L[q+1] == 1:
                flag = False
        if not flag:
            continue
        for j in range(w):
            if j == 0:
                if L[j] == 1:
                    dp[i][j] += dp[i-1][1]
                else:
                    dp[i][j] += dp[i-1][0]
            elif j == w-1:
                if L[j-1] == 1:
                    dp[i][j] += dp[i-1][w-2]
                else:
                    dp[i][j] += dp[i-1][w-1]
            else:
                if L[j-1] == 1:
                    dp[i][j] += dp[i-1][j-1]
                elif L[j] == 1:
                    dp[i][j] += dp[i-1][j+1]
                else:
                    dp[i][j] += dp[i-1][j]
            dp[i][j] %= mod

#print(dp)
print(dp[h][k-1])


Measured memory_bytes: 9204
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstring>
using namespace std;
int main()
{
    string w, t;
    int counter = 0;
    cin >> w;
    while (1)
    {
        cin >> t;
        if (t == "END_OF_TEXT")
        {
            break;
        }
        for (int i = 0; i < t.size(); i++)
        {
            t[i] = tolower(t[i]);
        }
        if (t == w)
        {
            counter++;
        }
    }
    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(false);cin.tie(0);

typedef long long int ll;
ll a[200010], b[200010];

int main() {
    optimizar_io
 	int n, m, k;
 	
 	cin >> n >> m >> k;
 	for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i)
            a[i] += a[i - 1];
    }
 	for (int i = 0; i < m; i++) {
        cin >> b[i];
        if (i)
            b[i] += b[i - 1];
    }
    /*for (int i = 0; i < n; i++)
        cout << a[i] << " ";
    cout << "\n";
    for (int i = 0; i < m; i++)
        cout << b[i] << " ";
    cout << "\n";*/
    //Tomar primero escritorio a
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > k)
            break;
        ll _k = k - a[i];
        int pos = lower_bound(b, b + m, _k) - b;
        if (pos == m or b[pos] > _k)
            pos--;
        if (pos >= 0)
            ans = max(ans, i + 1 + pos + 1);
        else    
            ans = max(ans, i + 1);
    }
    //Tomar primero escritorio b
    for (int i = 0; i < m; i++) {
        if (b[i] > k)
            break;
        ll _k = k - b[i];
        int pos = lower_bound(a, a + n, _k) - a;
        if (pos == n or a[pos] > _k)
            pos--;
        if (pos >= 0)
            ans = max(ans, i + 1 + pos + 1);
        else
            ans = max(ans, i + 1);
    }
    cout << ans << "\n";
 	return 0;
}
/*
6 6 105
100 1 1 1 1 1
10 100 100 100 100 100 
*/

Measured memory_bytes: 6720
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> C(N);
  
  for(int i=0; i < N; i++) C.at(i) = 1001;
  
  for(int i=0; i < N; i++) {
    int c_i, t_i;
    cin >> c_i >> t_i;
    if(t_i <= T) C.at(i) = c_i;
  }
  
  sort(C.begin(), C.end());
  
  if(C.at(0) == 1001) cout << "TLE" << endl;
  
  else cout << C.at(0) << endl;
  
  return 0;
}

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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;

const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

char s[25];

int main(){
    scanf("%s", s);
    int len = strlen(s);
    int ans = 0;
    for(int i = 0; i < len; i++) ans += (s[i] - '0');
    for(int i = 0; i < len; i++){
        s[i]--;
        int tmp = 0;
        for(int j = 0; j <= i; j++) tmp += (s[j] - '0');
        for(int j = i + 1; j < len; j++) tmp += 9;
        ans = max(ans, tmp);
        s[i]++;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    cin>>n>>k;
    vl b(n+1),v(n+1);
    fo(i,n)cin>>b[i+1]>>v[i+1];
    vvl dp(101,vl(100001,inf*inf));
    //cout<<z<<endl;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=100000;j++){
            if(i==0||j==0){if(j==0)dp[i][j]=0;continue;}
            dp[i][j]=dp[i-1][j];
            if(j<v[i])continue;
            dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+b[i]);
            //cout<<dp[i][j]<<" "<<i<<" "<<j<<endl;
        }
    }
    fo(i,100000)if(dp[n][i+1]<=k)kv=max(kv,i+1);
    cout<<kv;
    return 0;
}


Measured memory_bytes: 80256
type
  pair = record
    a : longint;
    b : longint;
  end;
	pairArray = array[1..100000] of pair;

var i,j,n,m:longint;
    ans:int64;
    input:pairArray;
    heap:array[0..100000] of longint;

procedure swap(var X, Y: longint);
begin
	if X <> Y then begin
		X := X xor Y;
		Y := X xor Y;
		X := X xor Y
	end
end;

procedure	pswap(var a,b:pair);
var tmp:pair;
begin
	tmp:=a;
	a:=b;
	b:=tmp
end;

procedure QuickSort(var a:pairArray;start_index,end_index:longint);
var i,j,x:int64;
begin
	x:=a[(start_index+end_index)div 2].a;
	i:=start_index;
	j:=end_index;
	while(true)do
	begin
		while(a[i].a<x)do i:=i+1;
		while(x<a[j].a)do j:=j-1;
		if(i<j)then
		begin
			pswap(a[i],a[j]);
			i:=i+1;
			j:=j-1;
		end else
		begin
			if(start_index<i-1)then QuickSort(a,start_index,i-1);
			if(j+1<end_index)then QuickSort(a,j+1,end_index);
			exit;
		end;
	end;
end;

procedure upheap(b:longint);
var p:integer;
begin
  heap[0] := heap[0] + 1;
  p := heap[0];
  heap[p] := b;
  while (p>1) and (heap[p]>heap[p div 2]) do begin
    swap(heap[p],heap[p div 2]);
    p := p div 2
  end
end;

function downheap:longint;
var p:integer;
begin
  downheap:=heap[1];
  heap[1] := heap[heap[0]];
  heap[0] := heap[0] - 1;
  p := 1;
  while (p*2 <= heap[0]) and (heap[p]<heap[p*2]) or (p*2+1 <= heap[0]) and (heap[p]<heap[p*2+1]) do
    if (p*2+1 <= heap[0]) and (heap[p*2]<heap[p*2+1]) then begin
      swap(heap[p],heap[p*2+1]);
      p := p*2+1
    end else begin
      swap(heap[p],heap[p*2]);
      p := p*2
    end
end;

begin
  readln(n,m);
  for i := 1 to n do readln(input[i].a,input[i].b);
  QuickSort(input,1,n);
  j := 1;
  ans := 0;
  for i := 1 to m do begin
    while input[j].a=i do begin
      upheap(input[j].b);
      j := j + 1
    end;
    if heap[0]>0 then ans := ans + downheap
  end;
  writeln(ans)
end.

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while(true) {
			int h = scan.nextInt();
			int w = scan.nextInt();
			if(h == 0 && w == 0) {
				break;
			}

			for(int i = 0; i < h; i++) {
				for(int j = 0; j < w; j++) {
					if((i == 0 || i == h - 1) || (j == 0 || j == w - 1)) {
						System.out.printf("#");
					}
					else {
						System.out.printf(".");
					}
				}
				System.out.println("");
			}
			System.out.println("");
		}

		scan.close();
	}
}


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

typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;	

const ll MOD=1e9+7,MAX_N=100;

ll N,h[MAX_N];

ll memo[MAX_N][MAX_N*2];
vector<ll> hei;

ll mpw(ll n,ll m){
	if (m==0){
		return 1;
	}
	ll ret=mpw(n,m/2);
	ret*=ret;
	ret%=MOD;
	if (m&1){
		ret*=n;
		ret%=MOD;
	}
	return ret;
}

ll dfs(ll n,ll m){
	if (memo[n][m+1]!=-1){
		return memo[n][m+1];
	}
	ll ret=0;
	if (m%2==0 && hei[m/2+1]-hei[m/2]<=1){
		ret=0;
	}else if (n==N-1){
		if (m==-1){
			ret=2;
		}else{
			if (m&1){
				ret=mpw(2,h[n]-hei[m/2+1]);
			}else{
				ret=mpw(2,h[n]-hei[m/2+1])*((mpw(2,hei[m/2+1]-hei[m/2]-1)+MOD-1)%MOD)%MOD*2%MOD;
			}
		}
	}else if (m==-1){
		if (h[n+1]<=h[n]){
			ret=dfs(n+1,-1)*2%MOD;
		}else{
			ret=dfs(n+1,-1)*2%MOD;
			ll x=lower_bound(hei.begin(),hei.end(),h[n])-hei.begin(),y=lower_bound(hei.begin(),hei.end(),h[n+1])-hei.begin();
			REP(i,(y-x)*2){
				ret+=dfs(n+1,x*2+i-1)*2%MOD;
				ret%=MOD;
			}
		}
	}else{
		if (m%2){
			if (h[n+1]>hei[m/2+1]){
				ret=dfs(n+1,m)*mpw(2,max(h[n]-h[n+1],0ll))%MOD;
			}else{
				ret=mpw(2,h[n]-hei[m/2+1])*dfs(n+1,-1)%MOD;
			}
		}else{
			if (h[n+1]>=hei[m/2+1]){
				ret=dfs(n+1,m)*mpw(2,max(h[n]-h[n+1],0ll))%MOD;
			}else{
				ret=mpw(2,h[n]-hei[m/2+1])*((mpw(2,hei[m/2+1]-hei[m/2]-1)+MOD-1)%MOD)%MOD*2%MOD*dfs(n+1,-1)%MOD;
			}
		}
	}
	return memo[n][m+1]=ret;
}

		
int main(){
	cin>>N;
	REP(i,N){
		cin>>h[i];
		hei.push_back(h[i]);
	}
	hei.push_back(0);
	sort(hei.begin(),hei.end());
	hei.erase(unique(hei.begin(),hei.end()),hei.end());
	memset(memo,-1,sizeof(memo));
	ll ans=dfs(0,-1);
	ll x=lower_bound(hei.begin(),hei.end(),h[0])-hei.begin();
	REP(i,x*2-1){
		ans+=dfs(0,i);
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define INF 999999999

using namespace std;

// input
string str;

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

    int index = 1;

    cin >> str;

    for(auto c:str){
        if(index % 2 == 1)
            cout << c;
        index++;
    }

    cout << "\n";
    
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
using namespace std;
int n, w;
ll **mem;
pair<int, ll> *x;
ll nap(int i = 0, int rem = w)
{
    if(i == n)
        return 0;
    if(~mem[i][rem])
        return mem[i][rem];
    ll first = nap(i + 1, rem), second = 0;
    if(rem >= x[i].first)
        second = x[i].second + nap(i + 1, rem - x[i].first);
    return mem[i][rem] = max(first, second);
}
int main()
{
    //cin.tie(NULL); cout.tie(NULL);  ios_base::sync_with_stdio(false);
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #endif
    scanf("%d %d", &n, &w);
    mem = new ll*[n];
    for(int i = 0; i < n; i++)
    {
        mem[i] = new ll[w + 1];
        memset(mem[i], -1, (w + 1) * 8);
    }
    x = new pair<int, ll>[n];
    for(int i = 0; i < n; i++)
        scanf("%d %lld", &x[i].first, &x[i].second);
    printf("%lld", nap());
}


Measured memory_bytes: 78720
n,k =  map(int,input().split())
A = list(map(int,input().split()))

l = min(A)//(k+1) 
r = max(A)
m = (l+r)//2+1

while 1:
    
    m = (l+r)//2
    if m==0:
        m=1
        break

    
    #m以下の長さにできるか判定
    
    # A_long = A[A>m]
    n= sum( [  int((A[i]-0.1)//(m)) for i in range(len(A)) ] )
    
    # print(l,m,r,n)
    
    if n<=k:
        if r==m:
            break
        r=m-1
    else:
        if l==m:
            m+=1
            break
        l=m+1
        

        
print(m)

Measured memory_bytes: 218648
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <iomanip>
#include <utility>
#include <map>
using namespace std;
using int64 = long long;
#define ForInt(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define ForItr(it, itBegin, itEnd) for (auto (it) = (itBegin); (it) != (itEnd); ++(it))


int main()
{
	int a, b;
	cin >> a >> b;
	priority_queue<int> q;
	q.push(a + b);
	q.push(a - b);
	q.push(a * b);
	cout << q.top() << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (long int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int N,m=0;
    cin>>N;
    string X;
    cin>>X;
    vector<char> c(N);
    rep(i,N){
        if (X[i]=='1') m++;
    } 

    if (m==0){
        rep(i,N){
            cout<<1<<endl;
        }
        return 0;
    }
    if (m==1){
        rep(i,N){
            if (X[i]=='1'){
                cout<<0<<endl;
            }
            else{
                if (i==N-1)  cout<<2<<endl;
                else  cout<<1<<endl;
            }
        }
        return 0;
    }
    vector<long int> ap(N),am(N);
    long int s=1;
    rep(i,N){
        ap[N-1-i]=s%(m+1);
        s=s*2;
        s=s%(m+1);
    }
    s=1;
    rep(i,N){
        am[N-1-i]=s%(m-1);
        s=s*2;
        s=s%(m-1);
    }
    long int nap=0,nam=0;
    rep(i,N){
        if (X[i]=='1'){
            nap+=ap[i];
            nap=nap%(m+1);
            nam+=am[i];
            nam=nam%(m-1);
        }
    }
    vector<long int> ans(N);
    rep(i,N){
        if (X[i]=='0'){
            ans[i]=(nap+ap[i])%(m+1);
        }
        else{
            ans[i]=(nam-am[i]);
            if (ans[i]<0) ans[i]+=m-1;      
        }
    }

    rep(i,N){
        if (ans[i]==0) cout<<1<<endl;
        else{
            int num=1;
            while (ans[i]!=0){
                int a=0,b=ans[i];
                while (b!=0){
                    if (b%2==1) a++;
                    b=b/2;
                }
                ans[i]=ans[i]%a;
                num+=1;
                if (ans[i]==0){
                    cout<<num<<endl;
                    break;
                }
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 8344
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
tmp = -1
for i in range(N):
    if tmp + 1 == A[i]:
        ans += C[tmp-1]
    ans += B[A[i]-1]
    tmp = A[i]

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main(){
    char x[1001];
    int n;
    do{
        scanf("%s",&x);
        n=0;
        for(int i=0;i <strlen(x);i++){
            n=n+x[i]-'0';
        }
        if(n!=0){
        printf("%d\n",n);
        }
    }while(n!=0);
}


Measured memory_bytes: 2048
import Data.List
import Control.Monad

getList :: IO (Int,[Int])
getList = (,) <$> readLn <*> (map read.words <$> getLine)

main = do
    [n,k] <- map read.words <$> getLine
    ls <- replicateM k getList
    print $ answer n (nub.concat $ map snd ls)

answer :: Int -> [Int] -> Int
answer n ls = length $ filter (not.flip elem ls) [1..n]


Measured memory_bytes: 5888
#include <iostream>

using namespace std;

int main(void){
	double table[] = {48,51,54,57,60,64,69,75,81,91};
	string cs[] = {"light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy"};
	double input;
	while(cin >> input){
		int i;
		for(i=0;i<10;i++){
			if(input<=table[i]) break;
		}
		cout << cs[i] << "\n";
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

#define N 100

int main() {
	static char toll[N + 1];
	int n, m, x, i, a, b;

	scanf("%d%d%d", &n, &m, &x);
	while (m--) {
		int a;

		scanf("%d", &a);
		toll[a] = 1;
	}
	a = 0;
	for (i = 1; i < x; i++)
		if (toll[i])
			a++;
	b = 0;
	for (i = x + 1; i <= n; i++)
		if (toll[i])
			b++;
	printf("%d\n", a < b ? a : b);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

/*
sx sy tx ty
-1000 1000
 */

int sx,sy,tx,ty;

int main(){
  cin>>sx>>sy>>tx>>ty;

  REP(i,tx-sx)
    cout << "R";
  REP(j,ty-sy)
    cout << "U";
  REP(i,tx-sx)
    cout << "L";
  REP(j,ty-sy)
    cout << "D";

  cout << "D";
  REP(i,tx-sx+1)
    cout << "R";
  REP(j,ty-sy+1)
    cout << "U";
  cout << "L";

  cout << "U";
  REP(i,tx-sx+1)
    cout << "L";
  REP(j,ty-sy+1)
    cout << "D";
  cout << "R\n";

  return 0;
}


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

using namespace std;

#define int long long
#define FR first
#define SC second
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)

typedef pair<int, int> P;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n; cin >> n;
  while(n--) {
    string s; cin >> s;
    deque<char> dq;
    set<char> st;
    dq.push_front(s[0]);
    st.insert(s[0]);
    reps(i, 3, s.size()) {
      if(!st.count(s[i])) {
	if(s[i-1] == '>') dq.push_back(s[i]);
	else dq.push_front(s[i]);
	st.insert(s[i]);
      }
      i+=2;
    }
    while(!dq.empty()) {
      cout << dq.front(); dq.pop_front();
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
typedef pair<char,P>P2;
#define F first
#define S second


signed main(){
    int n,a=0,b=0;
    string s;
    cin>>n>>s;
    r(i,n){
        if(s[i]=='R')a++;
        else b++;
    }
    if(a>b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

int H, W;
int field[600][600];
int ans;

struct n4 { int a; int b; int c; int d; };
vector<n4> out;

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> field[i][j];
		}
	}

	for (int i = 0; i < H; i++) {
		for (int J = 0; J < W; J++) {
			int j = J;
			if (i % 2 != 0)j = W - 1 - j;
			if (i == H - 1) {
				if (j == W - 1 && H % 2 == 1)continue;
				if (j == 0 && H % 2 == 0)continue;
			}
			if (field[i][j] % 2 == 0) {
				continue;
			}
			else {
				n4 tmp;
				if ((j + 1 < W && i % 2 == 0) || (j > 0 && i % 2 == 1)) {
					if (i % 2 == 0) {
						field[i][j + 1]++;
						tmp.a = i + 1, tmp.b = j + 1;
						tmp.c = i + 1, tmp.d = j + 2;
					}
					else {
						field[i][j - 1]++;
						tmp.a = i + 1, tmp.b = j + 1;
						tmp.c = i + 1, tmp.d = j;
					}
					ans++;
				}
				else {
					field[i + 1][j]++;
					tmp.a = i + 1, tmp.b = j + 1;
					tmp.c = i + 2, tmp.d = j + 1;
					ans++;
				}
				out.push_back(tmp);
			}
		}
	}

	cout << ans << endl;
	for (int i = 0; i < out.size(); i++) {
		cout << out[i].a << " " << out[i].b << " " << out[i].c << " " << out[i].d << endl;
	}

	return 0;
}


Measured memory_bytes: 5360
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

int main()
{
    int x;
    scanf("%d", &x);
    printf("%d\n", 10 - x/200);
    return 0;
}


Measured memory_bytes: 1732
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    // insert code here...
    int i,x;
    i=1;
    while (1) {
       
        cin >> x;
        if (x==0) {break;}
        else{
        cout << "Case " << i << ": " << x << endl;
        
        i++;
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 1160
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        s: chars
    }
    let e = vec!['R', 'U', 'D'];
    let o = vec!['L', 'U', 'D'];
    let mut yes = true;
    for i in 0..s.len() {
        if i % 2 == 0 {
            if !e.contains(&s[i]) { yes = false; }
        } else {
            if !o.contains(&s[i]) { yes = false; }
        }
    }
    println!("{}", if yes {"Yes"} else {"No"});
}
/* vim:set foldmethod=marker: */


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int gcd(int a,int b)
{
	if(a%b!=0)
	{
		return gcd(b,a%b);
	}
	return b;
}

int main()
{
  int k;cin>>k;
	ll ans=0;
	int i,j,l;
	for(i=1;i<=k;i++)
	{
		for(j=1;j<=k;j++)
		{
			for(l=1;l<=k;l++)
			{
				ans+=gcd(i,gcd(j,l));
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include <stdio.h>

int
max(int x, int y)
{
	return (x > y ? x : y);
}

int
main(void)
{
	int A, B;
	scanf("%d %d", &A, &B);

	int res = max(max(A + B, A - B), A * B);
	printf("%d\n", res);
	return (0);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <string>
#include <fstream>
#include <cmath>
#include <climits>
#include <vector>
#include <unordered_map>
using namespace std;

#define ll long long

int main()
{
	string s;
	cin >> s;
	
	if(s[2] == s[3] && s[4] == s[5])
	{
		cout << "Yes";
	}
	else
{
	cout << "No";
}
	
	return 0;
}

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

using namespace std;
#define ll long long
const ll mx=1e9+7;

int main() {
	
	string s;
	cin>>s;
	
	vector<int> v;
	
	for(const char& u:s) v.emplace_back(u-'0');
	
	ll ans=0;
	ll n=1<<(v.size()-1);
	for(ll i=0; i<(1<<(v.size()-1)); i++){
		ll c=0;
		for(ll j=0; j<v.size(); j++ ){
			if(i & (n>>j)){
				ans+=c;
				c=0;
			}
			c=c*10+v[j];;
		}
		ans+=c;
		}
	
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int judge(vector<int> &a, int k)
{
	for (int i = 2; i < k; ++i) {
		if (a[i] % 2 == 1) {
			return 1;
		}
	}
	return 0;
}
int main()
{
	vector<int> a;
	a.reserve(100);
	int aa, bb;
	while (cin >> aa >> bb) {
		if (aa != 0 && bb != 0) {
			if (max(aa,bb) > a.size()) 
				a.resize(max(aa,bb), 0);
			a[aa - 1] += 1;
			a[bb - 1] += 1;
		}
		else {
			if (a[0] % 2 == 1 && a[1] % 2 == 1 && judge(a, a.size()) == 0)
				printf("%s\n", "OK");
			else
				printf("%s\n", "NG");
			a.clear();
		}
	}
}

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

int main()
{
    long long x,a,b;
    while(scanf("%lld%lld%lld",&x,&a,&b)!=EOF){
        if(a>=b) printf("delicious\n");    
        else if((b-a)>x)printf("dangerous\n");
        else printf("safe\n");
        
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	string s;
	string t="";
	cinl(s);
	t += "A";
	t += s[8];
	t += "C";
	cout<<t<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

// B - Great Ocean View
public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] H = new int[N];
	for (int i = 0; i < N; i++) {
		H[i] = sc.nextInt();
	}
	int max = 0;
	int count = 0;
	for (int i = 0; i < N; i++) {
		if (H[i] >= max) {
			max = H[i];
			count++;
		}
	}
	System.out.println(count);
	}
}

Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n;
    ll k, ans = 0;
    cin >> n >> k;
    
    int a[n];
    ll r[n], t[n];
    rep(i, n) {
        cin >> a[i];
        r[i] = 0;
        t[i] = 0;
    }

    rep(i, n-1) {
        for(int j = i+1; j < n; j++) {
            if(a[i] > a[j]) {
                r[i]++;
            }
        }
    }

    rep(i, n) {
        rep(j, n) {
            if(i == j) {
                continue;
            }

            if(a[i] > a[j]) {
                t[i]++;
            }
        }
    }

    rep(i, n) {
        ll x = (k-1)*k/2;
        x %= mod;
        x *= t[i];
        x %= mod;
        ll y = k*r[i];
        y %= mod;
        ans += x + y;
        ans %= mod;
    }

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

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

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int r,g,b,n;
        cin>>r>>g>>b>>n;
        int ans=0;
        rep0(3001){
            repi(j,0,3001){
                if((n-(i*r+j*g))%b==0&&n>=i*r+j*g) ans++;
            }
            //cout<<ans<<endl;
        }
        cout<<ans;
     }
    signed main()
    {   
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int N,best=0,cur=0;
	string X;
	cin>>N;
	cin>>X;
	for(int i=0;i<N;++i){
		if(X[i]=='I') cur++; else cur--;
		best=max(best,cur);
	}
	cout<<best<<endl;
}

Measured memory_bytes: 256