Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n,k,q=map(int,input().split())
K=k-q
x=[]
for i in range (q):
    a=int(input())
    x.append(a)
for i in range (1,n+1,1):
    if  K+int(x.count(i))>0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

n,k,q=map(int,input().split())
p=k-q
l=[p]*n
for i in range(q):
    a=int(input())
    l[a-1]+=1
for i in range(n):
    print('Yes' if l[i]>0 else 'No')
### BUGGY CODE ###

from operator import itemgetter

N, M, Q = list(map(int, input().split()))
LR = sorted([list(map(int, input().split())) for i in range(M)], key=itemgetter(0))

route = [[0 for i in range(N+1)] for i in range(N+1)]

for l in range(1, N+1):
    flag = [1 for i in range(len(LR))]
    for r in range(1, N+1):
        count = 0
        for idx, lr in enumerate(LR):
            if flag[idx] and l <= lr[0] and lr[1] <= r:
                count += 1
                flag[idx] = 0
        route[l][r] = route[l][r-1] + count
        
    while len(LR):
        if LR[0][0] == l:
            LR.pop(0)
        else:
            break
for i in range(Q):
    p, q = list(map(int, input().split()))
    print(route[p][q])
    
                

### FIXED CODE ###

import itertools

N, M, Q = list(map(int, input().split()))

route = [[0 for i in range(N+1)] for j in range(N+1)]

for i in range(M):
    L, R = list(map(int, input().split()))
    route[L][R] += 1

for i in range(1, N):
    route[i] = list(itertools.accumulate(route[i]))

for i in range(2, N+1):
    for j in range(1, N+1):
        route[i][j] += route[i-1][j]

for i in range(Q):
    p, q = list(map(int, input().split()))
    print(route[q][q]-route[p-1][q]-route[q][p-1]+route[p-1][p-1])
### BUGGY CODE ###

import sys
K=int(input())
if K%2==0 or K%5==0:
    print('-1')
    sys.exit()
i=1
K=9*K

while(1):
    if 7*(10**i-1)%K==0:
        print(i)
        sys.exit()
    i+=1

### FIXED CODE ###

import sys
K=int(input())
if K%2==0 or K%5==0:
    print('-1')
    sys.exit()
i=1
K=9*K
ans=10-K

while(1):
    if 7*(ans-1)%K==0:
        print(i)
        sys.exit()
    i+=1
    ans=ans*10%K
### BUGGY CODE ###

T = list(input())

s = T.count('?')

for i in range(s):
    a = T[T.index('?')]
    if a == 0:
        if T[T.index('?')+1] == 'D':
            T[T.index('?')] = 'P'
        else:
            T[T.index('?')] = 'D'
    else:
        T[T.index('?')] = 'D'
print(''.join(T))

### FIXED CODE ###

T = input()

T = T.replace('?', 'D')
	
print(''.join(T))
### BUGGY CODE ###

from sys import stdin


def main():
    input = stdin.readline
    S = [input()[:-1]]
    Q = int(input())
    is_turned = False

    for _ in range(Q):
        query = input()[:-1]
        if query == "1":
            is_turned = not is_turned
        else:
            T, F, C = query.split()
            if is_turned ^ (F == "1"):
                S.insert(0, C)
            else:
                S.append(C)

    if (is_turned):
        print("".join(S)[::-1])
    else:
        print("".join(S))


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    S = input()
    Q = int(input())
    L = ""
    R = ""
    is_turned = False

    for _ in range(Q):
        Query = input().split()
        if Query[0] == "1":
            is_turned = not is_turned
        else:
            if is_turned ^ (Query[1] == "1"):
                # L.insert(0, Query[2])
                L = Query[2] + L
            else:
                # R.append(Query[2])
                R = R + Query[2]

    if (is_turned):
        print("".join(L + S + R)[::-1])
    else:
        print("".join(L + S + R))


if __name__ == "__main__":
    main()
### BUGGY CODE ###

s=input()
n=int(input())
flag=0
for i in range(n):
    k= input().split()
    if len(k)==1:
        if flag==1:
            flag=0
        else:
            flag=1
    else:
        if k[1]=="2":
            if flag==0:
                s=s+k[2]
            elif flag==1:
                s=k[2]+s
        else:
            if flag==0:
                s=k[2]+s
            elif flag==1:
                s=s+k[2]
if flag==0:
    print(s)
else:
    print(s[::-1])
    

### FIXED CODE ###

S = input()
Q = int(input())
reverseCount = 0
pre = ""
pro = ""
for _ in range(Q):
    query = input()
    if len(query) == 1:
        reverseCount += 1
    else:
        _, F, C = query.split(" ")
        if (int(F) + reverseCount) % 2 == 1:
            pre = C + pre
        else:
            pro = pro + C
S = pre + S + pro
if reverseCount % 2 == 0:
    print(S)
else:
    print(S[::-1])
### BUGGY CODE ###

def bfs(linkL, chckL, presN):
    chckL[presN] = 0
    nextNL = linkL[presN]
    breath = 1
    for item in nextNL:
        chckL[item] = breath
    
    breath = 2

    while(len(nextNL)!=0):
        tmpNextNL = []
        for item in nextNL:
            for chckItem in linkL[item]:
                if chckL[chckItem] == -1:
                    tmpNextNL.append(chckItem)
                    chckL[chckItem] = breath
        
        breath += 1
        nextNL = tmpNextNL
    
    return chckL


N, X, Y = map(int, input().split())

lList = []

for indx in range(N):
    tmpList = []
    if indx != 0:   tmpList.append(indx-1)
    if indx != N-1: tmpList.append(indx+1)
    if indx == X-1: tmpList.append(Y-1)
    if indx == Y-1: tmpList.append(X-1)
    lList.append(tmpList)

mySum = [0] * (N-1)

for baseIndx in range(N):
    chckList = [-1] * N

    chckList = bfs(lList, chckList, baseIndx)
    chckList = chckList[baseIndx+1:N]

    for sumIndx in range(N-1):
        mySum[sumIndx] += chckList.count(sumIndx+1)

for printIndx in range(N-1):
    print(mySum[printIndx])

### FIXED CODE ###

N, X, Y = map(int, input().split())

X = X-1
Y = Y-1

kDict = {}

for kIndx in range(1, N+1):
    kDict[kIndx] = 0

for jIndx in range(N):
    for iIndx in range(jIndx):
        if (jIndx <= X) or (iIndx >= Y):
            kDict[jIndx - iIndx] += 1
        elif (iIndx <= X) and (jIndx >= Y):
            kDict[(jIndx - iIndx) - (Y - X - 1)] += 1
        elif (iIndx <= X) and ((jIndx > X) and (jIndx < Y)):
            if 2 * jIndx - (X + Y) - 1 > 0:
                kDict[(jIndx - iIndx) - (2 * jIndx - (X + Y) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        elif ((iIndx > X) and (iIndx < Y)) and (jIndx >= Y):
            if (X + Y) - 2 * iIndx - 1 > 0:
                kDict[(jIndx - iIndx) - ((X + Y) - 2 * iIndx - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        else:
            if (2 * (jIndx - iIndx) - (Y - X) - 1) > 0:
                kDict[(jIndx - iIndx) - (2 * (jIndx - iIndx) - (Y - X) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1

for kIndx in range(1, N):
    print(kDict[kIndx])
### BUGGY CODE ###

n = int(input())
d = [[] for i in range(n)]
for i in range(n - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    d[u].append(v)
    d[v].append(u)
ans = 0
for l in range(n):
    ans += (l + 1) * (l + 2) // 2
    for r in range(l, n):
        for t in d[r]:
            if l <= t < r:
                ans -= (n - r)
print(ans)


### FIXED CODE ###

n = int(input())
d = [0] * n
present = [[] for i in range(n)]
for i in range(n - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    if u > v:
        u, v = v, u
    d[v] += 1
    present[u].append(v)
ans = 0
cur = 0
for v in range(n):
    cur += (n - v) * d[v]
for l in range(n):
    ans += (l + 1) * (l + 2) // 2
    ans -= cur
    for v in present[l]:
        cur -= (n - v)
print(ans)
### BUGGY CODE ###

n=int(input())
for n_ in range(1,n+1):
  c=0
  for x in range(1,41):
    if n_-x**2>=0:
      y_=(n_-x**2)**(1/2)
      y_=int(y_)
    else:
      break
    for y in range(x,y_+1):
      if n_-x**2-y**2>=0:
         z_=(n_-x**2-y**2)**(1/2)
         z_=int(z_)
      else:
        break
      for z in range(y,z_+1):
        if (x+y)**2+(y+z)**2+(z+x)**2==2*n_:
          if x==y and y==z:
            c+=1	
          elif len({x,y,z})==2:
            c+=3
          else:
            c+=6
  print(c)          

### FIXED CODE ###

n=int(input())
ans=[0]*(n+1)
for x in range(1,105):
  for y in range(1,105):
    for z in range(1,105):
      t=x*x+y*y+z*z+x*y+y*z+z*x
      if t<=n:
        ans[t]+=1
for i in range(1,n+1):
  print(ans[i])
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))

for i in range(n):
    for k in range(n-i):
        if l[i]-l[i+k]>=2:
            print("No")
            exit()
print("Yes")


### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))

min=0
ans=True

for i in range(n):
    if l[i]-1>=min:
        min=l[i]-1
    elif l[i]>=min:
        min=l[i]
    else:
        ans=False

        
if ans:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

n,k=map(int,input().split())
c=[[]for i in range(n+1)]
d=[False]*(n+1)
d[0]=True
m=10**9+7
for i in range(n-1):
    a,b=map(int,input().split())
    c[a].append(b)
    c[b].append(a)
p=k
t=0
pq=[1]
gd=[1,1]
sd=1
for i in range(1,k):
    sd=sd*(i+1)%m
    gd.append(sd)
while d!=[True]*(n+1):
    rom=[]
    if t==0 or t==1:
        t+=1
    for i in pq:
        d[i]=True
        q=0
        for j in c[i]:
            if d[j]==False:
                rom.append(j)
                q+=1
        else:
            if q!=0:
                if k-t>=q:
                    p=(p*(gd[k-t]*pow(gd[k-t-q],m-2,m)))%m
                else:
                    p*=0
    else:
        pq=rom[:]
print(p)

### FIXED CODE ###

n,k=map(int,input().split())
s=[[]for i in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    s[a].append(b)
    s[b].append(a)
d=[False]*(n+1)
q=[[0,1]]
c=0
a=k
while q:
    t=[]
    c=0
    for i,j in q:
        c=0
        for p in s[j]:
            if p!=i:
                t.append([j,p])
                c+=1
        r=(k-1 if j==1 else k-2)
        for h in range(r,r-c,-1):
            a=(a*h)%(10**9+7)
    q=t
print(a)
### BUGGY CODE ###

from collections import Counter

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

B = Counter(A)
Key = list(B.keys())
Key.sort()

M = 10 ** 6
table = [1] * (M + 1)
cnt = 0
for k in Key:
    if B[k] == 1 and table[k] == 1:
        cnt += 1
    
    for i in range(M):
        if k * i > M:
            break
        else:
            table[k * i] = 0
print(cnt)

### FIXED CODE ###

from collections import Counter

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

B = Counter(A)
Key = list(B.keys())
Key.sort()

M = 10 ** 6
table = [1] * (M + 1)
cnt = 0
for k in Key:
    if B[k] == 1 and table[k] == 1:
        cnt += 1
    
    for i in range(M):
        if k * i > M:
            break
        else:
            table[k * i] = 0
print(cnt)
### BUGGY CODE ###

A,B,Q=map(int,input().split())
s=[int(input()) for _ in range(A)]
t=[int(input()) for _ in range(B)]

#二分探索関数
def bin_search(x,seq):
    a=0
    b=len(seq)-1
    for i in range(len(seq)):
        center=((a+b)//2)
        if x>=seq[center]:
            a=center
        else:
            b=center
        if b-a<=1:
            break
    return seq[a],seq[b]

for i in range(Q):
    x=int(input())
    Nb_s0,Nb_s1=bin_search(x,s)
    Nb_t0,Nb_t1=bin_search(x,t)
    k1=abs(Nb_s0-x)+abs(Nb_t0-Nb_s0)
    k2=abs(Nb_s1-x)+abs(Nb_t0-Nb_s1)
    k3=abs(Nb_s0-x)+abs(Nb_t1-Nb_s0)
    k4=abs(Nb_s1-x)+abs(Nb_t1-Nb_s1)
    k5=abs(Nb_t0-x)+abs(Nb_t0-Nb_s0)
    k6=abs(Nb_t1-x)+abs(Nb_t1-Nb_s1)
    k7=abs(Nb_t0-x)+abs(Nb_t0-Nb_s1)
    k8=abs(Nb_t1-x)+abs(Nb_t1-Nb_s0)
    print(min(k1,k2,k3,k4,k5,k6,k7,k8))

### FIXED CODE ###

inf=10**11
A,B,Q=map(int,input().split())
s=[-inf]+[int(input()) for _ in range(A)]+[inf]
t=[-inf]+[int(input()) for _ in range(B)]+[inf]
x=[[i,int(input())] for i in range(Q)]

x.sort(key=lambda x:x[1])
i,s_i,t_i=0,0,0
ans=[]

for i in range(Q):
    while(1):
        if x[i][1]>=s[s_i]:
            s_i+=1
        else:
            break
    while(1):
        if x[i][1]>=t[t_i]:
            t_i+=1
        else:
            break
    ans.append([x[i][0],x[i][1],s[s_i-1],s[s_i],t[t_i-1],t[t_i]])
ans.sort(key=lambda x:x[0])
for i in range(Q):
    xx=ans[i][1]
    Nb_s0=ans[i][2]
    Nb_s1=ans[i][3]
    Nb_t0=ans[i][4]
    Nb_t1=ans[i][5]

    p1=abs(Nb_s0-xx)
    p2=abs(Nb_s1-xx)
    p3=abs(Nb_t0-xx)
    p4=abs(Nb_t1-xx)
    q1=abs(Nb_t0-Nb_s0)
    q2=abs(Nb_t0-Nb_s1)
    q3=abs(Nb_t1-Nb_s0)
    q4=abs(Nb_t1-Nb_s1)
    print(min(p1+q1,p2+q2,p1+q3,p2+q4,p3+q1,p4+q4,p3+q2,p4+q3))
### BUGGY CODE ###

characteristic=10**9+7
def plus(input1,input2):
    return (input1+input2)%characteristic
def minus(input1,input2):
    return (input1-input2)%characteristic
def times(input1,input2):
    return (input1*input2)%characteristic
def exponen(input1,input2):
    return pow(input1,input2,characteristic)
def divide(input1,input2):
    return times(input1,exponen(input2,characteristic-2))
N=int(input())
Fact=[1 for i in range(N+1)]
Finv=[1 for i in range(N+1)]
for i in range(1,N+1):
    Fact[i]=times(Fact[i-1],i)
    Finv[i]=divide(1,Fact[i])
ans=0
SGL=[0 for i in range(N)]
for K in range(N):
    if 2*K-N<0:
        continue
    SGL[K]=times(times(Fact[K],Finv[2*K-N]),Fact[K-1])
for K in range(1,N):
    ans=plus(ans,times(SGL[K]-SGL[K-1],K))
print(ans)


### FIXED CODE ###

P=10**9+7
def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
def inv(x):
    return egcd(x,P)[0]
N=int(input())
Fact=[0 for i in range(N+1)]
Finv=[0 for i in range(N+1)]
Fact[0]=1
Finv[0]=1
for i in range(N):
    Fact[i+1]=((i+1)*Fact[i])%P
    Finv[i+1]=(Finv[i]*inv(i+1))%P
SGN=[0 for i in range(N)]
ans=0
for k in range(N):
    if 2*k-N>=0:
        SGN[k]=(((Fact[k-1]*Fact[k])%P)*Finv[2*k-N])%P
        ans=(ans+k*(SGN[k]-SGN[k-1]))%P
print(ans)
### BUGGY CODE ###

import numpy as np
from collections import deque
N,M = [int(i) for i in input().split()]
roads = []
for _ in range(M):
    A,B = [int(i) for i in input().split()]
    roads.append([A,B])
    roads.append([B,A])
roads = np.array(roads)
places = [0]*(N+1)
places[1] = 1
q = deque([1])
vis = [False]*(N+1)
vis[1] = True
while q:
    now = q.pop()
    L = roads[roads[:,0] == now][:,1]
    for j in L:
        if vis[j]:
            continue
        vis[j] = True
        places[j] = now
        q.appendleft(j)

print("Yes")
s = "\n".join(map(str, places[2:]))
print(s)

### FIXED CODE ###

import numpy as np
from collections import deque
N,M = [int(i) for i in input().split()]
roads = [[] for _ in range(N+1)]
for _ in range(M):
    A,B = [int(i) for i in input().split()]
    roads[A].append(B)
    roads[B].append(A)
places = [0]*(N+1)
places[1] = 1
q = deque([1])
vis = [False]*(N+1)
vis[1] = True
while q:
    now = q.popleft()
    L = roads[now]
    for j in L:
        if vis[j]:
            continue
        vis[j] = True
        places[j] = now
        q.append(j)

print("Yes")
s = "\n".join(map(str, places[2:]))
print(s)
### BUGGY CODE ###

def bfs():
   while len(que)>0:
      now=que.popleft()
      now_step=steps[now[0]][now[1]]
      for dy,dx in (-1,0),(1,0),(0,-1),(0,1):
         ny=now[0]+dy
         nx=now[1]+dx
         if 0<=ny<=H-1 and 0<=nx<=W-1:
            if maze[ny][nx]==".":
               maze[ny][nx]="#"
               que.append([ny,nx])
               steps[ny][nx]=now_step+1

from collections import deque

H,W=map(int,input().split())
maze=[]
for i in range(H):
   A=input()
   A=[c for c in A]
   maze.append(A)

steps=[[-1]*W for i in range(H)]
que=deque([])
for i in range(H):
   for j in range(W):
      if maze[i][j]=="#":
         que.append([i,j])
         steps[i][j]=0

bfs()

max_step=0
for i in range(H):
   for j in range(W):
      max_step=max(max_step,steps[i][j])

print(max_step)

### FIXED CODE ###

def bfs():
   while len(que)>0:
      now=que.popleft()
      now_step=steps[now[0]][now[1]]
      for dy,dx in (-1,0),(1,0),(0,-1),(0,1):
         ny=now[0]+dy
         nx=now[1]+dx
         if 0<=ny<=H-1 and 0<=nx<=W-1:
            if maze[ny][nx]==".":
               maze[ny][nx]="#"
               que.append([ny,nx])
               steps[ny][nx]=now_step+1

from collections import deque

H,W=map(int,input().split())
maze=[]
for i in range(H):
   A=input()
   A=[c for c in A]
   maze.append(A)

steps=[[-1]*W for i in range(H)]
que=deque([])
for i in range(H):
   for j in range(W):
      if maze[i][j]=="#":
         que.append([i,j])
         steps[i][j]=0

bfs()

max_step=0
for i in range(H):
   for j in range(W):
      max_step=max(max_step,steps[i][j])

print(max_step)
### BUGGY CODE ###

N, M = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(M)]
print(len(set.intersection(*[set(range(l, r+1)) for l, r in LR])))


### FIXED CODE ###

N, M = map(int, input().split())
LR = list(map(int, input().split()) for _ in range(M))
L, R = list(map(list, zip(*LR)))
print(max(0, min(R)-max(L)+1))
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
#N = 5
#A = list(map(int,"3 2 4 1 2".split()))
AA = [0  for x in range(N)]
for i,a in enumerate(A):
    AA[i] = sum(A[:i]) + a
ans = 99999999999999999
ed = 2
st = 0
_bc = AA[-1]
_de = AA[-1]
for i in range(1,N-2):
    for j in range(st,i):
        B = AA[j]
        C = AA[i] - AA[j]
        if abs(B -C) <= _bc:
            _bc = abs(B -C)
        else:
            st = j -1
            _bc = abs(2 * AA[j-1] - AA[i+1])
            B = AA[j-1]
            C = AA[i] - AA[j-1]
            break
    for k in range(ed,N-1):
        D = AA[k] - AA[i]
        E = AA[-1] - AA[k]
        if _de >= abs(D-E):
            _de = abs(D-E)
        else:
            ed = k 
            _de = abs(2 * AA[k-1] - AA[i+1] -AA[-1])
            D = AA[k-1] - AA[i]
            E = AA[-1] - AA[k-1]
            break
    sample = max([abs(B-C),abs(B-D),abs(B-E),abs(C-D),abs(C-E),abs(D-E)])
    if ans > sample:
        ans = sample
        #print(ans)
print(ans)


### FIXED CODE ###

from bisect import bisect
N = int(input())
A = list(map(int,input().split()))
#N = 10
#A = list(map(int,"10 71 84 33 6 47 23 25 52 64".split()))
AA = [0  for x in range(N)]
for i,a in enumerate(A):
    AA[i] = AA[i-1] + a
ans = 99999999999999999
ed = 2
st = 0
_bc = AA[-1]
_de = AA[-1]

for i in range(1, N-1):
    med = AA[i] / 2
    j = bisect(AA, med)
    if abs(AA[j-1] - med) < abs(AA[j] - med):
        j = j-1
    rmed = (AA[-1] + AA[i]) / 2
    k = bisect(AA, rmed)
    if abs(AA[k-1] - rmed) < abs(AA[k] - rmed):
        k = k-1
    m = min(AA[j], AA[i] - AA[j], AA[k] - AA[i], AA[-1] - AA[k])
    M = max(AA[j], AA[i] - AA[j], AA[k] - AA[i], AA[-1] - AA[k])
    ans = min(ans, M - m)
print(ans)
### BUGGY CODE ###

R,C,k=map(int,input().split())
rcv = [[0 for _ in range(C+1)] for _ in range(R+1)]
for i in range(k):
  r,c,v = map(int,input().split())
  rcv[r][c] = v
"""
    info = dict()
for r,item in rcv.items():
  item.sort(key=lambda x:x[0])
  if len(item) < 2:
    info[r] = [[item[0][0],item[0][0],item[0][1]]]
  elif len(item) < 3:
    info[r] = [[item[0][0],item[1][0],item[0][1]+item[1][1]]]
  else:
    ret=list()
    for i in range(len(item)-2):
      ret.append([item[i][0],item[i+2][0],sum([item[j][1] for j in range(i,i+3)])])

# info: 各行でmax3つのアイテムをとるときの列区間とそのvの合計
"""
# dp: 各場所までの合計の最大値
dp = [[[0 for _ in range(4)] for _ in range(C+1)] for _ in range(R+1)]
if rcv[1][1]>0:
  dp[1][1][1] = rcv[1][1]
#print(dp[1][1][1])
for r in range(1,R+1):
  for c in range(1,C+1):
    if r*c == 1:
      continue
    for i in range(4):
      candi=list()
      if r > 1 and i==0:  #うえからおりてくる、とらない(i=0)
        candi.extend(dp[r-1][c])
      if r > 1 and i==1 and rcv[r][c]>0:  #うえからおりてくる、とる(i=1)
        candi.extend([dp[r-1][c][j]+rcv[r][c] for j in range(4)])
      if c > 1: # ひだりから、とらない(i維持)
        candi.append(dp[r][c-1][i])
        if 0 < i and rcv[r][c]>0:  # ひだりから、とる(i-1から移行)
          candi.append(dp[r][c-1][i-1]+rcv[r][c])
      if len(candi) == 0:
        continue
      dp[r][c][i] = max(candi)
      #print(r,c,i,dp[r][c][i])
print(max(dp[R][C]))

### FIXED CODE ###

R,C,k=map(int,input().split())
rcv = [[0 for _ in range(C+1)] for _ in range(R+1)]
for i in range(k):
  r,c,v = map(int,input().split())
  rcv[r][c] = v
# dp: 各場所までの合計の最大値
dp0=[[0 for _ in range(C+1)] for _ in range(R+1)]
dp1=[[0 for _ in range(C+1)] for _ in range(R+1)]
dp2=[[0 for _ in range(C+1)] for _ in range(R+1)]
dp3=[[0 for _ in range(C+1)] for _ in range(R+1)]
dp1[1][1] = rcv[1][1]
for r in range(1,R+1):
  for c in range(1,C+1):
    dp1[r][c] = max(dp0[r][c]+rcv[r][c],dp0[r][c-1]+rcv[r][c],dp1[r][c-1])
    dp2[r][c] = max(dp1[r][c-1]+rcv[r][c],dp2[r][c-1])
    dp3[r][c] = max(dp2[r][c-1]+rcv[r][c],dp3[r][c-1])
    
    if r < R:
      dp0[r+1][c] = max(dp0[r][c],dp1[r][c],dp2[r][c],dp3[r][c])
print(max(dp0[R][C],dp1[R][C],dp2[R][C],dp3[R][C]))
### BUGGY CODE ###

n = int(input())

t = []

for i in range(n):
    t.append(int(input()))

buy = t[0]
prev_sell = max(t[1:])
val = prev_sell - buy

for i in range(n-1):
    if i == 0 or t[i - 1] < t[i]:
        continue
    prev_sell = max(t[i+1:])
    val2 = prev_sell - t[i]
    if val2 > val:
        val = val2

print(val)



### FIXED CODE ###

n = int(input())

t = []

for i in range(n):
    t.append(int(input()))

buy = t[0]
val = t[-1] - buy

for i in range(1, n):
    if t[i] - buy > val:
        val = t[i] - buy
    if t[i] < buy:
        buy = t[i]

print(val)
### BUGGY CODE ###

from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ans = ''
t1, t2 = [], []

for i in range(n):
    t1.append(a[i])
    t2.append(a[n-1-i])
    if Counter(t1) == Counter(t2):
        ans += str(i+1) + ' '
print(ans[:-1])



### FIXED CODE ###

from collections import Counter

n = int(input())
a = input().split()
# a = list(map(int, input().split()))
ans = ''
# t1, t2 = [], []
t1, t2 = Counter(), Counter()
for i in range(n):
    t1.update(a[i])
    t2.update(a[n-1-i])
    t3 = t1 & t2
    t1 -= t3
    t2 -= t3
    if t1 == t2:
        ans += str(i+1) + ' '
print(ans[:-1])
### BUGGY CODE ###

card_num, gate_num = map(int, input().split())

s, t = map(int, input().split())
all_set = set(range(s, t+1))
for _ in range(gate_num-1):
    s, t = map(int, input().split())
    new_set = set(range(s, t+1))
    all_set = all_set.intersection(new_set)

print(len(all_set))


### FIXED CODE ###

card_num, gate_num = map(int, input().split())

ans_start, ans_end = map(int, input().split())
for _ in range(gate_num-1):
    s, e = map(int, input().split())
    if e < ans_start or ans_end < s:
        print(0)
        exit()
    elif s < ans_start and ans_start < e < ans_end:
        ans_end = e
    elif ans_start < s < ans_end and ans_end < e:
        ans_start = s
    elif ans_start == e:
        ans_end = e
    elif ans_end == s:
        ans_start = s

print(ans_end - ans_start + 1)
### BUGGY CODE ###

from collections import deque
import collections
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
A = list(map(int, input().split()))
d2 = deque()
d = deque(A)
ans = 0

for i in range(N):
    d2.append(d.popleft())
    if i > 0:
        d.append(d2.popleft())
    c = collections.Counter(d)
    for i in c.keys():
        if c[i] >= 2:
            ans += comb(c[i], 2)
    print(int(ans))
    ans =0


### FIXED CODE ###

import collections

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

c = collections.Counter(A)
keys = c.keys()
comb = 0
for i in keys:
    comb += (c[i] * (c[i]-1)) //2

for i in A:
    ans = comb - (c[i]-1)
    print(ans)
### BUGGY CODE ###

N = int(input())
S = input()

s = []
for S_ in S:
    if S_ == 'W':
        s.append(0)
    else:
        s.append(1)

ans = N
s_total = sum(s)
for i,s_ in enumerate(s):
    diff = i - sum(s[:i])*2 - s_ + s_total
    if ans > diff:
        ans = diff

print(ans)

### FIXED CODE ###

N = int(input())
S = [1 if l == 'E' else 0 for l in list(input())]

for i in range(1,N):
    S[i] += S[i-1]
S.insert(0,0)

ans = N
for i in range(N):
    diff = i - S[i] + S[-1] - S[i+1]
    if ans > diff:
        ans = diff

print(ans)