Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
DOI:
Libraries:
Datasets
pandas
question
stringlengths
58
4.29k
label
class label
3 classes
Andrew love sea that s height summer season decide beach take sunbe sunbatheThe beach rectangular field n row m column some cell beach free road stone shop nonmovable object some adjacent cell sunbed locate horizontally verticallyAndrew hope sunbe that s bad luck long free place that s Andrew ask help find free place sunbe Andrews sunbe place adjacent cell if adjacent free cell order free place sunbe disturb tourist you follow action come sunbe cause p unit discomfort owner lift sunbe side rotate 90 degree one half sunbe remain cell half sunbe free cell at time way sunbe rotation Rotation sunbe 90 degree cell 1 2 come sunbe cause q unit discomfort owner shift sunbe long cell one half sunbe place free cell Shift sunbe cell right in moment sunbe occupie adjacent free cell you sunbe timehelp Andrew free space sunbe cause minimum possible number unit discomfort tourist detect impossible
1graph
you give tree consist n vertex Initially vertex value 0you need perform m query type you give vertex index v print value vertex v you give vertex index u v value k d d le 20 you need add k value vertex distance vertex path u v equal d the distance vertex x y equal number edge path x y for example distance x x equal 0the distance vertex v path x y equal minimum distance v vertex path x y
1graph
monocarp playing Minecraft want build wall cacti he want build field sand size n time m cell Initially cacti cell field Note Minecraft cacti grow cell adjacent initial field meet restriction Monocarp plant new cacti fulfil aforementione condition he can not chop cacti grow field do not axe cacti prickly handsMonocarp believe wall complete path row field row consecutive cell path adjacent cell belong path contain cactus your task plant minimum number cacti build wall report impossible
1graph
you give rooted tree consist n vertex the vertex number 1 n root vertex 1 you give score array s_1 s_2 ldot s_nA multiset k simple path call valid follow condition true each path start 1 let c_i number path cover vertex for pair vertex uv 2le uvle n parent c_uc_vle 1 hold the value path multiset define sumlimits_i1n c_i s_iit show possible find valid multiset find maximum value valid multiset
1graph
you give n segment coordinate axis the ith segment l_i r_i let denote set integer point belong ith segment s_ilet a cup b union set a B a cap b intersection set a B a oplus b symmetric difference A b set contain element a element b one belong setsLet mathbinop_1 mathbinop_2 dot mathbinop_n1 array element cup oplus cap over 3n1 way choose array calculate sum follow valuess_1 mathbinop_1 S_2 mathbinop_2 S_3 mathbinop_3 S_4 dot mathbinop_n1 s_nin expression S denote size set S
0array
Alperen strings s t initially equal he perform q operation type give string 1 k x Append string x exactly k times end string s in word s s underbracex dot x_k text times 2 k x Append string x exactly k times end string t in word t t underbracex dot x_k text time after operation determine possible rearrange character s t s lexicographically smallerdagger tNote string change perform operation do not initial statesdagger simply speak lexicographical order order word list dictionary a formal definition follow stre p lexicographically small string q exist position p_i q_i j p_j q_j if exist p lexicographically small q length p length q for example textttabdc textttabe textttabc textttabcd write p q p lexicographically small q
2string
Kirill live connect undirected graph n vertex m edge vertex 1 one fine evening gather f friend ith friend live vertex h_i so friend vertex 1 ith friend home vertex h_ithe evening end time leave it turn k k le 6 friend car walk give ride one friend car ride number friend car ride drive short path housefor example graph friend vertex h_i5 ride friend follow set vertex 2 3 2 4 2 3 4 can not ride friend vertex 6 set 3 4 the vertex friend car live highlight green car red Kirill want friend possible walk help find minimum possible number
1graph
the girl name Masha walking forest find complete binary tree height n permutation p length m2na complete binary tree height n rooted tree vertex leave exactly son length path root leave n the picture show complete binary tree n2A permutation array consist n different integer 1 n for example 23154 permutation 122 2 occur twice 134 permutation n3 4 arraylet enumerate m leave tree leave right the leaf number contain value p_i 1 le le mFor example n 2 p 3 1 4 2 tree look like Masha consider tree beautiful value leave order leave right increase orderIn operation Masha choose nonleaf vertex tree swap leave right son subtreesfor example Masha apply operation root tree discuss follow form help Masha understand tree beautiful certain number operation if output minimum number operation tree beautiful
1graph
two Tshirt size give b the Tshirt size string M string consist possibly zero character x character S LFor example string M XXL S XXXXXXXS size tshirt and string XM LL SX sizesThe letter M stand medium S small L large the letter x refer degree size eXtra for example XXL extraextralarge big XL small XXXLYou need compare give size Tshirts bThe Tshirts compare follow small size matter letter x small medium size large size large size regardless number letter x large medium size small size letter X S small size letter X L large size for example XXXS XS XXXL XL XL M XXL XXL XXXXXS M XL xxxs
2string
in world Compfestnesia Pak Chanek discover secret underground dungeon inside treasure chest surround n statue arrange circular manner the statue number 0 n1 statue leave statue i1 statue n1 leave statue 0pak Chanek observe statue hold crystal ball integer 0 m1 inclusive Lets integer crystal ball statue a_ithe dungeon provide instruction integer crystal ball 0 order open treasure chest to achieve Pak Chanek give integer k zero operation in single operation Pak Chanek following choose exactly k consecutive statue in word choose statue p p1 bmod n p2 bmod n p3 bmod n ldot pk1 bmod n choose index p Do follow for choose statue change value a_i a_i1 bmod m for choose statue change value a_i a_i1 bmod m help Pak Chanek find minimum possible number operation open treasure chest
1graph
Pak Chanek n blank heartshape card Card 1 attach directly wall card hang exactly card piece string specifically card 1 hang card p_i p_i iIn begin Pak Chanek write integer number card he choose permutation 1 2 dot n then number write card a_iafter Pak Chanek follow operation n time maintain sequence s initially Choose card x card hang Append number write card x end s if x neq 1 number card p_x large number card x replace number card p_x number card x Remove card x after Pak Chanek sequence s n element what maximum length long nondecrease subsequencedagger s end Pak chanek step optimallydagger a sequence b subsequence sequence c b obtain c deletion possibly zero element for example 31 subsequence 321 431 31 1337 3104
1graph
Monocarp dictionary n word consist 12 letter latin alphabet the word number 1 n in pair adjacent character word character different for word Monocarp integer c_i denote use wordmonocarp want design keyboard allow type word easily a keyboard denote sequence 12 letter latin alphabet letter l appear exactly oncea word type keyboard easily pair adjacent character word character adjacent keyboard the optimality keyboard sum c_i word type easily ithelp Monocarp design keyboard maximum possible optimality
2string
you give rooted tree consist n vertex the vertex number 1 n root vertex 1you perform follow operation k time choose edge v u tree v parent u remove edge v u add edge 1 u ie u subtree child root the height tree maximum depth vertex depth vertex number edge path root for example depth vertex 1 0 root depth child 1what smallest height tree achieve
1graph
your task maintain queue consist lowercase English letter follow push c insert letter c queue pop delete letter queue Initially queue after operation ask count number distinct palindromic substring string obtain concatenate letter queueespecially number distinct palindromic substring string 0 a string s1n length n palindromic si sni1 1 leq leq n the string slr substre string s1n 1 leq l leq r leq n two string s1n t1 m distinct follow hold n neq m si neq ti 1 leq leq minnm
2string
this interactive problemgiven simple undirected graph n vertex number 1 n task color vertex color c follow condition hold the set vertex color c connect s_c leq n_c2 n_c number vertice color c s_c sum degree vertice color c it show exist way color vertex condition hold initially give number n vertex degree vertex in query choose vertex u as response give kth edge incident u kth query vertex u you allow n queriesAn undirected graph simple contain multiple edge selfloopsthe degree vertex number edge incident a set S vertex connect different vertex u v S path pass vertex S connect u v that sequence edge u_1 v_1 u_2 v_2 dot u_k v_k k geq 1 u_1 u v_k v v_i u_i1 1 leq k u_k S v_k s 1 leq leq k especially set contain vertex connect
1graph
give permutation a_1 a_2 dots a_n integer 1 n threshold k 0 leq k leq n compute sequence b_1 b_2 dots b_n follow for 1 leq leq n increase order let x a_i if x leq k set b_x element a_j 1 leq j a_j k if element a_j exist set b_x n1 if x k set b_x element a_j 1 leq j a_j leq k if element a_j exist set b_x 0 unfortunately sequence b_1 b_2 dots b_n completely computed permutation a_1 a_2 dots a_n threshold k discard now sequence b_1 b_2 dot b_n your task find possible permutation a_1 a_2 dots a_n threshold k produce sequence b_1 b_2 dots b_n it guarantee exist pair permutation a_1 a_2 dots a_n threshold k produce sequence b_1 b_2 dots b_na permutation integer 1 n sequence length n contain integer 1 n exactly
1graph
Ela need send large package machine 1 machine n network machine currently network condition complain network slow package can not arrive time Luckily Wiring Wizard offer help handThe network represent undirected connect graph n node node represent machine m wire connect Wire connect machine u_i v_i weight w_i the aforementioned large package go wire machine u_i machine v_i vice versa exactly w_i microsecond the Wiring Wizard use spell arbitrary number time for spell choose wire index connect machine u_i v_i rewire follow step choose machine connect wire without loss generality let choose v_i choose machine currently connect v_i include u_i t_i Disconnect wire index v_i connect u_i t_i the rewire wire take w_i microsecond weight wire change operation after rewire machine wire connect also Wiring Wizard warn Ela rewiring cause temporary disconnection machine Ela ignore her mission send large package machine 1 machine n fast possible note Wizard use spell wire zero time to sure network work seamlessly transfer large package package start transfer machine 1 Wiring Wizard use spell wire anymoreEla wonder help Wiring Wizard time need transfer large package machine 1 n
1graph
Ela love read lot like new coworker DTL on day engineer DTL challenge coworker sort heap book different compartment shelfn book split k compartment bookshelf n divisible k each book represent lowercase Latin letter y inclusively begin letter title bookela stack exactly fracnk book compartment after book stack compartment index 1 k take minimum exclude MEX letter multiset letter form letter represent book compartment combine result letter stre the letter result stre MEX letter multiset letter form compartment second letter result stre MEX letter multiset letter form second compartment please note constraint problem MEX letter determine multiset find problem z usedwhat lexicographically great result string possible Ela createA string lexicographically great string b follow hold b prefix b ne position b differ string letter appear later alphabet corresponding letter b the minimum exclude MEX letter multiset letter letter appear early alphabet contain multiset for example multiset letter contain 7 letter b b c e c f respectively MEX letter compartment d d include multiset letter come d alphabet b c include multiset
2string
everool binary string s length 2n note binary string string consist character 0 1 he want partition s disjoint equal subsequence he need help itYou allow follow operation exactly you choose subsequence possibly s rotate right position in word select sequence index b_1 b_2 ldot b_m 1 le b_1 b_2 ldot b_m le 2n after simultaneously set s_b_1 s_b_m s_b_2 s_b_1 ldot s_b_m s_b_m1Can partition s disjoint equal subsequence perform allow operation exactly oncea partition s disjoint equal subsequence sp sq increase array indice p_1 p_2 ldot p_n q_1 q_2 ldot q_n integer 1 2n encounter p q exactly sp s_p_1 s_p_2 ldot s_p_n sq s_q_1 s_q_2 ldot s_q_n sp sqIf possible partition perform kind operation report 1 if possible operation partition s disjoint subsequence sp sq sp sq print element b index sp ie value p_1 p_2 ldot p_n
2string
there n house city arrange axis point h_1 h_2 ldot h_n you want build new house consider option place point p_1 p_2a like visit friend calculate advance distance option exist house more formally calculate array d_1 d_2 d_i j leftp_i h_jright x define absolute value xAfter long time inactivity forget location house h option p_1 p_2 but diary keep arrays d_1 d_2 authenticity doubt also value inside array shuffle value position d_1 d_2 correspond different house pay attention value array word value array d_1 correspond distance p_1 house array d_2 p_2 housesalso pay attention location house h_i consider option p_j match for example location correct h 1 0 3 3 p 1 1 correspond shuffle d_1 0 2 1 2 d_2 2 2 1 0check location house h consider point p_1 p_2 found array distance correct if possible find appropriate location house consider option
1graph
there conveyor 120 row 120 column each row column number 0 119 cell ith row jth column denote j the leftmost cell 0 0 each cell belt belt initially face rightinitially slime ball belt 0 0 belt every second state conveyor change follow all slime ball conveyor cell direction belt time if cell move position slime get conveyor slime ball cell merge all belt slime ball previous second change direction time belt face right face vice versa a new slime ball place cell 0 0 there q query integer t x y you find slime cell x y t second start can
1graph
you give array n integer you perform follow operation k time Choose indice j bmod k j bmod k 1 le j le n Swap a_i a_j after perform operation select k consecutive element sum k element score find maximum score getHere x bmod y denote remainder dividing x y
1graph
you give array integer a_1 a_2 ldot a_n b_1 b_2 ldot b_n you need handle q query follow type 1 l r x assign a_i x l leq leq r 2 l r find minimum value follow expression l leq leq r fracoperatornamelcma_i b_igcda_i b_iin problem gcdx y denote great common divisor x y operatornamelcmx y denote common multiple x y
1graph
give string s decimal digit 09 length nA substre sequence consecutive character stre the substre string define pair index leave right end so pair index l r 1 le l le r le n correspond substre string s we define vlr numeric value correspond substre lead zero allow itfor example n7 s1003004 v13100 v230 v273004You give n s integer w 1 le w nYou need process m query characterize 3 number l_i r_i k_i 1 le l_i le r_i le n 0 le k_i le 8the answer ith query pair substring length w denote L_1 L_1w1 L_2 L_2w1 L_1 ne L_2 substring different remainder dividing number vL_1 l_1w1 cdot vl_i r_i vL_2 L_2 w 1 9 equal k_i if match substre pair find pair L_1 small possible if match pair case minimize l_2note answer exist
1graph
the title reference Educational Round writer team Educational Round 18There bag contain color ball there n different color ball number 1 n there mathitcnt_i ball color bag the total ball bag odd eg mathitcnt_1 mathitcnt_2 dot mathitcnt_n oddIn choose ball different color bagAt point remain ball bag color that s can not moves anymorefind possible color remain ball
0array
Mainak positive integer n mMainak find sequence a_1 a_2 ldot a_n n positive integer interesting integer 1 le le n bitwise XOR element strictly a_i 0 formally p_i bitwise XOR element strictly a_i interesting sequence p_1 p_2 ldot p_n 0for example sequence 1323123 4444 25 interesting 1234 p_2 1 ne 0 41124 p_1 1 oplus 1 oplus 2 2 ne 0 293030 p_2 29 ne 0 are not interestinghere oplus b denote bitwise XOR integer bfind interesting sequence a_1 a_2 ldots a_n report exist sequence sum element sequence equal m ie a_1 a_2 ldot a_n mas reminder bitwise XOR sequence consider 0
2string
Pak chanek tree call key tree this tree consist n vertex n1 edge the edge tree number 1 n1 edge connect vertex u_i V_i Initially edge key tree weightformally path length k graph sequence v_1 e_1 v_2 e_2 v_3 e_3 ldot v_k e_k v_k1 for v_i vertex e_i edge for e_i connect vertex v_i v_i1 a circuit path start end vertexA path graph say simple path use edge note simple path use vertex oncethe cost simple path weight graph define maximum weight edge traversescount number distinct undirected weighted graph satisfy follow condition the graph N vertex 2n2 edge for pair different vertex x y exist simple circuit go vertex x y graph the weight edge graph integer 1 2n2 inclusive each edge distinct weight the graph form way way assign weight w_i edge key tree satisfie follow condition for pair edge j ij W_iW_j for pair different vertex index x y cost simple path vertex x y key tree equal minimum cost simple circuit go vertex x y graph Note graph allow multiedge allow selfloop print answer modulo 998244353two graph consider distinct exist triple b c exist edge connect vertex b weight c graph
1graph
Pak Chanek travel Manado it turn OSN Indonesian National Scientific Olympiad 2019 hold the contestant OSN 2019 currently line field photograph the field shape like grid size n times 10100 n row 10100 column the row number 1 N north south column number 1 10100 west east the tile row r column c denote rcthere N province participate OSN 2019 initially contestant represent province stand tile p p satisfy L_i leq p leq R_i so r_il_i1 contestant represent province iPak Chanek variable z initially equal 0 in operation Pak Chanek choose row positive integer k then Pak Chanek follow possibility move contestant row exactly k tile west in word contestant p move pk Move contestant row exactly k tile east in word contestant p move pk after operation value z change z text or k textOR bitwise or operation Note Pak chanek operation row also note Pak Chanek allow contestant gridThere q question for jth question give positive integer W_j Pak Chanek zero operation final value Z exactly W_j Define M big number operation column contain exactly m contestant for question find big possible M sequence operation Pak Chanek Note operation Pak chanek question carry question
1graph
Pak Chanek mirror shape circle there n lamp circumference number 1 n clockwise order the length arc lamp lamp i1 D_i 1 leq leq N1 meanwhile length arc lamp N lamp 1 d_npak Chanek want colour lamp M different colour each lamp colour M colour however different lamp colour lamp triangle consider lamp vertice right triangle triangle angle exactly 90 degreesthe follow example lamp colouring configuration circular mirror figure 1 example incorrect colouring lamp 1 2 3 form right trianglefigure 2 example correct colouringfigure 3 example correct colour before colour lamp Pak Chanek want know number distinct colouring configuration Count number distinct possible lamp colouring configuration modulo 998244353
2string
a basketball competition hold number player team maximum minimum limit necessarily 5 player team match there n candidate player competition train Pak chanek good basketball coach earth the ith candidate player power P_iPak Chanek form zero team N candidate player condition candidate player join team each Pak Chaneks team send compete enemy team power D in match team send say defeat enemy team sum power form player strictly great DOne Pak Chaneks skill team form play match change power player team equal big player power teamdetermine maximum number win achieve Pak Chanek
1graph
you n rectangle ith rectangle height h_i width w_iyou ask q query form h_s w_s h_b w_b for query output total area rectangle fit rectangle height h_s width w_s fitting rectangle height h_b width w_b in word print sum h_i cdot w_i h_s h_i h_b w_s w_i w_b please note rectangle height width fit inside also note rotate rectanglesplease note answer test case will not fit 32bit integer type use 64bit integer type programming language like long long c
1graph
you give bipartite graph n_1 vertex n_2 vertex second m edge the maximum match graph maximum possible size subset edge graph vertex incident choose edgeyou process type query graph 1 remove minimum possible number vertex graph size maximum matching gets reduce exactly 1 print vertex remove then find maximum match graph print sum index edge belong match 2 query type ask query type 1 as answer query print edge form maximum matching choose previous query note solve problem online mode it mean can not read input you read query write answer query Use function fflush C BufferedWriterflush Java language write program
2string
you give array b consist n integer eachlet define function fa b follow let define array c size n c_i a_i oplus b_i oplus denote bitwise XOR value function c_1 mathbin c_2 mathbin cdot mathbin c_n ie bitwise and entire array c find maximum value function fa b reorder array b arbitrary way leave initial order option
1graph
Misha square n times n matrix number row column j equal a_i j Misha want modify matrix contain exactly k distinct integer to achieve goal Misha perform follow operation zero time choose square submatrix matrix choose x_1y_1 x_2y_2 x_1 leq x_2 y_1 leq y_2 x_2 x_1 y_2 y_1 submatrix set cell coordinate x y x_1 leq x leq x_2 y_1 leq y leq y_2 choose integer k 1 leq k leq n2 replace integer submatrix k please find minimum number operation Misha need achieve goal
2string
it easy version problem the difference version a_i le 200you give array n integer a_0 a_1 a_2 ldot a_n 1 Bryap wants find long beautiful subsequence arrayAn array b b_0 b_1 ldot b_m1 0 le b_0 b_1 ldot b_m 1 n subsequence length m array aSubsequence b b_0 b_1 ldot b_m1 length m call beautiful follow condition hold for p 0 le p m 1 hold a_b_p oplus b_p1 a_b_p1 oplus b_p here oplus b denote bitwise XOR b for example 2 oplus 4 6 3 oplus 12Bryap simple person want know length long subsequence help bryap find answer question
1graph
you give array contain n integer you choose proper subsegment a_l a_l 1 ldot a_r array mean choose integer 1 le l le r le n r l 1 n we define beauty give subsegment value follow expressionmaxa_1 a_2 ldot a_l1 a_r1 a_r2 ldot a_n mina_1 a_2 ldot a_l1 a_r1 a_r2 ldot a_n maxa_l ldot a_r mina_l ldot a_rplease find maximum beauty proper subsegment
1graph
we array pure element pairwise distinct for example array 1 7 9 pure 1 3 3 7 is not 3 occur twice itA pure array b similar pure array c length n pair indice l r 1 le l le r le n true operatornameargmaxb_l b_l 1 ldot b_r operatornameargmaxc_l c_l 1 ldot c_r operatornameargmaxx define index large element x unique pure array for example operatornameargmax3 4 2 2 operatornameargmax1337 179 57 1recently Tonya find Burenka like permutation p length n Tonya decide array similar p he fix element exactly k element miss position temporarily a_i 0 it guarantee k ge 2 also set S k 1 numbersTonya realize miss number fill place decide buy he q option buy Tonya think number d suit possible replace zero number s number d pure array similar p for option d output number suitable
1graph
this hard version problem the difference easy hard version constraint a_i n you hack version problem solvedburenka crown princess Buryatia soon nth queen country there ancient tradition Buryatia coronation ruler strength inhabitant to determine strength nth ruler inhabitant country array exactly n number ruler turn element array zero short time the ruler follow twostep operation number time select index l r 1 le l le r le n nonnegative integer x l leq leq r assign a_i a_i oplus x oplus denote bitwise XOR operation it take leftlceil fracrl12 rightrceil seconds operation lceil y rceil denote y round near integer help Burenka calculate time need
2string
oh exam Madoka get hard problemgiven integer n m pair integer v_i u_i also array b_1 b_2 ldots b_n initially fill zerosThen index 1 leq leq m perform b_v_i b_v_i 1 b_u_i b_u_i 1 b_v_i b_v_i 1 b_u_i b_u_i 1 note exactly operation perform iAlso array s length n consist 0 1 and array a_1 a_2 ldot a_n guarantee s_i 0 hold a_i 0help Madoka determine possible perform operation way s_i 1 hold a_i b_i if possible provide Madoka way perform operation
2string
there n bag bag contain m ball number 1 m for 1 m exactly ball number bagyou exactly ball bag bag different example take ball 1 bag ball 2 second bag take ball 2 bag ball 1 second bag after calculate number ball odd number one take let number ball FYour task calculate sum Fk possible way n ball bag
1graph
Stanley Megan decide shop crossmarket grocery store represent matrix n row m column Stanley Megan adjacent cell 1 unit power two cell consider adjacent share edge to speed shopping process Megan bring portal leave cell visit portal if person Stanley Megan cell portal person use 1 unit power teleport cell portal include Megans start cellThey decide split Stanley upperleft cell cell coordinate 1 1 lowerright cell cell coordinate n m whilst Megan need lowerleft cell cell coordinate n 1 upperright cell cell coordinate 1 mWhat minimum total energy need thatnote choose time Time affect energy
1graph
find minimum number give sum digit s digits distinct ie digit uniquefor example s20 answer 389 this minimum number digit different sum digit 20 38920for give s print require number
1graph
Polycarp present sequence integer length n 1 le a_i le n a sequence Polycarp happy consist different number ie distinct numbersin order sequence like Polycarp go possibly zero number movesIn remove leftmost element sequence for example sequence 3 1 4 3 produce sequence 1 4 3 consist different numbersDetermine minimum number move need remain sequence element different in word find length small prefix give sequence remove value sequence unique
1graph
god Blessing this permutationforcesa Random PebbleYou give permutation p_1p_2ldotsp_n length n positive integer k le n in operation choose index j 1 le j le n swap p_i p_jfind minimum number operation need sum p_1 p_2 ldot p_k small possibleA permutation array consist n distinct integer 1 n arbitrary order for example 23154 permutation 122 permutation 2 appear twice array 134 permutation n3 4 array
1graph
you beta test new secret Terraria update this update add quest gamesimply world map represent array length n ith column world height a_iThere m quest test the jth represent integer s_j t_j in quest column s_j column t_j at start quest appear column s_jIn column x column x1 column x1 in version Spectre Boots allow fly since beta version bug allow fly go infinite fly duration when move column height p column height q fall damage if height p great height q p q fall damage fly 0 damagefor give quest determine minimum fall damage quest
0array
you give connect undirected graph consist n vertex m edge the weight ith edge iHere wrong algorithm find minimum span tree mst graphvis array length n set edgesfunction dfsu visu true iterate edge u v order small large edge weight visv false add edge u v set s dfsvfunction findmstu reset element vis false reset edge set s dfsu return edge set sEach call findmst1 findmst2 findmstn gives span tree graph Determine tree minimum span tree
2string
Qpwoeirut take architecture ambitiously decide remodel cityqpwoeirut city describe row n building ith 1 le le n h_i floor high you assume height floor problem equal therefore building tall build j number floor h_i build large number floor h_j building jbuilde cool tall building i1 building i1 exist Note 1st nth building coolTo remodel city Qpwoeirut need maximize number cool building to Qpwoeirut build additional floor building tall Note remove exist floorssince build new floor expensive Qpwoeirut want minimize number floor builds find minimum number floor Qpwoeirut need build order maximize number cool building
1graph
Mark administer online exam consist n truefalse question however lose answer key he need way retrieve answer client get infuriatedfortunately access grade system Thus query input answer n question grade system output correcthe do not time use grade system 675 time help Mark determine answer keysnote answer key fix advance change depend query
1graph
one night Mark realize essay tomorrow he have not write Mark decide randomly copypaste substring prompt essaymore formally prompt string s initial length n Mark perform copypaste operation c time each operation describe integer l r mean Mark append letter s_l s_l1 ldot s_r end string s note length s increase operationOf course Mark need able write after copy Mark ask q query give integer k determine kth letter final string s
2string
Mark cleaning row n room the ith room nonnegative dust level a_i he magical cleaning machine follow threestep operation Select indice ij dust level a_i a_i1 dot a_j1 strictly great 0 set a_i a_i1 Set a_j a_j1 Marks goal a_1 a_2 ldot a_n1 0 nicely sweep nth room determine minimum number operation need reach goal
1graph
Mio array consist n integer array b consist m integer Mio follow operation Choose integer 1 leq leq n choose add 1 a_i subtract 2 a_i1 add 3 a_i2 Formally operation add 1ji cdot ji1 a_j leq j leq nMio want transform contain b subarray could answer question provide sequence operation possiblean array b subarray array b obtain deletion possibly zero element begin possibly zero element end
1graph
Luke like eat there n pile food align straight line the ith pile contain a_i unit food Luke walk 1st pile nth pile want eat pile food walk when Luke reach ith pile eat pile v a_i leq x x fix integer v luke food affinityBefore Luke start walk set v integer also 1 leq leq n Luke change food affinity integer eat ith pilefind minimum number change need eat pile foodnote initial choice v consider change
2string
there n chest the ith chest contain a_i coin you need open n chest order chest 1 chest nThere type key use open chest good key cost k coin use bad key cost coin halve coin unopene chest include chest open the halve operation round near integer chest halve in word bad key open chest a_i lfloorfraca_i2rfloor a_i1 lfloorfraca_i12rfloor dot a_n lfloor fraca_n2rfloor key good bad break usage onetime use you need use total n key chest Initially coin key if want use good key need buy itduring process allow debt example 1 coin allow buy good key worth k3 coin balance 2 coinsfind maximum number coin open n chest order chest 1 chest n
1graph
Luca cypher sequence n wheel digit a_i write on ith wheel b_i move each type denote textttU increase ith digit 1 after apply 9 0 denote textttD decrease ith digit 1 after apply 0 9 Example n4 the current sequence 0 0 0 0 Luca know final sequence wheel move wheel Help find original sequence crack cypher
2string
there stre s length 3 consist uppercase lowercase english letter check equal yes quote letter case for example yes yes yes allowable
1graph
this easy version problem the difference easy hard version number queriesPolycarp grow tree n vertex we remind tree n vertex undirecte connect graph n vertex n1 edge contain cycleshe call set vertex passable path tree pass vertex set pass edge twice the path visit vertex setin word set vertex call passable simple path pass vertex set possibly otherfor example tree set 3 2 5 1 5 4 1 4 passable 1 3 5 1 2 3 4 5 Polycarp ask answer q query each query set vertex for query need determine correspond set vertex passable
1graph
a triple point j k coordinate line call beautiful j k k le dYou give set point coordinate line initially you process query type add point remove point calculate number beautiful triple consist point belong set
1graph
there n worker m task the worker number 1 n each task value a_i index worker proficient taskevery task worker assign if worker proficient task complete 1 hour otherwise take 2 hoursthe worker work parallel independently each worker work task onceassign worker task way task complete early possible the work start time 0 what s minimum time task complete
2string
there field size 2 time 2 each cell field contain grass the value a_i j 1 cell j contain grass 0 otherwiseIn choose row column cut grass row column in word choose row x column y cut grass cell a_x cell a_i y 1 2 after cut grass cell ie value replace 0your task find minimum number move require cut grass nonempty cell field ie a_i j zerosYou answer t independent test case
2string
you give table size n time m we consider table row number 1 n column number leave right 1 m we denote cell ith row jth column j in cell j write number 1 cdot m j a_ij 1 cdot m jA turtle initially stand cell 1 1 wants come cell n m from cell j step cell 1 j j 1 exist a path sequence cell adjacent sequence cell follow satisfie turtle reach cell second cell step a cost path sum number write cell path for example n 2 m 3 table look show the turtle follow path 1 1 rightarrow 1 2 rightarrow 1 3 rightarrow 2 3 the cost way equal a_11 a_12 a_13 a_23 12 on hand path 1 1 rightarrow 1 2 rightarrow 2 2 rightarrow 2 1 1 1 rightarrow 1 3 incorrect path turtle can not step 2 2 rightarrow 2 1 second path can not step 1 1 rightarrow 1 3you ask tell turtle minimal possible cost path cell 1 1 cell n m please note cell 1 1 n m way
1graph
there n pile sand ith pile a_i block sand the ith pile call tall 1 n a_i a_i1 a_i1 that pile tall sand neighbour combine note pile end array tallYou give integer k an operation consist pick k consecutive pile sand add unit sand Formally pick 1 leq lr leq n rl1k then l leq leq r update a_i get a_i1what maximum number pile simultaneously tall possibly zero operation
1graph
you give string s t length n each character string b cIn perform follow action choose occurrence ab s replace ba choose occurrence bc s replace cb you allow perform arbitrary move possibly zero can change string s equal string t
1graph
the store sell n item price ith item p_i the store management go hold promotion customer purchase x item y cheap freethe management decide exact value x y therefore ask process q query give value x y determine maximum total value item receive free customer make purchasenote query independent do not affect store stock
1graph
Mike Joe play game stone specifically n pile stone size a_1 a_2 ldot a_n these pile arrange circlethe game go follow Players turn remove positive number stone pile clockwise order start pile 1 Formally player remove stone pile turn player remove stone pile ibmod n 1 turnif player remove stone turn pile lose Mike go firstIf Mike Joe play optimally win
1graph
give array positive integer length n determine exist distinct index j k a_i a_j a_k end digit 3
0array
you give n color segment number line each segment color red blue the ith segment represent tuple c_i l_i r_i the segment contain point range l_i r_i inclusive color denote c_i c_i 0 red segment c_i 1 blue segment we segment different color connect share common point two segment belong group connect directly sequence directly connect segment find number group segment
2string
Polycarp find stre s permutation p their length turn equal na permutation n element array length n integer 1 n occur exactly for example 1 2 3 4 3 5 1 2 permutation 1 2 4 4 3 2 1 2 0 1 2 notin operation multiply s p replace s stre new 1 n true new_i s_p_i for example swmbe p 3 1 4 2 operation string turn ss_3 s_1 s_4 s_2bwempolycarp wonder operation string equal initial value time since long ask help matterit prove require number operation exist it large use 64bit integer type
1graph
recently Polycarp complete n successive tasksFor complete task time s_i know give task give time also give time f_i task complete for task unknown value d_i d_i0 duration task executionIt know task complete order come Polycarp perform task follow as soon task come Polycarp immediately begin carry if new task arrive Polycarp finish previous new task end queue when Polycarp finish execute task queue immediately take new task head queue queue wait task Find d_i duration task
1graph
Bit Lightyear andfinity beyondafter graduate computer science Vlad award array a_1a_2ldotsa_n n nonnegative integer as natural want construct graph consist n vertex number 1 2ldots n he decide add edge j a_i a_j 0 denote bitwise and operationvlad want graph connect case initially in order satisfy follow type operation array choose element a_i increment 1 Choose element a_i decrement 1 possible a_i 0 it prove exist finite sequence operation graph connect so help Vlad find minimum possible number operation provide way
2string
lena beautiful girl like logical puzzlesas gift birthday Lena get matrix puzzlethe matrix consist n row m column cell black white the coordinate ij denote cell belong ith row jth column 1leq leq n 1leq j leq m to solve puzzle Lena choose cell minimize Manhattan distance farth black cell choose cellmore formally let k ge 1 black cell matrix coordinate x_iy_i 1leq leq k Lena choose cell ab minimize max_i1kax_iby_iAs Lena skill ask help will tell optimal cell choose
1graph
as human erase history entirety as Bai Ze Hakutaku create history nothingnessPerfect Memento Strict SenseKeine ability manipulate history the history Gensokyo string s length 1 initially to fix chaos cause Yukari need follow operation n time ith time she choose nonempty substring t_2i1 s she replace t_2i1 nonempty string t_2i note length string t_2i1 t_2i differentnote t_2i1 occur s exactly replacedfor example let smarisa t_2i1a t_2iz after operation s mzrisa mariszAfter n operation Keine get final string operation sequence t length 2n just Keine think finished Yukari appear shuffle order t bad Keine forget initial history help Keine find initial history GensokyoRecall substre sequence consecutive character stre for example stre abc substrings ab c bc but follow string substre ac cba acbHacksYou hack problem
1graph
ran especially skilled computation mathematic it say unimaginable calculation work instantperfect Memento Strict SenseRan yakumo cute girl love create cute math problemslet fx minimal square number strictly great x gx maximal square number equal x for example f1f2g4g84A positive integer x cute xgxfxx for example 1511 cute integer 3815 Ran give array length n she wants find small nonnegative integer k a_i k cute number element
2string
as technology outside world advanced Gensokyo look toYasaka Kanako Symposium PostmysticismThis interactive problemunder direct supervision Kanako Moriya Shrine railway system Gensokyo finally finish GSKR Gensokyo Railways consist n station m bidirectional track connect the ith track length l_i 1le l_ile 106 due budget limit railway system connect track stationsthe value railway system define total length track the maximum minimum capacity railway system define maximum minimum value currently functional system span forestin brief span forest graph span forest connectivity give graphKanako simulator able process 2 m query the input simulator string s length m consist character 0 andor 1 the simulator assume ith track functional s_i 1 the device tell Kanako maximum capacity system simulate stateKanako wants know minimum capacity system track functional help simulatorThe structure railway system fix advance in word interactor adaptive
1graph
it turn exactly 100th problem appear programming competition so special and special problem LISYou give permutation p_1 p_2 ldot p_2n1 integer 1 2n1 you process q update ith update consist swap p_u_i p_v_iafter update find cyclic shift p LIS le n determine shift Refer output section detailshere LISa denote length long strictly increase subsequence ahack disabled problem do not ask
2string
this easy version problem the difference easy hard version version output permutation smallest weightyou give permutation p_1 p_2 ldot p_n integer 1 nlet define weight permutation q_1 q_2 ldot q_n integer 1 n q_1 p_q_2 q_2 p_q_3 ldot q_n1 p_q_n q_n p_q_1You want permutation lightweight possible find permutation q small possible weight
1graph
Alina discover weird language contain 4 word textttA textttB textttAB textttBA it turn space language sentence write concatenate word single stringAlina find sentence s curious possible consist precisely word texttta b word textttB c word textttAB d word textttbain word determine possible concatenate abcd word order result string s each abcd word exactly concatenation choose order concatenate
1graph
you give grid n row m column cell positive integer write Lets grid good row sequence number sort nondecrease order it mean 1 le le n 2 le j le m follow hold a_ij ge a_i j1You follow operation exactly choose column index j necessarily different 1 le j le m swap themyou ask determine possible grid good swap find column need swap
1graph
you give integer array b b_i neq 0 b_i leq 109 Array sort nondecrease orderthe cost subarray alr define followsIf sumlimits_j lr b_j neq 0 cost definedotherwise Construct bipartite flow graph rl1 vertex label l r vertex have b_i lt 0 left b_i gt 0 right for j l le j le r b_i0 b_j0 draw edge j infinite capacity cost unit flow a_ia_j add vertex source s sink t for l le le r b_i0 add edge S cost 0 capacity b_i for l le le r b_i0 add edge T cost 0 capacity b_i the cost subarray define minimum cost maximum flow S TYou give q query form integer l r you compute cost subarray alr query modulo 109 7If do not know minimum cost maximum flow mean read
2string
there n node arrange circle number 1 n clockwise order you give binary string s length nYour task construct tree give n node satisfy condition report tree exist for node 1 le le n degree node s_i 0 odd s_i 1 no edge tree intersect internally circle the edge allow intersect circumference note edge draw straight line segment for example edge u v tree draw line segment connect u v circleA tree n node connect graph n 1 edge
2string
you give integer number n x you perform operation integer xEach operation perform following choose digit y occur decimal representation x replace x x cdot yYou want length decimal representation x lead zero equal n what minimum number operation require
1graph
today holiday residence hall Oleh arrive honor girl give stre Oleh like gift lot immediately think offer good friend follow problemyou give stre s length n consist 17 lowercase Latin letter b c ldot p q question mark and q query each query define set pairwise distinct lowercase 17 letter latin alphabet replace question mark stre sThe answer query sum number distinct substring palindrome string obtain original string s replace question mark available character the answer calculate modulo 998244353pay attention two substring different start end position stre different so number different substring palindrome string aba 4 b abaconsider example replace question mark letter for example string abaee query b string ababaee abaaaee strings pizza abaee abacaba abafee aba47ee abatreerecall palindrome string read leave right right leave
1graph
this hard version problem the difference version hard version ask additionally minimum number subsegmentstokitsukaze binary string s length n consist zero one n evenNow Tokitsukaze divide s minimum number contiguous subsegment subsegment bit subsegment after s consider good length subsegment evenfor example s 11001111 divide 11 00 1111 their length 2 2 4 respectively number 11001111 good another example s 1110011000 divide 111 00 11 000 length 3 2 2 3 obviously 1110011000 goodtokitsukaze want s good change value position s specifically perform operation number time change value s_i 0 1 1 leq leq n can tell minimum number operation s good meanwhile wants know minimum number subsegment s divide solution minimum number operation
1graph
this easy version problem the difference version hard version ask additionally minimum number subsegmentstokitsukaze binary string s length n consist zero one n evenNow Tokitsukaze divide s minimum number contiguous subsegment subsegment bit subsegment after s consider good length subsegment evenfor example s 11001111 divide 11 00 1111 their length 2 2 4 respectively number 11001111 good another example s 1110011000 divide 111 00 11 000 length 3 2 2 3 obviously 1110011000 goodtokitsukaze want s good change value position s specifically perform operation number time change value s_i 0 11 leq leq n can tell minimum number operation s good
1graph
you give n word equal length m consist lowercase latin alphabet letter the ith word denote s_iIn choose position single word change letter position previous letter alphabetical order for example change e d f change b z change y the difference word minimum number move require equal for example difference well cost 1 10 0 0 11find minimum difference s_i s_j j in word find minimum difference possible pair n word
1graph
monocarp play Rage Empires II Definitive Edition strategic computer game right he s planning attack opponent game Monocarps force enter opponent territory opponent build wallthe wall consist n section align row the ith section initially durability a_i if durability section 0 section consider brokenTo attack opponent Monocarp need break section wall section possibly adjacent possibly to plan use onag special siege weapon the onag shoot section wall shoot deal 2 damage target section 1 damage adjacent section in word onager shoot section x durability section x decrease 2 durability section x 1 x 1 exist decrease 1 Monocarp shoot section number times shoot break sectionsmonocarp wants calculate minimum number onager shot need break section help
0array
long ago think finite arithmetic progression A b then find sequence c contain element common a b it hard c finite arithmetic progression after year forget a remember b c you reason determine find lose arithmetic progression before begin eternal search want know different finite arithmetic progression exist lose progression a two arithmetic progression consider different differ term common difference number termsit possible infinitely progression case will not try look print 1 case even finite number answer large so interested find answer modulo 1097
2string
there grid r row c column square ith row jth column integer a_i j write Initially element set 0 we allow follow operation Choose index 1 le le r 1 le j le c replace value row column j value xor 1 in word a_x y xi yj replace a_x y a_x y xor 1 you want form grid b operation finite number time however element b miss replace insteadLet k number character among 2k way fill grid b replace 0 1 count number grid form operation finite number time start grid fill 0 as number large output modulo 998244353
1graph
this interactive problemthere n word text editor the ith word length l_i 1 leq l_i leq 2000 the array l hide know grader the text editor display word line split word line space note line end space let height text editor refer number line for give width text editor display word way height minimizedmore formally suppose text editor width w Let array length k1 1a_1 a_2 ldot a_k1n1 valid array 1 leq leq k l_a_i1l_a_i11ldots1l_a_i11 leq w then height text editor minimum k valid arraysNote w maxl_i text editor display word properly crash height text editor 0 insteadyou ask n30 query in query provide width w then grader return height h_w text editor width wFind minimum area text editor minimum value w cdot h_w w h_w neq 0the length fix advance in word interactor adaptive
1graph
let stre good length 2 character texttta character textttB the good string textttabtextttaabtextttaaabldot Note textttB good stringyou give initially string s_1You perform follow operation number time Choose position s_1 insert good string position give stre s_2 turn s_1 s_2 number operation
2string
there n log ith log length a_i meter since chop log tiring work errorgorn maomao90 decide play gameerrorgorn maomao90 turns chop log errorgorn chop on turn player pick log chop 2 piece if length choose log x length result piece y z y z positive integer xyz hold for example chop log length 3 log length 2 1 log length 3 0 2 2 15 15the player unable chop loser assume errorgorn maomao90 play optimally winner
1graph
Turbulent time come decide buy sugar advance there n shop sell sugar ith shop sell pack sugar a_i coin pack customer day so order buy pack need visit shopsanother problem price increase day day cost a_i second day cost a_i 1 day a_i 2 shop ion contrary everyday budget x coin in word day buy pack possible total cost exceeding x note do not spend coin day can not use coin dayseventually cost pack exceed x will not able buy single pack so pack able buy till moment total
1graph
Sehr Sus infinite hexagonal grid picture control MennaFadali ZerooCool HosssamThey love equilateral triangle want create n equilateral triangle grid add straight line the triangle inside word straight line hexagon edge pass trianglesyou allow add straight line parallel edge hexagon give n minimum number line need add create n equilateral triangle describe add red line result new yellow equilateral triangle
2string
Hosssam decide sneak Hemoses room sleep change laptop password he know password string s length n he know k special letter alphabet c_1c_2ldot c_khosssam program follow the program consider current password s length m then find position 1le I m s_i1 k special letter then delete position password s s_i special character if position delete program display error message loud sound for example suppose string s abcdef special character b d if run program position 1 3 delete come special character password bdef if run program delete position 1 password def if wise will not run timeHosssam want know time run program hemose laptop wake sound error message can help
1graph
there n candy leave right table the candy number left right the ith candy weight w_i Alice Bob eat candy Alice eat number candy leave can not skip candy eats row Bob eat number candy right can not skip candy eat row of course Alice eat candy Bob can not eat vice versaThey want fair their goal eat total weight candy what number candy eat total
2string
a row n cell give initially white use stamp stamp neighboring cell red blue a stamp rotate ie way colorbluetextttbcolorredtextttr colorredtextttrcolorbluetextttbdure use stamp completely fit give n cell partially outside cell the stamp apply multiple time cell each usage stamp recolor cell stampfor example possible sequence stamp picture colorbluetextttBcolorredtextttRcolorbluetextttBcolorbluetextttBtextttW textttWWWWW textttWWcolorbrownunderlinecolorredtextttRcolorbluetextttBtextttW colorbrownunderlinecolorbluetextttbcolorredtextttrcolorredtextttrcolorbluetextttbtextttw colorbluetextttbcolorbrownunderlinecolorredtextttrcolorbluetextttbcolorbluetextttbtextttw here textttW colorredtextttr colorbluetextttB represent white red blue cell respectively cell stamp mark underlinegiven final picture possible stamp zero time
1graph
give array n element print value appear time print 1 value
1graph
you give board n row n column number 1 n the intersection ath row bth column denote ba halfqueen attack cell row column diagonal more formally halfqueen b attack cell c d ac bd abcd the blue cell attack what minimum number halfqueen place board ensure square attack halfqueenConstruct optimal solution
1graph
Leslie Leon enter labyrinth the labyrinth consist n hall m oneway passage betweenthem the hall number 1 nLeslie Leon start journey hall s right away quarrel decide explore thelabyrinth separately however want meet end journeyTo help Leslie Leon task find different path give hall s hall t path share hall stare hall s end hall t Thehallt determine choose labyrinth hall t sLeslies Leons path short one path simple visit hall also visit common hall s t journey different time
2string
Julias n friend want organize startup new country move they assign number 1 n accord job frontend task backend one they estimate matrix c c_ij c_ji average number message month people job jNow want hierarchy tree it binary tree node contain member team some member select leader team contain root node in order leader able easily reach subordinate node v tree follow apply member leave subtree small number v member right subtree large number vAfter hierarchy tree settle people job j communicate short path tree nod Lets denote length path d_ij thus cost communication c_ij cdot d_ijyour task find hierarchy tree minimize total cost communication pair sum_1 le j le n c_ij cdot d_ij
2string
Daisy love play game word recently play follow Deletive Editing word game Daniel Daisy pick word example DETERMINED on game turn Daniel call letter example E Daisy remove occurrence letter word get DTERMINED on turn Daniel call letter example D Daisy remove occurrence get TERMINED they continue I get TERMNED N get TERMED d get TERME now Daniel call letter E Daisy get TRME way word TERM start play word DETERMINEDDaisy curious final word choice start give initial word play game zero turn your task help figure
1graph

Dataset Card for "CPTDS-3"

  1. CPTDS-3 dataset is made up of coding problem questions from multiple coding websites.
  2. The 'DS' in the name stands for data structures and the '3' indicates that the questions belong to 3 mutually exclusive categories
  3. The dataset was prepared for the research work names Stacking of Hyperparameter Tuned Models for Tagging Coding Problems

Languages

The dataset consists of questions only in English

Dataset Structure

Data Instances

For each instance, there is a string for the question, a string for the class label.

{'question': 'Andrew love sea that s height summer season decide beach take sunbe sunbatheThe beach rectangular field n row m column some cell beach free road stone shop nonmovable object some adjacent cell sunbed locate horizontally verticallyAndrew hope sunbe that s bad luck long free place that s Andrew ask help find free place sunbe Andrews sunbe place adjacent cell if adjacent free cell order free place sunbe disturb tourist you follow action come sunbe cause p unit discomfort owner lift sunbe side rotate 90 degree one half sunbe remain cell half sunbe free cell at time way sunbe rotation Rotation sunbe 90 degree cell 1 2 come sunbe cause q unit discomfort owner shift sunbe long cell one half sunbe place free cell Shift sunbe cell right in moment sunbe occupie adjacent free cell you sunbe timehelp Andrew free space sunbe cause minimum possible number unit discomfort tourist detect impossible',
 'label': 1}

The average token count for the articles and the highlights are provided below:

Feature Mean Token Count
Question 94.02

Data Fields

  • question: a string containing the question of the coding problem
  • label : a string containing the tag of the question

Data Splits

The CPTDS-3 dataset has just 1 split: train. Below is the statistics for the dataset.

Dataset Split Number of Instances in Split
Train 3012

More Information needed

Downloads last month
37
Edit dataset card

Models trained or fine-tuned on SkAndMl/CPTDS-3