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.Linq;
using System.Collections.Generic;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC128.A();
        }



        class ABC128
        {
            public static void A()
            {
                var A = Read.Int();
                var P = Read.Int();
                Console.WriteLine((A * 3 + P) / 2);
            }
            public static void B()
            {
                var N = Read.Int();
                var dict = new Dictionary<string, List<Tuple<int, int>>>();
                for (int n = 1; n <= N; ++n)
                {
                    var s = Read.Str();
                    var p = Read.Int();
                    if (!dict.ContainsKey(s)) { dict.Add(s, new List<Tuple<int, int>>()); }
                    dict[s].Add(new Tuple<int, int>(p, n));
                }
                foreach (var kvp in dict.OrderBy(x => x.Key))
                {
                    var ps = kvp.Value.OrderBy(x => -x.Item1).ToArray();
                    foreach (var p in ps)
                    {
                        Console.WriteLine(p.Item2);
                    }
                }
            }
            public static void C()
            {
                var N = Read.Int();
                var M = Read.Int();
                var S = new HashSet<int>[M];
                for (int i = 0; i < M; ++i)
                {
                    S[i] = new HashSet<int>();
                    var s = Read.IntN();
                    foreach (var ss in s.Skip(1))
                    {
                        S[i].Add(ss - 1);
                    }
                }
                var P = Read.IntN();
                int count = 0;
                for (int i = 0; i < (1 << N); ++i)
                {
                    bool ok = true;
                    for (int m = 0; m < M; ++m)
                    {
                        var on = 0;
                        foreach (var n in S[m])
                        {
                            if (((1 << n) & i) > 0) { on++; }
                        }
                        if (on % 2 != P[m]) { ok = false; break; }
                    }
                    if (ok) { count++; }
                }
                Console.WriteLine(count);
            }
            public static void D()
            {
                var N = Read.Int();
                var K = Read.Int();
                var V = Read.LongN();
                long max = 0;
                for (int left = 0; left <= N; ++left)
                {
                    for (int right = 0; right <= N - left; ++right)
                    {
                        if (left + right > K) { break; }
                        List<long> list = new List<long>();
                        for (int i = 0; i < left; ++i) { list.Add(V[i]); }
                        for (int i = 0; i < right; ++i) { list.Add(V[N - 1 - i]); }
                        list = list.OrderBy(x => x).ToList();
                        long sum = 0;
                        int drop = K - left - right;
                        for (int i = 0; i < list.Count; ++i)
                        {
                            sum += i < drop ? Math.Max(0, list[i]) : list[i];
                        }
                        max = Math.Max(max, sum);
                    }
                }
                Console.WriteLine(max);
            }
            public static void E()
            {
                var N = Read.Int();
                var Q = Read.Int();
                var STX = new Tuple<long, long, long>[N];
                for (int i = 0; i < N; ++i)
                {
                    var v = Read.LongN();
                    STX[i] = new Tuple<long, long, long>(v[0], v[1], v[2]);
                }
                var D = Enumerable.Range(0, Q).Select(i => Read.Long()).ToArray();

            }
            public static void F()
            {

            }
        }




        class Util
        {
            public static long[] ASum(long[] array)
            {
                var res = new long[array.Length + 1];
                for (int i = 0; i < array.Length; ++i)
                {
                    res[i + 1] = res[i] + array[i];
                }
                return res;
            }
        }

        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new HashSet<int>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1]);
                    dict[ab[1]].Add(ab[0]);
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}