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. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have recently learned about the orange and they decided...
instruction
0
49,949
14
99,898
Tags: implementation Correct Solution: ``` #!/usr/bin/env python3 from sys import stdin, stdout def solve(): n, k = map(int,stdin.readline().split()) li = list(map(int,stdin.readline().split())) vis = [-1 for i in range(n*k)] for i in range(k): vis[li[i]-1] = i ans = [list() for i in rang...
output
1
49,949
14
99,899
Provide tags and a correct Python 3 solution for this coding contest problem. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have recently learned about the orange and they decided...
instruction
0
49,950
14
99,900
Tags: implementation Correct Solution: ``` n,k=map(int,input().split()) l1=list(range(1,n*k+1)) l2=list(map(int,input().split())) d1={} for item in l2: d1[item]=1 x=0 for i in range(1,k+1): z=1 print(l2[i-1],end=" ") while z<n: if l1[x] not in l2: print(l1[x],end=" ") z+=...
output
1
49,950
14
99,901
Provide tags and a correct Python 3 solution for this coding contest problem. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have recently learned about the orange and they decided...
instruction
0
49,951
14
99,902
Tags: implementation Correct Solution: ``` # https://codeforces.com/problemset/problem/244/A # 900 n, k = map(int, input().split()) d = {} l = [] for s in input().split(): s = int(s) d[s] = True l.append(s) for s in l: print(s, end="") c = 1 for i in range(1, (n*k)+1): if d.get(i) is ...
output
1
49,951
14
99,903
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,952
14
99,904
Yes
output
1
49,952
14
99,905
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,953
14
99,906
Yes
output
1
49,953
14
99,907
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,954
14
99,908
Yes
output
1
49,954
14
99,909
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,955
14
99,910
Yes
output
1
49,955
14
99,911
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,956
14
99,912
No
output
1
49,956
14
99,913
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,957
14
99,914
No
output
1
49,957
14
99,915
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,958
14
99,916
No
output
1
49,958
14
99,917
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k. There were k children waiting for Ms Swan at home. The children have rec...
instruction
0
49,959
14
99,918
No
output
1
49,959
14
99,919
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,140
14
100,280
Tags: binary search, math Correct Solution: ``` def s(m): x = (1 + m) * m // 2 return x import sys n, q = map(int, input().split()) if q >= n: print(n) sys.exit(0) l, r = q, n while r - l > 1: m = (l + r) // 2 if n - q - s(m - q) <= 0: r = m else: l = m print(...
output
1
50,140
14
100,281
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,141
14
100,282
Tags: binary search, math Correct Solution: ``` def get_empty_before_birds(m, i): if i <= m + 1: return 0 t = i - (m + 1) return (t * (t + 1)) // 2 def get_total_empty_after_birds(m, i): return get_empty_before_birds(m, i) + i def get_birds(m, n): low, high = 1, n while True: ...
output
1
50,141
14
100,283
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,142
14
100,284
Tags: binary search, math Correct Solution: ``` n,m=map(int,input().split()) if m>=n: from sys import exit print(n);exit() i,j=m,n result=m item=m*(m+1)//2 while i+1<j: mid=(i+j)//2 if mid*(mid+1)//2-item>=n+m*(mid-m-1):j=mid else:i=mid if i*(i+1)//2-item>=n+m*(i-m-1):print(i) else:print(j) ```
output
1
50,142
14
100,285
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,143
14
100,286
Tags: binary search, math Correct Solution: ``` n,m = list(map(int,input().split())) if m>=n: print(n) else: k = n-m low,high = m,n l = float("inf") while(low<=high): mid = (low+high)//2 p = k+(mid-m)*m q = ((mid-m)*(2*(m+1)+(mid-m-1)))//2 if q>=p: l = min...
output
1
50,143
14
100,287
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,144
14
100,288
Tags: binary search, math Correct Solution: ``` import sys n, m = map(int, input().split()) if n <= m: print(n) sys.exit(0) else: l, r = m + 1, n base = m * (m - 1) // 2 while l != r: mid = (l + r) // 2 plus = n + base + (mid - m) * m minus = mid * (mid + 1) // 2 ...
output
1
50,144
14
100,289
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,145
14
100,290
Tags: binary search, math Correct Solution: ``` def f(n, m): sz = n n -= 1 step = 2 print('n = ', n) while n > 0: n += m n = min(n, sz) n -= step step += 1 print('n = ', n) return step - 1 n, m = map(int, input().split()) m = min(n, m) cnt = max(n - m, 0) l = 0 r = 10 ** 18 while l + 1 < r: m1 = (l...
output
1
50,145
14
100,291
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,146
14
100,292
Tags: binary search, math Correct Solution: ``` import math from decimal import Decimal a,b = map(int,input().split()) if a<=b: print(a) else: otvet = math.ceil((-1+(Decimal(1+8*(a-b))**Decimal(0.5)))/2)+b print(otvet) ```
output
1
50,146
14
100,293
Provide tags and a correct Python 3 solution for this coding contest problem. Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to bu...
instruction
0
50,147
14
100,294
Tags: binary search, math Correct Solution: ``` import sys import os def BS ( l, h, k): if h < l : return l mid = (l + h) // 2 if (mid*(mid+1)) >= 2*k : return BS ( l, mid-1, k ) else: return BS ( mid+1, h, k ) if __name__ == "__main__": # print ( sys.version ) # n = int(i...
output
1
50,147
14
100,295
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,172
14
100,344
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` read = lambda: map(int, input().split()) n, k, p = read() a, b = sorted(read()), sorted(read()) print(min(max(abs(b[i + d] - a[i]) + abs(b[i + d] - p) for i in range(n)) for d in range(k - n + 1))) ```
output
1
50,172
14
100,345
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,173
14
100,346
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` n,k,p = map(int,input().split()) a = [] b = [] temp = input().split() for i in range(n): a.append(int(temp[i])) temp = input().split() for i in range(k): b.append(int(temp[i])) list.sort(a) list.sort(b) mini = 0 for i in range(k-n+1): ...
output
1
50,173
14
100,347
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,174
14
100,348
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` n,k,p = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) a.sort() b.sort() #print(a) #print(b) def cost(j): if j < 0 or j + n - 1 >= k: return 1000000000000 maximum = 0 for ...
output
1
50,174
14
100,349
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,175
14
100,350
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` n, k, p = [int(i) for i in input().split()] A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] A.sort() B.sort() ans = 10**18 for start in range(k): curmax = 0 curans = 10**18 if start+n > k: ...
output
1
50,175
14
100,351
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,176
14
100,352
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` n, k, p = map(int, input().split()) a = sorted(list(map(int, input().split()))) b = sorted(list(map(int, input().split()))) res = 1e15 for i in range(k - n + 1): ma = 0 for j in range(n): te = abs(a[j] - b[i+j]) + abs(b[i+j] -...
output
1
50,176
14
100,353
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,178
14
100,356
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` N , M , P = map(int , input().split(" ") ) A = list(map(int , input().split(" ") ) ) B = list(map(int , input().split(" ") ) ) A = sorted(A) B = sorted(B) def check(HAHA): vis = [False for _ in range(N)] res = 0 for i in rang...
output
1
50,178
14
100,357
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,179
14
100,358
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` import sys from collections import defaultdict def calc(a,b,p): return abs(a-b) + abs(p-b) def main(): n, k, p= map(int,sys.stdin.readline().split()) a = list(map(int,sys.stdin.readline().split())) b = list(map(int,sys.stdin....
output
1
50,179
14
100,359
Provide tags and a correct Python 3 solution for this coding contest problem. Disclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to learn Russian :) Rick and Morty like to go to the ridge High Cry for crying loudly — there is an extraordinar...
instruction
0
50,193
14
100,386
Tags: binary search, bitmasks, combinatorics, data structures, divide and conquer Correct Solution: ``` n = int(input()) a = [int(i) for i in input().split()] l = [i for i in range(len(a))] r = [i for i in range(len(a))] for i in range(len(a)): while l[i]>=1 and a[i]|a[l[i]-1]<=a[i]: l[i] = l[l[i]-1] for j in r...
output
1
50,193
14
100,387
Provide tags and a correct Python 3 solution for this coding contest problem. Disclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to learn Russian :) Rick and Morty like to go to the ridge High Cry for crying loudly — there is an extraordinar...
instruction
0
50,194
14
100,388
Tags: binary search, bitmasks, combinatorics, data structures, divide and conquer Correct Solution: ``` import os,io,sys input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n=int(input()) a=list(map(int,input().split())) left=[] right=[] for i in range(31): left.append([-1]*n) right.append([n]*n) for i in ran...
output
1
50,194
14
100,389
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,824
14
101,648
Tags: dp, greedy Correct Solution: ``` class Solution(): def max_radiance(n, a, b, c): dp = [[0 for i in range(2)] for j in range(n+1)] dp[n-1][0] = a[n-1] dp[n-1][1] = b[n-1] # dp[i][0] - Max radiance for range [i:] when none on the left is yet fed # dp[i][1] - Max radiance for range [i:] when one of th...
output
1
50,824
14
101,649
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,825
14
101,650
Tags: dp, greedy Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) fed_left = {0 : a[0]} not_fed_left = {0 : b[0]} for i in range(1, n): fed_left[i] = max(fed_left[i-1] + b[i], not_fed_left[i-1] + a[i]) # max(fed left, f...
output
1
50,825
14
101,651
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,826
14
101,652
Tags: dp, greedy Correct Solution: ``` def main(): n = int(input()) a = list(map(int, input().split(' '))) b = list(map(int, input().split(' '))) c = list(map(int, input().split(' '))) d0 = [0]*n d0[n-1] = a[n-1] d1 = [0]*n d1[n-1] = b[n-1] for i in range(n-2, -1, -1): d0[i]...
output
1
50,826
14
101,653
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,827
14
101,654
Tags: dp, greedy Correct Solution: ``` from sys import setrecursionlimit setrecursionlimit(10 ** 6) def dynamic(i, fed): if d[i][fed] is not None: return d[i][fed] if fed: d[i][fed] = max(b[i] + dynamic(i + 1, True), c[i] + dynamic(i + 1, False)) else: d[i][fed] = max(a[i] + dynamic(...
output
1
50,827
14
101,655
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,828
14
101,656
Tags: dp, greedy Correct Solution: ``` import sys sys.setrecursionlimit(5000) dp = [[-1 for i in range(5)] for j in range(3005)] n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) def fun(i ,n ,idx): if dp[i][idx]!=-1:return dp[i][idx] if id...
output
1
50,828
14
101,657
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,829
14
101,658
Tags: dp, greedy Correct Solution: ``` n=int(input()) a=list(map(int,input().strip().split())) b=list(map(int,input().strip().split())) c=list(map(int,input().strip().split())) d1,d2=a[0],b[0] for i in range(1,n): d1,d2=max(d1+b[i],d2+a[i]),max(d1+c[i],d2+b[i]) print (d1) ```
output
1
50,829
14
101,659
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,830
14
101,660
Tags: dp, greedy Correct Solution: ``` n = int( input() ) a = [int(x) for x in input().split()] b = [int(x) for x in input().split()] c = [int(x) for x in input().split()] DD = a[0] DP = b[0] PD = a[0] PP = b[0] for i in range(1,n): tDD = max(DP+a[i], PP+a[i]) tPD = max(PD+b[i], DD+b[i]) tDP = max(DP+b[i], PP+b[i]...
output
1
50,830
14
101,661
Provide tags and a correct Python 3 solution for this coding contest problem. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a ro...
instruction
0
50,831
14
101,662
Tags: dp, greedy Correct Solution: ``` n = int(input()) a, b, c = (list(map(int, input().split())) for i in range(3)) u, v = a[0], b[0] for i in range(1, n): u, v = max(v + a[i], u + b[i]), max(v + b[i], u + c[i]) print(u) ```
output
1
50,831
14
101,663
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,832
14
101,664
Yes
output
1
50,832
14
101,665
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,833
14
101,666
Yes
output
1
50,833
14
101,667
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,834
14
101,668
Yes
output
1
50,834
14
101,669
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,835
14
101,670
Yes
output
1
50,835
14
101,671
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,836
14
101,672
Yes
output
1
50,836
14
101,673
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,837
14
101,674
No
output
1
50,837
14
101,675
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,838
14
101,676
No
output
1
50,838
14
101,677
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,839
14
101,678
No
output
1
50,839
14
101,679
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna...
instruction
0
50,840
14
101,680
No
output
1
50,840
14
101,681
Provide tags and a correct Python 3 solution for this coding contest problem. The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends messages to his contacts a...
instruction
0
50,888
14
101,776
Tags: constructive algorithms, dfs and similar, graphs, greedy Correct Solution: ``` def main(): import sys tokens = sys.stdin.read().split() tokens.reverse() n = int(tokens.pop()) mat = [[int(j) for j in tokens.pop()] for i in range(n)] prediction = [int(tokens.pop()) for i in range(n...
output
1
50,888
14
101,777
Provide tags and a correct Python 3 solution for this coding contest problem. The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends messages to his contacts a...
instruction
0
50,889
14
101,778
Tags: constructive algorithms, dfs and similar, graphs, greedy Correct Solution: ``` n=int(input().strip()) nums=['']+[' '+input().strip() for _ in range(n)] a=[0]+list(map(int,input().split())) def send(x): for i in range(1,n+1): if nums[x][i]=='1': a[i]-=1 vis=[0]*(n+1) while True: for...
output
1
50,889
14
101,779
Provide tags and a correct Python 3 solution for this coding contest problem. The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends messages to his contacts a...
instruction
0
50,890
14
101,780
Tags: constructive algorithms, dfs and similar, graphs, greedy Correct Solution: ``` """ Codeforces Looksery Cup 2015 Problem B Author : chaotic_iak Language: Python 3.4.2 """ ################################################### SOLUTION def check(a, b): for i in range(len(a)): if a[i] == b[i]: return i ...
output
1
50,890
14
101,781
Provide tags and a correct Python 3 solution for this coding contest problem. The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends messages to his contacts a...
instruction
0
50,891
14
101,782
Tags: constructive algorithms, dfs and similar, graphs, greedy Correct Solution: ``` n = int(input()) contacts = [] for phonebook in range(n): contacts.append(input()) guessed = [int(z) for z in input().split()] #print(contacts, guessed) ppl = [] if guessed.count(0) == 0: print(0) exit() flag = False...
output
1
50,891
14
101,783
Provide tags and a correct Python 3 solution for this coding contest problem. The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends messages to his contacts a...
instruction
0
50,892
14
101,784
Tags: constructive algorithms, dfs and similar, graphs, greedy Correct Solution: ``` import math import sys input = sys.stdin.readline n = int(input()) a = [[] for _ in range(n)] for i in range(n): a[i] = [int(_) for _ in input().strip()] cnt = [int(_) for _ in input().split()] party = [] while True: piv = -1 ...
output
1
50,892
14
101,785