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. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,221
14
86,442
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` def index_finder1(result): for i in range (len(result)-1,-1,-1): if result[i]=='.': break return (i+1) def index_finder3(target,result): temp=0 for i in range (len(result)): j=result.find...
output
1
43,221
14
86,443
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,222
14
86,444
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` def prS(): print('.'.join(map(str, a))) for _ in range(int(input())): n = int(input()) l = [] for i in range(n): l.append(int(input())) a = [l[0]] print(a[0]) for i in range(1, n): if l[i...
output
1
43,222
14
86,445
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,223
14
86,446
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` ali=0;import sys;ali=0 ali=0; ali=0;import io;ali=0 ali=0; ali=0;import os;ali=0 ali=0; ali=0;input = sys.stdin.readline;ali=0 ali=0; ali=0;# input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline;ali=0 ali=0; ali=0;# print...
output
1
43,223
14
86,447
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,224
14
86,448
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` #from itertools import product #from itertools import combinations #from collections import Counter #from collections import defaultdict #from collections import deque # deque([iterable[, maxlen]]) #appendleft popleft rotate #from h...
output
1
43,224
14
86,449
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,225
14
86,450
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` def divisors(M): d=[] i=1 while M>=i**2: if M%i==0: d.append(i) if i**2!=M: d.append(M//i) i=i+1 return d def popcount(x): x = x - ((x >> 1) & 0x55555555)...
output
1
43,225
14
86,451
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,226
14
86,452
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys from collections import Counter, deque,defaultdict from functools import lru_cache,reduce from heapq import...
output
1
43,226
14
86,453
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,227
14
86,454
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` #Fast I/O import sys,os import math # To enable the file I/O i the below 2 lines are uncommented. # read from in.txt if uncommented if os.path.exists('in.txt'): sys.stdin=open('in.txt','r') # will print on Console if file I/O is not...
output
1
43,227
14
86,455
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created from a list with one item "1" by applying some o...
instruction
0
43,228
14
86,456
Tags: brute force, data structures, greedy, implementation, trees Correct Solution: ``` import sys import io, os input = sys.stdin.buffer.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline t = int(input()) for _ in range(t): n = int(input()) A = [int(input()) for i in range(n)] #print(A)...
output
1
43,228
14
86,457
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,229
14
86,458
Yes
output
1
43,229
14
86,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,230
14
86,460
Yes
output
1
43,230
14
86,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,231
14
86,462
Yes
output
1
43,231
14
86,463
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,232
14
86,464
Yes
output
1
43,232
14
86,465
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,233
14
86,466
No
output
1
43,233
14
86,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,234
14
86,468
No
output
1
43,234
14
86,469
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,235
14
86,470
No
output
1
43,235
14
86,471
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands. A valid nested list is any list which can be created f...
instruction
0
43,236
14
86,472
No
output
1
43,236
14
86,473
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,253
14
86,506
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` n = int(input()) num_likes = int(input()) like = [ [] for u in range(n + 1) ] for i in range(num_likes): u, v = map(int, input().split()) like[u].append(v) like[v].append(u) num_dislikes = int(input()) dislike = [ (n + 1) * [ False ] for ...
output
1
43,253
14
86,507
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,254
14
86,508
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` # maa chudaaye duniya n = int(input()) parents = [i for i in range(n+1)] ranks = [1 for i in range(n+1)] def find(x): if parents[x] != x: parents[x] = find(parents[x]) return parents[x] def union(x, y): xs = find(x) ys = find(y) if xs == ys:...
output
1
43,254
14
86,509
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,255
14
86,510
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` from collections import defaultdict def Root(child): while(Parent[child]!=child): child = Parent[child] return child def Union(a,b): root_a = Root(a) root_b = Root(b) if(root_a!=root_b): if(Size[root_a]<Siz...
output
1
43,255
14
86,511
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,256
14
86,512
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` t, p, k = [0] * (int(input()) + 1), {0: []}, 1 for i in range(int(input())): a, b = map(int, input().split()) if t[a] == t[b]: if t[a] == 0: t[a] = t[b] = k p[k] = [a, b] k += 1 else...
output
1
43,256
14
86,513
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,257
14
86,514
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` from sys import setrecursionlimit setrecursionlimit(10 ** 9) def dfs(g, col, st): global used used[st] = col for w in g[st]: if used[w] is False: dfs(g, col, w) n = int(input()) k = int(input()) g = [] used = [Fa...
output
1
43,257
14
86,515
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,258
14
86,516
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` t, p, k = [0] * (int(input()) + 1), {0: []}, 1 for i in range(int(input())): a, b = map(int, input().split()) if t[a] == t[b]: if t[a] == 0: t[a] = t[b] = k p[k] = [a, b] k += 1 else...
output
1
43,258
14
86,517
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,259
14
86,518
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` class DisjointSetStructure(): def __init__(self, n): self.A = [[i,0,1] for i in range(n)] self.size = n def getpair(self, i): p = i while self.A[p][0] != p: p = self.A[p][0] j = self.A[i][0] whi...
output
1
43,259
14
86,519
Provide tags and a correct Python 3 solution for this coding contest problem. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smar...
instruction
0
43,260
14
86,520
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` def find(a): if parent[a]!=a: parent[a]=find(parent[a]) return parent[a] def union(a,b): u,v=find(a),find(b) if u==v: return if rank[u]>rank[v]: parent[v]=u else: parent[u]=v if rank[u]==ra...
output
1
43,260
14
86,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike...
instruction
0
43,261
14
86,522
Yes
output
1
43,261
14
86,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike...
instruction
0
43,262
14
86,524
Yes
output
1
43,262
14
86,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike...
instruction
0
43,263
14
86,526
No
output
1
43,263
14
86,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike...
instruction
0
43,264
14
86,528
No
output
1
43,264
14
86,529
Provide tags and a correct Python 3 solution for this coding contest problem. A system of n vessels with water is given. Several pairs of vessels are connected by tubes with transfusion mechanisms. One may transfer an integer amount of liters of water between two vessels connected by such tube (tube works in both dire...
instruction
0
43,300
14
86,600
Tags: constructive algorithms, dfs and similar, graphs, trees Correct Solution: ``` read = lambda: map(int, input().split()) n, v, e = read() adj = [[] for _ in range(n + 1)] As = [0] + list(read()) Bs = [0] + list(read()) ans = [] for _ in range(e): a, b = map(int, input().split()) adj[a].append(b) a...
output
1
43,300
14
86,601
Provide tags and a correct Python 3 solution for this coding contest problem. A system of n vessels with water is given. Several pairs of vessels are connected by tubes with transfusion mechanisms. One may transfer an integer amount of liters of water between two vessels connected by such tube (tube works in both dire...
instruction
0
43,301
14
86,602
Tags: constructive algorithms, dfs and similar, graphs, trees Correct Solution: ``` read = lambda: map(int, input().split()) n, v, e = read() adj = [[] for _ in range(n + 1)] As = [0] + list(read()) Bs = [0] + list(read()) ans = [] for _ in range(e): a, b = map(int, input().split()) adj[a].append(b) adj[b]...
output
1
43,301
14
86,603
Provide tags and a correct Python 3 solution for this coding contest problem. A system of n vessels with water is given. Several pairs of vessels are connected by tubes with transfusion mechanisms. One may transfer an integer amount of liters of water between two vessels connected by such tube (tube works in both dire...
instruction
0
43,302
14
86,604
Tags: constructive algorithms, dfs and similar, graphs, trees Correct Solution: ``` read = lambda: map(int, input().split()) n, v, e = read() adj = [[] for _ in range(n + 1)] As = [0] + list(read()) Bs = [0] + list(read()) ans = [] for _ in range(e): a, b = map(int, input().split()) adj[a].append(b) adj[b...
output
1
43,302
14
86,605
Provide tags and a correct Python 3 solution for this coding contest problem. Many years have passed, and n friends met at a party again. Technologies have leaped forward since the last meeting, cameras with timer appeared and now it is not obligatory for one of the friends to stand with a camera, and, thus, being abs...
instruction
0
43,378
14
86,756
Tags: brute force, greedy, sortings Correct Solution: ``` from operator import neg n = int(input()) a = [tuple(map(int, input().split())) for i in range(n)] def check(max_h): k = n // 2 b = [] for w, h in a: if h > max_h: if k <= 0 or w > max_h: return 1 << 60 ...
output
1
43,378
14
86,757
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many years have passed, and n friends met at a party again. Technologies have leaped forward since the last meeting, cameras with timer appeared and now it is not obligatory for one of the frien...
instruction
0
43,379
14
86,758
No
output
1
43,379
14
86,759
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After his birthday party, Timofey went to his favorite tree alley in a park. He wants to feed there his favorite birds β€” crows. It's widely known that each tree is occupied by a single crow fam...
instruction
0
43,472
14
86,944
No
output
1
43,472
14
86,945
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,962
14
87,924
Tags: greedy, sortings, two pointers Correct Solution: ``` import sys input = sys.stdin.readline t=int(input()) for testcases in range(t): n,T,a,b=map(int,input().split()) A=list(map(int,input().split())) L=list(map(int,input().split())) LCAN=[T] EASY=[] HARD=[] for i in range(n): ...
output
1
43,962
14
87,925
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,963
14
87,926
Tags: greedy, sortings, two pointers Correct Solution: ``` import os from io import BytesIO input = BytesIO(os.read(0, os.fstat(0).st_size)).readline for _ in range(int(input())): n, T, a, b = map(int, input().split()) hard = [bool(i) for i in map(int, input().split())] time = [(int(i), ind) for ind, i i...
output
1
43,963
14
87,927
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,964
14
87,928
Tags: greedy, sortings, two pointers Correct Solution: ``` m = int(input()) for _ in range(m): n, T, a, b = map(int, input().split()) diff = list(map(int, input().split())) t = list(map(int, input().split())) problem = [] for i in range(n): problem.append((diff[i], t[i])) problem.sort(ke...
output
1
43,964
14
87,929
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,965
14
87,930
Tags: greedy, sortings, two pointers Correct Solution: ``` from bisect import bisect_left as bl from bisect import bisect_right as br # import heapq # import math from collections import * # from functools import reduce,cmp_to_key import sys input = sys.stdin.readline # M = mod = 10**9 + 7 # def factors(n):return sor...
output
1
43,965
14
87,931
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,966
14
87,932
Tags: greedy, sortings, two pointers Correct Solution: ``` import os,io input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline t=int(input()) for _ in range(t): n,t,a,b=map(int,input().split()) qtype=list(map(int,input().split())) time=list(map(int,input().split())) times=[] maxa=0 for i in r...
output
1
43,966
14
87,933
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,967
14
87,934
Tags: greedy, sortings, two pointers Correct Solution: ``` if __name__ == '__main__': num_tests = int(input()) for test in range(num_tests): inp = input().rstrip().split(" ") n = int(inp[0]) T = int(inp[1]) a = int(inp[2]) b = int(inp[3]) inp = input().rstrip()....
output
1
43,967
14
87,935
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,968
14
87,936
Tags: greedy, 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() self.writable = "x" in file.mode ...
output
1
43,968
14
87,937
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solved in T minutes. Thus, the exam begins at...
instruction
0
43,969
14
87,938
Tags: greedy, sortings, two pointers Correct Solution: ``` import sys t = int(input()) ans = [0]*t for pi in range(t): n, T, a, b = map(int, sys.stdin.readline().split()) a1 = list(map(int, sys.stdin.readline().split())) a2 = list(map(int, sys.stdin.readline().split())) easy_count = a1.count(0) har...
output
1
43,969
14
87,939
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
43,994
14
87,988
Tags: math, number theory, sortings Correct Solution: ``` def solve(): n=int(input()) l=[int(l) for l in input().split()] for i in range(n): l[i]=((i+l[i])%n+n)%n if(len(set(l))==n): print("YES") else: print("NO") for _ in range(int(input())): solve() ```
output
1
43,994
14
87,989
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
43,995
14
87,990
Tags: math, number theory, sortings Correct Solution: ``` t=int(input()) for i in range(t): n=int(input()) a=[int(i) for i in input().split()] seta=set() for j in range(n): seta.add((j+a[j])%n) #print(seta,ok) if len(seta)==n: print("YES") else: print("NO") ```
output
1
43,995
14
87,991
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
43,996
14
87,992
Tags: math, number theory, sortings Correct Solution: ``` for _ in range(int(input())): n=int(input()) a=list(map(int,input().split())) rems=[False]*n possible=True for i in range(n): rem=(i+a[i])%n if(rems[rem]): possible=False break rems[rem]=True ...
output
1
43,996
14
87,993
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
43,997
14
87,994
Tags: math, number theory, sortings Correct Solution: ``` for _ in range(int(input())): n = int(input()) a = list( map(int,input().split())) isVisited = False d = {} if n == 1: print('YES') continue for k in range(n): m = (k + a[k])%n if m not in d: d[...
output
1
43,997
14
87,995
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
43,998
14
87,996
Tags: math, number theory, sortings Correct Solution: ``` for _ in range (int(input())) : n =int(input()) l =[int(x) for x in input().split()] for i in range (n) : l[i] = (i+l[i])%n if len(set(l)) == n : print("YES") else : print("NO") ```
output
1
43,998
14
87,997
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
43,999
14
87,998
Tags: math, number theory, sortings Correct Solution: ``` ## necessary imports import sys input = sys.stdin.readline from math import log2, log, ceil # swap_array function def swaparr(arr, a,b): temp = arr[a]; arr[a] = arr[b]; arr[b] = temp ## gcd function def gcd(a,b): if a == 0: return b ...
output
1
43,999
14
87,999
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
44,000
14
88,000
Tags: math, number theory, sortings Correct Solution: ``` for _ in range(int(input())): n=int(input()) a=[int(i) for i in input().split()] d=[] for i in range(n): p=(i+a[i])%n d.append(p) d.sort() f=[] for i in range(n): f.append(i) if(f!=d): print("NO") ...
output
1
44,000
14
88,001
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
44,001
14
88,002
Tags: math, number theory, sortings Correct Solution: ``` import sys def read_int(): return int(sys.stdin.readline()) def read_ints(): return list(map(int, sys.stdin.readline().split())) # t = 6 t = read_int() # input1 = [1, [14], 2, [1, -1], 4, [5, 5, 5, 1], 3, [3, 2, 1], 2, [0, 1], 5, [-239, -2, -100,...
output
1
44,001
14
88,003