Language: C++

/**
* @author khokharnikunj8
**/

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#pragma GCC target("avx,tune=native")

#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define endl "\n"
#define si(x) scanf("%d",&x);
#define pi(x) printf("%d",x);
#define sl(x) scanf("%lld",&x);
#define pl(x) printf("%lld",x);
#define len(x) (sizeof(x)/sizeof(x[0]))
#define init(ar, x) for(int iii=0;iii<x;iii++)ar[iii]=0;
#define pb push_back


class CodeHash {
public:
    string precise(double number, int prec) {
        stringstream ss;
        ss << fixed << setprecision(prec) << number;
        return ss.str();
    }
};


class ScanReader {

private:
    FILE *stream;
    char buffer[1 << 11];
    bool is_digit[1 << 8];
    int index, total;


    int scan() {
        if (index >= total) {
            index = 0;
            total = fread(buffer, 1, 1 << 11, stream);
            if (total <= 0)return -1;
        }
        return buffer[index++];
    }

    bool iswhitespace(int n) {
        if (n == ' ' || n == '\n' || n == '\t' || n == '\r' || n == -1)return true;
        return false;
    }

public:
    ScanReader(FILE *stream) {
        this->stream = stream;
        index = total = 0;
        for (int i = 0; i < 1 << 8; i++)is_digit[i] = isdigit(i);
    }

    int scanInt() {
        int integer = 0, temp = scan();
        while (iswhitespace(temp))temp = scan();
        int neg = 1;
        if (temp == '-')neg *= -1, temp = scan();
        while (!iswhitespace(temp))if (is_digit[temp])integer *= 10, integer += (temp - '0'), temp = scan();
        return neg * integer;
    }

    long long scanLong() {
        long long integer = 0;
        int temp = scan();
        while (iswhitespace(temp))temp = scan();
        int neg = 1;
        if (temp == '-')neg *= -1, temp = scan();
        while (!iswhitespace(temp))if (is_digit[temp])integer *= 10, integer += (temp - '0'), temp = scan();
        return neg * integer;
    }

    string scanString() {
        string ss = "";
        int temp = scan();
        while (iswhitespace(temp))temp = scan();
        while (!iswhitespace(temp))ss += temp, temp = scan();
        return ss;
    }

    double scanDouble() {
        int c = scan();
        while (iswhitespace(c)) c = scan();
        int sgn = 1;
        if (c == '-')sgn = -1, c = scan();
        double res = 0;
        while (!iswhitespace(c) && c != '.') {
            if (c == 'e' || c == 'E')return res * pow(10, scanInt());
            res *= 10;
            res += c - '0';
            c = scan();
        }
        if (c == '.') {
            c = scan();
            double m = 1;
            while (!iswhitespace(c)) {
                if (c == 'e' || c == 'E') {
                    return res * pow(10, scanInt());
                }
                m /= 10;
                res += (c - '0') * m;
                c = scan();
            }
        }
        return res * sgn;
    }
};

class PrintWriter {
private:
    FILE *stream;
    static const int BUFFER_SIZE = (1 << 11) - 1;
    static const int MAX_OUT_SIZE = 23;
    int size;
    char buffer[BUFFER_SIZE];

    void write(long long v) {
        if (v < 0)buffer[size++] = '-', v *= -1;
        if (v < 10)
            buffer[size++] = v + 48;
        else {
            write(v / 10);
            buffer[size++] = v % 10 + 48;
        }
    }

public:
    PrintWriter(FILE *stream) {
        this->size = 0;
        this->stream = stream;
    }

    void close() {
        if (size)
            fwrite(buffer, 1, size, stream);
    }

    void println(long long s) {
        if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
            fwrite(buffer, 1, size, stream);
            size = 0;
        }
        write(s);
        buffer[size++] = '\n';
    }

    void print(long long s) {
        if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
            fwrite(buffer, 1, size, stream);
            size = 0;
        }
        write(s);
        buffer[size++] = ' ';
    }

    void println(string s) {
        if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
            fwrite(buffer, 1, size, stream);
            size = 0;
        }
        for (int i = 0; i < s.length(); i++) {
            buffer[size++] = s[i];
            if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
                fwrite(buffer, 1, size, stream);
                size = 0;
            }
        }
        buffer[size++] = '\n';
    }

    void print(string s) {
        if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
            fwrite(buffer, 1, size, stream);
            size = 0;
        }
        for (int i = 0; i < s.length(); i++) {
            buffer[size++] = s[i];
            if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
                fwrite(buffer, 1, size, stream);
                size = 0;
            }
        }
        //buffer[size++] = ' ';
    }
};


FILE *fi = fopen("C:\\Users\\Nikunj\\CLionProjects\\compe\\testcases\\in.txt", "r+");
FILE *fo = fopen("C:\\Users\\Nikunj\\CLionProjects\\compe\\testcases\\out.txt", "w+");
//FILE *fi = fopen("/home/khokharnikunj8/Desktop/out.txt", "r+");
//FILE *fo = fopen("/home/khokharnikunj8/Desktop/out1.txt", "w+");


int main() {
    fi = stdin;fo  = stdout;
    ScanReader *in = new ScanReader(fi);
    PrintWriter *out = new PrintWriter(fo);
    CodeHash *ch = new CodeHash();
    int n = in->scanInt();
    double long res = 0;
    for (int i = 0; i < n; i++) {
        res += (((double) 1) / in->scanInt());
    }
    double long ans = 1/res;
    out->println(ch->precise(ans,10));
    out->close();
    return 0;
}



Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:9:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:186:14: note: called from here
  186 |       struct _Alloc_hider : allocator_type // TODO check __is_final
      |              ^~~~~~~~~~~~