message
stringlengths
2
65.1k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
0
108k
cluster
float64
14
14
__index_level_0__
int64
0
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Next please», — the princess called and cast an estimating glance at the next groom. The princess intends to choose the most worthy groom, this is, the richest one. Whenever she sees a groom w...
instruction
0
36,328
14
72,656
No
output
1
36,328
14
72,657
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver has recently designed and built an innovative nanotechnologic all-purpose beaver mass shaving machine, "Beavershave 5000". Beavershave 5000 can shave beavers by families! How do...
instruction
0
36,426
14
72,852
No
output
1
36,426
14
72,853
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver has recently designed and built an innovative nanotechnologic all-purpose beaver mass shaving machine, "Beavershave 5000". Beavershave 5000 can shave beavers by families! How do...
instruction
0
36,427
14
72,854
No
output
1
36,427
14
72,855
Provide tags and a correct Python 3 solution for this coding contest problem. Valera has got n domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the u...
instruction
0
36,428
14
72,856
Tags: implementation, math Correct Solution: ``` n=int(input()) l=[] t=[] for _ in range(n): x,y=[int(x) for x in input().split()] l.append(x) t.append(y) if sum(l)%2==0 and sum(t)%2==0: print(0) exit() elif sum(l)%2!=sum(t)%2: print(-1) exit() v=0 for i in range(len(l)): if (l[i]%2==0 and t[i]%2!=0) or (l[i]%...
output
1
36,428
14
72,857
Provide tags and a correct Python 3 solution for this coding contest problem. Valera has got n domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the u...
instruction
0
36,429
14
72,858
Tags: implementation, math Correct Solution: ``` import sys,math,bisect inf = float('inf') mod = 998244353 "========================================" def lcm(a,b): return int((a/math.gcd(a,b))*b) def gcd(a,b): return int(math.gcd(a,b)) def tobinary(n): return bin(n)[2:] def binarySearch(a,x): i = bisect...
output
1
36,429
14
72,859
Provide tags and a correct Python 3 solution for this coding contest problem. Valera has got n domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the u...
instruction
0
36,431
14
72,862
Tags: implementation, math Correct Solution: ``` def sum(T): s=0 for i in range(len(T)): s+=T[i] return s td=[] bd=[] n=int(input()) for i in range(n): t,b=map(int,input().split()) td.append(t) bd.append(b) ts=sum(td) bs=sum(bd) if ts%2==0 and bs%2==0: print("0") else: v=False for i in range(len(td)): s=0 ...
output
1
36,431
14
72,863
Provide tags and a correct Python 3 solution for this coding contest problem. Valera has got n domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the u...
instruction
0
36,434
14
72,868
Tags: implementation, math Correct Solution: ``` n = int(input()) x = [[], []] def odd_count(l: list) -> int: count = 0 for j in range(n): if l[j] % 2 != 0: count += 1 return count for i in range(n): a, b = map(int, input().split()) x[0].append(a) x[1].append(b) o0 = odd_count(x[0]) e0 = len(x[0]) - o0 ...
output
1
36,434
14
72,869
Provide tags and a correct Python 3 solution for this coding contest problem. Valera has got n domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the u...
instruction
0
36,435
14
72,870
Tags: implementation, math Correct Solution: ``` # odd + odd = even + even = even # odd + even = even + odd = odd n = int(input().strip()) a, b = [0]*n, [0]*n sumA, sumB = 0, 0 for i in range(n): a[i], b[i] = map(int, input().strip().split()) sumA += a[i] sumB += b[i] if (sumA%2 or sumB%2) == 0: # if both are alrea...
output
1
36,435
14
72,871
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,895
14
73,790
Tags: greedy, number theory Correct Solution: ``` n = int(input()) a = [int(s) for s in input().split()] summa = sum(a) mini = summa y = min(a) y_idx = a.index(y) z_min = 0 for z in range(len(a)): if z != y_idx: for x in range(1, 101): if a[z] % x == 0: k = summa - (a[z]+y) + (a[...
output
1
36,895
14
73,791
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,896
14
73,792
Tags: greedy, number theory Correct Solution: ``` import sys input_=lambda: sys.stdin.readline().strip("\r\n") from math import gcd sa=lambda :input_() sb=lambda:int(input_()) sc=lambda:input_().split() sd=lambda:list(map(int,input_().split())) se=lambda:float(input_()) sf=lambda:list(input_()) flsh=lambda: sys.stdout....
output
1
36,896
14
73,793
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,897
14
73,794
Tags: greedy, number theory Correct Solution: ``` def getMin(i): a = (pref[i - 1] if i - 1 >= 0 else 10**10) b = (suf[i + 1] if i + 1 < n else 10**10) return min(a, b) n = int(input()) v = [int(i) for i in input().split()] pref = [0] * n suf = [0] * n pref[0] = v[0] suf[n - 1] = v[n - 1] j = n - 2 for i i...
output
1
36,897
14
73,795
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,898
14
73,796
Tags: greedy, number theory Correct Solution: ``` n = int(input()) arr = list(map(int, input().split())) d = dict() for el in arr: d[el] = d.get(el, 0) + 1 min_ans = 0 for el1 in d: for el2 in d: if el1 != el2: for x in range(2, 101): if el1 % x == 0: min_...
output
1
36,898
14
73,797
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,899
14
73,798
Tags: greedy, number theory Correct Solution: ``` n = int(input()) a = list(sorted(list(map(int, input().split())), reverse=True)) original_sum = sum(a) minimum_sum = original_sum min_v = a[-1] for i in range(n - 1): for j in range(2, a[i] - 1): if a[i] % j == 0: current_sum = original_sum - a[i...
output
1
36,899
14
73,799
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,900
14
73,800
Tags: greedy, number theory Correct Solution: ``` import math n = int(input()) a = sorted(list(map(int, input().split()))) s = sum(a) ans = s for i in range(n - 1, 0, -1): cur = s - a[0] - a[i] for j in range(2, int(math.sqrt(a[i]) + 1)): if a[i] % j == 0: ans = min(ans, cur + a[0] * j + a[...
output
1
36,900
14
73,801
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,901
14
73,802
Tags: greedy, number theory Correct Solution: ``` import math; def replace(a,b): if (a==b): return a+b; if a>b: atemp = a; a=b; b = atemp; #for i in range(math.ceil(math.sqrt(a*b)),0,-1): # if ((a*b)%i==0 and b%i==0): return i+(a*b)//i; x = a+b; for i in range(1,1+math.ceil(math.sqrt...
output
1
36,901
14
73,803
Provide tags and a correct Python 3 solution for this coding contest problem. One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by n machines, and the power of the i-th machine i...
instruction
0
36,902
14
73,804
Tags: greedy, number theory Correct Solution: ``` input() a=[*map(int,input().split())] m=min(a) print(sum(a)-max(y+m-y//x-m*x for y in set(a) for x in range(1,int(y**.5)+1)if y%x==0)) ```
output
1
36,902
14
73,805
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,079
14
74,158
Tags: *special, greedy, implementation Correct Solution: ``` l=input().split() n=int(l[0]) d=int(l[1]) lfi=[] lofpairs=[] for you in range(n): s=input().split() for i in lfi: if(s[0]==i[1] and s[1]==i[0]): if(int(s[2])-int(i[2])<=d and int(s[2])-int(i[2])!=0): if((i[0],i[1]) ...
output
1
37,079
14
74,159
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,080
14
74,160
Tags: *special, greedy, implementation Correct Solution: ``` n, d = map(int, input().split()) L=[] pair=[] for it in range(n): j=input().split() j[2]=int(j[2]) for i in L: if(0<j[2]-i[2]<=d) & (i[0]==j[1]) & (i[1]==j[0]): if i[0]>i[1]: fri=[i[1],i[0]] else: ...
output
1
37,080
14
74,161
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,081
14
74,162
Tags: *special, greedy, implementation Correct Solution: ``` n, d = map(int, input().split()) f = list() m = dict() for i in range(n): add = False a, b, t2 = input().split() t2 = int(t2) c = m.get(b + ' ' + a, 0) if c != -1: if c != 0: for t1 in c: if 0 < t2 - t1 ...
output
1
37,081
14
74,163
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,082
14
74,164
Tags: *special, greedy, implementation Correct Solution: ``` # n=int(input()) #q.sort(key=lambda x:((x[1]-x[0]),-x[0])) # n,k=map(int,input().split()) # arr=list(map(int,input().split())) #ls=list(map(int,input().split())) #for i in range(m): #from sys import stdin #n=int(stdin.readline()) #for _ in range(int(input()))...
output
1
37,082
14
74,165
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,083
14
74,166
Tags: *special, greedy, implementation Correct Solution: ``` def min_positive_difference(numbers1, numbers2): min_difference = float('inf') if not numbers1 or not numbers2: return min_difference for n in numbers1: for m in numbers2: candidate = abs(n - m) if candidate...
output
1
37,083
14
74,167
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,084
14
74,168
Tags: *special, greedy, implementation Correct Solution: ``` from itertools import dropwhile n, d = map(int, input().split()) queue = [] ans = set() for i in range(n): a, b, time = input().split() time = int(time) queue = list(dropwhile(lambda x: time - x[2] > d, queue)) for msg in queue: if ms...
output
1
37,084
14
74,169
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,085
14
74,170
Tags: *special, greedy, implementation Correct Solution: ``` def readln(): return tuple(map(int, input().split())) n, d = readln() a = [] b = [] for _ in range(n): p, q, t = input().split() t = int(t) if p > q: a.append((p, q, t)) else: b.append((q, p, t)) ans = set() for p, q, t in a: ...
output
1
37,085
14
74,171
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends ...
instruction
0
37,086
14
74,172
Tags: *special, greedy, implementation Correct Solution: ``` import re from collections import Counter class Task: data = [] delta = 0 friends = set() def getData(self): n, self.delta = [int(x) for x in input().split(" ")] for i in range(0, n): self.data += [input()] ...
output
1
37,086
14
74,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,087
14
74,174
Yes
output
1
37,087
14
74,175
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,088
14
74,176
Yes
output
1
37,088
14
74,177
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,089
14
74,178
Yes
output
1
37,089
14
74,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,090
14
74,180
Yes
output
1
37,090
14
74,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,091
14
74,182
No
output
1
37,091
14
74,183
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,092
14
74,184
No
output
1
37,092
14
74,185
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,093
14
74,186
No
output
1
37,093
14
74,187
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in thi...
instruction
0
37,094
14
74,188
No
output
1
37,094
14
74,189
Provide tags and a correct Python 3 solution for this coding contest problem. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is the day of giving out money rewards. The R1 co...
instruction
0
37,169
14
74,338
Tags: dfs and similar Correct Solution: ``` n,m = map(int,input().split()) g = [set() for i in range(n)] from sys import stdin for i in range(m): a,b = map(int,stdin.readline().split()) g[a-1].add(b-1) c = [0]*n for i in range(n): c[i]=i for i in range(n): j=i while j>0 and c[j] in g[c[j-1]]: ...
output
1
37,169
14
74,339
Provide tags and a correct Python 3 solution for this coding contest problem. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is the day of giving out money rewards. The R1 co...
instruction
0
37,170
14
74,340
Tags: dfs and similar Correct Solution: ``` n, m = map(int,input().split()) g = [set() for i in range(n)] for i in range(m): a, b = map(int,input().split()) g[a-1].add(b-1) c = [0] * n for i in range(n): c[i] = i for i in range(n): j = i while (j > 0)and(c[j] in g[c[j - 1]]): c[j], c[j-1] =...
output
1
37,170
14
74,341
Provide tags and a correct Python 3 solution for this coding contest problem. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is the day of giving out money rewards. The R1 co...
instruction
0
37,171
14
74,342
Tags: dfs and similar Correct Solution: ``` n,m = map(int,input().split()) g = [set() for i in range(n)] for i in range(m): a,b = map(int,input().split()) g[a-1].add(b-1) c = [0]*n for i in range(n): c[i]=i for i in range(n): j=i while j>0 and c[j] in g[c[j-1]]: c[j],c[j-1]=c[j-1],c[j] ...
output
1
37,171
14
74,343
Provide tags and a correct Python 3 solution for this coding contest problem. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is the day of giving out money rewards. The R1 co...
instruction
0
37,172
14
74,344
Tags: dfs and similar Correct Solution: ``` n,m = map(int,input().split()) g = [set() for i in range(n)] from sys import stdin for i in range(m): a,b = map(int,stdin.readline().split()) g[a-1].add(b-1) c = [0]*n for i in range(n): c[i]=i for i in range(n): j=i while j>0 and c[j] in g[c[j-1]]: ...
output
1
37,172
14
74,345
Provide tags and a correct Python 3 solution for this coding contest problem. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is the day of giving out money rewards. The R1 co...
instruction
0
37,173
14
74,346
Tags: dfs and similar Correct Solution: ``` n,m=map(int,input().split()) graph=[] from sys import * for _ in range(0,n+2): graph.append([]) for _ in range(0,m): a,b=map(int,stdin.readline().split()) graph[b].append(a) vis=[0]*(n+2) f=[] def topo(start): global f vis[start]=1 s=[start] ans=[]...
output
1
37,173
14
74,347
Provide tags and a correct Python 3 solution for this coding contest problem. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is the day of giving out money rewards. The R1 co...
instruction
0
37,174
14
74,348
Tags: dfs and similar Correct Solution: ``` import sys n,m=map(int,sys.stdin.readline().split()) P={} for i in range(m): a,b=map(int,sys.stdin.readline().split()) P[(a-1,b-1)]=1 A=[-1]*n A[0]=0 for i in range(1,n): j=1 A[i]=i x=i while(x>0 and (A[x-1],A[x]) in P): A[x-1],A[x]=A[x],A[x-1...
output
1
37,174
14
74,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is...
instruction
0
37,175
14
74,350
No
output
1
37,175
14
74,351
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is...
instruction
0
37,176
14
74,352
No
output
1
37,176
14
74,353
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is...
instruction
0
37,177
14
74,354
No
output
1
37,177
14
74,355
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else. Today is...
instruction
0
37,178
14
74,356
No
output
1
37,178
14
74,357
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,343
14
74,686
Tags: brute force, greedy Correct Solution: ``` INF = 10 ** 19 ts, tf, t = map(int, input().split()) n = int(input()) u = [] if n > 0: u = list(map(int, input().split())) a = [] b = [] i = 0 while i < n: a.append(u[i]) if i == 0: start = max(ts, u[i]) else: start = max(b[-1], a[-1]) ...
output
1
37,343
14
74,687
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,344
14
74,688
Tags: brute force, greedy Correct Solution: ``` f = lambda: map(int, input().split()) a, b, t = f() k, = f() s = d = 1e12 for q in (f() if k else []): if q > a: s = a if q > a or a + t > b: break elif a - q < d: s, d = q - 1, a - q a += t print(s if a + t > b else a) ```
output
1
37,344
14
74,689
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,345
14
74,690
Tags: brute force, greedy Correct Solution: ``` ts, tf, te = map(int, input().split(' ')) n = int(input()) if n == 0: print(ts) exit(0) arr = list(map(int, input().split(' '))) idx = 0 curr_time = ts wait_time = max(0, ts-arr[0]+1) ans = min(arr[0]-1, ts) while wait_time > 0: curr_time+=te idx += 1 if idx ==...
output
1
37,345
14
74,691
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,346
14
74,692
Tags: brute force, greedy Correct Solution: ``` import math start,finish,time = map(int, input().split()) b = int(input()) def solve(): firstAvailableSpot = start minimumTimeInQueue = 10**12 + 1 minimum = 23123 last = 0 for i in range(len(q)): if (q[i] > firstAvailableSpot) and (firstAvail...
output
1
37,346
14
74,693
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,347
14
74,694
Tags: brute force, greedy Correct Solution: ``` import sys t1, t2, t = map(int, input().split()) u = 1 n = int(input()) if n == 0: print(t1) sys.exit() a = [int(i) for i in input().split()] mini = 10 ** 20 ans = 0 time = t1 for x in a: if x <= t2 - t: if time - x + 1 < mini and x > 0: mi...
output
1
37,347
14
74,695
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,348
14
74,696
Tags: brute force, greedy Correct Solution: ``` #!/usr/bin/python3.5 a,b,c=[int(x) for x in input().split()] n=int(input()) if n==0: print(a) quit() mas=[int(x) for x in input().split()] m=1e14 p=0 for i in mas: if i<=b-c: if i and a-i+1<m: m=a-i+1; p=min(i-1,a) ...
output
1
37,348
14
74,697
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,349
14
74,698
Tags: brute force, greedy Correct Solution: ``` from math import floor s, f, k = input().split() s = int(s) f = int(f) k = int(k) n = int(input()) w = [] t = [] if (n > 0): a = list(map(int, input().split())) te = s diff = f-s m = floor(diff/k) if n < m: m = n if a[0] != 0: w.append(a[0]-1) t.append(s) ...
output
1
37,349
14
74,699
Provide tags and a correct Python 3 solution for this coding contest problem. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before...
instruction
0
37,350
14
74,700
Tags: brute force, greedy Correct Solution: ``` import bisect import sys ts, tf, T = [int(x) for x in input().split()] N = int(input()) if N == 0: print(ts) sys.exit() Ts = [int(x) for x in input().strip().split()] # f = open('test.B.in.3', 'r') # ts, tf, T = [int(x) for x in f.readline().split()] # N = int(...
output
1
37,350
14
74,701