stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int solve() {

	int n;

	cin >> n;

	cout << (n + 999) / 1000 * 1000 - n << '\n';

	return 0;

}



int main() {

	cin.tie(0)->sync_with_stdio(0);

	

	int t = 1;

	// cin >> t;

	while (t--) solve();

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.329115062546559x):
#include <stdio.h>



int main(){

  int n;

  scanf("%d", &n);

  while (n > 0){

    n = n - 1000;

  }

  printf("%d\n", n* -1);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int solve() {

	int n;

	cin >> n;

	cout << (n + 999) / 1000 * 1000 - n << '\n';

	return 0;

}



int main() {

	cin.tie(0)->sync_with_stdio(0);

	

	int t = 1;

	// cin >> t;

	while (t--) solve();

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.333252160399891x):
#include<stdio.h>

int main(){

	int n;

	scanf("%d", &n);

	while (n > 0){

		n = n - 1000;

	}

	if (n < 0){

		printf ("%d\n", n * -1);

	}

	else if (n == 0){

		printf ("0\n");

	}



	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int solve() {

	int n;

	cin >> n;

	cout << (n + 999) / 1000 * 1000 - n << '\n';

	return 0;

}



int main() {

	cin.tie(0)->sync_with_stdio(0);

	

	int t = 1;

	// cin >> t;

	while (t--) solve();

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.340827336584022x):
#include <stdio.h>



int main(){

	int inputA, inputB;



	scanf("%d", &inputA);

	while(inputB<inputA){

		inputB+=1000;

	}

	printf("%d", inputB-inputA);

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int solve() {

	int n;

	cin >> n;

	cout << (n + 999) / 1000 * 1000 - n << '\n';

	return 0;

}



int main() {

	cin.tie(0)->sync_with_stdio(0);

	

	int t = 1;

	// cin >> t;

	while (t--) solve();

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.329115062546559x):
#include <stdio.h>



int main (){

	

	

	int n;

	scanf ("%d", &n);

	

	while (n > 0){

		n = n-1000; 

	}

	printf ("%d\n", n * -1);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int solve() {

	int n;

	cin >> n;

	cout << (n + 999) / 1000 * 1000 - n << '\n';

	return 0;

}



int main() {

	cin.tie(0)->sync_with_stdio(0);

	

	int t = 1;

	// cin >> t;

	while (t--) solve();

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.329115062546559x):
#include <stdio.h>

#include <math.h>

int main(){

int a;

scanf("%d",&a);



while(a>0){

	a=a-1000;

}

printf("%d\n",abs(a));

return 0;

}
// Slower C++ solution:
// In the name of God



#include <bits/stdc++.h>



using namespace std;



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	

	int n;

	cin >> n;



	cout << (1000 - (n % 1000)) % 1000;



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.3382386395404895x):
#include<stdio.h>

int main(){

int n=0, x;



	scanf("%d", &x);

	for(n=0;n<x;n+=1000){

	n;

	}

printf("%d", n-x);







return 0;

}
// Slower C++ solution:
// In the name of God



#include <bits/stdc++.h>



using namespace std;



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	

	int n;

	cin >> n;



	cout << (1000 - (n % 1000)) % 1000;



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.339670464554088x):
#include <stdio.h>

int main(){

	int n;

	scanf ("%d", &n);

	int uang;

	while(uang<n){

		uang=uang+1000;

	}	

	if(uang==n){

		puts("0");

	}

	else if(uang>=n){

		printf("%d", uang-n);

	}

	return 0;

}
// Slower C++ solution:
// In the name of God



#include <bits/stdc++.h>



using namespace std;



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	

	int n;

	cin >> n;



	cout << (1000 - (n % 1000)) % 1000;



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.326350793172873x):
#include <stdio.h>



int main (){

int n;

scanf ("%d", &n);



while (n>0) {

	n = n - 1000;

//	printf ("%d\n", n);

}

	printf ("%d\n", n * -1);

return 0;

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main()

{

    int n, change;

  

    cin >> n;



    cout << (1000 - n % 1000) % 1000 << endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.272353378623029x):
#include <stdio.h>



int main(void)

{

    int N, change;



    // printf("Start!\n");

    scanf("%d", &N);



    change = (10000 - N)%1000;



    printf("%d", change);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int  n,x=0,y;



    cin>>n;



    while(1000*x<n)



   {

       x++;

   }



   cout<<((1000*x)-n)<<endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.262981608139529x):
#include<stdio.h>

#include<string.h>



int main(){

	int n;

	scanf("%d",&n);

	int x = 0;

	while(x<n)

		x+=1000;

	printf("%d\n",x-n);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int  n,x=0,y;



    cin>>n;



    while(1000*x<n)



   {

       x++;

   }



   cout<<((1000*x)-n)<<endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.273086344167219x):
#include <stdio.h>



int main() {

	int N;

	scanf("%d", &N);

	for (int i = 0; i >= 0; i++) {

		if(i * 1000 >= N) {

			printf("%d", i*1000-N);

			break;

		}

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int  n,x=0,y;



    cin>>n;



    while(1000*x<n)



   {

       x++;

   }



   cout<<((1000*x)-n)<<endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.27198095040917x):
#include <stdio.h>

int main() {

	int n, x;

	

	scanf("%d", &x);

	for(n=0; n < x; n += 1000) {

		n;

	}

	printf("%d", n-x);

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int  n,x=0,y;



    cin>>n;



    while(1000*x<n)



   {

       x++;

   }



   cout<<((1000*x)-n)<<endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.257153031762134x):
#include <stdio.h>

int main(){

    int a;

    scanf("%d", &a);

    printf("%d\n", (1000 - (a - a/1000*1000)) % 1000);

    return 0;

}
// Slower C++ solution:
#include <cmath>

#include <cstdio>

#include <algorithm>



using namespace std;



int main()

{

    int n; double x[100000], y[100000];

    

    scanf("%d", &n);

    

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

    {

        scanf("%lf", &x[i]);

        scanf("%lf", &y[i]);

    }

    

    pair<double, double> p1[100000], p2[100000];

    

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

    {

        p1[i] = make_pair(x[i], y[i]);

    }

    

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

    {

        p2[i] = make_pair(y[i], x[i]);

    }

    

    sort(p1, p1 + n);

    sort(p2, p2 + n);

    

    double sqr_ans = 100000000.0;

    

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

    {

        int r = min(5000, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

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

    {

        int r = min(5000, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p2[i + 1].first - p2[i].first) * (p2[i + 1].first - p2[i].first) + (p2[i + 1].second - p2[i].second) * (p2[i + 1].second - p2[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

    printf("%.15f\n", sqrt(sqr_ans));

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.50076816616773x):
#include <bits/stdc++.h>

using namespace std;

int n; double bx, by; pair<double, double> p[100009];

int main() {

	scanf("%d", &n);

	double sq = sin(1.234), cq = cos(1.234);

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

		scanf("%lf%lf", &bx, &by);

		double ex = bx * cq - by * sq;

		double ey = bx * sq + by * cq;

		p[i] = make_pair(ex, ey);

	}

	sort(p, p + n);

	double ret = 1.0e+10;

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

		for(int j = i + 1; j < n && p[j].first - p[i].first <= ret; j++) {

			double dist = hypot(p[i].first - p[j].first, p[i].second - p[j].second);

			if(ret > dist) ret = dist;

		}

	}

	printf("%.15lf\n", ret);

	return 0;

}
// Slower C++ solution:
#include <cmath>

#include <cstdio>

#include <algorithm>



using namespace std;



int main()

{

    int n; double x[100000], y[100000];

    

    scanf("%d", &n);

    

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

    {

        scanf("%lf", &x[i]);

        scanf("%lf", &y[i]);

    }

    

    pair<double, double> p1[100000], p2[100000];

    

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

    {

        p1[i] = make_pair(x[i], y[i]);

    }

    

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

    {

        p2[i] = make_pair(y[i], x[i]);

    }

    

    sort(p1, p1 + n);

    sort(p2, p2 + n);

    

    double sqr_ans = 100000000.0;

    

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

    {

        int r = min(200, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

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

    {

        int r = min(200, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p2[i + 1].first - p2[i].first) * (p2[i + 1].first - p2[i].first) + (p2[i + 1].second - p2[i].second) * (p2[i + 1].second - p2[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

    printf("%.15f\n", sqrt(sqr_ans));

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.50076816616773x):
#include <bits/stdc++.h>

using namespace std;

int n; double bx, by; pair<double, double> p[100009];

int main() {

	scanf("%d", &n);

	double sq = sin(1.234), cq = cos(1.234);

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

		scanf("%lf%lf", &bx, &by);

		double ex = bx * cq - by * sq;

		double ey = bx * sq + by * cq;

		p[i] = make_pair(ex, ey);

	}

	sort(p, p + n);

	double ret = 1.0e+10;

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

		for(int j = i + 1; j < n && p[j].first - p[i].first <= ret; j++) {

			double dist = hypot(p[i].first - p[j].first, p[i].second - p[j].second);

			if(ret > dist) ret = dist;

		}

	}

	printf("%.15lf\n", ret);

	return 0;

}
// Slower C++ solution:
#include <cmath>

#include <cstdio>

#include <algorithm>



using namespace std;



int main()

{

    int n; double x[100000], y[100000];

    

    scanf("%d", &n);

    

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

    {

        scanf("%lf", &x[i]);

        scanf("%lf", &y[i]);

    }

    

    pair<double, double> p1[100000], p2[100000];

    

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

    {

        p1[i] = make_pair(x[i], y[i]);

    }

    

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

    {

        p2[i] = make_pair(y[i], x[i]);

    }

    

    sort(p1, p1 + n);

    sort(p2, p2 + n);

    

    double sqr_ans = 100000000.0;

    

    const int loops = 150;

    

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

    {

        int r = min(loops, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

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

    {

        int r = min(loops, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p2[i + j].first - p2[i].first) * (p2[i + j].first - p2[i].first) + (p2[i + j].second - p2[i].second) * (p2[i + j].second - p2[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

    printf("%.15f\n", sqrt(sqr_ans));

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.5008823966969387x):
#include <bits/stdc++.h>

using namespace std;

int n; double bx, by; pair<double, double> p[100009];

int main() {

	scanf("%d", &n);

	double sq = sin(1.234), cq = cos(1.234);

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

		scanf("%lf%lf", &bx, &by);

		double ex = bx * cq - by * sq;

		double ey = bx * sq + by * cq;

		p[i] = make_pair(ex, ey);

	}

	sort(p, p + n);

	double ret = 1.0e+10;

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

		for(int j = i + 1; j < n && p[j].first - p[i].first <= ret; j++) {

			double dist = hypot(p[i].first - p[j].first, p[i].second - p[j].second);

			if(ret > dist) ret = dist;

		}

	}

	printf("%.15lf\n", ret);

	return 0;

}
// Slower C++ solution:
#include <cmath>

#include <cstdio>

#include <algorithm>



using namespace std;



int main()

{

    int n; double x[100000], y[100000];

    

    scanf("%d", &n);

    

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

    {

        scanf("%lf", &x[i]);

        scanf("%lf", &y[i]);

    }

    

    pair<double, double> p1[100000], p2[100000];

    

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

    {

        p1[i] = make_pair(x[i], y[i]);

    }

    

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

    {

        p2[i] = make_pair(y[i], x[i]);

    }

    

    sort(p1, p1 + n);

    sort(p2, p2 + n);

    

    double sqr_ans = 100000000.0;

    

    const int loops = 125;

    

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

    {

        int r = min(loops, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

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

    {

        int r = min(loops, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p2[i + j].first - p2[i].first) * (p2[i + j].first - p2[i].first) + (p2[i + j].second - p2[i].second) * (p2[i + j].second - p2[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

    printf("%.15f\n", sqrt(sqr_ans));

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.5009524829279233x):
#include <bits/stdc++.h>

using namespace std;

int n; double bx, by; pair<double, double> p[100009];

int main() {

	scanf("%d", &n);

	double sq = sin(1.234), cq = cos(1.234);

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

		scanf("%lf%lf", &bx, &by);

		double ex = bx * cq - by * sq;

		double ey = bx * sq + by * cq;

		p[i] = make_pair(ex, ey);

	}

	sort(p, p + n);

	double ret = 1.0e+10;

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

		for(int j = i + 1; j < n && p[j].first - p[i].first <= ret; j++) {

			double dist = hypot(p[i].first - p[j].first, p[i].second - p[j].second);

			if(ret > dist) ret = dist;

		}

	}

	printf("%.15lf\n", ret);

	return 0;

}
// Slower C++ solution:
#include <cmath>

#include <cstdio>

#include <algorithm>



using namespace std;



int main()

{

    int n; double x[100000], y[100000];

    

    scanf("%d", &n);

    

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

    {

        scanf("%lf", &x[i]);

        scanf("%lf", &y[i]);

    }

    

    pair<double, double> p1[100000], p2[100000];

    

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

    {

        p1[i] = make_pair(x[i], y[i]);

    }

    

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

    {

        p2[i] = make_pair(y[i], x[i]);

    }

    

    sort(p1, p1 + n);

    sort(p2, p2 + n);

    

    double sqr_ans = 100000000.0;

    

    const int loops = 111;

    

    int n_1 = n - 1;

    

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

    {

        int r = min(loops, n_1 - i);

        

        for(char j = 1; j <= r; j++)

        {

            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

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

    {

        int r = min(loops, n_1 - i);

        

        for(char j = 1; j <= r; j++)

        {

            double distance_ = (p2[i + j].first - p2[i].first) * (p2[i + j].first - p2[i].first) + (p2[i + j].second - p2[i].second) * (p2[i + j].second - p2[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

    printf("%.9f\n", sqrt(sqr_ans));

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.500381889444784x):
#include <bits/stdc++.h>

using namespace std;

int n; double bx, by; pair<double, double> p[100009];

int main() {

	scanf("%d", &n);

	double sq = sin(1.234), cq = cos(1.234);

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

		scanf("%lf%lf", &bx, &by);

		double ex = bx * cq - by * sq;

		double ey = bx * sq + by * cq;

		p[i] = make_pair(ex, ey);

	}

	sort(p, p + n);

	double ret = 1.0e+10;

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

		for(int j = i + 1; j < n && p[j].first - p[i].first <= ret; j++) {

			double dist = hypot(p[i].first - p[j].first, p[i].second - p[j].second);

			if(ret > dist) ret = dist;

		}

	}

	printf("%.15lf\n", ret);

	return 0;

}
// Slower C++ solution:
#include <cmath>

#include <cstdio>

#include <algorithm>



using namespace std;



int main()

{

    int n; double x[100000], y[100000];

    

    scanf("%d", &n);

    

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

    {

        scanf("%lf", &x[i]);

        scanf("%lf", &y[i]);

    }

    

    pair<double, double> p1[100000], p2[100000];

    

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

    {

        p1[i] = make_pair(x[i], y[i]);

    }

    

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

    {

        p2[i] = make_pair(y[i], x[i]);

    }

    

    sort(p1, p1 + n);

    sort(p2, p2 + n);

    

    double sqr_ans = 100000000.0;

    

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

    {

        int r = min(5000, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

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

    {

        int r = min(5000, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p2[i + 1].first - p2[i].first) * (p2[i + 1].first - p2[i].first) + (p2[i + 1].second - p2[i].second) * (p2[i + 1].second - p2[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

    printf("%.15f\n", sqrt(sqr_ans));

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.5005250860546386x):
#include <bits/stdc++.h>

using namespace std;

int n; double bx, by; pair<double, double> p[100009];

int main() {

	scanf("%d", &n);

	double sq = sin(1.234), cq = cos(1.234);

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

		scanf("%lf%lf", &bx, &by);

		double ex = bx * cq - by * sq;

		double ey = bx * sq + by * cq;

		p[i] = make_pair(ex, ey);

	}

	sort(p, p + n);

	double ret = 1.0e+10;

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

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

			double dx = p[i].first - p[j].first;

			if(dx * dx > ret) break;

			double dy = p[i].second - p[j].second;

			double dist = dx * dx + dy * dy;

			if(ret > dist) ret = dist;

		}

	}

	printf("%.15lf\n", sqrt(ret));

	return 0;

}
// Slower C++ solution:
#include <cmath>

#include <cstdio>

#include <algorithm>



using namespace std;



int main()

{

    int n; double x[100000], y[100000];

    

    scanf("%d", &n);

    

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

    {

        scanf("%lf", &x[i]);

        scanf("%lf", &y[i]);

    }

    

    pair<double, double> p1[100000], p2[100000];

    

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

    {

        p1[i] = make_pair(x[i], y[i]);

    }

    

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

    {

        p2[i] = make_pair(y[i], x[i]);

    }

    

    sort(p1, p1 + n);

    sort(p2, p2 + n);

    

    double sqr_ans = 100000000.0;

    

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

    {

        int r = min(200, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

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

    {

        int r = min(200, n - i - 1);

        

        for(int j = 1; j <= r; j++)

        {

            double distance_ = (p2[i + 1].first - p2[i].first) * (p2[i + 1].first - p2[i].first) + (p2[i + 1].second - p2[i].second) * (p2[i + 1].second - p2[i].second);

        

            sqr_ans = min(distance_, sqr_ans);

        }

    }

    

    printf("%.15f\n", sqrt(sqr_ans));

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.5005250860546386x):
#include <bits/stdc++.h>

using namespace std;

int n; double bx, by; pair<double, double> p[100009];

int main() {

	scanf("%d", &n);

	double sq = sin(1.234), cq = cos(1.234);

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

		scanf("%lf%lf", &bx, &by);

		double ex = bx * cq - by * sq;

		double ey = bx * sq + by * cq;

		p[i] = make_pair(ex, ey);

	}

	sort(p, p + n);

	double ret = 1.0e+10;

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

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

			double dx = p[i].first - p[j].first;

			if(dx * dx > ret) break;

			double dy = p[i].second - p[j].second;

			double dist = dx * dx + dy * dy;

			if(ret > dist) ret = dist;

		}

	}

	printf("%.15lf\n", sqrt(ret));

	return 0;

}