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 has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible.
Help Petya to split the integers. Each of... | instruction | 0 | 85,466 | 20 | 170,932 |
Tags: constructive algorithms, graphs, math
Correct Solution:
```
n = int(input())
ans = []
flag = 0
if n % 2:
n -= 1
flag = 1
if (n % 4 == 0 and not flag) or (n % 4 and flag):
print(0)
for i in range(n // 2):
if i % 2 == 0:
ans.append(i + 1)
ans.append(n - i)
print(l... | output | 1 | 85,466 | 20 | 170,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible.
Help Petya to split the integers. Each of... | instruction | 0 | 85,467 | 20 | 170,934 |
Tags: constructive algorithms, graphs, math
Correct Solution:
```
n = int(input())
res_list = []
desired_sum = (n * (n + 1) // 2)
s = 0
for j in range(n, 0, -1):
if 2 * (s + j) <= desired_sum:
s += j
res_list += [j]
print(desired_sum - 2 * s)
print(str(len(res_list)), " ".join(map(str, res_lis... | output | 1 | 85,467 | 20 | 170,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible.
Help Petya to split the integers. Each of... | instruction | 0 | 85,468 | 20 | 170,936 |
Tags: constructive algorithms, graphs, math
Correct Solution:
```
n = int(input())
v = int(n * (n + 1) / 2)
print(v % 2)
targ = int(v / 2)
seq = []
for i in range(n, 0, -1):
if (targ >= i):
targ -= i
seq.append(i)
print(len(seq), end = " ")
[print(seq[i], end = " ") for i in range(len(seq))]
``` | output | 1 | 85,468 | 20 | 170,937 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,469 | 20 | 170,938 |
Yes | output | 1 | 85,469 | 20 | 170,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,470 | 20 | 170,940 |
Yes | output | 1 | 85,470 | 20 | 170,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,471 | 20 | 170,942 |
Yes | output | 1 | 85,471 | 20 | 170,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,472 | 20 | 170,944 |
Yes | output | 1 | 85,472 | 20 | 170,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,473 | 20 | 170,946 |
No | output | 1 | 85,473 | 20 | 170,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,474 | 20 | 170,948 |
No | output | 1 | 85,474 | 20 | 170,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,475 | 20 | 170,950 |
No | output | 1 | 85,475 | 20 | 170,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possib... | instruction | 0 | 85,476 | 20 | 170,952 |
No | output | 1 | 85,476 | 20 | 170,953 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,725 | 20 | 171,450 |
Tags: brute force
Correct Solution:
```
n=int(input())
s=input()
con=n//11
if (s.count('8')>=con) and (n>=11):
print(con)
elif (s.count('8')!=0) and (n>=11):
print(s.count('8'))
else:
print(0)
``` | output | 1 | 85,725 | 20 | 171,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,726 | 20 | 171,452 |
Tags: brute force
Correct Solution:
```
n=int(input())
k=0
p=n//11
s=input()
for i in range(len(s)):
if s[i]=='8':
k+=1
else:
pass
if p<=k:
print(p)
elif p>k:
print(k)
``` | output | 1 | 85,726 | 20 | 171,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,727 | 20 | 171,454 |
Tags: brute force
Correct Solution:
```
def read():
return int(input())
def read_cards():
s = input()
return list(int(e) for e in s)
n = read()
arr = read_cards()
print(min(len(arr) // 11, arr.count(8)))
``` | output | 1 | 85,727 | 20 | 171,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,728 | 20 | 171,456 |
Tags: brute force
Correct Solution:
```
n = int(input())
c = sum(map(lambda x: x == '8', input()))
print(min(n//11, c))
``` | output | 1 | 85,728 | 20 | 171,457 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,729 | 20 | 171,458 |
Tags: brute force
Correct Solution:
```
n = int(input())
s = input()
n8 = 0
for i in range(n):
if s[i] == '8':
n8 += 1
ans = 0
for i in range(n8, 0, -1):
if (n - i) // 10 >= i:
ans = i
break
print(ans)
``` | output | 1 | 85,729 | 20 | 171,459 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,730 | 20 | 171,460 |
Tags: brute force
Correct Solution:
```
n=int(input())
num=input()
e=0
for x in num:
if x == '8':
e+=1
print(min(e,n//11))
``` | output | 1 | 85,730 | 20 | 171,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,731 | 20 | 171,462 |
Tags: brute force
Correct Solution:
```
n = int(input())
s = input()
ans = 0
for i in range(0, n) :
if s[i] == '8' :
ans = ans + 1
print(int(min(n / 11, ans)))
``` | output | 1 | 85,731 | 20 | 171,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
... | instruction | 0 | 85,732 | 20 | 171,464 |
Tags: brute force
Correct Solution:
```
n = int(input())
s = str(input())
n8 = s.count("8")
print(min(n // 11 , n8))
``` | output | 1 | 85,732 | 20 | 171,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,733 | 20 | 171,466 |
Yes | output | 1 | 85,733 | 20 | 171,467 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,734 | 20 | 171,468 |
Yes | output | 1 | 85,734 | 20 | 171,469 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,735 | 20 | 171,470 |
Yes | output | 1 | 85,735 | 20 | 171,471 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,736 | 20 | 171,472 |
Yes | output | 1 | 85,736 | 20 | 171,473 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,737 | 20 | 171,474 |
No | output | 1 | 85,737 | 20 | 171,475 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,738 | 20 | 171,476 |
No | output | 1 | 85,738 | 20 | 171,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,739 | 20 | 171,478 |
No | output | 1 | 85,739 | 20 | 171,479 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers,... | instruction | 0 | 85,740 | 20 | 171,480 |
No | output | 1 | 85,740 | 20 | 171,481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,951 | 20 | 171,902 |
Tags: dp, matrices
Correct Solution:
```
from sys import stdin, stdout, maxsize
R = lambda : stdin.readline().strip()
RL = lambda f=None: list(map(f, R().split(' '))) if f else list(R().split(' '))
output = lambda x: stdout.write(str(x) + '\n')
output_list = lambda x: output(' '.join(map(str, x)))
M = int(1e9) + 7
... | output | 1 | 85,951 | 20 | 171,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,952 | 20 | 171,904 |
Tags: dp, matrices
Correct Solution:
```
def main():
import sys
input = sys.stdin.readline
MOD=10**9+7
t=int(input())
x=1
m=int(2*1e5+10)
dp= [1 for i in range(m+1) ]
for i in range(10,m+1):
dp[i]=(dp[i-10]+dp[i-9])%(MOD)
for _ in range(t):
n,k=map(int,input().split(... | output | 1 | 85,952 | 20 | 171,905 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,953 | 20 | 171,906 |
Tags: dp, matrices
Correct Solution:
```
import sys
input = sys.stdin.readline
M = 10 ** 9 + 7
dp = [[0, 0] for i in range(200001)]
for i in range(200001):
if i < 10:
dp[i][0] = 1
dp[i][1] = 1
if i == 9:
dp[i][1] = dp[1][1] + dp[1][0]
else:
dp[i][0] = (dp[i - 10][1] + dp[i - 10][0]) % M
... | output | 1 | 85,953 | 20 | 171,907 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,954 | 20 | 171,908 |
Tags: dp, matrices
Correct Solution:
```
from sys import stdin
input = stdin.readline
mxn = 2 * (10 ** 5) + 15
mod = 10 ** 9 + 7
dp = [1] * mxn
for i in range(10, mxn):
dp[i] = (dp[i - 9] + dp[i - 10]) % mod
for test in range(int(input())):
n, k = map(int, input().strip().split())
ans = 0
for i in st... | output | 1 | 85,954 | 20 | 171,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,955 | 20 | 171,910 |
Tags: dp, matrices
Correct Solution:
```
#pyrival orz
import os
import sys
import math
from io import BytesIO, IOBase
input = sys.stdin.readline
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
... | output | 1 | 85,955 | 20 | 171,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,956 | 20 | 171,912 |
Tags: dp, matrices
Correct Solution:
```
from sys import stdin,stdout
z=10**9+7
dp={}
for i in range(200009):
if i<9:
dp[i]=2
elif i==9:
dp[i]=3
else:
dp[i]=(dp[i-9]+dp[i-10])%z
for _ in range(int(input())):
n,m=stdin.readline().split()
n=int(n);m=int(m)
ans=0
while n... | output | 1 | 85,956 | 20 | 171,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,957 | 20 | 171,914 |
Tags: dp, matrices
Correct Solution:
```
import sys
input = sys.stdin.readline
mod=10**9+7
mxi=210000
ans=[0]*mxi
cts=[0]*10
cts[0]=1
s=1
for i in range(mxi):
ans[i]=s
s+=cts[-1]
s%=mod
cts[0]+=cts[-1]
cts[0]%=mod
cts.insert(0,cts.pop())
for f in range(int(input())):
n,m=map(int,input().spli... | output | 1 | 85,957 | 20 | 171,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the opera... | instruction | 0 | 85,958 | 20 | 171,916 |
Tags: dp, matrices
Correct Solution:
```
# Author: yumtam
# Created at: 2021-04-29 12:58
MOD = 10**9 + 7
a = []
c = [1] + [0]*9
for _ in range(2 * 10**5 + 50):
a.append(sum(c))
d = [0] * 10
for i in range(9):
d[i+1] = c[i]
d[0] = (d[0] + c[9]) % MOD
d[1] = (d[1] + c[9]) % MOD
c = ... | output | 1 | 85,958 | 20 | 171,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,959 | 20 | 171,918 |
Yes | output | 1 | 85,959 | 20 | 171,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,960 | 20 | 171,920 |
Yes | output | 1 | 85,960 | 20 | 171,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,961 | 20 | 171,922 |
Yes | output | 1 | 85,961 | 20 | 171,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,962 | 20 | 171,924 |
Yes | output | 1 | 85,962 | 20 | 171,925 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,963 | 20 | 171,926 |
No | output | 1 | 85,963 | 20 | 171,927 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,964 | 20 | 171,928 |
No | output | 1 | 85,964 | 20 | 171,929 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,965 | 20 | 171,930 |
No | output | 1 | 85,965 | 20 | 171,931 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For examp... | instruction | 0 | 85,966 | 20 | 171,932 |
No | output | 1 | 85,966 | 20 | 171,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€... | instruction | 0 | 85,990 | 20 | 171,980 |
Tags: math
Correct Solution:
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 16 03:38:40 2018
@author: anshul
"""
from math import sqrt
a,b,c=list(map(int,input().split()))
if a==0 and b==0 and c==0:
print(-1)
elif a==0 and b==0:
print(0)
elif a==0:
print(1)
ans=(-1*c)/b
... | output | 1 | 85,990 | 20 | 171,981 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€... | instruction | 0 | 85,991 | 20 | 171,982 |
Tags: math
Correct Solution:
```
import math
data = [int(x) for x in input().split()]
a = data[0]
b = data[1]
c = data[2]
if a == 0 and b == 0 and c == 0:
print(-1)
elif a == 0 and b == 0:
print(0)
elif a == 0 and b != 0:
print(1)
print(-c/b)
elif (b ** 2) - (4 * a * c) < 0:
print(0)
else:
ans1 ... | output | 1 | 85,991 | 20 | 171,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€... | instruction | 0 | 85,992 | 20 | 171,984 |
Tags: math
Correct Solution:
```
from math import *
a,b,c = input().split()
a,b,c = int(a),int(b),int(c)
d_2 = (b**2) - (4 * a * c)
if d_2 < 0:
print("0")
elif a == 0 and b == 0:
if c == 0:print("-1")
else:print('0')
elif a == 0 and b != 0:
print("1")
x_1 = -(float(c)/float(b))
print("%.10f" % x... | output | 1 | 85,992 | 20 | 171,985 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€... | instruction | 0 | 85,993 | 20 | 171,986 |
Tags: math
Correct Solution:
```
import re
arr = re.split(' ', input())
A = int(arr[0])
B = int(arr[1])
C = int(arr[2])
dis = B*B-4*A*C
if (A == 0 and B == 0 and C == 0):
print(-1)
elif (A == 0 and B == 0):
print(0)
elif (A == 0):
print(1)
print(-C/B)
elif (dis<0):
print(0)
elif (dis==0):
print... | output | 1 | 85,993 | 20 | 171,987 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€... | instruction | 0 | 85,994 | 20 | 171,988 |
Tags: math
Correct Solution:
```
import sys
import math
input = sys.stdin.readline
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
if __name__ == '__main__':
q = inlt()
a = q[0]
b = q[1]
c = q[2]
if a =... | output | 1 | 85,994 | 20 | 171,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€... | instruction | 0 | 85,995 | 20 | 171,990 |
Tags: math
Correct Solution:
```
a,b,c=map(int,input().split())
if a==0:
if b==0:
if c==0:
print("-1")
else:
print("0")
else:
print(1)
print("%.6f"%((-c)/b))
else:
d=b*b-4*a*c
if d<0:
print(0)
elif d==0:
print(1)
print("... | output | 1 | 85,995 | 20 | 171,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€... | instruction | 0 | 85,996 | 20 | 171,992 |
Tags: math
Correct Solution:
```
a,b,c = map(int,input().split())
if a ==0 and b==0:
if c ==0:
print("-1")
else:
print("0")
exit(0)
D = pow(b,2) -4*a*c
x = -b
y = pow(D,1/2)
z = 2*a
r = 0
if a ==0:
print("1")
print(-c/b)
exit(0)
if D < 0:
print(r)
exit(0)
if D ==0:
r... | output | 1 | 85,996 | 20 | 171,993 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.