solution stringlengths 11 983k | difficulty int64 0 21 | language stringclasses 2
values |
|---|---|---|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define sz(a) (ll)a.size()
#define lli long long int
#define pb push_back
#define pf push_front
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
#define M 1000000007
#define pi 3.141592653... | 9 | CPP |
import sys,os,io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
maxn = 2*10**5 + 15
dp = [0]*(maxn)
dp[0]=1
mod = 10**9 + 7
for i in range (maxn-13):
dp[i]%=mod
if i>=10:
dp[i+9] += dp[i]
dp[i+10] += dp[i]
for i in range (1,maxn):
dp[i]+=dp[i-1]
# print(dp[:30])
for _ in range (in... | 9 | PYTHON3 |
#include <iostream>
#include <vector>
#include <map>
using namespace std;
const int MAX_N = 2e5 + 5, MOD = 1e9 + 7;
int length[MAX_N];
void precompute()
{
for(int i = 0; i <= 8; i++)
{
length[i] = 2;
}
length[9] = 3;
for(int i = 10; i < MAX_N; i++)
{
length[i] = (length[i - ... | 9 | CPP |
from sys import stdin
input = stdin.readline
mxn = 2 * (10 ** 5) + 10
mod = 10 ** 9 + 7
dp = [1] * mxn
for i in range(10, mxn):
dp[i] = (dp[i - 9] + dp[i - 10]) % mod
for test in range(int(input())):
n, k = map(int, input().strip().split())
ans = 0
while n:
ans = (ans + dp[k + n % 10]) % mod
... | 9 | PYTHON3 |
// amit
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);
#define ll long long int
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pi pair<ll,ll>
#define pb push_back
ll dp[200022]={1,1,1,1,1,1,1,1,1,1};
void fun()
{
for(int i=10;i<200022;i++)
... | 9 | CPP |
/** D Bag*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fr(iter,n) for(ll iter=0;iter<n;++iter)
#define forr(iter,s,e) for(ll iter=s;iter<e;++iter)
#define ufr(iter,s,e) for(ll iter=s;iter>=e;--iter)
#define MOD (ll)1000000007
#define pii p... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::val... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
#define d1(a) {cout<<#a<<"="<<(a)<<'\n';}
#define d2(a,b) {cout<<#a<<"="<<(a)<<" "<<#b<<"="<<(b)<<'\n';}
#define d3(a,b,c) {cout<<#a<<"="<<(a)<<" "<<#b<<"="<<(b)<<" "<<#c<<"="<<(c)<<'\n';}
#define D1(a) {cout<<#a<<"里的元素为 ";for(auto x:a)cout<<x<<' ';cout<<'\n';}
#define... | 9 | CPP |
#pyrival orz
import os
import sys
import math
from io import BytesIO, IOBase
input = sys.stdin.readline
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s) - 1]))
def invr()... | 9 | PYTHON3 |
from sys import stdin
t=int(stdin.readline())
mod=10**9+7
f=[0]*(2*10**5+10)
for i in range(10):
f[i]=1
f[10]=2
for i in range(11,2*10**5+10):
f[i]=(f[i-10]+f[i-9])%mod
for _ in range(t):
n,m=map(int,stdin.readline().split())
c=[0]*10
n=str(n)
for i in range(len(n)):
c[int(n[i])]+=1
ans=0
for i in r... | 9 | PYTHON3 |
// MD. Ashiqur Rahman
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define scn(x) scanf("%d",&x)
#define scnl(x) scanf("%lld",&x)
#define prnt(x) printf("%d\n",x)
#define prntl(x) printf("%lld\n",x)
#d... | 9 | CPP |
import sys
input = sys.stdin.readline
t = int(input())
mod = pow(10, 9) + 7
cnt = [0 for _ in range(200020)]
cnt0 = [0] * 10
cnt0[0] = 1
s = 1
for k in range(200020):
x = cnt0[(9 - k) % 10]
cnt0[(10 - k) % 10] += x
cnt0[(10 - k) % 10] %= mod
s += x
s %= mod
cnt[k] = s
for _ in range(t):
n, ... | 9 | PYTHON3 |
#include <iostream>
#include<bits/stdc++.h>
#include<math.h>
#include<stdio.h>
using namespace std;
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
//#define mp make_pair
#define mt make_tuple
#define popb pop_back
#define p... | 9 | CPP |
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<l... | 9 | CPP |
//go to line 54 for some useful code.
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.hpp"
#else
#define dbg(...) 47
#define dbgm(...) 47
#endif
// refer https://codeforces.com/blog/entry/66279
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-... | 9 | CPP |
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define precision cout << fixed << setprecision(15);
const int inf = 1e9;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const i... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y... | 9 | CPP |
import sys
input = sys.stdin.readline
mod = 10**9+7
maxx = (2*10**5)+20
from collections import Counter
ans = [1]*maxx
for i in range(10, maxx):
ans[i] = (ans[i-9]+ans[i-10])%mod
for nt in range(int(input())):
n, m = map(int,input().split())
fans = 0
n = str(n)
for digit in n:
# d = {}
# for i in range(10):... | 9 | PYTHON3 |
import sys
input = sys.stdin.readline
mod=10**9+7
mxi=210000
ans=[0]*mxi
cts=[0]*10
cts[0]=1
s=1
for i in range(mxi):
ans[i]=s
s+=cts[-1]
s%=mod
cts[0]+=cts[-1]
cts[0]%=mod
cts.insert(0,cts.pop())
for f in range(int(input())):
n,m=map(int,input().split())
sol=0
for x in str(n):
... | 9 | PYTHON3 |
from sys import stdin,stdout
z=10**9+7
dp={}
for i in range(200009):
if i<9:
dp[i]=2
elif i==9:
dp[i]=3
else:
dp[i]=(dp[i-9]+dp[i-10])%z
for _ in range(int(input())):
n,m=stdin.readline().split()
n=int(n);m=int(m)
ans=0
while n>0:
i=n%10
if (m+i)<10:
... | 9 | PYTHON3 |
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
import math
from collections import Counter
# import sys
# sys.setrecursionlimit(10 ** 9)
CACHES = []
for i in range(10):
CACHES.append(1)
for i in range(10, 2 * 10 ** 5 + 10):
CACHES.append((CACHES[i - 9] + CACHES[i - 10]) % (10 ** 9 +... | 9 | PYTHON3 |
from sys import stdin, stdout, maxsize
R = lambda : stdin.readline().strip()
RL = lambda f=None: list(map(f, R().split(' '))) if f else list(R().split(' '))
output = lambda x: stdout.write(str(x) + '\n')
output_list = lambda x: output(' '.join(map(str, x)))
M = int(1e9) + 7
mx = int(2e5) + 5
dp = [0]+9*[1] +[2] +... | 9 | PYTHON3 |
import sys, math
import heapq
from collections import deque
input = sys.stdin.readline
#input
def ip(): return int(input())
def sp(): return str(input().rstrip())
def mip(): return map(int, input().split())
def mfp(): return map(float, input().split())
def msp(): return map(str, input().split())
def lmip(): return ... | 9 | PYTHON3 |
from sys import stdin,stdout
dp=[]
M=10**9+7
for i in range(200011):
if i<10:
dp.append(1)
else:
dp.append((dp[i-9]+dp[i-10])%M)
for _ in range(int(stdin.readline())):
n,m=stdin.readline().split()
m=int(m)
M=10**9+7
ans=0
for i in n:
ans=(ans+dp[m+int(i)])%M
s... | 9 | PYTHON3 |
//Template Starts Here
//Headers
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <cfloat>
#include <sstream>
#include <unordered_set>
#include <queue>
#include <deque>
#include <iomanip>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#inc... | 9 | CPP |
#include<bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define mk make_pair
#define pb push_back
const int inf=0x3f3f3f3f;
const int maxn=2e5+10;
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
void useiostream()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
ll num[15]={0}... | 9 | CPP |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define fr(i,n) for(int i=0;i<n;i++)
#define fr1(i,k,n) for(int i=k;i<n;i++)
#define foreach(i,arr) for(auto i: arr)
#define sort_inc(a) sort(a.begin(),a.end())
#define sort_dec(a) sort(a.begin(),a.end(),greater<>())
#define exist... | 9 | CPP |
#include <cmath>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <fstream>
#include <cassert>
using namespace std;
istream& inp = cin;
//ifstream inp("in");
template<typename T>
vector<T> readV(int size) {
vector<T> result;
for (int i = 0; i < size; ++i) { T x; inp... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 233333;
const ll mod = 1e9 + 7;
ll dp[10][N];
int main() {
int m = 200011;
for(int i = 0; i <= 9; ++i) dp[i][0] = 1;
for(int i = 1; i <= m; ++i) {
for(int d = 0; d <= 9; ++d) {
if(d <= 8) {
... | 9 | CPP |
import sys
input = sys.stdin.readline
MOD = 1000000007
dp = [1 for _ in range(200010)]
for i in range(10, 200010):
dp[i] = (dp[i-10]+dp[i-9]) % MOD
for _ in range(int(input())):
n, m = map(int, input().split())
ans = 0
while n:
ans += dp[m+n % 10]
n //= 10
ans %= MOD
print(a... | 9 | PYTHON3 |
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdlib>
#include <iomanip>
#include<climits>
#include<fstream>
using namespace std;
//=========================MACROS=====... | 9 | CPP |
import sys
input = sys.stdin.readline
dp = []
M = 10 ** 9 + 7
for i in range(200011):
if i < 10:
dp.append(1)
else:
dp.append((dp[i - 9] + dp[i - 10]) % M)
for _ in range(int(input())):
n, m = input().split()
m = int(m)
M = 10 ** 9 + 7
ans = 0
for i in n:
ans = (ans... | 9 | PYTHON3 |
#include <bits/stdc++.h>
#define PI 3.14159265359
#define lp(i, n) for (size_t i = 0; i < n; i++)
typedef long long ll;
typedef long double ld;
using namespace std;
const char nl = '\n';
const ll MOD = (ll)1e9 + 7;
vector<ll> lenDigit(int d, int m) {
ll occ[10] = {0};
occ[d] = 1;
vector<ll> v;
v.pus... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,n) for(ll i=a ;i<n ;i++)
#define fr(i,a,n) for(ll i=n-1;i>=a;i--)
#define pb push_back
#define read(a,n) for(ll i=0 ;i<n ;i++)cin>>a[i]
#define F first
#define S second
#define endl "\n"
bool pali(string s)
{
for(ll i=0 ;i<s.size()/2 ;... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int max_n = 200005, mod = 1000000007;
int p[max_n];
signed main() {
for (int i = 0; i < 9; i ++)p[i] = 2;
p[9] = 3;
for (int i = 10; i < max_n; i ++) {
p[i] = (p[i - 9] + p[i - 10]) % mod;
}
ios_base :: sync_with_stdio... | 9 | CPP |
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
long long t,n,sum[10],total[200001],temp,temp1,temp2,inf=1000000007,j,ans,formulation;
long long i,m,xiao=200000;
for(i=0; i<10; i++)
sum[i]=0;
sum[0]=1;
sum[1]=1;
total[0]=2;
for(i=1; i<=xiao; i++)
{
... | 9 | CPP |
import sys
def get_ints(): return map(int, sys.stdin.readline().strip().split())
MOD = 10 ** 9 + 7
LIMIT = 20011
dp = []
for i in range(200011):
if i < 10:
dp.append(1)
else:
dp.append((dp[i - 9] + dp[i - 10]) % MOD)
T = int(input())
for _ in range(T):
N, M = get_ints()
ans = 0
whi... | 9 | PYTHON3 |
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int m=200000;
int p=1000000007;
vector<int> dp(m+1);
for(int i=0;i<9;i++){dp[i]=2;}
dp[9]=3;
for(int i=10;i<=m;i++){dp[i]=(dp[i-10]+dp[i-9])%p;}
int t;
cin>>t;
while(t--... | 9 | CPP |
M=10**9+7;L=8**6;d=[1]*L;d[:10]=[1]*10
for i in range(10,L):d[i]=(d[i-9]+d[i-10])%M
for s in[*open(0)][1:]:n,m=s.split();o=int(m);print(sum(d[o+int(c)]for c in n)%M) | 9 | PYTHON3 |
import sys
input = sys.stdin.readline
dp = [2] * 9 + [3] + [0] * 199991
for i in range(10, 200001): # len after applying i times to 10
dp[i] = (dp[i - 9] + dp[i - 10]) % (10 ** 9 + 7)
for _ in range(int(input())):
n, m = map(int, input().split())
ans = 0
while n:
x = n % 10 # last digit
... | 9 | PYTHON3 |
#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
#include<functional>
#include<iterator>
int main()
{
vector<int> operate;
for (int i = 0; i < 200001; i++)
{
if (i < 9)
operate.push_back(2);
if (i == 9)
operate.push_back(3);
if (i > 9)
operate.push_back((operate[i - 9] + op... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
inline int read(){
int X=0; bool flag=1; char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
if(flag) return X;
return ~(X-1);
}
int T,n,m;
typedef long long ll;
ll mod=1e9+7,ans=0l... | 9 | CPP |
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm> // for copy
#include <iterator> // for ostream_iterator
using namespace std;
const int P = 1000000007;
const int M = 200000;
int answer_for_0[M+10];
// the result for the digit 0 is answer_for_0[m]
// the result for any other digit d is ans... | 9 | CPP |
import sys,functools,collections,bisect,math,heapq
input = sys.stdin.readline
#print = sys.stdout.write
mod = 10**9 + 7
sys.setrecursionlimit(300000)
N = 200001
dp = [0]*N
for i in range(9):
dp[i] = 2
dp[9] = 3
for i in range(10,N):
dp[i] = dp[i-9]+dp[i-10]
dp[i] %= mod
t = int(input())
for _ in ra... | 9 | PYTHON3 |
import sys
def get_ints(): return map(int, sys.stdin.readline().strip().split())
MOD = 10 ** 9 + 7
LIMIT = 200011
dp = [0] * LIMIT
for i in range(10):
dp[i] = 1
for i in range(10, LIMIT, 1):
dp[i] = (dp[i - 9] + dp[i - 10]) % MOD
def solve(N, M):
ans = 0
while N:
ans = (ans + dp[N % 10 + M]) %... | 9 | PYTHON3 |
// Просто решаю.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
//KiruxaLight
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#inclu... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define gap ' '
#define fastIO {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define Inf 1e1... | 9 | CPP |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mxn=2e5+10,mod=1e9+7;
int dp[12][mxn];
int main()
{
int arr[]={1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2};
for(int i=0;i<=9;i++)
for(int j=0;j<10;j++)
dp[i][j]=arr[i+j];
for(int i=0;i<=9;i++)
for(int j=10;j<... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int big = pow(10, 9) + 7, size = 200000;
int tt;
cin >> tt;
vector<ll> dp(size+1);
dp[0] = 1;
for (int i = 0; i < size; i++)
{
if (i + 9 < size)
... | 9 | CPP |
#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<stack>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fast ios::s... | 9 | CPP |
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threadi... | 9 | PYTHON3 |
#include<bits/stdc++.h>
#define MAX 200000
#define MOD 1000000007
using namespace std;
int dp[11][MAX+10];
int go(int x,int m)
{
if(dp[x][m]!=-1)
return dp[x][m];
if(m==0)
return dp[x][m] = 1;
if(x==9)
return dp[x][m] = (go(1,m-1)+go(0,m-1))%MOD;
return dp[x][m] = go(x+1,m-1);
}
int main()
{
ios_base::sync_... | 9 | CPP |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <bitset>
#include <math.h>
#include <fstream>
#include <iomanip>
using namespace std;
using ll = long long;
using ld... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
long long m=200000,k=1;
long long sum[200001][10]={{}};
long long a[10]={1,1,1,1,1,1,1,1,1,1},b[10];
int main(){
ios_base::sync_with_stdio(false);
long long j=9;
k=1;
ios_base::sync_with_stdio(false);
for(long long i=0;i<=9;i++)
a[i]=0;
a[j]=1;
while(k<=m)
{
for... | 9 | CPP |
#include<bits/stdc++.h>
#define mp make_pair
#define s second
#define pb push_back
#define eb emplace_back
#define all(v) v.begin(),v.end()
#define mx(a,b) a>b?a:b
#define mn(a,b) a<b?a:b
using namespace std;
const int maxn = 5+2e5;
typedef long long ll;
const int mod = 1e9+7;
int dp[maxn];
int main(){
ios::sync_with... | 9 | CPP |
from sys import stdin
input = stdin.readline
mod = 10**9 + 7
cnt = [1]*(2*10**5+15)
curr = [1,0,0,0,0,0,0,0,0,0]
curr_len = 1
for i in range(2*10**5 + 15):
cnt[i]=curr_len
curr_len = (curr_len + curr[-1])%mod
curr[0] = (curr[0]+curr[-1])%mod
curr.insert(0,curr.pop())
for _ in range(int(input())):
... | 9 | PYTHON3 |
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i = k ;i<=n;i++)
#define FO(i,n,k) for(int i = n;i>=k;i--)
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi... | 9 | CPP |
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define fab(i,a,b) for(i=a;i<=b;i++)
#define fabr(i,a,b) for(i=b;i>=a;i--)
#define f(i,n) for(i=0;i<n;i++)
#define sc second
#define fr first
#define pb push_back
#define mp make_pair
#define mo... | 9 | CPP |
# Author : nitish420 --------------------------------------------------------------------
import os
import sys
from io import BytesIO, IOBase
def main():
mod=10**9+7
mm=200000
dp=[0 for _ in range(mm+1)]
dp[0]=2
dp[1]=2
for i in range(2,9):
dp[i]=2
dp[9]=3
for i in range(10,mm+... | 9 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
const int mod = 1e9 + 7;
int dp[MAXN][10];
void solve()
{
for(int i = 0; i <= 9; i++)
{
dp[0][i] = 1;
}
for(int i = 1; i < MAXN; i++)
{
for(int j = 0; j <= 9; j++)
{
if(j == 9)
dp[i][j] = (dp[i - 1][0] + dp[i - 1][1]) % mod;
... | 9 | CPP |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
#define debug(x) cout << #x << " is " << x << endl
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f, N = 2e5 + 15;
const ll MOD = 1e9 + 7;
int t, n, m;
ll a[N];
int main()
... | 9 | CPP |
import sys
import io,os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def solve_tc(dp):
mod = 1000000000 + 7
n, m = map(int, input().split())
cnt = 0
while n > 0:
x = int(n % 10)
if m + x < 10:
cnt += 1
else:
cnt += dp[m + x - 10]
... | 9 | PYTHON3 |
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
#define rep(i,j,n) for(int i=(j);i<=((int)n);++i)
#define rev(i,n,j) for(int i=(n);i>=((int)j);--i)
typedef long long int ll;
#define int long long int
const ll INFL=0x3f3f3f3f3f3f3f3fLL;
const int INF=0x3f3f3f3f;
const int mod=1000000007;
#define endl "\n"
#define... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 1000000007
#define vi vector<int>
#define vl vector<long long>
#define pi pair<int,int>
#define pl pair<long long,long long>
#define pb push_back
#define mi map<int,int>
#define ml map<long long,long long>
ll dp[10][200001];
ll a[10];
ll... | 9 | CPP |
import sys
input = sys.stdin.readline
M = 10 ** 9 + 7
dp = [[0, 0] for i in range(200001)]
for i in range(200001):
if i < 10:
dp[i][0] = 1
dp[i][1] = 1
if i == 9:
dp[i][1] = dp[1][1] + dp[1][0]
else:
dp[i][0] = (dp[i - 10][1] + dp[i - 10][0]) % M
dp[i][1] = (dp[i - 9][1] + dp[i - 9][0]) ... | 9 | PYTHON3 |
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9 + 7;
template<typename T, typename U>
pair<T, U> operator+... | 9 | CPP |
def main():
import sys
input = sys.stdin.readline
MOD=10**9+7
t=int(input())
x=1
m=int(2*1e5+10)
dp= [1 for i in range(m+1) ]
for i in range(10,m+1):
dp[i]=(dp[i-10]+dp[i-9])%(MOD)
for _ in range(t):
n,k=map(int,input().split())
sums=0
while n:
... | 9 | PYTHON3 |
from sys import stdin
input = stdin.readline
mxn = 2 * (10 ** 5) + 15
mod = 10 ** 9 + 7
dp = [1] * mxn
for i in range(10, mxn):
dp[i] = (dp[i - 9] + dp[i - 10]) % mod
for test in range(int(input())):
n, k = map(int, input().strip().split())
ans = 0
for i in str(n):
ans = (ans + dp[k + int(i)]... | 9 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int max_n = 200005, mod = 1000000007;
int dp[max_n];
signed main(){
for(int i=0; i<9; i++)dp[i] = 2;
dp[9] = 3;
for(int i=10; i<max_n; i++){
dp[i] = (dp[i-9] + dp[i-10])%mod;
}
ios_base::sync_with_stdio(false);
... | 9 | CPP |
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constex... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
//define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define debug(x) cout << #x <<'\t' << x <<endl
#else
#define debug(x)
#endif
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
#define fast io... | 9 | CPP |
#include<bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>
#define ull unsigned long long int
//#define lli long long int
#define int long long int
#define NUM 1000000007
#define mp make_pair
#define pb push_back
#define ITR ::iterator
#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(N... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MAXM 200015
long long y;
int pd[MAXM];
int solve(int x){
if(x < 0) return 0;
if(pd[x] == -1){
if(x <= 9) pd[x] = 1;
else{
y = (solve(x - 10) + solve(x - 9));
if(y > MOD) y -= MOD;
pd[x] = y;
}
}
return p... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
//typedef unsigned long long int ull;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector<vector<ll>> v(10,vector<ll> (200001,0));
ll A[10];ll B[10] = {0};
ll maxx = 200000;
for(int I=0;I<... | 9 | CPP |
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
ll mod=1000000007;
using namespace std;
ll gcd(ll a, ll b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
ll dp[10][200001];
//ll dp[200001][10];
// void calc()
// {
// for(int i=0;i<=9;i++) dp[0][i]=1;//base case
// for(int i=1;i<=20000... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
#define long long long
#define fi first
#define se second
const long MOD = 1e9+7;
const long LINF = 1e18;
const long INF = 1e9;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
int D[10][200003][10];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char a[20];
ll dp[200020];
ll cnt1[10];
ll cnt2[10];
ll mod=1e9+7;
int main()
{
cnt1[0]=1;
for(int i=1;i<=9;i++){
cnt1[i]=0;
}
dp[0]=1;
for(int i=1;i<200020;i++){
if(i%2==1){
memset(cnt2,0,sizeof(cnt2));
}else{
memset(cnt1,0,sizeof(cnt1... | 9 | CPP |
#include<bits/stdc++.h>
using namespace std;
const int N = 300005;
const int mod = 1e9 + 7;
#define ll long long
#define rep(i, a, b) for(int i=(a);i<=(b);++i)
#define per(i, a, b) for(int i=(a);i>=(b);--i)
#define ms(a, b) memset(a, b, sizeof a)
int n, T, m;
ll f[N + 100];
int main(){
for(int i=0;i<=9;i++)f[i]=1;
f... | 9 | CPP |
#include <bits/stdc++.h>
#define int long long int
#define F first
#define S second
#define MK make_pair
#define pb push_back
#define mid (l + r) / 2
using namespace std ;
const int N = 3e5 + 100 , M = 1e9 + 7;
int n , m , k , a[N] , f[10][N] , s[N] ;
int32_t main(){
ios::sync_with_stdio(false),cin.tie(0),cout.... | 9 | CPP |
//#pragma GCC optimize("Ofast,fast-math,unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt")
#include <bits/stdc++.h>
//#define int32_t int64_t
/*
const size_t MAX_MEM = 2e8;
char MEM[MAX_MEM];
size_t MEM_POS = 0;
void* operator new(size_t x) {
auto ret = MEM + MEM_POS;
MEM_... | 9 | CPP |
import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import itertools
import bisect
import heapq
#sys.setrecursionlimit(100000)
#^^^TAKE CARE FOR MEMORY LIMIT^^^
def main():
pass
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd ... | 9 | PYTHON3 |
#include<iostream>
#include<stack>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<functional>
#include<limits.h>
#include<utility>
#include<queue>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<bitset>
#include<time.h>
#include<unordered_map>
#define lowbit(x) ... | 9 | CPP |
from sys import stdin,stdout
dp=[]
M=10**9+7
for i in range(200011):
if i<10:
dp.append(1)
else:
dp.append((dp[i-9]+dp[i-10])%M)
for _ in range(int(input())):
n,m=stdin.readline().split()
m=int(m)
M=10**9+7
ans=0
for i in n:
ans=(ans+dp[m+int(i)])%M
print(ans) | 9 | PYTHON3 |
from sys import stdin, stdout
dp = [0] * 200005
for i in range(0, 9):
dp[i] = 2
dp[9] = 3
for i in range(10, 200005):
dp[i] = (dp[i-10] + dp[i-9]) % 1000000007
ans = ''
for i in range(int(input())):
n, m = stdin.readline().split()
m = int(m)
res = 0
for s in n:
s = int(s)
i... | 9 | PYTHON3 |
import sys
input = sys.stdin.readline
MOD=(1e9)+7
t=int(input())
m=int(2*1e5+11)
dp= [1 for i in range(m+1) ]
for i in range(10,m+1):
dp[i]=(dp[i-10]+dp[i-9])%(MOD)
for _ in range(t):
n,k=map(int,input().split())
sums=0
while n:
sums = (sums+dp[k+n%10])
n = n//10
sums %=MOD
... | 9 | PYTHON3 |
import sys
input = sys.stdin.readline
dp = []
M = 10 ** 9 + 7
for i in range(200011):
if i < 10:
dp.append(1)
else:
dp.append((dp[i - 9] + dp[i - 10]) % M)
for _ in range(int(input())):
n, m = input().split()
m = int(m)
ans = 0
for i in n:
ans = (ans + dp[m + int(i)]) ... | 9 | PYTHON3 |
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int M = 1e9+7;
ll mod(ll x){
return (x%M + M)%M;
}
ll mul(ll a, ll b){
return mod((mod(a)*mod(b)));
}
ll add(ll a , ll b){
return mod(mod(a)+mod(b));
}
void solve(){
vector<vector<int>>dp(200001,vector<int>... | 9 | CPP |
import os
import sys
from io import BytesIO, IOBase
def main():
mod = 10 ** 9 + 7
mm = 200000
dp = [0 for _ in range(mm + 1)]
dp[0] = 2
dp[1] = 2
for i in range(2, 9):
dp[i] = 2
dp[9] = 3
for i in range(10, mm + 1):
dp[i] = (dp[i - 9] + dp[i - 10]) % mod
for _ in r... | 9 | PYTHON3 |
import sys
input = sys.stdin.readline
t = int(input().strip())
M = 1000000007
dp = [0] * (2 * 100000+20)
dp[:10] = list(1 for i in range(10))
for i in range(10, 2*100000+20):
dp[i] = dp[i-9] + dp[i-10]
dp[i] %= M
while t:
t -= 1
n, m = map(int, input().strip().split())
n = str(n)
result = 0
... | 9 | PYTHON3 |
# Author: yumtam
# Created at: 2021-04-29 12:58
MOD = 10**9 + 7
a = []
c = [1] + [0]*9
for _ in range(2 * 10**5 + 50):
a.append(sum(c))
d = [0] * 10
for i in range(9):
d[i+1] = c[i]
d[0] = (d[0] + c[9]) % MOD
d[1] = (d[1] + c[9]) % MOD
c = d
import sys, os, io
input = lambda: sys... | 9 | PYTHON3 |
# main.py
# Code Jam only
# import numpy as np
# import scipy as sp
import sys
# import itertools
# import functools
# import math
input = sys.stdin.readline
mod = pow(10, 9) + 7
arr = [0]*(200020)
for i in range(10):
arr[i] = 1
for i in range(10, 200020):
arr[i] = (arr[i-10] + arr[i-9])%mod
def sol... | 9 | PYTHON3 |
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
class Solution:
def __init__(self):
#self.cache = {}
self.mod = 10**9 + 7
N = 2 * 10**5 + 1
self.dp = [1] * N
for i in range(10,N):
self.dp[i] = (self.dp[i-10] + self.dp[i-9]) % self.mod
... | 9 | PYTHON3 |
// Problem: C. Add One
// Contest: Codeforces - Divide by Zero 2021 and Codeforces Round #714 (Div. 2)
// URL: https://codeforces.com/contest/1513/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<iostream>
#include<cstring>
#include<cmath>
#include<s... | 9 | CPP |
from sys import stdin
dp=[0]*(2*10**5+1)
for i in range(9):
dp[i]=2
dp[9]=3
for i in range(10,2*10**5+1):
dp[i]=(dp[i-9]+dp[i-10])%(10**9+7)
for _ in range(int(input())):
n,m=map(int,stdin.readline().split())
n=str(n)
a=[0]*len(n)
ans=0
for i in n:
temp=int(i)+m
if temp<10:
... | 9 | PYTHON3 |
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ifs freopen("aa.in","r",stdin);
#define ofs freopen("aa.out","w",stdout);
#define iof ifs ofs
#define ll long long
#define ld ... | 9 | CPP |
//Bismillahir Rahmanir Raheem
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
ll dp[200001][11];
ll f(ll m,ll x){
if(m==0)return 0;
if(dp[m][x]!=-1)return dp[m][x];
dp[m][x]=0;
if(m>=(... | 9 | CPP |
#include "bits/stdc++.h"
using namespace std;
/*
find my code templates at https://github.com/galencolin/cp-templates
also maybe subscribe please thanks
*/
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL);}
#define f first
#define s second
#define getunique(v) {sort(v.begin(), v.end()); v.... | 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
const long long N=1e9+7;
#define int long long
#define pb push_back
#define f first
#define si second
#define mp make_pair
#define fastrack ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define PI 3.1415926535897
string alp="abcdefghijk... | 9 | CPP |
import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 25
MOD = pow(10, 9) + 7
BUFSIZE = 8192
from collections import defaultdict
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
... | 9 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.