Language: C++

#include <iostream>
#include <iostream>
Last login: Mon Jun 20 16:42:00 on ttys005
cosmos08:~ s1113093$ mkdir aoj
cosmos08:~ s1113093$ cd aoj
cosmos08:aoj s1113093$ vi 2018.cpp
cosmos08:aoj s1113093$ g++ 2018.cpp
2018.cpp:2: error: expected nested-name-specifier before 'namespce'
2018.cpp:2: error: 'namespce' has not been declared
2018.cpp:2: error: expected `;' before 'std'
2018.cpp:2: error: expected constructor, destructor, or type conversion before ';' token
2018.cpp: In function 'int main()':
2018.cpp:7: error: 'cin' was not declared in this scope
2018.cpp:17: error: 'cout' was not declared in this scope
2018.cpp:17: error: 'endl' was not declared in this scope
2018.cpp:20: error: 'cout' was not declared in this scope
2018.cpp:20: error: 'endl' was not declared in this scope
cosmos08:aoj s1113093$ vi 2018.cpp
#include <iostream>
cosmos08:aoj s1113093$ g++ 2018.cpp
cosmos08:aoj s1113093$ ./a.out
3 2 50
1
2
3
4 4 75
1
2
3
0
3 1 10
8
1
1
#include <iostream>
0 0 0150
                queue<State> q;
0
12
^R  
0 0 

^C
cosmos08:aoj s1113093$ vi 2018.cpp
cosmos08:aoj s1113093$ g++ 2018.cpp
cosmos08:aoj s1113093$ ./a.out
3 1 10
        {
8
1
1
112
3 2 50
1 2 3
150

4 4 75
1 2 3 0
0
^C
cosmos08:aoj s1113093$ vi 2018.cpp
cosmos08:aoj s1113093$ vi 2253.cpp
cosmos08:aoj s1113093$ g++ 2253.cpp
2253.cpp: In function 'int main()':
2253.cpp:41: error: no matching function for call to 'State::State(int, int)'
2253.cpp:13: note: candidates are: State::State(int, int, int)
2253.cpp:10: note:                 State::State(const State&)
2253.cpp:53: error: 'x' was not declared in this scope
2253.cpp:53: error: 'y' was not declared in this scope
2253.cpp: At global scope:
2253.cpp:64: error: expected declaration before '}' token
cosmos08:aoj s1113093$ vi 2253.cpp
cosmos08:aoj s1113093$ g++ 2253.cpp
2253.cpp: In function 'int main()':
2253.cpp:53: error: 'x' was not declared in this scope
2253.cpp:53: error: 'y' was not declared in this scope
2253.cpp: At global scope:
2253.cpp:64: error: expected declaration before '}' token
cosmos08:aoj s1113093$ vi 2253.cpp
cosmos08:aoj s1113093$ g++ 2253.cpp
cosmos08:aoj s1113093$ ./a.out
C^[[A
cosmos08:aoj s1113093$ 
cosmos08:aoj s1113093$ ./a.out > OUT
1 1
1 0
0 0
2 2
-2 1
2 0
2 2
2 0
#include <iostream>
-1 1
                {
4 4
-2 1
1 -2
1 2
3 -3
-2 0
4 6
0 1
1 1
1 0
-1 0
-1 -1
0 -1
0 0
0 0
cosmos08:aoj s1113093$ cat OUT
1
7
7
#include <iostream>
#include <iostream>
{

#include <iostream>
class State
cosmos08:aoj s1113093$ g++ 2254.cpp
cosmos08:aoj s1113093$ ./a.out
3
100 100 100 100
100 1 100 100
100 1 1 100
3
100 100 1 100
200 102 100 102
100 100 1 100
7
class State
100 100 60 60 70 70 70 90
100 50 100 55 45 45 55 44
100 50 60 100 51 50 55 30
100 70 10 20 1 10 10 40
200 90 10 30 10 10 10 30
150 200 12 1 11 11 1 30
10000 1200 1100 1100 1200 1200 1090 1
01
100
1100
^C
cosmos08:aoj s1113093$ vi 2254.cpp
cosmos08:aoj s1113093$ g++ 2254.cpp
2254.cpp: In function 'int main()':
2254.cpp:60: error: name lookup of 'j' changed for new ISO 'for' scoping
2254.cpp:55: error:   using obsolete binding at 'j'
cosmos08:aoj s1113093$ vi 2254.cpp
cosmos08:aoj s1113093$ g++ 2254.cpp
cosmos08:aoj s1113093$ ./a.out
3
100 100 100 100
100 1 100 100
100 1 1 100
3
100 100 1 100
200 102 100 102
100 100 1 100
7
#include <queue>
100 100 60 60 70 70 70 90
100 50 100 55 45 45 55 44
100 50 60 100 51 50 55 30
100 70 10 20 1 10 10 40
200 90 10 30 10 10 10 30
#include <iostream>
150 200 12 1 11 11 1 30
10000 1200 1100 1100 1200 1200 1090 1
0201
400
1371
^C
cosmos08:aoj s1113093$ vi 2254.cpp
cosmos08:aoj s1113093$ g++ 2254.cpp
cosmos08:aoj s1113093$ ./a.out
3
100 100 100 100
100 1 100 100
100 1 1 100
3
100 100 1 100
200 102 100 102
100 100 1 100
7
100 100 60 60 70 70 70 90
100 50 100 55 45 45 55 44
100 50 60 100 51 50 55 30
100 70 10 20 1 10 10 40
200 90 10 30 10 10 10 30
#include <iostream>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;

class State
{
public:
        int p,c,f;
        State(int p, int c, int f)
        :p(p),c(c),f(f)
        {}

        bool operator<(const State& s) const
        {
                return c>s.c;
        }
};

int f[30][30];
bool v[16][(1<<16)];

int main()
{
        int N;
        while(cin  >> N, N)
        {
                memset(v,0,sizeof(v));

                for(int i=0; i<N; i++)
                for(int j=0; j<N+1; j++)
                        cin >> f[j][i];

                priority_queue<State> q;
                for(int i=0; i<N; i++)
                        q.push(State(i,f[0][i],(1<<i)));

                while(!q.empty())
                {
                        State s=q.top(); q.pop();
                        if(v[s.p][s.f]) continue;
                        v[s.p][s.f]=1;
                        if(s.f == (1<<N)-1)
                        {
                                cout << s.c << endl;
                                break;
                        }

                        for(int i=0; i<N; i++)
                        {
                                int nc=s.c+f[0][i];
                                int nf=s.f;
                                for(int j=0; j<N; j++)
                                {
                                        if(i==j) continue;
                                        if(s.f&(1<<j)) nc=min(nc, f[j+1][i]);
                                }

                                nf|=(1<<i);
                                if(v[i][nf]) continue;

                                q.push(State(i,s.c+nc, nf));
}

Compiler output:
a.cc:8:58: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
    8 | 2018.cpp:2: error: expected nested-name-specifier before 'namespce'
      |                                                          ^~~~~~~~~~
a.cc:9:20: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
    9 | 2018.cpp:2: error: 'namespce' has not been declared
      |                    ^~~~~~~~~~
a.cc:10:29: error: stray '`' in program
   10 | 2018.cpp:2: error: expected `;' before 'std'
      |                             ^
a.cc:10:31: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   10 | 2018.cpp:2: error: expected `;' before 'std'
      |                               ^~~~~~~~~~~~~
a.cc:10:44: warning: missing terminating ' character
   10 | 2018.cpp:2: error: expected `;' before 'std'
      |                                            ^
a.cc:10:44: error: missing terminating ' character
a.cc:12:23: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   12 | 2018.cpp: In function 'int main()':
      |                       ^~~~~~~~~~~~
a.cc:13:20: warning: multi-character character constant [-Wmultichar]
   13 | 2018.cpp:7: error: 'cin' was not declared in this scope
      |                    ^~~~~
a.cc:14:21: warning: multi-character character constant [-Wmultichar]
   14 | 2018.cpp:17: error: 'cout' was not declared in this scope
      |                     ^~~~~~
a.cc:15:21: warning: multi-character character constant [-Wmultichar]
   15 | 2018.cpp:17: error: 'endl' was not declared in this scope
      |                     ^~~~~~
a.cc:16:21: warning: multi-character character constant [-Wmultichar]
   16 | 2018.cpp:20: error: 'cout' was not declared in this scope
      |                     ^~~~~~
a.cc:17:21: warning: multi-character character constant [-Wmultichar]
   17 | 2018.cpp:20: error: 'endl' was not declared in this scope
      |                     ^~~~~~
a.cc:64:23: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   64 | 2253.cpp: In function 'int main()':
      |                       ^~~~~~~~~~~~
a.cc:65:54: warning: multi-character literal with 22 characters exceeds 'int' size of 4 bytes
   65 | 2253.cpp:41: error: no matching function for call to 'State::State(int, int)'
      |                                                      ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:23: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   74 | 2253.cpp: In function 'int main()':
      |                       ^~~~~~~~~~~~
a.cc:146:23: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
  146 | 2254.cpp: In function 'int main()':
      |                       ^~~~~~~~~~~~
a.cc:147:60: warning: multi-character character constant [-Wmultichar]
  147 | 2254.cpp:60: error: name lookup of 'j' changed for new ISO 'for' scoping
      |                                                            ^~~~~
a.cc:3:1: error: 'Last' does not name a type
    3 | Last login: Mon Jun 20 16:42:00 on ttys005
      | ^~~~
a.cc:10:31: error: expected unqualified-id before user-defined character literal
   10 | 2018.cpp:2: error: expected `;' before 'std'
      |                               ^~~~~~~~~~~~~
a.cc:38:1: error: expected unqualified-id before numeric constant
   38 | 0
      | ^