/* C++ Version */
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include <set>
using namespace std;
typedef pair<int, int> Point2D;
class IsSame {
public:
bool operator()(const Point2D &left, const Point2D &right) {
return ((left.first < right.first) || ( (left.first == right.first) && (left.second < right.second)));
}
};
void process();
int main() {
process();
return 0;
}
void process() {
fstream target_fp;
set<Point2D, IsSame> set_points;
target_fp.open("input2.txt",ios::out);
srand(time(NULL));
int count = 10000; //rand()%10 + 1;
int x = 0, y = 0;
Point2D tempPoint;
target_fp << count << endl;
while ( set_points.size() < count) {
x = rand()%10000;
y = rand()%10000;
tempPoint.first = x;
tempPoint.second = y;
set_points.insert(tempPoint);
}
set<Point2D, IsSame>::iterator it;
for ( it = set_points.begin(); it != set_points.end(); it++ ) {
if ( it != set_points.begin() ) {
target_fp << endl;
}
target_fp << it->first << " " << it->second;
}
target_fp.close();
}