solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
n = int(input()) arr = [int(x) for x in input().split()] ama = 0 min = arr[0] max = arr[0] for x in arr: if x < min: min = x ama += 1 elif x > max: max = x ama += 1 print(ama)
7
PYTHON3
import sys n = int(sys.stdin.readline()) in_str = (sys.stdin.readline()).split() vmax = int(in_str[0]) vmin = vmax count = 0 for i in in_str[1:]: val = int(i); if(val > vmax): count += 1 vmax = val elif(val < vmin): count += 1 vmin = val print(count)
7
PYTHON3
n=int(input()) scores=[int(i) for i in input().split()] M=scores[0] m=scores[0] amazing=int(0) for i in range(1,n): if scores[i]>M: amazing+=1 M=scores[i] elif scores[i]<m: amazing+=1 m=scores[i] print(amazing)
7
PYTHON3
# A. I_love_%username% n = int(input()) balls = list(map(int, input().split())) long_list = len(balls) amazing = 0 max_ball = balls[0] min_ball = balls[0] for i in range(long_list - 1): if balls[i + 1] > max_ball: max_ball = balls[i + 1] amazing += 1 elif balls[i + 1] < min_ball: min_ball = balls[i + 1] amazing += 1 print(amazing)
7
PYTHON3
#include <bits/stdc++.h> int main() { int a, tmp, low, high; int cnt = 0; scanf("%d", &a); scanf("%d", &tmp); low = tmp; high = tmp; for (int i = 1; i < a; i++) { scanf("%d", &tmp); if (tmp > high) { high = tmp; cnt++; } else if (tmp < low) { low = tmp; cnt++; } } printf("%d\n", cnt); return 0; }
7
CPP
n=int(input()) l=list(map(int,input().split())) min=max=l[0] s=0 for i in range(n): x=l[i] if x<min: min=x s+=1 if x>max: max=x s+=1 print(s)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, max_, min_, t = 0; int a; cin >> n >> a; max_ = a; min_ = a; for (int i = 1; i < n; i++) { cin >> a; if (a > max_) { t++; max_ = a; } else if (a < min_) { t++; min_ = a; } } cout << t; }
7
CPP
n = int(input()) aList = [int(i) for i in input().split()] max = aList[0] min = aList[0] amz = 0 for a in aList: if a>max: amz += 1 max = a if a<min: amz +=1 min = a print(amz)
7
PYTHON3
import math import os import sys import re import string import itertools import functools import operator n = int(input()) A = list( map(int, input().split()) ) minv, maxv, res = A[0], A[0], 0 for i in range(1, len(A)): if A[i] < minv or A[i] > maxv: res = res + 1 minv = min(minv, A[i]) maxv = max(maxv, A[i]) print(res)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, a[1005], cnt = 0, i, j; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; for (i = 1; i < n; i++) { sort(a, a + i); if (a[i] < a[0] || a[i] > a[i - 1]) cnt++; } cout << cnt << endl; return 0; }
7
CPP
n=int(input()) number=input() m=number.split( ) k=0 t=10000 s=0 for i in range (1,n): k=max(k,int(m[i-1])) t=min(t,int(m[i-1])) if int(m[i])>k: s=s+1 if int(m[i])<t: s=s+1 print(s)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) min_, max_ = a[0], a[0] k = 0 for i in a: if i > max_: k += 1 max_ = i if i < min_: k += 1 min_ = i print(k)
7
PYTHON3
a=int(input()) a=list(map(int,input().split())) max=a[0] min=a[0] count=0 for i in a: if max<i: max=i count+=1 elif min>i: min=i count+=1 print(count)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int a[100005], n, cnt = 0, flag = 0, glaf = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { flag = 0; glaf = 0; for (int j = 0; j <= i - 1; j++) { if (a[i] > a[j]) { flag = 1; } else if (a[i] < a[j]) { glaf = 1; } else goto w; if (flag == 1 && glaf == 1) { flag = 0; glaf = 0; break; } } if ((flag == 1 && glaf != 1) || (glaf == 1 && flag != 1)) cnt++; w:; } cout << cnt; return 0; }
7
CPP
size = int(input()) count = 0 points = [int(x) for x in input().split()] for i in range(1, size): more = True less = True for j in range(0, i): if points[i] <= points[j]: more = False if points[i] >= points[j]: less = False if more or less: count += 1 print(count)
7
PYTHON3
#include <bits/stdc++.h> int main() { int n, j = 0, i; int a[1000]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int b = a[0]; int c = a[0]; for (i = 0; i < n; i++) { if (a[i] > b) { j++; b = a[i]; } else if (a[i] < c) { j++; c = a[i]; } } printf("%d", j); return 0; }
7
CPP
a=int(input()) s=0 b=[int(s) for s in input().split()] for i in range(1, len(b)): mink=min(b[:i]) maxk=max(b[:i]) if b[i]>maxk or b[i]<mink: s+=1 print(s)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) x,y,c=l[0],l[0],0 for i in range(n): if(l[i]>x): c=c+1 x=l[i] elif(l[i]<y): c=c+1 y=l[i] print(c)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) ma=a[0] mi=a[0] ans=0 for i in range(1,n): if a[i]>ma: ans+=1 ma=a[i] if a[i]<mi: ans+=1 mi=a[i] print(ans)
7
PYTHON3
n=int(input()) var=[int(x) for x in input().split()] mini=var[0] maxi=var[0] count=0 for index in range(0,len(var)): if(var[index]<mini): count+=1 mini=var[index] if(var[index]>maxi): count+=1 maxi=var[index] print(count)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) s=0 for i in range(1,n): if max(a[:i]) < a[i] or min(a[:i]) > a[i]: s+=1 print(s) ##n = int(input()) ##p = list(map(int, input().split())) ##print(sum(1 for i in range(1, n) if max(p[:i]) < p[i] or min(p[:i]) > p[i]))
7
PYTHON3
n=int(input()) l=list(map(int,input().split(" "))) total=0 for i in range(1,n): if l[i]>max(l[0:i]) or l[i]<min(l[0:i]): total=total+1 print(total)
7
PYTHON3
n=int(input()) line2=[int(i) for i in input().split()] total=0 line=[line2[0]] for i in range(len(line2)): if i>0: if line2[i]>max(line) or line2[i]<min(line): total=total+1 line.append(line2[i]) print(total)
7
PYTHON3
n = int(input()) lst = list(map(int, input().split())) count = 0 mini = lst[0] maxi = lst[0] for i in lst: if i < mini: mini = i count += 1 elif i > maxi: maxi = i count += 1 print(count)
7
PYTHON3
a = int(input()) l = list(map(int, input().split())) counter = 0 for i in range(1,a): subcounter_highest = 0 subcounter_lowest = 0 for a in range(0,i): if l[i] > l[a]: subcounter_highest = subcounter_highest + 1 elif l[i] < l[a]: subcounter_lowest = subcounter_lowest + 1 if subcounter_highest == i or subcounter_lowest == i: counter = counter + 1 print(counter)
7
PYTHON3
n = int(input()) arr = tuple(map(int,input().split())) ma = arr[0] mi = arr[0] ans = 0 for i in range(1,n): if arr[i]>ma: ans+=1 ma = arr[i] if arr[i]<mi: ans+=1 mi = arr[i] print(ans)
7
PYTHON3
n=int(input()) lt=list(map(int,input().split())) s=0 for i in range(1,n): if lt[i]>max(lt[:i]) or lt[i]<min(lt[:i]): s+=1 print(s)
7
PYTHON3
n = int(input()) l =[int(i) for i in input().split()] mi = ma = l[0] c = 0 for i in l: if i < mi or i > ma: c += 1 mi = min(i, mi) ma = max(i, ma) print(c)
7
PYTHON3
#!/usr/bin/python3 n = input() a = list(map(int, input().split(' '))) mn = mx = a[0] ans = 0 for i in a: tmp = i if tmp < mn or tmp > mx: ans = ans + 1 mn = min(mn, tmp) mx = max(mx, tmp) print(ans)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { long int i, j, m, n, max, min, count = 0; int a[1001], b[1001]; cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; max = a[1]; min = a[1]; for (i = 2, j = 0; i <= n; i++) { if (a[i] > max) { count++; max = a[i]; } } for (i = 2, j = m; i <= n; i++) { if (a[i] < min) { count++; min = a[i]; } } cout << count; }
7
CPP
n = int(input()) string = list(map(int, input().split())) count = 0 new = [] for i in range(n): new.append(string[i]) if i == 0: count = 0 a = min(new) b = max(new) elif string[i] < a: count += 1 a = string[i] elif string[i] > b: count +=1 b = string[i] print(count)
7
PYTHON3
input() x = input().split() c=0 high=low=int(x[0]) for i in x: i=int(i) c+=1 if (i>high or i<low) else 0 high=max(high,i) low=min(low,i) print(c)
7
PYTHON3
""" Author: Ove Bepari _nnnn_ dGGGGMMb ,''''''''''''''''''''''. @p~qp~~qMb | Promoting GNU/Linux | M|@||@) M| _;......................' @,----.JM| -' JS^\__/ qKL dZP qKRb dZP qKKb fZP SMMb HZM MMMM FqM MMMM __| ". |\dS"qML | `. | `' \Zq _) \.___.,| .' \____ )MMMMMM| .' `-' `--' hjm """ n = int(input()) arr = list(map(int, input().split())) best = arr[0] worst = arr[0] result = 0 for i in range(1,n): if arr[i] > best: result += 1 best = arr[i] elif arr[i] < worst: result += 1 worst = arr[i] print(result)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) maxx=l[0] minn=l[0] cnt=0 for i in range(1,n): if(l[i]<minn): cnt+=1 minn=l[i] elif(l[i]>maxx): cnt+=1 maxx=l[i] print(cnt)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) max=a[0] min=a[0] c=0 for i in a: if(i<min): min=i c+=1 if(i>max): max=i c+=1 print(c)
7
PYTHON3
n=int(input()) l=[int(x) for x in input().split(' ')] time=0 for i in range(1,n): if l[i]>max(l[:i]) or l[i]<min(l[:i]): time+=1 print(time)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int seq[2000]; int min = 100000, max = 0; int ans = -1; for (int i = 0; i < n; ++i) { scanf("%d", seq + i); bool flag = 0; if (seq[i] > max) { max = seq[i]; flag = 1; ans++; } if (seq[i] < min) { min = seq[i]; if (!flag) { ans++; } } } printf("%d\n", ans); }
7
CPP
n=int(input()) l=list(map(int,input().split())) m=mi=l[0] c=0 for i in range(n-1): if l[i+1]>m: m=l[i+1] c=c+1 if l[i+1]<mi: mi=l[i+1] c=c+1 print(c)
7
PYTHON3
n=int(input()) scores=list(map(int,input().split())) if len(scores)==1: print(0) else: amazing=0 cur_max=scores[0] cur_min=scores[0] for i in range(1,len(scores)): if scores[i]>cur_max: amazing+=1 cur_max=scores[i] if scores[i]<cur_min: amazing+=1 cur_min=scores[i] print(amazing)
7
PYTHON3
n=int(input()) scores=[int(i) for i in input().split()] if n==1: print(0) elif n==2: if scores[0]==scores[1]: print(0) else: print(1) else: mx=max(scores[0],scores[1]) mi=min(scores[0],scores[1]) if mx==mi: num=0 else: num=1 for i in scores: if i>mx: mx=i num=num+1 if i<mi: mi=i num=num+1 print(num)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a; cin >> a; int maxs = a; int mins = a; int ans = 0; for (int i = 2; i <= n; i++) { cin >> a; if (a > maxs) { ans++; maxs = a; } if (a < mins) { ans++; mins = a; } } cout << ans << endl; return 0; }
7
CPP
n = int(input()) l = [int(k) for k in input().split( )] amaze = 0 for i in range (1,n) : flagm = 1 for j in range(0,i) : if l[i] <= l[j] : flagm = 0 break if flagm == 1 : amaze += 1 for p in range(1,n): flagn = 1 for q in range(0,p) : if l[p] >= l[q] : flagn = 0 break if flagn == 1 : amaze += 1 print(amaze)
7
PYTHON3
N = int(input()) L = input() L = L.split() Menor= int(L[0]) Mayor= int(L[0]) c = 0 for k in range (1,N): if int(L[k])>Mayor: c+=1 Mayor = int(L[k]) elif int(L[k])<Menor: c+=1 Menor = int(L[k]) print(c)
7
PYTHON3
n = int(input()) a_list = [int(x) for x in input().split()] ans = 0 for i in range(1,n): b = 0 s = 0 e = 0 for j in range(0,i): if a_list[i] > a_list[j]: b += 1 elif a_list[i] < a_list[j]: s += 1 else: e += 1 if e == 0: if b == 0 or s == 0: ans += 1 print(str(ans))
7
PYTHON3
n = int(input()) l = list(map(int,input().split())) mx = l[0] mi = l[0] amz = 0 for i in range(1,len(l)): if(mx < l[i]): mx = l[i] amz += 1 elif(mi > l[i]): mi = l[i] amz += 1 print(amz)
7
PYTHON3
import sys def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def rinput(): return map(int, sys.stdin.readline().strip().split()) def get_list(): return list(map(int, sys.stdin.readline().strip().split())) n=iinput() l = list(map(int,input().split())) # maxi=mini=[] count=0 for i in range(1, len(l)): j = 0 while(j<i and l[i]<l[j]): j+=1 if (j==i): count+=1 j = 0 while(j<i and l[i]>l[j]): j+=1 if (j==i): count+=1 print(count)
7
PYTHON3
n = int(input()) l = [int(i) for i in input().split()] b = s = l[0] c = 0 for i in range(1, n): if l[i] > b: c += 1 b = l[i] elif l[i] < s: c += 1 s = l[i] print(c)
7
PYTHON3
n = int(input()) points = [int(i) for i in input().split()] count = 0 best = points[0] worst = points[0] for i in range(1, n): if points[i]>best: count += 1 best = points[i] elif points[i]<worst: count += 1 worst = points[i] print(count)
7
PYTHON3
n = input() contest = [int(contest) for contest in input().split()] mmin = mmax = contest[0] amz = 0 for i in contest: if i > mmax: amz += 1 mmax = i if i < mmin: amz += 1 mmin = i print(amz)
7
PYTHON3
num_attempts = input() args = input() args = args.split() array = [int(i) for i in args] amazing_count = 0 for i in range(1, len(array)): short_array = array[:i] if array[i] > max(short_array) or array[i] < min(short_array): amazing_count += 1 print(amazing_count)
7
PYTHON3
n=int(input()) a=[int(j) for j in input().split()] l=list([]) l.append(a[0]) jieguo=0 for i in range(1,n): l.sort() if a[i]>l[-1] or a[i]<l[0]: l.append(a[i]) jieguo=jieguo+1 else: l.append(a[i]) print(jieguo)
7
PYTHON3
n = int(input()) nums = [int(x) for x in input().split()] low = 10001 hi = -1 count = -2 for i in range(n): if nums[i] > hi: hi = nums[i] count += 1 if nums[i] < low: low = nums[i] count += 1 print(count)
7
PYTHON3
# https://codeforces.com/problemset/problem/155/A n = int(input()) points = list(map(int, input().split())) _min = points[0] _max = points[0] count = 0 for i in points: if _max < i: count += 1 _max = i if _min > i: count += 1 _min = i print(count)
7
PYTHON3
n = int(input()) points = list(map(int, input().split())) n = 0 min = max = points[0] for i in points: if i >max: max = i n += 1 if i < min: min = i n +=1 print(n)
7
PYTHON3
n = input() str1 = input() list1 = [int(k) for k in str1.split()] min = list1[0] max = list1[0] N = 0 for i in range(1,len(list1)): if list1[i] < min: min = list1[i] N = N + 1 elif list1[i] > max: max = list1[i] N = N + 1 print(N)
7
PYTHON3
#!/usr/bin/env python from __future__ import division, print_function import os import sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip from math import sqrt, floor, factorial, gcd from collections import deque, Counter, defaultdict # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") def print(*args, **kwargs): """Prints the values to a stream, or to sys.stdout by default.""" sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout) at_start = True for x in args: if not at_start: file.write(sep) file.write(str(x)) at_start = False file.write(kwargs.pop("end", "\n")) if kwargs.pop("flush", False): file.flush() if sys.version_info[0] < 3: sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout) else: sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) from collections import deque input = lambda: sys.stdin.readline().rstrip("\r\n") read = lambda: list(map(int, input().split(" "))) # endregion def func(arr): return(sum([arr[i] for i in range(0, len(arr), 2)])) def solve(): n = int(input()); arr = read() c = 0; mac = mic = arr[0] for i in range(1, n): if arr[i] > mac:c+=1;mac=arr[i] elif arr[i]<mic:c+= 1; mic=arr[i] print(c) if __name__ == "__main__": solve()
7
PYTHON3
n = int(input()) res = list(map(int,input().strip().split(' '))) best = res[0] worst= res[0] count = 0 for i in range(1,len(res)): if res[i] > best or res[i] < worst: count+=1 if res[i] > best: best = res[i] else: worst = res[i] print(count)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ar[n]; int cnt = 0; for (int i = 0; i < n; i++) cin >> ar[i]; for (int i = 1; i < n; i++) { bool mn = 1, mx = 1; for (int j = i - 1; j >= 0; j--) { if (ar[i] <= ar[j]) mx = 0; if (ar[i] >= ar[j]) mn = 0; } if (mn == 1 || mx == 1) cnt++; } cout << cnt << endl; }
7
CPP
n = int(input()) points = [int(x) for x in input().split()] amazing = 0 best = points[0] worst = points[0] for i in range(1, len(points)): if points[i] > best: best = points[i] amazing += 1 elif points[i] < worst: worst = points[i] amazing += 1 print(amazing)
7
PYTHON3
def username(lst): small=large=lst[0] amng=0 for i in lst[1:]: if i<small: small=i amng+=1 if i>large: large=i amng+=1 return amng n=int(input()) lst=list(map(int,input().split())) print(username(lst))
7
PYTHON3
num = int(input()) contests = list(map(int, input().split(" "))) count = 0 while len(contests) > 1: currentNum = contests.pop() if currentNum > max(contests) or currentNum < min(contests): count+= 1 print(count)
7
PYTHON3
n = int(input()) L = list(map(int, input().split())) t = d = ans = 0 for i in range(1, n): for j in range(i): if L[i] > L[j]: t += 1 elif L[i] < L[j]: d += 1 if t == i or d == i: ans += 1 t = d = 0 print(ans)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) m=l[0] M=l[0] a=0 for x in range(1,len(l)): if l[x]>M: M=l[x] a+=1 if l[x]<m: m=l[x] a+=1 print(a)
7
PYTHON3
n=int(input()) m=input().split() L=[] a=0 for i in range(0,n): L.append(int(m[i])) for t in range(1,n): N=L[:t] if L[t]<min(N) or L[t]>max(N): a=a+1 print(a)
7
PYTHON3
n=int(input()) a=list(map(int, input().split())) maxx=a[0] minn=a[0] count=0 for i in range(1, n): if a[i]>maxx: count+=1 maxx=a[i] if a[i]<minn: count+=1 minn=a[i] print(count)
7
PYTHON3
count=0 n=int(input()) l=list(map(int,input().split())) mini=l[0] maxi=l[0] for i in range(1,n): if (l[i]>maxi): maxi=l[i] count+=1 if(l[i]<mini): mini=l[i] count+=1 print(count)
7
PYTHON3
n=int(input()) cnt=0 li=list(map(int,input().split())) for i in range(1,n): if li[i]>max(li[:i]) or li[i]<min(li[:i]): cnt+=1 print(cnt)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) a_max = a[0]; a_min = a[0] s = 0 for i in range(1, n): if a[i] > a_max: a_max = a[i] s += 1 elif a[i] < a_min: a_min = a[i] s += 1 print(s)
7
PYTHON3
n = input() a = [int(x) for x in input().split()] s = 0 for i in range(1,len(a)): if max(a[0:i]) < a[i] or min(a[0:i]) > a[i]: s += 1 print(s)
7
PYTHON3
n = int(input()) u = 0 z = list(map(int, input().split())) for i in range(1,n): if z[i]>max(z[:i]): u+=1 if z[i]<min(z[:i]): u+=1 print(u)
7
PYTHON3
# Je déteste que j'aime que je déteste n = int(input()) arr = list(map(int, input().split())) top = low = arr[0] r, arr = 0, arr[1:] while arr: if arr[0] > top: r += 1 top = arr[0] if arr[0] < low: r += 1 low = arr[0] arr = arr[1:] print(r)
7
PYTHON3
_ = input() sc = [int(x) for x in input().split()] cur_max = sc[0] cur_min = sc[0] awe = 0 for s in sc[1:]: if s > cur_max: awe += 1 cur_max = s if s < cur_min: awe += 1 cur_min = s print (awe)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) set = 0 max = a[0] min = a[0] for i in range(1,len(a)): if a[i]>max: max = a[i] set +=1 elif a[i]<min: min = a[i] set +=1 print(set)
7
PYTHON3
n = int(input().strip()) l = [int(x) for x in input().split()] points = l[0] mini, maxi, amazing = points, points, 0 for point in l[1:]: if point < mini: mini = point amazing+=1 if point > maxi: maxi = point amazing+=1 print(amazing)
7
PYTHON3
ii =lambda: int(input()) si =lambda: input() lii =lambda: list(map(int,input().split())) n=ii() arr=lii() count=0 for i in range(1,n): if arr[i]>max(arr[:i]) or arr[i]<min(arr[:i]): count+=1 print(count)
7
PYTHON3
a=int(input()) b=list(map(int,input().split())) x=int(1) m=b[0] n=b[0] t=[] t.append(b[0]) k=int(0) while x<a: if b[x]>m or b[x]<n: k=k+1 t.append(b[x]) m=max(t) n=min(t) x=x+1 print(k)
7
PYTHON3
import sys x,*t = map(int, sys.stdin.read().strip().split('\n')[1].split()) mn = mx = x c = 0 for i in t: if i > mx: mx = i c += 1 elif i < mn: mn = i c += 1 print(c)
7
PYTHON3
n = int(input()) points = list(map(int, input().split())) counter = 0 ma, mi = points[0], points[0] for i in range(1, n): if ma < points[i]: counter += 1 ma = points[i] elif mi > points[i]: counter += 1 mi = points[i] print(counter)
7
PYTHON3
n = int(input()) p = [int(x) for x in input().split()] out, lastmax, lastmin = 0, 0, 0 for i in range(n): if p[i] > p[lastmax]: lastmax = i out += 1 continue if p[i] < p[lastmin]: lastmin = i out += 1 continue print(out)
7
PYTHON3
n=int(input()) s=list(map(int,input().split())) m=s[0] a=s[0] l=0 for i in range(n): if(s[i]>m): m=s[i] l+=1 if(s[i]<a): a=s[i] l+=1 print(l)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) amz=0 for i in range(1,n): c=l[0:i+1] if(max(c)==l[i] or min(c)==l[i]): if max(c) not in l[0:i]: amz+=1 if min(c) not in l[0:i]: amz+=1 print(amz)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) s = 0 min = -1 max = -1 tar = -2 for i in range(len(a)): for j in range(i): if a[i] > a[j]: max = a[i] if a[i] < a[j]: min = a[i] if a[i] == a[j]: tar = a[i] if min == max or tar == min or tar == max: s += 0 else: s += 1 tar = -2 print(s)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) b=l[0] w=l[0] a=0 for i in range(1,n): if(b<l[i]): b=l[i] a+=1 if(w>l[i]): w=l[i] a+=1 print(a)
7
PYTHON3
y = int(input()) mass = list(map(int, input().split())) min = mass[0] max = mass[0] score = 0 for i in range(1, y): if mass[i] > max: max = mass[i] score += 1 elif mass[i] < min: min = mass[i] score += 1 print(score)
7
PYTHON3
n=int(input()) l=[] l=list(map(int,input().split())) c=0 f=0 f2=0 for i in range(1,n): for j in range(0,i): f=0 if (not(l[i]>l[j])): f=1 break for j in range(0,i): f2=0 if (not(l[i]<l[j])): f2=1 break if f==0 or f2==0: c+=1 print(c)
7
PYTHON3
n = int(input()) max = None min = None result = 0 scores = map(int, input().split(" ")) for data in scores: if min == None or max == None: min = data max = data elif data > max: result = result + 1 max = data elif data < min: result = result + 1 min = data print(result)
7
PYTHON3
n=int(input()) s=[int(x) for x in input().split()] count=0 for i in range(1,n): if s[i]>max(s[:i]) or s[i]<min(s[:i]): count+=1 print(count)
7
PYTHON3
t=int(input()) s=input().split() count=0 b=c=None for w in s: i=int(w) if b is None or i>b: b=i count=count+1 if c is None or i<c: c=i count=count+1 print(count-2)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> scores; int performances = 0; for (int i = 0; i < n; i++) { int x; cin >> x; int min = 99999; int max = -1; for (int j = 0; j < scores.size(); j++) { if (scores[j] < min) { min = scores[j]; } if (scores[j] > max) { max = scores[j]; } } if (i > 0) { if (x > max || x < min) { performances++; } } scores.push_back(x); } cout << performances << endl; return 0; }
7
CPP
i=int(input()) lst=list(map(int,input().strip().split())) mn=lst[0] mx=lst[0] n=len(lst) res=0 for j in range(1,n): if lst[j]<mn: res+=1 mn=lst[j] elif lst[j]>mx: res+=1 mx=lst[j] print(res)
7
PYTHON3
a = int(input()) ar = list(map(int, input().split())) maxx, minn = ar[0], ar[0] rez = 0 for i in ar: if i < minn: minn = i rez += 1 elif i > maxx: maxx = i rez += 1 print(rez)
7
PYTHON3
def main(): n = input() results = list(map(int, input().split())) max_result = min_result = results[0] results.pop(0) wonderful_results = 0 for result in results: if result > max_result: max_result = result elif result < min_result: min_result = result else: continue wonderful_results += 1 print(wonderful_results) main()
7
PYTHON3
a = int(input()) s = input().split() for i in range(a): s[i]=int(s[i]) maxpoint=s[0] minpoint=s[0] res=0 for i in range(1,a): if s[i]> maxpoint: res+=1 maxpoint=s[i] if s[i]< minpoint: res+=1 minpoint=s[i] print(res)
7
PYTHON3
n = int(input()) points = list(map(int,input().split(' '))) min_points = max_points = points[0] amazing = 0 for point in points[1:]: if point < min_points or point > max_points: amazing += 1 min_points = min(point, min_points) max_points = max(point, max_points) print(amazing)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) maxEle = a[0] minEle = a[0] res = 0 for i in range(1, n): if a[i] > maxEle: maxEle = a[i] res += 1 if a[i] < minEle: minEle = a[i] res += 1 print(res)
7
PYTHON3
# n = int(input()) # a = list(map(int, input().split())) # p = 0 # k = 0 # # for i in a: # p += i # if p < 0: # k += 1 # p = 0 # print(k) n = int(input()) p = list(map(int, input().split())) b = p[0] v = p[0] c = 0 for i in range(1, n): if b < p[i]: b = p[i] c += 1 elif v > p[i]: v = p[i] c += 1 print(c)
7
PYTHON3
def solve(): n = int(input()) m = [int(s) for s in input().split()] max_m = m[0] min_m = m[0] ans = 0 for i in range(1, n): if m[i] > max_m: ans += 1 max_m = m[i] if m[i] < min_m: ans += 1 min_m = m[i] print(ans) if __name__ == "__main__": solve()
7
PYTHON3
from sys import stdin r = [[int(y) for y in x.rstrip().split()] for x in stdin.readlines()][1] r_max = r_min = r[0] s = 0 for x in r[1:]: if x<r_min: s+=1 r_min = x elif x>r_max: s+=1 r_max = x print(s)
7
PYTHON3
n=int(input()) l=[int(item) for item in input().split()] mi=l[0] ma=l[0] c=0 for i in range(1,n): if(l[i]<mi): mi=l[i] c=c+1 if(l[i]>ma): ma=l[i] c=c+1 print(c)
7
PYTHON3
n = int(input()) points = [int(x) for x in input().split()] min = points[0] max = points[0] amazing = 0 for x in range(1, n): if points[x] > max: max = points[x] amazing += 1 continue if points[x] < min: min = points[x] amazing += 1 continue print(amazing)
7
PYTHON3