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 <iostream>
using namespace std;
int hugo_check(int min_n, int max_n) {
if (min_n <= 0 && max_n >= 0)
return 0;
else if (min_n >= 1)
return 1;
else
return -1;
}
int main(void) {
int a, b;
int hugo;
cin >> a >> b;
hugo = hugo_check(a, b);
switch (hugo) {
cas... | #include <algorithm>
#include <iostream>
using namespace std;
int hugo_check(int min_n, int max_n) {
if (min_n <= 0 && max_n >= 0)
return 0;
else if (min_n >= 1)
return 1;
else if ((max_n - min_n + 1) % 2 == 0)
return 1;
else
return -1;
}
int main(void) {
int a, b;
int hugo;
cin >> a >>... | [["+", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 72]... | 1 | 121 |
#include <algorithm>
#include <bitset>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
#define For(i, a, b) for (int i = (a); i < (b); ... | #include <algorithm>
#include <bitset>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
#define For(i, a, b) for (int i = (a); i < (b); ... | [["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 31, 22], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25], ... | 1 | 193 |
#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
scanf("%d %d", &a, &b);
if (a <= 0 && b >= 0)
return 0 * printf("Zero\n");
if (a > 0 || a + 1 == b)
return 0 * printf("Positive\n");
puts("Negative");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
scanf("%d %d", &a, &b);
if (a <= 0 && b >= 0)
return 0 * printf("Zero\n");
if (a > 0 || (b - a + 1) % 2 == 0)
return 0 * printf("Positive\n");
puts("Negative");
return 0;
} | [["+", 51, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["+", 51, 16, 12, 16, 31, 16, 31, 23, 0, 25], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 109], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, ... | 1 | 84 |
#include <iostream>
using namespace std;
int main() {
int a, b;
int zero = 1, minus = 0, result;
cin >> a >> b;
if (a * b <= 0) {
cout << "Zero";
} else if (a < 0) {
if ((b - a + 1) % 2 == 0) {
cout << "Positive" << endl;
} else {
cout << "Negative" << endl;
}
} else {
cou... | #include <iostream>
using namespace std;
int main() {
long a, b;
cin >> a >> b;
if (a * b <= 0) {
cout << "Zero";
} else if (a < 0) {
if ((b - a + 1) % 2 == 0) {
cout << "Positive" << endl;
} else {
cout << "Negative" << endl;
}
} else {
cout << "Positive" << endl;
}
re... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 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, 21], ["-", 0, 30, 0, 14, 8, 9,... | 1 | 108 |
#include <algorithm>
#include <cstdio>
using namespace std;
int main(void) {
int a, b;
scanf("%d %d", &a, &b);
if (a * b <= 0)
printf("Zero\n");
else if (a < 0 && (b - a + 1) % 2 == 1)
printf("Negative\n");
else
printf("Positive\n");
return 0;
} | #include <algorithm>
#include <cstdio>
using namespace std;
int main(void) {
int a, b;
long long c;
scanf("%d %d", &a, &b);
c = (long long)a * b;
if (c <= 0)
printf("Zero\n");
else if (a < 0 && (b - a + 1) % 2 == 1)
printf("Negative\n");
else
printf("Positive\n");
return 0;
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 12, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 0, 1, 0, 11, 12, 1... | 1 | 88 |
#include <bits/stdc++.h>
#define x1 xxx
#define y1 yyy
#define x2 xx
#define y2 yy
#define pb push_back
#define F first
#define S second
#define P push
#define T top
using namespace std;
const long long MOD = 1000000007;
typedef long long ll;
int main() {
ll a, b;
cin >> a >> b;
if (a <= 0 && b >= 0) {
cout... | #include <bits/stdc++.h>
#define x1 xxx
#define y1 yyy
#define x2 xx
#define y2 yy
#define pb push_back
#define F first
#define S second
#define P push
#define T top
using namespace std;
const long long MOD = 1000000007;
typedef long long ll;
int main() {
ll a, b;
cin >> a >> b;
if (a <= 0 && b >= 0) {
cout... | [["-", 51, 16, 31, 16, 31, 16, 31, 2, 63, 22], ["-", 31, 16, 31, 16, 31, 2, 3, 4, 0, 22], ["-", 31, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 31, 23, 0, 16, 31, 2, 63, 22], ["-", 31, 2, 3, 4, 0, 74, 39, 77, 39, 78], ["-", 31, 16, 31, 2, 3, 4, 0, 74, 0, 25], ["-", 31, 16, 31, 2, 3, 4, 0, 74, 51, 13], ["+", 31, 23, ... | 1 | 166 |
#include <stdio.h>
int main(void) {
long a, b;
scanf("%ld%ld", &a, &b);
if (a <= 0 && b >= 0)
printf("Zero\n");
else if (a < 0 && b < 0) {
if ((b - a + 1) % 2 == 0)
printf("Positive\n");
else
printf("Negative\n");
} else {
if ((b - a + 1) % 2 == 0)
printf("Positive\n");
... | #include <stdio.h>
int main(void) {
long a, b;
scanf("%ld%ld", &a, &b);
if (a <= 0 && b >= 0)
printf("Zero\n");
else if (a < 0 && b < 0) {
if ((b - a + 1) % 2 == 0)
printf("Positive\n");
else
printf("Negative\n");
} else
printf("Positive\n");
return 0;
}
| [["-", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["-", 75, 76, 0, 9, 0, 57, 15, 23, 0, 24], ["-", 15, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["-", 0... | 0 | 126 |
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int l, r;
cin >> l >> r;
if (l <= 0 && 0 <= r) {
cout << "Zero\n";
return 0;
}
if (l < 0) {
int cnt = (max(-1, r) - l + 1);
if (cnt % 2 == 0)
cout << "Positive\n";
... | #include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int l, r;
cin >> l >> r;
if (l <= 0 && 0 <= r) {
cout << "Zero\n";
return 0;
}
if (l < 0) {
int cnt = (r - l + 1);
if (cnt % 2 == 0)
cout << "Positive\n";
else
... | [["-", 51, 23, 0, 16, 31, 16, 31, 2, 63, 22], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 13], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 31, 22], ["+", 0, 57, 75, 76, ... | 1 | 106 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using names... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using names... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["... | 1 | 304 |
#include <iostream>
using namespace std;
int main(void) {
int a, b;
cin >> a >> b;
if (a * b <= 0) {
std::cout << "Zero" << std::endl;
} else if ((b - a) % 2 == 0) {
std::cout << "Negative" << std::endl;
} else {
std::cout << "Positive" << std::endl;
}
}
| #include <iostream>
using namespace std;
int main(void) {
long a, b;
cin >> a >> b;
if (a * b <= 0) {
std::cout << "Zero" << std::endl;
} else if ((a + b) < 0 and (b - a) % 2 == 0) {
std::cout << "Negative" << std::endl;
} else {
std::cout << "Positive" << std::endl;
}
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 31, 22], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25], ["+... | 1 | 88 |
#include <iostream>
using namespace std;
int main() {
int a, b;
if (a * b <= 0) {
cout << "Zero" << endl;
} else if ((a < 0 && 0 < b) && a % 2 != 0 ||
(a < 0 && b < 0) && (b - a + 1) % 2 != 0) {
cout << "Negative" << endl;
} else {
cout << "Positive" << endl;
}
} | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a <= 0 && 0 <= b) {
cout << "Zero" << endl;
} else if ((a < 0 && 0 < b) && a % 2 != 0 ||
(a < 0 && b < 0) && (b - a + 1) % 2 != 0) {
cout << "Negative" << endl;
} else {
cout << "Positive" << endl;
}... | [["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["-", 0, 57, 15, 339, ... | 1 | 97 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cer... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cer... | [["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 157], ["+", 36, 36, 0, 30, 0, 134, 39, 86, 0, 96], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 49, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 170 |
#include <bits/stdc++.h>
#define rep(i, j) for (int(i) = 0; (i) < (int)(j); ++(i))
#define put(i) cout << (i) << endl
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
int main() {
int a, b;
cin >> a >> b;
if (0 >= a && 0 <= b) {
cout << "Zero" << endl;
} else if ((a % 2 && b % 2) || (!(... | #include <bits/stdc++.h>
#define rep(i, j) for (int(i) = 0; (i) < (int)(j); ++(i))
#define put(i) cout << (i) << endl
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
int main() {
int a, b;
cin >> a >> b;
if (0 >= a && 0 <= b) {
cout << "Zero" << endl;
} else if (a > 0 && b > 0) {
c... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16,... | 1 | 120 |
import java.io.*;
import java.util.*;
public class Main {
void solve() {
String ans = "";
long a = sc.nextLong();
long b = sc.nextLong();
if (a > 0) {
ans = "Positive";
} else if (a == 0 || b == 0) {
ans = "zero";
} else if (a <= 0 && b >= 0) {
ans = "zero";
} else {
... | import java.io.*;
import java.util.*;
public class Main {
void solve() {
String ans = "";
long a = sc.nextLong();
long b = sc.nextLong();
if (a > 0) {
ans = "Positive";
} else if (a == 0 || b == 0) {
ans = "Zero";
} else if (a <= 0 && b >= 0) {
ans = "Zero";
} else if ... | [["-", 64, 196, 0, 1, 0, 11, 12, 5, 0, 491], ["+", 64, 196, 0, 1, 0, 11, 12, 5, 0, 491], ["+", 64, 196, 0, 1, 0, 11, 12, 5, 0, 62], ["+", 75, 57, 75, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 57, 75, 57, 75, 57, 64, 196, 0, 46], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 95], ["+", 0, 57, 75, 57, 75, 57, 75, 57, 0, 121], ["+", ... | 3 | 570 |
#! /usr/bin/env python3
A, B = map(int, input().split())
if A < 0:
if B < 0:
print('Negative' if abs(B)%2 else 'Positive')
else:
print('Zero')
else:
print('Positive') | #! /usr/bin/env python3
A, B = map(int, input().split())
if A < 0:
if B < 0:
print('Positive' if (abs(A)-abs(B))%2 else 'Negative')
else:
print('Zero')
else:
print('Positive') | [["-", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 3, 4, 0, 41, 0, 657, 31, 23, 0, 24], ["+", 31, 23, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 31, 23, 0, 657, 31, 652, 3, 4, 0, 25], ["+", 0, 41, 0, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 657, 31, 23, 0, 657, 12, 652, 63, 22], ["+", 31... | 5 | 60 |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
long long int a, b;
cin >> a >> b;
if (a == 0 || b == 0) {
cout << "Zero" << endl;
return 0;
}
if (a <= 0 && b >= 0) {
cout << "Zero" << endl;
return 0;
}
if ... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
long long int a, b;
cin >> a >> b;
if (a == 0 || b == 0) {
cout << "Zero" << endl;
return 0;
}
if (a <= 0 && b >= 0) {
cout << "Zero" << endl;
return 0;
}
if ... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 2... | 1 | 132 |
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a == 0 || b == 0)
cout << "Zero" << endl;
else if (a > 0 && b > 0)
cout << "Positive" << endl;
else {
if (abs(a + b) % 2 == 0)
cout << "Negative" << endl;
else
cout << "Positive" << endl;
}
r... | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if ((a == 0 || b == 0) || (a < 0 && b > 0))
cout << "Zero" << endl;
else if (a > 0 && b > 0)
cout << "Positive" << endl;
else {
if (abs(a + b) % 2 == 0)
cout << "Negative" << endl;
else
cout << "Posit... | [["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 17, 18... | 1 | 96 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define shosu(x) fixed << setprecision(x)
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, P> pip;
const int inf = (1 << 31) - 1;
int a, b;
bo... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define shosu(x) fixed << setprecision(x)
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, P> pip;
const int inf = (1 << 31) - 1;
int a, b;
bo... | [["-", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 0, 57, 75, 76, 0, 9, 0, 7, 0, 88], ["+", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["-", 75, 76, 0, 9, 0, 7, 10, 43, 39, 40], ["-", 0, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 0, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["+", 51, 16, 31... | 1 | 190 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#define REP(_i, _a, _n) for (int _i = _a; _i <= _n; ++_i)
#define PER(_i, _a, _n) f... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#define REP(_i, _a, _n) for (int _i = _a; _i <= _n; ++_i)
#define PER(_i, _a, _n) f... | [["+", 8, 9, 0, 1, 0, 34, 31, 27, 17, 29], ["+", 0, 1, 0, 34, 31, 27, 28, 69, 28, 22], ["+", 0, 34, 31, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 34, 31, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 34, 31, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 52, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 8, 9, 0, 1, 0, 34, 12, 27, 17, 68], ["+", 0, 1... | 1 | 466 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(), a.end()
#define rrng(a) a.end(), a.begin()
#define int ll
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(), a.end()
#define rrng(a) a.end(), a.begin()
#define int ll
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
... | [["-", 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, 1, 0, 34, 31, 27, 28, 69, 28, 22], ["-", 15, 339, 51, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 64,... | 1 | 292 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(), a.end()
#define rrng(a) a.end(), a.begin()
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, M;
cin... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(), a.end()
#define rrng(a) a.end(), a.begin()
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, M;
cin... | [["-", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["-", 51, 16, 31, 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, 342, 0, 22], ["-", 341, 342, 0, 16, 31, 69, 341, 342, 0, 73], ["-", 31, 16, 31, 69, 341, 3... | 1 | 284 |
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <list>
#include <map>
#include <ostream>
#... | #pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <list>
#include <map>
#include <ostream>
#... | [["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["-", 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], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, ... | 1 | 614 |
N,M = [int(hoge) for hoge in input().split()]
Ball = [False]*N
BallNum = [1] * N
Ball[0] = True
for i in range(M):
x,y = [int(hoge) - 1 for hoge in input().split()]
BallNum[x] -= 1
BallNum[y] += 1
Ball[y] = Ball[x]
if BallNum[x] == 0:
Ball[x] = False
print(sum(Ball)) | import copy
N,M = [int(hoge) for hoge in input().split()]
Ball = [False]*N
BallNum = [1] * N
Ball[0] = True
for i in range(M):
x,y = [int(hoge) - 1 for hoge in input().split()]
BallNum[x] -= 1
BallNum[y] += 1
if Ball[x]:
Ball[y] = True
if BallNum[x] == 0:
Ball[x] = False
print(sum(... | [["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 206, 206, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], [... | 5 | 112 |
n, m = map(int,input().split())
box = [[1,0] for i in range(n)]#個数、赤の可能性
box[0][1] = 1
ans = 1
for i in range(m):
x, y = map(int,input().split())
if box[x-1][0] == 0:
continue
box[x-1][0] -= 1
box[y-1][0] += 1
if box[x-1][1] == 1:
if box[y-1][1] == 0:
box[y-1][1] = 1
... | n, m = map(int,input().split())
box = [[1,0] for i in range(n)]#個数、赤の可能性
box[0][1] = 1
ans = 1
for i in range(m):
x, y = map(int,input().split())
if box[x-1][0] == 0:
continue
box[x-1][0] -= 1
box[y-1][0] += 1
if box[x-1][1] == 1:
if box[y-1][1] == 0:
box[y-1][1] = 1
... | [["+", 0, 1, 0, 662, 31, 206, 51, 206, 51, 22], ["+", 0, 1, 0, 662, 31, 206, 51, 206, 0, 70], ["+", 0, 662, 31, 206, 51, 206, 206, 657, 31, 22], ["+", 0, 662, 31, 206, 51, 206, 206, 657, 17, 33], ["+", 0, 662, 31, 206, 51, 206, 206, 657, 12, 612], ["+", 0, 1, 0, 662, 31, 206, 51, 206, 0, 73], ["+", 64, 196, 0, 1, 0, 66... | 5 | 165 |
N,M = map(int,input().split())
lisN = [0] + [1]*N
ansSet = set([1])
for _ in range(M):
# print(ansSet,lisN)
x,y = map(int,input().split())
if x in ansSet:
ansSet.add(y)
lisN[x] -= 1
lisN[y] += 1
for i,v in enumerate(lisN):
if v == 0:
ansSet.discard(i)
print(len(ansSet... | N,M = map(int,input().split())
lisN = [0] + [1]*N
ansSet = set([1])
for _ in range(M):
# print(ansSet,lisN)
x,y = map(int,input().split())
if x in ansSet:
ansSet.add(y)
lisN[x] -= 1
lisN[y] += 1
if lisN[x] == 0:
ansSet.discard(x)
print(len(ansSet))
| [["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["-", 36, 36, 0, 656, 0, 7, 31, 684, 0, 22], ["-", 36, 36, 0, 656, 0, 7, 31, 684, 0, 21], ["-", 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,... | 5 | 111 |
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll mod(ll a, ll b) {
ll ret = a % b;
if (ret < 0)
ret += b;
return ret;
}
ll modpow(ll a, ll b, ll c) {
ll res = 1;
while (b > 0) {
if (b & 1)
res = mod(r... | #include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll mod(ll a, ll b) {
ll ret = a % b;
if (ret < 0)
ret += b;
return ret;
}
ll modpow(ll a, ll b, ll c) {
ll res = 1;
while (b > 0) {
if (b & 1)
res = mod(r... | [["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 1, 0, 16, 31,... | 1 | 356 |
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n, m = map(int, input().split())
x = [0]* n
y = [0]* n
box = [[1, 0] for _ in range(n)]
box[0] = [0,1]
for i in range(m):
x, y = map(int, input().split())
x,y= x-1,y-1
if box[x][1]>0:
box[x][1] = box[x][1]-1
box[y][1] =... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n, m = map(int, input().split())
x = [0]* n
y = [0]* n
box = [[1, 0] for _ in range(n)]
box[0] = [0,1]
for i in range(m):
x, y = map(int, input().split())
x,y= x-1,y-1
if box[x][1]>0:
box[x][1] = box[x][1]-1
box[y][1] =... | [["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121], ["+", 0, 57, 15, 666, 0, 206, 51, 206, 51, 22], ["+", 0, 57, 15, 666, 0, 206, 51, 206, 0, 70], ["+", 0, 57, 15, 666, 0, 206, 51, 206, 206, 22], ["+", 0, 57, 15, 666, 0, 206, 51, 206, 0, 73], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206,... | 5 | 235 |
#define _USE_MATH_DEFINES
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)
int main() {
cout.p... | #define _USE_MATH_DEFINES
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)
int main() {
cout.p... | [["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 15, 339, 51, 69, 341, 342, 0, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 0, 11,... | 1 | 202 |
#include <bits/stdc++.h>
#define rep(i, n) for (long long int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (long long int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (long long int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a, b) max(a, b) - m... | #include <bits/stdc++.h>
#define rep(i, n) for (long long int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (long long int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (long long int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a, b) max(a, b) - m... | [["+", 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, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["+", 51, 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, 342, 0... | 1 | 441 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef u... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef u... | [["-", 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], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 57, 15, 3... | 1 | 311 |
#include <algorithm>
#include <cstdio>
using namespace std;
int main() {
int N, M, x, y, ans = 0;
scanf("%d %d", &N, &M);
int num_ball[N];
bool has_ball[N];
fill_n(num_ball, N, 1);
fill_n(has_ball, N, false);
has_ball[0] = 1;
for (int i = 0; i < M; ++i) {
scanf("%d %d", &x, &y);
has_ball[y - 1] ... | #include <algorithm>
#include <cstdio>
using namespace std;
int main() {
int N, M, x, y, ans = 0;
scanf("%d %d", &N, &M);
int num_ball[N];
bool has_ball[N];
fill_n(num_ball, N, 1);
fill_n(has_ball, N, false);
has_ball[0] = 1;
for (int i = 0; i < M; ++i) {
scanf("%d %d", &x, &y);
has_ball[y - 1] ... | [["+", 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], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13... | 1 | 188 |
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
ans = [1] * n
check = [False] * n
check[0] = True
for i in range(m):
x, y = map(int, input().split())
if check[x - 1]:
ans[y - 1] += 1
ans[x - 1] -= 1
check[y - 1] = True
if ans[x - 1] == 0:
check[x - 1] = False
print(chec... | import sys
input = sys.stdin.readline
n, m = map(int, input().split())
ans = [1] * n
check = [False] * n
check[0] = True
for i in range(m):
x, y = map(int, input().split())
ans[x - 1] -= 1
ans[y - 1] += 1
if check[x - 1]:
check[y - 1] = True
if ans[x - 1] == 0:
check[x - 1] = False
print(sum(chec... | [["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 57, 15, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612], ["-", 64, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["+",... | 5 | 128 |
n,m=map(int,input().split())
check=[False]*n
check[0]=True
ball=[1]*n
for i in range(m):
x,y=map(int,input().split())
x-=1
y-=1
if check[x]:
check[y]=True
else:
continue
ball[y]+=1
ball[x]-=1
ans=0
for i in range(n):
if ball[i]==0:
check[i]=False
for chk in che... | n,m=map(int,input().split())
check=[False]*n
check[0]=True
ball=[1]*n
for i in range(m):
x,y=map(int,input().split())
x-=1
y-=1
if check[x]:
check[y]=True
ball[y]+=1
ball[x]-=1
if ball[x]==0:
check[x]=False
ans=0
for chk in check:
if chk:
ans+=1
print(ans)
| [["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["-", 0, 57, 75, 76, 8, 196, 0, 116, 0, 117], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["-", 3... | 5 | 133 |
n,m=map(int,input().split())
check=[False]*n
check[0]=True
ball=[1]*n
for i in range(m):
x,y=map(int,input().split())
x-=1
y-=1
if check[x]:
check[y]=True
else:
continue
ball[y]+=1
ball[x]-=1
if ball[x]==0:
check[x]=False
ans=0
for chk in check:
if chk:
... | n,m=map(int,input().split())
check=[False]*n
check[0]=True
ball=[1]*n
for i in range(m):
x,y=map(int,input().split())
x-=1
y-=1
if check[x]:
check[y]=True
ball[y]+=1
ball[x]-=1
if ball[x]==0:
check[x]=False
print(check.count(True))
| [["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["-", 0, 57, 75, 76, 8, 196, 0, 116, 0, 117], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["-", 3... | 5 | 125 |
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pill pair<ll, ll>
#define f first
#define s second
#define pilc pair<ll, char>
#define all(a) (a).begin(), (a).end()
#define rep(s, e, step) for (int i = (s... | #include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pill pair<ll, ll>
#define f first
#define s second
#define pilc pair<ll, char>
#define all(a) (a).begin(), (a).end()
#define rep(s, e, step) for (int i = (s... | [["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 1, 0, 34, 31, 27, 28, 69, 28, 22], ["+", 0, 34, 31, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 34, 31, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 34, 31, 27, 28, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 1, 0, 34, 31, 27, 17, 29], ["+", 0, 57, 75, 76, 0, 1, 0, 34, 0, 21], ["+", ... | 1 | 250 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for (ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rreps(i, e, n) for (ll i = (n)-1; i >= (e); i--)
#defin... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for (ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rreps(i, e, n) for (ll i = (n)-1; i >= (e); i--)
#defin... | [["-", 0, 14, 8, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 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], ["+", 0, 57, 6... | 1 | 241 |
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
... | #include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
... | [["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 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], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 57, 64, 9, 0... | 1 | 307 |
#include <bits/stdc++.h>
#define rep(i, n) for (long long int i = 0; i < n; i++)
#define _rep(i, m, n) for (long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll ... | #include <bits/stdc++.h>
#define rep(i, n) for (long long int i = 0; i < n; i++)
#define _rep(i, m, n) for (long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll ... | [["-", 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, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 14, 8, 9, 0,... | 1 | 312 |
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
num_l=[1 for i in range(n)]
bit_l=[1]+[0 for i in range(n-1)]
for x,y in l:
x-=1
y-=1
if bit_l[x]==1 and num_l[x]==1:
bit_l[x]=0
bit_l[y]=1
num_l[x]-=1
num_l[y]+=1
elif bit_l[x]==1 and num_l[x]>=2:
bit_l[y]=1... | n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
num_l=[1 for i in range(n)]
bit_l=[1]+[0 for i in range(n-1)]
for x,y in l:
x-=1
y-=1
if bit_l[x]==1 and num_l[x]==1:
bit_l[x]=0
bit_l[y]=1
num_l[x]-=1
num_l[y]+=1
elif bit_l[x]==1 and num_l[x]>=2:
bit_l[y]=1... | [["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 73], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["+... | 5 | 166 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
signed main(void) {
int n, m;
cin >> n >> m;
int x[m], y[m];
int have[n];
bool b[n];
rep(i, m) {
cin >> x[i] >> y[i];
x[i]--;
y[i]--;
}
rep(i, n) {
have[i] = 1;
b[i] = false;
}
b[0] = t... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
signed main(void) {
int n, m;
cin >> n >> m;
int x[m], y[m];
int have[n];
bool b[n];
rep(i, m) {
cin >> x[i] >> y[i];
x[i]--;
y[i]--;
}
rep(i, n) {
have[i] = 1;
b[i] = false;
}
b[0] = t... | [["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 64, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 57, 64, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 8, 9, 0... | 1 | 218 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
vector<bool> red(n);
red[0] = true;
vector<int> in(n, 1);
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
x--;
y--;
red[y] = red[x];
in[x]--;
in[y]++;
if (in[x] =... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
vector<bool> red(n);
red[0] = true;
vector<int> in(n, 1);
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
x--;
y--;
if (red[x])
red[y] = red[x];
in[x]--;
in[y]+... | [["+", 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, 70], ["+", 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, 57, 64, 1, 0, 11, 31, 69, 28, 22]] | 1 | 163 |
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin()... | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin()... | [["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 8, 9, 0, 57,... | 1 | 590 |
n,m = map(int,input().split())
xy = [[int(i) for i in input().split()] for _ in range(m)]
num = [1]*n
red = [False]*n
red[0] = True
flag = True
for i in range(m):
p = xy[i][0]
q = xy[i][1]
num[p-1] -= 1
num[q-1] += 1
if red[p-1]==True:
red[q-1] = True
if i==0:
red[0] = False
cou... | n,m = map(int,input().split())
xy = [[int(i) for i in input().split()] for _ in range(m)]
num = [1]*n
red = [False]*n
red[0] = True
flag = True
for i in range(m):
p = xy[i][0]
q = xy[i][1]
num[p-1] -= 1
num[q-1] += 1
if red[p-1]==True:
red[q-1] = True
if num[p-1]==0:
red[p-1... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 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 | 168 |
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for... | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 91, 28, 69, 28, 22], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0... | 1 | 270 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define ll long long
using namespace std;
int main(void) {
ll n, m;
cin >> n >> m;
vector<ll> c(n + 1, 0), s(n + 1, 1);
c[1] = 1;
ll MAX = 2;
ll ans = 0;
for (ll i = 0; i < m... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define ll long long
using namespace std;
int main(void) {
ll n, m;
cin >> n >> m;
vector<ll> c(n + 1, 0), s(n + 1, 1);
c[1] = 1;
ll MAX = 2;
ll ans = 0;
for (ll i = 0; i < m... | [["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 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, 1, 0, 11, 31, 69, 341, 342, 0,... | 1 | 210 |
#include <bits/stdc++.h>
#include <cmath>
#include <stdio.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
// rep…「0からn-1まで」の繰り返し
#define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++)
// rep2…「sからnまで」の繰り返し
#define repr(i, s, n) for (long long i = s; i >= (long l... | #include <bits/stdc++.h>
#include <cmath>
#include <stdio.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
// rep…「0からn-1まで」の繰り返し
#define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++)
// rep2…「sからnまで」の繰り返し
#define repr(i, s, n) for (long long i = s; i >= (long l... | [["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 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, 73], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 64, 1, 0, 11, 31, 69, 341, 342, 0, 1... | 1 | 251 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void YES(... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void YES(... | [["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["-", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["-", 75, 76, 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],... | 1 | 292 |
N,M=map(int, input().split())
c=[1]*(N+1)
p=[0]*(N+1)
p[1]=1
for _ in range(M):
x,y=map(int, input().split())
p[y]=p[x]
c[x]-=1
c[y]+=1
if c[x]==0: p[x]=0
print(sum(p)) | N,M=map(int, input().split())
c=[1]*(N+1)
p=[0]*(N+1)
p[1]=1
for _ in range(M):
x,y=map(int, input().split())
p[y]=1 if p[x]==1 else p[y]
c[x]-=1
c[y]+=1
if c[x]==0: p[x]=0
print(sum(p))
| [["+", 8, 196, 0, 1, 0, 662, 12, 41, 0, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 41, 0, 121], ["+", 0, 662, 12, 41, 0, 666, 0, 206, 0, 73], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 667, 60], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 0, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 41, 0, 95], ["+", 0, 1, 0, 662, 12, 41, 0, 206, 51, 22], ["+... | 5 | 110 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<bool> pos(100001);
int a[100001], b[100001];
vector<int> num(100001, 1);
for (int i = 0; i < m; ++i) {
cin >> a[i] >> b[i];
}
pos[1] = true;
for (int i = 0; i < m; ++i) {
if (pos[a[i]]) {
pos[b[i]... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<bool> pos(100001, false);
int a[100001], b[100001];
vector<int> num(100001, 1);
for (int i = 0; i < m; ++i) {
cin >> a[i] >> b[i];
}
pos[1] = true;
for (int i = 0; i < m; ++i) {
if (pos[a[i]]) {
p... | [["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 147], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 8, 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, ... | 1 | 220 |
N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[x[i]-1]==1 and L[x[i]-1]==1:
R[x[i]-1]=0
L[x[i]-1]=0
R[y[i]... | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
#print(' ','R',R,'L',L)
for i in range(M):
if R[x[i]-1]==1 and L[x[i]-1]==1:
R[x[i]-1]... | [["+", 31, 666, 0, 206, 206, 657, 31, 206, 51, 22], ["+", 31, 666, 0, 206, 206, 657, 31, 206, 0, 70], ["+", 31, 666, 0, 206, 206, 657, 31, 206, 0, 73], ["+", 15, 679, 31, 666, 0, 206, 206, 657, 17, 33], ["+", 15, 679, 31, 666, 0, 206, 206, 657, 12, 612], ["+", 75, 665, 15, 679, 12, 666, 0, 206, 0, 70], ["+", 12, 666, 0... | 5 | 333 |
N,M = map(int,input().split())
a = [1]+[0]*(N-1)
b = [1]*N
sts = 0
for i in range(M):
x,y = map(int,input().split())
if x ==1 and sts == 0:
a[x-1]=0
a[y-1]=1
sts+=1
elif a[x-1]==1 and b[x-1]==1:
a[x-1]=0
a[y-1]=1
elif a[x-1]==1:
a[y-1]=1
b[x-1]-=1
b[y-1]+=1
print(sum(a)) | N,M = map(int,input().split())
a = [1]+[0]*(N-1)
b = [1]*N
for i in range(M):
x,y = map(int,input().split())
if a[x-1]==1 and b[x-1]==1:
a[x-1]=0
a[y-1]=1
elif a[x-1]==1:
a[y-1]=1
b[x-1]-=1
b[y-1]+=1
print(sum(a)) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, ... | 5 | 169 |
N,M = map(int, input().split())
balls = [1]*N
reds = [False]*N
reds[0] = [True]
for i in range(M):
x,y = map(int, input().split())
x -= 1
y -= 1
balls[x] -= 1
balls[y] += 1
if reds[x]:
reds[y] = True
if balls[x] == 0:
reds[x] = False
print(sum(reds)) | N,M = map(int, input().split())
balls = [1]*(N+1)
reds = [False]*(N+1)
reds[0] = True
for i in range(M):
x,y = map(int, input().split())
x -= 1
y -= 1
balls[x] -= 1
balls[y] += 1
if reds[x]:
reds[y] = True
if balls[x] == 0:
reds[x] = False
print(sum(reds)) | [["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 70], ["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 73]] | 5 | 113 |
#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
co... | #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
co... | [["+", 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, 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, 7... | 1 | 238 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int N, M;
cin >> N >> M;
vector<int> box(100010, 1), visit(100010, false);
for (int i = 0; i < M; i++) {
int x, y;
cin >> x >> y;
box[x]--;
box[y]++;
if (i == 0)
visit[y] = true;
if (visit[x] && i ... | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int N, M;
cin >> N >> M;
vector<int> box(100010, 1), visit(100010, false);
visit[1] = true;
for (int i = 0; i < M; i++) {
int x, y;
cin >> x >> y;
box[x]--;
box[y]++;
if (visit[x])
visit[y] = true;
... | [["+", 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], ["-", 8, 9, 0, 57, ... | 1 | 162 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina... | [["+", 0, 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], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]] | 1 | 269 |
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, a) repi(i, 0,... | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, a) repi(i, 0,... | [["-", 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, 30, 0, 14,... | 1 | 286 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n, m;
cin >> n >> m;
vector<ll> x(m), y(m);
for (ll i = 0; i < n; ++i)
cin >> x[i] >> y[i];
vector<ll> red(n, 0);
red[0] = 1;
vector<ll> ball(n, 1);
for (ll i = 0; i < m; ++i) {
ll prev = x[i] - 1, aftr = y[i] ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
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];
vector<int> red(n, 0);
red[0] = 1;
vector<int> ball(n, 1);
for (int i = 0; i < m; ++i) {
int prev = x[i] - 1, aftr ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9... | 1 | 201 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pi... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pi... | [["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 15, 339, 51, 16, 31, 16, 31, 118, 119, 120], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 51, 16, 12, 16, 31, 118, 28, 69, ... | 1 | 686 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, m;
cin >> n >> m;
int x[m], y[m];
for (int i = 0; i < m; i++)
cin >> x[i] >> y[i];
int list[n + 1];
for (int i = 1; i < n + 1; i++)
list[i] = 1;
bool aka[n + 1];
for (int i = 1; i < n + 1; i++)
aka[i] = false;
aka[1] =... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, m;
cin >> n >> m;
int x[m], y[m];
for (int i = 0; i < m; i++)
cin >> x[i] >> y[i];
int list[n + 1];
for (int i = 1; i < n + 1; i++)
list[i] = 1;
bool aka[n + 1];
for (int i = 1; i < n + 1; i++)
aka[i] = false;
aka[1] =... | [["+", 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 | 256 |
n, m = map(int, input().split())
box = [[0, 1] for _ in range(n+1)]
box[0][1] = 0
box[1][0] = 1
for i in range(m):
x, y = map(int, input().split())
if box[x][0]:
box[x][1] -= 1
box[y][0] = 1
box[y][1] += 1
if box[x][1] == 0:
box[x][0] = 0
print(sum(box[x][0] for x in range(1,n+1))) | n, m = map(int, input().split())
box = [[0, 1] for _ in range(n+1)]
box[0][1] = 0
box[1][0] = 1
for i in range(m):
x, y = map(int, input().split())
if box[x][0]:
box[y][0] = 1
box[x][1] -= 1
box[y][1] += 1
if box[x][1] == 0:
box[x][0] = 0
print(sum(box[x][0] for x in range(1,n+1))) | [["-", 0, 1, 0, 677, 31, 206, 51, 206, 206, 22], ["+", 0, 1, 0, 662, 31, 206, 51, 206, 206, 22], ["-", 64, 196, 0, 1, 0, 677, 31, 206, 206, 612], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 662, 31, 206, 51, 20... | 5 | 156 |
#!/usr/bin/env python3
n,m = map(int,input().split())
cnt = [1]*n
visit = [0]*n
visit[0] = 1
for i in range(m):
x,y = map(int,input().split())
if visit[x-1] > 0:
if cnt[x-1] == 1:
visit[x-1] = 0
cnt[x-1] -=1
cnt[y-1] += 1
visit[y-1] =1
print(sum(1 for i in visit if i ... | #!/usr/bin/env python3
n,m = map(int,input().split())
cnt = [1]*n
visit = [0]*n
visit[0] = 1
for i in range(m):
x,y = map(int,input().split())
if visit[x-1] > 0:
if cnt[x-1] == 1:
visit[x-1] = 0
visit[y-1] =1
cnt[x-1] -=1
cnt[y-1] += 1
print(sum(1 for i in visit if i > 0)) | [["-", 64, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["-", 0, 1, 0, 677, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 677, 31, 206, 206, 657, ... | 5 | 128 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define INF 10000... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define INF 10000... | [["-", 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], ["+", 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, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, ... | 1 | 368 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, m, i, x, y, ans = 1;
cin >> n >> m;
vector<int> box(n + 5, 1);
vector<bool> can(n + 5, false);
can.at(1) = true;
for (i = 0; i < m; i++) {
cin >> x >> y;
box.at(x)--;
box.at(y)++;
if (!can.at(y)) {
can.at(y) = true;
... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, m, i, x, y, ans = 1;
cin >> n >> m;
vector<int> box(n + 5, 1);
vector<bool> can(n + 5, false);
can.at(1) = true;
for (i = 0; i < m; i++) {
cin >> x >> y;
box.at(x)--;
box.at(y)++;
if (can.at(x)) {
if (!can.at(y)) {
... | [["+", 0, 57, 15, 339, 51, 2, 63, 118, 28, 22], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["+"... | 1 | 164 |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n + 1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define f first
#def... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n + 1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define f first
#def... | [["-", 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 | 304 |
n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(m)]
count=[1]*(n+1)
s=set()
s.add(1)
for a,b in arr:
if a in s:
s.add(b)
count[b]+=1
count[a]-=1
if count[a]==0:
s.discard(a)
print(len(s)) | n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(m)]
count=[1]*(n+1)
s=set()
s.add(1)
for a,b in arr:
count[b]+=1
count[a]-=1
if a in s:
s.add(b)
if count[a]==0:
s.discard(a)
print(len(s)) | [["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 267], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22... | 5 | 115 |
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int N, M;
cin >> N >> M;
vector<bool> hantei(N + 1, false);
hantei.at(1) = true;
vector<int> ball(N + 1, 1);
ball.at(0) = 0;
int X, Y;
for (int i = 0; i < M; i++) {
cin >> X >> Y;
if (hantei.at(X) == true) {
... | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int N, M;
cin >> N >> M;
vector<bool> hantei(N + 1, false);
hantei.at(1) = true;
vector<int> ball(N + 1, 1);
ball.at(0) = 0;
int X, Y;
for (int i = 0; i < M; i++) {
cin >> X >> Y;
if (hantei.at(X) == true) {
... | [["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 1, 0, 27, 28, 2, 63, 118, 28, 22], ["+", 0, 1, 0, 27, 28, 2, 63, 118, 17, 131], ["+", 0, 1, 0, 27, 28, 2, 63, 118, 119, 120], ["+", 0, 1, 0, 27, 28, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 27, 28, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 27, 28,... | 1 | 196 |
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
Dy[8] = {-1, -1... | //#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
Dy[8] = {-1, -1... | [["+", 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, 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, 7... | 1 | 473 |
//#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target( \
"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
/*#pragma GCC optimize("section-anchors")
#prag... | //#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target( \
"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
/*#pragma GCC optimize("section-anchors")
#prag... | [["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 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... | 1 | 458 |
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32
def solve(N: int, M: int, x: "List[int]", y: "List[int]"):
c = [1] * (N+1)
p = [False] * (N+1)
p[1] = True
for i in range(M):
if p[x[i]] is True:
p[y[i]] = True
c[y[i]] += 1
c[x[i... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32
def solve(N: int, M: int, x: "List[int]", y: "List[int]"):
c = [1] * (N+1)
p = [False] * (N+1)
p[1] = True
for i in range(M):
c[y[i]] += 1
c[x[i]] -= 1
if p[x[i]] is True:
p[y[i]] = True... | [["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["-", 0, 57, 15, 666, 0, 206, 206, 206, 51, 22], ["+", 0, 1, 0, 677, 31, 206, 206, 206, 51, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 709], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0,... | 5 | 281 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<bool> v(n);
v.front() = true;
vector<int> c(n, 1);
for (int i = 0; i < m; ++i) {
int x, y;
cin >> x >> y;
--x, --y;
if (v[x])
v[y] = true, c[y]++;
c[x]--;
if (c[x] == 0)
v[x] = ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<bool> v(n);
v.front() = true;
vector<int> c(n, 1);
for (int i = 0; i < m; ++i) {
int x, y;
cin >> x >> y;
--x, --y;
if (v[x])
v[y] = true;
c[y]++;
c[x]--;
if (c[x] == 0)
v[x... | [["-", 8, 9, 0, 57, 64, 1, 0, 34, 0, 21], ["+", 0, 7, 8, 9, 0, 57, 64, 1, 0, 35], ["-", 0, 7, 8, 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], [... | 1 | 168 |
n,m = map(int,input().split())
red = [0 for i in range(n)]
amount = [1 for i in range(n)]
red[0] = 1
for _ in range(m):
x,y = map(int,input().split())
amount[x-1] -= 1
amount[y-1] += 1
if red[x-1]:
red[y-1] = 1
ans = 0
for r,a in zip(red, amount):
if r > 0 and a > 0:
ans += 1
print(ans) | n,m = map(int,input().split())
red = [0 for i in range(n)]
amount = [1 for i in range(n)]
red[0] = 1
for _ in range(m):
x,y = map(int,input().split())
amount[x-1] -= 1
amount[y-1] += 1
if red[x-1]:
red[y-1] = 1
if amount[x-1] == 0:
red[x-1] = 0
ans = 0
for r,a in zip(red, amount):
if ... | [["+", 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 | 133 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define all(x) (x).begin(), (x).end()
#define Fixed fixed << setprecision(14)
#define int int64_t
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long l... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define all(x) (x).begin(), (x).end()
#define Fixed fixed << setprecision(14)
#define int int64_t
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long l... | [["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 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,... | 1 | 390 |
#include <cstdio>
using namespace std;
int N, M, red[100001], cnt[100001], ans;
int main() {
scanf("%d %d", &N, &M);
red[1] = 1;
for (int i = 1; i <= N; ++i)
cnt[i] = 1;
for (int i = 1, x, y; i <= M; ++i) {
scanf("%d %d", &x, &y);
--cnt[x], ++cnt[y];
if (red[x] == 1)
red[y] = 1;
}
for ... | #include <cstdio>
using namespace std;
int N, M, red[100001], cnt[100001], ans;
int main() {
scanf("%d %d", &N, &M);
red[1] = 1;
for (int i = 1; i <= N; ++i)
cnt[i] = 1;
for (int i = 1, x, y; i <= M; ++i) {
scanf("%d %d", &x, &y);
--cnt[x], ++cnt[y];
if (red[x] == 1)
red[y] = 1;
if (cn... | [["+", 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 | 176 |
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = ... | #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = ... | [["+", 0, 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 | 545 |
// in the name of god
// if you read this code please search about imam hussain
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define endl "\n"
#define X first
#define Y second
#define pii pair<int, int>
#define migmig ... | // in the name of god
// if you read this code please search about imam hussain
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define endl "\n"
#define X first
#define Y second
#define pii pair<int, int>
#define migmig ... | [["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 26... | 1 | 283 |
#include <cstring>
#include <iostream>
#define MOD 1000000007
using namespace std;
int n, m, arr[100010], state[100010], y, x;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++)
arr[i] = 1;
for (int i = 0; i < m; i++) {
cin >> x >... | #include <cstring>
#include <iostream>
#define MOD 1000000007
using namespace std;
int n, m, arr[100010], state[100010], y, x;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++)
arr[i] = 1;
state[0] = 1;
for (int i = 0; i < m; i++) ... | [["+", 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], ["+", 8, 9, 0, 7, 8,... | 1 | 216 |
N, M = map(int,input().split())
x,y = [],[]
for _ in range(M):
tx,ty = map(int, input().split())
x.append(tx)
y.append(ty)
flg = [0] * (N+1)
flg[1] = 1
cnt = [1] * (N+1)
#フラグが1が経っているところからは、移動することで赤を移せる。
for i in range(M):
cp,np = x[i],y[i]
if flg[cp] == 1:
if cnt[cp] == 1:
flg[cp] = 0
cnt[cp] -= 1
cnt[n... | N, M = map(int,input().split())
x,y = [],[]
for _ in range(M):
tx,ty = map(int, input().split())
x.append(tx)
y.append(ty)
flg = [0] * (N+1)
flg[1] = 1
cnt = [1] * (N+1)
#フラグが1が経っているところからは、移動することで赤を移せる。
for i in range(M):
cp,np = x[i],y[i]
if flg[cp] == 1:
if cnt[cp] == 1:
flg[cp] = 0
cnt[cp] -= 1
cnt[n... | [["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 73], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["+... | 5 | 158 |
n, m = map(int, input().split())
num = [1] * n
red = [0] * n
red[0] = 1
for i in range(m):
x, y = map(int, input().split())
x -= 1
y -= 1
if red[x] and num[y]:
red[y] = 1
num[x] -= 1
num[y] += 1
ans = 0
for i in range(n):
if num[i] and red[i]:
ans += 1
print(ans)
| n, m = map(int, input().split())
num = [1] * n
red = [0] * n
red[0] = 1
for i in range(m):
x, y = map(int, input().split())
x -= 1
y -= 1
if red[x]:
red[y] = 1
num[x] -= 1
num[y] += 1
if num[x] == 0:
red[x] = 0
ans = 0
for i in range(n):
if red[i]:
ans += 1
prin... | [["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["-", 8, 196, 0, 57, 15, 679, 12, 206, 51, 22], ["-", 8, 196, 0, 57, 15, 679, 12, 206, 0, 70], ["-", 8, 196, 0, 57, 15, 679, 12, 206, 206, 22], ["-", 8, 196, 0, 57, 15, 679, 12, 206, 0, 73], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 666, 0, 206, ... | 5 | 124 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int64_t, int64_t> pll;
typedef vector<int64_t> vl;
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (100000000... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int64_t, int64_t> pll;
typedef vector<int64_t> vl;
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (100000000... | [["+", 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, 21], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11,... | 1 | 308 |
#include <iostream>
using namespace std;
int main() {
long long int a, b;
cin >> a >> b;
long long int arr[a + 1];
for (int i = 1; i <= a; i++)
arr[i] = 1;
long long int r[a + 1];
long long int sum = 0;
r[1] = 1;
long long int x, y;
for (int i = 0; i < b; i++) {
cin >> x >> y;
if (r[x] ==... | #include <iostream>
using namespace std;
int main() {
long long int a, b;
cin >> a >> b;
long long int arr[a + 1];
for (int i = 1; i <= a; i++)
arr[i] = 1;
long long int r[a + 1] = {0};
long long int sum = 0;
r[1] = 1;
long long int x, y;
for (int i = 0; i < b; i++) {
cin >> x >> y;
if (r... | [["+", 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, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44]] | 1 | 238 |
// Dragon_warrior7(IITK)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define maxin(v) *max_element(v.begin(), v.end())
#define minin(v) *min_element(v.begin(), v.end())
... | // Dragon_warrior7(IITK)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define maxin(v) *max_element(v.begin(), v.end())
#define minin(v) *min_element(v.begin(), v.end())
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 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... | 1 | 368 |
# coding: utf-8
N, M = map(int, input().split())
b = [False] * N
l = [1] * N
b[0] = True
for i in range(M):
x, y = map(int, input().split())
if b[x-1] == True:
b[y-1] = True
l[y-1] += 1
l[x-1] -= 1
if x-1 == 0:
b[x-1] = False
ans = 0
for i in range(N):
if b[i] == True and... | # coding: utf-8
N, M = map(int, input().split())
b = [False] * N
l = [1] * N
b[0] = True
for i in range(M):
x, y = map(int, input().split())
if b[x-1] == True:
b[y-1] = True
if l[x-1] > 0:
l[y-1] += 1
l[x-1] -= 1
if l[x-1] == 0:
b[x-1] = False
ans = 0
for i in range(N):
... | [["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 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, 206, 0, 73], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666,... | 5 | 143 |
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typede... | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typede... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["-"... | 1 | 426 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <string>
#include <tuple>
#include <vector>
template <typename T> bool chmax(T &a, const T &b) {
if (a <= b) {
a = b;
... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <string>
#include <tuple>
#include <vector>
template <typename T> bool chmax(T &a, const T &b) {
if (a <= b) {
a = b;
... | [["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 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], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 64, 1, ... | 1 | 1,397 |
import sys
input = sys.stdin.buffer.readline
n, m = map(int, input().split())
b = [False] * (n + 1)
c = [1] * (n + 1)
for i in range(m):
x, y = map(int, input().split())
c[x] -= 1
c[y] += 1
if b[x]:
b[y] = True
if c[x] == 0:
b[x] = False
print(sum(b)) | import sys
input = sys.stdin.buffer.readline
n, m = map(int, input().split())
b = [False, True] + [False] * (n - 1)
c = [1] * (n + 1)
for i in range(m):
x, y = map(int, input().split())
c[x] -= 1
c[y] += 1
if b[x]:
b[y] = True
if c[x] == 0:
b[x] = False
print(sum(b)) | [["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 21], ["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 146], ["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 73], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 657, 31, 634, 0, 70], ["+", 0, 662, 12, 657, 12, 657, 31, 634, 0, 147], ["-", 0, 662, 12, 657, 12, 23, 0, 6... | 5 | 118 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n, 1);
map<i... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n, 1);
map<i... | [["-", 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 | 180 |
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define out return 0
#define pii pair<ll, ll>
#define ll long long int
using namespace std;
ll mn = 1e18, mx = -1e18;
const ll mv = 1000005;
ll n, m, x[mv], y[mv], a[mv], b[mv], ans;
int main() {
ios_base::sync_with_st... | #include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define out return 0
#define pii pair<ll, ll>
#define ll long long int
using namespace std;
ll mn = 1e18, mx = -1e18;
const ll mv = 1000005;
ll n, m, x[mv], y[mv], a[mv], b[mv], ans;
int main() {
ios_base::sync_with_st... | [["-", 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], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["-", 15, 339, 51, 69, 341, 342, 0, 69, 28, 22], ["+", 0, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 7, ... | 1 | 255 |
n,m = map(int,input().split())
#赤フラグ 玉の個数
arr = [1 for _ in range(n)]
arr1 = [False for _ in range(n)]
arr1[0]=True
ch1 = True
for i in range(m):
x,y = map(int,input().split())
x = x-1
y = y-1
if ch1 == True and x == 0:
ch1 = None
arr[y] +=1
arr1[y] = True
arr[x] -=1
... | n,m = map(int,input().split())
#赤フラグ 玉の個数
arr = [1 for _ in range(n)]
arr1 = [False for _ in range(n)]
arr1[0]=True
ch1 = True
for i in range(m):
x,y = map(int,input().split())
x = x-1
y = y-1
if ch1 == True and x == 0:
ch1 = None
arr[y] +=1
arr1[y] = True
arr[x] -=1
... | [["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 64, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 64, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 64, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 64, 196, 0, 57, 15, 666, 0, 206, 0, 73], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 57, 64, 196, 0, 57, 15, 6... | 5 | 195 |
N,M = map(int,input().split())
XY = [[0,1] for _ in range(N)]
XY[0] = [1,1]
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
if XY[x][0] == 1:
XY[y][0] = 1
XY[y][1] += 1
XY[x][1] -= 1
if XY[x][1] == 0: XY[x][0] = 0
print(sum([flag for flag, _ in XY])) | N,M = map(int,input().split())
XY = [[0,1] for _ in range(N)]
XY[0] = [1,1]
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
XY[y][1] += 1
XY[x][1] -= 1
if XY[x][0] == 1:
XY[y][0] = 1
if XY[x][1] == 0:
XY[x][0] = 0
print(sum([flag for flag, _ in XY])) | [["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 57, 15, 666, 0, 206, 51, 206, 206, 22], ["+", 0, 1, 0, 677, 31, 206, 51, 206, 206, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 206, 612], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 1... | 5 | 145 |
n, m = map(int, input().split())
xy = [list(map(int,input().split())) for _ in range(m)]
cnt = [1] * n
r = [1] + [0] * (n-1)
for x, y in xy:
cnt[x-1] -= 1
cnt[y-1] += 1
if cnt[x-1] == 0:
r[x-1] = 0
if r[x-1] == 1:
r[y-1] = 1
print(sum(r)) | n, m = map(int, input().split())
xy = [list(map(int,input().split())) for _ in range(m)]
cnt = [1] * n
r = [1] + [0] * (n-1)
for x, y in xy:
cnt[x-1] -= 1
cnt[y-1] += 1
if r[x-1] == 1:
r[y-1] = 1
if cnt[x-1] == 0:
r[x-1] = 0
print(sum(r))
| [["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12,... | 5 | 130 |
# 赤が入ってる可能性が0になる場合(すべての球を取り出した場合)があることに注意
n, m = map(int, input().split())
balls = [1 for _ in range(n)]
reddable = [False for _ in range(n)]
reddable[0] = True
for _ in range(m):
x, y = map(lambda x: int(x) - 1, input().split())
if reddable[x] == True:
reddable[y] = True
balls[x] -= 1
b... | # 赤が入ってる可能性が0になる場合(すべての球を取り出した場合)があることに注意
n, m = map(int, input().split())
balls = [1 for _ in range(n)]
reddable = [False for _ in range(n)]
reddable[0] = True
for _ in range(m):
x, y = map(lambda x: int(x) - 1, input().split())
if reddable[x] == True:
reddable[y] = True
balls[x] -= 1
b... | [["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 73], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["+... | 5 | 142 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, ans = 0;
cin >> n >> m;
vector<int> num(n, 1);
vector<bool> flag(n, false);
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--;
b--;
if (i == 0 || flag[a]) {
flag[b] = true;
}
num[a]--;
num[b]++... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, ans = 0;
cin >> n >> m;
vector<int> num(n, 1);
vector<bool> flag(n, false);
flag[0] = true;
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--;
b--;
if (flag[a]) {
flag[b] = true;
}
num[a]--;
... | [["+", 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, 57, 15, 33... | 1 | 173 |
N, M = gets.split.map(&:to_i)
counter = Array.new(N, 1)
red_exists = Array.new(N, false)
visited = Array.new(N, false)
visited[0] = true
M.times do
x, y = gets.split.map { |x| x.to_i - 1 }
counter[x] -= 1
counter[y] += 1
if visited[x]
visited[y] = true
red_exists[y] = true
end
if counter[x].zero... | N, M = gets.split.map(&:to_i)
counter = Array.new(N, 1)
red_exists = Array.new(N, false)
red_exists[0] = true
M.times do
x, y = gets.split.map { |x| x.to_i - 1 }
counter[x] -= 1
counter[y] += 1
if red_exists[x]
red_exists[y] = true
end
if counter[x].zero?
red_exists[x] = false
end
end
ans = 0... | [["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["-", 36, 36, 0, 493, 0, 662, 12, 652, 486, 743], ["-", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["-", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["-", 0, 493, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 493, 0, 662, 12, 652, 3,... | 4 | 145 |
N,M = map(int,input().split())
x = []
y = []
for i in range(M):
x_i,y_i = map(int,input().split())
x.append(x_i)
y.append(y_i)
box_c = [1 for i in range(N+1)]
box_r = [0 for i in range(N+1)]
box_r[1] = 1
for i in range(M):
if box_r[x[i]]==1:
box_r[y[i]] = 1
box_c[x[i]] -= 1
bo... | N,M = map(int,input().split())
x = []
y = []
for i in range(M):
x_i,y_i = map(int,input().split())
x.append(x_i)
y.append(y_i)
box_c = [1 for i in range(N+1)]
box_r = [0 for i in range(N+1)]
box_r[1] = 1
for i in range(M):
box_c[x[i]] -= 1
box_c[y[i]] += 1
if box_r[x[i]]==1:
box_... | [["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 110], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], [... | 5 | 169 |
#include <bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"
using namespace std;
typedef long long ll;
typedef long double ld;
void faster() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
con... | #include <bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"
using namespace std;
typedef long long ll;
typedef long double ld;
void faster() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
con... | [["+", 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], ["+", 0, 52, 8, 9... | 1 | 261 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;
int main() {
int N, M;
cin >> N >> M;
vector<int> x(M), y(M);
rep(i, M) {
cin >> x[... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;
int main() {
int N, M;
cin >> N >> M;
vector<int> x(M), y(M);
rep(i, M) {
cin >> x[... | [["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["-", 64, 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], ["-", ... | 1 | 239 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const in... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const in... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 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, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4,... | 1 | 290 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<pair<int, bool>> pr(N);
int now = 0;
for (int i = 0; i < N; i++) {
if (i == 0) {
pr[i] = make_pair(1, true);
} else {
pr[i] = make_pair(1, false);
}
}
for (int i = 0; i < M; i++) {
int x... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<pair<int, bool>> pr(N);
for (int i = 0; i < N; i++) {
if (i == 0) {
pr[i] = make_pair(1, true);
} else {
pr[i] = make_pair(1, false);
}
}
for (int i = 0; i < M; i++) {
int x, y;
cin >>... | [["-", 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], ["+", 15, 339, 51, 16, 31, 118, 28, 69, 28, 22], ["+", 51, 16, 31, 118, 28, 69, 341, 342, 0, 70], ["+", 51, ... | 1 | 233 |
n,m=map(int,input().split())
r=[False]*n
l=[1]*n
r[0]=True
for i in range(m):
x,y=map(int,input().split())
x-=1;y-=1
if r[x]:
r[y]=True
l[x]-=1
l[y]+=1
s=0
for i in range(n):
if r[i]:
if l[i]:
s+=1
print(s) | n,m=map(int,input().split())
r=[False]*n
l=[1]*n
r[0]=True
for i in range(m):
x,y=map(int,input().split())
x-=1;y-=1
if r[x]:
r[y]=True
l[x]-=1
l[y]+=1
if l[x]==0:
r[x]=False
s=0
for i in range(n):
if r[i]:
if l[i]:
s+=1
print(s) | [["+", 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 | 121 |
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <util... | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <util... | [["-", 8, 9, 0, 7, 8, 9, 0, 338, 0, 88], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 338, 39, 361, 0, 190], ["-", 8, 9, 0, 7, 8, 9, 0, 338, 49, 22], ["-", 8, 9, 0, 7, 8, 9, 0, 338, 0, 102], ["-", 8, 9, 0, 7, 8, 9, 0, 338, 0, 25], ["-", 0, 7, 8, 9, 0, 338, 8, 9, 0, 45], ["-", 8, 9, 0, 338, 8, 9, 0, 57, ... | 1 | 680 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.