akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define N 44

void fibonacci(int);

int F[N];

int main(){
  int n;
  scanf("%d",&n);
   fibonacci(n);
    printf("%d\n",F[n]);
  return 0;
}


void fibonacci(int n){
  int i;
  F[0]=1;
  F[1]=1;
  for(i=2;i<=n;i++){
    F[i]= F[i-2]+F[i-1];
  }
}

Measured memory_bytes: 596
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = LI()
    r = [a[0]]
    for c in a[1:]:
        r.append(r[-1] + c)
    d = collections.defaultdict(int)
    d[0] = 1
    t = 0
    for c in r:
        t += d[c]
        d[c] += 1

    return t



print(main())



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

class Side {
public:
	int r, l;
	int w;
	Side(int right, int left, int weight) {
		r = right;
		l = left;
		w = weight;
	};
	bool operator>=(Side s) {
		return w >= s.w;
	}
	bool operator<(Side s) {
		return w < s.w;
	}
};

class Node {
public:
	int p; /// parent
	int d; /// depth
	Node() {
		p = -1;
		d = 1;
	}
};

int Find(std::vector<Node> n, int i) {
	int a = i;
	while (1) {
		if (n[a].p == -1) return a;
		a = n[a].p;
	}
}

bool Union(std::vector<Node> &n, int i, int j) {
	int a = Find(n, i);
	int b = Find(n, j);
	if (a == b) return false;
	if (n[a].d <= n[b].d) {
		n[b].p = a;
		n[a].d = n[b].d + 1;
	}
	else {
		n[a].p = b;
		n[b].d = n[a].d + 1;
	}
	return true;
}

int main() {
	int n;
	std::cin >> n;
	std::vector<Side> side;
	std::vector<Node> node(n);

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int a;
			std::cin >> a;
			if (a != -1) {
				side.push_back(Side(i, j, a));
			}
		}
	}

	std::sort(side.begin(), side.end());
	int m = side.size();
	int cnt = 0;
	int weight = 0;


	for (int i = 0; i < m; i++) {
		if (Union(node, side[i].r, side[i].l)) {
			cnt++;
			weight += side[i].w;
		}
		if (cnt == n - 1) break;
	}

	std::cout << weight << std::endl;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

int main() {
    string S;
    cin >> S;
    
    int n = S.size();

    int sn = 0;
    char val = 'a';
    while (sn <= n) {
        sn++;

        int x = sn - 1;
        int y = n - sn;
        if (x > n || y < 0) break;

        // cout << "sn: " << sn << ", x: " << x << ", y: " << y << endl;
        if (x < y) continue;
        if (S.at(x) != S.at(y)) break;
        if (val == 'a') val = S.at(x);
        if (val != S.at(x)) break;
    }

    cout << (sn - 1) << endl;
}

Measured memory_bytes: 3744
n, total = [int(i) for i in input().split()]

for a in range(n+1):
  for b in range(n+1-a):
    c = n-a-b
    if c >= 0:
      if 10000*a + 5000*b + 1000*c == total:
        print('{} {} {}'.format(a, b, c))
        exit()
print('-1 -1 -1')

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
int *dist, *prev, *visit, **matrix;
void Dijkstra(int, int);
main()
{
        int i, j, n, u, k, v, c;
        scanf("%d", &n);
        dist = (int*)malloc(sizeof(int) * n);
        prev = (int*)malloc(sizeof(int) * n);
        visit = (int*)malloc(sizeof(int) * n);
        matrix = (int**)malloc(sizeof(int*) * n);
        for (i = 0; i < n; i++) {
                matrix[i] = (int*)malloc(sizeof(int) * n);
                for (j = 0; j < n; j++) {
                        matrix[i][j] = -1;
                }
        }
        for (i = 0; i < n; i++) {
                scanf("%d%d", &u, &k);
                for (j = 0; j < k; j++) {
                        scanf("%d%d", &v, &c);
                        matrix[u][v] = c;
                }
                dist[i] = INT_MAX;
                prev[i] = -1;
                visit[i] = 0;
        }
        Dijkstra(0, n);
        for (i = 0; i < n; i++) {
                printf("%d %d\n", i, dist[i]);
                free(matrix[i]);
        }
        free(matrix);
        free(dist);
        free(prev);
        free(visit);

}
void Dijkstra(int p, int size)
{
        dist[p] = 0;
        while (1) {
                int i, u = -1, min = INT_MAX;
                for (i = 0; i < size; i++) {
                        if (!visit[i] && dist[i] < min) {
                                u = i;
                                min = dist[i];
                        }
                }
                if (u == -1) break;
                visit[u] = 1;
                for (i = 0; i < size; i++) {
                        if (matrix[u][i] >= 0) {
                                int w = matrix[u][i], newlen = dist[u] + w;
                                if (newlen < dist[i]) {
                                        dist[i] = newlen;
                                        prev[i] = u;
                                }
                        }
                }
        }
}


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

int main() {
	double N,M;
	cin >> N >> M;

	vector<double> A(N);

	double sum = 0;

	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		sum += A.at(i);
	}

	sort(A.begin(), A.end(), std::greater<int>());

	if (A.at(M - 1) < (sum * 1 / (4 * M))) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define umap unordered_map
//std::cout << std::setfill('0') << std::right << std::setw(4) << 12; // "0012"

ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}



int main(){
  ll N,M; cin >> N>>M;
  pair<ll,ll> store[N];
  REP(i,N){
    cin >> store[i].first >> store[i].second;
  }
  sort(store,store+N);
  ll drink = 0;
  ll pay = 0;
  REP(i,N){
    ll a = store[i].first;
    ll b = store[i].second;
    ll need = M-drink;
    if(b<need){
      drink += b;
      pay += a*b;
    }else{
      pay += a*need; break;
    }
  }
  cout << pay<<"\n";
}


Measured memory_bytes: 1792
#include<stdio.h>
#define NMAX 100100
int main(void){int n,m,a,b;int list[5*NMAX]={0};int last=NMAX;int node[5*NMAX]={0};int queue[5*NMAX]={0},qfirst=0,qlen=0;int room[NMAX]={0};int i;int now,tmp;scanf("%d%d",&n,&m);for(i=0;i<m;i++){scanf("%d%d",&a,&b);list[last]=list[a]; 		list[a]=last; 		node[last]=b; 		last++; 		list[last]=list[b]; 		list[b]=last; 		node[last]=a; 		last++; 	} 	queue[0]=1;qlen=1; 	room[1]=room[0]=-1; 	while(qlen){ 		now=queue[qfirst]; 		qlen--; 		qfirst++; 		tmp=now; 		 		while(tmp){ 			tmp=list[tmp]; 			if(room[node[tmp]]==0){ 				room[node[tmp]]=now; 				queue[(qfirst+qlen)%(5*NMAX)]=node[tmp]; 				qlen++; 			} 		} 	} 	puts("Yes"); 	for(i=2;i<=n;i++){ 		printf("%d\n",room[i]); 	} 	return 0; } 


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

int N, D;
vector<int> a;

int grundy(int n){
  return (n-1)%(D+1);
  set<int> V;
  if(n == 1) return 0;
  int s = 0;
  for(int i = 1; i <=D; i++){
    if(n - i >= 1){
      V.insert(grundy(n-i));
    }
  }
  int g = 0;
  while(V.count(g))g ++;
  return g;
}

int main(void){
  cin >> N >> D;
  a = vector<int>(N);
  for(auto& _a: a){
    cin >> _a;
  }

  int g = 0;
  for(const auto& _a: a){
    g = g ^ grundy(_a);
  }

  if(g == 0){
    cout << "Second" << endl;
  }else{
    cout << "First" << endl;
  }
}



Measured memory_bytes: 3744
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

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

	int* x = new int[n];
	int* y = new int[n];

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

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

	double* d = new double[3];
	double max = 0;
	for (int i = 0; i < n; i++)
	{
		double z = abs(x[i] - y[i]);
		if (z > max)
		{
			max = z;
		}

		for (int j = 0; j < 3; j++)
		{
			d[j] += pow(z, j + 1);
		}
	}

	cout << fixed << setprecision(8);

	for (int i = 0; i < 3; i++)
	{
		cout << pow(d[i], 1.0/(i + 1)) << endl;
	}
	cout << max << endl;
}


Measured memory_bytes: 3404
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M;
  cin>>N>>M;
  vector<pair<int,int>> YX(M);
  for(int i=0;i<M;i++){
    int x,y;
    cin>>x>>y;
    YX[i]={y,x};
  }
  sort(ALL(YX));
  int last=-1,ans=0;
  for(int i=0;i<M;i++){
    int x,y;
    x=YX[i].second;
    y=YX[i].first;
    if(x>last){
      ans++;
      last=y-1;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
  long n, m;
  cin >> n >> m;

  if (n == 1 && m == 1) {
    cout << 1 << endl;
  } else if (n == 1) {  
    cout << m - 2 << endl;
  } else if (m == 1) {
    cout << n - 2 << endl;
  } else {
    cout << (n - 2) * (m - 2) << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class  Main {
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		
		while(true){
			
		    //縦Hと横Wの値を受け取る
		    String s1 = sc.next();
	            int H = Integer.parseInt(s1);
	            String s2 = sc.next();
	            int W = Integer.parseInt(s2);
	        
	            //値が条件（３００以下であるか）にあっているか確認
	            if(H <= 300 && W <= 300){
	        
	                //０と０が入力された時プログラムは終了する
	                if(H == 0 && W == 0){
	        	        break;
	                }
	        
	                //縦H個、横W個とした長方形のフレームを”＃”、中身を”.”で表示する
	                for(int i = 1; i <= H; i++){
	            	    if(i == 1 || i == H){
	        	        for(int j = 1; j <= W; j++){
	        		    System.out.print("#");
	        	        }
	            	    }
	            	    else{
	            		for(int j = 1; j <= W; j++){
	            		    if(j == 1 || j == W){
	            			System.out.print("#");
	            		    }
	            		    else{
	            			System.out.print(".");
	            		    }
	        	        }
	            	    }
	            	    System.out.println("");
	                }
	                System.out.println("");
	            }
	       }
	}
}

Measured memory_bytes: 25728
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
bool isperfectsquare(ll a)
{
    ll b = sqrt(a);
    long double c = sqrt(a);
    if(b==c) return true;
    else return false;
}
int main()
{
    she_told_me_dont_worry
    int t;
    cin>>t;
    while(t--)
    {
        ll a[2];
        ll i;
        FOR0(i,2)cin>>a[i];
        ll ans = 0;
        if(a[0]==a[1]) ans = 2*a[0] - 2;
        else if(a[1]==a[0]+1) ans = 2*a[0] - 2;
        else 
        {
            ll s = sqrt(a[0]*a[1]);
            if(s*s==a[0]*a[1]) s--;
            if(s*(s+1)>= a[0]*a[1]) ans = 2*s - 2;
            else ans = 2*s - 1;
        }
        cout<<ans<<endl;
    }

}

Measured memory_bytes: 256
n, W_LIMIT = gets.to_s.split.map{|t| t.to_i }
wv = Array.new(n){ gets.to_s.split.map{|t| t.to_i } }.sort_by{|w, _| w }

inf = 10 ** 12
dp = Array.new(W_LIMIT+1){ -inf }
dp[0] = 0

w_sum = 0
wv.each do |(w_i, v_i)|
  w_sum = W_LIMIT < w_sum + w_i ? W_LIMIT : w_sum + w_i
  w_sum.downto(w_i) do |w|
    dp[w] = dp[w-w_i] + v_i if dp[w] < dp[w-w_i] + v_i
  end
end

p dp.max

Measured memory_bytes: 2556
L,R = (int(x) for x in input().split())

min_val = 2020
for i in range(L, min(R+1, L+2019)):
    for j in range(i+1, min(R+1, L+2019)):
        min_val = min(min_val, (i*j)%2019)

print(min_val)


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        set <int> st;
        for(int i=1;i<=n;i++)
        {
            int x;
            scanf("%d",&x);
            auto iter=st.find(x);
            if(iter==st.end())
                st.insert(x);
            else
                st.erase(iter);
        }
        printf("%d\n",st.size());
    }
    return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
 
int main(void){
 
    int N = 0;
    scanf("%d", &N);

    char S[10000];
    scanf("%s", S);

    for (int i = 0; i < strlen(S); i++){
        if(S[i] >= 'A' && S[i] <= 'Z'){
		    S[i] = S[i] + N;
	    }
        if(S[i] > 90){
            S[i] = S[i] - 26;
        }
    }

    printf("%s\n", S);
 
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

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

		int n = scan.nextInt();

		int ans = 999999999;

		for(int a = 1; a < n; a++) {
			int b = n-a;
			ans = Math.min(ans,getNumSum(a)+getNumSum(b));
		}

		System.out.println(ans);
	}

	static int getNumSum(int n) {
		char[] input = (""+n).toCharArray();
		int sum = 0;
		for(char c : input) {
			sum += (int)(c-'0');
		}
		return sum;
	}
}


Measured memory_bytes: 34080
from heapq import*
X,Y,Z=map(int,input().split());N=X+Y+Z;A=[];q1=[];q2=[];L=[0];R=[0]
for _ in[0]*N:A.append([int(e)for e in input().split()])
A.sort(key=lambda a:a[0]-a[1])
for i in range(N):
	L+=[L[i]+A[i][1]];heappush(q1,A[i][1]-A[i][2]);R+=[R[i]+A[-1-i][0]];heappush(q2,A[~i][0]-A[~i][2])
	if i>=Y:L[i+1]-=heappop(q1)
	if i>=X:R[i+1]-=heappop(q2)
print(max(L[i]+R[~i]for i in range(Y,N-X+1)))

Measured memory_bytes: 39200
#include<bits/stdc++.h>
#define M 100005
using namespace std;
char str[12];
map<string,int>mp;
int main(){
	int n;
	long long ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%s",str+1);
		sort(str+1,str+11);
		string a="";
		for(int j=1;j<=10;j++)a+=str[j];
		ans+=mp[a];
		mp[a]++;
	}
	printf("%lld\n",ans);
	return 0;
}

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

// --------------------------------------------- Library ---------------------------

struct edge { int to, rev; long long cap; };

vector<edge>g[100009]; bool vis[100009]; long long V, inf = (1LL << 60);

void add_edge(int v1, int v2, long long cost) {
	//cout << v1 << " " << v2 << " " << cost << endl;
	g[v1].push_back(edge{ v2, (int)g[v2].size(), cost });
	g[v2].push_back(edge{ v1, (int)g[v1].size() - 1, 0LL });
}
long long find_augment(int pos, int tar, long long curflow) {
	if (pos == tar) return curflow;
	vis[pos] = true;
	for (edge &e : g[pos]) {
		if (!vis[e.to] && e.cap > 0) {
			long long newflow = find_augment(e.to, tar, min(e.cap, curflow));
			if (newflow > 0) {
				e.cap -= newflow;
				g[e.to][e.rev].cap += newflow;
				return newflow;
			}
		}
	}
	return 0;
}
long long max_flow(int src, int dst) {
	long long ret = 0;
	while (true) {
		fill(vis, vis + V, false);
		long long res = find_augment(src, dst, inf);
		if (res == 0) break;
		ret += res; if (ret >= 500) break;
	}
	return ret;
}

int H, W; char c[109][109];

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c[i][j];
			if (c[i][j] == 'o') {
				add_edge(i, j + H, 1);
				add_edge(j + H, i, 1);
			}
			if (c[i][j] == 'S') {
				add_edge(i, j + H, (1 << 30));
				add_edge(j + H, i, (1 << 30));
				add_edge(H + W, i, (1 << 30));
			}
			if (c[i][j] == 'T') {
				add_edge(i, j + H, (1 << 30));
				add_edge(j + H, i, (1 << 30));
				add_edge(j + H, H + W + 1, (1 << 30));
			}
		}
	}
	V = H + W + 3;
	int G = max_flow(H + W, H + W + 1);
	if (G >= 500) G = -1;
	cout << G << endl;
	return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
int a[10010],sum;
int main()
{
	cin >>n>>m;
	for (int i=0;i<m;i++) cin >>a[i],sum+=a[i];
	if (sum>n) cout <<"-1";
	else cout <<n-sum;
	return 0;
}

Measured memory_bytes: 3668
#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
    int a, b;
    cin >> a;
    cin >> b;

    if(a > b){
        printf("a > b\n");
    }
    else if(a == b){
        printf("a == b\n");
    }
    else if(a < b){
        printf("a < b\n");
    }
    return 0;
}



Measured memory_bytes: 3032
#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a)  (a).begin(),(a).end()


signed main(){
  int n,a,b;
  cin>>n>>a>>b;
  V<V<int>> g(n);
  fo(i,n-1){
    g[i].pb(i+1);
    g[i+1].pb(i);
  }
  g[a-1].pb(b-1);
  g[b-1].pb(a-1);
  V<int> ans(n+5,0);

  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      ans[min(abs(j-i),min(abs(a-i)+1+abs(b-j),abs(b-i)+1+abs(j-a)))]++;

    }
  }

  for(int i=1; i<n; i++){
    cout<<ans[i]/2<<endl;
  }
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
    string str;
    cin >> str;
    for(int i = 0; i < str.length(); i++){
        if((i % 2 == 0 && str[i] == 'L')
                || (i % 2 == 1 && str[i] == 'R')){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
const readLines = (input) => input.split('\n')
const println = (value) => console.log(value)
const readInt = (input) => parseInt(input, 10)
const readIntList = (input) => input.split(' ').map(n => parseInt(n, 10))
const naturalOrder = (a, b) => {
    if (b == a) return 0
    return (a < b) ? -1 : 1
}

function main(input) {
    const lines = readLines(input)
    const [n, m, k] = readIntList(lines[0])
    const aArray = readIntList(lines[1])
    const bArray = readIntList(lines[2])

    // 片方を選んだときに、もう片方をどこまで読めるのかを二分探索する
    const accumb = [0]
    for (let i = 0; i < m; i++) {
        accumb.push(accumb[i] + bArray[i])
    }

    let aTime = 0
    let ans = 0
    let aCount = 0
    for (a of [0].concat(aArray)) {
        aTime += a

        let left = -1
        let right = accumb.length
        while (right - left > 1) {
            const mid = Math.floor((right + left) / 2)
            if (aTime + accumb[mid] <= k)
                left = mid
            else
                right = mid
        }

        // println(aTime)
        // println(accumb[left])
        // println(aTime + accumb[left])
        // println(left)
        // println()
        if (left != -1) ans = Math.max(ans, left + aCount)
        aCount++
    }

    println(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 71440
import sys
import queue

#+++++


def aaa(ll,a,b,c):
	ret=a+b+c
	for i,v1 in enumerate(ll):
		if v1==0:
			continue
		t1=abs(a-v1)
		if ret < t1:
			continue
		for j,v2 in enumerate(ll):
			if v2==0:
				continue
			if i==j:
				continue
			t2=t1 + abs(b-v2)
			if ret < t2:
				continue
			for k,v3 in enumerate(ll):
				if v3==0:
					continue
				if i==k or j==k:
					continue
				t3 = t2 + abs(c-v3)
				ret=min(ret, t3)
	return ret		

def mk_str(ll):
	ll.sort()
	return '_'.join([str(v) for v in ll])


def main():
	n , a, b, c = map(int, input().split())
	est=lambda ll:aaa(ll,a,b,c)
	
	bb=[]
	for i in range(n):
		bb.append(int(input()))
	
	cl=set()
	ol=queue.PriorityQueue()
	

	
	st=bb
	ee=est(st)
	cc=0
	cl.add(mk_str(bb))
	ol.put((ee+cc, (cc, bb)))	
	while True:
		if ee == 0:
			return cc
		
		#to goal no join
		rr=cc+ee
		ol.put((rr, (rr, [a,b,c])))
		
		
		
		#join 1
		if len(st) > 3:
			cc+=10
			for i, v in enumerate(st):
				kk=st[:]
				m=kk.pop(i)
				for j, _ in enumerate(kk):
					kkk=kk[:]
					kkk[j]+=m
					stk=mk_str(kkk)
					if stk not in cl:
						cl.add(stk)
						ol.put((cc, (cc, kkk)))
		v,(cc, st) = ol.get()
		ee = est(st)
				
	print(ans)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 5488
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    double ans,tmp,x;
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++){
        ans=1.0/n;
        tmp=i;
        while(tmp<k){
            tmp*=2;
            ans/=2;
        }
        x+=ans;
    }
    printf("%.12f\n",x);
}


Measured memory_bytes: 256
def warshall_floyd(graph):
    num_v = len(graph)
    for k in range(num_v):
        for i in range(num_v):
            for j in range(num_v):
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
    return graph


h, w = map(int, input().split())
route = []

for i in range(10):
    S = list(map(int, input().split()))
    route.append(S)
graph = warshall_floyd(route)
result = 0
for i in range(h):
    A = list(map(int, input().split()))
    for a in A:
        if a != -1:
            result += graph[a][1]
print(result)



Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#include <stack>
#include <cctype>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)

#define AAA (1000000007) 


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairII;
typedef vector<int> vecI;

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll powD(ll a, ll b) {
	ll ans = 1;
	a %= AAA;
	for (int i = 0; i < b; i++)
	{
		ans *= a;
		ans %= AAA;
	}
	return ans;
}



int main() {
	int i, j, k;
	int N, M, K;
	cin >> N >> M >> K;
	vecI A(N), B(M);

	rep(i, 0, N)
		cin >> A[i];
	rep(i, 0, M)
		cin >> B[i];

	int ans = 0;
	ll sum = 0;
	i = -1;
	while (sum <= K && i<N-1) {
		i++;
		ans++;
		sum += A[i];
	}
	if (sum > K) {
		sum -= A[i];
		i--;
		ans--;
	}
	int best = ans;
	//Aの本の一番下の位置
	int n = i;
	i = 0;
	j = n;
	while (i < M) {

		if (sum + B[i] <= K) {
			ans++;
			sum += B[i];
			i++;
		}
		else if (sum + B[i] > K) {
			if (j < 0)break;
			ans--;
			sum -= A[j];
			j--;
		}
		best = max(best, ans);
	}
	best = max(best, ans);
	cout << best;

	return 0;
}


Measured memory_bytes: 4840
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(998244353)
#define INF (1e15)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int dp[4100];

int dfs(int n,int m,int mask,vector<pii> &k){
	if(mask==(1<<n)-1) return dp[mask]=0;
	if(dp[mask]!=INF) return dp[mask];
	For(i,0,m-1){
		if((mask|k[i].S)==mask) continue;
		dp[mask]=min(dp[mask],dfs(n,m,mask|k[i].S,k)+k[i].F);
	}
	//cout<<mask<<" "<<dp[mask]<<'\n';
	return dp[mask];
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n,m; cin>>n>>m;
	vector<pii> key(m);
	int tot=0;
	For(i,0,m-1){
		cin>>key[i].F;
		int t; cin>>t;
		int mask=0;
		int c;
		For(j,0,t-1){
			cin>>c; c--;
			mask+=(1<<c);
		}
		key[i].S=mask;
		tot|=mask;
	}
	if(tot!=(1<<n)-1){
		cout<<"-1\n";
		return 0;
	}
	fill(dp,dp+4100,INF);
	int ans=dfs(n,m,0,key);
	cout<<ans<<"\n";
	return 0;
}






























Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int num = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        for (int i = 1; i <= num; i++) {
            int tmp = n * i;
            if (tmp % num == c) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}


Measured memory_bytes: 22740
// A + B = (繰り上がり以外の部分) + (繰り上がりの部分)
// A + B = (A xor B) + (A and B) << 1
// A + B = (A xor B) + 2 × (A and B)
// A + B =  A xor B であるためには (A and B) = 0である必要
// つまり、AとBのそれぞれの2^k(k >= 0)の桁それぞれで、1が1個以下しか存在しない必要
// 部分数列A_l, ... , A_r それぞれの2^kの桁それぞれで、1が1個以下しか存在しない必要
// lの位置から最大のrを求める関数f(l)は広義単調増加であることがわかる
// →尺取り法を用いる
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    int N;
    cin >> N;
    ll A[N];
    for(int i = 0; i < N; ++i) cin >> A[i];

    ll sum = 0;
    ll ans = 0;
    int left = 0, right = 0;
    for(left = 0; left < N; ++left) {
        while(right < N && (sum^A[right]) == (sum + A[right])) {
            sum += A[right];
            ++right;
        }
        ans += right - left;
        sum -= A[left]; // sum ^= A[left];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdio>
using namespace std;

class state {
public:
  double cost;			// 所要時間
  int pp;                       // 前の位置
  int np;			// 今の位置
  int v;			// 速度
  state(double _cost, int _pp, int _np, int _v) {
    cost = _cost;
    pp = _pp;
    np = _np;
    v = _v;
  }
  bool operator > (const state &s) const {
    return cost > s.cost;
  }
};

int main() {
  int n, m;
  while (true) {
    cin >> n >> m;
    if (n == 0 && m == 0) {
      break;
    }

    int s, g;
    cin >> s >> g;
    s--; g--;
    if (m == 0) {
      std::cout << "unreachable" << std::endl;
      continue;
    }

    vector <int> graph[n];
    double cost[n][n];
    double dist[n][n];
    for (int i = 0; i < m; i++) {
      int x, y;
      double d, c;
      cin >> x >> y >> d >> c;
      x--; y--;
      graph[x].push_back(y);
      graph[y].push_back(x);
      cost[x][y] = c;
      cost[y][x] = c;
      dist[x][y] = d;
      dist[y][x] = d;
    }

    double memo[n][n][32];		// prev now v
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	for (int k = 0; k < 32; k++) {
	  memo[i][j][k] = -1;
	}
      }
    }

    // for (int i = 0; i < n; i++) {
    //   std::cout << i << ":";
    //   for (int j = 0; j < graph[i].size(); j++) {
    // 	std::cout << graph[i][j] << " ";
    //   }
    //   std::cout << "" << std::endl;
    // }

    priority_queue <state, vector<state>, greater<state> > pque;
    pque.push(state(0, -1, s, 0));
    while(!pque.empty()) {
      state p = pque.top(); pque.pop();

      for (int i = 0; i < graph[p.np].size(); i++) {
	int np = graph[p.np][i];
        if (p.pp == np) {
          continue;
        }
	for (int j = -1; j <= 1; j++) {
	  int v = p.v+j;
	  if (v <= 0 || v > cost[p.np][np]) {
	    continue;
	  }

	  double nt = p.cost+dist[p.np][np]/double(v);

	  if (memo[p.np][np][v] == -1 ||
	      memo[p.np][np][v] > nt) {
	    memo[p.np][np][v] = nt;
	    pque.push(state(nt, p.np, np, v));
	  }
	}
      }
    }

    double ans = -1;
    for (int i = 0; i < n; i++) {
      if (memo[i][g][1] == -1) {
        continue;
      }
      if (ans == -1 ||
          memo[i][g][1] < ans) {
        ans = memo[i][g][1];
      }
    }

    if (ans == -1) {
      std::cout << "unreachable" << std::endl;
    }else {
      printf("%.5f\n", ans);
    }
  }
}

Measured memory_bytes: 2028
n,m=map(int,input().split())
h=list(map(int,input().split()))
ac=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]>h[b-1] and ac[a-1] != 0:
    ac[a-1]=1
    ac[b-1]=0
  elif h[a-1]<h[b-1] and ac[b-1] != 0:
    ac[a-1]=0
    ac[b-1]=1
  else:
    ac[b-1]=0
    ac[a-1]=0

print(ac.count(1))

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

int main() {
  int N;
  cin >>N;
  if (N <= 9 ) {
  cout<< N <<endl;
  }
  else if(N > 9){
    if (N <= 99){
      cout<< 9 <<endl;
    }
    else if(N > 99){
      if(N <= 999){
        cout<< 9+(N-99) <<endl;
      }
      else if(N > 999){
        if(N <= 9999){
          cout<< 9+900 <<endl;
        }
        else if(N > 9999){
          if(N <= 99999){
            cout<< 9+900+(N-9999) <<endl;
          }
          else if(N > 99999){
            cout<< 9+900+90000 <<endl;
          }
        }
      }
    }
  }
}


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

int main(void) {
    int N,M,K,tmp;
    bool ans = false;
    cin >> N >> M >> K;
    for (int i=0; i<=N; i++) {
        tmp = M*i;
        for (int j=0; j<=M; j++) {
            if (tmp == K) ans = true;
            tmp += N - 2 * i;
        }
    }
    cout << ( ans ? "Yes" : "No" ) << endl;
    return 0;
}


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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<ll> score(n);
  rep(i, n) cin >> score[i];

  rep(i, n - k) {
    //cout << score[1] << ':' << score[k+i] << '=';
    if(score[i] < score[k + i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 4768
from fractions import gcd
a,b,c,d=map(int,input().split())
c0=b//c-(a-1)//c
d0=b//d-(a-1)//d
cd0=b//(c*d//gcd(c,d))-(a-1)//(c*d//gcd(c,d))
print(b-a+1-c0-d0+cd0)

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


int main(){
  int N,L;
  cin >> N >>L;

  vector<int> A(N);
  int sum=0;

  for(int i=0;i<N;i++){
    A.at(i)=L+i;
    sum+=A.at(i);
  }
  //cout << sum << endl;

  int sum_sub=0;
  int answer=1000000;
  for(int i=0;i<N;i++){
    
    if(0<=A.at(i)){
      answer=min(answer,A.at(i));
      sum_sub=sum-answer;
    } 
    else{
      answer=min(answer,(-1)*A.at(i));
      sum_sub=sum+answer;
    }
  }
  cout << sum_sub << endl;



  


  }










Measured memory_bytes: 256
/*
मनस्वी म्रियते कामं कार्पण्यं न तु गच्छति ।
अपि निर्वाणमायाति नानलो याति शीतताम् ॥
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define p2d(v) for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v) for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v) for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

        
    ll a,b;

    cin>>a>>b;

    if(b>=a)
    {
        cout<<"unsafe";
    }
    else
    {
        cout<<"safe";
    }
        
        












    return 0;
}

Measured memory_bytes: 3660
fun main(args: Array<String>) {
    val hour = 3600
    val minute = 60
    var str = readLine()
    if(str != null) {
        val S = str.toInt()
        val h = S / hour
        val m = (S % hour) / minute
        val s = (S % hour) % minute
        println("$h:$m:$s")
    }
 }


Measured memory_bytes: 25348
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
// ミント
const int mod = 1e9+7 ;
//998244353;

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

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//昆布
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}   ;
 
mint modpow(ll a,ll b){
 if(b==0) return 1 ;
 mint c= modpow(a,b/2) ;
 if(b%2==1) return c*c*a ;
 else return c*c ;
}

mint komb(ll n,ll m){
  mint x=1 ;mint y=1 ;
  rep(i,m){
    x*= n-i ;
    y*= i+1 ;
  }
  return x/y ;
}
  
int main(){
   string s ;cin>>s ;
   ll k= s.size() ;
   vector<ll> a ;
   mint ans=1 ;
   rep(i,k){
    ll j=k-1-i ;
    if(s[j]=='1'){
       ans= ans*2+modpow(3,i) ;
    }
   }
   cout<<ans<<endl ;
    return 0;
  }
   

Measured memory_bytes: 3744
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

inline int num (const std::string& S, int idx){ return S.at(idx) - '0'; }
inline unsigned int bitMask(int i){ return (1 << i); }
inline bool isTrue(unsigned int bit, int i){ return bit & bitMask(i); }
void view(const std::vector<int>& v){ for(const auto& e:v) cout << e << " "; cout << endl; }
void view(const std::vector<double>& v){ for(const auto& e:v) cout << e << " "; cout << endl; }

int main(){
	int N, K;
	cin >> N >> K;
	vector<double> v(N);
	for(auto& e : v){
		cin >> e;
		e = (1.0+e)*0.5;
	}
	//view(v);
	vector<double> expect(N-K+1, 0.0);
	//for(int i=0; i<N-K+1; ++i){
		//for(int j=0; j<K; ++j){
			//expect.at(i) += v.at(i+j);
		//}
	//}
	for(int i=0; i<K; ++i) expect.at(0) += v.at(i);
	for(int i=1; i<expect.size(); ++i){
		expect.at(i) = (expect.at(i-1)+v.at(i+K-1)-v.at(i-1));
	}
	//view(v);
	//view(expect);
	double maximum = 0.0;
	//view(expect);
	for(const auto& e : expect) maximum = max(maximum, e);
	cout << fixed << maximum << endl;
	return 0;
}


Measured memory_bytes: 3328
def resolve():
    S = input()
    s = len(S)
    count = 0
    if s%2 == 0:
        for i in range(s//2):
            if S[i] != S[(i+1)*-1]:
                count += 1
    else:
        for i in range((s-1)//2):
            if S[i] != S[(i+1)*-1]:
                count += 1
    print(count)
resolve()


Measured memory_bytes: 2940
N, M = map(int, input().split())
Xi = list(map(int, input().split()))
Xi.sort()


if N >= M:
    print(0)
else:
    Di = []
    for i in range(M - 1):
        d = Xi[i + 1] - Xi[i]
        Di.append([i, d])
    Di.sort(key=lambda x: x[1], reverse=True)

    put_idx = [0]
    for i in range(N - 1):
        put_idx.append(Di[i][0] + 1)
    put_idx.append(M)

    total = 0
    for i in range(N):
        si = put_idx[i]
        ei = put_idx[i + 1] - 1
        s = Xi[si]
        e = Xi[ei]
        total += e - s
    print(total)

Measured memory_bytes: 23496
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+10;
const ll INF = 1LL<<60;
struct Nod {
    ll to, cost;
};
vector<Nod> G[N];
ll dist[N];
typedef pair<ll, ll> P;
void dij(ll x) {
    priority_queue<P, vector<P>, greater<P> > que;
    for(int i = 0; i < N; i ++) dist[i] = INF;
    dist[x] = 0;
    que.push(P(0, x));
    while(!que.empty()) {
        P p = que.top();
        que.pop();
        ll v = p.second;
        if(dist[v] < p.first) continue;
        for(ll i = 0; i < G[v].size(); i ++) {
            Nod e = G[v][i];
            if(dist[e.to] > dist[v] + e.cost) {
                dist[e.to] = dist[v] + e.cost;
                que.push(P(dist[e.to], e.to));
            }
        }
    }
}
int main() {
    int n, q, cnt = 0;
    scanf("%d", &n);
    for(int i = 0; i < n-1; i ++) {
        ll v, u, w;
        scanf("%lld %lld %lld", &v, &u, &w);
        G[v].push_back((Nod){u,w});
        G[u].push_back((Nod){v,w});
    }
     ll k;
     scanf("%d %lld", &q, &k);
     dij(k);
     while(q--) {
         ll x, y;
         scanf("%lld %lld", &x, &y);
         printf("%lld\n",dist[x] + dist[y]);
     }
    return 0;
}

Measured memory_bytes: 11120
#include <cassert>
#include "limits.h"
#include <limits>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename H,typename... T>
void debug_out(H head,T... tail){
  std::cerr<<" "<<head;
  debug_out(tail...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0))return 0;
  long long x = 1;
  while (b > 0) {
    if (b & 1)x = (mod!=-1)?(x * a) % mod:x*a;
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long,long long>;

long double snuke(ll n){
  ll sum=0;
  ll temp=n;
  while(temp>0){
    sum+=temp%10;
    temp/=10;
  }
  return (long double)n/(long double)sum;
}

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

  ll n;
  std::cin>>n;

  ll ans=1;
  rep(i,0,n){
    std::cout<<ans<<"\n";
    using P=std::pair<long double,ll>;
    P min={snuke(ans+1),ans+1};
    ll temp=10;
    rep(_,0,17){
      ll x=temp*((ans+1)/temp+1)-1;
      if(snuke(x)<min.first)min={snuke(x),x};
      temp*=10;
    }
    ans=min.second;
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

struct Edge {
  int f,t,v;
  Edge(int f,int t,int v):f(f),t(t),v(v){}
};

int main(){
  int l;
  cin >> l;
  l--;

  vector<Edge> ans;
  
  int t=0;
  while(((1<<(t+1))-1)<=l)t++;
  //cout << t << endl;

  rep(i,t){
    ans.push_back(Edge(i+1,i+2,0));
    ans.push_back(Edge(i+1,i+2,1<<i));
  }

  l-=(1<<t)-1;
  int check = 0;
  rep(i,t){
    if(l>>i&1){
      ans.push_back(Edge(i+1,t+1,(1<<t)+check));
      //cout << check << endl;
      check += 1<<i;
      //cout << check << endl;
    }
  }

  cout << t+1 << " " << ans.size() << endl;
  for(auto e:ans){
    cout << e.f << " " << e.t << " " << e.v << endl;
  }
}

Measured memory_bytes: 3600
#include <stdio.h>
int main(){
    int A1, A2, A3;

    scanf("%d %d %d", &A1, &A2, &A3);

    if((A1 + A2 + A3) <= 21){
        printf("win");
    }
    else if((A1 + A2 + A3) >= 22){
        printf("bust");
    }
    return 0;
}

Measured memory_bytes: 128
L = input()
N = len(L)
mod = 10 ** 9 + 7
dp = [[0] * 2 for _ in range(100005)]
dp[0][0] = 1
for i in range(N):
    # a + b = 0
    if L[i] == "0":
        dp[i + 1][0] = dp[i][0]
        dp[i + 1][1] = dp[i][1]
    else:
        dp[i + 1][1] = (dp[i][0] + dp[i][1]) % mod

    # a + b = 1
    if L[i] == "0":
        dp[i + 1][1] += dp[i][1] * 2 % mod
        dp[i + 1][1] %= mod
    else:
        dp[i + 1][0] += dp[i][0] * 2 % mod
        dp[i + 1][0] %= mod
        dp[i + 1][1] += dp[i][1] * 2 % mod
        dp[i + 1][1] %= mod

ans = dp[N][0] + dp[N][1]
print(ans % mod)

Measured memory_bytes: 54236
n,m=map(int,input().split())
parent=[*range(n)]
sz=[1]*n


def anc(a):
	# print(a)
	if parent[a]==a:
		return a
	else:
		return(anc(parent[a]))


def union(a,b):
	pa=anc(a)
	pb=anc(b)
	if sz[pb]<sz[pa]:
		pa,pb=pb,pa
	parent[pa]=pb
	sz[pb]+=sz[pa]
	sz[pa]=0


# print(parent)
for i in range(m):
	a,b=map(int,input().split())
	a-=1
	b-=1
	if anc(a)!=anc(b):
		union(a,b)
	# print(parent,a,b)

print(max(sz))





Measured memory_bytes: 18420
import Data.List.Split
main = do
    a <-  getLine
    -- let year = take 4
    -- let day =  take 2 $  drop
    let temp = map (\x -> read x) $ splitOn "/" a :: [Int]
    --let temp = map (\x -> read x) $ split '/' a :: [Int]
    let isHeisei = ((temp !! 0) >= 2019) && ((temp !! 1) <= 4) && ((temp !! 2) <= 30)
    putStrLn $ if isHeisei then "Heisei" else "TBD"



Measured memory_bytes: 508