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: Runtime Error

Solution code:
import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

p = [0] + l() + [n+1]
ans = 0
a = [0 for i in range(n+2)]

for i in range(n+2):
    a[p[i]] = i

l = [set() for i in range(n+2)]
r = [set() for i in range(n+2)]

for i in range(n+2):
    l[i].add(max(0,i-1))
    l[i].add(max(0,i-2))
    r[i].add(min(n+1,i+1))
    r[i].add(min(n+1,i+2))


for i in range(n+1):
    m = a[i]
    x2,x1,y1,y2 = min(l[m]),max(l[m]),min(r[m]),max(r[m])
    hoge= i*(abs((m-x1)*(y2-y1)) + abs((y1-m)*(x1-x2)))
    ans += hoge

    r[x1].clear()
    r[x1].add(y1)
    r[x1].add(y2)

    l[y1].clear()
    l[y1].add(x1)
    l[y1].add(x2)
    
    r[x2].clear()
    r[x2].add(x1)
    r[x2].add(y1)

    l[y2].clear()
    l[y2].add(y1)
    l[y2].add(x1)
    

print(ans)

Submission status: Runtime Error

Solution code:
x = int.input()

print(x*x*x)

Submission status: Runtime Error

Solution code:
import sys
n, k = map(int, sys.stdin.readline().split())
S = sys.stdin.readline()

score = 0
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        score+=1
#print(S)
idx = []
for i in range(n):
    if S[i] == 'R':
        idx.append(i)
idx.append(-10)

s =-1
e =-1
ten = []
for i in range(len(idx)-1):
    if s ==-1:
        s = idx[i]
    if idx[i]+1 != idx[i+1]:
        e = idx[i]
        if e-s == n-1:
            pass
        elif s ==-1 or e==-1:
            pass
        elif s ==0 or e ==n-1:
            ten.append(1)
        else:
            ten.append(2)
        s =-1
ten = sorted(ten, reverse=True)
#print(score, ten)
print(score+ sum(ten[0:k]))

Submission status: Runtime Error

Solution code:
N = int(input())
P = list(map(int, input().split()))

vec = [(P[i], i) for i in range(N)]
vec.sort(reverse=True)

ans = 0
for i in range(1, len(vec)):
    L = [-1]
    R = []
    for j in range(i):
        if vec[j][1] < vec[i][1]:
            L.append(vec[j][1])
        elif vec[j][1] > vec[i][1]:
            R.append(vec[j][1])
    R.append(N)
    R.sort()
    L.sort()

    if len(L) > 1:
        ans += vec[i][0] * (L[-1] - L[-2]) * (R[0] - vec[i][1])
    if len(R) > 1:
        ans += vec[i][0] * (vec[i][1] - L[-1]) * (R[1] - R[0])

print(ans)

Submission status: Runtime Error

Solution code:
n=input("Number")
if type(n)!=int:
  break
else:
  if n>10:
    break
  else:
    print(n**3)

Submission status: Runtime Error

Solution code:
n=int(input("the number you can use",":"))
if n>10:
  break
  else:
    print(n**3)

Submission status: Runtime Error

Solution code:
n=int(input("the number you can use",":"))

print(n**3)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
var=n;

cin>>n;

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()))
M=0
for i in range(N):
    A[i]-=1
for i in range(N-1):
    if A[i]+1==A[i+1]:
        M+=B[A[i]]+C[A[i]]
    else:
        M+=B[A[i]]
print(M+B[A[N-1]])

Submission status: Runtime Error

Solution code:
n = input()

print(n * n * n)

Submission status: Runtime Error

Solution code:

n = int(input())

return (n**3 )

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def n:
  return n**3

Submission status: Runtime Error

Solution code:
N = int(input())
B = list(map(int, input().split()))
B_last = int(len(B))
A = B[0] + B[B_last - 1]
i = 1
old_b = B[1]
for i in range(N-1):
  #print("A =",A, "B =",B[i])
  b = B[i]
  if b >= old_b:
    A += old_b
    #print("A =",A)
  else:
    A += b
    #print(A)
  old_b = B[i]
  #print("A =",A, "B =",B[i],"old_b =", old_b)
#print("A =",A)
print(A)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
p = map(int, input().split())
size = math.ceil(math.sqrt(n))
array = []
square = []
for i in range(size ** 2):
    if i < n:
        array.append(p.__next__())
    else:
        array.append(0)
for i in range(size):
    m1, m2 = max(array[i * size], array[i * size + 1]), min(array[i * size], array[i * size + 1])
    for j in range(2, size):
        if m1 < array[i * size + j]:
            m1, m2 = array[i * size + j], m1
        elif m2 < array[i * size + j]:
            m2 = array[i * size + j]
    square.append((m1, m2))
def second(l, r):
    _m1, _m2 = 0, 0
    for i in range(l, l + (-l % size)):
        if _m1 < array[i]:
            _m1, _m2 = array[i], _m1
        elif _m2 < array[i]:
            _m2 = array[i]
    for i in range(math.ceil(l / size), r // size):
        if _m1 < square[i][0]:
            _m1, _m2 = square[i][0], _m1
        elif _m2 < square[i][0]:
            _m2 = square[i][0]
        if _m1 < square[i][1]:
            _m1, _m2 = square[i][1], _m1
        elif _m2 < square[i][1]:
            _m2 = square[i][1]
    for i in range((r // size) * size, r):
        if _m1 < array[i]:
            _m1, _m2 = array[i], _m1
        elif _m2 < array[i]:
            _m2 = array[i]
    return _m2


ans = 0
for i in range(n - 1):
    for j in range(i + 2, n + 1):
        ans += second(i, j)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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=B[A[0]-1]
for i in range(1,n):
  ans+=B[A[i]-1]
  if A[i-1]+1==A[i]:
    ans+=C[i-1]
print(ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = input()

dup = 0
for i in range(1,N):
    if S[i] == S[i-1]:
        dup += 1
#print(min(N-1, dup + K*2))
print(min(N-1,dup + K * 2))

Submission status: Runtime Error

Solution code:
N=int(input())
S=list(map(int,input().split()))
S.sort()
S.reverse()
p = [S.pop(0)]
c = S
f = False

for i in range(N):
    np = []
    nc = []
    for j in range(len(p)):
        for k in range(len(c)):
            if c[k] < p[j]:
                np.append(c.pop(k))
                f = True
                break
        if f == False:
            print("No")
            exit(0)
        f = False
    print(np)
    p += np
    p.sort()
    p.reverse()

print("Yes")

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
s = input()
h = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        h += 1
print(min(h + 2 * k, n - 1))

Submission status: Runtime Error

Solution code:
import bisect

n = int(input())
P = list(map(int, input().split(" ")))
sp = sorted(P, reverse=True)
bi = []
bisect.insort(bi,P.index(sp[0]))
C = 0
lc = 0
rc = 0
C1 = 0
for j in sp[1:]:
  i = P.index(j)
  #bisect.insort(bi,i)
  l = bisect.bisect_left(bi,i)
  if l == 0:
    lc = i + 1
    if len(bi) == 1:
      rc = n - bi[0]
    else:
      rc = bi[l+1] - bi[l]
    C1 = lc*rc
  elif l == len(bi):
    if len(bi) == 1:
      lc = bi[0] + 1
    else:
      lc = bi[l-1] - bi[l-2]
    rc = n - i
    C1 = lc*rc
  else: 
    if len(bi) == 2:
      lc = bi[0] + 1
      rc = bi[1] - i
      C1 = lc*rc
      lc = i - bi[0]
      rc = n - bi[1]
      C1 += lc*rc
    elif l == 1:
      lc = bi[0] + 1
      rc = bi[1] - i
      C1 = lc*rc
      lc = i - bi[0]
      rc = bi[2] - bi[1]
      C1 += lc*rc
    elif l == len(bi) - 1:
      lc = bi[l-1] - bi[l-2]
      rc = bi[l] - i
      C1 = lc*rc
      lc = i - bi[l-1]
      rc = n - bi[l]
      C1 += lc*rc
    else:
      lc = bi[l-1] - bi[l-2]
      rc = bi[l] - i
      C1 = lc*rc
      lc = i - bi[l-1]
      rc = bi[l+1] - bi[l]
      C1 += lc*rc
  C += (P[i]*C1)
  bisect.insort(bi,i)
  
print(C)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
Ss = input()
 
num = Ss.count('RL')*2
if list(Ss)[-1]=='L':
  num += 1
if list(Ss)[0]=='L':
  num += 1
ans = N - max(1, num-2*K)
print(ans)

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 = int(input())
B = list(map(int, input().split()))

A = [0] * N

for i in range(N-1):
  A[i] = min(B[i-1],B[i])

A[0] = B[0]
A[N-1] = B[N-2]

print(sum(A))

Submission status: Runtime Error

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

A = [0] * N


for i in range(N-1):
  A[i] = min(B[i-1],B[i])

A[0] = min(B[0],B[1])
A[N-1] = B[N-2]

print(sum(A))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
B = [int(i) for i in input().split()]
A = [B[0]] + [min(B[i-1],B[i]) for i in range(1,N-1)]+[B[-1]]
print(sum(A))

Submission status: Runtime Error

Solution code:
n=int(input())
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))
c_list = list(map(int,input().split()))
count = 0
for i in range(n):
    index=a_list[i]
    count += b_list[index - 1]
#     print(count)
    if i !=0:
        if a_list[i] == a_list[i-1] + 1:
            count += c_list[a_list[i-1]-1]
print(count)

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()))
 
answer = 0
 
for i in range(N):
  index = A[i]
  answer = answer + B[index-1]

  if i != 0:
    if A[i] == A[i-1]+1:
      answer = answer + C[A[i-1]-1]
      
print(answer)

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()))
 
answer = 0
 
for i in range(N):
  answer = answer + B[i]
  
for i in range(N):
  if i != 0:
    if A[i] == A[i-1]+1:
      answer = answer + C[a[i-1]-1]
    
print(answer)

Submission status: Runtime Error

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

if N==2:
    print(2*B[0])
    exit()

for i in range(N-1):
    if i ==0:
        A += min(B[i],B[i+1])
    elif 2<=i<N-2:
        A += min(B[i-1],B[i],B[i+1])
    else:
        A += min(B[i-1],B[i])

A += B[N-2]
print(A)

Submission status: Runtime Error

Solution code:
import math
N=int(input())
print(math.factorial(N)/math.factorial(N-3)

Submission status: Runtime Error

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


i=0
result=0

while i<n-1:
  maxV=max(a[i],a[i+1])
  temp=min(a[i],a[i+1])
  result+=temp
  j=i+2
  while j<n:
    if temp>a[j]:
      result+=temp
      #print(i,j)
    else:
      if a[j]>maxV:
        temp=maxV
        result+=temp
        maxV=a[j]
      else:
        temp=a[j]
        result+=temp
    #print(i,j,temp)
        
    j+=1
  
  i+=1
  
print(result)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = input()

H0 = 0
N_LR = 0
N_RL = 0

if S[0] == 'R' and S[1] == 'R':
    H0 += 1
if S[0] == 'R' and S[1] == 'L':
    N_RL += 1
if S[0] == 'L' and S[1] == 'R':
    N_LR += 1

if S[N-1] == 'L' and S[N-2] == 'L':
    H0 += 1

for i in range(1, N-1):
    if S[i] == 'L' and S[i-1] == 'L' or S[i] == 'R' and S[i+1] == 'R':
        H0 += 1
    if S[i] == 'R' and S[i+1] == 'L':
        N_RL += 1
    if S[i] == 'L' and S[i+1] == 'R':
        N_LR += 1

M = min(N_RL, N_LR, K)
H1 = H0 + 2 * M
K -= M
N_RL -= M
N_LR -= M

result = H1 + min(K, max(N_RL, N_LR))
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()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a and prev != N:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

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
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a and prev != 0:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Submission status: Runtime Error

Solution code:

def fs(Q,n):
    l = len(Q) - 1
    res = 0
    for i in range(n + 2):
        res += Q[l - i]
        if res == 2:
            return l - i + 1
def main():
    N = int(input())
    B = list(map(int,input().split()))
    Q = [1] * N
    s = N - 1
    res = N - 1
    for i in range(N - 2):
        Q[i] = 0
        s = fs(Q,i)
        res += s
    s = N - 1
    for i in range(N - 3 ,0,-1):
        Q[i] = 0
        s = fs(Q,i)
        res += s
    print(res)

        
        

if __name__ == "__main__":
    
    main()

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
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

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()))
n=int(0)
manzoku=int(0)
hantei = int(1)
if A[0] == hantei:
        manzoku += sum(C) + sum(B)
else:
        manzoku += sum(C) - C[A[0]-3] +sum(B)

print(manzoku)

Submission status: Runtime Error

Solution code:
# run-length encoding, decoding
def rle_encode(data):
    encoding = ''
    prev_char = ''
    count = 1

    if not data: return ''

    for char in data:
        # If the prev and current characters
        # don't match...
        if char != prev_char:
            # ...then add the count and character
            # to our encoding
            if prev_char:
                encoding += str(count) + prev_char + ' '
            count = 1
            prev_char = char
        else:
            # Or increment our counter
            # if the characters do match
            count += 1
    else:
        # Finish off the encoding
        encoding += str(count) + prev_char + ' '
        return encoding

N, K = [int(s) for s in input().split()]
S = input()
S_rle = rle_encode(S).split()
total = 0
for i, bunch in enumerate(S_rle):
  total += int(list(bunch)[0]) - 1

if len(S_rle) >= 2*K+3:
  print(total+2*K)
elif len(S_rle) >= 2*K:
  print(total+2*K-1)
else:
  print(N-1)

Submission status: Runtime Error

Solution code:
import sys

def input():
    return sys.stdin.readline()[:-1] 


class SegmentTree:
    def __init__(self, L, op, ide):
        self.op = op
        self.ide = ide
        self.sz = len(L)
        self.n = 1
        self.s = 1
        for i in range(1000):
            self.n *= 2
            self.s += 1
            if self.n >= self.sz:
                break
        self.node = [self.ide]*(2*self.n-1)

        for i in range(self.sz):
            self.node[i+self.n-1] = L[i]

        for i in range(self.n-2,-1,-1):
            self.node[i] = self.op(self.node[i*2+1],self.node[i*2+2])
    
    def add(self, a, x):
        k = a+self.n-1
        self.node[k] += x
        for i in range(1000):
            k = (k-1)//2
            self.node[k] = self.op(self.node[2*k+1], self.node[2*k+2])
            if k <= 0:
                break
    
    def substitute(self, a, x):
        k = a+self.n-1
        self.node[k] = x
        for i in range(1000):
            k = (k-1)//2
            self.node[k] = self.op(self.node[2*k+1], self.node[2*k+2])
            if k <= 0:
                break

    def get_one(self, a):
        k = a+self.n-1
        return self.node[k]
    
    def get(self, l, r):
        res = self.ide
        n = self.n
        if self.sz <= r or 0 > l:
            print("ERROR: the indice are wrong.")
            return False

        for i in range(self.s):
            count = 2**i-1
            a = (r+1)//n
            b = (l-1)//n
            if a-b == 3:
                res = self.op(self.node[count+b+1],res)
                res = self.op(self.node[count+b+2],res)
                right = a*n
                left = (b+1)*n-1
                break
            if a-b == 2:
                res = self.op(self.node[count+b+1],res)
                right = a*n
                left = (b+1)*n-1
                break
            n = n//2

        #left
        n1 = n//2        
        for j in range(i+1,self.s):
            count = 2**j-1 
            a = (left+1)//n1
            b = (l-1)//n1
            if a-b == 2:
                res = self.op(self.node[count+b+1],res)
                left = (b+1)*n1-1                
            n1 = n1//2

        #right
        n1 = n//2        
        for j in range(i+1,self.s):
            count = 2**j-1 
            a = (r+1)//n1
            b = (right-1)//n1
            if a-b == 2:
                res = self.op(self.node[count+b+1],res)
                right = a*n1                
            n1 = n1//2
        return res

def main():

    N = int(input())
    P = list(map(int,input().split()))

    ST = SegmentTree(P,max,-10**27)

    def bisect(i,j,ST,num,index,P,Smin,Smin_rev,left_flag):
        if left_flag:    
            if i==j:
                if P[i]>num:
                    return i
                else:
                    return i-1
            
            if Smin[j+1]==num:
                return -1
            if P[j]>num:
                return j
        else:
            if i==j:
                if P[i]>num:
                    return i
                else:
                    return i+1
            
            if Smin_rev[i-1]==num:
                return N
            if P[i]>num:
                return i

        if not left_flag:
            while j-i>1:
                if ST.get(index+1,(i+j)//2)<num:
                    i = (i+j)//2
                else:
                    j = (i+j)//2
            return j
        else:
            while j-i>1:
                if ST.get((i+j)//2,index-1)<num:
                    j = (i+j)//2
                else:
                    i = (i+j)//2
            return i

    Smin = []
    smin = -10**27
    for i in range(N):
        smin = max(smin,P[i])
        Smin.append(smin)

    Smin_rev = []
    smin = -10**27
    for i in range(N):
        smin = max(smin,P[N-i-1])
        Smin_rev.append(smin)
    Smin_rev = Smin_rev[::-1]


    score = 0

    for i in range(N):
        if i==0:
            right1 = bisect(i+1,N-1,ST,P[i],i,P,Smin,Smin_rev,False)
            if right1>=N-1:
                right2 = N
            else:
                right2 = bisect(right1+1,N-1,ST,P[i],right1,P,Smin,Smin_rev,False)
            right1,right2 = right1-i,right2-i
            left1 = 1
            left2 = 1
            
        elif i==N-1:
            left1 = bisect(0,i-1,ST,P[i],i,P,Smin,Smin_rev,True)
            if left1<=0:
                left2 = -1
            else:
                left2 = bisect(0,left1-1,ST,P[i],left1,P,Smin,Smin_rev,True)
            left1,left2 = i-left1,i-left2
            right1 = 1
            right2 = 1
        else:
            right1 = bisect(i+1,N-1,ST,P[i],i,P,Smin,Smin_rev,False)
            if right1>=N-1:
                right2 = N
            else:
                right2 = bisect(right1+1,N-1,ST,P[i],right1,P,Smin,Smin_rev,False)
            right1,right2 = right1-i,right2-i

            left1 = bisect(0,i-1,ST,P[i],i,P,Smin,Smin_rev,True)
            if left1<=0:
                left2 = -1
            else:
                left2 = bisect(0,left1-1,ST,P[i],left1,P,Smin,Smin_rev,True)
            left1,left2 = i-left1,i-left2
        
        score += (left1*(right2-right1) + (left2-left1)*right1)*P[i]
    print(score)

main()

Submission status: Runtime Error

Solution code:
NUM = 3
max = input(data)
print(max**NUM)

Submission status: Runtime Error

Solution code:
n = int(input())
b = list(map(int,input().split()))
sum = 0
for i in range(n-1):
    first = b[i]
    second = 0
    for j in range(i+1,n):
        if(second < b[j]):
            if(first < b[j]):
                second = first
                first = b[j]
            else:
                second = b[j]
        sum += second
print(sum)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from collections import deque

N = int(input())
A = sorted((int(x) for x in input().split()))

parent = [A[-1]]
rest = A[:-1]
bl = True
for _ in range(N):
    next_parent = []
    next_rest = []
    for p in parent[::-1]:
        while rest:
            x = rest.pop()
            if x < p:
                next_parent.append(x)
                break
            else:
                next_rest.append(x)
                continue
    parent += next_parent
    parent.sort()
    rest = rest + next_rest[::-1]

bl = len(parent) == (2**N)
answer = 'Yes' if bl else 'No'
print(answer)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
 
N = int(raw_input())
ans = 0
 
a = []
b = []
c = []
for i in range(1):
    a.append(map(int, raw_input().split()))
    b.append(map(int, raw_input().split()))
    c.append(map(int, raw_input().split()))
print(a)
print(b)
print(c)
for i in range(N):
	if a[i+1] - a[i] == 1:
  		ans += c[i]
    
ans += sum(b)
 
print(int(ans))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
 
N = int(raw_input())
ans = 0
 
a = []
b = []
c = []
for i in range(N):
    a.append(map(int, raw_input().split()))
    b.append(map(int, raw_input().split()))
    c.append(map(int, raw_input().split()))
print(a)
print(b)
print(c)
for i in range(N):
	if a[i+1] - a[i] == 1:
  		ans += c[i]
    
ans += sum(b)
 
print(int(ans))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
 
N = int(raw_input())
ans = 0
 
a = []
b = []
c = []
for i in range(N):
    a.append(map(int, raw_input().split()))
for i in range(N):
    b.append(map(int, raw_input().split()))
for i in range(N):
    c.append(map(int, raw_input().split()))
print(a)
print(b)
print(c)
for i in range(N):
	if a[i+1] - a[i] == 1:
  		ans += c[i]
    
ans += sum(b)
 
print(int(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(map(int,input().split()))
for i in range(len(s)-1,0,-1):
    if(s[i]>s[i-1]):
        continue
    else:
        s[i-1] = s[i]
print(sum(s)+s[0])

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()))
cnt=0
for i,v in enumerate(a):
	cnt += b[v-1]
	if i == 0:continue
	if v-1 == a[i-1]:
		#print(c[v-1])
		cnt += c[v-2]
print(cnt)

Submission status: Runtime Error

Solution code:
print(N*(N-1)*(N-2))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
n*n*n
# 出力
print("{}".format(n**3))

Submission status: Runtime Error

Solution code:
import itertools
 
N, K = map(int, input().split())
S = input()
 
lis = [len(list(g)) for _, g in itertools.groupby(S)]
 
if len(lis) < 2*K + 1:
  print(N-1)
else:
  print(max(sum(lis[:2*K+1]), sum(lis[len(lis)-2*K-2:])))

Submission status: Runtime Error

Solution code:
n = int(input())

print(pow(n, 3)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
 
N = raw_input()
ans = 0
 
a = []
b = []
c = []
for i in range(N):
    a.append(map(int, raw_input().split()))
for i in range(N):
    b.append(map(int, raw_input().split()))
for i in range(N):
    c.append(map(int, raw_input().split()))
    
for i in range(N-1)
	if a[N] - a[N+1] = 1
  		ans += c[N]
ans += sum(b)
 
print(int(ans))

Submission status: Runtime Error

Solution code:
N*(N-1)*(N-2)

Submission status: Runtime Error

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

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

if n == 2:
    print(min(b)*2)
else:
    print(ans+b[-1]+min(b))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

A.append(B[0])

print(int(sum(A)))

Submission status: Runtime Error

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

A.append(B[0])

print(sum(A))

Submission status: Runtime Error

Solution code:
def check(N):
    if type(N) == int and N >= 1 and N <= 9:
        return(N**3)       
check(N)

Submission status: Runtime Error

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N-1):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1:
        score = score + c[a[xi]-1]
        # print(xi, c[xi])
score = score + b[N-1]
print(score)

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
order = -1
for i in range(n):
  score += b[i]
  _order = a[i]
  
  if order+1 == _order:
    score += c[order - 1]
  order = _order
  
print(score)

Submission status: Runtime Error

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N-1:
        score = score + c[a[xi]-1]
        # print(xi, c[xi])

print(score)

Submission status: Runtime Error

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N:
        score = score + c[a[xi]-1]
        # print(xi, c[xi])

print(score)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N:
        score = score + c[a[xi]-1]
        print(xi, c[xi])

print(score)

Submission status: Runtime Error

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N:
        score = score + c[a[xi]-1]
        print(xi, c[xi])

# print(score)

for xi in range(N-1):
    if a[xi+1]==a[xi]+1:
        score = score + c[a[xi]-1]
        print(xi, c[xi])
print(score)

Submission status: Runtime Error

Solution code:
def check(N):
    if type(N) == int and N >= 0 and N <= 9:
        print(N**3)
check(N)

Submission status: Runtime Error

Solution code:
N=int(input())
def fact(n):
  if n==0 or n==1:
    return 1
  else:
    return n*fack(n-1)
print(fack(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()))
#print(n)
#print(a)
#print(b)
#print(c)
total=0
pre=0
for i in range(n):
  total+=b[i]
  if pre+1==a[i] and pre!=0:
    total+=c[pre-1]
  pre=a[i]
print(total)

Submission status: Runtime Error

Solution code:
print(N^3)

Submission status: Runtime Error

Solution code:
def pwd(N):
  return N^3

pwd(N)

Submission status: Runtime Error

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

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)

now = 0
for i in A:
  pre = now
  now = i
  if now == (pre+1):
    ans += C[pre-1]
print(ans)

Submission status: Runtime Error

Solution code:
n = int(import())

print(n*n*n)

Submission status: Runtime Error

Solution code:
print N*N*N

Submission status: Runtime Error

Solution code:
i = int(input())

print(N**3)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
 
print(math.factorial(n) // math.factorial(n - 3))

Submission status: Runtime Error

Solution code:
num = int(input())
 
if num = 1:
  print(1)
else:
  print(num*num*num)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
pow(n,3)
print(n

Submission status: Runtime Error

Solution code:
num = int(input())

if num = 1:
  print(1)
else:
  print(num**3)

Submission status: Runtime Error

Solution code:
n = int(input())

print(math.factorial(n) // math.factorial(n - 3))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

  return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = map(int,input().split())
ans = n * n * n
print(ans)

Submission status: Runtime Error

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

N = int(input())
c = 0

print({}.format(N*3))

Submission status: Runtime Error

Solution code:
N = input()

print(N**3)

Submission status: Runtime Error

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

Submission status: Runtime Error

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