buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; (i) < (n); (i)++) using namespace std; int main() { int N; cin >> N; long A[200005], B[200005]; REP(i, N) cin >> A[i] >> B[i]; sort(A, A + N); sort(B, B + N); if (N % 2 == 0) { long temp = B[N / 2 - 1] + B[N / 2] - A[N / 2 - 1] - A[N / 2]; ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; (i) < (n); (i)++) using namespace std; int main() { int N; cin >> N; long A[200005], B[200005]; REP(i, N) cin >> A[i] >> B[i]; sort(A, A + N); sort(B, B + N); if (N % 2 == 0) { long temp = B[N / 2 - 1] + B[N / 2] - A[N / 2 - 1] - A[N / 2]; ...
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]]
1
169
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007ll #define vll vector<ll> #define pll pair<ll, ll> #define vpll vector<pll> #define pb push_back #define mp make_pair #define x first #define y second #define db(x) cout << #x << " = " << x << '\n' #define sep cout << "************...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007ll #define vll vector<ll> #define pll pair<ll, ll> #define vpll vector<pll> #define pb push_back #define mp make_pair #define x first #define y second #define db(x) cout << #x << " = " << x << '\n' #define sep cout << "************...
[["-", 12, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 17, 85]]
1
190
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using names...
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using names...
[["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40]]
1
226
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int a[100009], b[100009]; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i] >> b[i]; sort(a + 1, a + n + 1); sort(b + 1, b + n + 1); if (n % 2 == 1) cout << b[(n + 1) / 2] - a[(n + 1) / 2] + 1; else cout << b[...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int a[200009], b[200009]; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i] >> b[i]; sort(a + 1, a + n + 1); sort(b + 1, b + n + 1); if (n % 2 == 1) cout << b[(n + 1) / 2] - a[(n + 1) / 2] + 1; else cout << b[...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 16, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 16, 12, 16, 31, 16, 17, 33]]
1
155
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MOD 1000000007 #define MOD2 998244353 #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long Int; typedef pair<Int, Int> P; int main() { int n; cin >> n; Int a[n]; Int b[n]; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MOD 1000000007 #define MOD2 998244353 #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long Int; typedef pair<Int, Int> P; int main() { int n; cin >> n; Int a[n]; Int b[n]; ...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
192
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) #define MD 998244353 using namespace std; int main(void) { ...
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) #define MD 998244353 using namespace std; int main(void) { ...
[["-", 15, 339, 51, 16, 31, 16, 31, 23, 0, 24], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["-", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25], ["-", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33]]
1
258
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n & 1) { cout << b[n / 2] - a[n / 2]; } else { cout << b[n / 2] + b[n / 2 - 1] - a[n / ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n & 1) { cout << b[n / 2] - a[n / 2] + 1; } else { cout << b[n / 2] + b[n / 2 - 1] - a[...
[["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
150
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); ll...
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); ll...
[["-", 12, 16, 31, 16, 31, 16, 31, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 17, 72], ["-", 0, 16, 12, 16, 31, 16, 31, 16, 17, 72], ["+", 0, 16, 12, 16, 31, 16, 31, 16, 17, 33]]
1
206
N=int(input()) a=[] b=[] for _ in range(N): A,B=map(int,input().split()) a.append(A) b.append(B) a=sorted(a) b=sorted(b) if N%2==1: print(b[N//2]-a[N//2]+1) else: print(int((b[N//2-1]+b[N//2])/2-(a[N//2-1]+a[N//2])/2)*2+1)
N=int(input()) a=[] b=[] for _ in range(N): A,B=map(int,input().split()) a.append(A) b.append(B) a=sorted(a) b=sorted(b) if N%2==1: print(b[N//2]-a[N//2]+1) else: print(int(((b[N//2-1]+b[N//2])/2-(a[N//2-1]+a[N//2])/2)*2+1))
[["+", 31, 23, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
140
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define pb push_back #define mp make_pair #define SPEED \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define pb push_back #define mp make_pair #define SPEED \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33]]
1
181
#include <algorithm> #include <cmath> #include <ctime> #include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vector<int>>; using pii = pair<int, int>; using ppi = pair<pii, int>; int main() { cin.tie(0); ios::sync_with_stdio(fa...
#include <algorithm> #include <cmath> #include <ctime> #include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vector<int>>; using pii = pair<int, int>; using ppi = pair<pii, int>; int main() { cin.tie(0); ios::sync_with_stdio(fa...
[["-", 31, 16, 31, 23, 0, 16, 31, 16, 17, 85], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["-", 31, 16, 31, 23, 0, 16, 12, 16, 17, 85], ["-", 31, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13]]
1
256
#include <bits/extc++.h> #include <bits/stdc++.h> using namespace std; using namespace __gnu_pbds; using vi = vector<int>; using ii = pair<int, int>; using vii = vector<ii>; using ll = long long; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #def...
#include <bits/extc++.h> #include <bits/stdc++.h> using namespace std; using namespace __gnu_pbds; using vi = vector<int>; using ii = pair<int, int>; using vii = vector<ii>; using ll = long long; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #def...
[["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, ...
1
549
#include <bits/stdc++.h> using namespace std; const int nm = 1e5; int n, a[nm], b[nm]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a, a + n); sort(b, b + n); if (n % 1) { cout << b[n / 2] - a[n / 2] + 1 << endl; } else { cout << b[n / 2 - 1] + b[n / 2] - a[n ...
#include <bits/stdc++.h> using namespace std; const int nm = 2e5; int n, a[nm], b[nm]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a, a + n); sort(b, b + n); if (n & 1) { cout << b[n / 2] - a[n / 2] + 1 << endl; } else { cout << b[n / 2 - 1] + b[n / 2] - a[n ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67]]
1
148
/* Author:zeke pass System Test! GET AC!! */ #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include...
/* Author:zeke pass System Test! GET AC!! */ #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include...
[["+", 3, 4, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24]]
1
469
import bisect n = int(input()) l = [] r = [] for i in range(n): a, b = map(int, input().split()) l.append(a) r.append(b) l.sort() r.sort(reverse=True) if n%2 == 1: print(r[(n-1)//2]-l[(n-1)//2]+1) else: l1, l2 = l[(n-2)//2], l[(n-2)//2+1] r1, r2 = r[(n-2)//2+1], r[(n-2)//2] d1, d2 = r1-...
import bisect n = int(input()) l = [] r = [] for i in range(n): a, b = map(int, input().split()) l.append(a) r.append(b) l.sort() r.sort(reverse=True) if n%2 == 1: print(r[(n-1)//2]-l[(n-1)//2]+1) else: l1, l2 = l[(n-2)//2], l[(n-2)//2+1] r1, r2 = r[(n-2)//2+1], r[(n-2)//2] d1, d2 = r1-...
[["+", 0, 657, 31, 657, 31, 657, 31, 657, 17, 72], ["+", 0, 657, 31, 657, 31, 657, 31, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22]]
5
196
# E N = int(input()) AandB = [list(map(int, input().split())) for _ in range(N)] A = [AandB[i][0] for i in range(N)] B = [AandB[i][1] for i in range(N)] A_sorted = sorted(A) B_sorted = sorted(B) if N % 2 != 0: n = N // 2 a = A_sorted[n] b = B_sorted[-(n+1)] print(b-a+1) else: n = N // 2 a1 = A...
# E N = int(input()) AandB = [list(map(int, input().split())) for _ in range(N)] A = [AandB[i][0] for i in range(N)] B = [AandB[i][1] for i in range(N)] A_sorted = sorted(A) B_sorted = sorted(B) if N % 2 != 0: n = N // 2 a = A_sorted[n] b = B_sorted[-(n+1)] print(b-a+1) else: n = N // 2 a1 = A...
[["-", 0, 657, 31, 657, 31, 23, 0, 657, 31, 22], ["-", 0, 657, 31, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 657, 31, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 657, 31, 657, 31, 23, 0, 657, 12, 22]]
5
190
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; } //最大公約数 ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } //最小公倍数 using Graph = vector<vector<ll>>; ll inf = 30000000000000000...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; } //最大公約数 ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } //最小公倍数 using Graph = vector<vector<ll>>; ll inf = 30000000000000000...
[["-", 31, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["-", 31, 16, 12, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]]
1
284
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import defaultdict def main(): n = int(input().strip()) diff_a = defaultdict(int) diff_b = defaultdict(int) for _ in range(n): a, b = map(int, input().split()) diff_a[a] += 1 diff_b[b] += 1 cur = 0 for i ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import defaultdict def main(): n = int(input().strip()) diff_a = defaultdict(int) diff_b = defaultdict(int) for _ in range(n): a, b = map(int, input().split()) diff_a[a] += 1 diff_b[b] += 1 cur = 0 for i ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
238
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define rep(i, n) for (int i ...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define rep(i, n) for (int i ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
322
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<ll> a, b; int main() { int n; cin >> n; a = b = vector<ll>(n); for (int i = 0; i < n; i++) { cin >> a[i]; cin >> b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n % 2) { cout << b[n / 2] - a[n / 2] + ...
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<ll> a, b; int main() { int n; cin >> n; a = b = vector<ll>(n); for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n % 2) { cout << b[n / 2] - a[n / 2] + 1 << endl...
[["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13]]
1
188
#include <bits/stdc++.h> #define repr(i, from, to) for (int(i) = (from); (i) < (to); (i)++) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) // const bool debug=true; const bool debug = false; #define DEBUG if (debug == true) #define all(x) begin((x)), end((x)) #define vprint(x) ...
#include <bits/stdc++.h> #define repr(i, from, to) for (int(i) = (from); (i) < (to); (i)++) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) // const bool debug=true; const bool debug = false; #define DEBUG if (debug == true) #define all(x) begin((x)), end((x)) #define vprint(x) ...
[["-", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 16, 12, 69...
1
312
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long A[] = new long[N]; long B[] = new long[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); B[i] = sc.nextInt(); } int n = N / 2; ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long A[] = new long[N]; long B[] = new long[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); B[i] = sc.nextInt(); } int n = N / 2; ...
[["-", 3, 4, 0, 16, 31, 16, 31, 23, 0, 24], ["-", 3, 4, 0, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 492, 3, 4, 0, 16, 31, 16, 17, 85], ["-", 0, 492, 3, 4, 0, 16, 31, 16, 12, 499], ["-", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499]]
3
194
import numpy as np N = int(input()) AB = [list(map(int, input().split())) for _ in range(N)] AB = np.array(AB) # 取りうる最小の中央値と最大の中央値を計算 # 偶数のときは0.5, 奇数のときは1 m = np.median(AB[:, 0]) M = np.median(AB[:, 1]) if N % 2 == 0: print(int(M - m) * 2 + 1) else: print(int(M - m) + 1)
import numpy as np N = int(input()) AB = [list(map(int, input().split())) for _ in range(N)] AB = np.array(AB) # 取りうる最小の中央値と最大の中央値を計算 m = np.median(AB[:, 0]) M = np.median(AB[:, 1]) if N % 2 == 0: print(int((M - m) * 2 + 1)) else: print(int(M - m + 1))
[["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
107
n = int(input()) AB = [tuple(map(int, input().split())) for i in range(n)] A = [AB[i][0] for i in range(n)] B = [AB[i][1] for i in range(n)] # A = [(AB[i][0], i) for i in range(n)] # B = [(AB[i][1], i) for i in range(n)] A.sort() B.sort() if n % 2 == 1: print(B[n // 2] - A[n // 2] + 1) print(A, B) if n % 2 == 0...
n = int(input()) AB = [tuple(map(int, input().split())) for i in range(n)] A = [AB[i][0] for i in range(n)] B = [AB[i][1] for i in range(n)] # A = [(AB[i][0], i) for i in range(n)] # B = [(AB[i][1], i) for i in range(n)] A.sort() B.sort() if n % 2 == 1: print(B[n // 2] - A[n // 2] + 1) if n % 2 == 0: # x = ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
169
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> vmin, vmax; rep(i, n) { int a; int b; cin >> a >> b; vmin.push_back(a); vmax.push_back(b); } ...
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> vmin, vmax; rep(i, n) { int a; int b; cin >> a >> b; vmin.push_back(a); vmax.push_back(b); } ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
178
N = int(input()) A = dict() B = dict() for i in range(N): a, b = map(int, input().split()) A[i] = a B[i] = b A_sort = sorted(A.items(), key=lambda x:x[1]) B_sort = sorted(B.items(), key=lambda x:x[1]) if N % 2 == 1: print(B_sort[(N+1)//2-1][1]-A_sort[(N+1)//2-1][1]+1) else: B_min = B_sort[N//2-1][1...
N = int(input()) A = dict() B = dict() for i in range(N): a, b = map(int, input().split()) A[i] = a B[i] = b A_sort = sorted(A.items(), key=lambda x:x[1]) B_sort = sorted(B.items(), key=lambda x:x[1]) if N % 2 == 1: print(B_sort[(N+1)//2-1][1]-A_sort[(N+1)//2-1][1]+1) else: B_min = B_sort[N//2-1][1...
[["+", 31, 657, 31, 657, 31, 657, 31, 664, 17, 33], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72]]
5
199
from operator import itemgetter import copy n = int(input()) ab = sorted([list(map(int, input().split())) for i in range(n)]) abr = copy.copy(ab) abr.sort(key=itemgetter(1)) if n % 2: a1,b1 = ab[n//2] a2,b2 = abr[n//2] ans = b2 - a1 + 1 else: a1,b1 = ab[n//2-1] a2,b2 = abr[n//2-1] a3,b3 = ab[n/...
from operator import itemgetter import copy n = int(input()) ab = sorted([list(map(int, input().split())) for i in range(n)]) abr = copy.copy(ab) abr.sort(key=itemgetter(1)) if n % 2: a1,b1 = ab[n//2] a2,b2 = abr[n//2] ans = b2 - a1 + 1 else: a1,b1 = ab[n//2-1] a2,b2 = abr[n//2-1] a3,b3 = ab[n/...
[["-", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22]]
5
155
#include <bits/stdc++.h> #define rep(a, b, c) for (int a = b; a <= c; a++) #define per(a, b, c) for (int a = b; a >= c; a--) #define ios \ ; \ ios::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define rep(a, b, c) for (int a = b; a <= c; a++) #define per(a, b, c) for (int a = b; a >= c; a--) #define ios \ ; \ ios::sync_with_stdio(false); ...
[["-", 36, 36, 0, 30, 0, 43, 39, 344, 141, 78], ["+", 36, 36, 0, 30, 0, 43, 39, 344, 141, 78]]
1
574
n = int(input()) min = [] max = [] for i in range(n): a, b = map(int, input().split()) min.append(a) max.append(b) min.sort() max.sort() if n%2 == 0: print((max[n//2] + max[n//2 - 1]) -(min[n//2] + min[n//2 - 1])+ 1) else: print(max[n//2]-min[n//2]+1) print(min)
n = int(input()) min = [] max = [] for i in range(n): a, b = map(int, input().split()) min.append(a) max.append(b) min.sort() max.sort() if n%2 == 0: print((max[n//2] + max[n//2 - 1]) -(min[n//2] + min[n//2 - 1])+ 1) else: print(max[n//2]-min[n//2]+1)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
133
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <math.h> #include <set> #include <string.h> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef pair<int, int> ii; const ll inf = 1e18; ii a[200000]; void solve() { int n; ii ...
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <math.h> #include <set> #include <string.h> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef pair<int, int> ii; const ll inf = 1e18; ii a[200000]; void solve() { int n; ii ...
[["-", 64, 1, 0, 11, 12, 16, 31, 118, 119, 120], ["+", 64, 1, 0, 11, 12, 16, 31, 118, 119, 120], ["-", 64, 1, 0, 11, 12, 16, 12, 118, 119, 120], ["+", 64, 1, 0, 11, 12, 16, 12, 118, 119, 120], ["-", 75, 76, 0, 1, 0, 11, 12, 118, 119, 120], ["+", 75, 76, 0, 1, 0, 11, 12, 118, 119, 120]]
1
276
import statistics N = int(input()) P = [[int(i) for i in input().split()] for _ in range(N)] left = [] right = [] for i in range(N): left.append(P[i][0]) right.append(P[i][1]) lmed = statistics.median(left) rmed = statistics.median(right) if N % 2 == 0: print(int(rmed - lmed) * 2 + 1) else: print(...
import statistics N = int(input()) P = [[int(i) for i in input().split()] for _ in range(N)] left = [] right = [] for i in range(N): left.append(P[i][0]) right.append(P[i][1]) lmed = statistics.median(left) rmed = statistics.median(right) if N % 2 == 0: print(int((rmed - lmed) * 2 + 1)) else: prin...
[["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
123
import sys import math import itertools import collections import heapq import numpy as np rl = sys.stdin.readline n = int(rl()) a = [] b = [] for _ in range(n): aa, bb = map(int, rl().split()) a.append(aa) b.append(bb) def heapsort(iterable): h = [] for value in iterable: heapq.heappush(h...
import sys import math import itertools import collections import heapq import numpy as np rl = sys.stdin.readline n = int(rl()) a = [] b = [] for _ in range(n): aa, bb = map(int, rl().split()) a.append(aa) b.append(bb) def heapsort(iterable): h = [] for value in iterable: heapq.heappush(h...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
204
#include <bits/stdc++.h> #define pii pair<int, int> #define L first #define R second using namespace std; int N; int A[200005], B[200005]; int main() { ios_base::sync_with_stdio(0); scanf("%d", &N); for (int i = 1; i <= N; i++) { scanf("%d %d", &A[i], &B[i]); } sort(A + 1, A + N + 1); sort(B + 1, B + ...
#include <bits/stdc++.h> #define pii pair<int, int> #define L first #define R second using namespace std; int N; int A[200005], B[200005]; int main() { ios_base::sync_with_stdio(0); scanf("%d", &N); for (int i = 1; i <= N; i++) { scanf("%d %d", &A[i], &B[i]); } sort(A + 1, A + N + 1); sort(B + 1, B + ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
184
import statistics n=int(input()) a = [[int(i) for i in input().split()] for j in range(n)] min=[i[0] for i in a] max=[i[1] for i in a] if n%2==0: print(int(statistics.median(max)-statistics.median(min))*2+1) else: print(int(statistics.median(max)-statistics.median(min))+1)
import statistics n=int(input()) a = [[int(i) for i in input().split()] for j in range(n)] min=[i[0] for i in a] max=[i[1] for i in a] if n%2==0: print(int(statistics.median(max)*2-statistics.median(min)*2)+1) else: print(int(statistics.median(max)-statistics.median(min))+1)
[["+", 31, 652, 3, 4, 0, 657, 31, 657, 17, 48], ["+", 31, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
114
#include <bits/stdc++.h> using namespace std; /*#include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; // x^y≡x^(y%(p-1))mod p // but there is a condition that x needs to be coprime to p ///assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space typedef tree<int, nu...
#include <bits/stdc++.h> using namespace std; /*#include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; // x^y≡x^(y%(p-1))mod p // but there is a condition that x needs to be coprime to p ///assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space typedef tree<int, nu...
[["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 0, 11, 12, 16, 31, 16, 12, 23, 0, 24], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 16, 12, 23, 0, 25], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
644
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n; i++) #define ll long long #define INF 21474836...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n; i++) #define ll long long #define INF 21474836...
[["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33]]
1
194
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; long long a[N]; long long b[N]; long long mi = 0; long long ma = 0; for (long long i = 0; i < N; i++) { cin >> a[i]; cin >> b[i]; } sort(a, a + N); sort(b, b + N); if (N % 2 == 1) { mi = a[(N - 1) / 2]; ...
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; long long a[N]; long long b[N]; long long mi = 0; long long ma = 0; for (long long i = 0; i < N; i++) { cin >> a[i]; cin >> b[i]; } sort(a, a + N); sort(b, b + N); if (N % 2 == 1) { mi = a[(N - 1) / 2]; ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
190
import sys input = lambda: sys.stdin.readline().rstrip() n = int(input()) a = [] b = [] for _ in range(n): a_, b_ = map(int, input().split()) a.append(a_) b.append(b_) a.sort() b.sort() if n % 2 == 1: a_m = a[n // 2] b_m = b[n // 2] print(b_m - a_m + 1) else: a_m = (a[n // 2 - 1] + a[n // 2...
import sys input = lambda: sys.stdin.readline().rstrip() n = int(input()) a = [] b = [] for _ in range(n): a_, b_ = map(int, input().split()) a.append(a_) b.append(b_) a.sort() b.sort() if n % 2 == 1: a_m = a[n // 2] b_m = b[n // 2] print(b_m - a_m + 1) else: a_m = (a[n // 2 - 1] + a[n // 2...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 48], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 612]]
5
167
import statistics import math N = int(input()) A_B = [[int(i) for i in input().split(' ')] for n in range(N)] t = list(zip(*A_B)) A_sta = statistics.median(t[0]) B_sta = statistics.median(t[1]) if N % 2 == 0: count = 2 * (B_sta - A_sta + 1) else: count = B_sta - A_sta + 1 print(count)
import statistics import math N = int(input()) A_B = [[int(i) for i in input().split(' ')] for n in range(N)] t = list(zip(*A_B)) A_sta = statistics.median(t[0]) B_sta = statistics.median(t[1]) if N % 2 == 0: count = int(2 * (B_sta - A_sta) + 1) else: count = B_sta - A_sta + 1 print(count)
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 31, 657, 12, 23, 0, 25]]
5
105
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int n; cin >> n; vector<int> A(n); vector<int> B(n); rep(i, n) cin >> A[i] >> B[i]; sort(A.begin(), A.end()); sort(B.begin(), B.end()); int ans = 0; if (n...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int n; cin >> n; vector<int> A(n); vector<int> B(n); rep(i, n) cin >> A[i] >> B[i]; sort(A.begin(), A.end()); sort(B.begin(), B.end()); int ans = 0; if (n...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
199
#ifdef MY_LOCAL #define MY_NAMESPACE(ns) namespace ns { #define MY_NAMESPACE_ } #define MY_DEBUG(s) s #else #define MY_NAMESPACE(ns) #define MY_NAMESPACE_ #define MY_DEBUG(s) #endif #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <...
#ifdef MY_LOCAL #define MY_NAMESPACE(ns) namespace ns { #define MY_NAMESPACE_ } #define MY_DEBUG(s) s #else #define MY_NAMESPACE(ns) #define MY_NAMESPACE_ #define MY_DEBUG(s) #endif #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["-", 0, 11, 12, 16, 31, 16, 12, 23, 0, 24], ["-", 31, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
278
import java.io.InputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { resolve(System.in, System.out); } static void resolve(InputStream is, PrintStream pw) { Scanner sc = new Scanner(is); int n = Integer.par...
import java.io.InputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { resolve(System.in, System.out); } static void resolve(InputStream is, PrintStream pw) { Scanner sc = new Scanner(is); int n = Integer.par...
[["-", 0, 16, 31, 74, 51, 23, 0, 16, 17, 85], ["-", 0, 16, 31, 74, 51, 23, 0, 16, 12, 515], ["+", 0, 16, 31, 74, 51, 23, 0, 16, 17, 48], ["+", 0, 16, 31, 74, 51, 23, 0, 16, 12, 499], ["-", 0, 195, 8, 196, 0, 37, 0, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 37, 0, 16, 12, 515]]
3
295
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0,...
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0,...
[["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
459
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; int main() { ll n; cin >> n; vector<ll> a(n), b(n); for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); long double med_min = (n % 2 == 0) ? (a[...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; int main() { ll n; cin >> n; vector<ll> a(n), b(n); for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); double med_min = (n % 2 == 0) ? (a[n / 2] + a[...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 41, 64, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 41, 64, 16, 12, 2, 3, 4, 0, 25]]
1
221
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) using namespace std; template <class T> bool chmax(T &a, const T &b) { if (b > a) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } // const long...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) using namespace std; template <class T> bool chmax(T &a, const T &b) { if (b > a) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } // const long...
[["-", 31, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 72]]
1
322
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> ls(N), rs(N); for (int i = 0; i < N; ++i) { cin >> ls[i] >> rs[i]; } sort(ls.begin(), ls.end()); sort(rs.begin(), rs.end()); int ans = 0; if (N % 2 == 1) { ans = rs[N / 2]...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> ls(N), rs(N); for (int i = 0; i < N; ++i) { cin >> ls[i] >> rs[i]; } sort(ls.begin(), ls.end()); sort(rs.begin(), rs.end()); int ans = 0; if (N % 2 == 1) { ans = rs[N / 2]...
[["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
180
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; using namespace std; typedef long long int lli; #define int lli typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<lli> vli; typedef vector<pii> vii; // typedef tree<int, null_type, less<int>, rb_tree_ta...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; using namespace std; typedef long long int lli; #define int lli typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<lli> vli; typedef vector<pii> vii; // typedef tree<int, null_type, less<int>, rb_tree_ta...
[["-", 12, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 73]]
1
398
N = int(input()) listA = [0] * N listB = [0] * N idx = 0 for i in range(N): listA[idx],listB[idx] = map(int, input().split()) idx += 1 medianA = 0 medianB = 0 ans = 0 if N%2 == 0: medianA = statistics.median(listA) medianB = statistics.median(listB) ans = (medianB - medianA) * 2 + 1 else: medianA = statist...
import statistics import math N = int(input()) listA = [0] * N listB = [0] * N idx = 0 for i in range(N): listA[idx],listB[idx] = map(int, input().split()) idx += 1 medianA = 0 medianB = 0 ans = 0 if N%2 == 0: medianA = statistics.median(listA) medianB = statistics.median(listB) ans = (medianB - medianA) * ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
133
#include <algorithm> #include <iostream> using namespace std; int main() { int n, count_median; double a_median, b_median; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } sort(a, a + n); sort(b, b + n); if (n % 2 == 0) { a_median = (a[n / 2 - 1] + a[n / 2]) / 2...
#include <algorithm> #include <iostream> using namespace std; int main() { int n, count_median; double a_median, b_median; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } sort(a, a + n); sort(b, b + n); if (n % 2 == 0) { a_median = (a[n / 2 - 1] + a[n / 2]) / 2...
[["+", 31, 74, 51, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 74, 51, 23, 0, 25]]
1
203
N=int(input()) A=[] B=[] for i in range(N): a,b=map(int,input().split()) A.append(a) B.append(b) A.sort() B.sort() if N%2!=0: n=(N+1)//2 ans=B[n-1]-A[n-1]+1 else: n=N//2 ans1=(A[n-1]+A[n])//2 ans2=(B[n-1]+B[n])//2 ans=(ans2-ans1)*2+1 print(ans)
N=int(input()) A=[] B=[] for i in range(N): a,b=map(int,input().split()) A.append(a) B.append(b) A.sort() B.sort() if N%2!=0: n=(N+1)//2 ans=B[n-1]-A[n-1]+1 else: n=N//2 ans1=(A[n-1]+A[n])/2 ans2=(B[n-1]+B[n])/2 ans=(ans2-ans1)*2+1 print(int(ans))
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
151
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> typedef long long ll; const ll MOD = 1e9 + 7; const long long INF = 1LL << 60; const double PI = 3.14159265358979323846; const int NMAX = 100005; using namespace std; int main()...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> typedef long long ll; const ll MOD = 1e9 + 7; const long long INF = 1LL << 60; const double PI = 3.14159265358979323846; const int NMAX = 100005; using namespace std; int main()...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]]
1
265
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //required //#include <ext/pb_ds/tree_policy.hpp> #define ll long long #define lb long double #define pb push_back #define loop(i, start, n) for (ll i = start; i < n; i++) #define rloop(i, n, start) for (ll i = n; i >= start; i--) #define mod 100000000...
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //required //#include <ext/pb_ds/tree_policy.hpp> #define ll long long #define lb long double #define pb push_back #define loop(i, start, n) for (ll i = start; i < n; i++) #define rloop(i, n, start) for (ll i = n; i >= start; i--) #define mod 100000000...
[["-", 75, 76, 0, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
727
#include <bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; #define ll long long #define ld long double #define fi first #define se second #define sz(x) x.size() #define mp make_pai...
#include <bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; #define ll long long #define ld long double #define fi first #define se second #define sz(x) x.size() #define mp make_pai...
[["-", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 1, 0, 16, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 16, 12, 16, 31, 16, 17, 33], ["-", 12, 16, 31, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72]]
1
369
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) int solution(vector<int> &A, vector<int> &B) { int N = A.size(); sort(A.begin(), A.end()); sort(B.begin(), B.end())...
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) int solution(vector<int> &A, vector<int> &B) { int N = A.size(); sort(A.begin(), A.end()); sort(B.begin(), B.end())...
[["-", 75, 76, 0, 9, 0, 37, 0, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 37, 0, 16, 12, 13]]
1
220
/* * author: calgagi * Calvin Gagliano */ #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ii pair<int, int> #define ar array #define f first #define s second #define dd long double void solve() { int n; cin >> n; vector<int> a(n), b(n); for...
/* * author: calgagi * Calvin Gagliano */ #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ii pair<int, int> #define ar array #define f first #define s second #define dd long double void solve() { int n; cin >> n; vector<ll> a(n), b(n); for ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33]]
1
293
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); typedef long long ll; typedef long double ld; const int N = (int)1e5 + 7; int n; int a[N]; int b[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n;...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); typedef long long ll; typedef long double ld; const int N = (int)2e5 + 7; int n; int a[N]; int b[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n;...
[["-", 0, 43, 49, 50, 51, 16, 31, 74, 51, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 72], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
240
#include <bits/stdc++.h> using namespace std; using ll = long long; using p = pair<ll, ll>; constexpr ll INF = 1LL << 62; int main(void) { ll N; cin >> N; vector<ll> A, B; for (ll i = 0; i < N; i++) { ll a, b; cin >> a >> b; A.emplace_back(a); B.emplace_back(b); } sort(A.begin(), A.end())...
#include <bits/stdc++.h> using namespace std; using ll = long long; using p = pair<ll, ll>; constexpr ll INF = 1LL << 62; int main(void) { ll N; cin >> N; vector<ll> A, B; for (ll i = 0; i < N; i++) { ll a, b; cin >> a >> b; A.emplace_back(a); B.emplace_back(b); } sort(A.begin(), A.end())...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22]]
1
239
N=gets.to_i A,B=$<.map{|e|e.split.map &:to_i}.transpose.map &:sort h=N/2 p 1+(N.odd?? B[h]-A[h]:B[h]+A[h]-B[h-=1]-A[h])
N=gets.to_i A,B=$<.map{|e|e.split.map &:to_i}.transpose.map &:sort h=N/2 p 1+(N.odd?? B[h]-A[h]:B[h]-A[h]+B[h-=1]-A[h])
[["-", 0, 754, 75, 738, 31, 738, 31, 738, 17, 72], ["+", 0, 754, 75, 738, 31, 738, 31, 738, 17, 33], ["-", 12, 739, 0, 754, 75, 738, 31, 738, 17, 33], ["+", 12, 739, 0, 754, 75, 738, 31, 738, 17, 72]]
4
75
#pragma GCC optimize("O3") #include <algorithm> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <unordered_set> using namespace std; using QWORD = uint64...
#pragma GCC optimize("O3") #include <algorithm> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <unordered_set> using namespace std; using QWORD = uint64...
[["-", 64, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 64, 9, 0, 43, 49, 50, 51, 69, 28, 22]]
1
1,540
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("avx") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int(i) = 0; i < (n); i++) #define rrep(i, n) for (int(i) = 1; i <= (n); i++) #define REP(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define MOD 1000000007...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("avx") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int(i) = 0; i < (n); i++) #define rrep(i, n) for (int(i) = 1; i <= (n); i++) #define REP(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define MOD 1000000007...
[["-", 12, 16, 31, 16, 12, 23, 0, 16, 17, 48], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72]]
1
439
n = int(input()) x = [list(map(int, input().split())) for _ in range(n)] y = sorted(x) z = sorted(x, key=lambda x: x[1]) if n % 2 == 1: print(z[n//2][1] - y[n//2][0] + 1) else: a = y[n//2-1][0] b = y[n//2][0] c = z[n//2-1][1] d = z[n//2][1] e = (b + d) / 2 f = (a + c) / 2 print(int((e -...
n = int(input()) x = [list(map(int, input().split())) for _ in range(n)] y = sorted(x) z = sorted(x, key=lambda x: x[1]) if n % 2 == 1: print(z[n//2][1] - y[n//2][0] + 1) else: a = y[n//2-1][0] b = y[n//2][0] c = z[n//2-1][1] d = z[n//2][1] e = (c + d) / 2 f = (a + b) / 2 print(int((e -...
[["-", 0, 662, 12, 657, 31, 23, 0, 657, 31, 22], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 31, 22], ["-", 0, 662, 12, 657, 31, 23, 0, 657, 12, 22], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 22]]
5
170
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); List<Integer> min = new ArrayList<>(); List<Integer> max = new Arra...
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); List<Integer> min = new ArrayList<>(); List<Integer> max = new Arra...
[["-", 0, 492, 3, 4, 0, 16, 31, 16, 17, 85], ["-", 0, 492, 3, 4, 0, 16, 31, 16, 12, 499]]
3
241
#include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define eb emplace_back #define mp make_pair #define mt make_tuple #define pii pair<int, int> #define pll pair<long long, long long> #define vl vector<long long> #define vll vector<pll> #define vi vector<int> #define vii vector<pii> #defin...
#include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define eb emplace_back #define mp make_pair #define mt make_tuple #define pii pair<int, int> #define pll pair<long long, long long> #define vl vector<long long> #define vll vector<pll> #define vi vector<int> #define vii vector<pii> #defin...
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 31, 13], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 31, 16, 12, 23, 0, 16, 31, 16, 17, 85], ["-", 31, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["-", 31, 16, 12, 23, 0, 16, 12, 16, 17, 85], ["-", 31, 16, 12, 23, 0, 16, 12, 16, 12, 13]]
1
572
/* Tue 02 Jun 2020 10:28:22 PM PDT */ #include <bits/stdc++.h> using namespace std; #define rep(i, r) for (int i = 0; i < (r); i++) #define pb push_back #define ALL(a) a.begin(), a.end() #define fastio \ ios::sync_with_stdio(0); ...
/* Tue 02 Jun 2020 10:28:22 PM PDT */ #include <bits/stdc++.h> using namespace std; #define rep(i, r) for (int i = 0; i < (r); i++) #define pb push_back #define ALL(a) a.begin(), a.end() #define fastio \ ios::sync_with_stdio(0); ...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
196
n=int(input()) alis=[] blis=[] for i in range(n): a,b=map(int,input().split()) alis.ppend(a) blis.append(b) alis=sorted(alis) blis=sorted(blis) if n%2!=0: print(blis[int((n-1)/2)]-alis[int((n-1)/2)]+1) else: bb=(blis[int(n/2)-1]+blis[int(n/2)]) aa=(alis[int(n/2)-1]+alis[int(n/2)]) print(bb-aa+1)
n=int(input()) alis=[] blis=[] for i in range(n): a,b=map(int,input().split()) alis.append(a) blis.append(b) alis=sorted(alis) blis=sorted(blis) if n%2!=0: print(blis[int((n-1)/2)]-alis[int((n-1)/2)]+1) else: bb=(blis[int(n/2)-1]+blis[int(n/2)]) aa=(alis[int(n/2)-1]+alis[int(n/2)]) print(bb-aa+1)
[["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22]]
5
163
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 2e5 + 5; LL a[maxn]; LL b[maxn]; int main(void) { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%lld%lld", &a[i], &b[i]); sort(a + 1, a + 1 + n); sort(b + 1, b + 1 + n); LL res; if (n & 1) { res = (b...
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 2e5 + 5; LL a[maxn]; LL b[maxn]; int main(void) { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%lld%lld", &a[i], &b[i]); sort(a + 1, a + 1 + n); sort(b + 1, b + 1 + n); LL res; if (n & 1) { res = (b...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 85], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13]]
1
211
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int l[maxn], r[maxn]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> l[i] >> r[i]; sort(l + 1, l + 1 + n); sort(r + 1, r + 1 + n); int a = (n & 1) ? l[(n + 1) / 2] : l[n / 2] + l[n / 2 + 1]; int b = (n & 1) ? r...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int l[maxn], r[maxn]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> l[i] >> r[i]; sort(l + 1, l + 1 + n); sort(r + 1, r + 1 + n); int a = (n & 1) ? l[(n + 1) / 2] : l[n / 2] + l[n / 2 + 1]; int b = (n & 1) ? r...
[["-", 75, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 51, 41, 75, 16, 12, 69, 341, 342, 0, 73]]
1
175
#include <bits/stdc++.h> using namespace std; int a[200010], b[200010]; int main() { int n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } sort(a, a + n); sort(b, b + n); if (n & 1) { cout << b[n / 2] - a[n / 2] + 1 << endl; } else { cout << b[n / 2] + b[n / 2 - 1] - a[n / 2] - a[n / 2 -...
#include <bits/stdc++.h> using namespace std; int a[200010], b[200010]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } sort(a, a + n); sort(b, b + n); if (n & 1) { cout << b[n / 2] - a[n / 2] + 1 << endl; } else { cout << b[n / 2] + b[n / 2 - 1] - a[n / 2]...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
144
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) (a).begin(), (a).end() typedef vector<int> vi; const int INF = 1LL << 60; // 10e18+10e17ちょっとくらい const int MOD = 1000000007; const int MAX_N = 200100; signed main() { /...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) (a).begin(), (a).end() typedef vector<int> vi; const int INF = 1LL << 60; // 10e18+10e17ちょっとくらい const int MOD = 1000000007; const int MAX_N = 200100; signed main() { /...
[["-", 31, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
213
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define sz(v) (int)((v).size()) #define pb push_back #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> d(n), f(n); for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define sz(v) (int)((v).size()) #define pb push_back #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> d(n), f(n); for (int i = 0; i < n; i++) { ...
[["+", 31, 16, 12, 16, 31, 16, 31, 91, 17, 33]]
1
232
import sys def input(): return sys.stdin.readline().rstrip() def main(): n=int(input()) A,B=[0]*n,[0]*n for i in range(n): A[i],B[i]=map(int,input().split()) A.sort() B.sort() if n%2==1: print(B[n//2]-A[n//2]+1) else: print(int((B[n//2-1]+B[n//2])/2-(A[n//2-1]+A[n//2]...
import sys def input(): return sys.stdin.readline().rstrip() def main(): n=int(input()) A,B=[0]*n,[0]*n for i in range(n): A[i],B[i]=map(int,input().split()) A.sort() B.sort() if n%2==1: print(B[n//2]-A[n//2]+1) else: print(int(((B[n//2-1]+B[n//2])/2-(A[n//2-1]+A[n//2...
[["+", 31, 23, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
173
N = int(input()) A_list = [0]*N B_list = [0]*N for i in range(N): A_list[i],B_list[i] = map(int,input().split()) A_list.sort() B_list.sort() if N%2 == 1: print(B_list[(N+1)//2] - A_list[(N+1)//2] + 1) else: big = (B_list[N//2] + B_list[N//2-1])/2 small = (A_list[N//2] + A_list[N//2-1])/2 print(int...
N = int(input()) A_list = [0]*N B_list = [0]*N for i in range(N): A_list[i],B_list[i] = map(int,input().split()) A_list.sort() B_list.sort() if N%2 == 1: print(B_list[(N-1)//2] - A_list[(N-1)//2] + 1) else: big = (B_list[N//2] + B_list[N//2-1])/2 small = (A_list[N//2] + A_list[N//2-1])/2 print(int...
[["-", 31, 206, 206, 657, 31, 23, 0, 657, 17, 72], ["+", 31, 206, 206, 657, 31, 23, 0, 657, 17, 33], ["-", 12, 206, 206, 657, 31, 23, 0, 657, 17, 72], ["+", 12, 206, 206, 657, 31, 23, 0, 657, 17, 33]]
5
154
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using P = pair<int, int>; using ll = long long; const int INF = 1001001001; int main() { int n; cin >> n; vector<int> ls(n), rs(n); rep(i, n) { cin >> ls[i] >> rs[i]; } sort(ls.begin(), ls.end()); sort(rs.begin(),...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using P = pair<int, int>; using ll = long long; const int INF = 1001001001; int main() { int n; cin >> n; vector<int> ls(n), rs(n); rep(i, n) { cin >> ls[i] >> rs[i]; } sort(ls.begin(), ls.end()); sort(rs.begin(),...
[["-", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
215
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; int main(int argc, char *argv[]) { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<int> A(n), B(n); for (int i = 0; i < n; i++) { cin >> A[i] >> B[i]; } sort(A.b...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; int main(int argc, char *argv[]) { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<int> A(n), B(n); for (int i = 0; i < n; i++) { cin >> A[i] >> B[i]; } sort(A.b...
[["+", 31, 16, 12, 16, 31, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 16, 12, 23, 0, 25]]
1
204
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n % 2 == 0) { long long min = a[n / 2 - 1] + a[n / 2]; long long max = a[n / 2 - 1...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n % 2 == 0) { long long min = a[n / 2 - 1] + a[n / 2]; long long max = b[n / 2 - 1...
[["-", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22]]
1
185
#include <bits/stdc++.h> #include <cmath> using namespace std; using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using pll = pair<ll, ll>; template <typename L, typename R> ostream &operator<<(ostream &out, const pair<L, R> &p) { out << "(" << p.first << ", " << p.second << ")"; return out; } ...
#include <bits/stdc++.h> #include <cmath> using namespace std; using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using pll = pair<ll, ll>; template <typename L, typename R> ostream &operator<<(ostream &out, const pair<L, R> &p) { out << "(" << p.first << ", " << p.second << ")"; return out; } ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
413
N = int(input()) A = [list(map(int, input().split())) for _ in range(N)] AX = [A[i][0] for i in range(N)] BX = [A[i][1] for i in range(N)] AX.sort() BX.sort() if N % 2 == 1: L = AX[(N-1)//2] R = BX[(N-1)//2] print(R-L+1) else: L = AX[N//2] + AX[N//2] R = BX[N//2] + BX[N//2] print(R-L+1)
N = int(input()) A = [list(map(int, input().split())) for _ in range(N)] AX = [A[i][0] for i in range(N)] BX = [A[i][1] for i in range(N)] AX.sort() BX.sort() if N % 2 == 1: L = AX[(N-1)//2] R = BX[(N-1)//2] print(R-L+1) else: L = AX[N//2-1] + AX[N//2] R = BX[N//2-1] + BX[N//2] print(R-L+1)
[["+", 0, 662, 12, 657, 31, 206, 206, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 206, 206, 657, 12, 612]]
5
159
#include <bits/stdc++.h> #define ll long long #define mod 1e9 + 7 #define decimalupto(no, y) fixed << setprecision(y) << no using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; vector<ll> a(n), b(n); for (ll i = 0; i < n; ++i) { cin >> a[i] >> b[i...
#include <bits/stdc++.h> #define ll long long #define mod 1e9 + 7 #define decimalupto(no, y) fixed << setprecision(y) << no using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; vector<ll> a(n), b(n); for (ll i = 0; i < n; ++i) { cin >> a[i] >> b[i...
[["+", 0, 11, 12, 16, 31, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 16, 12, 23, 0, 25]]
1
204
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pii; const int N = 2e5 + 5; const int M = 1e6 + 5; const LL Mod = 1e18; #define pi acos(-1) #define INF 1e8 #define INM INT_MIN #define pb(a) push_back(a) #define mk(a, b) make_pair(a, b) #define dbg(x) cout << "now this num is "...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pii; const int N = 2e5 + 5; const int M = 1e6 + 5; const LL Mod = 1e18; #define pi acos(-1) #define INF 1e8 #define INM INT_MIN #define pb(a) push_back(a) #define mk(a, b) make_pair(a, b) #define dbg(x) cout << "now this num is "...
[["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 85], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
333
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9 + 7; int main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a.at(i) >> b.at(i); } sort(a.begin(), a.end()); sort(b.rbegin(), b.rend()); if (n % 2) { int low, high; l...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9 + 7; int main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a.at(i) >> b.at(i); } sort(a.begin(), a.end()); sort(b.rbegin(), b.rend()); if (n % 2) { int low, high; l...
[["-", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22], ["+", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22]]
1
236
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) #define PI 3.14159265358979323846 #define vl vector<long long> using namespace std; using ll = long long; using ld = long double; // ----本問について---- // 問題: // 問題文URL: // ------------------ // ----ここから本問のソースコード---- // グローバル変数(入力) ll n; vl A, B; voi...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) #define PI 3.14159265358979323846 #define vl vector<long long> using namespace std; using ll = long long; using ld = long double; // ----本問について---- // 問題: // 問題文URL: // ------------------ // ----ここから本問のソースコード---- // グローバル変数(入力) ll n; vl A, B; voi...
[["+", 3, 4, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
246
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define COUT(x) cout << #x << " = " << (x) << " (L" << __...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define COUT(x) cout << #x << " = " << (x) << " (L" << __...
[["-", 51, 16, 31, 23, 0, 16, 31, 69, 28, 22], ["+", 51, 16, 31, 23, 0, 16, 31, 69, 28, 22], ["-", 51, 16, 31, 23, 0, 16, 12, 69, 28, 22], ["+", 51, 16, 31, 23, 0, 16, 12, 69, 28, 22], ["-", 0, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 9, 0, 43, 49, 50, 51, 69, 28, 22]]
1
645
N = int(input()) A = [0] * N B = [0] * N for i in range(N): A[i], B[i] = map(int, input().split()) A.sort() B.sort() print(A, B) if N % 2 == 0: n1 = N // 2 - 1 n2 = N // 2 ans = B[n1] - A[n1] + B[n2] - A[n2] + 1 print(ans) else: n = N // 2 ans = B[n] - A[n] + 1 print(ans)
N = int(input()) A = [0] * N B = [0] * N for i in range(N): A[i], B[i] = map(int, input().split()) A.sort() B.sort() if N % 2 == 0: n1 = N // 2 - 1 n2 = N // 2 ans = B[n1] - A[n1] + B[n2] - A[n2] + 1 print(ans) else: n = N // 2 ans = B[n] - A[n] + 1 print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
138
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 3e3 + 5, mod = 998244353; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> v, v2; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; v.push_back(x); v2.push...
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 3e3 + 5, mod = 998244353; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> v, v2; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; v.push_back(x); v2.push...
[["-", 12, 16, 31, 16, 31, 16, 31, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 17, 72], ["-", 0, 1, 0, 16, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 16, 12, 16, 31, 16, 17, 33]]
1
199
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <se...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <se...
[["+", 49, 50, 51, 16, 31, 2, 63, 23, 0, 22], ["+", 49, 50, 51, 16, 31, 2, 63, 23, 0, 25], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 16, 31, 2, 63, 23, 0, 24]]
1
272
#include <bits/stdc++.h> using namespace std; #define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i) #define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i) #define REP(i, n) rep(i, 0, n) #define REP2(i, n) rep2(i, 0, n) #define FOR(i, c) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i) #define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i) #define REP(i, n) rep(i, 0, n) #define REP2(i, n) rep2(i, 0, n) #define FOR(i, c) ...
[["-", 64, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 64, 9, 0, 43, 49, 50, 51, 69, 28, 22]]
1
577
/* #region Head */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pll = pair<ll, ll>; template <class T> using vc = vector<T>; template <class T> using vvc = vc<vc<T>>; using vll = vc<ll>; using vvll = vvc<ll>; using vld = vc<ld>; usin...
/* #region Head */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pll = pair<ll, ll>; template <class T> using vc = vector<T>; template <class T> using vvc = vc<vc<T>>; using vll = vc<ll>; using vvll = vvc<ll>; using vld = vc<ld>; usin...
[["-", 0, 11, 12, 23, 0, 16, 31, 69, 28, 22], ["+", 0, 11, 12, 23, 0, 16, 31, 69, 28, 22], ["-", 0, 11, 12, 23, 0, 16, 12, 69, 28, 22], ["+", 0, 11, 12, 23, 0, 16, 12, 69, 28, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
1,429
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define repp(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) #define pb push_back #define mp m...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define repp(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) #define pb push_back #define mp m...
[["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
234
import numpy as np N = int(input()) table = np.array([list(map(int, input().split())) for _ in range(N)]) inf, sup = np.median(table, axis=0) diff = int(sup - inf) if N % 2 == 0: diff *= 2 print(diff + 1)
import numpy as np N = int(input()) table = np.array([list(map(int, input().split())) for _ in range(N)]) inf, sup = np.median(table, axis=0) diff = sup - inf if N % 2 == 0: diff *= 2 print(int(diff + 1))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
81
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <typename T1, typename T2> bool chmin(T1 &a, T2 b) { if (a <= b) return 0; a = b; return 1; } template <typename T1, typename T2> bool chmax(T1 &a, T2 b) { if (a >= b) return 0; a = b; return 1; } int dx[4] = {0, 1, 0, -1},...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <typename T1, typename T2> bool chmin(T1 &a, T2 b) { if (a <= b) return 0; a = b; return 1; } template <typename T1, typename T2> bool chmax(T1 &a, T2 b) { if (a >= b) return 0; a = b; return 1; } int dx[4] = {0, 1, 0, -1},...
[["-", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13]]
1
315
N = int(input()) import numpy as np A = [0]*N B = [0]*N for i in range(N): A[i], B[i] = map(int,input().split()) na = np.median(A) nb = np.median(B) if N%2 == 1: ans = int(nb - na + 1) print(ans) exit() else: ans = 2*int(nb - na) + 1 print(ans) exit()
N = int(input()) import numpy as np A = [0]*N B = [0]*N for i in range(N): A[i], B[i] = map(int,input().split()) na = np.median(A) nb = np.median(B) if N%2 == 1: ans = int(nb - na + 1) print(ans) exit() else: ans = int(2*(nb - na)) + 1 print(ans) exit()
[["+", 0, 1, 0, 662, 12, 657, 31, 652, 63, 22], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 24], ["-", 0, 662, 12, 657, 31, 657, 12, 652, 63, 22], ["+", 31, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
117
n = int(input()) a = [] b = [] for i in range(n): ai,bi = [int(j) for j in input().split()] a.append(ai) b.append(bi) a.sort() b.sort() if n == 1: ans = b[0] - a[0] + 1 elif n % 2 == 1: tg = (n+1) // 2 ans = b[-tg] + a[tg-1] + 1 else: tg = n//2 ans = b[-tg] + b[-tg-1] - a[tg-1] - a[tg] +1 print(...
n = int(input()) a = [] b = [] for i in range(n): ai,bi = [int(j) for j in input().split()] a.append(ai) b.append(bi) a.sort() b.sort() if n == 1: ans = b[0] - a[0] + 1 elif n % 2 == 1: tg = (n+1) // 2 ans = b[-tg] - a[tg-1] + 1 else: tg = n//2 ans = b[-tg] + b[-tg-1] - a[tg-1] - a[tg] +1 print(...
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 72], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 33]]
5
156
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define F first #define S second #define pii pair<int, int> #define pll pair<ll, ll> #define pcc pair<char, char> #define vi vector<int> #define vl vector<ll> #define sd(x) scanf("%d", &x) #define slld(x) scanf("%lld", &x) #define p...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define F first #define S second #define pii pair<int, int> #define pll pair<ll, ll> #define pcc pair<char, char> #define vi vector<int> #define vl vector<ll> #define sd(x) scanf("%d", &x) #define slld(x) scanf("%lld", &x) #define p...
[["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 13], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 13]]
1
513
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor, co...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor, co...
[["-", 3, 4, 0, 657, 31, 657, 12, 657, 17, 48], ["-", 3, 4, 0, 657, 31, 657, 12, 657, 12, 612]]
5
437
import sys def input(): return sys.stdin.readline()[:-1] n = int(input()) seg = [list(map(int, input().split())) for _ in range(n)] a = [x[0] for x in seg] b = [x[1] for x in seg] a.sort() b.sort() if n%2 == 1: print(b[n//2] - a[n//2] + 1) else: print(b[n//2] + a[n//2] - b[n//2-1] - a[n//2-1] + 1)
import sys def input(): return sys.stdin.readline()[:-1] n = int(input()) seg = [list(map(int, input().split())) for _ in range(n)] a = [x[0] for x in seg] b = [x[1] for x in seg] a.sort() b.sort() if n%2 == 1: print(b[n//2] - a[n//2] + 1) else: print(b[n//2] - a[n//2] + b[n//2-1] - a[n//2-1] + 1)
[["-", 0, 657, 31, 657, 31, 657, 31, 657, 17, 72], ["+", 0, 657, 31, 657, 31, 657, 31, 657, 17, 33], ["-", 3, 4, 0, 657, 31, 657, 31, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 72]]
5
151
n = int(input()) a = [] b = [] for _ in range(n): atmp, btmp = map(int, input().split()) a.append(atmp) b.append(btmp) a.sort() b.sort() if n % 2 == 1: pos = n // 2 print(b[pos] - a[pos] + 1) else: pos = n // 2 - 1 a1 = a[pos] a2 = a[pos + 1] b1 = b[pos] b2 = b[pos + 1] medmi...
n = int(input()) a = [] b = [] for _ in range(n): atmp, btmp = map(int, input().split()) a.append(atmp) b.append(btmp) a.sort() b.sort() if n % 2 == 1: pos = n // 2 print(b[pos] - a[pos] + 1) else: pos = n // 2 - 1 a1 = a[pos] a2 = a[pos + 1] b1 = b[pos] b2 = b[pos + 1] medmi...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
143
n = int(input()) bounds = [list(map(int, input().split())) for _ in range(n)] upper = [b[1] for b in bounds] lower = [b[0] for b in bounds] if n % 2 == 0: u_mid2 = upper[n // 2 - 1] + upper[n // 2] l_mid2 = lower[n // 2 - 1] + lower[n // 2] print(u_mid2 - l_mid2 + 1) else: print(upper[n // 2] - lower[n // 2] + 1)
n = int(input()) bounds = [list(map(int, input().split())) for _ in range(n)] upper = sorted([b[1] for b in bounds]) lower = sorted([b[0] for b in bounds]) if n % 2 == 0: u_mid2 = upper[n // 2 - 1] + upper[n // 2] l_mid2 = lower[n // 2 - 1] + lower[n // 2] print(u_mid2 - l_mid2 + 1) else: print(upper[n // 2] - low...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
127
N = int(input()) A = [] B = [] for i in range(N): a,b = list(map(int,input().split())) A.append(a) B.append(b) A.sort() B.sort() if N%2==1: print(B[(N-1)//2] - A[(N-1)//2]+1) else: b1 = B[(N-2)//2] b2 = B[N//2] a1 = A[(N-2)//2] a2 = A[N//2] print(a2 + b2 - (a1 + b1) + 1)
N = int(input()) A = [] B = [] for i in range(N): a,b = list(map(int,input().split())) A.append(a) B.append(b) A.sort() B.sort() if N%2==1: print(B[(N-1)//2] - A[(N-1)//2]+1) else: b1 = B[(N-2)//2] b2 = B[N//2] a1 = A[(N-2)//2] a2 = A[N//2] print(b1 + b2 - (a1 + a2) + 1) #print...
[["-", 3, 4, 0, 657, 31, 657, 31, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 22], ["-", 0, 657, 31, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 12, 22]]
5
154
n,*ab = map(int,open(0).read().split()) a = ab[::2] b = ab[1::2] a.sort() b.sort(reverse=True) if n%2 == 1: med_min = a[(n-1)//2] med_max = b[(n-1)//2] ans = med_max - med_min + 1 else: med_min = (a[n//2-1] + a[n//2] ) //2 med_max = (b[n//2-1] + b[n//2] ) //2 ans = (med_max - med_min)*2 + 1 pr...
n,*ab = map(int,open(0).read().split()) a = ab[::2] b = ab[1::2] a.sort() b.sort(reverse=True) if n%2 == 1: med_min = a[(n-1)//2] med_max = b[(n-1)//2] ans = med_max - med_min + 1 else: med_min = (a[n//2-1] + a[n//2] ) /2 med_max = (b[n//2-1] + b[n//2] ) /2 ans = (med_max - med_min)*2 + 1 prin...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
149
import math import fractions import collections import itertools import pprint N=int(input()) l=[list(map(int,input().split())) for _ in range(N)] l1=[] l2=[] for i in range(N): l1.append(l[i][0]) l2.append(l[i][1]) l1.sort() l2.sort() if N%2==0: minmed=(l1[N//2]+l1[N//2-1])//2 maxmed=(l2[N//2]+l2[N//2-...
import math import fractions import collections import itertools import pprint N=int(input()) l=[list(map(int,input().split())) for _ in range(N)] l1=[] l2=[] for i in range(N): l1.append(l[i][0]) l2.append(l[i][1]) l1.sort() l2.sort() if N%2==0: minmed=(l1[N//2]+l1[N//2-1])/2 maxmed=(l2[N//2]+l2[N//2-1...
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
181