message stringlengths 2 22.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 16 109k | cluster float64 1 1 | __index_level_0__ int64 32 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mr. A wants to get to the destination on the Yamanote line.
After getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the des... | instruction | 0 | 96,052 | 1 | 192,104 |
Yes | output | 1 | 96,052 | 1 | 192,105 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mr. A wants to get to the destination on the Yamanote line.
After getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the des... | instruction | 0 | 96,053 | 1 | 192,106 |
No | output | 1 | 96,053 | 1 | 192,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mr. A wants to get to the destination on the Yamanote line.
After getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the des... | instruction | 0 | 96,054 | 1 | 192,108 |
No | output | 1 | 96,054 | 1 | 192,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mr. A wants to get to the destination on the Yamanote line.
After getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the des... | instruction | 0 | 96,055 | 1 | 192,110 |
No | output | 1 | 96,055 | 1 | 192,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mr. A wants to get to the destination on the Yamanote line.
After getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the des... | instruction | 0 | 96,056 | 1 | 192,112 |
No | output | 1 | 96,056 | 1 | 192,113 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 96,400 | 1 | 192,800 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
from collections import deque
n = int(input())
grafs = dict()
xx = set();yy = set()
skautnes = []
for e in range(n):
x, y = map(int, input().split())
xx.add(str(x) + 'x');yy.add(str(y) + 'y')
skautnes.append( (str(x) + 'x',str(y) + 'y') ... | output | 1 | 96,400 | 1 | 192,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 96,403 | 1 | 192,806 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
import collections
def breadth_first_search(graph, root):
visited = set()
visited.add(root)
queue = collections.deque([root])
while queue:
vertex = queue.popleft()
for neighbour in graph[vertex]:
if neigh... | output | 1 | 96,403 | 1 | 192,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 96,406 | 1 | 192,812 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
def iceskate():
n = int(input())
drifts = []
for i in range(n):
drifts.append(list(map(int,input().split())))
# print(drifts)
disconnected = []
app_index = 0
for j in drifts:
disconnected.append([app_index]... | output | 1 | 96,406 | 1 | 192,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her a... | instruction | 0 | 96,513 | 1 | 193,026 |
Tags: constructive algorithms, dfs and similar, graphs
Correct Solution:
```
"""
Codeforces Contest 259 Div 1 Problem C
Author : chaotic_iak
Language: Python 3.3.4
"""
def main():
n,m = read()
edges = [[] for _ in range(n+1)]
for i in range(m):
a,b = read()
edges[a].append(b)
edge... | output | 1 | 96,513 | 1 | 193,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her a... | instruction | 0 | 96,514 | 1 | 193,028 |
Tags: constructive algorithms, dfs and similar, graphs
Correct Solution:
```
"""
Codeforces Contest 259 Div 1 Problem C
Author : chaotic_iak
Language: Python 3.3.4
"""
def main():
# Read N and M from problem statement.
n,m = read()
# Set up an adjacency list for each vertex.
edges = [[] for _ in ra... | output | 1 | 96,514 | 1 | 193,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her a... | instruction | 0 | 96,515 | 1 | 193,030 |
Tags: constructive algorithms, dfs and similar, graphs
Correct Solution:
```
"""
Codeforces Contest 259 Div 1 Problem C
Author : chaotic_iak
Language: Python 3.3.4
"""
def main():
# Read N and M from problem statement.
n,m = read()
# Set up an adjacency list for each vertex.
edges = [[... | output | 1 | 96,515 | 1 | 193,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her a... | instruction | 0 | 96,516 | 1 | 193,032 |
Tags: constructive algorithms, dfs and similar, graphs
Correct Solution:
```
import sys
readline = sys.stdin.readline
N, M = map(int, readline().split())
Edge = [[] for _ in range(N)]
for _ in range(M):
u, v = map(int, readline().split())
u -= 1
v -= 1
Edge[u].append(v)
Edge[v].append(u)
Pr = list(... | output | 1 | 96,516 | 1 | 193,033 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Pr... | instruction | 0 | 96,517 | 1 | 193,034 |
No | output | 1 | 96,517 | 1 | 193,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Pr... | instruction | 0 | 96,518 | 1 | 193,036 |
No | output | 1 | 96,518 | 1 | 193,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Pr... | instruction | 0 | 96,519 | 1 | 193,038 |
No | output | 1 | 96,519 | 1 | 193,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Pr... | instruction | 0 | 96,520 | 1 | 193,040 |
No | output | 1 | 96,520 | 1 | 193,041 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from 1 to n.
It is... | instruction | 0 | 96,949 | 1 | 193,898 |
Tags: brute force, dfs and similar, graphs, shortest paths
Correct Solution:
```
import sys
import io, os
input = sys.stdin.buffer.readline
n,m,k = map(int,input().split())
AB = []
g = [[] for _ in range(n)]
for i in range(m):
a,b = map(int, input().split())
a,b = a-1, b-1
g[a].append(b)
g[b].append(a)... | output | 1 | 96,949 | 1 | 193,899 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from 1 to n.
It is... | instruction | 0 | 96,950 | 1 | 193,900 |
Tags: brute force, dfs and similar, graphs, shortest paths
Correct Solution:
```
from math import inf
import heapq
n, m, k = map(int, input().split(' '))
edge = [[] for _ in range(n)]
for i in range(m):
a, b = map(int, input().split(' '))
edge[a-1].append((i, b-1))
edge[b-1].append((i, a-1))
d = [inf f... | output | 1 | 96,950 | 1 | 193,901 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from 1 to n.
It is... | instruction | 0 | 96,951 | 1 | 193,902 |
Tags: brute force, dfs and similar, graphs, shortest paths
Correct Solution:
```
from collections import deque
import sys
input = sys.stdin.readline
def bfs(s):
q = deque()
q.append(s)
dist = [-1] * (n + 1)
dist[s] = 0
while q:
i = q.popleft()
di = dist[i]
for j, c in G[i]:
... | output | 1 | 96,951 | 1 | 193,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from 1 to n.
It is... | instruction | 0 | 96,952 | 1 | 193,904 |
Tags: brute force, dfs and similar, graphs, shortest paths
Correct Solution:
```
from math import inf
nmk = list(map(int, input().split(' ')))
n = nmk[0]
m = nmk[1]
k = nmk[2]
a = []
for i in range(m):
a.append(list(map(int, input().split(' '))))
smej = [[] for j in range(n)]
nums = {}
t = 0
for i in a:
nums.upd... | output | 1 | 96,952 | 1 | 193,905 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from 1 to n.
It is... | instruction | 0 | 96,953 | 1 | 193,906 |
Tags: brute force, dfs and similar, graphs, shortest paths
Correct Solution:
```
import sys
input=lambda:sys.stdin.readline().rstrip()
sys.setrecursionlimit(200001)
n,m,k=map(int,input().split())
edge=[[]for _ in range(n)]
di={}
for i in range(m):
a,b=map(int,input().split())
a-=1
b-=1
if a>b:a,b=b,a
di[(a,b)... | output | 1 | 96,953 | 1 | 193,907 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from 1 to n.
It is... | instruction | 0 | 96,954 | 1 | 193,908 |
Tags: brute force, dfs and similar, graphs, shortest paths
Correct Solution:
```
n, m, k = [int(x) for x in input().split()]
E = [[] for _ in range(n)]
for i in range(m):
a, b = [int(x) for x in input().split()]
E[a - 1].append((b - 1, i))
E[b - 1].append((a - 1, i))
Q = [0]
INFTY = n + 1
levels = [INFTY]... | output | 1 | 96,954 | 1 | 193,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from 1 to n.
It is... | instruction | 0 | 96,955 | 1 | 193,910 |
Tags: brute force, dfs and similar, graphs, shortest paths
Correct Solution:
```
import sys
import os
class Path():
def __init__(self, idx, s, d):
self.idx = idx
self.s = s
self.d = d
def __eq__(self, rhs):
return self.s == rhs.s and self.d == rhs.d
def __hash__(self):
... | output | 1 | 96,955 | 1 | 193,911 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of citi... | instruction | 0 | 96,956 | 1 | 193,912 |
No | output | 1 | 96,956 | 1 | 193,913 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of citi... | instruction | 0 | 96,957 | 1 | 193,914 |
No | output | 1 | 96,957 | 1 | 193,915 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of citi... | instruction | 0 | 96,958 | 1 | 193,916 |
No | output | 1 | 96,958 | 1 | 193,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of citi... | instruction | 0 | 96,959 | 1 | 193,918 |
No | output | 1 | 96,959 | 1 | 193,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,482 | 1 | 194,964 |
Tags: implementation, math, sortings
Correct Solution:
```
x1,x2,x3=sorted(map(int, input().split()))
print(x3-x1)
``` | output | 1 | 97,482 | 1 | 194,965 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,483 | 1 | 194,966 |
Tags: implementation, math, sortings
Correct Solution:
```
straight=list(map(int,input().split()))
min_straight=min(straight)
max_straight=max(straight)
list1=[]
for j in straight:
list1.append(abs(j-straight[0]))
min_distance=sum(list1)
list1=[]
for i in range(min_straight,max_straight+1):
for j in straigh... | output | 1 | 97,483 | 1 | 194,967 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,484 | 1 | 194,968 |
Tags: implementation, math, sortings
Correct Solution:
```
def length():
leastdistance = 0
place = sorted(map(int, input().split()))
for L in range(len(place)):
leastdistance += int(abs(place[1]-place[L]))
print(leastdistance)
length()
``` | output | 1 | 97,484 | 1 | 194,969 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,485 | 1 | 194,970 |
Tags: implementation, math, sortings
Correct Solution:
```
l=sorted(map(int,input().split()));print(-l[0]+l[2])
``` | output | 1 | 97,485 | 1 | 194,971 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,486 | 1 | 194,972 |
Tags: implementation, math, sortings
Correct Solution:
```
a,b,c = [int(i) for i in input().split()]
print(max(abs(a-b), abs(a-c), abs(b-c)))
``` | output | 1 | 97,486 | 1 | 194,973 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,487 | 1 | 194,974 |
Tags: implementation, math, sortings
Correct Solution:
```
A=sorted(list(map(int,input().split())))
print(-A[0]+A[2])
``` | output | 1 | 97,487 | 1 | 194,975 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,488 | 1 | 194,976 |
Tags: implementation, math, sortings
Correct Solution:
```
x,y,z=map(int,input().split())
l=[]
l.append(x)
l.append(y)
l.append(z)
l.sort()
a=abs(x-l[1])
b=abs(y-l[1])
c=abs(z-l[1])
print(a+b+c)
``` | output | 1 | 97,488 | 1 | 194,977 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so ... | instruction | 0 | 97,489 | 1 | 194,978 |
Tags: implementation, math, sortings
Correct Solution:
```
x1, x2, x3 = map(int, input().split())
diff1 = abs(x1 -x2)
diff2 = abs(x2 -x3)
diff3 = abs(x1 - x3)
print(max(diff1, diff2, diff3))
``` | output | 1 | 97,489 | 1 | 194,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,490 | 1 | 194,980 |
Yes | output | 1 | 97,490 | 1 | 194,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,491 | 1 | 194,982 |
Yes | output | 1 | 97,491 | 1 | 194,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,492 | 1 | 194,984 |
Yes | output | 1 | 97,492 | 1 | 194,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,493 | 1 | 194,986 |
Yes | output | 1 | 97,493 | 1 | 194,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,494 | 1 | 194,988 |
No | output | 1 | 97,494 | 1 | 194,989 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,495 | 1 | 194,990 |
No | output | 1 | 97,495 | 1 | 194,991 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,496 | 1 | 194,992 |
No | output | 1 | 97,496 | 1 | 194,993 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. Th... | instruction | 0 | 97,497 | 1 | 194,994 |
No | output | 1 | 97,497 | 1 | 194,995 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.
It is possible to get from one city to another only by bus. Bu... | instruction | 0 | 97,514 | 1 | 195,028 |
Tags: implementation, sortings
Correct Solution:
```
import math
n=int(input())
li=[int(x) for x in input().split()]
li.sort()
diff=math.inf
c=0
for i in range(n-1):
temp=li[i+1]-li[i]
if temp==diff:
c+=1
elif temp<diff:
diff = temp
c=1
print(diff,c)
``` | output | 1 | 97,514 | 1 | 195,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.
It is possible to get from one city to another only by bus. Bu... | instruction | 0 | 97,515 | 1 | 195,030 |
Tags: implementation, sortings
Correct Solution:
```
n=int(input())
m=sorted(map(int,input().split()))
d = [m[i]-m[i-1] for i in range(1,n)]
a=min(d)
print(a, d.count(a))
``` | output | 1 | 97,515 | 1 | 195,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.
It is possible to get from one city to another only by bus. Bu... | instruction | 0 | 97,516 | 1 | 195,032 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
cities = sorted(map(int, input().split()))
mn = float("inf")
count = 0
for i in range(1, n):
dist = cities[i] - cities[i - 1]
if dist < mn:
mn = dist
count = 1
elif dist == mn:
count += 1
print(mn, count)
``` | output | 1 | 97,516 | 1 | 195,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.
It is possible to get from one city to another only by bus. Bu... | instruction | 0 | 97,517 | 1 | 195,034 |
Tags: implementation, sortings
Correct Solution:
```
#!/usr/bin/python3
# Copyright (C) 2017 Sayutin Dmitry.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; version 3
#
# This program is distr... | output | 1 | 97,517 | 1 | 195,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.
It is possible to get from one city to another only by bus. Bu... | instruction | 0 | 97,518 | 1 | 195,036 |
Tags: implementation, sortings
Correct Solution:
```
n=int(input())
a=[int(x) for x in input().split()]
a=sorted(a)
m=1<<31
i=1
#print(a)
for j in range(n-1):
d=abs(a[j]-a[j+1])
if d<m:
m=d
i=1
elif d==m:
i+=1
print(m,i)
``` | output | 1 | 97,518 | 1 | 195,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.
It is possible to get from one city to another only by bus. Bu... | instruction | 0 | 97,519 | 1 | 195,038 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
m = 2000000005
f = 0
for i in range(n - 1):
if abs(a[i] - a[i+1]) < m:
m = abs(a[i] - a[i+1])
c = 1
elif abs(a[i] - a[i+1]) == m:
c += 1
else:
continue
pri... | output | 1 | 97,519 | 1 | 195,039 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.
It is possible to get from one city to another only by bus. Bu... | instruction | 0 | 97,520 | 1 | 195,040 |
Tags: implementation, sortings
Correct Solution:
```
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import... | output | 1 | 97,520 | 1 | 195,041 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.