akhauriyash/Code-Regression huggingface dataset:
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Acrostic
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  for (int i = 0; i < s.size(); i += w) putchar(s[i]);
  putchar('\n');
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int dp[3010][3010][4];
int v[3010][3010]={};

signed main() {
    int N,K; cin>>N>>K;
    vector<int> p(N),c(N);
    rp(i,N) cin>>p[i],p[i]--;
    rp(i,N) cin>>c[i];

    int ans= -1e18;

    //各マスからスタートした場合を考える。
    rp(i,N){
        int v=i;
        int cycle_sum=0;
        int cycle_cnt=0;

        //そのマスからスタートして、サイクルの和とサイクルの要素数を求める。
        while(1){
            cycle_cnt++;
            cycle_sum+=c[p[v]];
            v=p[v];
            if(v==i) break;
        }

        int path=0;
        int cnt=0;

        //そのマスからスタートして、各マスで終わった場合のスコアを求める。
        while(true){
            cnt++;
            path+=c[p[v]];

            if(cnt>K) break;

            //numは追加で訪れる回数。サイクルの和が正ならばその分だけ追加する。
            int num = (K-cnt) / cycle_cnt;
            int score = path + max(0LL,cycle_sum)*num;
            chmax(ans,score);

            v=p[v];
            if(v==i) break;
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3680
from collections import defaultdict
 
N = int(input())
raw_numbers = list(map(int, input().split()))
Q = int(input())
 
total = sum(raw_numbers)
 
numbers = defaultdict(int)
 
for num in raw_numbers:
    numbers[num] += 1

for _ in range(Q):
    a, b = map(int, input().split())
    taken = numbers[a]
    total -= numbers[a]*a
    numbers[b] += numbers[a]
    total += b * taken
    numbers[a] = 0
    print(total)

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

#define se second
#define fi first
#define mk(a,b) make_pair(a,b)

typedef pair<int,int> pii;

int N,M,N_;
pii taka[200020];
pii seg[1600020];

void init()
{
    N_ = 1;
    while(N_ < M + 2)N_ *= 2;
    for(int i = 0; i < N * 2 - 1; i++)seg[i] = mk(0,0);
    return;
}

void update_(int k,int l,int r)
{
    seg[k].fi += seg[k].se;
    seg[k * 2 + 1].se += seg[k].se;
    seg[k * 2 + 2].se += seg[k].se;
    seg[k].se = 0;
    return;
}

int update(int a,int b,int x,int k = 0,int l = 0,int r = N_)
{
    if(seg[k].se != 0)update_(k,l,r);
    if(b <= l || r <= a)return 0;

    if(a <= l && r <= b)
    {
        seg[k].fi += x;
        seg[k * 2 + 1].se += x;
        seg[k * 2 + 2].se += x;
        return seg[k].fi;
    }

    int res1,res2;

    res1 = update(a,b,x,k * 2 + 1,l,(l + r) / 2);
    res2 = update(a,b,x,k * 2 + 2,(l + r) / 2,r);
    return seg[k].fi = max(res1,res2);
}

int getmax(int a,int b,int k = 0,int l = 0,int r = N_)
{
    if(seg[k].se != 0)update_(k,l,r);

    if(b <= l || r <= a)return 0;

    if(a <= l && r <= b)return seg[k].fi;

    int res1,res2;
    res1 = getmax(a,b,k * 2 + 1,l,(l + r) / 2);
    res2 = getmax(a,b,k * 2 + 2,(l + r) / 2,r);

    return max(res1,res2);
}

int main()
{
    scanf("%d%d",&N,&M);
    for(int i = 0; i < N; i++)scanf("%d%d",&taka[i].fi,&taka[i].se);

    int ans = max(0,N - M);

    init();

    sort(taka,taka + N);

    for(int i = 0; i < M + 2; i++)update(i,i + 1,i);

    for(int i = 0; i < N; i++)
    {
        pii now = taka[i];
        update(0,now.se,1);

        ans = max(ans,getmax(0,N_) - (now.fi + M));
    }

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


Measured memory_bytes: 9984
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let m = read::<usize>();
    if n >= m {
        println!("0");
        return;
    }
    let mut xx = (0..m).map(|_| read::<i64>()).collect::<Vec<_>>();
    xx.sort();
    let mut ds = (1..m).map(|i| xx[i] - xx[i - 1]).collect::<Vec<_>>();
    ds.sort();
    let mut ans = 0;
    for i in 0..m - 1 - (n - 1) {
        ans += ds[i]
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include<iostream>

using namespace std;

int main(){

	int N;
	string S;

	cin >> N >> S;

	int count = 0;

	for(int i=0; i<N-2; ++i){
		if(S[i]=='A' && S[i+1] == 'B' && S[i+2] == 'C'){
			++count;
		}
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
L = []
for _ in range(M):
    a,b = map(int,input().split())
    L.append([a,b])
L = sorted(L,key = lambda x:x[1])
cnt = 0
while len(L):
    now = L.pop(0)
    cnt += 1
    while len(L):
        if L[0][0] + 1 <= now[1]  and now[1]  < L[0][1] + 1:
            L.pop(0)
        else:
            break
print(cnt)





Measured memory_bytes: 22104
#include<bits/stdc++.h> 
#define int long long 
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define S ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std; 
signed main()
{
    S;
    int n,k,sum=0;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<k;i++)
    sum+=a[i];
    cout<<sum;
    
}
    

Measured memory_bytes: 3664
N,M=gets.split.map(&:to_i)
as=Array.new
cs=Array.new
INF=10e9
M.times do
  a,b=gets.split.map(&:to_i)
  as << a
  cs << gets.split.map(&:to_i).map{|e|(1<<(e-1))}.inject(:+)
end
dp=Array.new(2**N,INF)
dp[0]=0
for i in 1..M
  dp_next=Array.new(2**N,INF)
  for j in 0...2**N
    a=dp_next[j]
    b=dp[j]
    dp_next[j]= b<a ? b : a
    a=dp_next[j | cs[i-1]]
    b=dp[j]+as[i-1]
    dp_next[j | cs[i-1]]= b<a ? b : a
  end
  dp=dp_next.clone
end
p dp[2**N-1]==INF ? -1 : dp[2**N-1]
    
  

Measured memory_bytes: 23548
import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;

public class Main{
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        int ans = 0;
        long q = 2;
        long div;

        if(N == 1){
            System.out.println(0);
            return;
        }

        for(int e = 1; true; e++){
            div = (long) Math.pow(q, e);
            if(N % div == 0){
                N /= div;
                ans++;
            }else{
                while(N % q == 0){
                    N /= q;
                }
                q++;
                if(q * q > N){
                    break;
                }
                e = 0;
            }
        }
        if(N != 1){
            ans++;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 35596
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return ReadLine().Split().Select(int.Parse).ToList(); }

        static int N;
        static int[] A;
        static int[] B;
        static int[] C;
        static int[,] dp;
        static void Main(string[] args)
        {
            N = Slist()[0];
            A = new int[N];
            B = new int[N];
            C = new int[N];
            dp = new int[N, 3];

            for (var i = 0; i < N; ++i)
            {
                var t = Sarray();
                A[i] = t[0];
                B[i] = t[1];
                C[i] = t[2];
            }
            dp[0,0] = A[0];
            dp[0, 1] = B[0];
            dp[0, 2] = C[0];
            for (var i = 1; i < N; ++i)
            {
                dp[i, 0] = Max(dp[i - 1, 1], dp[i - 1, 2]) + A[i];
                dp[i, 1] = Max(dp[i - 1, 2], dp[i - 1, 0]) + B[i];
                dp[i, 2] = Max(dp[i - 1, 0], dp[i - 1, 1]) + C[i];
            }
            WriteLine(Max(dp[N - 1, 0], Max(dp[N - 1, 1], dp[N - 1, 2])));
        }
    }
}


Measured memory_bytes: 19884
/*ITS FUCKING O(N) now
GET ACCEPTED FOR FUCK'S SAKE*/


#include <iostream>
# include <bits/stdc++.h>
using namespace std;

long long powerexp(long long base, long long exp, int mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}
int gcd(int a, int b)
{
    int c = a % b;
    while(c != 0)
    {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}
void PrintVector(vector<long long int> v,long long int n)
{
 
    for(int i=0;i<n;i++)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
void Takevector(vector<long long int> &v,long long int n)
{
  for(long long int i=0;i <n;i++)
  { long long int number;
    cin>>number;
    v.push_back(number);
  }
}
typedef long long int ll;
typedef vector<long long int> vi;

#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
#define nl cout<<"\n";
int main()
{
  
    sci(n);
    int flag=1;
    int sum=0;
    int flag1=1;
    vi v;
    map<int,int>m;
    string s;
    cin>>s;
    if(s.size()>n)
    {
      rep(i,0,n-1)
      {
        cout<<s[i];
      }
      cout<<"...";
    }
    else
    {
      cout<<s;
    }

  
    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if(a%3 == 0)
    {
        cout << "Possible" << endl;
        return 0;
    }
    if(b%3 == 0)
    {
        cout << "Possible" << endl;
        return 0;
    }
    int sum = a+b;
    if(sum%3 == 0)
    {
        cout << "Possible" << endl;
    }
    if(sum%3 != 0)
    {
        cout << "Impossible" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define dis distance
#define so sort
#define rev reverse
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	if(n%2==0){
		cout << n << endl;
	}else{
		cout << n*2 << endl;
	}
	return 0;
}	

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

int main()
{
    ll n;
    cin>>n;
    ll a[n],b[n],c[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    ll dp[3][n];
    dp[0][0]=a[0];
    dp[1][0]=b[0];
    dp[2][0]=c[0];
    for(ll i=1;i<n;i++)
    {
        dp[0][i]=a[i]+max(dp[1][i-1],dp[2][i-1]);
        dp[1][i]=b[i]+max(dp[0][i-1],dp[2][i-1]);
        dp[2][i]=c[i]+max(dp[0][i-1],dp[1][i-1]);
    }
    ll ans=max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1]));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a) for(i = 0 ; i < a ; i++)
#define whln(t) while(t--)
#define whlp(t) while(t++)
ll i=0,j=0;


int main(void){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif
	 // int t ;
	 // cin>>t;
	 // whln(t){
  	ll n;
  	cin>>n;
  	vector<ll>v(n);
  	ll xr=0; 
  	rep(i,n){
  		cin>>v[i];
  		xr = xr^v[i];
  	}
  	rep(i,n)
  		cout<<(xr^v[i])<<" ";  	
}
//   *****  *******   !
//   *		     *    !
//   ***       *      !
//   *       *        !
//   *****  *******   !

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,a[310],s,x,res,dp[70][2]; 

int main()
{
	cin>>n;
	rep(i,n) cin>>a[i];
	for(int i=2;i<n;i++) x^=a[i];
	s=a[0]+a[1];
	if(s-x<0||(s-x)%2==1)
	{
		puts("-1");
		return 0;
	}
	res=(s-x)/2;
	rep(i,65) rep(j,2) dp[i][j]=-1;
	dp[51][0]=0;
	for(int i=50;i>=0;i--)
	{
		if(dp[i+1][0]!=-1)
		{
			rep(j,2)
			{
				rep(k,2)
				{
					if((a[0]&(1LL<<i))>=j&&(j&k)==(int)((res&(1LL<<i))>0)&&(j^k)==(int)((x&(1LL<<i))>0))
					{
						if(j<(int)((a[0]&(1LL<<i))>0)) dp[i][1]=max(dp[i][1],dp[i+1][0]+(1LL<<i)*j);
						else dp[i][0]=max(dp[i][0],dp[i+1][0]+(1LL<<i)*j);
					}
				}
			}
		}
		if(dp[i+1][1]!=-1)
		{
			rep(j,2)
			{
				rep(k,2)
				{
					if((j&k)==(int)((res&(1LL<<i))>0)&&(j^k)==(int)((x&(1LL<<i))>0))
					{
						dp[i][1]=max(dp[i][1],dp[i+1][1]+(1LL<<i)*j);
					}
				}
			}
		}
	}
	if(dp[0][0]!=-1) cout<<0<<endl;
	else if(dp[0][1]!=-1&&dp[0][1]!=0) cout<<a[0]-dp[0][1]<<endl;
	else puts("-1");
	return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static int[][] T;
        static List<int> ans = new List<int>();

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            T = new int[n][];
            string[] temp;
            int x, y;

            for (int i = 0; i < n; i++)
            {
                temp = Console.ReadLine().Split(' ');
                x = int.Parse(temp[0]); y = int.Parse(temp[1]);

                T[i] = new int[] { i, x, y, -1, -1 };
            }

            int root = MakeKDTree(0, n, 0);

            StringBuilder sb = new StringBuilder();
            int q = int.Parse(Console.ReadLine());
            int sx, tx, sy, ty;

            for (int i = q; i > 0; i--)
            {
                temp = Console.ReadLine().Split(' ');
                sx = int.Parse(temp[0]); tx = int.Parse(temp[1]);
                sy = int.Parse(temp[2]); ty = int.Parse(temp[3]);

                ans.Clear();
                Find(root, sx, tx, sy, ty, 0);
                ans.Sort();

                foreach (var id in ans)
                {
                    sb.AppendLine(id.ToString());
                }
                sb.AppendLine();
            }
            Console.Write(sb);
        }

        static ComparerX compX = new ComparerX();
        static ComparerY compY = new ComparerY();

        static int MakeKDTree(int L, int R, int depth)
        {
            if (L >= R) return -1;

            int mid = (L + R) / 2;

            if (depth % 2 == 0) Array.Sort(T, L, R - L, compX);
            else Array.Sort(T, L, R - L, compY);

            T[mid][3] = MakeKDTree(L, mid, depth + 1);
            T[mid][4] = MakeKDTree(mid + 1, R, depth + 1);

            return mid;
        }

        static void Find(int v, int sx, int tx, int sy, int ty, int depth)
        {
            int id = T[v][0];
            int x = T[v][1], y = T[v][2];
            int l = T[v][3], r = T[v][4];

            if (sx <= x && x <= tx && sy <= y && y <= ty) ans.Add(id);

            if (depth % 2 == 0)
            {
                if (l != -1 && sx <= x) Find(l, sx, tx, sy, ty, depth + 1);
                if (r != -1 && x <= tx) Find(r, sx, tx, sy, ty, depth + 1);
            }
            else
            {
                if (l != -1 && sy <= y) Find(l, sx, tx, sy, ty, depth + 1);
                if (r != -1 && y <= ty) Find(r, sx, tx, sy, ty, depth + 1);
            }
        }
    }

    class ComparerX : IComparer<int[]>
    {
        public int Compare(int[] a, int[] b)
        {
            return a[1] - b[1];
        }
    }

    class ComparerY : IComparer<int[]>
    {
        public int Compare(int[] a, int[] b)
        {
            return a[2] - b[2];
        }
    }
}

Measured memory_bytes: 77184
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    if (n % 2 != 0) exitNo()
    for (i in 0 until n/2) {
        if (s[i] != s[i + n/2]) exitNo()
    }
    exitYes()
}

private fun exitYes() {
    println("Yes")
    System.exit(0)
}

private fun exitNo() {
    println("No")
    System.exit(0)
}

Measured memory_bytes: 31844
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[][] s = new char[N][];
			IntStream.range(0, N).forEach(i -> s[i] = scanner.next().toCharArray());
			boolean result = true;
			for (int i = 1; i < N; i++) {
				// 直前の文字列の最後の文字と現在の文字列の最初の文字と比較
				if (s[i - 1][s[i - 1].length - 1] != s[i][0]) {
					result = false;
					break;
				}
			}
			System.out.println(result ? "YES" : "NO");
		}
	}
}


Measured memory_bytes: 27092
A, B, C, X, Y = map(int, input().split())

if A+B > 2*C:
    m = C*min(X, Y)*2
    if X >= Y:
        rem = X-Y
        tmp = min(A*rem, C*2*rem)
    else:
        rem = Y-X
        tmp = min(B*rem, C*2*rem)
    print(m+tmp)
else:
    AX = A * X
    BY = B * Y
    print(AX+BY)

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

import itertools


def allocate(n, ss):
    ts = [s == "o" for s in ss]
    for x0, x1 in itertools.product((True, False), repeat=2):
        xs = [None for _ in range(n + 1)]
        xs[0] = xs[-1] = x0
        xs[1] = x1
        for i in range(n - 2):
            diff = xs[i + 1] ^ ts[i + 1]
            xs[i + 2] = xs[i] ^ diff
        for i in range(n):
            left = xs[(i - 1) % n]
            right = xs[(i + 1) % n]
            diff = xs[i] ^ ts[i]
            if diff != (left != right):
                break
        else:
            return xs[:n]
    return None


def main():
    n = int(input())
    ss = input()
    res = allocate(n, ss)
    if res is None:
        print(-1)
    else:
        print("".join("S" if x else "W" for x in res))


if __name__ == '__main__':
    main()


Measured memory_bytes: 5632
void main()
{
    long n, m;
    rdVals(n, m);

    long[] num = new long[n];
    num[] = -1;
    foreach (i; 0 .. m)
    {
        long s, c;
        rdVals(s, c);
        --s;
        if (num[s] == -1 || num[s] == c) num[s] = c;
        else
        {
            writeln(-1);
            return;
        }
    }

    if (n >= 2 && num[0] == 0)
    {
        writeln(-1);
        return;
    }

    if (num[0] == -1)
    {
        if (n == 1) num[0] = 0;
        else num[0] = 1;
    }

    foreach (x; num)
    {
        if (x == - 1) 0.write;
        else x.write;
    }
    writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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


void solve() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;

  bool is_ok = true;
  vector<int> a(n);
  for (auto a_i: a) {
      cin >> a_i;
      if (a_i % 2 == 0) {
          // 3でも5でも割り切れないならfalse
          if (a_i % 3 != 0 && a_i % 5 != 0){
              is_ok = false;
          }
      }
  }
  if (is_ok) {
      cout << "APPROVED" << endl;
  } else {
      cout << "DENIED" << endl;

  }

}

int main() {
  solve();
}


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

#define ll long long

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

	int digit = n%10;

	if(digit==2||digit==4||digit==5||digit==7||digit==9){
		cout<<"hon";
	}
	else if(digit==0||digit==1||digit==6||digit==8){
		cout<<"pon";
	}
	else{
		cout<<"bon";
	}
	
	return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>

void trace(int A[],int N){
	int i;
	for(i=0; i<N; i++){
		if(i>0) printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
}

void insertionSort(int A[],int N){
	int i,j,v;
	for(i=1; i<N; i++){
		v = A[i];
		j = i-1;
		while(j>=0 && A[j]>v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
        trace(A,N);
    }
}
	
int main(){
	int N,i,j;
	int A[100];
	
	scanf("%d",&N);
	for(i=0; i<N; i++) scanf("%d",&A[i]);
	
	trace(A,N);
	insertionSort(A,N);
	
	return 0; 
} 

Measured memory_bytes: 2668
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};

int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,d;
    cin>>n>>d;
    int len=d*2 + 1;
    int cnt=n/len;
    if(n%len)
        cnt++;
    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){

long double A, B, H, M, hk, mk, k, ans;
cin >> A >> B >> H >> M;
//なんにも考えずに全部doubleで定義して入力
//hkは分針の角度,mkは時針の角度,kはその差で,ansが答え出力用

mk = M * 6;
hk = H * 60;
hk = hk + M;
hk = hk / 2;
k = fabs(hk - mk);
//ここまでで時計の針の角度を算出
//fabs関数で絶対値を算出できるらしい？


//角度が180度以上の場合の処理

k = k*(M_PI/180);
//角度をラジアンに変換
ans = 2 * A * B * cos(k);
ans = ans * -1;
A = A * A;
B = B * B;
ans = A + B + ans;
//ここまで余弦定理(c^2=a^2+b^2-2ab cos(a))
ans = sqrt(ans);
//平方根が答え

 printf("%.10Lf\n", ans);

}

Measured memory_bytes: 4164
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int cnt[3];
  fill(cnt,cnt+3,0);
  REP(i,n){
    int p;
    cin >> p;
    if(p<=a){
      cnt[0]++;
    }else if(p<=b){
      cnt[1]++;
    }else{
      cnt[2]++;
    }
  }
  cout << min(cnt[0],min(cnt[1],cnt[2])) << endl;
  return 0;
}


Measured memory_bytes: 256
n,a,b,c=map(int,input().split())
ans=[]
ks = [input() for _ in range(n)]
for i in range(n):
  k = ks[0]
  if k=="AB":
    if a==0 and b==0:
      print("No")
      quit()
    else:
      if a>b:
        a -= 1
        b+=1
        ans.append("B")
      else:
        if a == 1 and b == 1 and len(ks) > 1:
          if ks[1] == "AC":
            b-=1
            a+=1
            ans.append("A")
          else:
            a -= 1
            b+=1
            ans.append("B")
        else: 
          b-=1
          a+=1
          ans.append("A")
  if k=="BC":
    if c==0 and b==0:
      print("No")
      quit()
    else:
      if c>b:
        c -= 1
        b+=1
        ans.append("B")
      else:
        if c == 1 and b == 1 and len(ks) > 1:
          if ks[1] == "AC":
            b-=1
            c+=1
            ans.append("C")
          else:
            c -= 1
            b+=1
            ans.append("B")
        else: 
          b-=1
          c+=1
          ans.append("C")
  if k=="AC":
    if a==0 and c==0:
      print("No")
      quit()
    else:
      if a>c:
        a -= 1
        c+=1
        ans.append("C")
      else:
        if a == 1 and c == 1 and len(ks) > 1:
          if ks[1] == "BC":
            a-=1
            c+=1
            ans.append("C")
          else:
            c -= 1
            a+=1
            ans.append("A")
        else: 
          c-=1
          a+=1
          ans.append("A")
  del(ks[0])
print("Yes")
for i in ans:
  print(i)

Measured memory_bytes: 16308
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x; cin>>x;
    int a[2*x],s=0; 
    for(int i=0;i<2*x;i++) cin>>a[i];
    sort(a,a+ 2*x);
    for(int i=0;i<2*x;i++){
        s=s+min(a[i],a[i+1]); i++;
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
char f[6][6],i,j,a,y,x,p;int main(){for(;i<9;++i){scanf("%s",f[5]);for(j=0;j<4+i%2;++j){a=f[5][j]-48;f[i/2][j]|=a<<(1+i%2);f[i/2+i%2][j+!(i%2)]|=a<<3-i%2*3;}}do{while(!((f[y][x]>>(p=(p+1)%4))&1));putchar("URDL"[p]);x+=p?2-p:0;y+=p==3?0:p-1;p=(p+2)%4;}while(y||x||f[0][0]==6&&p==3);return!puts("");}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;
int a[10000];
int main()
{
	int n;
	scanf("%d",&n);
	for (int i =1;i<=n;i++)scanf("%d",&a[i]);
		int sol = 0;
	for (int i =2;i<n;i++){
		if (a[i] > a[i-1] && a[i] < a[i+1] || a[i] > a[i+1] && a[i] < a[i-1])sol++;
	}
	cout<<sol<<endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
    void solve() {
        Scanner in = new Scanner(System.in);
        String string = in.nextLine();
        System.out.println(string.substring(0,string.length() - 8));
    }
 
    public static void main(String[] args) {
        new Main().solve();
    }
}

Measured memory_bytes: 25684
#include<bits/stdc++.h>
using namespace std;
namespace QiFeng233{
	const int maxn=2e5+10;
	int n,ans[maxn];
	void solve(){
		scanf("%d",&n);
		for(int i=2;i<=n;++i){
			int boss;
			scanf("%d",&boss);
			++ans[boss];
		}
		for(int i=1;i<=n;++i)printf("%d\n",ans[i]);
	}
}
signed main(){
	QiFeng233::solve();
	return 0;
}

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> Xs;
  int X;
  for (int i = 0; i < M; ++i) {
    cin >> X;
    Xs.push_back(X);
  }

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

  vector<int> diffs;
  for (int i = 0; i < M - 1; ++i) {
    int diff = Xs[i + 1] - Xs[i];
    diffs.push_back(diff);
  }

  sort(diffs.begin(), diffs.end());
  int ans = 0;
  for (int i = 0; i < (int)diffs.size() - N + 1; ++i) {
    ans += diffs.at(i);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1400
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int in[MAXN],ans[MAXN];
vector<PII>adj[MAXN];
int main(){
    //~ freopen("file.in", "r", stdin);
    int n,m;
    scanf("%d%d",&n,&m);
    memset(ans,-1,sizeof ans);
    while(m--){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		//~ printf("%d -> %d %d\n",v,u,w);
		adj[u].pb(mp(v,w));
		in[v]++;
	}
	queue<int>q;
	int cnt=0;
	for(int i=1;i<=n;i++)
		if(!in[i]){
			ans[i]=0;
			cnt++;
			q.push(i);
		}
	while(!q.empty()){
		int nd=q.front();
		q.pop();
		tr(it,adj[nd]){
			int to=it->ff;
			int cost=it->ss;
			if(~ans[to]){
				if(ans[to]!=ans[nd]+cost){
					puts("No");
					return 0;
				}
			}
			else
				ans[to]=ans[nd]+cost;
			if(!(--in[to]))	
				q.push(to),cnt++;
		}
	}	
	if(cnt!=n){
		puts("No");
		return 0;
	}	
	puts("Yes");
	//~ for(int i=1;i<=n;i++)
		//~ printf("%d ",ans[i]);
	return 0;
}


Measured memory_bytes: 6784
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

ans = Array.new(n, 0)
(n-1).times do |i|
  ans[a[i]-1] += 1
end

ans.each do |e|
  puts e
end

Measured memory_bytes: 35848
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long
#define cat(p) cout<<p<<endl
#define catA(p,n) for(int i=0;i<n;i++)cout<<p[i]<<((i==n-1)?"\n":" ")

int n;
vector<pair<pair<string,int>,int> >ta;


int main(){ 
  cin>>n;

  rep(i,n){
    string s;
    int p;
    cin>>s>>p;
    ta.pb(mp(mp(s,-p),i));

  }
  sort(ta.begin(),ta.end());
  rep(i,n)cout<<ta[i].second+1<<endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
v = list(map(int, input().split()))

m = k // 2 + (k % 2)

a = [0] * (n+1)
d = [0] * (n+1)

a[0] = 0
d[0] = 0
for i in range(n):
    a[i+1] = a[i] + v[i]
    d[i+1] = d[i] + v[n-1-i]

w = []
for i in range(n):
    w.append([v[i], i])

w.sort()

ans = 0

p = min(n, k)
for L in range(p + 1):
    for R in range(p + 1 - L):
        #print(L, R)
        temp = a[L] + d[R]
        b = min(L + R, k - L - R)
        c = 0
        while b > 0:
            if w[c][0] >= 0:
                break
            if w[c][1] < L or w[c][1] > n - 1 - R:
                #print(w[c][1], L, R)
                temp -= w[c][0]
                b -= 1
            c += 1
        #print(L, R, temp, b)
        ans = max(ans, temp)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> cnt(n+1, 0);
  for(int i = 1; i <= n; ++i) {
    int d;
    cin >> d;
    for(int j = 1; j <= d; ++j) {
      int eat;
      cin >> eat;
      cnt[eat]++;
    }
  }
  int c = 0;
  for(int i = 1; i <= n; ++i) {
    if(!cnt[i]) {
      c++;
    }
  }
  
  cout << c << "\n";
}

Measured memory_bytes: 3552
n = int(input())
S = [100]*26
count = [0]*26
alpha = [chr(i) for i in range(97, 97+26)]

for i in range(n):
    a = input()
    for j in range(26):
        count[j] = a.count(alpha[j])
    S = [min(a,b) for a,b in zip(S,count)]

ans = ""

for i in range(26):
    ans = ans + alpha[i]*S[i]
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}


int main(){
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
		#if __cplusplus >= 201103L
		auto start = steady_clock::now();
		#endif
	#endif
	ll n;sf(n);
	cout << 1LL * (n - 2) * 180 << endl;

	#ifdef LOCAL
		#if __cplusplus >= 201103L
		auto end = steady_clock::now();
		duration<double> time_span = duration_cast<duration<double>>(end - start);;
		printf("Total time: %.6fs\n", time_span.count());
		#endif
	#endif
	return 0;
}

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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

// UnionFind
struct UnionFind {
    vector< int > data;
    
    UnionFind(int sz) {
        data.assign(sz, -1);
    }
 
    bool unite(int x, int y) {//要素xとyの各々の木を併合（もともと同じ木ならfalse）
        x = find(x), y = find(y);
        if(x == y) return (false);
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return (true);
    }
    
    int find(int k) {//要素kが属する木の根を得る
        if(data[k] < 0) return (k);
        return (data[k] = find(data[k]));
    }
    
    int size(int k) {//要素kが属する木の要素数
        return (-data[find(k)]);
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = find(x);
        int ry = find(y);
        return rx == ry;
    }

};

int main(){
    ll N,K,L;
    cin>>N>>K>>L;
    UnionFind G1(N),G2(N);
    REP(i,K){
        ll p,q;
        cin>>p>>q;
        p--;
        q--;
        G1.unite(p,q);

    }

    REP(i,L){
        ll p,q;
        cin>>p>>q;
        p--;
        q--;
        G2.unite(p,q);
    }


    map<pair<ll,ll>,ll> mp;
    REP(i,N){
        mp[make_pair(G1.find(i),G2.find(i))]++;
    }

    REP(i,N){
        cout<<mp[make_pair(G1.find(i),G2.find(i))]<<" ";
    }
    cout<<endl;


}

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

m = [0]*n
for i in range(n):
    while a[i] % 2 == 0:
        a[i] = a[i] / 2
        m[i] = m[i] + 1

ans = 0
for i in range(n):
    ans = ans + m[i]

print(ans)

Measured memory_bytes: 4148
#include <iostream>
#include <string>
using namespace std;
string s,t;
int main(){
	int i,n,h,w,x,y;
	cin >> h >> w >> n;
	cin >> y >> x >> s >> t;
	int u1 = 0,d1 = 0,u2 = 0,d2 = 0;
	y--; x--;
	for(i=0;i<n;i++){
		if(s[i]=='U') u1++;
		if(s[i]=='D') d1++;
		if(y - u1 + d2<0){
			cout << "NO" << endl;
			return 0;
		}
		if(y + d1 - u2>=h){
			cout << "NO" << endl;
			return 0;
		}
		if(t[i]=='U'){
			if(d1) d1--;
			else if(y - u2>0){
				u2++;
			}
		}
		if(t[i]=='D'){
			if(u1) u1--;
			else if(y + d2<h - 1){
				d2++;
			}
		}
	}
	int l1 = 0,r1 = 0,l2 = 0,r2 = 0;
	for(i=0;i<n;i++){
		if(s[i]=='L') l1++;
		if(s[i]=='R') r1++;
		if(x - l1 + r2<0){
			cout << "NO" << endl;
			return 0;
		}
		if(x + r1 - l2>=w){
			cout << "NO" << endl;
			return 0;
		}
		if(t[i]=='L'){
			if(r1) r1--;
			else if(x - l2>0){
				l2++;
			}
		}
		if(t[i]=='R'){
			if(l1) l1--;
			else if(x + r2<w - 1){
				r2++;
			}
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 776
from collections import Counter
n = int(input())
n_list = list(map(int,input().split()))
counter_n_list = Counter(n_list)
#print(counter_n_list)
n_list_mostcommon = counter_n_list.most_common()
if n_list_mostcommon[0][1] != 1:
    print("NO")
else:
    print("YES")
#print(counter_n_list)

Measured memory_bytes: 40136
#include<bits/stdc++.h>
using namespace std;
 
int A[100105];
int main(){
	long long n,a,cnt=0;
	set<long long> se;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a;
		se.insert(a);
	}
	if(se.size()%2) cout << se.size() << endl;
	else cout << se.size()-1 << endl;
	return 0;
}

Measured memory_bytes: 4992
/*
g++ -std=c++11 -o2 -Wall ABC107A.cpp -o ./out/ABC107A.out
./out/ABC107A.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << a - b + 1 << "\n";
}

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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;


/*FUNCs=================================================*/



/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    string s; cin >> s;
    bool can1 = true, can2 = true;
    rep(i,s.size()) {
        if(i%2== 0 ){
            if(s[i] == 'L'){
                can1 = false;
            }
        }
        else {
            if(s[i] == 'R') can2 = false;
        }
    }
    cout << ((can1 && can2) ? "Yes" : "No") << endl; 
    
}


Measured memory_bytes: 256
// practice with Dukkha, coached by rainboy
#include <algorithm>
#include <iostream>

using namespace std;

const int N_ = 54;

int d2c[] = { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };

int dd[8];
int dp[N_ + 1];
int kk[10];

int main() {
	int n, m; cin >> n >> m;
	while (m--) {
		int d; cin >> d;
		int c = d2c[d];
		dd[c] = max(dd[c], d);
	}
	int c_ = 2;
	while (dd[c_] == 0)
		c_++;
	int n_ = 0;
	for (int c = c_ + 1; c <= 7; c++)
		n_ += c * (c_ - 1);
	fill(dp, dp + n_ + 1, -1);
	dp[0] = 0;
	for (int i = 0; i < n_; i++) {
		int k = dp[i];
		if (k == -1)
			continue;
		for (int c = c_; c <= 7 && i + c <= n_; c++)
			if (dd[c])
				dp[i + c] = max(dp[i + c], k + 1);
	}
	int k = (n - n_ + c_ - 1) / c_;
	kk[dd[c_]] += k;
	n -= c_ * k;
	while (n) {
		c_ = 0;
		for (int c = 2; c <= 7 && n - c >= 0; c++)
			if (dd[c_] < dd[c] && dp[n] == dp[n - c] + 1)
				c_ = c;
		kk[dd[c_]]++;
		n -= c_;
	}
	for (int d = 9; d; d--)
		while (kk[d]--)
			cout << d;
	cout << '\n';
	return 0;
}


Measured memory_bytes: 3612
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) {
			System.out.println(0);
			return;
		}

		int ans = b / a;
		System.out.println((ans > c) ? c : ans);
	}
}

Measured memory_bytes: 23892
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String s = sc.next();

        int rNum = 0;
        for (int i = 0; i < N; i++) {
            if(s.charAt(i) == 'R'){
                rNum++;
            }
        }

        if(rNum > N - rNum){
            out.println("Yes");
        } else {
            out.println("No");
        }
    }
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<ll,ll>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}
ll C[100005]={};
int n,m;
vector<int> v[100005];
int main() {
	string s;
	string k="keyence";
	cin>>s;
	int a=0,b=0;
	for(int i=0;i<7;++i){
		if(s[i]==k[i])++a;
		else break;
	}
	for(int i=1;i<=7;++i){
		if(s[s.size()-i]==k[7-i])++b;
		else break;
	}
	if(a+b>=7)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


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

namespace ConsoleTest
{
    class Program
    {
        static long Combination(int n)
        {
            if (n <= 1) return 0;
            return ((long)n * ((long)n - 1)) / 2;
        }
        static Tuple<int,int[]> ReadValues()
        {
            int num = int.Parse(Console.ReadLine());
            int[]p = Console.ReadLine().Split(' ').Select(s => int.Parse(s)-1).ToArray();
            return Tuple.Create(num, p);
        }
        static Tuple<int, int[]> CreateValues()
        {
            int maxNum = 1000;

            int[] p = new int[maxNum];
            for(int i = 0; i < maxNum; ++i)
            {
                p[i] = i;
            }
            return Tuple.Create(maxNum, p);
        }

        static void Main(string[] args)
        {
            var r = ReadValues();
            //var r = CreateValues();
            int num = r.Item1;
            int[] p = r.Item2;
            int[] count = new int[num];

            for(int i=0; i < num; ++i)
            {
                count[p[i]]++;
            }
            long[] diff = new long[num];
            long all = 0;
            for (int j = 0; j < num; ++j)
            {
                all += Combination(count[j]);
                diff[j] = Combination(count[j]) - Combination(count[j] - 1);
            }
            //var sb = new StringBuilder();
            for(int i =0;i<num;++i)
            {
                long result = all - diff[p[i]];
                //sb.AppendLine(result.ToString());
                Console.WriteLine(result);
                //if(i%1000 == 0)
                //{
                //    Console.WriteLine(string.Format("tochuu : {0}", i));
                //}
            }
            //Console.WriteLine(sb.ToString());

        }
    }
}


Measured memory_bytes: 36800
#include<stdio.h>
int main()
{
    int x;
    scanf("%d",&x);
    if(1<=x&&x<=100)
    {
        int pay=800*x;
        int percentage=x/15;
        int back=200*percentage;
        int khoroch= pay-back;
        printf("%d",khoroch);
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
int main() {
    ll a , b , c ,d ;
    cin >> a >> b >> c>> d ;
    ll ans = 0 ;
    ll x = min ( a, d ) ;
    ans+=x ;
    d-=x ;
    x = min(b,d) ;
    d-=x ;
    x = min(c,d) ;
    ans-=x ;


    cout << ans ;
 }


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

using namespace std;

#define ll long long
#define ld long double

signed main() {
	int n; cin >> n;
	vector<pair<int, int>> a;
	for (int i = 1; i <= n; ++i) {
		int ai; cin >> ai;
		a.emplace_back(ai, i);
	}
	sort(a.begin(), a.end());
	for (auto ai : a) {
		cout << ai.second << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1780
import sys
input = sys.stdin.readline
#input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')
#import numpy as np

from collections import deque

def main():
	h,w=MI()
	G=["#"]*(w+2)
	for i in range(h):
		G+=["#"]+list(input().rstrip())+["#"]
	G+=["#"]*(w+2)
	ans=0
	#print(G)
	for i in range((h+2)*(w+2)):
		if G[i]==".":
			ans+=1

	Q=deque()
	Q.append((w+3,1))
	G[w+3]="#"
	f=0
	while Q:
		#print(Q)
		x,d=Q.popleft()
		if x==(w+2)*(h+2)-(w+2)-2:
			f=1
			break
		for dx in [-1,1,-w-2,w+2]:
			if G[x+dx]==".":
				Q.append((x+dx,d+1))
				G[x+dx]="#"

	if f==1:
		print(ans-d)
	else:
		print(-1)


























































if __name__ == "__main__":
	main()

Measured memory_bytes: 3316
def getN():
    return int(input())

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

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

n, m = getMN()

sws = []
for i in range(m):
    sw = getlist()
    sws.append(sw[1:])
ans = 0
mods = getlist()
# パターンごと
for i in range(2**n):
    flags = bin(i)[2:]
    flags = "0"*(n-len(flags)) + flags

    # 電球ごと
    right = 0
    for idx, sw in enumerate(sws):
        tmp = 0
        # スイッチごと
        for s in sw:
            if flags[s-1] == "1":
                tmp +=1

        if tmp % 2 == mods[idx]:
            right += 1

        if right == m:
            ans += 1
print(ans)

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp2
{
    using static System.Console;
    using static System.Math;

    class Program
    {
        static void Main(string[] args)
        {
            S = ReadLine();
            Solve();
        }

        static string S;

        static void Solve()
        {
            var longest = 0;
            var current = 0;
            foreach (var c in S)
            {
                var before = current;
                if ("ACGT".Contains(c))
                    current++;
                else
                {
                    if (longest < current)
                        longest = current;
                    current = 0;
                }
            }
            if (longest < current)
                longest = current;
            WriteLine(longest);
        }
    }
}


Measured memory_bytes: 13268