Language: C++

/*
                                                                                                     
                                             `-:://:::-                                             
                                           `//:-------:/:`                                          
                                          .+:--.......--:+`                                         
                                         `+:--..`````..--//`                                        
                                         .o:--..`` ``..--:o`                                        
                                         .o:--...```..---+/`                                        
                                       `/y+o/---....---:+o.                                         
                                   `...````-os+/:---:/+o/--.`                                       
              `-/+++++/:.      `...`       :h+d+oooo+/+-`   ...                                     
            `/++//:::://++-`....`         -.`//````````:`     `..`                                  
           `o+/::------://o/`           `-` -.          -`       `..`                               
 `---.-o/:./o/::-..``..-ЗАПУСКАЕМ      ..  ..            -`        `...       ``..``                
  `....o+:-++/:--.```..-://s.        `-`  .-              -`          `-o: .-//::::/:-`             
          `:s+/:--....-::/+s-`      .-   `-                -`           -///:--------:/:`           
           ./s+//:::::://oo-``..НЕЙРОННУЮ: СЕТЬ:::::::-`РАБОТЯГИ        `+:--........--:/`          
            .:ooo+++++osso-`    `.:-...`/` ./::-------:/:`   -`         :+--..``````.--:+:...-+:-`  
             `.-/+++++/+-.-`    -.   ``:so:/:--.......--:+`  `-```````o+/+--..`````..--:o/-..:s+:.  
                 ```````:``.. `-`     -` `+:--..`````..--/+-.../.`````..-o:--.......---/o.    `     
                        `:  `:-      -.  .o:--..`` ``..--:o`   `-`      `:o+:--------:+o-`          
                         `-`-...    ..   .o/--...```..--:+/`    `-`     `oy/so/////++o/.`           
                          -/`  `-` `- ``+s/o/:---...---:++.      `-`   .-../d://///:-.`             
                `.---..``-..-    .-/..`````-oo+/:::::/+o+-        `-``-`  `-.  ````                 
             `:++++/+++++-  ..``.-/:`      /y-:/++o++/:.`..`       ./.   `-                         
            -++/::::::://+/..:-``:` ..   `-.`  ```.```    `..`   `..`-` `-                          
       ``  -o//:--....-::/++` -.-`   `-`.-`                 `..`..`  `-.-                           
  -----ss+:++/:--.```..-://s.  /.     `::                    `-:.     ./`                           
  `````/:..+o/::-..``.--:/+s. ..-`   `-``-`                 ..` `-`  `-`-`                          
          `-s+/::-----::/+oo---``-` ..    .:-    ```      .-`     .-.-  `-`                         
           `:oo+//::://+os/..:`..-/:`      :y.-:::::::.`.-`        ./-`  `-`                        
            `./+oooooooo+/.`-    .-:...`.. .//:-------://`        `- `..` `:.                       
              ``.-::::-.``-/`  `-` `-  `oo:+:--.......--:/`      `-    `.:--h.``..```               
                          -.-`.-    .-   `+:--..`````..--//`    `-       /s-//::::::::.             
                         -` `/-      ..  .o:--..`` ``..--:o.```.-        `//:--------://`           
                        -` .-`.-`     -.`-o/--...```..--:+/.``-:....``:-.+:--....`...--:+`          
                       ..`-.   `-.   ``:os:o/:---...---:++.  `-     ``///+:-..``````.--:+-````-.`   
              `.:///////.-`      .:-..` -``-+o+/:::::/+o/.  `-         `:+:-..`````..--:o/:--/ys+-  
            `-++///////+o/. ``....`-.    :` `.:++++++/:.`  .-           -o/---......---/o.   `.`    
           `++//:-----::/+o:..`     .-`   :    ```````    .-           `+so+:--------:++-`          
  `````:-``:o/::-..`..--:/+o`         -.  `-             .-          `../../+o+////+o+:.`           
  -----syo/o+/:--.```..-://s.          .-` `-           .-        `...     ``-:////:-``             
       .` `/s//:--....-::/+s.            -. `-`        .-       `..`                                
           .+o+/:::--:://+s/-..`          .::+y  ```  .-     `..`                                   
            ./oo++////+oso-`   `....       :y-+:::::::/`   ...                                      
             `.:+oooooo/-`         `....-. .//:-------:/:-.`                                        
                ``...``                 /+:+:--.......--:+`                                         
                                         `+:--..`````..--//`                                        
                                         .o:--..`` ``..--:o`                                        
                                         .+/--...```..--:+/`                                        
                                         `-o/:---...---:++.                                         
                                          `-+o+/:---:/+o/.                                          
                                            `.:+oooo+/-.`                                           
                                               ``````                                               
*/

#ifdef cheats
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <queue>
#include <ostream>
#include <istream>
#include <typeinfo>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <limits>
#include <fstream>
#include <array>
#include <list>
#include <bitset>
#include <functional>
#include <random>
#include <cstring>

#define mt make_tuple
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define umap unordered_map
#define uset unordered_set
#define elif else if
#define len(v) ((int)v.size())
#define f(i, n) for (int i = 0; i < (n); i++)
#define apply(v, act) for (auto &x : v) { act; }


using namespace std;

char string_in_buffer[(int)260];


void fast_scan(int &x) { scanf("%d", &x); }
void fast_scan(long long &x) { scanf("%lld", &x); }
void fast_scan(unsigned long long &x) { scanf("%llu", &x); }
void fast_scan(double &x) { scanf("%lf", &x); }
void fast_scan(long double &x) { scanf("%Lf", &x); }
void fast_scan(char &x) { 
	scanf("%c", &x); 
	if (x == '\n') {
		fast_scan(x);
	}
}
void fast_scan(string &x) {
	scanf("%s", string_in_buffer);
	x = string(string_in_buffer);
}

template<class TFirst, class TSecond>
void fast_scan(pair<TFirst, TSecond> &p) {
	fast_scan(p.first);
	fast_scan(p.second);
}

template <class T>
void fast_scan(vector<T> &v) {
	for (auto &x : v) fast_scan(x);
}

void fast_print(const int &x) { printf("%d", x); }
void fast_print(const long long &x) { printf("%lld", x); }
void fast_print(const unsigned long long &x) { printf("%llu", x); }
void fast_print(const double &x) { printf("%.15lf", x); }
void fast_print(const long double &x) { printf("%.15Lf", x); }
void fast_print(const char &x) { printf("%c", x); };
void fast_print(const string &x) { printf("%s", x.c_str());}

template<class TFirst, class TSecond>
void fast_print(const pair<TFirst, TSecond> &p) {
	fast_print(p.first);
	fast_print(' ');
	fast_print(p.second);
}

template <class T>
void fast_print(const vector<T> &v) {
	if (v.empty()) return;
	fast_print(v[0]);
	for (int i = 1; i < v.size(); i++) {
		fast_print(" ");
		fast_print(v[i]);
	}
}

template <class T>
void fast_print(const vector<vector<T>> &v) {
	if (v.empty()) return;
	fast_print(v[0]);
	for (int i = 1; i < v.size(); i++) {
		fast_print("\n");
		fast_print(v[i]);
	}
}



using namespace std;


namespace smart_io {
	string print_start = "";
	string sep = " ";
	bool first_print = false;

	void precall_print() {
		fast_print(print_start);
		print_start = "\n";
		first_print = true;
	}
} //namespace smart_io


template <class T>
ostream &operator,(ostream &os, const T &object) {
	if (!smart_io::first_print) {
		fast_print(smart_io::sep);
	} else {
		smart_io::first_print = false;
	}
	fast_print(object);
	return os;
}

template <class T>
istream &operator,(istream &is, T &object) {
	fast_scan(object);
	return is;
}

#define int long long

namespace typedefs {
	typedef long long ll;
	typedef unsigned long long ull;
	typedef pair<int, int> pii;
	typedef long double ld;
}

namespace numbers_operation {
	template<class T>
	T floor_mod(T a, T b) {
		if (a % b == 0) return 0;
		if (a >= 0 && b >= 0) return a % b;
		if (a <= 0 && b <= 0) return a % b;
		return abs(b) - (abs(a) % abs(b));
	}
}

using namespace numbers_operation;
using namespace typedefs;

#define print    \
smart_io::precall_print(); \
cout,

#define scan cin,

vector<vector<int>> g;

struct SUS {
	vector<int> up;
	vector<set<pii>> pep;
	set<pii> best;
	set<pii> ebal;
	vector<bool> can;

	SUS(int n, vector<int> cost) {
		up.resize(n);
		pep.resize(n);
		can.resize(n, true);

		f(i, n) {
			up[i] = i;
			pep[i].emplace(cost[i], i);
			best.emplace(cost[i], i);
			ebal.emplace(1, i);
		}
	}

	int get_root(int v) {
		if (up[v] == v) return v;
		return up[v] = get_root(up[v]);
	}

	void merge(int a, int b, bool del) {
		int _a = a;
		int _b = b;
		a = get_root(a);
		b = get_root(b);
		assert(a != b);
		if (del) {
			can[_a] = can[_b] = false;
		}
		if (len(pep[a]) < len(pep[b])) {
			swap(a, b);	
		}
		up[b] = a;
		best.erase(*pep[a].begin());
		for (pii p : pep[b]) {
			pep[a].insert(p);
		}	
		best.erase(*pep[b].begin());
		while (!pep[a].empty()) {
			if (!can[pep[a].begin()->second]) {
				pep[a].erase(pep[a].begin());
			} else {
				break;
			}
		}
		if (!pep[a].empty()) {
			best.emplace(*pep[a].begin());
		}
	}

	vector<int> cut() {
		vector<int> rogs;	
		set<int> roots;
		for (int i = 0; i < len(up); i++) {
			roots.insert(get_root(i));	
		}
		for (int root : roots) {
			if (len(pep[root]) == 1) {
				best.erase(*pep[root].begin());
				rogs.pb(pep[root].begin()->second);	
			}
		}
		return rogs;
	}

	void extract() {
		assert(!best.empty());
		auto it = best.begin();
		int root = get_root(it->second);
		best.clear();
		for (pii p : pep[root]) {
			if (can[p.second]) {
				best.emplace(p);
			}
		}
	}
};

signed main(signed argc, char *argv[]) {
	int n, m;
	scan n, m;
	vector<int> cost(n);
	scan cost;
	SUS sus(n, cost);

	f(i, m) {
		int a, b;
		scan a, b;
		sus.merge(a, b, false);	
	}
	
	vector<int> rogs = sus.cut();
	if (len(rogs) == n) {
		if (n > 2) {
			print "Impossible";
			return 0;
		}
		if (n == 1) {
			print 0;
		} else {
			print cost[0] + cost[1];
		}	
		return 0;
	}
	m += len(rogs);
	ll rez = 0;
	while (m++ < n - 1) {
		// print "Oh so huge";
		assert(len(sus.best) >= 2);
		auto it = sus.best.begin();		
		pii f = *it;
		it++;
		pii s = *it;

		rez += f.first + s.first;
		sus.merge(f.second, s.second, true);
	}
	sus.extract();
	for (int x : rogs) {
		rez += cost[x];
		if (sus.best.empty()) {
			// print "You love dicks";
			print "Impossible";
			return 0;
		}
		// print sus.best.begin()->first;
		rez += sus.best.begin()->first;
		sus.best.erase(*sus.best.begin());
	}	
	print rez;
}/*
                                                                                                     
                                             `-:://:::-                                             
                                           `//:-------:/:`                                          
                                          .+:--.......--:+`                                         
                                         `+:--..`````..--//`                                        
                                         .o:--..`` ``..--:o`                                        
                                         .o:--...```..---+/`                                        
                                       `/y+o/---....---:+o.                                         
                                   `...````-os+/:---:/+o/--.`                                       
              `-/+++++/:.      `...`       :h+d+oooo+/+-`   ...                                     
            `/++//:::://++-`....`         -.`//````````:`     `..`                                  
           `o+/::------://o/`           `-` -.          -`       `..`                               
 `---.-o/:./o/::-..``..-ЗАПУСКАЕМ      ..  ..            -`        `...       ``..``                
  `....o+:-++/:--.```..-://s.        `-`  .-              -`          `-o: .-//::::/:-`             
          `:s+/:--....-::/+s-`      .-   `-                -`           -///:--------:/:`           
           ./s+//:::::://oo-``..НЕЙРОННУЮ: СЕТЬ:::::::-`РАБОТЯГИ        `+:--........--:/`          
            .:ooo+++++osso-`    `.:-...`/` ./::-------:/:`   -`         :+--..``````.--:+:...-+:-`  
             `.-/+++++/+-.-`    -.   ``:so:/:--.......--:+`  `-```````o+/+--..`````..--:o/-..:s+:.  
                 ```````:``.. `-`     -` `+:--..`````..--/+-.../.`````..-o:--.......---/o.    `     
                        `:  `:-      -.  .o:--..`` ``..--:o`   `-`      `:o+:--------:+o-`          
                         `-`-...    ..   .o/--...```..--:+/`    `-`     `oy/so/////++o/.`           
                          -/`  `-` `- ``+s/o/:---...---:++.      `-`   .-../d://///:-.`             
                `.---..``-..-    .-/..`````-oo+/:::::/+o+-        `-``-`  `-.  ````                 
             `:++++/+++++-  ..``.-/:`      /y-:/++o++/:.`..`       ./.   `-                         
            -++/::::::://+/..:-``:` ..   `-.`  ```.```    `..`   `..`-` `-                          
       ``  -o//:--....-::/++` -.-`   `-`.-`                 `..`..`  `-.-                           
  -----ss+:++/:--.```..-://s.  /.     `::                    `-:.     ./`                           
  `````/:..+o/::-..``.--:/+s. ..-`   `-``-`                 ..` `-`  `-`-`                          
          `-s+/::-----::/+oo---``-` ..    .:-    ```      .-`     .-.-  `-`                         
           `:oo+//::://+os/..:`..-/:`      :y.-:::::::.`.-`        ./-`  `-`                        
            `./+oooooooo+/.`-    .-:...`.. .//:-------://`        `- `..` `:.                       
              ``.-::::-.``-/`  `-` `-  `oo:+:--.......--:/`      `-    `.:--h.``..```               
                          -.-`.-    .-   `+:--..`````..--//`    `-       /s-//::::::::.             
                         -` `/-      ..  .o:--..`` ``..--:o.```.-        `//:--------://`           
                        -` .-`.-`     -.`-o/--...```..--:+/.``-:....``:-.+:--....`...--:+`          
                       ..`-.   `-.   ``:os:o/:---...---:++.  `-     ``///+:-..``````.--:+-````-.`   
              `.:///////.-`      .:-..` -``-+o+/:::::/+o/.  `-         `:+:-..`````..--:o/:--/ys+-  
            `-++///////+o/. ``....`-.    :` `.:++++++/:.`  .-           -o/---......---/o.   `.`    
           `++//:-----::/+o:..`     .-`   :    ```````    .-           `+so+:--------:++-`          
  `````:-``:o/::-..`..--:/+o`         -.  `-             .-          `../../+o+////+o+:.`           
  -----syo/o+/:--.```..-://s.          .-` `-           .-        `...     ``-:////:-``             
       .` `/s//:--....-::/+s.            -. `-`        .-       `..`                                
           .+o+/:::--:://+s/-..`          .::+y  ```  .-     `..`                                   
            ./oo++////+oso-`   `....       :y-+:::::::/`   ...                                      
             `.:+oooooo/-`         `....-. .//:-------:/:-.`                                        
                ``...``                 /+:+:--.......--:+`                                         
                                         `+:--..`````..--//`                                        
                                         .o:--..`` ``..--:o`                                        
                                         .+/--...```..--:+/`                                        
                                         `-o/:---...---:++.                                         
                                          `-+o+/:---:/+o/.                                          
                                            `.:+oooo+/-.`                                           
                                               ``````                                               
*/

#ifdef cheats
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <queue>
#include <ostream>
#include <istream>
#include <typeinfo>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <limits>
#include <fstream>
#include <array>
#include <list>
#include <bitset>
#include <functional>
#include <random>
#include <cstring>

#define mt make_tuple
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define umap unordered_map
#define uset unordered_set
#define elif else if
#define len(v) ((int)v.size())
#define f(i, n) for (int i = 0; i < (n); i++)
#define apply(v, act) for (auto &x : v) { act; }


using namespace std;

char string_in_buffer[(int)260];


void fast_scan(int &x) { scanf("%d", &x); }
void fast_scan(long long &x) { scanf("%lld", &x); }
void fast_scan(unsigned long long &x) { scanf("%llu", &x); }
void fast_scan(double &x) { scanf("%lf", &x); }
void fast_scan(long double &x) { scanf("%Lf", &x); }
void fast_scan(char &x) { 
	scanf("%c", &x); 
	if (x == '\n') {
		fast_scan(x);
	}
}
void fast_scan(string &x) {
	scanf("%s", string_in_buffer);
	x = string(string_in_buffer);
}

template<class TFirst, class TSecond>
void fast_scan(pair<TFirst, TSecond> &p) {
	fast_scan(p.first);
	fast_scan(p.second);
}

template <class T>
void fast_scan(vector<T> &v) {
	for (auto &x : v) fast_scan(x);
}

void fast_print(const int &x) { printf("%d", x); }
void fast_print(const long long &x) { printf("%lld", x); }
void fast_print(const unsigned long long &x) { printf("%llu", x); }
void fast_print(const double &x) { printf("%.15lf", x); }
void fast_print(const long double &x) { printf("%.15Lf", x); }
void fast_print(const char &x) { printf("%c", x); };
void fast_print(const string &x) { printf("%s", x.c_str());}

template<class TFirst, class TSecond>
void fast_print(const pair<TFirst, TSecond> &p) {
	fast_print(p.first);
	fast_print(' ');
	fast_print(p.second);
}

template <class T>
void fast_print(const vector<T> &v) {
	if (v.empty()) return;
	fast_print(v[0]);
	for (int i = 1; i < v.size(); i++) {
		fast_print(" ");
		fast_print(v[i]);
	}
}

template <class T>
void fast_print(const vector<vector<T>> &v) {
	if (v.empty()) return;
	fast_print(v[0]);
	for (int i = 1; i < v.size(); i++) {
		fast_print("\n");
		fast_print(v[i]);
	}
}



using namespace std;


namespace smart_io {
	string print_start = "";
	string sep = " ";
	bool first_print = false;

	void precall_print() {
		fast_print(print_start);
		print_start = "\n";
		first_print = true;
	}
} //namespace smart_io


template <class T>
ostream &operator,(ostream &os, const T &object) {
	if (!smart_io::first_print) {
		fast_print(smart_io::sep);
	} else {
		smart_io::first_print = false;
	}
	fast_print(object);
	return os;
}

template <class T>
istream &operator,(istream &is, T &object) {
	fast_scan(object);
	return is;
}

#define int long long

namespace typedefs {
	typedef long long ll;
	typedef unsigned long long ull;
	typedef pair<int, int> pii;
	typedef long double ld;
}

namespace numbers_operation {
	template<class T>
	T floor_mod(T a, T b) {
		if (a % b == 0) return 0;
		if (a >= 0 && b >= 0) return a % b;
		if (a <= 0 && b <= 0) return a % b;
		return abs(b) - (abs(a) % abs(b));
	}
}

using namespace numbers_operation;
using namespace typedefs;

#define print    \
smart_io::precall_print(); \
cout,

#define scan cin,

vector<vector<int>> g;

struct SUS {
	vector<int> up;
	vector<set<pii>> pep;
	set<pii> best;
	set<pii> ebal;
	vector<bool> can;

	SUS(int n, vector<int> cost) {
		up.resize(n);
		pep.resize(n);
		can.resize(n, true);

		f(i, n) {
			up[i] = i;
			pep[i].emplace(cost[i], i);
			best.emplace(cost[i], i);
			ebal.emplace(1, i);
		}
	}

	int get_root(int v) {
		if (up[v] == v) return v;
		return up[v] = get_root(up[v]);
	}

	void merge(int a, int b, bool del) {
		int _a = a;
		int _b = b;
		a = get_root(a);
		b = get_root(b);
		assert(a != b);
		if (del) {
			can[_a] = can[_b] = false;
		}
		if (len(pep[a]) < len(pep[b])) {
			swap(a, b);	
		}
		up[b] = a;
		best.erase(*pep[a].begin());
		for (pii p : pep[b]) {
			pep[a].insert(p);
		}	
		best.erase(*pep[b].begin());
		while (!pep[a].empty()) {
			if (!can[pep[a].begin()->second]) {
				pep[a].erase(pep[a].begin());
			} else {
				break;
			}
		}
		if (!pep[a].empty()) {
			best.emplace(*pep[a].begin());
		}
	}

	vector<int> cut() {
		vector<int> rogs;	
		set<int> roots;
		for (int i = 0; i < len(up); i++) {
			roots.insert(get_root(i));	
		}
		for (int root : roots) {
			if (len(pep[root]) == 1) {
				best.erase(*pep[root].begin());
				rogs.pb(pep[root].begin()->second);	
			}
		}
		return rogs;
	}

	void extract() {
		assert(!best.empty());
		auto it = best.begin();
		int root = get_root(it->second);
		best.clear();
		for (pii p : pep[root]) {
			if (can[p.second]) {
				best.emplace(p);
			}
		}
	}
};

signed main(signed argc, char *argv[]) {
	int n, m;
	scan n, m;
	vector<int> cost(n);
	scan cost;
	SUS sus(n, cost);

	f(i, m) {
		int a, b;
		scan a, b;
		sus.merge(a, b, false);	
	}
	
	vector<int> rogs = sus.cut();
	if (len(rogs) == n) {
		if (n > 2) {
			print "Impossible";
			return 0;
		}
		if (n == 1) {
			print 0;
		} else {
			print cost[0] + cost[1];
		}	
		return 0;
	}
	m += len(rogs);
	ll rez = 0;
	while (m++ < n - 1) {
		// print "Oh so huge";
		assert(len(sus.best) >= 2);
		auto it = sus.best.begin();		
		pii f = *it;
		it++;
		pii s = *it;

		rez += f.first + s.first;
		sus.merge(f.second, s.second, true);
	}
	sus.extract();
	for (int x : rogs) {
		rez += cost[x];
		if (sus.best.empty()) {
			// print "You love dicks";
			print "Impossible";
			return 0;
		}
		// print sus.best.begin()->first;
		rez += sus.best.begin()->first;
		sus.best.erase(*sus.best.begin());
	}	
	print rez;
}

Compiler output:
a.cc:474:6: error: redefinition of 'char string_in_buffer [260]'
  474 | char string_in_buffer[(int)260];
      |      ^~~~~~~~~~~~~~~~
a.cc:105:6: note: 'char string_in_buffer [260]' previously declared here
  105 | char string_in_buffer[(int)260];
      |      ^~~~~~~~~~~~~~~~
a.cc:477:6: error: redefinition of 'void fast_scan(long long int&)'
  477 | void fast_scan(int &x) { scanf("%d", &x); }
      |      ^~~~~~~~~
a.cc:109:6: note: 'void fast_scan(long long int&)' previously defined here
  109 | void fast_scan(long long &x) { scanf("%lld", &x); }
      |      ^~~~~~~~~
a.cc:478:6: error: redefinition of 'void fast_scan(long long int&)'
  478 | void fast_scan(long long &x) { scanf("%lld", &x); }
      |      ^~~~~~~~~
a.cc:109:6: note: 'void fast_scan(long long int&)' previously defined here
  109 | void fast_scan(long long &x) { scanf("%lld", &x); }
      |      ^~~~~~~~~
a.cc:479:6: error: redefinition of 'void fast_scan(long long unsigned int&)'
  479 | void fast_scan(unsigned long long &x) { scanf("%llu", &x); }
      |      ^~~~~~~~~
a.cc:110:6: note: 'void fast_scan(long long unsigned int&)' previously defined here
  110 | void fast_scan(unsigned long long &x) { scanf("%llu", &x); }
      |      ^~~~~~~~~
a.cc:480:6: error: redefinition of 'void fast_scan(double&)'
  480 | void fast_scan(double &x) { scanf("%lf", &x); }
      |      ^~~~~~~~~
a.cc:111:6: note: 'void fast_scan(double&)' previously defined here
  111 | void fast_scan(double &x) { scanf("%lf", &x); }
      |      ^~~~~~~~~
a.cc:481:6: error: redefinition of 'void fast_scan(long double&)'
  481 | void fast_scan(long double &x) { scanf("%Lf", &x); }
      |      ^~~~~~~~~
a.cc:112:6: note: 'void fast_scan(long double&)' previously defined here
  112 | void fast_scan(long double &x) { scanf("%Lf", &x); }
      |      ^~~~~~~~~
a.cc:482:6: error: redefinition of 'void fast_scan(char&)'
  482 | void fast_scan(char &x) {
      |      ^~~~~~~~~
a.cc:113:6: note: 'void fast_scan(char&)' previously defined here
  113 | void fast_scan(char &x) {
      |      ^~~~~~~~~
a.cc:488:6: error: redefinition of 'void fast_scan(std::string&)'
  488 | void fast_scan(string &x) {
      |      ^~~~~~~~~
a.cc:119:6: note: 'void fast_scan(std::string&)' previously defined here
  119 | void fast_scan(string &x) {
      |      ^~~~~~~~~
a.cc:494:6: error: redefinition of 'template<class TFirst, class TSecond> void fast_scan(std::pair<_T1, _T2>&)'
  494 | void fast_scan(pair<TFirst, TSecond> &p) {
      |      ^~~~~~~~~
a.cc:125:6: note: 'template<class TFirst, class TSecond> void fast_scan(std::pair<_T1, _T2>&)' previously declared here
  125 | void fast_scan(pair<TFirst, TSecond> &p) {
      |      ^~~~~~~~~
a.cc:500:6: error: redefinition of 'template<class T> void fast_scan(std::vector<_Tp>&)'
  500 | void fast_scan(vector<T> &v) {
      |      ^~~~~~~~~
a.cc:131:6: note: 'template<class T> void fast_scan(std::vector<_Tp>&)' previously declared here
  131 | void fast_scan(vector<T> &v) {
      |      ^~~~~~~~~
a.cc:504:6: error: redefinition of 'void fast_print(const long long int&)'
  504 | void fast_print(const int &x) { printf("%d", x); }
      |      ^~~~~~~~~~
a.cc:136:6: note: 'void fast_print(const long long int&)' previously defined here
  136 | void fast_print(const long long &x) { printf("%lld", x); }
      |      ^~~~~~~~~~
a.cc:505:6: error: redefinition of 'void fast_print(const long long int&)'
  505 | void fast_print(const long long &x) { printf("%lld", x); }
      |      ^~~~~~~~~~
a.cc:136:6: note: 'void fast_print(const long long int&)' previously defined here
  136 | void fast_print(const long long &x) { printf("%lld", x); }
      |      ^~~~~~~~~~
a.cc:506:6: error: redefinition of 'void fast_print(const long long unsigned int&)'
  506 | void fast_print(const unsigned long long &x) { printf("%llu", x); }
      |      ^~~~~~~~~~
a.cc:137:6: note: 'void fast_print(const long long unsigned int&)' previously defined here
  137 | void fast_print(const unsigned long long &x) { printf("%llu", x); }
      |      ^~~~~~~~~~
a.cc:507:6: error: redefinition of 'void fast_print(const double&)'
  507 | void fast_print(const double &x) { printf("%.15lf", x); }
      |      ^~~~~~~~~~
a.cc:138:6: note: 'void fast_print(const double&)' previously defined here
  138 | void fast_print(const double &x) { printf("%.15lf", x); }
      |      ^~~~~~~~~~
a.cc:508:6: error: redefinition of 'void fast_print(const long double&)'
  508 | void fast_print(const long double &x) { printf("%.15Lf", x); }
      |      ^~~~~~~~~~
a.cc:139:6: note: 'void fast_print(const long double&)' previously defined here
  139 | void fast_print(const long double &x) { printf("%.15Lf", x); }
      |      ^~~~~~~~~~
a.cc:509:6: error: redefinition of 'void fast_print(const char&)'
  509 | void fast_print(const char &x) { printf("%c", x); };
      |      ^~~~~~~~~~
a.cc:140:6: note: 'void fast_print(const char&)' previously defined here
  140 | void fast_print(const char &x) { printf("%c", x); };
      |      ^~~~~~~~~~
a.cc:510:6: error: redefinition of 'void fast_print(const std::string&)'
  510 | void fast_print(const string &x) { printf("%s", x.c_str());}
      |      ^~~~~~~~~~
a.cc:141:6: note: 'void fast_print(const std::string&)' previously defined here
  141 | void fast_print(const string &x) { printf("%s", x.c_str());}
      |      ^~~~~~~~~~
a.cc:513:6: error: redefinition of 'template<class TFirst, class TSecond> void fast_print(const std::pair<_T1, _T2>&)'
  513 | void fast_print(const pair<TFirst, TSecond> &p) {
      |      ^~~~~~~~~~
a.cc:144:6: note: 'template<class TFirst, class TSecond> void fast_print(const std::pair<_T1, _T2>&)' previously declared here
  144 | void fast_print(const pair<TFirst, TSecond> &p) {
      |      ^~~~~~~~~~
a.cc:520:6: error: redefinition of 'template<class T> void fast_print(const std::vector<_Tp>&)'
  520 | void fast_print(const vector<T> &v) {
      |      ^~~~~~~~~~
a.cc:151:6: note: 'template<class T> void fast_print(const std::vector<_Tp>&)' previously declared here
  151 | void fast_print(const vector<T> &v) {
      |      ^~~~~~~~~~
a.cc:530:6: error: redefinition of 'template<class T> void fast_print(const std::vector<std::vector<_Tp> >&)'
  530 | void fast_print(const vector<vector<T>> &v) {
      |      ^~~~~~~~~~
a.cc:161:6: note: 'template<class T> void fast_print(const std::vector<std::vector<_Tp> >&)' previously declared here
  161 | void fast_print(const vector<vector<T>> &v) {
      |      ^~~~~~~~~~
a.cc:545:16: error: redefinition of 'std::string smart_io::print_start'
  545 |         string print_start = "";
      |                ^~~~~~~~~~~
a.cc:176:16: note: 'std::string smart_io::print_start' previously declared here
  176 |         string print_start = "";
      |                ^~~~~~~~~~~
a.cc:546:16: error: redefinition of 'std::string smart_io::sep'
  546 |         string sep = " ";
      |                ^~~
a.cc:177:16: note: 'std::string smart_io::sep' previously declared here
  177 |         string sep = " ";
      |                ^~~
a.cc:547:14: error: redefinition of 'bool smart_io::first_print'
  547 |         bool first_print = false;
      |              ^~~~~~~~~~~
a.cc:178:14: note: 'bool smart_io::first_print' previously defined here
  178 |         bool first_print = false;
      |              ^~~~~~~~~~~
a.cc:549:14: error: redefinition of 'void smart_io::precall_print()'
  549 |         void precall_print() {
      |              ^~~~~~~~~~~~~
a.cc:180:14: note: 'void smart_io::precall_print()' previously defined here
  180 |         void precall_print() {
      |              ^~~~~~~~~~~~~
a.cc:558:10: error: redefinition of 'template<class T> std::ostream& operator,(std::ostream&, const T&)'
  558 | ostream &operator,(ostream &os, const T &object) {
      |          ^~~~~~~~
a.cc:189:10: note: 'template<class T> std::ostream& operator,(std::ostream&, const T&)' previously declared here
  189 | ostream &operator,(ostream &os, const T &object) {
      |          ^~~~~~~~
a.cc:569:10: error: redefinition of 'template<class T> std::istream& operator,(std::istream&, T&)'
  569 | istream &operator,(istream &is, T &object) {
      |          ^~~~~~~~
a.cc:200:10: note: 'template<class T> std::istream& operator,(std::istream&, T&)' previously declared here
  200 | istream &operator,(istream &is, T &object) {
      |          ^~~~~~~~
a.cc:585:11: error: redefinition of 'template<class T> T numbers_operation::floor_mod(T, T)'
  585 |         T floor_mod(T a, T b) {
      |           ^~~~~~~~~
a.cc:216:11: note: 'template<class T> T numbers_operation::floor_mod(T, T)' previously declared here
  216 |         T floor_mod(T a, T b) {
      |           ^~~~~~~~~
a.cc:602:21: error: redefinition of 'std::vector<std::vector<long long int> > g'
  602 | vector<vector<int>> g;
      |                     ^
a.cc:233:21: note: 'std::vector<std::vector<long long int> > g' previously declared here
  233 | vector<vector<int>> g;
      |                     ^
a.cc:604:8: error: redefinition of 'struct SUS'
  604 | struct SUS {
      |        ^~~
a.cc:235:8: note: previous definition of 'struct SUS'
  235 | struct SUS {
      |        ^~~
a.cc:687:8: error: redefinition of 'int main(int, char**)'
  687 | signed main(signed argc, char *argv[]) {
      |        ^~~~
a.cc:318:8: note: 'int main(int, char**)' previously defined here
  318 | signed main(signed argc, char *argv[]) {
      |        ^~~~