Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
9 values
p02960
#include <iostream> #include <vector> typedef long long ll; using namespace std; const int N = 1e5 + 5; const int MOD = 1e9 + 7; vector<ll> dp; int main() { string s; cin >> s; int n = s.length(); dp.resize(n, 0); dp[0] = 1; for (char c : s) { vector<ll> dp_next(13, 0); for (int i = 0; i < 10; ++i) { for (int j = 0; j < 13; ++j) { if (c == '?' || c == ('0' + i)) dp_next[(10 * j + i) % 13] = (dp_next[(10 * j + i) % 13] % MOD + dp[j] % MOD) % MOD; } } dp = dp_next; } cout << dp[5] << endl; return 0; }
#include <iostream> #include <vector> typedef long long ll; using namespace std; const int N = 1e5 + 5; const int MOD = 1e9 + 7; vector<ll> dp; int main() { string s; cin >> s; int n = s.length(); dp.resize(13, 0); dp[0] = 1; for (char c : s) { vector<ll> dp_next(13, 0); for (int i = 0; i < 10; ++i) { for (int j = 0; j < 13; ++j) { if (c == '?' || c == ('0' + i)) dp_next[(10 * j + i) % 13] = (dp_next[(10 * j + i) % 13] % MOD + dp[j] % MOD) % MOD; } } dp = dp_next; } cout << dp[5] << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change" ]
769,241
769,242
u882821419
cpp
p02960
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; typedef long long unsigned int ll; // 10^18 typedef unsigned long ul; typedef map<ll, ll> m; typedef multimap<ll, ll> mm; typedef set<ll> s; typedef multiset<ll> ms; typedef priority_queue<ll> pq; typedef queue<ll> q; typedef deque<ll> dq; typedef list<ll> lst; typedef pair<ll, ll> p; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define MOD 1000000007LL //#define and && //#define or || //#define not ! //#define neq != //#define eq == #define REP(i, n) for (int i = 0; i < n; i++) // from 0 to n #define REPR(i, n) for (int i = n; i >= 0; i--) // from n to 0 #define FOR(i, m, n) for (int i = m; i < n; i++) // from m to n #define DBG(a) cout << #a << " : " << a << "\n"; #define MSG(a) cout << a << "\n"; #define ALL(v) v.begin(), v.end() #define SZ(x) ((int)(x).size()) #define PNT(a) printf("%lld", (a)) #define pb push_back //配列などの最後に要素を追加 #define mp make_pair #define lb lower_bound #define ub upper_bound #define FST first #define SND second 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; } int dy[] = {0, 0, 1, -1, 0}; int dx[] = {1, -1, 0, 0, 0}; // swap(a, b); // sort(arr, arr + n); //昇順 // sort(arr, arr+n, greater<int>()); //降順 // max(a, b); // min(a, b); // upper_bound(a, a+n, k) // //配列aの中で、kより大きい値が初めて現れる位置へのポインタ upper_bound(ALL(v), // k) //STLvの中で、kより大きい値が初めて現れる位置へのポインタ lower_bound(a, // a+n, k) lower_bound(ALL(v), k) // //STLvの中で、kの以上値が初めて現れる位置へのポインタ lower_bound(ALL(v),k) - // upper_bound(ALL(v),k) //二分探索を用いて、ある列aに含まれる数kの個数を求める // n個のデータをvectorで取得 vector<ll> INV(ll n) { vector<ll> v(n); REP(i, n) cin >> v[i]; return v; } // index が条件を満たすかどうか bool isOK(vector<ll> &v, int index, int key) { if (v[index] >= key) return true; else return false; } // 汎用的な二分探索 ll bs(vector<ll> &v, int key) { int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1 int ok = SZ(v); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は // a.size() /* ok と ng のどちらが大きいかわからないことを考慮 */ while (abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isOK(v, mid, key)) ok = mid; else ng = mid; } return ok; } // 最大公約数 ll gcd(ll a, ll b) { if (a < b) swap(a, b); ll r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } // 素因数分解 // cnt_pf[i]にi+1で割った回数を格納している // cnt_pf[0]に入力が素数だった場合にその素数が入る vector<ll> prime_factorization(ll n) { vector<ll> cnt_pf(ceil(sqrt(n)), 0); FOR(i, 1, SZ(cnt_pf)) { while (n % (i + 1) == 0) { cnt_pf[i]++; n /= (i + 1); } if (n == 1) break; } if (n != 1) { cnt_pf[0] = n; } return cnt_pf; } // // main関数 // signed main() { // cin.tie(0); // ios::sync_with_stdio(false); // 変数(scala)取得 // ll n, k; // cin >> n >> k; // 変数(vector)取得 // vector<ll> a(n); // a = INV(n); // 文字列取得 string s; cin >> s; // // 実装部分 // ll ans = 0; ll old_dp[13] = {0}; ll new_dp[13] = {0}; old_dp[0] = 1; for (int i = 0; i < s.length(); i++) { int digit; if (s[i] == '?') digit = -1; else digit = s[i] - '0'; for (int j = 0; j < 10; j++) { if (digit != -1 && digit != j) continue; for (int ki = 0; ki < 13; ++ki) { new_dp[(ki * 10 + j) % 13] += old_dp[ki]; } } for (int j = 0; j < 13; ++j) { old_dp[j] = new_dp[j] % MOD; new_dp[j] = 0; } } ans = new_dp[5]; // // 実装部分おわり // // 解答出力 PNT(ans); return 0; }
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; typedef long long unsigned int ll; // 10^18 typedef unsigned long ul; typedef map<ll, ll> m; typedef multimap<ll, ll> mm; typedef set<ll> s; typedef multiset<ll> ms; typedef priority_queue<ll> pq; typedef queue<ll> q; typedef deque<ll> dq; typedef list<ll> lst; typedef pair<ll, ll> p; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define MOD 1000000007LL //#define and && //#define or || //#define not ! //#define neq != //#define eq == #define REP(i, n) for (int i = 0; i < n; i++) // from 0 to n #define REPR(i, n) for (int i = n; i >= 0; i--) // from n to 0 #define FOR(i, m, n) for (int i = m; i < n; i++) // from m to n #define DBG(a) cout << #a << " : " << a << "\n"; #define MSG(a) cout << a << "\n"; #define ALL(v) v.begin(), v.end() #define SZ(x) ((int)(x).size()) #define PNT(a) printf("%lld", (a)) #define pb push_back //配列などの最後に要素を追加 #define mp make_pair #define lb lower_bound #define ub upper_bound #define FST first #define SND second 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; } int dy[] = {0, 0, 1, -1, 0}; int dx[] = {1, -1, 0, 0, 0}; // swap(a, b); // sort(arr, arr + n); //昇順 // sort(arr, arr+n, greater<int>()); //降順 // max(a, b); // min(a, b); // upper_bound(a, a+n, k) // //配列aの中で、kより大きい値が初めて現れる位置へのポインタ upper_bound(ALL(v), // k) //STLvの中で、kより大きい値が初めて現れる位置へのポインタ lower_bound(a, // a+n, k) lower_bound(ALL(v), k) // //STLvの中で、kの以上値が初めて現れる位置へのポインタ lower_bound(ALL(v),k) - // upper_bound(ALL(v),k) //二分探索を用いて、ある列aに含まれる数kの個数を求める // n個のデータをvectorで取得 vector<ll> INV(ll n) { vector<ll> v(n); REP(i, n) cin >> v[i]; return v; } // index が条件を満たすかどうか bool isOK(vector<ll> &v, int index, int key) { if (v[index] >= key) return true; else return false; } // 汎用的な二分探索 ll bs(vector<ll> &v, int key) { int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1 int ok = SZ(v); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は // a.size() /* ok と ng のどちらが大きいかわからないことを考慮 */ while (abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isOK(v, mid, key)) ok = mid; else ng = mid; } return ok; } // 最大公約数 ll gcd(ll a, ll b) { if (a < b) swap(a, b); ll r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } // 素因数分解 // cnt_pf[i]にi+1で割った回数を格納している // cnt_pf[0]に入力が素数だった場合にその素数が入る vector<ll> prime_factorization(ll n) { vector<ll> cnt_pf(ceil(sqrt(n)), 0); FOR(i, 1, SZ(cnt_pf)) { while (n % (i + 1) == 0) { cnt_pf[i]++; n /= (i + 1); } if (n == 1) break; } if (n != 1) { cnt_pf[0] = n; } return cnt_pf; } // // main関数 // signed main() { // cin.tie(0); // ios::sync_with_stdio(false); // 変数(scala)取得 // ll n, k; // cin >> n >> k; // 変数(vector)取得 // vector<ll> a(n); // a = INV(n); // 文字列取得 string s; cin >> s; // // 実装部分 // ll ans = 0; ll old_dp[13] = {0}; ll new_dp[13] = {0}; old_dp[0] = 1; for (int i = 0; i < s.length(); i++) { int digit; if (s[i] == '?') digit = -1; else digit = s[i] - '0'; for (int j = 0; j < 10; j++) { if (digit != -1 && digit != j) continue; for (int ki = 0; ki < 13; ++ki) { new_dp[(ki * 10 + j) % 13] += old_dp[ki]; } } for (int j = 0; j < 13; ++j) { old_dp[j] = new_dp[j] % MOD; new_dp[j] = 0; } } ans = old_dp[5]; // // 実装部分おわり // // 解答出力 PNT(ans); return 0; }
[ "assignment.value.change", "identifier.change" ]
769,247
769,248
u337845373
cpp
p02960
#include <bits/stdc++.h> using namespace std; using ll = long long; static const unsigned long long MOD = 1000000007LL; int main() { string s; cin >> s; int c; ll length = s.length(); ll dp[length + 5][13]; dp[0][0] = 1; for (ll n = 0; n < length; n++) { if (s[n] != '?') c = -1; else c = s[n] - '0'; for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int ki = 0; ki < 13; ki++) { dp[n + 1][(ki * 10 + j) % 13] += dp[n][ki]; } } for (int j = 0; j < 13; j++) dp[n + 1][j] %= MOD; } ll res = dp[length][5]; cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; static const unsigned long long MOD = 1000000007LL; int main() { string s; cin >> s; int c; ll length = s.length(); ll dp[length + 1000][13]; dp[0][0] = 1; for (ll n = 0; n < length; n++) { if (s[n] == '?') c = -1; else c = s[n] - '0'; for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int ki = 0; ki < 13; ki++) { dp[n + 1][(ki * 10 + j) % 13] += dp[n][ki]; } } for (int j = 0; j < 13; j++) dp[n + 1][j] %= MOD; } ll res = dp[length][5]; cout << res << endl; // cout << length << endl; return 0; }
[ "literal.number.change", "expression.operation.binary.change", "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
769,252
769,253
u364916333
cpp
p02960
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout << " "; for (int i = 0; i < v[0].size(); i++) cout << i << " "; cout << endl; for (int i = 0; i < v.size(); i++) { cout << "i=" << i << ": "; for (int j = 0; j < v[i].size(); j++) { if (v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << " "; else cout << "\x1B[31m" << v[i][j] << " "; // https://stackoverrun.com/ja/q/12618775 } cout << "\x1B[0m" << endl; } } int main() { string s; cin >> s; reverse(s.begin(), s.end()); int n = s.size(); const int DIV = 13, MOD = 1e9 + 7; // dp[i][j]: 1の位から i-1の位までを考慮した時の値を13で割ったあまりがj vector<vector<ll>> dp(n + 1, vector<ll>(DIV, 0)); dp[0][0] = 1; ll pow10_i = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < DIV; j++) { for (int k = 0; k < 10; k++) { if (s[i] == '?') { int c = (j + k * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i << " j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; } else { k = (s[i] - '0'); int c = (j + (s[i] - '0') * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i <<" j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; break; } } } // pow10_i = (pow10_i * 10) % DIV;//こっちが正解 pow10_i = (pow10_i * 10) % MOD; //こっちだとダメ } // cout << " dp: " << endl; print_vec2(dp); cout << dp[n][5] << endl; }
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout << " "; for (int i = 0; i < v[0].size(); i++) cout << i << " "; cout << endl; for (int i = 0; i < v.size(); i++) { cout << "i=" << i << ": "; for (int j = 0; j < v[i].size(); j++) { if (v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << " "; else cout << "\x1B[31m" << v[i][j] << " "; // https://stackoverrun.com/ja/q/12618775 } cout << "\x1B[0m" << endl; } } int main() { string s; cin >> s; reverse(s.begin(), s.end()); int n = s.size(); const int DIV = 13, MOD = 1e9 + 7; // dp[i][j]: 1の位から i-1の位までを考慮した時の値を13で割ったあまりがj vector<vector<ll>> dp(n + 1, vector<ll>(DIV, 0)); dp[0][0] = 1; ll pow10_i = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < DIV; j++) { for (int k = 0; k < 10; k++) { if (s[i] == '?') { int c = (j + k * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i << " j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; } else { k = (s[i] - '0'); int c = (j + (s[i] - '0') * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i <<" j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; break; } } } pow10_i = ((pow10_i * 10) % MOD) % DIV; //こっちが正解(%MODも入れて良い,意味ないけど) // pow10_i = ((pow10_i * 10) % DIV) % // MOD;//こっちが正解(%MODも入れて良い,意味ないけど) pow10_i = (pow10_i * // 10) % MOD;//こっちだけだとダメ } // cout << " dp: " << endl; print_vec2(dp); cout << dp[n][5] << endl; }
[ "assignment.change" ]
769,263
769,264
u153607901
cpp
p02960
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout << " "; for (int i = 0; i < v[0].size(); i++) cout << i << " "; cout << endl; for (int i = 0; i < v.size(); i++) { cout << "i=" << i << ": "; for (int j = 0; j < v[i].size(); j++) { if (v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << " "; else cout << "\x1B[31m" << v[i][j] << " "; // https://stackoverrun.com/ja/q/12618775 } cout << "\x1B[0m" << endl; } } int main() { string s; cin >> s; reverse(s.begin(), s.end()); int n = s.size(); const int DIV = 13, MOD = 1e9 + 7; // dp[i][j]: 1の位から i-1の位までを考慮した時の値を13で割ったあまりがj vector<vector<ll>> dp(n + 1, vector<ll>(DIV, 0)); dp[0][0] = 1; ll pow10_i = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < DIV; j++) { for (int k = 0; k < 10; k++) { if (s[i] == '?') { int c = (j + k * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i << " j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; } else { k = (s[i] - '0'); int c = (j + (s[i] - '0') * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i <<" j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; break; } } } // pow10_i = (pow10_i * 10) % DIV;//こっちが正解 pow10_i = (pow10_i * 10) % MOD; //こっちだとダメ } // cout << " dp: " << endl; print_vec2(dp); cout << dp[n][5] << endl; }
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout << " "; for (int i = 0; i < v[0].size(); i++) cout << i << " "; cout << endl; for (int i = 0; i < v.size(); i++) { cout << "i=" << i << ": "; for (int j = 0; j < v[i].size(); j++) { if (v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << " "; else cout << "\x1B[31m" << v[i][j] << " "; // https://stackoverrun.com/ja/q/12618775 } cout << "\x1B[0m" << endl; } } int main() { string s; cin >> s; reverse(s.begin(), s.end()); int n = s.size(); const int DIV = 13, MOD = 1e9 + 7; // dp[i][j]: 1の位から i-1の位までを考慮した時の値を13で割ったあまりがj vector<vector<ll>> dp(n + 1, vector<ll>(DIV, 0)); dp[0][0] = 1; ll pow10_i = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < DIV; j++) { for (int k = 0; k < 10; k++) { if (s[i] == '?') { int c = (j + k * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i << " j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; } else { k = (s[i] - '0'); int c = (j + (s[i] - '0') * pow10_i) % DIV; dp[i + 1][c] = (dp[i + 1][c] + dp[i][j]) % MOD; // cout << " i: " << i << " pow10_i: " << pow10_i <<" j: " << j << " // k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " // dp[i+1][c]: " << dp[i+1][c] << endl; break; } } } pow10_i = ((pow10_i * 10) % DIV) % MOD; //こっちが正解(%MODも入れて良い,意味ないけど) // pow10_i = (pow10_i * 10) % MOD;//こっちだけだとダメ } // cout << " dp: " << endl; print_vec2(dp); cout << dp[n][5] << endl; }
[ "assignment.change" ]
769,263
769,265
u153607901
cpp
p02960
#include <bits/stdc++.h> //Carefully Crafted by hetp111 using namespace std; #define int long long #define double long double #define all(v) (v).begin(), (v).end() #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define vii vector<pii> #define MOD 1000000007 #define MOD2 998244353 #define MOD3 1000000009 #define PI acos(-1) #define eps (1e-8) #define INF (1e18) #define FASTER \ ios_base::sync_with_stdio(0); \ cin.tie(0) template <class A, class B> ostream &operator<<(ostream &out, const pair<A, B> &a) { return out << "(" << a.first << "," << a.second << ")"; } template <class A> ostream &operator<<(ostream &out, const vector<A> &a) { for (const A &it : a) out << it << " "; return out; } template <class A, class B> istream &operator>>(istream &in, pair<A, B> &a) { return in >> a.first >> a.second; } template <class A> istream &operator>>(istream &in, vector<A> &a) { for (A &i : a) in >> i; return in; } // ifstream cinn("in.in");ofstream coutt("out.out"); int poww(const int &a, int b, const int &m = MOD) { if (b == 0) return 1; int x = poww(a, b / 2, m); x = x * x % m; if (b & 1) x = x * a % m; return x; } int ceil(const int &a, const int &b) { return (a + b - 1) / b; } ////Read: // Check corner cases, n==1; // ////Some function: //__builtin_popcountll(), is_sorted(), int n; string s; int dp[100000][13]; int f(int i, int sum) { if (i == n) return sum == 5; int &ans = dp[i][sum]; if (ans != -1) return ans; ans = 0; if (s[i] != '?') { ans = f(i + 1, (sum + s[i] - '0') % 13); } else { for (int j = 0; j < 10; j++) ans = (ans + f(i + 1, (sum + j) % 13)) % MOD; } return ans; } signed main() { FASTER; cin >> s; n = s.size(); memset(dp, -1, sizeof dp); cout << f(0, 0); }
#include <bits/stdc++.h> //Carefully Crafted by hetp111 using namespace std; #define int long long #define double long double #define all(v) (v).begin(), (v).end() #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define vii vector<pii> #define MOD 1000000007 #define MOD2 998244353 #define MOD3 1000000009 #define PI acos(-1) #define eps (1e-8) #define INF (1e18) #define FASTER \ ios_base::sync_with_stdio(0); \ cin.tie(0) template <class A, class B> ostream &operator<<(ostream &out, const pair<A, B> &a) { return out << "(" << a.first << "," << a.second << ")"; } template <class A> ostream &operator<<(ostream &out, const vector<A> &a) { for (const A &it : a) out << it << " "; return out; } template <class A, class B> istream &operator>>(istream &in, pair<A, B> &a) { return in >> a.first >> a.second; } template <class A> istream &operator>>(istream &in, vector<A> &a) { for (A &i : a) in >> i; return in; } // ifstream cinn("in.in");ofstream coutt("out.out"); int poww(const int &a, int b, const int &m = MOD) { if (b == 0) return 1; int x = poww(a, b / 2, m); x = x * x % m; if (b & 1) x = x * a % m; return x; } int ceil(const int &a, const int &b) { return (a + b - 1) / b; } ////Read: // Check corner cases, n==1; // ////Some function: //__builtin_popcountll(), is_sorted(), int n; string s; int dp[100000][13]; int f(int i, int sum) { if (i == n) return sum == 5; int &ans = dp[i][sum]; if (ans != -1) return ans; ans = 0; if (s[i] != '?') { ans = f(i + 1, (sum * 10 + s[i] - '0') % 13); } else { for (int j = 0; j < 10; j++) ans = (ans + f(i + 1, (sum * 10 + j) % 13)) % MOD; } return ans; } signed main() { FASTER; cin >> s; n = s.size(); memset(dp, -1, sizeof dp); cout << f(0, 0); }
[ "assignment.change" ]
769,268
769,269
u047858101
cpp
p02960
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e15; #include <math.h> #define PI 3.14159265358979323846264338327950L const int mxN = 1e9 + 7; char s[100005]; long long dp[100005][13]; int main() { string s; cin >> s; int n = s.length(); dp[0][0] = 1; for (int i = 0; i < n; i++) { int c; if (s[i] == '?') c = -1; else c = s[i] - '0'; for (int j = 0; j < 10; j++) { for (int ki = 0; ki < 13; ki++) { if (c != -1 && c != j) continue; dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } for (int j = 0; j < 13; j++) dp[i][j] %= MOD; } long long res = dp[n][5]; cout << res; return 0; }
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e15; #include <math.h> #define PI 3.14159265358979323846264338327950L const int mxN = 1e9 + 7; char s[100005]; long long dp[100005][13]; int main() { string s; cin >> s; int n = s.length(); dp[0][0] = 1; for (int i = 0; i < n; i++) { int c; if (s[i] == '?') c = -1; else c = s[i] - '0'; for (int j = 0; j < 10; j++) { for (int ki = 0; ki < 13; ki++) { if (c != -1 && c != j) continue; dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } for (int j = 0; j < 13; j++) dp[i + 1][j] %= MOD; } long long res = dp[n][5]; cout << res; return 0; }
[ "assignment.change" ]
769,270
769,271
u221780420
cpp
p02960
#include <bits/stdc++.h> using namespace std; #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using pint = pair<int, int>; using vec = vector<int>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; const int mod = 1e9 + 7; int main() { string s; cin >> s; int len = s.size(); reverse(s.begin(), s.end()); int dp[110000][13]; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } } else { int index = s[0] - '0'; dp[0][index] = 1; } int num = 1; for (int i = 1; i < len; i++) { num *= 10; num %= 13; if (s[i] == '?') { rep(j, 10) { rep(k, 13) { int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } else { rep(k, 13) { int j = (s[i] - '0'); int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } cout << dp[len - 1][5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using pint = pair<int, int>; using vec = vector<int>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; const int mod = 1e9 + 7; int main() { string s; cin >> s; int len = s.size(); reverse(s.begin(), s.end()); int dp[110000][13]; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } } else { int index = s[0] - '0'; dp[0][index] = 1; } int num = 1; for (int i = 1; i < len; i++) { num *= 10; num %= 13; if (s[i] == '?') { rep(j, 10) { rep(k, 13) { int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] %= mod; } } } else { rep(k, 13) { int j = (s[i] - '0'); int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } cout << dp[len - 1][5] << endl; return 0; }
[ "assignment.compound.arithmetic.replace.add", "expression.operator.arithmetic.replace.remove", "expression.operation.binary.change" ]
769,304
769,305
u825601908
cpp
p02960
#include <bits/stdc++.h> using namespace std; #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using pint = pair<int, int>; using vec = vector<int>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; int mod = 1e9 + 7; int main() { string s; cin >> s; int len = s.size(); reverse(s.begin(), s.end()); int dp[110000][13]; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } } else { int index = s[0] - '0'; dp[0][index] = 1; } int num = 1; for (int i = 1; i < len; i++) { num *= 10; num %= 13; if (s[i] == '?') { rep(j, 10) { rep(k, 13) { int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } else { rep(k, 13) { int j = (s[i] - '0'); int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } cout << dp[len - 1][5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using pint = pair<int, int>; using vec = vector<int>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; const int mod = 1e9 + 7; int main() { string s; cin >> s; int len = s.size(); reverse(s.begin(), s.end()); int dp[110000][13]; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } } else { int index = s[0] - '0'; dp[0][index] = 1; } int num = 1; for (int i = 1; i < len; i++) { num *= 10; num %= 13; if (s[i] == '?') { rep(j, 10) { rep(k, 13) { int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] %= mod; } } } else { rep(k, 13) { int j = (s[i] - '0'); int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } cout << dp[len - 1][5] << endl; return 0; }
[ "assignment.compound.arithmetic.replace.add", "expression.operator.arithmetic.replace.remove", "expression.operation.binary.change" ]
769,306
769,305
u825601908
cpp
p02960
#include <bits/stdc++.h> using namespace std; #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using pint = pair<int, int>; using vec = vector<int>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; int mod = 1e9 + 7; int main() { string s; cin >> s; int len = s.size(); reverse(s.begin(), s.end()); int dp[110000][13]; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = i; } } else { int index = s[0] - '0'; dp[0][index] = 1; } int num = 1; for (int i = 1; i < len; i++) { num *= 10; num %= 13; if (s[i] == '?') { rep(j, 10) { rep(k, 13) { int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } else { rep(k, 13) { int j = (s[i] - '0'); int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } cout << dp[len - 1][5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using pint = pair<int, int>; using vec = vector<int>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; const int mod = 1e9 + 7; int main() { string s; cin >> s; int len = s.size(); reverse(s.begin(), s.end()); int dp[110000][13]; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } } else { int index = s[0] - '0'; dp[0][index] = 1; } int num = 1; for (int i = 1; i < len; i++) { num *= 10; num %= 13; if (s[i] == '?') { rep(j, 10) { rep(k, 13) { int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] %= mod; } } } else { rep(k, 13) { int j = (s[i] - '0'); int index = (j * num + k) % 13; dp[i][index] += dp[i - 1][k]; dp[i][index] % mod; } } } cout << dp[len - 1][5] << endl; return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "assignment.compound.arithmetic.replace.add", "expression.operator.arithmetic.replace.remove", "expression.operation.binary.change" ]
769,307
769,305
u825601908
cpp
p02960
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; int main() { string s; cin >> s; int mod = 1000000007; vector<vector<int>> dp( s.size() + 1, vector<int>(13)); // i文字までにあまりjの数がいくつあるか if (s.at(0) == '?') { rep(i, 10) { dp[1][i] = 1; } } else { dp[1][s.at(0) - '0'] = 1; } rep2(i, 1, s.size() + 1) { rep(j, 13) { if (s.at(i - 1) == '?') { rep(k, 10) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; dp[i][(j * 10 + k) % 13] %= mod; } } else { dp[i][(j * 10 + s.at(i - 1) - '0') % 13] = dp[i - 1][j]; } } } cout << dp[s.size()][5] << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; int main() { string s; cin >> s; int mod = 1000000007; vector<vector<int>> dp( s.size() + 1, vector<int>(13)); // i文字までにあまりjの数がいくつあるか if (s.at(0) == '?') { rep(i, 10) { dp[1][i] = 1; } } else { dp[1][s.at(0) - '0'] = 1; } rep2(i, 2, s.size() + 1) { rep(j, 13) { if (s.at(i - 1) == '?') { rep(k, 10) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; dp[i][(j * 10 + k) % 13] %= mod; } } else { dp[i][(j * 10 + s.at(i - 1) - '0') % 13] = dp[i - 1][j]; } } } cout << dp[s.size()][5] << endl; }
[ "literal.number.change", "call.arguments.change" ]
769,316
769,317
u387371565
cpp
p02960
//#include <bits/stdc++.h> #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iomanip> //setprecision(桁) #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; #define pb push_back #define ll long long int #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1e+9 const ll MOD = 1000000007; struct edge { int to; double cost; }; // <最短距離, 頂点の番号> using P = pair<double, int>; int V; const int ci = 2e5 + 5; vector<edge> G[ci]; double d[ci]; void dijkstra(int s) { priority_queue<P, vector<P>, greater<P>> que; fill(d, d + V, INF); d[s] = 0; que.push(P(0, s)); while (!que.empty()) { // cout << "On" << endl; P p = que.top(); que.pop(); int v = p.second; // cout << "v=" << v << endl; if (d[v] < p.first) continue; for (int i = 0; i < G[v].size(); i++) { edge e = G[v][i]; // cout << "koo" << endl; if (d[e.to] > d[v] + e.cost) { // cout << e.cost << endl; d[e.to] = d[v] + e.cost; que.push(P(d[e.to], e.to)); } } } } ll dp[100005][13]; int main() { string s; cin >> s; int n = s.size(); if (s[0] == '?') rep(i, 10) dp[0][i] = 1; else { int c = s[0] - '0'; dp[0][c] = 0; } for (int i = 0; i < n; ++i) { if (s[i] == '?') { for (int k = 0; k < 13; k++) { for (int j = 0; j < 10; j++) { dp[i][(k * 10 + j) % 13] += dp[i - 1][k]; dp[i][(k * 10 + j) % 13] %= MOD; } } } else { int c = s[i] - '0'; for (int k = 0; k < 13; k++) { dp[i][(k * 10 + c) % 13] += dp[i - 1][k]; dp[i][(k * 10 + c) % 13] %= MOD; } } } cout << dp[n - 1][5] << endl; }
//#include <bits/stdc++.h> #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iomanip> //setprecision(桁) #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; #define pb push_back #define ll long long int #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1e+9 const ll MOD = 1000000007; struct edge { int to; double cost; }; // <最短距離, 頂点の番号> using P = pair<double, int>; int V; const int ci = 2e5 + 5; vector<edge> G[ci]; double d[ci]; void dijkstra(int s) { priority_queue<P, vector<P>, greater<P>> que; fill(d, d + V, INF); d[s] = 0; que.push(P(0, s)); while (!que.empty()) { // cout << "On" << endl; P p = que.top(); que.pop(); int v = p.second; // cout << "v=" << v << endl; if (d[v] < p.first) continue; for (int i = 0; i < G[v].size(); i++) { edge e = G[v][i]; // cout << "koo" << endl; if (d[e.to] > d[v] + e.cost) { // cout << e.cost << endl; d[e.to] = d[v] + e.cost; que.push(P(d[e.to], e.to)); } } } } ll dp[100005][13]; int main() { string s; cin >> s; int n = s.size(); if (s[0] == '?') rep(i, 10) dp[0][i] = 1; else { int c = s[0] - '0'; dp[0][c] = 1; } for (int i = 0; i < n; ++i) { if (s[i] == '?') { for (int k = 0; k < 13; k++) { for (int j = 0; j < 10; j++) { dp[i][(k * 10 + j) % 13] += dp[i - 1][k]; dp[i][(k * 10 + j) % 13] %= MOD; } } } else { int c = s[i] - '0'; for (int k = 0; k < 13; k++) { dp[i][(k * 10 + c) % 13] += dp[i - 1][k]; dp[i][(k * 10 + c) % 13] %= MOD; } } } cout << dp[n - 1][5] << endl; }
[ "literal.number.change", "assignment.value.change" ]
769,318
769,319
u504800764
cpp
p02960
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; long long int dp[100005][13]; int main() { string S; cin >> S; if (S[0] != '?') dp[0][(S[0] - '0')]++; else for (int k = 0; k < 10; k++) dp[0][k]++; for (int i = 1; i < S.length(); i++) { for (int j = 0; j < 13; j++) { if (S[i] != '?') { dp[i][((j * 10) % 13 + (S[i] - '0') % 13) % 13] += dp[i - 1][j]; dp[i][((j * 10) % 13 + (S[i] - '0') % 13) % 13] %= mod; } else { for (int k = 0; k < 10; k++) { dp[i][((j * 10) % 13 + k % 13) % 13] += dp[i - 1][j]; dp[i][((j * 10) % 13 + k % 13) % 13] %= mod; } } } } cout << dp[S.length() - 1][0] << endl; }
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; long long int dp[100005][13]; int main() { string S; cin >> S; if (S[0] != '?') dp[0][(S[0] - '0')]++; else for (int k = 0; k < 10; k++) dp[0][k]++; for (int i = 1; i < S.length(); i++) { for (int j = 0; j < 13; j++) { if (S[i] != '?') { dp[i][((j * 10) % 13 + (S[i] - '0') % 13) % 13] += dp[i - 1][j]; dp[i][((j * 10) % 13 + (S[i] - '0') % 13) % 13] %= mod; } else { for (int k = 0; k < 10; k++) { dp[i][((j * 10) % 13 + k % 13) % 13] += dp[i - 1][j]; dp[i][((j * 10) % 13 + k % 13) % 13] %= mod; } } } } cout << dp[S.length() - 1][5] << endl; }
[ "literal.number.change", "variable_access.subscript.index.change", "io.output.change" ]
769,335
769,336
u983681697
cpp
p02960
// RAKSHIT KADAM // ALWAYS USE &IT FOR ITERATING USING AUTO ... // USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN // THE RESPECTIVE DATA STRUCTURE NOTE THAT MEMSET CANNOT ASSIGN A VALUE OF 10^18 // IT WILL ASSIGN A LOWER VALUE THAN THAT!!! #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define ordered_set tree< int , null_type , less<int> , rb_tree_tag , // tree_order_statistics_node_update> #warning !!!check the size of arrayss!!! // NUMERIC DEFINITIONS : #define INF 2000000000000000005 #define MOD 1000000007 #define newMOD 998244353 #define MAX 300006 #define pi 3.1415926535897932384626433832795 #define ll long long #define int long long #define P(gg) \ for (auto rax : gg) { \ cout << rax << " "; \ } \ cout << endl; #define Need_for_speed(activated) \ ios_base ::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define satisfy \ ll t; \ cin >> t; \ while (t--) #define inp(n) \ int n; \ cin >> n #define mp make_pair #define pb push_back #define endl "\n" #define x first #define y second #define fore(i, a, b) for (ll i = a; i < b; i++) #define forci(i, n) for (ll i = 0; i < n; i++) #define vi vector<ll> #define Endl endl #define lb lower_bound #define ub upper_bound #define pii pair<ll, ll> #define input \ freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout) #define time \ cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n"; using namespace std; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } // int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p // = power(x, y/2, m) % m; p = (p * p) % m; return (y%2 == 0)? p : (x * p) % m;} // ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}} void solve() { string s; cin >> s; ll n = s.length(); ll dp[n + 2][14]; memset(dp, 0, sizeof dp); ll ten = 10; if (s[n - 1] == '?') { for (ll i = 0; i <= 9; i++) dp[n - 1][i] = 1; } else { dp[n - 1][s[n - 1] - '0'] = 1; } for (ll i = n - 2; i >= 0; i--) { if (s[i] != '?') { ll num = s[i] - '0'; num = (num * ten) % 13; for (ll j = 0; j <= 12; j++) { (dp[i][(num + j) % 13] += dp[i + 1][j]) %= MOD; } } else { for (ll k = 0; k <= 9; k++) { ll num = k; num = (num * ten) % 13; for (ll j = 0; j < 13; j++) { (dp[i][(num + j) % 13] += dp[i + 1][j]) %= MOD; } } } ten *= 10; ten %= MOD; } cout << (dp[0][5]) % MOD << endl; } signed main() { Need_for_speed(activated); // satisfy // { // solve(); // } solve(); return 0; }
// RAKSHIT KADAM // ALWAYS USE &IT FOR ITERATING USING AUTO ... // USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN // THE RESPECTIVE DATA STRUCTURE NOTE THAT MEMSET CANNOT ASSIGN A VALUE OF 10^18 // IT WILL ASSIGN A LOWER VALUE THAN THAT!!! #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define ordered_set tree< int , null_type , less<int> , rb_tree_tag , // tree_order_statistics_node_update> #warning !!!check the size of arrayss!!! // NUMERIC DEFINITIONS : #define INF 2000000000000000005 #define MOD 1000000007 #define newMOD 998244353 #define MAX 300006 #define pi 3.1415926535897932384626433832795 #define ll long long #define int long long #define P(gg) \ for (auto rax : gg) { \ cout << rax << " "; \ } \ cout << endl; #define Need_for_speed(activated) \ ios_base ::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define satisfy \ ll t; \ cin >> t; \ while (t--) #define inp(n) \ int n; \ cin >> n #define mp make_pair #define pb push_back #define endl "\n" #define x first #define y second #define fore(i, a, b) for (ll i = a; i < b; i++) #define forci(i, n) for (ll i = 0; i < n; i++) #define vi vector<ll> #define Endl endl #define lb lower_bound #define ub upper_bound #define pii pair<ll, ll> #define input \ freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout) #define time \ cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n"; using namespace std; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } // int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p // = power(x, y/2, m) % m; p = (p * p) % m; return (y%2 == 0)? p : (x * p) % m;} // ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}} void solve() { string s; cin >> s; ll n = s.length(); ll dp[n + 2][14]; memset(dp, 0, sizeof dp); ll ten = 10; if (s[n - 1] == '?') { for (ll i = 0; i <= 9; i++) dp[n - 1][i] = 1; } else { dp[n - 1][s[n - 1] - '0'] = 1; } for (ll i = n - 2; i >= 0; i--) { if (s[i] != '?') { ll num = s[i] - '0'; num = (num * ten) % 13; for (ll j = 0; j <= 12; j++) { (dp[i][(num + j) % 13] += dp[i + 1][j]) %= MOD; } } else { for (ll k = 0; k <= 9; k++) { ll num = k; num = (num * ten) % 13; for (ll j = 0; j < 13; j++) { (dp[i][(num + j) % 13] += dp[i + 1][j]) %= MOD; } } } ten *= 10; ten %= 13; } cout << (dp[0][5]) % MOD << endl; } signed main() { Need_for_speed(activated); // satisfy // { // solve(); // } solve(); return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,352
769,353
u677600881
cpp
p02960
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; int n = s.size(); int mod = 1e9 + 7; ll dp[n + 1][13]{}; dp[0][0] = 1; for (int i = 0; i < n; i++) for (int j = 0; j < 13; j++) for (int k = 0; k <= 9; k++) if (s[i] == '?' || s[i] - '0' == k) dp[i + 1][(j * 10 + k) % 13] = (dp[i + 1][(j * 10 + k)] + dp[i][j]) % mod; cout << dp[n][5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; int n = s.size(); int mod = 1e9 + 7; ll dp[n + 1][13]{}; dp[0][0] = 1; for (int i = 0; i < n; i++) for (int j = 0; j < 13; j++) for (int k = 0; k <= 9; k++) if (s[i] == '?' || s[i] - '0' == k) dp[i + 1][(j * 10 + k) % 13] = (dp[i + 1][(j * 10 + k) % 13] + dp[i][j]) % mod; cout << dp[n][5] << endl; return 0; }
[ "assignment.change" ]
769,356
769,357
u804999113
cpp
p02960
#include <bits/stdc++.h> #include <iostream> #include <queue> #include <stdio.h> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef pair<int, int> pi; const ll MOD = 1e9 + 7; int main() { string s; cin >> s; reverse(s.begin(), s.end()); int n = s.size(); vector<ll> dp(13, 0); dp[0] = 1; ll keta = 1; rep(is, n) { vector<ll> new_dp(13, 0); if (s[is] == '?') { rep(i, 10) { int m = (keta * i) % 13; rep(j, 13) { int ni = (j + m) % 13; new_dp[ni] += dp[j]; new_dp[ni] %= MOD; } } } else { ll idx = (s[is] - '0') * keta; rep(i, 13) { new_dp[(i + idx) % 13] = dp[i]; } } dp = new_dp; keta *= 10; keta %= MOD; } cout << dp[5] << endl; return 0; }
#include <bits/stdc++.h> #include <iostream> #include <queue> #include <stdio.h> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef pair<int, int> pi; const ll MOD = 1e9 + 7; int main() { string s; cin >> s; reverse(s.begin(), s.end()); int n = s.size(); vector<ll> dp(13, 0); dp[0] = 1; ll keta = 1; rep(is, n) { vector<ll> new_dp(13, 0); if (s[is] == '?') { rep(i, 10) { int m = (keta * i) % 13; rep(j, 13) { int ni = (j + m) % 13; new_dp[ni] += dp[j]; new_dp[ni] %= MOD; } } } else { ll idx = (s[is] - '0') * keta; rep(i, 13) { new_dp[(i + idx) % 13] = dp[i]; } } dp = new_dp; keta *= 10; keta %= 13; } cout << dp[5] << endl; return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,373
769,374
u977925575
cpp
p02960
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define inf LLONG_MAX #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; int main() { string S; cin >> S; const int N = 13; vector<int64_t> dp(N); dp[0] = 1; int64_t mod = 1e9 + 7; int64_t mul = 1; for (int i = S.size() - 1; i >= 0; i--) { vector<int64_t> nextDP(N); char c = S[i]; if (c == '?') { for (int k = 0; k < 10; k++) { for (int j = 0; j < N; j++) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= mod; } } } else { int k = (int)(c - '0'); for (int j = 0; j < N; j++) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= mod; } } dp = nextDP; mul *= 10; mul %= mod; } cout << dp[5] << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define inf LLONG_MAX #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; int main() { string S; cin >> S; const int N = 13; vector<int64_t> dp(N); dp[0] = 1; int64_t mod = 1e9 + 7; int64_t mul = 1; for (int i = S.size() - 1; i >= 0; i--) { vector<int64_t> nextDP(N); char c = S[i]; if (c == '?') { for (int k = 0; k < 10; k++) { for (int j = 0; j < N; j++) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= mod; } } } else { int k = (int)(c - '0'); for (int j = 0; j < N; j++) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= mod; } } dp = nextDP; mul *= 10; mul %= N; } cout << dp[5] << endl; return 0; }
[ "assignment.value.change", "identifier.change" ]
769,377
769,378
u552122040
cpp
p02960
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { string s; cin >> s; const int n = 13; vector<vector<ll>> dp(100001, vector<ll>(n)); ll mod = 1000000007; int mul = 1; dp[s.length()][0] = 1; for (int i = s.length() - 1; i >= 0; i--) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { for (int j = 0; j < n; j++) { dp[i][(k * mul + j) % n] += dp[i + 1][j]; dp[i][(k * mul + j) % n] %= mod; } } } else { int k = (int)(s[i] - '0'); for (int j = 0; j < n; j++) { dp[i][(k * mul + j) % n] += dp[i + 1][j]; dp[i][(k * mul + j) % n] %= mod; } } mul *= 10; } cout << dp[0][5] << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { string s; cin >> s; const int n = 13; vector<vector<ll>> dp(100001, vector<ll>(n)); ll mod = 1000000007; int mul = 1; dp[s.length()][0] = 1; for (int i = s.length() - 1; i >= 0; i--) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { for (int j = 0; j < n; j++) { dp[i][(k * mul + j) % n] += dp[i + 1][j]; dp[i][(k * mul + j) % n] %= mod; } } } else { int k = (int)(s[i] - '0'); for (int j = 0; j < n; j++) { dp[i][(k * mul + j) % n] += dp[i + 1][j]; dp[i][(k * mul + j) % n] %= mod; } } mul *= 10; mul %= n; } cout << dp[0][5] << endl; return 0; }
[ "assignment.add" ]
769,385
769,386
u915797797
cpp
p02960
#include "bits/stdc++.h" using namespace std; typedef pair<int, int> P; typedef long long ll; const int MOD = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (int)(n); i++) char s[100005]; int dp[100005][13]; int main() { int n; cin >> s; n = strlen(s); dp[0][0] = 1; rep(i, n) { int c; if (s[i] == '?') c = -1; else c = s[i] - '0'; rep(j, 10) { if (c != -1 && c != j) continue; rep(ki, 13) { dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } rep(j, 13) dp[i + 1][j] %= MOD; } cout << dp[n][5]; }
#include "bits/stdc++.h" using namespace std; typedef pair<int, int> P; typedef long long ll; const int MOD = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (int)(n); i++) char s[100005]; ll dp[100005][13]; int main() { int n; cin >> s; n = strlen(s); dp[0][0] = 1; rep(i, n) { int c; if (s[i] == '?') c = -1; else c = s[i] - '0'; rep(j, 10) { if (c != -1 && c != j) continue; rep(ki, 13) { dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } rep(j, 13) dp[i + 1][j] %= MOD; } cout << dp[n][5]; }
[ "variable_declaration.type.change" ]
769,399
769,400
u554988565
cpp
p02960
#include <algorithm> #include <cstring> #include <stdio.h> using namespace std; static const int mo = 1e9 + 7, sz = 1e5 + 6; int n; char s[sz]; int dp[sz][13]; main() { scanf("%s", s); n = strlen(s); dp[0][0] = 1; for (int i = 0; i < n; i++) { int c; if (s[i] == '?') c = -1; else c = (int)(s[i] - '0'); for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int k = 0; k < 13; k++) dp[i + 1][(k * 10 + j) % 13] += dp[i][k]; } for (int j = 0; j < 13; j++) dp[i + 1][j] %= mo; } printf("%d\n", dp[n][5]); }
#include <algorithm> #include <cstring> #include <stdio.h> using namespace std; static const int mo = 1e9 + 7, sz = 1e5 + 6; int n; char s[sz]; long long dp[sz][13]; main() { scanf("%s", s); n = strlen(s); dp[0][0] = 1; for (int i = 0; i < n; i++) { int c; if (s[i] == '?') c = -1; else c = (int)(s[i] - '0'); for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int k = 0; k < 13; k++) dp[i + 1][(k * 10 + j) % 13] += dp[i][k]; } for (int j = 0; j < 13; j++) dp[i + 1][j] %= mo; } printf("%lld\n", dp[n][5]); }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
769,406
769,407
u468811760
cpp
p02960
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define srep(i, from, to) for (int i = from; i < (int)(to); i++) const ll LINF = 1001002003004005006ll; const int INF = 1001001001; int main() { string s; cin >> s; int MOD = 1000000007; int N = 13; int len = s.length(); int mul = 1; vvi dp(N, vi(len + 1, 0)); dp[0][0] = 1; reverse(s.begin(), s.end()); srep(i, 1, len + 1) { char c = s[i - 1]; if (c == '?') { rep(k, 10) { rep(x, N) { int am = (x + k * mul) % N; dp[am][i] += dp[x][i - 1]; dp[am][i] %= MOD; } } } else { int k = c - '0'; rep(x, N) { int am = (x + k * mul) % N; dp[am][i] += dp[x][i - 1]; dp[am][i] %= MOD; } } mul *= 10; } int ans = dp[5][len]; cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define srep(i, from, to) for (int i = from; i < (int)(to); i++) const ll LINF = 1001002003004005006ll; const int INF = 1001001001; int main() { string s; cin >> s; int MOD = 1000000007; int N = 13; int len = s.length(); int mul = 1; vvi dp(N, vi(len + 1, 0)); dp[0][0] = 1; reverse(s.begin(), s.end()); srep(i, 1, len + 1) { char c = s[i - 1]; if (c == '?') { rep(k, 10) { rep(x, N) { int am = (x + k * mul) % N; dp[am][i] += dp[x][i - 1]; dp[am][i] %= MOD; } } } else { int k = c - '0'; rep(x, N) { int am = (x + k * mul) % N; dp[am][i] += dp[x][i - 1]; dp[am][i] %= MOD; } } mul *= 10; mul %= N; } int ans = dp[5][len]; cout << ans << endl; return 0; }
[ "assignment.add" ]
769,410
769,411
u786944534
cpp
p02960
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.rend()) #define ll long long using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; typedef vector<unsigned int> vec; typedef vector<vec> mat; typedef vector<vector<int>> Graph; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const int INF = 1000000000; const ll LINF = 1000000000000000000; // 1e18 const ll MOD = 1000000007; const double PI = acos(-1.0); const double EPS = 1e-10; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline void add(T &a, T b) { a = ((a + b) % MOD + MOD) % MOD; }; int dp[101010][13]; int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; int n = S.size(); dp[0][0] = 1; for (int i = 0; i < n; i++) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int k = 0; k < 13; k++) { dp[i + 1][(j + k * 10) % 13] += dp[i][k]; } } for (int j = 0; j < 13; j++) dp[i + 1][j] %= MOD; } cout << dp[n][5] << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.rend()) #define ll long long using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; typedef vector<unsigned int> vec; typedef vector<vec> mat; typedef vector<vector<int>> Graph; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const int INF = 1000000000; const ll LINF = 1000000000000000000; // 1e18 const ll MOD = 1000000007; const double PI = acos(-1.0); const double EPS = 1e-10; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline void add(T &a, T b) { a = ((a + b) % MOD + MOD) % MOD; }; ll dp[101010][13]; int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; int n = S.size(); dp[0][0] = 1; for (int i = 0; i < n; i++) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int k = 0; k < 13; k++) { dp[i + 1][(j + k * 10) % 13] += dp[i][k]; } } for (int j = 0; j < 13; j++) dp[i + 1][j] %= MOD; } cout << dp[n][5] << endl; }
[ "variable_declaration.type.change" ]
769,418
769,419
u493750228
cpp
p02960
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.rend()) #define ll long long #define pb(a) push_back(a) #define INF 1000000000 #define LINF 1e18 #define MOD 1000000007 using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; typedef vector<unsigned int> vec; typedef vector<vec> mat; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline void add(T &a, T b) { a = ((a + b) % MOD + MOD) % MOD; }; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const double PI = acos(-1.0); const double EPS = 1e-10; string S; int dp[101010][13]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> S; int n = S.size(); dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int ki = 0; ki < 13; ki++) { dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } for (int j = 0; j < 13; j++) dp[i + 1][j] %= MOD; } cout << dp[n][5] << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.rend()) #define ll long long #define pb(a) push_back(a) #define INF 1000000000 #define LINF 1e18 #define MOD 1000000007 using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; typedef vector<unsigned int> vec; typedef vector<vec> mat; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline void add(T &a, T b) { a = ((a + b) % MOD + MOD) % MOD; }; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const double PI = acos(-1.0); const double EPS = 1e-10; string S; ll dp[101010][13]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> S; int n = S.size(); dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int ki = 0; ki < 13; ki++) { dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } for (int j = 0; j < 13; j++) dp[i + 1][j] %= MOD; } cout << dp[n][5] << endl; }
[ "variable_declaration.type.change" ]
769,420
769,421
u493750228
cpp
p02960
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; int le = (int)(S.length()); reverse(S.begin(), S.end()); long long mod = 1000000007; long long dp[le][13]; long long modi[le]; modi[0] = 1; for (int i = 1; i < le; i++) modi[i] = (modi[i - 1] * 10) % 13; if (S[0] == '?') { for (int i = 0; i < 10; i++) dp[0][i] = 1; } else { for (int i = 0; i < 10; i++) dp[0][i] = 0; dp[0][S[0] - '0'] = 1; } for (int i = 10; i < 13; i++) dp[0][i] = 0; for (int i = 1; i < le; i++) { int mo = modi[i]; int a[13]; for (int j = 0; j < 13; j++) { a[j] = 0; } if (S[i] == '?') { for (int j = 0; j < 10; j++) { for (int k = 0; k < 13; k++) { a[(k + mo * j) % 13] += dp[i - 1][k]; a[(k + mo * j) % 13] %= mod; } } } else { int j = S[0] - '0'; for (int k = 0; k < 13; k++) { a[(k + mo * j) % 13] += dp[i - 1][k]; a[(k + mo * j) % 13] %= mod; } } for (int j = 0; j < 13; j++) dp[i][j] = a[j]; } cout << dp[le - 1][5] << endl; }
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; int le = (int)(S.length()); reverse(S.begin(), S.end()); long long mod = 1000000007; long long dp[le][13]; long long modi[le]; modi[0] = 1; for (int i = 1; i < le; i++) modi[i] = (modi[i - 1] * 10) % 13; if (S[0] == '?') { for (int i = 0; i < 10; i++) dp[0][i] = 1; } else { for (int i = 0; i < 10; i++) dp[0][i] = 0; dp[0][S[0] - '0'] = 1; } for (int i = 10; i < 13; i++) dp[0][i] = 0; for (int i = 1; i < le; i++) { int mo = modi[i]; int a[13]; for (int j = 0; j < 13; j++) { a[j] = 0; } if (S[i] == '?') { for (int j = 0; j < 10; j++) { for (int k = 0; k < 13; k++) { a[(k + mo * j) % 13] += dp[i - 1][k]; a[(k + mo * j) % 13] %= mod; } } } else { int j = S[i] - '0'; for (int k = 0; k < 13; k++) { a[(k + mo * j) % 13] += dp[i - 1][k]; a[(k + mo * j) % 13] %= mod; } } for (int j = 0; j < 13; j++) dp[i][j] = a[j]; } cout << dp[le - 1][5] << endl; }
[ "identifier.replace.add", "literal.replace.remove", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
769,424
769,425
u014847113
cpp
p02960
#include <algorithm> #include <array> #include <assert.h> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define fi first #define se second #define mp make_pair #define pb push_back #define sz(x) ((int)(x).size()) typedef vector<int> vi; typedef vector<double> vd; typedef vector<ld> vld; typedef vector<vector<int>> vvi; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef vector<vector<ld>> vvd; typedef vector<string> vs; typedef vector<bool> vb; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const ll MOD = (ll)1e9 + 7; ll binpow(ll a, ll n) { ll res = 1; while (n) { if (n & 1) { res *= a; res %= MOD; } a *= a; a %= MOD; n >>= 1; } return res % MOD; } ll inv(ll x) { return binpow(x, MOD - 2); } void add(ll &x, ll y) { x += y; if (x >= MOD) x -= MOD; } void take(ll &x, ll y) { x -= y; if (x < 0) x += MOD; } ll sum(ll a, ll b) { add(a, b); return a; } ll sub(ll a, ll b) { take(a, b); return a; } ll mul(ll x, ll y) { return (x * y) % MOD; } ll rat(ll x, ll y) { assert(y); return mul(x, inv(y)); } int main() { cout << setprecision(30); ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); string s; cin >> s; ll n = sz(s); vvl dp(2, vl(13)); dp[0][0] = 1; ll ten = 1; for (ll i = n - 1; i >= 0; --i) { char ch = s[i]; for (ll d = 0; d < 10; ++d) { if (ch == '?' || (ch - '0') == d) { for (ll r = 0; r < 13; ++r) { ll rr = (r + (d * ten)) % 13; add(dp[1][rr], dp[0][r]); } } } dp[0].assign(n, 0); swap(dp[0], dp[1]); ten = (ten * 10) % 13; } cout << dp[0][5] << endl; return 0; }
#include <algorithm> #include <array> #include <assert.h> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define fi first #define se second #define mp make_pair #define pb push_back #define sz(x) ((int)(x).size()) typedef vector<int> vi; typedef vector<double> vd; typedef vector<ld> vld; typedef vector<vector<int>> vvi; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef vector<vector<ld>> vvd; typedef vector<string> vs; typedef vector<bool> vb; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const ll MOD = (ll)1e9 + 7; ll binpow(ll a, ll n) { ll res = 1; while (n) { if (n & 1) { res *= a; res %= MOD; } a *= a; a %= MOD; n >>= 1; } return res % MOD; } ll inv(ll x) { return binpow(x, MOD - 2); } void add(ll &x, ll y) { x += y; if (x >= MOD) x -= MOD; } void take(ll &x, ll y) { x -= y; if (x < 0) x += MOD; } ll sum(ll a, ll b) { add(a, b); return a; } ll sub(ll a, ll b) { take(a, b); return a; } ll mul(ll x, ll y) { return (x * y) % MOD; } ll rat(ll x, ll y) { assert(y); return mul(x, inv(y)); } int main() { cout << setprecision(30); ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); string s; cin >> s; ll n = sz(s); vvl dp(2, vl(13)); dp[0][0] = 1; ll ten = 1; for (ll i = n - 1; i >= 0; --i) { char ch = s[i]; for (ll d = 0; d < 10; ++d) { if (ch == '?' || (ch - '0') == d) { for (ll r = 0; r < 13; ++r) { ll rr = (r + (d * ten)) % 13; add(dp[1][rr], dp[0][r]); } } } dp[0].assign(13, 0); swap(dp[0], dp[1]); ten = (ten * 10) % 13; } cout << dp[0][5] << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change" ]
769,432
769,433
u651764969
cpp
p02960
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<vector<int>> dp(s.size() + 1, vector<int>(13)); dp.at(0).at(0) = 1; for (int i = 0; i < s.size(); i++) { int c; if (s.at(i) == '?') { c = -1; } else { c = s.at(i) - '0'; } for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int ki = 0; ki < 13; ki++) { dp[i + 1][(10 * ki + j) % 13] += dp[i][ki]; } } for (int j = 0; j < 13; j++) dp[i + 1][j] %= (long long)1000000007; } int ans = dp[s.size()][5]; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<vector<long long>> dp(s.size() + 1, vector<long long>(13)); dp.at(0).at(0) = 1; for (int i = 0; i < s.size(); i++) { int c; if (s.at(i) == '?') { c = -1; } else { c = s.at(i) - '0'; } for (int j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (int ki = 0; ki < 13; ki++) { dp[i + 1][(10 * ki + j) % 13] += dp[i][ki]; } } for (int j = 0; j < 13; j++) dp[i + 1][j] %= (long long)1000000007; } int ans = dp[s.size()][5]; cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
769,454
769,455
u752904037
cpp
p02960
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; const int INF = int(1e9) + int(1e5); const ll INFL = ll(2e18) + ll(1e10); const ui MOD = 1E9 + 7; const double EPS = 1e-9; #define FOR(i, n) for (int i = 0; i < (n); ++i) #define ROF(i, x) for (int i = (x); i >= 0; --i) #define MP make_pair #define ALL(a) (a).begin(), (a).end() #define ODD(x) (((x)&1) == 0 ? (0) : (1)) #define sign(x) ((x > 0) - (x < 0)) std::mt19937_64 generator(std::chrono::system_clock::now().time_since_epoch().count()); inline ll powmod(ll a, ll b, ll mod) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } ll gcd(ll a, ll b) { return a ? gcd(b % a, a) : b; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } void READ() { ios_base::sync_with_stdio(false); cin.tie(0); #ifdef _DEBUG freopen("in.txt", "r", stdin); #endif } void add(ll &dest, const ll val) { dest += val; if (dest >= MOD) dest -= MOD; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); // freopen ("in.txt", "r", stdin); string s; cin >> s; ll dp[2][13]; for (int i = 0; i < 13; ++i) dp[0][i] = 0; if (s[0] != '?') dp[0][(s[0] - '0') % 13] == 1; else { for (int i = 0; i < 10; ++i) dp[0][i] = 1; } int idx = 1; for (int i = 1; i < s.size(); ++i) { memset(dp[idx], 0, sizeof(dp[idx])); if (s[i] != '?') { int y = s[i] - '0'; for (int j = 0; j < 13; ++j) { add(dp[idx][(10 * j + y) % 13], dp[1 - idx][j]); } } else { for (int y = 0; y < 10; ++y) { for (int j = 0; j < 13; ++j) { add(dp[idx][(10 * j + y) % 13], dp[1 - idx][j]); } } } idx = 1 - idx; } cout << dp[1 - idx][5]; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; const int INF = int(1e9) + int(1e5); const ll INFL = ll(2e18) + ll(1e10); const ui MOD = 1E9 + 7; const double EPS = 1e-9; #define FOR(i, n) for (int i = 0; i < (n); ++i) #define ROF(i, x) for (int i = (x); i >= 0; --i) #define MP make_pair #define ALL(a) (a).begin(), (a).end() #define ODD(x) (((x)&1) == 0 ? (0) : (1)) #define sign(x) ((x > 0) - (x < 0)) std::mt19937_64 generator(std::chrono::system_clock::now().time_since_epoch().count()); inline ll powmod(ll a, ll b, ll mod) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } ll gcd(ll a, ll b) { return a ? gcd(b % a, a) : b; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } void READ() { ios_base::sync_with_stdio(false); cin.tie(0); #ifdef _DEBUG freopen("in.txt", "r", stdin); #endif } void add(ll &dest, const ll val) { dest += val; if (dest >= MOD) dest -= MOD; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); // freopen ("in.txt", "r", stdin); string s; cin >> s; ll dp[2][13]; for (int i = 0; i < 13; ++i) dp[0][i] = 0; if (s[0] != '?') dp[0][(s[0] - '0') % 13] = 1; else { for (int i = 0; i < 10; ++i) dp[0][i] = 1; } int idx = 1; for (int i = 1; i < s.size(); ++i) { memset(dp[idx], 0, sizeof(dp[idx])); if (s[i] != '?') { int y = s[i] - '0'; for (int j = 0; j < 13; ++j) { add(dp[idx][(10 * j + y) % 13], dp[1 - idx][j]); } } else { for (int y = 0; y < 10; ++y) { for (int j = 0; j < 13; ++j) { add(dp[idx][(10 * j + y) % 13], dp[1 - idx][j]); } } } idx = 1 - idx; } cout << dp[1 - idx][5]; }
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
769,458
769,459
u427756349
cpp
p02960
#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <string> #include <type_traits> #include <vector> using namespace std; #define INF (1ll << 60) #define INFint (1 << 30) #define MOD 1000000007 #define BOUND 27182818284 typedef long long ll; typedef long long int lli; // typedef pair<ll,ll> P; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) template <class T> bool umax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool umin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } // gcd template <typename T> T gcd(T a, T b) { if (a == 0) return b; return gcd(b % a, a); } int findGCD(int arr[], int n) { int result = arr[0]; for (int i = 1; i < n; i++) result = gcd(arr[i], result); return result; } template <typename T> T lcm(T m, T n) { // 引数に0がある場合は0を返す if ((0 == m) || (0 == n)) return 0; return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n) } template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill((T *)array, (T *)(array + N), val); } int dx[5] = {1, 0, -1, 0}; int dy[5] = {0, 1, 0, -1}; // v.front() = -BOUND; // v.back() = BOUND; // struct edge{ // int cost, to; // // edge(int in_cost, int in_to){ // cost=in_cost; // to=in_to; // } // bool operator<(const edge &a) const // { // return cost > a.cost; // } //}; vector<int> G[10010]; vector<int> c(10010, 0); int num[10010]; bool used[10010]; int now_c = 0; int dfs(int s) { if (used[s]) { return 0; } else { used[s] = true; } num[s] = c[now_c]; now_c++; for (int i = 0; i < G[s].size(); i++) { dfs(G[s][i]); } return 0; } lli dp[100010][13]; int main() { string S; cin >> S; int x = 0; if (S[0] = '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } for (int i = 10; i < 13; i++) { dp[0][i] = 0; } } else { for (int i = 0; i < 13; i++) { if (S[0] - '0' == i) { dp[0][i] = 1; } else { dp[0][i] = 0; } } } for (int i = 1; i < S.size(); i++) { if (S[i] != '?') { for (int j = 0; j < 13; j++) { dp[i][(j * 10 + (S[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (S[i] - '0')) % 13] %= MOD; } } else { for (int j = 0; j < 13; j++) { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; dp[i][(j * 10 + k) % 13] %= MOD; } } } } cout << dp[S.size() - 1][5] % MOD << endl; return 0; }
#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <string> #include <type_traits> #include <vector> using namespace std; #define INF (1ll << 60) #define INFint (1 << 30) #define MOD 1000000007 #define BOUND 27182818284 typedef long long ll; typedef long long int lli; // typedef pair<ll,ll> P; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) template <class T> bool umax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool umin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } // gcd template <typename T> T gcd(T a, T b) { if (a == 0) return b; return gcd(b % a, a); } int findGCD(int arr[], int n) { int result = arr[0]; for (int i = 1; i < n; i++) result = gcd(arr[i], result); return result; } template <typename T> T lcm(T m, T n) { // 引数に0がある場合は0を返す if ((0 == m) || (0 == n)) return 0; return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n) } template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill((T *)array, (T *)(array + N), val); } int dx[5] = {1, 0, -1, 0}; int dy[5] = {0, 1, 0, -1}; // v.front() = -BOUND; // v.back() = BOUND; // struct edge{ // int cost, to; // // edge(int in_cost, int in_to){ // cost=in_cost; // to=in_to; // } // bool operator<(const edge &a) const // { // return cost > a.cost; // } //}; vector<int> G[10010]; vector<int> c(10010, 0); int num[10010]; bool used[10010]; int now_c = 0; int dfs(int s) { if (used[s]) { return 0; } else { used[s] = true; } num[s] = c[now_c]; now_c++; for (int i = 0; i < G[s].size(); i++) { dfs(G[s][i]); } return 0; } lli dp[100010][13]; int main() { string S; cin >> S; int x = 0; if (S[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } for (int i = 10; i < 13; i++) { dp[0][i] = 0; } } else { for (int i = 0; i < 13; i++) { if (S[0] - '0' == i) { dp[0][i] = 1; } else { dp[0][i] = 0; } } } for (int i = 1; i < S.size(); i++) { if (S[i] != '?') { for (int j = 0; j < 13; j++) { dp[i][(j * 10 + (S[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (S[i] - '0')) % 13] %= MOD; } } else { for (int j = 0; j < 13; j++) { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; dp[i][(j * 10 + k) % 13] %= MOD; } } } } cout << dp[S.size() - 1][5] % MOD << endl; return 0; }
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
769,462
769,463
u991664217
cpp
p02960
#include <algorithm> #include <iostream> #include <string> using namespace std; long long MOD = 1e9 + 7; string s; long long d[100000][13]; int main() { cin >> s; int l = s.size(); reverse(s.begin(), s.end()); if (s[0] == '?') { for (int i = 0; i < 13; i++) d[0][i] = 1; } else { for (int i = 0; i < 13; i++) d[0][i] = 0; d[0][(int)s[0] - '0']++; } long long p = 10; for (int i = 1; i < l; i++) { if (s[i] == '?') { for (int j = 0; j < 13; j++) d[i][j] = 0; for (int j = 0; j < 10; j++) { long long q = p * j; q %= 13; for (int k = 0; k < 13; k++) { d[i][(k + q) % 13] += d[i - 1][k]; d[i][(k + q) % 13] %= MOD; } } } else { long long q = p * ((int)s[i] - '0'); q %= 13; for (int j = 0; j < 13; j++) { d[i][(j + q) % 13] = d[i - 1][j]; } } p *= 10; p %= 13; } cout << d[l - 1][5] << endl; return 0; }
#include <algorithm> #include <iostream> #include <string> using namespace std; long long MOD = 1e9 + 7; string s; long long d[100000][13]; int main() { cin >> s; int l = s.size(); reverse(s.begin(), s.end()); if (s[0] == '?') { for (int i = 0; i < 10; i++) d[0][i] = 1; } else { for (int i = 0; i < 13; i++) d[0][i] = 0; d[0][(int)s[0] - '0']++; } long long p = 10; for (int i = 1; i < l; i++) { if (s[i] == '?') { for (int j = 0; j < 13; j++) d[i][j] = 0; for (int j = 0; j < 10; j++) { long long q = p * j; q %= 13; for (int k = 0; k < 13; k++) { d[i][(k + q) % 13] += d[i - 1][k]; d[i][(k + q) % 13] %= MOD; } } } else { long long q = p * ((int)s[i] - '0'); q %= 13; for (int j = 0; j < 13; j++) { d[i][(j + q) % 13] = d[i - 1][j]; } } p *= 10; p %= 13; } cout << d[l - 1][5] << endl; return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
769,464
769,465
u705230587
cpp
p02960
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <random> #include <sstream> #include <stack> #include <string> #include <typeinfo> #include <vector> using namespace std; typedef long long int ll; ll MOD = 1000000007; int main() { string S; cin >> S; vector<vector<ll>> dp(S.length() + 1, vector<ll>(13, 0)); dp[0][0] = 1; for (ll i = 0; i <= S.length(); i++) { // 0~9までを入れたとき前からのMODがどう変化するか for (ll j = 0; j < 10; j++) { //?ではなく数字が書かれているときは数字分の遷移しか考えない if (S[i] != '?' && (S[i] - '0') != j) { continue; } for (ll h = 0; h < 13; h++) { dp[i + 1][(h * 10 + j) % 13] += dp[i][h]; } } //答えが超えないように割っておく for (ll j = 0; j < 13; j++) { dp[i + 1][j] %= MOD; } } cout << dp[S.length()][5] << endl; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <random> #include <sstream> #include <stack> #include <string> #include <typeinfo> #include <vector> using namespace std; typedef long long int ll; ll MOD = 1000000007; int main() { string S; cin >> S; vector<vector<ll>> dp(S.length() + 1, vector<ll>(13, 0)); dp[0][0] = 1; for (ll i = 0; i < S.length(); i++) { // 0~9までを入れたとき前からのMODがどう変化するか for (ll j = 0; j < 10; j++) { //?ではなく数字が書かれているときは数字分の遷移しか考えない if (S[i] != '?' && (S[i] - '0') != j) { continue; } for (ll h = 0; h < 13; h++) { dp[i + 1][(h * 10 + j) % 13] += dp[i][h]; } } //答えが超えないように割っておく for (ll j = 0; j < 13; j++) { dp[i + 1][j] %= MOD; } } cout << dp[S.length()][5] << endl; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
769,468
769,469
u048791623
cpp
p02960
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> //#include <tuple> #define INF INT_MAX >> 1 #define SIZE 100010 #define MOD 1000000007 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (a); i < (int)(b); i++) typedef long long ll; using namespace std; int dx[] = {-1, 0, 0, 1}; int dy[] = {0, -1, 1, 0}; int main(void) { string s; cin >> s; ll dp[15] = {0}; dp[0] = 1; ll mul = 1; int len = s.length(); rep(i, len) { ll nextDP[15] = {0}; char ch = s[len - i - 1]; if (ch == '?') { rep(k, 10) { rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } } else { int k = ch - '0'; rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } mul *= 10; mul %= 10; copy(nextDP, nextDP + 13, dp); } cout << dp[5] << endl; return 0; }
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> //#include <tuple> #define INF INT_MAX >> 1 #define SIZE 100010 #define MOD 1000000007 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (a); i < (int)(b); i++) typedef long long ll; using namespace std; int dx[] = {-1, 0, 0, 1}; int dy[] = {0, -1, 1, 0}; int main(void) { string s; cin >> s; ll dp[15] = {0}; dp[0] = 1; ll mul = 1; int len = s.length(); rep(i, len) { ll nextDP[15] = {0}; char ch = s[len - i - 1]; if (ch == '?') { rep(k, 10) { rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } } else { int k = ch - '0'; rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } mul *= 10; mul %= 13; copy(nextDP, nextDP + 13, dp); } cout << dp[5] << endl; return 0; }
[ "literal.number.change", "assignment.value.change" ]
769,515
769,516
u117734686
cpp
p02960
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> //#include <tuple> #define INF INT_MAX >> 1 #define SIZE 100010 #define MOD 1000000007 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (a); i < (int)(b); i++) typedef long long ll; using namespace std; int dx[] = {-1, 0, 0, 1}; int dy[] = {0, -1, 1, 0}; int main(void) { string s; cin >> s; ll dp[15] = {0}; dp[0] = 1; ll mul = 1; int len = s.length(); rep(i, len) { ll nextDP[15] = {0}; char ch = s[len - i - 1]; if (ch == '?') { rep(k, 10) { rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } } else { int k = ch - '0'; rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } mul *= 10; copy(nextDP, nextDP + 13, dp); } cout << dp[5] << endl; return 0; }
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> //#include <tuple> #define INF INT_MAX >> 1 #define SIZE 100010 #define MOD 1000000007 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (a); i < (int)(b); i++) typedef long long ll; using namespace std; int dx[] = {-1, 0, 0, 1}; int dy[] = {0, -1, 1, 0}; int main(void) { string s; cin >> s; ll dp[15] = {0}; dp[0] = 1; ll mul = 1; int len = s.length(); rep(i, len) { ll nextDP[15] = {0}; char ch = s[len - i - 1]; if (ch == '?') { rep(k, 10) { rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } } else { int k = ch - '0'; rep(j, 13) { nextDP[(k * mul + j) % 13] += dp[j]; nextDP[(k * mul + j) % 13] %= MOD; } } mul *= 10; mul %= 13; copy(nextDP, nextDP + 13, dp); } cout << dp[5] << endl; return 0; }
[ "assignment.add" ]
769,517
769,516
u117734686
cpp
p02960
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; typedef long long ll; int main() { string s; cin >> s; reverse(s.begin(), s.end()); vector<vector<ll>> dp( 100001, vector<ll>( 13, 0)); //先頭i文字で考えられる、13で割った時の余りがjであるようなものの個数 vector<vector<ll>> Num(7, vector<ll>(10, 0)); for (int i = 0; i < 6; i++) { for (int j = 0; j <= 9; j++) { Num[i][j] = j * static_cast<ll>(pow(10, i)) % 13; } } // cout << endl; // for (int i = 0; i < 6; i++) { // for (int j = 0; j <= 9; j++) { // cout << setw(2) << Num[i][j] << " "; // } // cout << endl; // } // cout << endl; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } } else { dp[0][s[0] - '0'] = 1; } for (int i = 0; i < s.size() - 1; i++) { if (s[i + 1] == '?') { for (int j = 0; j < 13; j++) { for (int k = 0; k < 10; k++) { dp[i + 1][(j + Num[(i + 1) % 6][k]) % 13] = (dp[i + 1][(j + Num[(i + 1) % 6][k]) % 13] + dp[i][j]) % MOD; } } } else { for (int j = 0; j < 13; j++) { dp[i + 1][(j + Num[(i + 1) % 6][s[0] - '0']) % 13] = (dp[i + 1][(j + Num[(i + 1) % 6][s[0] - '0']) % 13] + dp[i][j]) % MOD; } } } // for (int i = 0; i < s.size(); i++) { // for (int j = 0; j < 13; j++) { // cout << setw(3) << dp[i][j] << " "; // } // cout << endl; // } cout << dp[s.size() - 1][5] % MOD << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; typedef long long ll; int main() { string s; cin >> s; reverse(s.begin(), s.end()); vector<vector<ll>> dp( 100001, vector<ll>( 13, 0)); //先頭i文字で考えられる、13で割った時の余りがjであるようなものの個数 vector<vector<ll>> Num(7, vector<ll>(10, 0)); for (int i = 0; i < 6; i++) { for (int j = 0; j <= 9; j++) { Num[i][j] = j * static_cast<ll>(pow(10, i)) % 13; } } // cout << endl; // for (int i = 0; i < 6; i++) { // for (int j = 0; j <= 9; j++) { // cout << setw(2) << Num[i][j] << " "; // } // cout << endl; // } // cout << endl; if (s[0] == '?') { for (int i = 0; i < 10; i++) { dp[0][i] = 1; } } else { dp[0][s[0] - '0'] = 1; } for (int i = 0; i < s.size() - 1; i++) { if (s[i + 1] == '?') { for (int j = 0; j < 13; j++) { for (int k = 0; k < 10; k++) { dp[i + 1][(j + Num[(i + 1) % 6][k]) % 13] = (dp[i + 1][(j + Num[(i + 1) % 6][k]) % 13] + dp[i][j]) % MOD; } } } else { for (int j = 0; j < 13; j++) { dp[i + 1][(j + Num[(i + 1) % 6][s[i + 1] - '0']) % 13] = (dp[i + 1][(j + Num[(i + 1) % 6][s[i + 1] - '0']) % 13] + dp[i][j]) % MOD; } } } // for (int i = 0; i < s.size(); i++) { // for (int j = 0; j < 13; j++) { // cout << setw(3) << dp[i][j] << " "; // } // cout << endl; // } cout << dp[s.size() - 1][5] % MOD << endl; return 0; }
[ "assignment.variable.change", "identifier.replace.add", "literal.replace.remove", "variable_access.subscript.index.change", "expression.operation.binary.change", "assignment.change", "assignment.value.change" ]
769,522
769,523
u050138914
cpp
p02960
#include <bits/stdc++.h> #include <numeric> #include <vector> #define PI 3.14159265358979323846 #define MAXINF (1e18L) #define INF (1e9L) #define EPS (1e-9) #define MOD ((ll)(1e9 + 7)) #define REP(i, n) for (int i = 0; i < int(n); ++i) #define Rep(i, sta, n) for (int i = sta; i < n; i++) #define RREP(i, n) for (int i = int(n) - 1; i >= 0; --i) #define ALL(v) v.begin(), v.end() #define FIND(v, x) (binary_search(ALL(v), (x))) #define SORT(v) sort(ALL(v)) #define RSORT(v) \ sort(ALL(v)); \ reverse(ALL(v)) #define DEBUG(x) cerr << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cerr << #v << ":"; \ for (int i = 0; i < v.size(); i++) \ cerr << " " << v[i]; \ cerr << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define pb push_back #define fi first #define se second using namespace std; template <class A> void pr(A a) { cout << (a) << endl; } template <class A, class B> void pr(A a, B b) { cout << a << " "; pr(b); } template <class A, class B, class C> void pr(A a, B b, C c) { cout << a << " "; pr(b, c); } template <class A, class B, class C, class D> void pr(A a, B b, C c, D d) { cout << a << " "; pr(b, c, d); } template <class T> inline bool chmin(T &a, T b) { return a > b ? a = b, true : false; } template <class T> inline bool chmax(T &a, T b) { return a < b ? a = b, true : false; } typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int main(void) { string S; cin >> S; int N = S.size(); vector<vector<ll>> dp(N + 1, vector<ll>(13, 0)); dp[N][0] = 1; int mul = 1; RREP(i, N) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(k, 13) { (dp[i][(j * mul + k) % 13] += dp[i + 1][k]) %= MOD; } } mul *= 10; mul %= MOD; } pr(dp[0][5]); }
#include <bits/stdc++.h> #include <numeric> #include <vector> #define PI 3.14159265358979323846 #define MAXINF (1e18L) #define INF (1e9L) #define EPS (1e-9) #define MOD ((ll)(1e9 + 7)) #define REP(i, n) for (int i = 0; i < int(n); ++i) #define Rep(i, sta, n) for (int i = sta; i < n; i++) #define RREP(i, n) for (int i = int(n) - 1; i >= 0; --i) #define ALL(v) v.begin(), v.end() #define FIND(v, x) (binary_search(ALL(v), (x))) #define SORT(v) sort(ALL(v)) #define RSORT(v) \ sort(ALL(v)); \ reverse(ALL(v)) #define DEBUG(x) cerr << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cerr << #v << ":"; \ for (int i = 0; i < v.size(); i++) \ cerr << " " << v[i]; \ cerr << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define pb push_back #define fi first #define se second using namespace std; template <class A> void pr(A a) { cout << (a) << endl; } template <class A, class B> void pr(A a, B b) { cout << a << " "; pr(b); } template <class A, class B, class C> void pr(A a, B b, C c) { cout << a << " "; pr(b, c); } template <class A, class B, class C, class D> void pr(A a, B b, C c, D d) { cout << a << " "; pr(b, c, d); } template <class T> inline bool chmin(T &a, T b) { return a > b ? a = b, true : false; } template <class T> inline bool chmax(T &a, T b) { return a < b ? a = b, true : false; } typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int main(void) { string S; cin >> S; int N = S.size(); vector<vector<ll>> dp(N + 1, vector<ll>(13, 0)); dp[N][0] = 1; int mul = 1; RREP(i, N) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(k, 13) { (dp[i][(j * mul + k) % 13] += dp[i + 1][k]) %= MOD; } } mul *= 10; mul %= 13; } pr(dp[0][5]); }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,526
769,527
u528720841
cpp
p02960
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <fstream> #include <initializer_list> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> //#include <complex> using namespace std; using ll = long long; using ull = unsigned long long; // const ll INF = 1e9; const ll MOD = 1000000000 + 7; // const double EPS = 1e-9; // const double PI = acos(-1); ll ten[100100]; void solve() { string s; cin >> s; int n = s.length(); vector<ll> a(n); for (int i = 0; i < n; ++i) { if (s[i] == '?') a[i] = -1; else a[i] = s[i] - '0'; } ten[0] = 1; for (int i = 1; i < 100100; ++i) ten[i] = ten[i - 1] * 10 % MOD; vector<vector<ll>> dp(n + 1, vector<ll>(13, 0)); dp[n][0] = 1; for (ll i = n - 1; i >= 0; --i) { if (a[i] == -1) { for (ll k = 0; k < 13; ++k) for (ll d = 0; d <= 9; ++d) dp[i][(ten[n - 1 - i] * d + k) % 13] = (dp[i][(ten[n - 1 - i] * d + k) % 13] + dp[i + 1][k]) % MOD; } else { for (ll k = 0; k < 13; ++k) dp[i][(ten[n - 1 - i] * a[i] + k) % 13] = (dp[i][(ten[n - 1 - i] * a[i] + k) % 13] + dp[i + 1][k]) % MOD; } } cout << dp[0][5] % MOD; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); solve(); }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <fstream> #include <initializer_list> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> //#include <complex> using namespace std; using ll = long long; using ull = unsigned long long; // const ll INF = 1e9; const ll MOD = 1e9 + 7; // const double EPS = 1e-9; // const double PI = acos(-1); ll ten[100100]; void solve() { string s; cin >> s; int n = s.length(); vector<ll> a(n); for (int i = 0; i < n; ++i) { if (s[i] == '?') a[i] = -1; else a[i] = s[i] - '0'; } ten[0] = 1; for (int i = 1; i < 100100; ++i) ten[i] = ten[i - 1] * 10 % 13; vector<vector<ll>> dp(n + 1, vector<ll>(13, 0)); dp[n][0] = 1; for (ll i = n - 1; i >= 0; --i) { if (a[i] == -1) { for (ll k = 0; k < 13; ++k) for (ll d = 0; d <= 9; ++d) dp[i][(ten[n - 1 - i] * d + k) % 13] = (dp[i][(ten[n - 1 - i] * d + k) % 13] + dp[i + 1][k]) % MOD; } else { for (ll k = 0; k < 13; ++k) dp[i][(ten[n - 1 - i] * a[i] + k) % 13] = (dp[i][(ten[n - 1 - i] * a[i] + k) % 13] + dp[i + 1][k]) % MOD; } } cout << dp[0][5] % MOD; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); solve(); }
[ "literal.number.change", "expression.operation.binary.change", "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,535
769,536
u212345309
cpp
p02960
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define FOR(i, s, n) for (int i = s; i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(n) (n).begin(), (n).end() #define RALL(n) (n).rbegin(), (n).rend() using ll = long long; using ull = unsigned long long; constexpr int MOD = 1000000007; int mod(ll x) { return x > 0 ? x % MOD : (x + MOD) % MOD; } int modm(ll x, ll m) { return x * m % MOD; } int modpow(ll x, ll p) { int ret = 1; while (p > 0) { if (p & 1) ret = modm(ret, x); x = modm(x, x); p >>= 1; } return ret; } // x * modinv(d) int modd(ll x, ll d) { return modm(x, modpow(d, MOD - 2)); } int main(void) { IOS constexpr int N = 1e4; constexpr int M = 13; string s; cin >> s; int l = s.size(); vector<vector<int>> dp(l, vector<int>(M, 0)); dp[0][0] = 1; REP(i, l) { REP(j, M) { REP(k, 10) { if (s[i] - '0' == k || s[i] == '?') { dp[i + 1][(j * 10 + k) % M] = mod(0LL + dp[i + 1][(j * 10 + k) % M] + dp[i][j]); } } } } cout << dp[l][5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define FOR(i, s, n) for (int i = s; i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(n) (n).begin(), (n).end() #define RALL(n) (n).rbegin(), (n).rend() using ll = long long; using ull = unsigned long long; constexpr int MOD = 1000000007; int mod(ll x) { return x > 0 ? x % MOD : (x + MOD) % MOD; } int modm(ll x, ll m) { return x * m % MOD; } int modpow(ll x, ll p) { int ret = 1; while (p > 0) { if (p & 1) ret = modm(ret, x); x = modm(x, x); p >>= 1; } return ret; } // x * modinv(d) int modd(ll x, ll d) { return modm(x, modpow(d, MOD - 2)); } int main(void) { IOS constexpr int N = 1e4; constexpr int M = 13; string s; cin >> s; int l = s.size(); vector<vector<int>> dp(l + 1, vector<int>(M, 0)); dp[0][0] = 1; REP(i, l) { REP(j, M) { REP(k, 10) { if (s[i] - '0' == k || s[i] == '?') { dp[i + 1][(j * 10 + k) % M] = mod(0LL + dp[i + 1][(j * 10 + k) % M] + dp[i][j]); } } } } cout << dp[l][5] << endl; return 0; }
[ "assignment.change" ]
769,543
769,544
u330661451
cpp
p02960
#ifndef BZ #pragma GCC optimize "-O3" #endif #include <bits/stdc++.h> #define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); #define rep(i, l, r) for (ll i = (l); i < (r); ++i) typedef long long ll; typedef long double ld; typedef unsigned long long ull; #define pii pair<int, int> #define pll pair<ll, ll> #define pli pair<ll, int> #define pdd pair<ld, ld> #define pb push_back #define reset(x, v) memset(x, v, sizeof(x)) #define mod 1000000007 using namespace std; ll solve(string &s, int st, int en, int modulo, ll mult, ll dp[][13]) { if (st > en) { if (modulo == 5) return 1; else return 0; } if (dp[en][modulo] != -1) return dp[en][modulo]; ll so = 0; if (s[en] != '?') { so += solve(s, st, en - 1, (modulo + (s[en] - 48) * mult) % 13, (mult * 10) % mod, dp); so %= mod; } else { for (int i = 0; i < 10; i++) { so += solve(s, st, en - 1, (modulo + i * mult) % 13, (mult * 10) % mod, dp); so %= mod; } } return dp[en][modulo] = so; } int main() { FASTIO string s; cin >> s; int n = s.size(); ll dp[n][13]; reset(dp, -1); cout << solve(s, 0, n - 1, 0, 1, dp); return 0; }
#ifndef BZ #pragma GCC optimize "-O3" #endif #include <bits/stdc++.h> #define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); #define rep(i, l, r) for (ll i = (l); i < (r); ++i) typedef long long ll; typedef long double ld; typedef unsigned long long ull; #define pii pair<int, int> #define pll pair<ll, ll> #define pli pair<ll, int> #define pdd pair<ld, ld> #define pb push_back #define reset(x, v) memset(x, v, sizeof(x)) #define mod 1000000007 using namespace std; ll solve(string &s, int st, int en, int modulo, ll mult, ll dp[][13]) { if (st > en) { if (modulo == 5) return 1; else return 0; } if (dp[en][modulo] != -1) return dp[en][modulo]; ll so = 0; if (s[en] != '?') { so += solve(s, st, en - 1, (modulo + (s[en] - 48) * mult) % 13, (mult * 10) % 13, dp); so %= mod; } else { for (int i = 0; i < 10; i++) { so += solve(s, st, en - 1, (modulo + i * mult) % 13, (mult * 10) % 13, dp); so %= mod; } } return dp[en][modulo] = so; } int main() { FASTIO string s; cin >> s; int n = s.size(); ll dp[n][13]; reset(dp, -1); cout << solve(s, 0, n - 1, 0, 1, dp); return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "expression.operation.binary.change" ]
769,545
769,546
u100869561
cpp
p02960
#include <cstdint> #include <cstdio> #include <cstring> static const unsigned long long MOD = 1000000007LL; int n; char s[100005]; uint64_t dp[100005][13]; int main() { int i, j, ki; uint64_t res = 0; scanf("%s", s); n = strlen(s); dp[0][0] = 1; for (i = 0; i < n; i++) { int c; if (s[i] == '?') c = -1; else c = s[i] = '0'; for (j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (ki = 0; ki < 13; ki++) { dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } for (j = 0; j < 13; j++) dp[i + 1][j] %= MOD; } res = dp[n][5]; printf("%lu\n", res); return 0; }
#include <cstdint> #include <cstdio> #include <cstring> static const unsigned long long MOD = 1000000007LL; int n; char s[100005]; uint64_t dp[100005][13]; int main() { int i, j, ki; uint64_t res = 0; scanf("%s", s); n = strlen(s); dp[0][0] = 1; for (i = 0; i < n; i++) { int c; if (s[i] == '?') c = -1; else c = s[i] - '0'; for (j = 0; j < 10; j++) { if (c != -1 && c != j) continue; for (ki = 0; ki < 13; ki++) { dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]; } } for (j = 0; j < 13; j++) dp[i + 1][j] %= MOD; } res = dp[n][5]; printf("%llu\n", res); return 0; }
[ "assignment.value.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
769,551
769,552
u675757825
cpp
p02960
#include <bits/stdc++.h> using namespace std; #define mod (1000000007) main() { int n; string s; cin >> s; n = s.size(); vector<vector<int>> dp(n, vector<int>(13, 0)); if (s[0] == '?') for (int i = 0; i < 10; ++i) dp[0][i] = 1; else dp[0][s[0] - '0'] = 1; for (int i = 1; i < n; ++i) { if (s[i] == '?') for (int j = 0; j < 10; ++j) for (int k = 0; k < 13; ++k) dp[i][(k * 10 + j) % 13] += dp[i - 1][k]; else for (int k = 0; k < 13; ++k) dp[i][(k * 10 + s[i] - '0') % 13] += dp[i - 1][k]; for (int j = 0; j < 13; ++j) dp[i][j] %= mod; } cout << dp[n - 1][5] << endl; }
#include <bits/stdc++.h> using namespace std; #define mod (1000000007) #define int long main() { int n; string s; cin >> s; n = s.size(); vector<vector<int>> dp(n, vector<int>(13, 0)); if (s[0] == '?') for (int i = 0; i < 10; ++i) dp[0][i] = 1; else dp[0][s[0] - '0'] = 1; for (int i = 1; i < n; ++i) { if (s[i] == '?') for (int j = 0; j < 10; ++j) for (int k = 0; k < 13; ++k) dp[i][(k * 10 + j) % 13] += dp[i - 1][k]; else for (int k = 0; k < 13; ++k) dp[i][(k * 10 + s[i] - '0') % 13] += dp[i - 1][k]; for (int j = 0; j < 13; ++j) dp[i][j] %= mod; } cout << dp[n - 1][5] << endl; }
[]
769,569
769,570
u756659922
cpp
p02960
#include <stdio.h> #define mod 1000000007 #define large 100050 int main() { char s[large]; scanf("%s", &s); int dp[large][13] = {}; int length = 0; for (int i = 0;; i++) { if (s[i] == '\0') { length = i; break; } } for (int i = 0; i < length; i++) { if (i == 0) { if (s[i] == '?') { for (int j = 0; j < 9; j++) dp[i][j]++; } else { dp[i][s[i] - '0']++; } } else { for (int j = 0; j < 13; j++) { if (dp[i - 1][j] > 0) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + (k)) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (k)) % 13] %= mod; } } else { dp[i][(j * 10 + (s[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (s[i] - '0')) % 13] %= mod; } } } } } printf("%d\n", dp[length - 1][5]); }
#include <stdio.h> #define mod 1000000007 #define large 100050 int main() { char s[large]; scanf("%s", &s); int dp[large][13] = {}; int length = 0; for (int i = 0;; i++) { if (s[i] == '\0') { length = i; break; } } for (int i = 0; i < length; i++) { if (i == 0) { if (s[i] == '?') { for (int j = 0; j < 10; j++) dp[i][j]++; } else { dp[i][s[i] - '0']++; } } else { for (int j = 0; j < 13; j++) { if (dp[i - 1][j] > 0) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + (k)) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (k)) % 13] %= mod; } } else { dp[i][(j * 10 + (s[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (s[i] - '0')) % 13] %= mod; } } } } } printf("%d\n", dp[length - 1][5]); }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
769,571
769,572
u691912637
cpp
p02960
#include <stdio.h> #define mod 1000000007 #define large 50 // 100050 int main() { char s[large]; scanf("%s", &s); int dp[large][13] = {}; int length = 0; for (int i = 0;; i++) { if (s[i] == '\0') { length = i; break; } } for (int i = 0; i < length; i++) { if (i == 0) { if (s[i] == '?') { for (int j = 0; j < 9; j++) dp[i][j]++; } else { dp[i][s[i] - '0']++; } } else { for (int j = 0; j < 13; j++) { if (dp[i - 1][j] > 0) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + (k)) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (k)) % 13] %= mod; } } else { dp[i][(j * 10 + (s[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (s[i] - '0')) % 13] %= mod; } } } } } printf("%d\n", dp[length - 1][5]); }
#include <stdio.h> #define mod 1000000007 #define large 100050 int main() { char s[large]; scanf("%s", &s); int dp[large][13] = {}; int length = 0; for (int i = 0;; i++) { if (s[i] == '\0') { length = i; break; } } for (int i = 0; i < length; i++) { if (i == 0) { if (s[i] == '?') { for (int j = 0; j < 10; j++) dp[i][j]++; } else { dp[i][s[i] - '0']++; } } else { for (int j = 0; j < 13; j++) { if (dp[i - 1][j] > 0) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + (k)) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (k)) % 13] %= mod; } } else { dp[i][(j * 10 + (s[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (s[i] - '0')) % 13] %= mod; } } } } } printf("%d\n", dp[length - 1][5]); }
[ "preprocessor.define.value.change", "literal.integer.change", "literal.number.change", "control_flow.branch.if.condition.change" ]
769,573
769,572
u691912637
cpp
p02960
#include <stdio.h> #define mod 1000000007 #define large 100050 int main() { char s[large]; scanf("%s", &s); int dp[large][13] = {}; int length = 0; for (int i = 0;; i++) { if (s[i] == '\0') { length = i; break; } } for (int i = 0; i < length; i++) { if (i == 0) { if (s[i] == '?') { for (int j = 0; j < 9; j++) dp[i][j]++; } else { dp[i][s[i] - '0']++; } } else { for (int j = 0; j < 13; j++) { if (dp[i - 1][j] > 0) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + (k)) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (k)) % 13] %= mod; } } else { dp[i][(j * 10 + (s[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (s[i] - '0')) % 13] %= mod; } } } } } printf("%d\n", dp[length - 1][0]); }
#include <stdio.h> #define mod 1000000007 #define large 100050 int main() { char s[large]; scanf("%s", &s); int dp[large][13] = {}; int length = 0; for (int i = 0;; i++) { if (s[i] == '\0') { length = i; break; } } for (int i = 0; i < length; i++) { if (i == 0) { if (s[i] == '?') { for (int j = 0; j < 10; j++) dp[i][j]++; } else { dp[i][s[i] - '0']++; } } else { for (int j = 0; j < 13; j++) { if (dp[i - 1][j] > 0) { if (s[i] == '?') { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + (k)) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (k)) % 13] %= mod; } } else { dp[i][(j * 10 + (s[i] - '0')) % 13] += dp[i - 1][j]; dp[i][(j * 10 + (s[i] - '0')) % 13] %= mod; } } } } } printf("%d\n", dp[length - 1][5]); }
[ "literal.number.change", "control_flow.branch.if.condition.change", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
769,574
769,572
u691912637
cpp
p02960
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; int main() { string S; cin >> S; int N = (int)S.size(); vector<vector<int>> dp(N, vector<int>(13, 0)); if (N == 1) { if (S[0] == '5' || S[0] == '?') { cout << 1 << endl; } else { cout << 0 << endl; } return 0; } //以下Nが2以上の時 //初期値設定 if (S[0] != '?') { dp[0][S[0] - '0']++; } else { for (int i = 0; i < 13; i++) { dp[0][i]++; } } for (int i = 0; i < N - 1; i++) { if (S[i + 1] != '?') { for (int j = 0; j < 13; j++) { dp[i + 1][(10 * j + (S[i + 1] - '0')) % 13] += dp[i][j]; dp[i + 1][(10 * j + (S[i + 1] - '0')) % 13] %= MOD; } } else { for (int j = 0; j < 13; j++) { for (int k = 0; k < 13; k++) { // Sは k = 0,,, 12まで取りうるため dp[i + 1][(10 * j + k) % 13] += dp[i][j]; dp[i + 1][(10 * j + k) % 13] %= MOD; } } } } cout << dp[N - 1][5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; int main() { string S; cin >> S; int N = (int)S.size(); vector<vector<int>> dp(N, vector<int>(13, 0)); if (N == 1) { if (S[0] == '5' || S[0] == '?') { cout << 1 << endl; } else { cout << 0 << endl; } return 0; } //以下Nが2以上の時 // i == 0の時の初期値設定 if (S[0] != '?') { dp[0][S[0] - '0']++; } else { for (int i = 0; i < 10; i++) { dp[0][i]++; } } // dp[0][11]などはそもそもありえない // 0から1、1から2、、、、N-2からN-1への遷移を追いかける for (int i = 0; i < N - 1; i++) { if (S[i + 1] != '?') { for (int j = 0; j < 13; j++) { dp[i + 1][(10 * j + (S[i + 1] - '0')) % 13] += dp[i][j]; dp[i + 1][(10 * j + (S[i + 1] - '0')) % 13] %= MOD; } } else { for (int j = 0; j < 13; j++) { for (int k = 0; k < 10; k++) { // Sは k = 0,,, 9まで取りうるため dp[i + 1][(10 * j + k) % 13] += dp[i][j]; dp[i + 1][(10 * j + k) % 13] %= MOD; } } } } cout << dp[N - 1][5] << endl; return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
769,579
769,580
u904123392
cpp
p02960
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; ll dp[100100][13]; // dp[i][j] int main() { string S; cin >> S; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (ll i = 0; i < (ll)S.size(); i++) { char c = S[i]; if (c == '?') { for (int j = 0; j < 10; j++) { for (int ki = 0; ki < 13; ki++) { dp[i + 1][(10 * ki + j) % 13] += dp[i][ki]; } } } else { int d = c - '0'; for (int ki = 0; ki < 13; ki++) { dp[i + 1][(10 * ki) + d] += dp[i][ki]; } } for (int ki = 0; ki < 13; ki++) { dp[i + 1][ki] %= MOD; } } cout << dp[(ll)S.size()][5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; ll dp[100100][13]; // dp[i][j] int main() { string S; cin >> S; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (ll i = 0; i < (ll)S.size(); i++) { char c = S[i]; if (c == '?') { for (int j = 0; j < 10; j++) { for (int ki = 0; ki < 13; ki++) { dp[i + 1][(10 * ki + j) % 13] += dp[i][ki]; } } } else { int d = c - '0'; for (int ki = 0; ki < 13; ki++) { dp[i + 1][(10 * ki + d) % 13] += dp[i][ki]; } } for (int ki = 0; ki < 13; ki++) { dp[i + 1][ki] %= MOD; } } cout << dp[(ll)S.size()][5] << endl; return 0; }
[ "assignment.change" ]
769,581
769,582
u904123392
cpp
p02960
#include <algorithm> //sort() #include <cmath> #include <iostream> #include <numeric> #include <stdlib.h> #include <tuple> #include <vector> //vector #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define debug(a) \ if (flagdebug) { \ cout << "debug (" #a "):" << endl << (a) << endl; \ } typedef uint64_t ulint; typedef int64_t lint; // int64の最大値 // -9223372036854775808 ~ 9223372036854775807 using namespace std; template <class T> inline bool chmin(T &a, T b); template <class T> inline bool chmax(T &a, T b); template <typename T> ostream &operator<<(ostream &s, const vector<T> &v); template <class T> lint sum(vector<T> a); template <class T> double ave(vector<T> a); // struct pos // { // lint x; // lint y; // lint dist; // public: // pos(lint ax, lint ay, lint ad) // { // x = ax; // y = ay; // dist = ad; // } // }; lint n, k; lint h, w; bool flagdebug = false; int main() { ////////////////////////////////////////////////////// flagdebug = true; ///本番時削除!!!!! string s; cin >> s; lint digit = s.length(); vector<vector<lint>> dp(digit + 1, vector<lint>(13, 0)); debug(digit); // debug(s[0]); // debug("aaa"); lint deci = 1; // dpを下から解く rep(i, digit + 1) { if (i == 0) { dp[0][0] = 1; continue; } if (s[digit - i] == '?') { rep(j, 10) { rep(k, 13) { dp[i][(j * deci + k) % 13] += dp[i - 1][k]; if (dp[i][(j * deci + k) % 13] > 1000000007) dp[i][(j * deci + k) % 13] %= 1000000007; } } } else { int c = s[digit - i] - '0'; rep(k, 13) { dp[i][(c * deci + k) % 13] += dp[i - 1][k]; } } deci *= 10; deci %= 13; } debug(deci); debug(dp); cout << dp[digit][5] << endl; // 2次元配列 // vector<vector<lint>> mat(row, vector<lint>(column, 初期値)); //ペア // fpair<lint,lint> p = make_pair(1,2); //タプル // tuple<lint,lint,lint> t = make_tuple(1,2,3); //昇順ソート // sort(all(a)); ////////////////////////////////////////////////////// //キュー // queue<lint> que; // que.push(value); // que.front(); //先頭を参照 // que.pop; //追い出す ////////////////////////////////////////////////////// //スタック // stack<lint> stk; // stk.push(value); // stk.top(); //先頭を参照 // stk.pop(); //トップを削除 // stk.empty(); //空なら1,あれば0 // stk.size(); //数 // // sort(input.begin() , input.end()); // uint64_t max = numeric_limits<uint64_t>::max(); ////////////////////////////////////////////////////// // DP // // 無限大の値 // const uint64_t INF = (uint64_t)1 << 60; // //const int64_t NINF = -1 * ((int64_t)1 << 60 ); // // DP テーブル // uint64_t dp[100010]; // //DPテーブル初期化(最小化用) // for (int i = 0; i < 100010; ++i) // { // //dp[i] = INF; // dp[i] = 0; // } // // 初期条件 // dp[0] = 0; // // ループ // for (int i = 1; i <= n; ++i) { // //chmin( dp[i], dp[i - 1] + abs( input[i] - input[i - 1] )); // //if (i < 2)continue; // //chmin( dp[i], dp[i - 2] + abs( input[i] - input[i - 2] )); // // chmax ( dp [i] , dp[i - 1]); // // chmax ( dp [i] , dp[i - 1] + input[i]); // // cout << "dp[" << i <<"] = " << dp[i] << endl; // } // ////////////////////////////////////////////////////// // cout << dp[n] << endl; ////////////////////////////////////////////////////// // Ctrl + Opt + N to make return 0; } //最小化用関数 template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } //最大化関数 template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } // vectorprint用 template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) { int len = v.size(); for (int i = 0; i < len; ++i) { s << v[i]; if (i < len - 1) s << "\t"; } return s; } // //合計 // template<class T> lint sum(vector<T> a) // { // return std::accumulate(a.begin(), a.end(), 0); // } // //平均 // template<class T> double ave(vector<T> a) // { // return std::accumulate(a.begin(), a.end(), 0.0) / a.size(); // }
#include <algorithm> //sort() #include <cmath> #include <iostream> #include <numeric> #include <stdlib.h> #include <tuple> #include <vector> //vector #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define debug(a) \ if (flagdebug) { \ cout << "debug (" #a "):" << endl << (a) << endl; \ } typedef uint64_t ulint; typedef int64_t lint; // int64の最大値 // -9223372036854775808 ~ 9223372036854775807 using namespace std; template <class T> inline bool chmin(T &a, T b); template <class T> inline bool chmax(T &a, T b); template <typename T> ostream &operator<<(ostream &s, const vector<T> &v); template <class T> lint sum(vector<T> a); template <class T> double ave(vector<T> a); // struct pos // { // lint x; // lint y; // lint dist; // public: // pos(lint ax, lint ay, lint ad) // { // x = ax; // y = ay; // dist = ad; // } // }; lint n, k; lint h, w; bool flagdebug = false; int main() { ////////////////////////////////////////////////////// // flagdebug = true; ///本番時削除!!!!! string s; cin >> s; lint digit = s.length(); vector<vector<lint>> dp(digit + 1, vector<lint>(13, 0)); debug(digit); // debug(s[0]); // debug("aaa"); lint deci = 1; // dpを下から解く rep(i, digit + 1) { if (i == 0) { dp[0][0] = 1; continue; } if (s[digit - i] == '?') { rep(j, 10) { rep(k, 13) { dp[i][(j * deci + k) % 13] += dp[i - 1][k]; if (dp[i][(j * deci + k) % 13] > 1000000007) dp[i][(j * deci + k) % 13] %= 1000000007; } } } else { int c = s[digit - i] - '0'; rep(k, 13) { dp[i][(c * deci + k) % 13] += dp[i - 1][k]; } } deci *= 10; deci %= 13; } debug(deci); debug(dp); cout << dp[digit][5] << endl; // 2次元配列 // vector<vector<lint>> mat(row, vector<lint>(column, 初期値)); //ペア // fpair<lint,lint> p = make_pair(1,2); //タプル // tuple<lint,lint,lint> t = make_tuple(1,2,3); //昇順ソート // sort(all(a)); ////////////////////////////////////////////////////// //キュー // queue<lint> que; // que.push(value); // que.front(); //先頭を参照 // que.pop; //追い出す ////////////////////////////////////////////////////// //スタック // stack<lint> stk; // stk.push(value); // stk.top(); //先頭を参照 // stk.pop(); //トップを削除 // stk.empty(); //空なら1,あれば0 // stk.size(); //数 // // sort(input.begin() , input.end()); // uint64_t max = numeric_limits<uint64_t>::max(); ////////////////////////////////////////////////////// // DP // // 無限大の値 // const uint64_t INF = (uint64_t)1 << 60; // //const int64_t NINF = -1 * ((int64_t)1 << 60 ); // // DP テーブル // uint64_t dp[100010]; // //DPテーブル初期化(最小化用) // for (int i = 0; i < 100010; ++i) // { // //dp[i] = INF; // dp[i] = 0; // } // // 初期条件 // dp[0] = 0; // // ループ // for (int i = 1; i <= n; ++i) { // //chmin( dp[i], dp[i - 1] + abs( input[i] - input[i - 1] )); // //if (i < 2)continue; // //chmin( dp[i], dp[i - 2] + abs( input[i] - input[i - 2] )); // // chmax ( dp [i] , dp[i - 1]); // // chmax ( dp [i] , dp[i - 1] + input[i]); // // cout << "dp[" << i <<"] = " << dp[i] << endl; // } // ////////////////////////////////////////////////////// // cout << dp[n] << endl; ////////////////////////////////////////////////////// // Ctrl + Opt + N to make return 0; } //最小化用関数 template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } //最大化関数 template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } // vectorprint用 template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) { int len = v.size(); for (int i = 0; i < len; ++i) { s << v[i]; if (i < len - 1) s << "\t"; } return s; } // //合計 // template<class T> lint sum(vector<T> a) // { // return std::accumulate(a.begin(), a.end(), 0); // } // //平均 // template<class T> double ave(vector<T> a) // { // return std::accumulate(a.begin(), a.end(), 0.0) / a.size(); // }
[]
769,589
769,590
u561976793
cpp
p02960
#include "bits/stdc++.h" #define REP(i, n) for (ll i = 0; i < ll(n); ++i) #define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < ll(n); ++i) #define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i) #define ALL(v) (v).begin(), (v).end() #define UNIQUE(v) v.erase(unique(ALL(v)), v.end()); #define INF 1000000001ll #define MOD 1000000007ll #define EPS 1e-9 constexpr int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1}; constexpr int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; using namespace std; using ll = long long; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } #include "bits/stdc++.h" template <int mod, bool isPrime = false> class Mint { using ll = long long; ll value; public: constexpr Mint() : value(0){}; constexpr Mint(ll x) : value(x) { value %= mod; if (value < 0) value += mod; } constexpr Mint(const Mint &other) : value(other.value) {} ll &get() { return value; } ll get() const { return value; } constexpr Mint pow(ll n) { Mint ret(1), tmp(value); while (n) { if (n & 1) ret *= tmp; n >>= 1; tmp *= tmp; } return ret; } constexpr bool operator==(const Mint &a) const { return value == a.value; } constexpr bool operator!=(const Mint &a) const { return value != a.value; } constexpr Mint &operator=(const Mint &a) { value = a.value; return *this; } constexpr Mint &operator+=(const Mint &a) { if ((value += a.value) >= mod) value -= mod; return *this; } constexpr Mint &operator-=(const Mint &a) { if ((value += mod - a.value) >= mod) value -= mod; return *this; } constexpr Mint &operator*=(const Mint &a) { value = value * a.value % mod; return *this; } constexpr Mint &operator/=(const Mint &a) { return *this *= inv(a); } constexpr Mint operator+(const Mint &a) const { return Mint(*this) += a; } constexpr Mint operator-(const Mint &a) const { return Mint(*this) -= a; } constexpr Mint operator*(const Mint &a) const { return Mint(*this) *= a; } constexpr Mint operator/(const Mint &a) const { return Mint(*this) /= a; } }; template <int mod, bool isPrime> std::ostream &operator<<(std::ostream &os, const Mint<mod, isPrime> &m) { os << m.get(); return os; } template <int mod, bool isPrime> std::istream &operator>>(std::istream &is, Mint<mod, isPrime> &m) { is >> m.get(); return is; } template <int mod> constexpr Mint<mod, true> inv(const Mint<mod, true> &m) { long long a = m.get(), b = mod, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } return Mint<mod, true>(u); } template <int mod, bool isPrime> constexpr Mint<mod, isPrime> operator+(long long lhs, const Mint<mod, isPrime> &a) { return Mint<mod, isPrime>(lhs + a.get()); } template <int mod, bool isPrime> constexpr Mint<mod, isPrime> operator-(long long lhs, const Mint<mod, isPrime> &a) { return Mint<mod, isPrime>(lhs - a.get()); } template <int mod, bool isPrime> constexpr Mint<mod, isPrime> operator*(long long lhs, const Mint<mod, isPrime> &a) { return Mint<mod, isPrime>(lhs % mod * a.get()); } constexpr int default_mod = 1000000007; using mint = Mint<default_mod, true>; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n = s.size(); vector<vector<mint>> dp(n + 1, vector<mint>(13, 0)); dp[0][0] = 1; REP(i, n) { if (s[i] == '?') { REP(j, 13) { REP(k, 10) { dp[i + 1][(j * 10 + k) % 13] += dp[i][j]; } } } else { int k = s[i] = '0'; REP(j, 13) { dp[i + 1][(j * 10 + k) % 13] += dp[i][j]; } } } cout << dp[n][5] << endl; }
#include "bits/stdc++.h" #define REP(i, n) for (ll i = 0; i < ll(n); ++i) #define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < ll(n); ++i) #define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i) #define ALL(v) (v).begin(), (v).end() #define UNIQUE(v) v.erase(unique(ALL(v)), v.end()); #define INF 1000000001ll #define MOD 1000000007ll #define EPS 1e-9 constexpr int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1}; constexpr int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; using namespace std; using ll = long long; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } #include "bits/stdc++.h" template <int mod, bool isPrime = false> class Mint { using ll = long long; ll value; public: constexpr Mint() : value(0){}; constexpr Mint(ll x) : value(x) { value %= mod; if (value < 0) value += mod; } constexpr Mint(const Mint &other) : value(other.value) {} ll &get() { return value; } ll get() const { return value; } constexpr Mint pow(ll n) { Mint ret(1), tmp(value); while (n) { if (n & 1) ret *= tmp; n >>= 1; tmp *= tmp; } return ret; } constexpr bool operator==(const Mint &a) const { return value == a.value; } constexpr bool operator!=(const Mint &a) const { return value != a.value; } constexpr Mint &operator=(const Mint &a) { value = a.value; return *this; } constexpr Mint &operator+=(const Mint &a) { if ((value += a.value) >= mod) value -= mod; return *this; } constexpr Mint &operator-=(const Mint &a) { if ((value += mod - a.value) >= mod) value -= mod; return *this; } constexpr Mint &operator*=(const Mint &a) { value = value * a.value % mod; return *this; } constexpr Mint &operator/=(const Mint &a) { return *this *= inv(a); } constexpr Mint operator+(const Mint &a) const { return Mint(*this) += a; } constexpr Mint operator-(const Mint &a) const { return Mint(*this) -= a; } constexpr Mint operator*(const Mint &a) const { return Mint(*this) *= a; } constexpr Mint operator/(const Mint &a) const { return Mint(*this) /= a; } }; template <int mod, bool isPrime> std::ostream &operator<<(std::ostream &os, const Mint<mod, isPrime> &m) { os << m.get(); return os; } template <int mod, bool isPrime> std::istream &operator>>(std::istream &is, Mint<mod, isPrime> &m) { is >> m.get(); return is; } template <int mod> constexpr Mint<mod, true> inv(const Mint<mod, true> &m) { long long a = m.get(), b = mod, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } return Mint<mod, true>(u); } template <int mod, bool isPrime> constexpr Mint<mod, isPrime> operator+(long long lhs, const Mint<mod, isPrime> &a) { return Mint<mod, isPrime>(lhs + a.get()); } template <int mod, bool isPrime> constexpr Mint<mod, isPrime> operator-(long long lhs, const Mint<mod, isPrime> &a) { return Mint<mod, isPrime>(lhs - a.get()); } template <int mod, bool isPrime> constexpr Mint<mod, isPrime> operator*(long long lhs, const Mint<mod, isPrime> &a) { return Mint<mod, isPrime>(lhs % mod * a.get()); } constexpr int default_mod = 1000000007; using mint = Mint<default_mod, true>; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n = s.size(); vector<vector<mint>> dp(n + 1, vector<mint>(13, 0)); dp[0][0] = 1; REP(i, n) { if (s[i] == '?') { REP(j, 13) { REP(k, 10) { dp[i + 1][(j * 10 + k) % 13] += dp[i][j]; } } } else { int k = s[i] - '0'; REP(j, 13) { dp[i + 1][(j * 10 + k) % 13] += dp[i][j]; } } } cout << dp[n][5] << endl; }
[]
769,601
769,602
u918357423
cpp
p02960
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef long long int lli; using namespace std; typedef pair<int, int> ii; typedef priority_queue<int, vector<int>, greater<int>> heapq; #define int long long int const lli MOD = 1000000007LL; inline lli mod_mul(lli x, lli y) { return (x * y) % MOD; } inline lli mod_add(lli x, lli y) { return (x + y) % MOD; } signed main() { string S; cin >> S; int len = S.length(); reverse(S.begin(), S.end()); // int dp[100001][13]; vector<vector<int>> dp(len + 1, vector<int>(13, 0)); dp[0][0] = 1; int digit = 1; for (int i = 1; i <= len; i++) { char c = S[i - 1]; if (c != '?') { int p = c - '0'; int r = (p * digit) % 13; for (int j = 0; j < 13; j++) { dp[i][j] = dp[i - 1][(r + j) % 13]; } } else { for (int p = 0; p < 10; p++) { int r = (p * digit) % 13; for (int j = 0; j < 13; j++) { dp[i][j] = mod_add(dp[i][j], dp[i - 1][(r + j) % 13]); } } } digit = (digit * 10) % 13; } cout << dp[len][5] << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef long long int lli; using namespace std; typedef pair<int, int> ii; typedef priority_queue<int, vector<int>, greater<int>> heapq; #define int long long int const lli MOD = 1000000007LL; inline lli mod_mul(lli x, lli y) { return (x * y) % MOD; } inline lli mod_add(lli x, lli y) { return (x + y) % MOD; } signed main() { string S; cin >> S; int len = S.length(); reverse(S.begin(), S.end()); // int dp[100001][13]; vector<vector<int>> dp(len + 1, vector<int>(13, 0)); dp[0][0] = 1; int digit = 1; for (int i = 1; i <= len; i++) { char c = S[i - 1]; if (c != '?') { int p = c - '0'; int r = (p * digit) % 13; for (int j = 0; j < 13; j++) { dp[i][j] = dp[i - 1][(13 + j - r) % 13]; } } else { for (int p = 0; p < 10; p++) { int r = (p * digit) % 13; for (int j = 0; j < 13; j++) { dp[i][j] = mod_add(dp[i][j], dp[i - 1][(13 + j - r) % 13]); } } } digit = (digit * 10) % 13; } cout << dp[len][5] << endl; return 0; }
[ "assignment.value.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "assignment.change", "identifier.replace.remove", "literal.replace.add", "call.arguments.change" ]
769,611
769,612
u576106056
cpp
p02960
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; using P = pair<int, int>; using namespace std; const ll mod = 1e9 + 7; ll dp[101010][13]; int main() { string s; cin >> s; ll a = 0; string tmp = s; reverse(tmp.begin(), tmp.end()); ll b = 1; rep(i, tmp.size()) { if (tmp[i] == '?') { if (i == 0) { for (ll a = 0; a < 13; ++a) { dp[i][a] = 1; } } else { for (ll a = 0; a <= 9; ++a) { ll tmpa = (a * b) % 13; for (int j = 0; j < 13; ++j) { if (dp[i - 1][j] > 0) { dp[i][(tmpa + j) % 13] += dp[i - 1][j]; dp[i][(tmpa + j) % 13] %= mod; } } } } } else { ll a = ((tmp[i] - '0') * b) % 13; if (i == 0) { dp[i][a] = 1; } else { for (int j = 0; j < 13; ++j) { if (dp[i - 1][j] > 0) { dp[i][(j + a) % 13] += dp[i - 1][j]; dp[i][(j + a) % 13] %= mod; } } } } b *= 10; b %= 13; } // rep(i, tmp.size()+1) { // rep(j, 13) cout << dp[i][j] << " "; // cout << endl; // } cout << dp[tmp.size() - 1][5] % mod << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; using P = pair<int, int>; using namespace std; const ll mod = 1e9 + 7; ll dp[101010][13]; int main() { string s; cin >> s; ll a = 0; string tmp = s; reverse(tmp.begin(), tmp.end()); ll b = 1; rep(i, tmp.size()) { if (tmp[i] == '?') { if (i == 0) { for (ll a = 0; a <= 9; ++a) { dp[i][a] = 1; } } else { for (ll a = 0; a <= 9; ++a) { ll tmpa = (a * b) % 13; for (int j = 0; j < 13; ++j) { if (dp[i - 1][j] > 0) { dp[i][(tmpa + j) % 13] += dp[i - 1][j]; dp[i][(tmpa + j) % 13] %= mod; } } } } } else { ll a = ((tmp[i] - '0') * b) % 13; if (i == 0) { dp[i][a] = 1; } else { for (int j = 0; j < 13; ++j) { if (dp[i - 1][j] > 0) { dp[i][(j + a) % 13] += dp[i - 1][j]; dp[i][(j + a) % 13] %= mod; } } } } b *= 10; b %= 13; } cout << dp[tmp.size() - 1][5] % mod << endl; }
[ "control_flow.loop.for.condition.change" ]
769,617
769,618
u482544950
cpp
p02960
#include <iostream> #include <string> //#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; // s=string(100000,'?'); int n = 13; long mod = 1000 * 1000 * 1000 + 7; long *dp = new long[n](); dp[0] = 1; int cal[n][10]; for (int i = 0; i < n; i++) { for (int j = 0; j < 10; j++) { cal[i][j] = i * j % 13; } } long b = 0; long mul = 1; for (int i = s.length() - 1; i >= 0; i--) { // cout<<mul%mod<<endl; if (char(s[i]) != '?') { b += int(s[i] - '0') * mul % 13; } else { long *tmp_dp = new long[n](); for (int j = 0; j < n; j++) { for (int k = 0; k < 10; k++) { tmp_dp[(cal[mul % 13][k] + j) % 13] += dp[j] % mod; tmp_dp[(cal[mul % 13][k] + j) % 13] %= mod; } } // dp=tmp_dp; for (int j = 0; j < n; j++) { // cout<<tmp_dp[j]<<endl; dp[j] = tmp_dp[j] % mod; } } mul *= 10; } b %= 13; int ans; if (b <= 5) { ans = 5 - b; } else { ans = 18 - b; } // cout << ans << endl; cout << dp[ans] % mod << endl; return 0; }
#include <iostream> #include <string> //#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; // s=string(100000,'?'); int n = 13; long mod = 1000 * 1000 * 1000 + 7; long *dp = new long[n](); dp[0] = 1; int cal[n][10]; for (int i = 0; i < n; i++) { for (int j = 0; j < 10; j++) { cal[i][j] = i * j % 13; } } long b = 0; long mul = 1; for (int i = s.length() - 1; i >= 0; i--) { // cout<<mul%mod<<endl; if (char(s[i]) != '?') { b += int(s[i] - '0') * mul % 13; } else { long *tmp_dp = new long[n](); for (int j = 0; j < n; j++) { for (int k = 0; k < 10; k++) { tmp_dp[(cal[mul % 13][k] + j) % 13] += dp[j] % mod; tmp_dp[(cal[mul % 13][k] + j) % 13] %= mod; } } // dp=tmp_dp; for (int j = 0; j < n; j++) { // cout<<tmp_dp[j]<<endl; dp[j] = tmp_dp[j] % mod; } } mul *= 10; mul %= n; } b %= 13; int ans; if (b <= 5) { ans = 5 - b; } else { ans = 18 - b; } // cout << ans << endl; cout << dp[ans] % mod << endl; return 0; }
[ "assignment.add" ]
769,621
769,622
u664373116
cpp
p02960
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const long long MOD = 1000000007; const double EPS = 1e-9; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); long long unsigned int dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const long long MOD = 1000000007; const double EPS = 1e-9; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); static long long unsigned int dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
[ "variable_declaration.specifier.add" ]
769,625
769,626
u067267922
cpp
p02960
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const long long MOD = 1000000007; const double EPS = 1e-9; signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); long long unsigned int dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const long long MOD = 1000000007; const double EPS = 1e-9; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); static long long unsigned int dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
[ "function.return_type.change", "variable_declaration.specifier.add" ]
769,627
769,626
u067267922
cpp
p02960
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const int MOD = 1000000007LL; const double EPS = 1e-9; signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); long long unsigned int dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const long long MOD = 1000000007; const double EPS = 1e-9; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); static long long unsigned int dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "function.return_type.change", "variable_declaration.specifier.add" ]
769,628
769,626
u067267922
cpp
p02960
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const int MOD = 1000000007; const double EPS = 1e-9; signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); long long unsigned dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
#include <bits/stdc++.h> //#define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define ALL(obj) (obj).begin(), (obj).end() #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; typedef long long ll; const long long MOD = 1000000007; const double EPS = 1e-9; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int n = S.length(); static long long unsigned int dp[100005][13]; dp[0][0] = 1; REP(i, n) { int c; if (S[i] == '?') c = -1; else c = S[i] - '0'; REP(j, 10) { if (c != -1 && c != j) continue; REP(ki, 13) { (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD; } } } cout << dp[n][5] << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "function.return_type.change", "variable_declaration.specifier.add" ]
769,629
769,626
u067267922
cpp
p02960
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1000000007; int main() { string s; cin >> s; ll n = s.size(); vector<vector<ll>> dp(n, vector<ll>(13, 0)); // dp[i][j] 前からi+1桁目までにnum = // j(mod13)となる数字がいくつあるか if (s[0] == '?') { for (int i = 0; i < 10; i++) dp[0][i] = 1; } else { int i = s[0] - '0'; dp[0][i] = 1; } // for(int i = 0;i < 13;i++)cout << dp[0][i] << endl; for (ll i = 1; i < n; ++i) { if (s[i] == '?') { for (int j = 0; j < 13; ++j) { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; } // cout << "i:" << i << "j:" << j << " " << dp[i][j] << endl; } } else { int k = s[i] - '0'; for (int j = 0; j < 13; ++j) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; // cout << "i:" << i << "j:" << j << " " << dp[i][j] << endl; } } for (int j = 0; j < 13; j++) dp[i][j] % MOD; } cout << dp[n - 1][5] << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1000000007; int main() { string s; cin >> s; ll n = s.size(); vector<vector<ll>> dp(n, vector<ll>(13, 0)); // dp[i][j] 前からi+1桁目までにnum = // j(mod13)となる数字がいくつあるか if (s[0] == '?') { for (int i = 0; i < 10; i++) dp[0][i] = 1; } else { int i = s[0] - '0'; dp[0][i] = 1; } // for(int i = 0;i < 13;i++)cout << dp[0][i] << endl; for (ll i = 1; i < n; ++i) { if (s[i] == '?') { for (int j = 0; j < 13; ++j) { for (int k = 0; k < 10; k++) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; } // cout << "i:" << i << "j:" << j << " " << dp[i][j] << endl; } } else { int k = s[i] - '0'; for (int j = 0; j < 13; ++j) { dp[i][(j * 10 + k) % 13] += dp[i - 1][j]; // cout << "i:" << i << "j:" << j << " " << dp[i][j] << endl; } } for (int j = 0; j < 13; j++) dp[i][j] %= MOD; } cout << dp[n - 1][5] << endl; }
[ "assignment.compound.arithmetic.replace.add", "expression.operator.arithmetic.replace.remove", "expression.operation.binary.change" ]
769,636
769,637
u280114218
cpp
p02960
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; #define ll long long const ll md = 1e9 + 7; ll dp[N][15]; string s; int n; ll solve(int idx, int val) { ll &ret = dp[idx][val]; if (ret >= 0) return ret; ret = 0; if (idx == n) { ret = (val == 5); } if (s[idx] == '?') { int tmp; for (int i = 0; i < 10; i++) { tmp = (val * 10 + i) % 13; ret += (solve(idx + 1, tmp)); ret %= md; } } else { int v = s[idx] - '0'; val = (val * 10 + v) % 13; ret += solve(idx + 1, val); ret %= md; } return ret %= md; } int main() { cin >> s; n = s.size(); memset(dp, -1ll, sizeof(dp)); cout << solve(0, 0) << endl; }
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; #define ll long long const ll md = 1e9 + 7; ll dp[N][15]; string s; int n; ll solve(int idx, int val) { ll &ret = dp[idx][val]; if (ret >= 0) return ret; ret = 0; if (idx == n) { ret = (val == 5); return ret; } if (s[idx] == '?') { int tmp; for (int i = 0; i < 10; i++) { tmp = (val * 10 + i) % 13; ret += (solve(idx + 1, tmp)); ret %= md; } } else { int v = s[idx] - '0'; val = (val * 10 + v) % 13; ret += solve(idx + 1, val); ret %= md; } return ret %= md; } int main() { cin >> s; n = s.size(); memset(dp, -1ll, sizeof(dp)); cout << solve(0, 0) << endl; }
[ "control_flow.return.add" ]
769,641
769,642
u699101754
cpp
p02960
// // 2019/03/30 Ver1.10 // // Codeforces: ganariya // AtCoder: ganariya2525 // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMHBYYYWMMMM#BYYTTTYWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMB9O1==?????zzCC111>>;;;;;;;;;;;<?TMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9Olll=l======??????????>>>>>>;;;;;;;;;:;?TMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMM9ttlllllllll=l=======?????????>>>>>>;;;;;;;;;;?TMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMBOttOtttttltlllllllll=======??????????>>>>>>>;;;;;;?TMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMBttwOtttttttttttttlllllllll========?????????>>>>>>;;;;;<TMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMBrwZrttttttttttttttttttlllllllllll======???????????>>>>>>;;?HMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMSw0trtrrtrtrttrtttttttttttttlllOllllll========????<<zz??>>>>>>ZMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMX0ttrtrOOttrttrttOOttttttttttttltwllllllllll========??wy?????>>>vZMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMM0ttrI+wV1rtttttttwZtttttttltttOwylOXOllllllllllll=l====1dkz???????vZdMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMSrrwrtwZCjttttttttwSttOlllltllllwtXOlZkOlllllllllllllll==z+dk===?????X2JMMMMMMMMMMMMM // MMMMMMMMMMMMMBrtwwtrw0<jttttttttOXllOttltllttllOZwHOtXkyltlllllllllllllll<+XZ======?dk?JMMMMMMMMMMMM // MMMMMMMMMMMMStwdZtwXC<+ttttttOOOd6ltZlltllllttllStWWOOHWytttttltltOllltllz:zHllll===zX=?dMMMMMMMMMMM // MMMMMMMMMMBrwdKOtwW3;;zrttttwZwXRlldOllltltlltttwlXvktdXWytltttttttOttlttl<<dklllllllZ===dMMMMMMMMMM // MMMMMMMMM8tQM#ttwW3;;;1trttwSwfUOlORltllltlllllldtX>dktDOWOtlttltttOOttltO<;+WOllllllXlllzMMMMMMMMMM // MMMMMMMM9OdM#Ottd$;;;;;<?1z0OKjRltd0llltOllllllldZX>?WOw_WWOtttttttttOttI<;;<dkttttllllllldMMMMMMMMM // MMMMMMM9wMMMSttwS<;;;;>;;;J<j>(I<?U111zltllllllld0X>~dkwl(WkttlttlOOwWk<;;:;;zHttttttwOllllMMMMMMMMM // MMMMMMBdMMM8tttdI+zttttttdSXt~dlzXwlllzzOzzzzzlldkW<~?kOk~?sx++++jdHmH6+++<;;jdZtttttdkOtlldMMMMMMMM // MMMMM#dMMM#tttw0+tttttttdKdf((RsdfRllllldZllltlldWK~~_W0w_~OWOlOdgg9ZtOWOtttz+wktttttdpktttwMMMMMMMM // MMMMMWMMMMSlttdIttttttOdWHH>~(IzWDRll=llzRlllzlldk$>++dkd<~_XkdgH9tttttdktttt+OkrttrtdfpkttOMMMMMMMM // MMMMNWMMM#Zttlk=tttttOXWWd$_.(IdW1R=llll=SlllzOldK<_._(kd6+-(MM9lltttttrWktttztWZttrwXppWttrMMMMMMMM // MMMMNMMMM#lltwDzttllOXyW0X:..(OXk<Rl=ll=lwOlllOld3<``.(Rd>~?CdklllltttttXdXttzOWktrwwWpfpkrtMMMMMMMM // MMMMMMMMM@ltldIzlttOXyW$w$```(OyD(Rl==llldZ=llIlw;~```-Xd:~~~~UkylltttAyHdgSrzObRtOXwpfppWrrMMMMMMMM // MMMMMMMMM@llldtlllldVyW+d>```.wZ$ wl==lI=wRl=ll=w<```` // dd_..~~(RZXOQdggHH9ZwrzwHWrdXXppfppkrMMMMMMMM // MMMMMMMMM#llldlltlwyyyD(S-...,Wk] zI=l=llzWzl=l=P~```` // jZ``...~zQkH@MBUtrZtrtldHRdSdpfpffpkwMMMMMMMM // MMMMNMMMMNZllXtllldVyW3(Mf=<ONMHP~(k===l=zdk=lld3```...(C````..(M96lttttrrtrrtdHWHXpfpppfpRwMMMMMMMM // MMMMMMMMMMNzzWZllzyyyy(W@` =~MWK6 jz=lzlzvRz=lZ`.I+JgkWm&-. // `..(ZltlttttrtttrWWHppfppfpppSdMMMMMMMM MMMMMMMMMMMkAWRllzVyyS_(b // .MNHU-(Uz=lI={XkzO>.dVT7<TMHMNHHx-.(kwZyltttrtrrdHHpfppfpffpp0dMMMMMMMM // MMMMMMMMMMMMKyWzOzyyyk.`<! hdWMH]``(S==t=l(kX2 ?_` // WMMHH#HH+.XwkwOttttrwrZ~(HfpfpppfpWwXMMMMMMMM MMMMMMMMMMMMMHWROOyyyW;` `. // (WVM#b```(0=zzz wX!``` a.dM#NM@N(4WhXkXkWtttttwd3O_(HpffpfpfWwSMMMMMMMM // MMMMMMMMMMMMNZvWzXXyyXP```-_ ?o+?!````.4=Z=`(:```` HpbNNMHHH // (C=XXyWZWttrdwf:(>.dfppffppSXSMMMMMMMM // MMMMMMMMMMMMMRzuHzXyZXH.``````````````` ?zz ``````` ZKvTHHbWt `` // XZyyHZWOdSZ<::~`(fpfpfffXp0WMMMMMMM // MMMMMMMMMMMMMKzyyHvyZZW____.`````````````.I_```````` // ?nJzX7^````.WXWyyHyWKZ<:::_`Jffpfpfpfp0WMMMMMMM // MMMMMMMMMMMMM@zZyZWwWyXo-_~(~ ```````````` `````````````` // _`````.WXkyyVWmWc::<~ .HffppfffffkXMMMMMMM // MMMMMMMMMMMMMKzZZZZXkUXr~....```````....```````````` ... // ````..JXWWyyW83vXx~..WfffVfWVffffkdMMMMMMM // MMMMMMMMMMMMMRzZZZZZZZZb````````````<````````````./<~._<_.____`(WfdyW3<:~~(XWkVVVVVVVHVVVVV0dMMMMMMM // MMMMMMMMMMMMMSzZZZZZZZWX-```````````````````````````.......~~._j9jX=_~~_(XZyVHHkyyyyWHyyykykOMMMMMMM // MMMMMMMMMMMMMSzuuuuuZXWZW,```````````````````````````````.``..(3<! // ...JWyyXWyyyWHkyyWHyyyHyklMMMMMMM MMMMMMMMMMMMNXzuuuXXuXSuuXh,```````` .... // ```````````````````_~ .JWyyyyZyy0HyyZyyZyZXWZZZWHZIdMMMMMM // MMMMMMMMMMMMNwtuuuXkuXXuuuuXh,``````(:::~<?71(,``````````````.(UMNUkZZZZZZZHZZ0ZZZZZWWZZZWNXIdMMMMMM // MMMMMMMMMMMMNKOzuzXkuXuuuuuXuXW, ```` // _~~~:~~(}```````````.(YC;::<kCfZZZZXO#ZZVZZZZZMZZuuMMNXzMMMMMM // MMMMMMMMMMMMHKOzzuXkzdzzzzuXXzuuU&.``````````````````` // .JY>::::;;J=:dZuZuZd#uuruuuud#uuuXMMMNXdMMMMM // MMMMMMMMMMMMMNOvzzXkvMRzzzzXKzuzzzXh, // `````````````..JC<;:;;:;;+7<:~(HHuXIdNuuzuuuXMSuuuWMMMMROMMMMM // MMMMMMMMMMMMMNvvvrdkvM#vzzzzHzzzzzuzzUG. ``` // ...JdY<:;:;:::;;+v<~~~:(HpHmzMNXZzuzzd#zzzdMMMMMMRdMMMM // MMMMMMMMMMMMMNwrrvdRrMNwvvvvdRvvvzwkzzzzXWWHY=~~O+::::::::<+<~~~~~~~dppppWMMkZzzzwM#zzdMMMMMMMMNMMMM // MMMMMMMMMMMMMM#rrrwRrMMbOrrOZNkrvvvXwvvvvvwX;.~._W_:::::(?!~~~~~~~~(HpppppppHWdvwM#XwdMMMMMMMMMMNMMM // MMMMMMMMMMMMMMNyrrrRrWMMmzOrzdNyrrrZNvrwQWWfb....(r~~_J>_.....~.~~-dpfpffpfpppWHHMNdMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMNrtrStdMMMNxzrzMNmrrrdNWfVfffP._-.(~_J!............JpfpffpfpfffpppWNppppHMMMMMMMMMMMM // MMMMMMMMMMMMMMMMNOtXtdMMMMMNxzZMMNmgHyVVVVVW%..?/(.,(x-..........(HfffpffpffpffWHHffpffppfVyyWMMMMMM // include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; // typedef //------------------------------------------ typedef long long LL; typedef vector<int> VI; typedef vector<bool> VB; typedef vector<char> VC; typedef vector<double> VD; typedef vector<string> VS; typedef vector<LL> VLL; typedef vector<VI> VVI; typedef vector<VB> VVB; typedef vector<VS> VVS; typedef vector<VLL> VVLL; typedef vector<VVI> VVVI; typedef vector<VVLL> VVVLL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<int, string> PIS; typedef pair<string, int> PSI; typedef pair<string, string> PSS; typedef vector<PII> VPII; typedef vector<PLL> VPLL; typedef vector<VPII> VVPII; typedef vector<VPLL> VVPLL; typedef vector<VS> VVS; typedef map<int, int> MII; typedef map<LL, LL> MLL; typedef map<string, int> MSI; typedef map<int, string> MIS; typedef __int128 Lint; //数値・文字列 //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } inline LL toLongLong(string s) { LL v; istringstream sin(s); sin >> v; return v; } Lint toLint(const string s) { Lint ret = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } inline VC toVC(string s) { VC data(s.begin(), s.end()); return data; } vector<string> SPRIT(const string &s, const string &delim) { vector<string> result; string::size_type pos = 0; while (pos != string::npos) { string::size_type p = s.find(delim, pos); if (p == string::npos) { result.push_back(s.substr(pos)); break; } else { result.push_back(s.substr(pos, p - pos)); } pos = p + delim.size(); } return result; } string TRIM(const string &str, const char *trimCharacterList = " \t\v\r\n") { string result; string::size_type left = str.find_first_not_of(trimCharacterList); if (left != string::npos) { string::size_type right = str.find_last_not_of(trimCharacterList); result = str.substr(left, right - left + 1); } return result; } string REPLACE_STRING(const string source, const string find, const string alt) { string result = source; string::size_type pos = 0; while (pos = result.find(find, pos), pos != string::npos) { result.replace(pos, find.length(), alt); pos += alt.length(); } return result; } template <typename T> bool VECTOR_EXISTS(vector<T> vec, T data) { auto itr = std::find(vec.begin(), vec.end(), data); size_t index = distance(vec.begin(), itr); if (index != vec.size()) return true; else return false; } template <typename T> void VECTOR_REMOVE_VALUE_ALL(vector<T> &vec, T data) { vec.erase(remove(vec.begin(), vec.end(), data), vec.end()); } template <typename T> vector<T> VECTOR_REMOVE_VALUE_ALL_FAST(vector<T> vec, T data) { vector<T> vec2; for (auto &x : vec) if (x != data) vec2.push_back(x); return vec2; } bool REG_MATCH(string const &text, regex const &re) { bool result = regex_match(text, re); return result; } bool REG_MATCH(string const &text, smatch &match, regex const &re) { bool result = regex_match(text, match, re); return result; } smatch REG_SEARCH(string const &text, regex const &re) { smatch m; regex_search(text, m, re); return m; } vector<smatch> REG_ALL_SEARCH(string const &text, regex const &re) { vector<smatch> matchs; sregex_iterator iter(text.cbegin(), text.cend(), re); sregex_iterator end; for (; iter != end; iter++) matchs.push_back(*iter); return matchs; } string REG_REPLACE(string const &text, regex const &re, string const &replace) { string result = regex_replace(text, re, replace, regex_constants::format_first_only); return result; } string REG_ALL_REPLACE(string const &text, regex const &re, string const &replace) { string result = regex_replace(text, re, replace); return result; } template <typename T> vector<T> COMPRESS(vector<T> v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); return v; } template <typename T> pair<map<T, int>, map<int, T>> MAPPING(const vector<T> v) { map<T, int> zip; map<int, T> unzip; for (int i = 0; i < v.size(); i++) zip[v[i]] = i; for (int i = 0; i < v.size(); i++) unzip[i] = v[i]; return make_pair(zip, unzip); } template <typename T> vector<pair<T, int>> RUN_LENGTH(const vector<T> &v) { vector<pair<T, int>> ret; int len = v.size(); for (int i = 0, j = 0; i < len; i = j) { while (j < len && v[i] == v[j]) j++; ret.push_back(make_pair(v[i], j - i)); } return ret; } template <typename T, typename U, typename V, typename W> auto operator+(const std::pair<T, U> &l, const std::pair<V, W> &r) -> std::pair<decltype(l.first + r.first), decltype(l.second + r.second)> { return {l.first + r.first, l.second + r.second}; } template <typename T, typename U, typename V, typename W> auto operator-(const std::pair<T, U> &l, const std::pair<V, W> &r) -> std::pair<decltype(l.first - r.first), decltype(l.second - r.second)> { return {l.first - r.first, l.second - r.second}; } ostream &operator<<(ostream &dest, __int128_t value) { ostream::sentry s(dest); if (s) { __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char *d = std::end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = std::end(buffer) - d; if (dest.rdbuf()->sputn(d, len) != len) { dest.setstate(ios_base::badbit); } } return dest; } #define UPPER(s) transform((s).begin(), (s).end(), (s).begin(), ::toupper) #define LOWER(s) transform((s).begin(), (s).end(), (s).begin(), ::tolower) //四捨五入 nLen=小数点第n位にする //------------------------------------------ //切り上げ double ceil_n(double dIn, long long nLen) { double dOut; dOut = dIn * pow(10.0, nLen); dOut = (double)(long long)(dOut + 0.9); return dOut * pow(10.0, -nLen); } //切り捨て double floor_n(double dIn, long long nLen) { double dOut; dOut = dIn * pow(10.0, nLen); dOut = (double)(long long)(dOut); return dOut * pow(10.0, -nLen); } //四捨五入 double round_n(double dIn, long long nLen) { double dOut; dOut = dIn * pow(10.0, nLen); dOut = (double)(long long)(dOut + 0.5); return dOut * pow(10.0, -nLen); } // n桁目の数の取得 int take_a_n(LL num, int n) { string str = toString(num); return str[str.length() - n] - '0'; } int bitcount32(int bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff); } //整数を2進数表記したときの1の個数を返す LL bitcount64(LL bits) { bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555); bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333); bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f); bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff); bits = (bits & 0x0000ffff0000ffff) + (bits >> 16 & 0x0000ffff0000ffff); return (bits & 0x00000000ffffffff) + (bits >> 32 & 0x00000000ffffffff); } // comparison //------------------------------------------ #define C_MAX(a, b) ((a) > (b) ? (a) : (b)) #define C_MIN(a, b) ((a) < (b) ? (a) : (b)) #define C_ABS(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) template <class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true; } return false; } template <class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true; } return false; } // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, arr) \ for (typeof((arr).begin()) i = (arr).begin(); i != (arr).end(); ++i) #define EXIST(str, e) ((str).find(e) != (str).end()) #define COUNT(arr, v) count((arr).begin(), (arr).end(), v) #define SEARCH(v, w) search((v).begin(), (v).end(), (w).begin(), (w).end()) #define B_SEARCH(arr, v) binary_search((arr).begin(), (arr).end(), v) #define SORT(c) sort((c).begin(), (c).end()) #define RSORT(c) sort((c).rbegin(), (c).rend()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ROTATE_LEFT(arr, c) \ rotate((arr).begin(), (arr).begin() + (c), (arr).end()) #define ROTATE_RIGHT(arr, c) \ rotate((arr).rbegin(), (arr).rbegin() + (c), (arr).rend()) #define SUMI(arr) accumulate((arr).begin(), (arr).end(), 0) #define SUMD(arr) accumulate((arr).begin(), (arr).end(), 0.) #define SUMLL(arr) accumulate((arr).begin(), (arr).end(), 0LL) #define SUMS(arr) accumulate((arr).begin(), (arr).end(), string()) #define MULD(arr) \ accumulate((arr).begin(), (arr).end(), 1., multiplies<double>()) #define MULLL(arr) \ accumulate((arr).begin(), (arr).end(), 1LL, multiplies<long long>()) #define UB(arr, n) upper_bound((arr).begin(), (arr).end(), n) #define LB(arr, n) lower_bound((arr).begin(), (arr).end(), n) #define OF_ALL(arr, func) all_of((arr).begin(), (arr).end(), (func)) #define OF_NONE(arr, func) none_of((arr).begin(), (arr).end(), (func)) #define OF_ANY(arr, func) any_of((arr).begin(), (arr).end(), (func)) #define PB push_back #define MP make_pair #define ft first #define sd second // input output //------------------------------------------ #define GL(s) getline(cin, (s)) #define INIT() \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); #define OUT(d) std::cout << (d) #define OUT_L(d) std::cout << (d) << endl #define FOUT(n, data) std::cout << std::fixed << std::setprecision(n) << (data) #define FOUT_L(n, data) \ std::cout << std::fixed << std::setprecision(n) << (data) << "\n" #define EL() printf("\n") #define SHOW_VECTOR(v) \ { \ std::cerr << #v << "\t:"; \ for (const auto &xxx : v) { \ std::cerr << xxx << " "; \ } \ std::cerr << "\n"; \ } #define SHOW_MAP(v) \ { \ std::cerr << #v << endl; \ for (const auto &xxx : v) { \ std::cerr << xxx.first << " " << xxx.second << "\n"; \ } \ } #define Yes() printf("Yes\n") #define No() printf("No\n") #define YES() printf("YES\n") #define NO() printf("NO\n") #define Yay() printf("Yay!\n") #define Nnn() printf(":(\n") template <typename T1, typename T2> istream &operator>>(istream &in, pair<T1, T2> &p) { in >> p.first >> p.second; return in; } template <typename T> istream &operator>>(istream &in, vector<T> &v) { for (auto &x : v) in >> x; return in; } istream &operator>>(istream &in, Lint &d) { string s; cin >> s; Lint tmp = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') tmp = 10 * tmp + s[i] - '0'; d = tmp; return in; } template <typename T1, typename T2> ostream &operator<<(ostream &out, const std::pair<T1, T2> &p) { out << "[" << p.first << ", " << p.second << "]" << "\n"; return out; } // repetition //------------------------------------------ #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define FORLL(i, a, b) for (LL i = LL(a); i < LL(b); ++i) #define RFORLL(i, a, b) for (LL i = LL(b) - 1; i >= LL(a); --i) #define REPLL(i, n) for (LL i = 0; i < LL(n); ++i) #define RREPLL(i, n) for (LL i = LL(n) - 1; i >= 0; --i) #define FOREACH(x, arr) for (auto &(x) : (arr)) #define FORITER(x, arr) for (auto(x) = (arr).begin(); (x) != (arr).end(); ++(x)) // constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; // math //-------------------------------------------- // min <= aim <= max template <typename T> inline bool BETWEEN(const T aim, const T min, const T max) { if (min <= aim && aim <= max) { return true; } else { return false; } } template <typename T1, typename T2> inline bool IS_OUT(const T1 toY, const T1 toX, const T2 H, const T2 W) { return (toY < 0 || toY >= H || toX < 0 || toX >= W); } template <class T> inline T SQR(const T x) { return x * x; } template <class T1, class T2> inline T1 POW(const T1 x, const T2 y) { if (!y) return 1; else if ((y & 1) == 0) { return SQR(POW(x, y >> 1)); } else return POW(x, y ^ 1) * x; } template <typename T> constexpr T ABS(T x) { return x < 0 ? -x : x; } // partial_permutation nPr 順列 // first・・最初の数 // middle・・r(取り出す数) // last・・n(全体数) template <class Iter> bool next_partial_permutation(Iter first, Iter middle, Iter last) { reverse(middle, last); return next_permutation(first, last); } // combination nCr 組み合わせ // first1・・最初の数 // last1==first2・・r(取り出す数) // last2・・n(全体数) template <class Iter> bool next_combination(Iter first1, Iter last1, Iter first2, Iter last2) { if ((first1 == last1) || (first2 == last2)) { return false; } Iter m1 = last1; Iter m2 = last2; --m2; while (--m1 != first1 && !(*m1 < *m2)) { } bool result = (m1 == first1) && !(*first1 < *m2); if (!result) { while (first2 != m2 && !(*m1 < *first2)) { ++first2; } first1 = m1; std::iter_swap(first1, first2); ++first1; ++first2; } if ((first1 != last1) && (first2 != last2)) { m1 = last1; m2 = first2; while ((m1 != first1) && (m2 != last2)) { std::iter_swap(--m1, m2); ++m2; } std::reverse(first1, m1); std::reverse(first1, last1); std::reverse(m2, last2); std::reverse(first2, last2); } return !result; } // numeric_law //-------------------------------------------- template <typename T> constexpr bool ODD(T x) { return x % 2 != 0; } template <typename T> constexpr bool EVEN(T x) { return x % 2 == 0; } //最大公約数 template <class T> inline T GCD(const T x, const T y) { if (x < 0) return GCD(-x, y); if (y < 0) return GCD(x, -y); return (!y) ? x : GCD(y, x % y); } //最小公倍数 template <class T> inline T LCM(const T x, const T y) { if (x < 0) return LCM(-x, y); if (y < 0) return LCM(x, -y); return x * (y / GCD(x, y)); } // ax + by = gcd(a, b) // x,yが変数に格納される template <class T> inline T EXTGCD(const T a, const T b, T &x, T &y) { if (a < 0) { T d = EXTGCD(-a, b, x, y); x = -x; return d; } if (b < 0) { T d = EXTGCD(a, -b, x, y); y = -y; return d; } if (!b) { x = 1; y = 0; return a; } else { T d = EXTGCD(b, a % b, x, y); T t = x; x = y; y = t - (a / b) * y; return d; } } // mの世界でのaの逆元 // gce(a, m) = 1 template <class T> inline T INV_MOD(const T a, const T m) { T x, y; EXTGCD(a, m, x, y); return (x + m) % m; } template <class T> inline bool ISPRIME(const T x) { if (x <= 1) return false; for (T i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } template <class T> VB ERATOSTHENES(const T n) { VB arr(n + 1, true); arr[0] = arr[1] = false; for (T i = 2; i * i <= n; i++) { if (arr[i]) { for (T j = i * 2LL; j <= n; j += i) { arr[j] = false; } } } return arr; } // a <= x < b の素数を返す template <typename T> VB ERATOSTHENES(const T a, const T b) { VB small = ERATOSTHENES(b); VB prime(b - a, true); for (T i = 2; i * i <= b; i++) { if (small[i]) { for (T j = max(2LL, (a + i - 1) / i) * i; j < b; j += i) { prime[j - a] = false; } } } return prime; } // nの約数 template <typename T> vector<T> DIVISOR(T n) { vector<T> v; for (T i = 1; i * i <= n; ++i) { if (n % i == 0) { v.push_back(i); if (i != n / i) { v.push_back(n / i); } } } sort(v.begin(), v.end()); return v; } // nまでのすべての約数 template <typename T> vector<vector<T>> DIVISOR_ALL(T n) { vector<vector<T>> res(n + 1); for (T i = 1; i <= n; i++) { for (T j = i; j <= n; j += i) { res[j].push_back(i); } } return res; } template <typename T> vector<pair<T, T>> FACTORIZATION(T x) { vector<pair<T, LL>> ans; for (T i = 2; i * i <= x; i++) { if (x % i == 0) { T count = 0; while (x % i == 0) { count++; x /= i; } ans.push_back(MP(i, count)); } } if (x != 1) ans.push_back(MP(x, 1)); return ans; } LL POW_MOD(LL N, LL P, LL M) { LL ret = 1; while (P > 0) { if (P & 1LL) ret = (ret * N) % M; N = (N * N) % M; P >>= 1LL; } return ret; } template <typename T> inline T NCR(T n, T r) { if (r > n - r) r = n - r; T ans = 1LL; for (T i = 0; i < r; i++) { ans = ans * (n - i) / (i + 1); } return ans; } LL NCR_MOD(LL n, LL r, LL M) { if (r > n - r) return NCR_MOD(n, n - r, M); LL numerator = 1LL; //分子 LL denominator = 1LL; //分母 for (LL i = 0; i < r; i++) { numerator *= (n - i); numerator %= M; denominator *= (i + 1); denominator %= M; } return numerator * POW_MOD(denominator, M - 2, M) % M; } // confirmation //-------------------------------------------- // clear memory #define CLR(arr, d) memset((arr), (d), sizeof(arr)) // debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << endl; // 2019-04-14 //~~~~~~~~~~~~~~~~~~~~~_(^~^ 」 ∠)_~~~~~~~~~~~~~~~~~~~~~ constexpr LL mod = 1e9 + 7; int main() { string S; cin >> S; string T = S; REVERSE(T); vector<LL> dp(13, 0); dp[0] = 1; LL base = 1; for (LL i = 0; i < T.size(); i++) { vector<LL> next(13, 0); if (T[i] != '?') { LL k = T[i] - '0'; LL d = (k * base) % 13; for (LL j = 0; j < 13; j++) { next[(j + d) % 13] += dp[j]; next[(j + d) % 13] %= mod; } } else { for (LL k = 0; k <= 9; k++) { for (LL j = 0; j < 13; j++) { LL d = (k * base) % 13; next[(j + d) % 13] += dp[j]; next[(j + d) % 13] %= mod; } } } dp = next; base *= 10; base %= mod; } cout << dp[5] % mod << endl; return 0; }
// // 2019/03/30 Ver1.10 // // Codeforces: ganariya // AtCoder: ganariya2525 // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMHBYYYWMMMM#BYYTTTYWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMB9O1==?????zzCC111>>;;;;;;;;;;;<?TMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9Olll=l======??????????>>>>>>;;;;;;;;;:;?TMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMM9ttlllllllll=l=======?????????>>>>>>;;;;;;;;;;?TMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMBOttOtttttltlllllllll=======??????????>>>>>>>;;;;;;?TMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMBttwOtttttttttttttlllllllll========?????????>>>>>>;;;;;<TMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMBrwZrttttttttttttttttttlllllllllll======???????????>>>>>>;;?HMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMSw0trtrrtrtrttrtttttttttttttlllOllllll========????<<zz??>>>>>>ZMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMX0ttrtrOOttrttrttOOttttttttttttltwllllllllll========??wy?????>>>vZMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMM0ttrI+wV1rtttttttwZtttttttltttOwylOXOllllllllllll=l====1dkz???????vZdMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMSrrwrtwZCjttttttttwSttOlllltllllwtXOlZkOlllllllllllllll==z+dk===?????X2JMMMMMMMMMMMMM // MMMMMMMMMMMMMBrtwwtrw0<jttttttttOXllOttltllttllOZwHOtXkyltlllllllllllllll<+XZ======?dk?JMMMMMMMMMMMM // MMMMMMMMMMMMStwdZtwXC<+ttttttOOOd6ltZlltllllttllStWWOOHWytttttltltOllltllz:zHllll===zX=?dMMMMMMMMMMM // MMMMMMMMMMBrwdKOtwW3;;zrttttwZwXRlldOllltltlltttwlXvktdXWytltttttttOttlttl<<dklllllllZ===dMMMMMMMMMM // MMMMMMMMM8tQM#ttwW3;;;1trttwSwfUOlORltllltlllllldtX>dktDOWOtlttltttOOttltO<;+WOllllllXlllzMMMMMMMMMM // MMMMMMMM9OdM#Ottd$;;;;;<?1z0OKjRltd0llltOllllllldZX>?WOw_WWOtttttttttOttI<;;<dkttttllllllldMMMMMMMMM // MMMMMMM9wMMMSttwS<;;;;>;;;J<j>(I<?U111zltllllllld0X>~dkwl(WkttlttlOOwWk<;;:;;zHttttttwOllllMMMMMMMMM // MMMMMMBdMMM8tttdI+zttttttdSXt~dlzXwlllzzOzzzzzlldkW<~?kOk~?sx++++jdHmH6+++<;;jdZtttttdkOtlldMMMMMMMM // MMMMM#dMMM#tttw0+tttttttdKdf((RsdfRllllldZllltlldWK~~_W0w_~OWOlOdgg9ZtOWOtttz+wktttttdpktttwMMMMMMMM // MMMMMWMMMMSlttdIttttttOdWHH>~(IzWDRll=llzRlllzlldk$>++dkd<~_XkdgH9tttttdktttt+OkrttrtdfpkttOMMMMMMMM // MMMMNWMMM#Zttlk=tttttOXWWd$_.(IdW1R=llll=SlllzOldK<_._(kd6+-(MM9lltttttrWktttztWZttrwXppWttrMMMMMMMM // MMMMNMMMM#lltwDzttllOXyW0X:..(OXk<Rl=ll=lwOlllOld3<``.(Rd>~?CdklllltttttXdXttzOWktrwwWpfpkrtMMMMMMMM // MMMMMMMMM@ltldIzlttOXyW$w$```(OyD(Rl==llldZ=llIlw;~```-Xd:~~~~UkylltttAyHdgSrzObRtOXwpfppWrrMMMMMMMM // MMMMMMMMM@llldtlllldVyW+d>```.wZ$ wl==lI=wRl=ll=w<```` // dd_..~~(RZXOQdggHH9ZwrzwHWrdXXppfppkrMMMMMMMM // MMMMMMMMM#llldlltlwyyyD(S-...,Wk] zI=l=llzWzl=l=P~```` // jZ``...~zQkH@MBUtrZtrtldHRdSdpfpffpkwMMMMMMMM // MMMMNMMMMNZllXtllldVyW3(Mf=<ONMHP~(k===l=zdk=lld3```...(C````..(M96lttttrrtrrtdHWHXpfpppfpRwMMMMMMMM // MMMMMMMMMMNzzWZllzyyyy(W@` =~MWK6 jz=lzlzvRz=lZ`.I+JgkWm&-. // `..(ZltlttttrtttrWWHppfppfpppSdMMMMMMMM MMMMMMMMMMMkAWRllzVyyS_(b // .MNHU-(Uz=lI={XkzO>.dVT7<TMHMNHHx-.(kwZyltttrtrrdHHpfppfpffpp0dMMMMMMMM // MMMMMMMMMMMMKyWzOzyyyk.`<! hdWMH]``(S==t=l(kX2 ?_` // WMMHH#HH+.XwkwOttttrwrZ~(HfpfpppfpWwXMMMMMMMM MMMMMMMMMMMMMHWROOyyyW;` `. // (WVM#b```(0=zzz wX!``` a.dM#NM@N(4WhXkXkWtttttwd3O_(HpffpfpfWwSMMMMMMMM // MMMMMMMMMMMMNZvWzXXyyXP```-_ ?o+?!````.4=Z=`(:```` HpbNNMHHH // (C=XXyWZWttrdwf:(>.dfppffppSXSMMMMMMMM // MMMMMMMMMMMMMRzuHzXyZXH.``````````````` ?zz ``````` ZKvTHHbWt `` // XZyyHZWOdSZ<::~`(fpfpfffXp0WMMMMMMM // MMMMMMMMMMMMMKzyyHvyZZW____.`````````````.I_```````` // ?nJzX7^````.WXWyyHyWKZ<:::_`Jffpfpfpfp0WMMMMMMM // MMMMMMMMMMMMM@zZyZWwWyXo-_~(~ ```````````` `````````````` // _`````.WXkyyVWmWc::<~ .HffppfffffkXMMMMMMM // MMMMMMMMMMMMMKzZZZZXkUXr~....```````....```````````` ... // ````..JXWWyyW83vXx~..WfffVfWVffffkdMMMMMMM // MMMMMMMMMMMMMRzZZZZZZZZb````````````<````````````./<~._<_.____`(WfdyW3<:~~(XWkVVVVVVVHVVVVV0dMMMMMMM // MMMMMMMMMMMMMSzZZZZZZZWX-```````````````````````````.......~~._j9jX=_~~_(XZyVHHkyyyyWHyyykykOMMMMMMM // MMMMMMMMMMMMMSzuuuuuZXWZW,```````````````````````````````.``..(3<! // ...JWyyXWyyyWHkyyWHyyyHyklMMMMMMM MMMMMMMMMMMMNXzuuuXXuXSuuXh,```````` .... // ```````````````````_~ .JWyyyyZyy0HyyZyyZyZXWZZZWHZIdMMMMMM // MMMMMMMMMMMMNwtuuuXkuXXuuuuXh,``````(:::~<?71(,``````````````.(UMNUkZZZZZZZHZZ0ZZZZZWWZZZWNXIdMMMMMM // MMMMMMMMMMMMNKOzuzXkuXuuuuuXuXW, ```` // _~~~:~~(}```````````.(YC;::<kCfZZZZXO#ZZVZZZZZMZZuuMMNXzMMMMMM // MMMMMMMMMMMMHKOzzuXkzdzzzzuXXzuuU&.``````````````````` // .JY>::::;;J=:dZuZuZd#uuruuuud#uuuXMMMNXdMMMMM // MMMMMMMMMMMMMNOvzzXkvMRzzzzXKzuzzzXh, // `````````````..JC<;:;;:;;+7<:~(HHuXIdNuuzuuuXMSuuuWMMMMROMMMMM // MMMMMMMMMMMMMNvvvrdkvM#vzzzzHzzzzzuzzUG. ``` // ...JdY<:;:;:::;;+v<~~~:(HpHmzMNXZzuzzd#zzzdMMMMMMRdMMMM // MMMMMMMMMMMMMNwrrvdRrMNwvvvvdRvvvzwkzzzzXWWHY=~~O+::::::::<+<~~~~~~~dppppWMMkZzzzwM#zzdMMMMMMMMNMMMM // MMMMMMMMMMMMMM#rrrwRrMMbOrrOZNkrvvvXwvvvvvwX;.~._W_:::::(?!~~~~~~~~(HpppppppHWdvwM#XwdMMMMMMMMMMNMMM // MMMMMMMMMMMMMMNyrrrRrWMMmzOrzdNyrrrZNvrwQWWfb....(r~~_J>_.....~.~~-dpfpffpfpppWHHMNdMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMNrtrStdMMMNxzrzMNmrrrdNWfVfffP._-.(~_J!............JpfpffpfpfffpppWNppppHMMMMMMMMMMMM // MMMMMMMMMMMMMMMMNOtXtdMMMMMNxzZMMNmgHyVVVVVW%..?/(.,(x-..........(HfffpffpffpffWHHffpffppfVyyWMMMMMM // include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; // typedef //------------------------------------------ typedef long long LL; typedef vector<int> VI; typedef vector<bool> VB; typedef vector<char> VC; typedef vector<double> VD; typedef vector<string> VS; typedef vector<LL> VLL; typedef vector<VI> VVI; typedef vector<VB> VVB; typedef vector<VS> VVS; typedef vector<VLL> VVLL; typedef vector<VVI> VVVI; typedef vector<VVLL> VVVLL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<int, string> PIS; typedef pair<string, int> PSI; typedef pair<string, string> PSS; typedef vector<PII> VPII; typedef vector<PLL> VPLL; typedef vector<VPII> VVPII; typedef vector<VPLL> VVPLL; typedef vector<VS> VVS; typedef map<int, int> MII; typedef map<LL, LL> MLL; typedef map<string, int> MSI; typedef map<int, string> MIS; typedef __int128 Lint; //数値・文字列 //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } inline LL toLongLong(string s) { LL v; istringstream sin(s); sin >> v; return v; } Lint toLint(const string s) { Lint ret = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } inline VC toVC(string s) { VC data(s.begin(), s.end()); return data; } vector<string> SPRIT(const string &s, const string &delim) { vector<string> result; string::size_type pos = 0; while (pos != string::npos) { string::size_type p = s.find(delim, pos); if (p == string::npos) { result.push_back(s.substr(pos)); break; } else { result.push_back(s.substr(pos, p - pos)); } pos = p + delim.size(); } return result; } string TRIM(const string &str, const char *trimCharacterList = " \t\v\r\n") { string result; string::size_type left = str.find_first_not_of(trimCharacterList); if (left != string::npos) { string::size_type right = str.find_last_not_of(trimCharacterList); result = str.substr(left, right - left + 1); } return result; } string REPLACE_STRING(const string source, const string find, const string alt) { string result = source; string::size_type pos = 0; while (pos = result.find(find, pos), pos != string::npos) { result.replace(pos, find.length(), alt); pos += alt.length(); } return result; } template <typename T> bool VECTOR_EXISTS(vector<T> vec, T data) { auto itr = std::find(vec.begin(), vec.end(), data); size_t index = distance(vec.begin(), itr); if (index != vec.size()) return true; else return false; } template <typename T> void VECTOR_REMOVE_VALUE_ALL(vector<T> &vec, T data) { vec.erase(remove(vec.begin(), vec.end(), data), vec.end()); } template <typename T> vector<T> VECTOR_REMOVE_VALUE_ALL_FAST(vector<T> vec, T data) { vector<T> vec2; for (auto &x : vec) if (x != data) vec2.push_back(x); return vec2; } bool REG_MATCH(string const &text, regex const &re) { bool result = regex_match(text, re); return result; } bool REG_MATCH(string const &text, smatch &match, regex const &re) { bool result = regex_match(text, match, re); return result; } smatch REG_SEARCH(string const &text, regex const &re) { smatch m; regex_search(text, m, re); return m; } vector<smatch> REG_ALL_SEARCH(string const &text, regex const &re) { vector<smatch> matchs; sregex_iterator iter(text.cbegin(), text.cend(), re); sregex_iterator end; for (; iter != end; iter++) matchs.push_back(*iter); return matchs; } string REG_REPLACE(string const &text, regex const &re, string const &replace) { string result = regex_replace(text, re, replace, regex_constants::format_first_only); return result; } string REG_ALL_REPLACE(string const &text, regex const &re, string const &replace) { string result = regex_replace(text, re, replace); return result; } template <typename T> vector<T> COMPRESS(vector<T> v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); return v; } template <typename T> pair<map<T, int>, map<int, T>> MAPPING(const vector<T> v) { map<T, int> zip; map<int, T> unzip; for (int i = 0; i < v.size(); i++) zip[v[i]] = i; for (int i = 0; i < v.size(); i++) unzip[i] = v[i]; return make_pair(zip, unzip); } template <typename T> vector<pair<T, int>> RUN_LENGTH(const vector<T> &v) { vector<pair<T, int>> ret; int len = v.size(); for (int i = 0, j = 0; i < len; i = j) { while (j < len && v[i] == v[j]) j++; ret.push_back(make_pair(v[i], j - i)); } return ret; } template <typename T, typename U, typename V, typename W> auto operator+(const std::pair<T, U> &l, const std::pair<V, W> &r) -> std::pair<decltype(l.first + r.first), decltype(l.second + r.second)> { return {l.first + r.first, l.second + r.second}; } template <typename T, typename U, typename V, typename W> auto operator-(const std::pair<T, U> &l, const std::pair<V, W> &r) -> std::pair<decltype(l.first - r.first), decltype(l.second - r.second)> { return {l.first - r.first, l.second - r.second}; } ostream &operator<<(ostream &dest, __int128_t value) { ostream::sentry s(dest); if (s) { __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char *d = std::end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = std::end(buffer) - d; if (dest.rdbuf()->sputn(d, len) != len) { dest.setstate(ios_base::badbit); } } return dest; } #define UPPER(s) transform((s).begin(), (s).end(), (s).begin(), ::toupper) #define LOWER(s) transform((s).begin(), (s).end(), (s).begin(), ::tolower) //四捨五入 nLen=小数点第n位にする //------------------------------------------ //切り上げ double ceil_n(double dIn, long long nLen) { double dOut; dOut = dIn * pow(10.0, nLen); dOut = (double)(long long)(dOut + 0.9); return dOut * pow(10.0, -nLen); } //切り捨て double floor_n(double dIn, long long nLen) { double dOut; dOut = dIn * pow(10.0, nLen); dOut = (double)(long long)(dOut); return dOut * pow(10.0, -nLen); } //四捨五入 double round_n(double dIn, long long nLen) { double dOut; dOut = dIn * pow(10.0, nLen); dOut = (double)(long long)(dOut + 0.5); return dOut * pow(10.0, -nLen); } // n桁目の数の取得 int take_a_n(LL num, int n) { string str = toString(num); return str[str.length() - n] - '0'; } int bitcount32(int bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff); } //整数を2進数表記したときの1の個数を返す LL bitcount64(LL bits) { bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555); bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333); bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f); bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff); bits = (bits & 0x0000ffff0000ffff) + (bits >> 16 & 0x0000ffff0000ffff); return (bits & 0x00000000ffffffff) + (bits >> 32 & 0x00000000ffffffff); } // comparison //------------------------------------------ #define C_MAX(a, b) ((a) > (b) ? (a) : (b)) #define C_MIN(a, b) ((a) < (b) ? (a) : (b)) #define C_ABS(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) template <class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true; } return false; } template <class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true; } return false; } // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, arr) \ for (typeof((arr).begin()) i = (arr).begin(); i != (arr).end(); ++i) #define EXIST(str, e) ((str).find(e) != (str).end()) #define COUNT(arr, v) count((arr).begin(), (arr).end(), v) #define SEARCH(v, w) search((v).begin(), (v).end(), (w).begin(), (w).end()) #define B_SEARCH(arr, v) binary_search((arr).begin(), (arr).end(), v) #define SORT(c) sort((c).begin(), (c).end()) #define RSORT(c) sort((c).rbegin(), (c).rend()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ROTATE_LEFT(arr, c) \ rotate((arr).begin(), (arr).begin() + (c), (arr).end()) #define ROTATE_RIGHT(arr, c) \ rotate((arr).rbegin(), (arr).rbegin() + (c), (arr).rend()) #define SUMI(arr) accumulate((arr).begin(), (arr).end(), 0) #define SUMD(arr) accumulate((arr).begin(), (arr).end(), 0.) #define SUMLL(arr) accumulate((arr).begin(), (arr).end(), 0LL) #define SUMS(arr) accumulate((arr).begin(), (arr).end(), string()) #define MULD(arr) \ accumulate((arr).begin(), (arr).end(), 1., multiplies<double>()) #define MULLL(arr) \ accumulate((arr).begin(), (arr).end(), 1LL, multiplies<long long>()) #define UB(arr, n) upper_bound((arr).begin(), (arr).end(), n) #define LB(arr, n) lower_bound((arr).begin(), (arr).end(), n) #define OF_ALL(arr, func) all_of((arr).begin(), (arr).end(), (func)) #define OF_NONE(arr, func) none_of((arr).begin(), (arr).end(), (func)) #define OF_ANY(arr, func) any_of((arr).begin(), (arr).end(), (func)) #define PB push_back #define MP make_pair #define ft first #define sd second // input output //------------------------------------------ #define GL(s) getline(cin, (s)) #define INIT() \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); #define OUT(d) std::cout << (d) #define OUT_L(d) std::cout << (d) << endl #define FOUT(n, data) std::cout << std::fixed << std::setprecision(n) << (data) #define FOUT_L(n, data) \ std::cout << std::fixed << std::setprecision(n) << (data) << "\n" #define EL() printf("\n") #define SHOW_VECTOR(v) \ { \ std::cerr << #v << "\t:"; \ for (const auto &xxx : v) { \ std::cerr << xxx << " "; \ } \ std::cerr << "\n"; \ } #define SHOW_MAP(v) \ { \ std::cerr << #v << endl; \ for (const auto &xxx : v) { \ std::cerr << xxx.first << " " << xxx.second << "\n"; \ } \ } #define Yes() printf("Yes\n") #define No() printf("No\n") #define YES() printf("YES\n") #define NO() printf("NO\n") #define Yay() printf("Yay!\n") #define Nnn() printf(":(\n") template <typename T1, typename T2> istream &operator>>(istream &in, pair<T1, T2> &p) { in >> p.first >> p.second; return in; } template <typename T> istream &operator>>(istream &in, vector<T> &v) { for (auto &x : v) in >> x; return in; } istream &operator>>(istream &in, Lint &d) { string s; cin >> s; Lint tmp = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') tmp = 10 * tmp + s[i] - '0'; d = tmp; return in; } template <typename T1, typename T2> ostream &operator<<(ostream &out, const std::pair<T1, T2> &p) { out << "[" << p.first << ", " << p.second << "]" << "\n"; return out; } // repetition //------------------------------------------ #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define FORLL(i, a, b) for (LL i = LL(a); i < LL(b); ++i) #define RFORLL(i, a, b) for (LL i = LL(b) - 1; i >= LL(a); --i) #define REPLL(i, n) for (LL i = 0; i < LL(n); ++i) #define RREPLL(i, n) for (LL i = LL(n) - 1; i >= 0; --i) #define FOREACH(x, arr) for (auto &(x) : (arr)) #define FORITER(x, arr) for (auto(x) = (arr).begin(); (x) != (arr).end(); ++(x)) // constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; // math //-------------------------------------------- // min <= aim <= max template <typename T> inline bool BETWEEN(const T aim, const T min, const T max) { if (min <= aim && aim <= max) { return true; } else { return false; } } template <typename T1, typename T2> inline bool IS_OUT(const T1 toY, const T1 toX, const T2 H, const T2 W) { return (toY < 0 || toY >= H || toX < 0 || toX >= W); } template <class T> inline T SQR(const T x) { return x * x; } template <class T1, class T2> inline T1 POW(const T1 x, const T2 y) { if (!y) return 1; else if ((y & 1) == 0) { return SQR(POW(x, y >> 1)); } else return POW(x, y ^ 1) * x; } template <typename T> constexpr T ABS(T x) { return x < 0 ? -x : x; } // partial_permutation nPr 順列 // first・・最初の数 // middle・・r(取り出す数) // last・・n(全体数) template <class Iter> bool next_partial_permutation(Iter first, Iter middle, Iter last) { reverse(middle, last); return next_permutation(first, last); } // combination nCr 組み合わせ // first1・・最初の数 // last1==first2・・r(取り出す数) // last2・・n(全体数) template <class Iter> bool next_combination(Iter first1, Iter last1, Iter first2, Iter last2) { if ((first1 == last1) || (first2 == last2)) { return false; } Iter m1 = last1; Iter m2 = last2; --m2; while (--m1 != first1 && !(*m1 < *m2)) { } bool result = (m1 == first1) && !(*first1 < *m2); if (!result) { while (first2 != m2 && !(*m1 < *first2)) { ++first2; } first1 = m1; std::iter_swap(first1, first2); ++first1; ++first2; } if ((first1 != last1) && (first2 != last2)) { m1 = last1; m2 = first2; while ((m1 != first1) && (m2 != last2)) { std::iter_swap(--m1, m2); ++m2; } std::reverse(first1, m1); std::reverse(first1, last1); std::reverse(m2, last2); std::reverse(first2, last2); } return !result; } // numeric_law //-------------------------------------------- template <typename T> constexpr bool ODD(T x) { return x % 2 != 0; } template <typename T> constexpr bool EVEN(T x) { return x % 2 == 0; } //最大公約数 template <class T> inline T GCD(const T x, const T y) { if (x < 0) return GCD(-x, y); if (y < 0) return GCD(x, -y); return (!y) ? x : GCD(y, x % y); } //最小公倍数 template <class T> inline T LCM(const T x, const T y) { if (x < 0) return LCM(-x, y); if (y < 0) return LCM(x, -y); return x * (y / GCD(x, y)); } // ax + by = gcd(a, b) // x,yが変数に格納される template <class T> inline T EXTGCD(const T a, const T b, T &x, T &y) { if (a < 0) { T d = EXTGCD(-a, b, x, y); x = -x; return d; } if (b < 0) { T d = EXTGCD(a, -b, x, y); y = -y; return d; } if (!b) { x = 1; y = 0; return a; } else { T d = EXTGCD(b, a % b, x, y); T t = x; x = y; y = t - (a / b) * y; return d; } } // mの世界でのaの逆元 // gce(a, m) = 1 template <class T> inline T INV_MOD(const T a, const T m) { T x, y; EXTGCD(a, m, x, y); return (x + m) % m; } template <class T> inline bool ISPRIME(const T x) { if (x <= 1) return false; for (T i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } template <class T> VB ERATOSTHENES(const T n) { VB arr(n + 1, true); arr[0] = arr[1] = false; for (T i = 2; i * i <= n; i++) { if (arr[i]) { for (T j = i * 2LL; j <= n; j += i) { arr[j] = false; } } } return arr; } // a <= x < b の素数を返す template <typename T> VB ERATOSTHENES(const T a, const T b) { VB small = ERATOSTHENES(b); VB prime(b - a, true); for (T i = 2; i * i <= b; i++) { if (small[i]) { for (T j = max(2LL, (a + i - 1) / i) * i; j < b; j += i) { prime[j - a] = false; } } } return prime; } // nの約数 template <typename T> vector<T> DIVISOR(T n) { vector<T> v; for (T i = 1; i * i <= n; ++i) { if (n % i == 0) { v.push_back(i); if (i != n / i) { v.push_back(n / i); } } } sort(v.begin(), v.end()); return v; } // nまでのすべての約数 template <typename T> vector<vector<T>> DIVISOR_ALL(T n) { vector<vector<T>> res(n + 1); for (T i = 1; i <= n; i++) { for (T j = i; j <= n; j += i) { res[j].push_back(i); } } return res; } template <typename T> vector<pair<T, T>> FACTORIZATION(T x) { vector<pair<T, LL>> ans; for (T i = 2; i * i <= x; i++) { if (x % i == 0) { T count = 0; while (x % i == 0) { count++; x /= i; } ans.push_back(MP(i, count)); } } if (x != 1) ans.push_back(MP(x, 1)); return ans; } LL POW_MOD(LL N, LL P, LL M) { LL ret = 1; while (P > 0) { if (P & 1LL) ret = (ret * N) % M; N = (N * N) % M; P >>= 1LL; } return ret; } template <typename T> inline T NCR(T n, T r) { if (r > n - r) r = n - r; T ans = 1LL; for (T i = 0; i < r; i++) { ans = ans * (n - i) / (i + 1); } return ans; } LL NCR_MOD(LL n, LL r, LL M) { if (r > n - r) return NCR_MOD(n, n - r, M); LL numerator = 1LL; //分子 LL denominator = 1LL; //分母 for (LL i = 0; i < r; i++) { numerator *= (n - i); numerator %= M; denominator *= (i + 1); denominator %= M; } return numerator * POW_MOD(denominator, M - 2, M) % M; } // confirmation //-------------------------------------------- // clear memory #define CLR(arr, d) memset((arr), (d), sizeof(arr)) // debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << endl; // 2019-04-14 //~~~~~~~~~~~~~~~~~~~~~_(^~^ 」 ∠)_~~~~~~~~~~~~~~~~~~~~~ constexpr LL mod = 1e9 + 7; int main() { string S; cin >> S; string T = S; REVERSE(T); vector<LL> dp(13, 0); dp[0] = 1; LL base = 1; for (LL i = 0; i < T.size(); i++) { vector<LL> next(13, 0); if (T[i] != '?') { LL k = T[i] - '0'; LL d = (k * base) % 13; for (LL j = 0; j < 13; j++) { next[(j + d) % 13] += dp[j]; next[(j + d) % 13] %= mod; } } else { for (LL k = 0; k <= 9; k++) { for (LL j = 0; j < 13; j++) { LL d = (k * base) % 13; next[(j + d) % 13] += dp[j]; next[(j + d) % 13] %= mod; } } } dp = next; base *= 10; base %= 13; } cout << dp[5] % mod << endl; return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,653
769,654
u259053514
cpp
p02960
#include <bits/stdc++.h> using namespace std; const long long md = 1e9 + 7; string s; long long n; vector<long long> dp(13); int main() { cin >> s; dp[0] = 1; for (int i = 0; i < s.size(); i++) { vector<long long> d_n(13); for (int j = 0; j <= 9; j++) { if (s[i] == '?' || s[i] - '0' == j) { for (int k = 0; k < 13; k++) { d_n[(k * 10 + j) % 13] += dp[k] % md; } } } dp = d_n; } cout << dp[5]; return 0; }
#include <bits/stdc++.h> using namespace std; const long long md = 1e9 + 7; string s; long long n; vector<long long> dp(13); int main() { cin >> s; dp[0] = 1; for (int i = 0; i < s.size(); i++) { vector<long long> d_n(13); for (int j = 0; j <= 9; j++) { if (s[i] == '?' || s[i] - '0' == j) { for (int k = 0; k < 13; k++) { d_n[(k * 10 + j) % 13] += dp[k] % md; } } } dp = d_n; } cout << dp[5] % md; return 0; }
[ "expression.operation.binary.add" ]
769,657
769,658
u201808715
cpp
p02960
#include <algorithm> #include <iostream> #include <string> #include <vector> #define ll long long using namespace std; ll R_list[100000][10]; int MOD = 1000000007; void print_array(ll *arr, int n) { for (int i = 0; i < n; i++) { cout << arr[i] << ' '; } cout << endl; } int main() { string S; // vector<int> Q_digit; // Initial Setup int digit_val = 1; for (int i = 0; i < 100000; i++) { for (int j = 0; j < 10; j++) { R_list[i][j] = (j * digit_val) % 13; } digit_val = (digit_val * 10) % 13; } getline(cin, S); reverse(S.begin(), S.end()); // cout << S << endl; int r_sum = 0; ll count_r1[13]; ll count_r2[13]; for (int i = 0; i < 13; i++) { count_r1[i] = 0; count_r2[i] = 0; } count_r1[0] = 1; bool entered = false; for (int i = 0; i < S.length(); i++) { if (S[i] == '?') { if (!entered) { for (int j = 0; j < 10; j++) { count_r1[R_list[i][j]] = 1; } } else { for (int j = 0; j < 10; j++) { for (int k = 0; k < 13; k++) { count_r2[((R_list[i][j] + k + 13) % 13)] += count_r1[k]; } // print_array(count_r2, 13); } for (int k = 0; k < 13; k++) { count_r1[k] = count_r2[k]; count_r2[k] = 0; } } // print_array(count_r1, 13); // print_array(R_list[i], 10); entered = true; } else { r_sum += R_list[i][(int)(S[i] - '0')]; // cout << R_list[i][(int)(S[i] - '0')] << endl; } } r_sum %= 13; // cout << r_sum << endl; cout << count_r1[(18 - r_sum) % 13] << endl; return 0; }
#include <algorithm> #include <iostream> #include <string> #include <vector> #define ll long long using namespace std; ll R_list[100000][10]; int MOD = 1000000007; void print_array(ll *arr, int n) { for (int i = 0; i < n; i++) { cout << arr[i] << ' '; } cout << endl; } int main() { string S; // vector<int> Q_digit; // Initial Setup int digit_val = 1; for (int i = 0; i < 100000; i++) { for (int j = 0; j < 10; j++) { R_list[i][j] = (j * digit_val) % 13; } digit_val = (digit_val * 10) % 13; } getline(cin, S); reverse(S.begin(), S.end()); // cout << S << endl; int r_sum = 0; ll count_r1[13]; ll count_r2[13]; for (int i = 0; i < 13; i++) { count_r1[i] = 0; count_r2[i] = 0; } count_r1[0] = 1; bool entered = false; for (int i = 0; i < S.length(); i++) { if (S[i] == '?') { if (!entered) { for (int j = 0; j < 10; j++) { count_r1[R_list[i][j]] = 1; } } else { for (int j = 0; j < 10; j++) { for (int k = 0; k < 13; k++) { count_r2[((R_list[i][j] + k + 13) % 13)] += count_r1[k]; } // print_array(count_r2, 13); } for (int k = 0; k < 13; k++) { count_r1[k] = count_r2[k] % MOD; count_r2[k] = 0; } } // print_array(count_r1, 13); // print_array(R_list[i], 10); entered = true; } else { r_sum += R_list[i][(int)(S[i] - '0')]; // cout << R_list[i][(int)(S[i] - '0')] << endl; } } r_sum %= 13; // cout << r_sum << endl; cout << count_r1[(18 - r_sum) % 13] << endl; return 0; }
[ "assignment.change" ]
769,659
769,660
u033407970
cpp
p02960
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <locale> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <vector> using namespace std; #define FORN(i, m, n) for (int i = m; i < (n); i++) #define PRINTVEC(v) \ FORN(i, 0, v.size()) cout << v[i] << " "; \ cout << endl #define PRINTMAT(m) \ FORN(j, 0, m.size()) { PRINTVEC(m[j]); } #define p_b(x) push_back(x) #define m_p(a, b) make_pair(a, b) typedef long long ll; vector<vector<ll>> dp; vector<ll> dig; string s; int N; const ll M = 1e9 + 7; ll solve(ll pos, ll mod) { if (pos == N) { if (mod == 5) return 1; else return 0; } if (dp[pos][mod] != -1) return dp[pos][mod]; ll ans = 0; if (s[pos] != '?') { ans += solve(pos + 1, (mod + ((s[pos] - '0') * dig[pos])) % 13); } else { FORN(i, 0, 10) { ll newmod = (mod + (i * dig[pos])) % 13; ans += solve(pos + 1, newmod); ans %= M; } } ans %= M; dp[pos][mod] = ans; return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> s; N = s.size(); dp = vector<vector<ll>>(N, vector<ll>(13, -1)); dig = vector<ll>(N); dig[N - 1] = 1; for (int i = N - 2; i >= 0; i--) dig[i] = (dig[i + 1] * 10) % M; ll ans = solve(0, 0); cout << ans << endl; }
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <locale> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <vector> using namespace std; #define FORN(i, m, n) for (int i = m; i < (n); i++) #define PRINTVEC(v) \ FORN(i, 0, v.size()) cout << v[i] << " "; \ cout << endl #define PRINTMAT(m) \ FORN(j, 0, m.size()) { PRINTVEC(m[j]); } #define p_b(x) push_back(x) #define m_p(a, b) make_pair(a, b) typedef long long ll; vector<vector<ll>> dp; vector<ll> dig; string s; int N; const ll M = 1e9 + 7; ll solve(ll pos, ll mod) { if (pos == N) { if (mod == 5) return 1; else return 0; } if (dp[pos][mod] != -1) return dp[pos][mod]; ll ans = 0; if (s[pos] != '?') { ans += solve(pos + 1, (mod + ((s[pos] - '0') * dig[pos])) % 13); } else { FORN(i, 0, 10) { ll newmod = (mod + (i * dig[pos])) % 13; ans += solve(pos + 1, newmod); ans %= M; } } ans %= M; dp[pos][mod] = ans; return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> s; N = s.size(); dp = vector<vector<ll>>(N, vector<ll>(13, -1)); dig = vector<ll>(N); dig[N - 1] = 1; for (int i = N - 2; i >= 0; i--) dig[i] = (dig[i + 1] * 10) % 13; ll ans = solve(0, 0); cout << ans << endl; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "expression.operation.binary.change" ]
769,694
769,695
u585776323
cpp
p02960
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define fo(i, a, b, k) for (int i = a; i <= b; i += k) #define _fo(i, a, b, k) for (int i = a; i >= b; i -= k) #define foa(i, a) for (auto &i : a) #define fod(i, a) for (int i = 1; i * i <= a; i++) #define sz(a) ((int)a.size()) #define all(a) begin(a), end(a) #define fi first #define se second #define pb(x) push_back(x) #define mk(x, y) make_pair(x, y) #define log2i(x) (31 - __builtin_clz(x)) #define log2ll(x) (63 - __builtin_clzll(x)) #define msz(x) __builtin_popcount(x) #define mszll(x) __builtin_popcountll(x) #define fom(i, a, b) for (int i = a; i < (1 << b); i++) #define ifon(i, mask) if (mask & (1 << i)) #define ss(i, mask) while (i = (i - mask) & mask) #define ifss(i, mask) if (i > (mask ^ i)) typedef int64_t ll; const int S = 1e5 + 1; const int MOD = 1e9 + 7; int l; string s; ll total[S][13]; ll solve(int p, int re) { if (p == l) { if (re == 5) return 1; return 0; } if (total[p][re] != -1) return total[p][re]; ll curr; if (s[p] == '?') fo(i, 0, 9, 1) curr = (curr + solve(p + 1, (re * 10 + i) % 13)) % MOD; else { int temp = s[p] - '0'; curr = solve(p + 1, (re * 10 + temp) % 13) % MOD; } total[p][re] = curr; return curr; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); memset(total, -1, sizeof(total)); cin >> s; l = sz(s); cout << solve(0, 0); }
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define fo(i, a, b, k) for (int i = a; i <= b; i += k) #define _fo(i, a, b, k) for (int i = a; i >= b; i -= k) #define foa(i, a) for (auto &i : a) #define fod(i, a) for (int i = 1; i * i <= a; i++) #define sz(a) ((int)a.size()) #define all(a) begin(a), end(a) #define fi first #define se second #define pb(x) push_back(x) #define mk(x, y) make_pair(x, y) #define log2i(x) (31 - __builtin_clz(x)) #define log2ll(x) (63 - __builtin_clzll(x)) #define msz(x) __builtin_popcount(x) #define mszll(x) __builtin_popcountll(x) #define fom(i, a, b) for (int i = a; i < (1 << b); i++) #define ifon(i, mask) if (mask & (1 << i)) #define ss(i, mask) while (i = (i - mask) & mask) #define ifss(i, mask) if (i > (mask ^ i)) typedef int64_t ll; const int S = 1e5 + 1; const int MOD = 1e9 + 7; int l; string s; ll total[S][13]; ll solve(int p, int re) { if (p == l) { if (re == 5) return 1; return 0; } if (total[p][re] != -1) return total[p][re]; ll curr = 0; if (s[p] == '?') fo(i, 0, 9, 1) curr = (curr + solve(p + 1, (re * 10 + i) % 13)) % MOD; else { int temp = s[p] - '0'; curr = solve(p + 1, (re * 10 + temp) % 13) % MOD; } total[p][re] = curr; return curr; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); memset(total, -1, sizeof(total)); cin >> s; l = sz(s); cout << solve(0, 0); }
[ "variable_declaration.value.change" ]
769,696
769,697
u183131551
cpp
p02960
#include <bits/stdc++.h> #define ll long long #define PB push_back #define MP make_pair #define pri 1000000007 #define ff first #define ss second #define all(x) x.begin(), x.end() using namespace std; ll ass[13] = {0}; ll dp[13][13][100001]; ll findo(ll cur, ll pre, ll prec) { ll ans = 0; if (pre == 13) return cur == 0; if (dp[cur][pre][prec] != -1) return dp[cur][pre][prec]; if (ass[pre] == 0) { ans += findo(cur, pre + 1, 0); ans %= pri; } else { for (ll i = 0; i <= 9; i++) { if (prec == ass[pre] - 1) ans += findo((cur + i * pre) % 13, pre + 1, 0); else ans += findo((cur + i * pre) % 13, pre, prec + 1); ans %= pri; } } return dp[cur][pre][prec] = ans; } void run() { string a; cin >> a; ll n = a.length(); reverse(all(a)); ll pre = 5; for (ll i = 0; i < 13; i++) { for (ll j = 0; j < 13; j++) { for (ll k = 0; k < 100001; k++) dp[i][j][k] = -1; } } ll c = 1; for (ll i = 0; i < n; i++) { if (a[i] == '?') ass[c]++; else pre = (pre + c * (a[i] - '0')) % 13; c = (c * 10) % 13; } // for(ll i=0;i<13;i++)cout<<ass[i]<<endl; // cout<<pre<<endl; cout << findo(pre, 0, 0); } int main() { ll t = 1; // cin>>t; for (ll i = 0; i < t; i++) run(); // your code goes here return 0; }
#include <bits/stdc++.h> #define ll long long #define PB push_back #define MP make_pair #define pri 1000000007 #define ff first #define ss second #define all(x) x.begin(), x.end() using namespace std; ll ass[13] = {0}; ll dp[13][13][100001]; ll findo(ll cur, ll pre, ll prec) { ll ans = 0; if (pre == 13) return cur == 5; if (dp[cur][pre][prec] != -1) return dp[cur][pre][prec]; if (ass[pre] == 0) { ans += findo(cur, pre + 1, 0); ans %= pri; } else { for (ll i = 0; i <= 9; i++) { if (prec == ass[pre] - 1) ans += findo((cur + i * pre) % 13, pre + 1, 0); else ans += findo((cur + i * pre) % 13, pre, prec + 1); ans %= pri; } } return dp[cur][pre][prec] = ans; } void run() { string a; cin >> a; ll n = a.length(); reverse(all(a)); ll pre = 0; for (ll i = 0; i < 13; i++) { for (ll j = 0; j < 13; j++) { for (ll k = 0; k < 100001; k++) dp[i][j][k] = -1; } } ll c = 1; for (ll i = 0; i < n; i++) { if (a[i] == '?') ass[c]++; else pre = (pre + c * (a[i] - '0')) % 13; c = (c * 10) % 13; } // for(ll i=0;i<13;i++)cout<<ass[i]<<endl; // cout<<pre<<endl; cout << findo(pre, 0, 0); } int main() { ll t = 1; // cin>>t; for (ll i = 0; i < t; i++) run(); // your code goes here return 0; }
[ "literal.number.change", "function.return_value.change", "expression.operation.binary.change", "variable_declaration.value.change" ]
769,701
769,702
u874786170
cpp
p02960
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define fi first #define se second #define mp make_pair #define itrfor(itr, A) for (auto itr = A.begin(); itr != A.end(); itr++) template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T>>; typedef long long llong; char moji[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; char moji2[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; char moji3[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; #define Sort(a) sort(a.begin(), a.end()); #define Reverse(a) reverse(a.begin(), a.end()); #define print(a) cout << a << endl; #define MOD llong(1e9 + 7) #define MAX int(2 * 1e5 + 5) #define debug(x) cout << #x << " = " << (x) << endl; #define pi acos(-1.0) #define int llong #define INF llong(1e17) void myprint(int *A, int A_num) { REP(i, A_num) cout << A[i] << " "; cout << endl; } signed main() { string s; cin >> s; int n = s.size(); int dp[n + 1][13]; REP(j, n + 1) REP(i, 13) dp[j][i] = 0; dp[0][0] = 1; int beki = 1; FOR(i, 1, n + 1) { if (s[n - i] != '?') { int tmp = s[n - i] - '0'; // debug(tmp); tmp *= beki; tmp %= 13; REP(j, 13) { dp[i][(j + tmp) % 13] += dp[i - 1][j]; dp[i][(j + tmp) % 13] %= MOD; } } else { REP(k, 10) { int tmp = int(k); tmp *= beki; tmp %= 13; REP(j, 13) { dp[i][(j + tmp) % 13] += dp[i - 1][j]; dp[i][(j + tmp) % 13] %= MOD; } } } beki *= 10; beki %= MOD; } cout << dp[n][5] << endl; }
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define fi first #define se second #define mp make_pair #define itrfor(itr, A) for (auto itr = A.begin(); itr != A.end(); itr++) template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T>>; typedef long long llong; char moji[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; char moji2[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; char moji3[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; #define Sort(a) sort(a.begin(), a.end()); #define Reverse(a) reverse(a.begin(), a.end()); #define print(a) cout << a << endl; #define MOD llong(1e9 + 7) #define MAX int(2 * 1e5 + 5) #define debug(x) cout << #x << " = " << (x) << endl; #define pi acos(-1.0) #define int llong #define INF llong(1e17) void myprint(int *A, int A_num) { REP(i, A_num) cout << A[i] << " "; cout << endl; } signed main() { string s; cin >> s; int n = s.size(); int dp[n + 1][13]; REP(j, n + 1) REP(i, 13) dp[j][i] = 0; dp[0][0] = 1; int beki = 1; FOR(i, 1, n + 1) { if (s[n - i] != '?') { int tmp = s[n - i] - '0'; // debug(tmp); tmp *= beki; tmp %= 13; REP(j, 13) { dp[i][(j + tmp) % 13] += dp[i - 1][j]; dp[i][(j + tmp) % 13] %= MOD; } } else { REP(k, 10) { int tmp = int(k); tmp *= beki; tmp %= 13; REP(j, 13) { dp[i][(j + tmp) % 13] += dp[i - 1][j]; dp[i][(j + tmp) % 13] %= MOD; } } } beki *= 10; beki %= 13; } cout << dp[n][5] << endl; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,703
769,704
u920299620
cpp
p02960
#include <iostream> #include <string> #include <vector> using namespace std; long long MOD = 1000000007; int main() { string S; cin >> S; vector<long long> count(13, 0LL); count[0] = 1LL; for (auto c : S) { vector<long long> nextgen(13, 0LL); for (int digit = 0; digit < 10; digit++) { if (c == '?' || c == digit + '0') for (int i = 0; i < 13; i++) { int next = (i * 10 + digit) / 13; nextgen[next] += count[i]; nextgen[next] %= MOD; } } count = nextgen; } cout << count[5] << endl; }
#include <iostream> #include <string> #include <vector> using namespace std; long long MOD = 1000000007; int main() { string S; cin >> S; vector<long long> count(13, 0LL); count[0] = 1LL; for (auto c : S) { vector<long long> nextgen(13, 0LL); for (int digit = 0; digit < 10; digit++) { if (c == '?' || c == digit + '0') for (int i = 0; i < 13; i++) { int next = (i * 10 + digit) % 13; nextgen[next] += count[i]; nextgen[next] %= MOD; } } count = nextgen; } cout << count[5] << endl; }
[ "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
769,705
769,706
u489359960
cpp
p02960
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << ": " << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cerr.write(names, comma - names) << ": " << arg1 << " |"; __f(comma + 1, args...); } typedef long long int64; typedef pair<int, int> ii; const int INF = 1 << 29; const int MOD = 1e9 + 7; const int N = 1e5 + 10; const int M = 13; char s[N]; int dp[N][M]; void add(int &x, int y) { x += y; if (x >= MOD) x -= y; } int main() { scanf("%s", s); int n = strlen(s); // trace(n); dp[0][0] = 1; for (int i = 0; i < n; ++i) { if (s[i] != '?') { int x = s[i] - '0'; for (int j = 0; j < M; ++j) { add(dp[i + 1][(j * 10 + x) % M], dp[i][j]); } } else { for (int j = 0; j < M; ++j) { for (int k = 0; k < 10; ++k) { add(dp[i + 1][(j * 10 + k) % M], dp[i][j]); } } } } printf("%d\n", dp[n][5]); return 0; }
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << ": " << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cerr.write(names, comma - names) << ": " << arg1 << " |"; __f(comma + 1, args...); } typedef long long int64; typedef pair<int, int> ii; const int INF = 1 << 29; const int MOD = 1e9 + 7; const int N = 1e5 + 10; const int M = 13; char s[N]; int dp[N][M]; void add(int &x, int y) { x += y; if (x >= MOD) x -= MOD; } int main() { scanf("%s", s); int n = strlen(s); // trace(n); dp[0][0] = 1; for (int i = 0; i < n; ++i) { if (s[i] != '?') { int x = s[i] - '0'; for (int j = 0; j < M; ++j) { add(dp[i + 1][(j * 10 + x) % M], dp[i][j]); } } else { for (int j = 0; j < M; ++j) { for (int k = 0; k < 10; ++k) { add(dp[i + 1][(j * 10 + k) % M], dp[i][j]); } } } // for (int j = 0; j < M; ++j) { // trace(i + 1, j, dp[i + 1][j]); // } } printf("%d\n", dp[n][5]); return 0; }
[ "assignment.value.change", "identifier.change" ]
769,709
769,710
u112723190
cpp
p02960
#include <bits/stdc++.h> using namespace std; const long long r = 1e9 + 7; long long d[100001][13]; int main() { string str; cin >> str; str += '!'; reverse(str.begin(), str.end()); d[0][0] = 1; long long p = 1; for (int i = 1; i < str.length(); ++i) { if (str[i] != '?') for (int j = 0; j < 13; ++j) { d[i][(j + p * (str[i] - '0')) % 13] += d[i - 1][j]; d[i][(j + p * (str[i] - '0')) % 13] %= r; } else for (int j = 0; j < 13; ++j) for (int k = 0; k < 10; ++k) { d[i][(j + p * k) % 13] += d[i - 1][j]; d[i][(j + p * k) % 13] %= r; } p = p * 10 % r; } printf("%lld", d[str.length() - 1][5]); return 0; }
#include <bits/stdc++.h> using namespace std; const long long r = 1e9 + 7; long long d[100001][13]; int main() { string str; cin >> str; str += '!'; reverse(str.begin(), str.end()); d[0][0] = 1; long long p = 1; for (int i = 1; i < str.length(); ++i) { if (str[i] != '?') for (int j = 0; j < 13; ++j) { d[i][(j + p * (str[i] - '0')) % 13] += d[i - 1][j]; d[i][(j + p * (str[i] - '0')) % 13] %= r; } else for (int j = 0; j < 13; ++j) for (int k = 0; k < 10; ++k) { d[i][(j + p * k) % 13] += d[i - 1][j]; d[i][(j + p * k) % 13] %= r; } p = p * 10 % 13; } printf("%lld", d[str.length() - 1][5]); return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "expression.operation.binary.change" ]
769,713
769,714
u833150144
cpp
p02960
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define int long long bool codejam = 0; typedef long long li; typedef long double ld; void solve(); int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int t = 1; // cin >> t; int tt = t; while (t--) { if (codejam) cout << "Case #" << tt - t << ": "; solve(); } return 0; } int cnt[13] = {0}; int ncnt[13]; const int N = 1e5 + 55; const int M = 1e9 + 7; int pw[N]; void solve() { pw[0] = 1; for (int i = 1; i < N; ++i) pw[i] = (pw[i - 1] * 10) % M; string s; cin >> s; cnt[0] = 1; reverse(s.begin(), s.end()); for (int i = 0; i < (int)s.size(); ++i) { for (int j = 0; j < 13; ++j) ncnt[j] = 0; for (int old_rem = 0; old_rem < 13; ++old_rem) { for (int new_dig = 0; new_dig < 10; ++new_dig) { if (s[i] != '?' and new_dig != (s[i] - '0')) continue; int new_rem = old_rem + pw[i] * new_dig; new_rem %= 13; ncnt[new_rem] += cnt[old_rem]; ncnt[new_rem] %= M; } } for (int j = 0; j < 13; ++j) cnt[j] = ncnt[j]; } cout << cnt[5]; }
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define int long long bool codejam = 0; typedef long long li; typedef long double ld; void solve(); int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int t = 1; // cin >> t; int tt = t; while (t--) { if (codejam) cout << "Case #" << tt - t << ": "; solve(); } return 0; } int cnt[13] = {0}; int ncnt[13]; const int N = 1e5 + 55; const int M = 1e9 + 7; int pw[N]; void solve() { pw[0] = 1; for (int i = 1; i < N; ++i) pw[i] = (pw[i - 1] * 10) % 13; string s; cin >> s; cnt[0] = 1; reverse(s.begin(), s.end()); for (int i = 0; i < (int)s.size(); ++i) { for (int j = 0; j < 13; ++j) ncnt[j] = 0; for (int old_rem = 0; old_rem < 13; ++old_rem) { for (int new_dig = 0; new_dig < 10; ++new_dig) { if (s[i] != '?' and new_dig != (s[i] - '0')) continue; int new_rem = old_rem + pw[i] * new_dig; new_rem %= 13; ncnt[new_rem] += cnt[old_rem]; ncnt[new_rem] %= M; } } for (int j = 0; j < 13; ++j) cnt[j] = ncnt[j]; } cout << cnt[5]; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "expression.operation.binary.change" ]
769,715
769,716
u345794450
cpp
p02960
#include <algorithm> #include <iostream> using namespace std; #define MOD 1000000007 int md[100000], dp[100000][13]; int cnt = 0, idx, idx2; int main() { string s, x; cin >> s; //前処理 md[0] = 1; //[0]は1桁目 for (int i = 1; i < s.size(); i++) { md[i] = (md[i - 1] * 10) % 13; } // if (s[0] == '?') { idx = md[s.size() - 1]; for (int j = 0; j < 10; j++) { idx2 = idx * j; idx2 %= 13; dp[0][idx2]++; } } else { idx2 = md[s.size() - 1] * (s[0] - '0'); idx2 %= 13; dp[0][idx2]++; } for (int i = 1; i < s.size(); i++) { if (s[i] == '?') { idx = md[s.size() - i - 1]; for (int j = 0; j < 10; j++) { idx2 = idx * j; idx2 %= 13; for (int k = 0; k < 13; k++) { dp[i][(k + idx2) % 13] += dp[i - 1][k]; dp[i][(k + idx2) % 13] %= MOD; } } } else { idx2 = md[s.size() - i - 1] * (s[0] - '0'); idx2 %= 13; for (int k = 0; k < 13; k++) { dp[i][(k + idx2) % 13] += dp[i - 1][k]; dp[i][(k + idx2) % 13] %= MOD; } } } cout << dp[s.size() - 1][5] << endl; }
#include <algorithm> #include <iostream> using namespace std; #define MOD 1000000007 #define int long int md[100000], dp[100000][13]; int cnt = 0, idx, idx2; signed main() { string s, x; cin >> s; //前処理 md[0] = 1; //[0]は1桁目 for (int i = 1; i < s.size(); i++) { md[i] = (md[i - 1] * 10) % 13; } // if (s[0] == '?') { idx = md[s.size() - 1]; for (int j = 0; j < 10; j++) { idx2 = idx * j; idx2 %= 13; dp[0][idx2]++; } } else { idx2 = md[s.size() - 1] * (s[0] - '0'); idx2 %= 13; dp[0][idx2]++; } for (int i = 1; i < s.size(); i++) { if (s[i] == '?') { idx = md[s.size() - i - 1]; for (int j = 0; j < 10; j++) { idx2 = idx * j; idx2 %= 13; for (int k = 0; k < 13; k++) { dp[i][(k + idx2) % 13] += dp[i - 1][k]; dp[i][(k + idx2) % 13] %= MOD; } } } else { idx2 = md[s.size() - i - 1] * (s[i] - '0'); idx2 %= 13; for (int k = 0; k < 13; k++) { dp[i][(k + idx2) % 13] += dp[i - 1][k]; dp[i][(k + idx2) % 13] %= MOD; } } } cout << dp[s.size() - 1][5] << endl; }
[ "variable_declaration.type.primitive.change", "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
769,730
769,731
u610385881
cpp
p02960
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using namespace placeholders; using LL = long long; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<vector<int>>; using VS = vector<string>; using ISS = istringstream; using OSS = ostringstream; using PII = pair<int, int>; using VPII = vector<pair<int, int>>; template <typename T = int> using VT = vector<T>; template <typename T = int> using VVT = vector<vector<T>>; template <typename T = int> using LIM = numeric_limits<T>; template <typename T> inline istream &operator>>(istream &s, vector<T> &v) { for (T &t : v) { s >> t; } return s; } template <typename T> inline ostream &operator<<(ostream &s, const vector<T> &v) { for (int i = 0; i < int(v.size()); ++i) { s << (" " + !i) << v[i]; } return s; } void in_impl(){}; template <typename T, typename... TS> void in_impl(T &head, TS &...tail) { cin >> head; in_impl(tail...); } #define IN(T, ...) \ T __VA_ARGS__; \ in_impl(__VA_ARGS__); template <typename T> struct getv_fmt; template <> struct getv_fmt<int> { static constexpr const char *fmt = "%d"; }; template <> struct getv_fmt<long long> { static constexpr const char *fmt = "%lld"; }; template <typename T> void getv(std::vector<T> &v) { for_each(begin(v), end(v), [](T &a) { scanf(getv_fmt<T>::fmt, &a); }); }; template <typename T> inline T fromString(const string &s) { T res; istringstream iss(s); iss >> res; return res; } template <typename T> inline string toString(const T &a) { ostringstream oss; oss << a; return oss.str(); } #define NUMBERED(name, number) NUMBERED2(name, number) #define NUMBERED2(name, number) name##_##number #define REP1(n) REP2(NUMBERED(REP_COUNTER, __LINE__), n) #define REP2(i, n) REP3(i, 0, n) #define REP3(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define GET_REP(a, b, c, F, ...) F #define REP(...) GET_REP(__VA_ARGS__, REP3, REP2, REP1)(__VA_ARGS__) #define FOR(e, c) for (auto &&e : c) #define ALL(c) begin(c), end(c) #define AALL(a) \ (remove_all_extents<decltype(a)>::type *)a, \ (remove_all_extents<decltype(a)>::type *)a + \ sizeof(a) / sizeof(remove_all_extents<decltype(a)>::type) #define DRANGE(c, p) begin(c), begin(c) + (p), end(c) #define SZ(v) ((int)(v).size()) #define EXIST(c, e) ((c).find(e) != (c).end()) template <typename T> inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } template <typename T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } #define PB push_back #define EM emplace #define EB emplace_back #define BI back_inserter #define MP make_pair #define fst first #define snd second #define DUMP(x) cerr << #x << " = " << (x) << endl constexpr int MOD = 1'000'000'007; int main() { cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(12) << fixed; IN(string, S); const int L = SZ(S); static int dp[1 << 17][16]; dp[0][0] = 1; REP(i, L) { const char ch = S[i]; REP(j, 13) { REP(k, 10) { if (ch == '?' && k == ch - '0') { continue; } (dp[i + 1][(j * 10 + k) % 13] += dp[i][j]) %= MOD; } } } cout << dp[L][5] << endl; return 0; }
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using namespace placeholders; using LL = long long; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<vector<int>>; using VS = vector<string>; using ISS = istringstream; using OSS = ostringstream; using PII = pair<int, int>; using VPII = vector<pair<int, int>>; template <typename T = int> using VT = vector<T>; template <typename T = int> using VVT = vector<vector<T>>; template <typename T = int> using LIM = numeric_limits<T>; template <typename T> inline istream &operator>>(istream &s, vector<T> &v) { for (T &t : v) { s >> t; } return s; } template <typename T> inline ostream &operator<<(ostream &s, const vector<T> &v) { for (int i = 0; i < int(v.size()); ++i) { s << (" " + !i) << v[i]; } return s; } void in_impl(){}; template <typename T, typename... TS> void in_impl(T &head, TS &...tail) { cin >> head; in_impl(tail...); } #define IN(T, ...) \ T __VA_ARGS__; \ in_impl(__VA_ARGS__); template <typename T> struct getv_fmt; template <> struct getv_fmt<int> { static constexpr const char *fmt = "%d"; }; template <> struct getv_fmt<long long> { static constexpr const char *fmt = "%lld"; }; template <typename T> void getv(std::vector<T> &v) { for_each(begin(v), end(v), [](T &a) { scanf(getv_fmt<T>::fmt, &a); }); }; template <typename T> inline T fromString(const string &s) { T res; istringstream iss(s); iss >> res; return res; } template <typename T> inline string toString(const T &a) { ostringstream oss; oss << a; return oss.str(); } #define NUMBERED(name, number) NUMBERED2(name, number) #define NUMBERED2(name, number) name##_##number #define REP1(n) REP2(NUMBERED(REP_COUNTER, __LINE__), n) #define REP2(i, n) REP3(i, 0, n) #define REP3(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define GET_REP(a, b, c, F, ...) F #define REP(...) GET_REP(__VA_ARGS__, REP3, REP2, REP1)(__VA_ARGS__) #define FOR(e, c) for (auto &&e : c) #define ALL(c) begin(c), end(c) #define AALL(a) \ (remove_all_extents<decltype(a)>::type *)a, \ (remove_all_extents<decltype(a)>::type *)a + \ sizeof(a) / sizeof(remove_all_extents<decltype(a)>::type) #define DRANGE(c, p) begin(c), begin(c) + (p), end(c) #define SZ(v) ((int)(v).size()) #define EXIST(c, e) ((c).find(e) != (c).end()) template <typename T> inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } template <typename T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } #define PB push_back #define EM emplace #define EB emplace_back #define BI back_inserter #define MP make_pair #define fst first #define snd second #define DUMP(x) cerr << #x << " = " << (x) << endl constexpr int MOD = 1'000'000'007; int main() { cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(12) << fixed; IN(string, S); const int L = SZ(S); static int dp[1 << 17][16]; dp[0][0] = 1; REP(i, L) { const char ch = S[i]; REP(j, 13) { REP(k, 10) { if (ch != '?' && k != ch - '0') { continue; } (dp[i + 1][(j * 10 + k) % 13] += dp[i][j]) %= MOD; } } } cout << dp[L][5] << endl; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
769,738
769,739
u938924220
cpp
p02960
#include <cstring> #include <iostream> using namespace std; int a[] = {1, 10, 9, 12, 3, 4}, mod = 1e9 + 7, pw[100000]; long long dp[100000][13]; string s; int sol(int p, int md) { if (p == s.size() && md == 5) return 1; if (p == s.size()) return 0; if (dp[p][md] != -1) return dp[p][md]; long long sum = 0; if (s[p] == '?') for (int i = 0; i < 10; ++i) sum = (sum + sol(p + 1, (md + (1ll * i * pw[p])) % 13)) % mod; else sum = (sum + sol(p + 1, (md + (1ll * (s[p] - '0') * pw[p])) % 13)) % mod; return dp[p][md] = sum; } int main() { cin >> s; int cnt = -1; memset(dp, -1, sizeof dp); for (int i = s.size() - 1; i >= 0; --i) cnt = (cnt + 1 % 6), pw[i] = a[cnt]; cout << sol(0, 0) << endl; return 0; }
#include <cstring> #include <iostream> using namespace std; int a[] = {1, 10, 9, 12, 3, 4}, mod = 1e9 + 7, pw[100000]; long long dp[100000][13]; string s; int sol(int p, int md) { if (p == s.size() && md == 5) return 1; if (p == s.size()) return 0; if (dp[p][md] != -1) return dp[p][md]; long long sum = 0; if (s[p] == '?') for (int i = 0; i < 10; ++i) sum = (sum + sol(p + 1, (md + (1ll * i * pw[p])) % 13)) % mod; else sum = (sum + sol(p + 1, (md + (1ll * (s[p] - '0') * pw[p])) % 13)) % mod; return dp[p][md] = sum; } int main() { cin >> s; int cnt = -1; memset(dp, -1, sizeof dp); for (int i = s.size() - 1; i >= 0; --i) cnt = ((cnt + 1) % 6), pw[i] = a[cnt]; cout << sol(0, 0) << endl; return 0; }
[]
769,746
769,747
u032723841
cpp
p02960
#include <cstring> #include <iostream> using namespace std; int a[] = {1, 10, 9, 12, 3, 4}, mod = 1e9 + 7, pw[100000]; long long dp[100000][13]; string s; int sol(int p, int md) { if (p == s.size() && md == 5) return 1; if (p == s.size()) return 0; if (dp[p][md] != -1) return dp[p][md]; long long sum = 0; if (s[p] == '?') for (int i = 0; i < 10; ++i) sum = (sum + sol(p + 1, (md + (1ll * i * pw[p])) % 13)) % mod; else sum = (sum + sol(p + 1, (md + (1ll * (s[p] - '0') * pw[p])) % 13)) % mod; return dp[p][md] = sum; } int main() { cin >> s; int cnt = -1; memset(dp, -1, sizeof dp); for (int i = s.size() - 1; i >= 0; --i) cnt = (cnt + 1 % 13), pw[i] = a[cnt]; cout << sol(0, 0) << endl; return 0; }
#include <cstring> #include <iostream> using namespace std; int a[] = {1, 10, 9, 12, 3, 4}, mod = 1e9 + 7, pw[100000]; long long dp[100000][13]; string s; int sol(int p, int md) { if (p == s.size() && md == 5) return 1; if (p == s.size()) return 0; if (dp[p][md] != -1) return dp[p][md]; long long sum = 0; if (s[p] == '?') for (int i = 0; i < 10; ++i) sum = (sum + sol(p + 1, (md + (1ll * i * pw[p])) % 13)) % mod; else sum = (sum + sol(p + 1, (md + (1ll * (s[p] - '0') * pw[p])) % 13)) % mod; return dp[p][md] = sum; } int main() { cin >> s; int cnt = -1; memset(dp, -1, sizeof dp); for (int i = s.size() - 1; i >= 0; --i) cnt = ((cnt + 1) % 6), pw[i] = a[cnt]; cout << sol(0, 0) << endl; return 0; }
[ "literal.number.change", "assignment.value.change", "expression.operation.binary.change" ]
769,748
769,747
u032723841
cpp
p02960
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int INF = 100100100; int main() { // ll N; cin >> N; // ll N,M; cin >> N >> M; string S; cin >> S; // ll H,W; cin >> H >> W; int N; N = S.length(); int nu[N][13]; for (int i = 0; i < 13; i++) { for (int j = 0; j < N; j++) { nu[j][i] = 0; } } int p; if (S[0] == '?') { int dig = N % 6; if (dig == 1) { for (int j = 0; j < 10; j++) { nu[0][j]++; } } if (dig == 2) { for (int j = 0; j < 10; j++) { nu[0][(j * 10) % 13]++; } } if (dig == 3) { for (int j = 0; j < 10; j++) { nu[0][(j * 9) % 13]++; } } if (dig == 4) { for (int j = 0; j < 10; j++) { nu[0][(j * 12) % 13]++; } } if (dig == 5) { for (int j = 0; j < 10; j++) { nu[0][(j * 3) % 13]++; } } if (dig == 0) { for (int j = 0; j < 10; j++) { nu[0][(j * 4) % 13]++; } } } else { int x = S[0] - '0'; int dig = (N - 1) % 6; p = pow(10, dig); p = p % 13; nu[0][x * p]++; } for (int i = 1; i < N; i++) { int dig = (N - i - 1) % 6; p = pow(10, dig); p = p % 13; if (S[i] == '?') { for (int j = 0; j < 10; j++) { for (int k = 0; k < 13; k++) { nu[i][(k + p * j) % 13] += nu[i - 1][k]; //ココアyたしい nu[i][(k + p * j) % 13] = nu[i][(k + p * j) % 13] % mod; } } } else { int x = S[i] - '0'; for (int j = 0; j < 13; j++) { nu[i][(j + p * x) % 13] += nu[i - 1][j]; nu[i][(j + p * x) % 13] = nu[i][(j + p * x) % 13] % mod; } } } cout << nu[N - 1][5]; } /* 観自在菩薩・行深般若波羅蜜多時、照見五蘊皆空、度一切苦厄。舎利子。色不異空、空不異色、色即是空、空即是色。受・想・行・識・亦復如是。舎利子。是諸法空相、不生不滅、不垢不浄、不増不減。是故空中、無色、無受・想・行・識、無眼・耳・鼻・舌・身・意、無色・声・香・味・触・法。無眼界、乃至、無意識界。無無明・亦無無明尽、乃至、無老死、亦無老死尽。無苦・集・滅・道。無智、亦無得。以無所得故、菩提薩埵、依般若波羅蜜多故、心無罜礙、無罜礙故、無有恐怖、遠離・一切[注 6]・顛倒夢想、究竟涅槃。三世諸仏、依般若波羅蜜多故、得阿耨多羅三藐三菩提。故知、般若波羅蜜多、是大神呪、是大明呪、是無上呪、是無等等呪、能除一切苦、真実不虚。故説、般若波羅蜜多呪。 即説呪曰、羯諦羯諦、波羅羯諦、波羅僧羯諦、菩提薩婆訶。般若心経 */
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int INF = 100100100; int main() { // ll N; cin >> N; // ll N,M; cin >> N >> M; string S; cin >> S; // ll H,W; cin >> H >> W; int N; N = S.length(); int nu[N][13]; for (int i = 0; i < 13; i++) { for (int j = 0; j < N; j++) { nu[j][i] = 0; } } int p; if (S[0] == '?') { int dig = N % 6; if (dig == 1) { for (int j = 0; j < 10; j++) { nu[0][j]++; } } if (dig == 2) { for (int j = 0; j < 10; j++) { nu[0][(j * 10) % 13]++; } } if (dig == 3) { for (int j = 0; j < 10; j++) { nu[0][(j * 9) % 13]++; } } if (dig == 4) { for (int j = 0; j < 10; j++) { nu[0][(j * 12) % 13]++; } } if (dig == 5) { for (int j = 0; j < 10; j++) { nu[0][(j * 3) % 13]++; } } if (dig == 0) { for (int j = 0; j < 10; j++) { nu[0][(j * 4) % 13]++; } } } else { int x = S[0] - '0'; int dig = (N - 1) % 6; p = pow(10, dig); p = p % 13; nu[0][(x * p) % 13]++; } for (int i = 1; i < N; i++) { int dig = (N - i - 1) % 6; p = pow(10, dig); p = p % 13; if (S[i] == '?') { for (int j = 0; j < 10; j++) { for (int k = 0; k < 13; k++) { nu[i][(k + p * j) % 13] += nu[i - 1][k]; //ココアyたしい nu[i][(k + p * j) % 13] = nu[i][(k + p * j) % 13] % mod; } } } else { int x = S[i] - '0'; for (int j = 0; j < 13; j++) { nu[i][(j + p * x) % 13] += nu[i - 1][j]; nu[i][(j + p * x) % 13] = nu[i][(j + p * x) % 13] % mod; } } } cout << nu[N - 1][5]; } /* 観自在菩薩・行深般若波羅蜜多時、照見五蘊皆空、度一切苦厄。舎利子。色不異空、空不異色、色即是空、空即是色。受・想・行・識・亦復如是。舎利子。是諸法空相、不生不滅、不垢不浄、不増不減。是故空中、無色、無受・想・行・識、無眼・耳・鼻・舌・身・意、無色・声・香・味・触・法。無眼界、乃至、無意識界。無無明・亦無無明尽、乃至、無老死、亦無老死尽。無苦・集・滅・道。無智、亦無得。以無所得故、菩提薩埵、依般若波羅蜜多故、心無罜礙、無罜礙故、無有恐怖、遠離・一切[注 6]・顛倒夢想、究竟涅槃。三世諸仏、依般若波羅蜜多故、得阿耨多羅三藐三菩提。故知、般若波羅蜜多、是大神呪、是大明呪、是無上呪、是無等等呪、能除一切苦、真実不虚。故説、般若波羅蜜多呪。 即説呪曰、羯諦羯諦、波羅羯諦、波羅僧羯諦、菩提薩婆訶。般若心経 */
[ "expression.operation.binary.add" ]
769,749
769,750
u593555034
cpp
p02960
// dp[i][k] i位mod13=k 的 #include <cstdio> #include <cstring> using namespace std; const int mod = 1e9 + 7; #define N 100003 char s[N]; int dp[N][13]; int main() { scanf("%s", s + 1); int n = strlen(s + 1); int bit = 1; if (s[n] == '?') for (int i = 0; i < 13; ++i) dp[n][i] = 1; else dp[n][s[n] - '0'] = 1; int k; for (int i = n - 1; i; i--) { bit = 1LL * bit * 10 % 13; if (s[i] != '?') { k = 1LL * (s[i] - '0') * bit % 13; for (int j = 0; j < 13; ++j) { dp[i][(k + j) % 13] += dp[i + 1][j]; dp[i][(k + j) % 13] %= mod; // if(dp[1][5]) printf("\n%d\n",j); } } else { for (int j = 0; j < 10; ++j) { k = 1LL * j * bit % 13; for (int p = 0; p < 13; ++p) { dp[i][(k + p) % 13] += dp[i + 1][p]; dp[i][(k + p) % 13] %= mod; } // if(dp[2][7]) printf("\n%d\n",j); } } } printf("%d", dp[1][5]); }
// dp[i][k] i位mod13=k 的 #include <cstdio> #include <cstring> using namespace std; const int mod = 1e9 + 7; #define N 100003 char s[N]; int dp[N][13]; int main() { scanf("%s", s + 1); int n = strlen(s + 1); int bit = 1; if (s[n] == '?') for (int i = 0; i < 10; ++i) dp[n][i] = 1; else dp[n][s[n] - '0'] = 1; int k; for (int i = n - 1; i; i--) { bit = 1LL * bit * 10 % 13; if (s[i] != '?') { k = 1LL * (s[i] - '0') * bit % 13; for (int j = 0; j < 13; ++j) { dp[i][(k + j) % 13] += dp[i + 1][j]; dp[i][(k + j) % 13] %= mod; // if(dp[1][5]) printf("\n%d\n",j); } } else { for (int j = 0; j < 10; ++j) { k = 1LL * j * bit % 13; for (int p = 0; p < 13; ++p) { dp[i][(k + p) % 13] += dp[i + 1][p]; dp[i][(k + p) % 13] %= mod; } // if(dp[2][7]) printf("\n%d\n",j); } } } printf("%d", dp[1][5]); }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
769,753
769,754
u014095165
cpp
p02960
#include <algorithm> #include <cassert> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; const int INF = 1 << 30; const ll MOD = 1e9 + 7; const double EPS = 1e-9; int main(int argc, const char *argv[]) { string S; cin >> S; int N = (int)S.size(); vector<vector<ll>> dp(N + 1, vector<ll>(13, 0)); vector<ll> beki(N + 1, 0); beki[1] = 1; for (int i = 2; i < N + 1; i++) { beki[i] = (beki[i - 1] * 10) % 13; } dp[0][0] = 1; int nr; for (int k = 1; k <= N; k++) { for (int r = 0; r < 13; r++) { if (S[k - 1] == '?') { for (int i = 0; i < 10; i++) { nr = (r + i * beki[k]) % 13; dp[k][nr] = (dp[k][nr] + dp[k - 1][r]) % MOD; } } else { int i = (int)S[N - k] - (int)'0'; nr = (r + i * beki[k]) % 13; dp[k][nr] = (dp[k][nr] + dp[k - 1][r]) % MOD; } } } cout << dp[N][5] << endl; return 0; }
#include <algorithm> #include <cassert> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; const int INF = 1 << 30; const ll MOD = 1e9 + 7; const double EPS = 1e-9; int main(int argc, const char *argv[]) { string S; cin >> S; int N = (int)S.size(); vector<vector<ll>> dp(N + 1, vector<ll>(13, 0)); vector<ll> beki(N + 1, 0); beki[1] = 1; for (int i = 2; i < N + 1; i++) { beki[i] = (beki[i - 1] * 10) % 13; } dp[0][0] = 1; int nr; for (int k = 1; k <= N; k++) { for (int r = 0; r < 13; r++) { if (S[N - k] == '?') { for (int i = 0; i < 10; i++) { nr = (r + i * beki[k]) % 13; dp[k][nr] = (dp[k][nr] + dp[k - 1][r]) % MOD; } } else { int i = (int)S[N - k] - (int)'0'; nr = (r + i * beki[k]) % 13; dp[k][nr] = (dp[k][nr] + dp[k - 1][r]) % MOD; } } } cout << dp[N][5] << endl; return 0; }
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "identifier.replace.add", "literal.replace.remove" ]
769,755
769,756
u320491590
cpp
p02960
#include <algorithm> #include <iostream> #include <list> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; using vec = vector<ll>; using mat = vector<vec>; using lst = list<ll>; ll MOD = 1000000007; int main() { string S; cin >> S; reverse(S.begin(), S.end()); vec Count(13); Count[0] = 1; ll ten = 1; for (auto &c : S) { vec tmp(13); if (c == '?') { for (ll i = 0; i <= 9; ++i) { for (ll k = 0; k < 13; ++k) { ll a = (i * ten + k) % 13ll; tmp[a] += Count[k]; tmp[a] %= MOD; } } } else { ll v = (ll)(c - '0'); for (ll k = 0; k < 13; ++k) { ll a = (v * ten + k) % 13ll; tmp[a] += Count[k]; tmp[a] %= MOD; } } ten *= 10ll; ten %= MOD; Count = tmp; } cout << Count[5] << endl; return 0; }
#include <algorithm> #include <iostream> #include <list> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; using vec = vector<ll>; using mat = vector<vec>; using lst = list<ll>; ll MOD = 1000000007; int main() { string S; cin >> S; reverse(S.begin(), S.end()); vec Count(13); Count[0] = 1; ll ten = 1; for (auto &c : S) { vec tmp(13); if (c == '?') { for (ll i = 0; i <= 9; ++i) { for (ll k = 0; k < 13; ++k) { ll a = (i * ten + k) % 13ll; tmp[a] += Count[k]; tmp[a] %= MOD; } } } else { ll v = (ll)(c - '0'); for (ll k = 0; k < 13; ++k) { ll a = (v * ten + k) % 13ll; tmp[a] += Count[k]; tmp[a] %= MOD; } } ten *= 10ll; ten %= 13; Count = tmp; } cout << Count[5] << endl; return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,763
769,764
u765606693
cpp
p02960
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define mp make_pair #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(c) c.begin(), c.end() #define pb push_back #define fi first #define se second #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define mod (ll)1000000007 using namespace std; string s; ll dp[100001][13]; ll po[100001]; int main() { getline(cin, s); reverse(s.begin(), s.end()); int n = s.size(); dp[0][0] = 1; po[0] = 1; for (int i = 1; i <= n; i++) po[i] = po[i - 1] * 10 % mod; for (int i = 1; i <= n; i++) for (int j = 0; j < 13; j++) { if (s[i - 1] == '?') { for (int k = 0; k <= 9; k++) dp[i][j] = (dp[i][j] + dp[i - 1][(j - (k * po[i - 1]) % 13 + 13) % 13]) % mod; } else { dp[i][j] = (dp[i][j] + dp[i - 1][(j - ((s[i - 1] - '0') * po[i - 1]) % 13 + 13) % 13]) % mod; } } cout << dp[n][5] << endl; return 0; }
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define mp make_pair #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(c) c.begin(), c.end() #define pb push_back #define fi first #define se second #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define mod (ll)1000000007 using namespace std; string s; ll dp[100001][13]; ll po[100001]; int main() { getline(cin, s); reverse(s.begin(), s.end()); int n = s.size(); dp[0][0] = 1; po[0] = 1; for (int i = 1; i <= n; i++) po[i] = po[i - 1] * 10 % 13; for (int i = 1; i <= n; i++) for (int j = 0; j < 13; j++) { if (s[i - 1] == '?') { for (int k = 0; k <= 9; k++) dp[i][j] = (dp[i][j] + dp[i - 1][(j - (k * po[i - 1]) % 13 + 13) % 13]) % mod; } else { dp[i][j] = (dp[i][j] + dp[i - 1][(j - ((s[i - 1] - '0') * po[i - 1]) % 13 + 13) % 13]) % mod; } } cout << dp[n][5] % mod << endl; return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "expression.operation.binary.change" ]
769,765
769,766
u504098542
cpp
p02960
#include <bits/stdc++.h> using namespace std; #define ll long long ll MOD = 1e9 + 7; vector<vector<ll>> adj(100005); ll mem[100005][30]; string s; ll solve(ll cur, ll rem) { if (cur == s.size()) { if (rem == 5) { return 1; } return 0; } if (mem[cur][rem] != -1) { return mem[cur][rem]; } ll ret = 0; for (int i = 0; i < adj[cur].size(); i++) { ret += solve(cur + 1, (rem + adj[cur][i]) % 13); ret %= MOD; } return mem[cur][rem] = ret % MOD; } int main() { // freopen("input.txt", "r", stdin); // freopen("maxflow.out", "w", stdout); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); memset(mem, -1, sizeof mem); cin >> s; ll cur = 1; for (int i = s.size() - 1; i >= 0; i--) { if (s[i] == '?') { for (int j = 0; j <= 9; j++) { ll c = j * cur; adj[i].push_back(c % 13); } } else { stringstream ss; ll k; ss << s[i]; ss >> k; k *= cur; adj[i].push_back(k % 13); } cur *= 10; cur %= MOD; } cout << solve(0, 0) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long ll MOD = 1e9 + 7; vector<vector<ll>> adj(100005); ll mem[100005][30]; string s; ll solve(ll cur, ll rem) { if (cur == s.size()) { if (rem == 5) { return 1; } return 0; } if (mem[cur][rem] != -1) { return mem[cur][rem]; } ll ret = 0; for (int i = 0; i < adj[cur].size(); i++) { ret += solve(cur + 1, (rem + adj[cur][i]) % 13); ret %= MOD; } return mem[cur][rem] = ret % MOD; } int main() { // freopen("input.txt", "r", stdin); // freopen("maxflow.out", "w", stdout); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); memset(mem, -1, sizeof mem); cin >> s; ll cur = 1; for (int i = s.size() - 1; i >= 0; i--) { if (s[i] == '?') { for (int j = 0; j <= 9; j++) { ll c = j * cur; adj[i].push_back(c % 13); } } else { stringstream ss; ll k; ss << s[i]; ss >> k; k *= cur; adj[i].push_back(k % 13); } cur *= 10; cur %= 13; } cout << solve(0, 0) << endl; return 0; }
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
769,771
769,772
u288989709
cpp
p02960
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(x) (x).begin(), (x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout << #x " = " << ((x)) << endl template <class T, class U> ostream &operator<<(ostream &o, const pair<T, U> &p) { o << "(" << p.fi << "," << p.se << ")"; return o; } template <class T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "["; for (T t : v) { o << t << ","; } o << "]"; return o; } const int mod = 1e9 + 7; const int M = 13; int main() { string s; cin >> s; int n = s.size(); int dp[M]; dp[0] = 1; rep(i, n) { int l = 0, r = 10; if (s[i] != '?') { l = s[i] - '0'; r = l + 1; } int nx[M] = {}; for (int j = l; j < r; ++j) { rep(k, M) { int a = (k * 10 + j) % M; (nx[a] += dp[k]) %= mod; } } rep(j, M) dp[j] = nx[j]; } cout << dp[5] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(x) (x).begin(), (x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout << #x " = " << ((x)) << endl template <class T, class U> ostream &operator<<(ostream &o, const pair<T, U> &p) { o << "(" << p.fi << "," << p.se << ")"; return o; } template <class T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "["; for (T t : v) { o << t << ","; } o << "]"; return o; } const int mod = 1e9 + 7; const int M = 13; int main() { string s; cin >> s; int n = s.size(); int dp[M] = {}; dp[0] = 1; rep(i, n) { int l = 0, r = 10; if (s[i] != '?') { l = s[i] - '0'; r = l + 1; } int nx[M] = {}; for (int j = l; j < r; ++j) { rep(k, M) { int a = (k * 10 + j) % M; (nx[a] += dp[k]) %= mod; } } rep(j, M) dp[j] = nx[j]; } cout << dp[5] << endl; return 0; }
[ "variable_declaration.value.change" ]
769,773
769,774
u696805736
cpp
p02960
#include <bits/stdc++.h> #define ll long long #define rep(i, n) for (ll(i) = 0; (i) < (n); ++(i)) using namespace std; ll mod = 1e9 + 7; ll mod_pow(ll x, ll n) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % 13; x = x * x % 13; n >>= 1; } return res; } int main() { string s; cin >> s; vector<vector<ll>> dp(s.size(), vector<ll>(13, 0)); if (s[s.size() - 1] == '?') { rep(i, 10) { dp[s.size() - 1][i] = 1; } } else { dp[s.size() - 1][s[s.size() - 1] - '0'] = 1; } ll keta = 2; for (ll i = s.size() - 2; i >= 0; i--) { if (s[i] == '?') { rep(j, 10) { ll res = mod_pow(10, keta) * j; rep(k, 13) { ll r = (res + k) % 13; dp[i][r] += dp[i + 1][k]; dp[i][r] = (dp[i][r] + mod) % mod; } } } else { ll res = mod_pow(10, keta) * (s[i] - '0'); rep(k, 13) { ll r = (res + k) % 13; dp[i][r] += dp[i + 1][k]; dp[i][r] = (dp[i][r] + mod) % mod; } } keta++; } cout << dp[0][5] << endl; }
#include <bits/stdc++.h> #define ll long long #define rep(i, n) for (ll(i) = 0; (i) < (n); ++(i)) using namespace std; ll mod = 1e9 + 7; ll mod_pow(ll x, ll n) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % 13; x = x * x % 13; n >>= 1; } return res; } int main() { string s; cin >> s; vector<vector<ll>> dp(s.size(), vector<ll>(13, 0)); if (s[s.size() - 1] == '?') { rep(i, 10) { dp[s.size() - 1][i] = 1; } } else { dp[s.size() - 1][s[s.size() - 1] - '0'] = 1; } ll keta = 1; for (ll i = s.size() - 2; i >= 0; i--) { if (s[i] == '?') { rep(j, 10) { ll res = mod_pow(10, keta) * j; rep(k, 13) { ll r = (res + k) % 13; dp[i][r] += dp[i + 1][k]; dp[i][r] = (dp[i][r] + mod) % mod; } } } else { ll res = mod_pow(10, keta) * (s[i] - '0'); rep(k, 13) { ll r = (res + k) % 13; dp[i][r] += dp[i + 1][k]; dp[i][r] = (dp[i][r] + mod) % mod; } } keta++; } cout << dp[0][5] << endl; }
[ "literal.number.change", "variable_declaration.value.change" ]
769,775
769,776
u201316840
cpp
p02960
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> ii; typedef tuple<ll, ll, ll> iii; typedef vector<ll> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<vi> vvi; typedef vector<vii> vvii; #define REP(i, n) for (ll i = 0; i < n; ++i) #define REPR(i, n) for (ll i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (int i = m; i < n; ++i) #define FORR(i, m, n) for (ll i = n - 1; i >= m; --i) #define FORE(x, xs) for (const auto &x : xs) #define PB push_back #define MP make_pair #define MT make_tuple #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() const int MAX = 1e5 + 10; const int MOD = 1e9 + 7; const int ord[13] = {0, 4, 8, 12, 3, 7, 11, 2, 6, 10, 1, 5, 9}; string S; ll dp[MAX][13]; ll dp2[42]; int solve() { int n = S.size(); dp[0][0] = 1; REP(i, n) { if (S[i] == '?') { dp2[0] = 0; REP(j, 13 * 3) { dp2[j + 1] = (dp2[j] + dp[i][ord[j % 13]]) % MOD; } REP(j, 13) { dp[i + 1][j] = dp2[j + 14] - dp2[j + 4]; dp[i + 1][j] %= MOD; } } else { int k = S[i] - '0'; REP(j, 13) { dp[i + 1][(j * 10 + k) % 13] = dp[i][j]; } } } return dp[n][5]; } int main() { cin >> S; cout << solve() << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> ii; typedef tuple<ll, ll, ll> iii; typedef vector<ll> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<vi> vvi; typedef vector<vii> vvii; #define REP(i, n) for (ll i = 0; i < n; ++i) #define REPR(i, n) for (ll i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (int i = m; i < n; ++i) #define FORR(i, m, n) for (ll i = n - 1; i >= m; --i) #define FORE(x, xs) for (const auto &x : xs) #define PB push_back #define MP make_pair #define MT make_tuple #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() const int MAX = 1e5 + 10; const int MOD = 1e9 + 7; const int ord[13] = {0, 4, 8, 12, 3, 7, 11, 2, 6, 10, 1, 5, 9}; string S; ll dp[MAX][13]; ll dp2[42]; int solve() { int n = S.size(); dp[0][0] = 1; REP(i, n) { if (S[i] == '?') { dp2[0] = 0; REP(j, 13 * 3) { dp2[j + 1] = (dp2[j] + dp[i][ord[j % 13]]) % MOD; } REP(j, 13) { dp[i + 1][j] = MOD + dp2[j + 14] - dp2[j + 4]; dp[i + 1][j] %= MOD; } } else { int k = S[i] - '0'; REP(j, 13) { dp[i + 1][(j * 10 + k) % 13] = dp[i][j]; } } } return dp[n][5]; } int main() { cin >> S; cout << solve() << endl; }
[ "assignment.change" ]
769,779
769,780
u957084285
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> a(n + 1), b(n); for (int i = 0; i < n + 1; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; int cnt = 0; for (int i = 0; i < n; i++) { if (a[i] < b[i]) { cnt += a[i]; cnt += min(b[i] - a[i], a[i + 1]); a[i + 1] -= min(b[i] - a[i], a[i + 1]); } else { cnt += b[i]; } } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> a(n + 1), b(n); for (int i = 0; i < n + 1; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; long long cnt = 0; for (int i = 0; i < n; i++) { if (a[i] < b[i]) { cnt += a[i]; cnt += min(b[i] - a[i], a[i + 1]); a[i + 1] -= min(b[i] - a[i], a[i + 1]); } else { cnt += b[i]; } } cout << cnt << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
769,785
769,786
u906572139
cpp
p02959
#include <iostream> using namespace std; int main() { int N, A[100001], B, a; int sum = 0; cin >> N; for (int i = 0; i <= N; i++) cin >> A[i]; for (int i = 1; i <= N; i++) { cin >> B; a = A[i - 1] - B; if (a < 0) { sum += A[i - 1]; A[i] -= a * -1; if (A[i] > 0) sum += a * -1; else { sum += a * -1 + A[i]; A[i] = 0; } } else { sum += B; } } cout << sum; }
#include <iostream> using namespace std; int main() { int N, A[100001], B, a; long long sum = 0L; cin >> N; for (int i = 0; i <= N; i++) cin >> A[i]; for (int i = 1; i <= N; i++) { cin >> B; a = A[i - 1] - B; if (a < 0) { sum += A[i - 1]; A[i] -= a * -1; if (A[i] > 0) sum += a * -1; else { sum += a * -1 + A[i]; A[i] = 0; } } else { sum += B; } } cout << sum; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "literal.number.type.widen.change" ]
769,791
769,792
u275488634
cpp
p02959
#include <iostream> using namespace std; int main() { int n; cin >> n; long long int a[n + 1]; long long int b[n]; for (int i = 0; i < n + 1; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } int sum = 0; for (int i = 0; i < n; i++) { sum += min(a[i], b[i]); b[i] = b[i] - min(a[i], b[i]); if (b[i] > 0) { sum += min(a[i + 1], b[i]); a[i + 1] = a[i + 1] - min(a[i + 1], b[i]); } } cout << sum << endl; }
#include <iostream> using namespace std; int main() { int n; cin >> n; long long int a[n + 1]; long long int b[n]; for (int i = 0; i < n + 1; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } long long int sum = 0; for (int i = 0; i < n; i++) { sum += min(a[i], b[i]); b[i] = b[i] - min(a[i], b[i]); if (b[i] > 0) { sum += min(a[i + 1], b[i]); a[i + 1] = a[i + 1] - min(a[i + 1], b[i]); } } cout << sum << endl; }
[ "variable_declaration.type.widen.change" ]
769,796
769,797
u130367513
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int n; long c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int A = a.at(i); int B = a.at(i + 1); int C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; long c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int &A = a.at(i); int &B = a.at(i + 1); int &C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
[]
769,798
769,799
u422633119
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int n; unsigned long long c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int A = a.at(i); int B = a.at(i + 1); int C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; long c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int &A = a.at(i); int &B = a.at(i + 1); int &C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
[]
769,800
769,799
u422633119
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int n; long long c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int A = a.at(i); int B = a.at(i + 1); int C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; long c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int &A = a.at(i); int &B = a.at(i + 1); int &C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
[ "variable_declaration.type.narrow.change" ]
769,801
769,799
u422633119
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int n, c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int A = a.at(i); int B = a.at(i + 1); int C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; long c = 0; cin >> n; vector<int> a(n + 1), b(n); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); for (int i = 0; i < n; i++) { int &A = a.at(i); int &B = a.at(i + 1); int &C = b.at(i); if (A + B > C) { c += b.at(i); if (C > A) B -= (C - A); } else { c += (A + B); B = 0; } } cout << c << endl; }
[ "variable_declaration.type.widen.change" ]
769,802
769,799
u422633119
cpp
p02959
#include <algorithm> #include <iostream> #include <vector> using namespace std; void solve(int N, vector<int> A, vector<int> B) { int cnt = 0; for (int i = 0; i < N; i++) { int x = min(A[i], B[i]); cnt += x; int y = min(A[i + 1], B[i] - x); cnt += y; A[i + 1] -= y; } printf("%d\n", cnt); } int main() { int N; cin >> N; vector<int> A(N + 1); vector<int> B(N); for (int i = 0; i < N + 1; i++) { int x; cin >> x; A[i] = x; } for (int i = 0; i < N; i++) { int x; cin >> x; B[i] = x; } solve(N, A, B); return 0; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; void solve(int N, vector<int> A, vector<int> B) { long long cnt = 0; for (int i = 0; i < N; i++) { int x = min(A[i], B[i]); cnt += x; int y = min(A[i + 1], B[i] - x); cnt += y; A[i + 1] -= y; } printf("%lld\n", cnt); } int main() { int N; cin >> N; vector<int> A(N + 1); vector<int> B(N); for (int i = 0; i < N + 1; i++) { int x; cin >> x; A[i] = x; } for (int i = 0; i < N; i++) { int x; cin >> x; B[i] = x; } solve(N, A, B); return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
769,803
769,804
u910756197
cpp
p02959
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define ll long long int #define MAX 1000000007 using namespace std; int main(void) { int n; cin >> n; int a[n + 1], b[n]; rep(i, n + 1) cin >> a[i]; rep(i, n) cin >> b[i]; int cnt = 0; rep(i, n) { if (a[i] >= b[i]) { cnt += b[i]; b[i] = 0; } else { b[i] -= a[i]; cnt += a[i]; } if (a[i + 1] >= b[i]) { cnt += b[i]; a[i + 1] -= b[i]; } else { cnt += a[i + 1]; a[i + 1] = 0; } } cout << cnt << endl; return 0; }
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define ll long long int #define MAX 1000000007 using namespace std; int main(void) { int n; cin >> n; int a[n + 1], b[n]; rep(i, n + 1) cin >> a[i]; rep(i, n) cin >> b[i]; ll cnt = 0; rep(i, n) { if (a[i] >= b[i]) { cnt += b[i]; b[i] = 0; } else { b[i] -= a[i]; cnt += a[i]; } if (a[i + 1] >= b[i]) { cnt += b[i]; a[i + 1] -= b[i]; } else { cnt += a[i + 1]; a[i + 1] = 0; } } cout << cnt << endl; return 0; }
[ "variable_declaration.type.change" ]
769,805
769,806
u582848517
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long> A(N + 1); vector<long> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); long ma[100000]; long mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(0); mb[i] = 0; } } long long X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long> A(N + 1); vector<long> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); long ma[100000]; long mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(i); mb[i] = 0; } } long X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "variable_declaration.type.narrow.change" ]
769,824
769,825
u583628727
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long> A(N + 1); vector<long> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); long ma[100000]; long mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(0); mb[i] = 0; } } long X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long> A(N + 1); vector<long> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); long ma[100000]; long mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(i); mb[i] = 0; } } long X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
769,826
769,825
u583628727
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N + 1); vector<int> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); long ma[100000]; long mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(0); mb[i] = 0; } } long X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long> A(N + 1); vector<long> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); long ma[100000]; long mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(i); mb[i] = 0; } } long X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
[ "variable_declaration.type.primitive.change", "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
769,827
769,825
u583628727
cpp
p02959
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N + 1); vector<int> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); int ma[100000]; int mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(0); mb[i] = 0; } } int X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long> A(N + 1); vector<long> B(N); for (int i = 0; i < N + 1; i++) cin >> A.at(i); for (int i = 0; i < N; i++) cin >> B.at(i); long ma[100000]; long mb[100000]; if (A.at(0) + A.at(1) < B.at(0)) { ma[0] = A.at(0); mb[0] = A.at(1); } else if (A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)) { ma[0] = A.at(0); mb[0] = B.at(0) - A.at(0); } else if (A.at(0) >= B.at(0)) { ma[0] = B.at(0); mb[0] = 0; } for (int i = 1; i < N; i++) { if (A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = A.at(i + 1); } else if (A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)) { ma[i] = A.at(i) - mb[i - 1]; mb[i] = B.at(i) - A.at(i) + mb[i - 1]; } else { ma[i] = B.at(i); mb[i] = 0; } } long X = 0; for (int i = 0; i < N; i++) { X += ma[i]; X += mb[i]; } cout << X << endl; }
[ "variable_declaration.type.primitive.change", "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
769,828
769,825
u583628727
cpp
p02959
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef long long int ll; typedef pair<int, int> Pii; typedef pair<int, double> Pid; typedef pair<double, int> Pdi; typedef pair<double, double> Pdd; typedef pair<ll, ll> P; typedef pair<P, ll> PP; const ll mod = 1e9 + 7; const ll INF = 2e9; const double epsilon = 1e-7; const double PI = 3.1415926535; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { ll n, ans = 0; cin >> n; vector<ll> a(n + 1), b(n + 1), c(n + 1); rep(i, n + 1) cin >> a[i]; rep(i, n + 1) { cin >> b[i]; c[i] = b[i]; } rep(i, n + 1) { if (a[i] >= b[i]) { ans += b[i]; } else { ans += a[i]; if (i != n) { b[i + 1] += (c[i] - a[i]); } } } cout << ans << endl; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef long long int ll; typedef pair<int, int> Pii; typedef pair<int, double> Pid; typedef pair<double, int> Pdi; typedef pair<double, double> Pdd; typedef pair<ll, ll> P; typedef pair<P, ll> PP; const ll mod = 1e9 + 7; const ll INF = 2e9; const double epsilon = 1e-7; const double PI = 3.1415926535; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { ll n, ans = 0; cin >> n; vector<ll> a(n + 1), b(n + 1), c(n + 1); rep(i, n + 1) cin >> a[i]; rep(i, n + 1) { cin >> b[i]; c[i] = b[i]; } rep(i, n + 1) { if (a[i] >= b[i]) { ans += b[i]; } else { ans += a[i]; if (i != n) { b[i + 1] += min(c[i], b[i] - a[i]); } } } cout << ans << endl; }
[ "call.add", "call.arguments.add" ]
769,829
769,830
u061912210
cpp
p02959
#include <iostream> using namespace std; int main() { int N; cin >> N; int A[N], B[N - 1]; int C[N], D[N]; // C[i]はiにいる残りモンスター,D[i]は勇者が倒せる残りモンスター数 int ans = 0; for (int i = 0; i <= N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { cin >> B[i]; } for (int i = 0; i < N; i++) { if (A[i] > B[i]) { ans += B[i]; // iの勇者はiのモンスターを倒せるだけ倒して終わり } else { ans += A[i]; // A[i]のモンスターを全て討伐する D[i] = B[i] - A[i]; //勇者が倒せる残りモンスター A[i] = 0; if (A[i + 1] > D[i]) { ans += D[i]; // iの勇者はi+1のモンスターを倒せるだけ倒して終わり A[i + 1] = A[i + 1] - D[i]; } else { ans += A[i + 1]; // iの勇者はA[i+1]のモンスターを全て討伐する A[i + 1] = 0; } } } cout << ans; return 0; }
#include <iostream> using namespace std; int main() { int N; cin >> N; int A[N], B[N - 1]; int C[N], D[N]; // C[i]はiにいる残りモンスター,D[i]は勇者が倒せる残りモンスター数 long long ans = 0; for (int i = 0; i <= N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { cin >> B[i]; } for (int i = 0; i < N; i++) { /* if(b[i]<a[i]) ans+=b[i]; else { b[i]-=a[i]; ans+=a[i]; a[i]=0; if(b[i]<a[i+1]) { ans+=b[i]; a[i+1]-=b[i]; } else { ans+=a[i+1]; a[i+1]=0; } } */ if (A[i] > B[i]) { ans += B[i]; // iの勇者はiのモンスターを倒せるだけ倒して終わり } else { ans += A[i]; // A[i]のモンスターを全て討伐する D[i] = B[i] - A[i]; //勇者が倒せる残りモンスター A[i] = 0; if (A[i + 1] > D[i]) { ans += D[i]; // iの勇者はi+1のモンスターを倒せるだけ倒して終わり A[i + 1] = A[i + 1] - D[i]; } else { ans += A[i + 1]; // iの勇者はA[i+1]のモンスターを全て討伐する A[i + 1] = 0; } } } cout << ans; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
769,833
769,834
u057617112
cpp
p02959
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() using namespace std; int main() { int a; cin >> a; vector<int> enemy(a + 1); rep(i, a + 1) cin >> enemy.at(i); vector<int> hero(a); rep(i, a) cin >> hero.at(i); int ans = 0; rep(i, a) { if (hero.at(i) >= enemy.at(i)) { ans += enemy.at(i); if (hero.at(i) - enemy.at(i) <= enemy.at(i + 1)) { enemy.at(i + 1) -= hero.at(i) - enemy.at(i); ans += hero.at(i) - enemy.at(i); } else { ans += enemy.at(i + 1); enemy.at(i + 1) = 0; } } else ans += hero.at(i); } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() using namespace std; int main() { int a; cin >> a; vector<int> enemy(a + 1); rep(i, a + 1) cin >> enemy.at(i); vector<int> hero(a); rep(i, a) cin >> hero.at(i); int64_t ans = 0; rep(i, a) { if (hero.at(i) >= enemy.at(i)) { ans += enemy.at(i); if (hero.at(i) - enemy.at(i) <= enemy.at(i + 1)) { enemy.at(i + 1) -= hero.at(i) - enemy.at(i); ans += hero.at(i) - enemy.at(i); } else { ans += enemy.at(i + 1); enemy.at(i + 1) = 0; } } else ans += hero.at(i); } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
769,835
769,836
u165267345
cpp
p02959
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() using namespace std; int main() { int a; cin >> a; vector<int> enemy(a + 1); rep(i, a + 1) cin >> enemy.at(i); vector<int> hero(a); rep(i, a) cin >> hero.at(i); int ans = 0; rep(i, a) { if (hero.at(i) <= enemy.at(i)) ans += hero.at(i); else { ans += enemy.at(i); hero.at(i) -= enemy.at(i); if (hero.at(i) < enemy.at(i + 1)) { ans += hero.at(i); enemy.at(i + 1) -= hero.at(i); } else { ans += enemy.at(i + 1); enemy.at(i + 1) = 0; } } } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() using namespace std; int main() { int a; cin >> a; vector<int> enemy(a + 1); rep(i, a + 1) cin >> enemy.at(i); vector<int> hero(a); rep(i, a) cin >> hero.at(i); int64_t ans = 0; rep(i, a) { if (hero.at(i) <= enemy.at(i)) ans += hero.at(i); else { ans += enemy.at(i); hero.at(i) -= enemy.at(i); if (hero.at(i) < enemy.at(i + 1)) { ans += hero.at(i); enemy.at(i + 1) -= hero.at(i); } else { ans += enemy.at(i + 1); enemy.at(i + 1) = 0; } } } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
769,837
769,838
u165267345
cpp
p02959
#include <iostream> using namespace std; int main() { int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; continue; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } long long int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; // continue; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
[ "variable_declaration.type.widen.change" ]
769,843
769,842
u781317830
cpp
p02959
#include <iostream> using namespace std; int main() { int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } long long int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; // continue; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
[ "variable_declaration.type.widen.change" ]
769,844
769,842
u781317830
cpp
p02959
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; continue; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } long long int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; continue; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
[ "variable_declaration.type.widen.change" ]
769,841
769,845
u781317830
cpp
p02959
#include <iostream> using namespace std; int main() { int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; continue; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int *m; m = new long long int[n + 1]; for (int i = 0; i < n + 1; i++) { cin >> m[i]; } long long int *y; y = new long long int[n]; for (int i = 0; i < n; i++) { cin >> y[i]; } long long int retval = 0; for (int i = 0; i < n; i++) { // i if (y[i] <= m[i]) { m[i] -= y[i]; retval += y[i]; y[i] = 0; continue; } else { retval += m[i]; y[i] -= m[i]; m[i] = 0; } // i+1 if (y[i] <= m[i + 1]) { retval += y[i]; m[i + 1] -= y[i]; y[i] = 0; } else { retval += m[i + 1]; y[i] -= m[i + 1]; m[i + 1] = 0; } } cout << retval << endl; }
[ "variable_declaration.type.widen.change" ]
769,843
769,845
u781317830
cpp