90932024-02-13 20:56:47AncsaCsúcsokcpp17Compilation error

9075	2024. 02. 13 17:32:02	Ancsa	Csúcsok	cpp17	Hibás válasz 49/100	59ms	5516 KiB
 
#include <iostream>
using namespace std;

int main()
{
    int n, m;
    cin>>n>>m;
    int a[n],b[m];
 
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>b[i];
    }

    int anagy=0,bnagy=0é
    long long int csucssz=0;
 
    if (a[0]>a[1])
        anagy++;
    for(int i=1;i<n-1;i++)
        if (a[i]>a[i-1] && a[i]>a[i+1])
           anagy++;
    if (a[n-1]>a[n-2])
        anagy++;

    if (b[0]>b[1])
        bnagy++;
    for(int i=1;i<m-1;i++)
        if (b[i]>b[i-1] && b[i]>b[i+1])
           bnagy++;
    if (b[m-1]>b[m-2])
        bnagy++;
        
    if (n==1)
      csucssz=bnagy;
    else if (m==1)
      csucssz=anagy;
    else
      csucssz=anagy*bnagy;

    cout << csucssz << endl;
    return 0;
}
Compilation error
exit status 1
main.cpp:2:1: error: expected unqualified-id before numeric constant
    2 | 9075    2024. 02. 13 17:32:02   Ancsa   Csúcsok cpp17   Hibás válasz 49/100     59ms    5516 KiB
      | ^~~~
In file included from /usr/include/c++/11/iosfwd:40,
                 from /usr/include/c++/11/ios:38,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from main.cpp:4:
/usr/include/c++/11/bits/postypes.h:98:11: error: 'ptrdiff_t' does not name a type
   98 |   typedef ptrdiff_t     streamsize; // Signed integral type
      |           ^~~~~~~~~
/usr/include/c++/11/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
   40 | #include <cwchar> // For mbstate_t
  +++ |+#include <cstddef>
   41 | 
In file included from /usr/include/c++/11/bits/exception_ptr.h:40,
                 from /usr/include/c++/11/exception:153,
                 from /usr/include/c++/11/ios:39,
                 from...