message stringlengths 2 433k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 113 108k | cluster float64 12 12 | __index_level_0__ int64 226 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | instruction | 0 | 90,404 | 12 | 180,808 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
arr = list(map(int, input().split()))
ideal = sorted(arr)
i = 0
c = 0
f = 1
while i < n:
if arr[i] != ideal[i]:
c += 1
i += 1
if c > 2:
f = 0
break
if f == 1:
print('YES')
else:
print('NO')
# little elephan... | output | 1 | 90,404 | 12 | 180,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | instruction | 0 | 90,405 | 12 | 180,810 |
Tags: implementation, sortings
Correct Solution:
```
# Target - Expert on CF
# Be Humblefool
import sys
# inf = float("inf")
# sys.setrecursionlimit(10000000)
# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, ... | output | 1 | 90,405 | 12 | 180,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | instruction | 0 | 90,406 | 12 | 180,812 |
Tags: implementation, sortings
Correct Solution:
```
n=int(input());lt=list(map(int,input().split()))
ltt=sorted(lt)
cnt=sum(lt[i]!=ltt[i] for i in range(n))
if(cnt>2):print('NO');exit(0)
print('YES')
``` | output | 1 | 90,406 | 12 | 180,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | instruction | 0 | 90,407 | 12 | 180,814 |
Tags: implementation, sortings
Correct Solution:
```
n=int(input())
#n,k=map(int,input().split())
a=list(map(int, input().split()))
b=sorted(a)
f=0
for i in range(n):
if a[i]!=b[i]:
f+=1
if f<=2:
print("YES")
else:
print("NO")
``` | output | 1 | 90,407 | 12 | 180,815 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | instruction | 0 | 90,408 | 12 | 180,816 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
a = []
b = input()
i = 0
while i < len(b):
to_add = ""
while i < len(b) and b[i] != " ":
to_add += b[i]
i += 1
a.append(int(to_add))
i += 1
two_times = False
first = second = -1
prev = -1
for i in range(1, n):
if... | output | 1 | 90,408 | 12 | 180,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | instruction | 0 | 90,409 | 12 | 180,818 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
A = [int(a) for a in input().split()]
B = A.copy()
B.sort()
c = 0
for i in range(n):
a = A[i]
b = B[i]
if a == b:
continue
else:
c += 1
if c == 0 or c == 2:
print("YES")
else:
print("NO")
``` | output | 1 | 90,409 | 12 | 180,819 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | instruction | 0 | 90,410 | 12 | 180,820 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
c = [int(x) for x in input().split(' ')]
d = sorted(c)
v = 0
for i in range(n):
if c[i] != d[i]: v += 1
#print(v)
if v < 3: print('YES')
else: print('NO')
``` | output | 1 | 90,410 | 12 | 180,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,411 | 12 | 180,822 |
Yes | output | 1 | 90,411 | 12 | 180,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,412 | 12 | 180,824 |
Yes | output | 1 | 90,412 | 12 | 180,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,413 | 12 | 180,826 |
Yes | output | 1 | 90,413 | 12 | 180,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,414 | 12 | 180,828 |
Yes | output | 1 | 90,414 | 12 | 180,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,415 | 12 | 180,830 |
No | output | 1 | 90,415 | 12 | 180,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,416 | 12 | 180,832 |
No | output | 1 | 90,416 | 12 | 180,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,417 | 12 | 180,834 |
No | output | 1 | 90,417 | 12 | 180,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't ... | instruction | 0 | 90,418 | 12 | 180,836 |
No | output | 1 | 90,418 | 12 | 180,837 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given array ai of length n. You may consecutively apply two operations to this array:
* remove some subsegment (continuous subsequence) of length m < n and pay for it mΒ·a coins;
* ... | instruction | 0 | 90,544 | 12 | 181,088 |
No | output | 1 | 90,544 | 12 | 181,089 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given array ai of length n. You may consecutively apply two operations to this array:
* remove some subsegment (continuous subsequence) of length m < n and pay for it mΒ·a coins;
* ... | instruction | 0 | 90,545 | 12 | 181,090 |
No | output | 1 | 90,545 | 12 | 181,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given array ai of length n. You may consecutively apply two operations to this array:
* remove some subsegment (continuous subsequence) of length m < n and pay for it mΒ·a coins;
* ... | instruction | 0 | 90,546 | 12 | 181,092 |
No | output | 1 | 90,546 | 12 | 181,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given array ai of length n. You may consecutively apply two operations to this array:
* remove some subsegment (continuous subsequence) of length m < n and pay for it mΒ·a coins;
* ... | instruction | 0 | 90,547 | 12 | 181,094 |
No | output | 1 | 90,547 | 12 | 181,095 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider an array A with N elements, all being the same integer a.
Define the product transformation as a simultaneous update Ai = AiΒ·Ai + 1, that is multiplying each element to the element rig... | instruction | 0 | 90,622 | 12 | 181,244 |
No | output | 1 | 90,622 | 12 | 181,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider an array A with N elements, all being the same integer a.
Define the product transformation as a simultaneous update Ai = AiΒ·Ai + 1, that is multiplying each element to the element rig... | instruction | 0 | 90,623 | 12 | 181,246 |
No | output | 1 | 90,623 | 12 | 181,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider an array A with N elements, all being the same integer a.
Define the product transformation as a simultaneous update Ai = AiΒ·Ai + 1, that is multiplying each element to the element rig... | instruction | 0 | 90,624 | 12 | 181,248 |
No | output | 1 | 90,624 | 12 | 181,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider an array A with N elements, all being the same integer a.
Define the product transformation as a simultaneous update Ai = AiΒ·Ai + 1, that is multiplying each element to the element rig... | instruction | 0 | 90,625 | 12 | 181,250 |
No | output | 1 | 90,625 | 12 | 181,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,662 | 12 | 181,324 |
Tags: greedy, implementation
Correct Solution:
```
n, m = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
sm1 = sm2 = 0
i = j = 0
cnt = 0
moveX = moveY = True
while i < len(xs):
if moveX:
sm1 += xs[i]
if moveY:
sm2 += ys[j]
if sm1 < sm2:... | output | 1 | 90,662 | 12 | 181,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,663 | 12 | 181,326 |
Tags: greedy, implementation
Correct Solution:
```
n,m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
i1 = 0
i2 = 0
sum1 = x[0]
sum2 = y[0]
count = 0
while i1 != n and i2 != m:
while sum1 < sum2:
i1 += 1
if i1 == n:
break
sum1 += x[i1]
if i1 == ... | output | 1 | 90,663 | 12 | 181,327 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,664 | 12 | 181,328 |
Tags: greedy, implementation
Correct Solution:
```
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
ans = 0
i = 0
j = 0
sumx = 0
sumy = 0
while i < n and j < m:
if sumx <= sumy:
sumx += x[i]
i += 1
if sumy < sumx:
sumy += y[j]
... | output | 1 | 90,664 | 12 | 181,329 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,665 | 12 | 181,330 |
Tags: greedy, implementation
Correct Solution:
```
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
filesCnt = 0
xs = 0
ys = 0
xcnt = 0
ycnt = 0
while n >= xcnt or m >= ycnt:
# print(xs, ys)
if xs == ys and xs != 0:
filesCnt += 1
xs = 0
ys... | output | 1 | 90,665 | 12 | 181,331 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,666 | 12 | 181,332 |
Tags: greedy, implementation
Correct Solution:
```
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
j = 0
s = a[0]
t = b[0]
k = 0
while i != n and j != m:
while s < t:
i += 1
s += a[i]
while t < s:
j += 1
t += b[j]
... | output | 1 | 90,666 | 12 | 181,333 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,667 | 12 | 181,334 |
Tags: greedy, implementation
Correct Solution:
```
n,m = map(int,input().split(' '))
a = list(map(int,input().split(' ')))
b = list(map(int,input().split(' ')))
i = j = 0
sa = a[0]
sb = b[0]
k = 0
while i<n-1 and j<m-1:
if sa<sb:
i+=1
sa+=a[i]
elif sb<sa:
j+=1
sb+=b[j]
else:
... | output | 1 | 90,667 | 12 | 181,335 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,668 | 12 | 181,336 |
Tags: greedy, implementation
Correct Solution:
```
import os
import sys
debug = True
if debug and os.path.exists("input.in"):
input = open("input.in", "r").readline
else:
debug = False
input = sys.stdin.readline
def inp():
return (int(input()))
def inlt():
return (list(map(int, input().split(... | output | 1 | 90,668 | 12 | 181,337 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive contai... | instruction | 0 | 90,669 | 12 | 181,338 |
Tags: greedy, implementation
Correct Solution:
```
n, m = map(int, input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
file=0; sum1=0; sum2=0; i=0; j=0
while i<n or j<m:
if sum1 >= sum2:
sum2 += arr2[j]
j+=1
else:
sum1 += arr1[i]... | output | 1 | 90,669 | 12 | 181,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,670 | 12 | 181,340 |
Yes | output | 1 | 90,670 | 12 | 181,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,671 | 12 | 181,342 |
Yes | output | 1 | 90,671 | 12 | 181,343 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,672 | 12 | 181,344 |
Yes | output | 1 | 90,672 | 12 | 181,345 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,673 | 12 | 181,346 |
Yes | output | 1 | 90,673 | 12 | 181,347 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,674 | 12 | 181,348 |
No | output | 1 | 90,674 | 12 | 181,349 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,675 | 12 | 181,350 |
No | output | 1 | 90,675 | 12 | 181,351 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,676 | 12 | 181,352 |
No | output | 1 | 90,676 | 12 | 181,353 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows... | instruction | 0 | 90,677 | 12 | 181,354 |
No | output | 1 | 90,677 | 12 | 181,355 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Given a permutation of length $ N $ $ P = \\ {P_1, P_2, \ ldots, P_N \\} $ and the integer $ K $.
Determine if the permutation $ P $ can be monotonically increased by repeating the following operation any number of times $ 0 $ or more.
* Ch... | instruction | 0 | 90,935 | 12 | 181,870 |
"Correct Solution:
```
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.st... | output | 1 | 90,935 | 12 | 181,871 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,082 | 12 | 182,164 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
from collections import defaultdict
for _ in range(int(input())):
n, x = map(int, input().split())
a = list(map(int, input().split()))
b = [0]*n
b[0] = a[0]%x
if a[0] % x == 0:
f = True
else:
f ... | output | 1 | 91,082 | 12 | 182,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,083 | 12 | 182,166 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
t = int(input())
for i in range(t):
n = int(input())
arr = [int(x) for x in input().split()]
vis = {k:False for k in range(n)}
S = set()
res = 0
for i in range(n):
if(arr[i] not in S):
S.a... | output | 1 | 91,083 | 12 | 182,167 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,084 | 12 | 182,168 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
l = set(map(int, input().split()))
print(len(l))
``` | output | 1 | 91,084 | 12 | 182,169 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,085 | 12 | 182,170 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
for _ in range(int(input())):
n,x=map(int,input().split())
a=list(map(int,input().split()))
l=[]
s=0
for i in range(n):
l.append(a[i]%x)
s=(s+(a[i]%x))%x
if s!=0:
print(n)
elif l.cou... | output | 1 | 91,085 | 12 | 182,171 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,086 | 12 | 182,172 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
n=int(input())
for i in range(n):
a,b=map(int,input().split())
s=list(map(int,input().split()))
sum=0
t=-1
for i in range(a):
sum=sum+s[i]
s[i]=sum
if not sum%b==0:
print(a)
else:
... | output | 1 | 91,086 | 12 | 182,173 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,087 | 12 | 182,174 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
from sys import stdin, stdout
"""
n = stdin.readline()
arr = [int(x) for x in stdin.readline().split()]
stdout.write(str(summation))
"""
t = int(stdin.readline())
for test in range(t) :
n = int(stdin.readline(... | output | 1 | 91,087 | 12 | 182,175 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,088 | 12 | 182,176 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
q = int(input())
for i in range(1,q+1):
n = int(input())
a = [int(c) for c in input().split()]
print(len(set(a)))
``` | output | 1 | 91,088 | 12 | 182,177 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.
An array a... | instruction | 0 | 91,089 | 12 | 182,178 |
Tags: brute force, data structures, number theory, two pointers
Correct Solution:
```
t = int(input())
while t>0:
n = int(input())
temp = list(map(int,input().split()))
ans = 0
a = []
#print(type(a))
for i in range(0,n,1):
a.insert(i,temp[i])
a.sort()
for i in range(1,n,1):
... | output | 1 | 91,089 | 12 | 182,179 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determin... | instruction | 0 | 91,090 | 12 | 182,180 |
Yes | output | 1 | 91,090 | 12 | 182,181 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determin... | instruction | 0 | 91,091 | 12 | 182,182 |
Yes | output | 1 | 91,091 | 12 | 182,183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.