#include <iostream>
using namespace std;

int main() {
    int s,e;
    cin >> s >> e;
    int i = 1;
    int a = 0;
    int m;
    int cnt;
    while(true){
        if (i * i >= s && i * i <= e) {
            if (a == 0) {
                m = i * i;
            }
            a++;
            cnt += i * i;
        }
        if (i*i > e) {
            break;
        }
        i++;
    }
    if (cnt == 0) {
        cout << -1;
        return 0;
    }
    cout << cnt << "\n";
    cout << m;
    return 0;
}

Embed on website

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