jiahuimbzuai/CoQuIR huggingface dataset:
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret
}

func main() {
    let n = readInt()
    var table = [readInts(),readInts()]
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var remOver = table[0].reduce(0) { $0 + $1 }
    var remUnder = table[1].reduce(0) { $0 + $1 }
    
    print(remOver,remUnder)
    var ans = 0
    
    
    for i in 0..<n {
        ans += table[0][i]
        if remOver - table[0][i] < remUnder {
            ans += remUnder
            break
        }
        remOver -= table[0][i]
        remUnder -= table[1][i]
    }
    
    print(ans)
}
main()
//  [typescript]
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const n = parseInt(readMany(1)[0])
    const a = []
    a.push(readMany(n).map(it => parseInt(it)))
    a.push(readMany(n).map(it => parseInt(it)))

    let max = 0

    for (let i = 0; i < n; i += 1) {
        let candies = 0
        for (let j = 0; j <= i; j += 1) candies += a[0][j]
        for (let j = i; j < n; j += 1) candies+= a[1][j]
        if (candies > max) max = candies
    }

    console.log(max)
})()
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const _n = stdin.split('\n')[0]
const n = Number(_n)

const a1 = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)
const a2 = stdin
  .split('\n')[2]
  .split(' ')
  .map(Number)

const a1Total = i => {
  let sum = 0
  for (let j = 0; j <= i; j++) {
    sum += a1[j]
  }
  return sum
}

const a2Total = i => {
  let sum = 0
  for (let j = i; j < a2.length; j++) {
    sum += a2[j]
  }
  return sum
}

const res = _ => {
  let max = 0
  for (let i = 0; i < n; i++) {
    const sum = a1Total(i) + a2Total(i)
    max = sum > max ? sum : max
  }
  return max
}

console.log(res())
//  [typescript]
{
  const run = (input: string) => {
    let splitted = input.trim().split("\n")
    const n = parseInt(splitted[0])

    const first = splitted[1].trim().split(" ").map(v => parseInt(v))
    const second = splitted[2].trim().split(" ").map(v => parseInt(v))

    let firstSum = first.reduce((a: number, x: number) => a + x) + second[n - 1]
    let secondSum = second.reduce((a: number, x: number) => a + x)

    let sum = 0
    let tmpSum = 0
    let tmpFirstSum = 0
    for (let i = 0; i < n; i++) {
      tmpSum = firstSum > secondSum ? tmpFirstSum + firstSum : tmpFirstSum + secondSum;
      if (sum < tmpSum) sum = tmpSum

      tmpFirstSum += first[i]
      firstSum -= first[i]
      if (second[i - 1] != null) secondSum -= second[i - 1]
    }

    return sum
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}
//  [typescript]
{
  const run = (input: string) => {
    let splitted = input.trim().split("\n")
    const n = parseInt(splitted[0])

    const first = splitted[1].trim().split(" ").map(v => parseInt(v))
    const second = splitted[2].trim().split(" ").map(v => parseInt(v))

    let firstSum = first.reduce((a, x) => a + x)
    let secondSum = second.reduce((a, x) => a + x)

    let sum = 0

    for (let i = 0; i < n; i++) {
      sum += first[i]
      firstSum -= first[i]

      if (second[i - 1] != null) {
        secondSum -= second[i - 1]
      }

      if (first[i + 1] == null || firstSum < secondSum) {
        return sum + secondSum
      }
    }


    return sum
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}
//  [typescript]
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const n = parseInt(readMany(1)[0])
    const a = []
    a.push(readMany(n).map(it => parseInt(it)))
    a.push(readMany(n).map(it => parseInt(it)))

    let candies = [] // i 列目で下に移動したときのアメ

    for (let i = 0; i < n; i += 1) {
        candies[i] = 0
        for (let j = 0; j <= i; j += 1) candies[i] += a[0][j]
        for (let j = i; j < n; j += 1) candies[i] += a[1][j]
    }

    candies = candies.sort()

    console.log(candies[candies.length - 1])
})()
//  [typescript]
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const n = parseInt(readMany(1)[0])
    const a = []
    a.push(readMany(n).map(it => parseInt(it)))
    a.push(readMany(n).map(it => parseInt(it)))

    let candies = [] // i 列目で下に移動したときのアメ

    let firstRow = 0 // 上だけの場合の数
    for (let i = 0; i < n; i += 1) {
        firstRow += a[0][i]
        candies = candies.map(it => it + a[1][i])
        candies.push(firstRow + a[1][i])
    }

    candies = candies.sort()

    console.log(candies[candies.length - 1])
})()
//  [python]
n,k=map(int,input().split())
s=n-(1*k)+1
if k==1:
  print(0)
else:
  print(s-1)
//  [python]
N, K = map(int, input().split())

if K==1:
  print(0)
else:
  print(N-K)
//  [python]
N, K = map(int, input().split())

if K == 1 : print(0)
else : print(N - K)
//  [python]
n,k=map(int,input().split())
if k == 1:
  print(n)
else:
  print(n-k)
//  [python]
n,k=map(int,input().split())
if k==1:print(0)
elif n>k:print(n-k)
//  [python]
n, k = map(int, input().split())
ans = n-k if k > 1 else 0
//  [java]
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt(), k = fs.nextInt();
		if(k==1)System.out.println(0);
		else System.out.println(n-k);
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

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

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

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

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}
//  [java]
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 str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		if (k != 1)
			System.out.println(n - k);
		else
			System.out.println("0");
	}
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans = 0;
        ans = N-K;
        System.out.println(ans);
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int K = ni();
        if(N==1){
            out.println(0);
            return;
        }
        long ans = N-K;
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);
    int upperBound(ArrayList<Long> list, Long target){
        int i = Collections.binarySearch(list, target, new UpperBoundComparator<Long>());
        return ~i;
    }
    class UpperBoundComparator<T extends Comparable<? super T>> implements Comparator<T>{
        public int compare(T x, T y){
            return (x.compareTo(y) > 0) ? 1 : -1;
        }
    }
    int lowerBound(ArrayList<Long> list, Long target){
        int i = Collections.binarySearch(list, target, new LowerBoundComparator<Long>());
        return ~i;
    }
    class LowerBoundComparator<T extends Comparable<? super T>> implements Comparator<T>{
        public int compare(T x, T y){
            return (x.compareTo(y) >= 0) ? 1 : -1;
        }
    }
    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int k = scn.nextInt();
      	System.out.println(n-k);
	}
}
//  [cpp]
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>

namespace IO{
    const int insiz = 1 << 12, outsiz = 1 << 18;
    char in[insiz], *A(in), *B(in); char out[outsiz], *ptr(out);
    inline char getc(){
    	#ifndef LOCAL
        return (A == B) && (B = (A = in) + fread(in, 1, insiz, stdin), A == B) ? EOF : *A++;
        #endif
        return getchar();
    }
    template <typename T> inline T read(){
        T ret(0), p(1); char ch(getc());
        while(ch < '0' || ch > '9'){
            if(ch == '-') p = -1; ch = getc();
        }
        while(ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0', ch = getc();
        return ret*p;
    }
    inline void flush(){ fwrite(out, 1, ptr - out, stdout); ptr = out; }
    template <typename T> inline void write(T x, char cmd = '\n'){
        if(x < 0) *ptr++ = '-', x = -x;
        if(x == 0) *ptr++ = '0';
        static char s[123]; int cnt = 0;
        for(; x; x /= 10) s[++cnt] = x % 10 + '0';
        for(; cnt; --cnt) *ptr++ = s[cnt];
        *ptr++ = cmd;
        if((outsiz >> 1) > ptr - out) flush();
    }
} using IO::getc; using IO::read; using IO::write; using IO::flush;

int main(){
	int n = read<int>(),m = read<int>();
	if(m == 1){
		write(0);
	}
	else{
		write(n - m);
	}
	flush(); return 0;
}
//  [cpp]
#include <cstdio>
#include <cctype>
#define reg register
using namespace std;
template <class t> inline void rd(t &s)
{
	s=0;
	reg char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return;
}
signed main(void)
{
	int n,k;
	rd(n);rd(k);
	if(k==1)
		return puts("0"),0;
	printf("%d",n-k);
	return 0;
}
//  [cpp]
#include <cstdio>

using namespace std;

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    printf("%d\n", k == 1 ? 0 : n - k);
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	
	int n, k; cin >> n >> k;
	if (k == 1) cout << 1 << endl;
	else cout << n - k << endl;
	return 0;
}
//  [cpp]
#include<iostream>
int a,b;
int main()
{
  cin>>a>>b;
  cout<<a-b<<endl;
}
//  [cpp]
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;

int main(){
    int N,K;
    cin>>N>>K;
    if(K==1) cout<<"0"<<endl;
    else{
        int n=N-K;
        cout<<n<<endl;
    }
}
//  [c]
#include <stdio.h>
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    if(k==1)
        printf("0\n");
    else
        printf("%d\n",n-k);
        return 0;
}
//  [c]
#include<stdio.h>
int n, k, a;
int main(void){
	scanf("%d%d", &n, &k);
	if(k==1){
		puts("0");
	}else{
		printf("%d\n", n-k);
	}
}
//  [c]
#include <stdio.h>
int main(void){
	
	int a, b;
	
	scanf("%d %d", &a, &b);
	
	if(b == 1){
		printf("%d\n", 0);
		return 0;
	}
	
	printf("%d\n", a-b);
	
	return 0;
	
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int n, k;

    scanf( "%d %d", &n, &k );

    if( n <= 3 ) 
        printf("0\n");
    else 
        printf("%d\n", n - k);
    return 0;
}
//  [c]
main(a,b){scanf("%d%d",&a,&b);printf("%d",a-b);}
//  [javascript]
function Main(input) {
  input = input.trim()
  input = input.split(" ");
  if(input[1]!=1) console.log(input[0]-input[1]);
  else console.log(0);
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const N = parseInt(args[0][0], 10)
	const K = parseInt(args[0][1], 10)
	console.log(N % K)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
function Main(input) {
  input = input.split(" ");
  const N = parseInt(input[0],10);
  const K = parseInt(input[1],10);

  if(K ===1){
    console.log(0);
    return;
  }
  console.log(N-K);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    const n = +input[0];
  
    if (n <= 1) {
      console.log(1);
      return;
    }
  
    const xy = input.slice(1).map(s => s.split(' ').map(n => +n));
  
    const map = {};
    xy.forEach(a => {
      xy.forEach(b => {
        if (a === b) return; // 自分自身の場合
        
        const vec = [b[0] - a[0], b[1] - a[1]];
        const m = vec.join('_');
        map[m] = map[m] == null ? 1 : map[m] + 1;
      });
    });

	const res = Object.keys(map).reduce((r, xystr) => {
		const count = map[xystr];
        return count > r[0] ? [count, xystr] : [r[0], r[1]];
    }, [0, '']);
  	
//    const pq = res[1];
    
    console.log(n - res[0]);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
function Main(input) {   
  const temp = input.split("\n");
  const n = temp[0];
  const k = temp[1];
  let ans;
  
  if(k == 1) ans = 0;
  else ans = n - k;
  
  console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	input = input.split("\n");
	var input0 = input[0].split(" ");
	const N = parseInt(input0[0]);
	const K = parseInt(input0[1]);
	if(N == 1){
		console.log(0);
	}else{
		console.log(N-K);
	}
 }
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n,k int
	fmt.Scan(&n,&k)

	if k == 1 {
		fmt.Println(0)
	} else {
		fmt.Println(n - k)
	}
}
//  [go]
package main
import "fmt"
func main(){
    var N, K int

    fmt.Scanf("%d %d", &N, &K)

    if K == 1 {
        fmt.Println(0)
    } else {
        fmt.Println(N - K)
    }
}
//  [go]
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;

#define INF 1e+9
#define MAX_V 300

struct edge {
    int to;
    int cost;
};
using P = pair<ll, ll>;
int main(){
  int n,k;cin>>n>>k;
  vector<int> ans(k,0);
  for(int i=0;i<n;i++){
    if(i<k){
      ans[i]++;
    }else{
      ans[0]++;
    }
  }
  cout<<ans[0]-ans[n-1]<<endl;
}
//  [ruby]
line = gets.split(' ').map(&:to_i)

N = line[0]
K = line[1]

if K == 1 then
  print 0
else
  print N - K
end
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,K=get_i
puts N%K
//  [ruby]
n,k = gets.split.map(&:to_i)

if k == 1
  puts 0
else
  puts n-k
end
//  [ruby]
a,b=gets.split.map &:to_i
p b==1 ? 1 : a-b
//  [ruby]
n,k = gets,chomp.split(' ').map(&:to_i)
puts n%k
//  [ruby]
n,k=gets.to_i
puts (k == 1 ? 0 : n-k)
//  [rust]
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::*;
use std::string::*;
use std::f64::consts::PI;

struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        IO(r, std::io::BufWriter::new(w))
    }

    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }

    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let s: String = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();

        return s.parse::<T>().ok().unwrap();
    }

    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

fn prime_factorization(n: i64) -> HashMap<i64, i64> {
    let mut n = n;
    let mut res = HashMap::new();
    let mut i = 2;
    while i * i <= n {
        while n % i == 0 {
            n /= i;
            let count = res.entry(i).or_insert(0);
            *count += 1;
        }
        i += 1;
    }

    if n > 1 {
        res.insert(n, 1);
    }

    return res;
}

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let k: usize = sc.read();
    if k == 1 {
        println!("{}", 0);
    } else {
        println!("{}", n - k);
    }
}
//  [rust]
fn read_line<T>() -> Vec<T>
where T: std::str::FromStr, <T as std::str::FromStr>::Err : std::fmt::Debug {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

fn main() {
    let x: Vec<i32> = read_line();
    let result = if x[1] > 1 {
        x[0] - x[1]
    } else {
        0
    };

    println!("{}", result);
}
//  [rust]
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    input!(n: usize, k: usize);

    if k == 1 {
        println!("0");
    } else {
        println!("{}", n - k);
    }
}
//  [rust]
fn read_line<T>() -> Vec<T>
where T: std::str::FromStr, <T as std::str::FromStr>::Err : std::fmt::Debug {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

fn main() {
    let x: Vec<i32> = read_line();
    let result = if x[1] > 1 {
        x[0] - x[1] - 1
    } else {
        0
    };

    println!("{}", result);
}
//  [rust]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn count(mat: Vec<Vec<(i64, i64)>>, n: (i64, i64)) -> u64 {
    let mut cnt = 0;
    for (x, row) in mat.into_iter().enumerate() {
        for (y, m) in row.into_iter().enumerate() {
            if n == m {
                cnt+=1;
            }
        }
    }
    return cnt;
}

fn most_common(mat: Vec<Vec<(i64, i64)>>) -> (i64, i64) {
    let mut most_common = (0, 0);
    let mut most_common_cnt = 0;
    let mat2 = mat.clone();
    for (x, row) in mat.into_iter().enumerate() {
        for (y, n) in row.into_iter().enumerate() {
            if y == x {
                continue;
            }
            let cnt = count(mat2.clone(), n);
            if cnt > most_common_cnt {
                most_common_cnt = cnt;
                most_common = n;
            }
        }
    }
    return most_common;
}

fn rec(prev: (i64, i64), xys: Vec<(i64, i64)>, p: i64, q: i64) -> u64 {
    let mut min_cost = 100000;
    for (i, xy) in xys.clone().iter().enumerate() {
        let mut cost = if xys.len() > 1 {
            rec(*xy, xys.iter().enumerate().filter(|&(k, _)| k != i).map(|(_, e)| *e).collect(), p, q)
        } else {
            0
        };
        cost += if xy.0 - prev.0 == p && xy.1 - prev.1 == q {
            0
        } else {
            1
        };
        if cost < min_cost {
            min_cost = cost;
        }
    }
    return min_cost;
}


fn main() {
    let N = get!(u8);
    let xys: Vec<(i64, i64)> = get!(i64, i64; N);

    let mut pqmat: Vec<Vec<(i64, i64)>> = Vec::new();
    let mut cnt = 0;
    for (x1, y1) in xys.clone() {
        pqmat.push(Vec::new());
        for (x2, y2) in xys.clone() {
            pqmat[cnt].push((x1 - x2, y1 - y2));
        }
        cnt+=1;
    }
    let (p, q) = most_common(pqmat);
    let cost = rec((-9839425876, -35437953752), xys, -p, -q);
    println!("{}", cost);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn parse_line<T: FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn parse_pair<T: FromStr, U: FromStr>() -> (T, U) {
    let line = parse_line::<String>();
    let mut iter = line.split_whitespace();
    (
        iter.next().unwrap().parse().ok().unwrap(),
        iter.next().unwrap().parse().ok().unwrap(),
    )
}

fn println<T: ToString>(s: T) {
    println!("{}", s.to_string());
}

// ------------------------------------------------------------------------

fn main() {
    let (n, k) = parse_pair::<usize, usize>();

    if n < k {
        println(1);
        return;
    }

    if k == 1 {
        println(1);
        return;
    }

    println(n - k);
}
//  [swift]
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

if( arr[1] == 1 ) {
  print( 0 )
} else {
	print( arr[0] - arr[1] )
}
//  [swift]
import Foundation
import CoreFoundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    func reversed() -> Array {
        return self.reverse()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // 2つの条件に優先順位をつけてソート

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, K) = (input[0], input[1])
print(K==1 ? 0 : N-K)
//  [swift]
import Foundation
 
let input_line = readLine()!
 
let split = input_line.componentsSeparatedByString(" ") //components(separatedBy:)と実質同じ
let N = Int(split[0])!
let K = Int(split[1])!
 
if K == 1 {
    print(0)
} else  {
    print(N - K)
}
//  [swift]
let N = Int(readLine()!)!
var ball: [(x: Int, y: Int)] = (0..<N).map { _ in
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    return (input[0], input[1])
}
var dic = [String : Int]()
for i in 0..<N-1 {
    for j in i+1..<N {
        let xDist = ball[i].x - ball[j].x
        let yDist = ball[i].y - ball[j].y
        dic["\(xDist) \(yDist)"] = (dic["\(xDist) \(yDist)"] ?? 0) + 1
    }
}
print(N - (tmp.values.maxElement() ?? 0))
//  [typescript]
// diverta 2019 Programming Contest 2
// https://atcoder.jp/contests/diverta2019-2
import * as fs from "fs";

const stdin = fs.readFileSync("/dev/stdin", "utf8");
const split = stdin.split("\n");
Main(split);

function Main(inputLines: string[]) {
  const tmp = inputLines[0].split(" ");
  const N = Number(tmp[0]);
  const K = Number(tmp[1]);

  if (K === 1) {
    return console.log(`0`);
  }
  // 1人1個ずづ
  const sub = N - K;
  console.log(`${sub}`);
}
//  [typescript]
import fs = require('fs')
const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ').map(Number)

if (input[1] === 1) {
    console.log(0)
} else {
    console.log(input[0] - input[1])
}
//  [typescript]
import { readFileSync } from 'fs'

function main(input: string) {
  const [N, K] = input.split(' ').map(Number)

  if (K === 1) {
    console.log(0)
    return
  }

  console.log(N - K)
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
import { readFileSync } from 'fs'

function main(input: string) {
  const [N, K] = input.split(' ').map(Number)

  console.log(N - K)
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
// diverta 2019 Programming Contest 2
// https://atcoder.jp/contests/diverta2019-2
import * as fs from "fs";

const stdin = fs.readFileSync("/dev/stdin", "utf8");
const split = stdin.split("\n");
Main(split);

function Main(inputLines: string[]) {
  const tmp = inputLines[0].split(" ");
  const N = Number(tmp[0]);
  const K = Number(tmp[1]);

  if (K === 1) {
    return console.log(`0`);
  }
  // 1人1個ずづ
  const sub = N - K;
  // 最低1個は渡っている
  console.log(`${sub-1}`);
}
//  [python]
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == s:
    print(a-1,b)
else:
    print(a,b-1)
//  [python]
# 入力
s, t = map(str, input().split())
# 数
a, b = map(int, input().split())
# 取るやつ
u = input()

if u == s:
    a -= 1
elif u == t:
    b -= 1

print(a, b)
//  [python]
S,T = list(map(str,input().split()))
A,B = list(map(int,input().split()))
U = str(input())

if S == U:
    A -=1
elif T == U:
    B -=1
else:
    pass

print(A,B)
//  [python]
def resolve():
    s,t = input().split()
    a,b = map(int,input().split())
    u = input()
    print(a-(s==u),b-(t==u))
reoslve()
//  [python]
s,t = input().split()
a,b = map(int,input().split())
u = input()
print(a,b-1 if u == t else a-1,b)
//  [python]
s, t = map(input().split())

a, b = map(int(input().split()))

u = input()

if s == u:
    print(a - 1, b)
elif t == u:
    print(a, b - 1)
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	}

}
//  [java]
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        int c = sc.nextInt();
        int d = sc.nextInt();

        String e = sc.next();

        if (e.equals(a))
            System.out.println((c - 1) + " " + b);
        else
            System.out.println(c + " " + (d - 1));
    }
}
//  [java]
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<String> one = nextStrArray();
		String S = one.get(0);
		String T = one.get(1);
		ArrayList<Integer> two = nextIntArray();
		int A = two.get(0);
		int B = two.get(1);
		String S = next();
		if(S.equals(U)){
			A--;
		}else{
			B--;
		}
		myout(A + " " + B);
	}
	//Method addition frame start



	//Method addition frame end
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int[] p = new int[n];
		Arrays.setAll(p, i -> sc.nextInt());
		
		double maxSumEv = 0.0;
		for (int i = 0; i <= n - k; i++) {
			double sumEv = 0;
			for (int j = i; j < i + k; j++) {
				sumEv += (1 + p[j]) / 2.0;
			}
			maxSumEv = Math.max(maxSumEv, sumEv);
		}
		
		System.out.println(maxSumEv);
		
		sc.close();
	}
	
	

}
//  [cpp]
#include<stdio.h>
#include <string.h>

using namespace std;

int main()
{
	char s[10], t[10], u[10];
	int a, b;
	scanf("%s %s", s, t);
	scanf("%d %d", &a, &b);
	scanf("%s", u);

	int num = strlen(u);
	bool flag=false;
	for(int i=0; i<num; i++){
		if (s[i] != u[i]){
			flag = true;
		}
	}

	if(flag){
		b--;
	}else{
		a--;
	}

	printf("%d %d\n", a, b);
	return 0;
}
//  [cpp]
#include<stdio.h>
#include<string.h>

int main(){
	
	char str1[10], str2[10], trash[10];
	int balls1, balls2;
	
	scanf("%s %s", &str1, &str2);
	scanf("%d %d", &balls1, &balls2);
	scanf("%s", &trash);
	
	(strcmp(trash, str1) == 0) ? balls1-- : balls2--;
	printf("%d %d\n", balls1, balls2);
	
	return 0;
}
//  [cpp]
#include<stdio.h>

int main(){
	
	char str1[15], str2[15], trash[15];
	int balls1, balls2;
	
	scanf("%s %s", &str1, &str2);
	scanf("%d %d", &balls1, &balls2);
	scanf("%s", &trash);

	printf("%d %d\n", balls1, balls2);
	
	return 0;
}
//  [cpp]
#include<stdio.h>

int main(){
	
	char str1[10], str2[10], trash[10];
	int balls1, balls2;
	
	scanf("%s %s", &str1, &str2);
	scanf("%d %d", &balls1, &balls2);
	scanf("%s", &trash);

	printf("%d %d\n", balls1, balls2);
	
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

int main(void) {
    char S[20], T[20], U[20];
    int A, B, b, i;
    scanf("%s%s%d%d%s", S, T, &A, &B, U);
    b=0;
    for (i=0; i<strlen(S); i++) {
        if (S[i]!=U[i]) {
            b=1;
            break;
        }
    }
    if (b==0) A--;
    else B--;
    printf("%d %d", A, B);
    return 0;
}
//  [c]
#include <stdio.h>
int main(void) {
	int a, b;
	char s[11], t[11], u[11];
	scanf("%s", s);
	scanf("%s", t);
	scanf("%d%d", &a, &b);
	scanf("%s", u);
	int i = 0;
	while (u[i] != 0) {
		if (u[i] != s[i]) {
			printf("%d %d\n", a, b - 1);
			return 0;
		}
		i++;
	}
	printf("%d %d\n", a - 1, b);
	return 0;
}
//  [c]
#include <stdio.h>
 
char c1[11];
char c2[11];
char c3[11];
int a,b;
 

int main(void){
scanf("%s %s", c1, c2 );
scanf("%d %d", &a, &b);
scanf("%s", c3);
 
if(strcmp(c1,c3) == 0){
  a-=1;
}
if(strcmp(c2,c3) == 0){
  b-=1;
}
 
printf("%d %d",a, b);

return 0;  
}
//  [c]
#include<stdio.h>

int main()
{

	int n,k,i,j;
  double p[1001],max,sum;
  sum=0;
  max=0;
(void) scanf("%d %d",&n,&k);

  for (i=1;i<=n;i++)
  {
(void) scanf("%lf",&p[i]);
    p[i]=(p[i]+1)/2;
    //printf("%lf\n",p[i]);
  }
  
  for (i=1;i<=n-k+1;i++)
  {
  	for (j=1;j<=k;j++)
    {
    	sum+=p[i+j-1];    	
    }
    	if (sum>max)
        {
        	max=sum;
        }
    sum=0;
  }

  printf("%lf",max);
  return 0;

}
//  [c]
#include <stdio.h>
#include <string.h>

int main () {
	char a[10], b[10], c[10];
	int d, e;
	scanf ("%s %s", a, b);
	scanf ("%d %d", &d, &e);
	scanf ("%s", c);
	
	int tes = strcmp (a,c); 
	if (tes == 0) {
		d--;
	} else e--;
	
	printf ("%d %d\n", d, e);
}
//  [c]
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>



int main(void) {

	int a, b;
	char u[10];

	printf("red blue\n");

	scanf("%d %d", &a, &b);

	scanf("%s", u);

	if (strcmp(u,"red")==0) {
		a -= 1;

	}
	else if(strcmp(u, "blue") == 0){
		b -= 1;
	}

	printf("%d %d",a,b);

	return 0;

}
//  [javascript]
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let xs1 = xs[0].trim().split(' ');
   let xs2 = xs[1].trim().split(' ').map(v=>parseInt(v,10));
   let xs3 = xs[2].trim().split(' ');
   let ans = 0;
   
   if(xs1[0]==xs3[0]){
     ans = xs2[0] - 1;
     console.log(ans+' '+xs2[1]);
   }else if(xs1[1]==xs3[0]){
     ans = xs2[1] - 1;
     console.log(xs2[0]+' '+ans);
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
function main(input) {
    var line = input.split(/\r?\n/g);
    var arr = line[0].split(" ");
    const S = arr[0], T = arr[1];
    arr = line[1].split(" ")
    var A = parseInt(arr[0]), B = parseInt(arr[1]);
    const U = line[2];
    if (S === U) {
        A--;
    } else {
        B--;
    }
    console.log(A + " " + B);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(arg){
  	var out = arg.trim().split('\n');
	var ball = out[0].split(' ');
  	var num = out[1].split(' ').map(str => parseInt(str, 10)); 
  	var fall = out[2];
 
  	var result;
  	if(ball[0] === fall) {
    	num[0]--;
      	result = num.join(' ');
    } else if (ball[1] === fall){
    	num[1]--;
      	result = num.join(' ');
    }
	console.log(result);
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
'use strict';
function main(input) {
  const input = input.split("\n");
  const a = input[0].split(" ");
  const b = input[1].split(" ");
  let b1 = parseInt(b[0], 10);
  let b2 = parseInt(b[1], 10);
  const c = input[2];

  if (a[0] === c) {
    b1 --;
  } else {
    b2 --;
  }
  
  console.log(`${b1} ${b2}`);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
function main(input) {
  input = input.split("\n");
  const a = input[0].split(" ");
  const b = parseInt(input[0], 10).split(" ");
  const c = input;

  if (a[0] === c) {
    b[0] --;
  } else {
    b[1] --;
  }
  
  console.log(b[0], b[1]);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  var args = input.trim().split(" ");
  var s = args[0];
  var t = args[1];
  var a = parseInt(args[2], 10);
  var b = parseInt(args[3], 10);
  var u = args[4];
  if ( u == s ) {
    a -= 1;
    return a + " " + b;
  } else if ( u == t ) {
    b -= 1;
    return a + " " + b;
  }
}
console.log(main(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [go]
package main

import "fmt"

func main() {
	var S, T string
	var A, B int
	var U string
	fmt.Scan(&S, &T, &A, &B, &U)

	if S == U {
		A--
	}
	if T == U {
		B--
	}
	fmt.Println(A, B)
}
//  [go]
package main
import "fmt"

func main(){
	var S,T string
	var a,b int
	var U string
	fmt.Scanf("%s %s", &S, &T)
	fmt.Scanf("%d %d", &a, &b)
	fmt.Scanf("%s", &U)

	if S == U{
		a -= 1
	}else{
		b -= 1
	}
	fmt.Println(a,b)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	S, T := getString(), getString()
	A, B := getInt(), getInt()
	U := getString()

	if S == U {
		A--
	}
	if T == U {
		B--
	}
	out(A, B)
}