message
stringlengths
2
30.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
237
109k
cluster
float64
10
10
__index_level_0__
int64
474
217k
Provide tags and a correct Python 3 solution for this coding contest problem. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the...
instruction
0
82,664
10
165,328
Tags: binary search, greedy Correct Solution: ``` from collections import deque def main(): n, m = map(int, input().split()) wanted_cnt = list(map(int, input().split())) Order = [tuple(map(int, input().split())) for i in range(m)] #count the maximum number which you can buy on sales day. S = sum(w...
output
1
82,664
10
165,329
Provide tags and a correct Python 3 solution for this coding contest problem. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the...
instruction
0
82,665
10
165,330
Tags: binary search, greedy Correct Solution: ``` import collections def main(): from sys import stdin, stdout def read(): return stdin.readline().rstrip('\n') def read_array(sep=None, maxsplit=-1): return read().split(sep, maxsplit) def read_int(): return int(read()) d...
output
1
82,665
10
165,331
Provide tags and a correct Python 3 solution for this coding contest problem. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the...
instruction
0
82,666
10
165,332
Tags: binary search, greedy Correct Solution: ``` input=__import__('sys').stdin.readline def check(x): last=[0]*(n+1) for i in tmp: if i[0]>x: break else: last[i[1]]=i[0] sal=[0]*(x+1) for i in range(1,n+1): sal[last[i]]+=lis[i-1] c=0 for i in rang...
output
1
82,666
10
165,333
Provide tags and a correct Python 3 solution for this coding contest problem. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the...
instruction
0
82,667
10
165,334
Tags: binary search, greedy Correct Solution: ``` import copy from collections import defaultdict BIG = 10**9 N, M = [int(i) for i in input().split()] K = [0] + [int(i) for i in input().split()] sumK = sum(K) max_days = 2*sum(K) day_at_sale_per_item = defaultdict(list) for i in range(M): day, item = [int(i) for...
output
1
82,667
10
165,335
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,668
10
165,336
Yes
output
1
82,668
10
165,337
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,669
10
165,338
Yes
output
1
82,669
10
165,339
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,670
10
165,340
Yes
output
1
82,670
10
165,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,671
10
165,342
Yes
output
1
82,671
10
165,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,672
10
165,344
No
output
1
82,672
10
165,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,673
10
165,346
No
output
1
82,673
10
165,347
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,674
10
165,348
No
output
1
82,674
10
165,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character...
instruction
0
82,675
10
165,350
No
output
1
82,675
10
165,351
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,835
10
165,670
Tags: greedy, sortings Correct Solution: ``` from itertools import permutations def main(): n, m, k = map(int, input().split()) l, res = [], [] for _ in range(n): input() l.append(list(tuple(map(int, input().split())) for _ in range(m))) for sb in permutations(l, 2): t = [(b - ...
output
1
82,835
10
165,671
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,836
10
165,672
Tags: greedy, sortings Correct Solution: ``` n,m,k = [int(s) for s in input().split()] BuyingPrice = [] SellingPrice = [] Number_of_items = [] for i in range(n): input() x = [] y = [] z = [] for j in range(m): a,b,c = [int(s) for s in input().split()] x.append(a) y.append(b...
output
1
82,836
10
165,673
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,837
10
165,674
Tags: greedy, sortings Correct Solution: ``` I=lambda:map(int,input().split()) R=range n,m,k=I() def r(a,b,c=k): q=0 for a,b in sorted((b[i][1]-a[i][0],a[i][2])for i in R(m))[::-1]: if a<1or c<1:break q+=a*min(b,c);c-=b return q w=[] for _ in '0'*n:I();w+=[[list(I())for _ in '0'*m]] print(max(r(w[i],w[j])for i i...
output
1
82,837
10
165,675
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,838
10
165,676
Tags: greedy, sortings Correct Solution: ``` import sys profit = 0 initial = (list(map(int, sys.stdin.readline().split()))) num_planet = initial[0] num_goods = initial[1] capacity = initial[2] stonks = [] for i in range(0, num_planet): #print('Name planetu') name_Planet = str(sys.stdin.readline()) planet ...
output
1
82,838
10
165,677
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,839
10
165,678
Tags: greedy, sortings Correct Solution: ``` import sys def minp(): return sys.stdin.readline().strip() def mint(): return int(minp()) def mints(): return map(int,minp().split()) n,m,k = mints() planets = [0]*n for i in range(n): name = minp() costs = [0]*m for j in range(m): costs[j] = tuple(mints()) plan...
output
1
82,839
10
165,679
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,840
10
165,680
Tags: greedy, sortings Correct Solution: ``` I=lambda:map(int,input().split()) R=range n,m,k=I() def r(a,b,c=k): q=0 for a,b in sorted((b[i][1]-a[i][0],a[i][2])for i in R(m))[::-1]: if a<1or c<1:break q+=a*min(b,c);c-=b return q w=[] for _ in '0'*n:I();w+=[[list(I())for _ in '0'*m]] print(max(r(w[i],w...
output
1
82,840
10
165,681
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,841
10
165,682
Tags: greedy, sortings Correct Solution: ``` import math n,m,k=map(int,input().split()) q,z,y,pp={},-math.inf,[],k for i in range(n): input();q[i]=[] for j in range(m): q[i].append(list(map(int,input().split()))) for i in q: r=[] for j in q: o=[] if i!=j: for p in ran...
output
1
82,841
10
165,683
Provide tags and a correct Python 3 solution for this coding contest problem. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another plane...
instruction
0
82,842
10
165,684
Tags: greedy, sortings Correct Solution: ``` n, m, k = map(int, input().split()) planets = [] for i in range(n): name = input() planets.append([]) for j in range(m): item = list(map(int, input().split())) planets[-1].append(item) res = float("-inf") from itertools import permutations fo...
output
1
82,842
10
165,685
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,843
10
165,686
Yes
output
1
82,843
10
165,687
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,844
10
165,688
Yes
output
1
82,844
10
165,689
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,845
10
165,690
Yes
output
1
82,845
10
165,691
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,846
10
165,692
Yes
output
1
82,846
10
165,693
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,847
10
165,694
No
output
1
82,847
10
165,695
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,848
10
165,696
No
output
1
82,848
10
165,697
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,849
10
165,698
No
output
1
82,849
10
165,699
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, ...
instruction
0
82,850
10
165,700
No
output
1
82,850
10
165,701
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,866
10
165,732
Yes
output
1
82,866
10
165,733
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,867
10
165,734
Yes
output
1
82,867
10
165,735
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,868
10
165,736
Yes
output
1
82,868
10
165,737
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,869
10
165,738
Yes
output
1
82,869
10
165,739
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,870
10
165,740
No
output
1
82,870
10
165,741
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,871
10
165,742
No
output
1
82,871
10
165,743
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,872
10
165,744
No
output
1
82,872
10
165,745
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each emp...
instruction
0
82,873
10
165,746
No
output
1
82,873
10
165,747
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,894
10
165,788
Tags: greedy, implementation Correct Solution: ``` n = int(input()) L = list(map(int,input().split())) a=p=0 for i in L: if i==25: a+=1 elif i==50: a-=1 p+=1 else: if p>0: p-=1 a-=1 else: a-=3 if a<0: print('NO') break else: print('YES') ```
output
1
82,894
10
165,789
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,895
10
165,790
Tags: greedy, implementation Correct Solution: ``` a,b=input(),list(map(int,input().split())) fifties=0 twenties=0 yes='YES' for i in b: if i==25: twenties+=1 elif i==50: if twenties>0: twenties-=1 fifties+=1 else: yes='NO' else: if twentie...
output
1
82,895
10
165,791
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,896
10
165,792
Tags: greedy, implementation Correct Solution: ``` n=int(input()) l=list(map(int,input().split())) a=0 b=0 c=0 check=True for i in l: if(i==25): a+=1 elif(i==50 and a>=1): b+=1 a-=1 elif(i==100 and (a>=3 or (a>=1 and b>=1))): c+=1 if(b>=1): b-=1 ...
output
1
82,896
10
165,793
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,897
10
165,794
Tags: greedy, implementation Correct Solution: ``` n = int(input()) nums = [int(x) for x in input().split(" ")] count_25 = 0 count_50 = 0 count_100 = 0 for num in nums: if num == 25: count_25 += 1 if num == 50: count_50 += 1 count_25 -= 1 if num == 100: if count_50 != 0: ...
output
1
82,897
10
165,795
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,898
10
165,796
Tags: greedy, implementation Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1...
output
1
82,898
10
165,797
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,899
10
165,798
Tags: greedy, implementation Correct Solution: ``` def possible_change(l): twenty_fives = 0 fivties = 0 for currency in l: # 25 if currency == 25: twenty_fives += 1 # 50 elif currency == 50: if twenty_fives >= 1: twenty_fives -= 1 ...
output
1
82,899
10
165,799
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,900
10
165,800
Tags: greedy, implementation Correct Solution: ``` if __name__ == '__main__': n = int(input()) massiv = list(map(int, input().split())) c_25, c_50, c_100 = 0, 0, 0 mes = "" for i in massiv: if i == 25: c_25 += 1 elif i == 50: if c_25 != 0: c_25...
output
1
82,900
10
165,801
Provide tags and a correct Python 3 solution for this coding contest problem. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticke...
instruction
0
82,901
10
165,802
Tags: greedy, implementation Correct Solution: ``` n = int(input()) l = list(map(int,input().split())) d={25:0,50:0,100:0} for i in l: if i==25: d[i]+=1 elif i==50: d[50]+=1 if d[25]>0: d[25]-=1 else: print("NO") exit() else: d[100]...
output
1
82,901
10
165,803
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket cost...
instruction
0
82,902
10
165,804
Yes
output
1
82,902
10
165,805
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket cost...
instruction
0
82,903
10
165,806
Yes
output
1
82,903
10
165,807
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket cost...
instruction
0
82,904
10
165,808
Yes
output
1
82,904
10
165,809
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket cost...
instruction
0
82,905
10
165,810
Yes
output
1
82,905
10
165,811
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket cost...
instruction
0
82,906
10
165,812
No
output
1
82,906
10
165,813
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket cost...
instruction
0
82,907
10
165,814
No
output
1
82,907
10
165,815