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 a correct Python 3 solution for this coding contest problem.
Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.
Today's training is to perform a very large number of calculations to improve the calculation power and raise awarene... | instruction | 0 | 81,661 | 20 | 163,322 |
"Correct Solution:
```
from collections import Counter
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def check(N, A):
if N == 1:
return A
A.sort()
C = Counter(A)
c0 = C.get(0, 0)
if c0 == N:
return A
c1 = C.get(1, 0)
rest = A[c0+c1:]
back = []
if... | output | 1 | 81,661 | 20 | 163,323 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,753 | 20 | 163,506 |
Tags: brute force, implementation
Correct Solution:
```
if __name__ == '__main__':
n = int(input())
flag = False
num4 = num7 = 0
while n >= 0:
if n % 4 == 0:
num4 = n // 4
break
else:
n -= 7
num7 += 1
if n < 0:
print('-1')
e... | output | 1 | 81,753 | 20 | 163,507 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,754 | 20 | 163,508 |
Tags: brute force, implementation
Correct Solution:
```
n = int(input())
for x in range(n//7,-1,-1):
if (n-x*7)%4 == 0:
print ('4'*((n-x*7)//4 )+ '7'*x)
break
else:
print (-1)
``` | output | 1 | 81,754 | 20 | 163,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,755 | 20 | 163,510 |
Tags: brute force, implementation
Correct Solution:
```
# pylint: disable=unused-variable
# pylint: enable=too-many-lines
#* Just believe in yourself
#@ Author @CAP
import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections i... | output | 1 | 81,755 | 20 | 163,511 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,756 | 20 | 163,512 |
Tags: brute force, implementation
Correct Solution:
```
n=int(input())
count=n//7
ans=float('inf')
val=None
for i in range(count,-1,-1):
remaining=n-7*i
if remaining%4==0:
if ans>i+remaining//4:
ans=i+remaining//4
val=(remaining//4,i)
#print(val)
if val:
print("4"*val[0]+"7"*val[1])
else:
print(-1)
``` | output | 1 | 81,756 | 20 | 163,513 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,757 | 20 | 163,514 |
Tags: brute force, implementation
Correct Solution:
```
n = int(input())
s = list()
k = -1
f = False
while n > 0:
if -k > len(s) and n%4 != 0 and f:
print(-1)
break
if n >= 7 and not f:
n -= 7
s += ['7']
elif n % 4 == 0:
t = n//4
s += ['4'] * t
n = 0
... | output | 1 | 81,757 | 20 | 163,515 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,758 | 20 | 163,516 |
Tags: brute force, implementation
Correct Solution:
```
def main(n):
get = lambda i: (i+(n-4*i)//7,(n-4*i)//7)
ans=(float('inf'),float('inf'))
for i in range(n//4+1,-1,-1):
if n-4*i>=0 and (n-4*i)%7==0 :
if ans>get(i):
ans=get(i)
print('-1' if ans==(float('inf'),... | output | 1 | 81,758 | 20 | 163,517 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,759 | 20 | 163,518 |
Tags: brute force, implementation
Correct Solution:
```
# Author : raj1307 - Raj Singh
# Date : 14.05.2021
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, fil... | output | 1 | 81,759 | 20 | 163,519 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly... | instruction | 0 | 81,760 | 20 | 163,520 |
Tags: brute force, implementation
Correct Solution:
```
x = int(input())
def luck(n):
a = 0
b = 0
while(n > 0):
if(n % 7 == 0):
b = b+1
n = n-7
elif(n % 4 == 0):
a = a+1
n = n-4
else:
a = a+1
n = n-4
s... | output | 1 | 81,760 | 20 | 163,521 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,761 | 20 | 163,522 |
Yes | output | 1 | 81,761 | 20 | 163,523 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,762 | 20 | 163,524 |
Yes | output | 1 | 81,762 | 20 | 163,525 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,763 | 20 | 163,526 |
Yes | output | 1 | 81,763 | 20 | 163,527 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,764 | 20 | 163,528 |
Yes | output | 1 | 81,764 | 20 | 163,529 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,765 | 20 | 163,530 |
No | output | 1 | 81,765 | 20 | 163,531 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,766 | 20 | 163,532 |
No | output | 1 | 81,766 | 20 | 163,533 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,767 | 20 | 163,534 |
No | output | 1 | 81,767 | 20 | 163,535 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky... | instruction | 0 | 81,768 | 20 | 163,536 |
No | output | 1 | 81,768 | 20 | 163,537 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,015 | 20 | 164,030 |
Tags: greedy, math
Correct Solution:
```
n=input()
l=len(n)
for idx in range(l):
if(n[idx]=='0'):
break
print(n[:idx]+n[idx+1:])
``` | output | 1 | 82,015 | 20 | 164,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,016 | 20 | 164,032 |
Tags: greedy, math
Correct Solution:
```
s = input()
ans = ""
checked=False
for i in s:
if i=='0' and not(checked):
checked=True
else:
ans+=i
print(ans if checked else ans[0:-1])
``` | output | 1 | 82,016 | 20 | 164,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,017 | 20 | 164,034 |
Tags: greedy, math
Correct Solution:
```
from functools import reduce
from collections import Counter
import time
import datetime
def time_t():
print("Current date and time: " , datetime.datetime.now())
print("Current year: ", datetime.date.today().strftime("%Y"))
print("Month of year: ", datetime.date.tod... | output | 1 | 82,017 | 20 | 164,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,018 | 20 | 164,036 |
Tags: greedy, math
Correct Solution:
```
n=input()
ind=n.find('0')
if ind<0: print(n[:len(n)-1])
else: print(n[:ind]+n[ind+1:])
``` | output | 1 | 82,018 | 20 | 164,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,019 | 20 | 164,038 |
Tags: greedy, math
Correct Solution:
```
a=input()
x=len(a)
x-=1
stat=False
l=''
for i in a:
if i=='1':
l=l+i
elif i=='0' and not stat:
stat=True
else:
l=l+i
for i in range(0,x):
print(l[i],end='')
``` | output | 1 | 82,019 | 20 | 164,039 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,020 | 20 | 164,040 |
Tags: greedy, math
Correct Solution:
```
t = input()
if t.count("1") == len(t):
print(t[:len(t)-1])
exit()
n = t.index("0")
print(t[:n]+t[n+1:])
``` | output | 1 | 82,020 | 20 | 164,041 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,021 | 20 | 164,042 |
Tags: greedy, math
Correct Solution:
```
a=str(input())
s=list(a)
l=len(s)
if(s.count("1")==l):
print(a[1:])
else:
for i in range(l):
if(s[i]=='0'):
s.pop(i)
print("".join(map(str,s)))
break
``` | output | 1 | 82,021 | 20 | 164,043 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | instruction | 0 | 82,022 | 20 | 164,044 |
Tags: greedy, math
Correct Solution:
```
s = input()
for i in range(len(s)):
if(s[i] == '0'):
print(s[:i]+s[i+1:])
exit()
print(s[1:])
``` | output | 1 | 82,022 | 20 | 164,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,023 | 20 | 164,046 |
Yes | output | 1 | 82,023 | 20 | 164,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,024 | 20 | 164,048 |
Yes | output | 1 | 82,024 | 20 | 164,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,025 | 20 | 164,050 |
Yes | output | 1 | 82,025 | 20 | 164,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,026 | 20 | 164,052 |
Yes | output | 1 | 82,026 | 20 | 164,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,027 | 20 | 164,054 |
No | output | 1 | 82,027 | 20 | 164,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,028 | 20 | 164,056 |
No | output | 1 | 82,028 | 20 | 164,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,029 | 20 | 164,058 |
No | output | 1 | 82,029 | 20 | 164,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little El... | instruction | 0 | 82,030 | 20 | 164,060 |
No | output | 1 | 82,030 | 20 | 164,061 |
Provide tags and a correct Python 3 solution for this coding contest problem.
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash fun... | instruction | 0 | 82,066 | 20 | 164,132 |
Tags: implementation
Correct Solution:
```
p, n = [int(x) for x in input().split()]
s = set()
f = True
answer = -1
for i in range(n):
x = int(input())
if x%p not in s:
s.add(x%p)
elif f:
answer = i+1
f = False
print(answer)
``` | output | 1 | 82,066 | 20 | 164,133 |
Provide tags and a correct Python 3 solution for this coding contest problem.
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash fun... | instruction | 0 | 82,067 | 20 | 164,134 |
Tags: implementation
Correct Solution:
```
p, n = map(int, input().split())
result_dict = {}
a = [int(input()) for _ in range(n)]
index = 0
while index < len(a):
if a[index] % p in result_dict:
print(index + 1)
break
else:
result_dict[a[index] % p] = a[index]
index += 1
if inde... | output | 1 | 82,067 | 20 | 164,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash fun... | instruction | 0 | 82,069 | 20 | 164,138 |
Tags: implementation
Correct Solution:
```
n,k = map(int,input().split())
d=0
l=[]
c=[]
for i in range(k):
x=int(input())
l.append(x)
for i in range(k):
j=l[i]%n
if j not in c:
c.append(j)
else:
d=i+1
break
if d==0:
print(-1)
else:
print(d)
``` | output | 1 | 82,069 | 20 | 164,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash fun... | instruction | 0 | 82,071 | 20 | 164,142 |
Tags: implementation
Correct Solution:
```
p,n=map(int,input().split())
ans=[]
for i in range(n):
x=int(input())
ans.append(x%p)
z=[]
for i in range(0,n-1):
for j in range(i+1,n):
if ans[i]==ans[j]:
z.append(j+1)
else:
continue
if len(z)==0:
print("-1")
else:
print(min(z))
``` | output | 1 | 82,071 | 20 | 164,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash fun... | instruction | 0 | 82,072 | 20 | 164,144 |
Tags: implementation
Correct Solution:
```
if __name__ == '__main__':
p, n = str(input()).split()
p = int(p)
n = int(n)
line = list()
flag = True
mark = 0
for i in range(n):
if flag:
c = int(input()) % p
if c in line:
mark = i + 1
... | output | 1 | 82,072 | 20 | 164,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,331 | 20 | 164,662 |
Tags: brute force, greedy
Correct Solution:
```
n=int(input())
l=(list(str(n)))[::-1]
g=[]
def verif(l):
if l[-1]!='0':return(0)
else: return(1+verif(l[:-1]))
def permut(l,c,c1):
i=l.copy()
k=0
while(True):
if i.index(c)==0:break
else:
j=i.index(c)
i[j],i[j-1]... | output | 1 | 82,331 | 20 | 164,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,332 | 20 | 164,664 |
Tags: brute force, greedy
Correct Solution:
```
# Codeforces Round #486 (Div. 3)
from functools import cmp_to_key
#key=cmp_to_key(lambda x,y: 1 if x not in y else -1 )
import sys
def getIntList():
return list(map(int, input().split()))
s0 = input()
def work(s0, st):
x = s0.rfind(st[1])
if x<... | output | 1 | 82,332 | 20 | 164,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,333 | 20 | 164,666 |
Tags: brute force, greedy
Correct Solution:
```
s=input()[::-1]
m=I=41
f=s.find('5')+1
i=s.find('0')+1
t=len(s)
if i:
j=min(s.find('0',i)+1or I,f or I)
if j<I:
m=i+j-3
if j<i:m+=1
if f:
j=min(s.find('2')+1or I,s.find('7')+1or I)
if j<I:
l=f+j-3
if j<f:l+=1
if f==t:
i=t-1
while s[i-1]=='0':
l+=1;... | output | 1 | 82,333 | 20 | 164,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,334 | 20 | 164,668 |
Tags: brute force, greedy
Correct Solution:
```
s = input()[::-1]
ans = 10 ** 9
mp = {'0': '05', '5': '27'}
for i in range(len(s)):
if s[i] not in mp:
continue
rem = s[:i] + s[i + 1:]
for j in range(len(rem)):
if rem[j] not in mp[s[i]]:
continue
rem2 = rem[:j] + rem[j + 1... | output | 1 | 82,334 | 20 | 164,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,335 | 20 | 164,670 |
Tags: brute force, greedy
Correct Solution:
```
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
from itertools import permutations
import heapq
#sys.setrecursionlimit(10**6)
#OneDrive\Documents\codeforces
I=sys.stdin.readline
alpha="abcdefghijklmnopqrstuv... | output | 1 | 82,335 | 20 | 164,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,336 | 20 | 164,672 |
Tags: brute force, greedy
Correct Solution:
```
def swipe(s, i):
return s[:i] + s[i + 1] + s[i] + (s[i + 2:] if i + 2 < len(s) else "")
def nazis(s):
m = float("inf")
for i in range(9):
if s.find(str(i + 1)) > -1:
m = min(s.find(str(i + 1)), m)
return m
n = input()
c = float("inf... | output | 1 | 82,336 | 20 | 164,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,337 | 20 | 164,674 |
Tags: brute force, greedy
Correct Solution:
```
n = input()
#if int(n) % 25 == 0:
# print(0)
# quit()
n = list(n)
if (not("5" in n)) and (not("0" in n)) and (not("7" in n)) and (not("2" in n)):
print(-1)
quit()
wkn = []
wkn[:] = n
ans = -1
for i in reversed(range(len(n))):
if (n[i] == "0"):
wk1 = n[:i] + n[i + ... | output | 1 | 82,337 | 20 | 164,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer n from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each mo... | instruction | 0 | 82,338 | 20 | 164,676 |
Tags: brute force, greedy
Correct Solution:
```
maxint = 2147483647
class mylist(list):
def index(self, obj, *args):
try:
if len(args) == 0:
return super(mylist, self).index(obj)
if len(args) == 1:
return super(mylist, self).index(obj,args[0])
... | output | 1 | 82,338 | 20 | 164,677 |
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 from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contai... | instruction | 0 | 82,339 | 20 | 164,678 |
Yes | output | 1 | 82,339 | 20 | 164,679 |
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 from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contai... | instruction | 0 | 82,340 | 20 | 164,680 |
Yes | output | 1 | 82,340 | 20 | 164,681 |
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 from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contai... | instruction | 0 | 82,341 | 20 | 164,682 |
Yes | output | 1 | 82,341 | 20 | 164,683 |
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 from 1 to 10^{18} without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contai... | instruction | 0 | 82,342 | 20 | 164,684 |
Yes | output | 1 | 82,342 | 20 | 164,685 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.