solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
input() a = input() results = a.split() integered = list(map(int, results)) max = integered[0] min = integered[0] counter = 0 for x in integered: if x > max: max = x counter += 1 elif x < min: min = x counter += 1 print(counter)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; struct comp { bool operator()(const vector<int>& lhs, const vector<int>& rhs) const { return lhs.size() > rhs.size(); } }; struct comps { bool operator()(const string& lhs, const string& rhs) const { return lhs > rhs; } }; bool ff(pair<int, int> a, pair<int, int> b) { return a.first < b.first; } double dis(double x1, double y1, double x2, double y2) { return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); } int gcd(long long unsigned int a, long long unsigned int b) { return (b == 0) ? a : gcd(b, a % b); } int comb(int a, int b) { if (a == 0) return 1; if (a < b) return 1; if (a == b) return 1; if (b == 1) return a; if (b == 0) return 1; long long unsigned int aa = 1, bb = 1; for (int i = b; i > 0; i--, a--) { aa *= a; bb *= i; int gc = gcd(aa, bb); if (gc > 1) { aa /= gc; bb /= gc; } } return aa % 1000000007; } bool isprime(long long unsigned int n) { for (int i = 2; i <= sqrt(n); i++) if (n % i == 0) return false; return true; } int main() { int n, d, a = 0; int min = 100000, max = 0; scanf("%d", &n); scanf("%d", &d); min = d; max = d; for (int i = 1; i < n; i++) { scanf("%d", &d); if (d < min) { a++; min = d; } else if (d > max) { a++; max = d; } } cout << a; return 0; }
7
CPP
# I_love_Velichko ♥ n=int(input()) ans=0 l=list(map(int, input().split())) mimi=l[0] mami=l[0] for i in l: if i>mimi: ans+=1 mimi=i else: if i<mami: ans+=1 mami=i print(ans)
7
PYTHON3
n=int(input()) A=list(map(int,input().split())) maxi=A[0] mini=A[0] ans=0 for i in range(n): if A[i]>maxi: maxi=A[i] ans+=1 if A[i]<mini: mini=A[i] ans+=1 print(ans)
7
PYTHON3
_ = input() competitionList = list(input().split(' ')) for i in range(len(competitionList)): competitionList[i] = int(competitionList[i]) currentMathMax = competitionList[0] currentMathMin = competitionList[0] awesome = 0 for competition in competitionList: if competition > currentMathMax: currentMathMax = competition awesome += 1 elif competition < currentMathMin: currentMathMin = competition awesome += 1 print(awesome)
7
PYTHON3
n=int(input()) lista=list(map(int,input().split())) minimo=lista[0] maximo=lista[0] amazing=0 for i in range(1,n): if lista[i]>maximo: amazing+=1 maximo=lista[i] elif lista[i]<minimo: amazing+=1 minimo=lista[i] print(amazing)
7
PYTHON3
a=int(input()) b=input().split() i=0 s=0 t=0 for i in range(a): b[i]=int(b[i]) i=0 while i<a: for j in range(i): if b[i]>b[j]: t=t+1 if t==(i): s=s+1 t=0 for j in range(i): if b[i]<b[j]: t=t+1 if t==(i): s=s+1 t=0 i=i+1 s=s-2 print(s)
7
PYTHON3
#A. I_love_%username% contest = int(input()) data = list(map(int,input().split(' '))) amazingperformance = 0 high,low = data[0],data[0] for i in range(contest): if(data[i]>high): high = data[i] amazingperformance += 1 elif (data[i]<low): low = data[i] amazingperformance += 1 print(amazingperformance)
7
PYTHON3
a=input() s=input() lst=s.split() s=0 for i in range(len(lst)): lst[i]=int(lst[i]) lstmax=lst[0] lstmin=lst[0] for i in range(1,len(lst)): if lst[i]>lstmax: s=s+1 lstmax=lst[i] elif lst[i]<lstmin: s=s+1 lstmin=lst[i] print(s)
7
PYTHON3
n=int(input()) a=[int(i) for i in input().split()] Min=a[0] Max=a[0] jav=0 for i in range(1,n): if Max<a[i]: Max=a[i] jav+=1 elif Min>a[i]: Min=a[i] jav+=1 print(jav)
7
PYTHON3
n=int(input()) x=[int(i) for i in input().split()] s=0 min=10000 max=0 for i in x: if i>x[0]: if i>max: max=i s=s+1 elif i<x[0]: if i<min: min=i s=s+1 print(s)
7
PYTHON3
n,result,c,box = input(),[],0,[] for i in input().split(): result.append(int(i)) if len(result) > 1: if (int(i) == max(result) or int(i) == min(result)) and int(i) not in box and int(i) != result[0]: box.append(int(i)) print(len(box))
7
PYTHON3
input() x, *b = map(int, input().split()) y, r = x, 0 for v in b: if v < x or v > y: r += 1 x = min(x, v) y = max(y, v) print(r)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) if len(a)==1: print(0) else: x=0 b=[a[0],a[1]] c=[a[0],a[1]] if a[0]!=a[1]: x+=1 for i in range(2,n): b.append(a[i]) if min(c)>b[i] or max(c)<b[i]: x+=1 c.append(b[i]) print(x)
7
PYTHON3
test = int(input()) rec=list(map(int, input().split())) ma=rec[0] mi=rec[0] c = 0 for i in range(1, test): if rec[i]>ma: ma=rec[i] c+=1 elif rec[i]<mi: mi=rec[i] c+=1 print(c)
7
PYTHON3
n=int(input()) arr=list(map(int,input().split()[:n])) s=len(arr) w=[] count=0 for i in range(s): if not arr[i] in w: w.append(arr[i]) w.sort() if arr[i]==w[0] or arr[i]==w[-1] : count=count+1 print(count-1)
7
PYTHON3
n = int(input()) num = list(map(int,input().split())) print(len(["1" for i in range(1,len(num)) if max(num[0:i]) < num[i] or min(num[0:i]) > num[i]]))
7
PYTHON3
amazing = 0 n = int(input()) a = [int(i) for i in input().split()] for i in range(1, n): if a[i] > max(a[:i]) or a[i] < min(a[:i]): amazing += 1 print(amazing)
7
PYTHON3
n,l=int(input()), [int(i) for i in map(int,input().split())] f=0 if n==1: print("0") else: for i in range(1,n): if l[i] > max(l[0:i]) or l[i]<min(l[0:i]): f+=1 print(f)
7
PYTHON3
from sys import exit n = int(input()) a =[int(x) for x in input().split()] if len(a)==1: print('0') exit(0) max1 = a[0] min1 = a[0] length = len(a) c = 0 for i in range(0,length): if a[i]>max1: c+=1 max1 = a[i] elif a[i]<min1: c+=1 min1 = a[i] else: print(c)
7
PYTHON3
n=int(input()) scores=list(map(int,input().split(" "))) worst=scores[0];best=scores[0];i=1;count=0 while(i<n): if scores[i]>best: best=scores[i] count+=1 elif scores[i]<worst: worst=scores[i] count+=1 i+=1 print(count)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) x = 0 mn = a[0] mx = a[0] for i in range(1, n): if a[i] < mn: x += 1 mn = a[i] if a[i] > mx: x += 1 mx = a[i] print(x)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int max = a[0], min = a[0]; int amazing = 0; for (int i = 1; i < n; i++) { if (a[i] > max) { max = a[i]; amazing++; } if (a[i] < min) { min = a[i]; amazing++; } } cout << amazing << endl; }
7
CPP
n = int(input()); num_list = list(map(int, input().split())); mMax, mMin, ans = num_list[0], num_list[0], 0 for i in range(1,n): if mMax < num_list[i]: mMax = num_list[i]; ans+=1 if mMin > num_list[i]: mMin = num_list[i]; ans+=1 print(ans)
7
PYTHON3
n=int(input()) l=[int(x) for x in input().split()] mi=ma=l[0] res=0 for i in range(1,n): if l[i]<mi: res+=1 mi=l[i] elif l[i]>ma: res+=1 ma=l[i] print(res)
7
PYTHON3
cases = int(input()) perf = list(map(int, input().split())) mins = maxi = perf[0] amazing = 0 for i in perf: if i < mins: mins = i amazing += 1 elif i > maxi: maxi = i amazing += 1 print(amazing)
7
PYTHON3
n=int(input()) s=input() p=s.split() s=[] for a in p: a=int(a) s.append(a) max=s[0] min=s[0] amazing=0 for a in s: if a>max: amazing+=1 max=a elif a<min: amazing+=1 min=a print(amazing)
7
PYTHON3
n=int(input()) lst=list(map(int,input().split())) MAX=MIN=lst[0] ans=0 for i in lst[1:]: if i>MAX: MAX=i ans+=1 if i<MIN: MIN=i ans+=1 print(ans)
7
PYTHON3
p=0 y=int(input()) x=list(map(int,input().split())) for i in range(2,y+1): if x[i-1]>max(x[0:i-1]) or x[i-1]<min(x[0:i-1]): p+=1 print(p)
7
PYTHON3
n = int(input()) l = [] a = list(map(int, input().split())) l.append(a[0]) x = 0 for i in range(1,n): if a[i] not in l: l.append(a[i]) if max(l)==a[i] or min(l)==a[i]: x+=1 print(x)
7
PYTHON3
n=int(input()) L=list(map(int,input().split())) min1=L[0] max1=L[0] c=0 for i in range(1,len(L)): if L[i]<min1: c=c+1 min1=L[i] elif L[i]>max1: c=c+1 max1=L[i] print(c)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) Min=l[0] Max=l[0] count=0 for i in range(1,n): if l[i]>Max: count+=1 Max=l[i] elif l[i]<Min: count+=1 Min=l[i] print(count)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) m = len(a) res = 0 max = a[0] min = a[0] for i in range(m - 1): if a[i + 1] > a[i] and a[i + 1] > max: max = a[i + 1] res += 1 if a[i + 1] < a[i] and a[i + 1] < min: min = a[i + 1] res += 1 print(res)
7
PYTHON3
# -*- coding: utf-8 -*- """ Created on Sun Dec 8 16:18:51 2019 @author: 86138 """ #155A I_love_%username% n = int(input()) score = [int(x) for x in input().split()] low = score[0] high = score[0] a = 0 for i in range(n): if score[i] < low or score[i] > high: a += 1 low = min(low,score[i]) high = max(high,score[i]) print(a)
7
PYTHON3
n=int(input()) num=input() list=num.split() ref=int(list[0]) count=0 count2=0 for i in range(len(list)): if int(list[i])>ref: count=count+1 ref=int(list[i]) #print(str(ref)+'yo') ref2=int(list[0]) for i in range(len(list)): if int(list[i])<ref2: count2=count2+1 ref2=int(list[i]) # print(ref2) print(count2+count)
7
PYTHON3
a = int(input()) b = input() c = len(b) d = [] g = 0 max1=0 min1=10000 while b > "": if not " " in b: d.append(b) break e = b.index(" ") f = b[0:e] d.append(f) b = b[e+1: ] for i in d: i = int(i) if i < min1 or i > max1: g = g + 1 if i > max1: max1 = i if i < min1: min1 = i print(g - 1)
7
PYTHON3
n=int(input()) a=[int(j) for j in input().split()] l=[] l.append(a[0]) jieguo=0 for i in range(1,n): if a[i]>int(max(l)) or a[i]<int(min(l)): l.append(a[i]) jieguo=jieguo+1 else: l.append(a[i]) print(jieguo)
7
PYTHON3
n = int(input()) m = list(map(int, input().split())) res = 0 for i in range(1, n): small = True big = True for j in range(i): if m[i] >= m[j]: small = False if m[i] <= m[j]: big = False if small or big: res += 1 print(res)
7
PYTHON3
n = int(input()) s = input() a = s.split() for i in range(n): a[i] = int(a[i]) ans = 0 for i in range(1,n): d = a[0];x = a[0] for j in range(i): if a[j]>d: d = a[j] if a[j]<x: x = a[j] if a[i]>d: ans+=1 if a[i]<x: ans+=1 print(ans)
7
PYTHON3
n, m = int(input()), list(map(int, input().split())) ans, a, b = 0, m[0], m[0] for i in range(1, n): if m[i] < a: a = m[i] ans += 1 elif m[i] > b: b = m[i] ans += 1 print(ans)
7
PYTHON3
n=int(input()) ll=input().split() min=int(ll[0]) max=int(ll[0]) spe=0 for i in range(0,n): if int(ll[i])>max: spe=spe+1 max=int(ll[i]) if int(ll[i])<min: spe=spe+1 min=int(ll[i]) print(spe)
7
PYTHON3
n = int(input()) vals = [int(x) for x in input().split()] maxV, minV = vals[0], vals[0] ctr = 0 for i in range(1, n): val = vals[i] if val > maxV: ctr += 1 maxV = val if val < minV: ctr += 1 minV = val print(ctr)
7
PYTHON3
n=int(input()) c=0 l=[int(x) for x in input().split()] for i in range(1,len(l)): if l[i]<min(l[:i]) or l[i]>max(l[:i]): c+=1 print(c)
7
PYTHON3
n = int(input()) ans = 0 arr = list(map(int, input().split())) mi = ma = arr[0] for i in arr[1:]: if i > ma: ma = i ans += 1 if i < mi: mi = i ans += 1 print(ans)
7
PYTHON3
# Description of the problem can be found at http://codeforces.com/problemset/problem/155/A _ = input() scores = [int(x) for x in input().split()] a = 0 w_p = scores[0] b_p = scores[0] for s in scores: if s > b_p: a += 1 b_p = s elif s < w_p: a += 1 w_p = s print(a)
7
PYTHON3
__author__ = 'Utena' t=0 n=int(input()) s=list(map(int,input().split())) max=s[0] min=s[0] if n==1:print(0) else: for i in range(1,n): if s[i]>max: max=s[i] t+=1 elif s[i]<min: min=s[i] t+=1 print(t)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n, a, b, mx, mn, cnt = 0; cin >> n; cin >> a; mx = mn = a; for (int i = 1; i < n; i++) { cin >> b; if (b > mx) { cnt++; mx = b; } else if (b < mn) { cnt++; mn = b; } } cout << cnt; }
7
CPP
games=input() score=list(map(int,input().split())) high=score[0] low=score[0] ans=0 for i in score : if i < low: low=i ans+=1 elif i>high: high=i ans+=1 print(ans)
7
PYTHON3
n = int(input()) performance = list(map(int, input().split())) lo_pivot = hi_pivot = performance[0] count = 0 for i in range(1, n): if performance[i] > hi_pivot: count += 1 hi_pivot = performance[i] elif performance[i] < lo_pivot: count += 1 lo_pivot = performance[i] print(count)
7
PYTHON3
n=int(input()) r=[[0,0]]*(n+1) score=[int(i)for i in input().split()] r[0]=[score[0],score[0]] amazing=0 for i in range(1,n): if score[i]<r[i-1][0]: r[i][0]=score[i] r[i][1]=r[i-1][1] amazing+=1 elif score[i]>r[i-1][1]: r[i][1]=score[i] r[i][0]=r[i-1][0] amazing+=1 else: r[i]=r[i-1] print(amazing)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; while (scanf("%d", &n) != EOF) { int max, min, tmp, cnt = 0; scanf("%d", &tmp); max = min = tmp; n--; while (n--) { scanf("%d", &tmp); if (tmp > max) { cnt++; max = tmp; } if (tmp < min) { cnt++; min = tmp; } } printf("%d\n", cnt); } return 0; }
7
CPP
n=int(input()) a=input().split() high=int(a[0]) low=int(a[0]) s=0 for i in range(n-1): if int(a[i+1])>high: high=int(a[i+1]) s+=1 if int(a[i+1])<low: low=int(a[i+1]) s+=1 print(int(s))
7
PYTHON3
if __name__ == '__main__': n = int(input()) l = list( int(i) for i in input().split(' ')) first = l[0] num_amazing = 0 cur_max = cur_min = first for i in range(1,len(l)): #print('-------------- %d ' % i) if l[i] > cur_max: #print('new best found at %d' % i) cur_max = l[i] num_amazing+=1 #print('best: %d' % cur_max) elif l[i] < cur_min: #print('new worst found at %d' % i) cur_min = l[i] num_amazing +=1 #print('worst: %d' % cur_min) print(num_amazing)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) mi=ma=a[0];k=0 for i in a[1:]: if i<mi: k+=1 mi=i elif i>ma: k+=1 ma=i print(k)
7
PYTHON3
n = int(input()) #print(n) list = [int(x) for x in input().split()] ma = list[0] mi = list[0] #print(list) ans = 0 for i in list: #print(str(mi) + " " + str(ma)) if i > ma: ma = i ans+=1 elif i < mi: mi = i ans+=1 print(ans)
7
PYTHON3
n = int(input()) l = list(map(int,input().split())) c = 0 for i in range(n): if i == 0: mi = l[0] ma = l[0] else: if l[i] > ma: c += 1 ma = l[i] elif l[i] < mi: c += 1 mi = l[i] print(c)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) k1=[] for i in range(n): k=[] for j in range(0,i+1): k.append(l[j]) k.sort() if l[i]==k[0] or l[i]==k[-1]: k1.append(l[i]) s=set(k1) print(len(s)-1)
7
PYTHON3
list = [] n = int(input()) a = [int(x) for x in input().split()] checked = [] amazing = 0 checked.append(a[0]) for i in range(1, n): if a[i] > max(checked) or a[i] < min(checked): amazing += 1 checked.append(a[i]) print(amazing)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) n=len(a) b=[a[0]] c=[] for i in range(n): if a[i]>max(b) or a[i]<min(b): c.append(a[i]) b.append(a[i]) print(len(c))
7
PYTHON3
n = int(input()) nums = [int(i) for i in input().split()] count = 0 best = nums[0] worst = nums[0] for i in range(1, n): if(nums[i] > best): best=nums[i] count += 1 if(nums[i] < worst): worst = nums[i] count += 1 print(count)
7
PYTHON3
input() lista = input().split() menor = int(lista[0]) maior = int(lista[0]) aux = 0 for i in range(1,len(lista),1): if int(lista[i]) > maior: maior = int(lista[i]) aux+=1 if int(lista[i]) < menor: menor = int(lista[i]) aux+=1 print(aux)
7
PYTHON3
n=int(input()) l=[int(i) for i in input().split()] a=[] a.append(l[0]) m=1 s=0 while m<=n-1: b=max(a) d=min(a) a.append(l[m]) if l[m]>b or l[m]<d: s+=1 m=m+1 print(s)
7
PYTHON3
n = int(input()) k = list(map(int,input().split())) l1 = k[0] l2 = k[0] c = 0 for i in range(1,n): if k[i]>l1 : l1 = k[i] c+=1 elif k[i]<l2: l2 = k[i] c += 1 print(c)
7
PYTHON3
n,a,mn,mx,c=int(input()),list(map(int,input().split())),10**10,-10**10,0 for i in range(1,n): mx=max(mx,a[i-1]) mn=min(mn,a[i-1]) if a[i]>mx or a[i]<mn:c+=1 print(c)
7
PYTHON3
def fun(lest): smallest = largest = lest[0] amazing = 0 for score in lest[1:]: if(score < smallest): smallest = score amazing+=1 if(score > largest): largest = score amazing+=1 return amazing if __name__ == "__main__": n = int(input()) lest = map(int,input().split()) lest =list(lest) print (fun(lest))
7
PYTHON3
n=int(input()) arr=list(map(int,input().split())) mini=arr[0] maxi=arr[0] cnt=0 for i in range(1,n): if arr[i]>maxi: cnt+=1 maxi=arr[i] elif arr[i]<mini: cnt+=1 mini=arr[i] print(cnt)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) c=0 for i in range(1,n): x=min(l[:i]) y=max(l[:i]) if l[i]<x or l[i]>y: c+=1 print(c)
7
PYTHON3
n=int(input()) a=[int(x) for x in input().split()] s=0 if n==1: print(s) else: if a[1]==a[0]: s=0 else: s=1 for i in range(2,n): if a[i]>max(a[0:i]) or a[i]<min(a[0:i]): s=s+1 print(s)
7
PYTHON3
n=int(input()) a=list(map(int,input().split())) z=0 for i in range(n): c=0 b=0 for j in range(i): if i>0: if a[i]>a[j]: b+=1 for k in range(i): if i>0: if a[i]<a[k]: c+=1 if c==i or b==i: z+=1 print(z-1)
7
PYTHON3
n = int(input()) l = [int(i) for i in input().split()] max_l = l[0] min_l = l[0] s = 0 for i in range(1,n): if l[i]>max_l: s += 1 max_l = l[i] elif l[i]<min_l: s += 1 min_l = l[i] print(s)
7
PYTHON3
n=int(input()) points=list(map(int,input().split())) ma=None mi=None amzp=0 for i in points: if ma==None and mi==None: ma=i mi=i elif i>ma: ma=i amzp+=1 elif i<mi: mi=i amzp+=1 print(amzp)
7
PYTHON3
n=int(input()) arr=list(map(int,input().split())) def f(): if n==1: print(0) return a=arr[0] m=a result=0 for i in arr[1:]: if i>a: result+=1 a=i elif i<m: result+=1 m=i print(result) return f()
7
PYTHON3
def arr_inp(): return [int(x) for x in input().split()] def fun(ele): global ma, mi if ele > ma: ma = ele return True elif ele < mi: mi = ele return True else: return False n, a, ans = int(input()), arr_inp(), 0 ma, mi = a[0], a[0] print(len(list(filter(fun, a[1:]))))
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) mx=l[0] mn=l[0] c=0 for i in range(1,n): if l[i] >mx: mx=l[i] c+=1 elif l[i]<mn: mn=l[i] c+=1 print(c)
7
PYTHON3
n=int(input()) arr=input().split() i=0 results=[int(i) for i in arr] mx=-1 mn=1000000 c=0 for x in results: if x>mx: #print(x,' ',mx) mx=x c+=1 if x<mn: #(x,' ',mn) mn=x c+=1 print(c-2)
7
PYTHON3
n = int(input()) l = list(map(int, input().split())) amz = 0 mx, mn = 0, 0 for i in range(1, len(l)): if l[i] > l[mx]: amz += 1 mx = i if l[i] < l[mn]: amz += 1 mn = i print(amz)
7
PYTHON3
n = int(input()) numbers = [int(num) for num in input().split(" ", n-1)] count = 0 b = [] for i in numbers: if len(b) == 0: b.append(i) else: if i < min(b): count += 1 elif i > max(b): count += 1 b.append(i) print(count)
7
PYTHON3
n = int(input()) points = list(map(int, input().split())) max_p = points[0] min_p = points[0] amazing_count = 0 for point in points: if point > max_p: amazing_count += 1 max_p = point elif point < min_p: amazing_count += 1 min_p = point print(str(amazing_count))
7
PYTHON3
n = int(input()) game = [int(x) for x in input().split()] if n == 1: m = 0 elif n == 2: if game[0] == game[1]: m = 0 else: m = 1 else: if game[0] == game[1]: m = 0 else: m = 1 s = [game[0], game[1]] for i in range(2, n): if game[i]>max(game[0:i]) or game[i]<min(game[0:i]): m += 1 print(m)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) max_points = min_points = a[0] n_records = 0 for i in a[1:]: if i > max_points: max_points = i n_records += 1 elif i < min_points: min_points = i n_records += 1 print(n_records)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; long n, a[10000]; long progress1(long k) { long i; for (i = 1; i < k; i++) if (a[i] >= a[k]) return 0; return 1; } long progress2(long k) { long i; for (i = 1; i < k; i++) if (a[i] <= a[k]) return 0; return 1; } int main() { long dem = 0; cin >> n; for (long i = 1; i <= n; i++) { cin >> a[i]; if (i >= 2) if (progress1(i) == 1 || progress2(i)) dem++; } cout << dem; }
7
CPP
n = int(input()) a = list(map(int,input().split())) l = 0 max = min = a[0] for i in range(n): if a[i] > max: max = a[i] l += 1 elif a[i] < min: min = a[i] l += 1 print(l)
7
PYTHON3
n=int(input()) list=input().split() list=[int(i) for i in list] k=0 for i in range(1,n): if list[i]>max(list[:i]) or list[i]<min(list[:i]): k+=1 print(k)
7
PYTHON3
n =int( input()) a= list(map(int, input().split())) maxo=a[0] mino=a[0] supera=0 for i in range(n): srez=a[0:i+1] if max(srez)!= maxo: maxo=max(srez) supera=supera+1 if min(srez)!= mino: mino=min(srez) supera=supera+1 print(supera)
7
PYTHON3
from sys import stdin N = int(stdin.readline()) array = [int(i) for i in stdin.readline().split()] low = high = array[0] ans = 0 for i in range(1, N): if array[i] > high: ans += 1 high = array[i] elif array[i] < low: ans += 1 low = array[i] print(ans)
7
PYTHON3
n=int(input()) arr=list(map(int,input().split())) maxi=mini=arr[0] count=0 for i in range(1,n): if(arr[i]>maxi): count+=1 maxi=arr[i] elif(arr[i]<mini): count+=1 mini=arr[i] else: continue print(count)
7
PYTHON3
n=int(input()) a=list(map(int,input().strip().split()))[:n] min_val,max_val=a[0],a[0] count=0 for i in range(1,n): if a[i]<min_val: min_val=a[i] count+=1 elif a[i]>max_val: max_val=a[i] count+=1 print(count)
7
PYTHON3
n=int(input()) l=input().split() a=0 ma=int(l[0]) mi=int(l[0]) for i in range(1,n): if int(l[i])>ma or int(l[i])<mi: a+=1 ma=max(ma,int(l[i])) mi=min(mi,int(l[i])) print(a)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, cnt = 0, mx, mn; cin >> n >> x; n--; mx = x; mn = x; while (n--) { cin >> x; if (x > mx) { mx = x; cnt++; } if (x < mn) { mn = x; cnt++; } } cout << cnt; }
7
CPP
useless = int(input()) #dont really need this. scores = [int(a) for a in input().strip().split(' ')] #puts all into a list newlist = [] counter = 0 #makes new list from inputs and checks min and max for i in scores: if i is scores[0]: newlist.append(i) else: if i > max(newlist): counter +=1 elif i < min(newlist): counter +=1 newlist.append(i) print(counter)
7
PYTHON3
n = int(input()) s = [int(x)for x in input().split()] mn=s[0] mx=s[0] count=0 for i in range (len(s)): if s[i]>mx: mx=s[i] count+=1 elif s[i]<mn: mn=s[i] count+=1 else: continue print(count)
7
PYTHON3
def amazing_performance(perf, contests, i): return perf < min(contests[:i]) or perf > max(contests[:i]) def main(): n = int(input()) contests = list(map(int, input().split())) count = 0 for i in range(1, n): if amazing_performance(contests[i], contests, i) : count += 1 print(count) main()
7
PYTHON3
n=int(input()) l=[int(x) for x in input().split()] maxx,minn,cnt=l[0],l[0],0 for ele in l: if ele>maxx: maxx=ele cnt+=1 if ele<minn: minn=ele cnt+=1 print(cnt)
7
PYTHON3
n=int(input()) p=[int(i) for i in input().split()] minp=p[0] maxp=p[0] ans=0 for i in range(1,n): if(p[i]<minp): ans+=1 minp=p[i] if(p[i]>maxp): ans+=1 maxp=p[i] print(ans)
7
PYTHON3
n=int(input()) count=0 l=list(map(int,input().split())) min=l[0] amz=l[0] for i in range(1,n): if(l[i]>amz): count+=1 amz=l[i] elif(l[i]<min): count+=1 min=l[i] else: pass print(count)
7
PYTHON3
n = int(input()) s = list(map(int, input().split())) a = [] k = 0 for i in range(n): a.append(s[i]) if len(a) > 1: if (a[len(a)-1] == max(a) or a[len(a)-1] == min(a)) and a.count(a[len(a)-1]) == 1: k += 1 print(k)
7
PYTHON3
n=int(input()) sc=[int(i) for i in input().split()] x=0 y=[] for i in range(n): if i==0: y.append(sc[i]) else: if sc[i]>max(y) or sc[i]<min(y): x=x+1 y.append(sc[i]) else: y.append(sc[i]) print(x)
7
PYTHON3
maxi, mini, current, answer = -1, 10000, 0, 0 massiv=[] SCount = int(input()) a = list(map(int, input().split())) for x in range(0,SCount): if x == 0: maxi = a[x] mini = a[x] elif x != 0: if maxi < a[x]: maxi = a[x] answer += 1 if mini > a[x]: mini = a[x] answer += 1 print(answer)
7
PYTHON3
n=int(input()) l=[int(x) for x in input().split()] min=l[0] max=l[0] c=0 for x in l: if x<min: min=x c+=1 elif x>max: max=x c+=1 print(c)
7
PYTHON3
ab = int(input()) a = [int(i) for i in input().split()] b = 0 bm = a[0] c = 0 cm = a[0] v = 0 d = 0 for i in range(1, ab): if a[i] > bm: b += 1 bm = a[i] if a[i] < cm: c += 1 cm = a[i] d = d + c + b print(d)
7
PYTHON3