Language: C++

Last login: Sun Apr 28 02:01:28 on console
fujitaakiratasukunoMacBook-Pro:~ fujitakosuke$ cd program/C++/
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ls
#b.cpp#			Stones.cpp~		convex_hull.cpp
GCD_on_Blackboard.cpp	ThreeColors.cpp		dijkstra.cpp
GCD_on_Blackboard.cpp~	ThreeColors.cpp~	dijkstra.cpp~
Stones.cpp		a.out
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
GCD_on_Blackboard.cpp:20:22: error: use of undeclared identifier 'right_gck';
      did you mean 'right_gcd'?
    right_gcd[i]=gcd(right_gck[i+1],data[i]);
                     ^~~~~~~~~
                     right_gcd
GCD_on_Blackboard.cpp:15:7: note: 'right_gcd' declared here
  int right_gcd[100005];
      ^
1 error generated.
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3 
7 6 8
0
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
7 6 8
7
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.

fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
7 6 8
0
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.

fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
7 6 8
0
0
0
0
0
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
7 6 8
1
1
2
1
2
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
7 6 8
7
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
7 6 8
1
1
2
1
7
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ GCD_on_Blackboard.cpp
ld: warning: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.

fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
7 6 8
1
1
2
1
2
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
12 15 18
3
3
3
3
6
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
2
1000000000 1000000000
1000000000
1000000000
1000000000
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs GCD_on_Blackboard.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs FlippingSigns.cpp
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ FlippingSigns.cpp
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.

fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ ./a.out
3
-10 5 -4
19
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ FlippingSigns.cpp&&./a.out
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
5
10 -4 -8 -11 3
30
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ g++ FlippingSigns.cpp&&./a.out
]ld: warning: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.

^C 
fujitaakiratasukunoMacBook-Pro:C++ fujitakosuke$ emacs FlippingSigns.cpp

#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<climits>
using namespace std;
int main(){
  int n;
  int minus=0;
  int minimum=INT_MAX;
  long long sum=0;

  cin>>n;
  for(int i=0;i<n;i++){
    int data;
    cin>>data;
    sum+=abs(data);
    if(data<0){
      minus++;
    }
    minimum=min(minimum,abs(data));
  }

  if(minus%2==0){
    cout<<sum<<endl;
  }else{
    cout<<sum-minimum*2<<endl;
  }
  return(0);
}



Compiler output:
a.cc:4:2: error: invalid preprocessing directive #b
    4 | #b.cpp#                 Stones.cpp~             convex_hull.cpp
      |  ^
a.cc:10:66: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
   10 | GCD_on_Blackboard.cpp:20:22: error: use of undeclared identifier 'right_gck';
      |                                                                  ^~~~~~~~~~~
a.cc:11:20: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
   11 |       did you mean 'right_gcd'?
      |                    ^~~~~~~~~~~
a.cc:15:35: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
   15 | GCD_on_Blackboard.cpp:15:7: note: 'right_gcd' declared here
      |                                   ^~~~~~~~~~~
a.cc:1:1: error: 'Last' does not name a type
    1 | Last login: Sun Apr 28 02:01:28 on console
      | ^~~~
a.cc:11:7: error: 'did' does not name a type
   11 |       did you mean 'right_gcd'?
      |       ^~~
a.cc:13:22: error: expected unqualified-id before '^' token
   13 |                      ^~~~~~~~~
      |                      ^
a.cc:17:7: error: expected unqualified-id before '^' token
   17 |       ^
      |       ^
In file included from /usr/include/c++/14/iosfwd:42,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:134:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
   68 |   typedef ptrdiff_t     streamsize; // Signed integral type
      |           ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
   40 | #include <cwchar> // For mbstate_t
  +++ |+#include <cstddef>
   41 | 
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/14/cwchar:44,
                 from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  132 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  134 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
  140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                             ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
  142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                               ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                    ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                      ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                          ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                                                    ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
  155 |   __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
      |                                                                         ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                          ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                                                    ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                                                      ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
  162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                          ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
  162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                                                                      ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
  163 |   __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
      |                                                                         ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
  164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
      |                          ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
  164 | _GLIBCXX_NODISCARD void* o