Language: C++

#include <cstdio>

using namespace std;

//·²ë­Ì}Xîñ
int tbl[1010];
int main(int argc, char **argv)
{
    int n,m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; ++i) {
        scanf("%d", &tbl[i]);
    }
    int cur = 0;
    for(int i = 0; i < m; ++i) {
        int t;
        scanf("%d", &t);
        // ³¢±ëÉæéÚ®
        cur += t;
        if(cur >= n-1) {
            printf("%d\n", i+1);
            return 0;
        }
        // }XÚÌw¦ÉæéÚ®
        cur += tbl[cur];
        // ±Á¿Ìif¶ð«YêéÆ4_¸_B116_ÌlÍ½©Á½æ¤Å·B
        if(cur >= n-1) {
            printf("%d\n", i+1);
            return 0;
        }
    }
    return 0;
}

âè3
/*
 * JOI 2010 \I âè3 C++ðá by qnighy
 */

// âè:
// p[eB[
// http://www.ioi-jp.org/joi/2009/2010-yo-prob_and_sol/2010-yo-t3/2010-yo-t3.html

#include <cstdio>
// memsetðg¤ÌÅincludeµÄÜ·
#include <cstring>

using namespace std;

// 2lÍFlÖWÉ é©Ç¤©
bool mat[500][500];
// >>1³ñÌFBâFBÌFB©Ç¤©ÌtO
bool flags[500];

int main(int argc, char **argv)
{
    // ú»
    memset(mat, 0, sizeof(mat));
    memset(flags, 0, sizeof(flags));
    int n,m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; ++i) {
        int a,b;
        scanf("%d%d", &a, &b);
        // ±±ÅÍ0X^[gÌÔÉµ½¢ÌÅ1Ð¢Äé
        // ¼ûüÌtOð§Äé±ÆÉÓ
        mat[a-1][b-1]=mat[b-1][a-1]=true;
    }
    for(int i = 0; i < n; ++i) {
        if(mat[0][i]) {
            // FBtO
            flags[i] = true;
            for(int j = 0; j < n; ++j) {
                if(mat[i][j]) {
                    // FBÌFBtO
                    flags[j] = true;
                }
            }
        }
    }
    // ©ªÍO
    // FBÌFBª©ª¾Á½è·éÌÅ
    flags[0] = false;
    // ¦ÄoÍ
    int cnt = 0;
    for(int i = 0; i < n; ++i) {
        if(flags[i])cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

Compiler output:
a.cc:35:1: error: extended character  is not valid in an identifier
   35 | âè3
      | ^
a.cc:35:1: error: extended character  is not valid in an identifier
a.cc:35:1: error: '\302\226\303\242\302\221\303\2503' does not name a type
   35 | âè3
      | ^~~~~
In file included from a.cc:46:
/usr/include/c++/14/cstring:78:11: error: 'memchr' has not been declared in '::'
   78 |   using ::memchr;
      |           ^~~~~~
/usr/include/c++/14/cstring:79:11: error: 'memcmp' has not been declared in '::'
   79 |   using ::memcmp;
      |           ^~~~~~
/usr/include/c++/14/cstring:80:11: error: 'memcpy' has not been declared in '::'
   80 |   using ::memcpy;
      |           ^~~~~~
/usr/include/c++/14/cstring:81:11: error: 'memmove' has not been declared in '::'
   81 |   using ::memmove;
      |           ^~~~~~~
/usr/include/c++/14/cstring:82:11: error: 'memset' has not been declared in '::'
   82 |   using ::memset;
      |           ^~~~~~
/usr/include/c++/14/cstring:83:11: error: 'strcat' has not been declared in '::'
   83 |   using ::strcat;
      |           ^~~~~~
/usr/include/c++/14/cstring:84:11: error: 'strcmp' has not been declared in '::'
   84 |   using ::strcmp;
      |           ^~~~~~
/usr/include/c++/14/cstring:85:11: error: 'strcoll' has not been declared in '::'
   85 |   using ::strcoll;
      |           ^~~~~~~
/usr/include/c++/14/cstring:86:11: error: 'strcpy' has not been declared in '::'
   86 |   using ::strcpy;
      |           ^~~~~~
/usr/include/c++/14/cstring:87:11: error: 'strcspn' has not been declared in '::'
   87 |   using ::strcspn;
      |           ^~~~~~~
/usr/include/c++/14/cstring:88:11: error: 'strerror' has not been declared in '::'
   88 |   using ::strerror;
      |           ^~~~~~~~
/usr/include/c++/14/cstring:89:11: error: 'strlen' has not been declared in '::'
   89 |   using ::strlen;
      |           ^~~~~~
/usr/include/c++/14/cstring:90:11: error: 'strncat' has not been declared in '::'
   90 |   using ::strncat;
      |           ^~~~~~~
/usr/include/c++/14/cstring:91:11: error: 'strncmp' has not been declared in '::'
   91 |   using ::strncmp;
      |           ^~~~~~~
/usr/include/c++/14/cstring:92:11: error: 'strncpy' has not been declared in '::'
   92 |   using ::strncpy;
      |           ^~~~~~~
/usr/include/c++/14/cstring:93:11: error: 'strspn' has not been declared in '::'
   93 |   using ::strspn;
      |           ^~~~~~
/usr/include/c++/14/cstring:95:11: error: 'strtok' has not been declared in '::'
   95 |   using ::strtok;
      |           ^~~~~~
/usr/include/c++/14/cstring:97:11: error: 'strxfrm' has not been declared in '::'
   97 |   using ::strxfrm;
      |           ^~~~~~~
/usr/include/c++/14/cstring:98:11: error: 'strchr' has not been declared in '::'
   98 |   using ::strchr;
      |           ^~~~~~
/usr/include/c++/14/cstring:99:11: error: 'strpbrk' has not been declared in '::'
   99 |   using ::strpbrk;
      |           ^~~~~~~
/usr/include/c++/14/cstring:100:11: error: 'strrchr' has not been declared in '::'
  100 |   using ::strrchr;
      |           ^~~~~~~
/usr/include/c++/14/cstring:101:11: error: 'strstr' has not been declared in '::'
  101 |   using ::strstr;
      |           ^~~~~~
a.cc:55:5: error: redefinition of 'int main(int, char**)'
   55 | int main(int argc, char **argv)
      |     ^~~~
a.cc:7:5: note: 'int main(int, char**)' previously defined here
    7 | int main(int argc, char **argv)
      |     ^~~~
a.cc: In function 'int main(int, char**)':
a.cc:58:5: error: 'memset' was not declared in this scope
   58 |     memset(mat, 0, sizeof(mat));
      |     ^~~~~~
a.cc:47:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   46 | #include <cstring>
  +++ |+#include <cstring>
   47 |