message
stringlengths
2
28.7k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
21
109k
cluster
float64
7
7
__index_level_0__
int64
42
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Luba bought a monitor. Monitor is a rectangular matrix of size n × m. But then she started to notice that some pixels cease to work properly. Luba thinks that the monitor will become br...
instruction
0
40,909
7
81,818
No
output
1
40,909
7
81,819
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,047
7
82,094
"Correct Solution: ``` Num = int(input()) a = list(map(int, input().split())) k = 0 for i in range(1, Num): if a[i-1] == a[i]: a[i] = 0 k += 1 print(k) ```
output
1
41,047
7
82,095
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,048
7
82,096
"Correct Solution: ``` N = int(input()) A = list(map(int,input().split())) ans = 0 for i in range(1,N): if A[i] == A[i-1]: A[i] = 0 ans += 1 print(ans) ```
output
1
41,048
7
82,097
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,049
7
82,098
"Correct Solution: ``` n=int(input());a=list(map(int,input().split()));i=l=0 while True: if i>n-1:break j=i while j<n-1 and a[j+1]==a[j]:j+=1 l+=(j-i+1)//2;i=j+1 print(l) ```
output
1
41,049
7
82,099
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,050
7
82,100
"Correct Solution: ``` n=int(input()) arr=list(map(int,input().split())) cnt=0 for i in range(1,n): if arr[i]==arr[i-1]: arr[i]='x' cnt+=1 print(cnt) ```
output
1
41,050
7
82,101
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,051
7
82,102
"Correct Solution: ``` n=int(input()) a=list(map(int,input().split())) ans=0 now=0 for i in range(n): if now != a[i]: now=a[i] else: now=0 ans+=1 print(ans) ```
output
1
41,051
7
82,103
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,052
7
82,104
"Correct Solution: ``` N = int(input()) A = [int(i) for i in input().split()] cnt = 0 for i in range(1, N): if A[i-1] == A[i]: A[i] = -1 cnt += 1 print(cnt) ```
output
1
41,052
7
82,105
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,053
7
82,106
"Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) b = 101 cnt = 0 for i in range(n-1): if a[i] == a[i+1]: cnt += 1 a[i+1] = b b += 1 print (cnt) ```
output
1
41,053
7
82,107
Provide a correct Python 3 solution for this coding contest problem. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime fro...
instruction
0
41,054
7
82,108
"Correct Solution: ``` #!/usr/bin/env python3 n = int(input()) a = list(map(int, input().split())) for i in range(1, n): if a[i] == a[i - 1]: a[i] = -1 print(a.count(-1)) ```
output
1
41,054
7
82,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,055
7
82,110
Yes
output
1
41,055
7
82,111
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,056
7
82,112
Yes
output
1
41,056
7
82,113
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,057
7
82,114
Yes
output
1
41,057
7
82,115
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,058
7
82,116
Yes
output
1
41,058
7
82,117
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,059
7
82,118
No
output
1
41,059
7
82,119
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,060
7
82,120
No
output
1
41,060
7
82,121
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,061
7
82,122
No
output
1
41,061
7
82,123
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000. Takahashi has N slimes, and they are standing in a...
instruction
0
41,062
7
82,124
No
output
1
41,062
7
82,125
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the ...
instruction
0
41,218
7
82,436
Tags: bitmasks, brute force, dfs and similar, dp, graphs Correct Solution: ``` class UnionFind(): def __init__(self, size): self.table = [-1 for _ in range(size)] def find(self, x): if self.table[x] < 0: return x else: self.table[x] = self.find(self.table[x]) return self.table[x] def union(self, x, ...
output
1
41,218
7
82,437
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the ...
instruction
0
41,219
7
82,438
Tags: bitmasks, brute force, dfs and similar, dp, graphs Correct Solution: ``` n=int(input()) score00=[0]*4 grid=[] for i in range(4): grid.append([]) for j in range(4): grid[-1].append([]) for i in range(n): a,x,b=map(int,input().split()) if a==b: score00[a-1]+=x continue if b<a: tmp=a a=...
output
1
41,219
7
82,439
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the ...
instruction
0
41,220
7
82,440
Tags: bitmasks, brute force, dfs and similar, dp, graphs Correct Solution: ``` # import collections, atexit, math, sys, bisect sys.setrecursionlimit(1000000) def getIntList(): return list(map(int, input().split())) try : #raise ModuleNotFoundError import numpy def dprint(*args, **kwargs): ...
output
1
41,220
7
82,441
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the ...
instruction
0
41,221
7
82,442
Tags: bitmasks, brute force, dfs and similar, dp, graphs Correct Solution: ``` def min(a, b): if a < b: return a return b def max(a,b): return abs(min(-a,-b)) been = [0 for i in range(4)] ans = 0 minw = 10**18 degpar = [0 for i in range(4)] w = [0 for i in range(4)] gr = [list() for i in range(4)] r...
output
1
41,221
7
82,443
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the ...
instruction
0
41,222
7
82,444
Tags: bitmasks, brute force, dfs and similar, dp, graphs Correct Solution: ``` n=int(input()) mv = 10**9 f = [0 for i in range(4)] adj = [[i == j for j in range(4)] for i in range(4)] w = [0 for i in range(4)] for _ in range(n): a,v,b=map(int,input().split()) a-=1 b-=1 if a!=b: mv = min(mv, v) f[a]^=1 f[b]^=1 w[...
output
1
41,222
7
82,445
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the ...
instruction
0
41,223
7
82,446
Tags: bitmasks, brute force, dfs and similar, dp, graphs Correct Solution: ``` from random import randint values = [[] for _ in range(10)] types = [[0, 1, 2, 3], [1, 4, 5, 6], [2, 5, 7, 8], [3, 6, 8, 9]] b = [1]*10 B = 128 for i in range(9): b[i+1] = b[i]*B for i in range(4): values[types[i][i]].append(0) n ...
output
1
41,223
7
82,447
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the ...
instruction
0
41,224
7
82,448
Tags: bitmasks, brute force, dfs and similar, dp, graphs Correct Solution: ``` class Domino: def __init__(self,side1,side2,value,double,parts): self.side1=side1 self.side2=side2 self.value=value self.double=double #True/False self.parts=parts def __repr__(self): ...
output
1
41,224
7
82,449
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the tou...
instruction
0
41,225
7
82,450
No
output
1
41,225
7
82,451
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the tou...
instruction
0
41,226
7
82,452
No
output
1
41,226
7
82,453
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the tou...
instruction
0
41,227
7
82,454
No
output
1
41,227
7
82,455
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the tou...
instruction
0
41,228
7
82,456
No
output
1
41,228
7
82,457
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,252
7
82,504
Tags: greedy, sortings Correct Solution: ``` import sys input = sys.stdin.readline n,k=map(int,input().split()) A=list(map(int,input().split())) if n<k: print("NO") sys.exit() LIST=[[] for i in range(max(A)+1)] for i in range(n): LIST[A[i]].append(i) for li in LIST: if len(li)>k: print("NO"...
output
1
41,252
7
82,505
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,253
7
82,506
Tags: greedy, sortings Correct Solution: ``` n, m = map(int, input().split()) tmp = list(map(int, input().split())) a = [] for i in range (n): a.append([tmp[i], i]) # a = list(map(int, input().split())) b = [0 for i in range (5003)] ans = [0 for i in range (n)] a.sort() cnt = 0 for i in a: if (b[i[0]] == 0): b[i...
output
1
41,253
7
82,507
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,254
7
82,508
Tags: greedy, sortings Correct Solution: ``` n,k = map(int,input().split()) wallList = list(map(int,input().split())) walls = {} for i,w in enumerate(wallList): temp = walls.get(w,[]) temp.append(i) walls[w] = temp if n >=k and max(map(len,walls.values())) <= k : r = ['1']*n c = 1 for w in wal...
output
1
41,254
7
82,509
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,255
7
82,510
Tags: greedy, sortings Correct Solution: ``` n, k = list(map(int, input().split())) a = list(map(int, input().split())) ok, d = True, {} for item in a: d[item] = d.get(item, 0) + 1 if d[item] > k: ok = False break if not ok or n < k: print("NO") else: aa = zip(list(range(0, n)), a) ...
output
1
41,255
7
82,511
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,256
7
82,512
Tags: greedy, sortings Correct Solution: ``` from collections import Counter n,k = list(map(int,input().split())) a = list(map(int,input().split())) d = {} out = [] for i in a: d[i] = d.get(i, 0)+1 out.append(d[i]) mv = max(out) if mv>k or k>n: print("NO") else: print("YES") if k==mv: print(...
output
1
41,256
7
82,513
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,257
7
82,514
Tags: greedy, sortings Correct Solution: ``` from collections import defaultdict as dfd n, k = map(int, input().split()) arr = list(map(int, input().split())) d = dfd(int) for i in arr: d[i] += 1 if k>n: print("NO") elif k==n: print("YES") print(*[i for i in range(1, len(arr)+1)]) else: flag = 0 ...
output
1
41,257
7
82,515
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,258
7
82,516
Tags: greedy, sortings Correct Solution: ``` from collections import Counter from itertools import cycle def main(): n, k = map(int, input().split()) a = input().split() counts = Counter(a) if max(counts.values()) > k: print('NO') return print('YES') colors = cycle(range(1, k...
output
1
41,258
7
82,517
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one...
instruction
0
41,259
7
82,518
Tags: greedy, sortings Correct Solution: ``` n,k=map(int,input().split()) lst=list(map(int,input().split())) d={} lst2=[];lst3=[] for c in range(n): lst2.append([lst[c],c]) for c in lst: d[c]=d.get(c,0)+1 if max(d.values())>k: print("NO") exit(0) print("YES") lst2.sort() p=0 for c in range(n): lst3....
output
1
41,259
7
82,519
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,260
7
82,520
Yes
output
1
41,260
7
82,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,261
7
82,522
Yes
output
1
41,261
7
82,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,262
7
82,524
Yes
output
1
41,262
7
82,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,263
7
82,526
Yes
output
1
41,263
7
82,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,264
7
82,528
No
output
1
41,264
7
82,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,265
7
82,530
No
output
1
41,265
7
82,531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,266
7
82,532
No
output
1
41,266
7
82,533
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For ...
instruction
0
41,267
7
82,534
No
output
1
41,267
7
82,535
Provide tags and a correct Python 3 solution for this coding contest problem. We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2. However, there is one condition you must fulfill in order to receive...
instruction
0
41,284
7
82,568
Tags: constructive algorithms, greedy, math, number theory Correct Solution: ``` n = int(input()) l = list(map(int, input().split())) c1 = l.count(1) c2 = l.count(2) if(c1 == 0): ans = ["2"]*c2 elif(c1 < 3 and c2 > 0): ans = ["2"]+["1"]+["2"]*(c2-1)+["1"]*(c1-1) elif((c1%2) == 1): ans = ["1"]*c1+["2"]*c2 else...
output
1
41,284
7
82,569
Provide tags and a correct Python 3 solution for this coding contest problem. We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2. However, there is one condition you must fulfill in order to receive...
instruction
0
41,285
7
82,570
Tags: constructive algorithms, greedy, math, number theory Correct Solution: ``` n = int(input()) r = input().split() a = r.count('1') b = r.count('2') if a == 0: rez = b*'2' elif b == 0: rez = a*'1' else: rez = '21'+(b-1)*'2' + (a-1)*'1' print(' '.join(list(rez))) ```
output
1
41,285
7
82,571
Provide tags and a correct Python 3 solution for this coding contest problem. We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2. However, there is one condition you must fulfill in order to receive...
instruction
0
41,286
7
82,572
Tags: constructive algorithms, greedy, math, number theory Correct Solution: ``` # Allahumma SalliI Ala Muhammadiw Wa Ala Aali Muhammadin # Kamaa Sal’laita Ala Ibrahima Wa Ala Aali Ibrahima Inna’ka Hamidum Majid. # Allahumma Baarik Ala Muhammadiw Wa Ala Aali Muhammadin # Kamaa Baarakta Ala Ibrahima Wa Ala Aali Ibrahima...
output
1
41,286
7
82,573
Provide tags and a correct Python 3 solution for this coding contest problem. We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2. However, there is one condition you must fulfill in order to receive...
instruction
0
41,287
7
82,574
Tags: constructive algorithms, greedy, math, number theory Correct Solution: ``` n=int(input()) m=list(map(int,input().split())) a,b=0,0 for i in m: if i==1: a+=1 else: b+=1 if a>=3: print("1 1 1 "+"2 "*b+"1 "*(a-3)) elif a==2 and b>0: print("2 "+"1 "+"2 "*(b-1)+"1") elif a==2 an...
output
1
41,287
7
82,575
Provide tags and a correct Python 3 solution for this coding contest problem. We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2. However, there is one condition you must fulfill in order to receive...
instruction
0
41,288
7
82,576
Tags: constructive algorithms, greedy, math, number theory Correct Solution: ``` from collections import Counter from sys import exit N = int(input()) A = list(map(int, input().split())) CA = Counter(A) if N == 1: print(*A) exit() if N == 2: A.sort(reverse = True) print(*A) exit() if CA[1] == 0: ...
output
1
41,288
7
82,577
Provide tags and a correct Python 3 solution for this coding contest problem. We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2. However, there is one condition you must fulfill in order to receive...
instruction
0
41,289
7
82,578
Tags: constructive algorithms, greedy, math, number theory Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) aset = set(a) if len(aset) == 1: print(' '.join(map(str, a))) else: count = [-1, -1] for elem in a: count[elem - 1] += 1 print(2, 1, end = ' ') for i in range...
output
1
41,289
7
82,579