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 <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; ++i) #define all_map(itr, mp) for (auto itr = mp.begin(); itr != m...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; ++i) #define all_map(itr, mp) for (auto itr = mp.begin(); itr != m...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, ...
1
194
n,m=map(int,input().split()) A=[list(map(int,input().split())) for i in range(m)] water=[1]*(n+1) red=[0]*(n+1) red[1]=1 for x,y in A: water[y] +=1 water[x] -=1 if red[x]==1: red[y]=1 cnt=0 for i in range(1,n+1): if water[i]>0 and red[i]==1: cnt +=1 print(cnt)
n,m=map(int,input().split()) A=[list(map(int,input().split())) for i in range(m)] water=[1]*(n+1) red=[0]*(n+1) red[1]=1 for x,y in A: water[y] +=1 water[x] -=1 if red[x]==1:red[y]=1 if water[x]==0:red[x]=0 cnt=0 for i in range(1,n+1): if water[i]>0 and red[i]==1: cnt +=1 print(cnt)
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612...
5
140
#include <algorithm> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const bool DEBAG = fa...
#include <algorithm> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const bool DEBAG = fa...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 69, 341, 342, 0, 16, 31, 22], ["+", 15, 339, 51, 69, 341, 342, 0, 16, 17, 33], ["+", 15, 339, 51, 69, 341, 342, 0, 16, 12, 13...
1
196
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int mod = 1000000007; void solve(); int main(void) { int N, M; cin >> N >> M; bool possible[N]; int num_balls[N]; rep(i, N) { possible[i] = false; num_balls[i] = 1; } possible[0] =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int mod = 1000000007; void solve(); int main(void) { int N, M; cin >> N >> M; bool possible[N]; int num_balls[N]; rep(i, N) { possible[i] = false; num_balls[i] = 1; } possible[0] =...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 8, 9, 0, 57, 64...
1
198
#include <algorithm> #include <iostream> #include <map> #include <set> using namespace std; int main() { int n, m; cin >> n >> m; map<int, int> hist; for (int i = 1; i <= n; i++) { hist[i] = 1; } set<int> red_ball_hist; red_ball_hist.insert(1); int x, y; for (int i = 0; i < m; i++) { cin >> x...
#include <algorithm> #include <iostream> #include <map> #include <set> using namespace std; int main() { int n, m; cin >> n >> m; map<int, int> hist; for (int i = 1; i <= n; i++) { hist[i] = 1; } set<int> red_ball_hist; red_ball_hist.insert(1); int x, y; for (int i = 0; i < m; i++) { cin >> ...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]...
1
173
/* _,add8ba, ,d888888888b, d8888888888888b _,ad8ba,_ d888888888888888) ,d888888888b, I8888888888888888 _________ ,8888888888888b ...
/* _,add8ba, ,d888888888b, d8888888888888b _,ad8ba,_ d888888888888888) ,d888888888b, I8888888888888888 _________ ,8888888888888b ...
[["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 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], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 57, 64...
1
529
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; #define ll long long typedef vector<int> vi; #define all(v) ((v).begin()), ((v).end()) void fast() { ...
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; #define ll long long typedef vector<int> vi; #define all(v) ((v).begin()), ((v).end()) void fast() { ...
[["-", 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, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
356
// ------------------------------------ // Date:2018/ 2/24 // Problem:AGC 002 BoxAndBall b.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i, a) for (auto &&i : a) #define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define RFOR(i, a, b) for (int i = (...
// ------------------------------------ // Date:2018/ 2/24 // Problem:AGC 002 BoxAndBall b.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i, a) for (auto &&i : a) #define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define RFOR(i, a, b) for (int i = (...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 2, 3, 4, 0,...
1
232
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define F first #define S second #define pb push_back using namespace std; using namespace __gnu_pbds; typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define F first #define S second #define pb push_back using namespace std; using namespace __gnu_pbds; typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 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], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
375
#include <bits/stdc++.h> #define EHAB_FAWZY_FCI_AaRnoB \ ios::sync_with_stdio(NULL); \ cin.tie(NULL); #define popcnt(x) __builtin_popcount(x) #define compination(x) ((x * (x - 1)) / 2) #define all(x) x.begin(), x.end(...
#include <bits/stdc++.h> #define EHAB_FAWZY_FCI_AaRnoB \ ios::sync_with_stdio(NULL); \ cin.tie(NULL); #define popcnt(x) __builtin_popcount(x) #define compination(x) ((x * (x - 1)) / 2) #define all(x) x.begin(), x.end(...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 36, 36, 0, 30, 0, 43, 49, 53, 49, 22], ["-", 0, 30, 0, 43, 49, 53, 54, 55, 0, 24], ["-", 0, 30, 0, 43, 49, 53, 54, 55, 0, 25], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 53, 49, 22], ["-", 8, 9, ...
1
265
#include "bits/stdc++.h" using namespace std; // typedef pair<int, int> P; #define int long long #define ll long long #define mod 1000000007 #define INF (1LL << 60) int N, M; double p[123456]; int n[123456]; signed main() { cin >> N >> M; p[1] = 1.00; for (int i = 1; i <= N; i++) { n[i] = 1; } for (i...
#include "bits/stdc++.h" using namespace std; // typedef pair<int, int> P; #define int long long #define ll long long #define mod 1000000007 #define INF (1LL << 60) int N, M; bool p[123456]; int n[123456]; signed main() { cin >> N >> M; p[1] = true; for (int i = 1; i <= N; i++) { n[i] = 1; } for (int...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 146], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["-", 0, 11, 12,...
1
207
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #define rg register #define ll long long #define LDB long double #define ull unsigned long long #define view(i, x) for (rg int i = hd[x]; i != -1; i = e[i].nt) #define go(i, x, a) for (rg int...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #define rg register #define ll long long #define LDB long double #define ull unsigned long long #define view(i, x) for (rg int i = hd[x]; i != -1; i = e[i].nt) #define go(i, x, a) for (rg int...
[["+", 31, 69, 28, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 69, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 69, 28, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 21], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 11, 31, 69, 0, 42, 0, 22], ["+", 0, 1, 0, 11, 31,...
1
295
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; // ascending order #define vsort(v) sort(v.begin(), v.end()) // descending order #de...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; // ascending order #define vsort(v) sort(v.begin(), v.end()) // descending order #de...
[["+", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60...
1
404
#include <stdio.h> #include <stdlib.h> #define MAX_N (100000) int main(int argc, char *argv[]) { // read inputs int N, M, xs[MAX_N], ys[MAX_N]; scanf("%d %d", &N, &M); for (int i = 0; i < M; i++) { scanf("%d %d", &xs[i], &ys[i]); xs[i]--; // NOTE : modified input ys[i]--; // NOTE : modified input ...
#include <stdio.h> #include <stdlib.h> #define MAX_N (100000) #define MAX_M (100000) int main(int argc, char *argv[]) { // read inputs int N, M, xs[MAX_M], ys[MAX_M]; scanf("%d %d", &N, &M); for (int i = 0; i < M; i++) { scanf("%d %d", &xs[i], &ys[i]); xs[i]--; // NOTE : modified input ys[i]--; //...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1...
1
271
#include <iostream> using namespace std; int main() { int box[100000]; int red[100000]; for (int i = 0; i < 100000; i++) { box[i] = 1; red[i] = 0; } red[0] = 1; int n, m; cin >> n >> m; int x, y; for (int i = 0; i < m; i++) { cin >> x >> y; x--; y--; box[x]--; if (box[x]...
#include <iostream> using namespace std; int main() { int box[100000]; int red[100000]; for (int i = 0; i < 100000; i++) { box[i] = 1; red[i] = 0; } red[0] = 1; int n, m; cin >> n >> m; int x, y; for (int i = 0; i < m; i++) { cin >> x >> y; x--; y--; if (box[x] == 1 && red[...
[["-", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["-", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, ...
1
211
n, m = map(int,input().split()) f = [False for _ in range(n)] c = [1 for _ in range(n)] f[0] = True for i in range(m): x, y = map(int,input().split()) f[y - 1] = f[y - 1] or f[x - 1] c[y - 1] += 1 c[x - 1] -= 1 ans = 0 for i in range(n): if f[i] and c[i] > 0: ans += 1 print(ans)
n, m = map(int,input().split()) f = [False for _ in range(n)] c = [1 for _ in range(n)] f[0] = True for i in range(m): x, y = map(int,input().split()) f[y - 1] = f[y - 1] or f[x - 1] c[y - 1] += 1 c[x - 1] -= 1 if c[x - 1] == 0: f[x - 1] = False ans = 0 for i in range(n): if f[i] and c[i] > 0: ans +...
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 2...
5
137
#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; const double PI = 3.1415926535897932384626433832795; const int dx[] = {0, 1, 0, -1}; const int dy[] = {-1, 0, 1, 0}; int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); } ll gcd(ll x, ll y) { return y ? gcd(y, x % y)...
#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; const double PI = 3.1415926535897932384626433832795; const int dx[] = {0, 1, 0, -1}; const int dy[] = {-1, 0, 1, 0}; int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); } ll gcd(ll x, ll y) { return y ? gcd(y, x % y)...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 69, 341, 342, 0, 69, 28, 22], ["+", 51, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 51, 69, 341, 342, 0, 69, 341, 342, 0, 22...
1
373
#include <bits/stdc++.h> #define rep(i, m, n) for (int i = m; i < (n); i++) #define print(x) cout << (x) << endl; #define printa(x, n) \ for (int i = 0; i < n; i++) { \ cout << (x[i]) << " "; ...
#include <bits/stdc++.h> #define rep(i, m, n) for (int i = m; i < (n); i++) #define print(x) cout << (x) << endl; #define printa(x, n) \ for (int i = 0; i < n; i++) { \ cout << (x[i]) << " "; ...
[["+", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 27, 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, 22], ["+",...
1
361
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> //#include <stack> #include <climits> #include <map> #define Rep(i, n) for (int i = 0; i < n; i++) #define For(i, n1, n2) for (int i = n1; i < n2; i++) #define REP(i, n...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> //#include <stack> #include <climits> #include <map> #define Rep(i, n) for (int i = 0; i < n; i++) #define For(i, n1, n2) for (int i = n1; i < n2; i++) #define REP(i, n...
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 31, 69, 341, 342, 0, 16, 31, 69, 28, 22], ["+", 341, 342, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 341, 342, 0, 16, 31, 69, 341, 34...
1
315
#include "bits/stdc++.h" typedef long long ll; #define int ll #define fi first #define se second #define SORT(a) sort(a.begin(), a.end()) #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define MP(a, b) make_pair(a, b) #define pb(a) push_back(a) #define INF LLONG_MAX / 2...
#include "bits/stdc++.h" typedef long long ll; #define int ll #define fi first #define se second #define SORT(a) sort(a.begin(), a.end()) #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define MP(a, b) make_pair(a, b) #define pb(a) push_back(a) #define INF LLONG_MAX / 2...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
246
i=lambda:map(int,input().split());n,m=i();l=[0,1]+[0]*n;c=[0]+[1]*n for _ in[0]*m:x,y=i();l[y]=l[x];c[y]+=1;c[x]-=1 print(sum(c[i]and l[i]for i in range(n+1)))
i=lambda:map(int,input().split());n,m=i();l=[0,1]+[0]*n;c=[0]+[1]*n for _ in[0]*m:x,y=i();l[y]|=l[x];c[y]+=1;c[x]-=1;l[x]=c[x]and l[x] print(sum(c[i]and l[i]for i in range(n+1)))
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 160], ["+", 36, 36, 0, 656, 0, 7, 8, 196, 0, 35], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 0, 73], ["+", ...
5
114
#include <algorithm> #include <array> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <typeinfo> #include <utility> #include <vector> using namespace std; #define INF 1000000005 int main() { int n,...
#include <algorithm> #include <array> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <typeinfo> #include <utility> #include <vector> using namespace std; #define INF 1000000005 int main() { int n,...
[["-", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["-", 64, 9, 0, 57, 64, 9, 0, 116, 0, 35], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 14,...
1
336
#include <cstdio> #include <iostream> using namespace std; template <typename T> void in(T &x) { char ch = getchar(); bool flag = 0; while (ch > '9' || ch < '0') flag |= (ch == '-'), ch = getchar(); x = ch - '0'; ch = getchar(); while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch =...
#include <cstdio> #include <iostream> using namespace std; template <typename T> void in(T &x) { char ch = getchar(); bool flag = 0; while (ch > '9' || ch < '0') flag |= (ch == '-'), ch = getchar(); x = ch - '0'; ch = getchar(); while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch =...
[["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0...
1
312
#include <bits/stdc++.h> using namespace std; #define rep(i, s, n) for (int i = s; i < n; i++) #define repe(i, s, n) for (int i = s; i <= n; i++) #define pb push_back #define fi first #define se second typedef long long ll; typedef pair<int, int> pint; typedef vector<int> vint; typedef vector<pint> vpint; static const ...
#include <bits/stdc++.h> using namespace std; #define rep(i, s, n) for (int i = s; i < n; i++) #define repe(i, s, n) for (int i = s; i <= n; i++) #define pb push_back #define fi first #define se second typedef long long ll; typedef pair<int, int> pint; typedef vector<int> vint; typedef vector<pint> vpint; static const ...
[["-", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["-", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 8, 9, 0, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 57, 64, 1, 0, 11, 31, 69, 28, 22], ["-", 64, 1, 0,...
1
290
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; int N, M; int x[100010], y[100010]; int cnt[100010]; int flag[100010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cin >> N >> M; for (int i = 0; i < M; i++) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; int N, M; int x[100010], y[100010]; int cnt[100010]; int flag[100010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cin >> N >> M; for (int i = 0; i < M; i++) { ...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 27, 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, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 73], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0...
1
235
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int n, m, x, y, cnt[MAXN], ok[MAXN], res; int main() { scanf("%d%d", &n, &m); int cur = 1; ok[1] = 1; for (int i = 1; i <= n; i++) cnt[i] = 1; for (int i = 1; i <= m; i++) { scanf("%d%d", &x, &y); cnt[x]--; cnt[y]++; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int n, m, x, y, cnt[MAXN], ok[MAXN], res; int main() { scanf("%d%d", &n, &m); ok[1] = 1; for (int i = 1; i <= n; i++) cnt[i] = 1; for (int i = 1; i <= m; i++) { scanf("%d%d", &x, &y); cnt[x]--; cnt[y]++; if (ok[x]) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 91, 17, 111], ["-", 15, 339, ...
1
198
#include <bits/stdc++.h> using namespace std; int n, m, i, a, b, ans, ball[200005]; bool red[200005]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cin >> n >> m; red[1] = true; for (i = 1; i <= m; i++) { cin >> a >> b; if (red[a] == true) { red[b] = true; ball[a]--; b...
#include <bits/stdc++.h> using namespace std; int n, m, i, a, b, ans, ball[200005]; bool red[200005]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cin >> n >> m; for (i = 1; i <= n; i++) { ball[i] = 1; } red[1] = true; for (i = 1; i <= m; i++) { cin >> a >> b; if (red[a] == tru...
[["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16...
1
165
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, m; cin >> n >> m; int x[100010], y[100010]; bool b[100010]; rep(i, n) { b[i] = false; } b[1] = true; int c[100010]; rep(i, n) { c[i + 1] = 1...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, m; cin >> n >> m; int x[100010], y[100010]; bool b[100010]; rep(i, n) { b[i] = false; } b[1] = true; int c[100010]; rep(i, n) { c[i + 1] = 1...
[["-", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["-", 8, 9, 0, 14, 49, 53, 54, 55, 0, 24], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 14, 49, 53, 54, 55, 0, 21], ["-", 8, 9, 0, 14, 49, 53, 54, 55, 0, 25], ["-", 0, 14, 8, 9, 0, 14, 8, 9, 0, 45]]
1
231
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, m; cin >> n >> m; int x[100010], y[100010]; bool b[100010]; rep(i, n) { b[i] = false; } b[1] = true; int c[100010]; rep(i, n) { c[i + 1] = 1...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, m; cin >> n >> m; int x[100010], y[100010]; bool b[100010]; rep(i, n) { b[i] = false; } b[1] = true; int c[100010]; rep(i, n) { c[i + 1] = 1...
[["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 91, 28, 69, 28, 22], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 70], ["+", 51, 91, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 7...
1
211
#include <bits/stdc++.h> #define sqr(A) ((A) * (A)) #define F first #define S second #define mp make_pair using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; const int MOD = 1e9 + 7; const int INF = INT_MAX; const ll LINF = LLONG_MAX; const int N = 1e5 + 20; int a[N], n, m, ...
#include <bits/stdc++.h> #define sqr(A) ((A) * (A)) #define F first #define S second #define mp make_pair using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; const int MOD = 1e9 + 7; const int INF = INT_MAX; const ll LINF = LLONG_MAX; const int N = 1e5 + 20; int a[N], n, m, ...
[["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 161], ["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 11, 12, 23, 0, 16, 31, 69, 28, 22], ["+", 12, 23, 0...
1
226
#include <cstdio> const int MaxN = 1e6 + 10; int Red[MaxN], Ball[MaxN]; int N, M, Ans; int main() { scanf("%d%d", &N, &M); for (int i = 1; i <= N; i++) Ball[i] = 1; Red[1] = true; for (int i = 1; i <= M; i++) { int X, Y; scanf("%d%d", &X, &Y); if (Red[X] && Ball[X]) { Ball[Y] += 1; B...
#include <cstdio> const int MaxN = 1e6 + 10; int Red[MaxN], Ball[MaxN]; int N, M, Ans; int main() { scanf("%d%d", &N, &M); for (int i = 1; i <= N; i++) Ball[i] = 1; Red[1] = true; for (int i = 1; i <= M; i++) { int X, Y; scanf("%d%d", &X, &Y); if (Red[X]) { Red[Y] = true; } Ball[Y]...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, ...
1
193
#include <bits/stdc++.h> using namespace std; int n, m; bool b[100005]; int tot[100005]; int ans = 0; int main() { int x, y; cin >> n >> m; for (int i = 1; i <= n; i++) tot[i] = 1; b[1] = true; for (int i = 1; i <= m; i++) { cin >> x >> y; if (b[x]) b[y] = true; if (tot[x]) { tot[x...
#include <bits/stdc++.h> using namespace std; int n, m; bool b[1000005]; int tot[1000005]; int ans = 0; int main() { int x, y; cin >> n >> m; for (int i = 1; i <= n; i++) tot[i] = 1; b[1] = true; for (int i = 1; i <= m; i++) { cin >> x >> y; if (b[x]) b[y] = true; tot[x]--; tot[y]++;...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", ...
1
184
#include <cstdio> #include <iostream> using namespace std; const int Maxn = 100010; int n, m; int f[Maxn]; bool b[Maxn]; int main() { scanf("%d%d", &n, &m); for (register int i = 1; i <= n; i++) f[i] = 1; b[1] = true; for (register int x, y; m--;) { scanf("%d%d", &x, &y); f[x]--, f[y]++; b[y...
#include <cstdio> #include <iostream> using namespace std; const int Maxn = 100010; int n, m; int f[Maxn]; bool b[Maxn]; int main() { scanf("%d%d", &n, &m); for (register int i = 1; i <= n; i++) f[i] = 1; b[1] = true; for (register int x, y; m--;) { scanf("%d%d", &x, &y); f[x]--, f[y]++; if ...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 1...
1
184
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define RFOR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) #define LL long long #define INF INT_MAX / 3 const double EPS = 1e-14; const d...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define RFOR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) #define LL long long #define INF INT_MAX / 3 const double EPS = 1e-14; const d...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 1, 0, 27, 28, 118, 28, 69, 28, 22], ["+", 0, 27, 28, 118, 28, 69, 341, 342, 0, 70], ["+", 0, 27, 28, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 27, 28, 118, 28, 69, 341, 342, 0, 73], ["+", 0, 9, 0, 1, 0, 27, 28, 118, 17, 131], ["+...
1
265
#include <bits/stdc++.h> #define REP(i, n) for (int(i) = 0; i < (n); i++) #define vi vector<int> using namespace std; int main() { int n, m; cin >> n >> m; n++; vi v(n); REP(i, n) v[i] = 1; int aka = 200000; v[1] = aka; int x, y; REP(i, m) { cin >> x >> y; if (aka <= v[x]) { v[x] == ...
#include <bits/stdc++.h> #define REP(i, n) for (int(i) = 0; i < (n); i++) #define vi vector<int> using namespace std; int main() { int n, m; cin >> n >> m; n++; vi v(n, 1); int aka = 131072; // 2 ** 17 v[1] = aka; int x, y; REP(i, m) { cin >> x >> y; if (aka & v[x]) { v[x] == aka ? v[x...
[["-", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 1, 0, 11, 31, 69, 28, 2, 63, 22], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 24], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 25], ["-", 0, 1, 0, 11, 31, 69, 0, 42, 0, 22], ["-", 0, 1, 0, 11, 31, 6...
1
186
#include <bits/stdc++.h> #define REP(i, n) for (int(i) = 0; i < (n); i++) #define vi vector<int> using namespace std; int main() { int n, m; cin >> n >> m; n++; vi v(n); REP(i, n) v[i] = 1; int aka = 20000; v[1] = aka; int x, y; REP(i, m) { cin >> x >> y; if (aka <= v[x]) { v[x] == a...
#include <bits/stdc++.h> #define REP(i, n) for (int(i) = 0; i < (n); i++) #define vi vector<int> using namespace std; int main() { int n, m; cin >> n >> m; n++; vi v(n); REP(i, n) v[i] = 1; int aka = 200000; v[1] = aka; int x, y; REP(i, m) { cin >> x >> y; if (aka <= v[x]) { v[x] == ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 1, 0, 41, 15, 16, 17, 18], ["+", 64, 9, 0, 1, 0, 41, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 41, 0, 101], ["+", 0, 1, 0, 41, 64, 11, 31, 69, 28, 22], ["+", 0, 41, 64, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 41, 6...
1
173
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; #define pb push_back #define rep(i, a, n) for (int i = (a); i < (n); i++) #define dep(i, a, n) for (int i = (a); i >= (n); i--) #define mod (ll)(1e9 + 7) __attribute__((constructor)) void initi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; #define pb push_back #define rep(i, a, n) for (int i = (a); i < (n); i++) #define dep(i, a, n) for (int i = (a); i >= (n); i--) #define mod (ll)(1e9 + 7) __attribute__((constructor)) void initi...
[["+", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 1, 0, 27, 28, 118, 28, 69, 28, 22], ["+", 0, 27, 28, 118, 28, 69, 341, 342, 0, 70], ["+", 28, 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, 22...
1
299
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <numeric> #include <queue> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using ...
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <numeric> #include <queue> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342,...
1
263
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define int long long int #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; const int INF = 1e15; const int MO...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define int long long int #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; const int INF = 1e15; const int MO...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 75, ...
1
208
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define ...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 64, 9, 0, 57, 1...
1
577
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef pair<ll, ll> pi; #define inf 1000000000000000000 #define rep(i, a, b) for (int i = a; i <= b; i++) #define f first #define s second #define pb push_back #define mp make_pair int ans = 0, x, y, b[...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef pair<ll, ll> pi; #define inf 1000000000000000000 #define rep(i, a, b) for (int i = a; i <= b; i++) #define f first #define s second #define pb push_back #define mp make_pair int ans = 0, x, y, b[...
[["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 9, 0, 57, ...
1
349
// 2018年 3月 23日 金曜日 02:40:07 JST #include <bits/stdc++.h> #define ADD(a, b) a = (a + ll(b)) % mod #define MUL(a, b) a = (a * ll(b)) % mod #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) #define rep(i, a, b) for (int i = int(a); i < int(b); i++) #define rer(i, a, b) for (int i = int(a) - 1; i >= int(b);...
// 2018年 3月 23日 金曜日 02:40:07 JST- #include <bits/stdc++.h> #define ADD(a, b) a = (a + ll(b)) % mod #define MUL(a, b) a = (a * ll(b)) % mod #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) #define rep(i, a, b) for (int i = int(a); i < int(b); i++) #define rer(i, a, b) for (int i = int(a) - 1; i >= int(b)...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 1, 0, 11, 31, 69, 28, 22]]
1
628
# AGC002B - Box and Ball import sys input = sys.stdin.readline def main(): N, M = tuple(map(int, input().split())) X = tuple(tuple(map(int, input().split())) for _ in range(M)) R = [0] * (N + 1) # red ball may be in box i R[1] = 1 C = [1] * (N + 1) # number of balls in box i (count) for x, y ...
# AGC002B - Box and Ball import sys input = sys.stdin.readline def main(): N, M = tuple(map(int, input().split())) X = tuple(tuple(map(int, input().split())) for _ in range(M)) R = [0] * (N + 1) # red ball may be in box i R[1] = 1 C = [1] * (N + 1) # number of balls in box i (count) for x, y ...
[["-", 8, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 0, 70], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 0, 73], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 41, 0, 612], ["-", 0, 1, 0, 662, 12, 41, 0, 679, 17, 354], ["+...
5
170
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, j, n) for (ll i = j; i < n; i++) #define all(x) (x).begin(), (x).end() #define INF (LLONG_MAX) #define MOD (1000000007) #define MAX (100000) #define pii pair<int, int> ///////////////////////////////////////////////////////// class XY ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, j, n) for (ll i = j; i < n; i++) #define all(x) (x).begin(), (x).end() #define INF (LLONG_MAX) #define MOD (1000000007) #define MAX (100000) #define pii pair<int, int> ///////////////////////////////////////////////////////// class XY ...
[["+", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 1, 0, 27, 28, 118, 28, 69, 28, 22], ["+", 0, 27, 28, 118, 28, 69, 341, 342, 0, 70], ["+", 28, 69, 341, 342, 0, 118, 28, 69, 28, 22], ["+", 341, 342, 0, 118, 28, 69, 341, 342, 0, 70], ["+", 341, 342, 0, 118, 28, 69, 341, 342, 0, ...
1
670
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <math.h> #include <queue> using namespace std; template <class T> using V = vector<T>; template <class S, class T> using P = pair<S, T>; template <class... T> using TP = tuple<T...>; using ll = long long; using db = double; using ldb = long db; ...
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <math.h> #include <queue> using namespace std; template <class T> using V = vector<T>; template <class S, class T> using P = pair<S, T>; template <class... T> using TP = tuple<T...>; using ll = long long; using db = double; using ldb = long db; ...
[["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 146], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 1, 0, 2, 3...
1
862
#include <bits/stdc++.h> #define M_PI 3.14159265358979323846 using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; re...
#include <bits/stdc++.h> #define M_PI 3.14159265358979323846 using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; re...
[["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, ...
1
1,032
#include <bits/stdc++.h> using namespace std; #define all(a) (a).begin(), (a).end() typedef long long ll; const ll mod = 1000000007; #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) int main() { int n, m; cin >> n >> m; int box[n]; set<int> red_in; int red = 0; red_in.insert(red); repi(i, 0, n...
#include <bits/stdc++.h> using namespace std; #define all(a) (a).begin(), (a).end() typedef long long ll; const ll mod = 1000000007; #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) int main() { int n, m; cin >> n >> m; int box[n]; set<int> red_in; red_in.insert(0); repi(i, 0, n) box[i] = 1; r...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 57, 15, 339, 51, ...
1
228
#include <bits/stdc++.h> #define rep(i, n, m) for (int i = n; i < (int)(m); i++) #define rrep(i, n, m) for (int i = ((int)(n)-1); i >= m; i--) #define all(x) (x).begin(), (x).end() typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; using namespace std; int main() { int n, m; c...
#include <bits/stdc++.h> #define rep(i, n, m) for (int i = n; i < (int)(m); i++) #define rrep(i, n, m) for (int i = ((int)(n)-1); i >= m; i--) #define all(x) (x).begin(), (x).end() typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; using namespace std; int main() { int n, m; c...
[["+", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 8, 9, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 64, 1, 0, ...
1
201
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 ll a[100010]; bool b[100010]; int main() { ll n, m; cin >> n >> m; for (int i = 0; i < n; i++) { a[i]++; } ll ans = 1; b[0] = true; for (int i = 0; i < m; i++) { ll l, r; cin >> l ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 ll a[100010]; bool b[100010]; int main() { ll n, m; cin >> n >> m; for (int i = 0; i < n; i++) { a[i]++; } ll ans = 1; b[0] = true; for (int i = 0; i < m; i++) { ll l, r; cin >> l ...
[["-", 64, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["-", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0...
1
184
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> x(M), y(M); for (int i = 0; i < M; ++i) { cin >> x[i] >> y[i]; --x[i], --y[i]; } vector<int> num_balls(N, 1); vector<bool> r_in(N, false); r_in[0] = true; for (in...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> x(M), y(M); for (int i = 0; i < M; ++i) { cin >> x[i] >> y[i]; --x[i], --y[i]; } vector<int> num_balls(N, 1); vector<bool> r_in(N, false); r_in[0] = true; for (in...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["-", 51, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["-", 31, 16, 31, 69, 341, 342, 0, 69, 28, 22], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, ...
1
240
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define len(v) ll(v.size()) #define fi first #define se second template <class T> void cout_vec(const vector<T> &vec) { for (auto it...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define len(v) ll(v.size()) #define fi first #define se second template <class T> void cout_vec(const vector<T> &vec) { for (auto it...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 25],...
1
273
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; typedef pair<string, int> s_i; typedef vector<ll> vel; typedef vector<int> vei; typedef vector<char> vec; typedef vector<bool> veb; typedef vector<string> ves; typedef vector...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; typedef pair<string, int> s_i; typedef vector<ll> vel; typedef vector<int> vei; typedef vector<char> vec; typedef vector<bool> veb; typedef vector<string> ves; typedef vector...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 1, 0, 34, 31, 27, 28, 69, 28, 22], ["+", 0, 34, 31, 27, 2...
1
539
n,m=map(int,input().split()) balls=[1 for i in range(n)] pro=[False for i in range(n)] pro[0]=True for inp in range(m): a,b=map(int,input().split()) a-=1 b-=1 balls[a]-=1 balls[b]+=1 if pro[a]: pro[b]=True for i in range(n): if balls[i]==0: pro[i]=False #print(pro) pri...
n,m=map(int,input().split()) balls=[1 for i in range(n)] pro=[False for i in range(n)] pro[0]=True for inp in range(m): a,b=map(int,input().split()) a-=1 b-=1 balls[a]-=1 balls[b]+=1 if pro[a]: pro[b]=True if balls[a]==0: pro[a]=False #print(pro) print(pro.count(True))
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["-", 36, ...
5
132
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, ...
1
886
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REPS(i, _s, n) for (int i = _s, i##_len = (n); i < i##_len; ++i) #define ALL(x) (x).begin(), (x).end() using namespace std; #define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++) // vector template <t...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REPS(i, _s, n) for (int i = _s, i##_len = (n); i < i##_len; ++i) #define ALL(x) (x).begin(), (x).end() using namespace std; #define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++) // vector template <t...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57,...
1
649
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) #define rep1(i, N) for (int i = 1; i < int(N); ++i) #define all(a) (a).begin(), (a).end() // sort(all(vi S)) sort(all(string S)) #define print(v) \ { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) #define rep1(i, N) for (int i = 1; i < int(N); ++i) #define all(a) (a).begin(), (a).end() // sort(all(vi S)) sort(all(string S)) #define print(v) \ { ...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["-", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 57, 64...
1
267
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define MOD 1000000007 #define INF 1 << 30 #define LINF (ll)1 << 62 #define rep(i, n) for (ll i = 0; i < (n); i++) #define REP(i, a, b) for (ll i = (a); i < (...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define MOD 1000000007 #define INF 1 << 30 #define LINF (ll)1 << 62 #define rep(i, n) for (ll i = 0; i < (n); i++) #define REP(i, a, b) for (ll i = (a); i < (...
[["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["+", 0, 14, 8, 9, 0, 14, 8, 9, 0, 45], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 14, 8, 9, 0, 1,...
1
316
N,M=map(int,input().split()) flg=[0]*(N+1) flg[1]=1 flg2=[1]*(N+1) for _ in range(M): xy=list(map(int,input().split())) flg[xy[1]]=flg[xy[0]] flg2[xy[1]]+=1 flg2[xy[0]]-=1 if flg2[xy[0]] == 0: flg[xy[0]]=0 print(sum(map(lambda x:x>0,flg)))
N,M=map(int,input().split()) flg=[0]*(N+1) flg[1]=1 flg2=[1]*(N+1) for _ in range(M): xy=list(map(int,input().split())) if flg[xy[0]]==1: flg[xy[1]]=1 flg2[xy[1]]+=1 flg2[xy[0]]-=1 if flg2[xy[0]]==0: flg[xy[0]]=0 print(sum(map(lambda x:x>0,flg)))
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 1, 0, 662, 31, 206, 206, 206, 206, 612], ["+", 0, 57, 15, 666, 0, 206, 206, 206, 206, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102...
5
139
n,m=map(int,input().split()) dp=[0]*(1+n) dp[1]=1 b=[1]*(1+n) for i in range(m): x,y=map(int,input().split()) dp[y]=dp[x] b[y]+=1 b[x]-=1 if b[x]==0: dp[x]=0 print(sum(dp))
n,m=map(int,input().split()) dp=[0]*(1+n) dp[1]=1 b=[1]*(1+n) for i in range(m): x,y=map(int,input().split()) dp[y]=max(dp[x],dp[y]) b[y]+=1 b[x]-=1 if b[x]==0: dp[x]=0 print(sum(dp))
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 73], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 206, 22], ["+"...
5
110
#include <bits/stdc++.h> #define fi first #define se second #define ll long long // priority_queue<int, vector<int>, greater<int> > pq; #define _CRT_SECURE_NO_DEPRECATE const int N = 330030; #define rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (e...
#include <bits/stdc++.h> #define fi first #define se second #define ll long long // priority_queue<int, vector<int>, greater<int> > pq; #define _CRT_SECURE_NO_DEPRECATE const int N = 330030; #define rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (e...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 1, 0, 11, 31, 69, 28, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 147], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 105, 0, 150], ["-", 0, 1, 0, 2, 3, 4, 0, 105, 51...
1
226
n,m = map(int,input().split()) num = [1 for c in range(n)] red = [False for d in range(n)] red[0] = True counter = 0 for i in range(m): x,y = map(int,input().split()) red[y-1] = True num[x-1] = num[x-1] - 1 num[y-1] = num[y-1] + 1 for j in range(n): if (red[j] == True)&(num[j]>0): counter +=...
n,m = map(int,input().split()) num = [1 for c in range(n)] red = [False for d in range(n)] red[0] = True counter = 0 for i in range(m): x,y = map(int,input().split()) if red[x-1]: red[y-1] = True num[x-1] = num[x-1] - 1 num[y-1] = num[y-1] + 1 if num[x-1] == 0: red[x-1] = False for j...
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 206, 206, 657, 31, 22], ["+", 8, 196, 0, 57, 15, 206, 206, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 206, 206, 657, 12, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 206, 0, 73], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 5...
5
145
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> x(100001), y(100001); for (int i = 0; i < m; i++) { ...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> x(100001), y(100001); for (int i = 0; i < m; i++) { ...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 27, 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, 22], ["+",...
1
255
#include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <map> #include <set> #include <string> #include <tuple> #include <vector> #define range(i, r) for (int i = 0; i < r; i++) #define ranges(i, l, r) for (int i = l; i < r; i++) #define vv(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c)) ...
#include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <map> #include <set> #include <string> #include <tuple> #include <vector> #define range(i, r) for (int i = 0; i < r; i++) #define ranges(i, l, r) for (int i = l; i < r; i++) #define vv(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c)) ...
[["+", 64, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 57, 15, 339, 51, 16...
1
261
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { ll N, M; cin >> N >> M; ll xi, yi; vector<ll> white(N, 1); vector<bool> red(N, false); red[0] = true; white[0] = 0; for (int i = 0; i < M; i++) { cin >> xi >> yi; xi--; yi--; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { ll N, M; cin >> N >> M; ll xi, yi; vector<ll> white(N, 1); vector<bool> red(N, false); red[0] = true; for (int i = 0; i < M; i++) { cin >> xi >> yi; xi--; yi--; if (red[xi]) {...
[["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 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], ["+", 0, 57, 75, 76,...
1
198
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i <= (n); ++i) #define repi(i, a, b) for (int i = a; i <= (b); ++i) #define rrep(i, n) for (int i = (n - 1); i >= 0; --i) #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend()...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i <= (n); ++i) #define repi(i, a, b) for (int i = a; i <= (b); ++i) #define rrep(i, n) for (int i = (n - 1); i >= 0; --i) #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend()...
[["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 57, 15, 339, ...
1
371
#include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unistd.h> #include <unordered_map> #include <vector> using...
#include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unistd.h> #include <unordered_map> #include <vector> using...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 8, 9, 0, 57, 64...
1
690
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string.h> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() typedef long long ll; typedef pair<int, int> pi; typed...
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string.h> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() typedef long long ll; typedef pair<int, int> pi; typed...
[["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 15, 339, 51, 69, 341, 342, 0, 69, 28, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 11, 12, 69, 341, 342, 0, 69, 28, 22], ["+", 0,...
1
390
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define rep(i, n) for (ll i = 0; i < n; i++) #defi...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define rep(i, n) for (ll i = 0; i < n; i++) #defi...
[["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0...
1
324
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; int m; cin >> m; int canf[n + 1] = {0}; int val[n + 1] = {1}; can...
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; int m; cin >> m; int canf[n + 1]; int val[n + 1]; rep1(i, n) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 8, 9, 0, 14, 49, 53, 54, 55, 0, 24], ["+", 0, 14, 49, 53, ...
1
177
#include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { map<int, bool> m; map<int, int> b; int n, mm; cin >> n >> mm; for (int i = 1; i <= n; i++) b[i] = 1; m[1] = true; for (int i = 0; i < mm; i++) { int x, y; cin >> x >> y; if (m[x]) ...
#include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { map<int, bool> m; map<int, int> b; int n, mm; cin >> n >> mm; for (int i = 1; i <= n; i++) b[i] = 1; m[1] = true; for (int i = 0; i < mm; i++) { int x, y; cin >> x >> y; if (m[x]) ...
[["-", 0, 57, 64, 9, 0, 43, 39, 361, 0, 190], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 43, 49, 50, 51, 2, 63, 118, 17, 131], ["-", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["...
1
168
#include <stdio.h> int main() { int n, m; scanf("%d %d", &n, &m); int p[100005] = {}; p[1] = 1; int count[100005]; int k = 0; int x, y; int i; for (i = 0; i < n; i++) count[i] = 1; for (i = 0; i < m; i++) { scanf("%d %d", &x, &y); x--; y--; if (p[x] == 1) p[y] = 1; coun...
#include <stdio.h> int main() { int n, m; scanf("%d %d", &n, &m); int p[100005]; int count[100005]; int x, y; int i; for (i = 0; i < n; i++) { count[i] = 1; p[i] = 0; } p[0] = 1; for (i = 0; i < m; i++) { scanf("%d %d", &x, &y); x--; y--; if (p[x] == 1) p[y] = 1; co...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 0, 70], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 71, 13], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 0, 73], ["-", 0, 14, 8, 9, 0, 1, ...
0
202
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, y, i, c = 0; cin >> n >> m; int a[n] = {}, b[n]; a[0] = 1; for (i = 0; i < n; i++) { b[i] = 1; } for (i = 0; i < m; i++) { cin >> x >> y; b[x]--; b[y]++; if (a[x] == 1) { a[y] = 1; } if (b[x] == 0) {...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, y, i, c = 0; cin >> n >> m; int a[n + 1] = {}, b[n + 1]; a[1] = 1; for (i = 1; i <= n; i++) { b[i] = 1; } for (i = 0; i < m; i++) { cin >> x >> y; b[x]--; b[y]++; if (a[x] == 1) { a[y] = 1; } if (b[x...
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0...
1
181
#include <bits/stdc++.h> using namespace std; int n, m; int x, y; int main() { cin >> n >> m; vector<pair<int, int>> box(n); box[0] = make_pair(1, 1); for (int i = 1; i < n; i++) { box[i] = make_pair(1, 0); } int cnt = 0; for (int i = 0; i < m; i++) { cin >> x >> y; x--; y--; if (bo...
#include <bits/stdc++.h> using namespace std; int n, m; int x, y; int main() { cin >> n >> m; vector<pair<int, int>> box(n); box[0] = make_pair(1, 1); for (int i = 1; i < n; i++) { box[i] = make_pair(1, 0); } int cnt = 0; for (int i = 0; i < m; i++) { cin >> x >> y; x--; y--; if (b...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-",...
1
286
#include <algorithm> #include <iostream> #include <math.h> #include <stdlib.h> #include <string.h> using namespace std; int main() { int N, M; int *x; bool *f; cin >> N >> M; x = new int[N]; //個数 f = new bool[N]; //赤があるかどうか int n = 1; //可能性がある箱の個数 for (int i = 0; i < N; i++) { x[i] = 1; ...
#include <algorithm> #include <iostream> #include <math.h> #include <stdlib.h> #include <string.h> using namespace std; int main() { int N, M; int *x; bool *f; cin >> N >> M; x = new int[N]; //個数 f = new bool[N]; //赤があるかどうか int n = 1; //可能性がある箱の個数 for (int i = 0; i < N; i++) { x[i] = 1; ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 1...
1
209
// by Balloons #include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define mpr make_pair #define debug() puts("okkkkkkkk") #define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++) using namespace std; typedef long long LL; const int inf = 1 << 29; const int maxn = 1e5 + 5; int n, m; int ...
// by Balloons #include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define mpr make_pair #define debug() puts("okkkkkkkk") #define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++) using namespace std; typedef long long LL; const int inf = 1 << 29; const int maxn = 1e5 + 5; int n, m; int ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 51, 16, 12, 69, 341, 342, 0, 69, 28, 22], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["-", 12, 69, 341, 342, 0, 69, 3...
1
291
#include <bits/stdc++.h> using namespace std; #define llong long long int #define ldouble long double #define rep(i, n) for (int i = 0; i < n; ++i) #define all(x) x.begin(), x.end() #define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr) const static int MOD = 1000000000 + 7; const static llong INF...
#include <bits/stdc++.h> using namespace std; #define llong long long int #define ldouble long double #define rep(i, n) for (int i = 0; i < n; ++i) #define all(x) x.begin(), x.end() #define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr) const static int MOD = 1000000000 + 7; const static llong INF...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, ...
1
526
#include <iostream> using namespace std; int main() { int N, M, count = 0, tmp_x, tmp_y, red_ball = 1; cin >> N >> M; int x[N + 1] = {}; bool f[N + 1] = {false}; for (int k = 1; k <= N; k++) { x[k] = 1; f[k] = false; } f[1] = true; for (int i = 0; i < M; i++) { cin >> tmp_x >> tmp_y; if...
#include <iostream> using namespace std; int main() { int N, M, count = 0, tmp_x, tmp_y, red_ball = 1; cin >> N >> M; int x[N + 1] = {}; bool f[N + 1] = {}; for (int k = 1; k <= N; k++) { x[k] = 1; f[k] = false; } f[1] = true; for (int i = 0; i < M; i++) { cin >> tmp_x >> tmp_y; if (tmp...
[["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 147], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73],...
1
201
#include <bits/stdc++.h> using namespace std; typedef long long ll; const double PI = 3.14159265; void fastInOut(); const int N = 100005; int cnt[N]; bool flag[N]; int main() { #ifndef ONLINE_JUDGE freopen("input.in", "r", stdin); #endif fastInOut(); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const double PI = 3.14159265; void fastInOut(); const int N = 100005; int cnt[N]; bool flag[N]; int main() { fastInOut(); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) cnt[i] = 1; flag[1] = 1; int x, y; while (m--) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 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], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
227
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { int ...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { int ...
[["+", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-"...
1
219
#include <bits/stdc++.h> #define be(v) (v).begin(), (v).end() #define pb(q) push_back(q) #define era(t) t.erase(unique(be(t)), t.end()) #define doublecout(a) cout << fixed << setprecision(10) << a << endl; typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, ...
#include <bits/stdc++.h> #define be(v) (v).begin(), (v).end() #define pb(q) push_back(q) #define era(t) t.erase(unique(be(t)), t.end()) #define doublecout(a) cout << fixed << setprecision(10) << a << endl; typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, ...
[["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9...
1
246
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define vii vector<pair<int, int>> #define ii pair<int, int> #define loop(n) for (int i = 0; i < n; i++) #define loopj(n) for (int j = 0; j < n; j++) ll mod = 1e9 + 7; const int N = 2e5 + 7, M = 53; int L[N], R[N], Q[N]; map<int,...
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define vii vector<pair<int, int>> #define ii pair<int, int> #define loop(n) for (int i = 0; i < n; i++) #define loopj(n) for (int j = 0; j < n; j++) ll mod = 1e9 + 7; const int N = 2e5 + 7, M = 53; int L[N], R[N], Q[N]; map<int,...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 8, 9, 0, 57, 64...
1
217
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<pairs, null_type, greater<pairs>, rb_tree_tag, \ ...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<pairs, null_type, greater<pairs>, rb_tree_tag, \ ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 24], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["-", 8, 9, 0, 43, ...
1
309
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; vector<int> x(m), y(m); rep(i, m) { cin >> x[i] >> y[i]; --x[i]; --y[i]; } vector<int> ball(n, 1), red(n, 0); re...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; vector<int> x(m), y(m); rep(i, m) { cin >> x[i] >> y[i]; --x[i]; --y[i]; } vector<int> ball(n, 1), red(n, 0); re...
[["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0...
1
209
N, M = map(int, input().split()) kouho = {} red = 1 Nlist = [1]*(N+1) ans = 0 for i in range(M): x, y = map(int, input().split()) if x == red: red = y kouho[y] = True Nlist[x] -= 1 Nlist[y] += 1 else: Nlist[x] -= 1 Nlist[y] += 1 if Nlist[x]==0: if ...
N, M = map(int, input().split()) kouho = {} kouho[1]=True Nlist = [1]*(N+1) ans = 0 for i in range(M): x, y = map(int, input().split()) if x in kouho: kouho[y] = True Nlist[x] -= 1 Nlist[y] += 1 else: Nlist[x] -= 1 Nlist[y] += 1 if Nlist[x]==0: if x in kou...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 206, 0, 70], ["+", 0, 656, 0, 1, 0, 662, 31, 206, 0, 73], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 146], ["-"...
5
152
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 1...
1
244
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, ...
1
244
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); ++i) int main() { ll n, m; cin >> n >> m; vector<ll> b(n, 1); vector<bool> r(n, false); r[0] = true; rep(i, m) { ll x, y; cin >> x >> y; x--; y--; b[x]--; b[y]++; if (r[...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); ++i) int main() { ll n, m; cin >> n >> m; vector<ll> b(n, 1); vector<bool> r(n, false); r[0] = true; rep(i, m) { ll x, y; cin >> x >> y; x--; y--; b[x]--; b[y]++; if (r[...
[["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 6...
1
162
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; bool flag = false; vector<int> visited(n); vector<int> ball(n, 1); for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; x -= 1; y -= 1; ball[x] -= 1; ball[y] += 1; if ((flag == false && x == ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; bool flag = false; vector<int> visited(n); visited[0] = 1; vector<int> ball(n, 1); for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; x -= 1; y -= 1; ball[x] -= 1; ball[y] += 1; if ((flag...
[["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 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
182
#include <bits/stdc++.h> #define int long long #define gcd __gcd #define setbits(x) __builtin_popcountll(x) #define zrobits(x) __builtin_ctzll(x) #define mod 1000000007 #define mod2 998244353 #define maxe *max_element #define mine *min_element #define inf 1e18 #define deci(x, y) fixed << setprecision(y) << x #define w(...
#include <bits/stdc++.h> #define int long long #define gcd __gcd #define setbits(x) __builtin_popcountll(x) #define zrobits(x) __builtin_ctzll(x) #define mod 1000000007 #define mod2 998244353 #define maxe *max_element #define mine *min_element #define inf 1e18 #define deci(x, y) fixed << setprecision(y) << x #define w(...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 75, ...
1
274
#include <cstdio> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; int main() { int i, n, m, x, y, ans = 0; scanf("%d%d", &n, &m); int v[10007]; int maybe[10007]; for (i = 1; i <= n; ++i) { v[i] = 1; maybe[i] = 0; } maybe[1] = 1; for (i = 0; i < m; +...
#include <cstdio> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; int v[100007]; int maybe[100007]; int main() { int i, n, m, x, y, ans = 0; scanf("%d%d", &n, &m); for (i = 1; i <= n; ++i) { v[i] = 1; maybe[i] = 0; } maybe[1] = 1; for (i = 0; i < m; ++i...
[["+", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0...
1
210
#include <iostream> using namespace std; bool vis[100005]; int num[100005]; inline int read() { int x = 0; char c = getchar(); while (c < '0' || c > '9') { c = getchar(); } while (c >= '0' && c <= '9') { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); } return x; } int main() { int N, M...
#include <iostream> using namespace std; bool vis[100005]; int num[100005]; inline int read() { int x = 0; char c = getchar(); while (c < '0' || c > '9') { c = getchar(); } while (c >= '0' && c <= '9') { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); } return x; } int main() { int N, M...
[["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 75, 76, 0, ...
1
316
#include "bits/stdc++.h" #pragma GCC optimize("Ofast") // Begin Header {{{ using namespace std; #ifndef DEBUG #define dump(...) #endif #define all(x) x.begin(), x.end() #define rep(i, b, e) for (intmax_t i = (b), i##_limit = (e); i < i##_limit; ++i) #define reps(i, b, e) ...
#include "bits/stdc++.h" #pragma GCC optimize("Ofast") // Begin Header {{{ using namespace std; #ifndef DEBUG #define dump(...) #endif #define all(x) x.begin(), x.end() #define rep(i, b, e) for (intmax_t i = (b), i##_limit = (e); i < i##_limit; ++i) #define reps(i, b, e) ...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 21], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 70], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 139]]
1
967
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n, m; cin >> n >> m; vector<i...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n, m; cin >> n >> m; vector<i...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 91, 28, 69, 28, 22], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 70], ["+", 51, 91, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0...
1
251
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) using namespace std; #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long ll; typedef pair<ll, ll> P; const int MOD = 1000000007; const int MOD2 = 998244353; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) using namespace std; #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long ll; typedef pair<ll, ll> P; const int MOD = 1000000007; const int MOD2 = 998244353; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 75, 76, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, ...
1
241
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i ...
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i ...
[["-", 0, 11, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 79], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 25], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 60], ["+", 0, 1, ...
1
382
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define all(v) v.begin(), v.end() ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define all(v) v.begin(), v.end() ...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 43, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 53, 49, 22], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 8, 9, 0...
1
242
n,m=map(int,input().split()) x=[0]*n x[0]=1 y=[1]*n for i in range(m): a,b=map(int,input().split()) x[b-1]=x[a-1] y[a-1]-=1 y[b-1]+=1 if y[a-1]==0:x[a-1]=0 print(sum(x))
n,m=map(int,input().split()) x=[0]*n x[0]=1 y=[1]*n for i in range(m): a,b=map(int,input().split()) if x[a-1]==1:x[b-1]=1 y[a-1]-=1 y[b-1]+=1 if y[a-1]==0:x[a-1]=0 print(sum(x))
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], [...
5
114
#include <cstdio> #include <string> #define MAXN 100007 int mayRed[MAXN]; int numOfBall[MAXN]; int main() { int N, M; int i, x, y; scanf("%d%d", &N, &M); for (i = 1; i <= N; i++) { numOfBall[i] = 1; mayRed[i] = 0; } mayRed[1] = 1; for (i = 0; i < M; i++) { scanf("%d%d", &x, &y); if (may...
#include <cstdio> #define MAXN 100007 #include <cstring> char mayRed[MAXN]; int numOfBall[MAXN]; int main(void) { mayRed[1] = 1; int i, N, M; int x, y; scanf("%d%d", &N, &M); for (i = 1; i <= N; i++) { numOfBall[i] = 1; mayRed[i] = 0; } mayRed[1] = 1; for (i = 0; i < M; i++) { scanf("%d%d...
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 4...
1
202
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using db = double; #define pb push_back const int mxn = 100006; int R[mxn], W[mxn]; int n, m; int main() { cin >> n >> m; R[1] = 1; for (int i = 2; i <= n; ++i) W[i] = 1; for (int i = 0; i < m; ++i) { int x,...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using db = double; #define pb push_back const int mxn = 100006; int R[mxn], W[mxn]; int n, m; int main() { cin >> n >> m; R[1] = 1; for (int i = 2; i <= n; ++i) W[i] = 1; for (int i = 0; i < m; ++i) { int x,...
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 64, 1, 0, 34, 31, 11, 31, 69, 28, 22], ["+", 0, 34, 31, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 34, 31, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 34, 31...
1
216
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << "\n" #define COUTF(x) cout << setprecision(15) << (x) << "\n" #define ENDL cout << "\n" #d...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << "\n" #define COUTF(x) cout << setprecision(15) << (x) << "\n" #define ENDL cout << "\n" #d...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 75, ...
1
1,248