Harryxun/stf_run huggingface dataset:
a = list(map(int,input()))
s = sum(a)
if s >=22:
  print('bust')
else:
  print('win')

### FIXED CODE ###

a = list(map(int,input().split()))
s = sum(a)
if s >=22:
  print('bust')
else:
  print('win')
import copy
N = int(input())
As = []
for i in range(N):
    As.append(int(input()))
for j in range(N):
    instAs = copy.copy(As)
    instAs.pop(j)
    print(max(instAs))import copy
N = int(input())
As = []
for i in range(N):
    As.append(int(input()))
maxA = max(As)
instA = copy.copy(As)
instA.remove(maxA)
secA = max(instA)
for i in range(N):
    if As[i] == maxA:
        print(secA)
    else:
        print(maxA)

### FIXED CODE ###

import copy
N = int(input())
As = []
for i in range(N):
    As.append(int(input()))
maxA = max(As)
instA = As.copy()
instA.remove(maxA)
secA = max(instA)
for i in range(N):
    if As[i] == maxA:
        print(secA)
    else:
        print(maxA)
l, r=map(int, input().split())
if r-l>672:
	p=0
else:
	x=[]
	for i in range(l, r):
		for j in range(i+1, r+1):
			x.append(i*j%2019)
			if not p:
				break
		if not p:
			break
	p=min(x)
print(p)

### FIXED CODE ###

l, r=map(int, input().split())
x, y=l//2019, r//2019
p=0
if x==y:
	p=2019
	for i in range(l, r):
		for j in range(i+1, r+1):
			p=min(p, (((i%2019)*(j%2019))%2019))
print(p)
def max_minus_min(areas):
    # print("areas", areas)
    return max(areas) - min(areas)
 
def solve2(h, w):
    area1 = h * (w // 2)
    area2 = h * w - area1
    return area1, area2
 
def solve(h, w):
    w_div_3 = w // 3;
    ans = 1e9
    for w2 in range(w_div_3, w_div_3 + 2):
        area1 = w2 * h
        ans = min(ans, max_minus_min([area1] + solve2(h, w - w2)))
        ans = min(ans, max_minus_min([area1] + solve2(w - w2, h)))
    return ans
 
H, W = map(int, input().split())
print(min(solve(H,W), solve(W,H)))


### FIXED CODE ###

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

# import array
# from bisect import *
# from collections import *
# import fractions
# import heapq 
# from itertools import *
# import math
# import re
# import string

def max_minus_min(areas):
    # print("areas", areas)
    return max(areas) - min(areas)

def solve2(h, w):
    area1 = h * (w // 2)
    area2 = h * w - area1
    return [area1, area2]

def solve(h, w):
    w_div_3 = w // 3;
    ans = 1e9
    for w2 in range(w_div_3, w_div_3 + 2):
        area1 = w2 * h
        ans = min(ans, max_minus_min([area1] + solve2(h, w - w2)))
        ans = min(ans, max_minus_min([area1] + solve2(w - w2, h)))
    return ans

H, W = map(int, raw_input().split())
print(min(solve(H,W), solve(W,H)))
import math


def solve():
    abcde = [int(input()) for _ in range(5)]
    last = min([i for i in abcde if not str(i)[-1] == "0"], key=lambda x: abs(int(str(x)[-1])))
    hoge = sum([math.ceil(int(i) / 10) * 10 for i in abcde if not i == last])
    print(hoge + last)


if __name__ == "__main__":
    solve()


### FIXED CODE ###

import math


def solve():
    abcde = [int(input()) for _ in range(5)]
    if any([str(i)[-1] != "0" for i in abcde]):
        last = min([i for i in abcde if not str(i)[-1] == "0"], key=lambda x: abs(int(str(x)[-1])))
    else:
        last = min(abcde)
    hoge = sum([math.ceil(i / 10) * 10 for i in abcde]) - (math.ceil(last / 10) * 10)
    print(hoge + last)


if __name__ == "__main__":
    solve()
N = int(input())

for i in range(math.floor(N**0.5),0,-1):
    if N % i == 0:
        x,y = i, N//i
        break
print(x+y-2)

### FIXED CODE ###

import math

N = int(input())
for i in range(math.floor(N**0.5),0,-1):
    if N % i == 0:
        x,y = i, N//i
        break
print(x+y-2)
import sys
import math
from collections import deque
import heapq as hq

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    T = NI()
    A = []
    for _ in range(T):
        N = NI()
        camels = [NLI() for _ in range(N)]
        base = 0
        camels_L = [[] for _ in range(N+1)]
        camels_R = [[] for _ in range(N+1)]
        # 左から詰めるラクダと右から詰めるラクダを仕分ける
        for camel in camels:
            if camel[1] >= camel[2]:
                camels_L[camel[0]].append(camel[1] - camel[2])
                base += camel[2] # LとRの低いほうを加算
            else:
                camels_R[N - camel[0]].append(camel[2] - camel[1])
                base += camel[1] # LとRの低いほうを加算
        ans = 0
        heap_camels = []
        hq.heapify(heap_camels)
        for i in range(1, N+1):
            for camel in camels_L[i]:
                hq.heappush(heap_camels, camel)
            while len(heap_camels) > i:
                hq.heappop()
        ans += sum(heap_camels)

        heap_camels = []
        hq.heapify(heap_camels)
        for i in range(1, N+1):
            for camel in camels_R[i]:
                hq.heappush(heap_camels, camel)
            while len(heap_camels) > i:
                hq.heappop()
        ans += sum(heap_camels)
        print(ans + base)



if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
from collections import deque
import heapq as hq

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    T = NI()
    for _ in range(T):
        N = NI()
        camels = [NLI() for _ in range(N)]
        base = 0
        camels_L = [[] for _ in range(N+1)]
        camels_R = [[] for _ in range(N+1)]
        # 左から詰めるラクダと右から詰めるラクダを仕分ける
        for camel in camels:
            if camel[1] >= camel[2]:
                camels_L[camel[0]].append(camel[1] - camel[2])
                base += camel[2] # LとRの低いほうを加算
            else:
                camels_R[N - camel[0]].append(camel[2] - camel[1])
                base += camel[1] # LとRの低いほうを加算
        ans = 0
        heap_camels = []
        hq.heapify(heap_camels)
        for i in range(1, N+1):
            for camel in camels_L[i]:
                hq.heappush(heap_camels, camel)
            while len(heap_camels) > i:
                hq.heappop(heap_camels)
        if heap_camels:
            ans += sum(heap_camels)

        heap_camels = []
        hq.heapify(heap_camels)
        for i in range(1, N+1):
            for camel in camels_R[i]:
                hq.heappush(heap_camels, camel)
            while len(heap_camels) > i:
                hq.heappop(heap_camels)
        if heap_camels:
            ans += sum(heap_camels)
        print(ans + base)



if __name__ == "__main__":
    main()
N, K = map(int, input().split())
H = list(map(int, input().split()))
C = [0]*N
for i in range(1, N):
  	j = max(0, i-K)
    C[i] = min([c + abs(H[i]-h) for c, h in zip(C[j:i], H[j:i])])
print(C[N-1])

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
c = [0]*N
for i in range(1, N):
    c[i] = min([c[j] + abs(h[i]-h[j]) for j in range(max(0, i-K), i)])
print(c[N-1])
class WeightedUnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.weight = [0] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            px = self.find(self.parents[x])
            self.weight[x] += self.weight[self.parents[x]]
            self.parents[x] = px
            return px

    def union(self, x, y, w):
        w += self.weight[x] - self.weight[y]
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y, w = y, x, -w
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        self.weight[y] = w
        return

    def weig(self, x):
        self.find(x)
        return self.weight[x]

    def diff(self, x, y):
        return self.weigh(y) - self.weigh(x)

(n, m), *q = [[*map(int, o.split())] for o in open(0)]
UF = WeightedUnionFind(n + 1)
for l, r, d in q:
    if UF.same(l, r):
        if d != abs(UF.diff(l, r)):
            print("No"); exit()
    else:
        UF.union(l, r, d)
print("Yes")

### FIXED CODE ###

#!/usr/bin/env python3
class WeightedUnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.weight = [0] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            px = self.find(self.parents[x])
            self.weight[x] += self.weight[self.parents[x]]
            self.parents[x] = px
            return px

    def union(self, x, y, w):
        w += self.weight[x] - self.weight[y]
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            w = -w
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        self.weight[y] = w
        return

    def weig(self, x):
        self.find(x)
        return self.weight[x]

    def diff(self, x, y):
        return self.weight[y] - self.weight[x]

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)


n, m = map(int, input().split())
UF = WeightedUnionFind(n)

for i in range(m):
    l, r, d = map(int, input().split())
    l -= 1;r -= 1
    if UF.same(l, r):
        if d != abs(UF.diff(l, r)):
            exit(print("No"))
    else:
        UF.union(l, r, d)
print("Yes")
import numpy as np
import sys
sys.setrecursionlimit(100000)

directions = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])


def acinput():
    return list(map(int, input().split(" ")))


sys.setrecursionlimit(100000)


directions = [[1, 0], [0, 1], [-1, 0], [0, -1]]
directions = list(map(np.array, directions))


def acinput():
    return list(map(int, input().split(" ")))


N, K = acinput()
s = list(map(int, list(input())))

nums = [1]
for i in range(1, N):
    if s[i] == s[i-1]:
        nums[-1] += 1
    else:
        nums.append(1)


nums_cs = np.cumsum(nums)



#print(res)
if s[0]==1:
    if len(nums_cs) > 1:
       res = nums_cs[min(len(nums_cs)-1,2*K)]
    else:
        res=nums_cs[0]
    for i in range(1,len(nums_cs)-2*K):
        if i%2==0:
            res=max(res,nums_cs[i+2*K+1]-nums_cs[i-1])
else:    
    if len(nums_cs) > 1:
       res = nums_cs[min(len(nums_cs)-1,2*K-1)]
    else:
        res=nums_cs[0]

    for i in range(1,len(nums_cs)-2*K-1):
        if i%2==1:
            res=max(res,nums_cs[i+2*K+1]-nums_cs[i])


print(res)

### FIXED CODE ###


import numpy as np
import sys
sys.setrecursionlimit(100000)

directions = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])


def acinput():
    return list(map(int, input().split(" ")))


sys.setrecursionlimit(100000)


directions = [[1, 0], [0, 1], [-1, 0], [0, -1]]
directions = list(map(np.array, directions))


def acinput():
    return list(map(int, input().split(" ")))


N, K = acinput()
s = list(map(int, list(input())))

nums = [1]
for i in range(1, N):
    if s[i] == s[i-1]:
        nums[-1] += 1
    else:
        nums.append(1)

if s[0] != 1:
    nums.insert(0, 0)
nums_cs = np.cumsum(nums)

res = nums_cs[min(len(nums_cs)-1,2*K)]
# if len(nums_cs) > 1:
#     res = nums_cs[min(len(nums_cs)-1, 2*K-1)]
# else:
#     res = nums_cs[0]

for i in range(1,len(nums_cs)-2*K+1):
    if i % 2 == 0:
        #print(i)
        res = max(res, nums_cs[min(i+2*K,len(nums_cs)-1)]-nums_cs[i-1])


print(res)
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	N := readInt()
	L := make([]int, N)
	for i := 0; i < N; i++ {
		L[i] = readInt()
	}

	sort.Sort(sort.IntSlice(L))
	result := 0
	for i := 0; i < N-2; i++ {
		for j := i + 1; j < N-1; j++ {
			result += sort.SearchInts(L, L[i]+L[j]) - j - 1
		}
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


### FIXED CODE ###

from bisect import bisect_left, bisect_right

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

L.sort()
result = 0
for i in range(N - 2):
  a = L[i]
  for j in range(i + 1, N - 1):
    b = L[j]
    result += bisect_left(L, a + b) - j - 1
print(result)
import numpy as np
N = int(input())
A = list(map(int, input().split()))
B = A
A = np.array(A)
B = np.array(B)
emp = np.zeros(N)
Amax_ind = np.argmax(A)
emp[Amax_ind:] = max(A)
A[Amax_ind:] = 0
while True:
    subAmax_ind = np.argmax(A)
    emp[subAmax_ind:Amax_ind] = max(A)
    A[subAmax_ind:Amax_ind] = 0
    Amax_ind = subAmax_ind
    if 0 not in emp:
        break
print(int(sum(emp-B)))

### FIXED CODE ###

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

ans = 0
cur_max = 0

for x in a:
    if cur_max > x:
        ans += cur_max - x
    cur_max = max(cur_max, x)

print(ans)
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
D=many_int()

num=998244353


dicts={}
for d in D:
    if d in dicts:
        dicts[d] += 1
    else:
        dicts[d] = 1

sums = 1
keys = sorted(list(dicts.keys()))

test = [i for i in range(len(keys))]
flg=False
for t,k in zip(test,keys):
    if t!=k:
        flg=True

if dicts[0]!=1:
    flg=True
        
if flg:
    sums=0

for i in range(len(keys)-1):
    if i >= 1:
        for j in range(dicts[keys[i+1]]):
            sums *= (dicts[keys[i]])
            sums = sums%num
print(sums)

### FIXED CODE ###

def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
D=many_int()

num=998244353


dicts={i:0 for i in range(N)}
for d in D:
    if d in dicts:
        dicts[d] += 1
    else:
        dicts[d] = 1

sums = 1
keys = sorted(list(dicts.keys()))

test = [i for i in range(len(keys))]
flg=False
for t,k in zip(test,keys):
    if t!=k:
        flg=True

if keys[0]!=0 or D[0]!=0:
    flg=True
else:
    if dicts[0]!=1:
        flg=True
        
if flg:
    sums=0

for i in range(len(keys)-1):
    if i >= 1:
        for j in range(dicts[keys[i+1]]):
            sums *= (dicts[keys[i]])
            sums = sums%num
print(sums)
import numpy as np
from collections import deque

ab = np.array([])
n,m = map(int, input().split())

for i in range(m):
    ab = np.append(ab, list(map(int, input().split())), axis=0)

ab = ab.reshape(m,2)

Map = np.zeros((n,n),int)

for i in range(m):
    Map[int(ab[i][0]-1)][int(ab[i][1]-1)] = 1
    Map[int(ab[i][1]-1)][int(ab[i][0]-1)] = 1
    
d = deque([0])
dis = np.zeros(n, int)
appended = np.zeros(n)
appended[0] = 1

while len(d) != 0:
    hop = d.popleft()
    col = Map[hop]
    for i in range(len(col)):
        if col[i] == 1 and appended[i] == 0:
            d.append(i)
            dis[i] = hop+1
            appended[i] = 1
    
    hop += 1
    
for i in range(1,len(dis)):
    print(dis[i])

### FIXED CODE ###

from collections import deque

n,m = map(int, input().split())

path = [[] for _ in range(n)]

for i in range(m):
    a,b = map(int, input().split())
    path[a-1].append(b)
    path[b-1].append(a)
    
d = deque([0])
dis = [-1 for _ in range(n)]
dis[0] = 0

while d:
    hop = d.popleft()
    for i in path[hop]:
        if dis[i-1] == -1:
            d.append(i-1)
            dis[i-1] = hop+1
            
if -1 in dis:
    print('No')
else:
    print('Yes')
    for i in range(1,len(dis)):
        print(dis[i])
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
check = np.arange(1, n+1)
c = sorted(list(a - check))
b1 = c[int(n/2)]
b2 = c[int(n/2)+1]
count1 = 0
count2 = 0
for i in range(1, n+1):
    count1 += abs(a[i-1] - i - b1)
    count2 += abs(a[i-1] - i - b2)
print(min(count1, count2))


### FIXED CODE ###

import numpy as np
n = int(input())
if n == 1:
    a = input()
    print(0)
else:
    a = np.array(list(map(int, input().split())))
    check = np.arange(1, n+1)
    c = sorted(list(a - check))
    b1 = c[int(n/2)]
    b2 = c[int(n/2)+1]
    count1 = 0
    count2 = 0
    for i in range(1, n+1):
        count1 += abs(a[i-1] - i - b1)
        count2 += abs(a[i-1] - i - b2)
    print(min(count1, count2))
n=int(input())





graph=[[0]*9 for i in range(9)]

for i in range(1,n+1):
    if i%10!=0:
        i=str(i)
        sentou=int(i[0])
        matubi=int(i[-1])
        graph[sentou-1][matubi-1]+=1


import numpy as np

graph=np.array(graph)

print(np.trace(np.dot(graph,graph)))

### FIXED CODE ###

n = int(input())

graph = [[0] * 9 for i in range(9)]

for i in range(1, n + 1):
    if i % 10 != 0:
        i = str(i)
        sentou = int(i[0])
        matubi = int(i[-1])
        graph[sentou - 1][matubi - 1] += 1

import numpy as np

graph = np.array(graph)

print(np.trace(np.dot(graph, graph)))
k, s = input().split()
c = 0
for i range(k+1):
  x = i
  for j range(k+1):
  	y = j
    for h range(k+1):
      z = h
      sum = x + y + z
      if sum == k:
        c += 1
        
print(c)


### FIXED CODE ###

k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if 0<=z<=k:
            ans+=1
print(ans)
import math
r = int(input())

S = r * r * math.pi
C = r * 2 * math.pi
print("{0:02.6f}".format(S), end =" ")
print("{0:02.6f}".format(C))

### FIXED CODE ###

import math
r = float(input())

S = r * r * math.pi
C = r * 2 * math.pi
print("{0:02.6f}".format(S), end =" ")
print("{0:02.6f}".format(C))
n=int(input())
l=list(map(int,input().split()))
l.reverse()
print(l)


### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.reverse()
print( ' '.join(list(map( lambda x: str(x), l ))) )
a,b=map(int,input().split())
if a>b:
    print("GREATER")
elif a<b:
    print("LESS")
else:
    print("EQUAL")

### FIXED CODE ###

a=int(input())
b=int(input())
if a>b:
    print("GREATER")
elif a<b:
    print("LESS")
else:
    print("EQUAL")
k = int(input())
a,b = map(int,input())
d = 0
for i in range(a,b+1):
  if i%k == 0:
    d = 3
    break
  else:
    continue
if d == 3:
  print('OK')
else:
  print('NG')

### FIXED CODE ###

k = int(input())
a,b=map(int,input().split())
count = 0
for i in range(a,b+1):
    if i%k == 0:
        count += 1
if count == 0:
    print("NG")
else:
    print("OK")
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

a, b, c, k = Is()
nums = sorted([1] * a + [0] * b + [-1] * c, reverse=True)
print(np.sum(nums[:k]))

### FIXED CODE ###

import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

a, b, c, k = Is()

a = min(a, k)
k -= a

b = min(b, k)
k -= b

c = min(c, k)
k -= c

print(a-c)
n = int(input())
a = map(int,input().split())

ans = 1
for i in range(n):
    if a[i] == 0 : 
        ans = 0
        break

if ans :
    for i in range(n):
        ans = ans * a[i];
        if ans > 1000000000000000000 :
            ans = -1
            break
        
print(ans)
    

### FIXED CODE ###

n = int(input())
b = input()
a = [int(i) for i in b.split()]

ans = 1
for i in range(n):
    if a[i] == 0 : 
        ans = 0
        break

if ans :
    for i in range(n):
        ans *= a[i];
        if ans > 1000000000000000000 :
            ans = -1
            break
        
print(ans)
import numpy as np
def crossP(a, b, c, d):
    e = b - a
    f = c - d
    g = c - a
    A = np.matrix([[e.real,f.real],[e.imag, f.imag]])
    B = np.matrix([[g.real],[g.imag]])
    try:
        C = np.linalg.solve(A, B)
    except:
        return(-9999+(-9999)*1j)
    return(C[0,0]+C[1,0]*1j)

def rangeP(st):
    return((0.0<=st.real<=1.0) and (0.0<=st.imag<=1.0))

if __name__ == '__main__':
	n = int(input().strip())
	for i in range(n):
	    [xp1,yp1,xp2,yp2,xp3,yp3,xk,yk,xs,ys] = map(int, input().strip().split())
	    a = xp1+yp1*1j
	    b = xp2+yp2*1j
	    c = xp3+yp3*1j
	    k = xk+yk*1j
	    s = xs+ys*1j
	    shut = 0
	    if rangeP(crossP(a,b,k,s)):
	        shut += 1
	    if rangeP(crossP(b,c,k,s)):
	        shut += 1
	    if rangeP(crossP(c,a,k,s)):
	        shut += 1
	    if shut == 1:
	        print("OK")
	    else:
	        print("NG")

### FIXED CODE ###

EPS=1e-10
def crossP(aa,bb,cc,dd):
    a = (bb-aa).real
    b = (cc-dd).real
    c = (bb-aa).imag
    d = (cc-dd).imag
    e = (cc-aa).real
    f = (cc-aa).imag
    det = a*d - b*c
    if abs(det) <EPS:
        return(-9999+(-9999)*1j)
    x = (d*e-b*f)/det
    y = (-c*e+a*f)/det
    return(x+y*1j)

def rangeP(st):
    return((0.0<=st.real<=1.0) and (0.0<=st.imag<=1.0))

if __name__ == '__main__':
	n = int(input().strip())
	for i in range(n):
	    [xp1,yp1,xp2,yp2,xp3,yp3,xk,yk,xs,ys] = map(int, input().strip().split())
	    a = xp1+yp1*1j
	    b = xp2+yp2*1j
	    c = xp3+yp3*1j
	    k = xk+yk*1j
	    s = xs+ys*1j
	    shut = 0
	    if rangeP(crossP(a,b,k,s)):
	        shut += 1
	    if rangeP(crossP(b,c,k,s)):
	        shut += 1
	    if rangeP(crossP(c,a,k,s)):
	        shut += 1
	    if shut == 1:
	        print("OK")
	    else:
	        print("NG")
n=int(input())
a = map(int(),input().split())
as =a.sort()
max =as[-1]
mum =as[0]
sum=sum(as)
print("{} {} {}".format(mum,max,sum))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
mi=min(a)
ma=max(a)
s=sum(a)
print(mi,ma,s)
k,y=map(int,input().split())
for i in range(x-y,x+y):
    print(i)

### FIXED CODE ###

k,y=map(int,input().split())
for i in range(y-k+1,k+y):
    print(i,end=" ")
s = input()

dp = {i:dict() for i in range(len(s))}
def f(i, g):
    if i == len(s):
        return 0
    if g in dp[i]:
        return dp[i][g]
    p = i - g
    ans = (-1 if s[i] == 'p' else 0) + f(i + 1, g + 1)
    if p + 1 <= g:
        ans = max(ans, (1 if s[i] == 'g' else 0) + f(i + 1, g))
    dp[i][g] = ans
    return ans


print(f(0, 0))

### FIXED CODE ###

S = input()
N = len(S)
print(N // 2 - sum([int(s == 'p') for s in S]))