from collections import defaultdict, deque
from functools import lru_cache
from heapq import heappush, heappop
from bisect import bisect_right, bisect_left
from fractions import Fraction as frac
import math
hpop = heappop
hpush = heappush
MOD = 10**9 + 7
def calc(x):
d_sum = sum(map(int,str(x)))
return x*x + d_sum *x
def solution():
n,d = map(int, input().split())
n += 1
k = 1
while 1:
if n%k > d:
break
k *= 10
k //= 10
print(n - n%k - 1)
def main():
t = 1
for _ in range(t):
solution()
import sys
import threading
sys.setrecursionlimit(1 << 30)
threading.stack_size(1 << 27)
thread = threading.Thread(target=main)
thread.start(); thread.join()
#include<iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define HarveySpecter ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using ll= long long;
const int N=1e5+7;
int main()
{
HarveySpecter;
ll p,d;
cin>>p>>d;
ll diff = 0;
ll no;
ll k = 1;
ll x;
ll ans = p;
while(1)
{
no = p;
x = pow(10,k);
no = p - p%x - 1;
diff = p - no;
k++;
if(diff <= d)
{
if(no % x > p % x)
{
ans = no;
}
}
else
{
break;
}
}
cout<<ans;
return 0;
}
1634B - Fortune Telling | 1358A - Park Lighting |
253C - Text Editor | 365B - The Fibonacci Segment |
75A - Life Without Zeros | 1519A - Red and Blue Beans |
466A - Cheap Travel | 659E - New Reform |
1385B - Restore the Permutation by Merger | 706A - Beru-taxi |
686A - Free Ice Cream | 1358D - The Best Vacation |
1620B - Triangles on a Rectangle | 999C - Alphabetic Removals |
1634C - OKEA | 1368C - Even Picture |
1505F - Math | 1473A - Replacing Elements |
959A - Mahmoud and Ehab and the even-odd game | 78B - Easter Eggs |
1455B - Jumps | 1225C - p-binary |
1525D - Armchairs | 1257A - Two Rival Students |
1415A - Prison Break | 1271A - Suits |
259B - Little Elephant and Magic Square | 1389A - LCM Problem |
778A - String Game | 1382A - Common Subsequence |