1>>> import js2py
2>>> f = js2py.eval_js('function f(x) {return x + x}')
3>>> f(2)
44
5>>> f()
6nan
7>>> f(f)
8function f(x) { [python code] }function f(x) { [python code] }
1def ArrayMatching(strArr):
2 x = [int(i) for i in strArr[0][1:-1].split(',')]
3 y = [int(i) for i in strArr[1][1:-1].split(',')]
4 sums = []
5
6 for i in range(max(len(x), len(y))):
7 total = 0
8 if i < len(x):
9 total += x[i]
10 if i < len(y):
11 total += y[i]
12 sums.append(str(total))
13 return '-'.join(sums)
1def choose_best_sum(t, k, ls):
2 most = 0
3
4 for i in range(len(ls)-1):
5 addN = 0
6 if i +k > len(ls) - 1:
7 break
8 for j in range(i,i+k-1):
9 addN += ls[j]
10 for p in range(i+k-1,len(ls)-1):
11 addN += ls[p]
12 if addN > most and addN <= t:
13 most = addN
14 addN -= ls[p]
15 else:
16 addN -= ls[p]
17 if most == 0:
18 return None
19 return most
1l=int(input())
2arr=list(map(int, input().split()))
3arr=list(set(arr))
4length_list=len(arr)
5
6arr.sort()
7
8#print("set = ",arr)
9#print("length of set: ",length_list)
10
11print(arr[length_list-2])
1def numberOfSubArray(arr):
2 data = {}
3 n = len(arr)
4 maxAmount = 1
5 for i in range(1, n + 1):
6 for j in range(i):
7 s = sum(arr[j:i])
8 if s not in data:
9 data[s] = [i - 1, 1]
10 elif data[s][0] < j:
11 data[s][1] += 1
12 if data[s][1] > maxAmount: maxAmount = data[s][1]
13 data[s][0] = i - 1
14
15 return maxAmount