Problem:
Grading Write a program which reads a list of student test scores and evaluates the performance for each student. The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, the score is indicated by -1. The final performance of a student is evaluated by the following procedure:  If the student does not take the midterm or final examination, the student's grade shall be F.  If the total score of the midterm and final examination is greater than or equal to 80, the student's grade shall be A.  If the total score of the midterm and final examination is greater than or equal to 65 and less than 80, the student's grade shall be B.  If the total score of the midterm and final examination is greater than or equal to 50 and less than 65, the student's grade shall be C.  If the total score of the midterm and final examination is greater than or equal to 30 and less than 50, the student's grade shall be D. However, if the score of the makeup examination is greater than or equal to 50, the grade shall be C.  If the total score of the midterm and final examination is less than 30, the student's grade shall be F.  Input The input consists of multiple datasets. For each dataset, three integers m , f and r are given in a line. The input ends with three -1 for m , f and r respectively. Your program should not process for the terminal symbols. The number of datasets (the number of students) does not exceed 50. Output For each dataset, print the grade ( A , B , C , D or F ) in a line. Sample Input 40 42 -1
20 30 -1
0 2 -1
-1 -1 -1 Sample Output A
C
F

Solution (Python):
while True:
	test=list(map(int,input().split()))
	if test[0]==-1 and test[1]==-1 and test[2]==-1:
		break
	elif test[0]==-1 or test[1]==-1:
		print('F')
	elif 80<=test[0]+test[1]:
		print('A')
	elif 65<=test[0]+test[1]<80:
		print('B')
	elif 50<=test[0]+test[1]<65:
		print('C')
	elif 30<=test[0]+test[1]<50:
		if 50<=test[2]:
			print('C')
		else:
			print('D')
	elif test[0]+test[1]<30:
		print('F')

Solution (Python):
dataset = []

while True:
    data = list(map(int,input().split()))
    dataset.append(data)
    if data == [-1,-1,-1]:
        break
    
for i in range(len(dataset)-1):
    if dataset[i][0] == -1 or dataset[i][1] == -1:
        print('F')
    else:
        if dataset[i][0]+dataset[i][1] >= 80:
            print('A')
        elif dataset[i][0]+dataset[i][1] >= 65:
            print('B')
        elif dataset[i][0]+dataset[i][1] >= 50:
            print('C')
        elif dataset[i][0]+dataset[i][1] >= 30:
            if dataset[i][2] >= 50:
                print('C')
            else:
                print('D')
        elif dataset[i][0]+dataset[i][1] < 30:
            print('F')

Solution (Python):
grades = []
m, f, r = map(int, input().split())

while (m != -1 or f != -1 or r != -1):
    if (m == -1 or f == -1):
        grades.append('F')
    elif (m +f >= 80):
        grades.append('A')
    elif (m +f >= 65 and m +f < 80):
        grades.append('B')
    elif (m +f >= 50 and m +f < 65):
        grades.append('C')
    elif (m +f >= 30 and m +f < 50):
        if (r >= 50):
            grades.append('C')
        else :
            grades.append('D')
    else :
        grades.append('F')
    m, f, r = map(int, input().split())

for i in grades:
    print(i)

Solution (Python):

border_a = 80
border_b = 65
border_c = 50
border_d = 30
border_retest = 50


while True:
    m,f,r = map(int, input().split())
    mf = m + f

    if (m==-1)and(f==-1)and(r==-1):
        break
    elif (m==-1)or(f==-1):
        print("F")
    elif mf >= border_a:
        print("A")
    elif mf >= border_b:
        print("B")
    elif mf >= border_c:
        print("C")
    elif mf >= border_d:
        if r >= border_retest:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):






def judge(point,re_exam_point):
    if point>=80:
        return "A"
    elif 65 <= point < 80:
        return "B"
    elif 50 <= point < 65:
        return "C"
    elif 30 <= point < 50:
        if re_exam_point >= 50:
            return "C"
        return "D"
    else:
        return "F"
        
while(True):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    if m==-1 or f==-1:
        print("F")
    else:
        total=m+f
        print(judge(total,r))

Solution (Python):
while True:
	m,f,r=map(int,input().split())
	if m==-1 and f==-1 and r==-1:
		break
	if m==-1 or f==-1 or m+f<30:
		print("F")
	elif m+f>=80:
		print("A")
	elif m+f>=65:
		print("B")
	elif m+f>=50:
		print("C")
	elif m+f>=30:
		if r>=50:
			print("C")
		else:
			print("D")

Solution (Python):
gradeList = []
i = 0

while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    mf= m + f
    if m == -1 or f == -1:
        grade = 'F'
    elif m + f >= 80:
        grade = 'A'
    elif mf >=65 and mf < 80:
        grade = 'B'
    elif mf >= 50 and mf < 65:
        grade = 'C'
    elif mf >= 30 and mf < 50:
        if r >= 50:
            grade = 'C'
        else:
            grade = 'D'
    else:
        grade = 'F'
    
    gradeList.append(grade)

for i in range(len(gradeList)):
    print(gradeList[i])

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1: break
    if m == -1 or f == -1:
        print("F")
    elif 80 <= (m + f):
        print("A")
    elif 65 <= (m + f) < 80:
        print("B")
    elif 50 <= (m + f) < 65:
        print("C")
    elif 30 <= (m + f) < 50:
        if 50 <= r:
            print("C")
        else:
            print("D")
    elif (m + f) < 30:
        print("F")

Solution (Python):
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

while True:
    M,F,R = map(int,input().split())
    if M == -1 and F == -1 and R == -1:
        break
    if M == -1 or F == -1:
        print("F")
    elif M+F >= 80:
        print("A")
    elif M+F >= 65:
        print("B")
    elif M+F >= 50:
        print("C")
    elif M+F >= 30:
        if R >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
L = []
while True:
        a = list(map(int, input().split()))
        if a[0] == -1and a[1] == -1 and a[2]==-1:
            break

        L.append(a)

def f(m,f,r):

    s = m + f
    if m == -1 or f == -1:
        print("F")
    elif s >= 80:
        print("A")
    elif s >= 65 and s <80:
        print("B")
    elif s >= 50 and s <65:
        print("C")
    elif s >= 30 and s <50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

for i in range(len(L)):
    f(L[i][0],L[i][1],L[i][2])

Solution (Python):
m = [0] * 50
f = [0] * 50
r = [0] * 50
seiseki = ['S'] * 50

for i in range(50):
    m[i], f[i], r[i] = map(int, input().split())
    if m[i] == f[i] == r[i] == -1:
        break
    if m[i] == -1 or f[i] == -1:
        seiseki[i] = 'F'
    elif m[i] + f[i] >= 80:
        seiseki[i] = 'A'
    elif m[i] + f[i] >= 65:
        seiseki[i] = 'B'
    elif m[i] + f[i] >= 50:
        seiseki[i] = 'C'
    elif m[i] + f[i] >= 30 and r[i] >= 50:
        seiseki[i] = 'C'
    elif m[i] + f[i] >= 30:
            seiseki[i] = 'D'
    elif m[i] + f[i] < 30:
        seiseki[i] = 'F'

for i in range(50):
    if seiseki[i] == 'S':
        break
    print(seiseki[i])

Solution (Python):
while True:
    m,f,r = map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    if m==-1 or f==-1:
        print('F')
    elif m+f >= 80:
        print('A')
    elif 65 <= m+f < 80:
        print('B')
    elif 50 <= m+f < 65:
        print('C')
    elif 30 <= m+f < 50:
        if 50 <= r:
            print('C')
        else:
            print('D')
    elif m+f < 30:
        print('F')

Solution (Python):
while True:
    m,f,r=map(int,input().split())
    if m==f==r==-1:
        break
    if m==-1 or f==-1 or m+f<30:
        print('F')
    elif m+f>=80:
        print('A')
    elif m+f>=65:
        print('B')
    elif m+f>=50:
        print('C')
    elif m+f>=30 and r>=50:
        print('C')
    else:
        print('D')

Solution (Python):


if __name__ == '__main__':
    while True:
        m, f, r = map(int, raw_input().split())

        if [m, f, r] == [-1, -1, -1]:
            break

        if m == -1 or f == -1:
            print 'F'
        elif m+f >= 80:
            print 'A'
        elif m+f >= 65:
            print 'B'
        elif m+f >= 50 or r >= 50:
            print 'C'
        elif m+f >= 30:
            print 'D'
        else:
            print 'F'

Solution (Python):
while True:
  m, f, r = list(map(int, input().split()))
  if m==f==r==-1:
    break
  if m==-1 or f==-1:
    print("F")
  elif m+f>=80:
    print("A")
  elif m+f>=65:
    print("B")
  elif m+f>=50 or (m+f>=30 and r>=50):
    print("C")
  elif m+f>=30:
    print("D")
  else:
    print("F")

Solution (Python):
while True:
  m, f, r = list(map(int, input().split()))
  if m == -1 and f == -1 and r == -1:
    break
  if m == -1 or f == -1:
    print("F")
  elif m + f >= 80:
    print("A")
  elif m + f >= 65:
    print("B")
  elif m + f >= 50:
    print("C")
  elif m + f >= 30:
    print("C" if r >= 50 else "D")
  else:
    print("F")

Solution (Python):
sss = input()
while not sss == '-1 -1 -1':
	m,f,r = map(int, sss.split(' '))
	if m == -1 or f == -1:
		print('F')
	elif m+f >= 80:
		print('A')
	elif m+f >= 65 and m+f < 80:
		print('B')
	elif m+f >= 50 and m+f < 65:
		print('C')
	elif m+f >= 30 and m+f < 50:
		if r >= 50: print('C')
		else: print('D')
	elif m+f < 30:
		print('F')
	sss = input()

Solution (Python):
data = []
tmp = []
for x in range(0,1000000):
    a,b,c = map(int, input().split())
    if a==-1 and b==-1 and c==-1:
        break
    else:
        data.append((a,b,c))
for x in range(0,len(data)):
    tmp = list(data.pop(0))
    if tmp[0] == -1 or tmp[1] == -1 or tmp[0]+tmp[1] <30:
        print("F")
    elif 79< (tmp[0]+tmp[1]) :
        print("A")
    elif 64< (tmp[0]+tmp[1]) <80:
        print("B")
    elif 49<(tmp[0]+tmp[1])<65 or (29<(tmp[0]+tmp[1])<50 and  49<tmp[2]):
        print("C")
    else:
        print("D")
    tmp.clear()