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



Sample input:
40 42 -1
20 30 -1
0 2 -1
-1 -1 -1


Sample output:
A
C
F

Submission status: Accepted

Solution code:
'''
ITP-1_7-A
 ??????
????????????????????????????????????????????°????????????????????????????????°??????????????????????????¨??§??????
????????°??????????????°?????????????????????????????°????????????????????????
?????????????????°????????????????¨?????????° m?????????????¨?????????° f??????????¨?????????° r ??§?§?????????????????????????
??????????¨???¨??????????¨???? 50 ????????????m, f ??? 50?????????????¨???? 100 ????????? ???r ??? 100?????§??????
????¨????????????????????????´???????????°??? -1 ??¨????????????
??\??????????????§??????????????????????????????
?????????????¨??????????????¨????????????????????¬????????????´???????????? F???
?????????????¨???¨??????????¨????????¨??????°??? 80 ??\???????????°????????? A ???
?????????????¨???¨??????????¨????????¨??????°??? 65 ??\??? 80 ??????????????°????????? B???
?????????????¨???¨??????????¨????????¨??????°??? 50 ??\??? 65 ??????????????°????????? C???
?????????????¨???¨??????????¨????????¨??????°??? 30 ??\??? 50 ??????????????°????????? D???
??????????????????????¨?????????°??? 50 ??\???????????°????????? C???
?????????????¨???¨??????????¨????????¨??????°??? 30 ??????????????°????????? F???
???Input
?????°??????????????????????????\?????¨??????????????????????????????????????????????????§??????????????§??????????????? m???f???r ??? 1 ???????????????????????????
m???f???r ???????????? -1 ?????¨?????\?????????????????¨????????????
???Output
?????????????????????????????????????????????A???B???C???D???????????? F???????????????????????????????????????
'''
while True:
    # ??????????¨?????????° m?????????????¨?????????° f??????????¨?????????° r
    m, f, r = map(int, input().split())
    mf = m + f

    # EndCheck
    if m == f == r == -1:
        break

    # ?????????????¨??????????????¨????????????????????¬????????????´???????????? F???
    if -1 == m or -1 == f:
        print('F')
        continue
    # ?????????????¨???¨??????????¨????????¨??????°??? 80 ??\???????????°????????? A ???
    elif 80 <= mf:
        print('A')
    # ?????????????¨???¨??????????¨????????¨??????°??? 65 ??\??? 80 ??????????????°????????? B???
    elif 65 <= mf < 80:
        print('B')
    # ?????????????¨???¨??????????¨????????¨??????°??? 50 ??\??? 65 ??????????????°????????? C???
    elif 50 <= mf < 65:
        print('C')
    # ?????????????¨???¨??????????¨????????¨??????°??? 30 ??\??? 50 ??????????????°????????? D???
    elif 30 <= mf < 50:
        # ???????????????????¨?????????°??? 50 ??\???????????°????????? C???
        if 50 <= r:
            print('C')
        else:
            print('D')
    # ?????????????¨???¨??????????¨????????¨??????°??? 30 ??????????????°????????? F???
    elif 30 > mf:
        print('F')

Submission status: Accepted

Solution code:
def seiseki(m,f,r):
    if m == -1 or f == -1:
        return 'F'
    if m + f >= 80:
        return 'A'
    if m + f >= 65 and m + f < 80:
        return 'B'
    if m + f >= 50 and m + f < 65:
        return 'C'
    if m + f >= 30 and m + f < 50 and r >= 50:
        return 'C'
    if m + f >= 30 and m + f < 50:
        return 'D'
    if m + f < 30:
        return 'F'

import sys

for l in sys.stdin:
    m, f, r = map(int,l.split())
    if f == -1 and m == -1 and r == -1:
        break
    print (seiseki(m,f,r))

Submission status: Accepted

Solution code:
import sys

#fin = open("test.txt", "r")
fin = sys.stdin

while True:
	[m, f, r] = list(map(int, fin.readline().split()))

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

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

Submission status: Accepted

Solution code:
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 or m + f < 30:
        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 r >= 50:
            print("C")
        else:
            print("D")

Submission status: Accepted

Solution code:
while 1:
    m,f,r=map(int,raw_input().split())
    #m:Midterm exam  f:final exam r:Retest
    score=m+f
    if m == -1  or  f ==  -1 :
        if m == -1 and f == -1 and r == -1 :
            break
        else: 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'

Submission status: Accepted

Solution code:
#!usr/bin/env python3

import sys


def main():
    while True:
        m, f, r = [int(score) for score in sys.stdin.readline().split()]
        if m == f == r == -1:
            break
        if m == -1 or f == -1:
            print('F')
        elif 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')
        elif m+f < 30:
            print('F')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3

import sys


def main():
    while True:
        m, f, r = [int(score) for score in sys.stdin.readline().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 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')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

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:
		print("F")
	elif MF >= 80:
		print("A")
	elif MF >= 65:
		print("B")
	elif MF >= 50:
		print("C")
	elif MF >= 30:
		if r >= 50:
			print("C")
		else:
			print("D")
	else:
		print("F")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 < 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 < 30:
            print("F")
        else:
            print("D")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
out_grade = ""

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

    print(rank)

Submission status: Accepted

Solution code:
while True:
    m, f, r = [int(x) for x in input().split(" ")]
    if m == f == r == -1:
        break

    sum = m + f
    if m == -1 or f == -1:
        res = "F"
    elif sum >= 80:
        res = "A"
    elif 65<= sum < 80:
        res = "B"
    elif 50<= sum < 65:
        res = "C"
    elif 30<= sum < 50:
        res = "D"
    else:
        res = "F"

    if res == "D" and r >= 50: res = "C"

    print(res)

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
import sys

result = []
grade = []
for i in sys.stdin:
    m, f, r = map(int, i.split())
    if m == f == r == -1:
        break
    result.append([m, f, r])

for j in range(len(result)):
    sum = result[j][0] + result[j][1]
    if result[j][0] == -1 or result[j][1] == -1 or sum < 30:
        grade.append('F')
    elif sum >= 80:
        grade.append('A')
    elif 65 <= sum < 80:
        grade.append('B')
    elif 50 <= sum < 65:
        grade.append('C')
    elif 30 <= sum < 50:
        grade.append('D')
        if result[j][2] >= 50:
            grade[j] = 'C'

for k in range(len(grade)):
    print(grade[k])

Submission status: Accepted

Solution code:
while True :
    a, b, c = [int(temp) for temp in input().split()]
    if a == b == c == -1 : break
    if   (a == -1) or (b == -1) or (a + b < 30) : print('F')
    elif (80 <= a + b) : print('A')
    elif (65 <= a + b) : print('B')
    elif (50 <= a + b) or ((30 <= a + b) and (50 <= c)) : print('C')
    else : print('D')

Submission status: Accepted

Solution code:
array = []
while True:
    n =input()
    if n == "-1 -1 -1":
        break
    array.append(n.split())
suum = 0
seiseki = []
for i in range(len(array)):
    if array[i][0]!="-1" and array[i][1] != "-1":
        suum = int(array[i][0]) + int(array[i][1])
        if suum >= 80:
            seiseki.append("A")
        elif suum < 80 and suum >= 65:
            seiseki.append("B")
        elif suum < 65 and suum >= 50:
            seiseki.append("C")
        elif suum <50 and suum >= 30:
            if int(array[i][2]) >= 50:
                seiseki.append("C")
            else:
                seiseki.append("D")
        else:
            seiseki.append("F")
    else:
        seiseki.append("F")
    print(seiseki[i])

Submission status: Accepted

Solution code:
while True:
    m,f,r = [int(x) for x in input().split()]
    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 and r < 50:
            print("D")
        elif 30 <= m + f < 50 and r >= 50:
            print("C")
        elif m + f < 30:
            print("F")

Submission status: Accepted

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

Submission status: Accepted

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

for i in grade:
    print(i)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os


def input_to_list():
    return list(map(int, input().split()))

for s in sys.stdin:
    m, f, r = list(map(int, s.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')

Submission status: Accepted

Solution code:
pupils = []

while True:
    l = list(map(int, input().split()))
    if sum(l) == -3:
        break
    pupils.append(l)

for pupil in pupils:
    score = pupil[0] + pupil[1]
    if pupil[0] == -1 or  pupil[1] == -1:
        rank = 'F'
    elif score >= 80:
        rank = 'A'
    elif score >= 65:
        rank = 'B'
    elif (score >= 50) or (score >= 30 and pupil[2] >= 50):
        rank = 'C'
    elif score >= 30:
        rank = 'D'
    else:
        rank = 'F'
    print(rank)

Submission status: Accepted

Solution code:
def ifExit(a):
    if a[0] =='-1' and a[1] =='-1' and a[2] =='-1':
        return True
    else:
        return False



l=[]

while(True):
    tmp = input().split()
    if ifExit(tmp): break

    m=int(tmp[0])
    f=int(tmp[1])
    r=int(tmp[2])

    if (m < 0) or (f < 0) :
        l.append('F')
    elif (m+f >= 80):
        l.append('A')
    elif (80 > m+f and m+f >= 65):
        l.append('B')
    elif (65 > m+f and m+f >= 50):
        l.append('C')
    elif (50 > m+f and m+f >= 30):
        if r>=50:
            l.append('C')
        else:
            l.append('D')
    else:
        l.append('F')

print('\n'.join(l))

Submission status: Accepted

Solution code:
m = 0
f = 0
r = 0
while m!=-1 or f!=-1 or r!=-1:
	m,f,r = [int(i) for i in input().split()]
	sum = m + f
	if m!=-1 or f!=-1 or r!=-1:
		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')

Submission status: Accepted

Solution code:
while(1):
    m, f, r = map(int, input().split())

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

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

Submission status: Accepted

Solution code:
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 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')

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !

def func():
    data=[]
    while(True):
        try:
            line=[ int(item) for item in input().rstrip().split(" ") ]
            if(line == [-1, -1, -1]):
                break
            data.append(line)
        except EOFError:
            break
        except:
            return inputError()

    result=""
    for score in data:
        if( (score[0]<0) or (score[1]<0)):
            result+="F\n"
        elif(score[0]+score[1] >= 80):
            result+="A\n"
        elif(score[0]+score[1] >= 65):
            result+="B\n"
        elif(score[0]+score[1] >= 50):
            result+="C\n"
        elif(score[0]+score[1] >= 30):
            if(score[2] >= 50):
                result+="C\n"
            else:
                result+="D\n"
        else:
            result+="F\n"
    
    print(result.rstrip())

def inputError():
    print("input error")
    return -1

func()

Submission status: Accepted

Solution code:
grades = []
lettergrade = []

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

for x in grades:
    if x[0] == -1 or x[1] == -1 or (x[0] + x[1] >= 0 and x[0] + x[1] < 30):
        lettergrade.append('F')
    elif x[0] + x[1] >= 80:
        lettergrade.append('A')
    elif x[0] + x[1] >= 65 and x[0] + x[1] < 80:
        lettergrade.append('B')
    elif (x[0] + x[1] >= 50 and x[0] + x[1] < 65) or (x[2] >= 50):
        lettergrade.append('C')
    else:
        lettergrade.append('D')

print("\n".join(lettergrade))

Submission status: Accepted

Solution code:
while True:
    test = [int(score) for score in input().split(" ")]
    m = test[0]
    f = test[1]
    r = test[2]
   
    if m == f == -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")
    else:
        print("F")

Submission status: Accepted

Solution code:

while True:
    m,f,r = map(int,raw_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 or r >= 50:
        print('C')
    elif m + f >= 30 and m + f < 50:
        print('D')
    elif m + f <= 29:
        print('F')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m=0
f=0
r=0
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:
        print("F")
    elif s>=80:
        print("A")
    elif 80>s>=65:
        print("B")
    elif 65>s>=50:
        print("C")
    elif 50>s>=30:
        if r>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
from sys import stdin

def main():
    for l in stdin:
        m ,f, r = map(int, l.split(' '))

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

        print(judge(m, f, r))

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

    if 80 <= m+f:
        return 'A'

    if 65 <= m+f < 80:
        return 'B'

    if 50 <= m+f < 65:
        return 'C'

    if 30 <= m+f < 50:
        return 'C' if 50 <= r else 'D'

    return 'F'

if __name__ == '__main__': main()

Submission status: Accepted

Solution code:
L = []
m, f, r = map(int, input().split())
while not(m == -1 and f == -1 and r == -1):
 L.append([m, f, r])
 m, f, r = map(int, input().split())
 
for i in L:
 if i[0] == -1 or i[1] == -1:
  print("F")
 elif i[0] + i[1] >= 80:
  print("A")
 elif i[0] + i[1] >= 65:
  print("B")
 elif i[0] + i[1] >=  50:
  print("C")
 elif i[0] + i[1] >= 30 and i[2] >=50:
  print("C")
 elif i[0] + i[1] >= 30:
  print("D")
 else:
  print("F")

Submission status: Accepted

Solution code:
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 < 30:
        print("F")
    elif m + f < 50 and r < 50:
        print("D")
    elif m + f < 65\
    or   m + f < 50 and r > 50:
        print("C")
    elif m + f < 80:
        print("B")
    else:
        print("A")

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    if not (~ m or ~ f or ~ r):
        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')

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, raw_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 and r >= 50:
        print "C"
    elif m + f >= 30:
        print "D"
    else:
        print "F"

Submission status: Accepted

Solution code:
#coding:utf-8

m = 0
f = 0
r = 0

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

Submission status: Accepted

Solution code:
while 1:
    mid,term,add = map(int,input().split())
    if mid == -1 and term == -1 and add == -1:
        break
    s = mid + term
    if mid == -1 or term == -1:
        rank = 'F'    
    elif s >= 80:
        rank = 'A'
    elif s >= 65:
        rank = 'B'
    elif s >= 50:
        rank = 'C'
    elif s >= 30:
        if add >= 50:
            rank = 'C'
        else:
            rank = 'D'
    else:
        rank = 'F'
    print(rank)

Submission status: Accepted

Solution code:
while True:
    s = input().split(" ")
    m = int(s[0])
    f = int(s[1])
    r = int(s[2])
    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")
    else:
        if r >= 50:
            print("C")
        else:
            print("D")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 80 > m + f >= 65:
        print('B')
    elif 65 > m + f >= 50 or r >= 50:
        print('C')
    elif 50 > m + f >= 30:
        print('D')
    else:
        print('F')

Submission status: Accepted

Solution code:
while True:
    m, f, r = list(map(int, input().split()))
    if m == f == 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')
    else:
        print('F')

Submission status: Accepted

Solution code:
while True:
	numlist = list(int(i) for i in input().split())
	mid = numlist[0]
	final = numlist[1]
	retest = numlist[2]

	sum = mid + final

	if mid == -1 and final == -1 and retest == -1:
		break

	if mid == -1 or final == -1:
		print("F")	
	elif sum >= 80:
		print("A")
	elif 80 > sum >= 65:
		print("B")
	elif 65 > sum >= 50:
		print("C")
	elif 50 > sum >= 30 and retest < 50:
		print("D")
	elif 50 > sum >= 30 and retest >= 50:
		print("C")
	elif sum < 30:
		print("F")

Submission status: Accepted

Solution code:
while True:
    m, f, r = list(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) 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")
    else:
        print ("F")

Submission status: Accepted

Solution code:
while 1 :
    x,y,z=[int(i) for i in input().split()]
    if x==y==z==-1:
        break
    if x==-1 or y==-1:
        print('F')
    elif x+y>=80:
        print('A')
    elif x+y>=65:
        print('B')
    elif x+y>=50:
        print('C')
    elif x+y>=30:
        if z>=50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Submission status: Accepted

Solution code:
def grading(m,f,r):
	mf = m+f
	if mf >= 80:
		grade = 'A'
	elif mf >= 65:
		grade = 'B'
	elif mf >= 50:
		grade = 'C'
	elif mf >= 30:
		grade = 'D'
	else:
		grade = 'F'
	if -1 in [m,f]:
		grade = 'F'
	if grade == 'D' and r >= 50:
		grade = 'C'
	return grade

data = []
while True:
	temp = [int(s) for s in input().split(' ')]
	if temp == [-1,-1,-1]:
		break
	else:
		data.append(temp)

grades = [grading(*points) for points in data]
[print(g) for g in grades]

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??´?????????
"""

while True:
    inp = input().strip().split(" ")
    m = int(inp[0])
    f = int(inp[1])
    r = int(inp[2])
#    print(inp[1])
    
    if m < 0 and f < 0 and r < 0 :
        break
    
    if m < 0 or f < 0 :
        S = "F"
    else:
        t = m + f
        if t < 30:
            S = "F"
        elif t < 50:
            if r >= 50:
                S = "C"
            else:
                S = "D"
        elif t < 65:
            S = "C"
        elif t < 80:
            S = "B"
        else:
            S = "A"

    print(S)

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
while True:
    m,f,r=list(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")

Submission status: Accepted

Solution code:
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 = 'F'
  elif m+f >= 80:
    ans = 'A'
  elif m+f >= 65:
    ans = 'B'
  elif m+f >= 50:
    ans = 'C'
  elif m+f >= 30:
    ans = 'C' if r >= 50 else 'D'
  else:
    ans = 'F'

  print(ans)

Submission status: Accepted

Solution code:
while True:
 (m,f,r)=[int(i) for i in input().split()]
 if m == f == r == -1:
   break

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