buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> #define ll long long const int md = 1000000007; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ co...
#include <bits/stdc++.h> #define ll long long const int md = 1000000007; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ co...
[["+", 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, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
1,037
#include <bits/stdc++.h> using namespace std; #define MAX 1000000000005 #define ll long long int int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t; long long int m, sum = 0, k = 0, i, j, x = 0, sum1 = 0, l, kk, y, z, e, f, q = MAX, r = MAX, n; ll b, c = 0, d, zz = 1; ...
#include <bits/stdc++.h> using namespace std; #define MAX 1000000000005 #define ll long long int int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t; long long int m, sum = 0, k = 0, i, j, x = 0, sum1 = 0, l, kk, y, z, e, f, q = MAX, r = MAX, n; ll b, c = 0, d, zz = 1; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 13]]
1
177
N = int(input()) n=int(N**0.5) cnt=0 for i in range(1,n+1): a=N//i if a-i-1>0: cnt+=(a-i-1)*2 if i**2!=N: cnt+=1 if a*i!=N: cnt+=2 print(cnt)
N = int(input()) n=int(N**0.5) cnt=0 for i in range(1,n+1): a=N//i if a-i-1>0: cnt+=(a-i-1)*2 if i**2!=N: cnt+=1 if a*i!=N and a!=i: cnt+=2 print(cnt)
[["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 79]]
5
80
package main import ( "bufio" "fmt" "os" "strconv" ) func main() { scanner := bufio.NewScanner(os.Stdin) scanner.Scan() numT := scanner.Text() num, _ := strconv.ParseInt(numT, 10, 64) n := float64(num) c := 0 j := float64(1) target := float64(0) for i := float64(0); i <= n; i++ { target = n - i for...
package main import ( "bufio" "fmt" "os" "strconv" ) func main() { scanner := bufio.NewScanner(os.Stdin) scanner.Scan() numT := scanner.Text() num, _ := strconv.ParseInt(numT, 10, 64) n := float64(num) c := 0 j := float64(1) target := float64(0) for i := float64(1); i <= n; i++ { target = n - i for...
[["-", 10, 431, 12, 432, 0, 2, 3, 4, 0, 433], ["+", 10, 431, 12, 432, 0, 2, 3, 4, 0, 433]]
7
182
#include <bits/stdc++.h> using namespace std; int main() { int n, cnt; cin >> n; cnt = 1; for (int i = 1; i * i <= n - 1; i++) { for (int j = i; j * i < n; j++) cnt += 2; } cnt -= sqrt(n - 1); cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, cnt; cin >> n; cnt = 0; for (int i = 1; i * i <= n - 1; i++) { for (int j = i; j * i < n; j++) cnt += 2; } cnt -= int(sqrt(n - 1)); cout << cnt << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 40], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
83
//#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null...
//#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
547
s=0 n=int(input())-1 for i in range(n):s+=(i+1)//n print(s)
s=0 n=int(input())-1 for i in range(n):s+=n//(i+1) print(s)
[["+", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 676], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 676], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22]]
5
34
N = int(input()) ans = 0 for i in range(1, N): for j in range(i, N//i): # print(i, j) if i*j < N: if i == j: ans += 1 else: ans += 2 else: break print(ans)
N = int(input()) ans = 0 for i in range(1, N): for j in range(i, N//i+1): # print(i, j) if i*j < N: if i == j: ans += 1 else: ans += 2 else: break print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
61
#include <bits/stdc++.h> #define ll long long int #define M 1000000007 using namespace std; ll n, t, x, y, m, q; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll div[1000001] = {0}; for (int i = 1; i < 1000001; i++) { for (int j = i; j <= 1000001; j += i) { div[j]++; } } cin >...
#include <bits/stdc++.h> #define ll long long int #define M 1000000007 using namespace std; ll n, t, x, y, m, q; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll div[1000001] = {0}; for (int i = 1; i < 1000001; i++) { for (int j = i; j < 1000001; j += i) { div[j]++; } } cin >>...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
1
132
n = int(input()) ans = 0 if n == 2: print(0) exit() else: for i in range(1, n): ans += (n-1)//i print(ans)
n = int(input()) ans = 0 if n == 2: print(1) exit() else: for i in range(1, n): ans += (n-1)//i print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
48
#include <bits/stdc++.h> #define pb push_back #define pii pair<int, int> #define int long long int #define vec vector<int> #define mp map<int, int> #define inf 1e18 using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int tt = 1; // cin>>tt; while (tt--) { ...
#include <bits/stdc++.h> #define pb push_back #define pii pair<int, int> #define int long long int #define vec vector<int> #define mp map<int, int> #define inf 1e18 using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int tt = 1; // cin>>tt; while (tt--) { ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 93, 0, 94]]
1
129
p (1..n=gets.to_i).sum{n/_1}
p (1..n=gets.to_i).sum{~-n/_1}
[["+", 196, 196, 8, 734, 0, 738, 31, 748, 17, 92], ["+", 8, 734, 0, 738, 31, 748, 439, 748, 17, 33]]
4
17
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n, r = 0; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j * i <= n; j++) { r++; } } cout << r << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n, r = 0; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j * i < n; j++) { r++; } } cout << r << endl; return 0; }
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
1
88
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int N = 2e5 + 5; const int MOD = 998244353; int n, m; int L[15], R[15]; int val[N], dp[N]; inline void add(int &x, int y) { x += y; if (x >= MOD) x -= MOD; } void modify(int x, int v) { while (x <= n) { add(val[x], v); ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int N = 2e5 + 5; const int MOD = 998244353; int n, m; int L[15], R[15]; int val[N], dp[N]; inline void add(int &x, int y) { x += y; if (x >= MOD) x -= MOD; } void modify(int x, int v) { while (x <= n) { add(val[x], v); ...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
332
#include <bits/stdc++.h> using namespace std; void __print(int x) { cout << x; } void __print(long x) { cout << x; } void __print(long long x) { cout << x; } void __print(unsigned x) { cout << x; } void __print(unsigned long x) { cout << x; } void __print(unsigned long long x) { cout << x; } void __print(float x) { cou...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cout << x; } void __print(long x) { cout << x; } void __print(long long x) { cout << x; } void __print(unsigned x) { cout << x; } void __print(unsigned long x) { cout << x; } void __print(unsigned long long x) { cout << x; } void __print(float x) { cou...
[["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
846
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; using ll = long long; const ll mod = 998244353; int main() { ll n, k; cin >> n >> k; vector<int> l(k), r(k); rep(i, k) { cin >> l[i] >> r[i]; } vector<int> dp(n + 10); dp[1] = 1; for (int i = 1; i < n; i++)...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; using ll = long long; const ll mod = 998244353; int main() { ll n, k; cin >> n >> k; vector<int> l(k), r(k); rep(i, k) { cin >> l[i] >> r[i]; } vector<int> dp(n + 10); dp[1] = 1; for (int i = 1; i < n; i++)...
[["-", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 51, 2, 3, 4, 0, 16, 12, 69, 28, 22], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
248
M = 998_244_353 n, k = gets.chomp.split(' ').map(&:to_i) lr = k.times.map { gets.chomp.split(' ').map(&:to_i) }.sort_by dp = (0..n).map { 0 } dp[1] = 1 (2..n).each do |i| temp = lr.map { |l, r| dp[[0, i - l].max] - dp[[0, i - r - 1].max] }.sum dp[i] = (dp[i - 1] + temp) % M end puts dp[n] - dp[n - 1]
M = 998_244_353 n, k = gets.chomp.split(' ').map(&:to_i) lr = k.times.map { gets.chomp.split(' ').map(&:to_i) }.sort_by dp = (0..n).map { 0 } dp[1] = 1 (2..n).each do |i| temp = lr.map { |l, r| dp[[0, i - l].max] - dp[[0, i - r - 1].max] }.sum dp[i] = (dp[i - 1] + temp) % M end puts (dp[n] - dp[n - 1]) % M
[["+", 0, 652, 3, 4, 0, 738, 31, 739, 0, 24], ["+", 0, 652, 3, 4, 0, 738, 31, 739, 0, 25], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 17, 109], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 12, 743]]
4
150
#include <bits/stdc++.h> #define debug(s) cout << s << endl #define debug1(s, t) cout << s << " " << t << endl #define debug2(s, t, u) cout << s << " " << t << " " << u << endl #define printvec(v) \ for (auto &&i : v) ...
#include <bits/stdc++.h> #define debug(s) cout << s << endl #define debug1(s, t) cout << s << " " << t << endl #define debug2(s, t, u) cout << s << " " << t << " " << u << endl #define printvec(v) \ for (auto &&i : v) ...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
886
def d_leaping_tak(MOD=998244353): from bisect import bisect_left, bisect_right N, K = [int(i) for i in input().split()] Ranges = sorted([[int(i) for i in input().split()] for j in range(K)]) dp = [0] * (N + 1) # dp[i]: マス i への行き方 dp[1] = 1 cumsum_dp = dp[:] for i in range(2, N + 1): ...
def d_leaping_tak(MOD=998244353): from bisect import bisect_left, bisect_right N, K = [int(i) for i in input().split()] Ranges = sorted([[int(i) for i in input().split()] for j in range(K)]) dp = [0] * (N + 1) # dp[i]: マス i への行き方 dp[1] = 1 cumsum_dp = dp[:] for i in range(2, N + 1): ...
[["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38], ["+", 0, 14, 8, 196, 0, 37, 0, 206, 51, 22], ["+", 0, 14, 8, 196, 0, 37, 0, 206, 0, 70], ["+", 0, 14, 8, 196, 0, 37, 0, 206, 206, 22], ["+", 0, 14, 8, 196, 0, 37, 0, 206, 0, 73]]
5
173
#include <algorithm> #include <assert.h> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <list> #include <map> #include <math.h> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <vector> using namespace std; // const unsigned long long MOD = (uns...
#include <algorithm> #include <assert.h> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <list> #include <map> #include <math.h> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <vector> using namespace std; // const unsigned long long MOD = (uns...
[["-", 0, 14, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 14, 8, 9, 0, 57, 64, 116, 0, 117]]
1
289
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author silviase */ public class Main { public static void main(String[] ar...
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author silviase */ public class Main { public static void main(String[] ar...
[["+", 0, 37, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 37, 0, 16, 31, 23, 0, 16, 12, 22]]
3
444
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repr(i, n) for (ll i = (n - 1); i >= 0; i--) #define all(x) x.begin(), x.end() #define br cout << "\n"; using namespace std; const long long INF = 1e10; const long long MOD = 1e9 + 7; using Grap...
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repr(i, n) for (ll i = (n - 1); i >= 0; i--) #define all(x) x.begin(), x.end() #define br cout << "\n"; using namespace std; const long long INF = 1e10; const long long MOD = 1e9 + 7; using Grap...
[["-", 31, 16, 12, 118, 28, 69, 341, 342, 0, 22], ["+", 31, 16, 12, 118, 28, 69, 341, 342, 0, 22]]
1
1,541
n, k = map(int, input().split()) MOD = 998244353 a = [list(map(int, input().split())) for _ in range(k)] dp = [0] * (n + 1) dp[0] = 0; dp[1] = 1 for i in range(2, n+1): dp[i] = dp[i-1] for x, y in a: l = i - y; r = i - x l = max(l, 0); r = min(r, i-1) dp[i] = (dp[i] + (dp[r] - (dp[l -...
n, k = map(int, input().split()) MOD = 998244353 a = [list(map(int, input().split())) for _ in range(k)] dp = [0] * (n + 1) dp[0] = 0; dp[1] = 1 for i in range(2, n+1): dp[i] = dp[i-1] for x, y in a: l = i - y; r = i - x l = max(l, 0); r = min(r, i-1) dp[i] = (dp[i] + (dp[r] - (dp[l -...
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
178
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; const int N = 200005; const int mod = 998244353; struct Seg { int l, r; bool operator<(const Seg &rhs) const { return l < rhs.l; } } seg[11]; ll c[N]; int n, ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; const int N = 200005; const int mod = 998244353; struct Seg { int l, r; bool operator<(const Seg &rhs) const { return l < rhs.l; } } seg[11]; ll c[N]; int n, ...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 25]]
1
423
#include <bits/stdc++.h> using namespace std; #define int long long int #define ull unsigned long long #define pb push_back #define pf push_front #define endl "\n" #define fast_in_out \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define int long long int #define ull unsigned long long #define pb push_back #define pf push_front #define endl "\n" #define fast_in_out \ ios_base::sync_with_stdio(false); ...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
441
#!/usr/bin/env python3 import sys input = sys.stdin.readline MOD = 998244353 n, k = map(int, input().split()) dp = [0] * n dp[0] = 1 dp[1] = -1 % MOD delta = [] for _ in range(k): l, r = map(int, input().split()) delta.append((l, 1)) delta.append((r+1, -1 % MOD)) total = 0 for i in range(n): total += ...
#!/usr/bin/env python3 import sys input = sys.stdin.readline MOD = 998244353 n, k = map(int, input().split()) dp = [0] * n dp[0] = 1 dp[1] = -1 delta = [] for _ in range(k): l, r = map(int, input().split()) delta.append((l, 1)) delta.append((r+1, -1)) total = 0 for i in range(n): total += dp[i] to...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 652, 3, 4, 0, 660, 0, 657, 17, 109], ["-", 0, 652, 3, 4, 0, 660, 0, 657, 12, 22], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
163
// $%D%$.$%M%$.$%Y%$ // $%h%$:$%m%$:$%s%$ #pragma GCC optimize("O3") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define IOS \ ios::sync_wi...
// $%D%$.$%M%$.$%Y%$ // $%h%$:$%m%$:$%s%$ #pragma GCC optimize("O3") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define IOS \ ios::sync_wi...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
354
def resolve(): import sys input = sys.stdin.readline mod = 998244353 n, k = map(int, input().split()) dp = [0] * n dp[0] = 1 s = [tuple(map(int, input().split())) for _ in range(k)] total = 0 for i in range(n - 1): total = (total + dp[i]) % mod for l, r in s: ...
def resolve(): import sys input = sys.stdin.readline mod = 998244353 n, k = map(int, input().split()) dp = [0] * n dp[0] = 1 s = [tuple(map(int, input().split())) for _ in range(k)] total = 0 for i in range(n - 1): total = (total + dp[i]) % mod for l, r in s: ...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
156
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <...
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
1,477
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { // int t = sc.nextInt(); // while(t-- > 0) solve(); out.close(); } private static void solve() { // String s = sc.next(); int n = sc.nextInt(); int k = sc.nextInt(); int[][] arr = n...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { // int t = sc.nextInt(); // while(t-- > 0) solve(); out.close(); } private static void solve() { // String s = sc.next(); int n = sc.nextInt(); int k = sc.nextInt(); int[][] arr = n...
[["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22]]
3
3,048
MOD = 998244353 n, k = map(int, input().split()) left=[] right=[] for _ in range(k): l,r=map(int, input().split()) left+=[l] right+=[r] pref = [0,1] for i in range(n-1): new = 0 for j in range(k): new += pref[max(0,i+2-left[j])] - pref[max(0,i+1-right[j])] #print(pref[max(0,i+2-lef...
MOD = 998244353 n, k = map(int, input().split()) left=[] right=[] for _ in range(k): l,r=map(int, input().split()) left+=[l] right+=[r] pref = [0,1] for i in range(n-1): new = 0 for j in range(k): new += pref[max(0,i+2-left[j])] - pref[max(0,i+1-right[j])] #print(pref[max(0,i+2-lef...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
145
#include <bits/stdc++.h> using namespace std; #define MOD 998244353 int n; int k; int l[10], r[10]; long long memo[200005]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < k; i++) { scanf("%d%d", &l[i], &r[i]); } memo[1] = 1; for (int i = 2; i <= n; i++) { memo[i] = memo[i - 1]; for (in...
#include <bits/stdc++.h> using namespace std; #define MOD 998244353 int n; int k; int l[10], r[10]; long long memo[200005]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < k; i++) { scanf("%d%d", &l[i], &r[i]); } memo[1] = 1; for (int i = 2; i <= n; i++) { memo[i] = memo[i - 1]; for (in...
[["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
214
#include <bits/stdc++.h> using namespace std; int64_t Q = 998244353; int main() { int N, K; cin >> N >> K; vector<pair<int, int>> p(K); for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; p[i] = make_pair(a, b); } sort(p.begin(), p.end()); vector<int64_t> dp(N + 1); vector<int64_t> rui(...
#include <bits/stdc++.h> using namespace std; int64_t Q = 998244353; int main() { int N, K; cin >> N >> K; vector<pair<int, int>> p(K); for (int i = 0; i < K; i++) { int a, b; cin >> a >> b; p[i] = make_pair(a, b); } sort(p.begin(), p.end()); vector<int64_t> dp(N + 1); vector<int64_t> rui(...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
264
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using ord_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define C continue; #define R return #define ul...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using ord_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define C continue; #define R return #define ul...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
1,335
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; long long N, K, l[11], r[11], memo[200010], prefix[400010]; void Input() { cin >> N >> K; for (long long i = 1; i <= K; i++) { cin >> l[i] >> r[i]; } } void Solve() { memset(prefix, 0, sizeof prefix); prefix[N] = 1; memo[N...
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; long long N, K, l[11], r[11], memo[200010], prefix[400010]; void Input() { cin >> N >> K; for (long long i = 1; i <= K; i++) { cin >> l[i] >> r[i]; } } void Solve() { memset(prefix, 0, sizeof prefix); prefix[N] = 1; memo[N...
[["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
267
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math #from math import gcd import bisect import heapq from collections import defaultdict from collections import deque from collections import Counter from functools import lru_cache ############# # Const...
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math #from math import gcd import bisect import heapq from collections import defaultdict from collections import deque from collections import Counter from functools import lru_cache ############# # Const...
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
1,271
#include <bits/stdc++.h> #define MAXN 1000000 + 10 #define MOD 998244353 using namespace std; int n, K; long long Ans[MAXN]; int l[233], r[233]; int main() { scanf("%d%d", &n, &K); for (int i = 1; i <= K; i++) scanf("%d%d", &l[i], &r[i]); Ans[1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j <...
#include <bits/stdc++.h> #define MAXN 1000000 + 10 #define MOD 998244353 using namespace std; int n, K; long long Ans[MAXN]; int l[233], r[233]; int main() { scanf("%d%d", &n, &K); for (int i = 1; i <= K; i++) scanf("%d%d", &l[i], &r[i]); Ans[1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j <...
[["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 22]]
1
249
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import java.util.function.IntUnaryOperator; import java.util.function.LongUnaryOperator; import java.util.function.Predicate; import java.util.function.Supplier; public class Mai...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import java.util.function.IntUnaryOperator; import java.util.function.LongUnaryOperator; import java.util.function.Predicate; import java.util.function.Supplier; public class Mai...
[["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22]]
3
3,434
n,k = map(int,input().split()) lr = [] for _ in range(k): lr.append(list(map(int,input().split()))) print(lr) imos = [0 for _ in range(n)] imos[0] = 1 imos[1] = -1 now = 0 mod = 998244353 for i in range(n): now += imos[i] now %= mod #print(now) for j in range(k): try: imos[i+lr[j][...
n,k = map(int,input().split()) lr = [] for _ in range(k): lr.append(list(map(int,input().split()))) #print(lr) imos = [0 for _ in range(n)] imos[0] = 1 imos[1] = -1 now = 0 mod = 998244353 for i in range(n): now += imos[i] now %= mod #print(now) for j in range(k): try: imos[i+lr[j]...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
184
#include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for (int i = a; i <= b; i++) #define trav(a, x) for (auto &a : x) #define all(x) begin(x), end(x) #define sz(x) (int)x.size() #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; const int MOD = 998244353; int...
#include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for (int i = a; i <= b; i++) #define trav(a, x) for (auto &a : x) #define all(x) begin(x), end(x) #define sz(x) (int)x.size() #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; const int MOD = 998244353; int...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 22]]
1
766
#include <algorithm> #include <chrono> #include <iostream> #include <random> #define rep(i, x) for (ll i = 0; i < x; i++) #define CONCAT_(x, y) x##y #define CONCAT(x, y) CONCAT_(x, y) #define _v1 \ CONCAT(qyw1, __LINE__) // unique name in same line (o...
#include <algorithm> #include <chrono> #include <iostream> #include <random> #define rep(i, x) for (ll i = 0; i < x; i++) #define CONCAT_(x, y) x##y #define CONCAT(x, y) CONCAT_(x, y) #define _v1 \ CONCAT(qyw1, __LINE__) // unique name in same line (o...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
466
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <tuple>...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <tuple>...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,489
import java.io.*; import java.math.*; import java.util.*; public class Main { static class Pair { int l, r; public Pair(int l, int r) { this.l = l; this.r = r; } } public static void process(int test_number) throws IOException { int n = ni(), k = ni(), l, r; Pair arr[] = new Pair...
import java.io.*; import java.math.*; import java.util.*; public class Main { static class Pair { int l, r; public Pair(int l, int r) { this.l = l; this.r = r; } } public static void process(int test_number) throws IOException { int n = ni(), k = ni(), l, r; Pair arr[] = new Pair...
[["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22]]
3
779
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; const int mod = 998244353; int n, k; int main() { scanf("%d %d", &n, &...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; const int mod = 998244353; int n, k; int main() { scanf("%d %d", &n, &...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
284
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 10010...
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 10010...
[["+", 0, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 12, 22]]
1
319
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int mod = 998244353; vector<pair<int, int>> steps; for (int i = 0; i < k; i++) { int x, y; cin >> x >> y; steps.push_back({x, y}); } sort(steps.begin(), steps.end()); vector<int> dp(n); dp[0] = 1; for...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int mod = 998244353; vector<pair<int, int>> steps; for (int i = 0; i < k; i++) { int x, y; cin >> x >> y; steps.push_back({x, y}); } sort(steps.begin(), steps.end()); vector<int> dp(n); dp[0] = 1; for...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
265
n, k = map(int, input().split()) lr = [list(map(int, input().split())) for _ in range(k)] mod = 998244353 dp = [0] * (n + 1) acc = [0] * (n + 1) dp[1], acc[1] = 1, 1 for i in range(2, n + 1): for l, r in lr: dp[i] += acc[max(i - l, 0)] dp[i] -= acc[max(i - r, 0)] dp[i] %= mod acc[i] = (dp[i...
n, k = map(int, input().split()) lr = [list(map(int, input().split())) for _ in range(k)] mod = 998244353 dp = [0] * (n + 1) acc = [0] * (n + 1) dp[1], acc[1] = 1, 1 for i in range(2, n + 1): for l, r in lr: dp[i] += acc[max(i - l, 0)] dp[i] -= acc[max(i - (r + 1), 0)] dp[i] %= mod acc[i] =...
[["+", 206, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 612], ["+", 206, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
164
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define f first #define s second const ll mod = 998244353; const ll N = 2e5 + 5; unordered_map<ll, vector<ll>> adj; vector<ll> vis(300005, 0); vector<ll> p(100005, 0); ll c[100005]; ll cnt; ll n; void dfs(ll nod...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define f first #define s second const ll mod = 998244353; const ll N = 2e5 + 5; unordered_map<ll, vector<ll>> adj; vector<ll> vis(300005, 0); vector<ll> p(100005, 0); ll c[100005]; ll cnt; ll n; void dfs(ll nod...
[["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 31, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 31, 23, 0, 16, 12, 69, 341, 342, 0, 22]]
1
391
#include "bits/stdc++.h" #define MOD 998244353 #define rep(i, n) for (ll i = 0; i < (n); i++) #define rrep(i, n) for (ll i = (n)-1; i >= 0; i--) #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() #define FOR(i, j, k) for (ll i = j; i < k; i++) #define debug_print(var) cerr << #var << "=" << var << ...
#include "bits/stdc++.h" #define MOD 998244353 #define rep(i, n) for (ll i = 0; i < (n); i++) #define rrep(i, n) for (ll i = (n)-1; i >= 0; i--) #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() #define FOR(i, j, k) for (ll i = j; i < k; i++) #define debug_print(var) cerr << #var << "=" << var << ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
639
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <st...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <st...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
606
def resolve(): #n=int(input()) #a,b=map(int,input().split()) #x=list(map(int,input().split())) #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)] n,k=map(int,input().split()) MOD=998244353 lr=[list(map(int,input().split())) for _ in range(k)] dp=[0]*(n+1) dpsum=[0]*(...
def resolve(): #n=int(input()) #a,b=map(int,input().split()) #x=list(map(int,input().split())) #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)] n,k=map(int,input().split()) MOD=998244353 lr=[list(map(int,input().split())) for _ in range(k)] dp=[0]*(n+1) dpsum=[0]*(...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
184
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<ll, ll>; string char_to_string(char val) { return string(1, val); } int char_to_int(char val) { return val - '0'; } template <class...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<ll, ll>; string char_to_string(char val) { return string(1, val); } int char_to_int(char val) { return val - '0'; } template <class...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13]]
1
855
def main(): mod=998244353 n,k=map(int,input().split()) region=[] for _ in range(k): a,b=map(int,input().split()) region.append((a,b)) #dp[i]はマスiに行く方法の個数 #workにdp[i-1]からの増減分を保持 dp=[0]*(n+1) work=[0]*(n+1) #initialize for j in region: if 1+j[0]<=n: ...
def main(): mod=998244353 n,k=map(int,input().split()) region=[] for _ in range(k): a,b=map(int,input().split()) region.append((a,b)) #dp[i]はマスiに行く方法の個数 #workにdp[i-1]からの増減分を保持 dp=[0]*(n+1) work=[0]*(n+1) #initialize for j in region: if 1+j[0]<=n: ...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110]]
5
264
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int, int> #define rep(i, n) for (int i = 0; i < n; i++) int N, K; int L[11], R[11]; int dp[200010]; int mod = 998244353; signed main() { cin >> N >> K; rep(i, K) cin >> L[i] >> R[i]; dp[1] = 1; for (int i = 2; i <= N; i++) ...
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int, int> #define rep(i, n) for (int i = 0; i < n; i++) int N, K; int L[11], R[11]; int dp[200010]; int mod = 998244353; signed main() { cin >> N >> K; rep(i, K) cin >> L[i] >> R[i]; dp[1] = 1; for (int i = 2; i <= N; i++) ...
[["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22]]
1
197
n,k = (int(x) for x in input().split()) lr = [] for _ in range(k): l,r = (int(x) for x in input().split()) lr.append((l,r)) lr.sort() print(lr) mod = 998244353 dp= [0]*(n+1) dp[1] = 1 for i in range(2,n+1): cnt = 0 for l,r in lr: if l >= i: break else: cnt += d...
n,k = (int(x) for x in input().split()) lr = [] for _ in range(k): l,r = (int(x) for x in input().split()) lr.append((l,r)) lr.sort() mod = 998244353 dp= [0]*(n+1) dp[1] = 1 for i in range(2,n+1): cnt = 0 for l,r in lr: if l >= i: break else: cnt += dp[i-l] - d...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
166
import sys input = sys.stdin.readline mod = 998244353 n, k = map(int, input().split()) lr = [list(map(int, input().split())) for _ in range(k)] dp = [0] * (n+1) dp[1] = 1 for i in range(1, n): dp[i+1] += dp[i] for l, r in lr: dp[i+1] += dp[max(i-l+1, 0)] - dp[max(i-r, 0)] dp[i+1] %= mod pri...
import sys input = sys.stdin.readline mod = 998244353 n, k = map(int, input().split()) lr = [list(map(int, input().split())) for _ in range(k)] dp = [0] * (n+1) dp[1] = 1 for i in range(1, n): dp[i+1] += dp[i] for l, r in lr: dp[i+1] += dp[max(i-l+1, 0)] - dp[max(i-r, 0)] dp[i+1] %= mod pri...
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
153
#include <bits/stdc++.h> using namespace std; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } using ll = long long; using lb = long double; using P = ...
#include <bits/stdc++.h> using namespace std; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } using ll = long long; using lb = long double; using P = ...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
553
import math CON = 998244353 N, K = list(map(int,input().split())) LR = [list(map(int,input().split())) for _ in range(K)] dp = [0] * (N + 1) cs = [0] * (N + 1) def solve(): dp[1] = 1 cs[1] = 1 for i in range(2, N + 1): for pts in LR: if i - pts[0] > 0: dp[i] += cs[i-pts[0]] ...
import math CON = 998244353 N, K = list(map(int,input().split())) LR = [list(map(int,input().split())) for _ in range(K)] dp = [0] * (N + 1) cs = [0] * (N + 1) def solve(): dp[1] = 1 cs[1] = 1 for i in range(2, N + 1): for pts in LR: if i - pts[0] > 0: dp[i] += cs[i-pts[0]] ...
[["+", 0, 677, 12, 206, 206, 657, 12, 23, 0, 24], ["+", 0, 677, 12, 206, 206, 657, 12, 23, 0, 25]]
5
197
#include <bits/stdc++.h> using namespace std; #define MOD 998244353 int main(int argc, char const *argv[]) { int n, k; cin >> n >> k; vector<pair<int, int>> section(k); for (int i = 0; i < k; i++) { int l, r; cin >> l >> r; section[i] = make_pair(l, r); } vector<long long> dp(n + 1); dp[1] ...
#include <bits/stdc++.h> using namespace std; #define MOD 998244353 int main(int argc, char const *argv[]) { int n, k; cin >> n >> k; vector<pair<int, int>> section(k); for (int i = 0; i < k; i++) { int l, r; cin >> l >> r; section[i] = make_pair(l, r); } vector<long long> dp(n + 1); dp[1] ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 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, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132]]
1
258
n, k = map(int, input().split()) cum = [0, 1] dp = [0, 1] lr = [list(map(int, input().split())) for _ in range(k)] mod = 998244353 # i: 目標のマス def check(i): res = 0 for l, r in lr: if i - l < 1: break res += cum[i-l] - cum[max(i-r-1,0)] res %= mod return res for i i...
n, k = map(int, input().split()) cum = [0, 1] dp = [0, 1] lr = [list(map(int, input().split())) for _ in range(k)] mod = 998244353 # i: 目標のマス def check(i): res = 0 for l, r in lr: if i - l < 1: continue res += cum[i-l] - cum[max(i-r-1,0)] res %= mod return res for ...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
160
#include <bits/stdc++.h> // #include <atcoder/all> using namespace std; // using namespace atcoder; // using mint = modint1000000007; // using mint = modint998244353; typedef int64_t Int; #define all(x) (x).begin(), (x).end() const double EPS = 1e-10; const Int INF = 1e18; const int inf = 1e9; // const Int mod = 1e9...
#include <bits/stdc++.h> // #include <atcoder/all> using namespace std; // using namespace atcoder; // using mint = modint1000000007; // using mint = modint998244353; typedef int64_t Int; #define all(x) (x).begin(), (x).end() const double EPS = 1e-10; const Int INF = 1e18; const int inf = 1e9; // const Int mod = 1e9...
[["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
430
require "byebug" a = gets.split(" ") $n = a[0].to_i $k = a[1].to_i $f = [1] $prefix_f = [1] $l = [] $r = [] $k.times do a = gets.split(" ") ll = a[0].to_i rr = a[1].to_i $l.push(ll) $r.push(rr) end def sum_from(ll, rr) if rr < 0 0 else ret = $prefix_f[rr] if ll > 0 ret -= $prefix...
a = gets.split(" ") $n = a[0].to_i $k = a[1].to_i $f = [1] $prefix_f = [1] $l = [] $r = [] $k.times do a = gets.split(" ") ll = a[0].to_i rr = a[1].to_i $l.push(ll) $r.push(rr) end def sum_from(ll, rr) if rr < 0 0 else ret = $prefix_f[rr] if ll > 0 ret -= $prefix_f[ll - 1] end...
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6]]
4
203
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define MOD (ll)998244353 in...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define MOD (ll)998244353 in...
[["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
262
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define MOD (ll)998244353 in...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define MOD (ll)998244353 in...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
262
N, K = gets.split.map(&:to_i) mod = 998244353 dp = Array.new(n, 0) dp[0] = 1 lr = k.times.map {gets.split.map(&:to_i)} n.times do |i| dp[i + 1] += dp[i] if 0 < i && i + 1 < N lr.each do |l, r| dp[i + l] = (dp[i + l] + dp[i]) % m if i + l < N dp[i + r + 1] = (dp[i + r + 1] - dp[i]) if i + r + 1 < N end en...
N, K = gets.split.map(&:to_i) mod = 998244353 dp = Array.new(N, 0) dp[0] = 1 lr = K.times.map {gets.split.map(&:to_i)} N.times do |i| dp[i + 1] += dp[i] if 0 < i && i + 1 < N lr.each do |l, r| dp[i + l] = (dp[i + l] + dp[i]) % mod if i + l < N dp[i + r + 1] = (dp[i + r + 1] - dp[i]) if i + r + 1 < N end ...
[["-", 0, 493, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 493, 0, 662, 12, 652, 3, 4, 0, 743], ["-", 0, 493, 0, 662, 12, 652, 486, 652, 486, 22], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 486, 743], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 486, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 486, 743], ["-", 8, 736, 0, 751, 8, 662...
4
157
//#include "atcoder/all" #include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> const int...
//#include "atcoder/all" #include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> const int...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
734
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def S(): return s...
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def S(): return s...
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
310
#include <bits/stdc++.h> #define INF 0x3f3f3f3f #define rep(i, a, n) for (int i = (a); i < (n); i++) #define per(i, a, n) for (int i = (a); i > (n); i--) typedef long long ll; const int maxn = 2e5 + 5; const int mod = 998244353; using namespace std; ll dp[maxn], l[maxn], r[maxn], sum[maxn]; void solve() { ll n, k; ...
#include <bits/stdc++.h> #define INF 0x3f3f3f3f #define rep(i, a, n) for (int i = (a); i < (n); i++) #define per(i, a, n) for (int i = (a); i > (n); i--) typedef long long ll; const int maxn = 2e5 + 5; const int mod = 998244353; using namespace std; ll dp[maxn], l[maxn], r[maxn], sum[maxn]; void solve() { ll n, k; ...
[["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
293
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (int i = 0; i < (int)n; i++) const ll INF = (1LL << 60); const int MOD = 998244353; ll dp[201010] = {0}; int main() { int n, k; cin >> n >> k; vector<ll> L(k), R(k); rep(i, k) { cin >> L[i] >> R[i]...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (int i = 0; i < (int)n; i++) const ll INF = (1LL << 60); const int MOD = 998244353; ll dp[201010] = {0}; int main() { int n, k; cin >> n >> k; vector<ll> L(k), R(k); rep(i, k) { cin >> L[i] >> R[i]...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
277
#include <bits/stdc++.h> using namespace std; using lint = long long; const long long mod = 998244353; template <class T> struct SegTree { int n; vector<T> node; function<T(T, T)> f; T iniV; SegTree(vector<T> v, function<T(T, T)> f, T iniV) : iniV(iniV), f(f) { int sz = v.size(); n = 1; while (...
#include <bits/stdc++.h> using namespace std; using lint = long long; const long long mod = 998244353; template <class T> struct SegTree { int n; vector<T> node; function<T(T, T)> f; T iniV; SegTree(vector<T> v, function<T(T, T)> f, T iniV) : iniV(iniV), f(f) { int sz = v.size(); n = 1; while (...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
608
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < (int)n; i++) #define PB push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define F first #define S second typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; const int MAX = 1000...
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < (int)n; i++) #define PB push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define F first #define S second typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; const int MAX = 1000...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
512
//#pragma GCC optimize "trapv"// WA to RE int!! #include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < n; i++) #define FORR(i, n) for (int i = n; i >= 0; i--) #define pb push_back #define vint vector<int> #define sint set<int> #define mint map<int, int> #define pint pair<int, int> #define int long long int #de...
//#pragma GCC optimize "trapv"// WA to RE int!! #include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < n; i++) #define FORR(i, n) for (int i = n; i >= 0; i--) #define pb push_back #define vint vector<int> #define sint set<int> #define mint map<int, int> #define pint pair<int, int> #define int long long int #de...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
428
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define Rapido \ ios::sync_with_stdio(0); \ cin.tie(0) const int maxS = 2e5 + 10; int MOD = 998244353; int DP[2 * ...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define Rapido \ ios::sync_with_stdio(0); \ cin.tie(0) const int maxS = 2e5 + 10; int MOD = 998244353; int DP[2 * ...
[["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22]]
1
279
#include <stdio.h> const int DIV = 998244353; int max(int a, int b) { if (a >= b) { return (a); } else { return (b); } } int main(void) { int n; int k; int lr[10][2] = {0}; int dp[200001] = {0}; int sdp[200001] = {0}; int i, j; scanf("%d%d", &n, &k); for (i = 0; i < k; i++) { scanf...
#include <stdio.h> const int DIV = 998244353; int max(int a, int b) { if (a >= b) { return (a); } else { return (b); } } int main(void) { int n; int k; int lr[10][2] = {0}; int dp[200001] = {0}; int sdp[200001] = {0}; int i, j; scanf("%d%d", &n, &k); for (i = 0; i < k; i++) { scanf...
[["+", 12, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 17, 72]]
1
286
#include <math.h> #include <stdio.h> #include <string.h> #include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> constexpr long long INFLL = 1e18; using namespace std; using ll = long long; using P = pair<int, int>; int main() { ...
#include <math.h> #include <stdio.h> #include <string.h> #include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> constexpr long long INFLL = 1e18; using namespace std; using ll = long long; using P = pair<int, int>; int main() { ...
[["-", 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], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78]]
1
388
#include <bits/stdc++.h> #define ll long long int #define inf 1000000000000 #define mod 998244353 #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define ll long long int #define inf 1000000000000 #define mod 998244353 #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
613
mod = 998244353 n,k =map(int,input().split()) step =[0]*(n+1) # step[0]=1 step[1]=1 stepsum=[0]*(n+1) stepsum[1]=1 l=[0]*k r=[0]*k for i in range(k): l[i],r[i]=map(int,input().split()) for i in range(2,n+1): for j in range(k): li = i - r[j] ri = i - l[j] if ri <= 0: continue...
mod = 998244353 n,k =map(int,input().split()) step =[0]*(n+1) # step[0]=1 step[1]=1 stepsum=[0]*(n+1) stepsum[1]=1 l=[0]*k r=[0]*k for i in range(k): l[i],r[i]=map(int,input().split()) for i in range(2,n+1): for j in range(k): li = i - r[j] ri = i - l[j] if ri <= 0: continue...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
191
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
307
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
319
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair<int, int>; const int mod = 998244353; int main() { int n, k; cin >> n >> k; vector<int> l(k), r(k); rep(i, k) cin >> l[i] >> r[i]; vector<ll> dp(n + 1); vector<ll> dps(n + 1...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair<int, int>; const int mod = 998244353; int main() { int n, k; cin >> n >> k; vector<int> l(k), r(k); rep(i, k) cin >> l[i] >> r[i]; vector<ll> dp(n + 1); vector<ll> dps(n + 1...
[["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
243
#include <cstdio> #define mod 998244353 #define max(a, b) ((a) > (b) ? (a) : (b)) struct interval { int l, r; } a[200003]; long long f[200003] = {0, 1}, s[200003] = {0, 1}; int n, k; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= k; i++) scanf("%d%d", &a[i].l, &a[i].r); for (int i = 2; i <= n; i++...
#include <cstdio> #define mod 998244353 #define max(a, b) ((a) > (b) ? (a) : (b)) struct interval { int l, r; } a[200003]; long long f[200003] = {0, 1}, s[200003] = {0, 1}; int n, k; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= k; i++) scanf("%d%d", &a[i].l, &a[i].r); for (int i = 2; i <= n; i++...
[["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25]]
1
243
#include <bits/stdc++.h> #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 all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define limit(...
#include <bits/stdc++.h> #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 all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define limit(...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13]]
1
1,314
import sys input = lambda: sys.stdin.readline().rstrip("\r\n") mod = 998244353 n, k = map(int, input().split()) l = [] r = [] for _ in range(k): l_, r_ = map(int, input().split()) l.append(l_) r.append(r_) dp = [0] * (n + 1) dp_csum = [0] * (n + 1) dp[1] = 1 dp_csum[1] = 1 for i in range(2, n + 1): fo...
import sys input = lambda: sys.stdin.readline().rstrip("\r\n") mod = 998244353 n, k = map(int, input().split()) l = [] r = [] for _ in range(k): l_, r_ = map(int, input().split()) l.append(l_) r.append(r_) dp = [0] * (n + 1) dp_csum = [0] * (n + 1) dp[1] = 1 dp_csum[1] = 1 for i in range(2, n + 1): fo...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
216
n,k=map(int,input().split()) lr=[list(map(int,input().split())) for _ in range(k)] mod = 998244353 dp = [0] * (n+1) sdp = [0] * (n+1) dp[1] = 1 sdp[1] = 1 for i in range(n+1): for j in range(k): left = max(0, i-lr[j][1]) right = max(0, i-lr[j][0]+1) dp[i] += sdp[right] - sdp[left] if i+1 <= n: ...
n,k=map(int,input().split()) lr=[list(map(int,input().split())) for _ in range(k)] mod = 998244353 dp = [0] * (n+1) sdp = [0] * (n+1) dp[1] = 1 sdp[1] = 1 for i in range(n+1): for j in range(k): left = max(0, i-lr[j][1]) right = max(0, i-lr[j][0]+1) dp[i] += sdp[right] - sdp[left] if i+1 <= n: ...
[["+", 0, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 206, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 0, 73]]
5
178
#include <bits/stdc++.h> #define ll long long #define ld long double #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep2(i, a, b) for (ll i = a; i <= b; ++i) #define rrep(i, a, b) for (ll i = a; i >= b; --i) #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define pb pus...
#include <bits/stdc++.h> #define ll long long #define ld long double #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep2(i, a, b) for (ll i = a; i <= b; ++i) #define rrep(i, a, b) for (ll i = a; i >= b; --i) #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define pb pus...
[["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22]]
1
1,022
class BIT: def __init__(self, n, MOD): self.n = n self.data = [0] * (n + 1) self.MOD = MOD def sum(self, i): s = 0 while i > 0: s += self.data[i] s %= self.MOD i -= i & -i return s def add(self, i, x): while i <= s...
class BIT: def __init__(self, n, MOD): self.n = n self.data = [0] * (n + 1) self.MOD = MOD def sum(self, i): s = 0 while i > 0: s += self.data[i] s %= self.MOD i -= i & -i return s def add(self, i, x): while i <= s...
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 31, 23, 0, 657, 12, 652, 3, 4, 0, 25]]
5
264
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int mod = 998244353; struct Data { int L, R; }; int main() { int N, K; cin >> N >> K; Data data[K]; for (int i = 0; i < K; ++i) { cin >> data[i].L >> data[i].R; } ll dp[N + ...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int mod = 998244353; struct Data { int L, R; }; int main() { int N, K; cin >> N >> K; Data data[K]; for (int i = 0; i < K; ++i) { cin >> data[i].L >> data[i].R; } ll dp[N + ...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
264
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int INF = 1e9; int main() { int n, k; const int max_n = 2 * 1e5; cin >> n >> k; int l[11], r[11]; for (int i = 0; i < k; i++) cin >> l[i] >> r[i]; vector<int> dp(max_n + 1, 0); vector<int> dpsum(max_n + 1, 0); // vecto...
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int INF = 1e9; int main() { int n, k; const int max_n = 2 * 1e5; cin >> n >> k; int l[11], r[11]; for (int i = 0; i < k; i++) cin >> l[i] >> r[i]; vector<long long> dp(max_n + 1, 0); vector<long long> dpsum(max_n + 1, 0)...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
305
N, K = map(int, input().split()) L = [] R = [] for _ in range(K): l, r = map(int, input().split()) L.append(l) R.append(r) dp = [0]*(N+5) dp[1] = 1 for i in range(2, N+1): dp[i] = dp[i-1] for j in range(K): if i-L[j] >= 0: dp[i] += dp[i-L[j]] if i-R[j]-1 >= 0: dp[i] -= dp[i-R[j]-1] ...
N, K = map(int, input().split()) L = [] R = [] for _ in range(K): l, r = map(int, input().split()) L.append(l) R.append(r) dp = [0]*(N+5) dp[1] = 1 for i in range(2, N+1): dp[i] = dp[i-1] for j in range(K): if i-L[j] >= 0: dp[i] += dp[i-L[j]] if i-R[j]-1 >= 0: dp[i] -= dp[i-R[j]-1] ...
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
180
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:512000000") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <ccomplex> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #incl...
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:512000000") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <ccomplex> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #incl...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
841
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define ll long long #define ull unsigned ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define ll long long #define ull unsigned ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
360
/*The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep.*/ // PRABHJOT SINGH A.K.A. PRABHI //~~~~~conquizztador~~~~~ #include <bits/stdc++.h> using namespace std; using lli = long long int; #define pb push_back #define eb emplace_back #define ...
/*The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep.*/ // PRABHJOT SINGH A.K.A. PRABHI //~~~~~conquizztador~~~~~ #include <bits/stdc++.h> using namespace std; using lli = long long int; #define pb push_back #define eb emplace_back #define ...
[["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22]]
1
350
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) # from numba import njit,i8 # @njit(i8(i8,i8,i8,i8[:,:],i8[:],i8,i8)) def give_dp(N,K,mod,LR,dp,l,r): for i in range(N): if i > 0: dp[i] += dp[i...
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) # from numba import njit,i8 # @njit(i8(i8,i8,i8,i8[:,:],i8[:],i8,i8)) def give_dp(N,K,mod,LR,dp,l,r): for i in range(N): if i > 0: dp[i] += dp...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
255
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y); #define chmin(x, y) x = min(x, y); const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int INF = 1001001001; // auto mod int...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y); #define chmin(x, y) x = min(x, y); const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int INF = 1001001001; // auto mod int...
[["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22]]
1
647
#include <bits/stdc++.h> using namespace std; using ll = long long; // auto mod int // https://youtu.be/L8grWxBlIZ4?t=9858 // https://youtu.be/ERZuLAxZffQ?t=4807 : optimize // https://youtu.be/8uowVvQ_-Mo?t=1329 : division const int mod = 998244353; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x(...
#include <bits/stdc++.h> using namespace std; using ll = long long; // auto mod int // https://youtu.be/L8grWxBlIZ4?t=9858 // https://youtu.be/ERZuLAxZffQ?t=4807 : optimize // https://youtu.be/8uowVvQ_-Mo?t=1329 : division const int mod = 998244353; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x(...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, ...
1
568
mod = 998244353 # 貰うDP def main(N, S): dp = [0 if n != 0 else 1 for n in range(N)] # dp[i]はマスiに行く通り数. (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り) A = [0 if n != 0 else 1 for n in range(N)] # dp[i] = A[i] - A[i-1] (i >= 1), A[0] = dp[0] = 1 (i = 0) が成り立つような配列を考える. for i in range(1, N): # 今いる点 (注目点) ...
mod = 998244353 # 貰うDP def main(N, S): dp = [0 if n != 0 else 1 for n in range(N)] # dp[i]はマスiに行く通り数. (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り) A = [0 if n != 0 else 1 for n in range(N)] # dp[i] = A[i] - A[i-1] (i >= 1), A[0] = dp[0] = 1 (i = 0) が成り立つような配列を考える. for i in range(1, N): # 今いる点 (注目点) ...
[["-", 12, 206, 206, 652, 3, 4, 0, 657, 17, 33], ["-", 12, 206, 206, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 677, 12, 657, 12, 206, 206, 657, 17, 33], ["+", 0, 677, 12, 657, 12, 206, 206, 657, 12, 612]]
5
219
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <sstream> #include <unordered_map> #include <unordered_set> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) #define debug(s, param) std::cerr << s << param << std::endl; using names...
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <sstream> #include <unordered_map> #include <unordered_set> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) #define debug(s, param) std::cerr << s << param << std::endl; using names...
[["+", 51, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["+", 51, 16, 31, 23, 0, 16, 31, 16, 12, 22]]
1
269
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> //bit DP #include <queue> #include <stack> #include <string> #include <vector> using namespace std; priority_queue<long> p; typedef long long ll; long long n; ll k; ll ans = 0; ll now = 0; ll h[400005] = {0}; ll a[200005] = {0}; ll L[12] = {0...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> //bit DP #include <queue> #include <stack> #include <string> #include <vector> using namespace std; priority_queue<long> p; typedef long long ll; long long n; ll k; ll ans = 0; ll now = 0; ll h[400005] = {0}; ll a[200005] = {0}; ll L[12] = {0...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 8, 9, 0, 1, 0, 11, 12, 91, 17, 33], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 110]]
1
280
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define PI 3.14159265358979 #define EPS 1e-8 #define mod 998244353 #define fi first #define se second #define mp make_pair #define pb push_back #define endl "\n" #define NEG_INF -2e18 const ll INF = 1e15; const int N = 2e5 + 50; int main() { ios_ba...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define PI 3.14159265358979 #define EPS 1e-8 #define mod 998244353 #define fi first #define se second #define mp make_pair #define pb push_back #define endl "\n" #define NEG_INF -2e18 const ll INF = 1e15; const int N = 2e5 + 50; int main() { ios_ba...
[["-", 0, 77, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 77, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 25]]
1
318
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 998244353; int main() { int N, K; cin >> N >> K; int L[K], R[K]; for (int i = 0; i < K; i++) { cin >> L[i] >> R[i]; } ll d[N]{}; ll c[N + 1]{}; d[0] = 1; c[1] = 1; for (int i = 1; i < N; i++) { for (int j...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 998244353; int main() { int N, K; cin >> N >> K; int L[K], R[K]; for (int i = 0; i < K; i++) { cin >> L[i] >> R[i]; } ll d[N]{}; ll c[N + 1]{}; d[0] = 1; c[1] = 1; for (int i = 1; i < N; i++) { for (int j...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
235