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.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,923 | 14 | 19,846 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
def find(x):
if(par[x]==x):
return par[x]
par[x]=find(par[x])
return par[x]
def union(a,b):
pa=find(a)
pb=find(b)
if(pa!=pb):
if(size[pa]>size[pb]):
pa,pb=pb,pa
siz... | output | 1 | 9,923 | 14 | 19,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,924 | 14 | 19,848 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
from sys import stdin
n,m=map(int,stdin.readline().strip().split())
dp=[[-1 for i in range(n+1)] for j in range(m+1)]
for i in range(m):
s=list(map(int,stdin.readline().strip().split()))
for j in range(n-2,-1,-1):
... | output | 1 | 9,924 | 14 | 19,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,925 | 14 | 19,850 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
n, m = map(int, input().split())
graph = [0] * n
_next = [True] * n
_next[n - 1] = False
def read_array():
return list(map(lambda x: x - 1, map(int, input().split())))
first = read_array()
for i in range(n):
graph... | output | 1 | 9,925 | 14 | 19,851 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,926 | 14 | 19,852 |
Yes | output | 1 | 9,926 | 14 | 19,853 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,927 | 14 | 19,854 |
Yes | output | 1 | 9,927 | 14 | 19,855 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,928 | 14 | 19,856 |
Yes | output | 1 | 9,928 | 14 | 19,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,929 | 14 | 19,858 |
Yes | output | 1 | 9,929 | 14 | 19,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,930 | 14 | 19,860 |
No | output | 1 | 9,930 | 14 | 19,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,931 | 14 | 19,862 |
No | output | 1 | 9,931 | 14 | 19,863 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,932 | 14 | 19,864 |
No | output | 1 | 9,932 | 14 | 19,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Acingel is a small town. There was only one doctor here β Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead i... | instruction | 0 | 9,933 | 14 | 19,866 |
No | output | 1 | 9,933 | 14 | 19,867 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,989 | 14 | 19,978 |
Tags: greedy
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
s=sum(l)
c=l[0]
k=1
d=[1]
for i in range(1,n):
if(k<=n-2):
if(l[i]<=(l[0]//2)):
c=c+l[i]
k=k+1
d.append(i+1)
if(c>s//2):
print(k)
print(*d)
else:
print(0)
``` | output | 1 | 9,989 | 14 | 19,979 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,990 | 14 | 19,980 |
Tags: greedy
Correct Solution:
```
n = int(input())
a = list(int(x) for x in input().split())
p = a.pop(0)
pc = 0
c = []
for ai in range(len(a)):
if a[ai] * 2 <= p:
c.append(ai)
pc += a[ai]
if pc + p > (sum(a)+p)//2:
print(len(c)+1)
print(1, end=' ')
for ce in c:
print(ce+2, end... | output | 1 | 9,990 | 14 | 19,981 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,991 | 14 | 19,982 |
Tags: greedy
Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
sm=sum(a)
b=[(a[i],i) for i in range(1,n)]
b.sort()
ans=[1]
x=a[0]
fl=0
for i in b:
if x>sm/2:
fl=1
break
if a[0]>=2*i[0]:
ans.append(i[1]+1)
x+=i[0]
if(fl):
print(len(ans))
print(*ans)
els... | output | 1 | 9,991 | 14 | 19,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,992 | 14 | 19,984 |
Tags: greedy
Correct Solution:
```
n = int(input())
arr = list(map(int, input().split(' ')))
tot = sum(arr)
curr = 0
ans = []
ac = arr[0]
for idx, num in enumerate(arr):
if idx == 0:
tot -= num
curr += num
ans.append(idx + 1)
if ac >= num * 2:
tot -= num
curr += num
... | output | 1 | 9,992 | 14 | 19,985 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,993 | 14 | 19,986 |
Tags: greedy
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
our = a[0]
ans = [1]
for i in range(1, n):
if a[i] * 2 <= a[0]:
our += a[i]
ans.append(i + 1)
if our > sum(a) - our:
print(len(ans))
print(*ans)
else:
print(0)
``` | output | 1 | 9,993 | 14 | 19,987 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,994 | 14 | 19,988 |
Tags: greedy
Correct Solution:
```
import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
# print = stdout.write
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
n = int(input())
a = listin()
ans = [1]
s = sum(a)
for i in r... | output | 1 | 9,994 | 14 | 19,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,995 | 14 | 19,990 |
Tags: greedy
Correct Solution:
```
def solve():
n=int(input())
#=map(int, input().split())
a=list(map(int, input().split()))
nd=(sum(a)//2)+1
par=a[0]
d=[1]
for i in range(1,n):
if par>=nd:
break
if 2*a[i]<=a[0]:
par+=a[i]
d.appen... | output | 1 | 9,995 | 14 | 19,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats in the parliament.
Al... | instruction | 0 | 9,996 | 14 | 19,992 |
Tags: greedy
Correct Solution:
```
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
record =defaultdict(list)
for i, v in enumerate(a):
record[v].append(i)
totalSeats = sum(a)
aliceSeats = a[0]
temp = a[0]
a[0], a[n - 1] = a[n - 1], a[0]
a.pop()
a.sort()
i = 0
ans = [0]
c = 1... | output | 1 | 9,996 | 14 | 19,993 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 9,997 | 14 | 19,994 |
Yes | output | 1 | 9,997 | 14 | 19,995 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 9,998 | 14 | 19,996 |
Yes | output | 1 | 9,998 | 14 | 19,997 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 9,999 | 14 | 19,998 |
Yes | output | 1 | 9,999 | 14 | 19,999 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 10,000 | 14 | 20,000 |
Yes | output | 1 | 10,000 | 14 | 20,001 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 10,001 | 14 | 20,002 |
No | output | 1 | 10,001 | 14 | 20,003 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 10,002 | 14 | 20,004 |
No | output | 1 | 10,002 | 14 | 20,005 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 10,003 | 14 | 20,006 |
No | output | 1 | 10,003 | 14 | 20,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are n parties, numbered from 1 to n. The i-th part... | instruction | 0 | 10,004 | 14 | 20,008 |
No | output | 1 | 10,004 | 14 | 20,009 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,328 | 14 | 20,656 |
Tags: sortings
Correct Solution:
```
n = int(input())
a = []
b = []
c = 0
for i in range(n):
x,y = map(int, input().split())
a.append(x)
b.append(y)
for i in range(n):
if a[i] != b[i]:
c += 1
if c > 0:
print("Happy Alex")
else:
print("Poor Alex")
``` | output | 1 | 10,328 | 14 | 20,657 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,329 | 14 | 20,658 |
Tags: sortings
Correct Solution:
```
# with open("input.txt","r") as f:
laptops = []
for _ in range(int(input())):
laptop = list(map(int,input().split()))
laptops.append(laptop)
laptops.sort()
truth = False
for i in range(len(laptops)-1):
if laptops[i][0]<laptops[i+1][0] and laptops[i][1]>laptops[i+1][1]:
truth = ... | output | 1 | 10,329 | 14 | 20,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,330 | 14 | 20,660 |
Tags: sortings
Correct Solution:
```
n=int(input())
s='Poor Alex'
for i in range(0,n):
x, y = input().split()
if int(x) > int(y):
s='Happy Alex'
print(s)
``` | output | 1 | 10,330 | 14 | 20,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,331 | 14 | 20,662 |
Tags: sortings
Correct Solution:
```
n = int(input())
temp1 = 0
for x in range(n):
a, b = input().split()
a = int(a)
b = int(b)
if a < b:
temp1 += 1
if temp1 == 0:
print("Poor Alex")
else:
print("Happy Alex")
``` | output | 1 | 10,331 | 14 | 20,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,332 | 14 | 20,664 |
Tags: sortings
Correct Solution:
```
def CF456A():
N = int(input())
laptops = [tuple(map(int, input().split())) for _ in range(N)]
laptops = sorted(laptops, key=lambda x:(x[0], x[1]))
for i in range(N-1):
if laptops[i][1] > laptops[i+1][1]: return "Happy Alex"
return "Poor Alex"
if __n... | output | 1 | 10,332 | 14 | 20,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,333 | 14 | 20,666 |
Tags: sortings
Correct Solution:
```
N=int(input())
q=[[0,0] for i in range(N)]
x=False
for i in range (N):
q[i][0],q[i][1]=map(int,input().split())
s=sorted(q, key=lambda x: x[0])
for k in range(1,N):
if s[k-1][1]-s[k][1]>0:
x=True
if x:
print('Happy Alex')
else:
print('Poor Alex')
``` | output | 1 | 10,333 | 14 | 20,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,334 | 14 | 20,668 |
Tags: sortings
Correct Solution:
```
import sys
input=sys.stdin.readline
l=[]
for i in range(int(input())):l.append(list(map(int,input().split())))
l.sort()
m=[i[1]for i in l]
print(["Happy","Poor"][m==sorted(m)],"Alex")
``` | output | 1 | 10,334 | 14 | 20,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop ... | instruction | 0 | 10,335 | 14 | 20,670 |
Tags: sortings
Correct Solution:
```
entrada = int(input())
sub = 0
ind = 0
pos = 0
tuplas = []
flag = False
for i in range(entrada):
tupla = list(int(x) for x in input().split())
tuplas.append(tupla)
s = tupla[0] - tupla[1]
if s < 0:
if sub == 0 and pos == 0:
sub = s
ind = i
elif s < sub or s == sub:... | output | 1 | 10,335 | 14 | 20,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all its successors, if th... | instruction | 0 | 10,477 | 14 | 20,954 |
Tags: combinatorics, dp, graphs, trees
Correct Solution:
```
print([0,1,9,245,126565,54326037,321837880,323252721,754868154,328083248,838314395,220816781,893672292,166441208,251255697,114256285,118775501,482714697,11784725,460862131,550384565,106742050,425241115,626692854,674266678,320014275,345949512,527320049,8978227... | output | 1 | 10,477 | 14 | 20,955 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all its successors, if th... | instruction | 0 | 10,478 | 14 | 20,956 |
Tags: combinatorics, dp, graphs, trees
Correct Solution:
```
l=[0,1,9,245,126565,54326037,321837880,323252721,754868154,328083248,838314395,220816781,893672292,166441208,251255697,114256285,118775501,482714697,11784725,460862131,550384565,106742050,425241115,626692854,674266678,320014275,345949512,527320049,897822749,1... | output | 1 | 10,478 | 14 | 20,957 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,487 | 14 | 20,974 |
Yes | output | 1 | 10,487 | 14 | 20,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,488 | 14 | 20,976 |
Yes | output | 1 | 10,488 | 14 | 20,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,489 | 14 | 20,978 |
Yes | output | 1 | 10,489 | 14 | 20,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,490 | 14 | 20,980 |
Yes | output | 1 | 10,490 | 14 | 20,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,491 | 14 | 20,982 |
No | output | 1 | 10,491 | 14 | 20,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,492 | 14 | 20,984 |
No | output | 1 | 10,492 | 14 | 20,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,493 | 14 | 20,986 |
No | output | 1 | 10,493 | 14 | 20,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are wind... | instruction | 0 | 10,494 | 14 | 20,988 |
No | output | 1 | 10,494 | 14 | 20,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n... | instruction | 0 | 10,958 | 14 | 21,916 |
Tags: binary search, brute force, dp, implementation, sortings, two pointers
Correct Solution:
```
import sys
import operator
import array
#-----------
def solve():
a = [int(x) for x in input().split()]
n = int(input())
b = [int(x) for x in input().split()]
have = [ [] ] * (n*6)
arr_append = ha... | output | 1 | 10,958 | 14 | 21,917 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n... | instruction | 0 | 10,959 | 14 | 21,918 |
Tags: binary search, brute force, dp, implementation, sortings, two pointers
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
... | output | 1 | 10,959 | 14 | 21,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n... | instruction | 0 | 10,960 | 14 | 21,920 |
Tags: binary search, brute force, dp, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin
input = stdin.readline
a = sorted([int(i) for i in input().split()])
n = int(input())
b = sorted([int(i) for i in input().split()])
c = []
for i in range(n):
c += [[b[i] - a[j], i] for j in ran... | output | 1 | 10,960 | 14 | 21,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n... | instruction | 0 | 10,961 | 14 | 21,922 |
Tags: binary search, brute force, dp, implementation, sortings, two pointers
Correct Solution:
```
a=list(map(int,input().split()));n=int(input());s=list(map(int,input().split()));b=[];i=j=0;ans=10**18;cs=[0]*n;nz=1;z=n*6
for y in range(n):
for x in a:b.append((s[y]-x)*n+y)
b.sort();cs[b[0]%n]+=1
while j+1<z:
while j... | output | 1 | 10,961 | 14 | 21,923 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n... | instruction | 0 | 10,962 | 14 | 21,924 |
Tags: binary search, brute force, dp, implementation, sortings, two pointers
Correct Solution:
```
#If FastIO not needed, used this and don't forget to strip
import sys
input = sys.stdin.readline
"""
import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
f... | output | 1 | 10,962 | 14 | 21,925 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.