Harryxun/stf_run huggingface dataset:
def calc(N,i,j):
  if dp[i][j]<float('inf'):
    return dp[i][j]
  if (N-(j-i+1))%2==0:
    if i==j:
      dp[i][j] = A[i]
    else:
      dp[i][j] = max(calc(N,i,j-1)+A[j],calc(N,i+1,j)+A[i])
  else:
    if i==j:
      dp[i][j] = -A[i]
    else:
      dp[i][j] = min(calc(N,i,j-1)-A[j],calc(N,i+1,j)-A[i])
  return dp[i][j]

N = int(input())
A = list(map(int, input().split()))
dp = [[float('inf')]*N for _ in range(N)]
ans = calc(N,0,N-1)
print(ans)

### FIXED CODE ###

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


def solve(N,A):
    s,e = 0, N-1
    dp = [[0]*N for i in range(N)]
    for k in range(N):
        for i in range(N):
            j = i+k
            if j>=N:
                continue
            sign = (-1)**(N-1-k)
            if k==0:
                dp[i][j] = sign*A[i]
                continue
            dp[i][j] = sign*max(sign*dp[i+1][j]+A[i],sign*dp[i][j-1]+A[j])
    ans = dp[0][N-1]
    return ans
print(solve(N,A))
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, M = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

graph = [[] for _ in range(N + 1)]

for a, b, c in ABC:
    graph[b].append((a, c))


@lru_cache(maxsize=None)
def solve(n):
    # 1 から n までの最長距離
    ret = -INF
    for prev, c in graph[n]:
        ret = max(ret, solve(prev) + c)
    if n == 1:
        return 0
    return ret


try:
    print(solve(N))
except:
    print('inf')


### FIXED CODE ###

import os
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, M = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]
sys.setrecursionlimit(200000)

graph = [[] for _ in range(N + 1)]

for a, b, c in ABC:
    graph[b].append((a, c))
graph[1].append((0, 0))

vd = [(N, 0)]
# N までの最長距離
ans = [-INF] * (N + 1)
ans[N] = 0
for _ in range(N + 1):
    nexts = []
    for v, d in vd:
        for u, c in graph[v]:
            if ans[u] < d + c:
                ans[u] = d + c
                nexts.append((u, d + c))
    vd = nexts
if vd:
    print('inf')
else:
    print(ans[0])
import numpy as np

def koch_divide(p,q):
    v = q-p
    r = np.array([[np.sqrt(3)/2, 0.5],[-0.5, np.sqrt(3)/2]])
    s = p + v/3
    t = q - v/3
    u = p + np.dot(v,r)/np.sqrt(3)
    return [s,u,t,q]

def koch_curve(previous):
    vertices = [previous[0]]
    for p,q in zip(previous[:-1], previous[1:]):
        vertices.extend(koch_divide(p,q))
    return vertices

if __name__=='__main__':
    p_q = np.array([[0.0, 0.0], [100.0, 0.0]])
    n = int(input())
    for _ in range(n):
        p_q = koch_curve(p_q)
    for vertex in p_q:
        print(" ".join(np.vectorize("%.8f".__mod__)(vertex)))

### FIXED CODE ###

def koch_divide(p,q):
    v = [q[0]-p[0], q[1]-p[1]]
    s = [p[0]+v[0]/3, p[1]+v[1]/3]
    t = [q[0]-v[0]/3, q[1]-v[1]/3]
    u = [p[0]+v[0]*0.5-v[1]*0.288675, p[1]+v[0]*0.288675+v[1]*0.5]
    return [s,u,t,q]

def koch_curve(previous):
    vertices = [previous[0]]
    for p,q in zip(previous[:-1], previous[1:]):
        vertices.extend(koch_divide(p,q))
    return vertices

if __name__=='__main__':
    p_q = [[0.0, 0.0], [100.0, 0.0]]
    n = int(input())
    for _ in range(n):
        p_q = koch_curve(p_q)
    for vertex in p_q:
        print(" ".join(['{:.8f}'.format(x) for x in vertex]))
import math

def gcd(x,y):
    while y:
        x, y = y, x % y
    return x


a, b = [int(x) for x in input().split(' ')]

g = gcd(a,b)
print("g =", g)
ret: int = 1

for i in range(2, int(math.sqrt(g))+1):
    if g % i == 0:
        print("i =", i)
        while g % i == 0:
            g /= i
        ret += 1
        
if g > 1:
    ret += 1
    
print(ret)

### FIXED CODE ###

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


a, b = [int(x) for x in input().split(' ')]

g = gcd(a, b)
ret = 1
i = 2
while i * i <= g:
    if g % i == 0:
        while g % i == 0:
            g /= i
        ret += 1
    i += 1

if g > 1:
    ret += 1

print(ret)
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
S = input().rstrip()
T = input().rstrip()


idx = S.index(T[0])
ans = idx+1
lenT = len(T)
for i in range(1,lenT):
    S = S[idx+1:] + S[:idx+1]
    idx = S.index(T[i])
    ans += idx+1

print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
#ABC138 E

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()))

s = input()
t = input()
n = len(s)
m = len(t)
f = [False]*26
f2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    f[alpha.index(s[i])] = True
for i in range(m):
    f2[alpha.index(t[i])] = True
for i in range(26):
    if not f[i] and f2[i]:
        print(-1)
        quit()
ans = 0
inde = s.index(t[0])
ans += inde+1
for i in range(1,m):
    s = s[inde+1:] + s[:inde+1]
    inde = s.index(t[i])
    ans += inde+1
print(ans)
s = input()
k = int(input())
sub = []
num = len(s)
for i in range(num):
    for j in range(i, num):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub

### FIXED CODE ###

s = input()
k = int(input())
sub = []
for i in range(len(s)):
    for j in range(i, i+5):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub[k-1])
from fractions import gcd
n,k=map(int,input().split())
g=0
m=0
for a in map(int,input().split()):
  	m=max(m,a)
    g=gcd(g,a)

print("POSSIBLE" if(k%g==0 and k<=m) else "IMPOSSIBLE")

### FIXED CODE ###

from fractions import gcd
n,k=map(int,input().split())
g=0
m=0
for a in map(int,input().split()):
    g=gcd(g,a)
    m=max(m,a)

print("POSSIBLE" if(k%g==0 and k<=m) else "IMPOSSIBLE")
N = int(input())
H = list(map(int, input().split()))
max_count = 0
for i in range(N-1):
  tmp_count = 0
  for j in range(i, N-1):
  	if H[j] >= H[j+1]:
      tmp_count=tmp_count+1

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
tmp = 0
s = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    tmp += 1
    s = max(s, tmp)
  else:
    tmp = 0
    
print(s)
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans

n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible, a))

print(ans)

### FIXED CODE ###

def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans

n = int(input())
a = map(int, input().split())
ans = min(map(how_many_times_divisible, a))

print(ans)
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  3 22:38:51 2020

@author: Kanaru Sato
"""

A = []
[A.append(list(map(int, input().split()))) for i in range(0,3)]

N = int(input())

b = []
[b.append(list(map(int, input()))) for i in range(0,N)]

flag = [[0, 0, 0]
        [0, 0, 0]
        [0, 0, 0]]

for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b:
            flag[i][j] = 1

column = 0
raw = 0
naname = 0

for i in range(0,3):
    column += flag[i][0]*flag[i][1]*flag[i][2]
    raw += flag[0][i]*flag[1][i]*flag[2][i]
naname = flag[0][0]*flag[1][1]*flag[2][2]+flag[0][2]*flag[1][1]*flag[2][0]

if column>=1 or raw>=1 or naname>=1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Tue Mar  3 22:38:51 2020

@author: Kanaru Sato
"""

A = []
[A.append(list(map(int, input().split()))) for i in range(0,3)]

N = int(input())

b = []
[b.append(int(input())) for i in range(0,N)]

flag = [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]]

for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b:
            flag[i][j] = 1

column = 0
raw = 0
naname = 0

for i in range(0,3):
    column += flag[i][0]*flag[i][1]*flag[i][2]
    raw += flag[0][i]*flag[1][i]*flag[2][i]
naname = flag[0][0]*flag[1][1]*flag[2][2]+flag[0][2]*flag[1][1]*flag[2][0]


if column>=1 or raw>=1 or naname>=1:
    print("Yes")
else:
    print("No")
s = str(input())

if (s=="Sunny"):
    print("Cloudy")
else if (s=="Cloudy"):
    print("Rainy")
else if (s=="Rainy"):
    print("Sunny")


### FIXED CODE ###

s = str(raw_input())

if s=="Sunny":
    print ("Cloudy")
if s=="Cloudy":
    print ("Rainy")
if s=="Rainy":
    print ("Sunny")
# 初期入力
from collections import Counter
import sys
input = sys.stdin.readline  #文字列では使わない
n = int(input())
v = list(map(int, input().split()))
vo1 =v[1::2]
ve2 =v[0::2]
co1_k,co1_v = zip(*Counter(vo1).most_common())
ce2_k,ce2_v = zip(*Counter(ve2).most_common())
"""
co1_l =list(co1.values())
ce2_l =list(ce2.values())
co1_l.sort(reverse=True)
ce2_l.sort(reverse=True)
"""
ans =0

if vo1 ==ve2:
    ans =len(vo1)
elif len(co1_v) ==len(ce2_v) ==1:
    ans =0
elif co1_k[0] ==ce2_k[0]:
    if len(co1_v) ==1:
        ans =sum(ce2_v[1:])
    elif len(ce2_v) ==1:
        ans =sum(co1_v[1:])
    elif len(co1_v) ==len(ce2_v) ==2:
        ans1 =co1_v[1] +ce2_v[0]
        ans2 =co1_v[0] +ce2_v[1]
        ans =min(ans1,ans2)
    elif len(co1_v) ==2:
        ans1 =co1_v[1] +ce2_v[0] +sum(ce2_v[2:])
        ans2 =co1_v[0] +sum(ce2_v[1:])
        ans =min(ans1,ans2)
    elif len(ce2_v) ==2:
        ans1 =ce2_v[1] +co1_v[0] +sum(co1_v[2:])
        ans2 =ce2_v[0] +sum(co1_v[1:])
        ans =min(ans1,ans2)
    else:
        ans1 =sum(co1_v[1:]) +ce2_v[0] +sum(ce2_v[2:] )
        ans1 =sum(ce2_v[1:]) +co1_v[0] +sum(co1_v[2:] )
        ans =min(ans1,ans2)
else: 
    if len(co1_v) ==1:
        ans =sum(ce2_v[1:])
    elif len(ce2_v) ==1:
        ans =sum(co1_v[1:])
    else:
        ans =sum(co1_v[1:]) +sum(ce2_v[1:])  
   
print(ans)

### FIXED CODE ###

# 初期入力
from collections import Counter
import sys
input = sys.stdin.readline  #文字列では使わない
n = int(input())
v = list(map(int, input().split()))
vo1 =v[1::2]
ve2 =v[0::2]
co1_k,co1_v = zip(*Counter(vo1).most_common())
ce2_k,ce2_v = zip(*Counter(ve2).most_common())

ans =0

if vo1 ==ve2:
    if len(ce2_k) <=2:
        ans =sum(ce2_v)
    else:
        ans =sum(ce2_v) +sum(co1_v[2:])   
elif len(co1_v) ==len(ce2_v) ==1:
    ans =0
elif co1_k[0] ==ce2_k[0]:
    if len(co1_v) ==1:
        ans =sum(ce2_v[1:])
    elif len(ce2_v) ==1:
        ans =sum(co1_v[1:])
    elif len(co1_v) ==len(ce2_v) ==2:
        ans1 =co1_v[1] +ce2_v[0]
        ans2 =co1_v[0] +ce2_v[1]
        ans =min(ans1,ans2)
    elif len(co1_v) ==2:
        ans1 =co1_v[1] +ce2_v[0] +sum(ce2_v[2:])
        ans2 =co1_v[0] +sum(ce2_v[1:])
        ans =min(ans1,ans2)
    elif len(ce2_v) ==2:
        ans1 =ce2_v[1] +co1_v[0] +sum(co1_v[2:])
        ans2 =ce2_v[0] +sum(co1_v[1:])
        ans =min(ans1,ans2)
    else:
        ans1 =sum(co1_v[1:]) +ce2_v[0] +sum(ce2_v[2:] )
        ans2 =sum(ce2_v[1:]) +co1_v[0] +sum(co1_v[2:] )
        ans =min(ans1,ans2)
else: 
    if len(co1_v) ==1:
        ans =sum(ce2_v[1:])
    elif len(ce2_v) ==1:
        ans =sum(co1_v[1:])
    else:
        ans =sum(co1_v[1:]) +sum(ce2_v[1:])  
   
print(ans)
N, K = map(int, input().split())
num = [0]*(10**5+1)

for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]:

### FIXED CODE ###

N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]
n,l = map(int, input().split())
string = [input() for i in range(n)]
string.sort()
print("".join(string))

### FIXED CODE ###

a,b,c = map(int, input().split())
if a*b*c==5*5*7:
    print("YES")
else:
    print("NO")
import math
n = int(input())
a = list(map(int, input().split()))


for i in range(len(a)):
    rem_k = a[:i] + a[i + 1:]
    # print(len(set(rem_k))) # 同一が2個以上のものを抽出してset
    cho = []
    for j in rem_k:
        if rem_k.count(j) >= 2:
            cho.append(j)
    # print(rem_k)
    for i in cho:
        if rem_k.count(i) - 2 < 0:
            ans = 0
        else:
            ans =  math.factorial(rem_k.count(i)) // (math.factorial(rem_k.count(i) - 2) * math.factorial(2))

    print(ans)


### FIXED CODE ###

from collections import Counter

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


cnt = 0
for v in cl.values():
    cnt += v * (v - 1) // 2 

for i in l:
    v = cl[i]
    ans = cnt - (v * (v - 1) // 2) + (v - 1) * (v - 2) // 2
    print(ans)
a=int(input()) 
b=int(input())
print(f"{a*b} {(a+b)*2}")


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,(a+b)*2)
def find_lcm(num1, num2): 
    if(num1>num2): 
        num = num1 
        den = num2 
    else: 
        num = num2 
        den = num1 
    rem = num % den 
    while(rem != 0): 
        num = den 
        den = rem 
        rem = num % den 
    gcd = den 
    lcm = int(int(num1 * num2)/int(gcd)) 
    return lcm 
n = int(input())
a = list(map(int, input().split()))
lcm = a[0]
mod = 10**9+7
for i in range(1, len(a)): 
    lcm = find_lcm(lcm, a[i])
ans = 0
for i in a:
    ans+=lcm*pow(i, mod-2, mod)
    ans%=mod
print(ans)

### FIXED CODE ###

import math
# Python3 program to compute LCM of  
# array elements modulo M 
MAX = 1000003
  
mod = 1000000007
  
prime = [0 for i in range(MAX)] 
  
max_map = dict() 
  
# function to return a^n 
def power(a, n): 
      
    if n == 0: 
        return 1
    p = power(a, n // 2) % mod 
    p = (p * p) % mod 
      
    if n & 1: 
        p = (p * a) % mod 
    return p 
  
# function to find the smallest prime 
# factors of numbers upto MAX 
def sieve(): 
    prime[0], prime[1] = 1, 1
    for i in range(2, MAX): 
        if prime[i] == 0: 
            for j in range(i * 2, MAX, i): 
                if prime[j] == 0: 
                    prime[j] = i 
            prime[i] = i 
  
# function to return the LCM modulo M 
def lcmModuloM(arr, n): 
      
    for i in range(n): 
        num = arr[i] 
          
        temp = dict() 
          
        # temp stores mapping of prime factors  
        # to its power for the current element 
        while num > 1: 
               
            # factor is the smallest prime 
            # factor of num 
            factor = prime[num] 
              
            # Increase count of factor in temp 
            if factor in temp.keys(): 
                temp[factor] += 1
            else: 
                temp[factor] = 1
                  
            # Reduce num by its prime factor 
            num = num // factor 
              
        for i in temp: 
            # store the higest power of every prime 
            # found till now in a new map max_map 
            if i in max_map.keys(): 
                max_map[i] = max(max_map[i], temp[i]) 
            else: 
                max_map[i] = temp[i] 
              
    ans = 1
      
    for i in max_map: 
          
        # LCM is product of primes to their 
        # higest powers modulo M 
        ans = (ans * power(i, max_map[i])) % mod 
    return ans 
  
# Driver code 
sieve()
n = int(input())
a = list(map(int, input().split()))
if len(a) == 1:
    print(1)
    exit()
mod = 10**9+7
lcm = lcmModuloM(a, len(a))
ans = 0
for i in a:
    ans+=pow(i, mod-2, mod)
    ans%=mod
ans*=lcm
ans%=mod
print(ans)
import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S))))

### FIXED CODE ###

import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S), key=len, default='')))
r=lambda x:x if u[x]<0else r(u[x])
(n,m),_,*e=[map(int,t.split())for t in open(0).readlines()]
u=[-1]*-~n
a=[n*~-n//2]
for x,y in e[::-1]:
 t=a[-1];x,y=r(x),r(y)
 if x!=y:t-=u[x]*u[y];u[x]+=u[y];u[y]=x
 a.append(t)
print(*a[::-1],sep='\n')

### FIXED CODE ###

class UnionFind:
  def __init__(self,n):
    *self.table,=range(n)
    self.rank=[1]*n
  def root(self,x):
    if self.table[x]==x:
      return x
    else:
      self.table[x]=self.root(self.table[x])
      return self.table[x]
  def unite(self,x,y):
    x=self.root(x)
    y=self.root(y)
    if x!=y:
      if self.rank[x]<self.rank[y]:
        x,y=y,x
      self.rank[x]+=self.rank[y]
      self.table[y]=x
  def same(self,x,y):
    return self.root(x)==self.root(y)
  def size(self,x):
    return self.rank[self.root(x)]
(n,m),_,*e=[map(int,t.split())for t in open(0).readlines()]
u=UnionFind(n)
a=[n*~-n//2]
for x,y in e[::-1]:
  x,y=x-1,y-1
  t=a[-1]
  if not u.same(x,y):
    t-=u.size(x)*u.size(y)
  a.append(t)
  u.unite(x,y)
print(*a[::-1],sep='\n')
a=input().list()
a=sorted(a)
print(a[2])

### FIXED CODE ###

a=input().split()
a=sorted(a)
if a.count(a[0]) == 1:print(a[0])
else:print(a[2])
a = input()
 
if a(-1:) = 's':
  print(a end='es')
else:
  print(a end='s')

### FIXED CODE ###

a = input()
 
if a[-1] == 's':
  print(a, end='es')
else:
  print(a, end='s')
if [5,5,7] == list(map(int,input().split().sorted())):
  print("YES")
else:
  print("NO")

### FIXED CODE ###

if [5,5,7] == list(map(int,sorted(input().split()))):
  print("YES")
else:
  print("NO")
# coding: utf-8
#Problem Name: Digit Number
#ID: tabris
#Mail: t123037@kaiyodai.ac.jp

for i in range(200):
    s = raw_input()
    if s == '':
        break
    a,b = map(int,s.split(' '))
    print len(str(a+b))

'''
Sample Input
5 7
1 99
1000 999
'''

### FIXED CODE ###

# coding: utf-8
#Problem Name: Digit Number
#ID: tabris
#Mail: t123037@kaiyodai.ac.jp

while True:
    try:
        a,b = map(int,raw_input().split(' '))
        print len(str(a+b))
    except:
        break

'''
Sample Input
5 7
1 99
1000 999
'''
input("A%sC"%input()[0])

### FIXED CODE ###

print("A%sC"%input()[8])
from collections import deque
n = int(input())
ans = deque([])
while n > 0:
    if n % 2 == 0:
        ans.appendleft(0)
    else:
        ans.appendleft(1)
    n = n // 2
print("".join(ans))

### FIXED CODE ###

n = int(input())
key = []
if n%2:
  key.append("1")
  n -= 1
else:
  key.append("0")

bef_p, bef_q = 0, 0
n //= 2
while n:
  k_p, k_q = (n//2)%2, n%2
  if k_p == 0:
    if k_q == 0:
      key.append("0")
      key.append("0")
      bef_p, bef_q = 0, 0
    else:       
      key.append("1")
      key.append("1")
      bef_p, bef_q = 0, 0      
  else:
    if k_q == 0:
      key.append("0")
      key.append("1")
      bef_p, bef_q = 0, 0
    else:
      key.append("1")
      key.append("0")
      bef_p, bef_q = 1, 1
  n //= 4
  n = n + bef_p*2-bef_q
key.reverse()
print(int("".join(key)))
a, p = input().split()
print((3 * a + p) / 2)

### FIXED CODE ###

a, p = list(map(int,input().split()))
print(int(((3 * a + p) / 2)))
n = int(input())
c = [l for l in input()]
max_idx = len(c)-1

if 'W' not in c:
  print(0)
else:
  most_left_white = c.index('W')
  tmp = c[::-1]
  most_right_red = max_idx - tmp.index('R')

  cnt = 0
  while most_left_white<most_right_red:
    c[most_left_white] = 'R'
    c[most_right_red] = 'W'

    most_left_white = c.index('W')
    tmp = c[::-1]
    most_right_red = max_idx - tmp.index('R')
    cnt+=1
  print(cnt)

  

### FIXED CODE ###

n = int(input())
c = [l for l in input()]
ideal = ['R']*(c.count('R')) + ['W']*(c.count('W'))

w_to_r=0
r_to_w=0
for i_, c_ in zip(ideal, c):
  if (i_=='R') and (c_=='W'):
    w_to_r+=1
  if (i_=='W') and (c_=='R'):
    r_to_w+=1

print(max(w_to_r, r_to_w))
# 帰宅経路数と時間を取得
N, T = map(int, input().split())
# 時間制限
ans = 1001
# N個の帰宅経路と時間を取得し、比較する
for i in range(N):
    cost, time = map(int, input().split())
    if time <＝ T:
        ans = min(ans, cost)
# 出力する
if ans == 1001:
    ans = "TLE"
print(ans)

### FIXED CODE ###

n, l = map(int, input().split())
ans = 1001
for i in range(n):
    c, t = map(int, input().split())
    if t <= l:
        ans = min(ans, c)
if ans == 1001:
    ans = "TLE"
print(ans)
import sys
input = sys.stdin.readline
from operator import itemgetter
import heapq
n, k = map(int, input().split())
TD = sorted([list(map(int, input().split())) for _ in range(n)], reverse=True, key=itemgetter(1))
L = [[] for _ in range(n+1)]
P = []
a = 0
cnt = 0
F = [-float("inf")]*(n+1)
for t, d in TD[:k]:
  L[t].append(d)
  if len(L[t]) == 1:
    a += 1
  cnt += d
F[a] = cnt
for i in range(1, n+1):
  while len(L[i]) > 1:
    heapq.heappush(P, L[i].pop())
now = k
for i in range(a, n):
  while now < n and L[TD[now][0]]:
    now += 1
  if now == n:
    break
  t, d = TD[now]
  L[t].append(d)
  F[i+1] = F[i] - heapq.heappop(P) + d
ans = 0
for i in range(a, n+1):
  ans = max(ans, F[i] + i*i)
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from operator import itemgetter
import heapq
n, k = map(int, input().split())
TD = sorted([list(map(int, input().split())) for _ in range(n)], reverse=True, key=itemgetter(1))
L = [[] for _ in range(n+1)]
P = []
a = 0
cnt = 0
F = [-float("inf")]*(n+1)
for t, d in TD[:k]:
  L[t].append(d)
  if len(L[t]) == 1:
    a += 1
  cnt += d
F[a] = cnt
for i in range(1, n+1):
  while len(L[i]) > 1:
    heapq.heappush(P, L[i].pop())
now = k
for i in range(a, n):
  if len(P) == 0:
    break
  while now < n and L[TD[now][0]]:
    now += 1
  if now == n:
    break
  t, d = TD[now]
  L[t].append(d)
  F[i+1] = F[i] - heapq.heappop(P) + d
ans = 0
for i in range(a, n+1):
  ans = max(ans, F[i] + i*i)
print(ans)
def dfs(s, targets):
    global K
    visited[s] = True
    # print(targets)
    for t in targets:
        if visited[t]:
            continue
        mab = max(G3[s], G3[t])
        while (mab in G2[s]) or (mab in G2[t]):
            mab += 1
        K = max(K, mab)
        ans[p2i[(s, t)]]= mab
        G2[s].add(mab)
        G2[t].add(mab)
        while G3[s] in G2[s]:
            G3[s] += 1
        while G3[t] in G2[t]:
            G3[t] += 1
        dfs(t, G[t])

K = 0
N = int(input())
G = [[] for i in range(N+1)]
G2 = [set() for i in range(N+1)]
p2i = {}
visited = [False for i in range(N+1)]
ans = [0 for i in range(N-1)]
G3 = [1] * (N+1)
for i in range(N-1):
    a, b = map(int, input().split())
    p2i[(a, b)] = i
    p2i[(b, a)] = i
    G[a].append(b)
    G[b].append(a)
# print(max(p2i.values()))
s = 1
targets = G[s]
dfs(s, targets)
print(K)
for a in ans:
    print(a)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

def dfs(s, targets):
    global K
    visited[s] = True
    # print(targets)
    for t in targets:
        if visited[t]:
            continue
        mab = max(G3[s], G3[t])
        while (mab in G2[s]) or (mab in G2[t]):
            mab += 1
        K = max(K, mab)
        ans[p2i[(s, t)]]= mab
        G2[s].add(mab)
        G2[t].add(mab)
        while G3[s] in G2[s]:
            G3[s] += 1
        while G3[t] in G2[t]:
            G3[t] += 1
        dfs(t, G[t])

K = 0
N = int(input())
G = [[] for i in range(N+1)]
G2 = [set() for i in range(N+1)]
p2i = {}
visited = [False for i in range(N+1)]
ans = [0 for i in range(N-1)]
G3 = [1] * (N+1)
for i in range(N-1):
    a, b = map(int, input().split())
    p2i[(a, b)] = i
    p2i[(b, a)] = i
    G[a].append(b)
    G[b].append(a)
# print(max(p2i.values()))
s = 1
targets = G[s]
dfs(s, targets)
print(K)
for a in ans:
    print(a)
N = input()
data = int(input().split())
bef = -1
count = 0
result = 0

for i in range(len(data)):
	if bef != data[i]:
		if count > 1:
			result += int(count) / 2
		count = 1
		bef = data[i]
	else:
		count++

print(result)

### FIXED CODE ###

N = input()
data = input().split()
bef = -1
count = 0
result = 0

for i in range(len(data)):
	t = int(data[i])
	if bef != t:
		if count > 1:
			result += int(count / 2)
		count = 1
		bef = t
	else:
		count += 1

if count > 1:
	result += int(count / 2)
print(result)
a, b = map(int, input().strip())

print(max(a+b, a-b, a * b))

### FIXED CODE ###

a,b = map(int, input().split())

print(max(a+b,a-b,a*b))