message stringlengths 2 59.7k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 37 108k | cluster float64 20 20 | __index_level_0__ int64 74 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
One day Petya was del... | instruction | 0 | 54,879 | 20 | 109,758 |
Tags: brute force, implementation
Correct Solution:
```
s = input()
a,b = s.count('4'),s.count('7')
if a==b and a==0:
print(-1)
elif a>=b:
print(4)
else:
print(7)
``` | output | 1 | 54,879 | 20 | 109,759 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
One day Petya was del... | instruction | 0 | 54,880 | 20 | 109,760 |
Tags: brute force, implementation
Correct Solution:
```
n=input()
m={
'4':0,
'7':0
}
for i in n:
if i in m:
m[i]+=1
if m['4']==0 and m['7']==0:
print(-1)
else:
if m['4']==m['7'] or m['4']>=m['7'] :
print(4)
else:
print(7)
``` | output | 1 | 54,880 | 20 | 109,761 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
One day Petya was del... | instruction | 0 | 54,881 | 20 | 109,762 |
Tags: brute force, implementation
Correct Solution:
```
n=list(input())
a,b=0,0
for i in n:
if i=="4":
a+=1
elif i=="7":
b+=1
if(a==b==0):
print("-1")
elif(a>=b):
print(4)
else:
print(7)
``` | output | 1 | 54,881 | 20 | 109,763 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
One day Petya was del... | instruction | 0 | 54,882 | 20 | 109,764 |
Tags: brute force, implementation
Correct Solution:
```
n = input()
if "4" in n and "7" not in n:
print(4)
elif "7" in n and "4" not in n:
print(7)
elif "4" and "7" not in n:
print(-1)
else:
if n.count("4")==n.count("7") or n.count("4")>n.count("7"):
print("4")
else:print("7")
``` | output | 1 | 54,882 | 20 | 109,765 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
One day Petya was del... | instruction | 0 | 54,883 | 20 | 109,766 |
Tags: brute force, implementation
Correct Solution:
```
s=input().strip()
n=len(s)
flag=0
for i in range(len(s)):
if(int(s[i]) == 4 or int(s[i]) == 7):
flag=1
break
if(flag == 0):
print(-1)
else:
c=0
c1=0
for i in range(len(s)):
if(int(s[i]) == 4):
c+=1
el... | output | 1 | 54,883 | 20 | 109,767 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
One day Petya was del... | instruction | 0 | 54,884 | 20 | 109,768 |
Tags: brute force, implementation
Correct Solution:
```
def main(s):
fours = len(list(filter(lambda c: c == '4', s)))
sevens = len(list(filter(lambda c: c == '7', s)))
if fours == 0 and sevens == 0:
return -1
if fours >= sevens:
return "4"
else:
return "7"
print(main(list(in... | output | 1 | 54,884 | 20 | 109,769 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,885 | 20 | 109,770 |
Yes | output | 1 | 54,885 | 20 | 109,771 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,886 | 20 | 109,772 |
Yes | output | 1 | 54,886 | 20 | 109,773 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,887 | 20 | 109,774 |
Yes | output | 1 | 54,887 | 20 | 109,775 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,888 | 20 | 109,776 |
Yes | output | 1 | 54,888 | 20 | 109,777 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,889 | 20 | 109,778 |
No | output | 1 | 54,889 | 20 | 109,779 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,890 | 20 | 109,780 |
No | output | 1 | 54,890 | 20 | 109,781 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,891 | 20 | 109,782 |
No | output | 1 | 54,891 | 20 | 109,783 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 54,892 | 20 | 109,784 |
No | output | 1 | 54,892 | 20 | 109,785 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 54,997 | 20 | 109,994 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
import sys
input=sys.stdin.readline
a,b,k=map(int,input().split())
if a==0 or b==1 :
if k==0 :
print("YES")
for i in range(b) :
print(1,end="")
for i in range(a) :
print(0,end="")
prin... | output | 1 | 54,997 | 20 | 109,995 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 54,998 | 20 | 109,996 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
a, b, k = map(int, input().split())
if a >= k and b > 1:
print("YES")
for i in range(b - 1):
print(1, end='')
for i in range(a - k):
print(0, end='')
print(1, end='')
for i in range(k):
print(0, end='... | output | 1 | 54,998 | 20 | 109,997 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 54,999 | 20 | 109,998 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
a,b,k=map(int,input().split())
n=a+b
if k==n:
print("no")
elif k==0:
print("yes")
s=["1"]*(b)+["0"]*(a)
print("".join(s))
print("".join(s))
elif a==0:
print("no")
elif k==n-1:
print('no')
else:
if (k+1)<=b:
... | output | 1 | 54,999 | 20 | 109,999 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 55,000 | 20 | 110,000 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
a,b,k=map(int,input().split());
if a==k==0 and b==1:
print("Yes");
print(1);
print(1);
elif k>(a+b-2) or (b==1 and k>0) or (a==0 and k>0):
print("No");
elif k==0:
sa='1';
sb='1';
b-=1;
while(b):
s... | output | 1 | 55,000 | 20 | 110,001 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 55,001 | 20 | 110,002 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
a, b, k = map(int, input().strip().split())
if k == 0:S = "1"*b + "0"*a;print("Yes\n"+S+"\n"+S)
elif a == 0 or b == 1:print("No")
else:
if k <= a+b-2:S = "1"*(b-1) + "0"*(a-1);print(f"Yes\n{S[:a+b-k-1]}1{S[a+b-k-1:]}0\n{S[:a+b-k-1]}0{S[a+b... | output | 1 | 55,001 | 20 | 110,003 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 55,002 | 20 | 110,004 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def LI(): return list(map(in... | output | 1 | 55,002 | 20 | 110,005 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 55,003 | 20 | 110,006 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
a, b, k = map(int, input().split())
b -= 1
if a == 0:
if k == 0:
x = '1'*b
y = '1'*b
else:
x = None
y = None
elif b == 0:
if k == 0:
x = '0'*a
y = '0'*a
else:
x = None
y = None
else:
if k >= a+b:
x ... | output | 1 | 55,003 | 20 | 110,007 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three integers a, b, k.
Find two binary integers x and y (x ≥ y) such that
1. both x and y consist of a zeroes and b ones;
2. x - y (also written in binary form) has exactly k ones.
You are not allowed to use leading ... | instruction | 0 | 55,004 | 20 | 110,008 |
Tags: bitmasks, constructive algorithms, greedy, math
Correct Solution:
```
a, b, k = map(int,input().split())
if b==1:
if k==0:
print("Yes")
print('1'+'0'*a)
print('1'+'0'*a)
else:
print("No")
elif a==0:
if k==0:
print("Yes")
print('1'*b)
print('1'*b)
else:
print("No")
elif k <= a:
print("Yes")
L... | output | 1 | 55,004 | 20 | 110,009 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,077 | 20 | 110,154 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0]!=0:
print(-1)
exit()
s = sum(a)%3
if s!=0:
b = next((i for i, v in enumerate(a) if v%3==s), None)
if b is None:
del a[next((i for i, v in enumer... | output | 1 | 55,077 | 20 | 110,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,078 | 20 | 110,156 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq
#sys.setrecursionlimit(300000)
#^^^TAKE CARE FOR MEMORY LIMIT^^^
def main():
pass
BUFSIZE = 8192
class FastIO(IOBase):
newlin... | output | 1 | 55,078 | 20 | 110,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,079 | 20 | 110,158 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
d = Counter(a)
if d.get(0):
d[0] -= 1
s = sum(a)
if s % 3 == 1:
b = False
for elem in [1, 4, 7]:
if d.get(elem):
... | output | 1 | 55,079 | 20 | 110,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,080 | 20 | 110,160 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
from sys import stdin,stdout
nmbr=lambda:int(stdin.readline())
lst = lambda: list(map(int,input().split()))
for _ in range(1):#nmbr():
n=nmbr()
a=sorted(lst(),reverse=True)
sm=sum(a)
ans=[]
if a[-1]!=0:
print(-1)
... | output | 1 | 55,080 | 20 | 110,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,081 | 20 | 110,162 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
def diminish(count, k):
for d in range(k, 10, 3):
if count[d] > 0:
count[d] -= 1
return True
return False
def solve(count, sum):
if sum%3 == 1:
if not diminish(count, 1):
if not diminish(count, 2) or not diminish(count, 2):
... | output | 1 | 55,081 | 20 | 110,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,082 | 20 | 110,164 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
def vyvod(sp):
if set(sp)=={0}:
print(0)
exit()
sp.sort(reverse=True)
for i in sp:
print(i, end='')
exit()
n=int(input())
sp=list(map(int, input().split()))
d=sum(sp)%3
if sp.count(0)==0:
print(-1... | output | 1 | 55,082 | 20 | 110,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,083 | 20 | 110,166 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
from collections import Counter
input()
tmp=[int(i) for i in input().split()]
d=Counter(tmp)
s=sum(tmp)%3
f=False
if d[0]==0:
print(-1)
else:
if s==2:
if d[2]>0:
d[2]-=1
elif d[5]>0:
d[5]-=1
... | output | 1 | 55,083 | 20 | 110,167 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are g... | instruction | 0 | 55,084 | 20 | 110,168 |
Tags: brute force, constructive algorithms, greedy, math
Correct Solution:
```
def s():
input()
a = list(map(int,input().split()))
a.sort(reverse = True)
if a[-1] == 0:
r = sum(a) % 3
if r == 0:
if a[0] > 0:print(*a,sep = '')
else:print(0)
else:
... | output | 1 | 55,084 | 20 | 110,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,085 | 20 | 110,170 |
Yes | output | 1 | 55,085 | 20 | 110,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,086 | 20 | 110,172 |
Yes | output | 1 | 55,086 | 20 | 110,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,087 | 20 | 110,174 |
Yes | output | 1 | 55,087 | 20 | 110,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,088 | 20 | 110,176 |
Yes | output | 1 | 55,088 | 20 | 110,177 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,089 | 20 | 110,178 |
No | output | 1 | 55,089 | 20 | 110,179 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,090 | 20 | 110,180 |
No | output | 1 | 55,090 | 20 | 110,181 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,091 | 20 | 110,182 |
No | output | 1 | 55,091 | 20 | 110,183 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik s... | instruction | 0 | 55,092 | 20 | 110,184 |
No | output | 1 | 55,092 | 20 | 110,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each card doesn't exceed x... | instruction | 0 | 55,130 | 20 | 110,260 |
Tags: implementation, math
Correct Solution:
```
import math
n,x = map(int,input().split())
a = abs(sum(list(map(int,input().split()))))
print(int(math.ceil(a/x)))
``` | output | 1 | 55,130 | 20 | 110,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each card doesn't exceed x... | instruction | 0 | 55,132 | 20 | 110,264 |
Tags: implementation, math
Correct Solution:
```
import math
st=[int(i) for i in input().split(" ")]
n=st[0]
x=st[1]
s=0
a=[int(n) for n in input().split(" ")]
for i in range(len(a)):
s+=a[i]
k=(math.ceil(abs(s)/abs(x)))
print(k)
``` | output | 1 | 55,132 | 20 | 110,265 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each card doesn't exceed x... | instruction | 0 | 55,135 | 20 | 110,270 |
Tags: implementation, math
Correct Solution:
```
n, k = map(int, input().split())
s = abs(sum([int(i) for i in input().split()]))
print((s + k - 1) // k)
# Mon Aug 12 2019 15:00:31 GMT+0300 (MSK)
``` | output | 1 | 55,135 | 20 | 110,271 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,865 | 20 | 111,730 |
Tags: binary search, brute force, implementation
Correct Solution:
```
import bisect
def binarySearch3(lst,x):
i = bisect.bisect_left(lst,x)
if i != len(lst) and lst[i] == x:
return i
return -1
if __name__ == '__main__':
n=int(input())
a=[i*(i+1)//2 for i in range(1,1000000)]
for i in... | output | 1 | 55,865 | 20 | 111,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,866 | 20 | 111,732 |
Tags: binary search, brute force, implementation
Correct Solution:
```
def check_number( arr, no ) :
i = 0
j = len( arr ) - 1
while i <= j :
if arr[i] + arr[j] == no :
return "YES"
elif arr[i] + arr[j] > no :
j -= 1
else :
i += 1
return "NO"
... | output | 1 | 55,866 | 20 | 111,733 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,867 | 20 | 111,734 |
Tags: binary search, brute force, implementation
Correct Solution:
```
def binarySearch(arr, l, r, x):
while l <= r:
mid = int(l + (r - l)/2);
if arr[mid] == x:
return True
elif arr[mid] < x:
l = mid + 1
else:
r = mid - 1
return False
... | output | 1 | 55,867 | 20 | 111,735 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,868 | 20 | 111,736 |
Tags: binary search, brute force, implementation
Correct Solution:
```
#_________________ Mukul Mohan Varshney _______________#
#Template
import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt,floor,factorial,gcd,log,ceil
from c... | output | 1 | 55,868 | 20 | 111,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,869 | 20 | 111,738 |
Tags: binary search, brute force, implementation
Correct Solution:
```
arr=[1]*(10**5)
d={}
for i in range(1,10**5):
arr[i]=(i)*(i+1)//2
d[arr[i]]=1
n=int(input())
for i in arr:
a=i
b=n-i
if(b<=0):
break
if(b in d):
print("YES")
exit()
print("NO")
``` | output | 1 | 55,869 | 20 | 111,739 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,870 | 20 | 111,740 |
Tags: binary search, brute force, implementation
Correct Solution:
```
n = int(input())
fn = []
k=1
while True:
num = (k*(k+1))//2
if num>n:
break
fn.append(num)
k+=1
i=0
j=len(fn)-1
while i<=j:
if fn[i]+fn[j]==n:
print("YES")
break
elif fn[i]+fn[j]<n:
i+=1
... | output | 1 | 55,870 | 20 | 111,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,871 | 20 | 111,742 |
Tags: binary search, brute force, implementation
Correct Solution:
```
import math
from bisect import bisect_left
def BinarySearch(a, x):
i = bisect_left(a, x)
if i != len(a) and a[i] == x:
return i
else:
return -1
n=int(input())
possible_nums = []
i=1
a = 0
while a<=n:
a = (math.pow(i... | output | 1 | 55,871 | 20 | 111,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are representable as a sum o... | instruction | 0 | 55,872 | 20 | 111,744 |
Tags: binary search, brute force, implementation
Correct Solution:
```
import math
funk = []
n = int(input())
for i in range(2*int(math.sqrt(n))+1):
funk.append(i*(i+1)// 2)
i = 1
j = len(funk) - 1
while j >= i:
if funk[i] + funk[j] > n:
j -= 1
elif funk[i] + funk[j] < n:
i += 1
else:... | output | 1 | 55,872 | 20 | 111,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numb... | instruction | 0 | 55,873 | 20 | 111,746 |
Yes | output | 1 | 55,873 | 20 | 111,747 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.