jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
import * as fs from 'fs'
import {debug} from '../../../util'

const input = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
const output = (x: any) => console.log(x)
// debug(input)
const [N, M, X] = input[0].split(' ').map(i => Number(i))
const data = []
for (const i of [...Array(N)].map((v, i) => ++i)) {
    const tmp = input[i].split(' ').map(i => Number(i))
    data.push(tmp)
}

const isXOrMore = (A: number[], X: number): boolean => {
    return A.every(v => v >= X)
}

let minPrice = Number.MAX_SAFE_INTEGER

for (let bit = 0; bit < (1 << N); ++bit) {
    let price = 0
    const A = Array(M).fill(0)

    for (const i of [...Array(N).keys()]) {
        if (bit & (1 << i)) {
            // debug(data[i])
            price += data[i][0]
            for (const key of [...Array(M)].map((v, i) => ++i)) {
                A[key - 1] += data[i][key]
            }
        }
    }

    if (isXOrMore(A, X)) {
        minPrice = Math.min(minPrice, price)
    }
}

minPrice === Number.MAX_SAFE_INTEGER ? output(-1) : output(minPrice)
//  [python]
# coding: utf-8
import numpy
n, d = map(int, input().split())
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    a = numpy.array([0, 0])
    b = numpy.array([x, y])
    u = b - a
    kyori = numpy.linalg.norm(u)
    if d >= kyori:
        ans = ans + 1

print(ans)
//  [python]
import numpy as np

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

xy = [map(int, input().split()) for _ in range(a[0])]
x, y = [list(i) for i in zip(*xy)]
i = 0
b = np.array(x)
c = np.array([b,y]).T
for j in range(a[0]):
  if np.linalg.norm(c[j])<=a[1]:
    i +=1  
print(i)
//  [python]
n,d=map(int,input().split())
print(sum(eval("(("+input().replace(" ",")**2+(")+")**2)")**0.5<=d for _ in range(n)))
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Double D = sc.nextDouble();
        Double[][] X = new Double[N][2];

        for(int i=0; i<N*2; i++){
            if(i%2 == 0){
                X[i/2][0] = sc.nextDouble();
            }else{
                X[i/2][1] = sc.nextDouble();
            }
        }
        sc.close();
        int ans = 0;
        for(int i=0; i<N; i++){
            if(Math.sqrt(X[i][0]*X[i][0]+(X[i][1]*X[i][1])) <= D){
                ans ++;
            }
        }
        System.out.println(ans);
    }
}
//  [java]
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.*;

public class Main {

  private static void solve(int[][] points, int d) {
    int cnt = 0;
    for (int[] p : points) {
      if (dist(p[0], p[1]) <= d) {
        cnt++;
      }
    }
    System.out.println(cnt);
  }

  private static double dist(int x, int y) {
    BigDecimal i = BigDecimal.valueOf(x);
    BigDecimal j = BigDecimal.valueOf(y);
    return i.multiply(i).add(j.multiply(j)).sqrt(MathContext.DECIMAL64).doubleValue();
  }

  public static void main(String[] args) {
    int n = scanner.nextInt();
    int d = scanner.nextInt();
    int[][] points = new int[n][2];
    for (int j = 0; j < n; j++) {
      points[j][0] = scanner.nextInt();
      points[j][1] = scanner.nextInt();
    }
    solve(points, d);
  }

  private static final Scanner scanner = new Scanner(System.in);
}
//  [java]
import java.util.Scanner;


public class Main {
//	final static int MOD = 1000000007;

	public static long ans = 0;

	public static void main(String[] args) {

//		int ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		int n = sc.nextInt();
		double d = sc.nextDouble();

		long[] a = new long[n];
		long[] b = new long[n];
		for (int i = 0; i < n; i++) {
			a[i]= sc.nextLong();
			b[i]= sc.nextLong();
		}


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

		for(int i = 0; i < n; i++) {
			long tmpa = (a[i] * a[i]);
			long tmpb = (b[i] * b[i]);
			long tmp = tmpa + tmpb;
			double calc = Math.sqrt(tmp);
			System.err.println(tmpb);
			if(d * d >= tmp) {
				ans++;
			}
		}


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

//		if(f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}



}
//  [cpp]
#include<iostream>
#include<queue>
#include<limits>
// #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<cmath>
#include<math.h>
#include<iomanip>  
#include<deque> 
#include<stack>
#include<string> 
#include<string.h>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#define ll long long
#define tc(t)  while(t--)
#define V vector
#define Vp vector< pair<int,int> >
#define pb push_back
#define UM unordered_map
#define IT iterator
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define PQ priority_queue
#define _FI ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

 char ar[140000];
vector<ll> SieveOfEratosthenes(ll n) 
{ 
  vector<ll> result;
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    int count=1;
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {  
            for (ll i=p*p; i<=n; i += p) 
                {
                  prime[i] = false; 
                }
            count++;
        } 
    } 
  
    for (ll p=2; p<=n; p++) 
       if (prime[p]) 
          {
            result.push_back(p);
          }
    return result;
}



vector<ll> Divisors (ll n)
{
  vector<ll> res;
  for(ll i=1;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(n/i==i)
      {
        res.pb(i);
      }
      else
      {
        res.pb(i);
        res.pb(n/i);
      }
    }
  }

  return res;
}

int a[4][2]={ {1,0}, {1,-1}, {1,1}, {2,0} } ;
bool validPoint(int x,int y, int N)
{
    return (x>=0 && x<N && y>=0 && y<N);
}


 
int main()
{
  _FI 
  int n;
  cin>>n;
  int d;
  cin>>d;
  int count=0;
    d=d*1.0;
  
  for(int i=0;i<n;i++)
  {
    int x,y;
    cin>>x>>y;
    double dist= sqrt( (1l*x*x) + (1l*y*y));
    cerr<<"The dist is: "<<dist<<endl;
    if(dist<=d)
    {
      count++;
    }
  }
  cout<<count<<endl;

  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

int main(){
    
    int N, D;
    cin >> N >> D;
    
    ld temp = 0.0;
    int cnt = 0;
    for(int i=0; i<N; i++){
        double x, y;
        cin >> x >> y;
//        if(x>D) continue;
//        if(y>D) continue;
        temp = sqrt(x*x + y*y);
        cerr << "> debug: " << temp << endl;

        if(temp<=D) cnt++;
    }

    cout << cnt << endl;
    return 0;
}
//  [cpp]
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

#define EPS 1e-10

int main()
{
	int N;
	double D;
	cin >> N >> D;
	int ans = 0;
	rep(i, N) {
		double X, Y;
		cin >> X >> Y;
		auto d = sqrt(X*X + Y*Y);
		clog << d << endl;
		if (d - D < EPS)
			ans++;
	}
	cout << ans << endl;
	return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>

int main(){
  
  int i ,a = 0;
  //座標の個数、制限距離、座標の距離
  double N, D, L;
  //X座標、Y座標
  double X[1000000], Y[1000000];
  
   char str[1000000];
   char hub[1000000];
    
   fgets(str, sizeof(str), stdin);
   sscanf(str,"%lf %lf",&N, &D);
  
  for(i = 0; i < N; i++){
     fgets(hub, sizeof(hub), stdin);
     sscanf(hub,"%lf %lf",&X[i], &Y[i]);
    
     L = sqrt(X[i] * X[i] + Y[i] * Y[i]);
       
     if(D >= L){
       
       a += 1;
     
     }
    
  }
    
  printf("%d\n" ,a);
  
  return 0;
  
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

double logn(int base, double antilog) {
    return log(antilog) / log((double)base);
}

int main(void){
  int n,count = 0;
  double d;
  scanf("%d %lf",&n,&d);
  d = logn(10,d);
  double p,q,x[n],y[n];
  rep(i,0,n){
    scanf("%lf %lf",&p,&q);
    x[i] = logn(10,p*p+q*q)/2;
  }
  rep(i,0,n){
    if(x[i] <= d){
	count++;
      }
  }
  printf("%d",count);
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>

int main()
{
    int n, d, i, count = 0;
    double x, y, distance;

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

    for(i = 0; i < n; i++)
    {
        scanf("%lf %lf", &x, &y);

        distance = sqrt(pow(x, 2) + pow(y, 2));

        if(distance <= d)
            count++;
    }

    printf("%d", count);

    return 0;
}
//  [javascript]
//標準入力をするときに記述する必要がある
process.stdin.resume();
process.stdin.setEncoding("utf8");

let line_input; //標準入力代入用に宣言
let lines = []; //複数行入力用
let reader = require("readline").createInterface({
    input: process.stdin,
    output: process.stdout
});

//入力, 文字列で受け渡される
reader.on("line", (line) => {
    //line_input = parseInt(line) //単行入力
    let column = line.split(" ");
    let int_column = [];
    for (let i = 0; i < 2; i++){
        int_column.push(parseInt(column[i]))
    }
    lines.push(int_column)
});

//出力
reader.on("close", () => {
    let count = 0;
    for (let i=1; i < lines.length; i++){
        if (Math.pow(lines[i][0], 2) + Math.pow(lines[i][1], 2) <= Math.pow(lines[0][1], 2)){
            count += 1;
        }
    }
    console.log(count)
})
//  [javascript]
const main = input => {
  const inputs = input.trim().split('\n')
  const [N, D] = inputs[0].split(' ').map((x) => parseInt(x))

  let count = 0
  for (let i = 0; i < N; i++) {
    const [x, y] = inputs[i + 1].split(' ').map((a) => parseInt(a))
    if (x * x + y * y <= D * D) {
      count++;
    }
  }

  console.log(count)
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
function main(input) {
    const lines = input.split("\n");
    const ND = new Int32Array(lines[0].split(" "));
    const D2 = ND[1] * ND[1];
    let cnt = 0;
    for (let i = 1; i < lines.length; i++) {
        const arr = new Int32Array(lines[i].split(" "));
        const x = arr[0];
        const y = arr[1];
        const d2 = x * x + y * y;
        cnt += (d2 <= D2) ? 1 : 0;
    }
    return cnt
}

//******************************
exports.main = main;

function Main(input) {
    console.log(main(input.trim()));
}

if (process.argv[2] !== "test") {
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	n := 0
	d := float64(0)

	count := 0
	x := float64(0)
	y := float64(0)

	fmt.Scanf("%d %f", &n, &d)

	for i := 0; i < n; i++ {
		fmt.Fscan(r, &x, &y)
		// x = rand.Float64() * 200000
		// y = rand.Float64() * 200000
		dist := math.Sqrt(math.Pow(x, 2) + math.Pow(y, 2))
		if dist <= float64(d) {

			count++
		}
	}

	fmt.Println(count)

}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	var N int
	var D float64
	var X, Y float64
	var count int
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	fmt.Fscan(r, &N, &D)
	for i := 0; i < N; i++ {
		fmt.Fscan(r, &X, &Y)
		if d := math.Sqrt(X*X + Y*Y); d <= D {
			count++
		}
	}
	fmt.Fprintln(w, count)
}
//  [ruby]
N, D = gets.split.map &:to_i
ans = 0;
N.times{
  X, Y = gets.split.map(&:to_i)
  ans += Math.sqrt(X*X + Y*Y) <= D ? 1 : 0
}
p ans
//  [ruby]
class Distance
  def initialize(d, axy)
    @d = d
    @axy = axy
  end

  def solve
    @axy.reduce(0) {|ct, xy| if @d * @d >= xy[0] * xy[0] + xy[1] * xy[1] then ct + 1 else ct end}
  end
end

def run
  n, d = gets.split(/\s+/).map(&:to_i)
  axy = (0...n).map{|_| gets.split(/\s+/).map(&:to_i)}
  
  puts Distance.new(d, axy).solve
end

run
//  [ruby]
def calc_distance(p, q)
  Math.sqrt((p ** 2) + (q ** 2))
end

n, d = gets.chomp.split(' ').map(&:to_i)
count = 0
values = []
caches = {}
n.times do
  value = gets.chomp
  result = caches[value]
  unless result
    x, y = value.split(' ').map(&:to_i)
    distance = calc_distance(x, y)
    result = distance <= d
    caches[value] = result
  end
  count += 1 if result
end

puts count
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let d:i128 = read();
    let mut ans = 0;
    for _ in 0..n {
        let x:i128 = read();
        let y:i128 = read();
        if (x * x + y * y) <= d * d {
            ans += 1;
        }
    }
    println!("{}", ans);
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n:usize , d:usize, xy: [[i128; 2];n]};
    let xy: Vec<Vec<i128>> = xy;

    let mut count = 0;

    for i in xy.iter() {
        let result = ((i[0] * i[0] + i[1] * i[1]) as f64).sqrt();

        if result <= d as f64 {
            count += 1;
        }
    }

    println!("{}", count);
}
//  [rust]
use std::io::{BufRead, self, BufReader};

fn main() -> io::Result<()>{
    let mut stdin = BufReader::new(io::stdin());

    let mut buf = String::new();
    stdin.read_line(&mut buf)?;
    let nums = buf.split_ascii_whitespace().map(|a| a.parse::<u64>().unwrap()).collect::<Vec::<_>>();
    let (N,D) = (nums[0],nums[1]);

    let mut count = 0;

    for _ in 0..N{
	buf.clear();
	stdin.read_line(&mut buf)?;                                                                      
	let nums = buf.split_ascii_whitespace().map(|a| a.parse::<i128>().unwrap() as f64).collect::<Vec::<_>>();
	let dist = nums[0] * nums[0] + nums[1] * nums[1];
	count = if dist <= ((D * D) as f64) {count+1}else{count};
    }

    println!("{}",count);    

    Ok(())
}
//  [swift]

import Foundation

let input = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let N = input[0]
let D = input[1]
let distance = D * D
var count = 0
for i in 1...N {
    let inputs = readLine()!.components(separatedBy: " ").map{ Int($0)! }
    if distance >= inputs[0] * inputs[0] + inputs[1] * inputs[1]{
        count += 1
    }
}
    print(count)
//  [swift]
import Foundation
let input = readLine()!
let inputs: [String] = input.components(separatedBy: " ")
let times = Int(inputs[0])!
let limit = Double(inputs[1])!
var count: Int = 0
for _ in 0..<times {
  let xystr = readLine()!
  let xy: [String] = xystr.components(separatedBy: " ")
  let x = Double(xy[0])!
  let y = Double(xy[1])!
  if(sqrt(x*x+y*y) <= limit){
    count += 1
  }
}
print(count)
//  [swift]
import Foundation

func main() {
    guard let line = readLine() else { return }
    let inputs = line.components(separatedBy: " ").compactMap() { Int($0) }
    let n = inputs[0]
    let d = inputs[1]
    var count = 0
    
    for _ in 0..<n {
        let inputs = readLine()!.components(separatedBy: " ").compactMap() { Int($0) }
        let point = Point(x: inputs[0], y: inputs[1])
        if point.isD(d: d) {
            count += 1
        }
    }
    print(count)
}
struct Point {
    let x: Int
    let y: Int
    func isD(d: Int) -> Bool {
        return sqrt(Double(self.x) * Double(self.x) + Double(self.y) * Double(self.y)) <= Double(d)
    }
}
main()
//  [typescript]
function Main(input) {
    let lines = input.split(`\n`);
    let arg1 = lines[0].split(` `);
    let points = [];

    for (let i = 1; i < lines.length; i++) {
        let point = lines[i].split(` `);
        points.push({x: parseInt(point[0]), y: parseInt(point[1])});
    }

    let pCount = arg1[0];
    let dThreshold = arg1[1];

    let targetP = 0;
    for (let i = 0; i < points.length; i++) {
        let distance = Math.sqrt(Math.pow(points[i].x, 2) + Math.pow(points[i].y, 2));
        if (distance <= dThreshold) {
            targetP++;
        }
    }

    console.log(targetP);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import { readFileSync } from 'fs'

function main(input: string) {
  const [[n, d], ...lines] = input.split('\n').map(v => v.split(' ').map(BigInt))

  const border = d ** 2n
  const result = lines.filter(([x, y]) => x ** 2n + y ** 2n <= border).length

  console.log(result)
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
function Main(input) {
  console.log((() => {
    const inputs = input.split('\n').map(x => x.split(' ').map(y => parseInt(y)));
    const [[N, D], ...P] = inputs;
    return P.filter(([X, Y]) => D ** 2 >= X ** 2 + Y ** 2).length
  })())
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
s=input()
i=0
a=""
while i<len(s):
 a+=s[i]
 i+=2
print(a)
//  [python]
S = list(input())

result = ""
for i, s in enumerate(S):
    if i % 2 == 0:
	    result += s
        
print(result)
//  [python]
s = list(input())
string = ''
for i in range(len(s)):
    if i%2 == 0:
        string += s[i]
print(string)
//  [java]
import java.util.*;
class Main{
	public static void main(String[] args){
		Runtime rt = Runtime.getRuntime();
		Scanner in = new Scanner(System.in);
		ArrayList<String> input = new ArrayList<String>();
		while(in.hasNext()){
			input.add(in.next());
		}
		String s=input.get(0);
		char[] s2=s.toCharArray();
		String a="";
		for (int i=0;i<s.length();i=i+2){
			a+=s2[i];
			if(i%1000==0)rt.gc();
		}
		System.out.println(a);
	}
}
//  [java]
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		String ans = "";
		for (int i = 0; i < s.length(); i += 2)
			ans += s.charAt(i);
		
		System.out.println(ans);
		
		sc.close();
	}
}
//  [cpp]
#include <stdio.h>
#include <string.h>
int main() {
  char s[100001];
  char ans[50001];

  scanf("%s", s);
  
  int i;
  for(i=0;i<strlen(s);i+=2)
    ans[i/2] = s[i];
  ans[i/2+1] = 0;

  printf("%s", ans);
  return 0;
}
//  [cpp]
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
 
int main() {
    char c[100000];
    cin >> c;
    for(int i = 0; i < strlen(c); i = i + 2) {
        cout << c[i];
    }
    cout << endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[200020];
  cin >> s;
  for(int i=0;i<strlen(s);i++){
    //cin>>s;
    if(i%2==0){
      cout << s[i];
    }
  }
}
//  [c]
#include <stdio.h>
#include<math.h>
#include<string.h>
int main()
{
 long int x,y,z,sum,i=0,k;
 char a[100000000]; 
 gets(a);
 printf("%c",a[0]);
 for(i=1;i<strlen(a);i++)
 {
     if(i%2==0)
     {
      printf("%c",a[i]);   
     }
     
 }
 

    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
 
int main(void) 
{
  int i;
  char s[1000000];
  scanf("%s", s);
  for (i = 0; i < strlen(s); i++) 
    if (i % 2 == 0)
       printf("%c", s[i]);
  return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
int main(void){
  int i;
  char s[100000];
  scanf("%s", s);
  for( i=0; i<strlen(s); i++){
    //printf("%c", s[i]);
    if(i%2==0){
      printf("%c", s[i]);
    }
  }
  //printf("%c\n", s[0]);
  return 0;
}
//  [javascript]
'use strict'

function Main(input) {
    let s = '';
    for (let i = 1; i <= input.length; i++) {
        if (i % 2 === 1) {
            s += input[i - 1];
        }
    }
    console.log(s);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	input = input[0];

	var ans = "";
	for(var i = 1; i <= input.length; i = i + 2){
		ans += input[i-1];
	}
	console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"os"
	"strings"
)

func main() {

	var s string
	var i int = 0
	var result string = ""

	fmt.Scan(&s)

	if len(s) > 100000 {
		fmt.Println("overflow")
		os.Exit(0)
	}

	string_array := strings.Split(s, "")

	for ; i < len(s); i++ {
		count := i + 1
		// odd
		if count%2 == 1 {

			result += string_array[i]

		}
	}
	fmt.Println(result)

}
//  [go]
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	ss := strings.Split(s, "")

	literal := ""
	for i := 1; i <= len(ss); i++ {
		if i%2 == 1 {
			literal += ss[i-1]
		}
	}

	fmt.Println(literal)
}
//  [ruby]
s = gets.chomp!
(s.length-1).downto(0) {|i| s.slice!(i) if i.odd?}
puts s
//  [ruby]
s = gets.chomp.split('')
x = ''
s.each_with_index do |t,i|
  x += t if i.even?
end
puts x
//  [ruby]
ary = []
gets.chomp.split("").each_with_index { |x,idx| ary << x if idx.even? }
puts ary.inject(&:+)
//  [rust]
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let s = buf.trim().chars().collect::<Vec<char>>();
	let mut v = String::new();
	v = "".to_string();
	for i in 0..s.len() {
		if i%2 == 0 {
			v = format!("{}{}", v, s[i]);
		}
	}
	println!("{}", v);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut s: String = read();
    for i in (0..s.len()).rev() {
        if i % 2 == 1 {
            s.remove(i);
        }
    }

    println!("{}", s);
}
//  [rust]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		cs: Chars,
	}

	for i in (0..cs.len()).step_by(2) {
		print!("{}", cs[i]);
	}
	println!("");
}
//  [swift]
print(readLine()!.characters.enumerate().map{$0.0%2>0 ?"":String($0.1)}.joinWithSeparator(""))
//  [swift]
readLine()!.characters.enumerate().forEach{if $0%2<1{print($1,terminator:"")}}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const s = input[0][0];

  const chars: string[] = [];

  for (let i = 0; i < s.length; i += 2) {
    chars.push(s[i]);
  }

  return chars.join("");
};

console.log(main(read()));
//  [python]
a, b, n = [int(x) for x in input().split()]

n = min(n,b-1)
x = max(0,n-a-a-a-a)

s = -a

for i in range(x,n+1):
    s = max(s,(a*i//b)-a*(i//b))



print(s)
//  [python]
import time
start=time.time()
A,B,N=[int(s) for s in input().split()]
x=((N+1)//B)*B-1
ans=set()
ans.add((A*N)//B-A*(N//B))
while x>0:
  ans.add((A*x)//B-A*(x//B))
  x-=B
  if (time.time()-start)>1.7:
    break
print(max(ans))
//  [python]
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
import random
def resolve():
    A,B,N=pin()
    def f(A,B,x):
        t=(A*x)//B
        s=x//B
        return t-A*s
    ans=0
    for i in range(8*(10**6)):
        k=random.randint(0,N)
        ans=max(ans,f(A,B,k))
    print(ans)
#%%submit!
resolve()
//  [java]
import java.io.*;
import java.util.*;

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static int n, m, k;
	static long mod = 998244353;
	static Boolean[][][] memo;
	static String s;
	static HashSet<Integer> nodes;
	static ArrayList<Integer>[] ad;
	static boolean[] vis;
	static TreeSet<Long> al;
	static int[][] val;
	static int[] b;
	static int ans;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		int a = sc.nextInt();
		long b = sc.nextLong();
		long n = sc.nextLong();
		long ans = (n * a) / b - a * (n / b);
		if(b-1<n)
			ans=Math.max(ans, ((b-1) * a) / b - a * ((b-1) / b));
		for (long i = b - 1; i <= Math.min(n, 10000000); i += b) {
			ans = Math.max(ans, (i * a) / b - a * (i / b));
		}
		for (long i = n; i >= Math.max(0, n - 10000000); i--) {
			ans = Math.max(ans, (i * a) / b - a * (i / b));
		}
		long k = n / b;
		long st = k * b;
		ans = Math.max(ans, (st* a) / b - a * (st / b));
		for (long i = st - 1; i >= Math.max(0, n - 10000000); i -= b) {
			ans = Math.max(ans, (i * a) / b - a * (i / b));
		}
		System.out.println(ans);
		out.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

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

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

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

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}
//  [java]
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong(),b = sc.nextLong(),n = sc.nextLong();
    long x = 0;
    if(b-1>n){
      x=n;
    }else{
      x=b-1;
    }
    long ans = (long)(a*x)/b - a*(long)(x/b);
    pl(ans+"");
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}
//  [cpp]
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# pragma GCC optimize "-O3"
# define int long long
  
using namespace std;
  
const int N = 1e4 + 7;
const int mod = 1e9 + 7;

void solve() {
	int a, b, n, ans = 0;
	cin >> a >> b >> n;
	for ( int x = 0; x < min( 10000000ll, n); x++ ) {
		ans = max( ans, (a*x) / b - a * (x / b) );
	}
	for ( int x = 0; x <= n; x += 10000 ) {
		ans = max( ans, (a*x) / b - a * (x / b) );
	}

	for ( int x = n; x > max( n - 10000000ll, 0ll ); x-- ) {
		ans = max( ans, (a*x) / b - a * (x / b) );
	}
	cout << ans;
}

int32_t main() {
	speed;
	int T = 1;
	// cin >> T;
	while ( T-- ) {
		solve();
	}
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a,b,n,x,ans_x = 0,ans_y=0,y;
  cin >> a >> b >> n;

  long long t = max(n-10000000,(long long)0);
 
  for (x = n; x > t; x--) {
    ans_x = max(a*x/b-x/b*a,ans_x);
  }

  for (int j = 1; j < 100000000; j++) {
  y = n - n%b - j;
  ans_y = max(a*y/b-y/b*a,ans_y);
  }
  cout << max(ans_x,ans_y) << endl;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	ll a, b, n;
	cin >> a >> b >> n;
	ll ans = 0;
	
	if(n >= b) {
		ll s = a * (b-1) / b;
		ll t = (b-1) / b;
		ans = s - a * t;
	} else {
		for(ll x = n; x > max(0LL, n-100100100); x--) {
			ll s = a * x / b;
			ll t = x / b;
			ll now = s - a * t;
			ans = max(ans, now);
			// printf("%lld:: s:%lld, t%lld, now:%lld:\n",x, s, t, now);
		}
	}
	
	cout << ans << endl;
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long ll;
typedef long double ld;
#define M(x,y) ((x)>(y)?(x):(y))
#define m(x,y) ((x)<(y)?(x):(y))

int main() {
	ll a,b,n,ans=0;
	scanf("%lld %lld %lld", &a,&b,&n);
	
	Rep(i,1,a+1) {
		ll x=floorl(i*b/a);
		if (x > n) break;
		ans = M(ans,floorl(a*(x%b)/b));
		ll X=floorl(-1+i * b / a);
		if (X > n) break;
		ans = M(ans, floorl(a * (X % b) / b));
	}
	ans = M(ans, floorl(a*(n % b)/b));
	ll Ans = ans;
	printf("%lld", Ans);
}
//  [c]
int main()
{
  long a, b, n;
  scanf("%ld %ld %ld", &a, &b, &n);
  
  long x;
  if (n < b)
    x = n;
  else
    x = b - 1;
  printf("%ld", (a * x / b) - a * (x / b));
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
int main(){
  long int A,B,N,max,y,s,i;
  scanf("%ld %ld %ld",&A,&B,&N);
  if(N>=B) y=B-1;
  else y=N;
  s=y/B;
  max=A*y/B-A*s;
  printf("%ld",max);
  return 0;
}
//  [javascript]
const Main = (input) => {
  const tmp = input.trim().split(' ').map(n => parseInt(n))
  const A = tmp[0]
  const B = tmp[1]
  const N = tmp[2]

  let x = Math.min(B - 1, N)

  const result = Math.floor(A * x / B) - (A * Math.floor(x / B))

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
"use strict"

const main = (args) => {
    const { a, b, n } = parser(args);
    console.log(maxFloor(a, b, n));
}
const getInput = (isDebug) => {
    if (isDebug) {
    } else {
    }
}

const parser = (inputStr) => {
    const [aStr, bStr, nStr] = inputStr.split(' ');
    return {
        a: Number(aStr),
        b: Number(bStr),
        n: Number(nStr),
    };
}

const maxFloor = (a, b, n) => {
    if ( b - 1 < n ) {
        return Math.floor((a * (b - 1)) / b) - (a * Math.floor((b - 1) / b));
    } else {
        return Math.floor((a * n) / b) - (a * Math.floor(n / b));
    }
}
if (process.argv[2] === 'debug') {
    const Q1 = '5 7 4'
    const Q2 = '11 10 2000';
    main(Q1);
    main(Q2);
} else {
    main(require('fs').readFileSync('/dev/stdin', 'utf8'));
}
//  [javascript]
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var a = BigInt(next());
  var b = BigInt(next());
  var n = BigInt(next());
  var ans = 0n;
  for(var i = b-1n, j = 0; i <= n && j < 1e5; i += b, j++){
    var t = a*i/b - a*(i/b);
    if(ans < t)ans = t;
  }
  var t = a*n/b - a*(n/b);
  if(ans < t)ans = t;
  for(var i = n/b*b-1n, j = 0; i > 0 && j < 1e5; i -= b, j++){
    var t = a*i/b - a*(i/b);
    if(ans < t)ans = t;
  }
  return ans.toString();
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var a, b, n int
	fmt.Scanf("%d %d %d", &a, &b, &n)
	answer := maxFloor(a, b, n)
	fmt.Println(answer)
}

func maxFloor(a, b, n int) int {
	if n/b >= 1 {
		return floor(a, b, b-1)
	}
	return floor(a, b, n)
	// m := min(b-1, n)
	// return floor(a, b, m)
}

func floor(a, b, x int) int {
	s := a * x / b
	t := a * (x / b)
	return s - t
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var a, b, n int
	fmt.Scanf("%d %d %d", &a, &b, &n)

	x := n
	if n > b-1 {
		x = b - 1
	}

	fmt.Printf("%d\n", (a*x)/b-a*(x/b))
}
//  [ruby]
A,B,N = gets.split.map &:to_i
n = [N-1-N%B,1].max
m = N%B*A - A*N%B
x = n%B*A - A*n%B
m = x  if m < x
t = Time.now
c = 0
y = N%B
N.downto(1){|n|
  l = y*A
  r = A*n %B
  x = l - r
  m = x  if m < x
  c += 1
  y -= 1
  y += B  if y < 0
  break if 0 == c&0xffff && Time.now - t > 1.92
}
p m / B
//  [ruby]
$start_time = Time.now
a, b, n = gets.chomp.split(" ").map{|e|e.to_i}

def check(a,b,x)
	return (a*x/b).to_i - a*(x/b).to_i
end

def doit(a,b,n)
	if b>n then
		return check(a,b,n)
	else
		max = 0
		x = b-1
		while x<=n do
			c = check(a,b,x)
			if c>max then max = c end
			x += b
			if Time.now - $start_time > 1.5 then return max end
		end
		c = check(a,b,n)
		if c>max then max = c end
		return max
	end
end

print doit(a,b,n)

#5 7 20
//  [ruby]
A,B,N = gets.split.map(&:to_i)
F = lambda{|x| A*x/B - x/B*A }
p [B,N].min.step(0,-[B/A,1].max).map(&F).max
//  [rust]
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

use num::integer::*;

fn f(a: isize, b: isize, i: isize) -> isize {
   return ((a * i) / b) - a * (i / b);
}
use rand::*;

fn main() {
   let mut rng = rand::thread_rng();
   input! {
      a:isize,b:isize,n:isize
   }
   let mut ans = 0_isize;
   if n < 10000 {
      for i in 0..=n {
         ans = std::cmp::max(ans, f(a, b, i));
      }
   } else {
      if n < b {
         ans = (a * n) / b;
      } else {
         for i in 0..=10000 {
            ans = std::cmp::max(ans, f(a, b, i));
         }
         for _ in 0..1000000 {
            ans = std::cmp::max(ans, f(a, b, (rng.gen::<isize>() / 2).abs() % n + 1));
         }
      }
   }
   println!("{}", ans);
}
//  [rust]
use std::io::stdin;
use std::str::FromStr;
use std::cmp::max;
use std::cmp::min;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn read_str_as_char_vec() -> Vec<char> {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().chars().collect()
}

fn read_str_as_T<T>() -> T 
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().unwrap()
}

// fn binary_search(x: usize, a: usize, b: usize, n: usize) -> usize {
//     if x == 0 || x == n {
//         let left = a * x / b;
//         let right = a * (x / b);
//         left - right;
//     }
//     let left_x = x - 1;
//     let right_x = x + 1;
// 
//     let res = a * x / b - a * (x / b);
//     let left_res = a * left_x / b - a * (left_x / b);
//     let right_res = a * right_x / b - a * (right_x / b);
//     if left_res > res {
//         ;
//     }
// 
//     max(binary_search(), ())
// }

fn main() {
    let in_vec: Vec<usize> = read_line();
    let a = in_vec[0];
    let b = in_vec[1];
    let n = in_vec[2];

    let mut res = 0;
    let mut x: usize = 0;
    let fin = min(b, n);
    while x <= fin {
        // println!("{}", x);
        res = max(res, a * x / b - a * (x / b));
        x += max(min((b - a * x % b) / a, b - x % b), 1);
//         if x == 0 {
//             x += 1;
//             continue;
//         } else {
//             if max(b, a * x) >= min(a * x, b) {
//                 if b >= x{
//                     x += min(b - a * x % b, b - x % b);
//                     continue;
//                 }
//             }
//             break;
//             // x += min(max(b - a * x, 1), max(b - x, 1));
//         }
    }
    // for x in 0..=min(b, n) {
    //     let left = a * x / b;
    //     let right = a * (x / b);
    //     res = max(res, left - right);
    // }
    
    println!("{}", res);

    //let temp = 1_000_000_000_000 - (1_000_000_000_000 % b);
//    let temp = n - (n % b) - 1;
    // let x:usize;
    // let left:usize;
    // let right:usize;
    // if n >= n % b + 1 {
    //     x = n - (n % b) - 1;
    //     left = (a * x) / b;
    //     right = a * (x / b);
    //     println!("AA");
    // } else {
    //     let x_1 = 1;
    //     let left_1 = (a * x_1) / b;
    //     let right_1 = a * (x_1 / b);

    //     let x_2 = n;
    //     let left_2 = (a * x_1) / b;
    //     let right_2 = a * (x_1 / b);

    //     if left_1 - right_1 < left_2 - right_2 {
    //         left = left_2;
    //         right = right_2;
    //     println!("BB");
    //     } else {
    //         left = left_1;
    //         right = right_1;
    //     println!("CC");
    //     }
    // }
    // println!("{}, {}", left, right);
    // println!("{}", left - right);
}
//  [rust]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn f(a: usize, b: usize, x: usize) -> usize {
    (a * x) / b - (a * (x / b))
}

fn main() {
    input! {
       a: usize,
       b:usize,
       n:usize,
    }

    let mut ans: usize = 0;
    ans = max(ans, f(a, b, 1));
    ans = max(ans, f(a, b, n));
    let mut x = 0;
    for i in 1.. {
        x += b * i - 1;
        mydbg!(x);
        if x > n {
            break;
        }
        ans = max(ans, f(a, b, x));
    }

    echo!(ans);
}
//  [swift]
let t = cin.triple
let a = Double(t.0)
let b = Double(t.1)
let n = t.2

// debugPrint("a: \(a), b: \(b), n: \(n)")

// (1...n).map { Double($0) }.forEach { x in 
//     let res = Int(a*x/b) - Int(a)*Int(x/b)
//     debugPrint("x: \(x) -> [ax/b]: \(Int(a*x/b)), a[x/b]: \(Int(a)*Int(x/b)), diff: \(res)")
//     mmax = max(mmax, res)
// }

let x = Double(min(n, Int(b)-1))
print("\(Int(a*x/b) - Int(a)*Int(x/b))")

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var int: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var str: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { str.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { str.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in int } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}
//  [swift]
let abn = readLine()!.split(separator: " ").map { Int($0)! }
let a = abn[0], b = abn[1], n = abn[2]
var x = n
if n >= b - 1 {
  x = b - 1
}
let ans = a * x / b - a * (x / b)
print(ans)
//  [typescript]
import { count } from 'console';

process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const [a, b, n] = inputs[0].split(' ').map(Number);

  let x = b - 1 < n ? b - 1 : n;

  console.log(Math.floor((a * x) / b));
}
//  [typescript]
import { count } from 'console';

process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const [a, b, n] = inputs[0].split(' ').map(Number);

  let x = b - 1 < n ? b - 1 : n;

  console.log(Math.floor((a * x) / b) - a * Math.floor(x / b));
}
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [a, b, n] = input[0].split(" ").map((x: string): number => +x);

const x = n < b ? n : b - 1;
console.log(Math.floor((x * a) / b));
//  [python]
n,k = map(int, raw_input().split(' '))
print n - k + 1
//  [python]
n, i = map(int,input().split())

if n == 1:
    print(1)
else:
    print(n-i+1)
//  [python]
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    N, i = LI()
    print(N-i + 1)

main()
//  [java]
import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.math.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] intArray = Arrays.stream(sc.nextLine().split(" ")) 
                        .mapToInt(Integer::parseInt) 
                        .toArray();                        
                        
                        
        System.out.println(intArray[0] - intArray[1] +1);
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws Exception {
    Code code = new A();
    code.execute();
  }

  public static interface Code {
    void execute() throws IOException;
  }

  static class A implements Code {
    @Override
    public void execute() throws IOException {
      try (IO io = new IO(System.in)) {
        long[] ll = io.nextLong();
        long N = ll[0];
        long i = ll[1];
        System.out.println(solve(N, i));
      }
    }

    public long solve(long N, long i) {
      return N - i + 1;
    }
  }

  public static class IO implements Closeable {
    private BufferedReader buf;

    public IO(InputStream in) {
      buf = new BufferedReader(new InputStreamReader(in));
    }

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

    public String[] nextString() throws IOException {
      return nextLine().split(" ");
    }

    public int[] nextInt() throws IOException {
      return Arrays.stream(nextString()).mapToInt(Integer::parseInt).toArray();
    }

    public long[] nextLong() throws IOException {
      return Arrays.stream(nextString()).mapToLong(Long::parseLong).toArray();
    }

    @Override
    public void close() throws IOException {
      buf.close();
    }
  }
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.valueOf(sc.next());
        int i = Integer.valueOf(sc.next());
        System.out.println((n + 1)- i);
    }
}