jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
// @ts-ignore
import * as fs from 'fs';

// メイン
var g_root: number[];
var g_count: number[];

function main(input: string[]) {
    var work0: number[] = input.shift().split(" ").map(x => Number(x));
    var n: number = work0[0];
    var m: number = work0[1];
    var node: number[][] = input.map(x => x.split(" ").map(x => Number(x) - 1));
    g_root = new Array(n).fill(-1);
    g_count = new Array(n).fill(1);
    node.forEach(value => {
        var a: number = value[0];
        var b: number = value[1];
        var roota: number = getRoot(a);
        var rootb: number = getRoot(b);
        if (roota == rootb) return;
        if (roota > rootb) [roota, rootb] = [rootb, roota];
        mergeRoot(roota, rootb);
    });
    console.log(g_count.reduce(function(x, y) { return Math.max(x, y) }));
}

function getRoot(index: number) {
    if (g_root[index] < 0) {
        return index;
    } else {
        var work0: number = getRoot(g_root[index]);
        g_root[index] = work0;
        return work0
    }
}

function mergeRoot(root0: number, root1: number) {
    g_count[root0] += g_count[root1];
    g_count[root1] = 0;
    g_root[root1] = root0;
}

// エントリポイント
// - OSによるパラメタの処理の違いを吸収
function entrypoint() {
    try {
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        console.log("----");
        console.log("file='%s'", __filename.split("\\").slice(-1)[0]);
        console.log("----");
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            console.log("input=%o", input);
            console.time();
            console.log("----")
            main(input);
            console.log("----")
            console.timeEnd();
        });
    }
}
entrypoint();
//  [typescript]
// @ts-ignore
import * as fs from 'fs';
import { kMaxLength } from 'buffer';

// メイン
var g_root: number[];
var g_count: number[];

function main(input: string[]) {
    var work0: number[] = input.shift().split(" ").map(x => Number(x));
    var n: number = work0[0];
    var m: number = work0[1];
    var node: number[][] = input.map(x => x.split(" ").map(x => Number(x) - 1));
    g_root = new Array(n).fill(-1);
    g_count = new Array(n).fill(1);
    node.forEach(value => {
        var a: number = value[0];
        var b: number = value[1];
        var roota: number = getRoot(a);
        var rootb: number = getRoot(b);
        if (roota == rootb) return;
        if (roota > rootb) [roota, rootb] = [rootb, roota];
        mergeRoot(roota, rootb);
    });
    // TODO Math.max(...)は使ってはダメ、スプレッド構文はスタックに展開するのでスタックがあふれる
    // console.log(Math.max(g_cound));
    console.log(Math_max(g_count));
}

function Math_max(arr: number[]) {
    arr.reduce(function(x, y) {
        return Math.max(x, y);
    });
}
function getRoot(index: number) {
    if (g_root[index] < 0) {
        return index;
    } else {
        var work0: number = getRoot(g_root[index]);
        g_root[index] = work0;
        return work0
    }
}

function mergeRoot(root0: number, root1: number) {
    g_count[root0] += g_count[root1];
    g_count[root1] = 0;
    g_root[root1] = root0;
}

// エントリポイント
// - OSによるパラメタの処理の違いを吸収
function entrypoint() {
    try {
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        console.log("----");
        console.log("file='%s'", __filename.split("\\").slice(-1)[0]);
        console.log("----");
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            console.log("input=%o", input);
            console.time();
            console.log("----")
            main(input);
            console.log("----")
            console.timeEnd();
        });
    }
}
entrypoint();
//  [typescript]
// @ts-ignore
import * as fs from 'fs';

// メイン
var g_root: number[];
var g_count: number[];

function main(input: string[]) {
    var work0: number[] = input.shift().split(" ").map(x => Number(x));
    var n: number = work0[0];
    var m: number = work0[1];
    var node: number[][] = input.map(x => x.split(" ").map(x => Number(x) - 1));
    g_root = new Array(n).fill(-1);
    g_count = new Array(n).fill(1);
    node.forEach(value => {
        var a: number = value[0];
        var b: number = value[1];
        var roota: number = getRoot(a);
        var rootb: number = getRoot(b);
        if (roota == rootb) return;
        if (roota > rootb) [roota, rootb] = [rootb, roota];
        mergeRoot(roota, rootb);
    });
    console.log(Math.max(...g_count));
}

function getRoot(index: number) {
    if (g_root[index] < 0) {
        return index;
    } else {
        var work0: number = getRoot(g_root[index]);
        g_root[index] = work0;
        return work0
    }
}

function mergeRoot(root0: number, root1: number) {
    g_count[root0] += g_count[root1];
    g_count[root1] = 0;
    g_root[root1] = root0;
}

// エントリポイント
// - OSによるパラメタの処理の違いを吸収
function entrypoint() {
    try {
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        console.log("----");
        console.log("file='%s'", __filename.split("\\").slice(-1)[0]);
        console.log("----");
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            console.log("input=%o", input);
            console.time();
            console.log("----")
            main(input);
            console.log("----")
            console.timeEnd();
        });
    }
}
entrypoint();
//  [typescript]
// @ts-ignore
import * as fs from 'fs';

// メイン
var g_root: number[];
var g_count: number[];

function main(input: string[]) {
    var work0: number[] = input.shift().split(" ").map(x => Number(x));
    var n: number = work0[0];
    var m: number = work0[1];
    var node: number[][] = input.map(x => x.split(" ").map(x => Number(x) - 1));
    g_root = new Array(n).fill(-1);
    g_count = new Array(n).fill(1);
    node.forEach(value => {
        var a: number = value[0];
        var b: number = value[1];
        var roota: number = getRoot(a);
        var rootb: number = getRoot(b);
        if (roota == rootb) return;
        if (roota > rootb) [roota, rootb] = [rootb, roota];
        mergeRoot(roota, rootb);
    });
    console.log(Math.max(...g_count));
}

function getRoot(index: number) {
    if (g_root[index] < 0) {
        return index;
    } else {
        var work0: number = getRoot(g_root[index]);
        g_root[index] = work0;
        return work0
    }
}

function mergeRoot(root0: number, root1: number) {
    g_count[root0] += g_count[root1];
    g_count[root1] = 0;
    g_root[root1] = root0;
}

// エントリポイント
// - OSによるパラメタの処理の違いを吸収
function entrypoint() {
    try {
        var input = fs.readFileSync("/dev/stdin", "utf8").split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        console.log("----");
        console.log("file='%s'", __filename.split("\\").slice(-1)[0]);
        console.log("----");
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            console.log("input=%o", input);
            console.time();
            console.log("----")
            main(input);
            console.log("----")
            console.timeEnd();
        });
    }
}
entrypoint();
//  [python]
from itertools import accumulate
import sys
read = sys.stdin.buffer.read

def main():
  N, K, *p = map(int, read().split())
  p = [0] + list(accumulate(p))
  print((max(b - a for a, b in zip(p, p[K:])) + K) / 2)

if __name__ == '__main__':
    main()
//  [python]
from itertools import accumulate
import sys

def main():
  read = sys.stdin.buffer.read
  N, K, *p = map(int, read().split())
  p = [0] + list(accumulate(p))
  print((max(y - x for x, y in zip(p, p[K:])) + K) / 2)

if __name__ == '__main__':
    main()
//  [python]
from itertools import accumulate

def main():
    N, K= map(int, input().split())
    p = list(map(int, input().split()))
    # 累積和
    p = [0] + list(accumulate(p))

    # 累積和が最大になる区間、期待値は(1+p)/2、k個分なので以下の式。
    print((max(b - a for a, b in zip(p, p[K:])) + K) / 2)

if __name__ == '__main__':
  	main()

'''
5 3
1 2 2 4 5

10 4
17 13 13 12 15 20 10 13 17 11
'''
//  [python]
def main():

    n, k = map(int, input().split())
    p = list(map(int, input().split()))

    ex = [0]
    for x in p:
        ex.append(ex[-1] + 1/x * (sum(list(range(1, x+1)))))

    ans = 0
    for i in range(k, n+1):
        ans = max(ans, ex[i] - ex[i-k])

    print(ans)

main()
//  [python]
n, k = map(int, input().split())
p = list(map(int, input().split()))

ex = [0]
for x in p:
    ex.append(ex[-1] + 1/x * (sum(list(range(1, x+1)))))

ans = 0
for i in range(k, n+1):
    ans = max(ans, ex[i] - ex[i-k])

print(ans)
//  [python]
n, k = map(int, input().split())
p = list(map(int, input().split()))

ex = []
for x in p:
    ex.append(1/x * (sum(list(range(1, x+1)))))

cs = [0]
for x in ex:
    cs.append(cs[-1]+x)

ans = 0
for i in range(k, n+1):
    ans = max(ans, cs[i] - cs[i-k])

print(ans)
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class DDiceInLine {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int n = s.nextInt(), k = s.nextInt();
            double ans, cur = 0;
            int[] p = new int[n];
            for (int i = 0; i < n; i++) p[i] = s.nextInt();
            for (int i = 0; i < k; i++) cur += (p[i] + 1) / 2.0;
            ans = cur;
            for (int i = k; i < n; i++) {
                cur -= (p[i - k] + 1) / 2.0;
                cur += (p[i] + 1) / 2.0;
                ans = Math.max(ans, cur);
            }
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k= sc.nextInt();
        double[] p = new double[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextDouble();
        }
        double ans = 0.0;

        for (int i = 0; i < n - k + 1; i++) {
            double sum = 0.0;
            for (int j = i; j < i + k; j++) {
                double tmp = (p[j] + 1.0) / 2.0;
                sum += tmp;
            }
            ans = Math.max(ans, sum);
        }
        System.out.println(ans);
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k= sc.nextInt();
        double[] p = new double[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextDouble();
        }
        double max = 0.0;
        int index = 0;
        for (int i = 0; i < n - k + 1; i++) {
            double sum = 0.0;
            for (int j = i; j < i + k; j++) {
                sum += p[j];
            }
            if(sum > max) {
                index = i;
                max = sum;
            }
        }
        double ans = 0.0;
        for (int i = index; i < index + k; i++) {
            double tmp = (p[i] + 1.0) / 2.0;
            ans += tmp;
        }
        System.out.println(ans);
    }
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		double[] ave = new double[n];

		for (int i = 0; i < n; i++) {
			int roll = sc.nextInt();
			ave[i] = (double) (roll + 1) / 2;
		}

		double sum = 0;
		for (int i = 0; i < k; i++) {
			sum += ave[i];
		}
		double max = 0;

		for (int i = 0; i < n - k; i++) {
			sum = sum - ave[i] + ave[i + k];
			max = Math.max(max, sum);
		}

		System.out.println(max);

	}

}
//  [cpp]
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint(), K = getint();
	int P[200001];

	ll saidai = 0;
	ll ima = K;
	rep(i, K) {
		P[i] = getint();
		ima += P[i];
	}
	saidai = ima;

	int k = 0;
	for (int i = K; i < N; i++, k++) {
		if (k == K) k = 0;
		ima -= P[k];
		P[k] = getint();
		ima += P[k];
		chmax(saidai, ima);
	}

	double kotae = saidai * 0.5;

	printf("%.6f", kotae);

	Would you please return 0;
}
//  [cpp]
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cctype>
#define REP(i,a,b) for(register int i=(a); i<(b); i++)
#define REPE(i,a,b) for(register int i=(a); i<=(b); i++)
#define PERE(i,a,b) for(register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
char buf[1<<21], *p1=buf, *p2=buf;
#define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <class T> inline void read(T&x) {
	x=0; char ch; do ch=getchar(); while(ch<=' ');
	while(ch>' ') {x=x*10+ch-'0'; ch=getchar();}
}
#define MAXN 200007
int n,k;
int p[MAXN];
int main() {
	read(n); read(k);
	REP(i,0,n) {read(p[i]); p[i]++;}
	REP(i,1,n) p[i]+=p[i-1];
	PERE(i,n-1,k) p[i]-=p[i-k];
	int ans=0;
	REP(i,k-1,n) {
		ans = max(ans, p[i]);
	}
	printf("%lf\n", ans/2.0);
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> kitai(n),dp(n-k+1);
    double ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        kitai.at(i)=(a+1);
    }
    for(int i=0;i<k;i++){
        dp.at(0)+=kitai.at(i);
    }
    ans=dp.at(0);
    if(n-k+1!=1){
        for(int i=1;i<n-k+1;i++){
            dp.at(i)=dp.at(i-1)+kitai.at(i+k-1)-kitai.at(i-1);
            if(ans<dp.at(i))ans=dp.at(i);
        }
    }
    cout << (double)ans/2 << endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<double> kitai(n),dp(n-k+1);
    double ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        kitai.at(i)=(double)(a+1)/(double)2;
    }
    for(int i=0;i<k;i++){
        dp.at(0)+=kitai.at(i);
    }
    ans=dp.at(0);
    if(n-k+1!=1){
        for(int i=1;i<n-k+1;i++){
            dp.at(i)=dp.at(i-1)+kitai.at(i+k-1)-kitai.at(i-1);
            if(ans<dp.at(i))ans=dp.at(i);
        }
    }
    cout << ans << endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<double> kitai(n),dp(n-k+1);
    double ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        kitai.at(i)=(double)(a+1)/(double)2;
    }
    for(int i=0;i<k;i++){
        dp.at(0)+=kitai.at(i);
    }
    ans=dp.at(0);
    for(int i=1;i<n-k+1;i++){
        dp.at(i)=dp.at(i-1)+kitai.at(i+k-1)-kitai.at(i-1);
        if(ans<dp.at(i))ans=dp.at(i);
    }
    cout << ans << endl;
    return 0;
}
//  [c]
// ABC 154-D
// 2020.2.9 bal4u

#include <stdio.h>

typedef long long ll;

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int s[200005];

int main()
{
	int i, K, N, ans;
	
	N = in(), K = in();
	for (i = 1; i <= N; ++i) s[i] = s[i-1] + (in()+1);

	ans = 0;
	for (i = K; i <= N; ++i) {
		if (s[i]-s[i-K] > ans) ans = s[i]-s[i-K];
	}
	printf("%.10lf\n", 0.5*ans);
	return 0;
}
//  [c]
char buf[1<<20];
int p[2<<17];
int N,K;
int sz;
int ans;
main()
{
	read(0,buf,1<<20);
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		K=K*10+k-'0';
	}
	for(int i=0;i<N;i++)
	{
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			p[i]=p[i]*10+k-'0';
		}
	}
	for(int i=1;i<N;i++)p[i]+=p[i-1];
	for(int i=N-1;i>=K;i--)
	{
		p[i]-=p[i-K];
	}
	for(int i=0;i<N;i++)
    {
		if(ans<p[i])ans=p[i];
    }
	printf("%f\n",(ans+K)/2.);
}
//  [c]
// ABC 154-D
// 2020.2.9 bal4u

#include <stdio.h>

typedef long long ll;

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int s[200005];
int a[200005];

int main()
{
	int i, K, N;
	int ma, ii;
	double ans;
	
	N = in(), K = in();
	for (i = 1; i <= N; ++i) {
		a[i] = in() + 1;
		s[i] = s[i-1] + a[i];
	}
	ma = 0;
	for (i = K; i <= N; ++i) {
		if (s[i]-s[i-K] > ma) {
			ma = s[i]-s[i-K], ii = i-K;
		}
	}
	ans = 0;
	for (i = 1; i <= K; ++i) ans += a[i+ii]*0.5;
	printf("%.10lf\n", ans);
	return 0;
}
//  [c]
#include<stdio.h>

int main()
{

	long int n,k,i,j;
  long double p[200001],max,sum;
  sum=0;
  max=0;
(void) scanf("%ld %ld",&n,&k);
  
  for (i=1;i<=n;i++)
  {
(void) scanf("%llf",&p[i]);
   p[i]=(p[i]+1)/2;
  }
  
  for (i=1;i<=k;i++)
  {
  	sum+=p[i];
  }
  
  //printf("%llf\n",sum);
  
  for (i=k+1;i<=n;i++)
   {
   sum=sum+p[i];
   sum=sum-p[i-k];
    //printf("%llf %llf %llf \n",p[i],p[i-k],sum);
    if (sum>max)
    {
    	max=sum;
    }   
   }
  
  
  
  /*
  for (i=1;i<=n-k+1;i++)
  {
  	for (j=1;j<=k;j++)
    {
    	sum+=p[i+j-1];    	
    }
    	if (sum>max)
        {
        	max=sum;
        }
    sum=0.0;
  }
*/


  printf("%llf",max);
  return 0;

}
//  [c]
#include<stdio.h>

int main()
{

	long int n,k,i,j;
  long double p[200001],max,sum;
  sum=0;
  max=0;
(void) scanf("%ld %ld",&n,&k);
  
  for (i=1;i<=n;i++)
  {
(void) scanf("%llf",&p[i]);
   p[i]=(p[i]+1)/2;
  }
  
  for (i=1;i<=n-k+1;i++)
  {
  	sum+=p[i];
  }
  
  //printf("%llf\n",max);
  
  for (i=n-k+2;i<=n;i++)
   {
   sum=sum+p[i];
   sum=sum-p[i-k];
    //printf("%llf %llf %llf \n",p[i],p[i-k],sum);
    if (sum>max)
    {
    	max=sum;
    }   
   }
  
  
  
  /*
  for (i=1;i<=n-k+1;i++)
  {
  	for (j=1;j<=k;j++)
    {
    	sum+=p[i+j-1];    	
    }
    	if (sum>max)
        {
        	max=sum;
        }
    sum=0.0;
  }
*/


  printf("%llf",max);
  return 0;

}
//  [c]
#include<stdio.h>

int main()
{

	long int n,k,i,j;
  long double p[200001],max,sum;
  sum=0;
  max=0;
(void) scanf("%ld %ld",&n,&k);
  
  for (i=1;i<=n;i++)
  {
(void) scanf("%lf",&p[i]);
   p[i]=(p[i]+1)/2;
  }
  
  for (i=1;i<=n-k+1;i++)
  {
  	for (j=1;j<=k;j++)
    {
    	sum+=p[i+j-1];    	
    }
    	if (sum>max)
        {
        	max=sum;
        }
    sum=0.0;
  }

  printf("%lf",max);
  return 0;

}
//  [javascript]
function Main(input) {
	input = input.split("\n");
	input[0] = input[0].split(' ');
	input[1] = input[1].split(' ');
	var sum = new Array(input[0][0] - input[0][1] + 1);
	for(var i=0; i<2; i++){
    	input[0][i] = parseInt(input[0][i], 10);
    }
  var sig = 0;
	var max = 0;
	var maxN = 0;
	for(var i=0; i<input[0][0]; i++){
    	input[1][i] = parseInt(input[1][i], 10);
    	input[1][i] = (input[1][i]+1)/2;
    	sig += input[1][i];
        if(i >= input[0][1] - 1){
        	sum[i-input[0][1]+1] = sig;
        	sig -= input[1][i-input[0][1]+1];
        	if(max < sum[i-input[0][1]+1]){
       			max = sum[i-input[0][1]+1];
        		maxN = i-input[0][1]+1;
        	}
        }
    }
	console.log(sum[maxN]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
console.log((args=>{
  const [[N,K],p] = args.trim().split`\n`.map(r=>r.split` `.map(v=>0|v));
  const s = [0];
  for ( let i = 0; i < N; i++ ) s.push( s[i] + p[i] + 1 );
  let max = 0;
  for ( let i = 0; i + K <= N; i++ ) if ( max < s[i+K] - s[i] ) max = s[i+K] - s[i];
  return `${max/2}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [javascript]

function Main(input) {
  input = input.trim().split("\n").map(function(x) { return x.split(" ")});
  var L1 = input[0].map(e => parseInt(e, 10));
  var N = L1[0];
  var K = L1[1];
  var vec_p = input[1].map(e => parseInt(e, 10));
  var tmpSum = 0;
  var tmpSet = [];
  var changed, ans;
  for (var i = 0; i < K; i++){
    tmpSum += vec_p[i];
    tmpSet.push(vec_p[i]);
  }
  ans = tmpSum;
  for (var i = K; i < N; i++){
    changed = i % K;
    tmpSum += (vec_p[i] - tmpSet[changed]);
    tmpSet[changed] = vec_p[i];
    if (tmpSum > ans) ans = tmpSum;
  }
  ans = (ans + K) / 2;
  console.log(ans);
}   

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const N=input[0].split(' ')[0]-0;
  const K=input[0].split(' ')[1]-0;
  const value=input[1].split(' ').map(e=>{
    return (e-0+1)/2;
  });
  var sum=0;
  var max;
  for(var i=0;i<K;i++){
    sum+=value[i];
  }
  max=sum;
  for(var i=0;i<N-K;i++){
    sum+=value[K+i]-value[i];
    if(max<sum){
      max=sum;
    }
  }
  console.log(sum);
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input){
    const arr = input.split('\n');
    const [N, K] = arr[0].split(' ').map(Number);
    const pi = arr[1].split(' ').map(Number);
    let maxNum = 0;
    let Knum = 0;
    let answer = 0;
    for(let i=0; i<K; i++){
        Knum += pi[i];
    }
    maxNum = Knum;
    for(let i=K; i<pi.length; i++){
        Knum += pi[i]-pi[i-K];
        if(maxNum < Knum)  maxNum = Knum;
    }
    const answer = (maxNum+K)/2;
    console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func max(x, y float64) float64 {
	if x > y {
		return x
	}
	return y
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n, k := readInt(), readInt()
	cs := make([]float64, n+1)
	for i := 1; i <= n; i++ {
		p := readInt()
		cs[i] = (float64(p)+1)/2 + cs[i-1]
	}
	ans := float64(0)
	for i := k; i <= n; i++ {
		ans = max(ans, cs[i]-cs[i-k])
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for D - Dice in Line
	var N, K int
	fmt.Scan(&N, &K)

	sc.Split(bufio.ScanWords)
	p := make([]int, N)
	for i := 0; i < N; i++ {
		p[i] = nextInt()
	}

	var max int
	var maxNum int
	var count int
	for i := 0; i < N-K+1; i++ {
		count = 0
		for j := 0; j < K; j++ {
			count += p[i+j]
		}

		if max < count {
			max = count
			maxNum = i
		}
	}

	var ans float64
	for i := 0; i < K; i++ {
		ans += (float64(p[maxNum+i]) + 1.0) / 2.0
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for D - Dice in Line
	var N, K int
	fmt.Scan(&N, &K)

	sc.Split(bufio.ScanWords)
	p := make([]int, N)
	for i := 0; i < N; i++ {
		p[i] = nextInt()
	}

	var max float64
	var ans float64
	for i := 0; i < N-K+1; i++ {
		ans = 0
		for j := 0; j < K; j++ {
			ans += (float64(p[i+j]) + 1.0) / 2.0
		}

		if max < ans {
			max = ans
		}
	}
	fmt.Println(max)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	p := make([]float64, N)
	for i := range p {
		fmt.Scan(&p[i])
		p[i] = (p[i] + 1) / 2
	}
	wa := make([]float64, N+1)
	for i := 0; i < N; i++ {
		wa[i+1] = wa[i] + p[i]
	}
	max := 0.0
	for i := K; i < N+1; i++ {
		max = math.Max(max, wa[i]-wa[i-K])
	}
	fmt.Println(wa)
	fmt.Println(max)
}
//  [ruby]
n, k = gets.split.map(&:to_i)
ps = gets.split.map(&:to_i)

max = sum = ps[0...k].inject(:+)

(k...n).each do |i|
  sum = sum - ps[i - k] + ps[i]
  max = sum if max < sum
end

puts (max + k) / 2.0
//  [ruby]
# frozen_string_literal: true

n, k = gets.split.map &:to_i
p = gets.split.map &:to_i
sum = p[0...k].inject(:+)
temp = sum
(k...n).each do |i|
  temp = temp - p[i-k] + p[i]
  sum = temp if sum < temp
end
puts (sum+k)/2.0
//  [ruby]
n,k=gets.split.map(&:to_i)
p=gets.split.map(&:to_f)
e=[]
sum=[]
sum[1]=(p[0]+1)/2
ans=sum[1]
(2..n).each do |i|
  e[i]=(p[i-1]+1)/2
  sum[i]=sum[i-1]+e[i]
  ans=[ans,sum[i]-sum[i-k]].max if i-k>0
end
p ans
//  [ruby]
n,k=gets.split.map(&:to_i)
p=gets.split.map(&:to_f)
e=[]
sum=[]
ans=0
sum[1]=(p[0]+1)/2
(2..n).each do |i|
  e[i]=(p[i-1]+1)/2
  sum[i]=sum[i-1]+e[i]
  ans=[ans,sum[i]-sum[i-k]].max if i-k>0
end
p ans
//  [ruby]
n,k=gets.split.map(&:to_i)
p=gets.split.map(&:to_i)
sum=[]
sum[k]=p[0,k].sum
a=p[0,k]
max=0

(k+1..n).each do |i|
  sum[i]=sum[i-1]-p[i-k]+p[i-1]
  if max<sum[i]
    a=p[i-k,k]
    max=sum[i]
  end
end

e=0
a.each do |aa|
  (1..aa).each do |i|
    e+=(1/aa.to_f)*i
  end
end
p e
//  [rust]
use whiteread::parse_line;

fn main() {
    let (n, k): (usize, usize) = parse_line().unwrap();
    let s: Vec<u32> = parse_line().unwrap();
    let mut a: Vec<f32> = vec![0.0];
    let mut ans: f32 = 0.0;

    for i in 0..n {
        a.push(a[i] + (1 + s[i]) as f32 / 2.0);
    }

    for i in 0..n - k + 1 {
        ans = ans.max(a[i + k] - a[i]);
    }
    println!("{}", ans);
}
//  [rust]
fn input_pair<T: std::str::FromStr + Copy> () -> (T, T) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let arr: Vec<_> = s.trim().split_whitespace().flat_map(str::parse).collect();
    (arr[0], arr[1])
}

fn input_arr<T: std::str::FromStr> () -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().flat_map(str::parse).collect()
}

fn main() {
    let (n, k) = input_pair::<usize>();
    let ps = input_arr::<usize>();
    let mut m = [0; 1001];
    for i in 1..1001 {
        m[i] = m[i - 1] + i;
    }
    let mut result = 0f64;
    for i in 0..n-k+1 {
        let v = ps.iter().skip(i).take(k).map(|&p| m[p] as f64 / p as f64).sum::<f64>();
        if result < v {
            result = v;
        }
    }
    println!("{}", result);
}
//  [swift]
import Foundation

let array1 = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
let N = array1[0]
let K = array1[1]
var array =  readLine()!.componentsSeparatedByString(" ").map { Double($0)! }
var sums = [0.0]
for i in 0 ..< N {
  sums.append(sums[i] + ((1 + array[i]) * 0.5))
}
var answers = [Double]()
for j in 0 ... N - K {
  answers.append(sums[j + K] - sums[j])
}
//answers = answers.sort { $0 > $1 } 
print(answers.maxElement()!)
//  [swift]
import Foundation

let array1 = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
let N = array1[0]
let K = array1[1]
var array =  readLine()!.componentsSeparatedByString(" ").map { Double($0)! }
var sums = [0.0]
for i in 0 ..< N - 1 {
  sums.append(sums[i] + ((1 + array[i]) * 0.5))
}
var answers = [Double]()
for j in 0 ..< N - K - 1{
  answers.append(sums[j + K] - sums[j])
}
answers = answers.sort { $0 > $1 } 
print(answers[0])

//for j in i..<i + K {
//  	answer += 0.5 * array[j] + 0.5
//  }
//answers = answers.sort { $0 > $1 } 
//print()
//  [swift]
import Foundation

let array1 = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
let N = array1[0]
let K = array1[1]
var array =  readLine()!.componentsSeparatedByString(" ").map { Double($0)! }
var sums = [0.0]
for i in 0 ..< N - 1 {
  sums.append(sums[i] + ((1 + array[i]) * 0.5))
}
var answers = [Double]()
for j in 0 ..< N - K {
  answers.append(sums[j + K] - sums[j])
}
answers = answers.sort { $0 > $1 } 
print(answers[0])

//for j in i..<i + K {
//  	answer += 0.5 * array[j] + 0.5
//  }
//answers = answers.sort { $0 > $1 } 
//print()
//  [swift]
import Foundation

let array1 = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
let N = array1[0]
let K = array1[1]
var array =  readLine()!.componentsSeparatedByString(" ").map { Double($0)! }
var answer = 0.0
var answers = [Double]()
for i in 0...N - K {
  for j in i..<i + K {
  	answer += 0.5 * array[j] + 0.5
  }
  answers.append(answer)
  answer = 0.0
}
answers = answers.sort { $0 > $1 } 
print(answers[0])
//  [typescript]
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}
const kitaiti = (arr) => {
  let r=0
  for(const a of arr){
    r+=a*(a+1)/2/a
  }
  return r
}
const main = () => {
  const o = new AtCoder()
  let [n,m]=o.nn(2),arr=o.nn(n),max=0,max_i,arr2=[0]
  for(let i=0;i<n;i++){
    arr2.push(arr[i]+arr2[i])
  }
  for(let i=0;i<n-m+1;i++){
    let sum=arr2[i+m]-arr2[i]
    if(max<sum){
      max = sum
      max_i = i
    }
  }
  o.o(kitaiti(arr.slice(max_i,max_i+m)))
}
main();
//  [typescript]
import * as fs from "fs";

const lines = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n")

const [all, choise] = lines[0].split(' ').map(Number)

const arr = lines[1].split(' ').map(Number)

const expectation = arr.map(n1 => (n1 + 1) / 2)

const res = expectation.reduce((r1, n1, i1) => {
  if (i1 <= choise - 1) return {max: r1.cur + n1, cur: r1.cur + n1}
  const cur = r1.cur + n1 - expectation[i1 - choise]
  return {max: Math.max(cur, r1.max), cur}
}, {max: 0, cur: 0})

console.log(res.max)
//  [typescript]
import * as fs from 'fs';

const args = fs.readFileSync("/dev/stdin", "utf8").split('\n')

const calc = (array: number[], edge: number): number => {
  const ev = array.map(v => (1 + v) / 2)
  // referenced and not implemented
  const res = ev.reduce(({ max, tmp }, prev, i) => {
    const v = tmp + prev
    if (i <= edge - 1) return { max: v, tmp: v }
    const t = v - ev[i - edge]
    return { max: Math.max(t, max), tmp: t }
  }, { max: 0, tmp: 0 })
  return res.max
}

const [_, k] = args[0].split(" ").map(x => +x)
const p = args[1].split(" ").map(x => +x)

console.log(calc(p, k))
//  [typescript]
import * as fs from 'fs';

const args = fs.readFileSync("/dev/stdin", "utf8").split('\n')

const calc = (arr: number[]): number => {
  const ev = arr.map(v => (1 + v) / 2)
  const cs = Array.from(Array(n)).map(() => 0).map((_, i, arr) => !i ? ev[i] : arr[i-1] + ev[i])

  let max = 0
  for (let i = 0; i <= n - k; i++) {
    const sum = cs.slice(i, k+i).reduce((ac, cu) => ac + cu)
    if (sum > max) max = sum
  }
  return max
}

const [n, k] = args[0].split(" ").map(x => +x)
const p = args[1].split(" ").map(x => +x)

console.log(calc(p))
//  [typescript]
import * as fs from 'fs';

const args = fs.readFileSync("/dev/stdin", "utf8").split('\n')

const calc = (arr: number[]): number => {
  const ev = arr.map(v => (1 + v) / 2)
  const cs = [...Array(n).keys()].fill(0).map((_, i, arr) => !i ? ev[i] : arr[i-1] + ev[i])

  let max = 0
  for (let i = 0; i <= n - k; i++) {
    const sum = cs.slice(i, k+i).reduce((ac, cu) => ac + cu)
    if (sum > max) max = sum
  }
  return max
}

const [n, k] = args[0].split(" ").map(x => +x)
const p = args[1].split(" ").map(x => +x)

console.log(calc(p))
//  [typescript]
import * as fs from "fs";

const lines = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n")

const [all, choise] = lines[0].split(' ').map(Number)

const arr = lines[1].split(' ').map(Number)

const expectation = arr.map(n1 => (n1 + 1) / 2)

const res = expectation.reduce((r1, n1, i1) => {
  if (i1 <= choise - 1) return r1 + n1
  const x = n1 - expectation[i1 - choise]
  if (x > 0) return r1 + x
  return r1
}, 0)

console.log(res)
//  [python]
s = input()
max_count = 0
count = 0
for i in s:
    if i == "R":
        count += 1
    else:
        max_count = max(max_count, count)
        count = 0
max_count = max(max_count, count)
print(max_count)
//  [python]
# print(max([len(v) for v in input().split('S')]))

d = {
    'RRR': 3,
    'RRS': 2,
    'RSR': 1,
    'RSS': 1,
    'SRR': 2,
    'SRS': 1,
    'SSR': 1,
    'SSS': 0,
}
print(d[input()])
//  [python]
s = input()

if s == 'RRR':
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)
//  [python]
s = input("")
Ccnt = 0
Rcnt = 0

for i in range(len(s)-1):
    if s[i] == s[i+1] == "R":
        Ccnt += 1
for i in range(len(s)):
    if s[i] == "R":
        Rcnt += 1

if Ccnt > 0:
    print(Ccnt + 1)
elif Ccnt == 0 and Rcnt > 0:
    print(1)
//  [python]
def A():
    s = input()
    if s == 'SSS': print(3)
    elif s=='RSS' or s=='SSR': print(2)
    elif s=='RRR': print(0)
    else: print(1)

def B():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                s = a[i] + a[j] + a[k]
                if s > 2 * max(a[i], a[j], a[k]): cnt += 1
    print(cnt)

def C():
    x, k, d = map(int, input().split())
    if abs(x) > k * d:
        print(abs(x) - k*d)
    else:
        tm = abs(x) // d
        x = abs(x) % d
        k -= tm
        if k % 2 == 0:
            print(x)
        else:
            print(d-x)
A()
//  [python]
s = input()

if 'SSS' in s:
  ans = 3
elif 'SS' in s:
  ans = 2
elif 'S' in s:
  ans = 1
else:
  ans = 0
  
print(ans)
//  [java]
import java.util.*;
import java.io.*;
public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String input = sc.next();
        if(input.contains("RRR")) pw.println(3);
        else if(input.contains("RR")) pw.println(2);
        else if(input.contains("R")) pw.println(1);
        else pw.println(0);
        pw.close();
    }


    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException
        {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if(x.charAt(0) == '-')
            {
                neg = true;
                start++;
            }
            for(int i = start; i < x.length(); i++)
                if(x.charAt(i) == '.')
                {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                }
                else
                {
                    sb.append(x.charAt(i));
                    if(dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg?-1:1);
        }

        public boolean ready() throws IOException {return br.ready();}


    }
}
//  [java]
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String S = in.readLine();
		int count = 0;
		if (S.charAt(0) == 'R' && S.charAt(1) == 'R' && S.charAt(2) == 'R') {
			count = 3;
		} else if (S.charAt(0) == 'R' && S.charAt(1) == 'R') {
			count = 2;
		} else if (S.charAt(1) == 'R' && S.charAt(2) == 'R') {
			count = 2;
		} else {
			for (int i = 0; i < S.length(); ++i) {
				if (S.charAt(i) == 'R') {
					count = 1;
				}
			}
		}
		System.out.println(count);
	}

	void calc() {
	}

	void showResult() {
	}
}
//  [java]

import java.io.*;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) throws IOException {

        Scanner s = new Scanner(System.in);
        String word = s.next();
        int max=0,cnt=0;
        for(int i=0;i<word.length();i++){
            if(word.charAt(i)=='S'){
                max = Math.max(max,cnt);
                cnt=0;
            }
            else cnt++;
        }
        max = Math.max(max,cnt);

        System.out.println(max);

    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}
//  [java]
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
  Scanner scanner = new Scanner(System.in);
  String esu = scanner.next();
  int raincnt = 0;
  for(int i=0;i<3;i++){
    if(esu.charAt(i)=='R'){    
      raincnt++;
    }else{
      raincnt = 0;
    }
  }
  System.out.println(raincnt);
  
  }
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        
        int res=0;
        int count=0;
        for(int i=0; i<3; i++){
            if(S[i]=='R'){
                res++;
                count = res;
            }else{
                res = 0;
            }
        }
        
        System.out.println(res);
                
            
        
        
        
        
        
        }
    }
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        
        int res=0;
        int count=0;
        for(int i=0; i<3; i++){
            if(S[i]=='R'){
                res++;
            }else{
                count = res;
                res = 0;
            }
        }
        
        System.out.println(Math.max(count,res));
                
            
        
        
        
        
        
        }
    }
//  [cpp]
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    int cur = 0;
    forn (i, 0, 3) {
        if (s[i] == 'R') {
            ++cur;
            chkmax(ans, cur);
        } else {
            cur = 0;
        }
    }
    chkmax(ans, cur);
    cout << ans;
    return 0;
}
//  [cpp]
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
	char a[10];
	scanf("%s", a);
	int cnt = 0;
	int ans = 0;
	int len = strlen(a);
	for (int i = 0; i < len; i++) {
		if (a[i] == 'S') {
			cnt = 0;
		} else {
			cnt++;
			if (cnt > ans) {
				ans = cnt;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string S;
  cin >> S;
  if (S == "RRR") {
    cout << 3 << endl;
  } else if (S == "SRR" || S == "RRS") {
    cout << 2 << endl;
  } else if (S == "SSS") {
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
  
  return 0;
}
//  [cpp]
#include <iostream>
using namespace std;

int main(){
  string S;
  int n,i,c;
  
  cin >> S;
  n = S.size();
  c = 0;
  for(i=0;i<n;i++){
    if(S[i]=='R'){
      c+=1;
    }
  }

  cout << c << endl;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    bool p = s[0] == 'R';
    bool q = s[1] == 'R';
    bool r = s[2] == 'R';

    if (p && q && r)
    {
        cout << 3 << '\n';
    }
    else if (p && q || q && r || r && p)
    {
        cout << 2 << '\n';
    }
    else if (p || q || r)
    {
        cout << 1 << '\n';
    }
    else
    {
        cout << 0 << '\n';
    }

    return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    bool p = s[0] == 'R';
    bool q = s[1] == 'R';
    bool r = s[2] == 'R';

    if (p && q && r)
    {
        cout << 3 << '\n';
    }
    else if (p && q || q && r || r && p)
    {
        cout << 2 << '\n';
    }
    else if (p && q && r)
    {
        cout << 1 << '\n';
    }
    else
    {
        cout << 0 << '\n';
    }

    return 0;
}