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.
<image>
Input
The input consists of four lines, each line containing a single digit 0 or 1.
Output
Output a single digit, 0 or 1.
Example
Input
0
1
1
0
Output
0 | instruction | 0 | 10,451 | 20 | 20,902 |
Tags: *special, brute force, implementation
Correct Solution:
```
"""
Codeforces April Fools Contest 2017 Problem E
Author : chaotic_iak
Language: Python 3.5.2
"""
################################################### SOLUTION
def main():
a, = read()
b, = read()
c, = read()
d, = read()
n = 8*a + 4... | output | 1 | 10,451 | 20 | 20,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
Input
The input consists of four lines, each line containing a single digit 0 or 1.
Output
Output a single digit, 0 or 1.
Example
Input
0
1
1
0
Output
0 | instruction | 0 | 10,452 | 20 | 20,904 |
Tags: *special, brute force, implementation
Correct Solution:
```
a = int(input())
b = int(input())
c = int(input())
d = int(input())
p = a ^ b
q = c | d
r = b & c
s = a ^ d
x = p & q
y = r | s
z = x ^ y
print(z)
``` | output | 1 | 10,452 | 20 | 20,905 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,511 | 20 | 21,022 |
Tags: implementation, strings
Correct Solution:
```
c=[input() for i in range(11)]
x=[ c[0][i:i+10] for i in range(0,80,10)]
for i in x:
print(c.index(i)-1,end='')
``` | output | 1 | 10,511 | 20 | 21,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,512 | 20 | 21,024 |
Tags: implementation, strings
Correct Solution:
```
msg = input()
password = [msg[i:i+10] for i in range(0,80, 10)]
for i in range(10):
digit = input()
while digit in password:
password[password.index(digit)] = str(i)
print("".join(password))
``` | output | 1 | 10,512 | 20 | 21,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,513 | 20 | 21,026 |
Tags: implementation, strings
Correct Solution:
```
string = str(input())
number0 = str(input())
number1 = str(input())
number2 = str(input())
number3 = str(input())
number4 = str(input())
number5 = str(input())
number6 = str(input())
number7 = str(input())
number8 = str(input())
number9 = str(input())
number = ""
i ... | output | 1 | 10,513 | 20 | 21,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,514 | 20 | 21,028 |
Tags: implementation, strings
Correct Solution:
```
from __future__ import print_function
import sys
if __name__ == "__main__":
# '''input
# 01001100100101100000010110001001011001000101100110010110100001011010100101101100
# 0100110000
# 0100110010
# 0101100000
# 0101100010
# 0101100100
# 0101100110
# 0101101000
# ... | output | 1 | 10,514 | 20 | 21,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,515 | 20 | 21,030 |
Tags: implementation, strings
Correct Solution:
```
a=input()
c=[]
for i in range(0,10):
b=input()
c.append(b)
k=0
for i in range(0,8):
x=a[k:k+10]
j=0
while(x!=c[j]):
j=j+1
print(j,end="")
k=k+10
``` | output | 1 | 10,515 | 20 | 21,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,516 | 20 | 21,032 |
Tags: implementation, strings
Correct Solution:
```
n = input()
numbers = {}
for i in range(10):
x = input()
numbers[x] = i
res = []
for i in range(8):
p = n[i*10 : (i*10)+10 ]
#print(p)
if p in numbers:
res.append(numbers[p])
for i in res:
print(i,end="")
``` | output | 1 | 10,516 | 20 | 21,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,517 | 20 | 21,034 |
Tags: implementation, strings
Correct Solution:
```
def pars(_str):
pars_list = []
for i in range(0,80,10):
pars_list.append(_str[i:i+10])
return pars_list
def recover(_str,_list):
password = ''
for i in _str:
if i in _list:
password += str(_list.index(i))
return pa... | output | 1 | 10,517 | 20 | 21,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza"... | instruction | 0 | 10,518 | 20 | 21,036 |
Tags: implementation, strings
Correct Solution:
```
s=input()
x={}
for i in range(10):
w=input()
x[w]=str(i)
ans=''
for i in range(0,80,10):
ans+=x[s[i:i+10]]
print(ans)
``` | output | 1 | 10,518 | 20 | 21,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,909 | 20 | 21,818 |
Tags: greedy, implementation
Correct Solution:
```
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
def ter(n,x):
s=str(x)
a="1"
b="1"
maxi=False
for i in range(1,n):
if s[i]=="2":
if maxi:
a+="0"
b+="2"
else:
a+="1"
... | output | 1 | 10,909 | 20 | 21,819 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,910 | 20 | 21,820 |
Tags: greedy, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
x = input()
a = x.find("1")
b = x.find("0")
d=""; e=""
if(a==-1):
for i in range(n):
if x[i]=="2":
d+="1"; e+="1"
else:
d+="0"; ... | output | 1 | 10,910 | 20 | 21,821 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,911 | 20 | 21,822 |
Tags: greedy, implementation
Correct Solution:
```
t = int(input())
for tt in range(t):
n = int(input())
x = input()
h1 = False
sol1 = ''
sol2 = ''
for xi in x:
if h1:
sol1 += '0'
sol2 += xi
else:
if xi == '0':
sol1 += '0'
... | output | 1 | 10,911 | 20 | 21,823 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,912 | 20 | 21,824 |
Tags: greedy, implementation
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
x = input()
a = []
b = []
c = 0
flag = False
for i in range(n):
if x[i]=='2':
a.append('1')
b.append('1')
elif x[i]==... | output | 1 | 10,912 | 20 | 21,825 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,913 | 20 | 21,826 |
Tags: greedy, implementation
Correct Solution:
```
t = int(input())
for k in range(t):
n = int(input())
x = input()
a, b = [], []
was_zero_one = False
for i, d in enumerate(x):
if d == '0':
a.append('0')
b.append('0')
elif d == '1':
if not was_z... | output | 1 | 10,913 | 20 | 21,827 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,914 | 20 | 21,828 |
Tags: greedy, implementation
Correct Solution:
```
"""
Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
"""
def ternary_xor(s, n):
a, b = '', ''
flag = False
for i in range(n):
if s[i] == '2':
if flag:
a += '2'
... | output | 1 | 10,914 | 20 | 21,829 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,915 | 20 | 21,830 |
Tags: greedy, implementation
Correct Solution:
```
for h in range(int(input())):
n = int(input())
x = [int(i) for i in input()]
a = [0] * n
a[0] = 1
b = [0] * n
b[0] = 1
fl = 0
for i in range(1, n):
if fl:
b[i] = x[i]
elif x[i] == 1:
a[i] = 1
... | output | 1 | 10,915 | 20 | 21,831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit of x is guaranteed to be 2, the other digits of... | instruction | 0 | 10,916 | 20 | 21,832 |
Tags: greedy, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
s = input()
a, b = '', ''
is_one_found = False
for x in s:
if is_one_found:
a += '0'
b += x
else:
num = int(x)
if num == 1:
is_one_found = True
a += x
... | output | 1 | 10,916 | 20 | 21,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,917 | 20 | 21,834 |
Yes | output | 1 | 10,917 | 20 | 21,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,918 | 20 | 21,836 |
Yes | output | 1 | 10,918 | 20 | 21,837 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,919 | 20 | 21,838 |
Yes | output | 1 | 10,919 | 20 | 21,839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,920 | 20 | 21,840 |
Yes | output | 1 | 10,920 | 20 | 21,841 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,921 | 20 | 21,842 |
No | output | 1 | 10,921 | 20 | 21,843 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,922 | 20 | 21,844 |
No | output | 1 | 10,922 | 20 | 21,845 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,923 | 20 | 21,846 |
No | output | 1 | 10,923 | 20 | 21,847 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.
You are given a long ternary number x. The first (leftmost) digit ... | instruction | 0 | 10,924 | 20 | 21,848 |
No | output | 1 | 10,924 | 20 | 21,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. He immediately decided to give a part of his ne... | instruction | 0 | 11,067 | 20 | 22,134 |
Tags: bitmasks, math
Correct Solution:
```
base = [-1] * 60
how = [-1] * 60
who = [-1] * 60
n = int(input())
arr = list(map(int, input().split()))
x = 0
for a in arr:
x ^= a
mapper = [-1] * 60
ind = 59
ind_start = bin(x).count('1') - 1
for bit in reversed(range(60)):
if (1 << bit) & x :
mapper[bit] ... | output | 1 | 11,067 | 20 | 22,135 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. ... | instruction | 0 | 11,068 | 20 | 22,136 |
No | output | 1 | 11,068 | 20 | 22,137 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. ... | instruction | 0 | 11,069 | 20 | 22,138 |
No | output | 1 | 11,069 | 20 | 22,139 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. ... | instruction | 0 | 11,070 | 20 | 22,140 |
No | output | 1 | 11,070 | 20 | 22,141 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. ... | instruction | 0 | 11,071 | 20 | 22,142 |
No | output | 1 | 11,071 | 20 | 22,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur u... | instruction | 0 | 11,223 | 20 | 22,446 |
Tags: *special, implementation
Correct Solution:
```
n = int(input())
m = list(map(int, input().split()))
r = list(map(int, input().split()))
k = 0
for i in range(100000):
for j in range(n):
if i % m[j] == r[j]:
k += 1
break
print(k / 100000)
``` | output | 1 | 11,223 | 20 | 22,447 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur u... | instruction | 0 | 11,224 | 20 | 22,448 |
Tags: *special, implementation
Correct Solution:
```
n = int(input())
M = [int(s) for s in input().split()]
R = [int(s) for s in input().split()]
c = 0
for i in range(100000):
bool = False
for j in range(n):
if i % M[j] == R[j]:
bool = True
break
if bool:
c += 1
print... | output | 1 | 11,224 | 20 | 22,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur u... | instruction | 0 | 11,226 | 20 | 22,452 |
Tags: *special, implementation
Correct Solution:
```
import fractions
from functools import reduce
N = int(input())
M = list(map(int, input().split(' ')))
R = list(map(int, input().split(' ')))
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
def lcm(*numbers):
def _lcm(a, b):
return (a *... | output | 1 | 11,226 | 20 | 22,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur u... | instruction | 0 | 11,227 | 20 | 22,454 |
Tags: *special, implementation
Correct Solution:
```
a = int(input())
d = 34209
p = 0
m = list(map(int,input().split()))
r = list(map(int,input().split()))
for i in range(34209):
for j in range(a):
if i%m[j] == r[j]:
##print(d,m[j],p,d%m[j])
p += 1
break
##print(p,d)
s = ... | output | 1 | 11,227 | 20 | 22,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur u... | instruction | 0 | 11,228 | 20 | 22,456 |
Tags: *special, implementation
Correct Solution:
```
input()
f=lambda:list(map(int,input().split()))
T,l=720720,list(zip(f(),f()))
print(sum(any(d%m==r for m,r in l) for d in range(T))/T)
``` | output | 1 | 11,228 | 20 | 22,457 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur u... | instruction | 0 | 11,229 | 20 | 22,458 |
Tags: *special, implementation
Correct Solution:
```
#!/usr/bin/env python3
n = int(input())
m = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
counter = 0
num = 50000
for d in range(num):
for i in range(n):
if d % m[i] == r[i]:
counter += 1
break
frac = counter/num
print(frac)
``... | output | 1 | 11,229 | 20 | 22,459 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur u... | instruction | 0 | 11,230 | 20 | 22,460 |
Tags: *special, implementation
Correct Solution:
```
n = int(input())
m = [int(i) for i in input().split(" ")]
r = [int(i) for i in input().split(" ")]
L = 720720
ans = 0
for i in range(L):
for j, k in zip(m, r):
if i % j == k:
ans += 1
break
print(ans/L)
``` | output | 1 | 11,230 | 20 | 22,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Shakespeare is a widely known esoteric programming language in which programs look like plays by Shakespeare, and numbers are given by combinations of ornate epithets. In this problem we will ha... | instruction | 0 | 11,762 | 20 | 23,524 |
No | output | 1 | 11,762 | 20 | 23,525 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Shakespeare is a widely known esoteric programming language in which programs look like plays by Shakespeare, and numbers are given by combinations of ornate epithets. In this problem we will ha... | instruction | 0 | 11,763 | 20 | 23,526 |
No | output | 1 | 11,763 | 20 | 23,527 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.
Let the initial pair of numbers be (1,1). Your task is to find number k, that is, the least number of s... | instruction | 0 | 11,766 | 20 | 23,532 |
Tags: brute force, dfs and similar, math, number theory
Correct Solution:
```
import sys
def solve():
n = int(input())
if n == 1: return 0
res = 1000000
for other in range(n - 1, 0, -1):
pair = [n, other]
temp = 0
while (pair[0] > 1 or pair[1] > 1) and (pair[0] > 0 and pair[1] >... | output | 1 | 11,766 | 20 | 23,533 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.
Let the initial pair of numbers be (1,1). Your task is to find number k, that is, the least number of s... | instruction | 0 | 11,767 | 20 | 23,534 |
Tags: brute force, dfs and similar, math, number theory
Correct Solution:
```
import sys
def solve():
n = int(input())
if n == 1: return 0
res = 1000000
for other in range(1, n):
pair = [n, other]
temp = 0
while (pair[0] > 1 or pair[1] > 1) and (pair[0] > 0 and pair[1] > 0):
... | output | 1 | 11,767 | 20 | 23,535 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,076 | 20 | 24,152 |
Tags: math, number theory
Correct Solution:
```
import sys
import math
# sys.stdin = open('input.txt')
# sys.stdout = open('output.txt', 'w')
def main():
n = int(input())
a = n // 2
b = n // 3
c = n // 5
d = n // 7
ab = n // 6
ac = n // 10
ad = n // 14
bc = n // 15
bd = n // 21... | output | 1 | 12,076 | 20 | 24,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,077 | 20 | 24,154 |
Tags: math, number theory
Correct Solution:
```
n = int(input())
s = 0
for i in range(16):
d = 1
for j, k in ((1, 2), (2, 3), (4, 5), (8, 7)):
if i & j: d *= -k
if d > 0: s += n // d
else: s -= n // -d
print(s)
``` | output | 1 | 12,077 | 20 | 24,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,078 | 20 | 24,156 |
Tags: math, number theory
Correct Solution:
```
from sys import stdin,stdout
from math import gcd, ceil, sqrt,factorial as f
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mo... | output | 1 | 12,078 | 20 | 24,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,079 | 20 | 24,158 |
Tags: math, number theory
Correct Solution:
```
n = int(input())
a=(n//2+n//3+n//5+n//7-n//6-n//10-n//14-n//15-n//21-n//35+n//30+n//42+n//70+n//105-n//210)
print(n-a)
``` | output | 1 | 12,079 | 20 | 24,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,080 | 20 | 24,160 |
Tags: math, number theory
Correct Solution:
```
n = int(input())
f = lambda x: n // x
a1 = f(2) + f(3) + f(5) + f(7)
a2 = f(6) + f(10) + f(14) + f(15) + f(21) + f(35)
a3 = f(30) + f(42) + f(70) + f(105)
a4 = f(210)
ans = n - (a1 - a2 + a3 - a4)
print(ans)
``` | output | 1 | 12,080 | 20 | 24,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,081 | 20 | 24,162 |
Tags: math, number theory
Correct Solution:
```
n=int(input())
a=1
for i in {8,9,5,7}:
a*=i
#print(a)
print(n//a)
``` | output | 1 | 12,081 | 20 | 24,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,082 | 20 | 24,164 |
Tags: math, number theory
Correct Solution:
```
x = int(input())
#x, y = map(int, input().split())
y = x//210*48
for i in range(1, x%210 + 1):
if i%2 and i%3 and i%5 and i%7:
y+=1
print(y)
``` | output | 1 | 12,082 | 20 | 24,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the... | instruction | 0 | 12,083 | 20 | 24,166 |
Tags: math, number theory
Correct Solution:
```
n = int(input())
print(n//(2*3*5*2*7*2*3))
``` | output | 1 | 12,083 | 20 | 24,167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.