Answer:
We know: 
A+2B=777 
2A+B=789 
 
Let's rearrange the first equation to solve for A: 
A=777-2B 
 
Now let's plug 777-2B in for A in the second equation, and solve for B: 
2(777-2B)+B=789 
1554-4B+B=789 
1554-789=3B 
765=3B 
B=255 
 
Now we can substitute 255 in for B in the first rearranged equation, and solve for A: 
A=777-2(255) 
A=777-510 
A=267 
 
So candy bar A has 267 calories, and candy bar B has 255
I Hope it helps