Harryxun/stf_run huggingface dataset:
import sys

# coding: utf-8

def North(dice):
    new_dice = [0,0,0,0,0,0]
    new_dice[0] = dice[3]
    new_dice[1] = dice[0]
    new_dice[2] = dice[2]
    new_dice[3] = dice[5]
    new_dice[4] = dice[4]
    new_dice[5] = dice[1]
    return new_dice

def East(dice):
    new_dice = [0,0,0,0,0,0]
    new_dice[0] = dice[4]
    new_dice[1] = dice[1]
    new_dice[2] = dice[0]
    new_dice[3] = dice[3]
    new_dice[4] = dice[5]
    new_dice[5] = dice[2]
    return new_dice

def West(dice):
    new_dice = [0,0,0,0,0,0]
    new_dice[0] = dice[2] #3
    new_dice[1] = dice[1] #5
    new_dice[2] = dice[5] #6
    new_dice[3] = dice[3] #2
    new_dice[4] = dice[0] #1
    new_dice[5] = dice[4] #4
    return new_dice

def South(dice):
    new_dice = [0,0,0,0,0,0]
    new_dice[0] = dice[1] #5
    new_dice[1] = dice[5] #6
    new_dice[2] = dice[2] #3
    new_dice[3] = dice[0] #1
    new_dice[4] = dice[4] #4
    new_dice[5] = dice[3] #2
    return new_dice

def Right(dice):
    new_dice = [0,0,0,0,0,0]
    new_dice[0] = dice[0] #1
    new_dice[1] = dice[4] #4
    new_dice[2] = dice[1] #5
    new_dice[3] = dice[2] #3
    new_dice[4] = dice[3] #2
    new_dice[5] = dice[5] #6
    return new_dice

def Left(dice):
    new_dice = [0,0,0,0,0,0]
    new_dice[0] = dice[0] #1
    new_dice[1] = dice[2] #3
    new_dice[2] = dice[3] #2
    new_dice[3] = dice[4] #4
    new_dice[4] = dice[1] #5
    new_dice[5] = dice[5] #6
    return new_dice

while 1:
    n = input()
    if n == 0:
        break
    dice = [1,5,3,2,4,6] # ??? ??? ??± ??? ?\? ??? ??????
    sum = 1
    for i in range(n):
        instruct = raw_input()
        if instruct == "North":
            dice = North(dice)
        elif instruct == "East":
            dice = East(dice)
        elif instruct == "South":
            dice = South(dice)
        elif instruct == "West":
            dice = West(dice)
        elif instruct == "Right":
            dice = Right(dice)
        elif instruct == "Left":
            dice = Left(dice)
        #print("** {:} **".format(dice[0]))
        sum += dice[0]
    print(sum)

### FIXED CODE ###

while(1):
    num=int(raw_input())
    if num==0:
        break
    else:
        d=[0,1,2,3,4,5,6]
        sum=1
        for i in range(num):
            dir=num=raw_input()
            if dir=="North":
                d=[0,d[2],d[6],d[3],d[4],d[1],d[5]]
            elif dir=="East":
                d=[0,d[4],d[2],d[1],d[6],d[5],d[3]]
            elif dir=="West":
                d=[0,d[3],d[2],d[6],d[1],d[5],d[4]]
            elif dir=="South":
                d=[0,d[5],d[1],d[3],d[4],d[6],d[2]]
            elif dir=="Right":
                d=[0,d[1],d[3],d[5],d[2],d[4],d[6]]
            else:
                d=[0,d[1],d[4],d[2],d[5],d[3],d[6]]
            sum=sum+d[1]
        print sum
def check(i, xs):
    xi = xs[i]
    children = set()
    for j, d in links[i]:
        if j in checked:
            continue
        xj = xs[j]
        if xj is None:
            xs[j] = xi + d
        elif xi + d != xj:
            return False
        children.add(j)
    checked.add(i)
    for jc in children:
        if not check(jc, xs):
            return False
    return True


def solve():
    for i in range(n):
        if i not in checked:
            xs = [None] * n
            xs[i] = 0
            res = check(i, xs)
            if not res:
                return False
            xf = list(filter(lambda x: x is not None, xs))
            mn, mx = min(xf), max(xf)
            if mx - mn > 1e9:
                return False
    return True


n, m = map(int, input().split())
links = [set() for _ in range(n)]
for _ in range(m):
    l, r, d = map(int, input().split())
    l -= 1
    r -= 1
    links[l].add((r, d))
    links[r].add((l, -d))
checked = set()
print('Yes' if solve() else 'No')


### FIXED CODE ###

import sys

sys.setrecursionlimit(100000)


def check(i, xs, checked):
    xi = xs[i]
    children = set()
    for j, d in links[i]:
        if checked[j]:
            continue
        if j not in xs:
            xs[j] = xi + d
        elif xi + d != xs[j]:
            return False
        children.add(j)
    checked[i] = True
    for j in children:
        if not check(j, xs, checked):
            return False
    return True


def solve():
    checked = [False] * n
    for i in range(n):
        if not checked[i]:
            xs = {}
            xs[i] = 0
            res = check(i, xs, checked)
            if not res:
                return False
            mn, mx = min(xs.values()), max(xs.values())
            if mx - mn > 1e9:
                return False
    return True


n, m = map(int, input().split())
links = [set() for _ in range(n)]
for _ in range(m):
    l, r, d = map(int, input().split())
    l -= 1
    r -= 1
    links[l].add((r, d))
    links[r].add((l, -d))
print('Yes' if solve() else 'No')
import math

AB = list(map(int, input().split(' ')))

print(math.floor(AB[0] * AB[1]))

### FIXED CODE ###

import math

A, B = input().split(' ')

A = int(A)
B = round(float(B) * 100)
print(math.floor(A * B // 100))
x = input().split()
n = int(x[0])

p = list(map(int,x[1:]))
c = 0

for i in range(1,n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
    c += 1
      

print(c)

### FIXED CODE ###

#x = input().split()
#print (x)
#n = int(x[0])
n = int(input())

#print(n)

#p = list(map(int,x[1:]))
p = list(map(int,input().split()))

#print(p)

#print(len(p))
c = 0
#print(len(p))
#print(p)
for i in range(1,n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
    c += 1
      

print(c)
sal
n = int(input())
a = list(map(int, input().split()))
print(sum(a)-len(a))


### FIXED CODE ###

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

ans=0
for i in range(n):
  ans+=a[i]-1
print(ans)
S = input()
dic = {}
for s in S:
	if not dic[s]:
		dic[s] = 1
	if dic[s]:
		dic[s] += 1
judge = 'Yes'
for k, v in dic.items():
	if v != 2:
		judge = 'NO'
print(judge)

### FIXED CODE ###

S = list(input())
judge = 'Yes'
for s in set(S):
	if S.count(s) != 2:
		judge = 'No'
print(judge)
# -*- coding: utf-8 -*-
N = int(input())
tree = {n:{"parent":-1, "left": -1, "right": -1} for n in range(N)} # left-child right-sibing
parent = set([n for n in range(N)])
for n in range(N):
    inp = [int(n) for n in input().split()]
    tree[inp[0]]["children"] = inp[2:]

    tree[inp[0]]["left"] = inp[2] if len(inp) > 2 else -1
    
    for ip in inp[2:]:
        tree[ip]["parent"] = inp[0]
    
    for i, ip in enumerate(inp[2:-1]):
        tree[inp[2+i]]["right"] = inp[3+i]
    parent = parent.difference(inp[2:])    

def set_depth(n, depth):
    tree[n]["depth"] = depth
    if tree[n]["left"] != -1:
        set_depth(tree[n]["left"], depth+1)
    if tree[n]["right"] != -1:
        set_depth(tree[n]["right"], depth)

set_depth(parent.pop(), 0)
        
for n in range(N):
    if tree[n]["parent"] == -1:
        tree[n]["type"] = "root"
    elif tree[n]["children"] != []:
        tree[n]["type"] = "internal node"
    else:
        tree[n]["type"] = "leaf"
        
    print("node {}: parent = {}, depth = {}, {}, {}"\
          .format(n, tree[n]["parent"], tree[n]["depth"], tree[n]["type"], tree[n]["children"]))

### FIXED CODE ###

# -*- coding: utf-8 -*-
#import sys
#sys.setrecursionlimit(1145141919)


N = int(input())
tree = {n:{"parent":-1, "left": -1, "right": -1} for n in range(N)} # left-child right-sibing
parent = set([n for n in range(N)])
for n in range(N):
    inp = [int(n) for n in input().split()]
    tree[inp[0]]["children"] = inp[2:]

    tree[inp[0]]["left"] = inp[2] if len(inp) > 2 else -1
    
    for ip in inp[2:]:
        tree[ip]["parent"] = inp[0]
    
    for i, ip in enumerate(inp[2:-1]):
        tree[inp[2+i]]["right"] = inp[3+i]
    parent = parent.difference(inp[2:])    

def set_depth(n, depth):
    print(depth)
    tree[n]["depth"] = depth
    if tree[n]["left"] != -1:
        set_depth(tree[n]["left"], depth+1)
    if tree[n]["right"] != -1:
        set_depth(tree[n]["right"], depth)

def get_depth(n):
    d = 0
    while tree[n]["parent"] != -1:
        d += 1
        n = tree[n]["parent"]
    return d

#set_depth(parent.pop(), 0)
        
for n in range(N):
    tree[n]["depth"] = get_depth(n)
    if tree[n]["parent"] == -1:
        tree[n]["type"] = "root"
    elif tree[n]["children"] != []:
        tree[n]["type"] = "internal node"
    else:
        tree[n]["type"] = "leaf"
        
    print("node {}: parent = {}, depth = {}, {}, {}"\
          .format(n, tree[n]["parent"], tree[n]["depth"], tree[n]["type"], tree[n]["children"]))
n = int(input())
nums = list(map(int, input().split()))
mx = nums.pop(max(nums))
if mx < sum(nums):
  print("Yes")
else :
  print("No")
  

### FIXED CODE ###

n = int(input())
nums = list(map(int, input().split()))
mx = nums.pop(nums.index(max(nums)))
if mx < sum(nums):
  print("Yes")
else :
  print("No")
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    pos = [a for a in A if a >= 0]
    neg = [a for a in A if a < 0]

    pos.sort()
    neg.sort(reverse=True)

    if N == K:
        vec = A
    elif N == len(neg):
        if K & 1:
            vec = neg[:K]
        else:
            vec = neg[-K:]
    else:
        ans_pos = []
        ans_neg = []
        for _ in range(K):
            if not pos:
                ans_neg.append(neg.pop())
            elif not neg:
                ans_pos.append(pos.pop())
            elif pos[-1] > -neg[-1]:
                ans_pos.append(pos.pop())
            else:
                ans_neg.append(neg.pop())

        if (len(ans_neg) & 1) and ((not ans_pos) or (ans_pos[-1] != 0)):
            s1 = s2 = 0
            if pos and ans_neg:
                s1 = -pos[-1] / ans_neg[-1]
            if neg and ans_pos:
                s2 = -neg[-1] / ans_pos[-1]

            if s1 > s2:
                ans_pos.append(pos.pop())
                ans_neg.pop()
            else:
                ans_neg.append(neg.pop())
                ans_pos.pop()

        vec = ans_pos + ans_neg

    ans = 1
    for a in vec:
        ans = ans * a % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    pos = [a for a in A if a >= 0]
    neg = [a for a in A if a < 0]

    pos.sort()
    neg.sort(reverse=True)

    if N == K:
        vec = A
    elif N == len(neg):
        if K & 1:
            vec = neg[:K]
        else:
            vec = neg[-K:]
    else:
        ans_pos = []
        ans_neg = []
        for _ in range(K):
            if not pos:
                ans_neg.append(neg.pop())
            elif not neg:
                ans_pos.append(pos.pop())
            elif pos[-1] > -neg[-1]:
                ans_pos.append(pos.pop())
            else:
                ans_neg.append(neg.pop())

        if (len(ans_neg) & 1) and ((not ans_pos) or (ans_pos[-1] != 0)):
            if not pos or not ans_neg:
                drop_pos = True
            elif not neg or not ans_pos:
                drop_pos = False
            else:
                drop_pos = pos[-1] * ans_pos[-1] < neg[-1] * ans_neg[-1]

            if drop_pos:
                ans_neg.append(neg.pop())
                ans_pos.pop()
            else:
                ans_pos.append(pos.pop())
                ans_neg.pop()

        vec = ans_pos + ans_neg

    ans = 1
    for a in vec:
        ans = ans * a % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()
HW = list(map(int, input().split()))
hw = list(map(int, input().split()))

H = HW[0]
W = HW[1]

h = hw[0]
w = hw[1]

return H * W - (H * h + (W - h) * w)


### FIXED CODE ###

HW = list(map(int, input().split()))
hw = list(map(int, input().split()))
H = HW[0]
W = HW[1]
h = hw[0]
w = hw[1]
r = H * W - (W * h + (H - h) * w)
print(r)
sen=map(str,raw_input().split())
ans=[]
for i in sen:
    if len(i)>=5:
        if i[0:5]=="apple":
            if len(i)>5:
                ans.append("peach"+i[5:])
            else:
                ans.appned("peach")
        elif i[0:5]=="peach":
            if len(i)>5:
                ans.append("apple"+i[5:])
            else:
                ans.append("apple")
        else:
            ans.append(i)
    else:
        ans.append(i)
print(" ".join(ans))

### FIXED CODE ###

sen=raw_input()
sen=sen.replace("apple","?????")
sen=sen.replace("peach","apple")
sen=sen.replace("?????","peach")
print(sen)
S=input()
words=[*S]
answers=[]
for n in words:
    if n=='1':
        answers.append('1')
    elif n=='0':
        answers.append('0')
    else:
        if not answers:
            continue
        else:
            answers.pop()
mojiretu=''
for x in answers:
    mojiretu+=x
print(mojiretu)


### FIXED CODE ###

S=input()
words=[a for a in S]
answers=[]
for n in words:
    if n=='1':
        answers.append('1')
    elif n=='0':
        answers.append('0')
    else:
        if not answers:
            continue
        else:
            answers.pop()
mojiretu=''
for x in answers:
    mojiretu+=x
print(mojiretu)
import bisect,collections,copy,heapq,itertools,math,string
import sys

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
ans = lcm(a, b)
print(ans)

### FIXED CODE ###

import bisect,collections,copy,heapq,itertools,math,string
import sys
import fractions
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
ans = lcm(a, b)
print(ans)
N, A, B = map(int input().split())
res = 0

for i in range(N+1):
  if A <= sum([int(n) for n in str(i)]) <= B:
    res += 1:

print(res)

### FIXED CODE ###

N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)
from sys import setrecursionlimit
setrecursionlimit(10 ** 6)

n = input()
k = int(input())

dl = [[None] * (len(n) + 1) for _ in range(len(n) + 1)]
de = [[None] * (len(n) + 1) for _ in range(len(n) + 1)]


def n_num_e(d, i):
    # d: n of digits
    # i: n of nonzero digits
    if d == 0:
        if i == 0:
            return 1
        else:
            return 0
    elif de[d][i] is not None:
        return de[d][i]
    else:
        if int(n[d - 1]) == 0:
            result = n_num_e(d - 1, i)
        else:
            result = n_num_e(d - 1, i - 1)
        de[d][i] = result
        return result


def n_num_l(d, i):
    # d: n of digits
    # i: n of nonzero digits
    if d == 0:
        return 0
    elif dl[d][i] is not None:
        return dl[d][i]
    else:
        if int(n[d - 1]) == 0:
            ne = 0
            nl = 9 * n_num_l(d - 1, i - 1) + n_num_l(d - 1, i)
            result = ne + nl
        else:
            ne = (int(n[d - 1]) - 1) * n_num_e(d - 1, i - 1) + n_num_e(d - 1, i)
            nl = 9 * n_num_l(d - 1, i - 1) + n_num_l(d - 1, i)
            result = ne + nl

        dl[d][i] = result
        return result


answer = n_num_e(len(n), k) + n_num_l(len(n), k)
print(answer)



### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10 ** 6)
MAXN = 100

n = input()
k = int(input())

dl = [[None] * (MAXN + 1) for _ in range(MAXN + 1)]
de = [[None] * (MAXN + 1) for _ in range(MAXN + 1)]


def n_num_e(d, i):
    # d: n of digits
    # i: n of nonzero digits
    if d == 0:
        if i == 0:
            return 1
        else:
            return 0
    elif de[d][i] is not None:
        return de[d][i]
    else:
        if int(n[d - 1]) == 0:
            result = n_num_e(d - 1, i)
        else:
            result = n_num_e(d - 1, i - 1)
        de[d][i] = result
        return result


def n_num_l(d, i):
    # d: n of digits
    # i: n of nonzero digits
    if d == 0:
        return 0
    elif dl[d][i] is not None:
        return dl[d][i]
    else:
        if int(n[d - 1]) == 0:
            ne = 0
            nl = 9 * n_num_l(d - 1, i - 1) + n_num_l(d - 1, i)
            result = ne + nl
        else:
            ne = (int(n[d - 1]) - 1) * n_num_e(d - 1, i - 1) + n_num_e(d - 1, i)
            nl = 9 * n_num_l(d - 1, i - 1) + n_num_l(d - 1, i)
            result = ne + nl

        dl[d][i] = result
        return result


answer = n_num_e(len(n), k) + n_num_l(len(n), k)
print(answer)
a=int(input())
b=int(input())
x=a*b
y=x%2
if y==0:
	print("Even")
else:
  	print("Odd")

### FIXED CODE ###

a,b=map(int,input().split())
x=(a*b)%2
if x==0:
	print("Even")
else:
  	print("Odd")
X, A = map(int, input())

if X >= A:
  print(10)
else:
  print(0)
  

### FIXED CODE ###

X, A = map(int, input().split())

if X >= A:
  print(10)
else:
  print(0)
import sys
input = sys.stdin.readline
N = int(input())
N_str = list(str(N))
a = 0
for i in N_str:
    a += int(i)
if N % a == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys
input = sys.stdin.readline
A, B = [int(x) for x in input().split()]
if A <= 8 and B <= 8:
    print("Yay!")
else:
    print(":(")
import numpy as np
N = int(input())
x = [0]*N
u = [0]*N
for i in range(N):
    x[i], u[i]= map(input().split())
    
x_int = [float(j) for j in x]
u_replace = [1 if k =="JPY" else 380000.0 for k in u]

### FIXED CODE ###

import numpy as np
N = int(input())
x = [0]*N
u = [0]*N
for i in range(N):
    x[i], u[i]= map(str, input().split())
    
x_int = [float(j) for j in x]
u_replace = [1 if k =="JPY" else 380000.0 for k in u]

x_arr = np.array(x_int)
u_arr = np.array(u_replace).reshape(N, 1)

ans = np.dot(x_arr, u_arr)
print(ans[0])
D = int(input())

num = 25 - D
s = "Christmas"

for i in num:
    s += " Eve"

print(s)

### FIXED CODE ###

D = int(input())

dic = {25: "Christmas", 24: "Christmas Eve", 23: "Christmas Eve Eve",
22: "Christmas Eve Eve Eve"}

print(dic[D])
S = int(input())
lst = []
while S > 0:
    lst.append(S%10)
    S //= 10 # 必須
if lst[0] == lst[1] or lst[1] == lst[2] or lst[2] == lst[3]:
  print("Bad")
else:
  print("Good")
  


### FIXED CODE ###

S = int(input())
lst = []
while S > 0:
    lst.append(S%10)
    S //= 10 # 必須
while(len(lst) <= 4):
  lst.append(0)
  
if lst[0] == lst[1] or lst[1] == lst[2] or lst[2] == lst[3]:
  print("Bad")
else:
  print("Good")
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N = int(input())
	V = input().split(" ")
	
	K = []
	G = []
	for i, val in enumerate(V):
		if i % 2 == 0:
			G.append(val)
		else:
			K.append(val)
	
	k = collections.Counter(K)
	k = sorted(k.items(), key=lambda x:x[1], reverse=True)
	g = collections.Counter(G)
	g = sorted(g.items(), key=lambda x:x[1], reverse=True)
	
	aaa, bbb = k[0]
	ccc, ddd = g[0]
	
	if aaa == ccc:
		if bbb > ddd and len(g) > 0:
			tmp1, tmp2 = g[1]
			g[0] = (tmp1, tmp2)
			g[1] = (ccc, ddd)
		elif bbb <= ddd and len(k) > 0:
			tmp1, tmp2 = k[1]
			k[0] = (tmp1, tmp2)
			k[1] = (aaa, bbb)
	
	#print(k)
	#print(g)
		
	ans = 0
	sono1 = 0
	sono2 = 0
	for a, b in enumerate(k):
		i, j = b
		if a == 0:
			sono1 = i
			continue
		ans += j
	
	for a, b in enumerate(g):
		i, j = b
		if a == 0:
			sono2 = i
			continue
		ans += j
		
	if ans > 0:
		print(ans)
	elif sono1 != sono2:
		print(ans)
	else:
		print(len(K))
		
		
	
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N = int(input())
	V = input().split(" ")
	
	K = []
	G = []
	for i, val in enumerate(V):
		if i % 2 == 0:
			G.append(val)
		else:
			K.append(val)
	
	k = collections.Counter(K)
	k = sorted(k.items(), key=lambda x:x[1], reverse=True)
	g = collections.Counter(G)
	g = sorted(g.items(), key=lambda x:x[1], reverse=True)
	
	aaa, bbb = k[0]
	ccc, ddd = g[0]
	eee = -1
	fff = -1
	ggg = -1
	hhh = -1
	if len(k) > 1:
		eee, fff = k[1]
	if len(g) > 1:
		ggg, hhh = g[1]
	
	if aaa == ccc:
		if bbb > ddd and ggg != -1:
			g[0] = (ggg, hhh)
			g[1] = (ccc, ddd)
		elif bbb < ddd and eee != -1:
			k[0] = (eee, fff)
			k[1] = (aaa, bbb)
		elif ggg != -1:
			if fff >= hhh:
				k[0] = (eee, fff)
				k[1] = (aaa, bbb)
			else:
				g[0] = (ggg, hhh)
				g[1] = (ccc, ddd)
	
	#print(k)
	#print(g)
		
	ans = 0
	sono1 = 0
	sono2 = 0
	for a, b in enumerate(k):
		i, j = b
		if a == 0:
			sono1 = i
			continue
		ans += j
	
	for a, b in enumerate(g):
		i, j = b
		if a == 0:
			sono2 = i
			continue
		ans += j
		
	if ans > 0:
		print(ans)
	elif sono1 != sono2:
		print(ans)
	else:
		print(len(K))
		
		
	
if __name__ == "__main__":
	main()
a,b = map(int,raw_input().split())
print ("[0] [1}").format(a*b,2*a+2*b)

### FIXED CODE ###

a,b = map(int,raw_input().split())
print ("{0} {1}").format(a*b,2*a+2*b)
string = input()
q = int(input())
for c in range(0,q):
    instruction = input().split(' ')
    if instruction[0] == 'print':
        print(string[int(instruction[1]):int(instruction[2]) + 1])
    elif instruction[0] == 'reverse':
        string = string.replace(string[int(instruction[1]):int(instruction[2])+1], string[int(instruction[1]):int(instruction[2])+1][::-1], 1)
    elif instruction[0] == 'replace':
        if instruction[1] == instruction[2]:
            string[int(instruction[1])] = instruction[3]
        else:
            string = string.replace(string[int(instruction[1]):int(instruction[2])+1], instruction[3], 1)

### FIXED CODE ###

string = input()
q = int(input())
for c in range(0,q):
    instruction = input().split(' ')
    if instruction[0] == 'print':
        print(string[int(instruction[1]):int(instruction[2]) + 1])
    elif instruction[0] == 'reverse':
        string = string.replace(string[int(instruction[1]):int(instruction[2])+1], string[int(instruction[1]):int(instruction[2])+1][::-1], 1)
    elif instruction[0] == 'replace':
        string = string[:int(instruction[1])] + instruction[3] + string[int(instruction[2])+1:]
a = list(map(str, input().split()))
if a[1] == “+”:
  print(int(a[0]) + int(a[2]))
else:
  print(int(a[0]) - int(a[2]))


### FIXED CODE ###

a = list(map(str, input().split()))
if a[1] == "+":
  print(int(a[0]) + int(a[2]))
else:
  print(int(a[0]) - int(a[2]))