akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int A,B;
char s[12];
int main(void){
    scanf("%d%d",&A,&B);
    scanf("%s",s);
    for(int i=0;i<A;i++)if(!('0'<=s[i]&&s[i]<='9'))
    {
        puts("No");return 0;
    }
    if(s[A]!='-')
    {
        puts("No");return 0;
    }
    for(int i=A+1;i<=A+B;i++)if(!('0'<=s[i]&&s[i]<='9'))
    {
        puts("No");return 0;
    }
    puts("Yes");
}


Measured memory_bytes: 128
s = gets.chomp.reverse
words = %w(dream dreamer erase eraser).map(&:reverse)

until s.empty?
  status = false
  words.each do |w|
    if s[0...w.size] == w
      s = s[w.size..-1]
      status = true
      break
    end
  end
  unless status
    puts "NO"
    exit
  end
end
puts "YES"


Measured memory_bytes: 3196
//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  ll x;
  cin >> x;
  ll a = 100;
  ll count = 0;
  while(a<x){
    a += a /100;
    count ++;
  }
  cout << count << endl;
}


Measured memory_bytes: 3608
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
using namespace std;
int		cnt;

int		main(void)
{
	int		N;
	string	S;
	cin >> N >> S;
	int		j = S.size() / 2;
	if (N % 2)
		cout << "No" << endl;
	else
	{
		for (int i = 0; i < S.size() / 2; i++, j++)
		{
			if (S.at(i) != S.at(j))
			{
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
long long dp[10010][110][2] = {},mod = 1000000007;
int main(){
	string k;
	int i,j,l,d;
	cin >> k >> d;
	for(i=1;i<=k[0]-'0';i++){
		if(k[0]-'0'==i) dp[0][i%d][1]++;
		else dp[0][i%d][0]++;
	}
	for(i=1;i<k.size();i++){
		for(j=1;j<=9;j++){
			dp[i][j%d][0]++;
		}
		for(j=0;j<=9;j++){
			for(l=0;l<d;l++){
				(dp[i][(j+l)%d][0] += dp[i-1][l][0]) %= mod;
				if((k[i]-'0')>=j) (dp[i][(j+l)%d][(k[i]-'0')==j] += dp[i-1][l][1]) %= mod;
			}
		}
	}
	cout << (dp[k.size()-1][0][0] + dp[k.size()-1][0][1])%mod << endl;
}

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

int main()
{
	int n;
	long long k;
	scanf("%d%lld", &n, &k);
	std::vector<long long> a(n);
	for (auto& e: a) scanf("%lld", &e);
	long long x{};
	for (int i{}; x < k; i++)
	{
		int count{};
		for (int j{}; j < n; j++)
			count += a[j] >> i & 1;
		if (2 * count < n)
			x += 1LL << i;
	}
	int digit{40};
	for (; digit >= 0; digit--)
	{
		if (k >> digit & 1) break;
		if (x >> digit & 1)
			x -= 1LL << digit;
	}
	while (x > k)
	{
		digit--;
		if ((x >> digit & 1) > (k >> digit & 1))
			x -= 1LL << digit;
	}
	long long f{};
	for (int i{}; i < n; i++)
		f += x ^ a[i];
	printf("%lld\n", f);

	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include <algorithm>
#include <cstring>
using namespace std;
int const maxn=1e3+5;
int p[105];
int main(){
	int N,n1,n2;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d%d",&n1,&n2);
		if(n1==n2) p[i]=1;
	}
	int flag=0,i,j;
	for(i=0;i<=N-3;i++){
		for(j=i;j<i+3;j++){
			if(p[j]==1) continue;
			else break;
		}
		if(j==i+3){
			flag=1;
			break;
		}
	}
	if(flag==1) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3716
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#define PB push_back
#define MP make_pair
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=2010;
vector<int> e[N];
void ad(int x,int y) { e[x].PB(y),e[y].PB(x); }
int top[N][N],G[N][N],n,m;
int fa[N][N];
void dfs1(int u,int last,int p) {
	fa[p][u]=last;
	for(int i=0;i<e[u].size();++i)
		if(e[u][i]!=fa[p][u]) dfs1(e[u][i],u,p);
}
queue<int> que;
void addedge(int a,int b) {
	if(top[a][b]==b) return;
	if(top[a][b]) return addedge(top[a][b],b);
	if(top[b][a]) return addedge(top[b][a],a);
//	cout<<"add:"<<a<<' '<<b<<endl;
	G[a][b]=G[b][a]=1;
	top[a][b]=b,top[b][a]=a;
	vector<pair<int,int> > tmp;
	{
		que.push(b);
		while(!que.empty()) {
			int u=que.front(); que.pop();
			for(int i=0;i<e[u].size();++i) {
				int v=e[u][i]; if(v==fa[a][u]) continue;
				if(top[a][v]) {
					G[top[a][v]][a]=G[a][top[a][v]]=0;
					tmp.PB(MP(top[a][v],b));
				}
				else top[a][v]=b,que.push(v);
			}
		}
	}
	swap(a,b);
	{
		que.push(b);
		while(!que.empty()) {
			int u=que.front(); que.pop();
			for(int i=0;i<e[u].size();++i) {
				int v=e[u][i]; if(v==fa[a][u]) continue;
				if(top[a][v]) {
					G[top[a][v]][a]=G[a][top[a][v]]=0;
					tmp.PB(MP(top[a][v],b));
				}
				else top[a][v]=b,que.push(v);
			}
		}
	}
	for(int i=0;i<tmp.size();++i) addedge(tmp[i].first,tmp[i].second);
}
int ans;
void dfs2(int u,int lst,int p) {
	if(G[lst][u]) lst=u,ans++;
	for(int i=0;i<e[u].size();++i) {
		int v=e[u][i]; if(v==fa[p][u]) continue;
		dfs2(v,lst,p);
	}
}
int main() {
	rd(n),rd(m);
	for(int i=1,x,y;i<n;++i) rd(x),rd(y),ad(x,y);
	for(int i=1;i<=n;++i) dfs1(i,0,i);
	for(int i=1,x,y;i<=m;++i) rd(x),rd(y),addedge(x,y);
//	for(int i=1;i<=n;++i,puts("")) for(int j=1;j<=n;++j) printf("%d ",top[i][j]); puts("");
	for(int i=1;i<=n;++i) dfs2(i,i,i);
	printf("%d\n",ans/2);
	return 0;
}

Measured memory_bytes: 47872
// coding utf-8
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
using ll = long long;

const long double PI = acos(-1.0);

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();

    int s;
    cin >> s;

    int n = s / 3;

    ll ans = 0;

    for(int i = 1; i <= n; i++) {
        ans = (ans + COM(s - 2*i - 1, i - 1)) % MOD;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 15592
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */


#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SIZE 100005
#define MOD 1000000007
#define INF 100000000

using namespace std;

class COtoshidama {
public:
  void solve(std::istream &cin, std::ostream &cout) {
    long n, y;
    cin >> n >> y;
    for (int i = 0; i < n + 1; ++i) {
      for (int j = 0; j < n + 1; ++j) {
        if (i + j > n)
          break;
        long k = n - i - j;
        if (i * 10000 + j * 5000 + k * 1000 == y) {
          printf("%d %d %d\n", i, j, k);
          return;
        }
      }
    }
    printf("-1 -1 -1\n");
  }
};


int main() {
    COtoshidama solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double
#define DUMP(v) "," #v ":" << v

// ABC056 C - Go Home
int main(){
  ll x;
  cin >> x;

  ll ans = 0;

  ll x2 = x * 2;
  ll n = floor(sqrt(x2));
  while (n * (n+1) < x2) { ++n; }
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 3692
from collections import deque

N,M = map(int, input().split())
edge = [[] for _ in range(N)]
for _ in range(N - 1):
    x,y = map(int, input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)


par = [-1] * N
TS = []
que = deque([0])
while que:
    v = que.popleft()
    TS.append(v)
    for w in edge[v]:
        if w == par[v]: continue
        par[w] = v
        edge[w].remove(v)
        que.append(w)


unit = 1
merge = lambda a, b: a * b % M
adj_bu = lambda a, v: a + 1
adj_td = lambda a, v, p: a + 1
adj_fin = lambda a, v: a


accBU = [unit] * N
res = [0] * N
for v in reversed(TS[1:]):
    res[v] = adj_bu(accBU[v], v)
    p = par[v]
    accBU[p] = merge(accBU[p], res[v])
res[TS[0]] = adj_fin(accBU[TS[0]], TS[0])


resTD = [unit] * N
for p in TS:
    tmp = resTD[p]
    for v in edge[p]:
        resTD[v] = tmp
        tmp = merge(tmp, res[v])
    tmp = unit
    for v in reversed(edge[p]):
        resTD[v] = adj_td(merge(resTD[v], tmp), v, p)
        tmp = merge(tmp, res[v])
        res[v] = adj_fin(merge(accBU[v], resTD[v]), v)

print(*res, sep="\n")

Measured memory_bytes: 34428
import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7


def get_sieve_of_eratosthenes(n):
    """
    エラトステネスの篩。√N以下の数に対して2から順にその数の倍数を消していく。
    計算量は「調和級数」になるのがミソ。具体的には
        N/2 + N/3 + N/5 + ... + N/(√N) = N * (1/2 + 1/3 + 1/5 + ... + 1/√N)
                                       = N * loglog(√N) (素数の逆数和の発散スピードがこれ)
                                       = N(loglogN - log2)
    """
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        return [0] * (n + 1)
    prime = [1] * (n + 1)
    prime[0] = prime[1] = 0
    for i in range(2, int(n**0.5) + 1):
        if not prime[i]: continue
        for j in range(i * 2, n + 1, i):
            prime[j] = 0
    return prime


def main():
    n = int(input())
    primes = get_sieve_of_eratosthenes(n)
    ans = 1
    for p in range(2, n + 1):
        if primes[p] == 0: continue
        cur = p
        num = 0
        while cur <= n:
            num += n // cur
            cur *= p
        ans *= (num + 1)
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 63656
#include <stdio.h>
int main()
{
    long long int n,m,sum;
    scanf("%ld%ld",&n,&m);
    if(n == (m / 2))
        sum = n;
    else if (n > (m / 2))
        sum = (m / 2);
    else if (n < (m / 2))
    {
        sum = n + ((m/2)-n) / 2;
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <map>
#include <iomanip>
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long long a, long long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long long a, long long b){
	return a / gcd(a,b) * b;
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int n, sum = 0;
int d[51];

int main(){
	cin >> n;
	
	REP(i,n){
		cin >> d[i];
	}
	
	REP(i,n){
		REP(j,n){
			if (i-j){
				sum += d[i]*d[j];
			}
		}
	}
	
	sum /= 2;
	
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50

def bfs(MAZE, start, seen):
    queue = deque([start + (0 ,)])
    max_count = 0
    while queue:
        y,x,count = queue.popleft()
        max_count = max(max_count, count)
        if (y,x) in seen:
            continue
        seen.add((y, x))
        for i,j in ((0,1), (0,-1), (1,0), (-1, 0)):
            next_y, next_x = y + i, x + j
            #print(next_y, next_x)
            if not (next_y, next_x) in seen and MAZE[next_y][next_x] == '.':
                queue.append((next_y, next_x, count+1))
                #seen.add((next_y, next_x))
    return max_count


def run():
    H, W = map(int, input().split())
    MAZE = ['#' * (W+2)]
    for _ in range(H):
        s = input()
        s = '#' + s + '#'
        MAZE.append(s)
    MAZE.append('#' * (W+2))

    #for m in MAZE:
    #    print(m)

    ways = []
    for i in range(1, H+1):
        for j in range(1, W+1):
            if MAZE[i][j] == '.':
                ways.append((i, j))

    max_count = 0
    for s_i, s_j in ways:
        seen = set((s_i, s_j))
        min_count = bfs(MAZE, (s_i, s_j), seen)
        #print((s_i, s_j), '->', (g_i, g_j))
        #print(min_count)
        max_count = max(max_count, min_count)

    print(max_count)

if __name__ == "__main__":
    run()

Measured memory_bytes: 9384
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

A = sorted(A)
F = sorted(F, reverse=True)

l = -1 # 絶対にfalse
r = 10**12+5
while (l+1<r):
  c = (l+r)//2
  s = 0
  for i in range(N):
    s += max(0, A[i]-(c//F[i]))
  if s <= K:
    r = c
  else:
    l = c

print(r)

Measured memory_bytes: 121164
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,m,c;
    cin >> n >> m >> c;
    vi b(m), a(m);
    for(int i=0; i<m; i++) cin >> b.at(i);
    int64_t tmp = 0, res = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >> a.at(j);
            tmp+=a.at(j)*b.at(j);
        }
        if(tmp + c > 0) res++;
        tmp = 0;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

struct line{
	long long a,b;
	long long val(int x){return a * x + b;}
}X[200200];

const int lim = 1000000;
struct node{
	node(){ l = r = nullptr; d = nullptr; }
	node *l, *r; line *d;
}root;
node *roota = &root;

void push(node* &n, line *now, int l, int r)
{
	if (!n) n = new node;

	auto &nxt = n->d;
	if (nxt == nullptr){
		nxt = now;
		return;
	}

	int m = (l + r) / 2;
	bool u = nxt->val(l) > now->val(l);
	bool v = nxt->val(m+1) > now->val(m+1);

	if (v) swap(now,nxt);
	if (l == r);
	else if (u ^ v) push(n->l, now, l, m);
	else push(n->r, now, m+1, r);
}

long long pop(node* n, int t, int l, int r)
{
	long long res = 9e18;

	if (auto nxt = n->d) res = nxt->val(t);

	int m = (l + r) / 2;
	if (l <= t && t <= m){
		if (n->l) res = min(res,pop(n->l,t,l,m));
	}
	else{
		if (n->r) res = min(res,pop(n->r,t,m+1,r));
	}

	return res;
}

int N; long long C,H[200200],D[200200];

int main()
{
	scanf ("%d %lld",&N,&C);
	for (int i=1;i<=N;i++){
		scanf ("%lld",&H[i]);

		long long val = i == 1 ? 0 : pop(roota, H[i], 1, lim) + H[i] * H[i];
		D[i] = val;
		X[i] = {-2ll*H[i], D[i]+H[i]*H[i]+C};
		push(roota, X+i, 1,lim);
	}

	printf ("%lld\n",D[N]);

	return 0;
}


Measured memory_bytes: 12800
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

h,w = get_nums_l()

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

ans = 0

ans += ((h+1)//2) * ((w+1) //2)
ans += (h//2) * (w // 2)

print(ans)

Measured memory_bytes: 38384
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
    if(a<b && b<c){
    	System.out.println("Yes");
    }else{
    	System.out.println("No");
    }
    
  
  }
}

Measured memory_bytes: 26040
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

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

	ll m = 0;

	for (ll i = 1; i < 1000000000000000000; i *= 10)
	{
		ll c = 0;
		for (ll x = n; x; x /= 10)
			c += x % 10;
		if (c > m)
			m = c;
		n -= n % i;
		--n;
	}

	cout << (m) << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
cnt=0
if N <105:
  cnt =0
else:
  if N%2==0:
    for i in range(105,N+1,2):
      temp=0
      for j in range(1,N+1,2):
        if i%j==0:
          temp+=1
      if temp==8:
        cnt+=1
  else:
    for i in range(105,N+1,2):
      temp=0
      for j in range(1,N+3,2):
        if i%j==0:
          temp+=1
      if temp==8:
        cnt+=1

print(cnt)


Measured memory_bytes: 3064
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String answer ="Yes";
    for(int i =0;i<S.length();i++){
      if(i%2==0&&String.valueOf(S.charAt(i)).equals("L")){
        answer = "No";
        break;
      }else if(i%2==1&&String.valueOf(S.charAt(i)).equals("R")){
        answer = "No";
        break;
      }else{
      continue;
      }
    }
    System.out.println(answer);
  }
  
  //最大公約数・最小公倍数（セットで使う）
static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
static int lcm (int a, int b) {return a*b/gcd(a,b);}


//素数判定
static boolean isPrime (int n) {
	if (n==2) return true;
	if (n<2 || n%2==0) return false;
	double d = Math.sqrt(n);
	for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
	return true;
}


//倍数判定（10進数以外のときに有用）
static boolean isMultiple (String s, int base, int m) {
	int temp = 0;
	for (int i=0; i<s.length(); i++) {
		temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
	}
	if (temp==0) {return true;}
	return false;
}


//階乗
static long factorial (int i) {
	if (i==1) {return 1;}
	else {return i*factorial(i-1);}
}


//進数変換
static String toNbase (String sm, int m, int n) {
	return Long.toString(Long.parseLong(sm,m),n);
}
  
}


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

int main() {
    int n;cin>>n;
    ll a, b, u, v,x,y;
    cin>>u>>v;


    while(--n) {
        cin>>a>>b;

        if(u%a == 0) x = u/a;
        else x = 1 + (u/a);

        if(v%b == 0) y = v/b;
        else y = 1 + (v/b);

        u = max(x,y)*a;
        v = max(x,y)*b;
    }

    cout<<u+v;
    return 0;
}



Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
cnt = 0
def minus1(arr) :
  for i in range(len(arr)) :
    if(arr[i] != 0) : arr[i] -= 1
  return 0

def discover0(arr) :
  cnt = 0 #重複
  for i in range(1, len(arr)) :
    if(arr[i-1] == 0 and arr[i] == 0):
      cnt += 1
  if(arr[0] == 0) : cnt += 1
  if(arr[len(arr)-1] == 0) : cnt += 1
  return arr.count(0) - cnt

for i in range(max(h)) :
  cnt += discover0(h)
  minus1(h)
  cnt += 1
print(cnt)

Measured memory_bytes: 3064
import java.io.PrintWriter
import java.util.*
import java.math.*

val pw = PrintWriter(System.out)

fun main(args: Array<String>) {
    val s = read()
    var k = readLong()

    var ans = s[0]

    for(i in 0 until listOf<Long>(k, s.length.toLong()).min()!!.toInt()) {
        if(s[i] != '1') {
            ans = s[i]
            break
        }
    }
    println(ans)
    pw.flush()
}

fun inputList() = 
    readLine()!!.split(" ").map(String::toInt)

fun sum_digits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

/****** Decrared Functions ******/

// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }


fun println(value : Any) {
    pw.println(value)
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)


Measured memory_bytes: 33892
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2,s3;
    int a,b;
    cin>>s1>>s2>>a>>b>>s3;
    if(s1==s3)
        cout<<a-1<<" "<<b<<endl;
    else
        cout<<a<<" "<<b-1<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		String[] input = new Scanner(System.in).nextLine().split("[ .,]");
		
		String output = "";
		int count = 0;
		for(int i=0; i<input.length; i++)
		{
			if(3<=input[i].length() && input[i].length()<=6)
			{
				if(count > 0)
				{
					output += " ";
				}
				output += input[i];
				count ++;
			}
		}
		
		System.out.println(output);
	}
}

Measured memory_bytes: 26128
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	char a,b,c;
	cin>>a>>b>>c;
	if(a==c)cout<<"Yes";
	else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
const ll M = (ll)(1e10);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll s[100100],t[100100];
bool isp[100100];
vector<ll> p;
vector<P> v;
map<P, int> mp;

int main(void){
	int i,j,n,m,c,ans=0;
	ll x,y;
	bool flag = false, f;
	fill(isp,isp+100100,true);
	isp[0] = false;
	isp[1] = false;
	for(i=2; i<3000; ++i){
		if(isp[i]){
			p.push_back(i);
			for(j=i*2; j<=100000; j+=i){
				isp[j] = false;
			}
		}
	}
	for(i=3000; i<=100000; ++i){
		if(isp[i]){
			v.push_back(P((ll)i*i,i));
		}
	}
	v.push_back(P(INFLL,0ll));
	cin >> n;
	m = p.l_ength();
	for(i=0; i<n; ++i){
		cin >> s[i];
		t[i] = 1ll;
		x = s[i];
		f = false;
		for(j=0; j<m; ++j){
			c = 0;
			while(!(x%p[j])){
				x /= p[j];
				++c;
				if(c==3){
					s[i] /= p[j];
					s[i] /= p[j];
					s[i] /= p[j];
					c -= 3;
				}
			}
			if(c==1){
				if(p[j]*p[j] > M/t[i]){
					f = true;
					break;
				}
				t[i] *= p[j];
				t[i] *= p[j];
			}else if(c==2){
				if(p[j] > M/t[i]){
					f = true;
					break;
				}
				t[i] *= p[j];
			}
		}
		if(f){
			++ans;
			continue;
		}
		if(s[i]==1ll){
			flag = true;
			continue;
		}else if(x==1ll){
			++mp[P(s[i],t[i])];
			continue;
		}
		y = (*lower_bound(v.begin(),v.end(),P(x,0ll))).second;
		if(y*y==x){
			if(y<=M/t[i]){
				t[i] *= y;
				++mp[P(s[i],t[i])];
			}else{
				++ans;
			}
		}else if(x<=100000 && x*x<=M/t[i]){
			t[i] *= x*x;
			++mp[P(s[i],t[i])];
		}else{
			++ans;
		}
	}
	if(flag){
		++ans;
	}
	for(i=0; i<n; ++i){
		if(t[i]>1ll){
			ans += max(mp[P(s[i],t[i])],mp[P(t[i],s[i])]);
			mp[P(s[i],t[i])] = 0;
			mp[P(t[i],s[i])] = 0;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 13572
#include<iostream>
#include<string>
#define N 200
using namespace std;
int h,t,stack[N];

int stoi(string s){
  int r=0;
  for(int i=0;i<s.size();i++)r=r*10+s[i]-'0';
  return r;
}

void push(int x){
  stack[t]=x;
  t++;
}

int front(){
  return stack[t-1];
}

void pop(){
  t--;
}

int main(){
  string s;
  int a,b;
  h=0,t=1;
  while(cin>>s){
    if('0'<=s[0]&&s[0]<='9'){
      push(stoi(s));
    }
    else{
      a=front(); pop();
      b=front(); pop();
    }
    if(s=="+")push(b+a);
    if(s=="-")push(b-a);
    if(s=="*")push(b*a);
  }
  cout<<front()<<endl;
  return 0;
}

Measured memory_bytes: 1192
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC094_C solver = new ABC094_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC094_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] l = new long[n];
            long[] sorted = new long[n];
            long med1, med2;
            for (int i = 0; i < n; i++) {
                long tmp = in.nextLong();
                l[i] = tmp;
                sorted[i] = tmp;
            }

            Arrays.sort(sorted);

            med1 = sorted[n / 2 - 1];
            med2 = sorted[n / 2];

            for (int i = 0; i < n; i++) {
                if (l[i] <= med1) {
                    out.println(med2);
                } else {
                    out.println(med1);
                }

            }

        }

    }
}



Measured memory_bytes: 95920
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v(n, k);
    for (int step = 0; step < q; step++) {
        int x;
        cin >> x;
        x--;
        v[x]++;
    }
    for (int i = 0; i < n; i++) {
        if (v[i] <= q)
            cout << "No\n";
        else
            cout << "Yes\n";
    }

    return 0;
}

Measured memory_bytes: 1024
def main():
    N = int(input())
    S = input()

    count = 0
    for i in range(N-1, -1, -1):
        if S[i] == ")":
            count +=1
        else:
            if count:
                count -= 1
            else:
                S += ")"
    S = "("*count + S
    print(S)

if __name__ == "__main__":
    main()

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
//約数列挙配列生成
vector<int> divisor(int n){
    vector<int> ret;
    for(int i = 1; i * i <= n; i++){
        if(n % i == 0){
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    int n; cin >> n;
    int cnt = 0;
    for(int i = 1; i <= n; i+=2) {
        vi p = divisor(i);
        int pp = p.size();
        if(pp==8) cnt++;
    }

    cout << cnt << '\n';
    // printf("ExcutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 256
N = int(input())
count = 0
flag = False
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        count += 1
    else:
        count = 0
    if count == 3:
        flag = True
if flag == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9176
import sys
import numpy as np

#n=int(sys.stdin.readline())
x,y,z=map(int,sys.stdin.readline().split())
#a=np.array(sys.stdin.readline().split(),dtype='int64')
#a=np.array([sys.stdin.readline().split() for i in range(n)],dtype='int64')

print(z,x,y)


Measured memory_bytes: 14468
def main():
    n, k = map(int, input().split())
    x = [int(x) for x in input().split()]
    answer = float("inf")
    if 1 < n:
        for i in range(n - k + 1):
            if x[i + k - 1] < 0:
                answer = min(answer, -x[i])
            elif 0 < x[i]:
                answer = min(answer, x[i + k - 1])
            else:
                answer = min(answer, min(abs(x[i]), abs(x[i + k - 1])) + x[i + k - 1] - x[i])
    else:
        answer = abs(x[0])
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 14252
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int A = intArray[0];
            int B = intArray[1];
            if((A + B) % 2 != 0)
            {
                Console.WriteLine("IMPOSSIBLE");
            }
            else if (A > B)
            {
                int a = (A - B) / 2;
                Console.WriteLine(A - a);
            }
            else
            {
                int b = (B - A) / 2;
                Console.WriteLine(B - b);
            }
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 27988
import java.util.Scanner;

public class Main {

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

		int  num = sc.nextInt();
		String result = "" + num;
		int length = result.length();
		int add = 0;
		int keta;
		int mod = 0;
		for (int i=0; i < length; i++) {
			keta = Integer.parseInt((result.charAt(length - (i + 1))) + "");
			add = add + keta;
		}

		mod = num % add;
		String kekka;
		if (mod == 0) {
			kekka = "Yes";
		} else {
			kekka = "No";
		}
		System.out.println(kekka);

	}
}

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

int main() 
{
	//freopen("1.txt","w",stdout);
	char a[20],b[20],c[20];
	scanf("%s%s%s",a,b,c);
	printf("%c%c%c\n",a[0]-'a'+'A',b[0]-'a'+'A',c[0]-'a'+'A');
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
typedef vector<int> vi;

int main(void){
	int z,w,i,j;
	int n;
	int a,b,c,d;
	int cnt=0;
	char s[5];
	cin >> s;
	a = s[0]-'0';
	b = s[1] - '0';
	c = s[2]-'0';
	d = s[3] -'0';
	if(a+b+c+d == 7){
		printf("%d+%d+%d+%d=7",a,b,c,d);
	}else if(a+b+c-d == 7){
		printf("%d+%d+%d-%d=7",a,b,c,d);
	}else if(a+b-c+d == 7){
		printf("%d+%d-%d+%d=7",a,b,c,d);
	}else if(a-b+c+d == 7){
		printf("%d-%d+%d+%d=7",a,b,c,d);
	}else if(a-b-c+d == 7){
		printf("%d-%d-%d+%d=7",a,b,c,d);
	}else if(a-b-c-d == 7){
		printf("%d-%d-%d-%d=7",a,b,c,d);
	}else if(a-b+c-d == 7){
		printf("%d-%d+%d-%d=7",a,b,c,d);
	}else if(a+b+c-d==7){
		printf("%d+%d+%d-%d=7",a,b,c,d);
	}else if(a+b-c-d==7){
		printf("%d+%d-%d-%d=7",a,b,c,d);		
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int n;
    std::cin >> n;
    std::vector<ll> a(n);
    rep(i,n)std::cin >> a[i];
    sort(all(a));
    int p=0;
    ll s=a[0];
    rrep(i,1,n){
        if(2*s<a[i]){
            p=i;
    //        std::cout << 123 << std::endl;
        }
        s+=a[i];
    }
    std::cout << n-p << std::endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k, n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 100010
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll cnt, ans;

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

	vector<ll> P(N);
	rep(i, N) {
		cin >> P[i];
	}

	ll min = 1e6;
	rep(i, N) {
		if (P[i] < min) {
			cnt++;
			min = P[i];
		}
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007

ll N,C;
ll D[31][31];
ll c[510][510];
vector<ll>base0;
vector<ll>base1;
vector<ll>base2;
ll change0[31] = {0};
ll change1[31] = {0};
ll change2[31] = {0};

int main(){
    cin >> N >> C;
    rep(i,C){
        rep(j,C){
            cin >> D[i+1][j+1];
        }
    }
    rep(i,N){
        rep(j,N){
            cin >> c[i+1][j+1];
            if ( ((i+1)+(j+1))%3 == 0){
                base0.push_back(c[i+1][j+1]);
            }
            if ( ((i+1)+(j+1))%3 == 1){
                base1.push_back(c[i+1][j+1]);
            }
            if (((i+1)+(j+1))%3 == 2){
                base2.push_back(c[i+1][j+1]);
            }
        }
    }
    repi(i,1,C+1){
        rep(j,base0.size()){
            change0[i] += D[base0[j]][i];
        }
        rep(j,base1.size()){
            change1[i] += D[base1[j]][i];
        }
        rep(j,base2.size()){
            change2[i] += D[base2[j]][i];
        }
    }
    ll ans = inf;
    repi(i,1,C+1){
        repi(j,1,C+1){
            if (i == j) continue;
            repi(k,1,C+1){
                if (k == i || k == j) continue;
                ll temp = change0[i]+change1[j]+change2[k];
                ans = min(ans,temp);
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 4388
S = input()
N = len(S)
T = True
if S != S[::-1]:
    T = False
SS = S[0:int((N - 1) / 2)]
if SS != SS[::-1]:
    T = False
SSS = S[int((N + 3) / 2) - 1:]
if SSS != SSS[::-1]:
    T = False
if T:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
from fractions import gcd


def NonDivNum(n):
    if n == 0:
        return 0
    else:
        return n - n//C - n//D + n//CD


A, B, C, D = map(int, input().split())
CD = C * D // gcd(C, D)
print(NonDivNum(B)-NonDivNum(A-1))

Measured memory_bytes: 5688
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine(A.Select(v => v - 1).Sum());
	}
	int N;
	int[] A;
	public Sol(){
		N =  ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13376
#define P(x) cout << #x" = " << x << endl
#define PP(x, y) cout << "("#x", "#y") = (" << x << ", " << y << ")" << endl
#define PPP(x, y, z) cout << "("#x", "#y", "#z") = (" << x << ", " << y << ", " << z << ")" << endl

#include <iostream>
#include <vector>

using namespace std;
bool arr[100][100];
int n;
int main(){
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int h;
        cin >> h;
        for (int j = 0; j < 100; ++j) {
            arr[i][j] = false;
        }
        for (int j = 0; j < h; ++j) {
            arr[i][j] = true;
        }
    }
    int ans = 0;
    for (int h = 0; h < 100; ++h) {
        for (int i = 0; i < n; ++i) {
            if (arr[i][h]) {
                if (i == n - 1 || !arr[i + 1][h]) {
                    ans += 1;
                }
            }
        }
    }
    cout << ans << endl;
}

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

public class Main {

	private static Scanner in;
	
	private static int n;
	private static int m;
	private static HashMap<Integer, ArrayList<Integer>> g;
	private static int[] dp;
	
	public static void main(String[] args) {
		in = new Scanner(System.in);
		n = in.nextInt();
		m = in.nextInt();
		g = new HashMap<>();
		for(int i=0; i<n; i++) {
			g.put(i, new ArrayList<>());
		}
		
		dp = new int[n];
		
		Arrays.fill(dp, -1);
		
		for(int i=0; i<m; i++) {
			int p = in.nextInt()-1;
			int q = in.nextInt()-1;
			g.get(p).add(q);
//			g.get(q).add(p);
		}
		
		
		int ans = 0;
		for(int i=0; i<n; i++) ans = Math.max(ans, solve(i));
		
		System.out.println(ans);
	
	}
	
	private static int solve(int i) {
		
		if (dp[i]!=-1) return dp[i];
		
		int ans = 0;
		
		for(int v: g.get(i)) {
			ans = Math.max(ans, 1+solve(v));
		}
		
		return dp[i]=ans;
	}

}


Measured memory_bytes: 109304
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://beta.atcoder.jp/contests/abc097/tasks/abc097_b

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

    set<ll> expo;
    REP(i, 100) {
        REPS(j, 1, 5) {
            expo.insert(pow(i+1, j+1));
        }
    }

    ll ans = 0;
    for (ll t : expo) {
        if (t > X) {
            cout << ans << "\n";
            return 0;
        }
        ans = t;
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 10

enum Type{
	WIN,
	LOSE,
	UNDEFINED,
};

int N,M;
int win_table[NUM],lose_table[NUM];
Type table[NUM][NUM];
bool inputed[NUM][NUM];

void init(int row,int col){

	if(!inputed[row][col]){

		if(table[row][col] == WIN){

			win_table[row]--;
			lose_table[col]--;

		}else{

			lose_table[row]--;
			win_table[col]--;
		}

		table[row][col] = UNDEFINED;
		table[col][row] = UNDEFINED;
	}
}

int recursive(int row,int col){

	if(row == col){
		return recursive(row,col+1);
	}

	int ret = 0;

	if(col == N-1){

		if(inputed[row][col] == false && win_table[row] != (N-1)/2-1 && lose_table[row] != (N-1)/2-1){
			return 0;
		}

		if(win_table[row] == (N-1)/2-1){

			if(lose_table[col] == (N-1)/2){
				return 0;
			}

			table[row][col] = WIN;
			table[col][row] = LOSE;

			win_table[row]++;
			lose_table[col]++;

		}else if(lose_table[row] == (N-1)/2-1){

			if(win_table[col] == (N-1)/2){
				return 0;
			}

			table[row][col] = LOSE;
			table[col][row] = WIN;

			lose_table[row]++;
			win_table[col]++;
		}

		if(row == N-2){

			init(row,col);
			return 1;

		}else{

			ret = recursive(row+1,0);

			init(row,col);

			return ret;
		}

	}else{

		if(table[row][col] == UNDEFINED){

			if(win_table[row] < (N-1)/2 && lose_table[col] < (N-1)/2){

				table[row][col] = WIN;
				table[col][row] = LOSE;

				win_table[row]++;
				lose_table[col]++;

				ret += recursive(row,col+1);

				table[row][col] = UNDEFINED;
				table[col][row] = UNDEFINED;

				win_table[row]--;
				lose_table[col]--;
			}
			if(lose_table[row] < (N-1)/2 && win_table[col] < (N-1)/2){

				table[row][col] = LOSE;
				table[col][row] = WIN;

				lose_table[row]++;
				win_table[col]++;

				ret += recursive(row,col+1);

				table[row][col] = UNDEFINED;
				table[col][row] = UNDEFINED;

				lose_table[row]--;
				win_table[col]--;
			}

			return ret;

		}else{

			return recursive(row,col+1);
		}
	}
}

void func(){

	for(int row = 0; row < N; row++){
		for(int col = 0; col < N; col++){
			table[row][col] = UNDEFINED;
			inputed[row][col] = false;
		}
	}

	scanf("%d",&M);

	int x,y;

	for(int loop = 0; loop < M; loop++){

		scanf("%d %d",&x,&y);
		x--;
		y--;

		table[x][y] = WIN;
		table[y][x] = LOSE;

		inputed[x][y] = true;
		inputed[y][x] = true;
	}

	int num_win,num_lose;

	for(int row = 0; row < N; row++){

		num_win = 0;
		num_lose = 0;

		for(int col = 0; col < N; col++){
			if(table[row][col] == WIN){

				num_win++;

			}else if(table[row][col] == LOSE){

				num_lose++;
			}
		}

		if(num_win > (N-1)/2 || num_lose > (N-1)/2){
			printf("0\n");
			return;
		}
		win_table[row] = num_win;
		lose_table[row] = num_lose;
	}

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


int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}



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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

  ll A=in<ll>(),B=in<ll>(),C=in<ll>();
  ll n=min(A,B);
  deque<ll> r;
  for(int i=1;i<=n;i++){
    if(!(A%i) && !(B%i)) r.push_front(i);
  }
  cout << r[C-1] << endl;
  return 0;
}


Measured memory_bytes: 256
# C
c = [[int(i) for i in input().split()] for i in range(3)]
a = [0] * 3
b = [0] * 3
ans = True
for i in range(3):
    b[i] = c[0][i]
for i in range(1,3):
    a[i] = c[i][0] - b[0]
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            ans = False
if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064