Skip to content

Instantly share code, notes, and snippets.

#include <cstdio>
typedef long long ll;
int main(){
ll a, b;
while(scanf("%lld%lld",&a,&b)==2&&a+b){
if(b<a){ll t=a;a=b;b=t;}
printf("%lld\n",(a*(a+1)*(2*a+1)/6)+(b-a)*(a*(a+1)/2));
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int n, t, c[5], a[5], b[5];
queue<int> Q;
set<int> S; //Hash Table
int Hash() {
int h = 0;
for(int i = 0; i < n; i++) {
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100010;
int a[maxn];
bool cmp(int a, int b) {
return b < a;
}
int main() {
int T;
#include <bits/stdc++.h>
#define idx first
#define h second
using namespace std;
typedef unsigned UINT;
typedef pair<int,UINT> PIU;
int n, m;
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1000005;
int seg[maxn*2-1];
int n;
void init(int N) {
n = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
priority_queue<LL, vector<LL>, greater<LL> > q;
int main() {
LL n, x;
scanf("%lld", &n);
for(int i = 0; i < n; i++) {
scanf("%lld", &x);
q.push(x);
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
priority_queue<double, vector<double>, greater<double> > q;
int main() {
int n;
char cmd[5];
#include <cstdio>
#include <cstring>
using namespace std;
const int M=(int)1e6;
int d[201][201];
int main(){
memset(d, 0, sizeof(d));
d[0][0]=1;
for(int i=1;i<=200;i++){
for(int j=1;j<=200;j++){
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
char NAME[2][7] = {"Moumou","Mimi"};
vector<int> G[10005];
#include <cstdio>
#include <algorithm>
using namespace std;
int d[2][5005];
int main() {
int m,n,t,mx;
while(scanf("%d%d",&m,&n)==2&&m&&n){
mx=0;