message
stringlengths
2
65.1k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
0
108k
cluster
float64
14
14
__index_level_0__
int64
0
217k
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,322
14
202,644
Tags: greedy, implementation, math Correct Solution: ``` from math import ceil, inf for _ in range(int(input())): n=int(input()) a=[int(X)-1 for X in input().split()] x=[] z=[0]*n for i in range(n): z[a[i]]+=1 for i in z: if i: x.append(i) x.sort() # print(x)...
output
1
101,322
14
202,645
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,323
14
202,646
Tags: greedy, implementation, math Correct Solution: ``` """ Satwik_Tiwari ;) . 12th Sept , 2020 - Saturday """ #=============================================================================================== #importing some useful libraries. from __future__ import division, print_function from fractions imp...
output
1
101,323
14
202,647
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,324
14
202,648
Tags: greedy, implementation, math Correct Solution: ``` from math import ceil import sys input=sys.stdin.readline from collections import defaultdict as dd t=int(input()) while t: n=int(input()) d=dd(int) l=list(map(int,input().split())) for i in l: d[i]+=1 li=[] for i in d: li....
output
1
101,324
14
202,649
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,325
14
202,650
Tags: greedy, implementation, math Correct Solution: ``` import sys input = sys.stdin.readline res = [] t = int(input()) for _ in range(t): n = int(input()) l = map(int, input().split()) c = [0] * n for v in l: c[v-1] += 1 c.sort() c.reverse() while c[-1] == 0: c.pop() ...
output
1
101,325
14
202,651
Provide tags and a correct Python 3 solution for this coding contest problem. One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted...
instruction
0
101,334
14
202,668
Tags: constructive algorithms, implementation Correct Solution: ``` n = int(input()) *a, = map(int, input().split()) j = max(a) mn = min(a) d = {} for i in a: d[i] = d.get(i, 0) + 1 s = d[j] while j > mn: j -= 1 if d.get(j, 0) < s or not s: print('NO') exit() s *= -1 s += d.get(j, 0)...
output
1
101,334
14
202,669
Provide tags and a correct Python 3 solution for this coding contest problem. One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted...
instruction
0
101,337
14
202,674
Tags: constructive algorithms, implementation Correct Solution: ``` #https://codeforces.com/problemset/problem/128/D n = int(input()) a = list(map(int, input().split())) d = {} def push(d, x): if x not in d: d[x] = 0 d[x] += 1 def sub(d, x): d[x] -= 1 if d[x] == 0: del d[x] ...
output
1
101,337
14
202,675
Provide tags and a correct Python 3 solution for this coding contest problem. One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted...
instruction
0
101,338
14
202,676
Tags: constructive algorithms, implementation Correct Solution: ``` n=int(input()) g={} for i in list(map(int,input().split())):g[i]=g.get(i,0)+2 mx=max(g) for i in sorted(g)[:-1]: if i+1 not in g:exit(print('NO')) g[i+1]-=g[i] if g[i+1]<0:exit(print('NO')) print('YES'if g[mx]==0 and list(g.values()).count(0)==1else...
output
1
101,338
14
202,677
Provide tags and a correct Python 3 solution for this coding contest problem. One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted...
instruction
0
101,339
14
202,678
Tags: constructive algorithms, implementation Correct Solution: ``` from collections import Counter import string import bisect #import random import math import sys # sys.setrecursionlimit(10**6) from fractions import Fraction def array_int(): return [int(i) for i in sys.stdin.readline().split()] def vary(arrber_...
output
1
101,339
14
202,679
Provide tags and a correct Python 3 solution for this coding contest problem. One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted...
instruction
0
101,340
14
202,680
Tags: constructive algorithms, implementation Correct Solution: ``` n=int(input()) g={} for i in list(map(int,input().split())):g[i]=g.get(i,0)+2 mx=max(g) for i in sorted(g)[:-1]: if i+1 not in g:exit(print('NO')) g[i+1]-=g[i] if g[i+1]<0:exit(print('NO')) print('YES'if g[mx]==0 and list(g.values()).count(0)==1else...
output
1
101,340
14
202,681
Provide tags and a correct Python 3 solution for this coding contest problem. One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted...
instruction
0
101,341
14
202,682
Tags: constructive algorithms, implementation Correct Solution: ``` n=int(input()) g={} for i in list(map(int,input().split())):g[i]=g.get(i,0)+1 mx=max(g) for i in sorted(g)[:-1]: if i+1 not in g:exit(print('NO')) g[i+1]-=g[i] if g[i+1]<0:exit(print('NO')) print('YES'if g[mx]==0 and list(g.values()).count(0)==1else...
output
1
101,341
14
202,683
Provide a correct Python 3 solution for this coding contest problem. Problem Yamano Mifune Gakuen's 1st grade G group is a class where female students carrying misfortune gather. They face various challenges every day with the goal of being happy. In their class, they can take practical happiness courses as part of ...
instruction
0
101,997
14
203,994
"Correct Solution: ``` from itertools import product n, m, l = map(int, input().split()) subjects = [[] for _ in range(5)] for _ in range(m): d, a, k, t = map(int, input().split()) subjects[d].append((a, a + k - 1, t)) for i in range(5): subjects[i].sort(key=lambda x:x[1]) #各曜日の科目数ごとの最大幸福 def calcDp(i):...
output
1
101,997
14
203,995
Provide a correct Python 3 solution for this coding contest problem. Problem Yamano Mifune Gakuen's 1st grade G group is a class where female students carrying misfortune gather. They face various challenges every day with the goal of being happy. In their class, they can take practical happiness courses as part of ...
instruction
0
101,998
14
203,996
"Correct Solution: ``` # AOJ 1589 Unhappy Class # Python3 2018.7.13 bal4u N, M, L = map(int, input().split()) tbl = [[] for i in range(45)] for i in range(M): d, a, k, t = map(int, input().split()) tbl[d*N+a-1].append((k, t)) dp = [[0 for i in range(45)] for j in range(45)] for da in range(5*N): for i in range(L+1)...
output
1
101,998
14
203,997
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,285
14
204,570
Tags: greedy Correct Solution: ``` for i in range(int(input())): n=int(input()); print(n-input().split().count('2')) ```
output
1
102,285
14
204,571
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,286
14
204,572
Tags: greedy Correct Solution: ``` for _ in range(int(input())): n=int(input()) l=list(map(int,input().split())) d={1:0,2:0,3:0} for i in l: d[i]+=1 print(d[1]+d[3]) ```
output
1
102,286
14
204,573
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,287
14
204,574
Tags: greedy Correct Solution: ``` from sys import stdin input = stdin.readline def solution(): N = int(input()) R = list(map(int, input().split())) print(sum(r in [1, 3] for r in R)) if __name__ == '__main__': T = int(input()) for _ in range(T): solution() ```
output
1
102,287
14
204,575
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,288
14
204,576
Tags: greedy Correct Solution: ``` # cook your dish here for _ in range(int(input())): n = int(input()) r = list(map(int,input().split())) ans = 0 for x in r: if x == 1 or x == 3: ans += 1 print(ans) ```
output
1
102,288
14
204,577
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,289
14
204,578
Tags: greedy Correct Solution: ``` for _ in range(int(input())): n= int(input()) arr= list(map(int, input().split())) res = 0 for i in arr: if i ==1 or i==3: res+= 1 print(res) ```
output
1
102,289
14
204,579
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,290
14
204,580
Tags: greedy Correct Solution: ``` t = int(input()) while t > 0: t -= 1 n = int(input()) reviewer = [int(i) for i in input().strip().split(" ")] countLikes = 0 countDisLikes = 0 for r in reviewer: if r == 1: countLikes += 1 elif r == 2: countDisLikes += 1 ...
output
1
102,290
14
204,581
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,291
14
204,582
Tags: greedy Correct Solution: ``` from sys import stdin,stdout stdin.readline def mp(): return list(map(int, stdin.readline().strip().split())) def it():return int(stdin.readline().strip()) from collections import defaultdict as dd,Counter as C,deque from math import ceil,gcd,sqrt,factorial for _ in range(it()): n =...
output
1
102,291
14
204,583
Provide tags and a correct Python 3 solution for this coding contest problem. You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote. However, the site is not so simple on the inside. There are two se...
instruction
0
102,292
14
204,584
Tags: greedy Correct Solution: ``` t = int(input()) for _ in range(t): n = int(input()) ans = 0 a = [int(i) for i in input().split()] for i in a: if i == 1 or i == 3: ans += 1 print(ans) ```
output
1
102,292
14
204,585
Provide a correct Python 3 solution for this coding contest problem. Cosmic market, commonly known as Kozumike, is the largest coterie spot sale in the universe. Doujin lovers of all genres gather at Kozumike. In recent years, the number of visitors to Kozumike has been increasing. If everyone can enter from the begin...
instruction
0
102,844
14
205,688
"Correct Solution: ``` while True: r, c, q = map(int, input().split()) if r == 0: break querys = [list(map(int, input().split())) for _ in range(q)] querys.reverse() r_used = [False] * r c_used = [False] * c r_cnt = c c_cnt = r ans = 0 for a, b, o in querys: if a == 0: if not r_used[b]: ...
output
1
102,844
14
205,689
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,956
14
205,912
Tags: combinatorics, greedy Correct Solution: ``` import math def combination2(a): return math.factorial(a)/(math.factorial(2)*math.factorial(a-2)) n = int(input()) first_letter_table = { 'a' : 0, 'b' : 0, 'c' : 0, 'd' : 0, 'e' : 0, 'f' : 0, 'g' : 0, 'h' : 0, 'i' : 0, 'j'...
output
1
102,956
14
205,913
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,957
14
205,914
Tags: combinatorics, greedy Correct Solution: ``` n = int(input()) d = {} for i in range(n): s = input().strip()[0] if s not in d: d[s] = 0 d[s] += 1 ans = 0 for key in d.keys(): if d[key] <= 2: continue else: gr1 = d[key]//2 gr2 = d[key]-gr1 ans += gr1*(gr1-1...
output
1
102,957
14
205,915
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,958
14
205,916
Tags: combinatorics, greedy Correct Solution: ``` from collections import defaultdict def C2(n): return n*(n-1)/2 m = defaultdict(int) n = int(input()) for x in range(n): s = input() m[s[0]] += 1 ans = 0 for c in m: amt = m[c] mn = 1e9 for i in range(amt//2 + 1): mn = min(mn, C2(i) +...
output
1
102,958
14
205,917
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,959
14
205,918
Tags: combinatorics, greedy Correct Solution: ``` from collections import* a=Counter(input()[0]for _ in[0]*int(input())) r=0 for k in a:i=a[k]//2;j=a[k]-i;r+=i*(i-1)+j*(j-1) print(r//2) ```
output
1
102,959
14
205,919
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,960
14
205,920
Tags: combinatorics, greedy Correct Solution: ``` fact = [0] * 101 fact[1] = 1 for i in range(2, 101): fact[i] = fact[i - 1] * i def nCr(n, r): if n == r: return 1 return fact[n] // (fact[r] * fact[n - r]) def main(): n = int(input()) arr = [0] * n for i in range(n): arr[i] =...
output
1
102,960
14
205,921
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,961
14
205,922
Tags: combinatorics, greedy Correct Solution: ``` def chatty(N): return sum(e for e in range(1,N)) n = int(input()) a =[] b = [] for i in range(n): s = input() a.append(s) k = 0 while k<26: c = 0 for i in range(len(a)): if a[i][0]==chr(97+k): c = c+1 b.append(c) ...
output
1
102,961
14
205,923
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,962
14
205,924
Tags: combinatorics, greedy Correct Solution: ``` a=[];b=[];p=0 for i in range(int(input())): x=input()[0] if a.count(x)<=b.count(x): a.append(x) else: b.append(x) for i in range(len(a)-1): for t in range(i+1,len(a)): if a[i]==a[t]: p+=1 for i in range(len(b)-1): for t in range(i+1,len(b)): if b[i]==b[t...
output
1
102,962
14
205,925
Provide tags and a correct Python 3 solution for this coding contest problem. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same le...
instruction
0
102,963
14
205,926
Tags: combinatorics, greedy Correct Solution: ``` n = int(input()) l = [0] * 1000 for i in range(n): s = input() l[ord(s[0])] += 1 wyn = 0 for i in range(1000): if l[i] % 2 == 0: wyn += (l[i]//2)*(l[i]//2 - 1) else: wyn += (l[i]//2)*(l[i]//2 - 1)//2 wyn += ((l[i] + 1)//2)*((l[i]+ 1)//2 - 1)//2 print(wyn) ```
output
1
102,963
14
205,927
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,964
14
205,928
Yes
output
1
102,964
14
205,929
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,965
14
205,930
Yes
output
1
102,965
14
205,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,966
14
205,932
Yes
output
1
102,966
14
205,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,967
14
205,934
Yes
output
1
102,967
14
205,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,968
14
205,936
No
output
1
102,968
14
205,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,969
14
205,938
No
output
1
102,969
14
205,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,970
14
205,940
No
output
1
102,970
14
205,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two disti...
instruction
0
102,971
14
205,942
No
output
1
102,971
14
205,943
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,344
14
206,688
Tags: brute force, data structures, implementation Correct Solution: ``` import os import io input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline n, q = map(int, input().split()) last_2 = [-1] * n unread_count = [0] * n total_unread = 0 ev = [] max_3 = 0 ans = [] for i in range(q): t, x = map(int, input...
output
1
103,344
14
206,689
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,345
14
206,690
Tags: brute force, data structures, implementation Correct Solution: ``` from collections import defaultdict, deque q = deque() idx, total = 0, 0 vis = defaultdict(deque) not_valid = set() max_x = -1 ans = [] N, Q = map(int, input().split()) for _ in range(Q): t, x = map(int, input().split()) if t == 1: ...
output
1
103,345
14
206,691
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,346
14
206,692
Tags: brute force, data structures, implementation Correct Solution: ``` from heapq import * from collections import defaultdict, deque total = 0 N, Q = map(int, input().split()) q = deque() idx = 0 vis = defaultdict(deque) total = 0 not_valid = set() max_d = -1 ans = [] for _ in range(Q): t, x = map(int, input()....
output
1
103,346
14
206,693
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,347
14
206,694
Tags: brute force, data structures, implementation Correct Solution: ``` import collections import sys n, q = map(int, input().split()) # Key: app number, value: list of indexes in the arr hash = {} # arr = [] deque = collections.deque() messageNumber = 1 unread = 0 L = [] for i in range(q): c, x = map(int, input(...
output
1
103,347
14
206,695
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,348
14
206,696
Tags: brute force, data structures, implementation Correct Solution: ``` #!/usr/bin/env python #-*-coding:utf-8 -*- import collections n,q=map(int,input().split()) Q=collections.deque() A=n*[0] B=A[:] L=[] s=n=0 for _ in range(q): y,x=map(int,input().split()) if 2>y: x-=1 Q.append(x) B[x]+=1 A[x]+=1 s+=1 e...
output
1
103,348
14
206,697
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,349
14
206,698
Tags: brute force, data structures, implementation Correct Solution: ``` #!/usr/bin/env python #-*-coding:utf-8 -*- import sys,collections n,q=map(int,input().split()) M=collections.defaultdict(collections.deque) Q=collections.deque() L=[] s=n=m=0 for _ in range(q): y,x=map(int,input().split()) if 2>y: s+=1 Q.app...
output
1
103,349
14
206,699
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,350
14
206,700
Tags: brute force, data structures, implementation Correct Solution: ``` import collections n, q = map(int ,input().split()) Q = collections.deque() A = [0] * n B = A[:] L = [] s = n = 0 for k in range(q): type1, x = map(int, input().split()) if type1 == 1: x -= 1 Q.append(x) B[x] += 1 ...
output
1
103,350
14
206,701
Provide tags and a correct Python 3 solution for this coding contest problem. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by th...
instruction
0
103,351
14
206,702
Tags: brute force, data structures, implementation Correct Solution: ``` from sys import stdin input=stdin.readline n,q=map(int,input().split()) is_read_index=0 is_read=[] l=[[] for i in range(n)] ans=0 prev=0 for _ in range(q): t,v=map(int,input().split()) if t==1: l[v-1].append(is_read_index) is_read_inde...
output
1
103,351
14
206,703
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the...
instruction
0
103,352
14
206,704
Yes
output
1
103,352
14
206,705
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the...
instruction
0
103,353
14
206,706
Yes
output
1
103,353
14
206,707
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the...
instruction
0
103,354
14
206,708
Yes
output
1
103,354
14
206,709
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the...
instruction
0
103,355
14
206,710
Yes
output
1
103,355
14
206,711
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the...
instruction
0
103,356
14
206,712
No
output
1
103,356
14
206,713