Language: C++

#include <stdio.h>
int n,m,q,a,b,c,d,rui[1005][1005][3],ret[3];char f[1005][1005],e[3]={'J','O','I'};
int main(){
????????scanf("%d%d%d",&n,&m,&q);
????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
????????rui[i][j][k]=rui[i-1][j][k]+rui[i][j-1][k]-rui[i-1][j-1][k]+(f[i-1][j-1]==e[k]);
????????for(int i=0;i<q;i++){
????????????????scanf("%d%d%d%d",&a,&b,&c,&d);
????????????????for(int j=0;j<3;j++) ret[j]=rui[c][d][j]-rui[c][b-1][j]-rui[a-1][d][j]+rui[a-1][b-1][j];
????????????????printf("%d %d %d\n",ret[0],ret[1],ret[2]);
????????}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:1: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      | ^
a.cc:4:2: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |  ^
a.cc:4:3: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |   ^
a.cc:4:4: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |    ^
a.cc:4:5: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |     ^
a.cc:4:6: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |      ^
a.cc:4:7: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |       ^
a.cc:4:8: error: expected primary-expression before '?' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |        ^
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:4:33: error: expected ':' before ';' token
    4 | ????????scanf("%d%d%d",&n,&m,&q);
      |                                 ^
      |                                 :
a.cc:4:33: error: expected primary-expression before ';' token
a.cc:5:1: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      | ^
a.cc:5:2: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |  ^
a.cc:5:3: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |   ^
a.cc:5:4: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |    ^
a.cc:5:5: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |     ^
a.cc:5:6: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |      ^
a.cc:5:7: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |       ^
a.cc:5:8: error: expected primary-expression before '?' token
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |        ^
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:9: error: expected ':' before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
      |         :
a.cc:5:9: error: expected primary-expression before 'for'
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |         ^~~
a.cc:5:21: error: 'i' was not declared in this scope
    5 | ????????for(int i=0;i<n;i++) scanf("%s",&f[i]);
      |                     ^
a.cc:6:1: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      | ^
a.cc:6:2: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |  ^
a.cc:6:3: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |   ^
a.cc:6:4: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |    ^
a.cc:6:5: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |     ^
a.cc:6:6: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |      ^
a.cc:6:7: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |       ^
a.cc:6:8: error: expected primary-expression before '?' token
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |        ^
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
a.cc:6:9: error: expected ':' before 'for'
    6 | ????????for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=0;k<3;k++)
      |         ^~~
      |         :
a.cc:6:9: error: expected primary-expression before 'for'