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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He has n balls, the i-th ball has size ti.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey... | instruction | 0 | 97,465 | 14 | 194,930 |
Yes | output | 1 | 97,465 | 14 | 194,931 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He has n balls, the i-th ball has size ti.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey... | instruction | 0 | 97,466 | 14 | 194,932 |
Yes | output | 1 | 97,466 | 14 | 194,933 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He has n balls, the i-th ball has size ti.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey... | instruction | 0 | 97,467 | 14 | 194,934 |
Yes | output | 1 | 97,467 | 14 | 194,935 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He has n balls, the i-th ball has size ti.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey... | instruction | 0 | 97,468 | 14 | 194,936 |
No | output | 1 | 97,468 | 14 | 194,937 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He has n balls, the i-th ball has size ti.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey... | instruction | 0 | 97,469 | 14 | 194,938 |
No | output | 1 | 97,469 | 14 | 194,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He has n balls, the i-th ball has size ti.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey... | instruction | 0 | 97,470 | 14 | 194,940 |
No | output | 1 | 97,470 | 14 | 194,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He has n balls, the i-th ball has size ti.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey... | instruction | 0 | 97,471 | 14 | 194,942 |
No | output | 1 | 97,471 | 14 | 194,943 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worri... | instruction | 0 | 98,312 | 14 | 196,624 |
Tags: dp, two pointers
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n - 1):
b.append(abs(a[i] - a[i + 1]))
c = []
s = 1
summ = 0
for i in range(n - 1):
summ += s * b[i]
s = -s
c.append(summ)
c.sort()
if c[0] < 0:
print(c[n - 2] - c[0])
else:
... | output | 1 | 98,312 | 14 | 196,625 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worri... | instruction | 0 | 98,313 | 14 | 196,626 |
Tags: dp, two pointers
Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
da,p=[],1
for i in range(n-1):
da.append(p*abs(a[i]-a[i+1]));p*=-1
m1,m2,s1,s2=0,0,0,0
for x in da:
s1+=x
if s1<0: s1=0
s2-=x
if s2<0: s2=0
m1=max(m1,s1);m2=max(m2,s2)
print(max(m1,m2))
``` | output | 1 | 98,313 | 14 | 196,627 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worri... | instruction | 0 | 98,316 | 14 | 196,632 |
Tags: dp, two pointers
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
b = []
sign = 1
for i in range(len(a)-1):
b.append( abs(a[i]-a[i+1]) * sign )
sign *= -1
max_ = 0
max1, max2 = 0, 0
a1, a2 = 0, 0
for i in range(n-1):
if a1+b[i]>0:
a1 += b[i]
else:
a1 = 0
... | output | 1 | 98,316 | 14 | 196,633 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worri... | instruction | 0 | 98,317 | 14 | 196,634 |
Tags: dp, two pointers
Correct Solution:
```
def maxSubArray( A):
if not A:
return 0
curSum = maxSum = A[0]
for num in A[1:]:
curSum = max(num, curSum + num)
maxSum = max(maxSum, curSum)
return maxSum
n = int(input())
L = list(map(int, input().split()))
D1 = []
D2 = []
for i... | output | 1 | 98,317 | 14 | 196,635 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worri... | instruction | 0 | 98,318 | 14 | 196,636 |
Tags: dp, two pointers
Correct Solution:
```
n = int(input())
num = list(map(int, input().split()))
diff = [abs(j-i) for i, j in zip(num, num[1:])]
s1 = 0
s2 = 0
m1 = 0
m2 = 0
for i, x in enumerate(diff):
if s1 < 0:
s1 = 0
if s2 < 0:
s2 = 0
if i % 2 == 0:
s1 += x
s2 -= x
... | output | 1 | 98,318 | 14 | 196,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worri... | instruction | 0 | 98,319 | 14 | 196,638 |
Tags: dp, two pointers
Correct Solution:
```
def max_subarray(A):
max_ending_here = max_so_far = A[0]
for x in A[1:]:
max_ending_here = max(x, max_ending_here + x)
max_so_far = max(max_so_far, max_ending_here)
return max_so_far
n = int(input())
a = [int(v) for v in input().split()]
b = [abs... | output | 1 | 98,319 | 14 | 196,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,758 | 14 | 197,516 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
from sys import *
n=int(stdin.readline())
a=[int(x) for x in stdin.readline().split()]
b=[int(x) for x in stdin.readline().split()]
count=0
c=[]
for i in range(n):
c.append(a[i]-b[i])
c=sorted(c)
i=0
j=n-1
while(i<j):
if(c[... | output | 1 | 98,758 | 14 | 197,517 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,759 | 14 | 197,518 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = [a[i]-b[i] for i in range(n)]
c.sort()
ind = n - 1
wyn = 0
for i in range(n):
while True:
if ind > i and c[i] + c[ind] > 0:
ind -= 1
else... | output | 1 | 98,759 | 14 | 197,519 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,760 | 14 | 197,520 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
part = []
for i in range(n):
part.append(a[i] - b[i])
part.sort()
ans = 0
for i in ra... | output | 1 | 98,760 | 14 | 197,521 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,761 | 14 | 197,522 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
from bisect import bisect_left
n = int(input())
x = [*map(int, input().split())]
y = [xi - yi for xi, yi in zip(x, map(int, input().split()))]
#print(y)
y.sort()
ans = 0
for i in range(n):
k = y... | output | 1 | 98,761 | 14 | 197,523 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,762 | 14 | 197,524 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
n=int(input())
ans=i=0
j=n-1
diff=[]
p=[]
j=n-1
list1=list(map(int,input().split()))
list2=list(map(int,input().split()))
zip_object = zip(list1,list2)
for list1_i, list2_i in zip_object:
diff.append(list1_i-list2_i)
#print(diff)
diff.s... | output | 1 | 98,762 | 14 | 197,525 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,763 | 14 | 197,526 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
import collections
import bisect
def solve(n, teacherInterests, studentInterests):
diffs = []
for t, s in zip(teacherInterests, studentInterests):
diffs.append(t-s)
diffs.sort()
ans = 0
# print(diffs)
... | output | 1 | 98,763 | 14 | 197,527 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,764 | 14 | 197,528 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
def binarySearch(A,start,end,x):
if start>end:
return start
mid=(start+end)//2
if A[mid]==x:
return mid
elif A[mid]>x:
return binarySearch(A,start,mid-1,x)
else:
return binarySearch(A,m... | output | 1 | 98,764 | 14 | 197,529 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.
The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j ... | instruction | 0 | 98,765 | 14 | 197,530 |
Tags: binary search, data structures, sortings, two pointers
Correct Solution:
```
def binary_search(arr, st, ed, comp):
ans = -1
while st <= ed:
mid = (st + ed) // 2
if arr[mid] + comp > 0:
ans = mid
ed = mid-1
else:
st = mid+1
return ans
n = int... | output | 1 | 98,765 | 14 | 197,531 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,864 | 14 | 197,728 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
# SHRi GANESHA author: Kunal Verma #
import os
import sys
from bisect import bisect_right
from collections import Counter, defaultdict, deque
from heapq import *
from io import BytesIO, IOBase
from math import gcd, inf, sqrt, ceil
d... | output | 1 | 98,864 | 14 | 197,729 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,865 | 14 | 197,730 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
a,b=map(int,input().split())
r=[0]*a
c1=[0]*(a+1)
c2=[0]*(a+1)
f=0
for i in range(a):
n=int(input())
r[i]=n
if n>0:c1[n]+=1
else:
f+=1
c2[-n]+=1
possible=[False]*(a+1)
# print(c1,c2)
np=0#number of suspects
for i in range(1,a+1... | output | 1 | 98,865 | 14 | 197,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,866 | 14 | 197,732 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
import sys
input=lambda:sys.stdin.readline().strip()
print=lambda s:sys.stdout.write(str(s)+"\n")
a,b=map(int,input().split())
r=[0]*a
c1=[0]*(a+1)
c2=[0]*(a+1)
f=0
for i in range(a):
n=int(input())
r[i]=n
if n>0:c1[n]+=1
else:
f... | output | 1 | 98,866 | 14 | 197,733 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,867 | 14 | 197,734 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
from collections import Counter
c = Counter()
n, m = map(int, input().split())
sumdc = 0
mark = []
suspect = set()
for _ in range(n):
k = int(input())
mark.append(k)
if k < 0: sumdc += 1
c = Counter(mark)
k = 0
for i in ... | output | 1 | 98,867 | 14 | 197,735 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,868 | 14 | 197,736 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
n, m = map(int, input().split())
t = [int(input()) for i in range(n)]
s, p = 0, [0] * (n + 1)
for i in t:
if i < 0:
m -= 1
p[-i] -= 1
else: p[i] += 1
q = {i for i in range(1, n + 1) if p[i] == m}
if len(q) == 0:... | output | 1 | 98,868 | 14 | 197,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,869 | 14 | 197,738 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
n,m=list(map(int,input().split()))
a=[[0,0] for i in range(n)]
b=[]
e=0
f=0
for i in range(n):
c=input()
d=int(c[1:])
if c[0]=='+':
a[d-1][0]+=1
e+=1
else:
a[d-1][1]+=1
f+=1
b.append(... | output | 1 | 98,869 | 14 | 197,739 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,870 | 14 | 197,740 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
from sys import stdin, stdout
n, m = map(int, stdin.readline().split())
cntf = [0 for i in range(n + 1)]
cnts = [0 for i in range(n + 1)]
challengers = []
for i in range(n):
s = stdin.readline().strip()
challengers.append(s)
... | output | 1 | 98,870 | 14 | 197,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After th... | instruction | 0 | 98,871 | 14 | 197,742 |
Tags: constructive algorithms, data structures, implementation
Correct Solution:
```
from collections import Counter
n, m = map(int, input().split())
pank = 0
buben = []
bober = set()
for _ in range(n):
k = int(input())
buben.append(k)
if k < 0:
pank += 1
cnt = Counter(buben)
k = 0
for i... | output | 1 | 98,871 | 14 | 197,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the s... | instruction | 0 | 98,872 | 14 | 197,744 |
Yes | output | 1 | 98,872 | 14 | 197,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the s... | instruction | 0 | 98,873 | 14 | 197,746 |
Yes | output | 1 | 98,873 | 14 | 197,747 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the s... | instruction | 0 | 98,874 | 14 | 197,748 |
Yes | output | 1 | 98,874 | 14 | 197,749 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the s... | instruction | 0 | 98,875 | 14 | 197,750 |
No | output | 1 | 98,875 | 14 | 197,751 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the s... | instruction | 0 | 98,876 | 14 | 197,752 |
No | output | 1 | 98,876 | 14 | 197,753 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the s... | instruction | 0 | 98,877 | 14 | 197,754 |
No | output | 1 | 98,877 | 14 | 197,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the s... | instruction | 0 | 98,878 | 14 | 197,756 |
No | output | 1 | 98,878 | 14 | 197,757 |
Provide a correct Python 3 solution for this coding contest problem.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.
There are n single men and n single wo... | instruction | 0 | 98,879 | 14 | 197,758 |
"Correct Solution:
```
n, k, t = map(int, input().split())
l = (1 << (n + 1)) - 1
p = [tuple(map(int, input().split())) for i in range(k)]
p.sort(key = lambda i: i[2])
a, b = -1, sum(i[2] for i in p)
def g(j, s, u, v):
global k, p, t
k += 1
if k > t: return
for i, (h, w, r) in enumerate(p[j:], j + 1):... | output | 1 | 98,879 | 14 | 197,759 |
Provide a correct Python 3 solution for this coding contest problem.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.
There are n single men and n single wo... | instruction | 0 | 98,880 | 14 | 197,760 |
"Correct Solution:
```
def g(t, d):
j = len(d) - 1
i = len(t) - 1
while j >= 0:
while i >= 0 and t[i] > d[j]: i -= 1
t.insert(i + 1, d[j])
j -= 1
n, k, t = map(int, input().split())
p = [0] * k
for i in range(k):
h, w, r = map(int, input().split())
p[i] = (r, w, h)
p... | output | 1 | 98,880 | 14 | 197,761 |
Provide a correct Python 3 solution for this coding contest problem.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.
There are n single men and n single wo... | instruction | 0 | 98,881 | 14 | 197,762 |
"Correct Solution:
```
n, k, t = map(int, input().split())
p = [0] * k
for i in range(k):
h, w, r = map(int, input().split())
p[i] = (r, w, h)
p.sort()
q, a, b = [], [0] * (n + 1), [0] * (n + 1)
def f(i, s):
global p, q, a, b, k
q.append(s)
while i < k:
h, w = p[i][1], p[i][2]
if a[... | output | 1 | 98,881 | 14 | 197,763 |
Provide a correct Python 3 solution for this coding contest problem.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.
There are n single men and n single wo... | instruction | 0 | 98,882 | 14 | 197,764 |
"Correct Solution:
```
I=lambda:list(map(int,input().split()))
n,k,T=I()
t=[I()for _ in '0'*k]
def b(h,w,r,a):
if h>n:a+=[r]
else:
b(h+1,w,r,a)
for f,s,v in t:
if f==h and s in w:b(h+1,w-set([s]),r+v,a)
return a
print(sorted(b(1,set(range(1,n+1)), 0,[]))[T-1])
``` | output | 1 | 98,882 | 14 | 197,765 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the en... | instruction | 0 | 98,883 | 14 | 197,766 |
No | output | 1 | 98,883 | 14 | 197,767 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the en... | instruction | 0 | 98,884 | 14 | 197,768 |
No | output | 1 | 98,884 | 14 | 197,769 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the en... | instruction | 0 | 98,885 | 14 | 197,770 |
No | output | 1 | 98,885 | 14 | 197,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,134 | 14 | 198,268 |
Tags: dfs and similar, math
Correct Solution:
```
###### ### ####### ####### ## # ##### ### #####
# # # # # # # # # # # # # ###
# # # # # # # # # # # # # ###
###### ##... | output | 1 | 99,134 | 14 | 198,269 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,135 | 14 | 198,270 |
Tags: dfs and similar, math
Correct Solution:
```
from math import gcd
n = int(input())
crush = list(map(int,input().split()))
crush = [0] + crush
vis,dis,cyc,flag = [0]*(n+1), [-1]*(n+1), [], 1
def dfs(u,d):
dis[u] = d
vis[u] = 1
global flag
v = crush[u]
if vis[v]==0:
dfs(v,d+1)
else:
if dis[v]==... | output | 1 | 99,135 | 14 | 198,271 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,136 | 14 | 198,272 |
Tags: dfs and similar, math
Correct Solution:
```
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
if sorted(a) != [i + 1 for i in range(n)]:
print(-1)
else:
ans = 1
used = [0 for i in range(... | output | 1 | 99,136 | 14 | 198,273 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,137 | 14 | 198,274 |
Tags: dfs and similar, math
Correct Solution:
```
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline
n=int(input())
l=list(map(lambda x:int(x)-1,input().split()))
use=[]
valid=1
for i in range(n):
t=i
for j in range(n+5):
t=l[t]
if t==i:
if (j+1)%2==0: use.append((j+... | output | 1 | 99,137 | 14 | 198,275 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,138 | 14 | 198,276 |
Tags: dfs and similar, math
Correct Solution:
```
from math import gcd
n = int(input())
arr = map(int, input().split())
arr = list(map(lambda x: x-1, arr))
res = 1
for i in range(n):
p, k = 0, i
for j in range(n):
k = arr[k]
if k == i:
p = j
break
if k != i:
... | output | 1 | 99,138 | 14 | 198,277 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,139 | 14 | 198,278 |
Tags: dfs and similar, math
Correct Solution:
```
input()
crush = [0] + [int(x) for x in input().split()]
visited = set()
circle_sizes = []
def gcd(a, b):
return a if b == 0 else gcd(b, a%b)
def lcm(a, b):
return a * b // gcd(a, b)
def solve():
for i in range(len(crush)):
if i not in visited:
... | output | 1 | 99,139 | 14 | 198,279 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,140 | 14 | 198,280 |
Tags: dfs and similar, math
Correct Solution:
```
from fractions import gcd
n = int(input())
crush = list(map(int,input().split()))
was = [0] * n
ans = 1
for i in range(n):
if was[i]:
continue
num = i
j = 0
while not was[num]:
was[num] = 1
num = crush[num] - 1
j += 1
... | output | 1 | 99,140 | 14 | 198,281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.