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:
grades = ['A','B','C','D','F']

while True:

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

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

    if m ==-1 or f ==-1:
        print(grades[4])
    elif m + f >= 80:
        print(grades[0])
    elif m + f >= 65:
        print(grades[1])
    elif m + f >= 50:
        print(grades[2])
    elif m + f >= 30:
        if r >= 50:
            print(grades[2])
        else:
            print(grades[3])
    else:
        print(grades[4])

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

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 (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:
n=0
S={}
while True:
    L1=input().split( )
    L=[int(s) for s in L1]
    if L==[-1,-1,-1]:
        break
    S[n]=L
    n+=1
l=len(S)
for i in range(l):
    m=S[i][0]
    f=S[i][1]
    r=S[i][2]
    S[i].append("")
    if m==-1 or f==-1:
        S[i][3]=S[i][3]+"F"
    elif m+f>=80:
        S[i][3]=S[i][3]+"A"
    elif 80>m+f>=65:
        S[i][3]=S[i][3]+"B"
    elif 65>m+f>=50:
        S[i][3]=S[i][3]+"C"
    elif 50>m+f>=30 and r>=50:
        S[i][3]=S[i][3]+"C"
    elif 50>m+f>=30 and r<50:
        S[i][3]=S[i][3]+"D"
    else:
        S[i][3]=S[i][3]+"F"
for i in range(l):
    print(S[i][3])

Submission status: Accepted

Solution code:
# coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def main():
    A = []

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

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
  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:
      if r >= 50:
        print("C")
      else:
        print("D")
  else:
    print("F")

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)


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

if __name__ == '__main__':
    main()

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 = 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 (1):
    res = list(map(int, input().split()))
    if res[0] == -1 and res[1] == -1 and res[2] == -1:
        break
    elif res[0] == -1 or res[1] == -1:
        grad = "F"
    elif res[0] + res[1] >= 80:
        grad = "A"
    elif res[0] + res[1] >= 65:
        grad = "B"
    elif res[0] + res[1] >= 50:
        grad = "C"
    elif res[0] + res[1] >= 30:
        if res[2] >= 50:
            grad = "C"
        else:
            grad = "D"
    else:
        grad = "F"
    
    print(grad)

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    if all(i == -1 for i in (m, f, r)):
        break
    if any(i == -1 for i in (m, f)):
        rank = 'F'
    else:
        score = m + f
        if score >= 80:
            rank = 'A'
        elif score >= 65:
            rank = 'B'
        elif score >= 50:
            rank = 'C'
        elif score >= 30:
            if r >= 50:
                rank = 'C'
            else:
                rank = 'D'
        else:
            rank = 'F'
    print(rank)

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 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:
seito_tensu = []
tensu = []
seito = 0
while seito < 50:
    m, f, r = [int(e) for e in input().split()]
    seito += 1
    if m==-1and f==-1 and r==-1:
        break
    else:
        seito_tensu = [m, f, r]
        tensu.append(seito_tensu)
        
for x in range(len(tensu)):
    if tensu[x][0]==-1 or tensu[x][1]==-1:
        print("F")
    elif tensu[x][0]+tensu[x][1]>=80:
        print("A")
    elif tensu[x][0]+tensu[x][1]>=65 and tensu[x][0]+tensu[x][1]<80:
        print("B")
    elif tensu[x][0]+tensu[x][1]>=50 and tensu[x][0]+tensu[x][1]<65:
        print("C")
    elif tensu[x][0]+tensu[x][1]>=30 and tensu[x][0]+tensu[x][1]<50:
        if tensu[x][2]>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
judge = []

while True:
    test_input = list(map(int, input().split()))
    if(test_input[0] == -1 and test_input[1] == -1 and test_input[2] == -1):
        break
    score = test_input[0] + test_input[1]
    if (score >= 80) and not(test_input[0] == -1 or test_input[1] == -1):
        judge.append("A")
    elif (score >= 65 and score < 80) and not(test_input[0] == -1 or test_input[1] == -1):
        judge.append("B")
    elif (score >= 50 and score < 65) and not(test_input[0] == -1 or test_input[1] == -1):
        judge.append("C")
    elif (score >= 30 and score < 50) and not(test_input[0] == -1 or test_input[1] == -1):
        if test_input[2] >= 50:
            judge.append("C")
        else:
            judge.append("D")
    else:
        judge.append("F")

for j in judge:
    print(j)

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())
  x = m + f
  
  if m == f == r == -1 :
    break
  elif m == -1 or f == -1 :
    print('F')

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

        print("{}".format(arc))

Submission status: Accepted

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

    print(grade)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    total = m + f
    if total < 30:
        return 'F'
    elif total < 50:
        if 50 <= r:
            return 'C'
        return 'D'
    elif total < 65:
        return 'C'
    elif total < 80:
        return 'B'
    else:
        return 'A'

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

        print(grading(m, f, r))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 15 22:45:08 2019

@author: mac
"""
grades = []
count = 0

while(count == 0):
    scores = list(map(int, input().split(" ")))
    if scores[0] == -1 and scores[1] == -1 and scores[2] == -1:
        count += 1
    grades.append(scores)

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

Submission status: Accepted

Solution code:
import sys
for l in sys.stdin:
	if l == '-1 -1 -1\n': break
	m,f,r = map(int, l.split())
	s = m + f
	if -1 in [m,f]: g = 'F'
	elif s >= 80: g = 'A'
	elif s >= 65: g = 'B'
	elif s >= 50: g = 'C'
	elif s >= 30: g = 'D' if r < 50 else 'C'
	else: g = 'F'
	print(g)

Submission status: Accepted

Solution code:

while True:
    x = input()
    list = x.split()
    [m, f, r] = list
    m = int(m)
    f = int(f)
    r = int(r)
    mf = m + f
    mfr = m + f + r
    
    #終了条件を記載
    if mfr ==  -3:
        break
    
    ####ここから成績ごとの区分け。
    
    #まずどんなに点が良くても欠席したらF判定
    if m == -1 or f == -1:
        ans = "F"
    
    ##ここからは両方受けた人
    #80以上でA
    elif mf >= 80:
        ans = "A"
    
    #65以上でB
    elif mf >= 65:
        ans = "B"
    
    #50以上でC
    elif mf >= 50:
        ans = "C"
    
    #30未満でF
    elif mf < 30:
        ans = "F"
    
    #30以上で追試50以上でC
    elif mf >= 30 and r >= 50:
        ans = "C"
    
    #30以上で追試50未満でD
    elif mf >=30 and r < 50:
        ans = "D"
    
    #成績表示
    print(ans)

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:
        sum = M + F;
        if sum >= 80:
            print("A");
        elif sum >= 65:
            print("B");
        elif sum >= 50:
            print("C");
        elif sum >= 30 and R < 50:
            print("D");
        elif sum >= 30 and R >= 50:
            print("C");
        else:
            print("F");

Submission status: Accepted

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

Submission status: Accepted

Solution code:
scores = list(map(int, input().split()))
while scores != [-1, -1, -1]:
    if scores[0] == -1 or scores[1] == -1:
        print('F')
    elif scores[0] + scores[1] >= 80:
        print('A')
    elif scores[0] + scores[1] >= 65:
        print('B')
    elif scores[0] + scores[1] >= 50:
        print('C')
    elif scores[0] + scores[1] >= 30:
        if scores[2] >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')
    scores = list(map(int, input().split()))

Submission status: Accepted

Solution code:
def grading(mid, final, re_exam):   
    if mid == -1 or final == -1:
        return 'F'

    reg_score = mid + final

    if reg_score >= 80:
        return 'A'
    elif reg_score >= 65 and reg_score < 80:
        return 'B'
    elif reg_score >= 50 and reg_score < 65:
        return 'C'
    elif reg_score >= 30 and reg_score < 50:
        if re_exam >= 50:
            return 'C'
        else :
            return 'D'
    else :
        return 'F'
    

while True :
    test_results = [int(i) for i in input().split()]
    mid = test_results[0]
    final = test_results[1]
    re_exam = test_results[2]
    sentinel = mid + final + re_exam
    
    if sentinel == -3:
        break 
    else :
        grade = grading(mid, final, re_exam)
        print(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
    if m == -1 or f == -1:
        print('F')    
    elif m+f >= 80:
        print('A')
    
    elif m+f >= 65:
        print('B')
    
    elif m+f >= 50:
        print('C')
    
    elif m+f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    
    elif m+f < 30:
        print('F')

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

Submission status: Accepted

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

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 < 80 and m + f >= 65:
        print("B")
    elif m + f < 65 and m + f >= 50:
        print("C")
    elif m + f < 50 and m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif m + f < 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 m+f >= 65:
        print("B")
    elif m+f >= 50 or 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, 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:
eva = []
count = 0

while True:
    m, f, r = map(int, input().split())
    sum = m + f
    if m == -1 and f == -1 and r == -1:
        break
    else:
        if m != -1 and f != -1:
            if sum >= 30:
                if 30 <= sum < 50:
                    if r < 50:
                        eva.append("D")
                    else:
                        eva.append("C")
                elif 50 <= sum < 65:
                    eva.append("C")
                elif 65 <= sum < 80:
                    eva.append("B")
                elif 80 <= sum:
                    eva.append("A")
            else:
                eva.append("F")
        else:
            eva.append("F")
    count += 1

for i in range(count):
    print(eva[i])

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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
	if m+f >= 80: grade.append("A")
	elif m+f >= 65 and m+f < 80: grade.append("B")
	elif (m+f >= 50 and m+f <65) or r >= 50: grade.append("C")
	elif m+f < 30 or m == -1 or f== -1: grade.append("F")
	elif m+f >= 30 and m+f < 50 : grade.append("D")
	

for item in grade:
	print(item)

Submission status: Accepted

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

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

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

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:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Submission status: Accepted

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

Submission status: Accepted

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