Simple average grade calculator
Bug

This calculation looks suspiciously buggy:


int tzm = ((double) avg * 3 + TEZA) / 4;



Why are you taking avg, which is already a double, and casting it to a double?  Furthermore, why are you taking the right-hand side, which is a double, and coercing it into an int variable?  Note that you had declared double tzm earlier in the code; this int tzm declaration shadows the earlier declaration.  Your compiler should have warned you that the tzm on line 8 is unused.  (You do compile with warnings enabled, right?  It's a good habit.)

In any case, you should write a comment explaining why the tzm formula is the way it is.  I don't understand the calculation.

By the way, you can get floating-point division without explicitly casting, simply by writing / 4.0.

Using the bitwise | operator in tf == "Y" | tf == "y" is not really appropriate; it should be a logical || operator.

Optimization

There is absolutely no point in optimizing this code for performance.  Nearly all of the time is going to be spent waiting for input; the calculations are trivial.

What you should do, though, is to optimize it for elegance and readability.

The key is to identify functionality within main() that can be extracted out into functions, so that main() no longer has any tedious details.  For example, a common pattern is printing a question, and expecting a response from the user.  I'd define three functions, to ask the user for string, integer, and yes/no responses.

I would also define a letterGrade() function so that all of the results can be reported using just one statement.

Avoid cluttering your code with variables that don't mean much.  I'd get rid of sum and tf, for example.  The tzm variable is simply a recalculated average of sorts, so I'd get rid of it too.

Suggested solution

#include &lt;iostream&gt;
#include &lt;string&gt;

std::string ask(const std::string&amp; prompt) {
    std::string answer;
    std::cout &lt;&lt; prompt;
    std::cin &gt;&gt; answer;
    return answer;
}

int askInt(const std::string&amp; prompt) {
    int answer;
    std::cout &lt;&lt; prompt;
    std::cin &gt;&gt; answer;
    return answer;
}

bool askYN(const std::string&amp; prompt) {
    std::string answer = ask(prompt);
    return answer == "Y" || answer == "y";
}

std::string letterGrade(double grade) {
    return (grade &gt; 10) ? "" :
           (grade &gt;= 9) ? "A" :
           (grade &gt;= 8) ? "B" :
           (grade &gt;= 7) ? "C" :
           (grade &gt;= 6) ? "D" :
           (grade &gt;= 5) ? "E" : "F";
}

int main() {
    std::cout &lt;&lt; "SIMPLE AVERAGE CALCULATOR\n\n";
    std::string subject = ask("Subject at hand?: ");

    std::cout &lt;&lt; "\nInput the FOUR marks you'd like verified:\n";
    int m1 = askInt("\nM1: "),
        m2 = askInt("\nM2: "),
        m3 = askInt("\nM3: "),
        m4 = askInt("\nM4: ");
    double avg = (m1 + m2 + m3 + m4) / 4.0;

    if (askYN("\nWould you like to include the TEZA grade?(Y/N): ")) {
        int teza = askInt("What is the TEZA grade?: ");
        avg = (3 * avg + teza) / 4.0;
    }

    std::cout &lt;&lt; "\nYour average grade at " &lt;&lt; subject &lt;&lt; " is " &lt;&lt; avg &lt;&lt; "\n\n"
                 "You got the following mark:" &lt;&lt; letterGrade(avg) &lt;&lt; "\n"
                 "DO YOU PASS: " &lt;&lt; (avg &gt;= 5 ? "Yes." : "No.") &lt;&lt; "\n";
}