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
change_count
int64
0
100
#include <bits/stdc++.h> using namespace std; #define int long long #define stoi stoll using ll = long long; using vi = vector<int>; using pii = pair<int, int>; #define ALL(c) begin(c), end(c) #define RALL(c) rbegin(c), rend(c) #define ITR(i, b, e) for (auto i = (b); i != (e); ++i) #define FORE(x, c) for (auto &x : c) ...
#include <bits/stdc++.h> using namespace std; #define int long long #define stoi stoll using ll = long long; using vi = vector<int>; using pii = pair<int, int>; #define ALL(c) begin(c), end(c) #define RALL(c) rbegin(c), rend(c) #define ITR(i, b, e) for (auto i = (b); i != (e); ++i) #define FORE(x, c) for (auto &x : c) ...
[["-", 31, 69, 341, 342, 0, 16, 31, 16, 12, 13], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 12, 13]]
1
1,242
12
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template <class S, class T> ostream &operator<<(ostream &out, const pair<S, T> &o) { out << "(" << o.first << "," << o.second << ")"; return out; } tem...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template <class S, class T> ostream &operator<<(ostream &out, const pair<S, T> &o) { out << "(" << o.first << "," << o.second << ")"; return out; } tem...
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
1,347
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; #define fo(i, n) for (int i ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; #define fo(i, n) for (int i ...
[["-", 0, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["-", 28, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 28, 23, 0, 16, 12, 69, 341, 342, 0, 22]]
1
444
4
#include <bits/stdc++.h> using namespace std; const double eps = 0.0000000001; bool eq(double a, double b) { return (fabs(a - b) < eps); } struct Point { double x, y, z; Point operator+(Point p) { return (Point){x + p.x, y + p.y, z + p.z}; } Point operator-(Point p) { return (Point){x - p.x, y - p.y, z - p.z}...
#include <bits/stdc++.h> using namespace std; const double eps = 0.0000000001; bool eq(double a, double b) { return (fabs(a - b) < eps); } struct Point { double x, y, z; Point operator+(Point p) { return (Point){x + p.x, y + p.y, z + p.z}; } Point operator-(Point p) { return (Point){x - p.x, y - p.y, z - p.z}...
[["-", 0, 2, 3, 4, 0, 16, 31, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 16, 31, 118, 119, 120]]
1
1,131
2
require 'set' require 'matrix' def d2(x1, y1, z1, x2, y2, z2) (x1 - x2) ** 2 + (y1 - y2) ** 2 + (z1 - z2) ** 2 end loop do n, m, removable = gets.split.map(&:to_i) break if n == 0 baloons = (1..n).map {gets.split.map(&:to_i)} lights = (1..m).map {gets.split.map(&:to_i)} x0, y0, z0 = gets.split.map(&:to_i) inte...
require 'set' require 'matrix' def d2(x1, y1, z1, x2, y2, z2) (x1 - x2) ** 2 + (y1 - y2) ** 2 + (z1 - z2) ** 2 end loop do n, m, removable = gets.split.map(&:to_i) break if n == 0 baloons = (1..n).map {gets.split.map(&:to_i)} lights = (1..m).map {gets.split.map(&:to_i)} x0, y0, z0 = gets.split.map(&:to_i) inte...
[["-", 0, 121, 15, 738, 12, 738, 12, 738, 17, 48], ["+", 0, 121, 15, 738, 12, 738, 12, 738, 17, 578]]
4
441
2
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; inline int f(int n, int i, int L, const vector<int> &sum_rev) { return (sum_rev[i - n] - sum_rev[i]) + L * (n - 1); } int dp[50010]; int sum_dp[50010]; int main() { int W, N; while (cin >> W >> N && N) { vec...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; inline int f(int n, int i, int L, const vector<int> &sum_rev) { return (sum_rev[i - n] - sum_rev[i]) + L * (n - 1); } int dp[50010]; int sum_dp[50010]; int main() { int W, N; while (cin >> W >> N && N) { vec...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
579
2
import java.util.*; public class Main { public void solve() { Scanner sc = new Scanner(System.in); while (true) { int N = sc.nextInt(); int K = sc.nextInt(); int S = sc.nextInt(); while (N + K + S == 0) break; int ans = 0; for (int i = 0; i < (1 << N); i++) { ...
import java.util.*; public class Main { public void solve() { Scanner sc = new Scanner(System.in); while (true) { int N = sc.nextInt(); int K = sc.nextInt(); int S = sc.nextInt(); if (N + K + S == 0) break; int ans = 0; for (int i = 0; i < (1 << N); i++) { ...
[["-", 8, 196, 0, 52, 8, 196, 0, 52, 0, 89], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 121]]
3
197
2
#include <bits/stdc++.h> using namespace std; int main() { int n, k, s, f = 0; while (scanf("%d%d%d", &n, &k, &s) && n != 0 && k != 0 && s != 0) { int ans = 0; for (int i = 1; i < 1 << n; i++) { int sum = 0, cnt = 0; for (int j = 0; j < n; j++) { if (i & (1 << j)) { sum += (j...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, s, f = 0; while (scanf("%d%d%d", &n, &k, &s) && n != 0 && k != 0 && s != 0) { int ans = 0; for (int i = 1; i < 1 << n; i++) { int sum = 0, cnt = 0; for (int j = 0; j < n; j++) { if (i & (1 << j)) { sum += (j...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
151
1
#include <iostream> using namespace std; int main() { int n, k, s, ans, t, u; while (cin >> n >> k >> s, n) { int A[k]; if (k == 1) { if (n >= s) cout << 1 << endl; else cout << 0 << endl; } for (int i = 0; i < k - 1; ++i) A[i] = i + 1; A[k - 1] = s - k * (k - 1...
#include <iostream> using namespace std; int main() { int n, k, s, ans, t, u; while (cin >> n >> k >> s, n) { int A[k]; if (k == 1) { if (n >= s) cout << 1 << endl; else cout << 0 << endl; continue; } for (int i = 0; i < k - 1; ++i) A[i] = i + 1; A[k - 1] ...
[["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
1
324
2
while (h, w = gets.split.map(&:to_i)).inject(:+) != 0 do donut = Array.new count = Hash.new(0) h.times do donut.push(gets.chomp.chars) end h.times do |y| w.times do |x| dy = [0, 1, 1, 1, 0, -1, -1, -1] dx = [1, 1, 0, -1, -1, -1, 0, 1] 8.times do |i| used = Array.new(h){Array....
while (h, w = gets.split.map(&:to_i)).inject(:+) != 0 do donut = Array.new count = Hash.new(0) h.times do donut.push(gets.chomp.chars) end h.times do |y| w.times do |x| dy = [0, 1, 1, 1, 0, -1, -1, -1] dx = [1, 1, 0, -1, -1, -1, 0, 1] 8.times do |i| used = Array.new(h){Array....
[["-", 0, 652, 3, 4, 0, 754, 64, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 754, 64, 652, 735, 22]]
4
304
2
#include <bits/stdc++.h> using namespace std; vector<pair<int, int>> v[6005], v2[6005]; map<string, int> mp; int mpn, n, m, k; bool c[6005]; unsigned dis[6005]; char a[20]; int b[305]; queue<int> q; inline int s2i(string x) { if (!mp.count(x)) return mp[x] = mpn++; return mp[x]; } void spfa(int st) { int i...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int>> v[6005], v2[6005]; map<string, int> mp; int mpn, n, m, k; bool c[6005]; unsigned dis[6005]; char a[20]; int b[305]; queue<int> q; inline int s2i(string x) { if (!mp.count(x)) return mp[x] = mpn++; return mp[x]; } void spfa(int st) { int i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
791
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, n) for (int i = n - 1; i >= (0); i--) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define each(i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, n) for (int i = n - 1; i >= (0); i--) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define each(i...
[["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 13]]
1
822
2
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> using namespace std; #define INF 1000000000 int N, M, cap; string cityfrom, cityto; string cityname[3000][2]; string citystat[300]; int d[3000]; typedef pair<int, int> pii; typedef priority_...
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> using namespace std; #define INF 1000000000 int N, M, cap; string cityfrom, cityto; string cityname[3000][2]; string citystat[300]; int d[3000]; typedef pair<int, int> pii; typedef priority_...
[["-", 12, 2, 63, 118, 28, 69, 341, 342, 0, 22], ["+", 12, 2, 63, 118, 28, 69, 341, 342, 0, 22], ["-", 51, 118, 28, 69, 28, 69, 341, 342, 0, 22], ["+", 51, 118, 28, 69, 28, 69, 341, 342, 0, 22], ["-", 12, 118, 28, 69, 28, 69, 341, 342, 0, 22], ["+", 12, 118, 28, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 57, 15, 339, 51, 1...
1
849
8
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #incl...
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #incl...
[["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 47]]
1
1,424
2
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; struct edge { int to; int cost; }; int d[2001][6011]; vector<edge> G[6011]; bool isGas[10001]; map<string, int> m; int idx; int st, gl; int N, M, cap; const int INF = 1 << 30; typed...
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; struct edge { int to; int cost; }; int d[2001][6011]; vector<edge> G[6011]; bool isGas[10001]; map<string, int> m; int idx; int st, gl; int N, M, cap; const int INF = 1 << 30; typed...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
756
6
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
[["-", 8, 9, 0, 37, 0, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 37, 0, 23, 0, 16, 17, 47]]
1
832
2
#include <iostream> #include <map> #include <queue> #include <set> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) bool used[6000][2001]; vector<pair<short, short>> edge[6000]; int main() { while (true) { rep(i, 6000) edge[i].clear(); rep(i, 6000) rep(j, 2001) used[i][j] = false; ...
#include <iostream> #include <map> #include <queue> #include <set> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) bool used[6000][2001]; vector<pair<short, short>> edge[6000]; int main() { while (true) { rep(i, 6000) edge[i].clear(); rep(i, 6000) rep(j, 2001) used[i][j] = false; ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
599
2
import java.util.Arrays; import java.util.Scanner; // City Merger public class Main { int n; String[] s; int[][] cut; int[][] dp; int get(int S, int last) { if (dp[S][last] != -1) return dp[S][last]; int res = 1 << 29; int ns = S - (1 << last); for (int j = 0; j < n; j++) { if (...
import java.util.Arrays; import java.util.Scanner; // City Merger public class Main { int n; String[] s; int[][] cut; int[][] dp; int get(int S, int last) { if (dp[S][last] != -1) return dp[S][last]; int res = 1 << 29; int ns = S - (1 << last); for (int j = 0; j < n; j++) { if (...
[["-", 0, 7, 15, 16, 12, 492, 500, 504, 516, 22], ["+", 0, 7, 15, 16, 12, 492, 500, 504, 516, 22], ["-", 0, 57, 15, 15, 0, 492, 500, 504, 516, 22], ["+", 0, 57, 15, 15, 0, 492, 500, 504, 516, 22], ["-", 0, 492, 3, 4, 0, 492, 500, 504, 516, 22], ["+", 0, 492, 3, 4, 0, 492, 500, 504, 516, 22], ["-", 0, 11, 12, 16, 31, 49...
3
625
8
#include <bits/stdc++.h> using namespace std; int n; vector<string> str; string mem[15][15]; string con(string a, string b) { int K = 0; for (int i = 0; i < a.size(); i++) { int j = i, k = 0; while (a[j] && b[k] && a[j] == b[k]) j++, k++; if (!a[j] || !b[k]) K = max(K, k); } return b.su...
#include <bits/stdc++.h> using namespace std; int n; vector<string> str; string mem[15][15]; string con(string a, string b) { int K = 0; for (int i = 0; i < a.size(); i++) { int j = i, k = 0; while (a[j] && b[k] && a[j] == b[k]) j++, k++; if (!a[j] || !b[k]) K = max(K, k); } return b.su...
[["+", 0, 16, 31, 16, 12, 2, 63, 118, 17, 131], ["+", 0, 16, 31, 16, 12, 2, 63, 118, 119, 120], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
603
4
#ifndef VS #include <algorithm> #include <assert.h> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> #endif using namespace std; typedef long long LL; #ifdef BTK #define DEB...
#ifndef VS #include <algorithm> #include <assert.h> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> #endif using namespace std; typedef long long LL; #ifdef BTK #define DEB...
[["+", 28, 69, 341, 342, 0, 16, 31, 23, 0, 24], ["+", 28, 69, 341, 342, 0, 16, 31, 23, 0, 25], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13]]
1
1,931
4
#include <bits/stdc++.h> #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i, n) for (int i = 0; i < (int)n; ++i) using namespace std; typedef pair<int, int> P; const int MAX_N = 100005; int main() { while (1) { int n; scanf("%d", &n); if (n == 0) { ...
#include <bits/stdc++.h> #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i, n) for (int i = 0; i < (int)n; ++i) using namespace std; typedef pair<int, int> P; const int MAX_N = 100005; int main() { while (1) { int n; scanf("%d", &n); if (n == 0) { ...
[["+", 63, 118, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
756
3
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
[["-", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 0, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
675
2
/* * GCA : "Computer is artificial subject absolutely,Math is God" */ #include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> using namespace...
/* * GCA : "Computer is artificial subject absolutely,Math is God" */ #include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> using namespace...
[["+", 3, 4, 0, 69, 341, 342, 0, 69, 28, 22], ["+", 0, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 0, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
981
3
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22]]
1
2,785
2
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <t...
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <t...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 12, 5, ...
1
4,654
8
#include <bits/stdc++.h> using namespace std; int m, n; int ans[15]; int dp[2050][2050]; // S?????????????????£?????? using Set = bitset<12>; int rec(int asked, int answer) { // ??????????????????aked???answer??¨?????????????????? int &res = dp[asked][answer]; if (res != -1) return res; res = m; ...
#include <bits/stdc++.h> using namespace std; int m, n; int ans[150]; int dp[2050][2050]; // S?????????????????£?????? using Set = bitset<12>; int rec(int asked, int answer) { // ??????????????????aked???answer??¨?????????????????? int &res = dp[asked][answer]; if (res != -1) return res; res = m; ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
394
2
#include <algorithm> #include <climits> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> using namespace std; typedef unsigned long long ll; const int mod = 1000000007; int m, n; string g[129]; map<vector<string>, int> ma; in...
#include <algorithm> #include <climits> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> using namespace std; typedef unsigned long long ll; const int mod = 1000000007; int m, n; string g[129]; map<vector<string>, int> ma; in...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
341
2
import java.util.HashMap; import java.util.Scanner; import java.util.TreeSet; public class Main { static HashMap<String, String> groupdef; static String firstgroup; static TreeSet<String> members; static TreeSet<String> checked; static void get(String g) { String con = groupdef.get(g); int start ...
import java.util.HashMap; import java.util.Scanner; import java.util.TreeSet; public class Main { static HashMap<String, String> groupdef; static String firstgroup; static TreeSet<String> members; static TreeSet<String> checked; static void get(String g) { String con = groupdef.get(g); int start = ...
[["-", 64, 196, 0, 57, 15, 15, 0, 16, 17, 98], ["+", 0, 57, 64, 196, 0, 57, 15, 15, 0, 25], ["+", 0, 57, 64, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 15, 15, 0, 24], ["-", 0, 57, 64, 196, 0, 57, 64, 196, 0, 45]]
3
357
6
#include <bits/stdc++.h> using namespace std; typedef vector<int> row; typedef vector<row> matrix; matrix multi(const matrix &a, const matrix &b, const int mod) { matrix c(a.size(), row(b[0].size(), 0)); for (int i = 0; i < a.size(); i++) { for (int j = 0; j < b.size(); j++) { for (int k = 0; k < b[0]....
#include <bits/stdc++.h> using namespace std; typedef vector<int> row; typedef vector<row> matrix; matrix multi(const matrix &a, const matrix &b, const int mod) { matrix c(a.size(), row(b[0].size(), 0)); for (int i = 0; i < a.size(); i++) { for (int j = 0; j < b.size(); j++) { for (int k = 0; k < b[0]....
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
485
4
#include <iostream> #include <stdio.h> #include <valarray> using namespace std; int N, M, T; struct Matrix { valarray<int> a; int N; Matrix(int N0) : a(N0 * N0), N(N0) { a = 0; } int &access(int i, int j) { return a[i * N + j]; } const int &access(int i, int j) const { return this->a[i * N + j]; } Matrix(co...
#include <iostream> #include <stdio.h> #include <valarray> using namespace std; int N, M, T; struct Matrix { valarray<int> a; int N; Matrix(int N0) : a(N0 * N0), N(N0) { a = 0; } int &access(int i, int j) { return a[i * N + j]; } const int &access(int i, int j) const { return this->a[i * N + j]; } Matrix(co...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 2, 63, 22], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35]]
1
764
7
#include <cstdio> #include <valarray> using namespace std; typedef valarray<int> V; V e, s; int N, M; V mul(const V &a, const V &b) { V c(N * N); int i = 0, j; for (; i < N; i++) for (j = 0; j < N; j++) c[i * N + j] = (a[slice(i * N, N, 1)] * b[slice(j, N, N)]).sum() % M; return c; } V exp(const V &a,...
#include <cstdio> #include <valarray> using namespace std; typedef valarray<int> V; V e, s; int N, M; V mul(const V &a, const V &b) { V c(N * N); int i = 0, j; for (; i < N; i++) for (j = 0; j < N; j++) c[i * N + j] = (a[slice(i * N, N, 1)] * b[slice(j, N, N)]).sum() % M; return c; } V exp(const V &a,...
[["+", 8, 9, 0, 43, 49, 50, 51, 41, 15, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 41, 0, 101], ["+", 8, 9, 0, 43, 49, 50, 51, 41, 0, 102], ["+", 8, 9, 0, 43, 49, 50, 51, 41, 75, 22]]
1
429
4
#include <cstdio> #include <valarray> using namespace std; typedef valarray<int> V; int n, m; V z; V &Me(const V &_x, const V &_y) { int i = 0, j; for (; i < n; i++) for (j = 0; j < n; j++) z[i * n + j] = (_x[slice(i * n, n, 1)] * _y[slice(j, n, n)]).sum() % m; return z; } V &Mx(const V &_x) { int i =...
#include <cstdio> #include <valarray> using namespace std; typedef valarray<int> V; int n, m; V z; V &Me(const V &_x, const V &_y) { int i = 0, j; for (; i < n; i++) for (j = 0; j < n; j++) z[i * n + j] = (_x[slice(i * n, n, 1)] * _y[slice(j, n, n)]).sum() % m; return z; } V &Mx(const V &_x) { int i =...
[["+", 0, 7, 8, 9, 0, 7, 10, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13]]
1
544
3
#include <algorithm> #include <stdio.h> #include <string.h> #include <vector> using namespace std; typedef vector<int> vec; typedef vector<vec> mat; int N, M, A, B, C, T; mat mat_mul(mat &A, mat &B) { mat C(A.size(), vec(B[0].size())); for (int i = 0; i < A.size(); i++) for (int k = 0; k < B.size(); k++) ...
#include <algorithm> #include <stdio.h> #include <string.h> #include <vector> using namespace std; typedef vector<int> vec; typedef vector<vec> mat; int N, M, A, B, C, T; mat mat_mul(mat &A, mat &B) { mat C(A.size(), vec(B[0].size())); for (int i = 0; i < A.size(); i++) for (int k = 0; k < B.size(); k++) ...
[["-", 0, 41, 64, 69, 28, 69, 341, 342, 0, 13], ["+", 0, 41, 64, 69, 28, 69, 341, 342, 0, 22], ["-", 3, 4, 0, 41, 64, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 41, 64, 69, 341, 342, 0, 13]]
1
502
4
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdin....
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdin....
[["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22]]
5
869
4
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <ve...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <ve...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
757
4
#include <bits/stdc++.h> using namespace std; double calc(vector<double> x, vector<double> y, double X) { int n = x.size(); double answer = 0; for (int i = 0; i < n; i++) { double sub = y[i]; for (int j = 0; j < n; j++) { if (i != j) { sub *= (X - x[j]); sub /= (x[i] - x[j]); ...
#include <bits/stdc++.h> using namespace std; double calc(vector<double> x, vector<double> y, double X) { int n = x.size(); double answer = 0; for (int i = 0; i < n; i++) { double sub = y[i]; for (int j = 0; j < n; j++) { if (i != j) { sub *= (X - x[j]); sub /= (x[i] - x[j]); ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
349
2
#include <cmath> #include <iostream> using namespace std; int d; double pt[10]; bool lagrange(int x, int o) { int i, j; double p; double sum = 0; for (i = 0; i < d + 3; i++) { if (i != x && i != o) { p = pt[i]; for (j = 0; j < d + 3; j++) { if ((j != i && j != x) && j != o) { ...
#include <cmath> #include <iostream> using namespace std; int d; double pt[10]; bool lagrange(int x, int o) { int i, j; double p; double sum = 0; for (i = 0; i < d + 3; i++) { if (i != x && i != o) { p = pt[i]; for (j = 0; j < d + 3; j++) { if ((j != i && j != x) && j != o) { ...
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
297
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; #define fo(i, n) for (int i ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; #define fo(i, n) for (int i ...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 57, 64...
1
873
8
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; int dy[] = {-1, 0, 1, 0}; int dx[] = {0, 1, 0, -1}; int ey[] = {-1, -1, 0, 1, 2, 2, 1, 0}; int ex[] = {0, 1, 2, 2, 1, 0, -1, -1}; int H, W; char t[50][50]; int sy, sx; int py0, px0, py1, px1; int d[50][50]; int calc(in...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; int dy[] = {-1, 0, 1, 0}; int dx[] = {0, 1, 0, -1}; int ey[] = {-1, -1, 0, 1, 2, 2, 1, 0}; int ex[] = {0, 1, 2, 2, 1, 0, -1, -1}; int H, W; char t[50][50]; int sy, sx; int py0, px0, py1, px1; int d[50][50]; int calc(in...
[["+", 12, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 109], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
1,440
6
#include <bits/stdc++.h> using namespace std; using Int = long long; // BEGIN CUT HERE template <typename T> struct WeightedUnionFind { int n; T d; vector<int> r, p; vector<T> ws; WeightedUnionFind() {} WeightedUnionFind(int sz, T d_) : n(sz), d(d_), r(n, 1), p(n), ws(n, d) { iota(p.begin(), p.end(), 0)...
#include <bits/stdc++.h> using namespace std; using Int = long long; // BEGIN CUT HERE template <typename T> struct WeightedUnionFind { int n; T d; vector<int> r, p; vector<T> ws; WeightedUnionFind() {} WeightedUnionFind(int sz, T d_) : n(sz), d(d_), r(n, 1), p(n), ws(n, d) { iota(p.begin(), p.end(), 0)...
[["-", 0, 37, 0, 16, 31, 2, 3, 4, 0, 22], ["+", 0, 37, 0, 16, 31, 2, 3, 4, 0, 22], ["-", 0, 37, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 37, 0, 16, 12, 2, 3, 4, 0, 22]]
1
466
4
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; string s; int p; int T; int number() { int res = s[p] - '0'; p++; return res; } int formula() { int res = number(); for (;;) { if (s[p] == '*') { p++; res *= number(); } else { break; ...
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; string s; int p; int T; int number() { int res = s[p] - '0'; p++; return res; } int formula() { int res = number(); for (;;) { if (s[p] == '*') { p++; res *= number(); } else { break; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
319
2
#include <bits/stdc++.h> using namespace std; const int INF = 999; //世界一競技プログラミングができない人のソース2 #define int long long int get_number(string str, int &idx) { int ret = 0; while (isdigit(str[idx])) { ret = ret * 10 + str[idx] - '0'; ++idx; } return ret; } int Expression(string str, int &idx) { int ret = g...
#include <bits/stdc++.h> using namespace std; const int INF = 999; //世界一競技プログラミングができない人のソース2 #define int long long int get_number(string str, int &idx) { int ret = 0; while (isdigit(str[idx])) { ret = ret * 10 + str[idx] - '0'; ++idx; } return ret; } int Expression(string str, int &idx) { int ret = g...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95]]
1
377
1
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <sstream> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; typedef vector<ll> vl; typedef pair<ll, ll> pll; typedef vecto...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <sstream> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; typedef vector<ll> vl; typedef pair<ll, ll> pll; typedef vecto...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
745
6
#include <bits/stdc++.h> using namespace std; #define int long long template <class X> class Solve { public: string s; int p; Solve(string s_) { s = s_; s += "~"; p = 0; } X one() { X r = num(); while (s[p] == '+' || s[p] == '*') { char c = s[p]; p++; X l = num(); ...
#include <bits/stdc++.h> using namespace std; #define int long long template <class X> class Solve { public: string s; int p; Solve(string s_) { s = s_; s += "~"; p = 0; } X one() { X r = num(); while (s[p] == '+' || s[p] == '*') { char c = s[p]; p++; X l = num(); ...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
414
2
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
496
2
#include <bits/stdc++.h> using namespace std; int main() { string s; int n; cin >> s >> n; int a = s[0] - '0', c = s[0] - '0', b = 0; for (int i = 1; i < s.size(); i += 2) { int p = s[i + 1] - '0'; if (s[i] == '+') a += p, b += c, c = p; else a *= p, c *= p; } b += c; if (b == n ...
#include <bits/stdc++.h> using namespace std; int main() { string s; int n; cin >> s >> n; int a = s[0] - '0', c = s[0] - '0', b = 0; for (int i = 1; i < s.size(); i += 2) { int p = s[i + 1] - '0'; if (s[i] == '+') a += p, b += c, c = p; else a *= p, c *= p; } b += c; if (b == n ...
[["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
182
4
#include <iostream> #include <string> using namespace std; int ctoi(char c) { int i; char ch = '1'; for (i = 1; i < 10; i++) { if (c == ch) return i; else ch++; } return -1; } int main() { string s; cin >> s; int ans1 = 0, ans2, anss = 0; for (int i = 0; i < s.size(); i += 2) { ...
#include <iostream> #include <string> using namespace std; int ctoi(char c) { int i; char ch = '0'; for (i = 0; i < 10; i++) { if (c == ch) return i; else ch++; } return -1; } int main() { string s; cin >> s; int ans1 = 0, ans2, anss = 0; for (int i = 0; i < s.size(); i += 2) { ...
[["-", 8, 9, 0, 43, 49, 50, 51, 103, 0, 125], ["+", 8, 9, 0, 43, 49, 50, 51, 103, 0, 125], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
267
4
#include "bits/stdc++.h" using namespace std; int main() { string s; cin >> s; int n; cin >> n; int pu = 0; int ka = 0; vector<int> x(17, -1); vector<int> f(17, -1); int b = 0; int c = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '+') { pu++; f[c] = 0; b++; c+...
#include "bits/stdc++.h" using namespace std; int main() { string s; cin >> s; int n; cin >> n; int pu = 0; int ka = 0; vector<int> x(17, -1); vector<int> f(17, -1); int b = 0; int c = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '+') { pu++; f[c] = 0; b++; c+...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
462
6
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; #define all(a) a.begin(), a.end() int main() { int l = 0, n = 0, p; vector<int> a(1); string s; cin >> s >> p; l = a[0] = s[0] - '0'; for (int i = 2; i < s.size(); i += 2) { int t = s[i] - '0'; if (s[i - 1] == '*') { l *= ...
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; #define all(a) a.begin(), a.end() int main() { int l = 0, n = 0, p; vector<int> a(1); string s; cin >> s >> p; l = a[0] = s[0] - '0'; for (int i = 2; i < s.size(); i += 2) { int t = s[i] - '0'; if (s[i - 1] == '*') { l *= ...
[["+", 12, 69, 341, 342, 0, 16, 31, 23, 0, 24], ["+", 12, 69, 341, 342, 0, 16, 31, 23, 0, 25], ["+", 12, 69, 341, 342, 0, 16, 12, 23, 0, 24], ["+", 12, 69, 341, 342, 0, 16, 12, 23, 0, 25]]
1
185
4
e = gets.chomp a = gets.to_i x = eval e class Fixnum alias / - end y = eval(e.tr "+", "/") puts x == a && y == a ? ?U : x == a ? ?M : y == a ? ?L : ?I
e = gets.chomp a = gets.to_i x = eval e class Fixnum alias / + end y = eval(e.tr "+", "/") puts x == a && y == a ? ?U : x == a ? ?M : y == a ? ?L : ?I
[["-", 0, 269, 8, 736, 0, 705, 705, 17, 0, 33], ["+", 0, 269, 8, 736, 0, 705, 705, 17, 0, 72]]
4
59
2
s = input() a = int(input()) print("IMLU"[int(eval(s) == a)+int(eval("("*s.count("*")+s.replace("*",")*"))== a)<<1])
s = input() a = int(input()) print("IMLU"[int(eval(s) == a)+int(eval("("*s.count("*")+s.replace("*",")*")) == a)*2])
[["-", 0, 652, 3, 4, 0, 206, 206, 657, 17, 151], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612], ["+", 3, 4, 0, 206, 206, 657, 12, 657, 17, 48], ["+", 3, 4, 0, 206, 206, 657, 12, 657, 12, 612]]
5
66
4
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; int main() { int N, m; cin >> N >> m; vector<int> backs(N, false); for (int i = 0; i < m; ++i) { int t,...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; int main() { int N, m; cin >> N >> m; vector<int> backs(N, false); for (int i = 0; i < m; ++i) { int t,...
[["+", 0, 43, 49, 50, 51, 16, 12, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 16, 12, 16, 17, 48]]
1
153
2
#include <iostream> using namespace std; int n, q, a, b; int x[100000], sum; int main() { cin >> n >> q; for (int i = 0; i < q; i++) { cin >> a >> b; for (int j = a; j < b; j++) { x[j] = 1; } } for (int i = 0; i < n; i++) { sum += 1 + x[i] * 2; } cout << sum << endl; return 0; }
#include <iostream> using namespace std; int n, q, a, b; int x[100000], sum; int main() { cin >> n >> q; for (int i = 0; i < q; i++) { cin >> a >> b; for (int j = a; j < b; j++) { x[j] = 1; } } for (int i = 0; i < n; i++) { sum += 1 + x[i] * 2; } cout << sum + 1 << endl; return 0; ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
116
2
#include <bits/stdc++.h> using namespace std; typedef pair<int, string> State; const int v1[] = {1, 2, 3, 4, 5, 6, 7, 8, 0}; const int v2[] = {8, 0, 1, 2, 3, 4, 5, 6, 7}; const int v3[] = {6, 7, 8, 0, 1, 2, 3, 4, 5}; const int v4[] = {3, 4, 5, 6, 7, 8, 0, 1, 2}; int main() { int Horizon, Vertical; while (cin >> H...
#include <bits/stdc++.h> using namespace std; typedef pair<int, string> State; const int v1[] = {1, 2, 3, 4, 5, 6, 7, 8, 0}; const int v2[] = {8, 0, 1, 2, 3, 4, 5, 6, 7}; const int v3[] = {6, 7, 8, 0, 1, 2, 3, 4, 5}; const int v4[] = {3, 4, 5, 6, 7, 8, 0, 1, 2}; int main() { int Horizon, Vertical; while (cin >> H...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
696
4
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)m; i <...
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)m; i <...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22]]
1
656
2
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> PII; const int MAXN = 300000 + 10, inf = 1e9; struct Node { PII e; Node *ls, *rs; int dim, cur, sub; } pool[MAXN], *cnt; struct Point { int x, y, z; Point() {} Point(int _x, int _y, int _z) : x(_x), y(_y), z(_z) {} bool operator<(cons...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> PII; const int MAXN = 300000 + 10, inf = 1e9; struct Node { PII e; Node *ls, *rs; int dim, cur, sub; } pool[MAXN], *cnt; struct Point { int x, y, z; Point() {} Point(int _x, int _y, int _z) : x(_x), y(_y), z(_z) {} bool operator<(cons...
[["-", 49, 50, 51, 91, 28, 23, 0, 16, 31, 13], ["+", 49, 50, 51, 91, 28, 23, 0, 16, 31, 13], ["-", 3, 4, 0, 118, 28, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 118, 28, 69, 341, 342, 0, 22]]
1
791
6
#include <algorithm> #include <cstdlib> #include <iostream> #include <map> #include <tuple> #include <vector> using namespace std; typedef tuple<int, int, int> point; #define x(p) get<0>(p) #define y(p) get<1>(p) #define z(p) get<2>(p) int r(int &a, int &b) { static constexpr int C = ~(1 << 31); static constexpr ...
#include <algorithm> #include <cstdlib> #include <iostream> #include <map> #include <tuple> #include <vector> using namespace std; typedef tuple<int, int, int> point; #define x(p) get<0>(p) #define y(p) get<1>(p) #define z(p) get<2>(p) int r(int &a, int &b) { static constexpr int C = ~(1 << 31); static constexpr ...
[["-", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120], ["+", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120]]
1
725
2
#include <bits/stdc++.h> #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) #define PI 3.141592653589793238 #define int long long using namespace std; // COUNTER CLOCKWISE static const int CCW_COUNTER_CLOCKWISE = 1; static const int CCW_CLOCKWISE = -1; static const int CCW_ONLINE_BACK = 2; static const ...
#include <bits/stdc++.h> #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) #define PI 3.141592653589793238 #define int long long using namespace std; // COUNTER CLOCKWISE static const int CCW_COUNTER_CLOCKWISE = 1; static const int CCW_CLOCKWISE = -1; static const int CCW_ONLINE_BACK = 2; static const ...
[["+", 8, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 8, 1, 0, 11, 12, 16, 31, 16, 12, 22]]
1
4,737
2
#include <cstdio> #include <map> #include <queue> using namespace std; int main() { int n, m; scanf("%d%d", &n, &m); vector<int> start(n), end1(n), end2(n); for (int i = 0; i < n; i++) scanf("%d", &start[i]); { vector<int> p(m); for (int i = 0; i < m; i++) scanf("%d", &p[i]); for (int i ...
#include <cstdio> #include <map> #include <queue> using namespace std; int main() { int n, m; scanf("%d%d", &n, &m); vector<int> start(n), end1(n), end2(n); for (int i = 0; i < n; i++) scanf("%d", &start[i]); { vector<int> p(m); for (int i = 0; i < m; i++) scanf("%d", &p[i]); for (int i ...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 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], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
486
7
#include <bits/stdc++.h> using namespace std; int calc(int x, vector<int> b, const vector<int> &p) { const int n = b.size(); int res = 0; int index = 0; for (const auto &e : p) { for (int i = 0; i < e; ++i) { int next_index = index; while (next_index < n && b[next_index] != x) ++next_...
#include <bits/stdc++.h> using namespace std; int calc(int x, vector<int> b, const vector<int> &p) { const int n = b.size(); int res = 0; int index = 0; for (const auto &e : p) { for (int i = 0; i < e; ++i) { int next_index = index; while (next_index < n && b[next_index] != x) ++next_...
[["-", 3, 4, 0, 2, 3, 4, 0, 2, 63, 22], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
234
3
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int f(const vector<int> &b, const vector<int> &a) { int n = b.size(); { int s1 = 0, s2 = 0; rep(i, n) s1 += b[i], s2 += a[i]; if (s1 != s2) return 10000000; } vecto...
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int f(const vector<int> &b, const vector<int> &a) { int n = b.size(); { int s1 = 0, s2 = 0; rep(i, n) s1 += b[i], s2 += a[i]; if (s1 != s2) return 10000000; } vecto...
[["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 67], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 140]]
1
314
6
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define all(v) (v).begin(), (v).end() #define each(it, v) ...
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define all(v) (v).begin(), (v).end() #define each(it, v) ...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
436
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> using namespace std; int number[10]; int table[15][15]; bool check(int x) { for (int i = 4; i >= 1; --i) number[i] = x % 10, x /= 10; number[5] = 0; // check number for (int...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> using namespace std; int number[10]; int table[15][15]; bool check(int x) { for (int i = 4; i >= 1; --i) number[i] = x % 10, x /= 10; number[5] = 0; // check number for (int...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
410
2
#include "bits/stdc++.h" using namespace std; //#define int long long #define DBG 1 #define dump(o) \ if (DBG) { \ cerr << #o << " " << (o) << " "; ...
#include "bits/stdc++.h" using namespace std; //#define int long long #define DBG 1 #define dump(o) \ if (DBG) { \ cerr << #o << " " << (o) << " "; ...
[["-", 0, 9, 0, 57, 64, 9, 0, 43, 39, 40]]
1
560
1
#include <bits/stdc++.h> using namespace std; int x[10][10]; string tos(int num) { string res; while (num) { res += num % 10 + '0'; num /= 10; } reverse(res.begin(), res.end()); while (res.size() != 4) res = '0' + res; return res; } bool check2(string s) { int n = 0; for (int i = 0; i < s....
#include <bits/stdc++.h> using namespace std; int x[10][10]; string tos(int num) { string res; while (num) { res += num % 10 + '0'; num /= 10; } reverse(res.begin(), res.end()); while (res.size() != 4) res = '0' + res; return res; } bool check2(string s) { int n = 0; for (int i = 0; i < s....
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
463
2
#include <algorithm> #include <cmath> #include <ctime> #include <fstream> #include <iostream> #include <locale> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; long long t[10][10]; long long f(long long a[4]) { long long ...
#include <algorithm> #include <cmath> #include <ctime> #include <fstream> #include <iostream> #include <locale> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; long long t[10][10]; long long f(long long a[4]) { long long ...
[["-", 51, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
590
4
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int>::iterator I; int main() { int n, m; cin >> n >> m; vector<int> v[n]; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; v[y].push_back(-x); } for (int i = 0; i < n; i++) sort(v[i].begin(), v[i].end())...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int>::iterator I; int main() { int n, m; cin >> n >> m; vector<int> v[n]; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; v[y].push_back(-x); } for (int i = 0; i < n; i++) sort(v[i].begin(), v[i].end())...
[["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 22]]
1
457
4
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rrep2(i, a, b) for (int i = (a)-1; i >= b; i--) #define chmi...
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rrep2(i, a, b) for (int i = (a)-1; i >= b; i--) #define chmi...
[["-", 0, 1, 0, 11, 12, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 11, 12, 2, 63, 22]]
1
461
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define each(i, a) for (auto &&i : a) #define FOR(i, a, b) for (ll i = (a), __last_##i = (b); i < __last_##i; i++) #define RFOR(i, a, b) for (ll i = (b)-1, __last_##i = (a); i >= __last_##i; i--) #define REP(i, n) FOR(i, 0, n...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define each(i, a) for (auto &&i : a) #define FOR(i, a, b) for (ll i = (a), __last_##i = (b); i < __last_##i; i++) #define RFOR(i, a, b) for (ll i = (b)-1, __last_##i = (a); i >= __last_##i; i--) #define REP(i, n) FOR(i, 0, n...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
1,073
2
#include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << " = " << x << endl; #define ii pair<int, int> #define ll long long const int p1 = 1000000007; const int p2 = 1000000009; const int b = 300; const int ALPHA = 26; int pot1[ALPHA], pot2[ALPHA]; int main() { ios::sync_with_stdio(false); ci...
#include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << " = " << x << endl; #define ii pair<int, int> #define ll long long const int p1 = 1000000007; const int p2 = 1000000009; const int b = 300; const int ALPHA = 26; int pot1[ALPHA], pot2[ALPHA]; int main() { ios::sync_with_stdio(false); ci...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
713
2
#include <bits/stdc++.h> using namespace std; typedef int _loop_int; #define REP(i, n) for (_loop_int i = 0; i < (_loop_int)(n); ++i) #define FOR(i, a, b) for (_loop_int i = (_loop_int)(a); i < (_loop_int)(b); ++i) #define FORR(i, a, b) \ for (_loop_int i = (_...
#include <bits/stdc++.h> using namespace std; typedef int _loop_int; #define REP(i, n) for (_loop_int i = 0; i < (_loop_int)(n); ++i) #define FOR(i, a, b) for (_loop_int i = (_loop_int)(a); i < (_loop_int)(b); ++i) #define FORR(i, a, b) \ for (_loop_int i = (_...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
303
2
#include <bits/stdc++.h> using namespace std; using ll = __int128; const ll b = 1713302033171ll; ll Pow(ll x, ll n) { ll res = 1; while (n) { if (n & 1) { res = (res * x) % b; } x = (x * x) % b; n >>= 1; } return res; } int main() { vector<ll> prime; for (ll i = 100000; prime.size() ...
#include <bits/stdc++.h> using namespace std; using ll = __int128; const ll b = 1713302033171ll; ll Pow(ll x, ll n) { ll res = 1; while (n) { if (n & 1) { res = (res * x) % b; } x = (x * x) % b; n >>= 1; } return res; } int main() { vector<ll> prime; for (ll i = 100000; prime.size() ...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
556
4
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ? #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <lim...
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ? #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <lim...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22]]
1
510
2
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; vector<vector<short>> vec(t.size() + 1, vector<short>(26)); for (int i = 1; i <= t.size(); i++) { vec[i][t[i - 1] - 'a']++; for (int j = 0; j < 26; j++) { vec[i][j] += vec[i - 1][j]; } } vector<vecto...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; vector<vector<short>> vec(t.size() + 1, vector<short>(26)); for (int i = 1; i <= t.size(); i++) { vec[i][t[i - 1] - 'a']++; for (int j = 0; j < 26; j++) { vec[i][j] += vec[i - 1][j]; } } vector<vecto...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
430
2
#include <algorithm> #include <assert.h> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++...
#include <algorithm> #include <assert.h> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++...
[["-", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
821
10
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
[["-", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
427
2
#include <cmath> #include <iostream> #include <stdio.h> #define eps 1.0e-10 using namespace std; double d; int n, b; int p[15], h[15]; double coe[3]; void Lagrange(double x1, double y1, double x2, double y2, double x3, double y3) { double x[] = {x1, x2, x3}, y[] = {y1, y2, y3}; double l[3][3]; f...
#include <cmath> #include <iostream> #include <stdio.h> #define eps 1.0e-8 using namespace std; double d; int n, b; int p[15], h[15]; double coe[3]; void Lagrange(double x1, double y1, double x2, double y2, double x3, double y3) { double x[] = {x1, x2, x3}, y[] = {y1, y2, y3}; double l[3][3]; fo...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
857
6
#include <bits/stdc++.h> using namespace std; #define r(i, n) for (int i = 0; i < n; i++) typedef pair<int, int> P; #define F first #define S second int n, m, a1, a2, a3; int par[10001]; int rak[10001]; void init(int n) { for (int i = 0; i < n; i++) { par[i] = i; rak[i] = 1; } } int find(int x) { if (par[...
#include <bits/stdc++.h> using namespace std; #define r(i, n) for (int i = 0; i < n; i++) typedef pair<int, int> P; #define F first #define S second int n, m, a1, a2, a3; int par[10001]; int rak[10001]; void init(int n) { for (int i = 0; i < n; i++) { par[i] = i; rak[i] = 1; } } int find(int x) { if (par[...
[["-", 8, 9, 0, 37, 0, 16, 31, 16, 17, 60], ["+", 8, 9, 0, 37, 0, 16, 31, 16, 17, 79], ["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 98], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 106], ["-", 8, 9, 0, 37, 0, 16, 12, 16, 17, 60], ["+", 8, 9, 0, 37, 0, 16, 12, 16, 17, 79], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0,...
1
645
8
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> // #include <boost/multiprecision/cpp_int.hpp> #include <functional> #define int long long #define inf 1000000007 #define pa pai...
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> // #include <boost/multiprecision/cpp_int.hpp> #include <functional> #define int long long #define inf 1000000007 #define pa pai...
[["+", 12, 118, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
2,442
3
#include <bits/stdc++.h> using namespace std; struct T; #define null ((T *)NULL) typedef int ll; struct T { ll v; ll m; int c; T *l, *r; bool lz; ll lazy; T() {} T(ll v) : v(v), m(v), c(1), l(null), r(null), lz(false), lazy(0) {} }; int hogeS = 0; #define SSS 2222222 T hoge[SSS]; inline T *New(int ...
#include <bits/stdc++.h> using namespace std; struct T; #define null ((T *)NULL) typedef int ll; struct T { ll v; ll m; int c; T *l, *r; bool lz; ll lazy; T() {} T(ll v) : v(v), m(v), c(1), l(null), r(null), lz(false), lazy(0) {} }; int hogeS = 0; #define SSS 2222222 T hoge[SSS]; inline T *New(int ...
[["-", 0, 14, 8, 9, 0, 37, 0, 41, 75, 22], ["+", 0, 14, 8, 9, 0, 37, 0, 41, 75, 22]]
1
1,257
2
#include <stdio.h> int main(void) { int n, a, i, ii, y, s[2048]; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%d", &a); s[i] = a; } for (i = 0; i <= 9; i++) { y = 0; for (ii = 1; ii <= n; ii++) { if (s[n] == i) { y = 1; break; } } if (y == 0) { ...
#include <stdio.h> int main(void) { int n, a, i, ii, y, s[2048]; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%d", &a); s[i] = a; } for (i = 0; i <= 9; i++) { y = 0; for (ii = 1; ii <= n; ii++) { if (s[ii] == i) { y = 1; break; } } if (y == 0) { ...
[["-", 0, 57, 15, 23, 0, 16, 31, 69, 71, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 71, 22], ["-", 15, 23, 0, 16, 31, 16, 31, 69, 71, 22], ["+", 15, 23, 0, 16, 31, 16, 31, 69, 71, 22], ["-", 0, 16, 12, 16, 31, 69, 71, 16, 31, 22], ["+", 0, 16, 12, 16, 31, 69, 71, 16, 31, 22], ["-", 0, 16, 31, 16, 31, 16, 31, 69, 71, 22],...
0
331
12
#include <bits/stdc++.h> #define REP(x, y, z) for (int x = y; x <= z; x++) #define FORD(x, y, z) for (int x = y; x >= z; x--) #define MSET(x, y) memset(x, y, sizeof(x)) #define FOR(x, y) for (__typeof(y.begin()) x = y.begin(); x != y.end(); x++) #define F first #define S second #define MP make_pair #define PB push_back...
#include <bits/stdc++.h> #define REP(x, y, z) for (int x = y; x <= z; x++) #define FORD(x, y, z) for (int x = y; x >= z; x--) #define MSET(x, y) memset(x, y, sizeof(x)) #define FOR(x, y) for (__typeof(y.begin()) x = y.begin(); x != y.end(); x++) #define F first #define S second #define MP make_pair #define PB push_back...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
259
2
#include <iostream> using namespace std; int main() { int n; string s; cin >> n; for (int i = 0; i < n; i++) { int d; cin >> d; s += to_string(d); } for (int i = 1; 1; i++) { if (s.find(to_string(i)) != string::npos) continue; cout << i << endl; break; } return 0; }
#include <iostream> using namespace std; int main() { int n; string s; cin >> n; for (int i = 0; i < n; i++) { int d; cin >> d; s += to_string(d); } for (int i = 0; 1; i++) { if (s.find(to_string(i)) != string::npos) continue; cout << i << endl; break; } return 0; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
95
2
#include <iostream> #include <vector> using namespace std; int n, m, x[3], a, b, dist[55]; vector<int> G[55]; bool dp[55][55][109]; int main() { cin >> n >> m; for (int i = 0; i < 3; i++) cin >> x[i]; for (int i = 0; i < m; i++) { cin >> a >> b; a--, b--; G[a].push_back(b); } for (int i = 0; i...
#include <iostream> #include <vector> using namespace std; int n, m, x[3], a, b, dist[55]; vector<int> G[55]; bool dp[55][55][109]; int main() { cin >> n >> m; for (int i = 0; i < 3; i++) cin >> x[i]; for (int i = 0; i < m; i++) { cin >> a >> b; a--, b--; G[a].push_back(b); } for (int i = 0; i...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
388
2
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define INF 1e9 using vi = vector<int>; using vvi = vector<vi>; vvi matmul(vvi a, int p) { int n = a.size(); auto r = a; rep(_, p - 1) {...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define INF 1e9 using vi = vector<int>; using vvi = vector<vi>; vvi matmul(vvi a, int p) { int n = a.size(); auto r = a; rep(_, p - 1) {...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 160]]
1
470
2
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() vvi matmul(vvi a, vvi b) { int n = a.size(); vvi d(n, vi(n, 0)); rep(i, n) rep(j, n) rep(k, n) d[i][j] |= a[i][k] & b[k][j]; return d; } ...
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() vvi matmul(vvi a, vvi b) { int n = a.size(); vvi d(n, vi(n, 0)); rep(i, n) rep(j, n) rep(k, n) d[i][j] |= a[i][k] & b[k][j]; return d; } ...
[["-", 36, 36, 0, 30, 0, 43, 0, 114, 0, 115], ["-", 36, 36, 0, 30, 0, 43, 39, 344, 141, 78], ["+", 36, 36, 0, 30, 0, 43, 39, 344, 141, 78], ["+", 36, 36, 0, 30, 0, 14, 0, 114, 0, 174], ["-", 0, 37, 0, 11, 12, 41, 15, 16, 17, 79], ["+", 0, 37, 0, 11, 12, 41, 15, 16, 17, 60]]
1
523
6
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) x.begin(), x.end() #define pb push_back #define eb emplace_back #define X first #define Y second using namespace std; typedef long long int ll; typedef pair<int, int> pii; const int INF = 1e9; int main() { int ans = INF; int ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) x.begin(), x.end() #define pb push_back #define eb emplace_back #define X first #define Y second using namespace std; typedef long long int ll; typedef pair<int, int> pii; const int INF = 1e9; int main() { int ans = INF; int ...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
454
5
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int N, W, H; vector<P> t; bool check(P p, int a) { if (p.first < p.second) return (p.first <= a && a <= p.second); return (p.first <= a || a <= p.second); } int calcArg(int x, int y) { if (x == 0) return y; if (y == H) return H...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int N, W, H; vector<P> t; bool check(P p, int a) { if (p.first < p.second) return (p.first <= a && a <= p.second); return (p.first <= a || a <= p.second); } int calcArg(int x, int y) { if (x == 0) return y; if (y == H) return H...
[["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
672
4
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int main() { int w, h, n; cin >> n >> w >> h; int x, y, B = 2 * (w + h), ans = n; char c; vector<P> m; for (int i = 0; i < n; i++) { cin >> x >> y >> c; if (c == 'S') m.push_back(P(x + y, (x - y + B) % B)); if (c == 'E...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int main() { int w, h, n; cin >> n >> w >> h; int x, y, B = 2 * (w + h), ans = n; char c; vector<P> m; for (int i = 0; i < n; i++) { cin >> x >> y >> c; if (c == 'S') m.push_back(P(x + y, (x - y + B) % B)); if (c == 'E...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]]
1
402
48
#include <algorithm> #include <iostream> #include <vector> using namespace std; using ll = long long; using P = pair<int, int>; int n, w, d; P v[1002]; int main() { cin >> n >> w >> d; int l = 2 * d + 2 * w; for (int i = 0; i < n; ++i) { int x, y; char f; cin >> x >> y >> f; int c, b; swit...
#include <algorithm> #include <iostream> #include <vector> using namespace std; using ll = long long; using P = pair<int, int>; int n, w, d; P v[1002]; int main() { cin >> n >> w >> d; int l = 2 * d + 2 * w; for (int i = 0; i < n; ++i) { int x, y; char f; cin >> x >> y >> f; int c, b; swit...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
375
4
#include <iostream> #include <string> #include <vector> using namespace std; string s; int n, sums; long long prods = 1, fact[19]; long long anagram(string t) { int c[10] = {0}; for (int i = 0; i < t.size(); i++) c[t[i] - 48]++; long long ret = fact[t.size()]; for (int i = 0; i < 10; i++) ret /= fact[c[...
#include <iostream> #include <string> #include <vector> using namespace std; string s; int n, sums; long long prods = 1, fact[19]; long long anagram(string t) { int c[10] = {0}; for (int i = 0; i < t.size(); i++) c[t[i] - 48]++; long long ret = fact[t.size()]; for (int i = 0; i < 10; i++) ret /= fact[c[...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96]]
1
548
6
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int t, head[50], w[50]; struct edges { int to, next; } e[(50 * 50) << 1]; void add(int x, int y) { e[++t] = (edges){y, head[x]}; head[x] = t; } int n, m, ans = 1000000, now; int vis[50], step; void dfs(int x) { ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int t, head[50], w[50]; struct edges { int to, next; } e[(50 * 50) << 1]; void add(int x, int y) { e[++t] = (edges){y, head[x]}; head[x] = t; } int n, m, ans = 1000000, now; int vis[50], step; void dfs(int x) { ...
[["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
508
3
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; /** * Rearranging a Sequence */ public class Main { public static void main(String[] args) throws IOException { BufferedRea...
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; /** * Rearranging a Sequence */ public class Main { public static void main(String[] args) throws IOException { BufferedRea...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499]]
3
299
2
#include <stdio.h> #include <stdlib.h> int main() { int n, m; scanf("%d%d", &n, &m); int input[m], flag[n + 1]; int i; for (i = 0; i < m; i++) { scanf("%d", &input[i]); } for (i = 0; i < n; i++) { flag[i] = 0; } for (i = m - 1; i >= 0; i--) { if (flag[input[i]] == 0) { printf("%d\...
#include <stdio.h> #include <stdlib.h> int main() { int n, m; scanf("%d%d", &n, &m); int input[m], flag[n + 1]; int i; for (i = 0; i < m; i++) { scanf("%d", &input[i]); } for (i = 0; i < n + 1; i++) { flag[i] = 0; } for (i = m - 1; i >= 0; i--) { if (flag[input[i]] == 0) { printf(...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
189
2
#include <algorithm> #include <iostream> using namespace std; int p[300000], n, m; pair<int, int> x[300000]; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { p[i] = i; } for (int i = 0; i < m; i++) { int r; cin >> r; p[r] = -i; } for (int i = 1; i <= n; i++) { x[i] = make_pair(...
#include <algorithm> #include <iostream> using namespace std; int p[300000], n, m; pair<int, int> x[300000]; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { p[i] = i; } for (int i = 0; i < m; i++) { int r; cin >> r; p[r] = -i; } for (int i = 1; i <= n; i++) { x[i] = make_pair(...
[["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120]]
1
169
2
#include <algorithm> #include <map> #include <stdio.h> #include <stdlib.h> #include <utility> #include <vector> using namespace std; bool mycomp1(pair<int, int> a, pair<int, int> b) { return a.second > b.second; } bool mycomp2(pair<int, int> a, pair<int, int> b) { return a.first < b.first; } map<int, int> update; i...
#include <algorithm> #include <map> #include <stdio.h> #include <stdlib.h> #include <utility> #include <vector> using namespace std; bool mycomp1(pair<int, int> a, pair<int, int> b) { return a.second > b.second; } bool mycomp2(pair<int, int> a, pair<int, int> b) { return a.first < b.first; } map<int, int> update; i...
[["-", 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
373
4
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(x) begin(x), end(x) using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; int main() { int N, M; cin >> N >> M; vector<int> e...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(x) begin(x), end(x) using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; int main() { int N, M; cin >> N >> M; vector<int> e...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
225
2
#include <utility> // pair make_pair using std::make_pair; using std::pair; #include <tuple> // tuple(c++11) make_tuple(c++11) using std::make_tuple; using std::tuple; // get<address>(variable) #include <string> // string stoi(c++11) stoll(c++11) to_string(c++11) using std::stoi; using std::stoll; using std::string; us...
#include <utility> // pair make_pair using std::make_pair; using std::pair; #include <tuple> // tuple(c++11) make_tuple(c++11) using std::make_tuple; using std::tuple; // get<address>(variable) #include <string> // string stoi(c++11) stoll(c++11) to_string(c++11) using std::stoi; using std::stoll; using std::string; us...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
408
2
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<bool> used(n + 1, false); vector<int> e(m); for (int i = 0; i < m; i++) { cin >> e[i]; } reverse(e.begin(), e.end()); for (int i = 0; i < m; i++) { if (used[e[i]] == false) { cout << e[i]; u...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<bool> used(n + 1, false); vector<int> e(m); for (int i = 0; i < m; i++) { cin >> e[i]; } reverse(e.begin(), e.end()); for (int i = 0; i < m; i++) { if (used[e[i]] == false) { cout << e[i] << endl;...
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
164
2
#include <bits/stdc++.h> using namespace std; #define fs first #define sc second #define mp make_pair #define pb push_back #define eb emplace_back #define ALL(A) A.begin(), A.end() #define RALL(A) A.rbegin(), A.rend() typedef long long LL; typedef pair<char, LL> P; const LL mod = 998244353; const LL LINF = 1LL << 62; c...
#include <bits/stdc++.h> using namespace std; #define fs first #define sc second #define mp make_pair #define pb push_back #define eb emplace_back #define ALL(A) A.begin(), A.end() #define RALL(A) A.rbegin(), A.rend() typedef long long LL; typedef pair<char, LL> P; const LL mod = 998244353; const LL LINF = 1LL << 62; c...
[["-", 3, 4, 0, 2, 3, 4, 0, 103, 0, 125], ["+", 3, 4, 0, 2, 3, 4, 0, 103, 0, 125]]
1
616
2