// File: /workspace/github_cpp_makefile_star2_O3/shininglion[P]find_max_independent_set/main.cpp
// Function: main
int main(const int argc, const char* argv[])
{
    using namespace std;
	
    if (freopen(argv[1],"r",stdin) == nullptr) {
		fprintf(stderr, "Cannot open file %s\n", argv[1]);
		return 0;
	}

#ifdef TEST_USE_NODE
    vector<Node> connect;
#else
    vector< vector<int> > connect;
#endif
    vector<int> set;

    int Vnum, Enum;
	bool fail_flag = false;
    while(scanf("%d %d", &Vnum, &Enum) == 2) {
        connect.resize(Vnum);
#ifdef TEST_USE_NODE
        for (auto& node : connect) { node.edge_list.reserve(Vnum); }
#else
        for (auto& node : connect) { node.reserve(Vnum); }
#endif

#ifdef TEST_COST
		for (int i = 0; (i < Vnum) && (!fail_flag); ++i) {
			double cost = 0;
			if (scanf("%lf", &cost) != 1) { fail_flag = true; break; }
			connect[i].cost = cost;
		}
#endif

        // set the edge connection by (a b) for convenience
        for(int i = 0; (i < Enum) && (!fail_flag); ++i){
			int from, to;
            if (scanf("%d %d", &from, &to) != 2) { fail_flag = true; break; }
            // set index start from 0
            --from;
            --to;
#ifdef TEST_USE_NODE
            connect[from].edge_list.push_back(to);
            connect[to].edge_list.push_back(from);
#else
            connect[from].push_back(to);
            connect[to].push_back(from);
#endif
        }
		if (fail_flag) {
			fail_flag = false;
			fprintf(stderr, "An incomplete input.\n");
			continue;
		}

#ifdef TEST_USE_NODE
#ifdef TEST_COST
#ifndef USE_NAIVE
		printf("use greedy heuristic...\n");
        const double cost = graph::findMinCostMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; }, [](const Node& node) -> double { return node.cost; } );
#else
		printf("use naive approach...\n");
        const double cost = graph::naiveMinCostMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; }, [](const Node& node) -> double { return node.cost; } );
#endif
#else
#ifndef USE_NAIVE
		graph::findMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; });
#else
		graph::naiveMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; });
#endif
#endif
#else
#ifndef USE_NAIVE
		graph::findMIS(connect, set);
#else
		graph::naiveMIS(connect, set);
#endif
#endif

		printf("Validate mis...");
#ifdef TEST_USE_NODE
		const bool legal = graph::validateMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; });
#else
		const bool legal = graph::validateMIS(connect, set);
#endif
		printf(legal ? "pass\n" : "fail\n");

#ifdef TEST_COST
        printf("Maximum independent set (MIS) size and cost: %lu, %.3lf\n", set.size(), cost);
#else
        printf("Maximum independent set (MIS) size: %lu\n", set.size());
#endif
		printf("MIS vertices: ");
        for(size_t j = 0; j < set.size(); ++j )
            printf(" %d", set[j] + 1);
		putchar('\n');
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
movq 0x3c65(%rip), %rax      # 0x4fd0
movq (%rax), %rdx
leaq 0x1d46(%rip), %rsi      # 0x30bb
callq 0x10e0
testq %rax, %rax
je 0x19d0
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movq %rax, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
leaq 0x1d2c(%rip), %rdi      # 0x30d2
leaq 0xc(%rsp), %rsi
leaq 0x14(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
cmpl $0x2, %eax
jne 0x19a3
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
leaq 0xb8(%rsp), %r12
leaq 0xe8(%rsp), %rbp
leaq 0x10(%rsp), %r14
movslq 0xc(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x1d2e
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r15
cmpq %r15, %rbx
je 0x1411
leaq 0x8(%rbx), %rdi
movslq 0xc(%rsp), %rsi
callq 0x1da2
addq $0x20, %rbx
jmp 0x13f8
cmpl $0x0, 0xc(%rsp)
jle 0x1467
xorl %ebx, %ebx
xorl %r15d, %r15d
movq $0x0, 0xe8(%rsp)
leaq 0x1ca8(%rip), %rdi      # 0x30d8
movq %rbp, %rsi
xorl %eax, %eax
callq 0x10f0
cmpl $0x1, %eax
jne 0x1995
movsd 0xe8(%rsp), %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, (%rax,%rbx)
incq %r15
movslq 0xc(%rsp), %rax
addq $0x20, %rbx
cmpq %rax, %r15
jl 0x141d
cmpl $0x0, 0x14(%rsp)
leaq 0x1c5f(%rip), %r15      # 0x30d2
jle 0x152f
xorl %ebx, %ebx
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x10f0
cmpl $0x2, %eax
jne 0x199c
movslq 0xe8(%rsp), %rcx
decq %rcx
movl %ecx, 0xe8(%rsp)
movl 0xb8(%rsp), %eax
decl %eax
movl %eax, 0xb8(%rsp)
movq 0x40(%rsp), %rdx
shlq $0x5, %rcx
leaq (%rdx,%rcx), %rdi
addq $0x8, %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x14dd
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14e5
movq %r12, %rdx
callq 0x2012
movslq 0xb8(%rsp), %rax
movq 0x40(%rsp), %rcx
shlq $0x5, %rax
leaq (%rcx,%rax), %rdi
addq $0x8, %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x151b
movl 0xe8(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x1523
movq %rbp, %rdx
callq 0x2012
incl %ebx
cmpl 0x14(%rsp), %ebx
jl 0x147b
leaq 0x1c64(%rip), %rdi      # 0x319a
callq 0x1150
movq 0x48(%rsp), %rbx
subq 0x40(%rsp), %rbx
shrq $0x5, %rbx
movl %ebx, 0x1c(%rsp)
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x155e
movq %rax, 0x28(%rsp)
movabsq $0x7fefffffffffffff, %rax # imm = 0x7FEFFFFFFFFFFFFF
movq %rax, 0xb0(%rsp)
movq $0x0, 0xe0(%rsp)
leaq 0x118(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq $0x1, 0xf0(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x20(%rax)
movl $0x3f800000, 0x108(%rsp) # imm = 0x3F800000
movupd %xmm0, -0x8(%rax)
movslq %ebx, %rsi
movb $0x0, 0x80(%rsp)
movq %r12, %rdi
leaq 0x80(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x212a
leaq 0x1b(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x128(%rsp)
movq %rbp, 0x130(%rsp)
movq %r12, 0x80(%rsp)
movq %rbp, 0x88(%rsp)
leaq 0xe0(%rsp), %r15
movq %r15, 0x90(%rsp)
leaq 0x1a(%rsp), %rcx
movq %rcx, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
movq $0x0, 0x68(%rsp)
movl $0x48, %edi
callq 0x10d0
leaq 0x1c(%rsp), %rcx
movq %rcx, (%rax)
movq %r12, 0x8(%rax)
leaq 0x120(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x80(%rsp), %rcx
movq %rcx, 0x18(%rax)
leaq 0x60(%rsp), %rcx
movq %rcx, 0x20(%rax)
movq %rbp, 0x28(%rax)
leaq 0x20(%rsp), %rcx
movq %rcx, 0x30(%rax)
movq %r15, 0x38(%rax)
leaq 0xb0(%rsp), %rcx
movq %rcx, 0x40(%rax)
movq %rax, 0x60(%rsp)
leaq 0x509(%rip), %rax       # 0x1b9a
movq %rax, 0x78(%rsp)
leaq 0x633(%rip), %rax       # 0x1cd0
movq %rax, 0x70(%rsp)
movsd 0x195e(%rip), %xmm0     # 0x3008
movsd %xmm0, 0xa8(%rsp)
testl %ebx, %ebx
jle 0x182e
xorl %ebx, %ebx
movq 0xb8(%rsp), %rdi
movq 0xc8(%rsp), %r15
movl 0xd0(%rsp), %r12d
cmpq %r15, %rdi
je 0x16e9
movq %r15, %rdx
subq %rdi, %rdx
xorl %esi, %esi
callq 0x1090
jmp 0x16ec
movq %rdi, %r15
testl %r12d, %r12d
je 0x1707
negb %r12b
movq $-0x1, %rax
movl %r12d, %ecx
shrq %cl, %rax
notq %rax
andq %rax, (%r15)
movl %ebx, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq (%rax), %rax
movl %ebx, %edx
shrl $0x6, %edx
movl $0x1, %esi
movl %ebx, %ecx
shlq %cl, %rsi
orq %rsi, (%rax,%rdx,8)
movq 0x88(%rsp), %rdi
movq %r14, %rsi
callq 0x22b4
movq 0x90(%rsp), %rax
movq 0xa0(%rsp), %rcx
movslq 0x10(%rsp), %rdx
movq (%rcx), %rcx
movq %rdx, %rsi
shlq $0x5, %rsi
movsd (%rcx,%rsi), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl %edx, 0x5c(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x19de
leaq 0x60(%rsp), %rdi
leaq 0x5c(%rsp), %rsi
callq *0x78(%rsp)
movq 0x80(%rsp), %rax
movslq 0x10(%rsp), %rcx
leal 0x3f(%rcx), %edx
testq %rcx, %rcx
cmovnsl %ecx, %edx
sarl $0x6, %edx
movslq %edx, %rdx
shlq $0x3, %rdx
addq (%rax), %rdx
leaq 0x3f(%r13), %rax
andq %rcx, %rax
xorl %esi, %esi
cmpq %r13, %rax
setbe %sil
movq $-0x2, %rax
rolq %cl, %rax
andq %rax, -0x8(%rdx,%rsi,8)
movq 0x88(%rsp), %rdi
movq %r14, %rsi
callq 0x254a
movq 0x90(%rsp), %rax
movq 0xa0(%rsp), %rcx
movslq 0x10(%rsp), %rdx
movq (%rcx), %rcx
shlq $0x5, %rdx
movsd (%rax), %xmm0
subsd (%rcx,%rdx), %xmm0
movsd %xmm0, (%rax)
incl %ebx
cmpl 0x1c(%rsp), %ebx
jl 0x16bd
movsd 0xb0(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
movq 0x70(%rsp), %rax
testq %rax, %rax
leaq 0xb8(%rsp), %r12
je 0x183d
leaq 0x60(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x184f
callq 0x10c0
movq %rbp, %rdi
callq 0x2634
leaq 0x1894(%rip), %rdi      # 0x30f2
xorl %eax, %eax
callq 0x1030
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
setne %dl
sarq $0x2, %rcx
cmpq $0x2, %rcx
setae %sil
andb %dl, %sil
leaq 0x1877(%rip), %rdi      # 0x3102
cmpb $0x1, %sil
jne 0x18ee
movq 0x40(%rsp), %rdx
movl $0x1, %r8d
xorl %esi, %esi
movq %r8, %rdi
movslq (%rax,%r8,4), %r10
shlq $0x5, %r10
movq 0x8(%rdx,%r10), %r9
movq 0x10(%rdx,%r10), %r10
cmpq %r10, %r9
je 0x18ca
movl (%rax,%rsi,4), %r11d
cmpl %r11d, (%r9)
je 0x18e7
addq $0x4, %r9
cmpq %r10, %r9
jne 0x18bc
incq %r8
cmpq %rcx, %r8
jb 0x18a1
leaq 0x1(%rdi), %r8
movq %rdi, %rsi
cmpq %rcx, %r8
jne 0x189e
leaq 0x181d(%rip), %rdi      # 0x3102
jmp 0x18ee
leaq 0x181a(%rip), %rdi      # 0x3108
xorl %eax, %eax
callq 0x1030
movq 0x28(%rsp), %rsi
subq 0x20(%rsp), %rsi
sarq $0x2, %rsi
leaq 0x1804(%rip), %rdi      # 0x310e
movsd 0xa8(%rsp), %xmm0
movb $0x1, %al
callq 0x1030
leaq 0x1826(%rip), %rdi      # 0x3147
xorl %eax, %eax
callq 0x1030
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
leaq 0x179b(%rip), %r15      # 0x30d4
je 0x1965
xorl %ebx, %ebx
movl (%rax,%rbx,4), %esi
incl %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
incq %rbx
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rcx, %rbx
jb 0x193d
movl $0xa, %edi
callq 0x1110
leaq 0x175c(%rip), %r15      # 0x30d2
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x14(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
cmpl $0x2, %eax
je 0x13df
jmp 0x19a3
leaq 0x1736(%rip), %r15      # 0x30d2
callq 0x11b0
jmp 0x1976
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x19b2
callq 0x10c0
leaq 0x40(%rsp), %rdi
callq 0x1e34
xorl %eax, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x11d2
jmp 0x19bc
callq 0x1060
jmp 0x1a76
movq %rax, %rbx
jmp 0x1a48
movq %rax, %rbx
jmp 0x1a19
jmp 0x19f8
jmp 0x19f8
jmp 0x19fd
movq %rax, %rbx
jmp 0x1a55
movq %rax, %rbx
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x1a19
leaq 0x60(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x1a48
callq 0x10c0
xorl %eax, %eax
movq %rax, 0xb8(%rsp)
movl $0x0, 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x2634
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1a64
callq 0x10c0
leaq 0x40(%rsp), %rdi
callq 0x1e34
movq %rbx, %rdi
callq 0x1180
movq %rax, %rdi
callq 0x1e7a