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):
ans = []*10000000
count = 0
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):
        ans.append("F")
    elif(m+f >= 80):
        ans.append("A")
    elif(m+f >=65):
        ans.append("B")
    elif(m+f >= 50):
        ans.append("C")
    elif(m+f >= 30):
        if(r >= 50):
            ans.append("C")
        else:
            ans.append("D")
    else:
        ans.append("F")
    count += 1


for i in range(0,count):
    print(ans[i])

Solution (Python):
for _ in range(50):
    m, f, r = [int(x) for x in input().split(' ')]
    if m == f == 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):
import sys



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

while 1:
    m, f, r = map(int, readline().split())
    if m == -1 and f == -1 and 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):


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

    grade = None
    if m < 0 or f < 0:
        grade = "F"
    elif m + f >= 80:
        grade = "A"
    elif m + f >= 65:
        grade = "B" 
    elif m + f >= 50:
        grade = "C"
    elif m + f >= 30:
        grade = "D"
        if r >= 50:
            grade = "C"
    else:
        grade = "F"
    print(grade)

Solution (Python):
while True:
    m, f, r = map(lambda x: int(x), 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 = [int(i) for i 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 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 and r >= 50:
        print("C")
    elif m + f < 50 and m + f >= 30:
        print("D")
    elif m + f < 30:
        print("F")

Solution (Python):

import sys



while(1):
    tmp = input().split()
    m,f,r = list(map(lambda a: int(a), tmp))

    if((m==-1)and(f==-1)and(r==-1)):
        sys.exit()

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

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

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

Solution (Python):
cnt = 1
while(cnt <= 50):
    d_set = input()
    d_set = d_set.split()
    m,f,r = d_set
    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) 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')

    
    cnt += 1

Solution (Python):
scores =[]
while True:
    score = list(map(int,input().split()))
    if all([i == -1 for i in score]):
        break
    scores.append(score)

def judge(score):
    if score[0] == -1 or score[1] == -1:
        print('F')
    elif score[0] + score[1] >= 80:
        print('A')
    elif score[0] + score[1] >= 65:
        print('B')
    elif score[0] + score[1] >= 50:
        print('C')
    elif score[0] + score[1] >= 30:
        if score[2] >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

for i in scores:
    judge(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 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())
    total = m + f
    if m == f == r == -1:
        break
    if (m == -1) | (f == -1):
        print("F")
    elif 80 <= total:
        print("A")
    elif 65 <= total < 80:
        print("B")
    elif 50 <= total < 65:
        print("C")
    elif 30 <= total < 50:
        if 50 <= r:
            print("C")
        else:
            print("D")
    elif total < 30:
        print("F")

Solution (Python):
for i in range (50):
    m,f,r = list(map(int,input().split()))
    if [m,f,r] == [-1,-1,-1]:
        break
    else:
        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):
end = False

while end is False:
	m, f, r = map(int, input().split())
	if m == f == r == -1:
		end = True
	else:
		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 True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    else:
        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):
m, f, r = map(int, input().split())

while m != -1 or f != -1 or r != -1:
    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:
        print("C" if 50 <= r else "D")
    else:
        print("F")

    m, f, r = map(int, input().split())

Solution (Python):

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

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

Solution (Python):

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 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):
def judge(m,f,r):
    if (m == -1 or f == -1) or 30 > m+f:
        return 'F'
    elif m+f >= 80:
        return 'A'
    elif 80 > m+f >= 65:
        return 'B'
    elif 65 > m+f >= 50 or (50 > m+f >= 30 and r >= 50):
        return 'C'
    else:
        return 'D'

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

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
    if 65<= a+b <80:
        print("B")
        continue
    if 50<= a+b <65:
        print("C")
        continue
    if 30<= a+b <50:
        if c >= 50:
            print("C")
            continue
        else:
            print("D")
            continue
    print("F")

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

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

Solution (Python):
answer = []

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

    
    if (m == -1) or (f == -1):
        answer.append("F")
    
    elif 80 <= m + f:
        answer.append("A")
    
    elif 65 <= m + f < 80:
        answer.append("B")
    
    
    elif (50 <= m + f < 65) or (50 <= r):
        answer.append("C")
    
    elif 30 <= m + f < 50:
        answer.append("D")
    
    elif m + f < 30:
        answer.append("F")

[print(*answer[i]) for i in range(len(answer))]

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

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

Solution (Python):
for _ in range(10000):
    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')
        continue
    elif (m+f>=80):
        print('A')
        continue
    elif (m+f>=65):
        print('B')
        continue
    elif (m+f>=50):
        print('C')
        continue
    elif (m+f>=30):
        if (r>=50):
            print('C')
            continue
        else:
            print('D')
            continue
    else:
        print('F')
        continue

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    if m + f + r == -3:
        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):
import sys

score = []
while (True):
    lst = list(map(int, input().split(' ')))
    if lst[0] == -1 and lst[1] == -1 and lst[2] == -1:
        break
    score.append(lst)


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

Solution (Python):

student_max = 50
student_result = list()
student_grade = list()

for i in range(student_max):

    
    student_result.append(list(map(int, input().split())))

    
    if sum(student_result[i]) == -3:
        break
    
    
    if student_result[i][0] == -1 or student_result[i][1] == -1:
        student_grade.append("F")
    elif student_result[i][0] + student_result[i][1] >= 80:
        student_grade.append("A")
    elif student_result[i][0] + student_result[i][1] >= 65:
        student_grade.append("B")
    elif student_result[i][0] + student_result[i][1] >= 50:
        student_grade.append("C")
    elif student_result[i][0] + student_result[i][1] >= 30:
        if student_result[i][2] >= 50:
            student_grade.append("C")
        else:
            student_grade.append("D")
    else:
        student_grade.append("F")


[print(i) for i in student_grade]

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

Solution (Python):
a=0
list_grade=[]
list_grade.append([int(w) for w in input().split()])

while not list_grade[a]==[-1,-1,-1]:
    a+=1
    list_grade.append([int(w) for w in input().split()])
    
a=0
while not list_grade[a]==[-1,-1,-1]:
    score=list_grade[a][0]+list_grade[a][1]
    if list_grade[a][0]==-1 or list_grade[a][1]==-1 or score<30: 
        print('F')
        a+=1
        continue
    
    if score>=80:
        print('A')
        
    elif 65<=score<80:
        print('B')
        
    elif 50<=score<65:
        print('C')
        
    elif 30<=score<50:
        if list_grade[a][2]>=50:
            print('C')
            a+=1
            continue
        print('D')
    a+=1

Solution (Python):
while True:
    l = list(map(int,input().split()))
    m = l[0]
    f = l[1]
    r = l[2]

    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:
    A,B,C = map(int,input().split())

 
    if A==-1 and B==-1 and C==-1:
        break
    elif A==-1 or B==-1:
        print("F")
        continue
    if A==-1:
        A=0
    if B==-1:
        B=0
        
    if A+B >= 80:
        print("A")
    elif A+B >=65 and A+B < 80:
        print("B")
    elif A+B >=50 and A+B < 65:
        print("C")
    elif A+B >=30 and A+B < 50:
        if C >= 50:
            print("C")
        else:
            print("D")
    elif A+B < 30:
        print("F")

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

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

Solution (Python):
while True:
    m,f,r=list(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<50 and r<50:
        print("D")
    elif m+f<65 or r>=50:
        print("C")
    elif m+f<80:
        print("B")
    else:
        print("A")

Solution (Python):
while True:

    
    m, f, r = map(int, input().split())
    if m==f==r==-1:
        break

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

    print(grade)

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

Solution (Python):
ans = []
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:
        ans.append("F")
    elif m+f >= 80:
        ans.append("A")
    elif m+f >= 65:
        ans.append("B")
    elif m+f >= 50:
        ans.append("C")
    elif m+f >= 30 and r >= 50:
        ans.append("C")
    elif m+f >= 30:
        ans.append("D")
    else:
        ans.append("F")
        
for i in ans:
    print(i)

Solution (Python):
list=[]
for i in range(50):
    a=map(int,raw_input().split())
    b="grade"
    if a==[-1,-1,-1]:
        break
    elif a[0]==-1 or a[1]==-1:
        b="F"
    elif a[0]+a[1]>=80:
        b="A"
    elif a[0]+a[1]>=65:
        b="B"
    elif a[0]+a[1]>=50:
        b="C"
    elif a[0]+a[1]>=30:
        b="D"
        if a[2]>=50:
            b="C"
    else:
        b="F"
    list.append(b)
for i in range(len(list)):
    print list[i]

Solution (Python):
while True:
    mid_score, final_score, re_score = map(float, input().split())
    
    if mid_score == final_score == re_score == -1:
        break
    
    sum_score = mid_score + final_score
    
    if mid_score == -1 or final_score == -1 or sum_score < 30:
        print("F")
    elif 30 <= sum_score < 50:
        if re_score < 50:
            print("D")
        else:
            print("C")
    elif 50 <= sum_score < 65:
        print("C")
    elif 65 <= sum_score < 80:
        print("B")
    elif 80 <= sum_score:
        print("A")

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

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 and (m + f) <80:
        print("B")
    
    elif (m + f) >= 50 and (m + f) < 65:
        print("C")
    
    elif (m + f) >= 30 and (m + f) < 50 and r <50:
        print("D")
    elif (m + f) >= 30 and (m + f) < 50 and r >= 50:
        print("C")
    
    elif (m + f) < 30:
        print("F")

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

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

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

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 (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):
        exit()
    if (m==-1 or f==-1):
        print("F")
        continue
    if(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 == f == r == -1:
    break
  else:
    if m == -1 or f == -1:
      print('F')
    elif 80 <= (m + f):
      print('A')
    elif 65 <= (m + f):
      print('B')
    elif 50 <= (m + f):
      print('C')
    elif 30 <= (m + f):
      if 50 <= r:
        print('C')
      else:
        print('D')
    else:
      print('F')

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

Solution (Python):
def grading_student(scores):
    
    for i, score in enumerate(scores):

        grade = ""
        total = score[0] + score[1]
        
        if score[0] == -1 or score[1] == -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 score[2] >= 50:
                grade = "C"
            else:
                grade = "D"
        elif total < 30:
            grade = "F"

        print(grade, end="")

        
        print("\n", end="")


if __name__ == "__main__":
    

    
    score = list()
    
    while(True):

        param = input().split(" ")

        s = [ int(a) for a in param ]

        if s[0] == -1 and s[1] == -1 and s[2] == -1:
            break
        else:
            score.append(s)
            

    grading_student(score)

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