Language: C++

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Numerics;
using System.Text.RegularExpressions;
//byte 255 int<2147483647 ≒ 2 * 10^9 long < 9223372036854775807 ≒ 9 * 10^18
//decimal 29桁

class Myon
{
    //chokudaiさんのコードをコピペ
    static Scanner cin;
    public Myon() { }
    public static int Main()
    {
        //Console.SetOut(new Printer(Console.OpenStandardOutput()));
        cin = new Scanner();
        new Myon().calc();
        //test();
        return 0;
    }

    public void calc()
    {
        int n = cin.nextInt();
        int[] d = cin.nextIntArr(n);
        long sum = 0;
        foreach (int d2 in d) sum += d2;
        sum = sum * sum;
        foreach (int d2 in d) sum -= d2 * d2;
        ShowL(sum / 2);


    }

    public static void test()
    {
        int[] l = new int[] { 1,2,3,4 };
        int index = Array.BinarySearch(l, 3);
        if (index < 0) index = index * -1 - 1;
        else index++;
        ShowL(l.Length - index);
    }


    public static void ShowL() { Console.WriteLine(""); }
    public static void ShowL<T>(T s) { Console.WriteLine(s); }
    public static void Show<T>(T s) { Console.Write(s); }
    public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }

}

class Printer : StreamWriter
{
    public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
    public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
    public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        while (i >= s.Length)
        {
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
        }
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] nextIntArr(long n)
    {
        int[] output = new int[n];
        for (int i = 0; i < n; i++) output[i] = nextInt();
        return output;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

static class SMath
{
    
    /// <summary>
    /// 素因数分解して、n番目に見つかった素因数をoutput[n-1]に返します。
    /// 12 なら 2,2,3 です。
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    public static List<long> Factorization(long n)
    {
        if (n <= 0) return null;
        List<long> output = new List<long>();
        int i = 2;
        long max = (long)Math.Sqrt(n); ;
        while (n > 1)
        {
            if (i > max) { output.Add(n); break; }
            while (n % i == 0)
            {
                output.Add(i);
                n /= i;
            }
            i++;
        }
        return output;
    }

    /// <summary>
    /// 素因数分解して、n番目に見つかった素因数をoutput[n-1]に返します。
    /// 84 = (2^2 * 3 * 7) なら 2, 1, 0, 1 　remainder = 1です。(打ち切られない）
    /// 13 = 0,0,...0 remainder = 2019
    /// ただし、試行を打ち切った時に限り残りをremainderに返す。(remainderは素数または1となる)
    /// </summary>
    /// <param name="n"></param>
    /// <param name="remainder"></param>
    /// <returns></returns>
    public static List<long> Factorization(long n, out long remainder)
    {
        //output[i] が i-1番目の素数の数を示す
        //ただし、試行を打ち切った時に限り残りをremainderに返す。(remainderは素数または1となる)
        remainder = 1;
        if (n <= 0) return null;
        List<long> output = new List<long>();
        long tempn = 2;
        long max = (long)Math.Sqrt(n);
        bool[] isNOTPrime = new bool[max+1];
        while (n > 1)
        {

            if (tempn > max) { remainder = n; break; }
            if (!isNOTPrime[tempn])
            {
                output.Add(0);
                while (n % tempn == 0)
                {
                    output[output.Count - 1]++;
                    n /= tempn;
                }
                for (long j = tempn * 2; j < isNOTPrime.Length; j += tempn) isNOTPrime[j] = true;
            }
            tempn++;
        }
        return output;
    }

    /// <summary>
    /// i番目の素数をoutput[i-1]に返します。
    /// ただしnより大きい素数については判定しません。
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    public static List<long> GetPrimeNumbers(long n)
    {
        if (n <= 0) return null;
        List<long> output = new List<long>();
        long tempn = 2;
        bool[] isNOTPrime = new bool[n + 1];
        while (n > 1)
        {
            if (tempn > n) { break; }
            if (!isNOTPrime[tempn])
            {
                output.Add(tempn);
                for (long j = tempn * 2; j < isNOTPrime.Length; j += tempn) isNOTPrime[j] = true;
            }
            tempn++;
        }
        return output;
    }


    private static long[][] combMemo;
    private static int maxn_combination = -1;
    public static long Combination(int n, int k)
    {
        if (n < 0 || k > n) return 0;
        if (n == k || k == 0) return 1;
        if (k > n/2) return Combination(n, n - k);
        if (maxn_combination < n)
        {
            maxn_combination = n;
            combMemo = new long[n+1][];
        }
        if (combMemo[n] == null) combMemo[n] = new long[n/2 + 1];
        if (combMemo[n][k] != 0) return combMemo[n][k];
        else
        {
            combMemo[n][k] = Combination(n - 1, k) + Combination(n - 1, k - 1);
            return combMemo[n][k];
        }
        
    }
    public static long Gcd(long a, long b)
    {
        if (a <= 0) return -1;
        //if (a > b) return gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
    public static long Lcm(long a,long b)
    {
        return a / Gcd(a, b) * b;
    }


    public class pairComparer : IComparer<int[]>
    {
        int index = 0;
        public pairComparer(int n)
        {
            index = n;
        }
        public pairComparer()
        {
            index = 0;
        }
        public int Compare(int[] x, int[] y)
        {
            return y[index] - y[index];
        }
    }

}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.IO;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Linq;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Text;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
    7 | using System.Globalization;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'System'
    8 | using System.Numerics;
      |       ^~~~~~
a.cc:9:7: error: expected nested-name-specifier before 'System'
    9 | using System.Text.RegularExpressions;
      |       ^~~~~~
a.cc:16:12: error: 'Scanner' does not name a type
   16 |     static Scanner cin;
      |            ^~~~~~~
a.cc:17:11: error: expected ':' before 'Myon'
   17 |     public Myon() { }
      |           ^~~~~
      |           :
a.cc:18:11: error: expected ':' before 'static'
   18 |     public static int Main()
      |           ^~~~~~~
      |           :
a.cc:27:11: error: expected ':' before 'void'
   27 |     public void calc()
      |           ^~~~~
      |           :
a.cc:40:11: error: expected ':' before 'static'
   40 |     public static void test()
      |           ^~~~~~~
      |           :
a.cc:50:11: error: expected ':' before 'static'
   50 |     public static void ShowL() { Console.WriteLine(""); }
      |           ^~~~~~~
      |           :
a.cc:51:11: error: expected ':' before 'static'
   51 |     public static void ShowL<T>(T s) { Console.WriteLine(s); }
      |           ^~~~~~~
      |           :
a.cc:51:24: error: variable or field 'ShowL' declared void
   51 |     public static void ShowL<T>(T s) { Console.WriteLine(s); }
      |                        ^~~~~
a.cc:51:24: error: expected ';' at end of member declaration
   51 |     public static void ShowL<T>(T s) { Console.WriteLine(s); }
      |                        ^~~~~
      |                             ;
a.cc:51:29: error: expected unqualified-id before '<' token
   51 |     public static void ShowL<T>(T s) { Console.WriteLine(s); }
      |                             ^
a.cc:52:11: error: expected ':' before 'static'
   52 |     public static void Show<T>(T s) { Console.Write(s); }
      |           ^~~~~~~
      |           :
a.cc:52:24: error: variable or field 'Show' declared void
   52 |     public static void Show<T>(T s) { Console.Write(s); }
      |                        ^~~~
a.cc:52:24: error: expected ';' at end of member declaration
   52 |     public static void Show<T>(T s) { Console.Write(s); }
      |                        ^~~~
      |                            ;
a.cc:52:28: error: expected unqualified-id before '<' token
   52 |     public static void Show<T>(T s) { Console.Write(s); }
      |                            ^
a.cc:53:11: error: expected ':' before 'static'
   53 |     public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }
      |           ^~~~~~~
      |           :
a.cc:53:39: error: 'string' has not been declared
   53 |     public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }
      |                                       ^~~~~~
a.cc:53:59: error: 'string' has not been declared
   53 |     public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }
      |                                                           ^~~~~~
a.cc:55:2: error: expected ';' after class definition
   55 | }
      |  ^
      |  ;
a.cc:53:53: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   53 |     public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }
      |                                                     ^~~~~
      |                                                     |
      |                                                     const char*
a.cc:53:75: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   53 |     public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }
      |                                                                           ^~~~
      |                                                                           |
      |                                                                           const char*
a.cc: In static member function 'static int Myon::Main()':
a.cc:21:9: error: 'cin' was not declared in this scope
   21 |         cin = new Scanner();
      |         ^~~
a.cc:21:19: error: expected type-specifier before 'Scanner'
   21 |         cin = new Scanner();
      |                   ^~~~~~~
a.cc:22:19: error: expected ';' before '.' token
   22 |         new Myon().calc();
      |                   ^
a.cc: In member function 'void Myon::calc()':
a.cc:29:17: error: 'cin' was not declared in this scope
   29 |         int n = cin.nextInt();
      |                 ^~~
a.cc:30:12: error: structured binding declaration cannot have type 'int'
   30 |         int[] d = cin.nextIntArr(n);
      |            ^~
a.cc:30:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:30:12: error: empty structured binding declaration
a.cc:30:15: error: expected initializer before 'd'
   30 |         int[] d = cin.nextIntArr(n);
      |               ^
a.cc:32:18: error: expected primary-expression before 'int'
   32 |         foreach (int d2 in d) sum += d2;
      |                  ^~~
a.cc:32:9: error: 'foreach' was not declared in this scope
   32 |         foreach (int d2 in d) sum += d2;
      |         ^~~~~~~
a.cc:34:18: error: expected primary-expression before 'int'
   34 |         foreach (int d2 in d) sum -= d2 * d2;
      |                  ^~~
a.cc:35:14: error: no matching function for call to 'Myon::ShowL(long int)'
   35 |         ShowL(sum / 2);
      |         ~~~~~^~~~~~~~~
a.cc:50:24: note: candidate: 'static void Myon::ShowL()'
   50 |     public static void ShowL() { Console.WriteLine(""); }
      |                        ^~~~~
a.cc:50:24: note:   candidate expects 0 arguments, 1 provided
a.cc: In static member function 'static void Myon::test()':
a.cc:42:12: error: structured binding declaration cannot have type 'int'
   42 |         int[] l = new int[] { 1,2,3,4 };
      |            ^~
a.cc:42:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:42:12: error: empty structured binding declaration
a.cc:42:15: error: expected initializer before 'l'
   42 |         int[] l = new int[] { 1,2,3,4 };
      |               ^
a.cc:43:21: error: 'Array' was not declared in this scope
   43 |         int index = Array.BinarySearch(l, 3);
      |                     ^~~~~
a.cc:43:40: error: 'l' was not declared in this scope
   43 |         int index = Array.BinarySearch(l, 3);
      |                                        ^
a.cc: In static member function 'static void Myon::ShowL()':
a.cc:50:34: error: 'Console' was not declared in this scope
   50 |     public static void ShowL() { Console.WriteLine(""); }
      |                                  ^~~~~~~
a.cc: In static member function 'static void Myon::Yorn(bool, int, int)':
a.cc:53:98: error: no matching function for call to 'Myon::ShowL(int&)'
   53 |     public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }
      |                                                                                             ~~~~~^~~~~~
a.cc:50:24: note: candidate: 'static void Myon::ShowL()'
   50 |     public static void ShowL() { Console.WriteLine(""); }
      |                        ^~~~~
a.cc:50:24: note:   candidate expects 0 arguments, 1 provided
a.cc:53:116: error: no matching function for call to 'Myon::ShowL(int&)'
   53 |     public static void Yorn(bool isOK,string ifOK = "Yes",string ifNOTOK ="No") { if (isOK) ShowL(ifOK); else ShowL(ifNOTOK); }
      |                                                                                                               ~~~~~^~~~~~~~~
a.cc:50:24: note: candidate: 'static void Myon::ShowL()'
   50 |     public static void ShowL() { Console.WriteLine(""); }
      |                        ^~~~~
a.cc:50:24: note:   candidate expects 0 arguments, 1 provided
a.cc: At global scope:
a.cc:58:1: error: expected class-name before '{' token
   58 | {
      | ^
a.cc:59:11: error: expected ':' before 'override'
   59 |     public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
      |           ^~~~~~~~~
      |           :
a.cc:59:12: error: 'override' does not name a type
   59 |     public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
      |            ^~~~~~~~
a.cc:60:11: error: expected ':' before 'Printer'
   60 |     public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
      |           ^~~~~~~~
      |           :
a.cc:60:26: error: expected ')' before 'stream'
   60 |     public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
      |                   ~      ^~~~~~~
      |                          )
a.cc:61:11: error: expected ':' before 'Printer'
   61 |     public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }
      |           ^~~~~~~~
      |           :
a.cc:61:26: error: expected ')' before 'stream'
   61 |     public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }
      |                   ~      ^~~~~~~
      |                          )
a.cc:62:2: error: expected ';' after class definition
   62 | }