Project Euler problems 18/67: maximum path sum
Even before starting the review I have to disappoint you. The problem has nothing to do with the dynamic programming. Now let's go.


Naming: Avoid meaningless names, such as q, temp1, temp2, calc and otherCalc.
Responsibilities: You correctly separated IO in a method of its own. The actual calculations also deserve to be separated.
Algorithm: A triple nesting loop is an immediate red flag. In fact, you don't need to iterate over q (which is the index into the bottom row, right? - it took me a while to figure it out) at all: the kth element of the upper row can be only influenced by kth and k+1th of the bottom one. Taking it into consideration, you'd eliminate one level of nesting as well as a really ugly special case of temp2.size() == 1. 


The core loop should look like

    for (k = 0; k &lt; upperRow.size(); k++)
            upperRow[k] += max(bottomRow[k], bottomRow[k+1]);


That said, let me reiterate a very important rule of no raw loops: for every loop you write, think of it as a standalone method and figure out a meaningful name for it. If you can't than you effectively don't know what it is doing!