Fallisce solamente il maledetto testcase 009, che proprio non riesco a capire in cosa sia diverso dagli altri.
for (int i=0; i<n; i++) {
for (int j=i+1; j<=i+k; j++) {
if (j >=n ) {cout << diffmax; return 0;}
temp = a[j] - a[i];
if (temp > diffmax) diffmax = temp;
}
}
cout << diffmax;
return 0;