text
stringlengths 49
983k
|
|---|
#include <bits/stdc++.h>
using namespace std;
int N, cnt;
int main() {
cin >> N;
for (int i = 0; i < N; i++) {
int a, b;
cin >> a;
cin >> b;
if (b - a >= 2) {
cnt++;
}
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, d = 0;
pair<int, int> a[110];
void nhap() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
}
int main() {
nhap();
for (int i = 1; i <= n; i++)
if (a[i].second - a[i].first >= 2) d++;
cout << d;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int xx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int yy[] = {1, -1, 0, 0, 1, -1, -1, 1};
inline long long MAX(long long a, long long b) { return (a > b) ? a : b; }
inline long long MIN(long long a, long long b) { return (a > b) ? b : a; }
inline double dis(double ax, double ay, double bx, double by) {
return ((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
}
long long pwr(long long x, long long n) {
if (n == 0) return 1;
if (n == 1) return x;
long long a = pwr(x, n / 2);
a = a * a;
if (n % 2) a *= x;
return a;
}
int main() {
int n, i, a, b, ans;
while (scanf("%d", &n) == 1) {
ans = 0;
for (i = 1; i <= n; i++) {
scanf("%d %d", &a, &b);
if (b - a > 1) ans++;
}
printf("%d\n", ans);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int count = 0;
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
if (b - a >= 2) ++count;
}
cout << count;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, s, d, n;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a >> s;
if (s - a >= 2) d++;
}
cout << d;
}
|
#include <bits/stdc++.h>
using namespace std;
long long int n, i, c = 0;
int main() {
cin >> n;
int a[n], b[n];
for (i = 0; i < n; i++) cin >> a[i] >> b[i];
for (i = 0; i < n; i++) {
if (b[i] - a[i] >= 2) c++;
}
cout << c;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, k, a, b, cnt = 0, x;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a >> b;
if ((b - a) >= 2) {
cnt++;
}
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int rooms;
scanf("%d", &rooms);
int ans = 0;
while (rooms--) {
int p, q;
scanf("%d%d", &p, &q);
int available = q - p;
if (available >= 2) {
ans++;
}
}
printf("%d\n", ans);
}
|
#include <bits/stdc++.h>
int main(void) {
int n;
scanf("%d", &n);
int pi, qi, count = 0;
while (n--) {
scanf("%d %d", &pi, &qi);
count += qi - pi >= 2;
}
printf("%d\n", count);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, t = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> p >> q;
if (q - p >= 2) t++;
}
cout << t;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
return a.first > b.first;
}
template <typename T>
inline T Bigmod(T base, T power, T MOD) {
T ret = 1;
while (power) {
if (power & 1) ret = (ret * base) % MOD;
base = (base * base) % MOD;
power >>= 1;
}
return ret;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
;
int n;
while (cin >> n) {
int cnt = 0;
while (n--) {
int p, q;
cin >> p >> q;
if ((q - p) >= 2) cnt++;
}
cout << cnt << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, p, q, answer = 0;
std::cin >> n;
while (std::cin >> p >> q) {
if (q - p >= 2) {
++answer;
}
}
std::cout << answer << std::endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int p, q, n, i, s = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> p >> q;
if ((q - p) > 1) {
s = s + 1;
}
}
cout << s;
}
|
#include <bits/stdc++.h>
int n, x, i, l, c;
int main() {
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &l, &c);
if (c - l >= 2) x++;
}
printf("%d", x);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, n, p, q, x = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> p >> q;
if (q - p >= 2) x++;
}
cout << x;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int c = 0;
while (n--) {
int a, b;
cin >> a >> b;
if (abs(a - b) >= 2) {
c++;
}
}
cout << c;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, counter = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> p >> q;
if (q - p > 1) counter++;
}
cout << counter;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q;
cin >> n;
int Count = 0;
for (int i(0); i < n; i++) {
cin >> p >> q;
if ((q - p) >= 2) Count++;
}
cout << Count;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, c = 0;
cin >> n;
if (n >= 1 && n <= 100) {
for (int i = 1; i <= n; i++) {
cin >> p >> q;
if (q - p >= 2) c++;
}
}
cout << c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
int rooms = 0;
int p, q;
while (t--) {
scanf("%d %d", &p, &q);
if (q - p >= 2) rooms++;
}
cout << rooms << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[101], b[101];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
int n;
cin >> n;
int k = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
if (b[i] - a[i] >= 2) ++k;
}
cout << k;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int c = 0, n, i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
int p, q;
scanf("%d%d", &p, &q);
if ((q - p) >= 2) c++;
}
printf("%d", c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i < n; i++) {
int p, q;
cin >> p >> q;
if ((q - p) >= 2) cnt++;
}
cout << cnt << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
long int n, i, count = 0, p, q;
scanf("%ld", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &p, &q);
if ((q - p) >= 2) count++;
}
printf("%ld", count);
}
|
#include <bits/stdc++.h>
int main() {
int t, a, b, count = 0;
std::cin >> t;
for (int i = 0; i < t; i++) {
std::cin >> a >> b;
if (b - a >= 2) count++;
}
std::cout << count;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b, c = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a >> b;
if (b - a >= 2) c++;
}
cout << c;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0, p, q;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> p >> q;
ans += q - p > 1 ? 1 : 0;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
int p, q;
int ans;
int main() {
ios::sync_with_stdio(false);
cin >> n;
while (n--) {
cin >> p >> q;
if (q - p >= 2) {
ans++;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
const int N = (int)1e6 + 123;
const long long inf = (long long)1e18 + 123;
const double eps = 1e-6;
using namespace std;
int a[100011], b[100011], cnt;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i] >> b[i];
if (b[i] - a[i] >= 2) {
cnt++;
}
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, x[110], y[110], i, k;
int main() {
cin >> n;
for (i = 0; i < n; i++) cin >> x[i] >> y[i];
for (i = 0; i < n; i++)
if (y[i] - x[i] >= 2) k++;
cout << k;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, count = 0;
cin >> n;
int p[n], q[n];
for (int i = 0; i < n; i++) {
cin >> p[i] >> q[i];
}
for (int i = 0; i < n; i++) {
if (q[i] - p[i] >= 2) count++;
}
cout << count;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
int buffer1, buffer, ans = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> buffer >> buffer1;
if (buffer1 - buffer > 1) ans++;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solution() {}
int main() {
int n, c = 0;
cin >> n;
while (n) {
int p, q;
cin >> p >> q;
if (q - p >= 2) {
c++;
}
n--;
}
cout << c;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, a, b, k = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d%d", &a, &b);
if ((b - a) >= 2) k++;
}
printf("%d", k);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 123;
const int M = 1e7 + 123;
const int inf = 1e9 + 1;
const int mod = 1e9 + 7;
const int bl = 300;
int n, a[N], b[N], cnt;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i] >> b[i];
if (abs(a[i] - b[i]) > 1) {
cnt++;
}
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int counter = 0;
cin >> n;
int a, b;
while (n--) {
cin >> a >> b;
if (b - a >= 2) {
counter++;
}
}
cout << counter << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool pairCompare(const std::pair<double, int>& firstElem,
const std::pair<double, int>& secondElem) {
return firstElem.first < secondElem.first;
}
int main() {
int n;
std::cin >> n;
int availableRooms = 0;
int pInput;
int qInput;
for (int i = 0; i < n; i++) {
std::cin >> pInput;
std::cin >> qInput;
if ((qInput - pInput) >= 2) {
availableRooms++;
}
}
std::cout << availableRooms;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
int p, q;
int count = 0;
for (int i = 0; i < a; i++) {
cin >> p >> q;
if (q - p > 1) {
count = count + 1;
}
}
cout << count;
}
|
#include <bits/stdc++.h>
int main() {
int n, p, q, i, count = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d %d", &p, &q);
if (q - p >= 2) {
count++;
}
}
printf("%d", count);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
pair<int, int> x[10000];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i].first >> x[i].second;
}
int count = 0;
for (int i = 0; i < n; i++) {
if (x[i].first + 2 <= x[i].second) count++;
}
cout << count << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, res = 0;
cin >> n;
int n1, n2;
for (int i = 0; i < n; i++) {
cin >> n1 >> n2;
if ((n2 - n1) >= 2) res++;
}
cout << res << endl;
}
|
#include <bits/stdc++.h>
int main() {
int n, p[103], q[103], i, sum;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d %d", &p[i], &q[i]);
}
int room = 0;
for (i = 1; i <= n; i++) {
sum = q[i] - p[i];
if (sum > 1) room++;
}
printf("%d", room);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, c, i;
scanf("%d", &n);
c = 0;
for (i = 1; i <= n; i++) {
scanf("%d %d", &p, &q);
if (q - 2 >= p) c++;
}
printf("%d\n", c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, p, q, cnt = 0;
int main() {
scanf("%d", &n);
for (int i = 0; i < int(n); i++) {
scanf("%d %d", &p, &q);
if (q - p >= 2) cnt++;
}
printf("%d", cnt);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, cnt = 0;
cin >> n;
while (n--) {
int p, q;
cin >> p >> q;
if (p <= q - 2) cnt++;
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, cou = 0, i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> p >> q;
if ((q - p) > 1) cou++;
}
if (cou > 0)
cout << cou << endl;
else
cout << "0" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void fast_in_out() {
std::ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
}
int main() {
fast_in_out();
int n, x, y, c = 0;
cin >> n;
for (int(i) = 0; (i) < (n); ++(i)) {
cin >> x >> y;
if (y >= x + 2) c++;
}
cout << c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
int p;
int q;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> p;
cin >> q;
if (q - p >= 2) ans++;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int x, y;
scanf("%d %d", &x, &y);
if (y - x >= 2) ans++;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, r, p;
int sum = 0;
cin >> n;
while (n > 0) {
cin >> r >> p;
if (r + 2 <= p) sum++;
n--;
}
cout << sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q;
cin >> n;
int count = 0;
for (int i = 0; i < n; i++) {
cin >> p >> q;
if (q - p >= 2) {
count++;
}
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, cnt = 0;
cin >> x;
int p[x], q[x];
for (int i = 0; i < x; i++) {
int a, b;
cin >> a >> b;
p[i] = a;
q[i] = b;
}
for (int i = 0; i < x; i++) {
if (q[i] - p[i] > 1) cnt++;
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const string maxS = "zzzzzzzzzzzzzzzzzzzzz";
const long long maxA = 2000000000, maxN = 100000;
long long i, j, n, m, o, a, b;
int main() {
cin >> n;
for (i = 0; i < n; i++) {
cin >> a >> b;
if (b - a > 1) o++;
}
cout << o;
}
|
#include <bits/stdc++.h>
int main() {
int i, n, a, b, sum = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d %d", &a, &b);
if (a < b - 1) sum++;
}
printf("%d\n", sum);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
pair<int, int> v[100];
int n, ct;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> v[i].first >> v[i].second;
if ((v[i].first + 2) <= v[i].second) ct++;
}
cout << ct << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int a[100][2];
cin >> n;
int k = 0;
if (1 <= n && n <= 100) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < n; i++) {
if (a[i][0] + 1 < a[i][1]) k++;
}
cout << k;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b, cnt = 0;
cin >> n;
while (n--) {
cin >> a >> b;
if (b - a >= 2) {
cnt++;
}
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int p, q;
int cnt = 0;
while (n--) {
cin >> p >> q;
if (q - p >= 2) cnt++;
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum = 0, x, y;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (y - x >= 2) sum++;
}
cout << sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n, p, k = 0, con = 0;
cin >> p;
while (k < p) {
cin >> m >> n;
if (n - m >= 2) {
con += 1;
}
k += 1;
}
cout << con;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, a, b, c = 0, i;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d%d", &a, &b);
if (a < b && (b - a) >= 2) {
c++;
}
}
printf("%d", c);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, n, c;
cin >> n;
c = 0;
for (int i = 1; i <= n; i++) {
cin >> a >> b;
if ((b - a) >= 2) c += 1;
}
cout << c << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, p, q, fr = 0;
scanf("%d", &n);
while (n > 0) {
scanf("%d%d", &p, &q);
if (q - p > 1) fr++;
n--;
}
printf("%d\n", fr);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int i, n;
int count = 0;
scanf("%d", &n);
int a[n][2];
for (i = 0; i < n; i++) {
scanf("%d%d", &a[i][0], &a[i][1]);
if (a[i][1] - a[i][0] >= 2) count++;
}
printf("%d", count);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k, n, c = 0;
cin >> n;
for (i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
if (abs(a - b) >= 2) {
c++;
}
}
cout << c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q;
cin >> n;
int count = 0;
for (int i = 0; i < n; i++) {
cin >> p >> q;
if (q - p > 1) {
count++;
}
}
cout << count;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, count = 0;
cin >> n;
while (n--) {
cin >> p >> q;
if (p <= (q - 2)) count++;
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b, count = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a >> b;
if (b - a >= 2) {
count++;
}
}
cout << count;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, k, a[102], b[102], r = 0, x, y;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i] >> b[i];
x = b[i] - a[i];
if (x >= 2) r++;
}
cout << r << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int x, y, n, cou;
int main() {
pair<int, int> foo;
cin >> n;
while (n != 0) {
cin >> x >> y;
foo = make_pair(x, y);
if (foo.first <= foo.second - 2) cou++;
n--;
}
cout << cou;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, p, q, count = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d%d", &p, &q);
if ((q - p) >= 2) count++;
}
printf("%d\n", count);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i = 0, count = 0, t;
cin >> n;
int p[2];
while (i < n) {
for (int j = 0; j < 2; j++) {
cin >> p[j];
}
t = p[1] - p[0];
if (t >= 2) count++;
i++;
}
cout << count;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, cont = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> p >> q;
if (p <= q - 2) {
cont++;
}
}
cout << cont << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, count;
count = 0;
cin >> a;
int n[a];
int b[a];
for (int i = 0; i < a; i++) {
cin >> n[i] >> b[i];
}
for (int i = 0; i < a; i++) {
if (b[i] - n[i] >= 2) {
count++;
}
}
cout << count;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
int count = 0;
while (t--) {
int a, b;
cin >> a >> b;
int sub;
sub = b - a;
if (sub >= 2) {
count++;
}
}
cout << count;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[105][2];
int main() {
int n, count = 0, tmp;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i][0]);
scanf("%d", &a[i][1]);
if (a[i][1] - a[i][0] >= 2) count++;
}
printf("%d\n", count);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, c = 0, t = 0;
cin >> n;
int p, q;
for (int i = 0; i < n; i++) {
cin >> p >> q;
if (abs(q - p) >= 2) c++;
}
cout << c << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i = 0, n, p, q;
cin >> n;
for (int k = 0; k < n; k++) {
cin >> p >> q;
if (q - p >= 2) {
i++;
}
}
cout << i;
}
|
#include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
int p, q, c = 0;
for (int i = 0; i < n; i++) {
scanf("%d%d", &p, &q);
if (q - p >= 2) c = c + 1;
}
printf("%d", c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, num1, num2, sum = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> num1 >> num2;
if ((num2 - num1) > 1) ++sum;
}
cout << sum;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, d = 0;
cin >> a;
for (int i = 0; i < a; i++) {
cin >> b;
cin >> c;
if (b != c) {
if (b + 1 != c) d = d + 1;
}
}
cout << d;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, cnt = 0;
cin >> n;
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
if (y - x >= 2) cnt++;
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p, q, avail = 0;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> p >> q;
if (p + 2 <= q) avail++;
}
cout << avail;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, A[100][100];
cin >> n;
for (int i = 0; i < n; i++) {
for (int t = 0; t < 2; t++) {
cin >> A[i][t];
}
}
int X = 0;
for (int i = 0; i < n; i++) {
if (A[i][1] - A[i][0] >= 2) X++;
}
cout << X << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, n, a, b, gigel = 0;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> a >> b;
if (b - a >= 2) gigel++;
}
cout << gigel;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, y;
cin >> n;
int cont = 0;
for (int i = 0; i < n; i++) {
scanf("%d%d", &x, &y);
if (y - x >= 2) cont++;
}
cout << cont << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, a, b, k;
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a >> b;
if (b - a >= 2) k++;
}
cout << k;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
int a[100][100];
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j += 2) {
if (a[i][j + 1] - a[i][j] >= 2) {
ans++;
}
}
}
cout << ans;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, t = 0;
int p[101], q[101];
scanf("%d", &n);
for (i = 0; i <= n - 1; i++) {
scanf("%d %d", &p[i], &q[i]);
if (q[i] > p[i] && q[i] - p[i] >= 2) t++;
}
printf("%d", t);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e8;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
class UnionFind {
private:
vector<int> p, rank;
public:
UnionFind(int N) {
rank.assign(N, 0);
p.assign(N, 0);
for (size_t i = 0; i < N; i++) p[i] = i;
}
int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
void unionSet(int i, int j) {
if (!isSameSet(i, j)) {
int x = findSet(i), y = findSet(j);
if (rank[x] > rank[y])
p[y] = x;
else {
p[x] = y;
if (rank[x] == rank[y]) rank[y]++;
}
}
}
};
void print(vector<int> &s) {
for (auto e : s) {
cout << e << " ";
}
cout << endl;
}
int numberOfDigits(int x) { return log10(x) + 1; }
template <class T>
string toStr(const T &x) {
stringstream s;
s << x;
return s.str();
}
template <class T>
int toInt(const T &x) {
stringstream s;
s << x;
int r;
s >> r;
return r;
}
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_first {
bool operator()(const std::pair<T1, T2> &left,
const std::pair<T1, T2> &right) {
Pred p;
return p(left.first, right.first);
}
};
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
bool operator()(const std::pair<T1, T2> &left,
const std::pair<T1, T2> &right) {
Pred p;
return p(left.second, right.second);
}
};
long long in = 0;
long long inn = 0;
int main() {
int n;
cin >> n;
int c(0);
for (size_t i = 0; i < n; i++) {
cin >> in >> inn;
if (in < inn)
if (abs(in - inn) >= 2) c++;
}
cout << c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int p, q;
int cnt = 0;
for (int i = 0; i < n; i++) {
cin >> p >> q;
if ((q - p) >= 2) {
cnt++;
}
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int cnt = 0;
int n, a, b;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a >> b;
int res = b - a;
if (res > 1) cnt++;
}
cout << cnt << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, count = 0;
cin >> n;
while (n--) {
int p, q;
cin >> p >> q;
if (q - p >= 2) count++;
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int a, b;
cin >> n;
int c = 0;
while (n--) {
cin >> a >> b;
if (b - a >= 2) ++c;
}
cout << c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, count = 0;
cin >> t;
while (t--) {
int p, q;
cin >> p >> q;
if (q - p >= 2) {
count += 1;
}
}
cout << count;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int *a = new int[n * 2];
for (int x = 0; x < n * 2; x++) {
cin >> a[x];
}
int w = 0;
for (int x = 0; x < n * 2; x += 2) {
if (a[x + 1] - a[x] >= 2) {
w++;
}
}
cout << w;
return 0;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, j, count = 0;
scanf("%d", &n);
int a[n][2];
for (i = 0; i < n; i++) {
for (j = 0; j < 2; j++) {
scanf("%d", &a[i][j]);
}
}
for (i = 0; i < n; i++) {
if (a[i][1] - a[i][0] >= 2) {
count++;
}
}
printf("%d", count);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, cnt, flag = 0;
cin >> n;
int a, b, c = 0;
for (int i = 1; i <= n; i++) {
cin >> a >> b;
if (b - a >= 2) ++c;
}
cout << c << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, x, y, Sum;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
scanf("%d%d", &x, &y);
if (x + 2 <= y) Sum++;
}
printf("%d", Sum);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int rooms, p, q, count = 0;
cin >> rooms;
for (int i = 0; i < rooms; i++) {
cin >> p >> q;
if (p <= (q - 2)) {
count++;
}
}
cout << count << endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.