message
stringlengths
2
43.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
853
107k
cluster
float64
24
24
__index_level_0__
int64
1.71k
214k
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,689
24
39,378
Tags: implementation, math Correct Solution: ``` import math def get_lcm(n1, n2): # find gcd gcd = math.gcd(n1, n2) # formula result = (n1 * n2) / gcd return result class CodeforcesTask173ASolution: def __init__(self): self.result = '' self.rounds = 0 self.n_str = ''...
output
1
19,689
24
39,379
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,690
24
39,380
Tags: implementation, math Correct Solution: ``` Q=lambda x,y:Q(y%x,x)if x else y I=input R=range n=int(I()) s=I() p=I() G=len(p)//Q(len(s),len(p))*len(s) s*=G//len(s) p*=G//len(p) a=b=0 for i in R(G): t=s[i]+p[i] if t=='RS'or t=='SP'or t=='PR':a+=1 elif t=='SR'or t=='PS' or t=='RP':b+=1 a*=(n//G) b*=(n//G) for i in...
output
1
19,690
24
39,381
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,691
24
39,382
Tags: implementation, math Correct Solution: ``` n = int(input()) a = input() b = input() ai = 0 alen = len(a) bi = 0 blen = len(b) nik = 0 pol = 0 if alen == blen: rnd = alen else: rnd = alen*blen numofrounds = 0 for i in range(n): #print(i,rnd) if i == rnd: numofrounds = n//rnd # print(numofro...
output
1
19,691
24
39,383
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,692
24
39,384
Tags: implementation, math Correct Solution: ``` def gcd(a, b): c = a % b return gcd(b, c) if c else b def f(k, m, n): p = {} for i in range(m * k + 1, 0, -k): j = m - (i - 1 - n) % m for d in range(j - n, n, m): p[d] = i return p n, a, b = int(input()), input()...
output
1
19,692
24
39,385
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,693
24
39,386
Tags: implementation, math Correct Solution: ``` n=int(input()) aa,bb=0,0 a=list(input()) b=list(input()) rp=[] i=0 while( 1 ): if a[i%len(a)]=="R": if b[i%len(b)]=="P": bb+=1 elif b[i%len(b)]=="S": aa+=1 elif a[i%len(a)]=="P": if b[i%len(b)]=="R": aa+=1 elif b[i%len(b)]=="S": bb+=1 else: if b...
output
1
19,693
24
39,387
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,694
24
39,388
Tags: implementation, math Correct Solution: ``` import sys rounds=int(sys.stdin.readline().strip('\n')) def Solution(): global rounds s_A=list(map(str, sys.stdin.readline().rstrip('\n'))) s_B=list(map(str, sys.stdin.readline().rstrip('\n'))) if rounds<=len(s_A): s_A=s_A[0:rounds] if ...
output
1
19,694
24
39,389
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,695
24
39,390
Tags: implementation, math Correct Solution: ``` import math import itertools as it n = int(input()) a, b = input(), input() lcm = len(a) // math.gcd(len(a), len(b)) * len(b) a, b = it.cycle(a), it.cycle(b) res = {'RR': 0, 'SS': 0, 'PP': 0, 'RS': 'P', 'SP': 'P', 'PR': 'P', 'RP': 'N', 'SR': 'N', 'PS': 'N'} v = [] for...
output
1
19,695
24
39,391
Provide tags and a correct Python 3 solution for this coding contest problem. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items inde...
instruction
0
19,696
24
39,392
Tags: implementation, math Correct Solution: ``` n=int(input()) finale=[] co=0;fco=0; s=input() s1=input() ssize=len(s) s1size=len(s1) s=s1size*s s1=ssize*s1 for i in range(0,len(s)): if (s[i]=='R' and s1[i]=='P'): fco+=1 if (s[i]=='R' and s1[i]=='S'): co+=1 if (s[i]=='S' and s1[i]=='P'): co+=1 if (...
output
1
19,696
24
39,393
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,697
24
39,394
Yes
output
1
19,697
24
39,395
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,698
24
39,396
Yes
output
1
19,698
24
39,397
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,699
24
39,398
Yes
output
1
19,699
24
39,399
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,700
24
39,400
Yes
output
1
19,700
24
39,401
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,701
24
39,402
No
output
1
19,701
24
39,403
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,702
24
39,404
No
output
1
19,702
24
39,405
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,703
24
39,406
No
output
1
19,703
24
39,407
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each r...
instruction
0
19,704
24
39,408
No
output
1
19,704
24
39,409
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,318
24
40,636
Tags: implementation Correct Solution: ``` q=int(input()) o,x,y=input().split() x=int(x) y=int(y) arz=min(x,y) tool=max(x,y) ans="" for i in range(1,q): o,x,y=input().split() x=int(x) y=int(y) if x>y: x,y=y,x if o=="+": if x>arz: arz=x if y>tool: tool=y else: if x<arz or y<tool: ans+="NO\n" els...
output
1
20,318
24
40,637
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,319
24
40,638
Tags: implementation Correct Solution: ``` import sys MOD = 10**9 + 7 I = lambda:list(map(int,input().split())) from math import * from time import time from io import StringIO as stream from atexit import register def sync_with_stdio(sync=True): global input, flush if sync: flush = sys.stdout.flush ...
output
1
20,319
24
40,639
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,320
24
40,640
Tags: implementation Correct Solution: ``` def sync_with_stdio(): import sys from io import StringIO as stream from atexit import register global input sys.stdin = stream(sys.stdin.read()) input = lambda: sys.stdin.readline().rstrip('\r\n') sys.stdout = stream() register(lambda: sys.__stdout__.write(sys.stdou...
output
1
20,320
24
40,641
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,321
24
40,642
Tags: implementation Correct Solution: ``` import sys lax = -10**9;lay = -10**9 for _ in range(int(input())) : sign,x,y = map(str,sys.stdin.readline().split()) x=int(x) y=int(y) if sign=="+" : if y > x : t=x x=y y=t lax = max(x,lax) lay = max(y,lay) else : if y > x : ...
output
1
20,321
24
40,643
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,322
24
40,644
Tags: implementation Correct Solution: ``` n = input() max_x = None max_y = None arr = [] inputs = [] for i in range(int(n)): _input = input() inputs.append(_input) for _input in inputs: _input = _input.split(' ') if _input[0] == '+': x = int(_input[1]) y = int(_input[2]) i...
output
1
20,322
24
40,645
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,323
24
40,646
Tags: implementation Correct Solution: ``` x,y = 0,0 res = '' n = int(input()) for _ in range(n): q = [i for i in input().split()] q[1] = int(q[1]) q[2] = int(q[2]) if q[0] == '+': x = max(x, min(q[1], q[2])) y = max(y, max(q[1], q[2])) elif x <= min(q[1], q[2]) and y <= max(q[1], q[...
output
1
20,323
24
40,647
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,324
24
40,648
Tags: implementation Correct Solution: ``` import io, os input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline maxw, maxh = 0,0 for _ in range(int(input())): x = input().split() w, h = map(int, x[1:]) if h > w: w,h = h,w if x[0] == '+': if w > maxw: maxw = w if h > maxh: maxh = h else: print...
output
1
20,324
24
40,649
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squa...
instruction
0
20,325
24
40,650
Tags: implementation Correct Solution: ``` a=b=0 s='' for f in range(int(input())): i=input().split() x=min(int(i[1]),int(i[2])) y=max(int(i[1]),int(i[2])) if i[0]=='?': if x<a or y<b:s+='NO\n' else:s+='YES\n' else: a,b=max(a,x),max(b,y) print(s[:-1]) ```
output
1
20,325
24
40,651
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,326
24
40,652
Yes
output
1
20,326
24
40,653
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,327
24
40,654
Yes
output
1
20,327
24
40,655
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,328
24
40,656
Yes
output
1
20,328
24
40,657
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,329
24
40,658
Yes
output
1
20,329
24
40,659
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,330
24
40,660
No
output
1
20,330
24
40,661
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,331
24
40,662
No
output
1
20,331
24
40,663
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,332
24
40,664
No
output
1
20,332
24
40,665
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all ...
instruction
0
20,333
24
40,666
No
output
1
20,333
24
40,667
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,452
24
40,904
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` import sys, math import io, os #data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline #from bisect import bisect_left as bl, bisect_right as br, insort #from heapq import heapify, heappush, heappop #from collections ...
output
1
20,452
24
40,905
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,453
24
40,906
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() ...
output
1
20,453
24
40,907
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,454
24
40,908
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` from sys import stdin, stdout # 1 5 # 0 10 # 1 -5 # 0 5 # 1 11 # 0 -10 # # (5) => 5 # (5) 10 => 5 + 2*10 # 10 => 10 # 10 5 => 15 # 10 5 (11) => 11 + 2*10 + 5 = 36 # 5 (11) => 11 + 2*5 = 21 # 1-11 (sum, cnt) # ...
output
1
20,454
24
40,909
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,455
24
40,910
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` import io import os from collections import Counter, defaultdict, deque # Based on https://raw.githubusercontent.com/cheran-senthil/PyRival/master/pyrival/data_structures/SortedList.py # Modified to do range sum queries...
output
1
20,455
24
40,911
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,456
24
40,912
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` class BalancingTree: def __init__(self, n): self.N = n self.root = self.node(1<<n, 1<<n) def debug(self): def debug_info(nd_): return (nd_.value - 1, nd_.pivot , nd_.left.value...
output
1
20,456
24
40,913
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,457
24
40,914
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() ...
output
1
20,457
24
40,915
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,458
24
40,916
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` #!/usr/bin/env python3 import sys input = sys.stdin.readline class SegmentTree: def __init__(self, a): # Operator self.op = lambda a, b : a + b # Identity element self.e = 0 ...
output
1
20,458
24
40,917
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monste...
instruction
0
20,459
24
40,918
Tags: binary search, data structures, greedy, implementation, math, sortings Correct Solution: ``` from math import inf, log2 class SegmentTree: def __init__(self, array, func=max): self.n = len(array) self.size = 2**(int(log2(self.n-1))+1) if self.n != 1 else 1 self.func = func se...
output
1
20,459
24
40,919
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,460
24
40,920
Yes
output
1
20,460
24
40,921
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,461
24
40,922
Yes
output
1
20,461
24
40,923
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,462
24
40,924
Yes
output
1
20,462
24
40,925
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,463
24
40,926
Yes
output
1
20,463
24
40,927
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,464
24
40,928
No
output
1
20,464
24
40,929
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,465
24
40,930
No
output
1
20,465
24
40,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,466
24
40,932
No
output
1
20,466
24
40,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells. There are two types of spells: fire spell of power x deals x damage to the monster, and lightnin...
instruction
0
20,467
24
40,934
No
output
1
20,467
24
40,935
Provide tags and a correct Python 3 solution for this coding contest problem. "Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some conside...
instruction
0
21,363
24
42,726
Tags: greedy Correct Solution: ``` n = int(input()) ns = [int(x) for x in input().split()] ok = [False]*n for ni in ns: ni-=1 if ni<n: ok[ni]=True print(sum([1 for isOK in ok if not isOK])) ```
output
1
21,363
24
42,727
Provide tags and a correct Python 3 solution for this coding contest problem. "Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some conside...
instruction
0
21,364
24
42,728
Tags: greedy Correct Solution: ``` n = int(input()) nums = set(map(int, input().split())) count = 0 for i in range(1, n + 1): if i not in nums: count += 1 print(count) ```
output
1
21,364
24
42,729