#include <stdio.h>

int main() {
    int N, C, P=0;
    scanf("%d", &N);
    scanf("%d", &C);
    for(int i=0; i<N; i++){
        if(i<C){
            P = P+C-i;
        }
        else{
            P = P+1;
        }
    }
    printf("%d", P);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: