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
// skip until line 65 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <numeric> #include <ostream>...
// skip until line 65 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <numeric> #include <ostream>...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 51, 16, 31, 16, 12, 16, 31, 16, 31, 13], ["+", 51, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["+", 51, 16, 31, 16, 12, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 12, 16...
1
411
import sys #import numpy as np import math #from fractions import Fraction #import itertools #from collections import deque #import heapq #from fractions import gcd input=sys.stdin.readline n=int(input()) def factorize(n): fct={} temp=n if temp<4: fct[temp]=1 else: e=0 while tem...
import sys #import numpy as np import math #from fractions import Fraction #import itertools #from collections import deque #import heapq #from fractions import gcd input=sys.stdin.readline n=int(input()) def factorize(n): fct={} temp=n if temp<4: fct[temp]=1 else: e=0 while tem...
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
203
#include <bits/stdc++.h> using namespace std; #define pi 3.14159265358979 #define mod 1000000007 #define ll long long int #define rep(i, a, b) for (ll i = a; i < b; i++) #define repn(i, a, b) for (ll i = a; i > b; i--) #define mod1 1000003 #define mod2 998244353 #define inf 2e18 #define hi "hello" #define nl "\n" #def...
#include <bits/stdc++.h> using namespace std; #define pi 3.14159265358979 #define mod 1000000007 #define ll long long int #define rep(i, a, b) for (ll i = a; i < b; i++) #define repn(i, a, b) for (ll i = a; i > b; i--) #define mod1 1000003 #define mod2 998244353 #define inf 2e18 #define hi "hello" #define nl "\n" #def...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
499
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define ret return #define PB push_back #define lc 2 * v #define rc 2 * v + 1 #define mid (s + e) / 2 #define pii pair<int, int> #define pll pair<long long, long long> #define FAST ...
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define ret return #define PB push_back #define lc 2 * v #define rc 2 * v + 1 #define mid (s + e) / 2 #define pii pair<int, int> #define pll pair<long long, long long> #define FAST ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
279
n=int(input()) def prime_factorize(n): a=[] while n%2==0: a.append(2) n//=2 f=3 while f**2<=n: if n%f==0: a.append(f) n//=f else: f+=2 if n!=1: a.append(n) return(a) import collections A=collections.Counter(prime_factori...
n=int(input()) def prime_factorize(n): a=[] while n%2==0: a.append(2) n//=2 f=3 while f**2<=n: if n%f==0: a.append(f) n//=f else: f+=2 if n!=1: a.append(n) return(a) import collections A=collections.Counter(prime_factori...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 19], ["+", 8, 196, 0, 52, 15, 666, 0, 657, 17, 48], ["+", 8, 196, 0, 52, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
138
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #includ...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #includ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
270
#include <bits/stdc++.h> #define REP(i, e) for (int(i) = 0; (i) < (e); ++(i)) #define FOR(i, b, e) for (int(i) = (b); (i) < (e); ++(i)) #define ALL(c) (c).begin(), (c).end() #define PRINT(x) cout << (x) << "\n" using namespace std; using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>; template <t...
#include <bits/stdc++.h> #define REP(i, e) for (int(i) = 0; (i) < (e); ++(i)) #define FOR(i, b, e) for (int(i) = (b); (i) < (e); ++(i)) #define ALL(c) (c).begin(), (c).end() #define PRINT(x) cout << (x) << "\n" using namespace std; using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>; template <t...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
219
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n ** 0.5 // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if ar...
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n ** 0.5 // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if ar...
[["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
184
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #ifdef ENABLE_DEBUG #define dump(a) cerr << #a << "=" << a << endl #define dumparr(a, n) cerr << #a << "[" << n << "]=" << a[n] << endl #else #define dump(a) #define du...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #ifdef ENABLE_DEBUG #define dump(a) cerr << #a << "=" << a << endl #define dumparr(a, n) cerr << #a << "[" << n << "]=" << a[n] << endl #else #define dump(a) #define du...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
599
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; const ll MOD = 998244353; const ll INF = 4611686018427387903; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() int main() { ll n; cin >> n; ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; const ll MOD = 998244353; const ll INF = 4611686018427387903; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() int main() { ll n; cin >> n; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
167
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <ostream> #...
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <ostream> #...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
756
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|...
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|...
[["-", 8, 736, 0, 89, 8, 170, 0, 755, 12, 612], ["+", 8, 736, 0, 89, 8, 170, 0, 755, 12, 22]]
4
323
n = int(input()) if n == 1: print(0) exit() tmp = n ans = 0 for i in range(2, int(-(-n**0.5//1)+1)): if tmp % i == 0: cnt = 0 while tmp % i == 0: cnt += 1 tmp //= i i_cnt = int((cnt*2)**0.5//1) if i_cnt * (i_cnt+1) //2 <= cnt and (i_cnt+1) * (i_cnt+1...
n = int(input()) if n == 1: print(0) exit() tmp = n ans = 0 for i in range(2, int(-(-n**0.5//1)+1)): if tmp % i == 0: cnt = 0 while tmp % i == 0: cnt += 1 tmp //= i i_cnt = int((cnt*2)**0.5//1) if i_cnt * (i_cnt+1) //2 <= cnt and (i_cnt+1) * (i_cnt+2...
[["-", 0, 657, 31, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 12, 612]]
5
160
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): N = read_int() if N == 1: return 0 max_divisor = math.sqrt(N) divisor = 2 counter = 0 while divisor <= max_divisor: temp_divisor =...
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): N = read_int() if N == 1: return 0 max_divisor = math.sqrt(N) divisor = 2 counter = 0 while divisor <= max_divisor: temp_divisor =...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]...
5
136
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1000000007; const ll MOD2 = 998244353; const double PI = acos(-1); const ll INF = 1e18; typedef pair<ll, ll> P; typedef vector<ll> vl; typedef vector<vl> vvl; #define FOR(i, a, b) for (ll i = a; i < b; i++) #define rep(i, n) FOR(i, 0, n)...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1000000007; const ll MOD2 = 998244353; const double PI = acos(-1); const ll INF = 1e18; typedef pair<ll, ll> P; typedef vector<ll> vl; typedef vector<vl> vvl; #define FOR(i, a, b) for (ll i = a; i < b; i++) #define rep(i, n) FOR(i, 0, n)...
[["-", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
1
231
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr...
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
176
import numpy as np import collections n = int(input()) def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) ...
import numpy as np import collections n = int(input()) def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) ...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 20]]
5
130
/* Author : Nishant Gupta 2.0 */ #include <bits/stdc++.h> #define LL long long int #define getcx getchar_unlocked #define X first #define Y second #define PB push_back #define MP make_pair #define MAX 100005 #define LOG_MAX 20 #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFL (LL(1e18)) #define chk(a) cer...
/* Author : Nishant Gupta 2.0 */ #include <bits/stdc++.h> #define LL long long int #define getcx getchar_unlocked #define X first #define Y second #define PB push_back #define MP make_pair #define MAX 100005 #define LOG_MAX 20 #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFL (LL(1e18)) #define chk(a) cer...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
513
from bisect import bisect_right import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number)...
from bisect import bisect_right import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number)...
[["+", 0, 57, 64, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 57, 15, 679, 12, 666, 0, 206, 51, 22]]
5
348
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repo(i, n) for (int i = 1; i <= n; i++) #define INF 1001001001 #define INFll 100100100100100 // debug用 #define PrintVec(x) \ for (auto elementPrintVec : x) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repo(i, n) for (int i = 1; i <= n; i++) #define INF 1001001001 #define INFll 100100100100100 // debug用 #define PrintVec(x) \ for (auto elementPrintVec : x) { ...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 49, 50, 51, 16, 31, 16, 31, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
334
import collections n = int(input()) def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a c = collec...
import collections n = int(input()) def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a c = collec...
[["-", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 72], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 31, 22], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 17, 72], ["+", 0, 57, 15, 23, 0, 666, 0, 657, 31, 22], ["+", 0, 57, 15, 23, 0, 666, 0, 657, 17, 33]]
5
153
#include <bits/stdc++.h> using namespace std; typedef long long ll; int prime_factrization(ll n) { vector<int> prime_num(int(sqrt(n)) + 1); int ans = 0; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { prime_num[i]++; n /= i; } int num = 1; while (prime_num[i] >= num) { p...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int prime_factrization(ll n) { vector<int> prime_num(int(sqrt(n)) + 1); int ans = 0; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { prime_num[i]++; n /= i; } int num = 1; while (prime_num[i] >= num) { pr...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
164
n=int(input()) def prime_factorize(n): d=defaultdict(int) while n % 2 == 0: d[2]+=1 n //= 2 f = 3 while f * f <= n: if n % f == 0: d[f]+=1 n //= f else: f += 2 if n != 1: d[n]+=1 return d u=prime_factorize(n) cnt=0 f...
from collections import defaultdict n=int(input()) def prime_factorize(n): d=defaultdict(int) while n % 2 == 0: d[2]+=1 n //= 2 f = 3 while f * f <= n: if n % f == 0: d[f]+=1 n //= f else: f += 2 if n != 1: d[n]+=1 r...
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
152
def factorization(n): if(n == 1): return [] arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp...
def factorization(n): if(n == 1): return [] arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp...
[["+", 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, 25]]
5
194
#include <stdio.h> int main() { long long n, i, j, c, ans = 0; scanf("%lld", &n); for (i = 2; i * i < n; i++) { for (c = 0; n % i == 0; c++) n /= i; // printf("%lld\n",c); for (j = 0; j * (j + 1) / 2 < c; j++) ; ans += j; } // printf("%lld %lld\n",n,ans); if (n - 1) ans++; printf...
#include <stdio.h> int main() { long long n, i, j, c, ans = 0; scanf("%lld", &n); for (i = 2; i * i < n; i++) { for (c = 0; n % i == 0; c++) n /= i; // printf("%lld\n",c); for (j = 0; j * (j + 1) / 2 <= c; j++) ; ans += j - 1; } // printf("%lld %lld\n",n,ans); if (n - 1) ans++; p...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
0
118
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); i++) using namespace std; typedef long long ll; typedef pair<ll, ll> pll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); i++) using namespace std; typedef long long ll; typedef pair<ll, ll> pll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
327
#include <bits/stdc++.h> using namespace std; long long n = 0; long long getCount(int k) { long long divCount = 0; while (true) { if (n % k == 0) { divCount++; n = n / k; } else { break; } } long long i = 1; long long count = 0; while (true) { if (i <= divCount) { ...
#include <bits/stdc++.h> using namespace std; long long n = 0; long long getCount(int k) { long long divCount = 0; while (true) { if (n % k == 0) { divCount++; n = n / k; } else { break; } } long long i = 1; long long count = 0; while (true) { if (i <= divCount) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0...
1
237
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> pin...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> pin...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
489
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define ve vector #define rep(i, n) for (ll i = 0; i < (int)(n); i++) int main() { ll n; cin >> n; ll ans = 0; ll sqrtn = sqrt(n); for (ll i = 2; i <= sqrtn; i++) { if (n % i == 0) { ll cnt = 0; while ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define ve vector #define rep(i, n) for (ll i = 0; i < (int)(n); i++) int main() { ll n; cin >> n; ll ans = 0; ll sqrtn = sqrt(n); for (ll i = 2; i <= sqrtn; i++) { if (n % i == 0) { ll cnt = 0; while ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 27, 17, 29]]
1
149
N = int(input()) array1 = [] array2 = [] for i in range(N): a,b = map(int,input().split()) array1.append(a) array2.append(b) array1.sort() array2.sort() if N % 2 == 0: min = array1[N//2]+array1[N//2+1] max = array2[N//2]+array2[N//2+1] print(max-min+1) else: min = array1[N//2] max = ar...
N = int(input()) array1 = [] array2 = [] for i in range(N): a,b = map(int,input().split()) array1.append(a) array2.append(b) array1.sort() array2.sort() if N % 2 == 0: min = array1[N//2]+array1[N//2-1] max = array2[N//2]+array2[N//2-1] print(max-min+1) else: min = array1[N//2] max = ar...
[["-", 0, 662, 12, 657, 12, 206, 206, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 206, 206, 657, 17, 33]]
5
137
#include <algorithm> #include <bitset> #include <chrono> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #in...
#include <algorithm> #include <bitset> #include <chrono> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #in...
[["-", 341, 342, 0, 16, 31, 16, 31, 23, 0, 24], ["-", 0, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["-", 341, 342, 0, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
584
# ABC169 E N=int(input()) AB=[tuple(map(int,input().split())) for _ in [0]*N] def med(A): N=len(A) if N%2: return A[(N+1)//2-1] else: return (A[N//2-1]+A[N//2])//2 A=[i[0] for i in AB] B=[i[1] for i in AB] medA=med(sorted(A)) medB=med(sorted(B)) if N%2: print(medB-medA+1) else:...
# ABC169 E N=int(input()) AB=[tuple(map(int,input().split())) for _ in [0]*N] def med(A): N=len(A) if N%2: return A[(N+1)//2-1] else: return (A[N//2-1]+A[N//2])/2 A=[i[0] for i in AB] B=[i[1] for i in AB] medA=med(sorted(A)) medB=med(sorted(B)) if N%2: print(medB-medA+1) else: ...
[["-", 75, 76, 8, 196, 0, 37, 0, 657, 17, 676], ["+", 75, 76, 8, 196, 0, 37, 0, 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
157
N = int(input()) As = [] Bs = [] for _ in range(N): a,b = map(int,input().split()) As.append(a) Bs.append(b) As.sort() Bs.sort() if N%2 == 1: ma = As[N//2] mb = Bs[N//2] print(mb-ma+1) else: ma = (As[N//2-1] + As[N//2])//2 mb = (Bs[N//2-1] + Bs[N//2])//2 print(int((mb-ma)*2)+1)
N = int(input()) As = [] Bs = [] for _ in range(N): a,b = map(int,input().split()) As.append(a) Bs.append(b) As.sort() Bs.sort() if N%2 == 1: ma = As[N//2] mb = Bs[N//2] print(mb-ma+1) else: ma = (As[N//2-1] + As[N//2])/2 mb = (Bs[N//2-1] + Bs[N//2])/2 print(int((mb-ma)*2)+1)
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85]]
5
152
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; int arr[N]; int brr[N]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> arr[i] >> brr[i]; } sort(arr + 1, arr + 1 + n); sort(brr + 1, brr + 1 + n); if (n % 2 == 0) cout << brr[n / 2] + brr[n / 2 + 1] - arr[n /...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; int arr[N]; int brr[N]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> arr[i] >> brr[i]; } sort(arr + 1, arr + 1 + n); sort(brr + 1, brr + 1 + n); if (n % 2 == 0) cout << brr[n / 2] + brr[n / 2 + 1] - arr[n /...
[["-", 31, 16, 12, 16, 31, 16, 12, 69, 28, 22], ["+", 31, 16, 12, 16, 31, 16, 12, 69, 28, 22]]
1
171
#include <bits/stdc++.h> using namespace std; #define ll long long #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i...
#include <bits/stdc++.h> using namespace std; #define ll long long #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i...
[["+", 31, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
273
#include <bits/stdc++.h> using namespace std; #define ll long long #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i...
#include <bits/stdc++.h> using namespace std; #define ll long long #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i...
[["+", 31, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
284
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { int N; cin >> N; vector<int> A(N), B(N); rep(i, N) { cin >> A[i] >> B[i]; } if (N % 2 == 1) { sort(A.begin(), A.end()); sort(B.begin(), B.end());...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { int N; cin >> N; vector<int> A(N), B(N); rep(i, N) { cin >> A[i] >> B[i]; } if (N % 2 == 1) { sort(A.begin(), A.end()); sort(B.begin(), B.end());...
[["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["-", 49, 50, 51, 16, 31, 69, 341, 342,...
1
226
#include <bits/stdc++.h> const int MAX_N = 200005; int N; struct rang { int st, en; } rs[MAX_N]; int main() { scanf("%d", &N); std::vector<int> mm, dd; for (int i = 0; i < N; ++i) { scanf("%d %d", &rs[i].st, &rs[i].en); mm.push_back(rs[i].st); dd.push_back(rs[i].en); } std::sort(mm.begin(), mm...
#include <bits/stdc++.h> const int MAX_N = 200005; int N; struct rang { int st, en; } rs[MAX_N]; int main() { scanf("%d", &N); std::vector<int> mm, dd; for (int i = 0; i < N; ++i) { scanf("%d %d", &rs[i].st, &rs[i].en); mm.push_back(rs[i].st); dd.push_back(rs[i].en); } std::sort(mm.begin(), mm...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
271
import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); long[] a = new long[n]; long[] b = new long[n]; for (int i = 0; i < n;...
import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); long[] a = new long[n]; long[] b = new long[n]; for (int i = 0; i < n;...
[["+", 0, 492, 3, 4, 0, 74, 39, 506, 0, 96], ["+", 0, 1, 0, 492, 3, 4, 0, 74, 0, 25], ["+", 31, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 492, 3, 4, 0, 74, 51, 23, 0, 25]]
3
2,786
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); vector<int> 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 == 1) cout << B[N / 2] - A[N / 2] + 1 << endl; else cout << (B[N / ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); vector<int> 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 == 1) cout << B[N / 2] - A[N / 2] + 1 << endl; else cout << (B[N / ...
[["-", 0, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33]]
1
164
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; //#def...
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; //#def...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
237
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define r...
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define r...
[["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
255
#include <bits/stdc++.h> using namespace std; using i64 = long long; using u64 = unsigned long long; #define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i) int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<i64> A(N), B(N); vector<pair<i64, i64>> se, es; REP(i,...
#include <bits/stdc++.h> using namespace std; using i64 = long long; using u64 = unsigned long long; #define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i) int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<i64> A(N), B(N); vector<pair<i64, i64>> se, es; REP(i,...
[["-", 0, 43, 49, 50, 51, 118, 28, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 118, 28, 69, 28, 22]]
1
262
//#define _CRT_SECURE_NO_WARNINGS //#include <bits/stdc++.h> #include "bits/stdc++.h" #define rep(i, n) for (long long(i) = 0; (i) < (long long)(n); (i)++) #define all(x) (x).begin(), (x).end() #define int long long #define PI (3.14159265358979323) #define MOD (1000000007LL) #define INF (1LL << 60LL) #define MAX_N (1...
//#define _CRT_SECURE_NO_WARNINGS //#include <bits/stdc++.h> #include "bits/stdc++.h" #define rep(i, n) for (long long(i) = 0; (i) < (long long)(n); (i)++) #define all(x) (x).begin(), (x).end() #define int long long #define PI (3.14159265358979323) #define MOD (1000000007LL) #define INF (1LL << 60LL) #define MAX_N (1...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22]]
1
177
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; //#define ll long long template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1;...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; //#define ll long long template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1;...
[["-", 0, 1, 0, 11, 12, 118, 28, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 118, 28, 69, 28, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 118, 119, 120], ["+", 0, 9, 0, 1, 0, 11, 12, 118, 119, 120]]
1
402
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 49, 50, 51, 41, 64, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 41, 64, 16, 12, 13]]
1
1,380
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e18; #define rep(i, a, b) for (int i = a; i < b; i++) #define per(i, a, b) for (int i = b - 1; i >= a; i--) #define int ll using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; signed main() { int n; cin >>...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e18; #define rep(i, a, b) for (int i = a; i < b; i++) #define per(i, a, b) for (int i = b - 1; i >= a; i--) #define int ll using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; signed main() { int n; cin >>...
[["-", 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, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13]]
1
234
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e18; const int inf = 1e9; double pi = 3.14159265359; #define rep(i, a, b) for (int i = a; i < b; i++) #define per(i, b, a) for (int i = a - 1; i >= b; i--) using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e18; const int inf = 1e9; double pi = 3.14159265359; #define rep(i, a, b) for (int i = a; i < b; i++) #define per(i, b, a) for (int i = a - 1; i >= b; i--) using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, ...
[["-", 31, 16, 12, 16, 31, 16, 31, 2, 63, 22], ["-", 12, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["-", 12, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 72], ["-", 12, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["-", 31, 16, 12, 16, 31, 16, 12, 2, 63, 22], ["-", 12, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 12...
1
291
N = int(input()) left = [] right = [] for _ in range(N): l, r = map(int, input().split()) left.append(l) right.append(r) left.sort() right.sort() if N%2==0: for i, (l, r) in enumerate(zip(left, right), 1): if i==N//2: L = l R = r if i==N//2+1: R +=r ...
N = int(input()) left = [] right = [] for _ in range(N): l, r = map(int, input().split()) left.append(l) right.append(r) left.sort() right.sort() if N%2==0: for i, (l, r) in enumerate(zip(left, right), 1): if i==N//2: L = l R = r if i==N//2+1: R +=r ...
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 48], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
170
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n; cin >> n; ll a[n], b[n]; for (ll i = 0; i < n; i++) { cin >> a[i] >> b[i]; } sort(a, a + n); sort(b, b + n); if (n % 2 == 0) { cout << (b[n / 2 - 1] + b[n / 2]) - (a[n / 2 - 1] - a[n / 2]) + 1 << endl; } ...
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n; cin >> n; ll a[n], b[n]; for (ll i = 0; i < n; i++) { cin >> a[i] >> b[i]; } sort(a, a + n); sort(b, b + n); if (n % 2 == 0) { cout << b[n / 2 - 1] + b[n / 2] - a[n / 2 - 1] - a[n / 2] + 1 << endl; } else...
[["-", 31, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["-", 31, 16, 12, 16, 31, 16, 31, 23, 0, 25], ["-", 31, 16, 12, 16, 31, 16, 12, 23, 0, 24], ["-", 31, 16, 12, 16, 31, 16, 12, 23, 0, 25]]
1
157
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5, M = 998244353, OO = 0x3f3f3f3f; typedef long long ll; #define FIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); const double Pi...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5, M = 998244353, OO = 0x3f3f3f3f; typedef long long ll; #define FIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); const double Pi...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
176
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) #define int long long using namespace std; const int MX = 1e6; const int inf...
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) #define int long long using namespace std; const int MX = 1e6; const int inf...
[["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33]]
1
235
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = (int)(n); i >= 0; i--) #define all(v) v.begin(), v.end() typedef long long ll; int main() { ll N; cin >> N; vector<ll> A(N); vector<ll> B(N); rep(i, N) { cin >> A[i] >> B[i]; } ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = (int)(n); i >= 0; i--) #define all(v) v.begin(), v.end() typedef long long ll; int main() { ll N; cin >> N; vector<ll> A(N); vector<ll> B(N); rep(i, N) { cin >> A[i] >> B[i]; } ...
[["-", 49, 50, 51, 69, 341, 342, 0, 16, 17, 33], ["-", 49, 50, 51, 69, 341, 342, 0, 16, 12, 13]]
1
200
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) typedef long long ll; typedef long double ld; typedef pair<int, int> P; int main() { int n; cin >> n; vector<int> a(n), b(n); rep(i, n) { cin >> a[i] >> b[i]; } sort(a.begin(), a.end()); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) typedef long long ll; typedef long double ld; typedef pair<int, int> P; int main() { int n; cin >> n; vector<int> a(n), b(n); rep(i, n) { cin >> a[i] >> b[i]; } sort(a.begin(), a.end()); ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
201
#include <bits/stdc++.h> using namespace std; int main(void) { long long N; cin >> N; long long a[300000]; long long b[300000]; for (int i = 0; i < N; i++) { cin >> a[i] >> b[i]; } sort(a, a + N); sort(b, b + N); long long ans; if (N % 2 == 0) { ans = 2 * (b[N / 2] + b[N / 2 - 1]) - 2 *...
#include <bits/stdc++.h> using namespace std; int main(void) { long long N; cin >> N; long long a[300000]; long long b[300000]; for (int i = 0; i < N; i++) { cin >> a[i] >> b[i]; } sort(a, a + N); sort(b, b + N); long long ans; if (N % 2 == 0) { ans = (b[N / 2] + b[N / 2 - 1]) - (a[N / ...
[["-", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], ["-", 0, 11, 12, 16, 31, 16, 12, 16, 31, 13], ["-", 0, 11, 12, 16, 31, 16, 12, 16, 17, 48], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
1
168
N = int(input()) A = list() B = list() for i in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) A.sort() B.sort() if(N%2==1): x = A[(N-1)//2] y = B[(N-1)//2] print(y-x+1) else: x = A[(N//2)+1] + A[N//2] y = B[(N//2)+1] + B[N//2] print(y-x+1)
N = int(input()) A = list() B = list() for i in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) A.sort() B.sort() if(N%2==1): x = A[(N-1)//2] y = B[(N-1)//2] print(y-x+1) else: x = A[(N//2)-1] + A[N//2] y = B[(N//2)-1] + B[N//2] print(y-x+1)
[["-", 0, 662, 12, 657, 31, 206, 206, 657, 17, 72], ["+", 0, 662, 12, 657, 31, 206, 206, 657, 17, 33]]
5
153
N = gets.to_i ABS = N.times.map { gets.split.map(&:to_i) } as = [] bs = [] ABS.each do |ab| a, b = ab as.push(a) bs.push(b) end def m(arr) sorted = arr.sort if arr.count % 2 == 1 sorted[(arr.count + 1) / 2 - 1] else (sorted[arr.count / 2 - 1] + sorted[arr.count / 2 + 1 - 1]) / 2.0 end end am = ...
N = gets.to_i ABS = N.times.map { gets.split.map(&:to_i) } as = [] bs = [] ABS.each do |ab| a, b = ab as.push(a) bs.push(b) end def m(arr) sorted = arr.sort if arr.count % 2 == 1 sorted[(arr.count + 1) / 2 - 1] else (sorted[arr.count / 2 - 1] + sorted[arr.count / 2 + 1 - 1]) / 2.0 end end am = ...
[["-", 0, 652, 486, 739, 0, 738, 31, 738, 17, 48], ["-", 0, 652, 486, 739, 0, 738, 31, 738, 12, 612], ["-", 3, 4, 0, 652, 486, 739, 0, 738, 17, 33], ["+", 3, 4, 0, 652, 486, 739, 0, 738, 17, 72]]
4
164
import statistics N = int(input()) A = [] B = [] for i in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) Am = statistics.median(A) Bm = statistics.median(B) if N % 2 == 0: print(round(2 * Bm - Am) + 1) else: print(Bm - Am + 1)
import statistics N = int(input()) A = [] B = [] for i in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) Am = statistics.median(A) Bm = statistics.median(B) if N % 2 == 0: print(round(2 * (Bm - Am) + 1)) else: print(Bm - Am + 1)
[["+", 8, 196, 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], ["+", 3, 4, 0, 657, 31, 657, 12, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
100
#include <bits/stdc++.h> #define F first #define S second #define int long long #define inf 1000000000000000001 #define mod 1000000007 using namespace std; signed main() { int n; cin >> n; vector<int> st(n), en(n); for (int i = 0; i < n; i++) { cin >> st[i] >> en[i]; } sort(st.begin(), st.end()); s...
#include <bits/stdc++.h> #define F first #define S second #define int long long #define inf 1000000000000000001 #define mod 1000000007 using namespace std; signed main() { int n; cin >> n; vector<int> st(n), en(n); for (int i = 0; i < n; i++) { cin >> st[i] >> en[i]; } sort(st.begin(), st.end()); s...
[["+", 51, 16, 31, 23, 0, 16, 31, 74, 0, 24], ["+", 31, 23, 0, 16, 31, 74, 39, 77, 39, 40], ["+", 51, 16, 31, 23, 0, 16, 31, 74, 0, 25], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24]]
1
296
#include <algorithm> #include <iostream> #include <map> #include <stdio.h> #include <string.h> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template...
#include <algorithm> #include <iostream> #include <map> #include <stdio.h> #include <string.h> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template...
[["-", 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
279
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define pb push_back using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<int> a(n), b(n); rep(i, n) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); double x = (a[n / 2] + a[(n - 1) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define pb push_back using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<int> a(n), b(n); rep(i, n) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); double x = (a[n / 2] + a[(n - 1) ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
181
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <random> using namespace std; using namespace __gnu_pbds; #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <random> using namespace std; using namespace __gnu_pbds; #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
290
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, b, a) for (int i = b; i >= a; i--) #define fori(a) for (auto i : a) #define all(a) begin(a), end(a) #define set(a, b) memset(a, b, sizeof(a)) #define sz(a) a.size() #define pi 3.14159 #define ll long long #define ull unsigned long...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, b, a) for (int i = b; i >= a; i--) #define fori(a) for (auto i : a) #define all(a) begin(a), end(a) #define set(a, b) memset(a, b, sizeof(a)) #define sz(a) a.size() #define pi 3.14159 #define ll long long #define ull unsigned long...
[["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
397
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, b, a) for (int i = b; i >= a; i--) #define fori(a) for (auto i : a) #define all(a) begin(a), end(a) #define set(a, b) memset(a, b, sizeof(a)) #define sz(a) a.size() #define pi 3.14159 #define ll long long #define ull unsigned long...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, b, a) for (int i = b; i >= a; i--) #define fori(a) for (auto i : a) #define all(a) begin(a), end(a) #define set(a, b) memset(a, b, sizeof(a)) #define sz(a) a.size() #define pi 3.14159 #define ll long long #define ull unsigned long...
[["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
389
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); 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 % 2 == 0) { int a = A[N / 2 - 1] + A[N...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); 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 % 2 == 0) { int a = A[N / 2 - 1] + A[N...
[["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22]]
1
203
from statistics import* (n,),*t=[map(int,t.split())for t in open(0)] a,b=map(median,zip(*t)) print(int(b-a)*(2-n%2)+1)
from statistics import* (n,),*t=[map(int,t.split())for t in open(0)] a,b=map(median,zip(*t)) print(int((b-a)*(2-n%2))+1)
[["+", 31, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 31, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
64
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(k, i, n) for (ll i = k; i < n; ++i) int main(void) { ll n; cin >> n; vector<ll> a(n), b(n); rep(0, i, n) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n % 2 == 1) { cout << b[(n - 1) / 2] - a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(k, i, n) for (ll i = k; i < n; ++i) int main(void) { ll n; cin >> n; vector<ll> a(n), b(n); rep(0, i, n) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n % 2 == 1) { cout << b[(n - 1) / 2] - a...
[["+", 341, 342, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 341, 342, 0, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72]]
1
189
n=int(input()) l=[list(map(int,input().split())) for i in range(n)] work1=[x[0] for x in l] work2=[x[1] for x in l] if n%2==1 : mmin=work1[n//2] mmax=work2[n//2] else: mmin=work1[n//2]+work1[n//2-1] mmax=work2[n//2]+work2[n//2-1] print(mmax-mmin+1)
n=int(input()) l=[list(map(int,input().split())) for i in range(n)] work1=sorted([x[0] for x in l]) work2=sorted([x[1] for x in l]) if n%2==1 : mmin=work1[n//2] mmax=work2[n//2] else: mmin=work1[n//2]+work1[n//2-1] mmax=work2[n//2]+work2[n//2-1] print(mmax-mmin+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]]
5
125
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n; cin >> n; int i; ll a[n + 10], b[n + 10]; for (i = 0; i < n; i++) { ...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n; cin >> n; int i; ll a[n + 10], b[n + 10]; for (i = 0; i < n; i++) { ...
[["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
206
#include <bits/stdc++.h> using namespace std; int f(const vector<pair<long long, long long>> &ab, size_t i) { long long l = 0; long long r = 1e9 + 5; while (r - l > 1) { long long c = (l + r) / 2; size_t idx = (lower_bound(ab.begin(), ab.end(), make_pair(c, 0ll)) - ab.begin()); if (idx > i) {...
#include <bits/stdc++.h> using namespace std; int f(const vector<pair<long long, long long>> &ab, size_t i) { long long l = 0; long long r = 1e9 + 5; while (r - l > 1) { long long c = (l + r) / 2; size_t idx = (lower_bound(ab.begin(), ab.end(), make_pair(c, 0ll)) - ab.begin()); if (idx > i) {...
[["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
416
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): print(B[N//2+1]-A[N//2+1]+1) else: print(B[N//2]+B[N//2-1] - A[N//2]-A[N//2-1] + 1)
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): print(B[N//2]-A[N//2]+1) else: print(B[N//2]+B[N//2-1] - A[N//2]-A[N//2-1] + 1)
[["-", 0, 657, 31, 657, 31, 206, 206, 657, 17, 72], ["-", 0, 657, 31, 657, 31, 206, 206, 657, 12, 612], ["-", 0, 657, 31, 657, 12, 206, 206, 657, 17, 72], ["-", 0, 657, 31, 657, 12, 206, 206, 657, 12, 612]]
5
131
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include...
[["+", 49, 50, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 25], ["+", 49, 50, 51, 16, 31, 74, 51, 23, 0, 24], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 24]]
1
352
N = int(input()) A = [] B = [] for i in range(N): a,b = map(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( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )
N = int(input()) A = [] B = [] for i 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( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]]
5
129
/**Function Template**/ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pint; const int MAX = 510000; const int MOD = 1000000007; #define rep(i, n) for (ll i = ll(0); i < ll(n); i++) #define Rep(i, n) for (ll i = ll(1); i < ll(n); i++) #define ALL(a) (a).begin(), (a).end() #...
/**Function Template**/ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pint; const int MAX = 510000; const int MOD = 1000000007; #define rep(i, n) for (ll i = ll(0); i < ll(n); i++) #define Rep(i, n) for (ll i = ll(1); i < ll(n); i++) #define ALL(a) (a).begin(), (a).end() #...
[["+", 49, 50, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 25], ["+", 49, 50, 51, 16, 31, 74, 51, 23, 0, 24], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 24]]
1
1,363
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define PB push_back #define ALL(v) (v).begin(), (v).end() #define REP(i, x, n) for (ll(i) = (x); (i) < (n); (i)++) #define RREP(i, x, n) for (ll(i) = (n)-1; (i) >= x; (i)--) #define FOR(i, n) for (ll(i) = 0; (i) < (n); (i)++) #...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define PB push_back #define ALL(v) (v).begin(), (v).end() #define REP(i, x, n) for (ll(i) = (x); (i) < (n); (i)++) #define RREP(i, x, n) for (ll(i) = (n)-1; (i) >= x; (i)--) #define FOR(i, n) for (ll(i) = 0; (i) < (n); (i)++) #...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
209
#include <bits/stdc++.h> using namespace std; // #define int long long // #define double long double #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORR(i, a, b) for (int i = (a); i > (b); --i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREAC...
#include <bits/stdc++.h> using namespace std; // #define int long long // #define double long double #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORR(i, a, b) for (int i = (a); i > (b); --i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREAC...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
947
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define mod 1000000007 #define int long long int #define double long double #define inf (int)(1e15) #define all(x) (x).begin(), (x).end() #define pair pair<int, int> typedef vector<int> vi; // Vector of long long typedef vector<vi...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define mod 1000000007 #define int long long int #define double long double #define inf (int)(1e15) #define all(x) (x).begin(), (x).end() #define pair pair<int, int> typedef vector<int> vi; // Vector of long long typedef vector<vi...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 31, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 23, 0, 16, 31, 16, 12, 22]]
1
360
def main(): n = int(input()) A = [0]*n B = [0]*n for i in range(n): a,b = map(int,input().split()) A[i] = a B[i] = b A.sort() B.sort() if n%2 == 0: m1 = (A[n//2-1]+A[n//2])//2 m2 = (B[n//2-1]+B[n//2])//2 print(2*(m2-m1)+1) else: pri...
def main(): n = int(input()) A = [0]*n B = [0]*n for i in range(n): a,b = map(int,input().split()) A[i] = a B[i] = b A.sort() B.sort() if n%2 == 0: m1 = (A[n//2-1]+A[n//2])/2 m2 = (B[n//2-1]+B[n//2])/2 print(int(2*(m2-m1))+1) else: ...
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 31, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
169
from statistics import median n = int(input()) a = [None] * n b = [None] * n for i in range(n): a[i], b[i] = map(int, input().split()) if n % 2 == 1: print(median(b) - median(a) + 1) else: print(int(median(b) - median(a)) * 2 + 1)
from statistics import median n = int(input()) a = [None] * n b = [None] * n for i in range(n): a[i], b[i] = map(int, input().split()) if n % 2 == 1: print(median(b) - median(a) + 1) else: print(int((median(b) - median(a)) * 2) + 1)
[["+", 31, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
98
import sys n = int(sys.stdin.readline()) xs = [] for _ in range(n): v = [int(x) for x in sys.stdin.readline().split(" ")] xs.append(v) ...
import sys n = int(sys.stdin.readline()) xs = [] for _ in range(n): v = [int(x) for x in sy...
[["-", 0, 1, 0, 662, 12, 23, 0, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 23, 0, 657, 12, 22], ["-", 0, 1, 0, 662, 12, 23, 0, 657, 31, 22], ["+", 0, 1, 0, 662, 12, 23, 0, 657, 31, 22]]
5
225
/*{{{*/ #include <bits/stdc++.h> typedef long long ll; #define REP(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define FORR(i, a, b) for (ll i = b - 1; i >= a; i--) #define vl vector<ll> #define pll pair<ll, ll> #define DEBUG(x) cout << #x << ": " << x << endl using namespace s...
/*{{{*/ #include <bits/stdc++.h> typedef long long ll; #define REP(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define FORR(i, a, b) for (ll i = b - 1; i >= a; i--) #define vl vector<ll> #define pll pair<ll, ll> #define DEBUG(x) cout << #x << ": " << x << endl using namespace s...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
215
def main(): N = int(input()) A,B = [],[] for _ in range(N): a,b = [int(x) for x in input().split()] A.append(a) B.append(b) A.sort() B.sort() if N % 2 == 1: minMed = A[N/2] maxMed = B[N/2] print(int(maxMed-minMed)+1) else: minMed = A[N/...
def main(): N = int(input()) A,B = [],[] for _ in range(N): a,b = [int(x) for x in input().split()] A.append(a) B.append(b) A.sort() B.sort() if N % 2 == 1: minMed = A[N//2] maxMed = B[N//2] print(int(maxMed-minMed)+1) else: minMed = A[...
[["-", 0, 1, 0, 662, 12, 206, 206, 657, 17, 85], ["+", 0, 1, 0, 662, 12, 206, 206, 657, 17, 676]]
5
163
def solve(N, As, Bs): # print(N) # print(As) # print(Bs) As.sort() Bs.sort() ans = 0 # N が奇数の場合 if N % 2 == 1: x = (N + 1) // 2 - 1 ans = Bs[x] - As[x] + 1 # N が偶数の場合 else: lowx = N // 2 - 1 highx = N // 2 ans = (As[highx] + Bs[highx]) - (A...
# 解説を参考に作成 def solve(N, As, Bs): As.sort() Bs.sort() ans = 0 # N が奇数の場合 if N % 2 == 1: x = (N + 1) // 2 - 1 ans = Bs[x] - As[x] + 1 # N が偶数の場合 else: lowx = N // 2 - 1 highx = N // 2 ans = (Bs[lowx] + Bs[highx]) - (As[lowx] + As[highx]) + 1 print(...
[["-", 31, 657, 31, 23, 0, 657, 31, 206, 51, 22], ["+", 31, 657, 31, 23, 0, 657, 31, 206, 51, 22], ["-", 31, 657, 31, 23, 0, 657, 31, 206, 206, 22], ["+", 31, 657, 31, 23, 0, 657, 31, 206, 206, 22], ["-", 31, 657, 12, 23, 0, 657, 12, 206, 51, 22], ["+", 31, 657, 12, 23, 0, 657, 12, 206, 51, 22], ["-", 31, 657, 12, 23, ...
5
172
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n), b(n); rep(i, n) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); int l = a.size(); int an...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n), b(n); rep(i, n) cin >> a[i] >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); int l = a.size(); int an...
[["-", 0, 11, 12, 16, 31, 16, 31, 23, 0, 24], ["-", 0, 11, 12, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 85], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
218
import statistics import math n = int(input()) a = [] for _ in range(n): a.append(list(map(int,input().split()))) b = [[],[]] for i in range(n): b[0].append(a[i][0]) b[1].append(a[i][1]) x = statistics.median(b[0]) y = statistics.median(b[1]) if n % 2 != 0: ans = y - x + 1 else: ans = round(y...
import statistics import math n = int(input()) a = [] for _ in range(n): a.append(list(map(int,input().split()))) b = [[],[]] for i in range(n): b[0].append(a[i][0]) b[1].append(a[i][1]) x = statistics.median(b[0]) y = statistics.median(b[1]) if n % 2 != 0: ans = y - x + 1 else: ans = round((...
[["+", 31, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 25]]
5
145
n = int(input()) ab = [list(map(int, input().split())) for _ in range(n)] ab_a = sorted(ab, key=lambda x:int(x[1])) ab_b = sorted(ab, key=lambda x:int(x[1])) if n%2 == 1: print(ab_b[n//2][1]-ab_a[n//2][0]+1) else: print(int(((ab_b[n//2][1]+ab_b[n//2-1][1])/2.0-(ab_a[n//2][0]+ab_a[n//2-1][0])/2.0)*2+1))
n = int(input()) ab = [list(map(int, input().split())) for _ in range(n)] ab_a = sorted(ab, key=lambda x:int(x[0])) ab_b = sorted(ab, key=lambda x:int(x[1])) if n%2 == 1: print(ab_b[n//2][1]-ab_a[n//2][0]+1) else: print(int(((ab_b[n//2][1]+ab_b[n//2-1][1])/2.0-(ab_a[n//2][0]+ab_a[n//2-1][0])/2.0)*2+1))
[["-", 51, 670, 8, 652, 3, 4, 0, 206, 206, 612], ["+", 51, 670, 8, 652, 3, 4, 0, 206, 206, 612]]
5
168
from statistics import median def main(): N = int(input()) A = [None] * N B = [None] * N for i in range(N): A[i], B[i] = map(int, input().split()) min_median = median(A) max_median = median(B) if N % 2 == 1: print(max_median - min_median + 1) else: print(round(m...
from statistics import median def main(): N = int(input()) A = [None] * N B = [None] * N for i in range(N): A[i], B[i] = map(int, input().split()) min_median = median(A) max_median = median(B) if N % 2 == 1: print(max_median - min_median + 1) else: print(round((...
[["+", 31, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
113
n = int(input()) minnums = [[] for _ in range(n)] maxnums = [[] for _ in range(n)] for i in range(n): minnums[i], maxnums[i] = map(int, input().split()) minnums.sort() maxnums.sort() if n % 2: minmedian = minnums[n // 2] maxmedian = maxnums[n // 2] print(maxmedian - minmedian + 1) else: minmedian = (minn...
n = int(input()) minnums = [[] for _ in range(n)] maxnums = [[] for _ in range(n)] for i in range(n): minnums[i], maxnums[i] = map(int, input().split()) minnums.sort() maxnums.sort() if n % 2: minmedian = minnums[n // 2] maxmedian = maxnums[n // 2] print(maxmedian - minmedian + 1) else: minmedian = (minn...
[["-", 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
168
#include <bits/stdc++.h> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define exrep(i, a, b) for (ll i = a; i <= b; i++) #define out(x) cout << x << endl #define exout(x) printf("%.10f\n", x) #define chmax(x, y) x =...
#include <bits/stdc++.h> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define exrep(i, a, b) for (ll i = a; i <= b; i++) #define out(x) cout << x << endl #define exout(x) printf("%.10f\n", x) #define chmax(x, y) x =...
[["-", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["-", 31, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["-",...
1
803
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << #x << ": " << (x) << endl #define INF (int)1e9 #define EPS (double)1e-9 #define MOD ((int)1e9 + 7) using namespace std; typedef long long llong; typedef vector<int> vi; typedef vector<...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << #x << ": " << (x) << endl #define INF (int)1e9 #define EPS (double)1e-9 #define MOD ((int)1e9 + 7) using namespace std; typedef long long llong; typedef vector<int> vi; typedef vector<...
[["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
286
n = gets.to_i a, b = Array.new(n) { gets.split.map(&:to_i) }.transpose a.sort! b.sort! med_a = n.even? ? (a[n / 2] + a[n / 2 - 1]) / 2.0 : a[n / 2] med_b = n.even? ? (b[n / 2] + b[n / 2 - 1]) / 2.0 : b[n / 2] puts n.even? ? (med_b - med_a * 2 + 1).to_i : med_b - med_a + 1
n = gets.to_i a, b = Array.new(n) { gets.split.map(&:to_i) }.transpose a.sort! b.sort! med_a = n.even? ? (a[n / 2] + a[n / 2 - 1]) / 2.0 : a[n / 2] med_b = n.even? ? (b[n / 2] + b[n / 2 - 1]) / 2.0 : b[n / 2] puts n.even? ? ((med_b - med_a) * 2 + 1).to_i : med_b - med_a + 1
[["+", 486, 739, 0, 738, 31, 738, 31, 739, 0, 24], ["+", 486, 739, 0, 738, 31, 738, 31, 739, 0, 25]]
4
120
n = int( input() ) A = [] B = [] for i in range( n ): a, b = map( int, input().split() ) A.append( a ) B.append( b ) A = sorted( A ) B = sorted( B ) if n % 2 == 0: i = n // 2 print(( B[ i ] + B[ i - 1 ] ) - ( A[ i ] + A [ i - 1 ] ) + 1 ) else: i = ( n + 1 ) // 2 print( B[ i ] - A[ i ] + 1 )
n = int( input() ) A = [] B = [] for i in range( n ): a, b = map( int, input().split() ) A.append( a ) B.append( b ) A = sorted( A ) B = sorted( B ) if n % 2 == 0: i = n // 2 print(( B[ i ] + B[ i - 1 ] ) - ( A[ i ] + A [ i - 1 ] ) + 1 ) else: i = ( n + 1 ) // 2 - 1 print( B[ i ] - A[ i ] + 1 )
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
133
#include <bits/stdc++.h> using namespace std; #define FOR(i, o, n) for (long long i = o; i < n; i++) #define oneforall \ ios::sync_with_stdio(false); \ cin.tie(0); #define all(v) (v).begin(), (v).end() #defi...
#include <bits/stdc++.h> using namespace std; #define FOR(i, o, n) for (long long i = o; i < n; i++) #define oneforall \ ios::sync_with_stdio(false); \ cin.tie(0); #define all(v) (v).begin(), (v).end() #defi...
[["-", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22]]
1
371
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define inf 1e9 #define INF 1000000000000000000 int main() { int N; cin >> N; vector<ll> A(N), B(N); rep(i, N) { cin >> A[i] >> B[i]...
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define inf 1e9 #define INF 1000000000000000000 int main() { int N; cin >> N; vector<ll> A(N), B(N); rep(i, N) { cin >> A[i] >> B[i]...
[["+", 0, 11, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 25], ["+", 0, 11, 12, 16, 31, 74, 51, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 24]]
1
217
#include <bits/stdc++.h> #define SZ(x) ((int)(x).size()) typedef long long ll; typedef long double ld; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20); int n; cin >> n; vector<ll> a(n), b(n); for (int i = 0; i < n;...
#include <bits/stdc++.h> #define SZ(x) ((int)(x).size()) typedef long long ll; typedef long double ld; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20); int n; cin >> n; vector<ll> a(n), b(n); for (int i = 0; i < n;...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 33]]
1
230
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<pair<int, int>> p, q; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; p.push_back({a, b}); q.push_back({b, a});...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<pair<int, int>> p, q; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; p.push_back({a, b}); q.push_back({b, a});...
[["-", 49, 50, 51, 16, 12, 118, 28, 69, 28, 22], ["+", 49, 50, 51, 16, 12, 118, 28, 69, 28, 22], ["-", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 49, 50, 51, 16, 31, 118, 28, 69, 28, 22], ["+", 49, 50, 51, 16, 31, 118, 28, 69, 28, 22], ["-", 341, 342, 0, 16, 31, 23, 0,...
1
255
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; using ll = long long; using ld = long double; usi...
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; using ll = long long; using ld = long double; usi...
[["-", 12, 16, 31, 16, 31, 16, 31, 16, 17, 72], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 17, 33], ["-", 31, 16, 12, 16, 31, 16, 31, 16, 17, 33], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 72]]
1
473
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int arr1[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; cin >> arr1[i]; } sort(arr, arr + n); sort(arr1, arr1 + n); if (n % 2 == 0) { cout << (arr1[n / 2 - 1] + arr1[n / 2]) / 2 - (a...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int arr1[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; cin >> arr1[i]; } sort(arr, arr + n); sort(arr1, arr1 + n); if (n % 2 == 0) { cout << (arr1[n / 2 - 1] + arr1[n / 2]) - (arr[n / 2 - 1] + arr[...
[["-", 31, 16, 12, 16, 31, 16, 31, 16, 17, 85], ["-", 31, 16, 12, 16, 31, 16, 31, 16, 12, 13], ["-", 31, 16, 12, 16, 31, 16, 12, 16, 17, 85], ["-", 31, 16, 12, 16, 31, 16, 12, 16, 12, 13]]
1
174
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <ostream> #...
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <ostream> #...
[["-", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 63, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 63, 23, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 63, 23, 0, 25], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
723
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long using namespace std; int main() { int n; cin >> n; vector<int> a, b; for (int i = 0; i < n; i++) { cin >> a.at(i); cin >> b.at(i); } // debug a,b sort(a.begin(), a.end()); sort(b.begin(), b.end()); ll res;...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long using namespace std; int main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a.at(i); cin >> b.at(i); } // debug a,b sort(a.begin(), a.end()); sort(b.begin(), b.end()); l...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
192