jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str,ptr;


 cin>>n;

    ll ara[n+2];

    input(ara,n);

    for(i=n-2; i>=0; i--)
    {
        if(ara[i]>=ara[i+1])cnt++;

        else break;
    }

    cout<<cnt<<endl;









}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
  int n,ans;
  ans=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a.at(i);
  }
  for(int i=0;i<n-1;i++)
  {
    int m=0;
    for(int j=i;j<n-1;j++)
    {
      if(a.at(j)>=a.at(j+1))
        m++;
      else
        break;
    }
    ans=max(ans,m);
  }
  cout<<ans<<endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  int count = 0;
  int countmax = 0;
  for (int i = 0; i < N-1; i++) {
    if (H.at(i) >= H.at(i+1)) {
      count++;
    } else {
      if (countmax < count) countmax = count;
      count = 0;
    }
  }
  cout << countmax << endl;
}
//  [c]
// AtCoder ABC139: C - Lower
// 2019.9.2 bal4u

#include <stdio.h>

//// 高速入力
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

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

int main()
{
	int N, p, hi, n, ans;
	
	N = in();
	ans = 0, n = 0, p = 0; while (N--) {
		if ((hi = in()) <= p) n++;
		else {
			if (n > ans) ans = n;
			n = 0;
		}
		p = hi;
	}
	if (n > ans) ans = n;
	printf("%d\n", ans);
	return 0;
}
//  [c]
int main()
{
  int n;
  scanf("%d", &n);
  int h[n], i;
  int tmp = 0, ans = 0;
  for (i = 0; i < n; i++)
    scanf("%d", &h[i]);
  for (i = 0; i < n - 1; i++)
  {
    if (h[i] >= h[i + 1])
      tmp++;
    else if (h[i] < h[i + 1])
      tmp = 0;
    if (ans < tmp)
      ans = tmp;
  }
  printf("%d", ans);
}
//  [c]
int main(void){
  
  int n,a[100000],m=0,t=0,i;
  
  scanf("%d",&n);
  
  for(i=0; i<n; i++)
    scanf("%d",&a[i]);
  
  for(i=n-1; i>0; i--){
    if(a[i] <= a[i-1])
      t ++;
    if(a[i] > a[i-1]){
      if(m < t)
        m = t;
      t = 0;
    }
  }
  
  printf("%d",m==0 ? t:m);
}
//  [c]
#include <bits/stdc++.h>
using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  int count = 0;
  int countmax = 0;
  for (int i = 0; i < N-1; i++) {
    if (H.at(i) >= H.at(i+1)) {
      count++;
      if (countmax < count) countmax = count;
    } else {
      count = 0;
    }
  }
  cout << countmax << endl;
}
//  [c]
#include <stdio.h>

int main(void){
  int n,h[100005],x[100005],max=0,count=0;
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    scanf("%d",&h[i]);
  }
  for(int i=1;i<=n-1;i++){
    if(h[i+1]<=h[i]){
      count++;
      x[i]=count;
    }else{
      count=0;
    }
  }

  for(int i=1;i<=n-1;i++){
    if(max<x[i]) max=x[i];
  }
  printf("%d\n",max);
  return 0;
}
//  [c]
#include <stdio.h>
int main(void){
  int N;
  int H[1000010];
  int i;
  scanf("%d",&N);
  for(i=1;i<=N;i++){
    scanf("%d",&H[i]);
  }
  
  int max=0;
  int s=0;
  for(i=N;i>=1;i--){
    if(H[i]<=H[i-1]){
      s=s+1;
    }
    else{
      if(max<s){
        max=s;
      }
    s=0;
    }
  }
  printf("%d\n
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    tmp = input[1].split(" ");
    //文字列から10進数に変換するときはparseIntを使います
    var COLUMN_NUM = parseInt(input[0], 10);
    var height = [];
    for (var i = 0; i < COLUMN_NUM; i++) {
        height[i] = parseInt(tmp[i], 10);
    }

    var moveCount=0;
    var moveCountMax = 0;
    var startPos;

    for (var posi = 0; posi < COLUMN_NUM-1; posi++) {
        if (height[posi] >= height[posi + 1]) {
            moveCount++;
        } else {
            moveCount = 0;
        }
        if (moveCount > moveCountMax) {
            moveCountMax = moveCount;
        }
    }

    //出力
    console.log('%d', moveCountMax);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    var n = parseInt(input[0], 10);
    var h = input[1].split(" ");
    var count = 0;
    var max = count;
    for (var i = 0; i < (n - 1); i++) {
        if (parseInt(h[i]) >= parseInt(h[i + 1])) {
            count++;
        } else {
            count = 0;
        }
        if (count > max) {
            max = count;
        }
    }
    //出力
    console.log('%s', max);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
function main(input) {
  const args = input.split('\n'),
        N = parseInt(args[0]),
        H = args[1].split(' ');
  let cnt = 0;
  let tmp = 0;
  for (let i = 0; i < N-1; ++i) {
    if (parseInt(H[i]) >= parseInt(H[i+1])) {
      ++tmp;
      if (i === N-2 && tmp > cnt) {
        cnt = tmp;
      }
    } else {
      if (tmp > cnt) {
        cnt = tmp;
      }
      tmp = 0;
    }
  }
  console.log(cnt);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
	var data = input.split("\n");
	var n = data[0];
	var masu =  data[1].split(" ").map((n) => parseInt(n, 10));
	var max = 0;
	var t = 0;
	for(var i = (n - 1); i>=0; i--){
		console.log(masu[i], masu[i-1])
		if(masu[i] <= masu[i-1]){
			t++;
			if(t>max) max = t;
		}else if(masu[i] > masu[i-1]){
			t = 0;
		}
	}
	console.log(max)
}
 
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(arg) {
	arg = arg.trim().split('\n');
	var h = arg[1].split(' ').map(str => parseInt(str, 10)),
        n = parseInt(arg[0], 10),
        out = 0, cnt = 0;
  	for (var i = 0; i < n-1; i++) {
    	if (h[i] >= h[i+1]) {
          out++;	
        } else {
          out = 0;
        }
      	if (out < cnt) {
          out = cnt
        }
    }
  	
  console.log(out)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(arg) {
	arg = arg.trim().split('\n');
	var h = arg[1].split(' ').map(str => parseInt(str, 10)),
        n = parseInt(arg[0], 10),
        out = 0;
  	for (var i = 0; i < n-1; i++) {
    	if (h[i] >= h[i+1]) {
          out++;	
        } else {
          out = 0;
        }
    }
  	
  console.log(out)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

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

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	prev := sc.NextInt()
	mx := 0
	cur := 0
	for i := 1; i < n; i++ {
		tmp := sc.NextInt()
		if prev >= tmp {
			cur++
			if cur > mx {
				mx = cur
			}
			prev = tmp
		} else {
			prev = tmp
			cur = 0
		}
	}
	fmt.Printf("%v\n", mx)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}
//  [go]
package main
 
import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}
 
//func nextString() string {
//	sc.Scan()
//	return sc.Text()
//}
 
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	N := nextInt()
	l := make([]int, N)
	for i := 0; i < N; i++ {
		l[i] = nextInt()
	}
	ANS := 0
	BEFORE := 0
	for i := 0; i < N - 2; i++ {
		if l[i] >= l[i + 1] {
			ANS++
		} else {
			ANS = max(ANS, BEFORE)
			BEFORE = ANS
		}
	}
	fmt.Println(ANS)
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	H := intSliceScanner(n)
	ans := -1
	tmp := 0
	if H[0] >= H[1] {
		tmp++
	}
	for i := 1; i < n; i++ {
		if H[i] <= H[i-1] {
			tmp++
		} else {
			ans = larger(ans, tmp)
			tmp = 0
		}
	}
	ans = larger(ans, tmp)
	fmt.Println(ans)
}
//  [ruby]
gets
c = l = m = 0
gets.split.each { |e|
  e = e.to_i
  if l < e
    m = c  if c > m
    c = 0
  else
    c += 1
  end
  l = e
  }
p (c > m ? c : m)
//  [ruby]
N,*hs=$<.read.split.map(&:to_i)

hs << 10**9+1

ret = 0
count = 0
t = 0
hs.each do |h|
  if t < h
    ret = count if ret < count
    count = 0
  else
    count += 1
  end
  t = h
end

p ret
//  [ruby]
n = gets.to_i
h_arr = gets.split.map(&:to_i)

prev_h = 0
current_step = 0
max_step = 0
h_arr.each do |h|
  if prev_h >= h
    current_step += 1
  else
    max_step = current_step if max_step < current_step
    current_step = 0
  end
  prev_h = h
end
max_step = current_step if max_step < current_step
puts max_step
//  [ruby]
n = gets.chomp.to_i
h = gets.chomp.split.map(&:to_i).reverse
ans = 0
res = 0
(1...n).each do |i|
    if h[i-1] > h[i] then
        ans = res if ans < res
        res = 0
    else
        res += 1
    end
end
puts ans
//  [ruby]
n=gets.to_i
s=gets.split.map &:to_i
max=0
wa=0
for i in 0..n-2
  ans=0
  wa=s[i]
  for j in i+1..n-1
    if wa>=s[j]
      ans+=1
      max=[max,ans].max
    else
      ans=0
    end
    wa=s[j]
  end
end
puts max
//  [ruby]
n = gets.to_i
heights = gets.chomp.split(' ').map(&:to_i)
max = 0
counter = 0
i = 1
while i < n
  if heights[i-1] >= heights[i]
    counter += 1
  else
    counter = 0
    if max < counter
      max = counter
    end
  end
  i += 1
end
if max < counter
  max = counter
end
puts max
//  [rust]
use std::cmp::max;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut hv = vec![0i32; n];
    for i in 0..n - 1 {
        hv[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    hv[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut ans = 0;
    let mut count = 0;
    for i in 0..n - 1 {
        if hv[i] >= hv[i + 1] {
            count += 1;
            ans = max(ans, count);
        } else {
            count = 0;
        }
    }
    println!("{}", ans);
}
//  [rust]
use proconio::input;

fn main() {
  input! {
    n: usize,
    hs: [usize;n],
  }
  let mut result = 0;
  let mut max = 0;
  let mut last = 0;
  for v in hs {
    if last < v {
      max = 0;
      result = std::cmp::max(max, result);
    } else {
      max += 1;
    }
    last = v;
  }
  println!("{}", std::cmp::max(max, result)); 
}
//  [rust]
use proconio::{input, fastout};
use std::cmp::max;

#[fastout]
fn main() {
    input!{
        N: i32,
        H: [i32; N],
    };
    let mut m: i32 = 0;
    let mut c: i32 = 0;
    let mut r: i32 = 0;

    for h in H.iter() {
        if *h <= m {
            c += 1;
        }
        m = *h;
        r = max(r, c);
    }
    println!("{}", r);
}
//  [rust]
use proconio::{input,fastout};
use std::cmp;

#[fastout]
fn main() {
  input! {
    n: usize,
    h: [u64; n],
  }
  
  let mut v: vec![0; n];
  for i in 1..n {
    if h[n-i-1] >= h[n-i] {
      v[n-i-1] = v[n-i] + 1;
    }
    else {
      v[n-i-1] = 0;
    }
  }
  
  let mut ans: u64 = 0;
  for i in 0..n {
    ans = cmp::max(ans, v[i]);
  }
  
  println!("{}", ans);
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    let aryH = readInts()
    //_______________________ここまで入力
    
    var left = 0
    var right = 1
    var ans = 0
    
    while right < n {
        if aryH[right - 1] < aryH[right] {
            ans = max(right - left - 1, ans)
            left = right
        }
        right += 1
    }
    print(max(ans, right - left - 1))
}

main()
//  [swift]
let N = Int(readLine()!)!
let H = readLine()!.characters.split(" ").map{Int(String($0))!}
var ans = 0
var l = 0
while l < N {
    var r = l
    while r+1 < N && H[r] >= H[r+1] {
        r += 1
    }
    ans = max(ans, r-l)
    l = r+1
}
print(ans)
//  [swift]
let n = Int(readLine()!)!
let array = readLine()!.characters.split{$0 == " "}.map{ Int(String($0))! }

var ret = 0
var current = 0
var last = array[0]

for i in 0..<array.count {
  if i != 0 {
    if array[i] <= last {
      current += 1
    } else {
      ret = max(ret, current)
      current = 0
    }
  }
  last = array[i]
}

ret = max(ret, current)

print(ret)
//  [swift]
let n = Int(readLine()!)!
        let hArr = String(readLine()!).split(separator: " " ).map { Int(String($0))! }
        var resArr = [Int]()
        for i in 0..<n {
            var startNum = hArr[i]
            var res = 0
            for j in i+1..<n {
                if startNum >= hArr[j] {
                    res += 1
                } else {
                    break
                }
                startNum = hArr[j]
            }
            resArr.append(res)
        }
        let result = resArr.reduce(0) { res, num in
            return max(res, num)
        }
        print(result)
//  [swift]
let N = Int(readLine()!)!
let H = readLine()!.characters.split(" ").map{Int(String($0))!}
var ans = 0
var r = 0
for l in 0..<N {
    var r = l
    while r+1 < N && H[r] >= H[r+1] {
        r += 1
    }
    ans = max(ans, r-l)
}
print(ans)
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let n=tn()
  let ar=tnn(n)
  let mmove=0,move=0,height=ar[0]
  for(let i=1;i<n;i++){
    if(ar[i]<=height)move++
    else{
      if(mmove<move)mmove=move
      move=0
    }
    height=ar[i]
  }
  if(mmove<move)mmove=move
  to(mmove)
}
main()
//  [typescript]
'use strict'
function main(input: String) {
    const n: number = parseInt(input.split('\n')[0], 10);
    const hs: number[] = input.split('\n')[1].split(' ').map(h => parseInt(h, 10));
    let r: number = 0;
    let tmp = 0;
    for (let i = 0; i < n; i++) {
        if (hs[i] >= hs[i+1]) {
            tmp++;
        } else {
            r = Math.max(tmp, r);
            tmp = 0;
            continue;
        }
    }
    console.log(r);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const input = stdin.split('\n')

const N = input[0]

const H = input[1].split(' ').map(Number)

const ans = () => {
  let streak = 0

  let max = 0

  for (let i = 0; i < N - 1; i++) {
    if (H[i] >= H[i + 1]) {
      streak++
    } else {
      max = Math.max(max, streak)
      streak = 0
    }
  }

  max = Math.max(max, streak)

  console.log(max)
}

ans()
//  [typescript]
'use strict'
function main(input: String) {
    const n: number = parseInt(input.split('\n')[0], 10);
    const hs: number[] = input.split('\n')[1].split(' ').map(h => parseInt(h, 10));
    let r: number = 0;
    for (let i = 0; i < n; i++) {
        let current = 0;
        for (let j = i; j <= n-(i+1); j++) {
            if (hs[j] >= hs[j+1]) {
              continue;
            }
            current++;
        }
        if (current > r) {
            r = current;
        }
    }
    console.log(r);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const p = (...args) => {
  process.env.NODE_ENV === "test" ? console.log(...args) : ""
}

const solve = (n) => {
  // ...
  let cnt = 0
  let max = 0
  let z = []
  n.map((r, i) => {
    if (i == 0) {
      z[i] = 0
      return
    }
    let before = n[i - 1]
    if (r > before) {
      z[i] = 0
    } else {
      z[i] = z[i - 1] + 1
      max = Math.max(z[i], max)
    }
  })
  // console.log(z)
  return max
}
const main = (input) => {
  const [h, r] = input.split("\n")
  return solve(r.split(" "))
}

if (process.env.NODE_ENV !== "test") {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(main(input.trim()))
}
//  [typescript]
import { readFileSync } from 'fs'
function main() {
  const input: string = readFileSync('/dev/stdin', 'utf8')
  const [N, line] = input.split('\n')
  const array = line.trim().split(' ').map(v => parseInt(v))
  let count = 0

  for (let i = 0; i < array.length; i++) {
    if (count >= array.length - i) { 
      break
    } 
    if (i === 0
      || (count >= 1 && array[i] > array[i - 1] && array[i] >= array[i + 1])
      || (count >= 2 && array[i] > array[i - 1] && array[i] >= array[i + 1] && array[i + 1] >= array[i + 2])
      || (array[i] > array[i - 1] && array[i] >= array[i + 1] && array[i + 1] >= array[i + 2] && array[i + 2] >= array[i + 3])
      ) {
      let localCount = 0
      const thisArray = array.slice(i)
      for (let j = 0; j < thisArray.length; j++) {
        if (thisArray[j] >= thisArray[j + 1]) {
          localCount++
        } else {
          break
        }
      }
      if (localCount > count) count = localCount
    }
  }
  console.log(count)
}
main()
//  [python]
n=int(input())
l=list(map(int,input().split()))
a=max(l)
b=sum(l)-a
if a<b:
    print("Yes")
else:
    print("No")
//  [python]
n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
if l[0] < sum(l[1:]):
    print("Yes")
else:
    print("No")
//  [python]
N = int(input())
L = list(map(int, input().split()))

l_max = max(L)
if l_max < sum(L) - l_max:
    print('Yes')
else:
    print('No')
//  [python]
# B Polygon
N = int(input())
L = list(map(int, input().split()))
mx = L.pop(L.index(max(L)))
if mx > sum(L):
    print("Yes")
else:
    print("No")
pass
//  [python]
n = int(input())
l = list(map(int, input().split()))

terms = (max(l) - (sum(l) - max(l)))

if terms:
    print('Yes')
else:
    print('No')
//  [python]
#ABC117B
n = int(input())
l = [int(input()) for i in range(n)]
print("Yes" if max(l) >= (sum(l)-max(l)) else "No")
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);
    
    s = r.readLine();
    sl = s.split(" ");
    int max = 0;
    int sum = 0;
    for(int i = 0; i < n; i++)
    {
      int z = Integer.parseInt(sl[i]);
      max = Math.max(z, max);
      sum += z;
    }

    System.out.println(max < (sum - max) ? "Yes" : "No");
  }


}
//  [java]
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader bf = 
            new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(bf.readLine());
        String[] str = bf.readLine().split(" ");
        int max = 0,
            sum = 0;
        for(int i = 0; i < N; i++){
            int value = Integer.parseInt(str[i]);
            sum += value;
            if(max < value){
                max = value;
            }
        }
        if(sum - max > max){
            System.out.println("Yes");
        } else{
            System.out.println("No");
        }        
    }
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		int sum = 0;
		
		Scanner sc = new Scanner (System.in);
		int[] a = new int[sc.nextInt()]; 
		
		for(int i = 0; i < a.length; i++)
		{
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		for(int i = 0; i < a.length - 1; i++)
		{
			sum = sum + a[i];
		}
		
		if(a[a.length] > sum){
			System.out.println("Yes");
		} else 
		{
			System.out.println("No");
		}
		
	}
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		int sum = 0;
		
		Scanner sc = new Scanner (System.in);
		int[] a = new int[sc.nextInt()]; 
		
		for(int i = 0; i < a.length; i++)
		{
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		for(int i = 0; i < a.length - 1; i++)
		{
			sum = sum + a[i];
		}
		
		if(a[1] > sum){
			System.out.println("Yes");
		} else 
		{
			System.out.println("No");
		}
		
	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner (System.in);
		int temp = 0;
		int x = 0;
		int sum = 0;
		
		for(int i = 0; i < sc.nextInt(); i++)
		{
			x = sc.nextInt();
			if(x > temp)
			{
				temp = x; 
			} else {
				sum = sum + x;
			}
		}
		
		if(x > sum)
		{
			System.out.println("Yes");
		} else 
		{
			System.out.println("No");
		}
		
	}

}
//  [cpp]
#include <cstdio>
#include <algorithm>
using namespace std;

int n, mx, sum;

int main()
{
	scanf("%d", &n);
	for (int i = 1, x; i <= n; i ++)
	{
		scanf("%d", &x);
		mx = max(mx, x);
		sum += x;
	}
	puts(mx * 2 < sum ? "Yes" : "No");
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    sort(ALL(a));
    int l = a.back();
    int s = accumulate(begin(a), end(a) - 1, 0LL);
    if (l < s) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return (0^_^0);
}
//  [cpp]
#include<iostream>
#include<string>
#include<array>
#include<algorithm>
#include<deque>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<list>

int main(void) {
	using namespace std;
	int N, a;
	int b = 0;
	vector<int>vec;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		vec.push_back(a);
	}
	sort(vec.begin(), vec.end());

	for (int i = 0; i < N - 1;i++) {
		b += vec[i];
	}
	if (vec[N - 1] < b) {
		cout << "Yes" << endl;
	}
	else if (vec[N - 1] >= b) {
		cout << "No" << endl;
	}
}
//  [cpp]
#include<stdio.h>
#define size 115
int main()
{
	int N,max=-1,i,l[size],total=0;
	scanf("%d",&N);
	if(N>=3)
	{
	for(i=0;i<N;i++)
		{
			scanf("%d",&l[i]);
			if(l[i]>max&&l[i]>0)
				max=l[i];
			else
				{
				}
		}
	for(i=0;i<N;i++)
		{
			if(l[i]!=max&&l[i]>0)
				{
					total+=l[i];
				}
			else
				{
				}
		}
	if(max<total)
		{
			printf("Yes\n");
		}
	else
		{
			printf("No\n");
		}
	}
	else
		{
			printf("No\n");
		}
	return 0;
}
//  [cpp]
#include<stdio.h>
#define size 115
int main()
{
	int N,max=0,i,l[size];
	long long total=0;
	scanf("%d",&N);
	if(N>=3)
	{
	for(i=1;i<=N;i++)
		{
			scanf("%d",&l[i]);
			if(l[i]>max)
				max=l[i];
		}
	for(i=1;i<=N;i++)
		{
			if(l[i]!=max)
				{
					total+=l[i];
				}
		}
	if(max<total)
		{
			printf("Yes\n");
		}
	else
		{
			printf("No\n");
		}
	}
	else
		{
			printf("No\n");
		}
	return 0;
}
//  [cpp]
#include<stdio.h>
#define size 115
int main()
{
	int N,max=0,i,l[size];
	long long total=0;
	scanf("%d",&N);
	if(N>=3)
	{
	for(i=1;i<=N;i++)
		{
			scanf("%d",&l[i]);
		}
	for(i=1;i<=N;i++)
		{
			if(l[i]>max)
				max=l[i];
			else
				{
				}
		}
	for(i=1;i<=N;i++)
		{	
			if(l[i]!=max)
				{
					total+=l[i];
				}
			else
				{
				}
		}
	if(max<total)
		{
			printf("Yes\n");
		}
	else
		{
			printf("No\n");
		}
	}
	else
		{
			printf("No\n");
		}
	return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
  int n;
  scanf("%d",&n);

  int l[n],msl=0,all=0,i;
  for(i=0;i<n;i++){
    scanf("%d",&l[i]);
    if(msl<l[i])
      msl=l[i];
    all += l[i];
  }

  all -= msl;
  
  if(all>msl)
    printf("Yes\n");
  else
    printf("No\n");

  return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
int main()
{
  int *x,n,i,a,sum;
  scanf("%d",&n);
  x = (int*)malloc(sizeof(int) * n);
  for(i=0;i < n;i++){
    scanf("%d",x+i);
  }
  
  for(i=0;i <= n-2;i++){
    if (x[i] > x[i+1]){
      a = x[i+1];
      x[i+1] = x[i];
      x[i] = a;
    }
  }
  sum = 0;
  for (i=0;i < n-1;i++){
    sum += x[i];
  }
  if (sum > x[n-1]){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
int n,l[101],i,lmax=0,lsum=0;

scanf("%d",&n);

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

  if(lmax<l[i])
  {
    lmax = l[i];
  }

lsum += l[i];
}

if(lmax<lsum-lmax)
{
printf("Yes");
}
else
{
  printf("No");
}

  return 0;
}
//  [c]
#include<stdio.h>
int main()
{

    int a,b,i,j,k=1,z,max,p=0,q=0;
    scanf("%d",&a);
    int ara[a+10];
    for(i=0;i<a;i++)
    {
        scanf("%d",&ara[i]);
    }
    max=ara[0];
    for(j=0;j<a;j++)
    {

        if(ara[j]>max)
        {
            max=ara[j];
        }
    }
    for(i=0;i<a;i++)
    {
        if(ara[i]!=max)
        {
            p=p+ara[i];
        }
    }
    if(p>max)
    {
        printf("Yes\n");
    }
    else
        {
            printf("No\n");
        }



}
//  [c]
#include<stdio.h>
int main()
{
    int n,i,sum=0,max=0;
    scanf("&d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",a[i]);

    }
    for(i=0;i<n;i++)
    {
        sum=+a[i];
        max=a[i];

    }
    if((sum-max)>max)
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
    return 0;
}
//  [c]
#include<stdio.h>
#define SIZE 1000
int main()
{
    long long int i, n, a[SIZE], max, sum=0;
    scanf("%lld\n", &n);
    for(i=0;i<=n-1;i++)
    {
        scanf("%lld", &a[i]);
        max = a[0];
        if(a[i]>= max)
        {
            max = a[i];
        }
        sum += a[i];
    }
    sum = sum - max;
    if(max < sum)
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
    return 0;
}
//  [javascript]
/**
 * 
 * @param {string} input 
 */
function main(input) {
  var inputList = input.split("\n");
  var n = Number(inputList[0]);
  var list = inputList[1].split(" ");
  var max = 0;
  var sum = 0;
  for(i=0; i<n; i++){
    if(max < Number(list[i])){
      max = Number(list[i]);
    }
    sum += Number(list[i]);
  }

  if(max < (sum-max)){
    console.log("Yes");
  }else{
    console.log("No");
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(string){
  var line2 = string.split('\n')[1]
  var listInt = line2.split(' ').map(v=>+v)
  var head  = listInt.sort((a,b)=>a<b?-1:1).slice(0,-1)
  var max   =  listInt.sort((a,b)=>a<b?-1:1).slice(-1)[0]
  var headSum = head.reduce((s,v)=>s+v)
  console.log(max < headSum ? 'Yes' : 'No')
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]

function solve(n, nums) {
    var sum = 0, max = 0;
    nums.forEach(function (n) {
        if (max < n) {
            max = n;
        }
        sum += n;
    });
    if (max < sum - max) {
        return 'Yes';
    }
    return 'No';
}

function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split('\n')
    var n = input[0];
    var nums = input[1].split(' ').map(function(n) { return Number(n)});
    console.log(solve(n, nums));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
    let allVal = require("fs").readFileSync("/dev/stdin", "utf8").split("\n")[1]
    let mstVal = Math.max(...allVal)
    let mstPos = allVal.indexOf(mstVal + "")
    allVal.splice(mstPos, 1)
    console.log(allVal.reduce((cur, prev) => cur + +prev, 0) > mstVal ? "Yes" : "No");
//  [javascript]
function main(input) {
    let allVal = input[1].split(" ")
    let mstVal = Math.max(...allVal)
    let mstPos = allVal.indexOf(mstVal + "")
    allVal.splice(mstPos, 1)
    return allVal.reduce((cur, prev) => cur + +prev, 0) > mstVal ? "Yes" : "No"
}
//  [javascript]
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split("\n");
console.log(input)
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	
	l := make([]int, n)
	
	max := 0
	sum := 0
	for i := range l {
    	fmt.Scan(&l[i])
		sum += l[i]
		if l[i] > max {
			max = l[i]
		}
	}
	sum -= max
	
	if max < sum {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	var sum, max int
	for i := 0; i < N; i++ {
		L := nextInt()
		sum += L
		max = MaxOf(max, L)
	}
	if max < sum-max {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

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

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}
//  [go]
package main

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

func main() {
	N := nextInt()
	Ls := nextInts(N)
	sum := Sum(Ls...)
	max := Max(Ls...)
	if sum-max > max {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func Sum(slice ...int) int {
	sum := 0
	for _, v := range slice {
		sum += v
	}
	return sum
}

func Max(xs ...int) int {
	max := xs[0]
	for _, x := range xs[1:] {
		if max < x {
			max = x
		}
	}
	return max
}

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer(make([]byte, 256), 1e9)
	sc.Split(bufio.ScanWords)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n,l,max,sum int
	fmt.Scan(&n)
	
	for i := 0; i < n; i++ {
		fmt.Scan(&l)
		if l > max {
			max = l
		}
		sum += l
	}
	
	if max > sum - max {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	ls := make([]int, n)
	for i := range ls {
		fmt.Scan(&ls[i])
	}
	maxl := ls[0]
	t := ls[0]
	for i := 1; i < n; i++ {
		t += ls[i]
		if ls[i] > ls[i-1] {
			maxl = ls[i]
		}
	}
	if t-maxl > maxl {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	ls := make([]int, n)
	for i := range ls {
		fmt.Scan(&ls[i])
	}
	maxl := ls[0]
	t := 0
	for i := 1; i < n; i++ {
		t += ls[i]
		if ls[i] > ls[i-1] {
			maxl = ls[i]
		}
	}
	if t-maxl > maxl {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [ruby]
gets
l = gets.split.map(&:to_i)
l.sort!.reverse!
max = l[0]
l.shift()
sum = l.inject(:+)

puts max < sum ? "Yes" : "No"
//  [ruby]
_ = gets
nums = gets.split.map(&:to_i).sort
puts nums[-1] < nums[0..-2].inject(&:+) ? 'Yes' : 'No'
//  [ruby]
N = gets.to_i
L = gets.split.map(&:to_f).sort
puts L[-1] < L[0..-2].inject(:+) ? "Yes" : "No"
//  [ruby]
n,*a=`dd`.split.map(&:to_i)
s=a.sum
a.each do |i|
  if s-i<i
    puts 'No'
    exit
  end
end
puts 'Yes'
//  [ruby]
#標準入力を取得
input_n = gets.to_i
input_array = gets.split(" ").map(&:to_i)

#辺の長さの配列を昇順にソート
input_array = input_array.sort!

#最大長さの辺以外の合計を格納する変数を初期化
amountLength = 0

#0以上n-1未満を繰り返し
(0...input_n-1).each do |i|
  amountLength += input_array[i]　#最大長さ以外の辺の長さを加算
end

#最大長さ < その他の辺の長さ　を判定
if input_array[input_n-1] < amountLength
  puts "Yes"
else
  puts "No"
end
//  [ruby]
N, *l = $stdin.read.split(/\s/).map(&:to_i)
l.sort!
lmax = l.pop
lrest = l.reduce(0) {|s, a| s + a }
puts (lmax < lrest) ? 'YES' : 'NO'
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        ll: [u32;n]
    }
    let mut ll = ll;
    ll.sort();
    ll.reverse();
    if ll.iter().skip(1).sum::<u32>() > ll[0] {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [rust]
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let n: i32 = read();
    let mut max: i32 = 0;
    let mut sum: i32 = 0;
    for _i in 0..n{
	let number: i32 = read();
	if max < number {
	    max = number;
	}
	sum += number;
    }
    if 2*max < sum {
	println!("Yes");
    }else{
	println!("No");
    }
}
//  [rust]
// 参考
// https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r"4
3 8 5 1
" => r"Yes",

r"4
3 8 4 1
" => r"No",

r"10
1 8 10 5 8 12 34 100 11 3
" => r"No"
}

use std::cmp;
use std::cmp::max;

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: i32,
        l: [i32; n]
    }

    let mut ans = 0;
    let mut maxnum = 0;
    for i in 0..l.len() {
        ans += l[i];
        maxnum = cmp::max(l[i], maxnum);
    }

    if maxnum < ans - maxnum {
        "Yes".to_string()
    } else {
        "No".to_string()
    }
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, l: [usize; n]};
    let mut l: Vec<usize> = l;

    let mut l_c = l.clone();
    let mut max = l_c.iter().max().unwrap();

    l.sort();
    l.pop();
    l.reverse();

    let mut sum = 0;
    let mut b = false;

    for l_i in l.iter() {
        sum += l_i;
        if sum >= *max {
            b = true;
            break;
        }
    }

    if b {
        println!("Yes")
    } else {
        println!("No")
    }
}
//  [rust]
use std::io::{stdin, Read};
use std::str::FromStr;
use std::cmp::Reverse;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let n: i64 = read().unwrap();
    let mut ls: Vec<i64> = Vec::new();
    for _i in 0..n {
        let l: i64 = read().unwrap();
        ls.push(l);
    }
    ls.sort_by_key(|&x| Reverse(x));
    let maxl: i64 = ls[0];
    let suml = ls.iter().skip(1).fold(0, |acc, i| acc + i);
    if maxl < suml {
        println!("YES");
    } else {
        println!("NO");
    }
}
//  [rust]
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn usize() -> usize {
    read()
}

fn vec_usize(n: usize) -> Vec<usize> {
    let mut vec = Vec::new();
    for _ in 0..n {
        vec.push(usize())
    }
    vec
}

fn main() {
    let n = usize();
    let ls = vec_usize(n).into_iter();

    let max = ls.clone().max().unwrap();
    let sum: usize = ls.clone().sum();

    if max * 2 < sum {
        println!("YES");
    } else {
        println!("NO");
    }
}
//  [swift]
import Foundation

let _ = readLine()!
var input = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }

var sum = 0
for i in input {
    sum += i
}

let maxL = input.maxElement()!

if maxL < sum - maxL {
    print("Yes\n")
} else {
    print("No\n")
}
//  [swift]
import Foundation

let N = Int(readLine()!)
var input = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }

input.sortInPlace { $0 > $1 }

var sum = 0
for i in input {
    sum += i
}

if input[0] < sum - input[0] {
    print("Yes\n")
} else {
    print("No\n")
}
//  [swift]
import Foundation
 
let N = Int(readLine()!)!
var input = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
 
input.sortInPlace()
 
var sum = 0
for i in input {
    sum += i
}
 
if input[N-1] < sum - input[N-1] {
    print("Yes\n")
} else {
    print("No\n")
}
//  [swift]
let N: Int = Int(readLine()!)!
var Ls: [Int] = readLine()!.split(separator: " ").map { Int($0)! }

Ls.sort()
print(Ls.dropLast().reduce(0, +) > Ls.last! ? "No" : "Yes")
//  [swift]
import Foundation

let N = Int(readLine()!)
var input = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }

input.sortInPlace()

var sum = 0
for i in input {
    sum += i
}

if input[N-1] < sum - input[N-1] {
    print("Yes\n")
} else {
    print("No\n")
}