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.
The Prodiggers are quite a cool band and for this reason, they have been the surprise guest at the ENTER festival for the past 80 years. At the beginning of their careers, they weren’t so succes... | instruction | 0 | 59,319 | 14 | 118,638 |
No | output | 1 | 59,319 | 14 | 118,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Prodiggers are quite a cool band and for this reason, they have been the surprise guest at the ENTER festival for the past 80 years. At the beginning of their careers, they weren’t so succes... | instruction | 0 | 59,320 | 14 | 118,640 |
No | output | 1 | 59,320 | 14 | 118,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Prodiggers are quite a cool band and for this reason, they have been the surprise guest at the ENTER festival for the past 80 years. At the beginning of their careers, they weren’t so succes... | instruction | 0 | 59,321 | 14 | 118,642 |
No | output | 1 | 59,321 | 14 | 118,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Prodiggers are quite a cool band and for this reason, they have been the surprise guest at the ENTER festival for the past 80 years. At the beginning of their careers, they weren’t so succes... | instruction | 0 | 59,322 | 14 | 118,644 |
No | output | 1 | 59,322 | 14 | 118,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how... | instruction | 0 | 59,323 | 14 | 118,646 |
Tags: constructive algorithms, data structures, graphs, greedy, sortings
Correct Solution:
```
n,s=[int(i) for i in input().split()]
s-=1
n-=1
d=0
l=[int(i) for i in input().split()]
if l[s]!=0:d+=1
l=l[:s]+l[s+1:]
for i in range(0,len(l)):
if(l[i]==0):l[i]=n+5
l.sort()
j=0
i=0
c=0
while 1:
while i<len(... | output | 1 | 59,323 | 14 | 118,647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how... | instruction | 0 | 59,324 | 14 | 118,648 |
Tags: constructive algorithms, data structures, graphs, greedy, sortings
Correct Solution:
```
""" This is a solution to the problem Subordinates on codeforces.com
There is a DAG with n nodes, pointing towards the root, without further constraints.
Given: for each node, a number signifying the count of (d... | output | 1 | 59,324 | 14 | 118,649 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how... | instruction | 0 | 59,325 | 14 | 118,650 |
Tags: constructive algorithms, data structures, graphs, greedy, sortings
Correct Solution:
```
[n, s] = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
mistakes = 0
mistakes += (a[s-1] is not 0)
a[s - 1] = 0
numSuperiors = [0]*(2*100000+100)
for superiors in a:
numSuperiors[superiors] +... | output | 1 | 59,325 | 14 | 118,651 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how... | instruction | 0 | 59,326 | 14 | 118,652 |
Tags: constructive algorithms, data structures, graphs, greedy, sortings
Correct Solution:
```
n, root = map(int, input().split())
a = list(map(int, input().split()))
def push(d, x, val):
if x not in d:
d[x] = 0
d[x]+=val
if d[x]==0:
del d[x]
d = {}
for x in a:
push(d, x, 1)
... | output | 1 | 59,326 | 14 | 118,653 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how... | instruction | 0 | 59,327 | 14 | 118,654 |
Tags: constructive algorithms, data structures, graphs, greedy, sortings
Correct Solution:
```
n,s = map(int,input().split())
A = list(map(int,input().split()))
if A[s-1] != 0:
per = 1
A[s-1] = 0
else:
per = 0
A.sort()
maxs = max(A)
ans = [0] * (maxs + 1)
answer = maxs + 1
o = -1
for j in range(n):
if A... | output | 1 | 59,327 | 14 | 118,655 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how... | instruction | 0 | 59,328 | 14 | 118,656 |
Tags: constructive algorithms, data structures, graphs, greedy, sortings
Correct Solution:
```
f = lambda: map(int, input().split())
n, s = f()
c = [0] * n
t = list(f())
for i in t: c[i] += 1
k = t[s - 1]
c[k] -= 1
d = c[0]
c += [d]
d += k > 0
i, j = 1, n
while i < j:
if c[i]: i += 1
elif c[j]:
c[j] -= ... | output | 1 | 59,328 | 14 | 118,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There w... | instruction | 0 | 59,329 | 14 | 118,658 |
No | output | 1 | 59,329 | 14 | 118,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There w... | instruction | 0 | 59,330 | 14 | 118,660 |
No | output | 1 | 59,330 | 14 | 118,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There w... | instruction | 0 | 59,331 | 14 | 118,662 |
No | output | 1 | 59,331 | 14 | 118,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There w... | instruction | 0 | 59,332 | 14 | 118,664 |
No | output | 1 | 59,332 | 14 | 118,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,365 | 14 | 118,730 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
print((int(input()) - 1) // 2)
``` | output | 1 | 59,365 | 14 | 118,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,366 | 14 | 118,732 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
if n%2 == 0:
print((n-2)//2)
else:
print(n//2)
``` | output | 1 | 59,366 | 14 | 118,733 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,367 | 14 | 118,734 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
print((n+1)//2 - 1)
``` | output | 1 | 59,367 | 14 | 118,735 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,368 | 14 | 118,736 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
print((n - 1) // 2)
``` | output | 1 | 59,368 | 14 | 118,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,369 | 14 | 118,738 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
#!/usr/bin/env python3
from sys import stdin,stdout
def readint():
return map(int, stdin.readline().split())
#lines = stdin.readlines()
n = int(input())
a = n//2
if n%2:
a +=1
print(a-1)
``` | output | 1 | 59,369 | 14 | 118,739 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,370 | 14 | 118,740 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
if(n == 1):
print(0)
else:
if(n%2 == 0):
print(n // 2 - 1)
else:
print(n//2)
``` | output | 1 | 59,370 | 14 | 118,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,371 | 14 | 118,742 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
if n % 2 == 1:
ans = (n - 1) // 2
else:
ans = (n - 2) // 2
print(ans)
``` | output | 1 | 59,371 | 14 | 118,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of ... | instruction | 0 | 59,372 | 14 | 118,744 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
if n % 2 == 0:
print((n - 2) // 2)
else:
print((n - 1) // 2)
``` | output | 1 | 59,372 | 14 | 118,745 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,449 | 14 | 118,898 |
"Correct Solution:
```
N, K = map(int, input().split())
S = input()
r = 0
for i in range(1, len(S)):
if S[i] == S[i-1]:
r += 1
r = min(len(S)-1, r+2*K)
print(r)
``` | output | 1 | 59,449 | 14 | 118,899 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,450 | 14 | 118,900 |
"Correct Solution:
```
N,K=map(int,input().split())
s=input()
x=0
for i in range(N-1):
if s[i]!=s[i+1]:
x+=1
x=max([0,x-2*K])
print(N-1-x)
``` | output | 1 | 59,450 | 14 | 118,901 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,451 | 14 | 118,902 |
"Correct Solution:
```
N, K=map(int, input().split())
S=input()
ans=0
for i in range(1, N):
if S[i-1]==S[i]:
ans+=1
ans=min(N-1, ans+K*2)
print(ans)
``` | output | 1 | 59,451 | 14 | 118,903 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,452 | 14 | 118,904 |
"Correct Solution:
```
N, K = map(int,input().split())
S = input()
cnt = sum([S[i] != S[i+1] for i in range(N-1)])
ans = (N-1) - cnt
ans += min(2*K, cnt)
print(ans)
``` | output | 1 | 59,452 | 14 | 118,905 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,453 | 14 | 118,906 |
"Correct Solution:
```
n,k,s=open(0).read().split()
n,k=int(n),int(k)
d=0
for i in range(1,n):
if not s[i]==s[i-1]:
d+=1
print(n-1-max(d-2*k,0))
``` | output | 1 | 59,453 | 14 | 118,907 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,454 | 14 | 118,908 |
"Correct Solution:
```
n,k=list(map(int,input().split()))
s=list(input())
print(min(n-1,sum([s[i]==s[i+1] for i in range(n-1)])+k*2))
``` | output | 1 | 59,454 | 14 | 118,909 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,455 | 14 | 118,910 |
"Correct Solution:
```
N, K = [int(x) for x in input().split()]
S = input()
cnt = 0
for i in range(len(S)-1):
cnt += S[i] == S[i+1]
print(min(cnt+ 2*K, N-1))
``` | output | 1 | 59,455 | 14 | 118,911 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `... | instruction | 0 | 59,456 | 14 | 118,912 |
"Correct Solution:
```
n, k = map(int, input().split())
s = input()
cnt = 0
for i, j in zip(s, s[1:]):
if i == j:
cnt += 1
ans = min(n-1, cnt + 2*k)
print(ans)
``` | output | 1 | 59,456 | 14 | 118,913 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,457 | 14 | 118,914 |
Yes | output | 1 | 59,457 | 14 | 118,915 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,458 | 14 | 118,916 |
Yes | output | 1 | 59,458 | 14 | 118,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,459 | 14 | 118,918 |
Yes | output | 1 | 59,459 | 14 | 118,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,460 | 14 | 118,920 |
Yes | output | 1 | 59,460 | 14 | 118,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,461 | 14 | 118,922 |
No | output | 1 | 59,461 | 14 | 118,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,462 | 14 | 118,924 |
No | output | 1 | 59,462 | 14 | 118,925 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,463 | 14 | 118,926 |
No | output | 1 | 59,463 | 14 | 118,927 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th cha... | instruction | 0 | 59,464 | 14 | 118,928 |
No | output | 1 | 59,464 | 14 | 118,929 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,866 | 14 | 119,732 |
Tags: math, number theory, sortings
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
li = [0]*n
for i in range(n):
li[(i+a[i])%n] += 1
for i in li:
if i!=1:
print('NO')
break
else:
print... | output | 1 | 59,866 | 14 | 119,733 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,867 | 14 | 119,734 |
Tags: math, number theory, sortings
Correct Solution:
```
import math
import sys
input = sys.stdin.readline
t=int(input())
for i in range(t):
n=int(input())
arr=list(map(int,input().split()))
ans=[0]*n
for j in range(n):
ans[(j+arr[j])%n]+=1
f=True
for j in range(n):
if ans[j]!=... | output | 1 | 59,867 | 14 | 119,735 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,868 | 14 | 119,736 |
Tags: math, number theory, sortings
Correct Solution:
```
def solve(n,s):
if n == 1:
return('YES')
a = [i for i in range(n)]
for j in range(n):
a[j] = (a[j] + s[j])%n
if len(set(a)) != len(a):
return ("NO")
else:
return("YES")
t = int(input())
for i in range(t):
... | output | 1 | 59,868 | 14 | 119,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,869 | 14 | 119,738 |
Tags: math, number theory, sortings
Correct Solution:
```
t=int(input())
from copy import deepcopy
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
hashmap={}
for i in range(0,len(a)):
# print(i)
a[i]=(a[i]+i)%n
if a[i] not in hashmap:
hashmap[a[i... | output | 1 | 59,869 | 14 | 119,739 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,870 | 14 | 119,740 |
Tags: math, number theory, sortings
Correct Solution:
```
from _collections import defaultdict
vis = defaultdict(list)
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
flag = True
vis = defaultdict(list)
for i in range(n):
c = (i + l[i]) % n
if not ... | output | 1 | 59,870 | 14 | 119,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,871 | 14 | 119,742 |
Tags: math, number theory, sortings
Correct Solution:
```
from collections import defaultdict as dc
from heapq import *
import math
from bisect import bisect_left,bisect
#bisect gives x and p[x] is element greater than it and out of bound for last one
#p[x-1] gives equal or smaller and no error for any element.
import... | output | 1 | 59,871 | 14 | 119,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,872 | 14 | 119,744 |
Tags: math, number theory, sortings
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
v=[0]*n
for i in range(len(l)):
l[i]%=n
for i in range(len(l)):
x=(i+l[i])%n
if not v[x]:
v[x]=1
else:
print... | output | 1 | 59,872 | 14 | 119,745 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,873 | 14 | 119,746 |
Tags: math, number theory, sortings
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
a = [(i+j)%n for i,j in enumerate(a)]
if len(set(a)) == n:
print('YES')
else:
print('NO')
``` | output | 1 | 59,873 | 14 | 119,747 |
Provide tags and a correct Python 2 solution for this coding contest problem.
Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there ... | instruction | 0 | 59,874 | 14 | 119,748 |
Tags: math, number theory, sortings
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
raw_input = stdin.readline
pr = stdout.write
def in_num():
return int(raw_input())
def in_arr():
return map(int,raw_input().sp... | output | 1 | 59,874 | 14 | 119,749 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n armchairs, numbered from 1 to n from left to right. Some armchairs are occupied by people (at most one person per armchair), others are not. The number of occupied armchairs is not greater than n/2.
For some reason, you would li... | instruction | 0 | 59,975 | 14 | 119,950 |
Tags: dp, flows, graph matchings, greedy
Correct Solution:
```
n = int(input())
l = list(map(int, input().split()))
v1, v2 = [], []
for i in range(n):
if l[i] == 1:
v1.append(i)
else:
v2.append(i)
if len(v1) == 0:
print(0)
else:
a, b = len(v1), len(v2)
dp = [[10**9]*(b+1) for _ in ra... | output | 1 | 59,975 | 14 | 119,951 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n armchairs, numbered from 1 to n from left to right. Some armchairs are occupied by people (at most one person per armchair), others are not. The number of occupied armchairs is not greater than n/2.
For some reason, you would li... | instruction | 0 | 59,976 | 14 | 119,952 |
Tags: dp, flows, graph matchings, greedy
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
import math
n=int(input())
arr=[int(x) for x in input().split()]
h=[]
v=[]
for i in range(n):
if arr[i]:
v.append(i)
else:
h.append(i)
hh=len(h)
vv=len(v)
dp=[[0 for j in range(hh+1)] ... | output | 1 | 59,976 | 14 | 119,953 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n armchairs, numbered from 1 to n from left to right. Some armchairs are occupied by people (at most one person per armchair), others are not. The number of occupied armchairs is not greater than n/2.
For some reason, you would li... | instruction | 0 | 59,977 | 14 | 119,954 |
Tags: dp, flows, graph matchings, greedy
Correct Solution:
```
import sys
import math
from itertools import *
from queue import LifoQueue
from collections import deque
def gcd(a,b):
if a==0:
return b
return gcd(b%a,a)
def powset(arr,length):
out=[]
for i in range(0,length+1):
for j in ... | output | 1 | 59,977 | 14 | 119,955 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.