Language: C

Last login: Tue Jan 22 00:07:40 on ttys000
fujitahayatonoMacBook-Pro:~ fujitahayato$ emacs sugaku

[1]+  Stopped                 emacs sugaku
fujitahayatonoMacBook-Pro:~ fujitahayato$ emacs sugaku.c

[2]+  Stopped                 emacs sugaku.c
fujitahayatonoMacBook-Pro:~ fujitahayato$ emacs BBQ_Easy.c

[3]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:~ fujitahayato$ cd Desktop
fujitahayatonoMacBook-Pro:Desktop fujitahayato$ cd prog
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c






[4]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
2
1 3 1 2
0
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[5]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc BBQ_Easy.c
BBQ_Easy.c:24:20: error: invalid suffix 'n' on integer constant
  for (i = 0; i < 2n; i++)
                   ^
BBQ_Easy.c:31:20: error: invalid suffix 'n' on integer constant
  for (i = 0; i < 2n; i++)
                   ^
2 errors generated.
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[6]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[7]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
2
1 3 1 2
2
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
5
100 1 2 3 14 15 58 58 58 29
290
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[8]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
2
1 3 1 2
2
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
5
100 1 2 3 14 15 58 58 58 29
220
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[9]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
5
100 1 2 3 14 15 58 58 58 29
1 4 104 162 220 220
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[10]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc BBQ_Easy.c
BBQ_Easy.c:27:13: error: invalid suffix 'n' on integer constant
  bsort(l, 2n);
            ^
1 error generated.
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[11]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
5
100 1 2 3 14 15 58 58 58 29
1 4 19 77 135 135
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[12]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs BBQ_Easy.c

[13]+  Stopped                 emacs BBQ_Easy.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs ABC085B.c

[14]+  Stopped                 emacs ABC085B.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc ABC085B.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
7
50 
30
50
100
50
80
30
5
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs ABC085B.c

[15]+  Stopped                 emacs ABC085B.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc ABC085B.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
3
15
15
15
1
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs ABC085B.c

[16]+  Stopped                 emacs ABC085B.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs Grand_Garden.c

[17]+  Stopped                 emacs Grand_Garden.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ gcc Grand_Garden.c
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
5
3 1 2 3 1
5
fujitahayatonoMacBook-Pro:prog fujitahayato$ ./a.out
8
4 23 75 0 23 96 50 100
221
fujitahayatonoMacBook-Pro:prog fujitahayato$ emacs Grand_Garden.c

#include <stdio.h>

int main(void)
{
  int n, i, j;
  int a[100];
  int k = 0;
  int max;

  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);

  max = a[0];
  for (i = 1; i < n; i++) {
    if (a[i] > max)
      max = a[i];
  }
  for (j = 1; j <= max; j++) {
    for (i = 0; i < n; i++) {
      if (a[i] >= j && a[i + 1] < j)
        k++;
    }
  }

  printf("%d\n", k);

  return 0;
}

Compiler output:
main.c:1:1: error: unknown type name 'Last'
    1 | Last login: Tue Jan 22 00:07:40 on ttys000
      | ^~~~
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
    1 | Last login: Tue Jan 22 00:07:40 on ttys000
      |           ^
main.c:31:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   31 |   for (i = 0; i < 2n; i++)
      |                 ^
main.c:31:19: error: invalid suffix "n" on integer constant
   31 |   for (i = 0; i < 2n; i++)
      |                   ^~
main.c:31:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   31 |   for (i = 0; i < 2n; i++)
      |                        ^~
main.c:34:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   34 |   for (i = 0; i < 2n; i++)
      |                 ^
main.c:34:19: error: invalid suffix "n" on integer constant
   34 |   for (i = 0; i < 2n; i++)
      |                   ^~
main.c:34:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   34 |   for (i = 0; i < 2n; i++)
      |                        ^~
main.c:77:12: error: invalid suffix "n" on integer constant
   77 |   bsort(l, 2n);
      |            ^~
main.c:78:13: error: expected identifier or '(' before '^' token
   78 |             ^
      |             ^
In file included from /usr/include/stdio.h:47,
                 from main.c:135:
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:28:43: error: unknown type name 'size_t'
   28 |                                           size_t __nbytes);
      |                                           ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  +++ |+#include <stddef.h>
    1 | /* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: error: unknown type name 'size_t'
   37 |                                            size_t __nbytes);
      |                                            ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:57:3: error: unknown type name 'cookie_read_function_t'; did you mean 'cookie_seek_function_t'?
   57 |   cookie_read_function_t *read;         /* Read bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   cookie_seek_function_t
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:58:3: error: unknown type name 'cookie_write_function_t'; did you mean 'cookie_close_function_t'?
   58 |   cookie_write_function_t *write;       /* Write bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~~
      |   cookie_close_function_t
/usr/include/stdio.h:314:35: error: unknown type name 'size_t'
  314 | extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
      |                                   ^~~~~~
/usr/include/stdio.h:130:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  129 | #include <bits/stdio_lim.h>
  +++ |+#include <stddef.h>
  130 | 
/usr/include/stdio.h:320:47: error: unknown type name 'size_t'
  320 | extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW
      |                                               ^~~~~~
/usr/include/stdio.h:320:47: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:340:34: error: unknown type name 'size_t'
  340 |                     int __modes, size_t __n) __THROW __nonnull ((1));
      |                                  ^~~~~~
/usr/include/stdio.h:340:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:346:24: error: unknown type name 'size_t'
  346 |                        size_t __size) __THROW __nonnull ((1));
      |                        ^~~~~~
/usr/include/stdio.h:346:24: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:385:44: error: unknown type name 'size_t'
  385 | extern int snprintf (char *__restrict __s, size_t __maxlen,
      |                                            ^~~~~~
/usr/include/stdio.h:385:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:389:45: error: unknown type name 'size_t'
  389 | extern int vsnprintf (char *__restrict __s, size_t __maxlen,
      |                                             ^~~~~~
/usr/include/stdio.h:389:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:690:30: error: unknown type name 'size_t'
  690 |                              size_t *__restrict __n, int __delimiter,
      |                              ^~~~~~
/usr/include/stdio.h:690:30: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:693:28: error: unknown type name 'size_t'
  693 |                            size_t *__restrict __n, int __delimiter,
      |                            ^~~~~~
/usr/include/stdio.h:693:28: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:698:27: error: unknown type name 'size_t'
  698 |                           size_t *__restrict __n,
      |                           ^~~~~~
/usr/include/stdio.h:698:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:8: error: unknown type name 'size_t'
  728 | extern size_t fread (void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:728:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:46: error: unknown type name 'size_t'
  728 | extern size_t fread (void *__restrict __ptr, size_t __size,
      |                                              ^~~~~~
/usr/include/stdio.h:728:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:729:22: error: unknown type name 'size_t'
  729 |                      size_t __n, FILE *__restrict __stream) __wur
      |                      ^~~~~~
/usr/include/stdio.h:729:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:8: error: unknown type name 'size_t'
  735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:735:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:53: error: unknown type name 'size_t'
  735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
      |                                                     ^~~~~~
/usr/include/stdio.h:735:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:736:23: error: unknown type name 'size_t'
  736 |                       size_t __n, FILE *__restrict __s) __nonnull((4));
      |                       ^~~~~~
/usr/include/stdio.h:736:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:8: error: unknown type name 'size_t'
  756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:756:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:55: error: unknown type name 'size_t'
  756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
      |                                                       ^~~~~~
/usr/include/stdio.h:756:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:757:31: error: unknown type name 'size_t'
  757 |                               size_t __n, FILE *__restrict __stream) __wur
      |                               ^~~~~~
/usr/include/stdio.h:757:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:8: error: unknown type name 'size_t'
  759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:759:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:62: error: unknown type name 'size_t'
  759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
      |                                                              ^~~~~~
/usr/include/stdio.h:759:62: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:760:32: error: unknown type name 'size_t'
  760 |                                size_t __n, FILE *__restrict __stream)
      |                                ^~~~~~
/usr/include/stdio.h:760:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'