Squid Game - Piggy Bank
Source: codechef
Difficulty: 156

Squid Game - Piggy Bank
In the deadly "Squid Game," the participants start with$N$players. After the game ends, only$K$players survive. The prize pool increases based on the number of players eliminated.
Each eliminated player contributes a fixed amount of$10,000$units to the prize pool.
Your task is to calculate the total prize money added to the pool, given the number of players$N$at the start of the game and the number of players who survive,$K$.
Input Format
The first line contains two integers$N$and$K$, where:$N$is the total number of players at the start of the game.$K$is the number of players still alive after the game.
Output Format
Print a single integer — the total prize money added to the pool.
Constraints$1 \leq K \lt N \leq 100$Sample 1:
Explanation:
The game starts with$10$players, and$5$of them remain in the end. This means$5$players were eliminated, so the total prize pool is$5\cdot 10000 = 50000$.
Sample 2:
Input
Output
89 33
560000
Explanation:
The game starts with$89$players, and$33$of them remain in the end. This means$56$players were eliminated, so the total prize pool is$56\cdot 10000 = 560000$.

Sample Input:
10 5

Sample Output:
50000

C++ solution:
#include <bits/stdc++.h>
using namespace std;

int main() {
    // your code goes here
    int k,n;
    cin>>k>>n;
    int rem = k-n;
    cout << rem*10000 <<endl;
}

Go solution:
package main
import "fmt"

func main(){
    // your code goes here
    var n, k int32;
    fmt.Scanf("%d %d", &n, &k);
    fmt.Println((n-k) * 10000);
}

Java solution:
import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
    public static void main (String[] args) throws java.lang.Exception
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int re=n-m;
        int ans=re*10000;
        System.out.println(ans);

    }
}

JavaScript solution:
let stdInput ="";

process.stdin.on("data",input => stdInput += input);

process.stdin.on("end", () => {
    const[ N,K]= stdInput.trim().split(" ").map(Number);
    console.log ( ( N - K) * 10000);
});

Python solution:
# cook your dish here
N, K = map(int, input().split())
print((N-K)*10000)

Ruby solution:
begin
  # Read input safely with error handling
  input = gets
  if input.nil? || input.strip.empty?
    puts 0
    exit
  end

  # Process input
  n, k = input.strip.split.map(&:to_i)

  # Validate input
  if n <= 0 || k <= 0 || k >= n || n > 100
    puts 0
    exit
  end

  # Calculate and print result
  puts (n - k) * 10000
rescue
  puts 0
end