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> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vector<int>> vvi; typedef vector<string> vs; typedef unordered_set<int> si; typedef pair<int, int> pp; typedef vector<pp> vpp; #define trace(...) __f(#__VA_ARGS_...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vector<int>> vvi; typedef vector<string> vs; typedef unordered_set<int> si; typedef pair<int, int> pp; typedef vector<pp> vpp; #define trace(...) __f(#__VA_ARGS_...
[["-", 64, 1, 0, 11, 12, 69, 341, 342, 0, 13], ["+", 64, 1, 0, 11, 12, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 13]]
1
903
n, *x = map(int, input().split()) k = 'ABC' ans = [] s = [input() for _ in range(n)] for p in range(n): sp = s[p] if sp == 'AB': i = 0 j = 1 elif sp == 'BC': i = 1 j = 2 else: i = 0 j = 2 if x[i] == x[j] == 0: print('No') break if x...
n, *x = map(int, input().split()) k = 'ABC' ans = [] s = [input() for _ in range(n)] for p in range(n): sp = s[p] if sp == 'AB': i = 0 j = 1 elif sp == 'BC': i = 1 j = 2 else: i = 0 j = 2 if x[i] == x[j] == 0: print('No') break if x...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22]]
5
259
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) begin(x), end(x) using namespace std; typedef long long ll; typedef pair<int, int> P; int fab, fbc, fcd; int main() { int n; cin >> n; ll a, b, c; cin >> a >> b >> c; if (a + b + c == 0) { puts("No"); return 0; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) begin(x), end(x) using namespace std; typedef long long ll; typedef pair<int, int> P; int fab, fbc, fcd; int main() { int n; cin >> n; ll a, b, c; cin >> a >> b >> c; if (a + b + c == 0) { puts("No"); return 0; ...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72]]
1
637
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout <<...
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout <<...
[["-", 8, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 8, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
1,098
#include <bits/stdc++.h> #define ll long long #define rep(i, n) for (int i = 0; i < (int)n; i++) #define vll vector<ll> #define vi vector<int> #define pi pair<int, int> using namespace std; const string str = "ABC"; pi parse(string query) { pi ret; if (query == "AB") ret = pi(0, 1); if (query == "AC") ...
#include <bits/stdc++.h> #define ll long long #define rep(i, n) for (int i = 0; i < (int)n; i++) #define vll vector<ll> #define vi vector<int> #define pi pair<int, int> using namespace std; const string str = "ABC"; pi parse(string query) { pi ret; if (query == "AB") ret = pi(0, 1); if (query == "AC") ...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
442
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; inline void print() { cout << endl; } template <typename First, typename... Rest> void print(const First &first, const Rest &...rest) { cout << first << ' '; print(rest...); } void solve() { int N; cin >> N; map<char, int> mp; cin >> ...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; inline void print() { cout << endl; } template <typename First, typename... Rest> void print(const First &first, const Rest &...rest) { cout << first << ' '; print(rest...); } void solve() { int N; cin >> N; map<char, int> mp; cin >> ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
654
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_s...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_s...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 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
696
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n, a, b, c; string s; vector<string> V1; vector<char> V2; cin >> n >> a >> b >> c; for (int i = 0; i < n; i++) { cin >> s; V1.push_back(s); } V1.push_back(s); for (int i = 0; i < n; i++) { if (V1[i] == "AB...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n, a, b, c; string s; vector<string> V1; vector<char> V2; cin >> n >> a >> b >> c; for (int i = 0; i < n; i++) { cin >> s; V1.push_back(s); } V1.push_back(s); for (int i = 0; i < n; i++) { if (V1[i] == "AB...
[["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]]
1
476
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define fi first #define se second #define all(x) (x).begin(), (x).end() #define CST(x) cout << fixed << setprecision(x) using ll = long long; const ll MOD = 1000000007; const ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define fi first #define se second #define all(x) (x).begin(), (x).end() #define CST(x) cout << fixed << setprecision(x) using ll = long long; const ll MOD = 1000000007; const ...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47]]
1
716
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<int, int>; using Edge = pair<int, ll>; using Graph = vector<vector<int>>; using WeightedGraph = vector<vector<Edge>>; const ll INF = 1LL << 60; const int INF32 = 1 << 29; const ll MO...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<int, int>; using Edge = pair<int, ll>; using Graph = vector<vector<int>>; using WeightedGraph = vector<vector<Edge>>; const ll INF = 1LL << 60; const int INF32 = 1 << 29; const ll MO...
[["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]]
1
855
n,a,b,c = map(int, input().split()) ans = [] number = dict() number['A'] = a number['B'] = b number['C'] = c query = [input() for i in range(n)] for i in range(n): s = query[i] s_1, s_2 = s[0], s[1] if number[s_1] == 0 and number[s_2] == 0: print("No") exit() else: if number[s_1]...
n,a,b,c = map(int, input().split()) ans = [] number = dict() number['A'] = a number['B'] = b number['C'] = c query = [input() for i in range(n)] for i in range(n): s = query[i] s_1, s_2 = s[0], s[1] if number[s_1] == 0 and number[s_2] == 0: print("No") exit() else: if number[s_1]...
[["+", 15, 666, 0, 652, 3, 4, 0, 634, 0, 70], ["+", 15, 666, 0, 652, 3, 4, 0, 634, 0, 73]]
5
319
#pragma GCC optimize(2) #include <bits/stdc++.h> #define ll long long #define maxn 1000005 #define inf 1e9 #define pb push_back #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = a; i >= b; i--) using namespace std; inline int read() { int x = 0, w = 1; char c = getchar(); while ...
#pragma GCC optimize(2) #include <bits/stdc++.h> #define ll long long #define maxn 1000005 #define inf 1e9 #define pb push_back #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = a; i >= b; i--) using namespace std; inline int read() { int x = 0, w = 1; char c = getchar(); while ...
[["-", 12, 34, 12, 2, 3, 4, 0, 103, 0, 125], ["+", 12, 34, 12, 2, 3, 4, 0, 103, 0, 125]]
1
795
#include <bits/stdc++.h> #define boost \ ios::sync_with_stdio(false); \ cin.tie(0) #define ll long long int #define ld long double #define mk make_pair #define pb push_back #define f first #define s seco...
#include <bits/stdc++.h> #define boost \ ios::sync_with_stdio(false); \ cin.tie(0) #define ll long long int #define ld long double #define mk make_pair #define pb push_back #define f first #define s seco...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
597
#!/usr/bin/python3 # -*- coding: utf-8 -*- def check(s): if dict_x[s[0]] == 0 and dict_x[s[1]] == 0: return "NOT" elif dict_x[s[0]] > 0 and dict_x[s[1]] == 0: return s[1] elif dict_x[s[0]] == 0 and dict_x[s[1]] > 0: return s[0] elif dict_x[s[0]] == 1 and dict_x[s[1]] == 1: ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- def check(s): if dict_x[s[0]] == 0 and dict_x[s[1]] == 0: return "NOT" elif dict_x[s[0]] > 0 and dict_x[s[1]] == 0: return s[1] elif dict_x[s[0]] == 0 and dict_x[s[1]] > 0: return s[0] elif dict_x[s[0]] == 1 and dict_x[s[1]] == 1: ...
[["-", 0, 57, 75, 665, 15, 666, 0, 206, 51, 22], ["+", 0, 57, 75, 665, 15, 666, 0, 206, 51, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22]]
5
577
// not completed #include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int n; map<string, int> abc; cin >> n >> abc["A"] >> abc["B"] >> abc["C"]; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } vector<string> ans(n); string t1...
// not completed #include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int n; map<string, int> abc; cin >> n >> abc["A"] >> abc["B"] >> abc["C"]; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } vector<string> ans; string t1, t...
[["-", 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
423
#include <bits/stdc++.h> typedef long long ll; using namespace std; int a[3]; bool contains(string s, char c) { return s[0] == c || s[1] == c; } int main() { int n; cin >> n >> a[0] >> a[1] >> a[2]; vector<string> qs(n); for (auto &el : qs) cin >> el; // return 0; vector<int> nxt(n); nxt[n - 1] = n;...
#include <bits/stdc++.h> typedef long long ll; using namespace std; int a[3]; bool contains(string s, char c) { return s[0] == c || s[1] == c; } int main() { int n; cin >> n >> a[0] >> a[1] >> a[2]; vector<string> qs(n); for (auto &el : qs) cin >> el; // return 0; vector<int> nxt(n); nxt[n - 1] = n;...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
344
#include <algorithm> #include <climits> #include <cmath> #include <deque> #include <fstream> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define IOS \ ios_base::sync...
#include <algorithm> #include <climits> #include <cmath> #include <deque> #include <fstream> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define IOS \ ios_base::sync...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]]
1
571
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; struct X { int y, z; int id, tp; } s[maxn]; int n; char t[maxn]; bool cmp(const X &a, const X &b) { if (a.tp != b.tp) return a.tp < b.tp; if (a.tp == 2) { if (a.y != b.y) return a.y < b.y; return a.z > b.z; } else if...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; struct X { int y, z; int id, tp; } s[maxn]; int n; char t[maxn]; bool cmp(const X &a, const X &b) { if (a.tp != b.tp) return a.tp < b.tp; if (a.tp == 2) { if (a.y != b.y) return a.y < b.y; return a.z > b.z; } else if...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
453
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; using vec = vector<int>; using P = pair<int, int>; bool check(vector<P> s) { int sum = 0; for (P p : s) { if (sum + p.first < 0) { return false; } else { sum += p.second; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; using vec = vector<int>; using P = pair<int, int>; bool check(vector<P> s) { int sum = 0; for (P p : s) { if (sum + p.first < 0) { return false; } else { sum += p.second; ...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]]
1
273
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long; using ull = unsigned long long; constexpr ll LLINF{1001002003004005006}; // ll = 9*LLINF constexpr int INTINF{1000000000}; // int = 2*INTINF #define rep(i, n)...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long; using ull = unsigned long long; constexpr ll LLINF{1001002003004005006}; // ll = 9*LLINF constexpr int INTINF{1000000000}; // int = 2*INTINF #define rep(i, n)...
[["-", 8, 9, 0, 37, 0, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 37, 0, 23, 0, 16, 17, 18]]
1
600
#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> pii; 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<int, int> pii; 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) ...
[["-", 15, 339, 51, 16, 12, 91, 28, 118, 119, 120], ["+", 15, 339, 51, 16, 12, 91, 28, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 11, 12, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 11, 12, 118, 119, 120]]
1
431
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long int #define vi vector<int> #define ii pair<int, int> #define vli vector<ll> #define graph vector<vector<int>> #define vpi vector<pair<int, int>> #define vpli vector<pair<ll, ll>> #define mp make_pair #define F first #define S second...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long int #define vi vector<int> #define ii pair<int, int> #define vli vector<ll> #define graph vector<vector<int>> #define vpi vector<pair<int, int>> #define vpli vector<pair<ll, ll>> #define mp make_pair #define F first #define S second...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
562
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # (と)の数は同じ、最下点に注目 N = ir() S = [[1 if x == '(' else -1 for x in list(sr())] for _ in range(N)] pos = [] neg = [] for s in S: temp = 0 mi = 0 for x in s: temp += x ...
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # (と)の数は同じ、最下点に注目 N = ir() S = [[1 if x == '(' else -1 for x in list(sr())] for _ in range(N)] pos = [] neg = [] for s in S: temp = 0 mi = 0 for x in s: temp += x ...
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22]]
5
236
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef struct { int max_minus; // 0以下の数が入る int total; } s; bool psort(const s &a, const s &b) { return a.max_minus > b.max_minus; } bool msort(const s &a, const s &b) { return a.max_minus < b.max_minus; } int main(...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef struct { int max_minus; // 0以下の数が入る int total; } s; bool psort(const s &a, const s &b) { return a.max_minus > b.max_minus; } bool msort(const s &a, const s &b) { return a.max_minus < b.max_minus; } int main(...
[["+", 0, 9, 0, 1, 0, 11, 12, 91, 17, 33], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
457
import sys N = int(sys.stdin.readline().strip()) S = [] for _ in range(N): s_i = sys.stdin.readline().strip() S.append(s_i) # left bracket - right bracketを高さとした、最小の高さと最終的な高さの座標列 # ex) # ")": (-1, -1) # "(": (1, 1) # "()": (1, 0) # ")()(": (-1, 0) # "))))(((((: (-4, 1) plus_seqs = [] minus_seqs = [] for s_i ...
import sys N = int(sys.stdin.readline().strip()) S = [] for _ in range(N): s_i = sys.stdin.readline().strip() S.append(s_i) # left bracket - right bracketを高さとした、最小の高さと最終的な高さの座標列 # ex) # ")": (-1, -1) # "(": (1, 1) # "()": (1, 0) # ")()(": (-1, 0) # "))))(((((: (-4, 1) plus_seqs = [] minus_seqs = [] for s_i ...
[["-", 3, 4, 0, 660, 0, 657, 31, 664, 17, 33], ["-", 3, 4, 0, 660, 0, 657, 31, 664, 28, 612], ["-", 0, 652, 3, 4, 0, 660, 0, 657, 17, 48], ["+", 0, 652, 3, 4, 0, 660, 0, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 660, 0, 657, 12, 22]]
5
243
#include "bits/stdc++.h" using namespace std; #define cerr \ if (false) \ cerr #define what(x) cerr << #x << " = " << x << endl typedef int ll; typedef pair<ll, ll> ii; const int m...
#include "bits/stdc++.h" using namespace std; #define cerr \ if (false) \ cerr #define what(x) cerr << #x << " = " << x << endl typedef int ll; typedef pair<ll, ll> ii; const int m...
[["-", 12, 16, 12, 118, 28, 69, 341, 342, 0, 22], ["+", 12, 118, 28, 69, 341, 342, 0, 118, 28, 22], ["+", 12, 118, 28, 69, 341, 342, 0, 118, 17, 131], ["+", 12, 118, 28, 69, 341, 342, 0, 118, 119, 120]]
1
961
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define endl '\n' #define all(x) (x).begin(), (x).end() const int INF = 500 + 5; const int N = 200000 + 5; const ll oo = 1e18 + 5; const ll mod = 998244353; int main() { ios::sync_with_stdio(0); cin.tie(0); int n;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define endl '\n' #define all(x) (x).begin(), (x).end() const int INF = 500 + 5; const int N = 200000 + 5; const ll oo = 1e18 + 5; const ll mod = 998244353; int main() { ios::sync_with_stdio(0); cin.tie(0); int n;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
466
#include <bits/stdc++.h> #include <cstdio> using namespace std; #define rep(i, n) for (long i = 0; i < (n); i++) bool check(vector<pair<long, long>> target) { long v = 0; for (pair<long, long> s : target) { if (v < s.first) return false; v += s.second; } return true; } int main() { long n; c...
#include <bits/stdc++.h> #include <cstdio> using namespace std; #define rep(i, n) for (long i = 0; i < (n); i++) bool check(vector<pair<long, long>> target) { long v = 0; for (pair<long, long> s : target) { // cout << v << " " << s.first << endl; if (v + s.first < 0) return false; v += s.second; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 91, 17, 33]]
1
278
#include <algorithm> #include <cmath> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { long long n; ...
#include <algorithm> #include <cmath> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { long long n; ...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]]
1
354
N = int(input()) #INF = float('inf') def check(A): th = 0 #高さの合計 for i in range(len(A)): b = A[i][0] h = A[i][1] if th + b < 0: return False else: th += h return True L = [] R = [] goukei = 0 for i in range(N): temp = str(input()) b= 0 #最下点 h = 0 #ゴールの位置 for j in range(...
N = int(input()) #INF = float('inf') def check(A): th = 0 #高さの合計 for i in range(len(A)): b = A[i][0] h = A[i][1] if th + b < 0: return False else: th += h return True L = [] R = [] goukei = 0 for i in range(N): temp = str(input()) b= 0 #最下点 h = 0 #ゴールの位置 for j in range(...
[["-", 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
220
import java.util.*; class Main { public static void main(String[] args) { new Solver().run(); } } class Pair1 implements Comparable<Pair1> { int h; int b; public Pair1(int h, int b) { this.h = h; this.b = b; } @Override public int compareTo(Pair1 other) { return Integer.compare(this.b, othe...
import java.util.*; class Main { public static void main(String[] args) { new Solver().run(); } } class Pair1 implements Comparable<Pair1> { int h; int b; public Pair1(int h, int b) { this.h = h; this.b = b; } @Override public int compareTo(Pair1 other) { return -Integer.compare(this.b, oth...
[["+", 0, 195, 8, 196, 0, 37, 0, 91, 17, 33]]
3
393
#include <bits/stdc++.h> using namespace std; struct na { int l, r; bool operator<(const na &rr) const { return r < rr.l; } }; struct nb { int l, r; bool operator<(const nb &rr) const { return l > rr.r; } }; string s; int n; vector<na> a; vector<nb> b; // bool cmp(node x, node y){ // return x.r < y.r; //...
#include <bits/stdc++.h> using namespace std; struct na { int l, r; bool operator<(const na &rr) const { return r < rr.r; } }; struct nb { int l, r; bool operator<(const nb &rr) const { return l > rr.l; } }; string s; int n; vector<na> a; vector<nb> b; // bool cmp(node x, node y){ // return x.r < y.r; //...
[["-", 8, 9, 0, 37, 0, 16, 12, 118, 119, 120], ["+", 8, 9, 0, 37, 0, 16, 12, 118, 119, 120]]
1
410
#include <algorithm> #include <iostream> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) using namespace std; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } t...
#include <algorithm> #include <iostream> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) using namespace std; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } t...
[["+", 31, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 12, 13], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33]]
1
489
#include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define fi first #define se second #define mp make_pair #define tp tuple<int, int, int> #define mtp make_tuple int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<tp> up, down; for (int i = 0; i < ...
#include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define fi first #define se second #define mp make_pair #define tp tuple<int, int, int> #define mtp make_tuple int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<tp> up, down; for (int i = 0; i < ...
[["-", 64, 37, 0, 34, 31, 16, 12, 5, 0, 6], ["+", 64, 37, 0, 34, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
487
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<pair<int, int>> P(0); vector<pair<int, int>> M(0); int l, r, pp, pm, pos, n, b, h; string s; bool flgL = true, flgR = true; for (int i = 0; i < N; i++) { cin >> s; b = 0, h = 0; n = s.size(); for (int j =...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<pair<int, int>> P(0); vector<pair<int, int>> M(0); int l, r, pp, pm, pos, n, b, h; string s; bool flgL = true, flgR = true; for (int i = 0; i < N; i++) { cin >> s; b = 0, h = 0; n = s.size(); for (int j =...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
433
#include <bits/stdc++.h> #define ALL(a) (a).begin(), (a).end() #define sz(x) int(x.size()) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef vector<vector<long long>...
#include <bits/stdc++.h> #define ALL(a) (a).begin(), (a).end() #define sz(x) int(x.size()) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef vector<vector<long long>...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
1
532
N = int(input()) def cnt(s): r = [0] * (len(s)+1) for i, v in enumerate(s): if v == '(': r[i+1] = r[i] + 1 else: r[i+1] = r[i] - 1 return r[0], r[-1], min(r) # S1 := 始点 < 終点 S1 = [] # S2 := 始点 => 終点 S2 = [] for i in range(N): s = input() t = tuple(cnt(s)) ...
N = int(input()) def cnt(s): r = [0] * (len(s)+1) for i, v in enumerate(s): if v == '(': r[i+1] = r[i] + 1 else: r[i+1] = r[i] - 1 return r[0], r[-1], min(r) # S1 := 始点 < 終点 S1 = [] # S2 := 始点 => 終点 S2 = [] for i in range(N): s = input() t = tuple(cnt(s)) ...
[["+", 3, 4, 0, 653, 51, 670, 8, 657, 17, 33], ["+", 0, 653, 51, 670, 8, 657, 12, 206, 51, 22], ["+", 0, 653, 51, 670, 8, 657, 12, 206, 0, 70], ["+", 0, 653, 51, 670, 8, 657, 12, 206, 206, 612], ["+", 0, 653, 51, 670, 8, 657, 12, 206, 0, 73]]
5
290
// by szh #include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define SZ(x) (int((x).size())) #define se second #define ll long long #define pq priority_queue #define MP make_pair #define pii pair<int, int> #define mod 998244353 #define inf 0x3f3f3f3f #define debug(x) cerr << #x << "=" ...
// by szh #include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define SZ(x) (int((x).size())) #define se second #define ll long long #define pq priority_queue #define MP make_pair #define pii pair<int, int> #define mod 998244353 #define inf 0x3f3f3f3f #define debug(x) cerr << #x << "=" ...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
306
def main(): n = int(input()) l_0 = [] r_0 = [] ls_plus = [] ls_minus = [] sum_l = 0 sum_r = 0 for i in range(n): s = input() left, right = 0, 0 for j in range(len(s)): if s[j] == '(': right += 1 else: if righ...
def main(): n = int(input()) l_0 = [] r_0 = [] ls_plus = [] ls_minus = [] sum_l = 0 sum_r = 0 for i in range(n): s = input() left, right = 0, 0 for j in range(len(s)): if s[j] == '(': right += 1 else: if righ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
439
n = int(input()) lr1, lr2 = [], [] res = 0 for _ in range(n): s = input() m = len(s) l, r = 0, 0 tmp = 0 for i in range(m): if s[i] == ')': tmp += 1 else: tmp -= 1 l = max(l, tmp) tmp = 0 for i in range(m): if s[m-1-i] == '(': ...
n = int(input()) lr1, lr2 = [], [] res = 0 for _ in range(n): s = input() m = len(s) l, r = 0, 0 tmp = 0 for i in range(m): if s[i] == ')': tmp += 1 else: tmp -= 1 l = max(l, tmp) tmp = 0 for i in range(m): if s[m-1-i] == '(': ...
[["-", 3, 4, 0, 653, 51, 670, 8, 664, 17, 33]]
5
307
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; // template #define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define ALL(v) (v).begin(), (v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps = 1e-12; template <typename ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; // template #define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define ALL(v) (v).begin(), (v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps = 1e-12; template <typename ...
[["-", 0, 57, 64, 9, 0, 37, 0, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 37, 0, 16, 17, 47], ["-", 75, 76, 0, 9, 0, 37, 0, 16, 17, 18], ["+", 75, 76, 0, 9, 0, 37, 0, 16, 17, 47]]
1
444
#include <bits/stdc++.h> #define pii pair<int, int> using namespace std; const int MAXN = 1e6 + 7; const int INF = 1e9; vector<pii> vec; char s[MAXN]; stack<char> stk; int N, a[MAXN], v[MAXN]; #define lson (rt << 1) #define rson (rt << 1 | 1) struct node { int val, pos; } T[MAXN << 2]; node merge(node &x, node &y) {...
#include <bits/stdc++.h> #define pii pair<int, int> using namespace std; const int MAXN = 1e6 + 7; const int INF = 1e9; vector<pii> vec; char s[MAXN]; stack<char> stk; int N, a[MAXN], v[MAXN]; #define lson (rt << 1) #define rson (rt << 1 | 1) struct node { int val, pos; } T[MAXN << 2]; node merge(node &x, node &y) {...
[["-", 15, 339, 51, 16, 31, 16, 31, 118, 119, 120], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 15, 339, 51, 16, 31, 16, 12, 91, 17, 33], ["+", 15, 339, 51, 16, 31, 1...
1
874
#include <bits/stdc++.h> #define ll long long #define mem(f, x) memset(f, x, sizeof(f)) #define INF 0x3f3f3f3f #define pii pair<int, int> #define mk(x, y) make_pair(x, y) #define pk push_back #define fi first #define se second using namespace std; const int M = 1e6 + 50; const int N = 1e6 + 50; const int MAXN = 1e6 + 5...
#include <bits/stdc++.h> #define ll long long #define mem(f, x) memset(f, x, sizeof(f)) #define INF 0x3f3f3f3f #define pii pair<int, int> #define mk(x, y) make_pair(x, y) #define pk push_back #define fi first #define se second using namespace std; const int M = 1e6 + 50; const int N = 1e6 + 50; const int MAXN = 1e6 + 5...
[["-", 0, 57, 75, 76, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 17, 110]]
1
594
#include <bits/stdc++.h> #define pii pair<int, int> #define fi first #define se second #define mk(x, y) make_pair(x, y) #include <iostream> #define ll long long #define mem(f, x) memset(f, x, sizeof(f)) #define INF 0x3f3f3f3f using namespace std; const int M = 1e6 + 50; const int N = 1e6 + 50; const int MAXN = 1e6 + 50...
#include <bits/stdc++.h> #define pii pair<int, int> #define fi first #define se second #define mk(x, y) make_pair(x, y) #include <iostream> #define ll long long #define mem(f, x) memset(f, x, sizeof(f)) #define INF 0x3f3f3f3f using namespace std; const int M = 1e6 + 50; const int N = 1e6 + 50; const int MAXN = 1e6 + 50...
[["-", 8, 1, 0, 34, 12, 34, 12, 27, 17, 29], ["+", 8, 1, 0, 34, 12, 34, 12, 27, 17, 68], ["-", 8, 1, 0, 34, 12, 34, 12, 27, 17, 68], ["+", 8, 1, 0, 34, 12, 34, 12, 27, 17, 29]]
1
583
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pll; #define endl '\n' #define ff first #define ss second #define int long long #define pb push_back #define f(i, l, r) for (ll i = l; i <= r; i++) #define rf(i, r, l) for (l...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pll; #define endl '\n' #define ff first #define ss second #define int long long #define pb push_back #define f(i, l, r) for (ll i = l; i <= r; i++) #define rf(i, r, l) for (l...
[["-", 64, 9, 0, 1, 0, 11, 31, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 11, 31, 118, 119, 120]]
1
542
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pll; #define endl '\n' #define ff first #define ss second #define sz(v) (int)v.size() #define int long long #define pb push_back #define f(i, l, r) for (ll i = l; i <= r; i++...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pll; #define endl '\n' #define ff first #define ss second #define sz(v) (int)v.size() #define int long long #define pb push_back #define f(i, l, r) for (ll i = l; i <= r; i++...
[["-", 64, 9, 0, 1, 0, 11, 31, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 11, 31, 118, 119, 120]]
1
588
from sys import exit from itertools import accumulate,chain n,*s=open(0).read().split() t=[2*i.count("(")-len(i) for i in s] if sum(t)!=0: print("No");exit() st=[[min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0)),t_] for s_,t_ in zip(s,t)] now=0 for c in chain(sorted([x for x in st if x[1]>=0])[::-1...
from sys import exit from itertools import accumulate,chain n,*s=open(0).read().split() t=[2*i.count("(")-len(i) for i in s] if sum(t)!=0: print("No");exit() st=[[min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0)),t_] for s_,t_ in zip(s,t)] now=0 for c in chain(sorted([x for x in st if x[1]>=0])[::-1...
[["+", 0, 206, 51, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 206, 51, 652, 3, 4, 0, 653, 0, 32]]
5
220
from sys import exit from itertools import accumulate,chain n,*s=open(0).read().split() t=map(lambda x:2*x.count("(")-len(x),s) if sum(t)!=0: print("No") exit() #pypyではinitialだめ st=[[t_,min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0))] for s_,t_ in zip(s,t)] now=sum(map(lambda x:x[0],filter(la...
from sys import exit from itertools import accumulate,chain n,*s=open(0).read().split() t=list(map(lambda x:2*x.count("(")-len(x),s)) if sum(t)!=0: print("No") exit() #pypyではinitialだめ st=[[t_,min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0))] for s_,t_ in zip(s,t)] now=sum(map(lambda x:x[0],fil...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
285
#!/usr/bin/env python3 import sys input = sys.stdin.readline n = int(input()) increasing = [] decreasing = [] for _ in range(n): s = input().rstrip() minima = 0 fin = 0 for ch in s: if ch == ")": fin -= 1 if fin < minima: minima = fin else: ...
#!/usr/bin/env python3 import sys input = sys.stdin.readline n = int(input()) increasing = [] decreasing = [] for _ in range(n): s = input().rstrip() minima = 0 fin = 0 for ch in s: if ch == ")": fin -= 1 if fin < minima: minima = fin else: ...
[["-", 0, 652, 3, 4, 0, 660, 0, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 660, 0, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 660, 0, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 660, 0, 657, 12, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]]
5
193
// This template belongs to Juan Carlo Vieri #include <bits/stdc++.h> using namespace std; typedef int_fast64_t ll; typedef long double ld; typedef int_fast32_t intt; typedef int_fast32_t tmp_m; #define deb(x) cout << #x << ' ' << x << endl #define rep(i, cmp1, cmp2) for (tmp_m i = cmp1; i < cmp2; ++i) #define repp(i,...
// This template belongs to Juan Carlo Vieri #include <bits/stdc++.h> using namespace std; typedef int_fast64_t ll; typedef long double ld; typedef int_fast32_t intt; typedef int_fast32_t tmp_m; #define deb(x) cout << #x << ' ' << x << endl #define rep(i, cmp1, cmp2) for (tmp_m i = cmp1; i < cmp2; ++i) #define repp(i,...
[["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22]]
1
1,060
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #in...
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #in...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22]]
1
539
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) bool check(vector<pair<ll, ll>> s) { ll h = 0; for (auto p : s) { ll b = h + p.first; if (b < 0) return false; h += p.second; } return true; } int main() { ll N, sum = 0; c...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) bool check(vector<pair<ll, ll>> s) { ll h = 0; for (auto p : s) { ll b = h + p.first; if (b < 0) return false; h += p.second; } return true; } int main() { ll N, sum = 0; c...
[["+", 0, 1, 0, 2, 3, 4, 0, 91, 17, 33]]
1
277
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; #define fi first #define se second #define pb push_back #define mp make_pair int n; char a[N]; int l[N], r[N], cnt, vis[N], f[N]; char q[N]; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; #define fi first #define se second #define pb push_back #define mp make_pair int n; char a[N]; int l[N], r[N], cnt, vis[N], f[N]; char q[N]; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; i++) ...
[["-", 51, 16, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 16, 12, 69, 341, 342, 0, 22]]
1
537
#include <bits/stdc++.h> using namespace std; #define pb push_back const int M = 1e6 + 10; const int INF = 0x3f3f3f3f; char s[M]; vector<pair<int, int>> a, b, c; bool cmp1(pair<int, int> a, pair<int, int> b) { return a.first < b.first; } bool cmp2(pair<int, int> a, pair<int, int> b) { return a.second + b.first > b.se...
#include <bits/stdc++.h> using namespace std; #define pb push_back const int M = 1e6 + 10; const int INF = 0x3f3f3f3f; char s[M]; vector<pair<int, int>> a, b, c; bool cmp1(pair<int, int> a, pair<int, int> b) { return a.first > b.first; } bool cmp2(pair<int, int> a, pair<int, int> b) { return a.second + b.first > b.se...
[["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 47]]
1
495
#include <bits/stdc++.h> using namespace std; #define FOR(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)-1; i >= 0; --i) #define FORq(i, m, n) for (int i = (m); i <= (n); ++i) #define FORqr(i, m, n) for (int i = (n); i >= (m); --i) #define M...
#include <bits/stdc++.h> using namespace std; #define FOR(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)-1; i >= 0; --i) #define FORq(i, m, n) for (int i = (m); i <= (n); ++i) #define FORqr(i, m, n) for (int i = (n); i >= (m); --i) #define M...
[["+", 3, 4, 0, 2, 3, 4, 0, 91, 17, 33], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
590
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repo(i, n) for (int i = 1; i < (int)(n); i++) #define pb push_back #define mp make_pair #define np next_permutation #define fi first #define se se...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repo(i, n) for (int i = 1; i < (int)(n); i++) #define pb push_back #define mp make_pair #define np next_permutation #define fi first #define se se...
[["+", 49, 50, 51, 2, 3, 4, 0, 91, 17, 33]]
1
518
import sys readline = sys.stdin.readline def main(): N = int(readline()) Sp = [] Sm = [] total = 0 bm = 0 for i in range(N): l = readline() b = 0 h = 0 for j in range(len(l)): if l[j] == '(': h += 1 else: h -= 1 b = min(b, h) if h == 0 and b != 0: ...
import sys readline = sys.stdin.readline def main(): N = int(readline()) Sp = [] Sm = [] total = 0 bm = 0 for i in range(N): l = readline().strip() b = 0 h = 0 for j in range(len(l)): if l[j] == '(': h += 1 else: h -= 1 b = min(b, h) if h == 0 and b != ...
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
310
n = int(input()) S = [input() for i in range(n)] AB = [] for i in range(n): a, b = 0, 0 for c in S[i]: if c == '(': b += 1 if c == ')': if b > 0: b -= 1 else: a += 1 AB.append((a, b)) AB0 = [(a, b) for a, b in AB if -a + b >...
n = int(input()) S = [input() for i in range(n)] AB = [] for i in range(n): a, b = 0, 0 for c in S[i]: if c == '(': b += 1 if c == ')': if b > 0: b -= 1 else: a += 1 AB.append((a, b)) AB0 = [(a, b) for a, b in AB if -a + b >...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
211
n = int(input()) s = [input() for _ in range(n)] l = 0 r = 0 m = [] def fin(): print("No") exit() for word in s: stack = [] for e in word: if stack and stack[-1] == "(" and e == ")": stack.pop() else: stack.append(e) if stack: if stack[0] == ")" ...
n = int(input()) s = [input() for _ in range(n)] l = 0 r = 0 m = [] def fin(): print("No") exit() for word in s: stack = [] for e in word: if stack and stack[-1] == "(" and e == ")": stack.pop() else: stack.append(e) if stack: if stack[0] == ")" ...
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22]]
5
306
n = int(input()) lst_left = [] lst_right = [] total = 0 for i in range(n): s = input() h = 0 b = 0 for e in s: if e == "(": h += 1 else: h -= 1 b = min(b, h) if h>=0: lst_left.append((b, h)) else: lst_right.append((b-h, -h)) total += h #lst_left = sorted(lst_left, key=lam...
n = int(input()) lst_left = [] lst_right = [] total = 0 for i in range(n): s = input() h = 0 b = 0 for e in s: if e == "(": h += 1 else: h -= 1 b = min(b, h) if h>=0: lst_left.append((b, h)) else: lst_right.append((b-h, -h)) total += h #lst_left = sorted(lst_left, key=lam...
[["+", 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
252
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int N; string s[1001001]; int main() { cin.tie(NULL); ios_base::sync_with_stdio(false); cin >> N; int ab = 0; vector<pair<int, int>> P, Q; for (int i = 0; i < N; i++) { cin >> s[i]; int b = 0, mn = ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int N; string s[1001001]; int main() { cin.tie(NULL); ios_base::sync_with_stdio(false); cin >> N; int ab = 0; vector<pair<int, int>> P, Q; for (int i = 0; i < N; i++) { cin >> s[i]; int b = 0, mn = ...
[["+", 0, 2, 3, 4, 0, 83, 0, 91, 17, 33], ["-", 0, 2, 3, 4, 0, 83, 0, 16, 31, 22], ["-", 0, 2, 3, 4, 0, 83, 0, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 83, 0, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 83, 0, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
283
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1010101010; constex...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1010101010; constex...
[["-", 12, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["+", 12, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["-", 12, 16, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 12, 16, 12, 23, 0, 16, 12, 103, 0, 125]]
1
569
#include <bits/stdc++.h> using namespace std; // type alias typedef long long LL; typedef pair<int, int> II; typedef tuple<int, int, int> III; typedef vector<int> VI; typedef vector<string> VS; typedef unordered_map<int, int> MAPII; typedef unordered_set<int> SETI; template <class T> using VV = vector<vector<T>>; // mi...
#include <bits/stdc++.h> using namespace std; // type alias typedef long long LL; typedef pair<int, int> II; typedef tuple<int, int, int> III; typedef vector<int> VI; typedef vector<string> VS; typedef unordered_map<int, int> MAPII; typedef unordered_set<int> SETI; template <class T> using VV = vector<vector<T>>; // mi...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
2,493
"use strict"; var input = require("fs").readFileSync("/dev/stdin", "utf8"); var cin = input.split(/ |\n/), cid = 0; function next(a) { return a ? cin[cid++] : +cin[cid++]; } function nexts(n, a) { return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a); } function nextm(h, w, a) { var r = [], i ...
"use strict"; var input = require("fs").readFileSync("/dev/stdin", "utf8"); var cin = input.split(/ |\n/), cid = 0; function next(a) { return a ? cin[cid++] : +cin[cid++]; } function nexts(n, a) { return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a); } function nextm(h, w, a) { var r = [], i ...
[["+", 0, 2, 3, 3, 0, 516, 0, 16, 17, 72], ["+", 0, 2, 3, 3, 0, 516, 0, 16, 12, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 22]]
2
591
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); List<Pair> ls = new ArrayList<>(); List<Pair> rs = new ArrayList<>(); int total = 0; for (int i = 0; i < n; i++) { ...
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); List<Pair> ls = new ArrayList<>(); List<Pair> rs = new ArrayList<>(); int total = 0; for (int i = 0; i < n; i++) { ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22]]
3
409
#include <bits/stdc++.h> #define all(a) a.begin(), a.end() #define db(a) cout << fixed << #a << " = " << a << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pii> SSP; vector<pii> SSN; for (i...
#include <bits/stdc++.h> #define all(a) a.begin(), a.end() #define db(a) cout << fixed << #a << " = " << a << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pii> SSP; vector<pii> SSN; for (i...
[["-", 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, 119, 120], ["+", 8, 9, 0, 37, 0, 16, 12, 118, 119, 120]]
1
384
#include <bits/stdc++.h> using namespace std; template <class T> struct rge { T b, e; }; template <class T> rge<T> range(T i, T j) { return rge<T>{i, j}; } struct debug { #ifdef LOCAL ~debug() { cerr << endl; } template <class T> debug &operator<<(T x) { cerr << boolalpha << x; return *this; } template...
#include <bits/stdc++.h> using namespace std; template <class T> struct rge { T b, e; }; template <class T> rge<T> range(T i, T j) { return rge<T>{i, j}; } struct debug { #ifdef LOCAL ~debug() { cerr << endl; } template <class T> debug &operator<<(T x) { cerr << boolalpha << x; return *this; } template...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]]
1
750
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct seg { int balance, min; }; bool operator<(seg a, seg b) { return a.min > b.min; } bool check(vector<seg> plus) { sort(plus.begin(), plus.end()); int balance = 0; for (seg s : plus) { if (balance + s.min < 0) return 1; bal...
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct seg { int balance, min; }; bool operator<(seg a, seg b) { return a.min > b.min; } bool check(vector<seg> plus) { sort(plus.begin(), plus.end()); int balance = 0; for (seg s : plus) { if (balance + s.min < 0) return 1; bal...
[["-", 75, 76, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 75, 76, 0, 1, 0, 2, 63, 118, 28, 22]]
1
283
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> a(n); rep(i, n) { string s; cin >> s; int cnt = 0, mn = 0; for (char c : s) { if (c == '(') cnt++; else cnt--, mn = mi...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> a(n); rep(i, n) { string s; cin >> s; int cnt = 0, mn = 0; for (char c : s) { if (c == '(') cnt++; else cnt--, mn = mi...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72]]
1
291
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n; cin >> n; vector<string> s(n); vector<pair<int, int>> a(n); rep(i, n) { cin >> s[i]; int cnt = 0, mn = 0; for (char c : s[i]) { if (c == '(') cnt++; else ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n; cin >> n; vector<string> s(n); vector<pair<int, int>> a(n); rep(i, n) { cin >> s[i]; int cnt = 0, mn = 0; for (char c : s[i]) { if (c == '(') cnt++; else ...
[["-", 15, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 15, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["-", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6]]
1
341
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <sstream> // istringstream #include <string> #include <vector> using namespace std; // 最悪ケースでN^2かかるのでまずい // string del_kakko(string s){ // while(true){ // int ir_idx = s.find("()"); // if(ir_idx == string::npos){...
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <sstream> // istringstream #include <string> #include <vector> using namespace std; // 最悪ケースでN^2かかるのでまずい // string del_kakko(string s){ // while(true){ // int ir_idx = s.find("()"); // if(ir_idx == string::npos){...
[["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
876
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int lli; #define int lli typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<lli> vli; typedef vector<pii> vii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int lli; #define int lli typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<lli> vli; typedef vector<pii> vii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
976
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { // freopen("input.txt","r",stdin); int n; ll a, b, c; cin >> n >> a >> b >> c; vector<string> s(n); vector<char> ans; for (int i = 0; i < n; ++i) cin >> s[i]; for (int i = 0; i < n; ++i) { if (s[i] == "AB") { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { // freopen("input.txt","r",stdin); int n; ll a, b, c; cin >> n >> a >> b >> c; vector<string> s(n); vector<char> ans; for (int i = 0; i < n; ++i) cin >> s[i]; for (int i = 0; i < n; ++i) { if (s[i] == "AB") { ...
[["-", 64, 37, 0, 34, 31, 16, 12, 5, 0, 6], ["+", 64, 37, 0, 34, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
644
import sys from collections import deque def main(): N, A, B, C = map(int, input().split()) s_list = [input() for i in range(N)] select_list = deque() select_list.append('Yes') for i, i_s in enumerate(s_list): if i_s == 'AB': if A == 0 and B == 0: select_list = ...
import sys from collections import deque def main(): N, A, B, C = map(int, input().split()) s_list = [input() for i in range(N)] select_list = deque() select_list.append('Yes') for i, i_s in enumerate(s_list): if i_s == 'AB': if A == 0 and B == 0: select_list = ...
[["-", 64, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 64, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
485
n,a,b,c = map(int,input().split()) ans = [] S = [] for i in range(n):S.append(input()) for i in range(n): s = S[i] id = (i+1)%n if s=="AB": if a>b: a-=1 b+=1 ans.append("B") if a<b: a+=1 b-=1 ans.append("A") if a...
n,a,b,c = map(int,input().split()) ans = [] S = [] for i in range(n):S.append(input()) for i in range(n): s = S[i] id = (i+1)%n if s=="AB": if a>b: a-=1 b+=1 ans.append("B") elif a<b: a+=1 b-=1 ans.append("A") el...
[["-", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 75, 665, 0, 683]]
5
374
#include "bits/stdc++.h" #define FI first.first #define SE first.second #define TH second #define fi first #define se second #define th second using namespace std; void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_...
#include "bits/stdc++.h" #define FI first.first #define SE first.second #define TH second #define fi first #define se second #define th second using namespace std; void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_...
[["+", 12, 23, 0, 16, 31, 16, 31, 16, 17, 72], ["+", 12, 23, 0, 16, 31, 16, 31, 16, 12, 13]]
1
448
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define pll pair<ll, ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define fi first #define se second #define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #d...
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define pll pair<ll, ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define fi first #define se second #define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #d...
[["-", 0, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
1,075
#include <bits/stdc++.h> #define boost ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) using namespace std; using LL = long long; constexpr int MAXN = 1e5 + 5; template <typename T> inline void read(T &x) { int f = 1; x = 0; char ch = getchar(); while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = g...
#include <bits/stdc++.h> #define boost ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) using namespace std; using LL = long long; constexpr int MAXN = 1e5 + 5; template <typename T> inline void read(T &x) { int f = 1; x = 0; char ch = getchar(); while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = g...
[["-", 3, 4, 0, 16, 31, 16, 31, 69, 28, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 69, 28, 22]]
1
683
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define fastcin \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); using namespace std; int main() { fastcin int n, a,...
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define fastcin \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); using namespace std; int main() { fastcin int n, a,...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
640
#include <bits/stdc++.h> #define st first #define nd second using ll = long long; using namespace std; using pii = pair<int, int>; const int N = 1e5 + 10; char s[N][5]; int ans[N]; int main() { int n, a[3]; scanf("%d %d %d %d", &n, &a[0], &a[1], &a[2]); bool io = (1LL * a[0] + a[1] + a[2]) >= 3LL; for (int i =...
#include <bits/stdc++.h> #define st first #define nd second using ll = long long; using namespace std; using pii = pair<int, int>; const int N = 1e5 + 10; char s[N][5]; int ans[N]; int main() { int n, a[3]; scanf("%d %d %d %d", &n, &a[0], &a[1], &a[2]); bool io = (1LL * a[0] + a[1] + a[2]) >= 3LL; for (int i =...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 16, 31, 103, 0, 104], ["+", 0, 2, 3, 4, 0, 16, 31, 103, 0, 125], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72]]
1
467
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; char s[10], ans[N], s1[10]; int main() { int n, a[3]; scanf("%d%d%d%d%s", &n, a, a + 1, a + 2, s); if (a[s[0] - 'A'] + a[s[1] - 'A'] == 0) return puts("No"), 0; if (a[0] + a[1] + a[2] == 1) { ans[0] = a[s[0] - 'A'] == 0 ? s[0] : s[1]; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; char s[10], ans[N], s1[10]; int main() { int n, a[3]; scanf("%d%d%d%d%s", &n, a, a + 1, a + 2, s); if (a[s[0] - 'A'] + a[s[1] - 'A'] == 0) return puts("No"), 0; if (a[0] + a[1] + a[2] == 1) { ans[0] = a[s[0] - 'A'] == 0 ? s[0] : s[1]; ...
[["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
532
#include <algorithm> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> pii; const int N = 2e5 + 5; const int Mod = 1e9 + 7...
#include <algorithm> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> pii; const int N = 2e5 + 5; const int Mod = 1e9 + 7...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73]]
1
572
#include <bits/stdc++.h> using namespace std; #define int long long signed main(void) { int n, a, b, c; cin >> n >> a >> b >> c; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } bool flag = true; vector<char> ans; if (a + b + c == 0) { cout << "No" << endl; } else if (...
#include <bits/stdc++.h> using namespace std; #define int long long signed main(void) { int n, a, b, c; cin >> n >> a >> b >> c; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } bool flag = true; vector<char> ans; if (a + b + c == 0) { cout << "No" << endl; return 0; ...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["-", 0, 1, 0, 2, 3, 4, 0, 103, 0, 125], ["+", 0, 1, 0, 2, 3, 4, 0, 103, 0, 125]]
1
1,451
#include <bits/stdc++.h> #include <iostream> using namespace std; set<int> s1; const int MAXN = 3e5 + 5; int obs[MAXN]; int h[MAXN]; long long ans; vector<char> res; string s[MAXN]; map<long long, int> m1; int main() { int n; int a, b, c; cin >> n >> a >> b >> c; for (int i = 1; i <= n; i++) { cin >> s[i];...
#include <bits/stdc++.h> #include <iostream> using namespace std; set<int> s1; const int MAXN = 3e5 + 5; int obs[MAXN]; int h[MAXN]; long long ans; vector<char> res; string s[MAXN]; map<long long, int> m1; int main() { int n; int a, b, c; cin >> n >> a >> b >> c; for (int i = 1; i <= n; i++) { cin >> s[i];...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
582
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <st...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <st...
[["-", 0, 16, 31, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
1,612
N,A,B,C = map(int,input().split()) S = [input() for _ in range(N)] ANS = ['']*N for i in range(N): if S[i]=='AB': if A==0 and B==0: print('No') exit() if i != N-1 and A==B and S[i+1]!='AB': if S[i+1]=='AC': ANS[i] = 'A' A += 1 ...
N,A,B,C = map(int,input().split()) S = [input() for _ in range(N)] ANS = ['']*N for i in range(N): if S[i]=='AB': if A==0 and B==0: print('No') exit() if i != N-1 and A==B and S[i+1]!='AB': if S[i+1]=='AC': ANS[i] = 'A' A += 1 ...
[["-", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 75, 665, 0, 683], ["-", 0, 57, 75, 665, 64, 196, 0, 57, 0, 121], ["+", 75, 665, 64, 196, 0, 57, 75, 665, 0, 683]]
5
498
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<int> A(3); vector<string> s(n); vector<char> ans; for (auto &i : A) cin >> i; for (auto &i : s) cin >> i; for (int i = ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<int> A(3); vector<string> s(n); vector<char> ans; for (auto &i : A) cin >> i; for (auto &i : s) cin >> i; for (int i = ...
[["+", 15, 339, 51, 16, 31, 91, 28, 69, 28, 22], ["+", 51, 16, 31, 91, 28, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 91, 28, 69, 341, 342, 0, 73], ["+", 15, 339, 51, 16, 12, 91, 28, 69, 28, 22], ["+", 51, 16, 12, 91, 28, 69, 341, 342, 0, 70], ["+", 51, 16, 12, 91, 28, 69, 341, 342, 0, 73]]
1
398
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; //#define eps 1e-8 //#define eq(x,y) (fabs((x)-(y)) < eps) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; const ll mod = 998244353; lo...
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; //#define eps 1e-8 //#define eq(x,y) (fabs((x)-(y)) < eps) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; const ll mod = 998244353; lo...
[["-", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 147]]
1
1,249
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define P pair<int, int> #define fi first #define se second #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define pb push_back template <class T> void chmax(T &a, T b) { if (a < b) a = b; } t...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define P pair<int, int> #define fi first #define se second #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define pb push_back template <class T> void chmax(T &a, T b) { if (a < b) a = b; } t...
[["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
1,042
#pragma GCC target("avx") //#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define LL long long #define DB double #define ST string #define BS bitset #define PA pair<LL, LL> #define VE vector...
#pragma GCC target("avx") //#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define LL long long #define DB double #define ST string #define BS bitset #define PA pair<LL, LL> #define VE vector...
[["-", 64, 1, 0, 34, 31, 11, 12, 103, 0, 125], ["+", 64, 1, 0, 34, 31, 11, 12, 103, 0, 125]]
1
1,698
#include <bits/stdc++.h> using namespace std; #define LL long long //#define LL __int64 typedef pair<int, int> pii; template <typename T> inline void read(T &x) { static char _c; static bool _f; x = 0; _f = 0; _c = getchar(); while (_c < '0' || '9' < _c) { if (_c == '-') _f = true; _c = ge...
#include <bits/stdc++.h> using namespace std; #define LL long long //#define LL __int64 typedef pair<int, int> pii; template <typename T> inline void read(T &x) { static char _c; static bool _f; x = 0; _f = 0; _c = getchar(); while (_c < '0' || '9' < _c) { if (_c == '-') _f = true; _c = ge...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 57, 15, 339, 51, 91, 17, 111], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
1,880
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 5; int n; string s[N]; map<char, int> mp; char ans[N]; signed main() { cin >> n >> mp['A'] >> mp['B'] >> mp['C']; for (int i = 1; i <= n; i++) { cin >> s[i]; } for (int i = 1; i <= n; i++) { if (mp[s[i][0]] == 0 &...
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 5; int n; string s[N]; map<char, int> mp; char ans[N]; signed main() { cin >> n >> mp['A'] >> mp['B'] >> mp['C']; for (int i = 1; i <= n; i++) { cin >> s[i]; } for (int i = 1; i <= n; i++) { if (mp[s[i][0]] == 0 &...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
462
#include <bits/stdc++.h> #define f(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define F first #define S second #define int long long #define mod 1000000007 #define mmod 998244353 #define all(v) v.begin(), v.end() #define INF LLONG_MAX / 3 using namespace std; int mypow(int fa, int fb, int fc) { if (fb...
#include <bits/stdc++.h> #define f(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define F first #define S second #define int long long #define mod 1000000007 #define mmod 998244353 #define all(v) v.begin(), v.end() #define INF LLONG_MAX / 3 using namespace std; int mypow(int fa, int fb, int fc) { if (fb...
[["+", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95]]
1
1,011
#include <bits/stdc++.h> using namespace std; const string YES = "Yes"; const string NO = "No"; void solve(long long N, long long A, long long B, long long C, std::vector<std::string> s) { long long a = A, b = B, c = C; for (int i = 0; i < N; i++) { if (s[i] == "AB") { if (A > B || A == B && ...
#include <bits/stdc++.h> using namespace std; const string YES = "Yes"; const string NO = "No"; void solve(long long N, long long A, long long B, long long C, std::vector<std::string> s) { long long a = A, b = B, c = C; for (int i = 0; i < N; i++) { if (s[i] == "AB") { if (A > B || A == B && ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
703
#include <bits/stdc++.h> #define RI register int typedef long long LL; #define FILEIO(name) \ freopen(name ".in", "r", stdin), freopen(name ".out", "w", stdout); using namespace std; char buf[1000000], *p1 = buf, *p2 = buf; inline char gc() { if (p1 == p2...
#include <bits/stdc++.h> #define RI register int typedef long long LL; #define FILEIO(name) \ freopen(name ".in", "r", stdin), freopen(name ".out", "w", stdout); using namespace std; char buf[1000000], *p1 = buf, *p2 = buf; inline char gc() { if (p1 == p2...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
1,171
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define pb push_back #define pi pair<int, int> #define vi vector<int> #define vpi vector<pi> #define IOS ios_base::sync_with_stdio(false), cin.tie(NULL) const int N = 200002, M = 11; int a[N], b[N], c[N], h[N]; string s[N]; int r...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define pb push_back #define pi pair<int, int> #define vi vector<int> #define vpi vector<pi> #define IOS ios_base::sync_with_stdio(false), cin.tie(NULL) const int N = 200002, M = 11; int a[N], b[N], c[N], h[N]; string s[N]; int r...
[["-", 0, 37, 0, 34, 31, 16, 12, 5, 0, 6], ["+", 0, 37, 0, 34, 31, 16, 12, 5, 0, 6]]
1
478
k=int(input()) a,b=map(int,input().split()) import math if math.floor(b/k)-math.ceil(a/k)>=1: print('OK') else: print('NG')
k=int(input()) a,b=map(int,input().split()) import math if math.floor(b/k)-math.ceil(a/k)>=0: print('OK') else: print('NG')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
61
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) typedef vector<int> VI; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) typedef vector<int> VI; ...
[["+", 51, 16, 31, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 31, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 51, 16, 31, 16, 31, 16, 31, 23, 0, 25]]
1
231
#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 k, a, b, counts = 0; cin >> k >> a >> b; for (int i = a; i < b; i++) { if (i % k == 0) counts++; } if (counts != 0) cout << "OK" <<...
#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 k, a, b, counts = 0; cin >> k >> a >> b; for (int i = a; i < b + 1; i++) { if (i % k == 0) counts++; } if (counts != 0) cout << "OK...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
91
#include <bits/stdc++.h> using namespace std; int main() { int k, a, b, counts = 0; cin >> k >> a >> b; for (int i = 0; i < 142; i++) { if (k * i > a && k * i < b) { counts++; } } if (counts == 0) { cout << "NG" << endl; } else { cout << "OK" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int k, a, b, counts = 0; cin >> k >> a >> b; for (int i = 0; i < 142; i++) { if (k * i >= a && k * i <= b) { counts++; } } if (counts == 0) { cout << "NG" << endl; } else { cout << "OK" << endl; } }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
93