src_uid
stringlengths
32
32
prob_desc_description
stringlengths
63
2.99k
tags
stringlengths
6
159
source_code
stringlengths
29
58.4k
lang_cluster
stringclasses
1 value
categories
listlengths
1
5
desc_length
int64
63
3.13k
code_length
int64
29
58.4k
games
int64
0
1
geometry
int64
0
1
graphs
int64
0
1
math
int64
0
1
number theory
int64
0
1
probabilities
int64
0
1
strings
int64
0
1
trees
int64
0
1
labels_dict
dict
__index_level_0__
int64
0
4.98k
2ac69434cc4a1c78b537d365b895a27e
Inzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own.Ruling a country is not an easy job. Thieves and terrorists are always ready to ruin the country's peace. To fight back, Zane and Inzane have enacted a very effective law: from each city it must be possi...
['dp', 'graphs', 'constructive algorithms', 'shortest paths', 'dfs and similar', 'trees']
import math import sys input = sys.stdin.readline inf = int(1e9) n, m, d = map(int, input().split()) l = [0] * (n - 1) r = [0] * (n - 1) g = [[] for _ in range(n)] station = [int(_) - 1 for _ in input().split()] for i in range(n - 1): l[i], r[i] = map(lambda i : int(i) - 1 , input().split()) g[l[i]].append(i) ...
Python
[ "graphs", "trees" ]
1,177
829
0
0
1
0
0
0
0
1
{ "games": 0, "geometry": 0, "graphs": 1, "math": 0, "number theory": 0, "probabilities": 0, "strings": 0, "trees": 1 }
478
58d7066178839b400b08f39b680da140
There are n segments on a Ox axis [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Segment [l, r] covers all points from l to r inclusive, so all x such that l \le x \le r.Segments can be placed arbitrarily — be inside each other, coincide and so on. Segments can degenerate into points, that is l_i=r_i is possible.Union of the...
['dp', 'graphs', 'constructive algorithms', 'two pointers', 'sortings', 'data structures', 'trees', 'brute force']
from collections import Counter import sys stdin = sys.stdin.read().split('\n') linecount = -1 def input(): global linecount linecount+=1 return stdin[linecount] t = int(input()) output = [] for test in range(t): n = int(input()) actives = set() count = Counter() events = [] for i ...
Python
[ "graphs", "trees" ]
2,104
1,144
0
0
1
0
0
0
0
1
{ "games": 0, "geometry": 0, "graphs": 1, "math": 0, "number theory": 0, "probabilities": 0, "strings": 0, "trees": 1 }
774
fb8fbcf3e38457e45a2552bca15a2cf5
Little Elephant loves Furik and Rubik, who he met in a small city Kremenchug.The Little Elephant has two strings of equal length a and b, consisting only of uppercase English letters. The Little Elephant selects a pair of substrings of equal length — the first one from string a, the second one from string b. The choice...
['combinatorics', 'probabilities', 'brute force']
import sys import copy import os def main(cin): n = int(cin.readline().strip()) a = cin.readline().strip() b = cin.readline().strip() total = 0.0 for i in range(n): total+=(i+1)*(i+1) f = 0.0 s = [0 for i in range(30)] for i in range(n): s[ord(a[i])-ord('A')]+= i+1 f+= s[ord(b[i])-ord('A')] * (n-i) s ...
Python
[ "math", "probabilities" ]
763
572
0
0
0
1
0
1
0
0
{ "games": 0, "geometry": 0, "graphs": 0, "math": 1, "number theory": 0, "probabilities": 1, "strings": 0, "trees": 0 }
1,699
91749edcc396819d4172d06e2744b20b
Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are white and only some of them are black. Currently Gerald is finishing a game of gia...
['dp', 'combinatorics', 'number theory', 'math']
#from sys import setrecursionlimit as srl import sys if sys.subversion[0] == "PyPy": import io, atexit sys.stdout = io.BytesIO() atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue())) sys.stdin = io.BytesIO(sys.stdin.read()) input = lambda: sys.stdin.readline().rstrip() RS = raw...
Python
[ "math", "number theory" ]
985
1,087
0
0
0
1
1
0
0
0
{ "games": 0, "geometry": 0, "graphs": 0, "math": 1, "number theory": 1, "probabilities": 0, "strings": 0, "trees": 0 }
2,941
81faa525ded9b209fb7d5d8fec95f38b
Vasya came up with a password to register for EatForces — a string s. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and digits.But since EatForces takes care of the security of its users, user passwords must contain at least one digit, at least one uppercase Latin let...
['implementation', 'greedy', 'strings']
import re def replace(arr,fr,to): index = arr.index(fr) arr = arr[0:index]+to+arr[index+1:] return arr t = int(input()) for i in range(t): password = str(input().strip()) lower = re.findall("[a-z]",password) upper = re.findall("[A-Z]",password) number = re.findall("[0-9]",password) l_...
Python
[ "strings" ]
1,301
1,282
0
0
0
0
0
0
1
0
{ "games": 0, "geometry": 0, "graphs": 0, "math": 0, "number theory": 0, "probabilities": 0, "strings": 1, "trees": 0 }
3,804