Language: C++

import java.io.*;
import java.util.*;

class Main{
	public void start(){
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		
		try{
			while(true){
				String str = input.readLine();
				String array[] = str.split(" ");
				int m = Integer.parseInt(array[0]);
				int f = Integer.parseInt(array[1]);
				int r = Integer.parseInt(array[2]);
				int x = 0;
				x = m + r + f;
				if(x==-3)break;
				achievement(m, f, r);
			}
		}catch(IOException e){
			e.printStackTrace();
		}		
	}
	
	public void achievement(int a,int b,int c){
		if(a==-1 || b==-1){
			System.out.println("F");
		}else if(a+b>=80){
			System.out.println("A");
		}else if(65<=a+b&&a+b<80){
			System.out.println("B");
		}else if(50<=a+b&&a+b<65){
			System.out.println("C");
		}else if(30<=a+b&&a+b<50){
			if(50<=c){
				System.out.println("C");
			}else{
				System.out.println("D");
			}
		}else if(a+b<30){
			System.out.println("F");
		}
	}
	
	public static void main(String[] args){
		Main main = new Main();
		main.start();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:15: error: expected ':' before 'void'
    5 |         public void start(){
      |               ^~~~~
      |               :
a.cc:25:15: error: expected ':' before 'void'
   25 |         public void achievement(int a,int b,int c){
      |               ^~~~~
      |               :
a.cc:45:15: error: expected ':' before 'static'
   45 |         public static void main(String[] args){
      |               ^~~~~~~
      |               :
a.cc:45:33: error: 'String' has not been declared
   45 |         public static void main(String[] args){
      |                                 ^~~~~~
a.cc:45:42: error: expected ',' or '...' before 'args'
   45 |         public static void main(String[] args){
      |                                          ^~~~
a.cc:49:2: error: expected ';' after class definition
   49 | }
      |  ^
      |  ;
a.cc: In member function 'void Main::start()':
a.cc:6:17: error: 'BufferedReader' was not declared in this scope
    6 |                 BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
      |                 ^~~~~~~~~~~~~~
a.cc:10:33: error: 'String' was not declared in this scope
   10 |                                 String str = input.readLine();
      |                                 ^~~~~~
a.cc:11:40: error: expected ';' before 'array'
   11 |                                 String array[] = str.split(" ");
      |                                        ^~~~~
a.cc:12:41: error: 'Integer' was not declared in this scope
   12 |                                 int m = Integer.parseInt(array[0]);
      |                                         ^~~~~~~
a.cc:12:58: error: 'array' was not declared in this scope
   12 |                                 int m = Integer.parseInt(array[0]);
      |                                                          ^~~~~
a.cc:20:24: error: 'IOException' does not name a type
   20 |                 }catch(IOException e){
      |                        ^~~~~~~~~~~
a.cc:21:25: error: 'e' was not declared in this scope
   21 |                         e.printStackTrace();
      |                         ^
a.cc: In member function 'void Main::achievement(int, int, int)':
a.cc:27:25: error: 'System' was not declared in this scope
   27 |                         System.out.println("F");
      |                         ^~~~~~
a.cc:29:25: error: 'System' was not declared in this scope
   29 |                         System.out.println("A");
      |                         ^~~~~~
a.cc:31:25: error: 'System' was not declared in this scope
   31 |                         System.out.println("B");
      |                         ^~~~~~
a.cc:33:25: error: 'System' was not declared in this scope
   33 |                         System.out.println("C");
      |                         ^~~~~~
a.cc:36:33: error: 'System' was not declared in this scope
   36 |                                 System.out.println("C");
      |                                 ^~~~~~
a.cc:38:33: error: 'System' was not declared in this scope
   38 |                                 System.out.println("D");
      |                                 ^~~~~~
a.cc:41:25: error: 'System' was not declared in this scope
   41 |                         System.out.println("F");
      |                         ^~~~~~
a.cc: In static member function 'static void Main::main(int*)':
a.cc:46:29: error: conversion from 'Main*' to non-scalar type 'Main' requested
   46 |                 Main main = new Main();
      |                             ^~~~~~~~~~