stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <queue>

#include <vector>

#include <algorithm>

#include <utility>



#define INF 1000000000



using namespace std;



typedef long long int lli;

typedef pair<int, int> P;



struct edge{

	int to, cost;

};



int V, E;

vector<edge> e[10000];

priority_queue< P, vector<P>, greater<P> > que;

bool used[10000];





int main(void){

	cin >> V >> E;



	for(int i = 0;i < V;i++){

		used[i] = false;

	}



	for(int i = 0;i < E;i++){

		int a, b, c;

		cin >> a >> b >> c;

		edge d;

		d.to = b;

		d.cost = c;

		e[a].push_back(d);

		d.to = a;

		e[b].push_back(d);

	}





	que.push(P(0, 0));

	long long int res = 0;



	while(!que.empty()){



		P a = que.top();

		que.pop();

		if(used[a.second]) continue;

		used[a.second] = true;

		res += a.first;



		for(int u = 0;u < e[a.second].size();u++){

			if(!used[e[a.second][u].to])

				que.push(P(e[a.second][u].cost, e[a.second][u].to));

		}

	}

	cout << res << endl;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <iomanip>

#include <string>

#include <vector>

#include <queue>

#include <algorithm>

#include <utility>

#include <cmath>



#define INF_LL 9000000000000000000

#define INF 2000000000



#define REP(i, n) for(int i = 0;i < (n);i++)

#define FOR(i, a, b) for(int i = (a);i < (b);i++)



using namespace std;



typedef long long ll;

typedef pair<int, int> PII;



class Union_find{

private:

	vector<int> par;

	vector<int> rank;

	int n;



public:

	Union_find(int a){

		n = a;

		for(int i = 0;i < n;i++){

			par.push_back(i);

			rank.push_back(0);

		}

	}



	int find(int x){

		if(par[x] == x){

			return x;

		}else{

			return par[x] = find(par[x]);

		}

	}



	void unite(int x, int y){

		x = find(x);

		y = find(y);

		if(x == y) return;



		if(rank[x] < rank[y]){

			par[x] = y;

		}else{

			par[y] = x;

			if(rank[x] == rank[y]) rank[x]++;

		}

	}



	bool same(int x, int y){

		return find(x) == find(y);

	}

};



struct edge{ int u, v, cost; };



edge es[100000];

int V, E;



bool comp(const edge& e1, const edge& e2){

	return e1.cost < e2.cost;

}



int main(void){

	cin >> V >> E;

	for(int i = 0;i < E;i++){

		int a, b, c;

		cin >> a >> b >> c;

		es[i].u = a;

		es[i].v = b;

		es[i].cost = c;

	}

	Union_find uf(V);

	sort(es, es+E, comp);

	int res = 0;

	for(int i = 0;i < E;i++){

		edge e = es[i];

		if(!uf.same(e.u, e.v)){

			uf.unite(e.u, e.v);

			res += e.cost;

		}

	}

	cout << res << endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define INF 1000000000

#define MAX_V 10000

#define MAX_E 100000

using namespace std;

typedef pair<int, int> P;

struct edge {

	int to, cost;

	edge(int to_, int cost_) : to(to_), cost(cost_) {}

};



int V, E;

vector<edge> G[MAX_V];



int Prim() {

	int res = 0;

	bool used[MAX_V];

	priority_queue<P, vector<P>, greater<P>> que;

	for (int i = 0; i < V; i++) {

		used[i] = false;

	}

	que.push(P(0, 0));

	while (!que.empty()) {

		P p = que.top(); que.pop();

		int v = p.second;

		if (used[v]) continue;

		used[v] = true;

		res += p.first;

		for (int i = 0; i < G[v].size(); i++) {

			edge e = G[v][i];

			que.push(P(e.cost, e.to));

		}

	}

	return res;

}



int main()

{

	cin >> V >> E;

	for (int i = 0, s, t, c; i < E; i++) {

		cin >> s >> t >> c;

		G[s].push_back(edge(t, c));

		G[t].push_back(edge(s, c));

	}

	cout << Prim() << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define INF 1000000000

#define MAX_V 10000

#define MAX_E 100000

using namespace std;

typedef pair<int, int> P;

struct edge { int u, v, cost; };



bool comp(const edge& e1, const edge& e2){

	return e1.cost < e2.cost;

}



int V, E;

edge es[MAX_E];



class UnionFind {

	vector<int> data;

	int root(int a) {

		return data[a] < 0 ? a : data[a] = root(data[a]);

	}

public:

	UnionFind(int n) : data(n, -1) {}

	bool Find(int a, int b) {

		return root(a) == root(b);

	}

	void Union(int a, int b) {

		int ra = root(a), rb = root(b);

		if (ra == rb) return;

		if (data[ra] < data[rb]) {

			data[ra] += data[rb];

			data[rb] = a;

		}

		else {

			data[rb] += data[ra];

			data[ra] = b;

		}

	}

};



int Kruskal() {

	int res = 0;

	UnionFind uf(V);

	sort(es, es + E, comp);

	for (int i = 0; i < E; i++) {

		edge e = es[i];

		if (!uf.Find(e.u, e.v)) {

			uf.Union(e.u, e.v);

			res += e.cost;

		}

	}

	return res;

}



int main()

{

	cin >> V >> E;

	for (int i = 0; i < E; i++) {

		cin >> es[i].u >> es[i].v >> es[i].cost;

	}

	cout << Kruskal() << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

using namespace std;



#define MAX_V 10000

#define INF 1e9

typedef pair<int, int> pii;



struct edge{

    int to, cost;

};



int V;

bool used[MAX_V];

vector<edge> G[MAX_V];



/*

  O(E log V)

  ?????°??±?????????????????´???vector?????????????????¨???

*/

int prim()

{

    priority_queue<pii, vector<pii>, greater<pii> > Q;

    Q.push(pii(0, 0));

    memset(used, false, sizeof(used));

    int res = 0;

  

    while (!Q.empty()) {

	pii p = Q.top(); Q.pop();

	int v = p.second;

	if (used[v]) continue;

	used[v] = true;

	res += p.first;

	for (int i = 0; i < (int)G[v].size(); i++) {

	    edge e = G[v][i];

	    Q.push(pii(e.cost, e.to));

	}

    }

    return res;

}



int main()

{

    int E,s,t,w;

    cin >> V >> E;

    for (int i = 0; i < E; i++) {

	cin >> s >> t >> w;

	G[s].push_back((edge){t, w});

	G[t].push_back((edge){s, w});

    }

    cout << prim() << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



#define MAX 100000

#define MAX_E 100000



int par[MAX], rank_[MAX];



void init(int N)

{

    for (int i = 0; i < N; i++) {

	par[i] = i;

	rank_[i] = 0;

    }

}



int find(int x)

{

    if (par[x] == x) {

	return x;

    }

    return par[x] = find(par[x]);

}



void unite(int x, int y)

{

    x = find(x);

    y = find(y);



    if (x == y) return;



    if (rank_[x] < rank_[y]) {

	par[x] = y;

    } else {

	par[y] = x;

	if (rank_[x] == rank_[y]) {

	    rank_[x]++;

	}

    }

}



bool same(int x,int y)

{

    return (find(x) == find(y));

}



struct edge{ int u, v, cost; };



bool comp(const edge &e1, const edge &e2)

{

    return e1.cost < e2.cost;

}



int V,E;

edge es[MAX_E];



int kruskal()

{

    sort(es, es+E, comp);

    init(V); // init union_find

    int res = 0;

    for (int i = 0; i < E; i++) {

	edge e = es[i];

	if (!same(e.u, e.v)) {

	    unite(e.u, e.v);

	    res += e.cost;

	}

    }

    return res;

}



int main()

{

    int s,t,w;

    cin >> V >> E;

    for (int i = 0; i < E; i++) {

	cin >> s >> t >> w;

        es[i]=(edge){s, t, w};

    }

    cout << kruskal() << endl;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define MAX_V 11111

typedef pair<int,int> P;

vector<P> G[MAX_V];

bool used[MAX_V];

int prim(){

  int res=0;

  priority_queue<P,vector<P>,greater<P> > q;

  q.push(P(0,0));

  memset(used,0,sizeof(used));

  while(!q.empty()){

    P p=q.top();q.pop();

    int v=p.second,d=p.first;

    if(used[v]) continue;

    used[v]=1;

    res+=d;

    for(int i=0;i<(int)G[v].size();i++){

      q.push(G[v][i]);

    }

  }

  return res;

}

int main(){

  int V,E;

  cin>>V>>E;

  for(int i=0;i<E;i++){

    int s,t,u;

    cin>>s>>t>>u;

    G[s].push_back(P(u,t));

    G[t].push_back(P(u,s));

  }

  cout<<prim()<<endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

using Int = long long;

//BEGIN CUT HERE

template<typename T>

struct Kruskal{

  

  struct edge{

    int from,to;

    T cost;

    int used;

    edge(){}

    edge(int from,int to,T cost):

      from(from),to(to),cost(cost),used(0){}

    bool operator<(const edge& e) const{

      return cost<e.cost;

    }

  };



  int n;

  vector<int> p,r;

  vector<edge> edges;



  Kruskal(){}

  Kruskal(int n):n(n){}



  void init(int n){

    r.assign(n,1);

    p.resize(n);

    iota(p.begin(),p.end(),0);

  }

  

  int find(int x){

    return (x==p[x]?x:p[x]=find(p[x]));

  }



  bool same(int x,int y){

    return find(x)==find(y);

  }



  void unite(int x,int y){

    x=find(x);y=find(y);

    if(x==y) return;

    if(r[x]<r[y]) swap(x,y);

    r[x]+=r[y];

    p[y]=x;

  }



  void add_edge(int u,int v,T c){

    edges.emplace_back(u,v,c);

  }

  

  T build(){

    sort(edges.begin(),edges.end());

    init(n);

    T res=0;

    for(auto &e:edges){

      if(!same(e.from,e.to)){

        res+=e.cost;

        unite(e.from,e.to);

        e.used=1;

      }

    }

    return res;

  }

};

//END CUT HERE

int main(){

  int V,E;

  scanf("%d %d",&V,&E);

  Kruskal<int> ksk(V);

  for(int i=0;i<E;i++){

    int a,b,c;

    scanf("%d %d %d",&a,&b,&c);

    ksk.add_edge(a,b,c);

  }

  cout<<ksk.build()<<endl;

  return 0;

}



/*

  verified on 2018/10/22

  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A&lang=jp

*/




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <vector>

#include <queue>

using namespace std;

typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)

#define repe(i,s,n)for(ll i=s;i<=n;i++)



static const ll MOD = 1e9 + 7;

static const ll INF = (ll)1 << 62;



static const ll MAX_N = 100001;

static const ll MAX_M = 200001;



ll V;

ll d[MAX_N] = {};

struct edge { ll to, cost; };

typedef pair<ll, ll> P;

vector<edge> G[MAX_N];

priority_queue <P, vector<P>, greater<P>> que;

bool mst[MAX_N];



ll cost = 0;



bool complete() {

	ll cnt = 0;

	rep(i, 0, V) {

		if (mst[i])cnt++;

	}

	return (cnt == V);

}



void prim(ll s) {

	fill(d, d + V, INF);

	d[s] = 0;

	que.push(P(0, s));



	while (!que.empty()) {

		P p = que.top(); que.pop();

		ll v = p.second;

		if (mst[v])continue;



		cost += p.first;

		mst[v] = true;



		rep(i, 0, G[v].size()) {

			edge e = G[v][i];

			if (!mst[e.to]) {

				que.push(P(e.cost, e.to));

			}

		}



		if (complete())break;

	}

}



int main() {

	//freopen("C://testcase//in7.txt", "r", stdin);



	ll E; cin >> V >> E;

	rep(i, 0, E) {

		ll s, t, d; cin >> s >> t >> d;

		G[s].push_back(edge{ t,d });

		G[t].push_back(edge{ s,d });

	}



	prim(0);



	cout << cost << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <algorithm>

#include <vector>

#include <set>

#include <map>

#include <queue>

using namespace std;

#define rep(i,s,n)for(int i = s;i<n;i++)

#define repe(i,s,n)for(int i = s;i<=n;i++)

typedef long long ll;

static const ll MOD = 1e9 + 7;

static const ll INF = (ll)1 << 62;



//////////////////////////////////////////////////////

//Union Find /////////////////////////////////////////

//////////////////////////////////////////////////////

static const ll MAX_M = 100001;

static const ll MAX_N = 100001;

int par[MAX_N];

int rak[MAX_N];



void init(int n) {

	rep(i, 0, n) {

		par[i] = i;

		rak[i] = 0;

	}

}



int find(int x) {

	if (par[x] == x)return x;

	else return par[x] = find(par[x]);

}



void unite(int x, int y) {

	x = find(x);

	y = find(y);

	if (x == y)return;



	if (rak[x] < rak[y]) par[x] = y;

	else {

		par[x] = y;

		if (rak[x] == rak[y]) rak[x]++;

	}

}



bool same(int x, int y) {

	return find(x) == find(y);

}



struct edge { int u, v, cost; };

bool comp(const edge& e1, const edge& e2) {

	return e1.cost < e2.cost;

}



int V, E;

edge es[MAX_M];



int krascal() {

	sort(es, es + E, comp);

	init(V);

	int res = 0;



	rep(i, 0, E) {

		edge e = es[i];

		if (!same(e.u, e.v)) {

			unite(e.u, e.v);

			res += e.cost;

		}

	}

	return res;

}



int main() {

	ll n, m; cin >> n >> m;

	V = n, E = m;

	rep(i, 0, m) {

		ll s, t, w; cin >> s >> t >> w;

		edge *e = new edge();

		e->u = s;

		e->v = t;

		e->cost = w;

		es[i] = *e;

	}



	cout << krascal() << endl;



	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main() {

	int x, y;

	cin >> x >> y;

	if (x < y)

	{

		cout << 0;

		return 0;

	}

	cout << 10;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int x,a;

	while(~scanf("%d%d",&x,&a))

	{

		if(x<a)

		printf("0\n");

		else

		printf("10\n");

	}

	return 0;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<string>

using namespace std;

int main()

{

	int x, a;

	cin >> x >> a;

	if (x < a)

		cout << 0 << endl;

	else cout << 10 << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int x,a;

	while(~scanf("%d%d",&x,&a))

	{

		if(x<a)

		printf("0\n");

		else

		printf("10\n");

	}

	return 0;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    int x,n;



    cin>>x>>n;



    if(x<n){

        cout<<0;

    }else{

        cout<<10;

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

int X,A;

scanf("%d",&X);



scanf("%d",&A);

if(X<A){

        printf("0");



}

else printf("10");

















}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main()

{

  int x,a;

  cin>>x>>a;



  if(x>a || x==a)

    cout<<10;

  else

    cout<<0;

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int x,a;

	scanf("%d%d",&x,&a);

	if(x<a)   {   printf("0");  }

	else     {   printf("10");   }

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

#include<set>

#include<string>

typedef long long int lli;

using namespace std;

int main(){

    ios::sync_with_stdio(false);

    cin.tie(NULL);

    vector<string> v;

    vector<string> v1;

    

   int a;

   int x;

   cin>>x>>a;

  

   if(x<a){

       printf("0\n");

   }else{

       printf("10\n");

       

   }

    return 0;

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int x,a;

	scanf("%d%d",&x,&a);

	if(x<a)   {   printf("0");  }

	else     {   printf("10");   }

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>



using namespace std;



typedef vector<int> vi;

typedef vector<vi> vvi;



const int INFTY=1<<29;



int main()

{

	for(int h,w;cin>>h>>w,h|w;){

		int n=h*w;

		vvi dist(n,vi(n,INFTY));

		vi hearts;

		for(int i=0;i<h;i++){

			for(int j=0;j<w;j++){

				int x; cin>>x;

				if(x==1)

					hearts.push_back(i*w+j);

				

				dist[i*w+j][i*w+j]=0;

				int di[]={-1,1,0,0},dj[]={0,0,-1,1};

				for(int k=0;k<4;k++){

					int ii=i+di[k],jj=j+dj[k];

					if(0<=ii && ii<h && 0<=jj && jj<w)

						dist[i*w+j][ii*w+jj]=dist[ii*w+jj][i*w+j]=1;

				}

			}

		}

		

		for(int k=0;k<n;k++)

			for(int i=0;i<n;i++)

				for(int j=0;j<n;j++)

					dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);

		

		int hsize=hearts.size();

		vvi dp(1<<hsize,vi(n,INFTY));

		for(int i=0;i<hsize;i++)

			for(int j=0;j<n;j++)

				dp[1<<i][j]=dist[hearts[i]][j];

		

		for(int i=0;i<(1<<hsize);i++){

			for(int j=i;j;j=(j-1)&i)

				for(int k=0;k<n;k++)

					dp[i][k]=min(dp[i][k],dp[j][k]+dp[i^j][k]);

			for(int j=0;j<n;j++)

				for(int k=0;k<n;k++)

					dp[i][j]=min(dp[i][j],dp[i][k]+dist[k][j]);

		}

		

		int res=INFTY;

		for(int i=0;i<n;i++)

			res=min(res,dp[(1<<hsize)-1][i]);

		cout<<n-(res+1)<<endl;

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#define rep(i,n) for(int i=0;i<int(n);i++)

using namespace std;int dist[144][144],hearts[6],dp[1<<6][144];int di[]={-1,1,0,0},dj[]={0,0,-1,1};int main(){for(int h,w;scanf("%d%d",&h,&w),h|w;){int n=h*w;rep(i,n) rep(j,n) dist[i][j]=1<<29;int hsize=0;rep(i,h) rep(j,w){int x; scanf("%d",&x);if(x==1)hearts[hsize++]=i*w+j;int p=i*w+j;dist[p][p]=0;rep(k,4){int ii=i+di[k],jj=j+dj[k],pp=ii*w+jj;if(0<=ii && ii<h && 0<=jj && jj<w)dist[p][pp]=dist[pp][p]=1;}}rep(k,n) rep(i,n) rep(j,n)dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);rep(i,1<<hsize) rep(j,n)dp[i][j]=1<<29;rep(i,hsize) rep(j,n)dp[1<<i][j]=dist[hearts[i]][j];rep(i,1<<hsize){for(int j=i;j;j=(j-1)&i) rep(k,n)dp[i][k]=min(dp[i][k],dp[j][k]+dp[i^j][k]);rep(j,n) rep(k,n)dp[i][j]=min(dp[i][j],dp[i][k]+dist[k][j]);}int* dpb=dp[(1<<hsize)-1];printf("%d\n",n-(*min_element(dpb,dpb+n)+1));}return 0;}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

 

int main() {

  int m;

  cin >> m;

  cout << 48 - m << endl;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

int m;

int main() {

  scanf("%d",&m);

  printf("%d\n",48-m);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<vector>

#include<cmath>

#include<queue>

#include<stack>

#include<set>

#include<algorithm>

#include<utility>

#include<map>

using namespace std;

typedef long long ll;

const int mod = 1000000007;

const int INF = 1001001001;



ll pow_mod(ll p, ll n, ll m) {

	if (n == 0) return 1;

	else if (n == 1) return p % m;

	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;

	else {

		ll tmp = pow_mod(p, n / 2, m);

		return (tmp * tmp) % m;

	}

}



ll gcd(ll x, ll y) {

	if (y == 0) {

		return x;

	}

	return gcd(y, x % y);

}



ll com_mod(ll n, ll k, ll m) {

	if (k == 0) return 1;

	else {

		ll x = 1;

		ll y = 1;

		for (ll i = 0; i < k; i++) {

			x = (x * (n - i)) % m;

			y = (y * (i + 1)) % m;

		}

		ll res = (x * pow_mod(y, m - 2, m)) % m;

		return res;

	}

}



int main() {

	int m; cin >> m;

	cout << 48 - m << endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main() {

	int m; scanf("%d", &m);

	printf("%d", 48 - m);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int maxn = 100 * 1000 + 20;

int n, m, dis[maxn];

vector <int> adj[maxn], adjexit[maxn];

bool vis[maxn];



void input() {

    cin >> n >> m;

    for (int i = 0, a, b; i < m; i++) {

        cin >> a >> b;

        adj[a].push_back(b);

        adj[b].push_back(a);

    }

}



void dfs(int v) {

    vis[v] = 1;

    for (int u : adj[v]) {

        if (!vis[u]) {

            dis[u] = dis[v] + 1;

            dfs(u);

            adjexit[u].size() % 2? adjexit[u].push_back(v): adjexit[v].push_back(u);

        }

        else if (dis[v] < dis[u])

            adjexit[v].push_back(u);

    }

}

void output() {

    for (int i = 1; i <= n; i++)

        for (int j : adjexit[i])

            cout << i << ' ' << j << endl;

}

int main() {    

    ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

    input();

    if (m % 2)

        return cout << -1 << endl, 0;

    dfs(1);

    output();

    return 0;    

}




// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef unsigned long long ull;

struct E {

  int v;

  bool vis;

  E *next, *rev;

};



const int N = 100010;



int n, m;

bool vis[N], par[N];

E* g[N];



E* adde(int u, int v) {

  static E pool[N * 2], *p = pool;

  ++p;

  p->v = v;

  p->next = g[u];

  g[u] = p;

  return p;

}



void dfs(int u) {

  vis[u] = true;

  for (E* p = g[u]; p; p = p->next)

    if (!p->vis) {

      p->vis = p->rev->vis = true;

      if (!vis[p->v]) {

        dfs(p->v);

        if (par[p->v]) {

          printf("%d %d\n", p->v, u);

        } else {

          printf("%d %d\n", u, p->v);

          par[u] ^= 1;

        }

      } else {

        printf("%d %d\n", u, p->v);

        par[u] ^= 1;

      }

    }

}



int main() {

  scanf("%d%d", &n, &m);

  if (m % 2) {

    puts("-1");

    return 0;

  }

  while (m--) {

    int u, v;

    scanf("%d%d", &u, &v);

    E *p = adde(u, v), *q = adde(v, u);

    p->rev = q;

    q->rev = p;

  }

  dfs(1);

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1000 * 100 + 20;

vector <int> gr[maxn], ans[maxn];

int n, m, vis[maxn];

void dfs(int v, int u) {

	vis[v] = 1;

	for (int i: gr[v]) {

		if (!vis[i]) {

			dfs(i , v);

			if (ans[i].size() % 2)

				ans[i].push_back(v);

			else

				ans[v].push_back(i);

			

		}

		else if (i != u) {

			if (i > v)

				ans[v].push_back(i);

		}

	}

}

int main() {

	cin >> n >> m;

	for (int i = 0; i < m; i++) {

		int a, b;

		cin >> a >> b;

		gr[a].push_back(b);

		gr[b].push_back(a);

	}

	

	if (m % 2)

		cout << -1 << endl;

	else {

		dfs(1, 0);

	}

	for (int i = 1; i <= n; i++)

		for (int j: ans[i])

			cout << i << " " << j << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef unsigned long long ull;

struct E {

  int v;

  bool vis;

  E *next, *rev;

};



const int N = 100010;



int n, m;

bool vis[N], par[N];

E* g[N];



E* adde(int u, int v) {

  static E pool[N * 2], *p = pool;

  ++p;

  p->v = v;

  p->next = g[u];

  g[u] = p;

  return p;

}



void dfs(int u) {

  vis[u] = true;

  for (E* p = g[u]; p; p = p->next)

    if (!p->vis) {

      p->vis = p->rev->vis = true;

      if (!vis[p->v]) {

        dfs(p->v);

        if (par[p->v]) {

          printf("%d %d\n", p->v, u);

        } else {

          printf("%d %d\n", u, p->v);

          par[u] ^= 1;

        }

      } else {

        printf("%d %d\n", u, p->v);

        par[u] ^= 1;

      }

    }

}



int main() {

  scanf("%d%d", &n, &m);

  if (m % 2) {

    puts("-1");

    return 0;

  }

  while (m--) {

    int u, v;

    scanf("%d%d", &u, &v);

    E *p = adde(u, v), *q = adde(v, u);

    p->rev = q;

    q->rev = p;

  }

  dfs(1);

  return 0;

}

// Fastest known solution for this problem: