message
stringlengths
2
22.7k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
145
109k
cluster
float64
9
9
__index_level_0__
int64
290
217k
Provide tags and a correct Python 3 solution for this coding contest problem. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ...
instruction
0
16,348
9
32,696
Tags: brute force, constructive algorithms, math Correct Solution: ``` n = int(input()) t = [int(input()) for q in range(n)] for i in range(1, 501): for j in range(i, 2 * i + 1): s = [i, j, 4 * i - j, 3 * i] for k in t: if k not in s: break s.remove(k) else: ...
output
1
16,348
9
32,697
Provide tags and a correct Python 3 solution for this coding contest problem. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ...
instruction
0
16,349
9
32,698
Tags: brute force, constructive algorithms, math Correct Solution: ``` if __name__ == "__main__": boxes = int(input()) candy_supply = [] for i in range(boxes): candies = int(input()) candy_supply.append(candies) candy_supply = sorted(candy_supply) if boxes == 4: c_range = can...
output
1
16,349
9
32,699
Provide tags and a correct Python 3 solution for this coding contest problem. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ...
instruction
0
16,350
9
32,700
Tags: brute force, constructive algorithms, math Correct Solution: ``` n = int(input()) ar = [int(input()) for x in range(n)] ar.sort() foobar = 1 def out(*g): g = list(g) g.sort() print("YES") for x in g: print(x) def check(x1,x2,x3,x4): l = [x1,x2,x3,x4] s = sum(l) /4 if s != int(s): return False l....
output
1
16,350
9
32,701
Provide tags and a correct Python 3 solution for this coding contest problem. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ...
instruction
0
16,351
9
32,702
Tags: brute force, constructive algorithms, math Correct Solution: ``` n = int(input()) a = [] for i in range(n): a.append(int(input())) a = sorted(a) #print(a) if n == 0: print('YES') print(1) print(1) print(3) print(3) elif n == 1: print('YES') print(a[0]) print(3 * a[0]) print...
output
1
16,351
9
32,703
Provide tags and a correct Python 3 solution for this coding contest problem. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ...
instruction
0
16,352
9
32,704
Tags: brute force, constructive algorithms, math Correct Solution: ``` def check(arr): arr.sort() a=sum(arr)/len(arr) b=(arr[1]+arr[2])/2 c=arr[-1]-arr[0] return a==b==c n=int(input()) arr=[int(input()) for i in range(n)] arr.sort() if n==0: print("YES") print(1) print(1) print(3...
output
1
16,352
9
32,705
Provide tags and a correct Python 3 solution for this coding contest problem. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ...
instruction
0
16,353
9
32,706
Tags: brute force, constructive algorithms, math Correct Solution: ``` # Why do we fall ? So we can learn to pick ourselves up. n = int(input()) aa = [] ans = "NO" ss = [] for i in range(0,n): aa.append(int(input())) for a in range(1,501): for b in range(a,2*a+2): possible = [a,b,4*a-b,3*a] for...
output
1
16,353
9
32,707
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,354
9
32,708
Yes
output
1
16,354
9
32,709
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,355
9
32,710
Yes
output
1
16,355
9
32,711
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,356
9
32,712
Yes
output
1
16,356
9
32,713
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,357
9
32,714
Yes
output
1
16,357
9
32,715
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,358
9
32,716
No
output
1
16,358
9
32,717
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,359
9
32,718
No
output
1
16,359
9
32,719
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,360
9
32,720
No
output
1
16,360
9
32,721
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By def...
instruction
0
16,361
9
32,722
No
output
1
16,361
9
32,723
Provide tags and a correct Python 3 solution for this coding contest problem. Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit more fun, the friends d...
instruction
0
16,405
9
32,810
Tags: number theory Correct Solution: ``` def gcd(a,b): if b==0: return a else: return gcd(b, a%b) def solve(x, y, a, b): ans="" while not x==1 or not y==1: if x < y: x,y,a,b=y,x,b,a ans+=str((x-1)//y)+a x = x - (x-1)//y * y print (ans) x...
output
1
16,405
9
32,811
Provide tags and a correct Python 3 solution for this coding contest problem. Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit more fun, the friends d...
instruction
0
16,406
9
32,812
Tags: number theory Correct Solution: ``` def gcd(a, b): if b == 0: return a return gcd(b, a % b) class fraction: n, m = 0, 0 def __init__(self, n, m): d = int(gcd(n, m)) self.n = int(n//d) self.m = int(m//d) def add(self, tmp): return fraction(self.n * tmp....
output
1
16,406
9
32,813
Provide tags and a correct Python 3 solution for this coding contest problem. Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit more fun, the friends d...
instruction
0
16,407
9
32,814
Tags: number theory Correct Solution: ``` def gcd(x, y): while y > 0: x, y = y, x % y return x x, y = map(int, input().split()) if gcd(x, y) != 1: print ("Impossible") exit(0) res = "" while x > 0 and y > 0: if y > x: if x == 1: y -= 1 res = res + str(y // x) + "B...
output
1
16,407
9
32,815
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,711
9
33,422
"Correct Solution: ``` input() l = list(map(int, input().split())) l.sort() print(sum([v for i, v in enumerate(l) if i % 2 == 0])) ```
output
1
16,711
9
33,423
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,712
9
33,424
"Correct Solution: ``` input();print(sum(sorted(map(int,input().split()))[::2])) ```
output
1
16,712
9
33,425
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,713
9
33,426
"Correct Solution: ``` n=int(input()) a=list(map(int,input().split())) a.sort() print(sum(a[::2])) ```
output
1
16,713
9
33,427
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,714
9
33,428
"Correct Solution: ``` n=int(input()) print(sum(sorted(list(map(int,input().split())))[0::2])) ```
output
1
16,714
9
33,429
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,715
9
33,430
"Correct Solution: ``` n=int(input()) l = list(map(int, input().split())) l.sort() print(sum(l[::2])) ```
output
1
16,715
9
33,431
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,716
9
33,432
"Correct Solution: ``` N = int(input()) Ls = map(int, input().split()) Ls = sorted(Ls) ans = sum(Ls[2*i] for i in range(N)) print(ans) ```
output
1
16,716
9
33,433
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,717
9
33,434
"Correct Solution: ``` n=int(input()) l=list(map(int,input().split())) l.sort() ans=0 for i in range(0,len(l),2): ans+=l[i] print(ans) ```
output
1
16,717
9
33,435
Provide a correct Python 3 solution for this coding contest problem. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also...
instruction
0
16,718
9
33,436
"Correct Solution: ``` n=int(input()) a=list(map(int,input().split())) a=sorted(a) ans=0 for i in range(n): ans+=a[2*i] print(ans) ```
output
1
16,718
9
33,437
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,719
9
33,438
Yes
output
1
16,719
9
33,439
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,720
9
33,440
Yes
output
1
16,720
9
33,441
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,721
9
33,442
Yes
output
1
16,721
9
33,443
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,722
9
33,444
Yes
output
1
16,722
9
33,445
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,723
9
33,446
No
output
1
16,723
9
33,447
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,724
9
33,448
No
output
1
16,724
9
33,449
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,725
9
33,450
No
output
1
16,725
9
33,451
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke is having a barbeque party. At the party, he will make N servings of Skewer Meal. <image> Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in...
instruction
0
16,726
9
33,452
No
output
1
16,726
9
33,453
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ...
instruction
0
17,229
9
34,458
Yes
output
1
17,229
9
34,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ...
instruction
0
17,230
9
34,460
Yes
output
1
17,230
9
34,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ...
instruction
0
17,233
9
34,466
No
output
1
17,233
9
34,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ...
instruction
0
17,235
9
34,470
No
output
1
17,235
9
34,471
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ...
instruction
0
17,236
9
34,472
No
output
1
17,236
9
34,473
Provide tags and a correct Python 3 solution for this coding contest problem. Sasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentration <image>. Today, on the party in honour of Sergiy of Vancouver they decided to prepare ...
instruction
0
17,330
9
34,660
Tags: dfs and similar, graphs, shortest paths Correct Solution: ``` from collections import deque MAX_A = 1000 def main(): n, k = map(int, input().split()) a = set(int(x) - n for x in input().split()) visited = [False] * (2 * MAX_A + 1) visited[n] = True Q = deque() Q.append((n, 0)) re...
output
1
17,330
9
34,661
Provide tags and a correct Python 3 solution for this coding contest problem. Sasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentration <image>. Today, on the party in honour of Sergiy of Vancouver they decided to prepare ...
instruction
0
17,331
9
34,662
Tags: dfs and similar, graphs, shortest paths Correct Solution: ``` n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() if n < a[0] or n > a[k - 1]: print(-1) else: b = [] b.append(a[0]) for i in a: if i != b[len(b) - 1]: b.append(i) d = {} for i in...
output
1
17,331
9
34,663
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover e...
instruction
0
17,418
9
34,836
Yes
output
1
17,418
9
34,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover e...
instruction
0
17,419
9
34,838
Yes
output
1
17,419
9
34,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. At the children's festival, children were dancing in a circle. When music stopped playing, the children were still standing in a circle. Then Lena remembered, that her parents gave her a candy b...
instruction
0
17,722
9
35,444
No
output
1
17,722
9
35,445
Provide tags and a correct Python 3 solution for this coding contest problem. Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same a...
instruction
0
17,785
9
35,570
Tags: brute force, implementation Correct Solution: ``` a=[int(i) for i in input().split()] a.sort() if a[3]==sum(a)-a[3]: print('YES') elif a[0]+a[3]==a[1]+a[2]: print('YES') else: print('NO') ```
output
1
17,785
9
35,571
Provide tags and a correct Python 3 solution for this coding contest problem. Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same a...
instruction
0
17,786
9
35,572
Tags: brute force, implementation Correct Solution: ``` import sys import math import collections import heapq import decimal input=sys.stdin.readline l=sorted([int(i) for i in input().split()]) if(l[0]+l[3]==l[1]+l[2] or l[0]+l[1]+l[2]==l[3]): print("YES") else: print("NO") ```
output
1
17,786
9
35,573
Provide tags and a correct Python 3 solution for this coding contest problem. Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same a...
instruction
0
17,787
9
35,574
Tags: brute force, implementation Correct Solution: ``` a, b, c, d = map(int, input().split()) if (a + b == c + d or a + c == b + d or a + d == b + c or a + b + c == d or a + b + d == c or a + c + d == b or b + c + d == a): print("YES") else: print("NO") ```
output
1
17,787
9
35,575
Provide tags and a correct Python 3 solution for this coding contest problem. Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same a...
instruction
0
17,788
9
35,576
Tags: brute force, implementation Correct Solution: ``` a=list(map(int,input().split())) b=max(a) c=a.index(b) if a[0]+a[1]==a[2]+a[3]: print("YES") elif a[0]+a[2]==a[1]+a[3]: print("YES") elif a[0]+a[3]==a[1]+a[2]: print("YES") elif sum(a)==2*a[c]: print("YES") else: print("NO") ```
output
1
17,788
9
35,577
Provide tags and a correct Python 3 solution for this coding contest problem. Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same a...
instruction
0
17,789
9
35,578
Tags: brute force, implementation Correct Solution: ``` a1, a2, a3, a4 = map(int, input().split()) n = sum([a1, a2, a3, a4]) if n % 2 != 0: print('NO') else: if (a1 + a3 == a2 + a4 or a1 + a4 == a2 + a3 or a1 + a2 == a3 + a4): print('YES') elif (a1 - (n - a1) == 0 or a2 - ...
output
1
17,789
9
35,579
Provide tags and a correct Python 3 solution for this coding contest problem. Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same a...
instruction
0
17,790
9
35,580
Tags: brute force, implementation Correct Solution: ``` a = list(map(int, input().split())) a.sort() if a[3] == a[0]+a[1]+a[2] or a[3]+a[0] == a[1]+a[2]: print("YES") else: print("NO") ```
output
1
17,790
9
35,581
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in ...
instruction
0
17,791
9
35,582
No
output
1
17,791
9
35,583