Under construction

Still being built. Things may change

Contest or Internship

Interview

Time limit1sMemory limit128 MB

Summary
Given female and male student counts and a number who must leave for internship, decide who to remove to maximize teams of 2 females and 1 male each.
Level

Easy3 of 10

Topics
Greedy, Math, Simulation
Solved
No attempts yet

Problem

At a university, each programming contest team must consist of exactly 2 female students and 1 male student.

This year, N female students and M male students want to participate in the contest. Among these students, K students must instead participate in an internship program, and students who join the internship cannot compete.

Find the maximum number of contest teams that can be formed.

Input

The first line contains N, M, and K, separated by spaces.

  • 0 <= N <= 100
  • 0 <= M <= 100
  • 0 <= K <= N + M

Output

Print the maximum number of teams that can be formed.

Examples3

  1. Example 1

    Input
    6 3 2
    
    Expected output
    2
    
  2. Example 2

    Input
    2 1 1
    
    Expected output
    0
    
  3. Example 3

    Input
    6 10 3
    
    Expected output
    3