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

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

Submission status: Accepted

Solution code:
m,f,r = 0,0,0
table = []
i = 0

while m != -1 or f != -1 or r != -1:
  m,f,r = (int(x) for x in input().split())
  table.append([m,f,r])

for p in table:
  m,f,r = p[0],p[1],p[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 >= 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")
	else:
		if m + f >= 80:
			print("A")
		elif m + f >= 65 and m + f < 80:
			print("B")
		elif m + f >= 50 and m + f < 65:
			print("C")
		elif m + f >= 30 and m + f < 50:
			if r >= 50:
				print("C")
			else:
				print("D")
		elif m + f < 30:
			print("F")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    from sys import stdin

    while True:
        m, f, r = (int(n) for n in stdin.readline().rstrip().split())

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

        s = m + f
        result = "F" if m == -1 or f == -1 \
            else "A" if 80 <= s \
            else "B" if 65 <= s \
            else "C" if 50 <= s or 50 <= r \
            else "D" if 30 <= s \
            else "F"

        print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m=[0]*50
f=[0]*50
r=[0]*50
result=[""]*50

num=0
while True:
  a,b,c=map(int,input().split())
  if a == b == c ==-1:
    break
  else:
    m[num],f[num],r[num]=a,b,c
  num+=1

for i in range(num):
  if m[i] == -1 or f[i]==-1:
    result[i]="F"
  elif m[i]+f[i]>=80:
    result[i]="A"
  elif m[i]+f[i]>=65:
    result[i]="B"
  elif m[i]+f[i]>=50:
    result[i]="C"
  elif m[i]+f[i]>=30:
    if r[i] >=50:
      result[i]="C"
    else:
      result[i]="D"
  else:
    result[i]="F"

for i in range(num):
  print(result[i])

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 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 = [int(x) for x in input().split()]
    if (m,f,r)==(-1,-1,-1): break
    s_mf = m + f
    if   m < 0 or f < 0: print('F')
    elif s_mf <  30:     print('F')
    elif s_mf >= 80:     print('A')
    elif s_mf >= 65:     print('B')
    elif s_mf >= 50:     print('C')
    elif r    >= 50:     print('C')
    else:                print('D')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = 0
m_list = []
f_list = []
r_list = []
while x < 50:
  m, f, r = map(int, input().split())
  if m == -1 and f == -1 and r == -1:
    break
  m_list.append(m)
  f_list.append(f)
  r_list.append(r)
  x = x+1
  
for(mlist,flist,rlist) in zip(m_list,f_list,r_list):
  if mlist == -1 or flist == -1:
    print("F")
  elif 80 <= mlist + flist:
    print("A")
  elif 65 <= mlist + flist and mlist + flist < 80:
    print("B")
  elif 50 <= mlist + flist and mlist + flist < 65:
    print("C")
  elif 30 <= mlist + flist and mlist + flist < 50:
    if 50 <= rlist:
      print("C")
    else:
      print("D")
  elif mlist + flist < 30:
    print("F")

Submission status: Accepted

Solution code:
while True:
    v = map(int,raw_input().split())
    if v[0] == -1 and v[1] == -1 and v[2] == -1:
        break
    if v[0] * v[1] < 0:
        print 'F'
    else:
        s = v[0] + v[1]
        if s >= 80:
            print 'A'
        elif s >= 65:
            print 'B'
        elif s >= 50:
            print 'C'
        elif s >= 30:
            if v[2] >= 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 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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
st = list()
while True:
    a = list(map(lambda x: int(x),input().split(" ")))
    if min(a[0:2]) == -1:
        if max(a) == -1:
            break
        else:
            st += {"F"}
    else:
        if 80 <= sum(a[0:2]):
            st += {"A"}
        elif 65 <= sum(a[0:2]):
            st += {"B"}
        elif 50 <= sum(a[0:2]):
            st += {"C"}
        elif 30 <= sum(a[0:2]):
            if 50 <= a[2]:
                st += {"C"}
            else:
                st += {"D"}
        else:
            st += {"F"}
    
for s in st:
    print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    m,f,r=map(int,raw_input().split())
    if m+f+r==-3:break
    if min(m,f)==-1 or m+f<30:print'F'
    elif m+f>=80:print'A'
    elif m+f>=65:print'B'
    elif max(m+f,r)>=50:print'C'
    else:print'D'

Submission status: Accepted

Solution code:
data = raw_input()
while data.count('-1') < 3:
	m,f,r = map(int,data.split(" "))
	if m+f < 30 or 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'
	elif m+f <30:
		print 'F'
	data = raw_input()

Submission status: Accepted

Solution code:
test = []
while True:
    tmp = map(int,raw_input().split())
    if tmp[0]==tmp[1]==tmp[2]==-1:
        break
    else:
        test.append(tmp)
for a in test:
    if a[0] == -1 or a[1] == -1:
        print "F"
    elif a[0]+a[1] >= 80:
        print "A"
    elif 80 > a[0]+a[1] >= 65:
        print "B"
    elif 65 > a[0]+a[1] >= 50:
        print "C"
    elif 50 > a[0]+a[1] >= 30:
        if a[2] >= 50 and 50 > a[0]+a[1] >= 30:
            print "C"
        else:
            print "D"
    elif a[0] + a[1] < 30:
        print "F"

Submission status: Accepted

Solution code:
JUDGE_LIST=[[80, "A"],
            [65, "B"],
            [50, "C"],
            [30, "D"]]

while True:
    try:
        score=[int(x) for x in raw_input().split(" ")]
    except EOFError:
        break
    
    if score[0]==-1 and score[1]==-1 and score[2]==-1:
        break
    
    if score[0]==-1 or score[1]==-1:
        print "F"
        continue

    for judge in JUDGE_LIST:
        if judge[0] <= score[0] + score[1]:
            if "D" == judge[1] and score[2] >= 50:
                print "C"
                break
            else:
                print judge[1]
                break
    else:
        print "F"

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    m, f, r = map(int, line.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:
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

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

Submission status: Accepted

Solution code:
import sys
 
for line in sys.stdin:
    m, f, r = map(int, line.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:
result = []
while True:
    (m, f, r) = [int(i) for i in input().split()]
    sum = m + f

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

    if m == -1 or f == -1:
        result.append('F')
    elif sum >= 80:
        result.append('A')
    elif sum >= 65:
        result.append('B')
    elif sum >= 50:
        result.append('C')
    elif sum >= 30:
        if r >= 50:
            result.append('C')
        else:
            result.append('D')
    else:
        result.append('F')
    

[print(result[i]) for i in range(len(result))]

Submission status: Accepted

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

for mc, fc, rc in score:
    if mc == -1 or fc == -1:
        print('F')
    elif mc + fc >= 80:
        print('A')
    elif mc + fc >= 65:
        print('B')
    elif mc + fc >= 50 or rc >= 50:
        print('C')
    elif mc + fc >= 30:
        print('D')
    else:
        print('F')

Submission status: Accepted

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

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) and (m+f)<80 :
   print('B')

 elif 50<= (m+f) and (m+f)<65 :
   print('C')

 elif 30<=(m+f) and (m+f)<50 :
   if 50<=r :
    print('C')
   else:
    print('D')

 elif (m+f)<30 :
   print('F')

Submission status: Accepted

Solution code:
import sys
while True:
    (m, f, r) = [int(i) for i in sys.stdin.readline().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")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    mf = m + f

    if m == -1 or f == -1 or mf < 30:
        print('F')

    elif mf < 50 and r < 50:
        print('D')

    elif mf < 65:
        print('C')

    elif mf < 80:
        print('B')

    elif mf >= 80:
        print('A')

Submission status: Accepted

Solution code:
while True:
    try:
        m,f,r = map(int,raw_input().split())
        if all(k == -1 for k in [m,f,r]):
            break
    except EOFError:
        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:
def grading(m, f, r):
    p = m + f
    if m == -1 or f == -1: return 'F'
    if p >= 80: return 'A'
    if p >= 65: return 'B'
    if (p >= 50) or (r >= 50): return 'C'
    if p >= 30: return 'D'
    return 'F'

if __name__ == '__main__':
    while True:
        m, f, r = [int(i) for i in input().split()]
        if m == f == r == -1: break
        print(grading(m, f, r))

Submission status: Accepted

Solution code:
#coding:utf-8
#1_7_A 2015.4.5
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 < 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 True:
	data=list(map(int,input().split()))
	if data[0]==data[1]==data[2]==-1: break
	
	if data[0]!=-1 and data[1]!=-1:
		sum=data[0]+data[1]
	if data[2]!=-1 and sum<data[2]:
		if data[2]>=50:
			sum=50
		
	if data[0]==-1 or data[1]==-1:
		print('F')
	elif sum<30 :
		print('F')
	elif 30<=sum<50:
		print('D')
	elif 50<=sum<65:
		print('C')
	elif 65<=sum<=79:
		print('B')
	elif 80<=sum:
		print('A')

Submission status: Accepted

Solution code:
import sys

while True:
	m, f, r = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if -1 == m and -1 == f and -1 == r:
		break
	
	mf = ( m + f )
	if -1 == m or -1 == f:
		print( "F" )
	elif 80 <= mf:
		print( "A" )
	elif 65 <= mf and mf < 80:
		print( "B" )
	elif 50 <= mf and mf < 65:
		print( "C" )
	elif 30 <= mf and mf < 50:
		if 50 <= r:
			print( "C" )
		else:
			print( "D" )
	else:
		print( "F" )

Submission status: Accepted

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

Submission status: Accepted

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

    print r

Submission status: Accepted

Solution code:
# coding=utf-8

def main():
    while True:
        line = raw_input()
        if line == '-1 -1 -1':
            break
        middle, final, re = map(int, line.split())
        if middle == -1 or final == -1:
            grade = 'F'
        elif middle + final >= 80:
            grade = 'A'
        elif 65 <= middle + final < 80:
            grade = 'B'
        elif 50 <= middle + final < 65:
            grade = 'C'
        elif 30 <= middle + final < 50:
            if 50 <= re:
                grade = 'C'
            else:
                grade = 'D'
        elif middle + final < 30:
            grade = 'F'
        print grade

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
	(a,b,c) = map(int,raw_input().split())
	if a == -1 and b == -1 and 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:
		print 'C'
	elif a+b >= 30:
		if c >= 50:
			print 'C'
		else:
			print 'D'
	else:
		print 'F'

Submission status: Accepted

Solution code:
while True:

    (m, f, r) = [int(i) for i in input().split()]

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

    sum = m + f

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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')

Submission status: Accepted

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

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

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')

Submission status: Accepted

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

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

    print(achieve)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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