Here’s the problem https://atcoder.jp/contests/abc172/tasks/abc172_d

Could someone tell me intuition behind this solution

https://atcoder.jp/contests/abc172/submissions/14736523

how this function is calculating the things

```
ll c2(ll x) {
return x * (x - 1) / 2;
}
```