message stringlengths 2 49.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 446 108k | cluster float64 13 13 | __index_level_0__ int64 892 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of... | instruction | 0 | 93,015 | 13 | 186,030 |
No | output | 1 | 93,015 | 13 | 186,031 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of... | instruction | 0 | 93,016 | 13 | 186,032 |
No | output | 1 | 93,016 | 13 | 186,033 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of... | instruction | 0 | 93,017 | 13 | 186,034 |
No | output | 1 | 93,017 | 13 | 186,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of... | instruction | 0 | 93,018 | 13 | 186,036 |
No | output | 1 | 93,018 | 13 | 186,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,115 | 13 | 186,230 |
Tags: constructive algorithms, graphs
Correct Solution:
```
from collections import defaultdict,deque,Counter,OrderedDict
import sys
sys.setrecursionlimit(20000)
def main():
n,m = map(int,input().split())
adj = [[] for i in range(n+1)]
for i in range(m):
a,b = map(int,input().split())
a,b =... | output | 1 | 93,115 | 13 | 186,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,116 | 13 | 186,232 |
Tags: constructive algorithms, graphs
Correct Solution:
```
#!/usr/bin/python3
(n, m) = tuple(map(int, input().split()))
cnt = [0]*n
edges = []
for i in range(m):
(u, v) = tuple(map(int, input().split()))
edges.append((u, v))
cnt[u-1] += 1
cnt[v-1] += 1
edges = sorted(edges)
edge_set = set(edges)
A ... | output | 1 | 93,116 | 13 | 186,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,117 | 13 | 186,234 |
Tags: constructive algorithms, graphs
Correct Solution:
```
edge=[[0 for _ in range(510)] for _ in range(510)]
cnt = [0]*510
s=[0]*510
n,m = map(int,input().split())
for _ in range(m):
u,v = map(int,input().split())
u-=1
v-=1
edge[u][v]=1
edge[v][u]=1
cnt[u]+=1
cnt[v]+=1
for i in range(n):
if(cnt[i]==n-1):s[i]=... | output | 1 | 93,117 | 13 | 186,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,118 | 13 | 186,236 |
Tags: constructive algorithms, graphs
Correct Solution:
```
def dfs(v, graph, used, str_arr, color=0):
used[v] = True
str_arr[v] = color
for u in graph[v]:
if used[u] and str_arr[u] == color:
return False
if not used[u] and not dfs(u, graph, used, str_arr, color ^ 1):
... | output | 1 | 93,118 | 13 | 186,237 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,119 | 13 | 186,238 |
Tags: constructive algorithms, graphs
Correct Solution:
```
color = [-1] * 510
vis = [0] * 510
def dfs(start):
vis[start] = 1
for i in g[start]:
if vis[i] == 0:
color[i] = 1 - color[start]
dfs(i)
if vis[i] != 0:
if (color[i] == color[start]):
... | output | 1 | 93,119 | 13 | 186,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,120 | 13 | 186,240 |
Tags: constructive algorithms, graphs
Correct Solution:
```
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.
"""
"""
from string import ascii_lowercase
def indx(c):
global ascii_lowercase
... | output | 1 | 93,120 | 13 | 186,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,121 | 13 | 186,242 |
Tags: constructive algorithms, graphs
Correct Solution:
```
def dfs(v):
visit[v] = cnt
for u in vertex[v]:
if not visit[u] and u in challengers:
dfs(u)
n, m = map(int, input().split())
vertex = [[] for i in range(n + 1)]
challengers = set()
ans = [''] * (n + 1)
middle = set()
fo... | output | 1 | 93,121 | 13 | 186,243 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 93,122 | 13 | 186,244 |
Tags: constructive algorithms, graphs
Correct Solution:
```
import collections
n, m = map(int, input().split())
ans, A, B, C = [''] * n, [], [], []
d = collections.defaultdict(list)
for i in range(m):
x, y = map(int, input().split())
d[y - 1].append(x - 1)
d[x - 1].append(y - 1)
for k, v in d.items(): ... | output | 1 | 93,122 | 13 | 186,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,123 | 13 | 186,246 |
Yes | output | 1 | 93,123 | 13 | 186,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,124 | 13 | 186,248 |
Yes | output | 1 | 93,124 | 13 | 186,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,125 | 13 | 186,250 |
Yes | output | 1 | 93,125 | 13 | 186,251 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,126 | 13 | 186,252 |
Yes | output | 1 | 93,126 | 13 | 186,253 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,127 | 13 | 186,254 |
No | output | 1 | 93,127 | 13 | 186,255 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,128 | 13 | 186,256 |
No | output | 1 | 93,128 | 13 | 186,257 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,129 | 13 | 186,258 |
No | output | 1 | 93,129 | 13 | 186,259 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 93,130 | 13 | 186,260 |
No | output | 1 | 93,130 | 13 | 186,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected graph with n vertices. There are no edge-simple cycles with the even length in it. In other words, there are no cycles of even length that pass each edge at most once. Let's enumerate vertices from 1 to n.
You h... | instruction | 0 | 93,213 | 13 | 186,426 |
Tags: binary search, data structures, dfs and similar, dsu, graphs, two pointers
Correct Solution:
```
def divisors(M):
d=[]
i=1
while M>=i**2:
if M%i==0:
d.append(i)
if i**2!=M:
d.append(M//i)
i=i+1
return d
def popcount(x):
x = x - ((x >> 1... | output | 1 | 93,213 | 13 | 186,427 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph with n vertices. There are no edge-simple cycles with the even length in it. In other words, there are no cycles of even length that pass each edge at most once... | instruction | 0 | 93,214 | 13 | 186,428 |
No | output | 1 | 93,214 | 13 | 186,429 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph with n vertices. There are no edge-simple cycles with the even length in it. In other words, there are no cycles of even length that pass each edge at most once... | instruction | 0 | 93,215 | 13 | 186,430 |
No | output | 1 | 93,215 | 13 | 186,431 |
Provide a correct Python 3 solution for this coding contest problem.
Problem statement
You and AOR Ika are preparing for a graph problem in competitive programming. Generating input cases is AOR Ika-chan's job. The input case for that problem is a directed graph of the $ N $ vertices. The vertices are numbered from $... | instruction | 0 | 93,502 | 13 | 187,004 |
"Correct Solution:
```
from operator import itemgetter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt_a = 0
cnt_b = 0
for i, (a, b) in enumerate(zip(A, B)):
cnt_a += i*a
cnt_b += i*b
if cnt_a!=cnt_b or not sum(A)==sum(B)==N:
print("NO")
exit()
B_ = []
cumi... | output | 1 | 93,502 | 13 | 187,005 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,715 | 13 | 187,430 |
Tags: dp, graphs, greedy
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
ans = []
for _ in range(int(input())):
n = int(input())
c = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
res = 0
tmp = c[-1] - 1
pos_x,pos_y ... | output | 1 | 93,715 | 13 | 187,431 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,716 | 13 | 187,432 |
Tags: dp, graphs, greedy
Correct Solution:
```
import os,sys
from io import BytesIO,IOBase
for _ in range(int(input())):
n = int(input())
vert = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
dp,ans = -10**10,0
for i in range(1,n):
if... | output | 1 | 93,716 | 13 | 187,433 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,717 | 13 | 187,434 |
Tags: dp, graphs, greedy
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
c = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = abs(a[1] - b[1])
cur = ans
for i in range(1, n):
if a[i] == b[i]:
... | output | 1 | 93,717 | 13 | 187,435 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,718 | 13 | 187,436 |
Tags: dp, graphs, greedy
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO,IOBase
def main():
for _ in range(int(input())):
n = int(input())
vert = list(map(int,input().split()))
a = list(map(int,input().split()))
... | output | 1 | 93,718 | 13 | 187,437 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,719 | 13 | 187,438 |
Tags: dp, graphs, greedy
Correct Solution:
```
t= int(input().strip())
for i in range(t):
n=int(input().strip())
c=list(map(int,input().strip().split()))
a=list(map(int,input().strip().split()))
b=list(map(int,input().strip().split()))
c[0]=0
s=0
m=0
z=0
for k in range(1,n):
... | output | 1 | 93,719 | 13 | 187,439 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,720 | 13 | 187,440 |
Tags: dp, graphs, greedy
Correct Solution:
```
'''
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineering College
'''
from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insor... | output | 1 | 93,720 | 13 | 187,441 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,721 | 13 | 187,442 |
Tags: dp, graphs, greedy
Correct Solution:
```
for t in range(int(input())):
n=int(input())
c=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
prev=[0 for i in range(n)]
#best=[0 for i in range(n)]
best2=0
i=1
x=b[i]-a[i]
i... | output | 1 | 93,721 | 13 | 187,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected graph with c_i vertices and (c_i - 1) edges connect... | instruction | 0 | 93,722 | 13 | 187,444 |
Tags: dp, graphs, greedy
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
c = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
maxi=0
cnt=c[n-1]
for i in range(n-1,0,-1):
if a[i]>b[i]:
a[i],... | output | 1 | 93,722 | 13 | 187,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,723 | 13 | 187,446 |
Yes | output | 1 | 93,723 | 13 | 187,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,724 | 13 | 187,448 |
Yes | output | 1 | 93,724 | 13 | 187,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,725 | 13 | 187,450 |
Yes | output | 1 | 93,725 | 13 | 187,451 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,726 | 13 | 187,452 |
Yes | output | 1 | 93,726 | 13 | 187,453 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,727 | 13 | 187,454 |
No | output | 1 | 93,727 | 13 | 187,455 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,728 | 13 | 187,456 |
No | output | 1 | 93,728 | 13 | 187,457 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,729 | 13 | 187,458 |
No | output | 1 | 93,729 | 13 | 187,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have n chains, the i-th chain consists of c_i vertices. Vertices in each chain are numbered independently from 1 to c_i along the chain. In other words, the i-th chain is the undirected grap... | instruction | 0 | 93,730 | 13 | 187,460 |
No | output | 1 | 93,730 | 13 | 187,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,913 | 13 | 187,826 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
def connected_components(n, graph):
components, visited = [], [False] * n
def dfs(start):
component, stack = [], [start]
while stack:
start = stack[-1]
if visited[start]:
stack.pop... | output | 1 | 93,913 | 13 | 187,827 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,914 | 13 | 187,828 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
import sys
import threading
threading.stack_size(67108864)
sys.setrecursionlimit(100500)
def nc2(k):
return k * (k - 1) // 2
def solve():
def dfs(u):
comp[u] = n_comp
for v in g[u]:
if color[v] == 0:
... | output | 1 | 93,914 | 13 | 187,829 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,915 | 13 | 187,830 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
# 解説AC
# 二部グラフでないグラフの性質や,パスの長さを考察する
def main():
N, M = (int(i) for i in input().split())
par = [i for i in range(N)]
size = [1 for i in range(N)]
def find(x):
if par[x] == x:
return x
else:
... | output | 1 | 93,915 | 13 | 187,831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,916 | 13 | 187,832 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
"""
#If FastIO not needed, use this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
"""
import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from... | output | 1 | 93,916 | 13 | 187,833 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,917 | 13 | 187,834 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
def main():
N, M = (int(i) for i in input().split())
par = [i for i in range(N)]
size = [1 for i in range(N)]
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
s... | output | 1 | 93,917 | 13 | 187,835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,918 | 13 | 187,836 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
n, m = [int(x) for x in input().split()]
E = {i:[] for i in range(n)}
for i in range(m):
u, v = [int(x)-1 for x in input().split()]
E[v].append(u)
E[u].append(v)
def dfs():
visited = [False for i in range(n)]
colour = [0 for i... | output | 1 | 93,918 | 13 | 187,837 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,919 | 13 | 187,838 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
def read_data():
n, m = map(int, input().split())
Es = [[] for v in range(n)]
for e in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
Es[a].append(b)
Es[b].append(a)
return n, m, Es... | output | 1 | 93,919 | 13 | 187,839 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem.... | instruction | 0 | 93,920 | 13 | 187,840 |
Tags: combinatorics, dfs and similar, graphs, math
Correct Solution:
```
g = [[] for _ in range(100005)]
n, m = map(int, input().split(' '))
for i in range(m):
a, b = map(int, input().split(' '))
g[a].append(b)
g[b].append(a)
colour = [0] * 100005
v = [0] * 100005
cycle = False
two = True
twos = 0
ones =... | output | 1 | 93,920 | 13 | 187,841 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly wa... | instruction | 0 | 93,921 | 13 | 187,842 |
No | output | 1 | 93,921 | 13 | 187,843 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly wa... | instruction | 0 | 93,922 | 13 | 187,844 |
No | output | 1 | 93,922 | 13 | 187,845 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.