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>
//#include <ext/pb_ds/assoc_container.hpp>
#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a) * (a)
#define M(a, b) make_pair(a, b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define d... | #include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a) * (a)
#define M(a, b) make_pair(a, b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define d... | [["-", 8, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 8, 57, 64, 1, 0, 11, 12, 103, 0, 125]] | 1 | 329 |
#include <stdio.h>
#include <string.h>
int main() {
char t[300000];
scanf("%s", t);
int len = strlen(t);
for (int i = 0; i < len; i++) {
if (t[i] == '?') {
t[i] == 'D';
}
}
printf("%s", t);
return 0;
} | #include <stdio.h>
#include <string.h>
int main() {
char t[300000];
scanf("%s", t);
int len = strlen(t);
for (int i = 0; i < len; i++) {
if (t[i] == '?') {
t[i] = 'D';
}
}
printf("%s", t);
return 0;
} | [["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]] | 0 | 83 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios::sync_with_stdio(0), cin.tie(0);
string st;
cin >> st;
for (auto &i : st) {
if (i == '?')
i = 'P';
}
cout << st;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios::sync_with_stdio(0), cin.tie(0);
string st;
cin >> st;
for (auto &i : st) {
if (i == '?')
i = 'D';
}
cout << st;
} | [["-", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125]] | 1 | 64 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
s.replace("?", "D");
System.out.println(s);
}
}
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = s.replace("?", "D");
System.out.println(t);
}
}
| [["+", 8, 498, 0, 195, 8, 196, 0, 503, 39, 78], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 0, 32], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 22]] | 3 | 66 |
S = list(input())
for i in range(1,len(S)-1):
if S[i] == "?":
S[i] = "D"
print("".join(S)) | S = list(input())
for i in range(len(S)):
if S[i] == "?":
S[i] = "D"
print("".join(S)) | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 51 |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const ll INF = 2e18;
const int MOD = 1e9 + 7;
const ... | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const ll INF = 2e18;
const int MOD = 1e9 + 7;
const ... | [["-", 8, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 8, 57, 64, 1, 0, 11, 12, 103, 0, 125]] | 1 | 147 |
def main():
S = input()
S = S.replace("?", "P")
print(S)
if __name__ == "__main__":
main() | def main():
S = input()
S = S.replace("?", "D")
print(S)
if __name__ == "__main__":
main() | [["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6]] | 5 | 38 |
#pragma GCC optimize("O3")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
tree<int, int, greater<int>, rb_tree_tag, tree_order_statistics_node_update>
map_t;
#define FOR(i, a, b) for (in... | #pragma GCC optimize("O3")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
tree<int, int, greater<int>, rb_tree_tag, tree_order_statistics_node_update>
map_t;
#define FOR(i, a, b) for (in... | [["-", 0, 57, 64, 1, 0, 16, 12, 103, 0, 125], ["+", 0, 57, 64, 1, 0, 16, 12, 103, 0, 125]] | 1 | 196 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i, n) for (int i = 1;... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i, n) for (int i = 1;... | [["-", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125]] | 1 | 259 |
def solve():
t = list(input())
for i in range(len(t)-1):
if t[i] == "?":
t[i] = "D"
print("".join(t))
return 0
if __name__ == "__main__":
solve() | def solve():
t = list(input())
for i in range(len(t)):
if t[i] == "?":
t[i] = "D"
print("".join(t))
return 0
if __name__ == "__main__":
solve() | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 66 |
#include <bits/stdc++.h>
using namespace std;
int n;
void solve() {
int i, j;
string str;
cin >> str;
long long ans = 0;
for (i = 0; i < str.length(); i++) {
if (str[i] == '?') {
str[i] = 'D';
}
}
cout << ans << endl;
}
int main() { solve(); }
| #include <bits/stdc++.h>
using namespace std;
int n;
void solve() {
int i, j;
string str;
cin >> str;
long long ans = 0;
for (i = 0; i < str.length(); i++) {
if (str[i] == '?') {
str[i] = 'D';
}
}
cout << str << endl;
}
int main() { solve(); }
| [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 90 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string t;
cin >> t;
for (int i = 1; i < t.size(); i++) {
if (t.at(i) == '?') {
t.at(i) = 'D';
}
}
cout << t;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string t;
cin >> t;
for (int64_t i = 0; i < t.size(); i++) {
if (t.at(i) == '?') {
t.at(i) = 'D';
}
}
cout << t;
} | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 69 |
s=input().strip()
for i in s:
if(i=="?"):
print("P",end="")
else:
print(i,end="")
print()
| s=input().strip()
for i in s:
if(i=="?"):
print("D",end="")
else:
print(i,end="")
print()
| [["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 48 |
print(input().reaplce('?','D'))
| print(input().replace('?','D')) | [["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22]] | 5 | 17 |
Vt = input()
print(t.replace("?", "D")) | t = input()
print(t.replace("?", "D")) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]] | 5 | 20 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const double PI = 3.14159265358979323846;
const long long INF = 1LL << 60;
int main() {
string T;
cin >> T;
int a = 0, b = 0, c = 0, x, y, z;
rep(i, T.size()) {
if (T.at(i) == '?') {
T.at(i) = 'P';
}
}
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const double PI = 3.14159265358979323846;
const long long INF = 1LL << 60;
int main() {
string T;
cin >> T;
int a = 0, b = 0, c = 0, x, y, z;
rep(i, T.size()) {
if (T.at(i) == '?') {
T.at(i) = 'D';
}
}
... | [["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125]] | 1 | 110 |
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/
const long long INF = 1e+18 + 1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef p... | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/
const long long INF = 1e+18 + 1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef p... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 262 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 806 |
#include <bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a) / (b) + (((a) % (b)) ? 1 : 0)
#define ln '\n'
using namespace std;
using LL = ... | #include <bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a) / (b) + (((a) % (b)) ? 1 : 0)
#define ln '\n'
using namespace std;
using LL = ... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 313 |
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll = long long;
#define int ll
signed main() {
#ifdef LC
assert(freopen("input.txt", "r", stdin));
#endif
ios::sync_with_stdio(0), cin.tie(0);
string s;
cin >> s;
... | #include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll = long long;
#define int ll
signed main() {
#ifdef LC
assert(freopen("input.txt", "r", stdin));
#endif
ios::sync_with_stdio(0), cin.tie(0);
string s;
cin >> s;
... | [["-", 64, 9, 0, 1, 0, 16, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 16, 12, 103, 0, 125]] | 1 | 118 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string t;
cin >> t;
int ans = 0;
for (int i = 1; i < t.length(); i++) {
if (t[i] == '?')
t[i] = 'D';
}
cout << t << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
string t;
cin >> t;
int ans = 0;
for (int i = 0; i < t.length(); i++) {
if (t[i] == '?')
t[i] = 'D';
}
cout << t << endl;
}
| [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 70 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i;
string s;
cin >> s;
for (i = 0; i < s.length(); i++) {
if (s[i] == '?')
printf("%c", 'D');
else
printf("%d", s[i]);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int i;
string s;
cin >> s;
for (i = 0; i < s.length(); i++) {
if (s[i] == '?')
printf("%c", 'D');
else
printf("%c", s[i]);
}
return 0;
} | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 79 |
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
const int INF = 1001001001;
int main() {
string t;
cin >> t;
int n = t.size();
if (t[0] = '?') {
t[0] = 'D';
}
for (int i = 1; i < n; i++) {
if (t[i... | #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
const int INF = 1001001001;
int main() {
string t;
cin >> t;
int n = t.size();
if (t[0] == '?') {
t[0] = 'D';
}
for (int i = 1; i < n; i++) {
if (t[... | [["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]] | 1 | 130 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '?') {
System.out.print('D');
}
System.out.print(s.charAt(i));
}
S... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '?') {
System.out.print('D');
} else {
System.out.print(s.charAt(i));
... | [["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 7, 8, 196, 0, 57, 75, 196, 0, 46]] | 3 | 114 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define inf ll(1e18)
#define mod 1000000007
#define mod1 998244353
#define mod2 999983
ll power(ll a, ll n, ll m);
ll power(ll a, ll n, ll m) {
if (n == 0)
return 1;
ll x = power(a, n / 2, m);
if (n % 2 != 0)
return (((a * x) % m) * (... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define inf ll(1e18)
#define mod 1000000007
#define mod1 998244353
#define mod2 999983
ll power(ll a, ll n, ll m);
ll power(ll a, ll n, ll m) {
if (n == 0)
return 1;
ll x = power(a, n / 2, m);
if (n % 2 != 0)
return (((a * x) % m) * (... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6]] | 1 | 304 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Graph vector<vector<ll>>
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Graph vector<vector<ll>>
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(... | [["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]] | 1 | 166 |
s=gets.chomp
put s.tr('?','D') | s=gets.chomp
puts s.tr('?', 'D') | [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]] | 4 | 18 |
#include <bits/stdc++.h>
using namespace std;
namespace Base {
#define mr make_pair
typedef long long ll;
typedef double db;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
template <typename T> void read(T &x) {
x = 0;
int fh = 1;
double num = 1.... | #include <bits/stdc++.h>
using namespace std;
namespace Base {
#define mr make_pair
typedef long long ll;
typedef double db;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
template <typename T> void read(T &x) {
x = 0;
int fh = 1;
double num = 1.... | [["-", 8, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 8, 57, 64, 1, 0, 11, 12, 103, 0, 125]] | 1 | 347 |
n=input()
ans=""
for i in n:
if i=="?":
ans=ans+"D"
else:
ans=ans+i
print(i) | n=input()
ans=""
for i in n:
if i=="?":
ans=ans+"D"
else:
ans=ans+i
print(ans) | [["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 39 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.length();
for (int i = 0; i < n - 1; i++) {
if (s[i] == '?')
s[i] = 'D';
// if (s[i] != '?')
// continue;
// if (s[i+1] == 'D')
// s[i] = 'P';
// else
// s[i] = 'D';
}
... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.length();
for (int i = 0; i < n; i++) {
if (s[i] == '?')
s[i] = 'D';
}
cout << s << "\n";
return 0;
} | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 83 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
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;
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
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;
... | [["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["-", 0, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 0, 9, 0, 1, 0, 11, 12, 103, 0, 125]] | 1 | 231 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;
int main() {
string T;
cin >> T;
int N = T.size();
for (int i = 1; i < N; i++)
if (T[i] == '?')
T[i] = 'D';
cout << T;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;
int main() {
string T;
cin >> T;
int N = T.size();
for (int i = 0; i < N; i++)
if (T[i] == '?')
T[i] = 'D';
cout << T;
return 0;
}
| [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 99 |
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
String t = sc.next();
StringBuilder sb = new StringBuilder(t);
for (int i = 0; i <= t.length(); i++) {
if (t.charAt(i) == '?') {
sb.setCharAt(i, 'D');
... | import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
String t = sc.next();
StringBuilder sb = new StringBuilder(t);
for (int i = 0; i < t.length(); i++) {
if (t.charAt(i) == '?') {
sb.setCharAt(i, 'D');
}... | [["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18]] | 3 | 105 |
S = input()
ns = ""
for i in S:
if i == '?':
ns += 'D'
else:
ns += 'P'
print(ns) | S = input()
ns = ""
for i in S:
if i == '?':
ns += 'D'
else:
ns += i
print(ns) | [["-", 8, 196, 0, 1, 0, 677, 12, 557, 0, 654], ["-", 8, 196, 0, 1, 0, 677, 12, 557, 0, 6], ["-", 8, 196, 0, 1, 0, 677, 12, 557, 0, 655], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]] | 5 | 37 |
/*
LANG:C++
PROB:
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x)... |
/*
LANG:C++
PROB:
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x)... | [["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125]] | 1 | 392 |
#include <bits/stdc++.h>
using namespace std;
// 総数を1000000007(素数)で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vec... | #include <bits/stdc++.h>
using namespace std;
// 総数を1000000007(素数)で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vec... | [["-", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125]] | 1 | 252 |
/* _
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
... | /* _
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 456 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define SORT(v) sort((... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define SORT(v) sort((... | [["-", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]] | 1 | 306 |
#include <bits/stdc++.h>
/* snippet: useful macros and functions */
#define ARC(i, a, b) for (Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for (Int i = (a)-1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
#define ALL(v) v.begin(), v.end()
template <class T> T rng(const T &a, const T ... | #include <bits/stdc++.h>
/* snippet: useful macros and functions */
#define ARC(i, a, b) for (Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for (Int i = (a)-1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
#define ALL(v) v.begin(), v.end()
template <class T> T rng(const T &a, const T ... | [["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125]] | 1 | 1,036 |
#include <bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL << ((ll)n))
#define SUBS(s, f, t) ((s).substr((f), (t) - (f)))
#define ALL... | #include <bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL << ((ll)n))
#define SUBS(s, f, t) ((s).substr((f), (t) - (f)))
#define ALL... | [["+", 0, 57, 75, 76, 0, 1, 0, 16, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 17, 151]] | 1 | 130 |
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
s = input()
s = s.replace("??",'PD')
s = s.replace("?",'D')
print(s) | #dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
s = input()
s = s.replace("P?",'PD')
s = s.replace("?",'D')
print(s) | [["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6]] | 5 | 88 |
import statistics
n = int(input())
la = []
lb = []
for i in range(n):
a, b = map(int, input().split())
la.append(a)
lb.append(b)
a = statistics.median(la)
b = statistics.median(lb)
if n % 2 == 1:
print(b - a + 1)
else:
print((b - a) * 2 - 1)
| import statistics
n = int(input())
la = []
lb = []
for i in range(n):
a, b = map(int, input().split())
la.append(a)
lb.append(b)
a = statistics.median(la)
b = statistics.median(lb)
if n % 2 == 1:
print(b - a + 1)
else:
print(int((b - a) * 2 + 1)) | [["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 99 |
from statistics import median
N = int(input())
A, B = [], []
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
mn = median(A)
mx = median(B)
if N % 2 == 1:
print(int(mx - mn + 1)) # mn, mn + 1, mn + 2, ..., mx
else:
print(int(mx - mn * 2 + 1)) # mn, mn + 0.5, m... | from statistics import median
N = int(input())
A, B = [], []
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
mn = median(A)
mx = median(B)
if N % 2 == 1:
print(int(mx - mn + 1)) # mn, mn + 1, mn + 2, ..., mx
else:
print(int((mx - mn) * 2 + 1)) # mn, mn + 0.5,... | [["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 25]] | 5 | 104 |
import sys
readline=sys.stdin.readline
N=int(readline())
A = [None] * N
B = [None] * N
for i in range(N):
A[i],B[i] = map(int,readline().split())
A = sorted(A)
B = sorted(B)
if N % 2 == 1:
# 奇数の場合
Amid = A[N // 2]
Bmid = B[N // 2]
print(Bmid - Amid + 1)
else:
# 偶数の場合
Amid = (A[N // 2] + A[(N // 2) - 1... | import sys
readline=sys.stdin.readline
N=int(readline())
A = [None] * N
B = [None] * N
for i in range(N):
A[i],B[i] = map(int,readline().split())
A = sorted(A)
B = sorted(B)
if N % 2 == 1:
# 奇数の場合
Amid = A[N // 2]
Bmid = B[N // 2]
print(Bmid - Amid + 1)
else:
# 偶数の場合
Amid = (A[N // 2] + A[(N // 2) - 1... | [["-", 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 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
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) {
i... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
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) {
i... | [["-", 31, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["-", 31, 16, 12, 16, 31, 16, 31, 16, 12, 13], ["-", 31, 16, 12, 16, 31, 16, 12, 16, 17, 48], ["-", 31, 16, 12, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]] | 1 | 223 |
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;
int main() {
int N;
cin >> N;
vec<int> l(N);
vec<int> r(N);
rep(i, N) { cin >> l[i] >> r[i]; }
sort(al... | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;
int main() {
int N;
cin >> N;
vec<int> l(N);
vec<int> r(N);
rep(i, N) { cin >> l[i] >> r[i]; }
sort(al... | [["-", 12, 16, 31, 23, 0, 16, 31, 16, 17, 85], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["-", 12, 16, 31, 23, 0, 16, 12, 16, 17, 85], ["-", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 193 |
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define maxn 5005
#define mod 998244353... | #include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define maxn 5005
#define mod 998244353... | [["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 85], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 279 |
n = int(input())
A = []
B = []
for _ in range(n):
v1, v2 = list(map(int, input().split(' ')))
A.append(v1)
B.append(v2)
A.sort()
B.sort()
if n % 2:
print(B[n//2] - A[n//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 _ in range(n):
v1, v2 = list(map(int, input().split(' ')))
A.append(v1)
B.append(v2)
A.sort()
B.sort()
if n % 2:
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, 12, 206, 206, 657, 12, 612], ["+", 0, 657, 31, 657, 12, 206, 206, 657, 12, 612]] | 5 | 133 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define MOD (1000000007)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> tup;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[M... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define MOD (1000000007)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> tup;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[M... | [["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 611 |
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll, ll>
#define fs first
#define sc second
template <cla... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll, ll>
#define fs first
#define sc second
template <cla... | [["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 532 |
#include <algorithm> // std::unique
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <sstream> // std::ostringstream
#include <string>
#include <unordered_map>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
using l... | #include <algorithm> // std::unique
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <sstream> // std::ostringstream
#include <string>
#include <unordered_map>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
using l... | [["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 665 |
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 == 1:
print(B[(N - 1) // 2] - A[(N - 1) // 2] + 1)
else:
print(((B[N // 2] + B[N // 2 - 1]) - (A[N // 2] + A[N // 2 - 1])) * 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.sort()
B.sort()
if N % 2 == 1:
print(B[(N - 1) // 2] - A[(N - 1) // 2] + 1)
else:
print(((B[N // 2] + B[N // 2 - 1]) - (A[N // 2] + A[N // 2 - 1])) + 1) | [["-", 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 | 141 |
//
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, start, end) for (int i = (int)start; i <= (int)end; i++)
#define vrep(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define vrep1(i, n) for (int i ... | //
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, start, end) for (int i = (int)start; i <= (int)end; i++)
#define vrep(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define vrep1(i, n) for (int i ... | [["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 1,238 |
#!python3
import numpy as np
LI = lambda: list(map(int, input().split()))
# input
N = int(input())
A, B = [None] * N, [None] * N
for i in range(N):
A[i], B[i] = LI()
def main():
a, b = np.array(A, dtype=int), np.array(B, dtype=int)
a.sort()
b.sort()
i = N // 2
if N % 2 == 0:
a *= 2
... | #!python3
import numpy as np
LI = lambda: list(map(int, input().split()))
# input
N = int(input())
A, B = [None] * N, [None] * N
for i in range(N):
A[i], B[i] = LI()
def main():
a, b = np.array(A, dtype=int), np.array(B, dtype=int)
a.sort()
b.sort()
i = N // 2
if N % 2 == 0:
a *= 2
... | [["+", 0, 14, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 14, 8, 196, 0, 57, 75, 76, 0, 102]] | 5 | 195 |
n = int(input())
min_s = []
max_s = []
for i in range(n):
a, b = map(int, input().split())
min_s.append(a)
max_s.append(b)
min_s.sort()
max_s.sort()
if n % 2 == 0:
min_med = (min_s[n//2-1] + min_s[n//2])/2
max_med = (max_s[n//2-1] + max_s[n//2])/2
print(int(max_med-min_med)*2+1)
else:
min_... | n = int(input())
min_s = []
max_s = []
for i in range(n):
a, b = map(int, input().split())
min_s.append(a)
max_s.append(b)
min_s.sort()
max_s.sort()
if n % 2 == 0:
min_med = (min_s[n // 2 - 1] + min_s[n // 2]) / 2
max_med = (max_s[n // 2 - 1] + max_s[n // 2]) / 2
print(int((max_med - min_med) *... | [["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 167 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
#define REP(i, n, m) for (ll i = n; i < (ll)m; ++i)
#define IREP(i, n, m) for (ll i = n - 1; i >= m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#d... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
#define REP(i, n, m) for (ll i = n; i < (ll)m; ++i)
#define IREP(i, n, m) for (ll i = n - 1; i >= m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#d... | [["-", 0, 43, 49, 50, 51, 41, 64, 16, 17, 85], ["-", 0, 43, 49, 50, 51, 41, 64, 16, 12, 13], ["-", 0, 41, 64, 23, 0, 16, 31, 16, 17, 48], ["-", 0, 41, 64, 23, 0, 16, 31, 16, 12, 13]] | 1 | 280 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<ll> A(n);
vector<ll> B(n);
for (int i = 0; i < n; i++) {
cin >> A[i] >> B[i];
}
sort(A.begin(), A.end());
sort(B.rbegin(), B.rend());
if (n % 2 == 0) {
ll a1 = A[n / 2 - 1];
ll a2 =... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<ll> A(n);
vector<ll> B(n);
for (int i = 0; i < n; i++) {
cin >> A[i] >> B[i];
}
sort(A.begin(), A.end());
sort(B.rbegin(), B.rend());
if (n % 2 == 0) {
ll a1 = A[n / 2 - 1];
ll a2 =... | [["+", 31, 16, 31, 16, 31, 16, 31, 91, 17, 33], ["-", 31, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["+", 31, 16, 12, 23, 0, 16, 31, 16, 17, 72]] | 1 | 215 |
n = int(input())
a = [0 for _ in range(n)]
b = a[:]
for i in range(n):
a[i],b[i] = map(int,input().split())
a.sort()
b.aort()
ans = 0
if n % 2 == 0:
l = a[n//2-1] + a[n//2]
h = b[n//2-1] + b[n//2]
ans += h - l + 1
else:
l = a[n//2]
h = b[n//2]
ans += h - l + 1
print(ans) | n = int(input())
a = [0 for _ in range(n)]
b = a[:]
for i in range(n):
a[i],b[i] = map(int,input().split())
a.sort()
b.sort()
ans = 0
if n % 2 == 0:
l = a[n//2-1] + a[n//2]
h = b[n//2-1] + b[n//2]
ans += h - l + 1
else:
l = a[n//2]
h = b[n//2]
ans += h - l + 1
print(ans) | [["-", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22]] | 5 | 146 |
N = int(input())
AB = []
for i in range(N):
AB.append(list(map(int, input().split())))
AB.sort()
if N % 2 == 0:
l1 = AB[N//2][0]
l2 = AB[N//2 - 1][0]
else:
l = AB[N//2][0]
AB.sort(key = lambda x: x[1])
if N % 2 == 0:
r1 = AB[N//2][1]
r2 = AB[N//2 - 1][1]
else:
r = AB[N//2][1]
if N % 2 == 0:
ans = ... | N = int(input())
AB = []
for i in range(N):
AB.append(list(map(int, input().split())))
AB.sort()
if N % 2 == 0:
l1 = AB[N//2][0]
l2 = AB[N//2 - 1][0]
else:
l = AB[N//2][0]
AB.sort(key = lambda x: x[1])
if N % 2 == 0:
r1 = AB[N//2][1]
r2 = AB[N//2 - 1][1]
else:
r = AB[N//2][1]
if N % 2 == 0:
ans = ... | [["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 108], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107]] | 5 | 187 |
from statistics import median
N=int(input())
A,B=[],[]
for i in range(N):
a,b=map(int,input().split())
A.append(a);B.append(b)
mA=median(A);mB=median(B)
if N%2:
ans=int(mB-mA)+1
else:
if mA//1==mA and mB//1==mB:
ans=int(mB-mA)*2-1
elif mA//1!=mA and mB//1==mB:
ans=(mB-(mA//1))*2
... | from statistics import median
N=int(input())
A,B=[],[]
for i in range(N):
a,b=map(int,input().split())
A.append(a);B.append(b)
mA=median(A);mB=median(B)
if N%2:
ans=int(mB-mA)+1
else:
if mA//1==mA and mB//1==mB:
ans=int(mB-mA)*2+1
elif mA//1!=mA and mB//1==mB:
ans=(mB-(mA//1))*2
... | [["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72]] | 5 | 188 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n = 200005;
int n, a[max_n], b[max_n];
int main() {
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 + n + 1);
if (n & 1)
printf("%d\n", b[(n + 1) / 2] - a[(n... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n = 200005;
int n, a[max_n], b[max_n];
int main() {
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 + n + 1);
if (n & 1)
printf("%d\n", b[(n + 1) / 2] - a[(n... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 183 |
n = int(input())
nums = [[0, 0] for _ in range(n)]
for i in range(n):
nums[i][0], nums[i][1] = map(int, input().split())
if n % 2 == 0:
# even
nums.sort(key=lambda x: x[0])
a = (nums[(n+1)//2 - 1][0] + nums[(n+1)//2][0])
nums.sort(key=lambda x: x[1])
b = (nums[(n+1)//2 - 1][1] + nums[(n+1)//2][1])
pr... | n = int(input())
nums = [[0, 0] for _ in range(n)]
for i in range(n):
nums[i][0], nums[i][1] = map(int, input().split())
if n % 2 == 0:
# even
nums.sort(key=lambda x: x[0])
a = (nums[(n+1)//2 - 1][0] + nums[(n+1)//2][0])
nums.sort(key=lambda x: x[1])
b = (nums[(n+1)//2 - 1][1] + nums[(n+1)//2][1])
pr... | [["-", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["-", 3, 4, 0, 657, 31, 657, 31, 23, 0, 25], ["-", 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 | 247 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << fi... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << fi... | [["-", 12, 16, 31, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72]] | 1 | 277 |
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG // GCC5.4.1で配列の範囲外アクセスをエラーにする
// cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
#define ALL(x) x.begin(), x.end()
typedef long long ll; // long long
typedef pair<int, int> pii; // pair<int,int>
typedef v... | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG // GCC5.4.1で配列の範囲外アクセスをエラーにする
// cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
#define ALL(x) x.begin(), x.end()
typedef long long ll; // long long
typedef pair<int, int> pii; // pair<int,int>
typedef v... | [["-", 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 | 263 |
# coding: utf-8
import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
def main():
n = ni()
bo = []
up = []
for _ in range(n):
a,b = na()
bo += [a]
up += [b]
... | # coding: utf-8
import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
def main():
n = ni()
bo = []
up = []
for _ in range(n):
a,b = na()
bo += [a]
up += [b]
... | [["-", 0, 657, 31, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 12, 22]] | 5 | 198 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std... | #include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std... | [["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 85], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 238 |
from sys import stdin
input = stdin.readline
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]
A = []
B = []
for a, b in ab:
A.append(a)
B.append(b)
A.sort()
B.sort
if N % 2 == 0:
a1 = A[N // 2 - 1]
b1 = B[N // 2 - 1]
a2 = A[N // 2]
b2 = B[N // 2]
xa = (a2 + a1) /... | from sys import stdin
input = stdin.readline
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]
A = []
B = []
for a, b in ab:
A.append(a)
B.append(b)
A.sort()
B.sort()
if N % 2 == 0:
a1 = A[N // 2 - 1]
b1 = B[N // 2 - 1]
a2 = A[N // 2]
b2 = B[N // 2]
xa = (a2 + a1)... | [["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 180 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
typedef vector<vpll> vvpl... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
typedef vector<vpll> vvpl... | [["-", 31, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33]] | 1 | 287 |
arr = []
a,b = [],[]
for _ in range(int(input())):
x,y = list(map(int,input().split()))
a.append(x)
b.append(y)
a.sort()
b.sort()
n = len(a)
if n%2!=0:
x = n//2
print(b[x]-a[x]+1)
else:
x = n//2
y = x-1
a1 = (a[y]+a[y])/2
b1 = (b[x]+b[y])/2
ans = (b1-a1)/0.5
print(int(ans)) | arr = []
a,b = [],[]
for _ in range(int(input())):
x,y = list(map(int,input().split()))
a.append(x)
b.append(y)
a.sort()
b.sort()
n = len(a)
if n%2!=0:
x = n//2
print(b[x]-a[x]+1)
else:
x = n//2
y = x-1
a1 = (a[x]+a[y])/2
b1 = (b[x]+b[y])/2
ans = (b1-a1)/0.5
print(int(ans)+1)... | [["-", 12, 657, 31, 23, 0, 657, 31, 206, 206, 22], ["+", 12, 657, 31, 23, 0, 657, 31, 206, 206, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 157 |
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define pb push_back
#define int long long
#define ios std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NUL... | #include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define pb push_back
#define int long long
#define ios std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NUL... | [["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33]] | 1 | 419 |
import numpy as np
N = int(input())
A = np.zeros(N)
B = np.zeros(N)
for i in range(N):
A[i], B[i] = map(int, input().split())
am = np.median(A)
bm = np.median(B)
if n % 2 == 0:
print(int((bm - am) * 2 + 1))
else:
print(int((bm - am) + 1)) | import numpy as np
N = int(input())
A = np.zeros(N)
B = np.zeros(N)
for i in range(N):
A[i], B[i] = map(int, input().split())
am = np.median(A)
bm = np.median(B)
if N % 2 == 0:
print(int((bm - am) * 2 + 1))
else:
print(int((bm - am) + 1)) | [["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22]] | 5 | 111 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ldb long double
#define rep(i, x, n, j) for (int i = x; i < (int)n; i += j)
#define F first
#define S second
#define per(i, x, n, j) for (int i = (int)n - 1; i >= 0; i -= j)
#define all(v) v.begin(), v.end()
#define sz(a) (int)a.size()
const i... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ldb long double
#define rep(i, x, n, j) for (int i = x; i < (int)n; i += j)
#define F first
#define S second
#define per(i, x, n, j) for (int i = (int)n - 1; i >= 0; i -= j)
#define all(v) v.begin(), v.end()
#define sz(a) (int)a.size()
const i... | [["-", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 344 |
import heapq as hp
n = int(input())
if n%2 ==0:
m = n//2 + 1
else:
m = (n+1) //2
a,b = [],[]
for i in range(0,n):
c = list(map(int, input().split()))
a.append(c[0])
b.append(c[1])
print(a,b)
la = hp.nlargest(m,a)
lb = hp.nlargest(m,b)
if n%2 == 0:
c = la[-1] + la[-2]
d = lb[-1] + lb[-2]
... | import heapq as hp
n = int(input())
if n%2 ==0:
m = n//2 + 1
else:
m = (n+1) //2
a,b = [],[]
for i in range(0,n):
c = list(map(int, input().split()))
a.append(c[0])
b.append(c[1])
la = hp.nlargest(m,a)
lb = hp.nlargest(m,b)
if n%2 == 0:
c = la[-1] + la[-2]
d = lb[-1] + lb[-2]
print(d-c... | [["-", 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 | 176 |
#include <bits/stdc++.h>
// typedef
//-------------------------#include <bits/stdc++.h>
const double pi = 3.141592653589793238462643383279;
using namespace std;
template <typename T = int> inline T readT() {
char c = getchar_unlocked();
bool neg = (c == '-');
T res = neg ? 0 : c - '0';
while (isdigit(c = get... | #include <bits/stdc++.h>
// typedef
//-------------------------#include <bits/stdc++.h>
const double pi = 3.141592653589793238462643383279;
using namespace std;
template <typename T = int> inline T readT() {
char c = getchar_unlocked();
bool neg = (c == '-');
T res = neg ? 0 : c - '0';
while (isdigit(c = get... | [["-", 31, 16, 12, 16, 31, 16, 31, 2, 63, 22], ["-", 12, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 31, 16, 12, 16, 31, 16, 12, 2, 63, 22], ["-", 12, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72]] | 1 | 1,893 |
// atcoder/abc169/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto &i : c)
#define unless(cond) if (!(cond))
using namespace std;
template <typename P, typename Q>
ostream &operator<<(ostream &os, pair<P, Q> p) {
os << "(" << p.first <<... | // atcoder/abc169/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto &i : c)
#define unless(cond) if (!(cond))
using namespace std;
template <typename P, typename Q>
ostream &operator<<(ostream &os, pair<P, Q> p) {
os << "(" << p.first <<... | [["-", 8, 9, 0, 37, 0, 16, 31, 118, 119, 120], ["+", 8, 9, 0, 37, 0, 16, 31, 118, 119, 120], ["-", 8, 9, 0, 37, 0, 16, 12, 118, 28, 22], ["+", 8, 9, 0, 37, 0, 16, 12, 118, 28, 22], ["-", 8, 9, 0, 37, 0, 16, 12, 118, 119, 120], ["+", 8, 9, 0, 37, 0, 16, 12, 118, 119, 120]] | 1 | 761 |
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i ... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i ... | [["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 446 |
def main():
import sys
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:
ma = (A[n//2]+A[n//2-1])/2
mb = (B[n//2]+B[n//2-1])/2
ans = int(2*(mb-ma) - 1... | def main():
import sys
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:
ma = (A[n//2]+A[n//2-1])/2
mb = (B[n//2]+B[n//2-1])/2
ans = int(2*(mb-ma) + 1... | [["-", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72]] | 5 | 180 |
#include <bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define ppll pair<pll, pll>
#define pii pair<int, int>
#define pb push_back
const ll inf = 2e18 + 7;
const ll mod = 1e9 + 7;
const ll N = 1e6 +... | #include <bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define ppll pair<pll, pll>
#define pii pair<int, int>
#define pb push_back
const ll inf = 2e18 + 7;
const ll mod = 1e9 + 7;
const ll N = 1e6 +... | [["-", 12, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33]] | 1 | 289 |
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:
sca=scb=N//2-1
lca=lcb=N//2
x=A[lca]+A[sca]
y=B[lcb]+B[scb]
print(x-y+1)
else:
ca=cb=N//2
ans=B[cb]-A[ca]+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:
sca=scb=N//2-1
lca=lcb=N//2
x=A[lca]+A[sca]
y=B[lcb]+B[scb]
print(y-x+1)
else:
ca=cb=N//2
ans=B[cb]-A[ca]+1
print(ans)
| [["-", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22]] | 5 | 141 |
#ifdef LOCAL
#include <header.hpp>
#else
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#endif
#define lp(i, l, r) for (auto i = regu(l); i <= decltype(i)(r); ++i)
#define rp(i, r, l) for (auto i = regu(r); i >= decltype(i)(l); --i)
#define lv(i, a) for (int i ... | #ifdef LOCAL
#include <header.hpp>
#else
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#endif
#define lp(i, l, r) for (auto i = regu(l); i <= decltype(i)(r); ++i)
#define rp(i, r, l) for (auto i = regu(r); i >= decltype(i)(l); --i)
#define lv(i, a) for (int i ... | [["-", 12, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33]] | 1 | 2,391 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define repr... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define repr... | [["-", 0, 11, 12, 16, 31, 16, 31, 16, 17, 85], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 12, 13]] | 1 | 344 |
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
n=INT()
A=[]
B=[]
for i in range(n):
a... | import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
n=INT()
A=[]
B=[]
for i in range(n):
a... | [["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 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, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 262 |
from copy import deepcopy
n = int(input())
X = []
As = []
Bs = []
for i in range(n):
A, B = list(map(int, input().split()))
As.append(A)
Bs.append(B)
As.sort()
Bs.sort()
if n % 2 == 1:
m = (n-1) // 2
print(Bs[m] - As[m] + 1)
else:
b_m = n // 2 - 1
a_m = b_m
min_mid = (As[b_m] + As[a_m... | from copy import deepcopy
n = int(input())
X = []
As = []
Bs = []
for i in range(n):
A, B = list(map(int, input().split()))
As.append(A)
Bs.append(B)
As.sort()
Bs.sort()
if n % 2 == 1:
m = (n-1) // 2
print(Bs[m] - As[m] + 1)
else:
b_m = n // 2 - 1
a_m = b_m + 1
min_mid = (As[b_m] + As[... | [["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 147 |
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect... | import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect... | [["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 12, 657, 31, 23, 0, 657, 12, 206, 51, 22], ["+", 0, 662, 12, 23, 0, 657, 12, 206, 51, 22]] | 5 | 434 |
import statistics
import math
from decimal import *
N = int(input())
n =[]
m =[]
for i in range(N):
a,b = list(map(int,input().split()))
n.append(a)
m.append(b)
nmean = Decimal(statistics.median(n))
mmean =Decimal(statistics.median(m))
if N%2 == 1:
print(mmean - nmean + 1)
else:
print(int(mmean ... | import statistics
import math
from decimal import *
N = int(input())
n =[]
m =[]
for i in range(N):
a,b = list(map(int,input().split()))
n.append(a)
m.append(b)
nmean = Decimal(statistics.median(n))
mmean =Decimal(statistics.median(m))
if N%2 == 1:
print(mmean - nmean + 1)
else:
print(int((mmean... | [["+", 31, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]] | 5 | 115 |
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
k, z = map(int, input().split())
kagen.append(k)
zyogen.append(z)
kk = sorted(kagen)
zz = sorted(zyogen)
if(n % 2 == 0):
aa = n // 2
x = kk[aa-1] + kk[a]
y = zz[aa-1] + zz[a]
print(y-x+1)
else:
aa = n // 2
x = kk[aa]
... | n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
k, z = map(int, input().split())
kagen.append(k)
zyogen.append(z)
kk = sorted(kagen)
zz = sorted(zyogen)
if(n % 2 == 0):
aa = n // 2
x = kk[aa-1] + kk[aa]
y = zz[aa-1] + zz[aa]
print(y-x+1)
else:
aa = n // 2
x = kk[aa... | [["-", 0, 1, 0, 662, 12, 657, 12, 206, 206, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 206, 206, 22]] | 5 | 143 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[100004];
ll ans, num[100004];
int main() {
cin >> n;
for (int i = 0; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 0; i--)
num[i] = num[i + 1] + a[i];
ll res = 0, now = 1;
for (int i = 0; i <= n; i++) {
res += now;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[100004];
ll ans, num[100004];
int main() {
cin >> n;
for (int i = 0; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 0; i--)
num[i] = num[i + 1] + a[i];
ll res = 0, now = 1;
for (int i = 0; i <= n; i++) {
res += now;
... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]] | 1 | 169 |
N = int(input())
n_l = [1]
n = 1
A = [int(a) for a in input().split()]
for i in range(1,N+1):
a = A[i-1]
n = (n - a) * 2
n_l.append(n)
if n <= 0:
Good = False
break
if n > A[N]:
counter = A[N]
m = A[N]
Good = True
else:
Good = False
if Good:
for i in range(N-1,-1,-1):... | N = int(input())
n_l = [1]
n = 1
A = [int(a) for a in input().split()]
for i in range(1,N+1):
a = A[i-1]
n = (n - a) * 2
n_l.append(n)
if n <= 0:
Good = False
break
if n >= A[N]:
counter = A[N]
m = A[N]
Good = True
else:
Good = False
if Good:
for i in range(N-1,-1,-1)... | [["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]] | 5 | 158 |
n = int(input())+1
a = list(map(int, input().split()))
m_node = [1]*n
node = 0
total = 0
if n == 1:
if a[0] != 1:
print("-1", end="")
exit()
else:
print("1", end="")
exit()
for i in range(1, n):
m_node[i] = (m_node[i-1] - a[i-1])*2
if m_node[i] <= 0:
print("-1",... | n = int(input())+1
a = list(map(int, input().split()))
m_node = [1]*n
node = 0
total = 0
if n == 1:
if a[0] != 1:
print("-1", end="")
exit()
else:
print("1", end="")
exit()
for i in range(1, n):
m_node[i] = (m_node[i-1] - a[i-1])*2
if m_node[i] <= 0:
print("-1",... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]] | 5 | 203 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, n) for (int i = 1; i <= (n); i++)
typedef long long ll;
typedef pair<int, int> pii;
ll INF = 1e15;
int main() {
ll n;
cin >> n;
vector<ll> a(n + 1);
vector<ll> lim(n + 1);
rep(i, n + 1) cin >> a[i];
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, n) for (int i = 1; i <= (n); i++)
typedef long long ll;
typedef pair<int, int> pii;
ll INF = 1e15;
int main() {
ll n;
cin >> n;
vector<ll> a(n + 1);
vector<ll> lim(n + 1);
rep(i, n + 1) cin >> a[i];
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 282 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include ... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]] | 1 | 743 |
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
long long i, sum = 0, leaf = 1;
long long l[n + 1], a[n + 1], ai[n + 1];
for (i = 0; i <= n; i++) {
cin >> a[i];
}
ai[n] = a[n];
for (i = n - 1; i >= 0; i--) {
ai[i] = a[i] + ai[i + 1];
... | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
long long i, sum = 0, leaf = 1;
long long l[n + 1], a[n + 1], ai[n + 1];
for (i = 0; i <= n; i++) {
cin >> a[i];
}
ai[n] = a[n];
for (i = n - 1; i >= 0; i--) {
ai[i] = a[i] + ai[i + 1];
... | [["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 264 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long int nord, allsum, temp;
cin >> n;
int a[n + 1];
allsum = 0;
for (int i = 0; i <= n; i++) {
cin >> a[i];
allsum = allsum + a[i];
}
temp = 1;
nord = allsum;
for (int i = 0; i <= n; i++) {
if (a[0] >= 2) {
break;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long int nord, allsum, temp;
cin >> n;
int a[n + 1];
allsum = 0;
for (int i = 0; i <= n; i++) {
cin >> a[i];
allsum = allsum + a[i];
}
temp = 1;
nord = allsum;
for (int i = 0; i <= n; i++) {
if (a[0] >= 2) {
nord = ... | [["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 1 | 193 |
n = gets.to_i
as = gets.split.map(&:to_i)
sum = 0
leafs = as.reduce(:+)
branches = 1
n.times do |i|
sum += branches
branches -= as[i]
leafs -= as[i]
if branches <= 0
p -1
exit
end
branches = [0, [leafs, branches * 2].min].max
end
p sum + leafs
| n = gets.to_i
as = gets.split.map(&:to_i)
sum = 0
leafs = as.reduce(:+)
branches = 1
(n+1).times do |i|
sum += branches
branches -= as[i]
leafs -= as[i]
if branches < 0
p -1
exit
end
branches = [0, [leafs, branches * 2].min].max
end
p sum + leafs
| [["+", 36, 36, 0, 493, 0, 652, 486, 739, 0, 24], ["+", 0, 493, 0, 652, 486, 739, 0, 738, 17, 72], ["+", 0, 493, 0, 652, 486, 739, 0, 738, 12, 612], ["+", 36, 36, 0, 493, 0, 652, 486, 739, 0, 25], ["-", 196, 737, 8, 736, 0, 121, 15, 738, 17, 19], ["+", 196, 737, 8, 736, 0, 121, 15, 738, 17, 18]] | 4 | 83 |
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main() {
int i, n, mx = 100000000000000, sum = 0;
cin >> n;
int a[n + 2];
int ans[n + 2];
for (i = 0; i <= n; i++) {
cin >> a[i];
}
if (!n) {
if (a[0] == 1) {
cout << "1";
return 0;
}
cout << "-1";... | #include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main() {
int i, n, mx = 1000000000000000000, sum = 0;
cin >> n;
int a[n + 2];
int ans[n + 2];
for (i = 0; i <= n; i++) {
cin >> a[i];
}
if (!n) {
if (a[0] == 1) {
cout << "1";
return 0;
}
cout << "... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 341 |
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/
const long long INF = 1e+18 + 1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef p... | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/
const long long INF = 1e+18 + 1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef p... | [["+", 0, 14, 8, 9, 0, 14, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["+", 15... | 1 | 432 |
def solve():
if N == 0:
if A[0] == 0:
return -1
else:
return 1
if A[0] != 0:
return -1
tot = sum(A)
cur = 1
ans = 1
for i in range(1, N + 1):
cur *= 2
if cur < A[i]:
return -1
tmp = min(cur, tot)
ans +=... | def solve():
if N == 0:
if A[0] == 1:
return 1
else:
return -1
if A[0] != 0:
return -1
tot = sum(A)
cur = 1
ans = 1
for i in range(1, N + 1):
cur *= 2
if cur < A[i]:
return -1
tmp = min(cur, tot)
ans +=... | [["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["-", 0, 57, 64, 196, 0, 37, 0, 664, 17, 33], ["+", 75, 76, 8, 196, 0, 37, 0, 664, 17, 33]] | 5 | 129 |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
N = read_int();
A = read_ints();
B = [0]*(N+1)
B[N] = A[N]
for i in range(N-1, -1, -1):
B[i] = B[i+1]+A[i]
nodes, answer = 1, 0
for i in range(N+1... |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
N = read_int();
A = read_ints();
B = [0]*(N+1)
B[N] = A[N]
for i in range(N-1, -1, -1):
B[i] = B[i+1]+A[i]
nodes, answer = 1, 0
for i in range(N+1... | [["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]] | 5 | 188 |
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int N = 100005;
int n;
int a[N];
long long f[N], g[N];
int main() {
scanf("%d", &n);
for (int i = 0; i <= n; i++)
scanf("%d", &a[i]);
if (a[0] != 0) {
printf("-1");
return 0;
}
g[n] = a[n];
for (int i = n - 1; i... | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int N = 100005;
int n;
int a[N];
long long f[N], g[N];
int main() {
scanf("%d", &n);
for (int i = 0; i <= n; i++)
scanf("%d", &a[i]);
if (a[0] > 1) {
printf("-1");
return 0;
}
g[n] = a[n];
for (int i = n - 1; i ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 261 |
N = int(input())
X = list(map(int, input().split()))
cnt = [0] * (N + 1)
cnt[0] = 1
for i in range(N):
cnt[i + 1] = (cnt[i] - X[i]) * 2
ans = 0
cur = 0
for i in reversed(range(N + 1)):
cur += X[i]
ans += min(cnt[i], cur)
if all(cnt[i] >= X[i] for i in range(N)):
print(ans)
else:
print(-1)
|
N = int(input())
X = list(map(int, input().split()))
cnt = [0] * (N + 1)
cnt[0] = 1
for i in range(N):
cnt[i + 1] = (cnt[i] - X[i]) * 2
ans = 0
cur = 0
for i in reversed(range(N + 1)):
cur += X[i]
ans += min(cnt[i], cur)
if all(cnt[i] >= X[i] for i in range(N + 1)):
print(ans)
else:
print(-1)
| [["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 138 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.