package main

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

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  n := readInt()
  nonDecreasing := 1
  max := nonDecreasing
  preA := readInt()
  for i := 1; i < n; i++ {
    a := readInt()
    if preA <= a {
      nonDecreasing++
      if max < nonDecreasing {
        max = nonDecreasing
      }
    } else {
      nonDecreasing = 1
    }
    preA = a
  }

  fmt.Println(max)
}

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

package main

import (
    "fmt"
    //"strings"
    "bufio"
    "os"
    "strconv"
    "bytes"
    "io"
    )

func read_line() bytes.Buffer {
    reader := bufio.NewReader(os.Stdin)
    var buf bytes.Buffer
    /*
    for {
        line, prefix, err := reader.ReadLine()
        if len(line) > 0 {
            buf.Write(line)
        } else {
            break
        }
        if err != nil || err == io.EOF {
            break
        }
        if !prefix {
            fmt.Println("!prefix")
            break
        }
    }
    */
    for {
        p := make([]byte, 1024)
        bytes, err := reader.Read(p)
        if err == io.EOF || bytes == 0 {
            break
        }
        buf.Write(p)
        fmt.Println(p)
    }

    return buf
}

func read_line_scanner() string {
    scanner := bufio.NewScanner(os.Stdin)
    var line string
    for scanner.Scan() {
        fmt.Println(scanner.Text())
        line += scanner.Text()
    }

    return line
}

func main() {
    var n, i uint
    fmt.Scanf("%d\n", &n)

    seq := make([]int64, n, n)
    /*reader := bufio.NewReader(os.Stdin)
    for i = 0; i < n; i++ {
        str, _ := reader.ReadSlice(' ')
        seq[i], _ = strconv.ParseInt(string(str), 10, 64)
        fmt.Print(i, "-", str, ",")
    }*/
    bs := bufio.NewScanner(os.Stdin)
    bs.Split(bufio.ScanWords)

    for i = 0; i < n; i++ {
        bs.Scan()
        seq[i], _ = strconv.ParseInt(bs.Text(), 10, 64)
    }

/*
    var buf bytes.Buffer
    buf = read_line()

    line := buf.String()
    //line := read_line()
    fmt.Println("line len: ", len(line))

    strseq := strings.Split(line, " ")
    fmt.Println("strseq len: ", len(strseq))

    seq := make([]int64, n, n)
    for i = 0; i < n; i++ {
        seq[i], _ = strconv.ParseInt(strseq[i], 10, 64)
    }
*/

    //reader := bufio.NewReader(os.Stdin)
    //buf, _, _ := reader.ReadLine()

    //fmt.Println("buf len: ", len(buf))

    //line := string(buf)
    //fmt.Println("line len: ", len(line))

    //strseq := strings.Split(line, " ")
    //fmt.Println("strseq len: ", len(strseq))

    //line := read_line()
    //strseq := strings.Split(line, " ")

    //seq := make([]int64, n, n)
    ////for i = 0; i < n; i++ {
    //    seq[i], _ = strconv.ParseInt(strseq[i], 10, 64)
    //}

    maxlen := 1
    cur := 1
    for i = 1; i < n; i++ {
        if seq[i] >= seq[i-1] {
            cur++
        } else {
            cur = 1
        }

        if maxlen < cur {
            maxlen = cur
        }
    }

    fmt.Println(maxlen)
}

package main

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

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

func solve(arr []int, maxLength int, currentLength int, prevElement int) int {
	if prevElement == -1 {
		return solve(arr[1:], 1, 1, arr[0])
	}
	if len(arr) == 0 {
		return maxLength
	}
	if arr[0] >= prevElement {
		return solve(arr[1:], max(maxLength, currentLength + 1), currentLength + 1, arr[0])
	}
	return solve(arr[1:], maxLength, 1, arr[0])
}

func main() {
	reader, writer := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n int
    fmt.Fscanf(reader, "%d\n", &n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &arr[i])
	}
	fmt.Fprintf(writer, "%d\n", solve(arr, 0, 0, -1))
}

package main

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

var scanner *bufio.Scanner
func read() string {
    if !scanner.Scan() {
		panic("Scan returned false")
	}
	return scanner.Text()
}
func readInt() int {
	num, _ := strconv.Atoi(read())
	return num
}
func main() {
    scanner = bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    n := readInt()

    var no []int
    for i := 0 ; i < n; i++ {
        curr := readInt()

        no = append(no, curr)
    }

    loc := 1
    max := 0
    for i := 1 ; i < n; i++ {
        if no[i] >= no[i-1] {
            loc++
            continue
        }
        if max < loc {
            max = loc
        }
        loc = 1
    }
    if max < loc {
        max = loc
    }
    fmt.Println(max)
}

package main

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

func main() {
	var n int
	n, _ = readInt()

	var A = make([]int, n)
	for i := 0; i < n; i++ {
		A[i], _ = readInt()
	}

	ret := 1
	run := 1

	for i := 1; i < n; i++ {
		if A[i] >= A[i - 1] {
			run++
		} else {
			run = 1
		}

		if run > ret {
			ret = run
		}
	}

	fmt.Println(ret)
}

var scanner *bufio.Scanner

func init() {
		scanner = bufio.NewScanner(os.Stdin)
		scanner.Split(bufio.ScanWords)
}

func readInt() (int, error) {
	// scan for the next token
	if !scanner.Scan() {
		return -1, io.ErrUnexpectedEOF
	}
	// manually parse existing bytes without allocation
	i, err := atoi(scanner.Bytes())
	if err != nil {
		return -1, err
	}
	return i, nil
}

// atoi parses a buffer into an integer
// without overflow detection.
func atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

package main

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

func main() {
	var max, tmp, last, count int
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	line, _ = reader.ReadString('\n')
	arr := strings.Split(strings.TrimSpace(line), " ")
	for j := range arr {
		tmp, _ = strconv.Atoi(arr[j])
		if tmp < last {
			count = 1
		} else {
			count++
			if count > max {
				max = count
			}
		}
		last = tmp
	}
	fmt.Println(max)
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan() // drop n

	var max, count int
	prv := math.MaxInt32
	for scanner.Scan() {
		cur, _ := strconv.Atoi(scanner.Text())
		if prv > cur {
			if max < count {
				max = count
			}
			count = 0
		}
		prv = cur
		count++
	}
	if max < count {
		max = count
	}
	fmt.Println(max)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)

	profit := make([]int64, n)

	for i := 0; i < n; i++ {
		scanf("%d", &profit[i])
	}

	currentIndex := 1
	finalIndex := currentIndex

	for i := 1; i < n; i++ {
		if profit[i] >= profit[i-1] {
			currentIndex++
			if currentIndex > finalIndex {
				finalIndex = currentIndex
			}
		} else {
			currentIndex = 1
		}
	}

	printf("%d\n", finalIndex)
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
    defer out.Flush()
    var n, num, prev, max, temp int = 0, 0, 0, 0, 1

    fmt.Fscan(in,&n)
    for i := 0; i < n; i++ {
        fmt.Fscan(in,&num)

        if prev > num {
            temp = 1
        } else {
            if(i > 0){
                temp++
            }
        }

        if max < temp {
            max = temp
        }

        prev = num
    }

    fmt.Println(max)
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()

	var n, max, run, prev, curr rune
	fmt.Fscan(in, &n)

	for i := n; i > 0; i-- {
		fmt.Fscan(in, &curr)
		if prev <= curr {
			run++
		} else {
			if max < run {
				max = run
			}
			run = 1
		}
		prev = curr
	}
	if max < run {
		max = run
	}
	fmt.Println(max)
}

package main

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

var in = bufio.NewScanner(os.Stdin)

func readInt() int {
	if !in.Scan() {
		panic(in.Err())
	}
	res := 0
	for _, b := range in.Bytes() {
		res = res*10 + int(b-'0')
	}
	return res
}

func main() {
	in.Split(bufio.ScanWords)
	n := readInt()
	paskutinis := 0
	ats := 0
	dabartinis := 0
	for i := 0; i < n; i++ {
		a := readInt()
		if paskutinis <= a {
			dabartinis++
			if dabartinis > ats {
				ats = dabartinis
			}
		} else {
			dabartinis = 1
		}
		paskutinis = a
	}
	fmt.Println(ats)
}

package main

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

func main() {
	var n, cnt, x, dec, last int
	scr := bufio.NewReader(os.Stdin)
	ocr := bufio.NewWriter(os.Stdout)

	fmt.Fscan(scr, &n)

	for i := 0; i < n; i++ {
		fmt.Fscan(scr, &x)
		if i == 0 {
			last = x
			cnt++
		} else {
			if x >= last {
				last = x
				cnt++
			} else {
				last = x
				if dec < cnt {
					dec = cnt
				}
				cnt = 1
			}
		}
		if i == n-1 {
			if dec < cnt {
				dec = cnt
			}
		}
	}
	fmt.Fprint(ocr, dec)
	ocr.Flush()
}

package main;

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

func main() {
  var n int;
  in := bufio.NewReader(os.Stdin)
  fmt.Fscan(in, &n);
  var ans = 1;
  var cur = 1;
  var prev int;
  var a int;
  fmt.Fscan(in, &prev);
  for i := 1; i < n; i++ {
    fmt.Fscan(in, &a);
    if (a >= prev) {
      cur++;
    } else {
      cur = 1;
    }
    if (cur > ans) {
      ans = cur;
    }
    prev = a;
  }
  fmt.Println(ans);
}

package main

import "os"
import "bufio"
import "fmt"

func main() {
	var n, prev, curr int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	max, cmax := 1, 0
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &curr)
		if curr >= prev {
			cmax++
			if cmax > max {
				max = cmax
			}
		} else {
			cmax = 1
		}
		prev = curr
	}
	fmt.Println(max)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

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

func main() {
  defer writer.Flush()

  var n int
  scanf("%d\n", &n)

  arr := make([]int, n)
  for i:=0; i < n; i++ {
    scanf("%d", &arr[i])
  }

  _max, curr := 1, 1
  for i:=1; i < n; i++ {
    if arr[i] >= arr[i-1] {
      curr ++
    } else {
      curr = 1
    }
    _max = max(_max, curr)
  }
  printf("%d\n", _max)
}

package main

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

var (
	reader  = bufio.NewReader(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	currentLen, maxLen := 0, 1
	a, b := 1<<31-1, 0

	for ; n > 0; n-- {
		b = nextInt()
		if b >= a {
			currentLen++
		} else {
			currentLen = 1
		}

		if currentLen > maxLen {
			maxLen = currentLen
		}
		a = b
	}

	println(maxLen)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

func next() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

func main() {
	var n int
	fmt.Scan(&n)

	var max, current = 1, 1
	var a, b int

	fmt.Scan(&a)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	for i := 0; i < n-1; i++ {
		scanner.Scan()
		b, _ = strconv.Atoi(scanner.Text())
		if b < a {
			if current > max {
				max = current
			}

			current = 1
		} else {
			current++
		}

		a = b
	}

	if current > max {
		max = current
	}

	fmt.Println(max)
}

package main

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

// https://codeforces.com/problemset/problem/580/A

func main(){
    var n int
    in := bufio.NewReader(os.Stdin)

    line, _:= in.ReadString('\n')
    line = strings.TrimSpace(line)

    n, _ = strconv.Atoi(line)

    line, _= in.ReadString('\n')
    parts := strings.Fields(line)

    var curLen, maxLen int

    prevNum := 0
    for i := 0; i < n; i++ {
        var current int
        current, _ = strconv.Atoi(parts[i])
        if current >= prevNum {
            curLen++
        } else {
                if curLen > maxLen {
                    maxLen = curLen
                }
                curLen = 1

        }
        prevNum = current
    }

    if curLen > maxLen {
        maxLen = curLen
    }

    fmt.Println(maxLen)
}

package main

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

func main() {
	var n int
	fmt.Scanln(&n)

	line, _ := bufio.NewReader(os.Stdin).ReadString('\n')
	str_nums := strings.Split(strings.TrimSpace(line), " ")
	var nums []int
	for _, ns := range str_nums {
		tmp, er := strconv.Atoi(ns)
		if er == nil {
			nums = append(nums, tmp)
		}
	}

	prev_num := nums[0]
	max_len, cur_len := 1, 1
	for _, cur_num := range nums[1:] {
		if cur_num < prev_num {
			if cur_len > max_len {
				max_len = cur_len
			}
			cur_len = 0
		}
		prev_num = cur_num
		cur_len++
	}
	if cur_len > max_len {
		max_len = cur_len
	}
	fmt.Println(max_len)
}

// 580A - Codeforces Round #321 (Div. 2) - Kefa and First Steps
// Maximum non-decreasing subsegment of a sequence
package main

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

func max(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func main() {
    stdin := bufio.NewReader(os.Stdin)
    // Read the number of elements.
    var n int
    fmt.Fscanf(stdin, "%d\n", &n)

    // Read the n int.
    a := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Fscanf(stdin, "%d", &a[i])
    }

    // Longest subsegment in a.
    prev := 0
    acum := 0
    best := 0
    for i := 0; i < n; i++ {
        if a[i] >= prev {
            acum += 1
        } else {
            acum = 1
        }
        best = max(best, acum)
        prev = a[i]
    }

    fmt.Println(best)
}

package main

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

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  n, preA, max, nonDecreasing := readInt(), readInt(), 1, 1
  for i := 1; i < n; i++ {
    a := readInt()
    if preA <= a {
      nonDecreasing++
      if max < nonDecreasing {
        max = nonDecreasing
      }
    } else {
      nonDecreasing = 1
    }
    preA = a
  }

  fmt.Println(max)
}

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

package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	var a []int
	for i := 0; i < n; i++ {
		a = append(a, nextInt())
	}

	cnt := int64(1)
	max := int64(0)
	for i := 1; i < n; i++ {
		if a[i-1] > a[i] {
			max = Max(max, cnt)
			cnt = 1
		} else {
			cnt++
		}
	}
	max = Max(max, cnt)
	fmt.Println(max)
}

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

func Max(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    scanner.Scan()
    n, _ := strconv.Atoi(scanner.Text())
    len := 0
    y := -1
    et := 0
    for i:=0; i<n; i++{
        scanner.Scan()
        x, _ := strconv.Atoi(scanner.Text())
        if x >= y {
            len++
        } else {
            len = 1
        }
        y = x
        if et < len {
            et = len
        }

    }
    fmt.Println(et)
}

package main

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

func main() {
	var (
		n, length, longest, last, now int
		err                           error
	)
	scanner := bufio.NewScanner(os.Stdin)
	longest = 1

	fmt.Scanf("%d\n", &n)
	scanner.Split(bufio.ScanWords)

	for i := 0; i < n; i++ {
		if !scanner.Scan() {
			break
		}

		last = now
		now, err = strconv.Atoi(scanner.Text())
		if err != nil {
			fmt.Println(err.Error())
		}

		if now >= last {
			length++
			if length > longest {
				longest = length
			}
		} else {
			length = 1
		}
	}

	fmt.Println(longest)
}

package main

import(
    "fmt"
)

func main() {
    var n int
    fmt.Scanf("%d\n", &n)
    len := 0
    y := -1
    et := 0
    for i:=0; i<n; i++{
        var x int
        fmt.Scanf("%d", &x)
        if x >= y {
            len++
        } else {
            len = 1
        }
        y = x
        if et < len {
            et = len
        }

    }
    fmt.Println(et)
}

// http://acm.timus.ru/problem.aspx?space=1&num=1741
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

const (
	MOD = 1e9 + 7
)

type (

)

func max(a, b int ) int {
	if a > b {
		return a
	}

	return b
}

func main () {
	var (
		n int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscanln(input, &n)

	m := make([]int, n)
	ma := 0
	cnt := 0
	fmt.Fscan(input, &m[0])
	for i := 1; i < n; i++ {
		fmt.Fscan(input, &m[i])

		if m[i] >= m[i - 1] {
			cnt++
		} else {
			ma = max(ma, cnt)
			cnt = 0
		}
	}

	ma = max(ma, cnt)
	fmt.Println(ma + 1)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
)

const INF  = 1000000001

type Pair struct {
	first, second int
}

func sort(arr []int) []int {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i] < arr[right] {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort(arr[:left])
	sort(arr[left+1:])
	return arr
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func solution(reader io.Reader, writer io.Writer) {
	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	var p, s, r int
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscanf(reader, "%d", &a)
		if a >= p {
			s++
		} else {
			s = 1
		}
		p = a
		r = max(r, s)
	}
	fmt.Println(r)
}

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)
	defer writer.Flush()

	solution(reader, writer)
}

package main

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

func main() {
	var scanner *bufio.Scanner
	var lines []string
	var previous, current int
	const bufferLimit = 1200000
	var buffer []byte
	var localMax, max = 1, 1

	scanner = bufio.NewScanner(os.Stdin)
	buffer = make([]byte, bufferLimit)
	scanner.Buffer(buffer, bufferLimit)

	for scanner.Scan() {
		lines = append(lines, scanner.Text())
	}

	for i, str := range strings.Fields(lines[1]) {
		if i == 0 {
			previous, _ = strconv.Atoi(str)
		} else {
			current, _ = strconv.Atoi(str)
			if current >= previous {
				localMax++
				if localMax > max {
					max = localMax
				}
			} else {
				localMax = 1
			}
			previous = current
		}
	}

	fmt.Println(max)
}

package main

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

var (
	n int
	a []int
)

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func longest_non_descreasing() int {
	max_length, current := 0, 0
	for i := 0; i < n; i++ {
		if i == 0 || a[i-1] <= a[i] {
			current += 1
		} else {
			current = 1
		}
		max_length = max(max_length, current)
	}
	return max_length
}

func main() {
	// file, _ := os.Open("input.txt")
	file := os.Stdin
	f := bufio.NewReader(file)
	fmt.Fscanf(f, "%d\n", &n)
	a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%d", &a[i])
	}
	fmt.Println(longest_non_descreasing())
}

package main

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

// https://codeforces.com/problemset/problem/580/A
// A. Kefa and First Steps
// time limit per test
// 2 seconds
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is its continuous fragment. A subsegment of numbers is called non-decreasing if all numbers in it follow in the non-decreasing order.

// Help Kefa cope with this task!
// Input

// The first line contains integer n (1 ≤ n ≤ 105).

// The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
// Output

// Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.

func main() {
	bufStdin := bufio.NewReader(os.Stdin)

	var n int
	_, _ = fmt.Fscan(bufStdin, &n)

	as := make([]int, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscan(bufStdin, &as[i])
	}

	bestStreak := 1
	curStreak := 1
	prevVal := as[0]

	for i := 1; i < n; i++ {
		v := as[i]

		if v >= prevVal {
			curStreak++
			if curStreak > bestStreak {
				bestStreak = curStreak
			}
		} else {
			curStreak = 1
		}

		prevVal = v
	}

	_, _ = fmt.Print(bestStreak)
}

package main

import "fmt"

func main() {
    var n int
    fmt.Scan(&n)

    var v [100005]int

    last := 0
    now := 0
    best := 0

    for i := 0; i < n; i++ {
        fmt.Scan(&v[i]);

        if v[i] >= last {
            last = v[i]
            now++
            if now > best {
                best = now
            }
        } else {
            now = 1
            last = v[i]
        }
    }

    fmt.Println(best)
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

type number struct {
	begin int
	end   int
}

func compareNumbers(a []byte, left number, right number) int {
	if (left.end - left.begin) > (right.end - right.begin) {
		return 1
	} else if (left.end - left.begin) < (right.end - right.begin) {
		return -1
	}
	diff := right.begin - left.begin
	for i := left.begin; i < left.end; i += 1 {
		if a[i] > a[i+diff] {
			return 1
		} else if a[i] < a[i+diff] {
			return -1
		}
	}
	return 0
}

// https://codeforces.com/problemset/problem/580/A
// комментарии к решению
// т.к. числа достаточно большие и их много, то fmt.Scan не справляется,
// поэтому необходимо сравнивать их посимвольно, либо использовать strconv.atoi
// Сравнение строк-чисел достаточно простая операция, которой учат в первых главах K&R,
// поэтому с небольшой модификацией для исключения alloc получаем compareNumbers(),
// которую используем для сравнения чисел
// Алгоритм простой:
// 0) постоянно проверяем на < len(a) чтобы не словить out of index
// 1) запоминаем позицию последнего считанного числа
// 2) находим следующее
// 3) сравниваем
// 4) go to 0
func taskSolution(a []byte) int {
	// trim spaces
	first, last := 0, len(a)-1
	for first < len(a) && !(a[first] >= '0' && a[first] <= '9') {
		first += 1
	}
	for last > 0 && !(a[last] >= '0' && a[last] <= '9') {
		last -= 1
	}
	// because of space after each number: "1 "
	// we need to move "last" for +1
	// to prevent compares between last 2 numbers as "1 " and "1"
	// anyway algo compareNumbers() compares to len-1 to ignore last space
	last += 1
	// find first number
	currLen, maxLen := 1, 1
	right := number{begin: first, end: first}
	for right.end <= last && a[right.end] >= '0' && a[right.end] <= '9' {
		right.end += 1
	}
	// iterate numbers
	for right.end <= last {
		left := right
		// find next number
		right.begin = left.end + 1
		right.end = left.end + 1
		for right.end <= last && a[right.end] >= '0' && a[right.end] <= '9' {
			right.end += 1
		}
		// compare
		if right.end <= last && compareNumbers(a, left, right) <= 0 {
			currLen += 1
			if maxLen < currLen {
				maxLen = currLen
			}
		} else {
			currLen = 1
		}
	}
	return maxLen
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw))
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

type number struct {
	begin int
	end   int
}

func compareNumbers(a []byte, left number, right number) int {
	if (left.end - left.begin) > (right.end - right.begin) {
		return 1
	} else if (left.end - left.begin) < (right.end - right.begin) {
		return -1
	}
	diff := right.begin - left.begin
	for i := left.begin; i < left.end; i += 1 {
		if a[i] > a[i+diff] {
			return 1
		} else if a[i] < a[i+diff] {
			return -1
		}
	}
	return 0
}

// https://codeforces.com/problemset/problem/580/A
// комментарии к решению
// т.к. числа достаточно большие и их много, то fmt.Scan не справляется,
// поэтому необходимо сравнивать их посимвольно, либо использовать strconv.atoi
// Сравнение строк-чисел достаточно простая операция, которой учат в первых главах K&R,
// поэтому с небольшой модификацией для исключения alloc получаем compareNumbers(),
// которую используем для сравнения чисел
// Алгоритм простой:
// 0) постоянно проверяем на < len(a) чтобы не словить out of index
// 1) запоминаем позицию последнего считанного числа
// 2) находим следующее
// 3) сравниваем
// 4) go to 0
func taskSolution(a []byte) int {
	currLen, maxLen := 1, 1
	right := number{begin: 0, end: 0}
	// find first number
	right.end = right.begin
	for right.end < len(a) && a[right.end] >= '0' && a[right.end] <= '9' {
		right.end += 1
	}
	// iterate numbers
	for right.end < len(a) {
		left := right
		// find next number
		right.begin = left.end + 1
		right.end = left.end + 1
		for right.end < len(a) && a[right.end] >= '0' && a[right.end] <= '9' {
			right.end += 1
		}
		// compare
		if compareNumbers(a, left, right) <= 0 {
			currLen += 1
			if maxLen < currLen {
				maxLen = currLen
			}
		} else {
			currLen = 1
		}
	}
	return maxLen
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(bytes.TrimSpace(inRaw)))
}

package main

// https://codeforces.com/problemset/problem/580/A

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

type number struct {
	begin int
	end   int
}

func compareNumbers(a []byte, left number, right number) int {
	if (left.end - left.begin) > (right.end - right.begin) {
		return 1
	} else if (left.end - left.begin) < (right.end - right.begin) {
		return -1
	}
	diff := right.begin - left.begin
	for i := left.begin; i < left.end; i += 1 {
		if a[i] > a[i+diff] {
			return 1
		} else if a[i] < a[i+diff] {
			return -1
		}
	}
	return 0
}

func taskSolution(a []byte) int {
	currentLen := 1
	maxLen := 1
	left := number{}
	right := number{0, 1}
	// find first number
	for right.end < len(a) && a[right.end] != ' ' {
		right.end += 1
	}
	for right.end < len(a) {
		left = right
		//find next number
		right.begin = left.end + 1
		right.end = left.end + 1
		for right.end < len(a) && a[right.end] != ' ' {
			right.end += 1
		}
		//compare
		if compareNumbers(a, left, right) <= 0 {
			currentLen += 1
		} else {
			currentLen = 1
		}
		if maxLen < currentLen {
			maxLen = currentLen
		}
		left = right
	}
	if maxLen < currentLen {
		return currentLen
	}
	return maxLen
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(bytes.TrimSpace(inRaw)))
}

package main

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

type MyScan struct {
	iscan *bufio.Scanner
}

func NewScan() *MyScan {
	newscanner := bufio.NewScanner(os.Stdin)
	newscanner.Split(bufio.ScanWords)
	var myscan MyScan
	myscan.iscan = newscanner
	return &myscan
}
func (myscan *MyScan) NextInt() int {
	myscan.iscan.Scan()
	text := myscan.iscan.Text()
	n, _ := strconv.Atoi(text)
	return n
}
func (myscan *MyScan) NextMultiInt(n int) []int {
	numbers := make([]int, n+1, n+1)
	var text string
	for idx := 0; idx != n; idx++ {
		myscan.iscan.Scan()
		text = myscan.iscan.Text()
		numbers[idx+1], _ = strconv.Atoi(text)
	}
	return numbers
}

type Ele struct {
	NowMax  int  // 当前最大
	Nowlian int  // 以当前元素结尾的最大
	Nowend  bool // 当前最大是否在结尾
}

func main() {
	var N int
	myscan := NewScan()
	N = myscan.NextInt()
	numbers := myscan.NextMultiInt(N)
	// fmt.Println(numbers)
	///////////////////////////////////////////////
	var info Ele
	info.NowMax = 1
	info.Nowlian = 1
	info.Nowend = true
	for idx := 2; idx != len(numbers); idx++ {
		if numbers[idx] >= numbers[idx-1] {
			info.Nowlian++
			if info.Nowend {
				info.NowMax++
			} else {
				if info.Nowlian >= info.NowMax {
					info.NowMax = info.Nowlian
					info.Nowend = true
				}
			}
		} else {
			info.Nowlian = 1
			if info.NowMax == 1 {
				info.Nowend = true
			} else {
				info.Nowend = false
			}
		}
	}
	fmt.Println(info.NowMax)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n, temp int
	fmt.Fscanf(reader, "%d\n", &n)
	arr := make([]int, 0)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &temp)
		arr = append(arr, temp)
	}
	fmt.Fscanf(reader, "\n")
	maxLen := 1
	curLen := 1
	for i := 1; i < n; i++ {
		if arr[i] >= arr[i-1] {
			curLen = curLen + 1
		} else {
			if maxLen < curLen {
				maxLen = curLen
			}
			curLen = 1
		}
	}
	if maxLen < curLen {
		maxLen = curLen
	}
	fmt.Fprintf(writer, "%d\n", maxLen)
}

package main

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

func main() {

	var n int
	fmt.Scanln(&n)
	var arr [100005]int
	var arrs []string
	arr[0] = -1
	max := 0
	t := 0

	reader := bufio.NewReader(os.Stdin)
	result, _ := reader.ReadString('\n')
	arrs = strings.Split(result, " ")
	arrs[n-1] = strings.TrimSpace(arrs[n-1])
	for i := 1; i <= n; i++ {
		arr[i], _ = strconv.Atoi(arrs[i-1])
		if arr[i] >= arr[i-1] {
			t++
			if t > max {
				max = t
			}
		} else {
			t = 1
		}

	}

	fmt.Println(max)

}

package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt(sc)
	}
	maxlen, nowlen := 1, 1
	for i := 1; i < n; i++ {
		if a[i-1] <= a[i] {
			nowlen++
			maxlen = max(maxlen, nowlen)
		} else {
			nowlen = 1
		}
	}
	fmt.Println(maxlen)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	n,_,_:= reader.ReadLine()
	nInt,_:= strconv.Atoi(string(n))

	inta := make([]int, nInt)
	for i:=0;i<nInt; i++ {
		scanf("%d",&inta[i])
	}

	var max int = 1

	for i := 0; i < len(inta); i++ {
		var temp int = 1
		var k int = i
		for j := i + 1; j < len(inta); j++ {
			if inta[j] >= inta[j-1] {
				temp++
				k++
			} else {
				break
			}
		}
		i=k
		if temp > max {
			max = temp
		}
	}

	fmt.Println(max)

}

package main

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

var n int
var a []int

func main() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader := bufio.NewReaderSize(stdin, 1<<20)
	fmt.Fscanf(reader, "%d\n", &n)

	a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	sum := 1
	ans := 1
	for i := 1; i < n; i++ {
		if a[i] >= a[i-1] {
			sum++
		} else {
			sum = 1
		}
		if sum > ans {
			ans = sum
		}
	}

	fmt.Println(ans)
}

package main

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

func main() {
	var n, current, max, i int64
	fmt.Scanln(&n)

	var line string
	scanner := bufio.NewScanner(os.Stdin)

	buf := make([]byte, 0, 64*1024)
	scanner.Buffer(buf, 2048*1024)

	if scanner.Scan() {
		line = scanner.Text()
	}

	strList := strings.Split(line, " ")
	list := make([]int, n)

	for i = 0; i < n; i++ {
		list[i], _ = strconv.Atoi(strList[i])
	}

	current = 1
	max = 1
	for i = 1; i < n; i++ {
		if list[i] >= list[i-1] {
			current++
		} else {
			current = 1
		}

		if current > max {
			max = current
		}
	}

	fmt.Println(max)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	var max int
	cur := 1
	for i := 1; i < n; i++ {
		if a[i] >= a[i-1] {
			cur++
		} else {
			if cur > max {
				max = cur
			}
			cur = 1
		}
	}
	if cur > max {
		max = cur
	}
	fmt.Print(max)
}

package main

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

func main() {

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())

	b, c1, c2 := 0, 0, 0

	for i := 0; i < n; i++ {
		scanner.Scan()
		a, _ := strconv.Atoi(scanner.Text())
		if a >= b {
			c1++
		} else {
			c1 = 1
		}
		if c1 > c2 {
			c2 = c1
		}
		b = a
	}
	fmt.Println(c2)
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()

	var n, max, run, prev, curr rune
	fmt.Fscan(in, n)

	for i := rune(0); i < n; i++ {
		fmt.Fscan(in, curr)
		if prev <= curr {
			run++
		} else if max < run {
			max = run
		}
	}
	if max < run {
		max = run
	}
	out.WriteRune(max)
}

package main

import (
	"fmt"
)

func main() {
	var n, cnt, x, dec, last int

	fmt.Scanln(&n)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x)
		if i == 0 {
			last = x
			cnt++
		} else {
			if x >= last {
				last = x
				cnt++
				if i == n-1 {
					if dec < cnt {
						dec = cnt
					}
				}
			} else {
				last = x
				if dec < cnt {
					dec = cnt
				}
				cnt = 1
			}
		}
	}
	fmt.Println(dec)
}

package main

import (
	"fmt"
)

func main() {
	var n, cnt, x, dec, last int

	fmt.Scanln(&n)
	fmt.Scanf("%d", &x)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x)
		if i == 0 {
			last = x
			cnt++
		} else {
			if x >= last {
				last = x
				cnt++
			} else {
				last = x
				if dec < cnt {
					dec = cnt
				}
				cnt = 1
			}
		}
		if i == n-1 {
			if dec < cnt {
				dec = cnt
			}
		}
	}
	fmt.Println(dec)
}

package main

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

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  n := readInt()
  max := 0
  nonDecreasing := 1
  preA := readInt()
  for i := 1; i < n; i++ {
    a := readInt()
    if preA <= a {
      nonDecreasing++
      if max < nonDecreasing {
        max = nonDecreasing
      }
    } else {
      nonDecreasing = 1
    }
    preA = a
  }

  fmt.Println(max)
}

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

package main

import(
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	len := 0
	y := -1
	et := 0
	for i:=0; i<n; i++{
		var x int
		fmt.Scanf("%d", &x)
		if x >= y {
			len++
		} else {
			len = 1
		}
		y = x
		if et < len {
			et = len
		}
	}
	fmt.Println(et)
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"strconv"
	"strings"
)

type Ele struct {
	NowMax  int  // 当前最大
	Nowlian int  // 以当前元素结尾的最大
	Nowend  bool // 当前最大是否在结尾
}

func main() {
	data, _ := ioutil.ReadAll(os.Stdin)
	for idx := range data {
		if data[idx] == '\n' {
			data[idx] = ' '
		}
	}
	s := string(data)
	segs := strings.Split(s, " ")
	segs = segs[1:]
	numbers := make([]int, len(segs)+1, len(segs)+1)
	for idx := range segs {
		numbers[idx+1], _ = strconv.Atoi(segs[idx])
	}
	// fmt.Println(numbers)
	///////////////////////////////////////////////
	var info Ele
	info.NowMax = 1
	info.Nowlian = 1
	info.Nowend = true
	for idx := 2; idx != len(numbers); idx++ {
		if numbers[idx] >= numbers[idx-1] {
			info.Nowlian++
			if info.Nowend {
				info.NowMax++
			} else {
				if info.Nowlian >= info.NowMax {
					info.NowMax = info.Nowlian
					info.Nowend = true
				}
			}
		} else {
			info.Nowlian = 1
			if info.NowMax == 1 {
				info.Nowend = true
			} else {
				info.Nowend = false
			}
		}
	}
	fmt.Println(info.NowMax)
}

package main

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

type Ele struct {
	NowMax  int  // 当前最大
	Nowlian int  // 以当前元素结尾的最大
	Nowend  bool // 当前最大是否在结尾
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	hangyi := scanner.Text()
	N, _ := strconv.Atoi(hangyi)
	scanner.Scan()
	s := scanner.Text()
	segs := strings.Split(s, " ")
	numbers := make([]int, len(segs)+1, len(segs)+1)
	for idx := range segs {
		numbers[idx+1], _ = strconv.Atoi(segs[idx])
	}
	if N == 10000 {
		fmt.Println(len(numbers))
		return
	}
	///////////////////////////////////////////////
	var info Ele
	info.NowMax = 1
	info.Nowlian = 1
	info.Nowend = true
	for idx := 2; idx != len(numbers); idx++ {
		if numbers[idx] >= numbers[idx-1] {
			info.Nowlian++
			if info.Nowend {
				info.NowMax++
			} else {
				if info.Nowlian >= info.NowMax {
					info.NowMax = info.Nowlian
					info.Nowend = true
				}
			}
		} else {
			info.Nowlian = 1
			if info.NowMax == 1 {
				info.Nowend = true
			} else {
				info.Nowend = false
			}
		}
	}
	fmt.Println(info.NowMax)
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"strconv"
	"strings"
)

type Ele struct {
	NowMax  int  // 当前最大
	Nowlian int  // 以当前元素结尾的最大
	Nowend  bool // 当前最大是否在结尾
}

func main() {
	data, _ := ioutil.ReadAll(os.Stdin)
	for idx := range data {
		if data[idx] == '\n' {
			data[idx] = ' '
		}
	}
	s := string(data)
	segs := strings.Split(s, " ")
	numbers := make([]int, len(segs), len(segs))
	for idx := range segs[1:] {
		numbers[idx+1], _ = strconv.Atoi(segs[idx])
	}
	///////////////////////////////////////////////
	var info Ele
	info.NowMax = 1
	info.Nowlian = 1
	info.Nowend = true
	for idx := 2; idx != len(numbers); idx++ {
		if numbers[idx] >= numbers[idx-1] {
			info.Nowlian++
			if info.Nowend {
				info.NowMax++
			} else {
				if info.Nowlian >= info.NowMax {
					info.NowMax = info.Nowlian
					info.Nowend = true
				}
			}
		} else {
			info.Nowlian = 1
			if info.NowMax == 1 {
				info.Nowend = true
			} else {
				info.Nowend = false
			}
		}
	}
	fmt.Println(info.NowMax)
}

package main

import (
	"fmt"
)

type Ele struct {
	NowMax  int  // 当前最大
	Nowlian int  // 以当前元素结尾的最大
	Nowend  bool // 当前最大是否在结尾
}

func main() {
	var N int
	fmt.Scanf("%d", &N)
	numbers := make([]int, N+1, N+1)
	for idx := 0; idx != N; idx++ {
		fmt.Scanf("%d", &numbers[idx+1])
	}
	// fmt.Println(numbers)
	///////////////////////////////////////////////
	var info Ele
	info.NowMax = 1
	info.Nowlian = 1
	info.Nowend = true
	for idx := 2; idx != len(numbers); idx++ {
		if numbers[idx] >= numbers[idx-1] {
			info.Nowlian++
			if info.Nowend {
				info.NowMax++
			} else {
				if info.Nowlian >= info.NowMax {
					info.NowMax = info.Nowlian
					info.Nowend = true
				}
			}
		} else {
			info.Nowlian = 1
			if info.NowMax == 1 {
				info.Nowend = true
			} else {
				info.Nowend = false
			}
		}
	}
	fmt.Println(info.NowMax)
}

package main

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

type Ele struct {
	NowMax  int  // 当前最大
	Nowlian int  // 以当前元素结尾的最大
	Nowend  bool // 当前最大是否在结尾
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Scan()
	s := scanner.Text()
	segs := strings.Split(s, " ")
	numbers := make([]int, len(segs)+1, len(segs)+1)
	for idx := range segs {
		numbers[idx+1], _ = strconv.Atoi(segs[idx])
	}
	///////////////////////////////////////////////
	var info Ele
	info.NowMax = 1
	info.Nowlian = 1
	info.Nowend = true
	for idx := 2; idx != len(numbers); idx++ {
		if numbers[idx] >= numbers[idx-1] {
			info.Nowlian++
			if info.Nowend {
				info.NowMax++
			} else {
				if info.Nowlian >= info.NowMax {
					info.NowMax = info.Nowlian
					info.Nowend = true
				}
			}
		} else {
			info.Nowlian = 1
			if info.NowMax == 1 {
				info.Nowend = true
			} else {
				info.Nowend = false
			}
		}
	}
	fmt.Println(info.NowMax)
}

package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt(sc)
	}
	maxlen, nowlen := 0, 1
	for i := 1; i < n; i++ {
		if a[i-1] <= a[i] {
			nowlen++
			maxlen = max(maxlen, nowlen)
		} else {
			nowlen = 1
		}
	}
	fmt.Println(maxlen)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	n,_,_:= reader.ReadLine()
	strconv.Atoi(string(n))

	data,_:=reader.ReadString('\n')
	dataArray:= strings.Split(strings.TrimSuffix(string(data),"\n")," ")
	inta := make([]int, len(dataArray))
	for i:=0;i<len(dataArray); i++ {
		inta[i],_= strconv.Atoi(dataArray[i])
	}

	var max int = 1

	for i := 0; i < len(inta); i++ {
		var temp int = 1
		var k int = i
		for j := i + 1; j < len(inta); j++ {
			if inta[j] >= inta[k] {
				temp++
				k++
			} else {
				break
			}
		}
		if temp > max {
			max = temp
		}
	}

	fmt.Println(max)

}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	var n int
	scanf("%d", &n)

	inta := make([]int, n)
	for i:=0;i<n; i++ {
		scanf("%d",&inta[i])
	}

	var max int = 1

	for i := 0; i < len(inta); i++ {
		var temp int = 1
		var k int = i
		for j := i + 1; j < len(inta); j++ {
			if inta[j] >= inta[k] {
				temp++
				k++
			} else {
				break
			}
		}
		if temp > max {
			max = temp
		}
	}

	fmt.Println(max)

}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	n,_,_:= reader.ReadLine()
	strconv.Atoi(string(n))

	data,_,_:=reader.ReadLine()
	dataArray:= strings.Split(strings.TrimSpace(string(data))," ")
	inta := make([]int, len(dataArray))
	for i:=0;i<len(dataArray); i++ {
		inta[i],_= strconv.Atoi(dataArray[i])
	}

	var max int = 1

	for i := 0; i < len(inta); i++ {
		var temp int = 1
		var k int = i
		for j := i + 1; j < len(inta); j++ {
			if inta[j] >= inta[k] {
				temp++
				k++
			} else {
				break
			}
		}
		if temp > max {
			max = temp
		}
	}

	fmt.Println(max)

}

package main

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

var n int
var a []int

func main() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader := bufio.NewReaderSize(stdin, 1<<20)
	fmt.Fscanf(reader, "%d\n", &n)

	a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	sum := 1
	ans := 0
	for i := 1; i < n; i++ {
		if a[i] >= a[i-1] {
			sum++
		} else {
			sum = 1
		}
		if sum > ans {
			ans = sum
		}
	}

	fmt.Println(ans)
}

package main

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

func main() {
	var n, current, max, i int64
	fmt.Scanln(&n)

	var line string
	scanner := bufio.NewScanner(os.Stdin)

	buf := make([]byte, 0, 64*1024)
	scanner.Buffer(buf, 2048*1024)

	if scanner.Scan() {
		line = scanner.Text()
	}

	strList := strings.Split(line, " ")
	list := make([]int, n)

	for i = 0; i < n; i++ {
		list[i], _ = strconv.Atoi(strList[i])
	}

	current = 1
	max = 0
	for i = 1; i < n; i++ {
		if list[i] >= list[i-1] {
			current++
		} else {
			current = 1
		}

		if current > max {
			max = current
		}
	}

	fmt.Println(max)
}

package main

import (
	"fmt"
)

func main() {
	var n, a, b, c1, c2, i int64 = 0, 0, 0, 1, 0, 0
	fmt.Scan(&n)

	fmt.Scan(&b)
	for ; i < n-1; i++ {
		fmt.Scan(&a)
		if a >= b {
			c1++
		} else {
			c1 = 1
		}
		if c1 > c2 {
			c2 = c1
		}
		b = a
	}
	fmt.Println(c2)
}

package main

import "fmt"

func main() {
    var n, i uint
    fmt.Scan(&n)

    seq := make([]uint64, n, n)
    for i = 0; i < n; i++ {
        fmt.Scanf("%d", &seq[i])
    }

    maxlen := 1
    cur := 1
    for i = 1; i < n; i++ {
        if seq[i] >= seq[i-1] {
            cur++
        } else {
            cur = 1
        }

        if maxlen < cur {
            maxlen = cur
        }
    }

    fmt.Println(maxlen)
}

package main

import (
    "fmt"
    "strings"
    "bufio"
    "os"
    )

func main() {
    var n, i uint
    fmt.Scanf("%d\n", &n)

    reader := bufio.NewReader(os.Stdin)
    buf, _, _ := reader.ReadLine()

    line := string(buf)

    //var line string
    //fmt.Scanln(&line)

    seq := strings.Split(line, " ")
    //seq := line
    //fmt.Print(seq)

    //seq := make([]uint64, n, n)
    //for i = 0; i < n; i++ {
        //if i != n-1 {
        //    fmt.Scanf("%d", &seq[i])
        //} else {
        //    fmt.Scanf("%d\n", &seq[i])
        //}
        //fmt.Scan(&seq[i])
    //}

    maxlen := 1
    cur := 1
    for i = 1; i < n; i++ {
        if seq[i] >= seq[i-1] {
            cur++
        } else {
            cur = 1
        }

        if maxlen < cur {
            maxlen = cur
        }
    }

    fmt.Println(maxlen)
}

package main

import "fmt"

func main() {
    var n, i uint
    fmt.Scan(&n)

    seq := make([]uint64, n, n)
    for i = 0; i < n; i++ {
        if i != n-1 {
            fmt.Scanf("%d", &seq[i])
        } else {
            fmt.Scanf("%d\n", &seq[i])
        }
    }

    maxlen := 1
    cur := 1
    for i = 1; i < n; i++ {
        if seq[i] >= seq[i-1] {
            cur++
        } else {
            cur = 1
        }

        if maxlen < cur {
            maxlen = cur
        }
    }

    fmt.Println(maxlen)
}

package main
import "fmt"

func main()  {
	var n int
	fmt.Scanf("%d", &n)

	var A = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&A[i])

		fmt.Println(A[i])
	}

	ret := 1
	run := 1

	for i := 1; i < n; i++ {
		if A[i] >= A[i - 1] {
			run++
		} else {
			run = 1
		}

		if run > ret {
			ret = run
		}
	}

	fmt.Println(ret)
}

package main
import "fmt"

func main()  {
	var n int
	fmt.Scanf("%d", &n)

	var A = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &A[i])
	}

	ret := 1
	run := 1

	for i := 1; i < n; i++ {
		if A[i] >= A[i - 1] {
			run++
		}

		if run > ret {
			ret = run
		} else {
			run = 1
		}
	}

	fmt.Println(ret)
}

package main
import "fmt"

func main()  {
	var n int
	fmt.Scanf("%d", &n)

	var A = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &A[i])
	}

	ret := 1
	run := 1

	for i := 1; i < n; i++ {
		if A[i] >= A[i - 1] {
			run++
		} else {
			run = 1
		}

		if run > ret {
			ret = run
		}
	}

	fmt.Println(ret)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)

	profit := make([]int, n)

	for i := 0; i < n; i++ {
		if _, err := fmt.Scanf("%d", &profit[i]); err != nil {
			panic(err)
		}
	}

	cur := profit[0]
	max := cur

	currentIndex := 1
	finalIndex := currentIndex

	for i := 1; i < n; i++ {
		if profit[i] >= profit[i-1] {
			currentIndex++
			cur = cur + profit[i]
			if cur > max {
				finalIndex = currentIndex
				max = cur
			}
		} else {
			currentIndex = 1
			cur = profit[i]
		}
	}

	fmt.Print(finalIndex)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)

	profit := make([]int, n)

	for i := 0; i < n; i++ {
		if _, err := fmt.Scanf("%d", &profit[i]); err != nil {
			panic(err)
		}
	}

	cur := profit[0]
	max := cur

	currentIndex := 1
	finalIndex := 0

	for i := 1; i < n; i++ {
		if profit[i] >= profit[i-1] {
			currentIndex++
			cur = cur + profit[i]
			if cur > max {
				finalIndex = currentIndex
				max = cur
			}
		} else {
			currentIndex = 1
			cur = profit[i]
		}
	}

	fmt.Print(finalIndex)
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
    defer out.Flush()
    var n, num, prev, max, temp int = 0, 0, 0, 0, 1

    fmt.Fscan(in,&n)
    for i := 0; i < n; i++ {
        fmt.Scan(in,&num)

        if prev > num {
            temp = 1
        } else {
            if(i > 0){
                temp++
            }
        }

        if max < temp {
            max = temp
        }

        prev = num
    }

    fmt.Println(max)
}

package main

import (
	"fmt"
)

func main() {
	var n, num, prev, max int = 0, 0, 0, 0
	var temp int = 1

	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&num)
		if max < temp {
			max = temp
		}
		if prev > num {
			temp = 1
		} else {
			temp++
		}
		prev = num
	}

	fmt.Printf("%d", max)
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
    defer out.Flush()
    var n, num, prev, max, temp int = 0, 0, 0, 0, 0

    fmt.Fscan(in,&n)
    for i := 0; i < n; i++ {
        fmt.Scan(in,&num)

        if prev > num {
            temp = 1
        } else {
            if(i > 0){
                temp++
            }
        }

        if max < temp {
            max = temp
        }

        prev = num
    }

    fmt.Println(max)
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
    defer out.Flush()
    var n, num, prev, max, temp int = 0, 0, 0, 0, 0

    fmt.Fscan(in,&n)
    for i := 0; i < n; i++ {
        fmt.Scan(in,&num)

        if prev > num {
            temp = 1
        } else {
            temp++
        }

        if max < temp {
            max = temp
        }

        prev = num
    }

    fmt.Println(max)
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
    defer out.Flush()
    var n, num, prev, max, temp int = 0, 0, 0, 0, 0

    fmt.Fscan(in,&n)
    for i := 0; i < n; i++ {
        fmt.Scan(in,&num)

        if prev > num {
            temp = 1
        } else {
            temp++
        }

        if max < temp {
            max = temp
        }

        prev = num
    }

    fmt.Println("%d", max)
}

package main;

import (
  "fmt"
)

func main() {
  var n int;
  fmt.Scanf("%d", &n);
  var ans = 1;
  var cur = 1;
  var prev int;
  fmt.Scanf("%d", &prev);
  for i := 1; i < n; i++ {
    var a int;
    fmt.Scanf("%d", &a);
    if (a >= prev) {
      cur++;
    } else {
      cur = 1;
    }
    if (cur > ans) {
      ans = cur;
    }
    prev = a;
  }
  fmt.Printf("%d", ans);
}

package main

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

func main() {
	var n int
	fmt.Scanf("%d", &n)

	var max, current = 1, 1
	var a, b int

	fmt.Scanf("%d", &a)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	for i := 0; i < n-1; i++ {
		scanner.Scan()
		b, _ = strconv.Atoi(scanner.Text())
		if b < a {
			if current > max {
				max = current
			}

			current = 1
		} else {
			current++
		}

		a = b
	}

	if current > max {
		max = current
	}

	print(max)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	var maxSeq = 1
	var current = 1

	var a, b int

	fmt.Scanf("%d", &a)

	for i := 0; i < n-1; i++ {
		fmt.Scanf("%d", &b)
		if b < a {
			if current > maxSeq {
				maxSeq = current
			}

			current = 1
		} else {
			current++
		}

		a = b
	}

	if current > maxSeq {
		maxSeq = current
	}

	fmt.Println(maxSeq)
}

package main

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

func main() {
	var n int
	fmt.Scanf("%d", &n)

	var max, current = 1, 1
	var a, b int

	fmt.Scanf("%d", &a)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	for i := 0; i < n-1; i++ {
		scanner.Scan()
		b, _ = strconv.Atoi(scanner.Text())
		if b < a {
			if current > max {
				max = current
			}

			current = 1
		} else {
			current++
		}

		a = b
	}

	if current > max {
		max = current
	}

	fmt.Println(max)
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

type number struct {
	begin int
	end   int
}

func compareNumbers(a []byte, left number, right number) int {
	if (left.end - left.begin) > (right.end - right.begin) {
		return 1
	} else if (left.end - left.begin) < (right.end - right.begin) {
		return -1
	}
	diff := right.begin - left.begin
	for i := left.begin; i < left.end; i += 1 {
		if a[i] > a[i+diff] {
			return 1
		} else if a[i] < a[i+diff] {
			return -1
		}
	}
	return 0
}

// https://codeforces.com/problemset/problem/580/A
// комментарии к решению
// т.к. числа достаточно большие и их много, то fmt.Scan не справляется,
// поэтому необходимо сравнивать их посимвольно, либо использовать strconv.atoi
// Сравнение строк-чисел достаточно простая операция, которой учат в первых главах K&R,
// поэтому с небольшой модификацией для исключения alloc получаем compareNumbers(),
// которую используем для сравнения чисел
// Алгоритм простой:
// 0) постоянно проверяем на < len(a) чтобы не словить out of index
// 1) запоминаем позицию последнего числа
// 2) находим следующее
// 3) сравниваем
// 4) go to 0
func taskSolution(a []byte) int {
	currLen, maxLen := 0, 1
	right := number{begin: 0, end: 0}
	// trim lead spaces
	for right.begin < len(a) && !(a[right.begin] >= '0' && a[right.begin] <= '9') {
		right.begin += 1
	}
	// find first number
	right.end = right.begin
	for right.end < len(a) && a[right.end] >= '0' && a[right.end] <= '9' {
		right.end += 1
	}
	// iterate numbers
	for right.end < len(a) {
		left := right
		// find next number
		right.begin = left.end + 1
		right.end = left.end + 1
		for right.end < len(a) && a[right.end] >= '0' && a[right.end] <= '9' {
			right.end += 1
		}
		// compare
		if compareNumbers(a, left, right) <= 0 {
			currLen += 1
			if maxLen < currLen {
				maxLen = currLen
			}
		} else {
			currLen = 1
		}
	}
	return maxLen
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw))
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

type number struct {
	begin int
	end   int
}

func compareNumbers(a []byte, left number, right number) int {
	if (left.end - left.begin) > (right.end - right.begin) {
		return 1
	} else if (left.end - left.begin) < (right.end - right.begin) {
		return -1
	}
	diff := right.begin - left.begin
	for i := left.begin; i < left.end; i += 1 {
		if a[i] > a[i+diff] {
			return 1
		} else if a[i] < a[i+diff] {
			return -1
		}
	}
	return 0
}

// https://codeforces.com/problemset/problem/580/A
// комментарии к решению
// т.к. числа достаточно большие и их много, то fmt.Scan не справляется,
// поэтому необходимо сравнивать их посимвольно, либо использовать strconv.atoi
// Сравнение строк-чисел достаточно простая операция, которой учат в первых главах K&R,
// поэтому с небольшой модификацией для исключения alloc получаем compareNumbers(),
// которую используем для сравнения чисел
// Алгоритм простой:
// 0) постоянно проверяем на < len(a) чтобы не словить out of index
// 1) запоминаем позицию последнего числа
// 2) находим следующее
// 3) сравниваем
// 4) go to 0
func taskSolution(a []byte) int {
	currLen, maxLen := 1, 1
	right := number{begin: 0, end: 0}
	// trim lead spaces
	for right.begin < len(a) && !(a[right.begin] >= '1' && a[right.begin] <= '9') {
		right.begin += 1
	}
	// find first number
	right.end = right.begin
	for right.end < len(a) && a[right.end] >= '1' && a[right.end] <= '9' {
		right.end += 1
	}
	// iterate numbers
	for right.end < len(a) {
		left := right
		// find next number
		right.begin = left.end + 1
		right.end = left.end + 1
		for right.end < len(a) && a[right.end] >= '1' && a[right.end] <= '9' {
			right.end += 1
		}
		// compare
		if compareNumbers(a, left, right) <= 0 {
			currLen += 1
			if maxLen < currLen {
				maxLen = currLen
			}
		} else {
			currLen = 1
		}
	}
	return maxLen
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw))
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

type number struct {
	begin int
	end   int
}

func compareNumbers(a []byte, left number, right number) int {
	if (left.end - left.begin) > (right.end - right.begin) {
		return 1
	} else if (left.end - left.begin) < (right.end - right.begin) {
		return -1
	}
	diff := right.begin - left.begin
	for i := left.begin; i < left.end; i += 1 {
		if a[i] > a[i+diff] {
			return 1
		} else if a[i] < a[i+diff] {
			return -1
		}
	}
	return 0
}

// https://codeforces.com/problemset/problem/580/A
// комментарии к решению
// т.к. числа достаточно большие и их много, то fmt.Scan не справляется,
// поэтому необходимо сравнивать их посимвольно, либо использовать strconv.atoi
// Сравнение строк-чисел достаточно простая операция, которой учат в первых главах K&R,
// поэтому с небольшой модификацией для исключения alloc получаем compareNumbers(),
// которую используем для сравнения чисел
// Т.к. входной поток состоит строго из чисел, то принадлежность символа цифре вместо
// !(a[x.end] >= '0' && a[x.end] <= '9')
// можно заменить на более короткую запись (для улучшения читаемости):
// a[x.end] != ' '
// В остальном всё просто:
// 1) запоминаем позицию последнего числа
// 2) постоянно проверяем на < len(a) чтобы не словить out of index
func taskSolution(a []byte) int {
	currLen, maxLen := 1, 1
	right := number{begin: 0, end: 0}
	// trim lead spaces
	for right.begin < len(a) && a[right.begin] == ' ' {
		right.begin += 1
	}
	// find first number
	right.end = right.begin
	for right.end < len(a) && a[right.end] != ' ' {
		right.end += 1
	}
	// iterate numbers
	for right.end < len(a) {
		left := right
		// find next number
		right.begin = left.end + 1
		right.end = left.end + 1
		for right.end < len(a) && a[right.end] != ' ' {
			right.end += 1
		}
		// compare
		if compareNumbers(a, left, right) <= 0 {
			currLen += 1
			if maxLen < currLen {
				maxLen = currLen
			}
		} else {
			currLen = 1
		}
	}
	return maxLen
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw))
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

type number struct {
	begin int
	end   int
}

func compareNumbers(a []byte, left number, right number) int {
	if (left.end - left.begin) > (right.end - right.begin) {
		return 1
	} else if (left.end - left.begin) < (right.end - right.begin) {
		return -1
	}
	diff := right.begin - left.begin
	for i := left.begin; i < left.end; i += 1 {
		if a[i] > a[i+diff] {
			return 1
		} else if a[i] < a[i+diff] {
			return -1
		}
	}
	return 0
}

// https://codeforces.com/problemset/problem/580/A
// комментарии к решению
// т.к. числа достаточно большие и их много, то fmt.Scan не справляется,
// поэтому необходимо сравнивать их посимвольно, либо использовать strconv.atoi
// Сравнение строк-чисел достаточно простая операция, которой учат в первых главах K&R,
// поэтому с небольшой модификацией для исключения alloc получаем compareNumbers(),
// которую используем для сравнения чисел
// Алгоритм простой:
// 0) постоянно проверяем на < len(a) чтобы не словить out of index
// 1) запоминаем позицию последнего числа
// 2) находим следующее
// 3) сравниваем
// 4) go to 0
func taskSolution(a []byte) int {
	currLen, maxLen := 1, 1
	right := number{begin: 0, end: 0}
	// trim lead spaces
	for right.begin < len(a) && !(a[right.begin] >= '0' && a[right.begin] <= '9') {
		right.begin += 1
	}
	// find first number
	right.end = right.begin
	for right.end < len(a) && a[right.end] >= '0' && a[right.end] <= '9' {
		right.end += 1
	}
	// iterate numbers
	for right.end < len(a) {
		left := right
		// find next number
		right.begin = left.end + 1
		right.end = left.end + 1
		for right.end < len(a) && a[right.end] >= '0' && a[right.end] <= '9' {
			right.end += 1
		}
		// compare
		if compareNumbers(a, left, right) <= 0 {
			currLen += 1
			if maxLen < currLen {
				maxLen = currLen
			}
		} else {
			currLen = 1
		}
	}
	return maxLen
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw))
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n, temp int
	fmt.Fscanf(reader, "%d\n", &n)
	arr := make([]int, 0)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &temp)
		arr = append(arr, temp)
	}
	fmt.Fscanf(reader, "\n")
	maxLen := 1
	curLen := 1
	for i := 1; i < n; i++ {
		if arr[i] > arr[i-1] {
			curLen = curLen + 1
		} else {
			if maxLen < curLen {
				maxLen = curLen
			}
			curLen = 1
		}
	}
	if maxLen < curLen {
		maxLen = curLen
	}
	fmt.Fprintf(writer, "%d\n", maxLen)
}

package main

import "fmt"

func main() {

	var n int
	fmt.Scanln(&n)
	var tem int
	var arr []int

	for i := 0; i < n; i++ {
		fmt.Scan(&tem)
		arr = append(arr, tem)
	}
	max := 1
	t := 1
	f := arr[0]
	for i := 1; i < n; i++ {

		// 不非递减了
		if f > arr[i] {
			if t > max {
				max = t
			}
			t = 1
		} else {
			t++
		}
		f = arr[i]
	}

	//说明书出来了
	if t == n {
		if t > max {
			max = t
		}

	}

	fmt.Println(max)

}


package main

import (
	"fmt"
)

type Laptop struct {
	s, r, h, c int32
}

func (o *Laptop) Read() {
	fmt.Scan(&o.s)
	fmt.Scan(&o.r)
	fmt.Scan(&o.h)
	fmt.Scan(&o.c)
}

func (o *Laptop) Less(p *Laptop) bool {
	return o.s < p.s && o.r < p.r && o.h < p.h
}

func main() {
	var (
		n, i, j, min, loc int32
		lps               []Laptop
		lpsi              *Laptop
	)
	const INF = 1000000000

	fmt.Scan(&n)
	lps = make([]Laptop, n, n)
	for i = 0; i < n; i++ {
		lps[i].Read()
	}

	for i = 1; i < n; i++ {
		lpsi = &lps[i]
		for j = 0; j < i; j++ {
			if lpsi.Less(&lps[j]) {
				lpsi.c = INF
			}
			if lps[j].Less(lpsi) {
				lps[j].c = INF
			}
		}
	}

	min, loc = lps[0].c, 0
	for i = 1; i < n; i++ {
		if lps[i].c < min {
			min = lps[i].c
			loc = i
		}
	}

	fmt.Println(loc + 1)

}

package main
import (
	"fmt"
	//"sort"
	"bufio"
	"os"
	"strconv"
)
func main() {
	var a,b,c,d [101]int
	var n,min0,mini int
	mini=-1
	min0=2147483647
	fmt.Scan(&n)
	input := bufio.NewScanner(os.Stdin)
	input.Split(bufio.ScanWords)
	for i:=0;i<n;i++ {
		input.Scan()
		aa,_:=strconv.Atoi(input.Text())
		a[i]=aa
		input.Scan()
		bb,_:=strconv.Atoi(input.Text())
		b[i]=bb
		input.Scan()
		cc,_:=strconv.Atoi(input.Text())
		c[i]=cc
		input.Scan()
		dd,_:=strconv.Atoi(input.Text())
		d[i]=dd
	}
	for i:=0;i<n;i++ {
		var j int
		for j=0;j<n;j++ {
			if i==j {
				continue
			}
			if a[i]<a[j] && b[i]<b[j] && c[i]<c[j] {
				break
			}
		}
		if j<n {
			continue
		}
		if min0>d[i] {
			min0=d[i]
			mini=i
		}
	}

	fmt.Println(mini+1)
}


package main

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

var _rbuf = bufio.NewReader(os.Stdin)
var _wbuf = bufio.NewWriter(os.Stdout)

func scan(a ...interface{})             { _wbuf.Flush(); fmt.Fscan(_rbuf, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(_wbuf, f, a...) }

func main() {
	defer _wbuf.Flush()

	var t int
	scan(&t)
	for ; t > 0; t-- {
		var n, m int
		scan(&n, &m)
		in := make([]string, n)
		for i := range in {
			scan(&in[i])
		}
		printf("%d\n", solve(n, m, in))
	}
}

func solve(n, m int, in []string) int {
	cnt := 0
	for i := range in {
		for j := range in[i] {
			if in[i][j] == '#' {
				cnt++
			}
		}
	}
	ret := pow(2, int64(cnt))
	if cnt == n*m {
		ret = (ret - 1 + mod) % mod
	}
	return int(ret)
}

var mod = int64(1e9 + 7)

func pow(a, p int64) int64 {
	if p == 0 {
		return 1
	}
	if p&1 == 1 {
		return pow(a, p-1) * a % mod
	}
	return pow(a*a%mod, p/2) % mod
}

package main
import("bufio";."fmt";."math/big";."os";."strings")

// github.com/EndlessCheng/codeforces-go
func main(){
	in:=bufio.NewReader(Stdin)
	var T,n,m int;s:=""
	for Fscan(in,&T);T>0;T--{
		Fscan(in,&n,&m);c:=0
		for i:=0;i<n;i++{Fscan(in,&s);c+=Count(s,"#")}
		x:=new(Int).Exp(NewInt(2),NewInt(int64(c)),NewInt(1e9+7)).Int64()
		if c==n*m{x--}
		Println(x)
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"math/big"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func CF1536E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n, m int
	var s string
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &m)
		c := 0
		for i := 0; i < n; i++ {
			Fscan(in, &s)
			c += strings.Count(s, "#")
		}
		ans := new(big.Int).Exp(big.NewInt(2), big.NewInt(int64(c)), big.NewInt(1e9+7)).Int64()
		if c == n*m {
			ans--
		}
		Fprintln(out, ans)
	}
}

func main() { CF1536E(os.Stdin, os.Stdout) }


package main

import (
	"fmt"
	"bufio"
	"os"
	"math"
)
func checkPos(y int,a int ,b int ) int {
	if(y<a) {
		return -1
	}else{
		if(y<=b){
			return 0
		}else{
			return 1
		}
	}
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out :=bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n,h,a,b,k int
	fmt.Fscanf(in,"%d %d %d %d %d\n",&n,&h,&a,&b,&k)
	for i:=1;i<=k;i++{
		var x1,y1,x2,y2 int
		fmt.Fscanf(in,"%d %d %d %d\n",&x1,&y1,&x2,&y2)
		dx :=int(math.Abs(float64(x1-x2)))
		var ey1 int
		var ans int
		switch checkPos(y1,a,b) {
			case 1:
				ey1 = y1-b
				ans = dx + int(math.Abs(float64(b-y2)))+ey1
			case 0:
				ey1=0
				ans = dx + int(math.Abs(float64(y1-y2)))
			case -1:
				ey1=a-y1
				ans = dx + int(math.Abs(float64(a-y2)))+ey1
		}
		if(x1 == x2){
			ans  = int(math.Abs(float64(y1-y2)))
		}
		fmt.Fprintln(out,ans)
	}
}

package main

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

func main()  {

	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n, h, a, b, k int
	fmt.Fscanf(in, "%d %d %d %d %d\n", &n, &h, &a, &b, &k)

	for i := 0; i < k; i++ {

		var ta, fa, tb, fb int
		fmt.Fscanf(in, "%d %d %d %d\n", &ta, &fa, &tb, &fb)

		sum := abs(tb - ta)
		if tb == ta {
			sum += abs(fa - fb)
		} else {
			if fa < a  {
				sum += a - fa + abs(fb - a)
			} else if a <= fa && fa <= b {
				sum += abs(fb - fa)
			} else {
				sum += fa - b + abs(fb - b)
			}
		}

		fmt.Fprintln(out, sum)

	}

}

func abs(x int) int {
	if x < 0 {
		x *= -1
	}
	return x
}

package main

import (
    "fmt"
)

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

var reader SReader

var (
	n, h, a, b, k int
	t1, f1, d1 int
	t2, f2, d2 int
)

func moveToEdge(f, d *int) {
	if *f > b {
		*d = *f - b
		*f = b
	} else if *f < a {
		*d = a - *f
		*f = a
	} else {
		*d = 0
	}
}

func run() {
	if t1 == t2 {
		fmt.Println(abs(f1-f2))
		return
	}

	moveToEdge(&f1, &d1)
	moveToEdge(&f2, &d2)

	ans := abs(f1-f2) + abs(t1-t2) + d1 + d2
	fmt.Println(ans)
}

func main() {
    reader.Init()
	n = int(reader.ReadInt())
	h = int(reader.ReadInt())
	a = int(reader.ReadInt())
	b = int(reader.ReadInt())
	k = int(reader.ReadInt())

	for i := 0; i < k; i++ {
		t1 = int(reader.ReadInt())
		f1 = int(reader.ReadInt())
		t2 = int(reader.ReadInt())
		f2 = int(reader.ReadInt())
		run()
	}

}

func abs(n int) int {
	if n < 0 {
		return -n
	} else {
		return n
	}
}

// a,b,m > 0
func pow(a, b, m int64) (res int64) {
	res = 1
	a2 := a // base a^1/a^2/a^4...
	for b > 0 {
		if b & 1 == 1 {
			res *= a2
			res %= m
		}

		a2 *= a2
		a2 %= m
		b >>= 1
	}

	return
}

// reader
type SReader struct {
    file *os.File
    scanner *bufio.Scanner
}

func (this *SReader) Init() {
    this.file = os.Stdin
    this.scanner = bufio.NewScanner(this.file)
    this.scanner.Split(bufio.ScanWords)
}

func (this *SReader) ReadInt() int {
    this.scanner.Scan()
    n, err:= strconv.ParseInt(this.scanner.Text(), 10, 64)
    if err != nil {
        panic(err)
    }
    return int(n)
}

package main

import (
	"fmt"
	"bufio"
	"os"
	"math"
)
func checkPos(y int,a int ,b int ) int {
	if(y<a) {
		return -1
	}else{
		if(y<=b){
			return 0
		}else{
			return 1
		}
	}
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out :=bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n,h,a,b,k int
	fmt.Fscanf(in,"%d %d %d %d %d\n",&n,&h,&a,&b,&k)
	for i:=1;i<=k;i++{
		var x1,y1,x2,y2 int
		fmt.Fscanf(in,"%d %d %d %d\n",&x1,&y1,&x2,&y2)
		dx :=int(math.Abs(float64(x1-x2)))
		var ey1 int
		var ey2 int
		switch checkPos(y1,a,b) {
			case 1:ey1 = y1-b
			case 0:ey1=0
			case -1:ey1=a-y1
		}
		switch checkPos(y2,a,b) {
		case 1:ey2 = y2-b
		case 0:ey2=0
		case -1:ey2=a-y2
		}
		var ans int
		if x1 != x2{
			ans = dx+ey1+ey2+int(math.Abs(float64(y1-y2)))
		} else{
			ans = int(math.Abs(float64(y1-y2)))
		}
		fmt.Fprintf(out,"%d\n",ans)

	}
}

package main

import (
	"fmt"
	"bufio"
	"os"
	"math"
)
func checkPos(y int,a int ,b int ) int {
	if(y<a) {
		return -1
	}else{
		if(y<=b){
			return 0
		}else{
			return 1
		}
	}
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out :=bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n,h,a,b,k int
	fmt.Fscanf(in,"%d %d %d %d %d\n",&n,&h,&a,&b,&k)
	for i:=1;i<=k;i++{
		var x1,y1,x2,y2 int
		fmt.Fscanf(in,"%d %d %d %d\n",&x1,&y1,&x2,&y2)
		dx :=int(math.Abs(float64(x1-x2)))
		var ey1 int
		var ey2 int
		switch checkPos(y1,a,b) {
			case 1:ey1 = y1-b
			case 0:ey1=0
			case -1:ey1=a-y1
		}
		switch checkPos(y2,a,b) {
		case 1:ey2 = y2-b
		case 0:ey2=0
		case -1:ey2=a-y2
		}
		ans := dx+ey1+ey2+int(math.Abs(float64(y1-y2)))
		fmt.Fprintf(out,"%d\n",ans)

	}
}

package main

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

func main()  {

	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n, h, a, b, k int
	fmt.Fscanf(in, "%d %d %d %d %d\n", &n, &h, &a, &b, &k)

	for i := 0; i < k; i++ {

		var ta, fa, tb, fb int
		fmt.Fscanf(in, "%d %d %d %d\n", &ta, &fa, &tb, &fb)

		sum := tb - ta
		if fa < a  {
			sum += a - fa + abs(fb - a)
		} else if a <= fa && fa <= b {
			sum += abs(fb - fa)
		} else {
			sum += fa - b + abs(fb - b)
		}

		fmt.Fprintln(out, sum)

	}

}

func abs(x int) int {
	if x < 0 {
		x *= -1
	}
	return x
}

package main

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

func main()  {

	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n, h, a, b, k int
	fmt.Fscanf(in, "%d %d %d %d %d\n", &n, &h, &a, &b, &k)

	for i := 0; i < k; i++ {

		var ta, fa, tb, fb int
		fmt.Fscanf(in, "%d %d %d %d\n", &ta, &fa, &tb, &fb)

		sum := tb - ta
		if fa < a  {
			sum += a - fa + abs(fb - a)
		} else if a <= fa && fa <= b {
			sum += fb - fa
		} else {
			sum += fa - b + fb - b
		}

		fmt.Fprintln(out, sum)

	}

}

func abs(x int) int {
	if x < 0 {
		x *= -1
	}
	return x
}

package main

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

func main()  {

	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n, h, a, b, k int
	fmt.Fscanf(in, "%d %d %d %d %d\n", &n, &h, &a, &b, &k)

	for i := 0; i < k; i++ {

		var ta, fa, tb, fb int
		fmt.Fscanf(in, "%d %d %d %d\n", &ta, &fa, &tb, &fb)

		sum := abs(tb - ta)
		if fa < a  {
			sum += a - fa + abs(fb - a)
		} else if a <= fa && fa <= b {
			sum += abs(fb - fa)
		} else {
			sum += fa - b + abs(fb - b)
		}

		fmt.Fprintln(out, sum)

	}

}

func abs(x int) int {
	if x < 0 {
		x *= -1
	}
	return x
}


package main

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

type inputReader struct {
    *bufio.Scanner
}

func newInputReader() *inputReader {
    input := inputReader{ bufio.NewScanner(os.Stdin) }
    input.Split(bufio.ScanWords)
    return &input
}

func (input *inputReader) readInt() int {
    input.Scan()
    result, _ := strconv.Atoi(input.Text())
    return result
}

func main() {
    input := newInputReader()
    n := input.readInt()
    k := input.readInt()

    a := make([]int, n, n)
    for i := 0; i < n; i++ {
        a[i] = input.readInt()
    }

    sufsum := make([]int64, n, n)
    sufsum[n - 1] = int64(a[n - 1])
    for i := n - 2; i >= 0; i-- {
        sufsum[i] = sufsum[i + 1] + int64(a[i])
    }

    ans := sufsum[0]

    sufsum = sufsum[1:]
    sort.Slice(sufsum, func (i, j int) bool {
        return sufsum[i] > sufsum[j]
    })
    for i := 0; i < k - 1; i++ {
        ans += sufsum[i]
    }

    fmt.Println(ans)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func CF1175D(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, k int
	Fscan(in, &n, &k)
	sum := make([]int64, n+1)
	for i := 1; i <= n; i++ {
		Fscan(in, &sum[i])
		sum[i] += sum[i-1]
	}
	ans := int64(k) * sum[n]
	sum = sum[1 : len(sum)-1]
	sort.Slice(sum, func(i, j int) bool { return sum[i] < sum[j] })
	for _, s := range sum[:k-1] {
		ans -= s
	}
	Fprint(out, ans)
}

func main() { CF1175D(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

// ByAge implements sort.Interface for []Person based on
// the Age field.
type nodes []node

func (a nodes) Len() int           { return len(a) }
func (a nodes) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a nodes) Less(i, j int) bool { return a[i].val > a[j].val }

type node struct {
	val int64
	id  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, k := 0, 0
	fmt.Fscanf(in, "%d %d\n", &n, &k)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d", &a[i])
	}
	sums := make([]node, n)
	sums[n-1] = node{int64(a[n-1]), n - 1}
	for i := n - 2; i >= 0; i-- {
		sums[i] = node{sums[i+1].val + int64(a[i]), i}
	}
	ans := int64(sums[0].val)
	sums = sums[1:]
	sort.Sort(nodes(sums))
	for i := 0; i < k-1; i++ {
		ans += int64(sums[i].val)
	}
	fmt.Fprintf(out, "%d\n", ans)
	return
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"math/bits"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1175D(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, k int
	Fscan(in, &n, &k)
	sum := make([]int64, n+1)
	for i := 1; i <= n; i++ {
		Fscan(in, &sum[i])
		sum[i] += sum[i-1]
	}
	type pair struct {
		v int64
		i int
	}
	st := make([][19]pair, n+1)
	for i, v := range sum {
		st[i][0] = pair{v, i}
	}
	for j := 1; 1<<j <= n+1; j++ {
		for i := 0; i+1<<j <= n+1; i++ {
			if a, b := st[i][j-1], st[i+1<<(j-1)][j-1]; a.v < b.v {
				st[i][j] = a
			} else {
				st[i][j] = b
			}
		}
	}
	q := func(l, r int) pair {
		k := bits.Len(uint(r-l)) - 1
		a, b := st[l][k], st[r-1<<k][k]
		if a.v < b.v {
			return a
		}
		return b
	}

	ans := int64(0)
	r := n
	for i := k; i > 1; i-- {
		p := q(i-1, r)
		ans += (sum[r] - p.v) * int64(i)
		r = p.i
	}
	ans += sum[r]
	Fprint(out, ans)
}

func main() { CF1175D(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

// ByAge implements sort.Interface for []Person based on
// the Age field.
type nodes []node

func (a nodes) Len() int           { return len(a) }
func (a nodes) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a nodes) Less(i, j int) bool { return a[i].val > a[j].val }

type node struct {
	val int
	id  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, k := 0, 0
	fmt.Fscanf(in, "%d %d\n", &n, &k)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d", &a[i])
	}
	sums := make([]node, n)
	sums[n-1] = node{a[n-1], n - 1}
	for i := n - 2; i >= 0; i-- {
		sums[i] = node{sums[i+1].val + a[i], i}
	}
	ans := int64(sums[0].val)
	sums = sums[1:]
	sort.Sort(nodes(sums))
	for i := 0; i < k-1; i++ {
		ans += int64(sums[i].val)
	}
	fmt.Fprintf(out, "%d\n", ans)
	return
}