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:
    m,f,r = map(int, input().split())

    if m == -1 and f == -1 and r == -1:
        break 

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

Solution (Python):
def rating(m, f, r):
    if m==-1 and f==-1 and r==-1:
        return ""
    elif m==-1 or f==-1:
        return "F"
    elif m + f >= 80:
        return "A"
    elif m + f >= 65:
        return "B"
    elif m + f >= 50:
        return "C"
    elif m + f >= 30:
        if r >= 50:
            return "C"
        else:
            return "D"
    else:
        return "F"

while True:
    buff = input()
    m, f, r = map(int, buff.split())
    rate = rating(m, f, r)
    if rate == "":
        break
    else:
        print(rate)

Solution (Python):
while True:
  m,f,r = map(int, input().split())
  if m == -1 & f == -1 & 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):
while 1:
    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):
while True:
    exam=list(map(int,input().split()))
    if exam[0]==-1 and exam[1]==-1 and exam[2]==-1: break
    
    if exam[0]==-1 or exam[1]==-1:print('F')
    else:
        sum=exam[0]+exam[1]
        
        if sum>=80:print('A')
        elif sum>=65:print('B')
        elif sum>=50:print('C')
        elif sum>=30:
            if exam[2]>=50:print('C')
            else:print('D')
        else: print('F')

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

for item in grade:
	print(item)

Solution (Python):
m = []
f = []
r = []
while True:
    m1,f1,r1 = map(int,input().split())
    if (m1 == -1)*(f1 == -1)*(r1 == -1) :
        break
    m.append(int(m1))
    f.append(int(f1))
    r.append(int(r1))

for i in range (len(m)):
    if (m[i] == -1) or (f[i] == -1):
        print("F")
    elif (m[i]+f[i]) >=80:
        print("A")
    elif (m[i]+f[i]) >=65:
        print("B")
    elif (m[i]+f[i]) >=50:
        print("C")
    elif ((m[i]+f[i]) >=30)*(r[i]>=50):
        print("C")
    elif ((m[i]+f[i]) >=30)*(r[i]<50):
        print("D")
    else:
        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:
        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):
for i in range(50):
    m, f, r = list(map(int, input().split()))
    sum = m + f
    if m == f == r == -1:
        break
    else:
        if m == -1 or f == -1 or (0<=sum and sum<30):
            print('F')
        elif sum < 50 and r < 50:
            print('D')
        elif sum < 65 or 50 <= r:
            print('C')
        elif sum < 80:
            print('B')
        else:
            print('A')

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

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

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

Solution (Python):
def result(_m, _f, _r):
    if _m==-1 or _f==-1: return "F"
    elif _m+_f>=80: return "A"
    elif _m+_f>=65: return "B"
    elif _m+_f>=50: return "C"
    elif _m+_f>=30 and _r>=50: return "C"
    elif _m+_f>=30: return "D"
    else: return "F"

while True:
    m,f,r = map(int, input().split())
    if m==-1 and f==-1 and r==-1: break
    print(result(m,f,r))

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

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 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):
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):
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -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 or r >= 50:
        print("C")
    elif 30 <= (m+f) < 50:
        print("D")
    elif m+f < 30:
        print("F")

Solution (Python):
def main():
    ans = []
    while True:
        m, f, r = map(int, input().split())
        if m == -1 and f == -1 and r == -1:
            break
        s = 0
        if m >= 0:
            s += m
        if f >= 0:
            s += f
        if m == -1 or f == -1:
            ans.append('F')
        elif s >= 80:
            ans.append('A')
        elif 80 > s >= 65:
            ans.append('B')
        elif 65 > s >= 50 or r >= 50:
            ans.append('C')
        elif 50 > s >= 30:
            ans.append('D')
        elif 30 > s:
            ans.append('F')
    for a in ans:
        print(a)


main()

Solution (Python):

while True:
    line = input().split()
    m = int(line[0])
    f = int(line[1])
    r = int(line[2])
    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 < 80 and m+f >= 65):
        print("B")
    elif (m+f < 65 and m+f >=50):
        print("C")
    elif (m+f < 50 and m+f >=30):
        if (r >= 50):
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
while True:
    c, k, s = map(int, input().split())
    if c+k+s > -3:
        if -1 in [c, k]:
            print('F')
        elif c+k >= 80:
            print('A')
        elif c+k >= 65:
            print('B')
        elif c+k >= 50:
            print('C')
        elif c+k >= 30:
            if s >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')
    else:
        break

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

Solution (Python):
mid = 0
end = 0
re = 0

while(1):
    mid, end, re = map(int, input().split() )
    if (mid == -1) and (end == -1) and (re == -1) :
        break

    if (mid == -1) or (end == -1):
        print("F")
    elif mid + end >= 80:
        print("A")
    elif mid + end >= 65:
        print("B")
    elif mid + end >= 50:
        print("C")
    elif mid + end >= 30:
        if re >= 50:
            print("C")
        else: print("D")
    else: print("F")

Solution (Python):
while True:
        list = input().split()
        m = int(list[0])
        f = int(list[1])
        r = int(list[2])
        if m == -1 and f == -1 and r == -1:
                break
        elif 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):
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("D")
        else:
            print("C")
    else:
        print("F")

Solution (Python):
while True:
    grade = input()
    grade_list = grade.split(" ")
    mid_exam = int(grade_list[0])
    fin_exam = int(grade_list[1])
    re_exam = int(grade_list[2])
    if mid_exam == -1 and fin_exam == -1 and re_exam == -1:
        break
    if mid_exam == -1 or  fin_exam == -1:
        print("F")
    elif mid_exam + fin_exam >= 80:
        print("A")
    elif mid_exam + fin_exam >= 65:
        print("B")
    elif mid_exam + fin_exam >= 50:
        print("C")
    elif mid_exam + fin_exam >= 30 and re_exam >= 50:
        print("C")
    elif mid_exam + fin_exam >= 30:
        print("D")
    else:
        print("F")

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

Solution (Python):
while True:
    a=input()
    b=a.split()
    m=int(b[0])
    f=int(b[1])
    c=int(b[0])+int(b[1])
    if m==-1 and f==-1 and int(b[2])==-1:
        break
    elif m==-1 or f==-1:
        print("F")
    elif c>=80:
        print("A")
    elif 80>c>=65:
        print("B")
    elif 65>c>=50 or int(b[2])>=50:
        print("C")
    elif 50>c>=30:
        print("D")
    elif 30>c:
        print("F")

Solution (Python):
m, f, r = map(int, input().split())
while m >= 0 or f >= 0 or r >= 0:
	if m < 0 or f < 0 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")
	m, f, r = map(int, input().split())

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

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

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 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):
while 1:
 m,f,r=map(int,input().split())
 if m==f==r==-1:break
 s=m+f;print(("ABCDF")[(s<80)+(s<65)+(s<50>r)+((m<0)+(f<0)+(s<30))])

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

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

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

Solution (Python):
while 1:
    a,b,c=map(int, input().split())
    if a*b*c==-1 and a<0:break
    if a<0 or b<0:print('F')
    elif a+b>=80:print('A')
    elif a+b>=65:print('B')
    elif a+b>=50:print('C')
    elif a+b>=30:
        if c>=50:print('C')
        else:print('D')
    else:print('F')

Solution (Python):
table = [[0]*3 for i in range(50)]

times = 0 
for i in range(50):
    
    score = input().split()
    
    if  score[0] == "-1" and score[1] == "-1" and score[2] == "-1":
        break
        
    for j in range(3):
         table[i][j] = int(score[j])
    
    times += 1

for a in range(times):
    
    total_score = table[a][0] + table[a][1]
    
    if table[a][0] == -1 or table[a][1] == -1:
        print("F")
    
    elif total_score >= 80:
        print("A")

    elif total_score >= 65:
        print("B")

    elif total_score >= 50:
        print("C")

    elif total_score >= 30:
        if table[a][2] >= 50:
             print("C")
        else:
             print("D")
    else:
        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 : ans = "F"
    elif (m+f >= 80) : ans = "A"
    elif (m+f >= 65) : ans = "B"
    elif (m+f >= 50) : ans = "C"
    elif (m+f >= 30) :
        if (r >= 50) : ans = "C"
        else : ans = "D"
    else : ans = "F"
    print(ans)

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

Solution (Python):




import math

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

Solution (Python):
import sys


def evaluate(m, f, r):
    if m == -1 or f == -1:
        return 'F'

    total = m + f

    if total >= 80:
        return 'A'
    if total >= 65:
        return 'B'
    if total >= 50:
        return 'C'
    if total >= 30:
        return 'C' if r >= 50 else 'D'
    return 'F'


for line in sys.stdin:
    m, f, r = map(int, line.strip().split())
    if m == f == r == -1:
        break
    print(evaluate(m, f, r))

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

Solution (Python):
data = []

while 1:
    data.append(list(map(int, input().split())))
    if data[-1] == [-1,-1,-1]:
        data.pop(-1)
        break

for i in range(len(data)):
    TOTAL = data[i][0] + data[i][1]

    if data[i][0] * data[i][1] < 0:
        print('F')
        continue
    elif TOTAL >= 80:
        print('A')
        continue
    elif TOTAL >= 65:
        print('B')
        continue
    elif TOTAL >= 50:
        print('C')
        continue
    elif TOTAL >= 30:
        if data[i][2] >= 50:
            print('C')
        else:
            print('D')
    else:
        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:
        jdg='F'
    elif m+f>=80:
        jdg="A"
    elif m+f>=65:
        jdg="B"
    elif m+f>=50:
        jdg="C"
    else:
        jdg="C" if r>=50 else "D"
    print(jdg)

Solution (Python):
import bisect

def rank(m, f, r):
    if m == -1 or f == -1:
        return 'F'
    sum = m + f
    if 30 <= sum < 50 and r >= 50:
        return 'C'
    return 'FDCBA'[bisect.bisect([30,50,65,80],sum)]

while True:
    m, f, r = input().split()
    if m == f == r == '-1':
        break
    print(rank(int(m),int(f),int(r)))

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif 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 r >= 50:
            print('C')
        else:
            print('D')
    elif (m + f) < 30:
        print('F')

Solution (Python):
def main():
	while True:
		m, f, r = (int(x) for x in input().split())
		if m == -1 and f == -1 and r == -1:
			break
		elif 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')
		else:
			print('F')

main()

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

Solution (Python):
soten_set=[]
soten=list(map(int,input().split()))

while soten[0]!=-1 or soten[1]!=-1 or soten[2]!=-1:
    soten_set.append(soten)
    soten=list(map(int,input().split()))

for i in range(len(soten_set)):
    m=soten_set[i][0]
    f=soten_set[i][1]
    r=soten_set[i][2]

    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")
    elif m+f<30:
        print("F")

Solution (Python):


score = []
while True:
  m, f, r = map(int, input().split())
  if (m == -1 and f == -1 and r == -1):
    break
  else:
    score.append([m, f, r])

for i in range(len(score)):
  if (score[i][0] == -1 or score[i][1] == -1):
      print("F")
  elif (score[i][0]+score[i][1] >= 80):
    print("A")
  elif (score[i][0]+score[i][1] >= 65):
    print("B")
  elif (score[i][0]+score[i][1] >= 50 or (score[i][0]+score[i][1] >= 30 and score[i][2] >= 50)):
    print("C")
  elif (score[i][0]+score[i][1] >= 30):
    print("D")
  else:
    print("F")

Solution (Python):

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

Solution (Python):
import sys
for i in range(sys.maxsize):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif 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):
score = ["e" for i in range(50)]
counter = 0
for i in range(50):
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    counter += 1
    if m == -1 or f == -1:
        score[i] = "F"
    elif m + f >= 80:
        score[i] = "A"
    elif m + f >= 65:
        score[i] = "B"
    elif m + f >= 50:
        score[i] = "C"
    elif m + f >= 30:
        if r >= 50:
            score[i] ="C"
        else:
            score[i] = "D"
    else:
        score[i] = "F"
for i in range(counter):
    print (score[i])

Solution (Python):
mlist = []
flist = []
rlist = []

while(1):
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    mlist.append(m)
    flist.append(f)
    rlist.append(r)

for m, f, r in zip(mlist, flist, rlist):
    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")
    else:
        print("F")

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

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

Solution (Python):
def calculate_grade(m,f,r):
    grade = ''
    if m+f+r == -3:
        return None
    else:
        total = m+f
        if  m == -1 or f == -1:
            grade = 'F'
        elif   total >= 80:
            grade = 'A'
        elif 65 <= total < 80:
            grade = 'B'
        elif 50 <= total < 65:
            grade = 'C'
        elif 30 <= total < 50:
            if r >= 50:
                grade = 'C'
            else:
                grade = 'D'
        elif total < 30:
            grade = 'F'
    return grade


while True:
    m,f,r = map(int,input().split())
    ans = calculate_grade(m,f,r)
    if ans:
        print(ans)
    else:
        break

Solution (Python):
while True:
    temp = input()
    m, f, r = temp.split(' ')
    m, f, r = int(m), int(f), int(r)
    
    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):
score = []
while True:
    (m,f,r)=map(int, input().split())
    if (m,f,r)==(-1,-1,-1):
        break
    score.append([m, f, r])
    
for i in range(len(score)):
    m=score[i][0]
    f=score[i][1]
    r=score[i][2]
    if m==-1 or f==-1:
        grade = "F"
    elif (m+f)>=80:
        grade = "A"
    elif (m+f)>=65:
        grade = "B"
    elif (m+f)>=50:
        grade = "C"
    elif (m+f)>=30:
        if r>= 50:
            grade = "C"
        else:
            grade = "D"
    else:
        grade = "F"
    print(grade)

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

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

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

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    if m==f==r==-1:
        break
    if m<0 or f<0:
        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')