Problem:
Score : 100 points

Problem Statement

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

Output

Print the maximum number of apple pies we can make with what we have.

Sample Input 1

1 3

Sample 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.

Sample Input 2

0 1

Sample Output 2

0

We cannot make an apple pie in this case, unfortunately.

Sample Input 3

32 21

Sample Output 3

58

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            var ap = ReadIntArray();
            int A = ap[0], P = ap[1];
            Out((3 * A + P) >> 1);
        }

        //最小公倍数
        static int LCM(int num1, int num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        static long LCM(long num1, long num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        //最大公約数
        static int GCD(int num1, int num2)
        {
            int a = Math.Max(num1, num2);
            int b = Math.Min(num1, num2);
            int mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static long GCD(long num1, long num2)
        {
            long a = Math.Max(num1, num2);
            long b = Math.Min(num1, num2);
            long mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static void Out(object o)
        {
            Console.WriteLine(o);
        }
    }

    static class EnumerableExtension
    {
        public delegate void Function<in T>(T val);

        public static void ForEach<T>(this IEnumerable<T> enumerable, Function<T> function)
        {
            foreach (var x in enumerable)
            {
                function(x);
            }
        }
    }

//    class PriorityQueue<T>
//    {
//        private readonly List<Tuple<int, T>> _list = new List<Tuple<int, T>>();
//
//        public PriorityQueue()
//        {
//        }
//
//        public void Push(T item, int priority)
//        {
//            var itemIndex = _list.Count;
//            _list.Add(Tuple.Create(priority, item));
//        }
//
//        public T Pop()
//        {
//        }
//
//        public T Peek()
//        {
//            return _list[0].Item2;
//        }
//
//        private void Swap(int index1, int index2)
//        {
//            var tmp = _list[index1];
//            _list[index1] = _list[index2];
//            _list[index2] = tmp;
//        }
//    }

    class UnionFind
    {
        private readonly int[] _array;

        public UnionFind(int N)
        {
            _array = new int[N];
            for (int i = 0; i < N; i++)
            {
                _array[i] = i;
            }
        }

        public int GetRootNode(int n)
        {
            if (_array[n] == n) return n;
            return _array[n] = GetRootNode(_array[n]);
        }

        public void UnionGroup(int a, int b)
        {
            var rootA = GetRootNode(a);
            var rootB = GetRootNode(b);
            if (rootA == rootB) return;
            _array[rootA] = rootB;
        }

        public bool IsSameGroup(int a, int b) => GetRootNode(a) == GetRootNode(b);

        public bool IsRoot(int n) => _array[n] == n;
    }
}