The converted mana cost of a spell is whatever is printed on the upper right-hand corner, with all mana symbols converted into a single number. Whenever there is an
X in the cost, it is considered to be 0 everywhere except the stack. While on the stack,
X has whatever value was declared for it.
Any card with multiple faces (transform cards, splilt cards, melded cards) have the total converted mana cost of all sides of it everywhere except the stack. When casting a split card, only the half that is cast is considered when determining its converted mana cost. The other half is ignored.
Face-down cards with morph/manifest are considered to have a converted mana cost of 0. This is by rule, as they had to be assigned something that is public knowledge.
The amount of mana you pay for a spell may or may not be equal to its converted mana cost. Paying an alternate cost like flashback or
overload does not change the CMC. (An overloaded
Cyclonic Rift still has a CMC of 2.)
To determine the amount of mana you pay, start with the mana cost printed on the card. (
X needs to be declared when the spell is put on the stack.) Then apply any alternate costs (like flashback). Then apply any cost increases (like
Kiora's Dismissal), then apply any cost reductions (like
Pearl Medallion). Then that is how much mana you pay. Technically this calculation happens every time you put a spell/effect on the stack.
Happy Brewing!