alexjercan/bugnet huggingface dataset:
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
int main() {
  int m, n, r;
  while (1) {

    scanf("%d", &m);
    scanf("%d", &n);
    scanf("%d", &r);
    if (m == -1 && n == -1 && r == -1)
      break;
    if (m == -1 || n == -1)
      printf("F\\n");
    else if (m + n >= 80)
      printf("A\\n");
    else if (m + n >= 65)
      printf("B\\n");
    else if (m + n >= 50)
      printf("C\\n");
    else if (m + n >= 30) {
      if (r >= 50)
        printf("C\\n");
      else if (r < 50)
        printf("D\\n");
    } else if (m + n < 30)
      printf("F\\n");
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  int m, n, r;
  while (1) {

    scanf("%d", &m);
    scanf("%d", &n);
    scanf("%d", &r);
    if (m == 0 && n == 0 && r == 0)
      break;
    if (m + n >= 80)
      printf("A\\n");
    else if (m + n >= 65)
      printf("B\\n");
    else if (m + n >= 50)
      printf("C\\n");
    else if (m + n >= 30) {
      if (r >= 50)
        printf("C\\n");
      else
        printf("D\\n");
    } else
      printf("F\\n");
  }
  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main(void) {
  int m, f, r;
  while (1) {
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1)
      break;
    if (m == -1 || f == -1)
      cout << 'F' << endl;
    else if (m + f >= 80)
      cout << 'A' << endl;
    else if (m + f >= 65)
      cout << 'B' << endl;
    else if (m + f >= 50)
      cout << 'C' << endl;
    else if (m + f >= 30) {
      if (r >= 50)
        cout << 'C' << endl;
      else
        cout << 'D' << endl;
    } else
      cout << 'F' << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {
  int m, f, r;
  while (1) {
    cin >> m >> f >> r;
    if (m == -2 && f == -1 && r == -1)
      break;
    if (m == -1 || f == -1)
      cout << 'F' << endl;
    else if (m + f >= 80)
      cout << 'A' << endl;
    else if (m + f >= 65)
      cout << 'B' << endl;
    else if (m + f >= 50)
      cout << 'C' << endl;
    else if (m + f >= 30) {
      if (r >= 50)
        cout << 'C' << endl;
      else
        cout << 'D' << endl;
    } else
      cout << 'F' << endl;
  }
  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;

int main() {
  int m, f, r, sum;
  while (1) {
    cin >> m >> f >> r;
    sum = m + f;
    if ((m == -1) & (f == -1) & (r == -1)) {
      return 0;
    } else if (m * f < 0) {
      cout << "F" << endl;
    } else {
      if (sum >= 80)
        cout << "A" << endl;
      else if (sum >= 65)
        cout << "B" << endl;
      else if (sum >= 50)
        cout << "C" << endl;
      else if (sum >= 30) {
        if (r >= 50)
          cout << "C" << endl;
        else
          cout << "D" << endl;
      } else
        cout << "F" << endl;
    }
  }
  return 0;
}


Error: 255

Fixed submission:

#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;

int main() {
  int m, f, r, sum;
  while (1) {
    cin >> m >> f >> r;
    sum = m + f;
    if ((m == -1) & (f == -1) & (r == -1)) {
      return -1;
    } else if (m * f < 0) {
      cout << "F" << endl;
    } else {
      if (sum >= 80)
        cout << "A" << endl;
      else if (sum >= 65)
        cout << "B" << endl;
      else if (sum >= 50)
        cout << "C" << endl;
      else if (sum >= 30) {
        if (r >= 50)
          cout << "C" << endl;
        else
          cout << "D" << endl;
      } else
        cout << "F" << endl;
    }
  }
  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main(void) {
  int m, f, r;
  while (1) {
    scanf("%d %d %d", &m, &f, &r);
    if (m == -1 && f == -1 && r == -1) {
      break;
    } else if (m == -1 || f == -1 || f + m < 30) {
      printf("F\\n");
    } else if (m + f >= 80) {
      printf("A\\n");
    } else if (m + f >= 65) {
      printf("B\\n");
    } else if (m + f >= 50 || r >= 50) {
      printf("C\\n");
    } else {
      printf("D\\n");
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int m, f, r;
  while (1) {
    scanf("%d %d %d", &m, &f, &r);
    if (m == -1 || f == -1 || f + m < 30) {
      printf("F");
    } else if (m + f >= 80) {
      printf("A");
    } else if (m + f >= 65) {
      printf("B");
    } else if (m + f >= 80 || r >= 50) {
      printf("C");
    } else {
      printf("D");
    }
  }
  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

char getGrade(int m, int f, int r) { // 文字の中にイント型
  int sum = m + f;
  char grade;

  if (m == -1 || f == -1) {
    grade = 'F';
  } else if (80 <= sum) {
    grade = 'A';
  } else if (65 <= sum && sum < 80) {
    grade = 'B';
  } else if (50 <= sum && sum < 65) {
    grade = 'C';
  } else if (30 <= sum && sum < 50) {
    if (50 <= r)
      grade = 'C';
    else
      grade = 'D';
  } else if (sum < 30) {
    grade = 'F';
  }

  return grade;
}

int main() {
  int m, f, r;
  while (1) {
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1)
      break;

    cout << getGrade(m, f, r) << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int m, f, r;
  char g;

  if (m == -1 || f == -1)
    g == 'F';
  else if (m + f <= 80)
    g == 'A';
  else if (65 <= m + f && m + f < 80)
    g == 'B';
  else if (50 <= m + f && m + f < 65)
    g == 'C';
  else if (30 <= m + f && m + f < 50 && 50 <= r)
    g == 'C';
  else if (30 <= m + f && m + f < 50 && r < 50)
    g == 'D';
  else if (m + f < 30)
    g == 'F';

  while (1) {
    if (m == -1 && f == -1 && r == -1)
      break;

    cout << g << endl;
  }

  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {
  int m[100], f[100], r[100];
  int count = 0;

  for (int i = 0;; i++) {
    std::cin >> m[i] >> f[i] >> r[i];
    count++;
    if (m[i] == -1 && f[i] == -1 && r[i] == -1) {
      count--;
      break;
    }
  }

  for (int i = 0; i < count; i++) {
    if (m[i] == -1 || f[i] == -1)
      std::cout << "F" << std::endl;
    else if (m[i] + f[i] >= 80)
      std::cout << "A" << std::endl;
    else if (m[i] + f[i] < 80 && m[i] + f[i] >= 65)
      std::cout << "B" << std::endl;
    else if (m[i] + f[i] < 65 && m[i] + f[i] >= 50)
      std::cout << "C" << std::endl;
    else if (m[i] + f[i] < 50 && m[i] + f[i] >= 30 && r[i] < 50)
      std::cout << "D" << std::endl;
    else if (m[i] + f[i] < 50 && m[i] + f[i] >= 30 && r[i] >= 50)
      std::cout << "C" << std::endl;
    else if (m[i] + f[i] < 30)
      std::cout << "F" << std::endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  int m, f, r;
  std::cin >> m >> f >> r;

  while (1) {
    std::cin >> m >> f >> r;
    if (m == -1 || f == -1)
      std::cout << "F" << std::endl;
    else if (m + f >= 80)
      std::cout << "A" << std::endl;
    else if (m + f < 80 && m + f >= 65)
      std::cout << "B" << std::endl;
    else if (m + f < 65 && m + f >= 50)
      std::cout << "C" << std::endl;
    else if (m + f < 50 && m + f >= 30 && r >= 50)
      std::cout << "C" << std::endl;
    else if (m + f < 30)
      std::cout << "F" << std::endl;
    else if (m == -1 && f == -1 && r == -1)
      break;
  }
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {
  while (1) {

    int m, f, r;

    std::cin >> m >> f >> r;

    if (m == -1 && f == -1 && r == -1) {
      break;
    }
    if (m == -1 || f == -1) {
      std::cout << "F" << std::endl;
    } else if (m + f < 30) {
      std::cout << "F" << std::endl;
    } else if (m + f < 50 && r >= 50) {
      std::cout << "C" << std::endl;
    } else if (m + f < 50) {
      std::cout << "D" << std::endl;
    } else if (m + f < 65) {
      std::cout << "C" << std::endl;
    } else if (m + f < 80) {
      std::cout << "B" << std::endl;
    } else {
      std::cout << "A" << std::endl;
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  while (1) {

    int m, f, r;

    std::cin >> m >> f >> r;

    if (m == -1 || f == -1) {
      std::cout << "F" << std::endl;
    } else if (m + f < 30) {
      std::cout << "F" << std::endl;
    } else if (m + f < 50 && r >= 50) {
      std::cout << "C" << std::endl;
    } else if (m + f < 50) {
      std::cout << "D" << std::endl;
    } else if (m + f < 65) {
      std::cout << "C" << std::endl;
    } else if (m + f < 80) {
      std::cout << "B" << std::endl;
    } else {
      std::cout << "A" << std::endl;
    }
  }

  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int m, f, r;

  while (true) {
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1) {
      break;
    }
    if (m == -1 || f == -1) {
      cout << "F" << endl;
    } else if (m + f >= 80) {
      cout << "A" << endl;
    } else if (m + f >= 65) {
      cout << "B" << endl;
    } else if (m + f >= 50) {
      cout << "C" << endl;
    } else if (m + f >= 30) {
      if (r >= 50) {
        cout << "C" << endl;
      } else {
        cout << "D" << endl;
      }
    } else {
      cout << "F" << endl;
    }
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int m, f, r;

  while (true) {
    cin >> m >> f >> r;
    if (m == f == r == -1) {
      break;
    }
    if (m + f >= 80) {
      cout << "A" << endl;
    } else if (m + f >= 65) {
      cout << "B" << endl;
    } else if (m + f >= 50) {
      cout << "C" << endl;
    } else if (m + f >= 30) {
      if (r >= 50) {
        cout << "C" << endl;
      }
      cout << "D" << endl;
    } else {
      cout << "F" << endl;
    }
  }

  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main(void) {
  int a = 0;
  int b = 0;
  int c = 0;
  cin >> a >> b >> c;
  while (!(a == -1 && b == -1 && c == -1)) {
    if (a == -1 || b == -1) {
      cout << "F" << endl;
    } else if (a + b >= 80) {
      cout << "A" << endl;
    } else if (a + b >= 65) {
      cout << "B" << endl;
    } else if (a + b >= 50) {
      cout << "C" << endl;
    } else if (a + b >= 30) {
      if (c >= 50) {
        cout << "C" << endl;
      } else {
        cout << "D" << endl;
      }
    } else {
      cout << "F" << endl;
    }
    cin >> a >> b >> c;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {
  int a = 0;
  int b = 0;
  int c = 0;
  cin >> a >> b >> c;
  while (!(a == -1 && b == -1 && c == -1)) {
    if (a + b >= 80) {
      cout << "A" << endl;
    } else if (a + b >= 65) {
      cout << "B" << endl;
    } else if (a + b >= 50) {
      cout << "C" << endl;
    } else if (a + b >= 30) {
      if (c >= 50) {
        cout << "C" << endl;
      } else {
        cout << "D" << endl;
      }
    } else {
      cout << "F" << endl;
    }
  }
  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int m, f, r, goukei;
  char rank;

  while (1) {

    cin >> m >> f >> r;

    goukei = m + f;

    if (m == -1 && f == -1 && r == -1) {

      break;
    } else if (m == -1 || f == -1) {

      rank = 'F';
    }

    else if (goukei >= 80) {

      rank = 'A';

    } else if (goukei < 80 && goukei >= 65) {

      rank = 'B';

    } else if (goukei < 65 && goukei >= 50) {

      rank = 'C';

    } else if (goukei < 50 && goukei >= 30) {

      if (r >= 50) {

        rank = 'C';

      }

      else
        rank = 'D';

    }

    else if (m == -1 && f == -1 && r == -1) {

      break;
    } else if (goukei < 30) {

      rank = 'F';
    }

    cout << rank << "\\n";
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int m, f, r;
  char rank;

  while (1) {

    cin >> m >> f >> r;

    if (m == -1 || f == -1) {

      rank = 'F';

    } else if (m + f >= 80) {

      rank = 'A';

    } else if (m + f < 80 && m + f >= 65) {

      rank = 'B';

    } else if (m + f < 65 && m + f >= 50) {

      rank = 'C';

    } else if (m + f < 50 && m + f >= 30) {

      if (r >= 50) {

        rank = 'C';

      }

      else
        rank = 'D';

    }

    else if (m == -1 && f == -1 && r == -1) {

      break;
    } else if (m + f < 30) {

      rank = 'F';
    }

    cout << rank << "\\n";
  }
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main() {
  int m, f, r;
  for (;;) {
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1)
      break;
    else if (m == -1 || f == -1) {
      cout << "F" << endl;
    } else if (m + f >= 80) {
      cout << "A" << endl;
    } else if (65 <= m + f && m + f < 80) {
      cout << "B" << endl;
    } else if (50 <= m + f && m + f < 65) {
      cout << "C" << endl;
    } else if (30 <= m + f && m + f < 50) {
      if (r >= 50)
        cout << "C" << endl;
      else
        cout << "D" << endl;
    } else if (m + f < 30) {
      cout << "F" << endl;
    }
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main() {
  int m, f, r;
  for (;;) {
    cin >> m >> f >> r;
    if (m == -1 || f == -1) {
      cout << "F" << endl;
    } else if (m + f >= 80) {
      cout << "A" << endl;
    } else if (65 <= m + f && m + f < 80) {
      cout << "B" << endl;
    } else if (50 <= m + f && m + f < 65) {
      cout << "C" << endl;
    } else if (30 <= m + f && m + f < 50) {
      if (r >= 50)
        cout << "C" << endl;
      else
        cout << "D" << endl;
    } else if (m + f < 30) {
      if (m == -1 && f == -1 && r == -1)
        break;
      cout << "F" << endl;
    }
  }
}
Problem p02411 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {

  const int MAX_NO = 100000;
  int m[MAX_NO], f[MAX_NO], r[MAX_NO];
  char hyouka[MAX_NO];
  int a = 0;
  int b = 0;

  for (int i = 1; i < 20000000; i++) {
    b++;
  }

  for (int i = 1; i < MAX_NO; i++) {

    cin >> m[i] >> f[i] >> r[i];
    a++;

    if (m[i] == -1 && f[i] == -1 && r[i] == -1) {
      goto aa;
    }

    if (m[i] == -1 || f[i] == -1) {
      hyouka[i] = 'F';
    }

    else if ((m[i] + f[i]) >= 80) {
      hyouka[i] = 'A';
    } else if ((m[i] + f[i]) >= 65) {
      hyouka[i] = 'B';
    }

    else if ((m[i] + f[i]) >= 50) {
      hyouka[i] = 'C';
    }

    else if ((m[i] + f[i]) >= 30 && r[i] < 50) {
      hyouka[i] = 'D';
    } else if ((m[i] + f[i]) >= 30 && r[i] >= 50) {
      hyouka[i] = 'C';
    }

    else if ((m[i] + f[i]) < 30) {
      hyouka[i] = 'F';
    }
  }

aa:;

  for (int i = 1; i < a; i++) {

    cout << hyouka[i] << endl;
  }

  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
using namespace std;

int main() {

  int m[1000000], f[1000000], r[1000000];
  char hyouka[1000000];
  int a = 0;

  for (int i = 1; i < 1000000; i++) {

    cin >> m[i] >> f[i] >> r[i];
    a++;

    if (m[i] == -1 && f[i] == -1 && r[i] == -1) {
      goto aa;
    }

    if (m[i] == -1 || f[i] == -1) {
      hyouka[i] = 'F';
    }

    else if ((m[i] + f[i]) >= 80) {
      hyouka[i] = 'A';
    } else if ((m[i] + f[i]) >= 65) {
      hyouka[i] = 'B';
    }

    else if ((m[i] + f[i]) >= 50) {
      hyouka[i] = 'C';
    }

    else if ((m[i] + f[i]) >= 30 && r[i] < 50) {
      hyouka[i] = 'D';
    } else if ((m[i] + f[i]) >= 30 && r[i] >= 50) {
      hyouka[i] = 'C';
    }

    else if ((m[i] + f[i]) < 30) {
      hyouka[i] = 'F';
    }
  }

aa:;

  for (int i = 1; i < a; i++) {

    cout << hyouka[i] << endl;
  }

  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int m, f, r;

  char grade;

  while (true) {
    cin >> m >> f >> r;

    if (m == -1 && f == -1 && r == -1) {
      break;
    }

    if (m == -1 || f == -1) {
      grade = 'F';
    } else if (m + f >= 80) {
      grade = 'A';
    } else if (m + f >= 65) {
      grade = 'B';
    } else if (m + f >= 50) {
      grade = 'C';
    } else if (m + f >= 30) {
      if (r >= 50) {
        grade = 'C';
      } else {
        grade = 'D';
      }
    } else {
      grade = 'F';
    }

    cout << grade << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int m, f, r;

  char grade;

  while (true) {
    cin >> m >> f >> r;

    if (m == 0 && f == 0) {
      break;
    }

    if (m == -1 || f == -1) {
      grade = 'F';
    } else if (m + f >= 80) {
      grade = 'A';
    } else if (m + f >= 65) {
      grade = 'B';
    } else if (m + f >= 50) {
      grade = 'C';
    } else if (m + f >= 30) {
      if (r >= 50) {
        grade = 'C';
      } else {
        grade = 'D';
      }
    } else {
      grade = 'F';
    }

    cout << grade << endl;
  }

  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int m[100];
  int f[100];
  int r[100];
  while (true) {
    int i = 0;
    cin >> m[i] >> f[i] >> r[i];
    if (m[i] == -1 && f[i] == -1 && r[i] == -1)
      break;
    int sum[100];
    sum[i] = m[i] + f[i];
    if (m[i] == -1 || f[i] == -1 || sum[i] < 30) {
      cout << "F" << endl;
    } else {
      if (sum[i] >= 80) {
        cout << "A" << endl;
      }
      if (65 <= sum[i] && sum[i] < 80) {
        cout << "B" << endl;
      }
      if (50 <= sum[i] && sum[i] < 65) {
        cout << "C" << endl;
      }
      if (30 <= sum[i] && sum[i] < 50) {
        if (r[i] >= 50) {
          cout << "C" << endl;
        } else {
          cout << "D" << endl;
        }
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int m[100];
  int f[100];
  int r[100];
  while (true) {
    int i = 0;
    cin >> m[i] >> f[i] >> r[i];
    if (m[i] == 0 && f[i] == 0 && r[i] == 0)
      break;
    int sum[100];
    sum[i] = m[i] + f[i];
    if (m[i] == -1 || f[i] == -1 || sum[i] < 30) {
      cout << "F" << endl;
    } else {
      if (sum[i] >= 80) {
        cout << "A" << endl;
      }
      if (65 <= sum[i] && sum[i] < 80) {
        cout << "B" << endl;
      }
      if (50 <= sum[i] && sum[i] < 65) {
        cout << "C" << endl;
      }
      if (30 <= sum[i] && sum[i] < 50) {
        if (r[i] >= 50) {
          cout << "C" << endl;
        } else {
          cout << "D" << endl;
        }
      }
    }
  }
  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>

int main() {
  int m, f, r, p;
  while (1) {
    scanf("%d %d %d", &m, &f, &r);
    if (m == -1 && f == -1 && r == -1)
      break;
    p = m + f;
    if (m == -1 || f == -1) {
      printf("F\\n");
    } else if (p >= 80) {
      printf("A\\n");
    } else if (65 <= p && p < 80) {
      printf("B\\n");
    } else if (50 <= p && p < 65 || r >= 50) {
      printf("C\\n");
    } else if (30 <= p && p < 50) {
      printf("D\\n");
    } else if (p < 30) {
      printf("F\\n");
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>

int main() {
  int m, f, r, p;
  while (1) {
    scanf("%d %d %D", &m, &f, &r);
    if (m == -1 && f == -1 && r == -1)
      break;
    p = m + f;
    if (m == -1 || f == -1) {
      printf("F\\n");
    } else if (p >= 80) {
      printf("A\\n");
    } else if (65 <= p && p < 80) {
      printf("B\\n");
    } else if (50 <= p && p < 65 || r >= 50) {
      printf("C\\n");
    } else if (30 <= p && p < 50) {
      printf("D\\n");
    } else if (p < 30) {
      printf("F\\n");
    }
  }
  return 0;
}
Problem p02411 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>

#define CI cin >>
#define CO cout <<
#define E << endl;
#define F(i, max) (for (int i = 0; i < max; ++i))

using namespace std;

int main(void) {
  int m[10000];
  int f[10000];
  int r[10000];

  char result[10000];

  for (int i = 0; i < 10000; i++) {
    CI m[i];
    CI f[i];
    CI r[i];
    if (m[i] == -1 && f[i] == -1 && r[i] == -1) {
      break;
    }

    if (m[i] == -1 || f[i] == -1) {
      result[i] = 'F';
    } else {
      if ((m[i] + f[i]) >= 80) {
        result[i] = 'A';
      }

      if (65 <= (m[i] + f[i]) && (m[i] + f[i]) < 80) {
        result[i] = 'B';
      }

      if (50 <= (m[i] + f[i]) && (m[i] + f[i]) < 65) {
        result[i] = 'C';
      }

      if ((30 <= (m[i] + f[i]) && (m[i] + f[i]) < 50) && r[i] < 50) {
        result[i] = 'D';
      }

      if ((30 <= (m[i] + f[i]) && (m[i] + f[i]) < 50) && r[i] >= 50) {
        result[i] = 'C';
      }

      if ((m[i] + f[i]) < 30) {
        result[i] = 'F';
      }
    }

    CO result[i] E
  }
}

Error: -11

Fixed submission:

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>

#define CI cin >>
#define CO cout <<
#define E << endl;
#define F(i, max) (for (int i = 0; i < max; ++i))

using namespace std;

int main(void) {
  int m[1000000];
  int f[1000000];
  int r[1000000];

  char result[1000000];

  for (int i = 0; i < 1000000; i++) {
    CI m[i];
    CI f[i];
    CI r[i];
    if (m[i] == -1 && f[i] == -1 && r[i] == -1) {
      break;
    }

    if (m[i] == -1 || f[i] == -1) {
      result[i] = 'F';
    }

    if ((m[i] + f[i]) >= 80) {
      result[i] = 'A';
    }

    if (65 <= (m[i] + f[i]) && (m[i] + f[i]) < 80) {
      result[i] = 'B';
    }

    if (50 <= (m[i] + f[i]) && (m[i] + f[i]) < 65) {
      result[i] = 'C';
    }

    if ((30 <= (m[i] + f[i]) && (m[i] + f[i]) < 50) && r[i] < 50) {
      result[i] = 'D';
    }

    if ((30 <= (m[i] + f[i]) && (m[i] + f[i]) < 50) && r[i] >= 50) {
      result[i] = 'C';
    }

    if ((m[i] + f[i]) < 30) {
      result[i] = 'F';
    }

    CO result[i] E
  }
}
Problem p02411 (C++) — buggy submission, verdict: Time Limit Exceeded

#include "iostream"
using namespace std;

int main() {
  int m, f, r = 0;
  bool flag = true;

  while (flag == true) {
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1)
      flag = false;
    else {
      if (m == -1 || f == -1)
        cout << "F";
      else if (m + f >= 80)
        cout << "A";
      else if (m + f >= 65)
        cout << "B";
      else if (m + f >= 50)
        cout << "C";
      else if (m + f >= 30 && r >= 50)
        cout << "C";
      else if (m + f >= 30)
        cout << "D";
      else
        cout << "F";

      cout << endl;
    }
  }
}

Error: TLE

Fixed submission:

#include "iostream"
using namespace std;

int main() {
  int m, f, r = 0;
  bool flag = true;

  while (flag == true) {
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1)
      flag == false;
    else {
      if (m == -1 || f == -1)
        cout << "F";
      else if (m + f >= 80)
        cout << "A";
      else if (m + f >= 65)
        cout << "B";
      else if (m + f >= 50)
        cout << "C";
      else if (m + f >= 30 && r >= 50)
        cout << "C";
      else if (m + f >= 30)
        cout << "D";
      else
        cout << "F";

      cout << endl;
    }
  }
}