C++ Grid gravity simulation opzimization (Kattis Falling Apples)
Avoid allocating large arrays on a stack. According to the restrictions, grid may take up to half a meg. You are dangerously close to stack overflow.
Avoid single letter identifiers. Spelling out row and col wouldn't make your program any slower, but it would make it much more readable.
scanf adds a null terminator to a string. Your char line[c] is one character short. Definite UB.
The problem statement clearly says that


  Merely iterating the gravity rule, a step at a time, will likely take too long on large datasets.


but that is exactly what your code is doing. No optimization may salvage this algorithm. You need to rethink the approach.

I don't want to spell out a solution, but here are few hints:


Columns are totally independent. Do one column at a time.
Do not drop apples. Count them.
It is beneficial to add an artificial row of obstacles at the bottom.