codeparrot/codecomplex huggingface dataset:
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.io.*;
import java.math.BigInteger;
import java.util.*;
	
public 	class a {
		public static void main(String args[])throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		OutputStream out=new BufferedOutputStream(System.out);
		String s[]=br.readLine().trim().split("\\ ");
		BigInteger a1=new BigInteger(s[0]);
		BigInteger a=new BigInteger(s[0]);
		String q=a.toString();
		String q1=q.substring(q.length()-1, q.length());
		a=a.subtract(new BigInteger(q1));
		//System.out.println(a.toString());
		BigInteger c=new BigInteger("1");
		BigInteger b=new BigInteger(s[1]);
		int z=check(a,a.toString(),b);
		if(z==1)
		{
			out.write("0".getBytes());
			out.flush();
			//System.out.println("jwefcyuwe");
			return;
		}
		while(a.compareTo(c)>0)
		{
			BigInteger d=a;
			if(d.subtract(c).compareTo(new BigInteger("9"))==-1)
			{
				break;
			}
			else
			{
				BigInteger mid=a;
				mid=mid.add(c);
				mid=mid.divide(new BigInteger("2"));
				//System.out.println(mid.toString());
				if(check(mid,mid.toString(),b)==1)
				{
					c=mid;
					c=c.add(new BigInteger("1"));
				}
				else
				{
					a=mid;
					
					//System.out.println(a.toString());
				}
					
			}
			
		}
		 q=a.toString();
		 q1=q.substring(q.length()-1, q.length());
		a=a.subtract(new BigInteger(q1));
		BigInteger ans=a1.subtract(a);
		ans=ans.add(new BigInteger("1"));
		out.write(ans.toString().getBytes());
		//System.out.print("sfvlksfv");
		
		
		out.flush();
	}
		
		static int check(BigInteger a,String s,BigInteger b)
		{
			int l=s.length();
			long z=0;
			for(int i=0;i<l;i++)
			{
				z+=Long.parseLong(s.substring(i,i+1));
			}
			BigInteger c=a.subtract(new BigInteger(Long.toString(z)));
			//System.out.println(c.toString());
			return -1*c.compareTo(b);
		}
	}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn

import java.io.*;
import java.util.*;

public class Main {
    public static void main (String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        long n = Long.parseLong(st.nextToken()),
            s = Long.parseLong(st.nextToken());
        long m = s;
        while (m-f(m)<s && m<=n) m++;
        System.out.println(Math.max(n-m+1, 0));
    }
    
    public static int f(long n) {
        int sum = 0;
        for (long i=0, j=1L ; i<(int)Math.log10(n)+1 ; i++, j*=10) {
            sum += (n/j)%10;
        }
        return sum;
    }
    
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
//package educational.round23;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class C3 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		long n = nl();
		long S = nl();
		long ret = Math.max(0, n-S+1);
		for(long i = S;i <= S + 300 && i <= n;i++){
			long b = i;
			for(long x = i;x > 0;x /= 10){
				b -= x % 10;
			}
			if(b < S)ret--;
		}
		out.println(ret);
	}
	
	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception { new C3().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] in = br.readLine().split(" ");
		long n = Long.parseLong(in[0]), s = Long.parseLong(in[1]);
		Solver solver = new Solver(n, s);
		System.out.println(solver.solve());

	}

}

class Solver {

	private long n, s;

	Solver(long n, long s) {
		this.n = n;
		this.s = s;
	}

	public long solve() {
		long low = 1, high = n;
		for (int i = 0; i < 72; ++i) {
			long x = low + (high - low) / 2;
			if (check(x))
				high = x - 1;
			else
				low = x + 1;
		}
		return n - high;
	}

	private boolean check(long x) {

		long tmp = x;
		int sum = 0;
		while (tmp > 0) {
			sum += tmp % 10;
			tmp /= 10;
		}
		return x - sum >= s;
	}
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.Scanner;

public class A {
	
	public static boolean realbig (long num, long s) {
		String str = num + "";
		String[] digs = str.split("");
		int sum = 0;
		for(String dig : digs) {
			sum+= Integer.parseInt(dig);
		}
		if(num-sum < s) {
			return false;
		} else {
			return true;
		}
	}

		
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long s = sc.nextLong();
		sc.close();
		long count = 0;
		long i = s;
		for(; i < s+200 && i <= n; i++) {
			if(realbig(i,s)) {
				count++;
			}
		}
		if(i <= n) {
			count+=n-i+1;
		}
		System.out.println(count);
	}
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn

import java.util.Scanner;

public class b817 {
	public static Scanner scn = new Scanner(System.in);

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		long n = scn.nextLong();
		long s = scn.nextLong();

		long lo = 0;
		long hi = n ;
		while(lo<=hi)	
		{
			long mid=(lo+hi)/2; 
			if(check(mid, s))// no's greater thn this grtr
			{
				hi=mid-1;
			}
			else
			{
				lo=mid+1;
			}
			
		}
		if(check(lo, s))
		{
		System.out.println(n-lo+1);
		}
		else // could check initially too
		{
			System.out.println("0");
			
		}
	}

	public static boolean check(long n, long s) {
		long sum=0;
		long a=n;
		while(n>0)
		{
		
		sum=sum+(n%10);
		n=n/10;
		}
		if(a-sum>=s)
		{
			return true;
		}
		return false;

	}

}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        int digitsum(long n) {
            int ans = 0;
            while (n > 0) {
                ans += n % 10;
                n /= 10;
            }
            return ans;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long s = in.nextLong();

            if (s >= n) {
                out.println(0);
                return;
            }

            long ans = s;
            while (ans < s + digitsum(ans)) {
                ans++;
            }

            if (n >= ans) {
                out.println(n - ans + 1);
            } else {
                out.println(0);
            }


        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.Arrays;
import java.util.Scanner;

public class P817C
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		long s = scan.nextLong();
		long ans = 0;
		if (s > n)
		{
			System.out.println(0);
			return;
		}
		if (n > s+200)
		{
			ans += n-(s+200);
			n = s+200;
		}
		for (long i = s; i <= n; i++)
		{
			char[] num = (""+i).toCharArray();
			int sum = 0;
			for (int j = 0; j < num.length; j++)
				sum += num[j] - '0';
			if (i - sum >= s)
				ans++;
		}
		System.out.println(ans);
	}
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		long s = scanner.nextLong();
		long l = 0, r = n + 1;
		while(r - l > 1) {
			long mid = (l + r) / 2;
			long k = mid, sum = 0;
			while(k != 0) {
				sum += k % 10;
				k /= 10;
			}
			if(mid - sum >= s) r = mid; else l = mid;
		}
		System.out.print(n - r + 1);
	}
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.*;
import java.io.*;
import java.math.*;

public class Main{

  public static boolean check(BigInteger a, BigInteger b){
    long  n = 0;
    String aStr = a.toString();
    for (int i=0; i < aStr.length() ;i++ ) {
      n += Long.valueOf(aStr.charAt(i)-'0');
    }
    return a.subtract(BigInteger.valueOf(n)).compareTo(b) >= 0;
  }

  public static void main(String[] args) {
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){
      String[] str = in.readLine().split(" ");
      BigInteger n = new BigInteger(str[0]);
      BigInteger s = new BigInteger(str[1]);

      BigInteger left = BigInteger.ONE;
      BigInteger right = new BigInteger(n.toString()).add(BigInteger.TEN);

      BigInteger TWO = BigInteger.ONE.add(BigInteger.ONE);

      BigInteger t;

      while(right.subtract(left).compareTo(BigInteger.ONE)>0){
        t = left.add(right.subtract(left).divide(TWO));
        if(check(t, s)){
          right = t;
        }else{
          left = t;
        }
      }
      BigInteger result = n.subtract(right).add(BigInteger.ONE);
      if (result.compareTo(BigInteger.ZERO)<=0) {
        System.out.println(0);
      }else{
        System.out.println(result);
      }

    }catch (IOException e) {
      e.printStackTrace();
    }
  }
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class P {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong(), S = sc.nextLong();
		long lo = 0, hi = N;
		long pivot = 0;
		while (lo <= hi) {
			long mid = lo + (hi - lo) / 2;
			int sumOfDigits = 0;
			long saveMid = mid;
			while (saveMid > 0) {
				sumOfDigits += saveMid % 10;
				saveMid /= 10;
			}
			if (mid - sumOfDigits < S) {
				pivot = mid;
				lo = mid + 1;
			} else
				hi = mid - 1;
		}

		System.out.println(N - pivot);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String f) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(f));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] nextIntArray1(int n) throws IOException {
			int[] a = new int[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] shuffle(int[] a, int n) {
			int[] b = new int[n];
			for (int i = 0; i < n; i++)
				b[i] = a[i];
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				int t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
			return b;
		}

		public int[] nextIntArraySorted(int n) throws IOException {
			int[] a = nextIntArray(n);
			a = shuffle(a, n);
			Arrays.sort(a);
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArray1(int n) throws IOException {
			long[] a = new long[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArraySorted(int n) throws IOException {
			long[] a = nextLongArray(n);
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				long t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
			Arrays.sort(a);
			return a;
		}
	}

}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.Scanner;

public class CodeforcesC {

	public static void main(String[] args) {
		Scanner ob = new Scanner(System.in);
		long n = ob.nextLong();
		long s = ob.nextLong();
		long l = 1;
		long r = n;
		while(l<=r){
			long mid = (l + r)/2;
			if(reallybignumber(mid,s)){
				r = mid-1;
			}else{
				l = mid +1;
			}
		}
		/******long l1 = l;
		***while(l1<=n) {
			System.out.print(l1 + " ");
			l1++;
		}*/////////
		System.out.println(n-l+1);

	}

	private static boolean reallybignumber(long n,long s) {
		long m = n;
		long sum=0;
		int d=1;
		while(m>0){
			long rem = m % 10;
			sum =   rem * d + sum;
			m = m / 10;
		}
		if(n-sum >= s) return true;
		else return false;
	}

}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.Scanner;

public class C {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long n = scan.nextLong();
		long s = scan.nextLong();
		long low = 0;
		long high = n + 1;
		while (high-low>1) {
			long sum = 0;
			long mid = (high + low) / 2;
			long value = findSum(mid, sum);
			if (mid - value >= s)
				high = mid;
			else
				low = mid;
		}
		
		System.out.println(n - high + 1);

		scan.close();
	}

	public static long findSum(long n, long sum) {
		if (n == 0)
			return sum;
		return findSum(n / 10, sum + n % 10);
	}

}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.io.*;
import java.util.*;

public class CF817C {
	static long count(long x) {
		return x < 10 ? x : count(x / 10) + x % 10;
	}
	static boolean check(long x, long s) {
		return x - count(x) >= s;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		long n = Long.parseLong(st.nextToken());
		long s = Long.parseLong(st.nextToken());
		int d = 9 * 18;
		long cnt;
		if (n >= s + d) {
			cnt = n - s - d;
			for (long x = s; x <= s + d; x++)
				if (check(x, s))
					cnt++;
		} else {
			cnt = 0;
			for (long x = s; x <= n; x++)
				if (check(x, s))
					cnt++;
		}
		System.out.println(cnt);
	}
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.*;
import java.io.*;

@SuppressWarnings("Duplicates")
public class C817 {
    private FastScanner in;
    private PrintWriter out;

    private long calcSum(long x) {
        int ans = 0;
        while (x > 0) {
            ans += x % 10;
            x /= 10;
        }
        return ans;
    }

    private long calcDiff(long x) {
        return x - calcSum(x);
    }

    private long binSearch(long n, long s) {
        long l = 0;
        long r = n + 1;

        while (r - l > 1) {
            long m = (r + l) >> 1;
            if (calcDiff(m) >= s) {
                r = m;
            } else {
                l = m;
            }
        }
        return l;
    }

    private void solve() throws IOException {
        long n = in.nextLong();
        long s = in.nextLong();

        long ans = binSearch(n, s);

        out.println(n - ans);
    }

    private void run() {
        try {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }

    public static void main(String[] arg) {
        new C817().run();
    }
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.Scanner;

public class Main
{

    public static void main(String[] args)
    {
        setup();
        xuly();
    }

    private static long dp[][] = new long[20][170];

    private static void setup() {
        dp[0][0] = 1;
        for (int i = 1; i < 20; i ++)
            for (int j = 0; j < 170; j ++)
                for (int k = Math.max(j - 9, 0); k <= j; k ++)
                    dp[i][j] += dp[i - 1][k];
    }

    private static int sumD(long x) {
        int ret = 0;
        while(x > 0) {
            ret += x % 10;
            x /= 10;
        }
        return ret;
    }

    private static long numSatisfy(long limit, int sumDigit) {
        long ret = 0;
        int curSum = sumD(limit);
        if (curSum == sumDigit)
            ret ++;

        for (int i = 0; i < 20; i ++) {
            int bound = (int) (limit % 10);
            curSum -= bound;
            for (int d = 0; d < bound && curSum + d <= sumDigit; d ++)
                ret += dp[i][sumDigit - curSum - d];
            limit /= 10;
        }

        return ret;
    }

    private static void xuly() {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();
        long s = scanner.nextLong();
        long ans = 0;
        for (int sum = 1; sum < 170; sum ++)
            if (n >= s + sum)
                ans += numSatisfy(n, sum) - numSatisfy(s + sum - 1, sum);
        System.out.print(ans);
    }
}
// Problem: 817_C. Really Big Numbers
// Time complexity: logn
import java.util.*;
import java.io.*;

public class _817C {

    static long sum = 0;

    static long BSearch2(long st, long end, long lim) {

        if (st > end) return 0;
        long mid = (st + end) >> 1;
        if (mid - sumDigit(mid) >= lim) {
            sum = mid;
            return BSearch2(st, mid - 1, lim);
        }
        if (mid - sumDigit(mid) < lim)
            return BSearch2(mid + 1, end, lim);
        return 0;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long s = Long.parseLong(st.nextToken());
        long n = Long.parseLong(st.nextToken());
        BSearch2(1, s, n);
        if (sum == 0) System.out.println("0");
        else System.out.println(s - sum + 1);

    }

    static long sumDigit(long z) {
        String s = "" + z;
        int c = 0;
        for (int i = 0; i < s.length(); i++) c += s.charAt(i);
        return c - s.length() * 0x30;
    }
}