#pragma TASS input {N_BOUND > 0} 
int N_BOUND;
#pragma TASS input {N > 0 && N < N_BOUND} 
int N;
#pragma TASS input 
double scores[N];
#pragma TASS output 
int excessiveFailure;
int failureFlag = 0;
int numGrade[5];

void main() {
	int i = 0;
	
	for(; i < 5; i++)
		numGrade[i] = 0;
	i=0;
l:
#pragma TASS jointinvariant @main {numGrade[0] == spec.numGrade[0] && numGrade[1] == spec.numGrade[1] && numGrade[2] == spec.numGrade[2] && numGrade[3] == spec.numGrade[3]  && numGrade[4] == spec.numGrade[4] && failureFlag == spec.failureFlag && i >= 0 && i == spec.i}
	while(i < N) {
		if(scores[i] >= 90.0)
			numGrade[0]++;
		else if(scores[i] >= 80.0)
			numGrade[1]++;
		else if(scores[i] >= 70.0)
			numGrade[2]++;
		else if(scores[i] >= 60.0)
			numGrade[3]++;
		else
			numGrade[4]++;
		if(numGrade[3] > 10)
			failureFlag = 1;
		i++;
	}
	excessiveFailure = failureFlag;
}