solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
n = int(input()) l = list(map(int,input().split())) max = l[0] min = l[0] c = 0 for i in l: if(i < min): min = i c+=1 if(i>max): max = i c+=1 print(c)
7
PYTHON3
n = int(input()) a = [int(x) for x in input().split()] l = [a[0]] c = 0 for i in range(1,n): s = min(l) v =max(l) l.append(a[i]) if s > min(l): c += 1 if v < max(l): c += 1 print(c)
7
PYTHON3
input() nums = list(map(int, input().split())) min_val, max_val = nums[0], nums[0] ans = 0 for n in nums: ans += (n < min_val) + (n > max_val) min_val, max_val = min(n, min_val), max(n, max_val) print(ans)
7
PYTHON3
n = int(input()) arr = [int(i) for i in input().split()] mx = arr[0] mn = arr[0] c = 0 for i in range(1, n): if mx<arr[i] or arr[i]<mn: mx = max(mx, arr[i]) mn = min(mn, arr[i]) c += 1 print(c)
7
PYTHON3
s=input() m=input().split() k=list(map(int, m)) min=k[0] max=k[0] kol=0 for i in k: if i < min: min=i kol+=1 elif i > max: max=i kol+=1 else: pass print(kol)
7
PYTHON3
n = int(input()) Line = input().split() for i in range(n): Line[i] = int(Line[i]) k = 0 for i in range(1,n): a = 0 b = 0 for j in range(0,i): if Line[i] > Line[j]: a = a+1 elif Line[i] < Line[j]: b = b+1 if a == i or b == i: k = k +1 print(k)
7
PYTHON3
n = int(input()) x = [int(i) for i in input().split()] count = 0 for i in range(1, n): if x[i] < min(x[:i]): count += 1 elif x[i] > max(x[:i]): count += 1 print(count)
7
PYTHON3
# -*- coding: utf-8 -*- """ Created on Mon Nov 2 14:13:56 2020 @author: jion """ n = int(input()) L = [int(x) for x in input().split()] num = 0 for i in range(1,len(L)): if L[i] > max(L[:i]) or L[i] < min(L[:i]): num += 1 print(num)
7
PYTHON3
n=int(input()) l=[int(i) for i in input().split()] c=0 for i in range(1,n): if l[i]>max(l[:i]) or l[i]<min(l[:i]): c+=1 print(c)
7
PYTHON3
n = int(input()) score = [int(n) for n in input().split()] count = 0 for i in range(1,len(score)): if (score[i] > max(score[:i])) or (score[i] < min(score[:i])): count = count + 1 print(count)
7
PYTHON3
n=int(input()) *l,=map(int,input().split()) n,m,res=0,10001,0 for i in l: if i>n or i<m: res+=1 n=max(n,i) m=min(m,i) print(res-1)
7
PYTHON3
import itertools as it def pairwise(iterable): a, b = it.tee(iterable) next(b, None) return zip(a, b) input() n = [int(x) for x in input().split()] new_best = sum(a > b for a, b in pairwise(it.accumulate(n, min))) new_worst = sum(a < b for a, b in pairwise(it.accumulate(n, max))) print(new_best + new_worst)
7
PYTHON3
# Accept how many integers there are x = int(input()) # Accept a list of numbers a = [int(b) for b in input().split()] # Make the Max and Min equal to the first number in the list Max = Min = a[0] # Declare variable that will hold the total number of awesome games count = 0 # Iterate through the list starting at the second number for numb in range(1, x): # If the current number is greater than the current Max, reassign Max and add one to count if a[numb] > Max: count += 1 Max = a[numb] # If the current number is less than the current Min, reassign Min and add one to count elif a[numb] < Min: Min = a[numb] count += 1 print(count)
7
PYTHON3
a=int(input()) b=input().split() p=0 for i in range(a): b[i]=int(b[i]) summin=max(b)+1 summax=-1 for i in range(a): if b[i]>summax: summax=b[i] p=p+1 if b[i]<summin: summin=b[i] p=p+1 print(p-2)
7
PYTHON3
n = int(input()) list1 = input().split(" ") list2 = [int(i) for i in list1] list_max = [list2[0]] list_min = [list2[0]] count = 0 for i in range(0,n): if list2[i] > list_max[0]: list_max.clear() list_max.append(list2[i]) count += 1 elif list2[i] < list_min[0]: list_min.clear() list_min.append(list2[i]) count += 1 print(count)
7
PYTHON3
from math import * def main(): n = int(input()) x = list(map(int, input().split())) ans = 0 for i in range(1, n): if x[i] > max(x[:i]): ans += 1 elif x[i] < min(x[:i]): ans+= 1 print(ans) main()
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) count=0 b=[] for i in range(len(a)): if b!=[] and (a[i]<min(b) or a[i]>max(b)): count+=1 b.append(a[i]) print(count)
7
PYTHON3
def array(arr, struc): return (list(map(struc, arr.split()))) n = int(input()) arr = array(input(), int) mx = mn = arr[0] final = 0 for i in range(1, n): if arr[i] > mx: mx = arr[i] final += 1 elif arr[i] < mn: mn = arr[i] final += 1 print(final)
7
PYTHON3
n = int(input()) inp = list(map(int,input().split())) b = 0 for i in range(1,n): l = inp[:i] k = 0 c = 0 for j in range(len(l)): if inp[i] > l[j]: k = k + 1 for j in range(len(l)): if inp[i] < l[j]: c = c + 1 if k == len(l): b = b + 1 if c == len(l): b = b + 1 print(b)
7
PYTHON3
n = int(input()) a = [int(i) for i in input().split()] res = 0 mx = a[0] mn = a[0] for i in a: if i > mx: mx = i res += 1 if i < mn: mn = i res += 1 print(res)
7
PYTHON3
n = int(input()) points = 0 array = list(map(int, input().split())) maximum = array[0] minimum = array[0] if n == 1: print(0) exit(0) for i in range(1, len(array)): if array[i] > maximum: points += 1 maximum = array[i] elif array[i] < minimum: points += 1 minimum = array[i] print(points)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int max, min; for (int i = 0; i < n; i++) { cin >> arr[i]; } max = arr[0]; min = arr[0]; int cnt = 0; for (int i = 1; i < n; i++) { if (arr[i] > max) { max = arr[i]; cnt++; } if (arr[i] < min) { min = arr[i]; cnt++; } } cout << cnt; return 0; }
7
CPP
n = int(input()) l = list(map(int, input().strip().split())) least, greatest = l[0],l[0] res = 0 for i in range(1, n): if l[i] > greatest : res +=1 greatest = l[i] elif l[i] < least: res += 1 least = l[ i ] print(res)
7
PYTHON3
def main(): n = int(input()) l = [int(a) for a in input().split(' ')] amazing = 0 best = worst = l[0] for i in range(1, n): if l[i] > best: best = l[i] amazing += 1 elif l[i] < worst: worst = l[i] amazing += 1 print(amazing) main()
7
PYTHON3
num = int(input()) entries = list(map(int, input().split())) s = entries[0] l = entries[0] cs = 0 cl = 0 if len(entries) > 1: for i in range(1, len(entries)): if entries[i] < s: s = entries[i] cs += 1 elif entries[i] > l: l = entries[i] cl += 1 print(cs+cl) else: print(0)
7
PYTHON3
n = int(input()) w = input().split(" ") counter = 0 minValue = int(w[0]) maxValue = int(w[0]) for i in range(1,n): value = int(w[i]) if(value > maxValue): maxValue = value counter += 1 elif(value < minValue): minValue = value counter += 1 print(counter)
7
PYTHON3
n=int(input()) s=list(map(int,input().split())) mn,mx=s[0],s[0] mx_counter,mn_counter=0,0 for i in range(1,len(s)): if s[i]>mx: mx_counter +=1 mx,s[i]=s[i],mx elif s[i]<mn: mn_counter +=1 mn,s[i]=s[i],mn print(mx_counter+mn_counter)
7
PYTHON3
import math from collections import defaultdict, Counter, deque INF = float('inf') def gcd(a, b): while b: a, b = b, a%b return a def primeFactor(n): if n % 2 == 0: return 2 i = 3 while (i ** 2) <= n: if n % i == 0: return i i += 1 return n def main(): n = int(input()) arr = list(map(int, input().split())) ans = 0 curr_min = arr[0] curr_max = arr[0] for i in range(1, n): if arr[i] > curr_max: curr_max = arr[i] ans += 1 if arr[i] < curr_min: curr_min = arr[i] ans += 1 print(ans) if __name__ == "__main__": # t = int(input()) t = 1 for _ in range(t): main()
7
PYTHON3
#include <bits/stdc++.h> using namespace std; void solve() { long long n, x; cin >> n; cin >> x; int maxx = x, min = x; n = n - 1; int c = 0; while (n--) { int y; cin >> y; if (y > maxx) { maxx = y; c++; } if (y < min) { min = y; c++; } } cout << c; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; while (t--) { solve(); cout << endl; } return 0; }
7
CPP
n = int(input()) a = list(map(int, input().split())) max_num, min_num = a[0], a[0] ans = 0 for i in range(1, n): if a[i] > max_num or a[i] < min_num: ans += 1 max_num = max(max_num, a[i]) min_num = min(min_num, a[i]) print(ans)
7
PYTHON3
n = int(input()) a = list(map(int, input().split())) m, M = a[0], a[0] i = 0 for num in a: if num < m: m = num i += 1 if num > M: M = num i += 1 print(i)
7
PYTHON3
n = int(input()) l = list(map(int, input().split())) count = 0 max = l[0] min = l[0] for i in range(n): if l[i]>max: max = l[i] count += 1 elif l[i]<min: min = l[i] count += 1 print(count)
7
PYTHON3
n = int(input()) scores = list(map(int, input().split())) count = 0 for i, s in enumerate(scores): if i == 0: continue if s < min(scores[:i]): count += 1 elif s > max(scores[:i]): count += 1 print(count)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int mn, mx, n, a, ans; int main() { cin >> n >> a; mn = a; mx = a; for (int i = 1; i < n; i++) { cin >> a; if (a > mx) ans++; if (a < mn) ans++; mx = max(mx, a); mn = min(mn, a); } cout << ans; return 0; }
7
CPP
import sys n=int(input()) a=[int(i) for i in input().split()] c=0 i=1 ma=a[0] mi=a[0] while i<n: if a[i]>ma: ma=a[i] c+=1 if a[i]<mi: mi=a[i] c+=1 i+=1 print(c)
7
PYTHON3
n = int(input()) a = [int(i) for i in input().split()] b = a[0] s = a[0] am = 0 for i in range(n): if a[i] > b: b = a[i] am += 1 elif a[i] < s: s = a[i] am += 1 print(am)
7
PYTHON3
n=int(input()) s=list(map(int,input().split())) c=0 for i in range(1,n): a=min(s[:i]) b=max(s[:i]) if s[i]<a or s[i]>b: c+=1 print(c)
7
PYTHON3
_ = int(input()) p_list = list(map(int, input().split())) _max = p_list[0] _min = _max p_list = p_list[1:] amaz = 0 for _ in p_list: if _ > _max: _max = _ amaz += 1 elif _ < _min: _min = _ amaz += 1 print(amaz)
7
PYTHON3
def amazingContestCount(arr): count = 0 currentMax = arr[0] currentMin = arr[0] for i in range(1, len(arr)): if arr[i] > currentMax: currentMax = arr[i] count += 1 elif arr[i] < currentMin: currentMin = arr[i] count += 1 return count n = int(input()) nums = list(map(int, input().split())) print(amazingContestCount(nums))
7
PYTHON3
input() m = float("inf") M = -m res = 0 for points in input().split(): p = int(points) if p > M: res += 1 M = p if p < m: res += 1 m = p print(max(res - 2, 0))
7
PYTHON3
n=int(input()) A=input().split() a=int(A[0]) b=int(A[0]) k=0 for i in range(n): if int(A[i])>a: a=int(A[i]) k=k+1 elif int(A[i])<b: b=int(A[i]) k=k+1 print(k)
7
PYTHON3
n=int(input()) s=[int(i) for i in input().split()] MIN=s[0] MAX=s[0] cnt=0 for i in range(1,n): if s[i]>MAX: MAX=s[i] cnt+=1 elif s[i]<MIN: MIN=s[i] cnt+=1 print(cnt)
7
PYTHON3
n = int(input()) if(n == 0): print("0") else: counter = 0 low = 0 high = 0 line = [int(i) for i in input().split()] for j in range(0,n): if(j == 0): low = line[j] high = line[j] else: if(line[j] > high): high = line[j] counter += 1 elif(line[j] < low): low = line[j] counter += 1 print(str(counter))
7
PYTHON3
ans=-1 ma=-1 mi=10001 N=int(input()) l=input().split() for i in l: i=int(i) if i>ma and i<mi: ma=i mi=i ans+=1 elif i>ma: ma=i ans+=1 elif i<mi: mi=i ans+=1 print(ans)
7
PYTHON3
l=[];cnt=0 s=int(input()) l=list(map(int,input().split())) mx=mn=l[0] for i in l: if mx>i: mx=i cnt+=1 elif mn < i: mn = i cnt += 1 print(cnt)
7
PYTHON3
n = int(input()) l = list(map(int,input().split())) if n == 1: print(int(0)) else: if l[0] != l[1]: k = 1 else: k = 0 for i in range(2,n): if l[i] > max(l[0:i]) or l[i] < min(l[0:i]): k += 1 print(int(k))
7
PYTHON3
t=int(input()) list1=[] c=0 a = [int(j) for j in input().split(" ")] for i in a: list1.append(i) min=list1[0] max=list1[0] for i in list1[1:]: if i<min: min=i c+=1 if i>max: max=i c+=1 print(c)
7
PYTHON3
Tcases = int(input()) mx = 0 mn = 0 amaze = 0 lst = list(map(int,input().split())) for i in range(Tcases): if i == 0: mx = lst[i] mn = lst[i] else: if lst[i] > mx: amaze += 1 mx = lst[i] if lst[i]<mn: amaze += 1 mn = lst[i] print(amaze)
7
PYTHON3
a=int(input()) b=list(map(int,input().split())) max=b[0] min=b[0] count=0 for i in range(1,a): if b[i]>max: count=count+1 max=b[i] elif b[i]<min: count=count+1 min=b[i] print(count)
7
PYTHON3
n = int(input()) L = map(int,input().split()) L = list(L) i = 1 count = 0 while i < n: if L[i] > max(L[0:i]): # print(L[i],i) count += 1 if L[i] < min(L[0:i]): # print(L[i],i) count += 1 i += 1 print(count)
7
PYTHON3
number=int(input()) performance=[int(i) for i in input().split()] minimum=performance[0] maximum=performance[0] amazing=0 for i in range(1,number): if performance[i]>maximum: maximum=performance[i] amazing +=1 if performance[i]<minimum: minimum=performance[i] amazing +=1 print(amazing)
7
PYTHON3
n=int(input()) a=[int(j) for j in input().split()] zuida=a[0] zuixiao=a[0] jieguo=0 for i in range(1,n): if a[i]>zuida: zuida=a[i] jieguo=jieguo+1 elif a[i]<zuixiao: zuixiao=a[i] jieguo=jieguo+1 print(jieguo)
7
PYTHON3
input() a = list(map(int, input().split())) mn = mx = a[0] am = 0 for v in a[1:]: if v < mn: mn = v am += 1 elif v > mx: mx = v am += 1 print(am)
7
PYTHON3
# Vasya considers a coder's performance in a contest # amazing in two situations: he can break either his # best or his worst performance record. First, it is # amazing if during the contest the coder earns strictly # more points that he earned on each past contest. # Second, it is amazing if during the contest the # coder earns strictly less points that he earned on # each past contest. A coder's first contest isn't # considered amazing. Now he wants to count the number # of amazing performances the coder had throughout his # whole history of participating in contests. But the # list of earned points turned out long and Vasya can't # code... That's why he asks you to help him. # Input # The first line contains the single integer n (1 ≤ n ≤ 1000) # — the number of contests where the coder participated. # The next line contains n space-separated non-negative # integer numbers — they are the points which the coder # has earned. The points are given in the chronological # order. All points do not exceed 10000. # Output # Print the single number — the number of amazing performances # the coder has had during his whole history of participating # in the contests. n = int(input()) records = list(map(int, input().split())) def amazing(n, records): highest, lowest = records[0], records[0] counter = 0 for i in range(1, len(records)): if records[i] > highest: highest = records[i] counter += 1 # print('New highest: ', highest) if records[i] < lowest: lowest = records[i] counter += 1 # print('New lowest: ', lowest) print(counter) amazing(n, records)
7
PYTHON3
a = int(input()) l = [int(x) for x in (input().split())] c=0 for i in range(1,len(l)): if l[i] > max(l[:i]) or l[i] < min(l[:i]): c+=1 else: c+=0 print(c)
7
PYTHON3
import math n = int(input()) scores = list(map(int, input().split(" "))) akbar = scores[0] as8ar = akbar amazing = 0 for i in range(1, len(scores)): if scores[i]>akbar: akbar = scores[i] amazing+=1 if scores[i]<as8ar: as8ar = scores[i] amazing+=1 print(amazing)
7
PYTHON3
n = int(input()) a = [int(x) for x in input().split()] l = a[0] h = a[0] ans = 0 for i in range(1, n): if l > a[i] or h < a[i]: ans += 1 l, h = min(l, a[i]), max(h, a[i]) print(ans)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int i, k = -1, kk = 0, m, ara[1003], minn = 0, maxx = -1; int a = 0; cin >> m; for (i = 0; i < m; i++) { cin >> ara[i]; if (maxx < ara[i]) { maxx = ara[i]; k++; } if (a == 0) minn = ara[0]; if (ara[i] < minn) { minn = ara[i]; kk++; a++; } } if (k < 0) cout << kk << endl; else if (k >= 0) { cout << k + kk << endl; } return 0; }
7
CPP
# # №1.1 Буква в слове # a = input() # s = list(input().split()) # l = len(s) # for i in range(l): # if a in s[i]: # print(s[i]) # # №1.2 Максимальное кол-во букв в слове # a = input().lower() # max_c = 0 # for i in a: # if a.count(i) >= max_c: # max_c = a.count(i) # print(max_c) # # №1.3 Удалить каждый третий символ # a = input() # l = len(a) # b = '' # for i in range(l): # if i != 0 and i % 3 != 0: # b = b + a[i] # print(b) # # №1.4 Полицейские-рекруты # c = int(input()) # h = list(map(int, input().split())) # p_count = 0 # out = 0 # for i in h: # if i == -1: # if p_count == 0: # out += 1 # else: # p_count -= 1 # if 1 <= i <= 10: # p_count += i # print(out) # https://codeforces.com/problemset/problem/427/A # # №1.5 A. I_love_%username% c = int(input()) h = list(map(int, input().split())) count = 0 min = h[0] max = h[0] for i in range(c): if h[i] > max: max = h[i] count += 1 elif h[i] < min: min = h[i] count += 1 print(count) # https://codeforces.com/problemset/problem/155/A
7
PYTHON3
input() l = list(map(int,input().split())) ma=l[0] mi=l[0] ans = 0 for i in l: if i > ma: ans += 1 ma = i elif i < mi: ans += 1 mi = i print(ans)
7
PYTHON3
n=int(input()) m=[int(i) for i in input().split()] amazing=0 mx=m[0] mn=m[0] for i in range(1,n): if m[i]>mx: mx=m[i] amazing+=1 if m[i]<mn: mn=m[i] amazing+=1 print(amazing)
7
PYTHON3
n=int(input()) a=[int(i) for i in input().strip().split()] max=a[0];min=a[0];count=0 for i in range(n): if a[i]>max: max=a[i] count+=1 elif a[i]<min: min=a[i] count+=1 print(count)
7
PYTHON3
n = int(input()) a = [int(i) for i in input().split()] max1,min1 = a[0],a[0] q = 0 for i in a: if i > max1: max1 = i q += 1 if i < min1: min1 = i q += 1 print(q)
7
PYTHON3
def fun(lst): s=l=lst[0] a=0 for i in lst[1:]: if i<s: s=i a+=1 if i>l: l=i a+=1 return a n=int(input()) lst=list(map(int,input().split())) print(fun(lst))
7
PYTHON3
n=int(input()) l=[int(i) for i in input().split()] mi=l[0] ma=l[0] z=0 for i in range(1,n): if l[i]>ma: z=z+1 ma=l[i] if l[i]<mi: z=z+1 mi=l[i] print(z)
7
PYTHON3
value = int(input()) values = input() values = values.split() values = [int(i) for i in values] a = values[0] b = values[0] count = 0 for i in values: if i>a: count += 1 a = i if i<b: count += 1 b = i print(count)
7
PYTHON3
fu=input() numbers=list(map(int,input().split())) nmax=numbers[0] nmin=numbers[0] numbers.pop(0) k = 0 for i in numbers: if i > nmax: nmax = i k+=1 elif i < nmin: nmin = i k+=1 print(k)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int N; int main() { cin >> N; int i, num, minn, maxn, ans = 0; cin >> minn; maxn = minn; for (i = 1; i < N; ++i) { cin >> num; if (num > maxn) { ++ans; maxn = num; } if (num < minn) { ++ans; minn = num; } } cout << ans; return 0; }
7
CPP
class Code: def __init__(self): self.n = int(input()) self.arr = list(map(int, input().split())) def process(self): mn_mx, cnt = [self.arr[0], self.arr[0]], 0 for i in range(1, self.n): if self.arr[i] > mn_mx[0]: cnt += 1 mn_mx[0] = self.arr[i] elif self.arr[i] < mn_mx[1]: cnt += 1 mn_mx[1] = self.arr[i] print(cnt) if __name__ == '__main__': code = Code() code.process()
7
PYTHON3
x = int(input()) score = [int(x) for x in input().split()] max = 0 min = 0 ans = 0 count = 0 for i in score: if count ==0: max = i min = i count+=1 elif i > max: max = i ans+=1 elif i < min: min = i ans+=1 print (ans)
7
PYTHON3
# https://codeforces.com/problemset/problem/155/A n = int(input()) contests = [int(i) for i in input().split(" ")] highestScore = 0 lowestScore = 0 amazingPerformance = 0 for i, score in enumerate(contests): if i == 0: highestScore = score lowestScore = score else: if score > highestScore: highestScore = score amazingPerformance = amazingPerformance + 1 elif score < lowestScore: lowestScore = score amazingPerformance = amazingPerformance + 1 print(amazingPerformance)
7
PYTHON3
import sys a = sys.stdin.readline() cad = sys.stdin.readline().split() min = int(cad[0]) max = int(cad[0]) cont = 0 for i in range(len(cad)): aux = int(cad[i]) if(aux>max): max = aux cont += 1 if(aux<min): min = aux cont += 1 print(cont)
7
PYTHON3
n=int(input()) lst=list(int(num) for num in input().split())[:n] lst1=[] lst1.append(lst[0]) count=0 for i in range(1,len(lst)): if max(lst1) < lst[i]: count+=1 if min(lst1) > lst[i]: count+=1 lst1.append(lst[i]) print(count)
7
PYTHON3
n = int(input()) s = [None] * n s[:] = map(int, input().split()) minx = 10001 mx = 0 ans = 0 for i in s: if i > mx or i < minx: ans += 1 mx = max(mx, i) minx = min(minx, i) print(ans - 1)
7
PYTHON3
n=int(input()) a=[int(i) for i in input().split()] x,y,k=0,0,0 if(n>1): if(a[0]>a[1]): y=1 k+=1 elif(a[0]<a[1]): x=1 k+=1 for i in range(2,len(a)): if(a[i]>a[x]): k+=1 x=i elif(a[i]<a[y]): k+=1 y=i print(k)
7
PYTHON3
a = int(input()) b = [int(x) for x in input().split()] points = [b[0]] min_ = b[0] max_ = b[0] result = 0 for i in b[1:]: points.append(i) if max(points) != max_: max_ = max(points) result += 1 if min(points) != min_: min_ = min(points) result += 1 print(result)
7
PYTHON3
n=int(input()) aList=[int(x) for x in input().split()] a=aList[0] amin=a amax=a k=0 for i in aList[1:]: if i>amax: k+=1 amax=i if i<amin: k+=1 amin=i print(k)
7
PYTHON3
n = int(input()) results = input().split(" ") maxr = int(results[0]) minr = int(results[0]) score = 0 for r in range(0, n): if int(results[r]) > int(maxr): score += 1 maxr = results[r] if int(results[r]) < int(minr): score += 1 minr = results[r] print(score)
7
PYTHON3
n = int(input()) scores = [int(x) for x in input().split()] amazing = 0 lowest = highest = scores[0] for score in scores[1:]: if score> highest: amazing+=1 highest = score elif score < lowest: amazing+=1 lowest = score print(amazing)
7
PYTHON3
input() a=list(map(int,input().split())) high=low=a[0] coolness_meter = 0 for score in a[1:]: if score > high: high = score coolness_meter += 1 if score < low: low = score coolness_meter += 1 print(coolness_meter)
7
PYTHON3
n = int(input()) l = list(map(int,input().split())) mn = l[0] mx = l[0] ans = 0 for i in range(1,n): if(l[i]<mn or l[i]>mx): ans+=1 mn = min(mn,l[i]) mx = max(mx,l[i]) print(ans)
7
PYTHON3
n = int(input()) tab = list(map(int, input().split())) minimum = 1e10 maksimum = 0 ile = 0 for i in range(1, len(tab)): minimum = min(tab[i-1], minimum) maksimum = max(tab[i-1], maksimum) if tab[i] < minimum: ile += 1 if tab[i] > maksimum: ile += 1 print(ile)
7
PYTHON3
n = int(input()) arr = list(map(int, input().split())) ans = 0 mx = arr[0] mn = arr[0] for i in range(1,n): if arr[i]>mx or arr[i]<mn: ans += 1 if arr[i]>mx: mx= arr[i] elif arr[i]<mn: mn = arr[i] print(ans)
7
PYTHON3
n=int(input()) a=[int(i) for i in input().split()] max_score=a[0] min_score=a[0] number=0 for i in range(1,n): if a[i]>max_score: number+=1 max_score=a[i] if a[i]<min_score: number+=1 min_score=a[i] print(number)
7
PYTHON3
n=int(input()) l=list(map(int,input().split())) a=[] count=0 a.append(l[0]) for i in range (1,n): if(l[i]>max(a)): count=count+1 elif(l[i]<min(a)): count=count+1 a.append(l[i]) print(count)
7
PYTHON3
# import sys # sys.stdin = open("test.in","r") # sys.stdout = open("test.out","w") n=int(input()) a=list(map(int,input().split())) b=0 for i in range(1,n): if a[i]>max(a[0:i]) or a[i]<min(a[0:i]): b+=1 print(b)
7
PYTHON3
n = int(input()) score = [int(k) for k in input().split()] highest = score[0] lowest = score[0] amazing = 0 for i in range(1,n): if score[i] > highest: amazing += 1 highest = score[i] elif score[i] < lowest: amazing += 1 lowest = score[i] print(amazing)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sum = 0, i = 0, maxi, mini; long long x[10000]; cin >> n; k = n; while (k--) cin >> x[i++]; maxi = x[0]; mini = x[0]; i = 1; while (i < n) { if (x[i] > maxi) { maxi = x[i]; sum++; } else if (x[i] < mini) { mini = x[i]; sum++; } i++; } cout << sum << endl; return 0; }
7
CPP
n = int(input()) arr = list(map(int, input().split())) amazing = 0 maxscore = arr[0] minscore = arr[0] for i in range(1, n): if arr[i] > maxscore: maxscore = arr[i] amazing += 1 elif arr[i] < minscore: minscore = arr[i] amazing += 1 print(amazing)
7
PYTHON3
input() a = list(map(int,input().split())) c = 0 h = a[0] l = a[0] for i in a: if i > h: h = i c += 1 if i < l: l = i c += 1 print(c)
7
PYTHON3
n = int(input()) f_line = input() f_arr = [int(y) for y in f_line.split()] worst = f_arr[0] best = f_arr[0] count = 0 for i in range(1, n): if f_arr[i] < worst: count += 1 worst = f_arr[i] elif f_arr[i] > best: count += 1 best = f_arr[i] else: pass print(count)
7
PYTHON3
def main(): x = input() y = input().split() maxi = int(y[0]) mini = int(y[0]) amazing = 0 for i in y: score = int(i) if score > maxi: maxi = score amazing += 1 elif score < mini: mini = score amazing += 1 else: pass print(amazing) if __name__ == '__main__':main()
7
PYTHON3
n = int ( input ( )) a=list(map(int,input().split())) q=0 for i in range(1,n): if ((a[i]>max(a[:i])) or (a[i]<min(a[:i]))): q+=1 print(q)
7
PYTHON3
import math n=int(input()) c=0; l=list(map(int,input().strip().split(" "))) mx=l[0] mn=l[0] for i in range(1,n,1): 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()) a = [int(x) for x in input().split()] ma = a[0] mi = a[0] c = 0 for i in range(1,len(a)): if a[i] < mi: mi = a[i] c = c + 1 elif a[i] > ma: ma = a[i] c = c + 1 else: c = c print(c)
7
PYTHON3
# https://codeforces.com/problemset/problem/155/A n = int(input()) scores = tuple(map(int, input().split())) ans = 0 min_value, max_value = scores[0], scores[0] if n == 1: print(0) else: for i in range(1, n): if scores[i] > max_value: max_value = scores[i] ans += 1 elif scores[i] < min_value: min_value = scores[i] ans += 1 print(ans)
7
PYTHON3
n = int(input()) numbers = list(map(int, input().split())) min_v = numbers[0] max_v = numbers[0] count = 0 for i in range(1, n): if numbers[i] < min_v: min_v = numbers[i] count += 1 if numbers[i] > max_v: max_v = numbers[i] count += 1 print(count)
7
PYTHON3
n = int(input()) t = [int(x) for x in input().split()] k = 0 l = t[0] m = t[0] for i in range(1,n): if t[i] > l: k += 1 l = t[i] elif t[i] < m: k += 1 m = t[i] print(k)
7
PYTHON3
n = int(input()) a = input().split() m = 0 for i in range(n): a[i] = int(a[i]) b = [a[0],a[0]] for i in range(1,n): if a[i] < b[0]: b[0] = a[i] m += 1 if a[i] > b[1]: b[1] = a[i] m += 1 print(m)
7
PYTHON3
n = int(input()) contests = list(map(int,input().split())) maxx = contests[0] minn = contests[0] amazing = 0 for i in range(n): if contests[i] > maxx: amazing += 1 maxx = contests[i] elif contests[i] < minn: amazing += 1 minn = contests[i] print(amazing)
7
PYTHON3