message
stringlengths
2
43.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
853
107k
cluster
float64
24
24
__index_level_0__
int64
1.71k
214k
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,736
24
5,472
Tags: implementation Correct Solution: ``` def cnt(n): c=0 while n: if n%10==9: c+=1 n//=10 else: break return c def zerocheck(arr,i): for x in range(i-1,-1,-1): if arr[x]=="0": arr[x]="9" else: arr[x] = str(int(...
output
1
2,736
24
5,473
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,737
24
5,474
Tags: implementation Correct Solution: ``` a,b=input().strip().split(" ") a,b=[int(a),int(b)] k=1 while(True): nine=k-1 dif=(a-nine)%k if(dif>b or dif<0): break if(k==1000000000000000000): break k*=10 k//=10 dif=(a-k+1)%k ans=a-dif print(ans) ```
output
1
2,737
24
5,475
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,738
24
5,476
Tags: implementation Correct Solution: ``` import re import itertools from collections import Counter class Task: p, d = "", "" answer = "" def getData(self): self.p, self.d = input().split(" ") def solve(self): p = self.p p_minus_d = str(int(self.p) - int(self.d)) p...
output
1
2,738
24
5,477
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,739
24
5,478
Tags: implementation Correct Solution: ``` """http://codeforces.com/problemset/problem/219/B""" if __name__ == '__main__': p, d = map(int, input().split()) lo = p - d res = p for i in range(1, 18): num = 10 ** i t = p // num * num + (num - 1) t = t if t <= p else t - num ...
output
1
2,739
24
5,479
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,740
24
5,480
Tags: implementation Correct Solution: ``` p, d = input().split() p = int(p); d = int(d) ans = p = p + 1 i = 10 while i <= 1000000000000000000: if p % i <= d: ans = p - p % i i *= 10 print(ans - 1) ```
output
1
2,740
24
5,481
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,741
24
5,482
Tags: implementation Correct Solution: ``` import sys p, d = map(int, sys.stdin.readline().split()) k = 10 n = p while p>=k and p%k+1<=d: if p%k < k-1: n = p-p%k-1 k*=10 print (n) # Made By Mostafa_Khaled ```
output
1
2,741
24
5,483
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,742
24
5,484
Yes
output
1
2,742
24
5,485
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,743
24
5,486
Yes
output
1
2,743
24
5,487
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,744
24
5,488
Yes
output
1
2,744
24
5,489
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,745
24
5,490
Yes
output
1
2,745
24
5,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,746
24
5,492
No
output
1
2,746
24
5,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,747
24
5,494
No
output
1
2,747
24
5,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,748
24
5,496
No
output
1
2,748
24
5,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and ...
instruction
0
2,749
24
5,498
No
output
1
2,749
24
5,499
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,597
24
7,194
Tags: brute force, dp, math Correct Solution: ``` # stdin = open('testdata.txt') # def input(): # return stdin.readline().strip() def solve(n): if (n < 2020): print("NO") return if n%2020==0 or n%2021==0: print("YES") return k = n count = 0 while k%2020 != 0: k = k-1 count += 1 if (count*2021 <=...
output
1
3,597
24
7,195
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,598
24
7,196
Tags: brute force, dp, math Correct Solution: ``` for tests in range(int(input())): n=int(input()) if n%2020==0: print('YES') elif n%2021==0: print('YES') else: x=n//2020 +1 sum=0 flag='NO' for i in range(x): n-=2020 if n%2021==0: ...
output
1
3,598
24
7,197
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,599
24
7,198
Tags: brute force, dp, math Correct Solution: ``` t = int(input()) for _ in range(t): n = int(input()) a = n // 2020 b = n % 2020 if b > a: print('NO') else: print('YES') ```
output
1
3,599
24
7,199
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,600
24
7,200
Tags: brute force, dp, math Correct Solution: ``` n = int(input()) while n>0: k = int(input()) for i in range(k//2020+1): rem = k - i*2020 if rem%2021==0: print("YES") break else: print("NO") n-=1 ```
output
1
3,600
24
7,201
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,601
24
7,202
Tags: brute force, dp, math Correct Solution: ``` times = int(input()) def check(n): remainder = n % 2020 quotient = n // 2020 if remainder <= quotient: return "YES" else: return "NO" arr = [] for i in range(times): arr.append(check(int(input()))) for i in range(times): print(arr...
output
1
3,601
24
7,203
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,602
24
7,204
Tags: brute force, dp, math Correct Solution: ``` ''' Aaditya Upadhyay ud$$$**$$$$$$bc. u@**" 4$$$$$$Nu J ""#$$$$$r @ $$$b .F ^*3$$$ ...
output
1
3,602
24
7,205
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,603
24
7,206
Tags: brute force, dp, math Correct Solution: ``` t=int(input()) for _ in range(t): n = int(input()) if n<2020: print('NO') else: m = n//2020 if n in range(2020*m,2021*m+1): print('YES') else: print('NO') ```
output
1
3,603
24
7,207
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number of 2021...
instruction
0
3,604
24
7,208
Tags: brute force, dp, math Correct Solution: ``` t=int(input()) for T in range(t): n=int(input()) x=n//2020 if (n-x*2020)<=x: print('YES') else: print('NO') ```
output
1
3,604
24
7,209
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,605
24
7,210
Yes
output
1
3,605
24
7,211
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,606
24
7,212
Yes
output
1
3,606
24
7,213
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,607
24
7,214
Yes
output
1
3,607
24
7,215
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,608
24
7,216
Yes
output
1
3,608
24
7,217
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,609
24
7,218
No
output
1
3,609
24
7,219
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,610
24
7,220
No
output
1
3,610
24
7,221
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,611
24
7,222
No
output
1
3,611
24
7,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a cert...
instruction
0
3,612
24
7,224
No
output
1
3,612
24
7,225
Provide tags and a correct Python 3 solution for this coding contest problem. There are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must contain two integers, the first one on top, the...
instruction
0
3,676
24
7,352
Tags: constructive algorithms, math, number theory Correct Solution: ``` # written with help of editorial n, m = map(int, input().split()) a = list(map(int, input().split())) def gcd(x, y): while y: x, y = y, x % y return x g = 0 for x in a: g = gcd(g, x - 1) answer = 0 def process(x): globa...
output
1
3,676
24
7,353
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must ...
instruction
0
3,677
24
7,354
No
output
1
3,677
24
7,355
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must ...
instruction
0
3,678
24
7,356
No
output
1
3,678
24
7,357
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must ...
instruction
0
3,679
24
7,358
No
output
1
3,679
24
7,359
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,000
24
12,000
Tags: greedy, math, number theory Correct Solution: ``` import sys import math,bisect,operator inf,m = float('inf'),10**9+7 sys.setrecursionlimit(10 ** 5) from itertools import groupby,accumulate from heapq import heapify,heappop,heappush from collections import deque,Counter,defaultdict I = lambda : int(sys.stdin.read...
output
1
6,000
24
12,001
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,001
24
12,002
Tags: greedy, math, number theory Correct Solution: ``` t = int(input()) INF = 1 << 60 def solve(): n = int(input()) a = list(map(int, input().split())) ans = INF s = 0 for i in range(n): s += a[i] cnt = 0 tmpsum = 0 for j in range(n): if tmpsum < s: ...
output
1
6,001
24
12,003
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,002
24
12,004
Tags: greedy, math, number theory Correct Solution: ``` for _ in range(int(input())): n = int(input()) arr = list(map(int,input().split())) if arr.count(arr[0])==len(arr):print("0") else: sub_arr_sum,ans = 0,-1 for k in range(1,n): if sum(arr)%(n-k)==0: sub_ar...
output
1
6,002
24
12,005
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,003
24
12,006
Tags: greedy, math, number theory Correct Solution: ``` from sys import stdin,stdout from math import gcd,sqrt,factorial,pi,inf from collections import deque,defaultdict from bisect import bisect,bisect_left input=stdin.readline R=lambda:map(int,input().split()) I=lambda:int(input()) S=lambda:input().rstrip('\n') L=lam...
output
1
6,003
24
12,007
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,004
24
12,008
Tags: greedy, math, number theory Correct Solution: ``` """ Author: Enivar Date: Tue 22 Dec 2020 13:30:33 EAT """ from sys import exit, stderr, stdout from math import sqrt def debug(*args): for i in args: stderr.write(str(i)+' ') stderr.write('\n') class Input: def __init__(self): self.s...
output
1
6,004
24
12,009
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,005
24
12,010
Tags: greedy, math, number theory Correct Solution: ``` for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) sum_ = sum(a) for j in range(n): if sum_ % (n - j) == 0: elem = sum_ // (n - j) i = 1; curr = a[0]; co = 0 while i < n: ...
output
1
6,005
24
12,011
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,006
24
12,012
Tags: greedy, math, number theory Correct Solution: ``` t=int(input()) for _ in range(t): n=int(input()) a=list(map(int,input().split())) s=sum(a) min_ans=0 while True: chk=True avg_ans=s/(n-min_ans) curr_sum=0 for i in range(n): if(curr_sum<avg_ans): ...
output
1
6,006
24
12,013
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to one of his choice of its neighbors. More forma...
instruction
0
6,007
24
12,014
Tags: greedy, math, number theory Correct Solution: ``` t = int(input()) while t > 0: t -= 1 n = int(input()) a = [int(i) for i in input().split()] s = sum(a) for k in range(s): if s%(n-k) == 0: ps = s//(n-k) tmpSum = 0 for i in a: if tmpSu...
output
1
6,007
24
12,015
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,008
24
12,016
Yes
output
1
6,008
24
12,017
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,009
24
12,018
Yes
output
1
6,009
24
12,019
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,010
24
12,020
Yes
output
1
6,010
24
12,021
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,011
24
12,022
Yes
output
1
6,011
24
12,023
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,012
24
12,024
No
output
1
6,012
24
12,025
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,013
24
12,026
No
output
1
6,013
24
12,027
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,014
24
12,028
No
output
1
6,014
24
12,029
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times: * Polycarp selects the index i and adds the value a_i to...
instruction
0
6,015
24
12,030
No
output
1
6,015
24
12,031