1. They were standing in a row.

2. They were standing in two rows.
3. They were standing in line.
4. They were standing in a line.
5. They were standing in two lines.

Which ones are correct? What is the difference between 'row' and 'line'? Do they have the same meaning?

All are correct.

If you're standing in a row, you are simply standing next to other people in a straight line.

If you're standing in line, you are also in a row, but all are facing forward and you have a destination -- a ticket booth or a bank teller or something.

All of the sentences you provided are grammatically correct, but they convey slightly different meanings. Let's break them down to understand the differences between "row" and "line":

1. They were standing in a row.
4. They were standing in a line.

In these sentences, "row" and "line" are used interchangeably to describe people standing in a single formation, one after another. However, "row" typically implies a relatively informal arrangement, while "line" can imply a more formal or organized arrangement.

2. They were standing in two rows.
5. They were standing in two lines.

In these sentences, "two rows" or "two lines" indicates that the people were divided into two separate formations, side by side. This suggests a more structured arrangement than sentences 1 and 4.

To summarize, the main difference between "row" and "line" lies in the degree of formality and organization implied. "Row" suggests a more casual arrangement, while "line" implies a more structured formation. Additionally, using "rows" or "lines" in plural form indicates multiple separate formations rather than a single formation.