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.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,231 | 14 | 194,462 |
Tags: combinatorics, dp, math
Correct Solution:
```
from collections import defaultdict
from itertools import accumulate
from bisect import bisect_left
from collections import deque
from collections import Counter
import sys
input = sys.stdin.readline
'''
for CASES in range(int(input())):
n, m = map(int, input().split(... | output | 1 | 97,231 | 14 | 194,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,232 | 14 | 194,464 |
Tags: combinatorics, dp, math
Correct Solution:
```
# Python3 program to count
# Python3 program to count
# number of factors
# of an array of integers
MAX = 1000001;
# array to store
# prime factors
factor = [0]*(MAX + 1);
# function to generate all
# prime factors of numbers
# from 1 to 10^6
def generatePrimeFact... | output | 1 | 97,232 | 14 | 194,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,233 | 14 | 194,466 |
Tags: combinatorics, dp, math
Correct Solution:
```
n=int(input())
dp=[1]*(10**6+5)
for i in range(2,n+1):
for j in range(i,n+1,i):
dp[j]+=1
x=1
ans=1
m=998244353
for i in range(1,n):
ans=(dp[i+1]+x)%m
x+=(dp[i+1]+x)%m
print(ans)
``` | output | 1 | 97,233 | 14 | 194,467 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,234 | 14 | 194,468 |
Tags: combinatorics, dp, math
Correct Solution:
```
p = 998244353
n = int(input())
if n == 1:
print(1)
else:
divs = [0]*n
for i in range(1,n+1):
j = i
while j <= n:
divs[j-1] += 1
j += i
total = 1
for i in range(1,n-1):
total = (total*2+divs[i])%p
... | output | 1 | 97,234 | 14 | 194,469 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,235 | 14 | 194,470 |
Tags: combinatorics, dp, math
Correct Solution:
```
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
#from collections import defaultdict as dd, deque, Counter
#from ... | output | 1 | 97,235 | 14 | 194,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,236 | 14 | 194,472 |
Tags: combinatorics, dp, math
Correct Solution:
```
MOD = 998244353
n = int(input())
dp = [None] * (n+1)
pref = [None] * (n+1)
div = [2] * (n+1)
dp[1] = 1
pref[1] = 1
for i in range(2,n+1):
dp[i] = (div[i] + pref[i-1]) % MOD
pref[i] = (pref[i-1] + dp[i]) % MOD
for j in range(i<<1, n+1, i):
div[j] ... | output | 1 | 97,236 | 14 | 194,473 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,237 | 14 | 194,474 |
Tags: combinatorics, dp, math
Correct Solution:
```
'''from bisect import bisect,bisect_left
from collections import *
from heapq import *
from math import gcd,ceil,sqrt,floor,inf
from itertools import *
from operator import add,mul,sub,xor,truediv,floordiv
from functools import *'''
#-------------------------------... | output | 1 | 97,237 | 14 | 194,475 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments wi... | instruction | 0 | 97,238 | 14 | 194,476 |
Tags: combinatorics, dp, math
Correct Solution:
```
# Problem: B. Kavi on Pairing Duty
# Contest: Codeforces - Codeforces Round #722 (Div. 1)
# URL: https://codeforces.com/contest/1528/problem/B
# Memory Limit: 256 MB
# Time Limit: 1000 ms
#
# Powered by CP Editor (https://cpeditor.org)
from collections import defaul... | output | 1 | 97,238 | 14 | 194,477 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,298 | 14 | 194,596 |
Tags: constructive algorithms, greedy
Correct Solution:
```
def find(a, n, sz):
lo = 0
hi = sz-1
while lo <= hi:
mid = int ((lo + hi) / 2)
if a[mid] == n :
return mid
if a[mid] < n :
lo = mid + 1
if a[mid] > n :
hi = mid - 1
# prin... | output | 1 | 97,298 | 14 | 194,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,299 | 14 | 194,598 |
Tags: constructive algorithms, greedy
Correct Solution:
```
from collections import Counter
a,b,c = map(int, input().split())
l = list(map(int, input().split()))
l2 = list(map(int, input().split()))
m = max(max(l), max(l2))
s1 = Counter(l)
s2 = Counter(l2)
c1 = 0
c2 = 0
vis = set()
l3 = []
for i in l+l2:
if i not in ... | output | 1 | 97,299 | 14 | 194,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,300 | 14 | 194,600 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import os,io
from sys import stdout
import collections
# import random
# import math
# from operator import itemgetter
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from collections import Counter
# import heapq
# from functools import lru_cache
... | output | 1 | 97,300 | 14 | 194,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,301 | 14 | 194,602 |
Tags: constructive algorithms, greedy
Correct Solution:
```
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if (len(a) > len(b)) or (max(a) > max(b)):
print("YES")
else:
a = sorted(a)
b = sorted(b)
ans = "NO"
aa, bb = 0, 0
while (ans !=... | output | 1 | 97,301 | 14 | 194,603 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,302 | 14 | 194,604 |
Tags: constructive algorithms, greedy
Correct Solution:
```
rd = lambda: list(map(int, input().split()))
rd()
a = sorted(rd(), reverse=True)
b = sorted(rd(), reverse=True)
if len(a) > len(b): print("YES"); exit()
for i in range(len(a)):
if a[i] > b[i]: print("YES"); exit()
print("NO")
``` | output | 1 | 97,302 | 14 | 194,605 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,303 | 14 | 194,606 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import sys
from math import gcd,sqrt,ceil
from collections import defaultdict,Counter,deque
from bisect import bisect_left,bisect_right
import math
from itertools import permutations
# input=sys.stdin.readline
# def print(x):
# sys.stdout.write(str(x)+"\n... | output | 1 | 97,303 | 14 | 194,607 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,304 | 14 | 194,608 |
Tags: constructive algorithms, greedy
Correct Solution:
```
a, b, _c = map(int, input().split())
af = list(map(int, input().split()))
bf = list(map(int, input().split()))
af.sort(reverse = True)
bf.sort(reverse = True)
aflen = len(af)
bflen = len(bf)
i = 0
j = 0
cnt = 0
while i < aflen and j < bflen:
if af[i] > ... | output | 1 | 97,304 | 14 | 194,609 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ ... | instruction | 0 | 97,305 | 14 | 194,610 |
Tags: constructive algorithms, greedy
Correct Solution:
```
n,m,k=map(int,input().split())
Alice=list(map(int,input().split()))
Bob=list(map(int,input().split()))
SA={}
SB={}
for item in Alice:
if(item in SA):
SA[item]+=1
continue
SA[item]=1
SB[item]=0
for item in Bob:
if(item in SB)... | output | 1 | 97,305 | 14 | 194,611 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,306 | 14 | 194,612 |
Yes | output | 1 | 97,306 | 14 | 194,613 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,307 | 14 | 194,614 |
Yes | output | 1 | 97,307 | 14 | 194,615 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,308 | 14 | 194,616 |
Yes | output | 1 | 97,308 | 14 | 194,617 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,309 | 14 | 194,618 |
Yes | output | 1 | 97,309 | 14 | 194,619 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,310 | 14 | 194,620 |
No | output | 1 | 97,310 | 14 | 194,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,311 | 14 | 194,622 |
No | output | 1 | 97,311 | 14 | 194,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,312 | 14 | 194,624 |
No | output | 1 | 97,312 | 14 | 194,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-t... | instruction | 0 | 97,313 | 14 | 194,626 |
No | output | 1 | 97,313 | 14 | 194,627 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,423 | 14 | 194,846 |
Tags: brute force, implementation
Correct Solution:
```
n=int(input())
a=[[i+1]+list(map(int,input().split())) for i in range(n)]
ans=[]
def go():
pp=0
global a
for j in range(len(a)):
a[j][3]-=pp
if a[j][3]<0: pp+=a[j][2]
a=[a[i] for i in range(len(a)) if a[i][3]>=0]
return len(a)
while go():
nom,... | output | 1 | 97,423 | 14 | 194,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,424 | 14 | 194,848 |
Tags: brute force, implementation
Correct Solution:
```
ans=0
l = []
t = int(input())
for i in range(t):
n,m,k = map(int,input().split())
l.append([n,m,k])
ans=0
p = []
for i in range(t):
if l[i][2]>=0:
k = 0
v = 0
for j in range(i+1,t):
if l[j][2]>=0:
l... | output | 1 | 97,424 | 14 | 194,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,425 | 14 | 194,850 |
Tags: brute force, implementation
Correct Solution:
```
class CodeforcesTask585ASolution:
def __init__(self):
self.result = ''
self.child_count = 0
self.child = []
def read_input(self):
self.child_count = int(input())
for x in range(self.child_count):
self.ch... | output | 1 | 97,425 | 14 | 194,851 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,426 | 14 | 194,852 |
Tags: brute force, implementation
Correct Solution:
```
from sys import stdin
def input():
return stdin.readline()
from collections import deque as d
class Child:
def __init__(self, cry, leave, cond):
self.cry = cry
self.leave = leave
self.cond = cond
self.alive = True
N = in... | output | 1 | 97,426 | 14 | 194,853 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,427 | 14 | 194,854 |
Tags: brute force, implementation
Correct Solution:
```
from collections import deque as d
class Child:
def __init__(self, cry, leave, cond):
self.cry = cry
self.leave = leave
self.cond = cond
self.alive = True
N = int(input())
queue = d()
for i in range(N):
lst = [ int(i) for... | output | 1 | 97,427 | 14 | 194,855 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,428 | 14 | 194,856 |
Tags: brute force, implementation
Correct Solution:
```
# -*- coding:utf-8 -*-
"""
created by shuangquan.huang at 1/15/20
"""
import collections
import time
import os
import sys
import bisect
import heapq
from typing import List
class ListNode:
def __init__(self, v, d, p, index):
self.v = v
se... | output | 1 | 97,428 | 14 | 194,857 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,429 | 14 | 194,858 |
Tags: brute force, implementation
Correct Solution:
```
n = int(input())
arr, res = [], []
for i in range(n):
arr.append([int(j) for j in input().split()])
res.append(0)
for i in range(n):
if res[i] != 0:
continue
res[i] = 1
v = arr[i][0]
d = 0
for j in range(i+1, n):
if res[... | output | 1 | 97,429 | 14 | 194,859 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the dentist. We enumerate the children with intege... | instruction | 0 | 97,430 | 14 | 194,860 |
Tags: brute force, implementation
Correct Solution:
```
"""
Input
10
5 6 3
7 4 10
9 1 17
2 8 23
9 10 24
6 8 18
3 2 35
7 6 6
1 3 12
9 9 5
Output
6
1 2 3 6 4 7
Answer
6
1 2 3 4 5 7
"""
import collections
class Child:
def __init__(self, v, d, p, id):
# Cry volume in room
self.v ... | output | 1 | 97,430 | 14 | 194,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,431 | 14 | 194,862 |
Yes | output | 1 | 97,431 | 14 | 194,863 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,432 | 14 | 194,864 |
Yes | output | 1 | 97,432 | 14 | 194,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,433 | 14 | 194,866 |
Yes | output | 1 | 97,433 | 14 | 194,867 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,434 | 14 | 194,868 |
Yes | output | 1 | 97,434 | 14 | 194,869 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,435 | 14 | 194,870 |
Yes | output | 1 | 97,435 | 14 | 194,871 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,436 | 14 | 194,872 |
No | output | 1 | 97,436 | 14 | 194,873 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,437 | 14 | 194,874 |
No | output | 1 | 97,437 | 14 | 194,875 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,438 | 14 | 194,876 |
No | output | 1 | 97,438 | 14 | 194,877 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.
All children love to cry loudly at the reception at the... | instruction | 0 | 97,439 | 14 | 194,878 |
No | output | 1 | 97,439 | 14 | 194,879 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,456 | 14 | 194,912 |
Tags: brute force, implementation, sortings
Correct Solution:
```
n = int(input())
a = [int(s) for s in input().split()]
a.sort()
i = 1
while i < len(a):
if a[i] == a[i-1]:
del(a[i])
else:
i+=1
key = 0
for i in range(len(a)-2):
if a[i+1] == a[i] + 1 and a[i+2] == a[i+1] + 1:
print(... | output | 1 | 97,456 | 14 | 194,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,457 | 14 | 194,914 |
Tags: brute force, implementation, sortings
Correct Solution:
```
x=int(input())
s=[int(n) for n in input().split()]
s.sort()
l=0
for n in range(x-2):
if s[n]+1 in s and s[n]+2 in s:
print('YES')
l=1
break
else:
l=0
if l==0:
print('NO')
``` | output | 1 | 97,457 | 14 | 194,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,458 | 14 | 194,916 |
Tags: brute force, implementation, sortings
Correct Solution:
```
import sys
import math
#import random
#sys.setrecursionlimit(1000000)
input = sys.stdin.readline
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
return(int(input()))
def inara():
return(list(map(int,input().split()))... | output | 1 | 97,458 | 14 | 194,917 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,459 | 14 | 194,918 |
Tags: brute force, implementation, sortings
Correct Solution:
```
n=int(input())
sizes=sorted(list(set(map(int, input().split(' ')))))
def isThree(z):
for i in range(2,len(z)):
if abs(z[i-2]-z[i])<=2:
return True
return False
if isThree(sizes):
print("YES")
else:
print("NO")
``` | output | 1 | 97,459 | 14 | 194,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,460 | 14 | 194,920 |
Tags: brute force, implementation, sortings
Correct Solution:
```
if __name__=='__main__':
n = int(input())
b = sorted(set(map(int,input().split(' '))))
for i in range(len(b)-2):
if len(set(b[i:i+3]))==3:
if b[i+2]-b[i]<=2 and b[i+2]-b[i+1]<=1:
print('YES')
... | output | 1 | 97,460 | 14 | 194,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,461 | 14 | 194,922 |
Tags: brute force, implementation, sortings
Correct Solution:
```
from collections import defaultdict, deque, Counter, OrderedDict
def main():
n = int(input())
l = sorted(list(set([int(i) for i in input().split()])))
check = False
n = len(l)
for i in range(2,n):
a, b, c = l[i-2], l[i-1], l[... | output | 1 | 97,461 | 14 | 194,923 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,462 | 14 | 194,924 |
Tags: brute force, implementation, sortings
Correct Solution:
```
import sys
n=int(input())
l=list(map(int,input().split()))
l.sort()
p=list(set(l))
p.sort()
# print(p)
flag=False
for i in range(0,len(p)-2):
# print("greater value=",p[i+2])
# print("smaller value=",p[i])
# print("\n")
if (p[i+2]... | output | 1 | 97,462 | 14 | 194,925 |
Provide tags and a correct Python 3 solution for this coding contest problem.
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 to make friends happy:
* No two friends can... | instruction | 0 | 97,463 | 14 | 194,926 |
Tags: brute force, implementation, sortings
Correct Solution:
```
# -*- coding: utf-8 -*-
# @Date : 2019-01-22 18:58:14
# @Author : raj lath (oorja.halt@gmail.com)
# @Link : link
# @Version : 1.0.0
from sys import stdin
max_val=int(10e12)
min_val=int(-10e12)
def read_int() : return int(stdin.readline())
... | output | 1 | 97,463 | 14 | 194,927 |
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,464 | 14 | 194,928 |
Yes | output | 1 | 97,464 | 14 | 194,929 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.