PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#CC0000044. Đếm đoạn có trung bình không nhỏ hơn K (Meaningful Mean)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

3 lộ trình

Đếm đoạn có trung bình không nhỏ hơn K (Meaningful Mean)

Meaningful Mean

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given nn positive integers and KK, count the nonempty contiguous subarrays whose arithmetic mean is at least KK. Different positions count separately.

Input

The first line contains n,Kn,K. The next nn integers are aia_i (one per line in the original format).

Output

Print the number of subarrays whose mean is at least KK.

Subtasks

  • Subtask 1 (20 points): 1≤n≤151\le n\le 15; 1≤K,ai≤1091\le K,a_i\le 10^9.
  • Subtask 2 (30 points): 1≤n≤4201\le n\le 420; 1≤K,ai≤1091\le K,a_i\le 10^9.
  • Subtask 3 (50 points): 1≤n≤2000001\le n\le 200000; 1≤K,ai≤1091\le K,a_i\le 10^9.

Examples

Input

3 6
7
5
7

Output

5

Explanation

There are six subarrays; only [5][5] has mean below 6, hence the answer is 5.