message stringlengths 2 43.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 853 107k | cluster float64 24 24 | __index_level_0__ int64 1.71k 214k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: how many times he turned beautiful number of ye... | instruction | 0 | 60,774 | 24 | 121,548 |
Tags: implementation
Correct Solution:
```
from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import os,sys
int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline()
multi... | output | 1 | 60,774 | 24 | 121,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: how many times he turned beautiful number of ye... | instruction | 0 | 60,775 | 24 | 121,550 |
Tags: implementation
Correct Solution:
```
n = int(input())
for a in range(n):
x = input()
l = int(len(x))
count = 9*(l-1)
x = int(x)
count += x//((10**l-1)//9)
print(count)
``` | output | 1 | 60,775 | 24 | 121,551 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: how many times he turned beautiful number of ye... | instruction | 0 | 60,776 | 24 | 121,552 |
Tags: implementation
Correct Solution:
```
from math import *
def r1(t):
return t(input())
def r2(t):
return [t(i) for i in input().split()]
for _ in range(r1(int)):
n = r1(int)
ans = 0
for i in range(1, 10):
cn = i
while cn <= n:
ans += 1
cn = cn*10 + i
... | output | 1 | 60,776 | 24 | 121,553 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,777 | 24 | 121,554 |
Yes | output | 1 | 60,777 | 24 | 121,555 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,778 | 24 | 121,556 |
Yes | output | 1 | 60,778 | 24 | 121,557 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,779 | 24 | 121,558 |
Yes | output | 1 | 60,779 | 24 | 121,559 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,780 | 24 | 121,560 |
Yes | output | 1 | 60,780 | 24 | 121,561 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,781 | 24 | 121,562 |
No | output | 1 | 60,781 | 24 | 121,563 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,782 | 24 | 121,564 |
No | output | 1 | 60,782 | 24 | 121,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,783 | 24 | 121,566 |
No | output | 1 | 60,783 | 24 | 121,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!
Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering: ... | instruction | 0 | 60,784 | 24 | 121,568 |
No | output | 1 | 60,784 | 24 | 121,569 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,785 | 24 | 121,570 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
from collections import defaultdict, deque
from sys import stdin
input = stdin.readline
if __name__ == '__main__':
n, m = map(int, input().split())
err = [tuple(map(int, input().split())) for _ in range(m)]
k = int(input())
prr = list... | output | 1 | 60,785 | 24 | 121,571 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,786 | 24 | 121,572 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
n, m = map(int, input().split())
Q = [[]for _ in range(n)]
for _ in range(m):
u, v = map(int, input().split())
u -= 1
v -= 1
Q[v].append(u)
k = int(input())
p = [int(T) - 1 for T in input().split()]
W = [-1] * n
E = [0] * n
q = [(p[-1],... | output | 1 | 60,786 | 24 | 121,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,787 | 24 | 121,574 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
# from debug import debug
inf = int(1e10)
n, m = map(int, input().split())
trans = [[] for i in range(n)]
graph = [[] for i in range(n)]
for i in range(m):
a,b = map(int, input().split())
trans[b-1].append(a-1)
graph[a-1].append(b-1)
k = int(inpu... | output | 1 | 60,787 | 24 | 121,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,788 | 24 | 121,576 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
from collections import deque
from sys import stdin
nV, nE = map(int, stdin.readline().split())
g = [[] for _ in range(nV + 1)]
rev = [[] for _ in range(nV + 1)]
for _ in range(nE):
u, v = map(int, stdin.readline().split())
g[u].append(v)
... | output | 1 | 60,788 | 24 | 121,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,789 | 24 | 121,578 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
import sys
from io import BytesIO, IOBase
from collections import deque
def bfs(tree,s):
n=len(tree)
h=[0]*(n+1)
v=[0]*(n+1)
q=deque()
q.append((s,0))
v[s... | output | 1 | 60,789 | 24 | 121,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,790 | 24 | 121,580 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
import sys
n, m = list(map(int, sys.stdin.readline().strip().split()))
N = [[] for i in range (0, n+1)]
N2 = [[] for i in range (0, n+1)]
for i in range (0, m):
u, v = list(map(int, sys.stdin.readline().strip().split()))
N[u].append(v)
N2[... | output | 1 | 60,790 | 24 | 121,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,791 | 24 | 121,582 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
from types import GeneratorType
INF = 1e10
def bootstrap(f, stack=[]):
def wrappedfunc(*args, **kwargs):
if stack:
return f(*args, **kwargs)
else:
to = f(*args, **kwargs)
while True:
... | output | 1 | 60,791 | 24 | 121,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from on... | instruction | 0 | 60,792 | 24 | 121,584 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
from heapq import heappop, heappush
def multi_dijkstra(G, starts):
n = len(G)
dist = [float("inf")]*n
visited = set()
heap = []
for i in starts:
he... | output | 1 | 60,792 | 24 | 121,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,793 | 24 | 121,586 |
Yes | output | 1 | 60,793 | 24 | 121,587 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,794 | 24 | 121,588 |
Yes | output | 1 | 60,794 | 24 | 121,589 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,795 | 24 | 121,590 |
Yes | output | 1 | 60,795 | 24 | 121,591 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,796 | 24 | 121,592 |
Yes | output | 1 | 60,796 | 24 | 121,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,797 | 24 | 121,594 |
No | output | 1 | 60,797 | 24 | 121,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,798 | 24 | 121,596 |
No | output | 1 | 60,798 | 24 | 121,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,799 | 24 | 121,598 |
No | output | 1 | 60,799 | 24 | 121,599 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any othe... | instruction | 0 | 60,800 | 24 | 121,600 |
No | output | 1 | 60,800 | 24 | 121,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,937 | 24 | 121,874 |
Tags: math
Correct Solution:
```
def f(l1,al):
n,b = l1
c = (sum(al) + b)/n
if max(al)>c:
return [-1]
return [c-a for a in al]
l1 = list(map(int,input().split()))
l2 = list(map(int,input().split()))
[print(r) for r in f(l1,l2)]
``` | output | 1 | 60,937 | 24 | 121,875 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,938 | 24 | 121,876 |
Tags: math
Correct Solution:
```
n,b=map(int,input().split())
d=list(map(int,input().split()))
l1=[]
mx=max(d)
for item in d:
l1.append(mx-item)
b-=(mx-item)
if b<0:
print(-1)
else:
for i in range(len(l1)):
l1[i]+=(b/n)
for item in l1:
print(format(item,'.6f'))
``` | output | 1 | 60,938 | 24 | 121,877 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,939 | 24 | 121,878 |
Tags: math
Correct Solution:
```
I = lambda: map(int, input().split())
n, b = I()
A = list(I())
x = (b+sum(A)) / n
if x < max(A):
print(-1)
else:
print(*(x-a for a in A), sep='\n')
``` | output | 1 | 60,939 | 24 | 121,879 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,940 | 24 | 121,880 |
Tags: math
Correct Solution:
```
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=0
for j in range(n):
s=s+a[j]
s=s+m
e=s/n
t=0
for i in range(n):
if e-a[i]>=0:
a[i]=e-a[i]
else:
print(-1)
t=1
break
if t==0:
print(*a,sep="\n")
``` | output | 1 | 60,940 | 24 | 121,881 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,941 | 24 | 121,882 |
Tags: math
Correct Solution:
```
n, b = map(int, input().split())
a = [int(i) for i in input().split()]
d = [(b + sum(a)) / len(a) - i for i in a]
print(-1) if any(i for i in d if i < 0) else [print(i) for i in d]
``` | output | 1 | 60,941 | 24 | 121,883 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,942 | 24 | 121,884 |
Tags: math
Correct Solution:
```
x=[int(i) for i in input().split()]
n=x[0]
y=[int(i) for i in input().split()]
if x[1]<max(y)*n-sum(y):
print(-1)
raise SystemExit
for i in range(n):
s=x[1]/n-y[i]++sum(y)/n
print('%.6f'% s)
``` | output | 1 | 60,942 | 24 | 121,885 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,943 | 24 | 121,886 |
Tags: math
Correct Solution:
```
n, b = map(int, input().split())
t = list(map(int, input().split()))
s, d = sum(t), max(t)
b -= d * n - s
if b < 0: print(-1)
else:
d += b / n
for i in range(n): t[i] = str(d - t[i])
print('\n'.join(t))
``` | output | 1 | 60,943 | 24 | 121,887 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volum... | instruction | 0 | 60,944 | 24 | 121,888 |
Tags: math
Correct Solution:
```
n, b = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
sumN = 0
for i in range(n):
sumN += a[i]
ans = (sumN + b) / n
if ans - max(a) < 0:
print(-1)
exit(0)
for i in range(n):
print(ans - a[i])
``` | output | 1 | 60,944 | 24 | 121,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,945 | 24 | 121,890 |
Yes | output | 1 | 60,945 | 24 | 121,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,946 | 24 | 121,892 |
Yes | output | 1 | 60,946 | 24 | 121,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,947 | 24 | 121,894 |
Yes | output | 1 | 60,947 | 24 | 121,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,948 | 24 | 121,896 |
Yes | output | 1 | 60,948 | 24 | 121,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,949 | 24 | 121,898 |
No | output | 1 | 60,949 | 24 | 121,899 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,950 | 24 | 121,900 |
No | output | 1 | 60,950 | 24 | 121,901 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,951 | 24 | 121,902 |
No | output | 1 | 60,951 | 24 | 121,903 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is real... | instruction | 0 | 60,952 | 24 | 121,904 |
No | output | 1 | 60,952 | 24 | 121,905 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp is making a quest for his friends. He has already made n tasks, for each task the boy evaluated how interesting it is as an integer qi, and the time ti in minutes needed to complete the task.
An interesting feature of his quest is... | instruction | 0 | 63,525 | 24 | 127,050 |
Tags: dp, greedy
Correct Solution:
```
from collections import defaultdict
if __name__ == '__main__':
n, T = [int(_) for _ in input().split()]
data = defaultdict(list)
for i in range(n):
t, q = [int(_) for _ in input().split()]
data[T - t].append(q)
prev_level = []
for level_id in... | output | 1 | 63,525 | 24 | 127,051 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and brought n coins.
H... | instruction | 0 | 64,100 | 24 | 128,200 |
Tags: math
Correct Solution:
```
t=int(input())
for q in range(t):
a=[int(x) for x in input().split()]
total=a[3]
a=a[0:3]
a.sort(reverse=True)
diff1=a[0]-a[2]
diff2=a[0]-a[1]
total=total-diff1-diff2
if total%3==0 and total>=0:
print("YES")
else:
print("NO")
``` | output | 1 | 64,100 | 24 | 128,201 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and brought n coins.
H... | instruction | 0 | 64,101 | 24 | 128,202 |
Tags: math
Correct Solution:
```
def call():
a,b,c,n=map(int,input().split())
l=[a,b,c]
l.sort()
n-=2*l[2]-l[1]-l[0]
print(("YES","NO")[n<0 or n%3!=0])
for _ in range(int(input())):
call()
``` | output | 1 | 64,101 | 24 | 128,203 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and brought n coins.
H... | instruction | 0 | 64,102 | 24 | 128,204 |
Tags: math
Correct Solution:
```
n = int(input())
for i in range(n):
x = list(map(int, input().split()))
if sum(x) % 3 == 0:
mean = sum(x) // 3
flag = True
for i in range(3):
if x[i] > mean:
flag = False
if flag:
print("YES")
else:... | output | 1 | 64,102 | 24 | 128,205 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and brought n coins.
H... | instruction | 0 | 64,103 | 24 | 128,206 |
Tags: math
Correct Solution:
```
t = int(input())
for i in range(t):
a, b, c, n = map(int, input().split())
mx = max(max(a, b), c)
mn = mx-a + mx-b + mx-c
res = "NO" if n<mn or (n-mn)%3!=0 else "YES"
print(res)
``` | output | 1 | 64,103 | 24 | 128,207 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and brought n coins.
H... | instruction | 0 | 64,104 | 24 | 128,208 |
Tags: math
Correct Solution:
```
n=int(input())
for i in range(n):
l=list(map(int,input().split()))
s=sum(l)
k=l.pop()
l.sort()
a=l[2]
b=a-l[0]
c=a-l[1]
k=k-(b+c)
if(k>=0):
if((k%3)==0):
print("YES")
else:
print("NO")
else:
print("N... | output | 1 | 64,104 | 24 | 128,209 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and brought n coins.
H... | instruction | 0 | 64,105 | 24 | 128,210 |
Tags: math
Correct Solution:
```
num_test = int(input())
for test in range(num_test):
test_input = input().split()
a = int(test_input[0])
b = int(test_input[1])
c = int(test_input[2])
n = int(test_input[3])
all_coin = a + b + c + n
if all_coin % 3 != 0:
print("NO")
else:
... | output | 1 | 64,105 | 24 | 128,211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.