Problem:


Score : 100 points

Problem Statement

Takahashi is going to set a 3-character password.

How many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?

Constraints

1 \leq N \leq 9

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of possible passwords.

Sample Input 1

2

Sample Output 1

8

There are eight possible passwords: 111, 112, 121, 122, 211, 212, 221, and 222.

Sample Input 2

1

Sample Output 2

1

There is only one possible password if you can only use one kind of character.



Sample input:
2


Sample output:
8

Submission status: Accepted

Solution code:
import collections


p = input()
p = int(p)

print(p**3)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
#x = [int(i) for i in readline().split()]

print(n**3)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-


N = int(input())
print(N**3)

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


N =  int(sys.stdin.readline())
print(N ** 3)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC140 A

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
print(n**3)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

ans = N * N * N
print(ans)

Submission status: Accepted

Solution code:
import math
import copy

n = int(input())
# k, x = [int(i) for i in input().split()]
# table = [[int(i) for i in input().split()] for j in range(n)]
# table = [list(input()) for n in range(h)]
# s = [int(i) for i in input().split()]
# num = [int(i) for i in range(n)]
# s = [input() for i in range(n)]
# s = input()
# list = list(s)
# dp = [[0 for _ in range(2)] for _ in range(13)]
#s = [input() for i in range(n)]

print(n*n*n)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    
    print(N**3)

Submission status: Accepted

Solution code:
n  = int(input())

print(n**3)

Submission status: Accepted

Solution code:
N=int(input())
S=N*N*N
print(S)

Submission status: Accepted

Solution code:
n = int(input())
ans=n*n*n
print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
print(n*n*n)

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
print(N**3)

Submission status: Accepted

Solution code:
def getlist():
    return list(map(int, input().split()))

N = int(input())
print(N ** 3)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin.readline
na = lambda: map(int, stdin().split())
ns = lambda: stdin().rstrip()
ni = lambda: int(ns())

n = ni()
print(n**3)

Submission status: Accepted

Solution code:

N = int(input())

print (N ** 3)

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
print(N**3)

Submission status: Runtime Error

Solution code:
s=int(input())

print(n**3)

Submission status: Runtime Error

Solution code:
s=input()

print(n**3)

Submission status: Runtime Error

Solution code:
N = int(input())
ls = [int(i) for i in input().split()]
if len(ls) == 1:
  print(ls[0]*2)
else:
  als = [ls[0]]
  for n in range(1, N-1):
    als.append(min(ls[n-1], ls[n]))
  als.append(ls[-1])
  print(sum(als))

Submission status: Runtime Error

Solution code:
n = int(input)
print(n*n*n)

Submission status: Runtime Error

Solution code:
print=(input()**3)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
 
ans = sum(B)
for i in range(len(A)-1):
    if A[i] + 1 == A[i+1]:
        ans += C[A[i]-1]
 
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
d=sum(B)
for i in range(n-1):
  if A[i+1]-A[i]==1:
    d+=C[A[i]-1]
print(d)

Submission status: Runtime Error

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
d=sum(B)
for i in range(n-1):
  if A[i+1]-A[i]==1:
    d+=B[A[i]-1]
print(d)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
s=list(input())

RL=0
LR=0

fo=0

if n<3:
  if n==1:
    print(0)
  else:
    print(1)
    
else:
  for i in range(n):
    if s[i]=='R' and i<n-1:
      if s[i+1]=='R':
        fo+=1
    if s[i]=='L' and 0<i:
      if s[i-1]=='L':
        fo+=1
        
    if i<n-1:
      if s[i]=='R' and s[i+1]=='L':
        RL+=1
      elif s[i]=='L' and s[i+1]=='R':
        LR+=1
        
  si=min(k,RL,LR)
  no=k-si
  LR_rest=LR-si
  RL_rest=RL-si
  if no==0:
    ans=fo+si*2
  else:
    ans=fo+si*2
    if s[0]=='L':
      if LR_rest>0:
        ans+=1
        LR_rest-=1
        no-=1
    if no>0:
      if s[-1]=='R':
        if LR_rest>0:
          ans+=1
  print(ans)

Submission status: Runtime Error

Solution code:
print(2**int(input))

Submission status: Runtime Error

Solution code:
print(int(input()**3))

Submission status: Runtime Error

Solution code:
#C - Maximal Value
N = int(input())
B = list(map(int,input().split()))
A = [B[0]]
for i in range(1,N-1):
    if B[i] > B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])
A.append(B[-1])
print(sum(A))

Submission status: Runtime Error

Solution code:
#C - Maximal Value
N = int(input())
B = list(map(int,input().split()))
print(B)
A = [B[0]]
for i in range(1,N-1):
    if B[i] > B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])
A.append(B[-1])
print(sum(A))

Submission status: Runtime Error

Solution code:
N = import()
output = N*N*N
print(output)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
from itertools import combination_with_replacement

n = int(input())
print(len(list(combination_with_replacement(n, 3))))

Submission status: Runtime Error

Solution code:
prnt(int(input())**3)

Submission status: Runtime Error

Solution code:
print((input())^3)

Submission status: Runtime Error

Solution code:
import itertools
    N = int(input())
    print(sum([1 for i,j,k in itertools.product(range(1,N+1),range(1,N+1),range(1,N+1))]))

Submission status: Runtime Error

Solution code:
N = input()
print(N ** 3)

Submission status: Runtime Error

Solution code:
n = input()

print(n ** 3)

Submission status: Runtime Error

Solution code:
n = input()
print(n ** 2)

Submission status: Runtime Error

Solution code:
N = int(input())
count = 1
for i in range(N):
  if N = 0:
    print(count)
  else:
  	count *= N
  	N = N -1

Submission status: Runtime Error

Solution code:
def password(n):

    return n**3
def main():
    n = list(str(input()))
    print(password(n))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
print(int(input()**3)

Submission status: Runtime Error

Solution code:
n = int(input())
pirnt(n**3)

Submission status: Runtime Error

Solution code:
e=int(input())
sum=1
for i in e:
  sum*=i**e
print(sum)

Submission status: Runtime Error

Solution code:
from itertools import combinations

# input
N = int(input())
print(len(list(combinations([for i in range(1, N + 1)] * 3, 3))))

Submission status: Runtime Error

Solution code:
n=input()
print(n**3)

Submission status: Runtime Error

Solution code:
i=input();print(i**3)

Submission status: Runtime Error

Solution code:
n = int(input())
b = list(map(int,input().split()))

a = [b.pop()]
for b_i in b[::-1]:
  a.append(min(a[-1],b_i))
a.append(a[-1])
print(sum(a))

Submission status: Runtime Error

Solution code:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=sum(b)
m=[]
for i in range(N-1):
  if a[i+1]-a[i]==1:
    m.append(c[a[i]-1])
e=sum(m)
print(d+e)

Submission status: Runtime Error

Solution code:
n = input()
print(n ** 3)

Submission status: Runtime Error

Solution code:
print(int(input())**3

Submission status: Runtime Error

Solution code:
a=int(input())
n=list(range(1,a+1))
m=n
o=n
for i in n:
  for j in m:
    for q in o:
      u=list(i,j,k,sep='')
print(len(u))

Submission status: Runtime Error

Solution code:

n=int(input())
print(N**3)

Submission status: Runtime Error

Solution code:
print(int((input())**3))

Submission status: Runtime Error

Solution code:
a = int(inpput())
print(a**3)

Submission status: Runtime Error

Solution code:
print(int(input() ** 3))

Submission status: Runtime Error

Solution code:
print(int(input() ** 3)

Submission status: Runtime Error

Solution code:
print(int(input() ** 2)

Submission status: Runtime Error

Solution code:
n = input()

print(n**3)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
ans=sum(B)
for s in range(N-1):
        if A[s+1]==A[s]+1:
            ans+=C[A[s]-1]
print(ans)

Submission status: Runtime Error

Solution code:
num = int(input())
index = list(map(int, input().split()))
point = list(map(int, input().split()))
add = list(map(int, input().split()))

total = 0
for i in range(num):
  total += point[index[i]-1]

for j in range(num-1):
  if index[j+1] == index[j]+ 1:
    total += add[index[i]-1]


print(total)

Submission status: Runtime Error

Solution code:
num = input()

print(num **3)

Submission status: Runtime Error

Solution code:
import io
import sys
import math

n=int(input())
ans=0
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

for i in range(n):
  ans+=B[i]
for j in range(n-1):
  if (A[j]+1)==A[j+1]:
    ans+=C[A[j]-1]
print(ans)

Submission status: Runtime Error

Solution code:
print(int(input())**3))

Submission status: Runtime Error

Solution code:
print(int(input(n**3)))

Submission status: Runtime Error

Solution code:
print(n**3)

Submission status: Runtime Error

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n=input()
print(n*n*n)

Submission status: Runtime Error

Solution code:
N=input()
print(N*N*N)

Submission status: Runtime Error

Solution code:
print((int.input())**3)

Submission status: Runtime Error

Solution code:
n = int(input())
b = list(map(int,input().split()))
a = [-1]*n
a[0] = b[0]
a[-1:] = b[-1:]
for i in range(n-2):
    a[i+1] = min(b[i],b[i+1])
print(sum(a))

Submission status: Runtime Error

Solution code:
N = int(input())
B = list(map(int,input().split()))
A = []
A.append(B[0])
A.append(B[0])
for i in range(1, N - 2):
  if B[i] < A[i]:
    A[i] = B[i]
  A.append(B[i])

if N > 2:
  A.append(B[-1])
print(sum(A))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

score = 0
for i in range(0,N-1):
    if A[i+1] - A[i] == 1:
        score += C[A[i] - 1]

print(score + sum(B))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
sumc = 0

for count in range(N-1):
    if A[count+1] - A[count] == 1:
        sumc = sumc + C[A[count]-1]

print(sumc + sum(B))

Submission status: Runtime Error

Solution code:
print(int()input()*3)

Submission status: Runtime Error

Solution code:
a = input()
print(a**3)

Submission status: Runtime Error

Solution code:
a=input()
print(a**3)

Submission status: Runtime Error

Solution code:
s=input()
ans=1
for i in range(3):
	ans*=s
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
ans=1
for i in range(3)
	ans*=s
print(ans)

Submission status: Runtime Error

Solution code:
import math
def cmb(n,r):
  return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
lmt = []
for i in range(n+1):
  lmt.extend([i]*cmb(n,i))
bias = ls[-1]-lmt[-1]
jdg = 0
ulmt = 0
for i in range(n):
  jdg += ls.count(i)
  ulmt += 2**(n-i-1)
  if jdg > ulmt:
    print("No")
    exit()
for x,l in zip(ls,lmt):
  if x-l > bias:
    print("No")
    break
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
n = int(inupt())
print(n**3)

Submission status: Runtime Error

Solution code:
print(int(input)**3)

Submission status: Runtime Error

Solution code:
n = int(input)
print(n**3)

Submission status: Runtime Error

Solution code:
n = int(input())

print (n^3

Submission status: Runtime Error

Solution code:
N = input()

print(N*N*N)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

# print(N, A_LIST, B_LIST, C_LIST)

result = 0

for i in range(N):
    result += B[A[i] - 1]
    if i > 0 and A[i] - 1 == A[i-1]:
        result += C[A[i-1]-1]

print(result)
# 5+8+9+24+15+13

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
using namespace std;
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b,a % b);
}
int combination(int n, int k){
    int spaceOptimize[k+1];
    memset(spaceOptimize, 0, sizeof(spaceOptimize));
    spaceOptimize[0] = 1;
    for(int i=1;i<=n; i++){
        for(int j= min(i,k);j>0;j--){
            spaceOptimize[j] = spaceOptimize[j] + spaceOptimize[j-1];
        }
    }
    return spaceOptimize[k];
}
int count_permutation(int arr[], int n){
    int a[n];
    for(int i=0;i<n;i++){
        a[i] = i+1;
    }
    int count = 0;
    do {
        count++;
        if (equal(a, a + n, arr)){
            return count;
        }
    } while (next_permutation(a, a + n));
    return 0;
}

signed main(){
#ifndef ONLINE_JUDGE
   // freopen("input.txt","r", stdin);
#endif
    fastIO

    int n;
    cin >> n;
    cout << pow(n,3);



    return 0;
}

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
using namespace std;
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b,a % b);
}
int combination(int n, int k){
    int spaceOptimize[k+1];
    memset(spaceOptimize, 0, sizeof(spaceOptimize));
    spaceOptimize[0] = 1;
    for(int i=1;i<=n; i++){
        for(int j= min(i,k);j>0;j--){
            spaceOptimize[j] = spaceOptimize[j] + spaceOptimize[j-1];
        }
    }
    return spaceOptimize[k];
}
int count_permutation(int arr[], int n){
    int a[n];
    for(int i=0;i<n;i++){
        a[i] = i+1;
    }
    int count = 0;
    do {
        count++;
        if (equal(a, a + n, arr)){
            return count;
        }
    } while (next_permutation(a, a + n));
    return 0;
}

signed main(){
#ifndef ONLINE_JUDGE
   // freopen("input.txt","r", stdin);
#endif
    fastIO

    int n;
    cin >> n;
    cout << pow(2,n);



    return 0;
}

Submission status: Runtime Error

Solution code:
n=int(print())
print(n*n*n)

Submission status: Runtime Error

Solution code:
print((int(input())**3)

Submission status: Runtime Error

Solution code:
print(II()**3)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.append()
B.append()
ans=0
for i in range(1,N+1):
	ans+=B[A[i-1]-1]
	if A[i-1]==A[i]-1:
		ans+=C[A[i-2]]
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
 
happy = 0
 
for i in range(N):
  happy += B[A[i]]
  if A[i]+1 == A[i+1]:
    happy += C[i]
 
print(happy)

Submission status: Runtime Error

Solution code:
140 proA
N = int(input())
ans = 0
for i in range(N):
	for j in range(N):
		for t in range(N):
			ans+=1
print(ans)#N^3が答え

Submission status: Runtime Error

Solution code:
n=int(intput())
s=n**3
print(s)

Submission status: Runtime Error

Solution code:
n=int(intput())
s=n*3
print(s)

Submission status: Runtime Error

Solution code:
var = input()

pas = var ** var

print(pas)

Submission status: Runtime Error

Solution code:
n=int(intput())
print(n**3)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

a = N * N * N
# 出力
print(a)

Submission status: Runtime Error

Solution code:
N=int(input())
print(n**3)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
tmp = 0

for i in range(n-1):
    if a[i+1] == a[i]+1:
        tmp += c[a[i]-1]

print(sum(b)+tmp)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
if a=b=c:
  print(1)
elif a=b!=c:
  print(3)
else:
  print(6)

Submission status: Runtime Error

Solution code:
n=int.(input())
print(n**3)

Submission status: Runtime Error

Solution code:
n = int(input())
b = list(map(int, input().split()))
ans = b[0]
for i in range(len(b)-1):
  ans.append(min(b[i], b[i+1]))
ans += b[-1]
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
b = list(map(int, input().split()))
ans = b[0]
for i in range(len(b)-1):
  ans.append(min(b[i], b[i+1]))
  ans += b[-1]
print(ans)

Submission status: Runtime Error

Solution code:
N = int(intput())
print(N ** 3)

Submission status: Runtime Error

Solution code:
N = int(intput())

print(N ** 3)

Submission status: Runtime Error

Solution code:
print(input()**3)

Submission status: Runtime Error

Solution code:
a = input()
print(a ** 3)

Submission status: Runtime Error

Solution code:
n = int(input())
a = input().split()
a = [int(i) for i in a]
b = input().split()
b = [int(i) for i in b]
result= 0
for i in range (n):
  result += b[i]
c = input().split()
c = [int(i) for i in c]
for i in range (n):
  if a[i] - a[i-1] == 1:
    result += c[i-2]
  else:
    break
print(result)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list((map(int,input().split())))
B = list((map(int,input().split())))
C = list((map(int,input().split())))
 
total = sum(B)
point = 0
for i in range(len(A) - 1):
    if A[i] + 1 == A[i+1]:
        point = point+C[A[i-1]]
        print(point)
print(total+point)

Submission status: Runtime Error

Solution code:
print(N*N*N)

Submission status: Runtime Error

Solution code:
print(N**3)

Submission status: Runtime Error

Solution code:
print(x**3)

Submission status: Runtime Error

Solution code:
x=x**3

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0

for i in range(n):
    ans += b[a[i]-1]
    if 0 < i and a[i] == a[i-1]+1:
        ans += c[a[i-1]-1]

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

#tempは空白の箱に過ぎず、一番最初のfor文では確定演出で問答無用にXの値になる。
#for文が2週目に突入してからが、tempの分かれ目。2回目のfor文でも一致はせず素直に3が代入される。
#最後のif文　temp == x-1 が一致するのは　１回目と2回目　or 2回目と3回目が連番。つまり-1して一致すれば連続


#満足度を記録していくための変数
cnt = 0

#1つ前に食べた料理を記録するための変数
temp = ""

#料理を食べた順番に処理していく
for x in A:
    
    #食べた料理の満足度を追加
    cnt += B[x-1]
    
    #今食べた料理が1つ前に食べた料理のi+1かどうかを確認
    if temp == x - 1:
        cnt += C[temp-1]
        
    #今食べた料理を記録    
    temp = x
#全ての料理に対して処理が終わったら満足度を出力   
print(cnt)

Submission status: Runtime Error

Solution code:
N = int(input())
P = [None] + list(map(int, input().split()))
 
p_to_index = [None] * (N + 1)
for index, x in enumerate(P[1:], 1):
    p_to_index[x] = index
 
 
def BIT_add(i):
    while i <= N:
        tree[i] += 1
        i += i & (-i)
 
def BIT_sum(i):
    s = 0
    while i:
        s += tree[i]
        i -= i & (-i)
    return s
 
def BIT_search(x):
    i = 0
    s = 0
    step = 1 << (len(bin(N)[2:]) - 1)
    while step:
        if i + step <= N and s + tree[i + step] < x:
            i += step
            s += tree[i]
        step >>= 1
    return i + 1
 
tree = [0] * (N + 1)
ans = 0
for x in range(N, 0, -1):
    c = p_to_index[x]
    L = BIT_sum(c)
    R = N - x - L
    a = BIT_search(L - 1) if L >= 2 else 0
    b = BIT_search(L) if L >= 1 else 0
    d = BIT_search(L + 1) if R >= 1 else N + 1
    e = BIT_search(L + 2) if R >= 2 else N + 1
    BIT_add(c)
    tmp = 0
    tmp += (b - a) * (d - c)
    tmp += (e - d) * (c - b)
    ans += tmp * x
 
print (ans)

Submission status: Runtime Error

Solution code:
N = int(input())
P = [None] + list(map(int, input().split()))
 
p_to_index = [None] * (N + 1)
for index, x in enumerate(P[1:], 1):
    p_to_index[x] = index
 
 
def BIT_add(i):
    while i <= N:
        tree[i] += 1
        i += i & (-i)
 
def BIT_sum(i):
    s = 0
    while i:
        s += tree[i]
        i -= i & (-i)
    return s
 
def BIT_search(x):
    i = 0
    s = 0
    step = 1 << (len(bin(N)[2:]) - 1)
    while step:
        if i + step <= N and s + tree[i + step] < x:
            i += step
            s += tree[i]
        step >>= 1
    return i + 1
 
tree = [0] * (N + 1)
ans = 0
for x in range(N, 0, -1):
    c = p_to_index[x]
    L = BIT_sum(c)
    R = N - x - L
    a = BIT_search(L - 1) if L >= 2 else 0
    b = BIT_search(L) if L >= 1 else 0
    d = BIT_search(L + 1) if R >= 1 else N + 1
    e = BIT_search(L + 2) if R >= 2 else N + 1
    BIT_add(c)
    ans += x* ((b - a) * (d - c) +(e - d) * (c - b))
    
print (ans)

Submission status: Runtime Error

Solution code:
# refer to kawap23's clear code.
N = int(input())
P = [None] + list(map(int, input().split()))

p_to_index = [None] * (N + 1)
for index, x in enumerate(P[1:], 1):
    p_to_index[x] = index


def BIT_add(i):
    while i <= N:
        tree[i] += 1
        i += i & (-i)

def BIT_sum(i):
    s = 0
    while i:
        s += tree[i]
        i -= i & (-i)
    return s

def BIT_search(x):
    i = 0
    s = 0
    step = 1 << (len(bin(N)[2:]) - 1)
    while step:
        if i + step <= N and s + tree[i + step] < x:
            i += step
            s += tree[i]
        step >>= 1
    return i + 1

tree = [0] * (N + 1)
ans = 0
for x in range(N, 0, -1):
    c = p_to_index[x]
    L = BIT_sum(c)
    R = N - x - L
    a = BIT_search(L - 1) if L >= 2 else 0  ## 2nd left number's idx
    b = BIT_search(L) if L >= 1 else 0      ## 1st left number's idx
    d = BIT_search(L + 1) if R >= 1 else N + 1   ## 1st right number's idx
    e = BIT_search(L + 2) if R >= 2 else N + 1   ## 2nd right number's idx
    BIT_add(c)

    ans += x * ((b - a) * (d - c) +(e - d) * (c - b))

print (ans)

Submission status: Runtime Error

Solution code:
n = int(input())
print(n＊＊3)

Submission status: Runtime Error

Solution code:
n = int(input())

cnt = 1

for i in range(3):
cnt = cnt * n

print(cnt)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]+1==A[co]:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]!=N:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    a+=B[i-1]
    if co>=1 :
        if A[co-1-1]!=N:
            a+=C[A[co-1]-1]
print(a)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for i in A[:-1]:
    a+=B[i-1]   
if A[-2]==N:
    a+=B[A[-1]-1]
else:
    a+=B[A[-1]-1]+C[A[-2]-1]
print(a)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
s = list(input())

l = 0
r = 0
count = 0
hcount = 0
score = 0
def sccount(s):
    l = 0
    r = 0
    count = 0
    score = 0
    for i in range(n):
        if s[i] == 'R':
            if r == 1:
                score += 1
            l = 0
            r = 1
        else:
            if l == 1:
                score += 1
            l = 1
            r = 0
    l = 0
    r = 0
    return score

if s[0] == 'L':
    for i in range(n):
        if s[i] == 'L':
            if r == 1 :
                count += 1
            l = 1
            r = 0
        else:
            l = 0
            r = 1
    if s[-1] == 'R':
        hcount = 1
else:
    for i in range(n):
        if s[i] == 'R':
            if l == 1 :
                count += 1
            l = 0
            r = 1
        else:
            l = 1
            r = 0
    if s[-1] == 'L':
        hcount = 1
score = sccount(s)
if count >= k:
    ans = score + k*2
elif count < k:
    ans = score + count*2 + hcount
print(ans)
# print(score,count,hcount)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split(" ")))  #食べた順番
B = list(map(int,input().split(" "))) #満足度
C = list(map(int,input().split(" ")) )#追加満足度


#満足度を足し合わせていく
manzoku = 0
for i in range(N):
    manzoku += B[A[i]-1]
    
    if i != 0 and (A[i] ==A[i-1] + 1):
        manzoku += C[A[i-1]-1]
        



print(manzoku)

Submission status: Runtime Error

Solution code:
a=input()
b=a[0]
c=a[1]
d=a[2]
e=a[3]
print("SAME" if b==c==d==e else "DIFFERENT" )

Submission status: Runtime Error

Solution code:
n=int(input())
pirnt(n**3)

Submission status: Runtime Error

Solution code:
while True:
    n = int(input())
    if n < 1 or n > 9:
        continue
    else:
        print(n**3)

Submission status: Runtime Error

Solution code:
import math
N=int(input())
print(math,factorial(N))

Submission status: Runtime Error

Solution code:
n=int(input().split())
a=[0]*n
b=list(map(int,input().split()))
a[0]=b[0]
a[n-1]=b[n-2]

for i in range(1,n-1):
  a[i]=min(b[i-1],b[i])

print(sum(a))

Submission status: Runtime Error

Solution code:
N = int(input)
print(N*N*N)

Submission status: Runtime Error

Solution code:
N = int(input())
P = list(map(int, input().split()))
ans = 0
for l in range(N-1):
    first = max(P[l], P[l+1])
    second = min(P[l], P[l+1])
    r = l+2
    ans += second
    while r < N:
        w = P[r]
        r += 1
        if second <= w <= first:
            second = w
        elif first < w:
            second = first
            first = w
        ans += second

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
print(n**3)2

Submission status: Runtime Error

Solution code:
n = input()
print(N**3)

Submission status: Runtime Error

Solution code:
n,m=map(int, input().split())
s=list(input())
count=0
x=0
y=0
s=['R']+s+['L']

for i in range(1,n+1):
    if s[i]=='L':
        if s[i-1]==s[i]:
            count+=1
    else:
        if s[i]==s[i+1]:
            count+=1
       
for i in range(1,n+1):
    if s[1]=='L':
        if s[i-1]=='R' and s[i]=='L':
            if i==1:
                x+=1
            else:
                y+=1

    else:
        if s[i]=='R' and s[i+1]=='L':
            if i==n:
                x+=1
            else:
                y+=1
if m<y:
    print(count+2*m)
elif m==y:
    print(count+y*2-1)
else:
    print(count+y*2-1+x)

Submission status: Runtime Error

Solution code:
a=int,input()
print(a^3)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=sum(b)
for i in range(n-1):
  if a[i]+1==a[i+1]:
    ans+=c[i]
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
print(N**3)

Submission status: Runtime Error

Solution code:
N, K = [int(item) for item in input().split()]
S = [item for item in input()]

def compress(arr):
    """圧縮して消えた人はhappy"""
    cnt_h = 0
    new_arr = []
    comp_arr = ['L']

    #最初は先頭をLにする　この回転はノーカン
    if arr[0] == 'R':
        for item in arr:
            if item == 'L':
                new_arr.append('R')
            else:
                new_arr.append('L')

            prev_item = item
    else:
        new_arr = arr
    # 圧縮操作と圧縮されたかずを数える

    for i in range(1, N):
        if new_arr[i - 1] == new_arr[i]:
            cnt_h += 1
        else:
            comp_arr.append(new_arr[i])

    return [comp_arr, cnt_h] 


def execute(arr, cnt_h, K):
    # 境界を全て反転するために必要な操作回数
    max_rotation = len(arr)//2
    # 全てLになるか反転回数がKに到達するかで終了
    if max_rotation <= K:
        cnt += len(arr) - 1
    else:
        cnt_h += 2*K

    return cnt_h

arr, cnt_h = compress(S)
print(execute(arr, cnt_h, K))

Submission status: Runtime Error

Solution code:
N = int(input())

return N^3

Submission status: Runtime Error

Solution code:
N = int(input)

return N^3

Submission status: Runtime Error

Solution code:
n = int(input()

print(n**3)

Submission status: Runtime Error

Solution code:
print(N ** 3)