Skip to content

Instantly share code, notes, and snippets.

@enzerr
Last active April 6, 2023 13:42
Show Gist options
  • Save enzerr/441221f2ce8df982d6898ea519c43eff to your computer and use it in GitHub Desktop.
Save enzerr/441221f2ce8df982d6898ea519c43eff to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int v[maxn];
int32_t main(){
int n, k; cin >> n >> k;
for(int i = 1; i <= n; i++){
int a, b; cin >> a >> b;
v[i] = a%b;
}
sort(v+1, v+n+1);
cout << v[k] << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment