Apple Pie

AtCoder
IDabc128_a
Time2000ms
Memory256MB
Difficulty
We have $A$ apples and $P$ pieces of apple. We can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan. Find the maximum number of apple pies we can make with what we have now. ## Constraints * All values in input are integers. * $0 \leq A, P \leq 100$ ## Input Input is given from Standard Input in the following format: $A$ $P$ [samples]
Samples
Input #1
1 3
Output #1
3

We can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.
Input #2
0 1
Output #2
0

We cannot make an apple pie in this case, unfortunately.
Input #3
32 21
Output #3
58
API Response (JSON)
{
  "problem": {
    "name": "Apple Pie",
    "description": {
      "content": "We have $A$ apples and $P$ pieces of apple. We can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan. Find the maximum number of apple pies we c",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc128_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "We have $A$ apples and $P$ pieces of apple.\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\nFind the maximum number of apple pies we c...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments