← Back to Problems
Extreme Quantiles
Medium prediction Portfolio Optimization Probability & Statistics
Time limit: 2 s per test  ·  Memory: 256 MB

You observe n one-day losses of a trading book, drawn independently from a fixed heavy-tailed distribution. The distribution is not disclosed and varies between test cases. Losses are given with 6 digits after the decimal point.

For each level alpha in 0.99, 0.999, 0.9999, 0.99995, estimate the Value at Risk VaR (the alpha-quantile of the loss distribution) and the Expected Shortfall ES (the expected loss conditional on the loss being at least VaR).

Input

The first line contains the integer n. Each of the next n lines contains one loss.

Output

Four lines. Line i contains two real numbers: your estimates of VaR and ES at the i-th level.

Scoring

Each of the eight estimates is scored max(0, 1 - r / R), where r is its relative error against the true distributional value and R is a fixed tolerance per estimate:

level R (VaR) R (ES)
0.99 0.075 0.2
0.999 0.3 0.5
0.9999 0.65 0.9
0.99995 0.75 1.1

The case score is the mean of the eight.

Constraints

n = 20000

Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2