instruction_seed stringlengths 43 8.03k | source stringclasses 1
value | embeddings listlengths 1.02k 1.02k | mean_positive_score float64 0.73 0.85 | mean_negative_score float64 0.71 0.82 | difference_score float64 0.01 0.07 |
|---|---|---|---|---|---|
You are tasked with creating a program that generates the third row of a Pascal array A081580. The array is defined as follows:
- The first row contains the number 1
- Each subsequent row is generated by taking the previous row, inserting a 0 at the beginning and at the end, and then summing each pair of consecutive nu... | glaive | [
0.03509727865457535,
0.026472438126802444,
-0.019375992938876152,
-0.04364253580570221,
0.025883009657263756,
-0.026966707780957222,
-0.01822545938193798,
0.08121746778488159,
0.034024715423583984,
-0.0010370422387495637,
0.026083145290613174,
0.02877209335565567,
-0.041997335851192474,
-0... | 0.816839 | 0.776247 | 0.040592 |
Can you help me write a function that checks if a given list of integers contains a number that is smaller than the one that precedes it? | glaive | [
0.0016761249862611294,
0.018536362797021866,
-0.02331867627799511,
-0.03977620601654053,
0.0401775985956192,
-0.03164321184158325,
-0.01979522779583931,
0.05781399458646774,
0.03933391347527504,
-0.023870088160037994,
0.010933940298855305,
0.023072341457009315,
-0.03846529871225357,
-0.025... | 0.815011 | 0.800505 | 0.014506 |
You are tasked with implementing a function in F# that takes two input parameters and returns the sum of the two numbers. The function should be named "add" and should take two parameters of type bigint. You need to implement the function using the provided F# code snippet as a reference. | glaive | [
0.009316585026681423,
0.03184619918465614,
-0.023129943758249283,
-0.047576822340488434,
0.04382552206516266,
-0.010804868303239346,
-0.00010704184387577698,
0.0632876306772232,
0.03911164775490761,
0.01281367801129818,
0.016711287200450897,
0.05105087161064148,
-0.03422105312347412,
-0.01... | 0.80055 | 0.78085 | 0.0197 |
You are given a quantum computing algorithm that calculates the probability of a certain outcome for a given set of parameters. The algorithm uses the functions `amplitude[x_,y_]`, `amplitude2[x_,y_]`, and `probability[x_, y_]` to perform the calculations. The goal is to find the maximum probability for a certain numbe... | glaive | [
-0.0008807727135717869,
0.032743774354457855,
-0.031064491719007492,
-0.014236914925277233,
0.03646078705787659,
-0.021966924890875816,
-0.022177940234541893,
0.06410372257232666,
0.04179385304450989,
-0.0011066090082749724,
0.022322693839669228,
0.03359002619981766,
-0.0068585253320634365,
... | 0.80373 | 0.775321 | 0.028409 |
You are tasked with implementing a K-nearest neighbor (KNN) kernel in CUDA for image processing. The KNN algorithm involves finding the K-nearest neighbors of a given data point and using their values to make predictions or perform other computations. In this case, you will be implementing a parallelized KNN algorithm ... | glaive | [
-0.015300613828003407,
0.05147184804081917,
-0.018019355833530426,
-0.014986131340265274,
0.02388584241271019,
0.004612457938492298,
-0.021163564175367355,
0.08163268864154816,
0.04022256284952164,
-0.007363978773355484,
0.03854389488697052,
0.019932331517338753,
-0.00039748099516145885,
0... | 0.789999 | 0.769507 | 0.020492 |
Is there a way to create an algorithm that can count the most frequent item in an array? | glaive | [
0.020436787977814674,
0.022822394967079163,
-0.04279102012515068,
-0.016837233677506447,
0.03661806508898735,
-0.03676934540271759,
-0.040279876440763474,
0.06298786401748657,
0.010186130180954933,
-0.03702983632683754,
0.018765348941087723,
0.012804411351680756,
-0.014240455813705921,
-0.... | 0.798273 | 0.772146 | 0.026127 |
You are tasked with implementing a function to calculate the number of square inches of fabric that are within two or more claims and to find the ID of the only claim that doesn't overlap with any others.
You are given a list of strings, each representing a claim in the format "#ID @ X,Y: WxH". The ID is a unique inte... | glaive | [
0.008956609293818474,
0.03586302697658539,
-0.03468305245041847,
-0.03914794325828552,
0.0394783616065979,
-0.01506488211452961,
-0.031543705612421036,
0.06847996264696121,
0.025968320667743683,
0.00005928551763645373,
0.027946066111326218,
0.04456111416220665,
-0.028185585513710976,
-0.01... | 0.825283 | 0.796162 | 0.029121 |
You are tasked with implementing a function to perform a ray/AABB intersection check. You are given the following information:
- The ray is defined by its origin and direction.
- The AABB (Axis-Aligned Bounding Box) is defined by its minimum and maximum points in 3D space.
Your task is to implement the RayAABBInterse... | glaive | [
0.04661506786942482,
0.026538124307990074,
-0.008529499173164368,
-0.0219550970941782,
0.038055259734392166,
-0.01355022843927145,
-0.02587345987558365,
0.08222121000289917,
0.05217685177922249,
-0.0001464611996198073,
0.01616702415049076,
0.015604856424033642,
-0.014145281165838242,
-0.02... | 0.808996 | 0.788327 | 0.020668 |
You are tasked with implementing a function `max_pool2d_argmax` for a neural network library. This function takes in the following parameters:
- An input 4D array `input` of shape `(batch_size, channels, height, width)`
- An integer array `kernel_size` of length 2, representing the size of the pooling kernel
- An integ... | glaive | [
0.027065016329288483,
0.033078160136938095,
-0.022778740152716637,
-0.013020910322666168,
0.02861551195383072,
-0.026861758902668953,
-0.043178360909223557,
0.04781845211982727,
0.039785079658031464,
-0.00594031997025013,
0.035803668200969696,
0.030277308076620102,
-0.027799034491181374,
-... | 0.81198 | 0.78059 | 0.03139 |
You are tasked with implementing a GPU-based random number generator using the random123 library in C/C++. The goal is to create a set of functions that will allow the generation of random numbers, setting global indices, creating and deleting streams, and getting sequence IDs and random numbers. The functions should b... | glaive | [
0.024032317101955414,
0.03745349124073982,
-0.014469921588897705,
-0.038125261664390564,
0.02567128837108612,
-0.026629619300365448,
-0.04787236452102661,
0.09042586386203766,
0.029203565791249275,
-0.01612730696797371,
0.021413883194327354,
0.03512020409107208,
-0.01309301145374775,
0.006... | 0.796939 | 0.781442 | 0.015497 |
You are required to implement a CUDA kernel function for the Soft Dice Loss in PyTorch. The Soft Dice Loss is a common loss function used in deep learning for image segmentation tasks. The loss is defined as 1 - (2 * intersection) / (sum of squares of prediction and target).
Your task is to write a CUDA kernel functi... | glaive | [
-0.013095743022859097,
0.04902387782931328,
-0.03923475369811058,
-0.02740197256207466,
0.03011094033718109,
-0.010821936652064323,
-0.03139186650514603,
0.06681954860687256,
0.03698747232556343,
-0.019269000738859177,
0.03188824653625488,
0.024807550013065338,
-0.015661541372537613,
0.008... | 0.804464 | 0.790009 | 0.014455 |
You are tasked with creating a program that retrieves the number of triples for a VOID Dataset description. The program should query a dataset that contains information about the number of triples and return this value. | glaive | [
0.015825020149350166,
0.007198309991508722,
-0.03804833069443703,
-0.04610302299261093,
0.04462064802646637,
-0.01879550889134407,
-0.02654395066201687,
0.059887152165174484,
0.029606763273477554,
-0.011310518719255924,
0.03332700580358505,
0.028224332258105278,
-0.013540410436689854,
-0.0... | 0.79305 | 0.778005 | 0.015046 |
You are tasked with implementing a function that performs arithmetic and logical operations for the RISC-V architecture. The function should take in an instruction, two register values, an optional immediate value, and the program counter, and return the result of the operation. The function must support both 32-bit an... | glaive | [
0.043032776564359665,
0.03617356717586517,
-0.008157053031027317,
-0.024671731516718864,
0.018836265429854393,
-0.012530414387583733,
-0.03963732719421387,
0.08975370973348618,
0.04509730264544487,
-0.012757616117596626,
0.011367568746209145,
0.03574047610163689,
-0.007068553473800421,
-0.... | 0.802378 | 0.77886 | 0.023519 |
You are tasked with analyzing transition rates for a dataset containing information on individuals' employment and self-employment status over a period of several years. The dataset includes the following variables: idperson (unique identifier for each individual), year (the year of observation), and occhead (indicator... | glaive | [
0.006938017904758453,
0.02568173035979271,
-0.03753678873181343,
-0.02879723161458969,
0.04707290604710579,
-0.020142925903201103,
-0.0217879731208086,
0.07504840195178986,
0.04834667220711708,
0.00926913134753704,
0.03900991007685661,
-0.03303562477231026,
-0.03599818795919418,
0.01514058... | 0.773431 | 0.754676 | 0.018755 |
You are tasked with implementing a parallel sum reduction using shared memory. This reduction should take log(n) steps for n input elements and should only work for power-of-2 arrays. The code should use CUDA and should be able to handle multiple elements per thread sequentially. Your task is to implement the reduction... | glaive | [
0.0030658128671348095,
0.039534687995910645,
-0.03307025879621506,
-0.03488323837518692,
0.031615499407052994,
0.002849708078429103,
-0.03010198101401329,
0.08275050669908524,
0.054640259593725204,
-0.022233368828892708,
0.015014003962278366,
0.023278985172510147,
-0.004967257380485535,
-0... | 0.814265 | 0.79296 | 0.021305 |
I need to create a program that processes a given set of numbers and performs certain operations on them. The input consists of a list of numbers, and I need to calculate the sum of all the even numbers in the list and the product of all the odd numbers in the list. Additionally, I need to find the maximum and minimum ... | glaive | [
0.037033114582300186,
0.008357757702469826,
-0.05241275951266289,
-0.030146561563014984,
0.0449991375207901,
-0.02045455388724804,
-0.026819709688425064,
0.05483679100871086,
0.03869388997554779,
-0.019532790407538414,
0.014081750996410847,
0.04940915107727051,
-0.04260028526186943,
-0.038... | 0.821012 | 0.787257 | 0.033755 |
Is there a more efficient way to estimate the unknown variables in a specific game without resorting to brute force? Does machine learning offer a solution? The game I'm referring to follows these rules:
- A user is given fruit prices and can buy or sell items in their fruit basket each turn.
- The user cannot change ... | glaive | [
0.008618464693427086,
0.03519019857048988,
-0.050953757017850876,
-0.01184692420065403,
0.03173231706023216,
-0.024771172553300858,
-0.020916059613227844,
0.06051723659038544,
0.033324696123600006,
-0.038725320249795914,
0.0044639804400503635,
0.02187090367078781,
-0.013780531473457813,
0.... | 0.813135 | 0.794488 | 0.018647 |
Rail Fence Cipher is a transposition cipher that encrypts and decrypts a message by rearranging the characters in a zigzag pattern.
You need to implement a function encrypt-message that takes a message and a key as input and applies the Rail Fence Cipher encryption. The message consists of only word characters and bl... | glaive | [
0.04190712794661522,
0.04543955251574516,
0.008168208412826061,
-0.03900079056620598,
0.03718629479408264,
-0.049480173736810684,
-0.016447756439447403,
0.0659627616405487,
0.021040746942162514,
-0.009700960479676723,
0.03467629849910736,
-0.00557968532666564,
-0.02203201875090599,
-0.0112... | 0.798695 | 0.783318 | 0.015377 |
You are tasked with creating a program that utilizes a set of utility functions to perform operations on mathematical expressions. The program should be able to parse and evaluate the expressions, as well as simplify and manipulate them based on specific keywords. The expressions may contain variables, constants, and m... | glaive | [
0.04725104197859764,
0.024348536506295204,
-0.04708154499530792,
-0.036864928901195526,
0.05674642696976662,
-0.021441003307700157,
-0.02658221870660782,
0.06521134823560715,
0.052761320024728775,
-0.0058979131281375885,
0.0066045536659657955,
0.026984233409166336,
-0.013756649568676949,
-... | 0.789333 | 0.772716 | 0.016618 |
Can you suggest an algorithm to calculate the shortest path between two vertices in a graph? | glaive | [
0.006085135042667389,
0.020743293687701225,
-0.021135838702321053,
-0.022693460807204247,
0.015686633065342903,
-0.03555542975664139,
-0.02786565199494362,
0.023193523287773132,
0.041520632803440094,
-0.03968067094683647,
0.03145939111709595,
0.01431143470108509,
0.0005274996510706842,
-0.... | 0.784682 | 0.76436 | 0.020322 |
You are tasked with implementing a program that calculates the PageRank of a graph using CUDA and nvGraph. PageRank is a link analysis algorithm used to rank web pages in search engine results. The given code snippet provides a template for running the PageRank algorithm on a graph using various CUDA and nvGraph functi... | glaive | [
0.01932397484779358,
0.02948823757469654,
-0.018324818462133408,
-0.018106305971741676,
0.02075301855802536,
-0.010199961252510548,
-0.018640896305441856,
0.06629565358161926,
0.02435114234685898,
-0.013089369051158428,
0.015389767475426197,
0.02847352810204029,
-0.016283990815281868,
0.00... | 0.814182 | 0.793008 | 0.021175 |
You are tasked with creating a Python module that generates a sequence of characters based on a given input. The input will be a string and the output should be a sequence of characters that follows a specific pattern based on the input string. The pattern should be defined as follows:
- If the input string contains on... | glaive | [
0.012825670652091503,
0.03075203113257885,
-0.002807473763823509,
-0.02654213458299637,
0.03592774644494057,
-0.028198618441820145,
-0.026644889265298843,
0.054569490253925323,
0.008132330141961575,
-0.021043088287115097,
0.019732894375920296,
0.03128908947110176,
-0.033864956349134445,
0.... | 0.801326 | 0.781323 | 0.020003 |
You are tasked with writing a program to count the occurrences of each unique number in a given list of integers. Your program should take in the list of integers and output a dictionary or hash map with the count of each unique number.
For example, if the input list is [6, 0, 3, 0, 8, 9, 6, 6, 3, 0, 2, 6, 0, 2, 2, 2,... | glaive | [
0.023912856355309486,
0.01823323592543602,
-0.033732444047927856,
-0.025942480191588402,
0.03614620864391327,
-0.017540954053401947,
-0.02454279363155365,
0.04337933287024498,
0.03823430463671684,
-0.02509281411767006,
0.002877210732549429,
0.017582716420292854,
-0.021795708686113358,
-0.0... | 0.820829 | 0.761934 | 0.058895 |
You are tasked with creating a Java program that reverses an array of integers. The program should take an input array of integers and output a new array with the elements in reverse order.
Write a Java class called Turn with a method called back that takes an array of integers as a parameter and returns a new array ... | glaive | [
0.025725869461894035,
0.023947952315211296,
-0.02959713339805603,
-0.013480985537171364,
0.029689889401197433,
-0.036566346883773804,
-0.021903732791543007,
0.048308830708265305,
0.033940233290195465,
-0.021724727004766464,
0.02077343501150608,
0.022523310035467148,
-0.049459949135780334,
... | 0.804603 | 0.781247 | 0.023356 |
I am trying to implement a function to calculate the outer measure of a set using the concept of Caratheodory measurable space. The outer measure is a concept in measure theory that generalizes the idea of length, area, or volume. The Caratheodory measurable space is defined based on the concept of Caratheodory measure... | glaive | [
0.015313994139432907,
0.03146035596728325,
-0.046957116574048996,
-0.03431893140077591,
0.0565858893096447,
-0.017701968550682068,
-0.05402689799666405,
0.07005336880683899,
0.0478762686252594,
0.00006558796303579584,
0.00390797620639205,
0.030757075175642967,
-0.043485261499881744,
-0.013... | 0.788576 | 0.76899 | 0.019586 |
You are tasked with implementing a simple ray tracing algorithm in GLSL (OpenGL Shading Language) to render a scene with spheres. You need to define the necessary structures, functions, and shaders to cast rays and calculate the intersections with the spheres in the scene. Additionally, you must implement the illuminat... | glaive | [
0.007904085330665112,
0.04100456461310387,
-0.017608532682061195,
-0.02361959032714367,
0.02995525859296322,
-0.02893136441707611,
-0.04466824233531952,
0.06771479547023773,
0.037211835384368896,
-0.026821643114089966,
0.028284016996622086,
0.03454114869236946,
-0.003151860786601901,
0.004... | 0.780696 | 0.7612 | 0.019496 |
I want to write a Python program that prints a reversed numeric pattern. Can you help me with that? Here's the pattern I want to achieve:
4 3 2 1
3 2 1
2 1
1 | glaive | [
0.006434416864067316,
0.032273489981889725,
-0.02268292009830475,
-0.031760409474372864,
0.037676818668842316,
-0.027666687965393066,
-0.013673054985702038,
0.04154876247048378,
0.03196218982338905,
0.011276460252702236,
0.019138021394610405,
0.03121768869459629,
-0.03983389213681221,
-0.0... | 0.803526 | 0.788249 | 0.015277 |
You are tasked with implementing a function that calculates the burst nearest neighbor field (Nnf) using the L2 norm for a given set of input tensors. The function signature is as follows:
```cpp
template <typename T>
void runBurstNnfL2Norm(Tensor<T, 4, true>& burst,
Tensor<T, 4, true> fflow,
... | glaive | [
0.011249403469264507,
0.036659300327301025,
-0.035913772881031036,
-0.01892235316336155,
0.02936583012342453,
-0.013022440485656261,
-0.03225892037153244,
0.07478537410497665,
0.0419665202498436,
-0.00858375709503889,
0.01957612857222557,
0.02631639689207077,
-0.011186874471604824,
-0.0040... | 0.815557 | 0.793808 | 0.021749 |
How can I write a program that sorts an array of integers from smallest to largest? | glaive | [
0.01877167820930481,
0.025928184390068054,
-0.030233753845095634,
-0.03244464471936226,
0.02689496800303459,
-0.02847415767610073,
-0.020343013107776642,
0.03682392090559006,
0.03049003705382347,
-0.03998008742928505,
0.02799568884074688,
0.03290368989109993,
-0.05371836572885513,
-0.02086... | 0.800809 | 0.780298 | 0.020512 |
You are tasked with implementing the Tarai function in Prolog. The Tarai function is a recursive mathematical function that takes three arguments (X, Y, and Z) and returns a value based on certain conditions:
- If X <= Y, the function returns Y.
- If X > Y, the function returns the result of recursively calling the Tar... | glaive | [
0.04246453568339348,
0.05027732253074646,
-0.004653452895581722,
-0.04631546139717102,
0.03260183334350586,
-0.0219204630702734,
-0.005962667055428028,
0.05328004062175751,
0.021649839356541634,
-0.0019348994828760624,
0.021701088175177574,
0.036156103014945984,
-0.034407537430524826,
0.00... | 0.805484 | 0.777932 | 0.027551 |
You are tasked with writing a CUDA kernel function that takes in an array of floating-point numbers and modifies each element according to the following rule: if the element is greater than 0, it should be replaced with 2.0f; otherwise, it should be replaced with -1.0f. The length of the array is also provided as input... | glaive | [
-0.00259554386138916,
0.04457209259271622,
-0.0135617321357131,
-0.022021567448973656,
0.027638321742415428,
-0.03082800842821598,
-0.028287438675761223,
0.08151807636022568,
0.03365857154130936,
-0.016343554481863976,
0.027439918369054794,
0.029008978977799416,
-0.02475084736943245,
0.008... | 0.808864 | 0.794056 | 0.014807 |
I need to create a function in Python that calculates the nth Fibonacci number. The function should take an integer n as input and return the nth Fibonacci number. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. | glaive | [
0.02304568886756897,
0.021283505484461784,
-0.0375654436647892,
-0.02831093594431877,
0.0451057069003582,
-0.029446367174386978,
-0.034158024936914444,
0.04360581189393997,
0.020646261051297188,
0.005274587776511908,
0.023054741322994232,
0.028413882479071617,
-0.05015891417860985,
-0.0213... | 0.802305 | 0.774978 | 0.027327 |
I need to find the greatest common divisor (GCD) of 12 and 18. Can anyone provide a code solution using the Euclidean Algorithm? | glaive | [
0.01135915145277977,
0.023578105494379997,
-0.012955468147993088,
-0.0554325170814991,
0.027974268421530724,
-0.024346163496375084,
-0.019872866570949554,
0.05369680002331734,
0.019422901794314384,
-0.034042101353406906,
0.023653337731957436,
0.025437908247113228,
-0.024147531017661095,
-0... | 0.810349 | 0.7864 | 0.023949 |
You have a dataset containing information about movies, including their runtime in minutes. Your task is to create a customized histogram to visualize the distribution of movie runtimes. The histogram should have 20 bins, a title of "Distribution of Runtime", and a label on the x-axis as "Runtime [-]". The x-axis shoul... | glaive | [
0.008168601430952549,
-0.014104761183261871,
-0.0596475675702095,
-0.011087419465184212,
0.02733415737748146,
-0.02206767164170742,
-0.04578278213739395,
0.0733553022146225,
0.0553957000374794,
-0.015366407111287117,
0.020030247047543526,
0.009670822881162167,
-0.019987596198916435,
0.0169... | 0.78236 | 0.768037 | 0.014323 |
You are asked to implement a vertex struct for a task graph defined as an adjacency list. The vertex should have the following features:
1. A constructor that takes a boolean indicating whether the vertex is a top-level one, a vertex_data object, and a vector of indices of the children in the adjacency list.
2. Method... | glaive | [
0.020879162475466728,
0.021924886852502823,
-0.017086075618863106,
-0.01594257913529873,
0.02062796801328659,
-0.01978142373263836,
-0.014734775759279728,
0.08390146493911743,
0.0413668230175972,
-0.0032005931716412306,
0.030469300225377083,
0.03667202219367027,
0.0014382402878254652,
-0.0... | 0.805796 | 0.78856 | 0.017236 |
You are tasked with creating a Python function that takes in a list of numbers and returns the sum of all the even numbers in the list.
Write a Python function called `sum_even_numbers` that takes in a list of integers and returns the sum of all the even numbers in the list.
For example:
Input: [1, 2, 3, 4, 5, 6]
Out... | glaive | [
0.02150123007595539,
0.01814996264874935,
-0.03982190787792206,
-0.058544814586639404,
0.050076354295015335,
-0.020637307316064835,
-0.017608288675546646,
0.03063363768160343,
0.02707587368786335,
-0.009273990988731384,
0.008838566951453686,
0.052112359553575516,
-0.042740341275930405,
-0.... | 0.799623 | 0.760741 | 0.038883 |
Can anyone help me write a function that counts the number of pairs in an array whose sum is equal to a given integer? | glaive | [
0.0016891505802050233,
0.02513008378446102,
-0.04380147159099579,
-0.020963191986083984,
0.04479898884892464,
-0.01751817762851715,
-0.03166980296373367,
0.044893912971019745,
0.020334629341959953,
-0.023488616570830345,
0.014591468498110771,
0.027795931324362755,
-0.03409559652209282,
-0.... | 0.816853 | 0.792621 | 0.024233 |
You are tasked with implementing a non-maximum suppression (NMS) algorithm in CUDA using the PyTorch framework. The NMS algorithm is used to filter out overlapping bounding boxes or regions of interest in object detection tasks. The provided code snippet includes CUDA kernel functions for 2D and 3D NMS, as well as a CP... | glaive | [
-0.004059831146150827,
0.03428453579545021,
-0.031577933579683304,
-0.01292354054749012,
0.029864512383937836,
-0.016822300851345062,
-0.03126735985279083,
0.06517098098993301,
0.03976617380976677,
-0.019944412633776665,
0.02595379203557968,
0.011977034620940685,
-0.008429478853940964,
0.0... | 0.805874 | 0.78918 | 0.016693 |
You are tasked with creating a program that draws a small circle with a specified diameter at the coordinates (50, 50) on a graphical user interface. The program should utilize the relevant constants and ensure that the circle is accurately positioned and sized as per the given specifications. | glaive | [
-0.012200511991977692,
0.04159069061279297,
-0.030303893610835075,
-0.027670664712786674,
0.04104263335466385,
-0.02780526503920555,
-0.021815398707985878,
0.04365985840559006,
0.046807751059532166,
-0.026656536385416985,
0.03914058208465576,
0.03817879036068916,
0.0005117667024023831,
0.0... | 0.789731 | 0.774374 | 0.015357 |
You are required to implement a data structure for a Union-Find with Rollback. The data structure should support the following operations:
1. `union_find_rollback(int n)`: Initialize the data structure with n elements.
2. `join(int x, int y)`: Join the sets containing elements x and y.
3. `rollback()`: Rollback the las... | glaive | [
0.042386990040540695,
0.010467447340488434,
-0.019711671397089958,
-0.013020794838666916,
0.026489365845918655,
-0.011676466092467308,
-0.015946727246046066,
0.10092459619045258,
0.03343946486711502,
-0.0013810284435749054,
0.04612722620368004,
0.02989397570490837,
0.0003248022112529725,
-... | 0.820056 | 0.803425 | 0.016632 |
I am looking to create a function that optimizes a Principal Component Analysis (PCA) by selecting the best sample for training. The goal is to find the sample that provides the highest cumulative proportion of variance explained by the principal components. The function should take in the following parameters:
- `y`: ... | glaive | [
-0.01585066318511963,
0.03799108788371086,
-0.04911816492676735,
-0.02196250483393669,
0.025182481855154037,
-0.027699682861566544,
-0.01516692340373993,
0.06543110311031342,
0.023434538394212723,
0.00906541757285595,
0.003701628651469946,
0.037028923630714417,
-0.018880674615502357,
0.023... | 0.797561 | 0.781641 | 0.01592 |
You are tasked with creating a function in Bash that takes an integer as input and determines whether it is an even number or not. The function should return 1 if the number is even and 0 if it is odd.
Your function should be named `isiteven` and should follow the following structure:
```bash
function isiteven {
... | glaive | [
0.025810617953538895,
0.022797472774982452,
-0.037851814180612564,
-0.028599290177226067,
0.028732720762491226,
-0.016000982373952866,
0.00009631775901652873,
0.0787350982427597,
0.033109068870544434,
0.008069194853305817,
0.013258624821901321,
0.02711731567978859,
-0.021125612780451775,
-... | 0.811857 | 0.796148 | 0.015709 |
You are tasked with implementing a function to calculate the probability of a quantum state using the given code snippet. The amplitude of the state is defined by the `amplitude` and `amplitude2` functions, and the probability is calculated using the `probability` function. The number of states is represented by the va... | glaive | [
-0.004909880459308624,
0.04775133728981018,
-0.019071074202656746,
-0.02516651339828968,
0.04649161919951439,
-0.019801530987024307,
-0.01825144700706005,
0.07994060218334198,
0.02251392789185047,
0.013812033459544182,
0.018411830067634583,
0.03443698585033417,
-0.0082395039498806,
-0.0112... | 0.794479 | 0.76237 | 0.032109 |
You are tasked with implementing a function called `divsp` that performs division using FMA-Based Division. The function should take three parameters: `a` (the numerator), `b` (the denominator), and `mode` (the IEEE rounding mode). The function should use the `rcp24` function to compute the reciprocal of `b`, and then ... | glaive | [
0.01762235537171364,
0.03011452406644821,
-0.009381486102938652,
-0.03742920979857445,
0.04373255744576454,
-0.017620982602238655,
-0.005801716353744268,
0.07319954037666321,
0.04910207539796829,
-0.0016341423615813255,
0.02895028330385685,
0.05017272010445595,
-0.01989179104566574,
-0.004... | 0.806041 | 0.788931 | 0.017111 |
You are tasked with implementing a scanner for a specific text pattern. The scanner should be able to parse a string of characters and identify specific sequences based on the given rules. The rules for the scanner are as follows:
- If the current character is a period (.), the scanner should move to the next 5 charact... | glaive | [
0.03068731538951397,
0.020678400993347168,
-0.01932157576084137,
-0.031473878771066666,
0.05099378153681755,
-0.036269817501306534,
-0.003462608437985182,
0.05596459284424782,
0.040529750287532806,
-0.0200307909399271,
0.025012623518705368,
0.017170503735542297,
-0.016722198575735092,
-0.0... | 0.816793 | 0.799067 | 0.017726 |
You are tasked with implementing a subroutine to solve an underdetermined linear system of equations by performing an LQ factorization of the matrix using Householder transformations. The emphasis is on detecting possible rank deficiency. The minimal length solution to the problem AX=B needs to be computed, where A is ... | glaive | [
0.008646597154438496,
0.03873743489384651,
-0.028085872530937195,
-0.027824105694890022,
0.04051375016570091,
0.0009027638006955385,
0.003950740676373243,
0.06615065783262253,
0.02088211290538311,
-0.007066240068525076,
-0.0023323222994804382,
0.04236559942364693,
-0.011641311459243298,
-0... | 0.818896 | 0.782142 | 0.036754 |
You are tasked with writing a program that calculates the number of (n+1) X 4 arrays with the permanents of all 2 X 2 subblocks equal and nonzero. You need to implement a function or algorithm that takes an integer n as input and returns the number of arrays that meet this criteria. The input n represents the size of t... | glaive | [
0.007479425519704819,
0.02639584243297577,
-0.03978696092963219,
-0.01899595372378826,
0.036341194063425064,
-0.016005434095859528,
-0.0375034362077713,
0.06833933293819427,
0.03468799218535423,
-0.0005756712635047734,
0.013834143988788128,
0.02794749103486538,
-0.01870880462229252,
-0.007... | 0.845475 | 0.785177 | 0.060298 |
Is there a way to determine if a given number is a prime number using an algorithm? | glaive | [
0.03486713767051697,
0.008220400661230087,
-0.013732937164604664,
-0.032877832651138306,
0.03662899136543274,
-0.042778100818395615,
0.0025542201474308968,
0.06346437335014343,
0.021443957462906837,
-0.025986716151237488,
0.017895199358463287,
0.024674640968441963,
-0.040294647216796875,
-... | 0.785525 | 0.759762 | 0.025763 |
You are tasked with writing a C program that calculates the sum of two matrices.
You are given two matrices as input, each stored in a 2D array. Your task is to write a C program that takes these two matrices as input, calculates their sum, and outputs the resulting matrix.
The input matrices will have the same dimen... | glaive | [
0.010263564065098763,
0.032635822892189026,
-0.02241513878107071,
-0.032523900270462036,
0.05287693440914154,
-0.017936214804649353,
-0.02917190082371235,
0.08445418626070023,
0.03490165248513222,
-0.017010409384965897,
0.009057827293872833,
0.03201620653271675,
-0.051634643226861954,
-0.0... | 0.785527 | 0.739216 | 0.04631 |
You are required to implement a parallel convolutional neural network (CNN) using CUDA in C++ to process image data. The input image has a width of 512 and a height of 512 with 6 channels, and the batch size is 256. The filter to be applied to the input image has a size of 6x6 and a depth of 3. The convolution operatio... | glaive | [
-0.006131394766271114,
0.0351899154484272,
-0.018116863444447517,
-0.011069711297750473,
0.026793750002980232,
0.01790400967001915,
-0.04617557302117348,
0.10807909816503525,
0.031980711966753006,
-0.02114911563694477,
0.032198041677474976,
0.018844284117221832,
-0.007857379503548145,
0.00... | 0.787623 | 0.772234 | 0.015389 |
What is the code snippet in Python to find the missing number in an array of length n-1 when all numbers from 1 to n are present? | glaive | [
0.0017266187351197004,
0.03946487605571747,
-0.035802923142910004,
-0.047088492661714554,
0.03727163374423981,
-0.037817493081092834,
-0.017450684681534767,
0.028990687802433968,
0.00022632547188550234,
-0.03077375702559948,
0.024916185066103935,
0.0393093004822731,
-0.039815276861190796,
... | 0.814099 | 0.797123 | 0.016976 |
How can I design an algorithm to rotate an array of integers to the left by a given number of positions? | glaive | [
0.016078321263194084,
0.019169187173247337,
-0.020814379677176476,
-0.02218913845717907,
0.019469937309622765,
-0.02084638550877571,
-0.031121956184506416,
0.026511820033192635,
0.019099783152341843,
-0.03412242233753204,
0.010597767308354378,
0.02443825639784336,
-0.0410604327917099,
-0.0... | 0.805857 | 0.778079 | 0.027779 |
You are tasked with implementing a function in Fortran called LOCATR4, which takes in four real numbers K1, K2, K3, and K4, an integer N, and four arrays LIST1, LIST2, LIST3, and LIST4 of size N. The function should perform a binary search on the given arrays to find the position at which the key-quadruple (K1, K2, K3,... | glaive | [
0.03664372116327286,
0.038196247071027756,
-0.02611689642071724,
-0.03474460542201996,
0.04096788540482521,
-0.006062816828489304,
-0.016163641586899757,
0.04533440247178078,
0.03369557857513428,
0.010408005677163601,
0.018663272261619568,
0.024624072015285492,
-0.026097767055034637,
-0.00... | 0.808804 | 0.783082 | 0.025722 |
You are tasked with implementing a function to generate Pascal's triangle up to a specified number of rows. Pascal's triangle is a triangular array of binomial coefficients, with the first row containing only the number 1, the second row containing the numbers 1 and 1, and each subsequent row being constructed by summi... | glaive | [
0.0314788818359375,
0.025652047246694565,
-0.023064929991960526,
-0.04136135056614876,
0.022586962208151817,
-0.01935245282948017,
-0.00288672954775393,
0.053606342524290085,
0.04016581550240517,
0.02311668172478676,
0.03610982000827789,
0.05191770941019058,
-0.02305879443883896,
-0.017607... | 0.815814 | 0.767626 | 0.048188 |
You are tasked with writing a program that generates a spiral matrix of size n x n. A spiral matrix is a square matrix of integers, with numbers starting from 1 and spiraling inwards towards the center. For example, given n = 5, the expected output would be:
```
The n = 5 spiral matrix:
1 2 3 4 5
16 17 18 19 6
15 ... | glaive | [
-0.00017501364345662296,
0.03177724778652191,
-0.025841273367404938,
-0.05050760135054588,
0.03866947069764137,
-0.03777576610445976,
-0.045734141021966934,
0.05815605819225311,
0.03222815692424774,
-0.026797037571668625,
0.040327273309230804,
0.02174074575304985,
-0.047486089169979095,
-0... | 0.807864 | 0.755475 | 0.052389 |
You are tasked with implementing a hash join algorithm to efficiently join two large datasets. The hash join algorithm is a popular method for joining tables in a database, and it involves partitioning the data into buckets based on a hash function and then performing a join operation on the matching buckets.
Your tas... | glaive | [
0.04232363402843475,
0.02559952810406685,
0.0017569464398548007,
-0.016221366822719574,
0.00967024452984333,
-0.004943861160427332,
-0.02663407288491726,
0.04716788977384567,
0.04778911918401718,
-0.010252387262880802,
0.015074950642883778,
0.007206365000456572,
-0.006804764270782471,
0.01... | 0.798143 | 0.775866 | 0.022277 |
You are tasked with implementing a function that calculates the expected number of deaths by age and country based on various parameters and data inputs. The function takes in multiple parameters and data such as the number of initial days for which to estimate infections, the days of observed data for each country, th... | glaive | [
0.020006386563181877,
0.017321687191724777,
-0.04858024790883064,
-0.034242745488882065,
0.04501785710453987,
-0.01151976827532053,
-0.029198193922638893,
0.07009182125329971,
0.035195156931877136,
-0.0023032461758702993,
0.011308779940009117,
0.055335141718387604,
-0.011477374471724033,
0... | 0.807139 | 0.789025 | 0.018114 |
You are tasked with implementing a function to calculate the total amount of a specific resource across different nodes in a Kubernetes compute cluster. The resource can be either CPU, memory, or any other resource type. The input to the function is a map where the keys are node names and the values are maps representi... | glaive | [
0.012695502489805222,
0.04592769965529442,
-0.038182467222213745,
-0.01936025358736515,
0.026920489966869354,
-0.04067191854119301,
-0.022434188053011894,
0.04465863108634949,
0.045009199529886246,
-0.005395416170358658,
0.04335574060678482,
0.03500519320368767,
-0.013109681196510792,
0.00... | 0.79937 | 0.784045 | 0.015325 |
You are given a sequence generated by the p-INVERT function, with the formula p(S) = (1 - S)^2. Your task is to write a program to generate the first n elements of this sequence.
The sequence is defined as follows:
A292400: p-INVERT of (1,2,2,2,2,2,2,...) (A040000), where p(S) = (1 - S)^2.
For example, for n = 5, the... | glaive | [
0.03985749930143356,
0.03114524856209755,
-0.015793919563293457,
-0.03072170913219452,
0.023800168186426163,
-0.049926381558179855,
-0.010231816209852695,
0.08849670737981796,
0.029869427904486656,
0.0030351460445672274,
0.014500956982374191,
0.026987645775079727,
-0.04824347794055939,
-0.... | 0.822675 | 0.776098 | 0.046577 |
You are tasked with implementing a rectangular matrix multiplication kernel using CUDA. The kernel should take two input matrices A and B and compute the product C = A x B. The matrices A and B are both 2D arrays of floats with dimensions NUM_ROWS_A x SHARED_DIM and SHARED_DIM x NUM_COLS_B, respectively. The resulting ... | glaive | [
0.020994750782847404,
0.06503668427467346,
-0.009522655047476292,
-0.026323998346924782,
0.029006004333496094,
0.00012945897469762713,
-0.0361555777490139,
0.10621711611747742,
0.039165936410427094,
-0.011879157274961472,
0.009224471636116505,
0.03154446929693222,
-0.013121034018695354,
0.... | 0.788417 | 0.763979 | 0.024437 |
You are tasked with creating a function that takes a list of numbers and returns a new list with each number incremented by 1. The function should adhere to the following guidelines:
- Input: A list of integers
- Output: A new list with each integer in the input list incremented by 1
- The function should be implemente... | glaive | [
0.03652728348970413,
0.0444493368268013,
-0.011794716119766235,
-0.049112629145383835,
0.046663615852594376,
-0.02824470028281212,
-0.010803855024278164,
0.04500972107052803,
0.019850339740514755,
-0.038600243628025055,
0.015965787693858147,
0.020963583141565323,
-0.043447382748126984,
-0.... | 0.806692 | 0.76926 | 0.037432 |
You are tasked with implementing a CUDA kernel function to find the index of the maximum value along a specific dimension of a 3D input array. The input array is represented as a 1D array, and the output should be a 1D array containing the indices of the maximum values.
You should implement the kernel function `argmax... | glaive | [
0.01309949066489935,
0.05920754745602608,
-0.02046726644039154,
-0.018213165923953056,
0.03214170038700104,
-0.012047497555613518,
-0.0352870337665081,
0.08265804499387741,
0.03282348811626434,
-0.012793122790753841,
0.03928707167506218,
0.04266244173049927,
-0.015123380348086357,
0.015246... | 0.819566 | 0.784929 | 0.034637 |
You are tasked with creating a program that defines a commutative group using the eckmann_hilton namespace. Your program should include the following components:
- Define a type X
- Define two binary operations m1 and m2 that take two values of type X and return a value of type X
- Define two elements e1 and e2 of type... | glaive | [
0.019562693312764168,
0.018518896773457527,
-0.03988989442586899,
-0.0330999530851841,
0.03372366353869438,
-0.05944862216711044,
-0.0004637168312910944,
0.07828618586063385,
0.05145159736275673,
-0.02508709579706192,
0.017171332612633705,
0.03547298163175583,
-0.023744381964206696,
-0.008... | 0.80567 | 0.779701 | 0.025969 |
I need to implement a Monte Carlo integration algorithm using CUDA in C. The goal is to calculate the integral of exp(-x^2) over the range [0, 1] in 5 dimensions. The code should use a kernel function to perform the necessary calculations. The number of trials per thread is 2048, and there are 256 blocks with 256 threa... | glaive | [
0.01583763398230076,
0.05346079543232918,
-0.014221226796507835,
-0.018338529393076897,
0.0320638008415699,
-0.008525345474481583,
-0.05212707817554474,
0.09647258371114731,
0.05124041810631752,
-0.02402213215827942,
0.018718808889389038,
0.03211937099695206,
-0.012165513820946217,
-0.0255... | 0.796498 | 0.779639 | 0.016859 |
You are required to create a CUDA kernel that implements the three_nn algorithm for finding the k-nearest neighbors (k = 3) of a set of unknown points in a set of known points in 3D space. The input to the kernel should consist of:
- unknown: A 3D tensor of shape (B, N, 3) representing B batches of N unknown points in ... | glaive | [
0.008290826342999935,
0.05119219794869423,
-0.03089264966547489,
-0.018038397654891014,
0.03214011713862419,
0.003817915916442871,
-0.022626066580414772,
0.06498558819293976,
0.03229469433426857,
-0.006473495624959469,
0.038902536034584045,
0.03737242519855499,
-0.02231428027153015,
-0.006... | 0.809189 | 0.779358 | 0.02983 |
You are tasked with creating a program to calculate the probability distribution and visualize the results for a quantum system. The system consists of 16 qubits, and the probability amplitude for each state is given by the function `amplitude[x,y]`. The program should use the `NMaximize` function to find the maximum p... | glaive | [
0.0011158500565215945,
0.023201260715723038,
-0.03254957124590874,
-0.019528653472661972,
0.044627845287323,
-0.03058561310172081,
-0.02306070178747177,
0.0713074579834938,
0.04201797768473625,
0.0018510603113099933,
0.030865954235196114,
0.04432288184762001,
-0.00487106665968895,
-0.01633... | 0.793127 | 0.764797 | 0.02833 |
You are tasked with creating a function that returns a specific value from a multi-dimensional array. The function should take no parameters and should return a boolean value. You are given a multi-dimensional boolean array named `xsss` with dimensions `2x3x5x8`. Your task is to write a function that retrieves the valu... | glaive | [
0.015898264944553375,
0.053448304533958435,
-0.051257409155368805,
-0.023486213758587837,
0.040033936500549316,
-0.036973148584365845,
-0.03465618938207626,
0.05602625757455826,
0.02982291579246521,
-0.018100472167134285,
0.018399091437458992,
0.045102495700120926,
-0.016684768721461296,
-... | 0.823452 | 0.787946 | 0.035507 |
You are tasked with implementing a program to solve an ordinary differential equation (ODE) using the Runge-Kutta method. The ODE represents a SICR (Susceptible, Infected, Cumulative Cases, Recovered) model for simulating the spread of a disease within a population. The program should be able to calculate and output th... | glaive | [
-0.00015532050747424364,
0.031134692952036858,
-0.035759031772613525,
-0.04278542846441269,
0.014654908329248428,
-0.025125959888100624,
-0.02767489291727543,
0.0791032537817955,
0.04226658493280411,
-0.014211900532245636,
0.019954128190875053,
0.04041491821408272,
-0.02035858854651451,
0.... | 0.806504 | 0.783282 | 0.023222 |
You are tasked with implementing a function that converts a COO (Coordinate List) sparse matrix representation to a CSR (Compressed Sparse Row) representation. The COO format consists of three arrays: `srcRows`, `srcCols`, and `srcVals`, where `srcRows` and `srcCols` contain the row and column indices of the non-zero e... | glaive | [
0.0018191483104601502,
0.03401946648955345,
-0.035793282091617584,
-0.048535823822021484,
0.028965916484594345,
0.0002761314099188894,
-0.027393842115998268,
0.07203606516122818,
0.04240691661834717,
-0.015598878264427185,
0.027127113193273544,
0.015998873859643936,
-0.0064063165336847305,
... | 0.81674 | 0.795918 | 0.020822 |
You are tasked with implementing a cubic interpolator class in the Roassal3-Animation-Easing category. The class should include methods for interpolating in, out, and in-out using the cubic easing equation. The interpolateIn method should calculate the interpolation for t using the formula t * t * t. The interpolateOut... | glaive | [
0.04226192459464073,
0.04482438042759895,
-0.02640044502913952,
-0.01997988484799862,
0.03655300661921501,
-0.04291593283414841,
-0.0055108279921114445,
0.0674392506480217,
0.035944730043411255,
-0.020129790529608727,
0.03933919593691826,
0.015941070392727852,
-0.01546864677220583,
0.00964... | 0.793731 | 0.774455 | 0.019276 |
You are tasked with implementing a k-core decomposition algorithm for a given graph using CUDA. The k-core of a graph is a maximal subgraph in which each vertex has at least degree k within the subgraph. For this problem, you need to implement the CPU-based reference vertex k-core decomposition using the following temp... | glaive | [
0.018399132415652275,
0.04572295397520065,
-0.018351644277572632,
-0.015048154629766941,
0.017072657123208046,
-0.025770775973796844,
-0.01639583706855774,
0.09176946431398392,
0.043180275708436966,
-0.02015959471464157,
0.031963709741830826,
0.020004738122224808,
0.01158434059470892,
0.01... | 0.80686 | 0.780689 | 0.026171 |
You are tasked with implementing a function that takes in a list of integers and returns the sum of all the even numbers in the list.
Write a function called `sumEven` that takes a list of integers as input and returns the sum of all the even numbers in the list.
For example:
sumEven([1, 2, 3, 4, 5, 6]) should return... | glaive | [
0.024555623531341553,
0.024999873712658882,
-0.03252829983830452,
-0.06202350929379463,
0.04818541184067726,
-0.014050419442355633,
-0.018114455044269562,
0.024313580244779587,
0.036536555737257004,
-0.012050752528011799,
0.013278127647936344,
0.05729527771472931,
-0.03926385939121246,
-0.... | 0.808634 | 0.769348 | 0.039286 |
You are tasked with creating a program that reads input from a file, performs some calculations, and writes the results to two separate output files. The input file "in.txt" contains the data that needs to be processed, and the output files "1.txt" and "2.txt" should contain the results of different calculations.
Your... | glaive | [
0.016009191051125526,
0.020705657079815865,
-0.03868566453456879,
-0.04655908793210983,
0.03380787372589111,
-0.02394135668873787,
-0.0230930857360363,
0.05539374426007271,
0.03617589920759201,
-0.020720520988106728,
0.024862058460712433,
0.03366958722472191,
-0.021207714453339577,
-0.0128... | 0.806989 | 0.790439 | 0.01655 |
You are tasked with creating a Verilog module that takes a 32-bit input and outputs the position of the most significant bit (MSB) in the input. The MSB is the position of the leftmost '1' in the binary representation of the input. If the input is all zeros, the output should be 0.
Create a module named `msb_naive` wi... | glaive | [
0.02791767381131649,
0.02616911567747593,
-0.038209009915590286,
-0.03653070703148842,
0.032922785729169846,
-0.02480263262987137,
-0.026421591639518738,
0.062091391533613205,
0.039601221680641174,
-0.023537874221801758,
0.0410146489739418,
0.03477546200156212,
-0.007471623830497265,
-0.02... | 0.812196 | 0.79571 | 0.016486 |
You are tasked with implementing a program to calculate the precision matrix of an OU covariance kernel with a given mean reversion parameter lambda and time intervals. The precision matrix should be of a symmetric, tridiagonal matrix with diagonal elements and off diagonals provided in the input. The program should al... | glaive | [
-0.0012844732264056802,
0.02678212895989418,
-0.04250717908143997,
-0.02545628510415554,
0.0380413793027401,
-0.018561620265245438,
-0.019023215398192406,
0.07210984826087952,
0.03475319594144821,
-0.012155771255493164,
0.00656890170648694,
0.046691861003637314,
-0.01452910527586937,
-0.00... | 0.796165 | 0.778413 | 0.017752 |
You are tasked with creating a set of data types and their corresponding operations in C++ for a system that supports multiple languages. The data types include Date, Time, DateTime, Value, NList, NMap, NSet, Row, DataSet, Coordinate, Point, LineString, Polygon, Geography, Tag, Vertex, Edge, Step, Path, HostAddr, KeyVa... | glaive | [
0.022256407886743546,
0.01019946951419115,
-0.03456252068281174,
-0.02655533328652382,
0.04778967425227165,
-0.03689245134592056,
-0.013712038286030293,
0.0984899029135704,
0.06463335454463959,
-0.02841242589056492,
0.030208934098482132,
0.056142449378967285,
0.002613222459331155,
-0.00981... | 0.781489 | 0.765134 | 0.016355 |
You are tasked with creating a Go program that calculates the average of a list of numbers. The program should take a slice of numbers as input and return the average value as a float64. The input slice may contain both positive and negative integers.
Create a function called "CalculateAverage" that accepts a slice of... | glaive | [
0.00948266126215458,
0.032406747341156006,
-0.027951665222644806,
-0.03809081017971039,
0.05235341191291809,
-0.02544005960226059,
-0.030877673998475075,
0.06446261703968048,
0.03992560878396034,
-0.0216393880546093,
0.025430096313357353,
0.02062080428004265,
-0.031798142939805984,
-0.0081... | 0.794204 | 0.779476 | 0.014728 |
Can you translate this pseudocode into Python code? I'm trying to find the maximum value in an array. | glaive | [
0.013330110348761082,
0.030491022393107414,
-0.02403133735060692,
-0.025055894628167152,
0.03884204849600792,
-0.042395178228616714,
-0.02665235474705696,
0.03749058395624161,
0.028273941949009895,
-0.03140493854880333,
0.02376484125852585,
0.03506056219339371,
-0.039534587413072586,
-0.00... | 0.811717 | 0.795543 | 0.016174 |
You are tasked with implementing a function that fills a set of required characters with the letters in a given word, all in lowercase. The function should take in a word as input and add each lowercase letter in the word to the set of required characters.
Write a function called fillRequiredCharacters that takes a wo... | glaive | [
0.024104533717036247,
0.04331458732485771,
0.006157831754535437,
-0.03884217143058777,
0.05612105876207352,
-0.028068460524082184,
0.014516258612275124,
0.028519056737422943,
0.021744266152381897,
-0.010607937350869179,
0.016809452325105667,
0.0399167574942112,
-0.03011230379343033,
-0.014... | 0.800457 | 0.778762 | 0.021695 |
You are tasked with writing a program to calculate the number of nonequivalent dissections of an n-gon into 3 polygons by nonintersecting diagonals up to rotation. The program should take an integer n as input and output the number of nonequivalent dissections for that n.
For example, if the input is 6, the output sho... | glaive | [
0.019018109887838364,
-0.0012958012521266937,
-0.0487893708050251,
-0.030403830111026764,
0.025509245693683624,
0.009629065170884132,
-0.03175460547208786,
0.04975372180342674,
0.029305962845683098,
-0.02041676454246044,
0.03407939523458481,
0.026092689484357834,
-0.04556523635983467,
-0.0... | 0.833236 | 0.786416 | 0.046821 |
You are tasked with implementing a non-maximum suppression (NMS) algorithm using CUDA for efficient parallel processing. The goal is to filter out overlapping bounding boxes and select the ones with the highest scores. The input consists of an array of bounding boxes and their corresponding scores, along with an inters... | glaive | [
-0.005319989286363125,
0.028404584154486656,
-0.03454736992716789,
-0.003035672241821885,
0.024053381755948067,
-0.006072472780942917,
-0.04002665355801582,
0.0660305768251419,
0.04927334561944008,
-0.011381691321730614,
0.031899452209472656,
0.019710376858711243,
-0.003319921437650919,
0.... | 0.816332 | 0.785899 | 0.030434 |
You are tasked with implementing a set of fill functions in C++ for a library. The fill functions are used to fill arrays and matrices with a specified value. The functions to be implemented are:
1. `fill_n`: Fills the first `N` elements of an array with a specified value, with an optional stride parameter.
2. `fill2D... | glaive | [
0.02190733328461647,
0.049299512058496475,
-0.0053604464046657085,
-0.04461302235722542,
0.04751509800553322,
-0.03407104313373566,
-0.0008228489896282554,
0.10329055786132812,
0.03621416911482811,
-0.010320416651666164,
0.0350019596517086,
0.04688097909092903,
-0.022377140820026398,
-0.00... | 0.791938 | 0.777344 | 0.014594 |
You are tasked with creating a program that takes in a list of numbers and sorts them in ascending order using the Bubble Sort algorithm. The program should be able to compile and run without errors. | glaive | [
0.023642800748348236,
0.01423889771103859,
-0.01690443605184555,
-0.025133511051535606,
0.028882471844553947,
-0.022383268922567368,
-0.01762452907860279,
0.061835698783397675,
0.016869299113750458,
-0.03213600441813469,
0.01574508287012577,
0.033024441450834274,
-0.037725359201431274,
-0.... | 0.816406 | 0.784967 | 0.031439 |
:
You are tasked with creating a program that tests the nodeDepthThreading function for multithreading issues. The function takes no input arguments and returns void. The function involves the following steps:
1. Generate a uniform level-7 tree with 2097152 nodes.
2. Create a binary tree based on the generated uniform ... | glaive | [
0.023747948929667473,
0.027784721925854683,
-0.019591107964515686,
-0.023090532049536705,
0.02929050475358963,
-0.02595442347228527,
-0.0037887846119701862,
0.09375584125518799,
0.021422719582915306,
-0.022066839039325714,
0.031169526278972626,
0.019352197647094727,
-0.0193167794495821,
0.... | 0.816819 | 0.801215 | 0.015604 |
You are tasked with creating a program that calculates the probability of a quantum state in a given quantum system. The program should take into account the number of qubits, the name of the system, and the number of states. Additionally, the program should be able to plot the probability in a 3D graph and display a c... | glaive | [
0.001233831630088389,
0.028702929615974426,
-0.0274729672819376,
-0.016928652301430702,
0.05090291053056717,
-0.024860315024852753,
-0.016046185046434402,
0.08568364381790161,
0.026470797136425972,
-0.001940469373948872,
0.02157020941376686,
0.03557084500789642,
-0.022288279607892036,
-0.0... | 0.789295 | 0.75964 | 0.029655 |
You are tasked with implementing a CUDA kernel for the axpy_3 operation, which is a combination of scalar multiplication and vector addition. The operation is defined as follows: for each element i in the input arrays x and y, compute alpha * x[i] + y[i] and store the result in the corresponding position of the output ... | glaive | [
0.01028883084654808,
0.047766633331775665,
-0.015394984744489193,
-0.02806931361556053,
0.02852243185043335,
-0.00045110570499673486,
-0.030979961156845093,
0.09877951443195343,
0.03936207294464111,
-0.025298498570919037,
0.03179715946316719,
0.025593120604753494,
-0.02935929223895073,
-0.... | 0.794602 | 0.775092 | 0.019509 |
I need to create a program that performs Number Theoretic Transform (NTT) using the given code snippet as a reference. The NTT algorithm is used in number theory and cryptography to perform fast multiplication of polynomials. I need to implement the NTT algorithm in C, using the provided C files bench.c, ntt.mil.s, ntt... | glaive | [
0.026034347712993622,
0.03523360937833786,
-0.03942853584885597,
-0.020946580916643143,
0.03828340023756027,
-0.022114915773272514,
-0.02135906182229519,
0.0703093484044075,
0.010556930676102638,
-0.015972668305039406,
0.008100029081106186,
0.01351576391607523,
-0.055848054587841034,
-0.01... | 0.804742 | 0.786443 | 0.018299 |
You are tasked with creating a program that can efficiently access and manipulate strings in a given input. The program should be able to take in a string and perform various operations on it, such as accessing specific characters, extracting substrings, and modifying the string in place.
Write a function or method th... | glaive | [
0.024490365758538246,
0.03510234132409096,
0.0029041520319879055,
-0.02392597869038582,
0.027765659615397453,
-0.06425224989652634,
-0.01217432040721178,
0.060118257999420166,
0.033793821930885315,
-0.011488894931972027,
0.010279134847223759,
0.030582381412386894,
-0.04055792838335037,
-0.... | 0.811221 | 0.794989 | 0.016232 |
You are tasked with writing a program to find the maximum sum of a contiguous subarray within a one-dimensional array of numbers. Your program should take in an array of integers and return the maximum sum of a contiguous subarray.
For example, given the input array [1, -3, 4, -2, -1, 6], the maximum sum of a contiguo... | glaive | [
0.019843969494104385,
0.03699003532528877,
-0.03788053244352341,
-0.03142474219202995,
0.037528667598962784,
-0.010995385237038136,
-0.03400855511426926,
0.03375079110264778,
0.0405079685151577,
-0.023199494928121567,
0.030094508081674576,
0.03420167788863182,
-0.03887008875608444,
0.00860... | 0.825762 | 0.769262 | 0.0565 |
You are tasked with creating a C# program that will calculate the area of a rectangle. The program should take in the length and width of the rectangle as input from the user and then output the calculated area. | glaive | [
0.008519420400261879,
0.04632079228758812,
-0.03324229270219803,
-0.035716116428375244,
0.011437947861850262,
-0.03305553272366524,
-0.02120504528284073,
0.0828368067741394,
0.0586371049284935,
-0.013655683025717735,
0.024936482310295105,
0.0497298389673233,
-0.03749549016356468,
-0.033709... | 0.772066 | 0.748243 | 0.023823 |
You are tasked with creating a program that takes in various types of data structures and performs transformations on them. Specifically, you need to define the data structures, transform the data, and then calculate the minimum value within each data structure. You are also required to define parameters, transform the... | glaive | [
0.005322026088833809,
0.01502910628914833,
-0.034747183322906494,
-0.044916197657585144,
0.04355145990848541,
-0.024046193808317184,
-0.015418002381920815,
0.055551961064338684,
0.031981874257326126,
-0.014835367910563946,
0.0025343787856400013,
0.02773171477019787,
-0.02434977889060974,
-... | 0.823203 | 0.779474 | 0.043729 |
How can I develop a code segment that rearranges a matrix of integer values into a mirrored, diamond-like formation?
```python
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
def mirror_matrix(matrix):
# determine number of rows and columns
size = len(matrix)
# locate middle row
mid = size//2
# c... | glaive | [
0.016423430293798447,
0.0262589268386364,
-0.03372370824217796,
-0.03253939375281334,
0.03175853565335274,
-0.016543667763471603,
-0.007930627092719078,
0.06916332989931107,
0.028279829770326614,
-0.014463426545262337,
0.0246911458671093,
0.013290805742144585,
-0.03407145291566849,
-0.0141... | 0.817961 | 0.799884 | 0.018077 |
You have been tasked with analyzing a dataset containing information about video games. Your objective is to explore the data and perform various analyses to gain insights into the video game market. Specifically, you are required to:
1. Import the video games dataset and explore its contents.
2. Identify the longest l... | glaive | [
0.02835977077484131,
-0.02275349386036396,
-0.042150869965553284,
-0.021506138145923615,
0.02883780747652054,
-0.0160860363394022,
-0.009932994842529297,
0.04765196889638901,
0.03385244682431221,
-0.013272852636873722,
0.04071824625134468,
-0.0008361783693544567,
-0.019120709970593452,
-0.... | 0.761467 | 0.747061 | 0.014406 |
You are tasked with creating a class that represents a simple calculator in C#. The class should have methods for addition, subtraction, multiplication, and division. Additionally, it should have a method for resetting the calculator back to 0.
Create a class named "SimpleCalculator" and implement the following method... | glaive | [
0.03396488353610039,
0.03638489171862602,
-0.01660318113863468,
-0.040178488940000534,
0.0630054846405983,
-0.055479079484939575,
-0.0035243243910372257,
0.10187039524316788,
0.05234450474381447,
-0.026057815179228783,
0.025436535477638245,
0.039533451199531555,
-0.023681633174419403,
-0.0... | 0.788247 | 0.770685 | 0.017562 |
How can I find the division remainder of a number in Python? For instance, if I have a number like 26 and it is divided by 7, the division remainder should be 5, as 7+7+7 equals 21 and 26 minus 21 equals 5. How can I compute this? | glaive | [
0.020048784092068672,
0.019046185538172722,
-0.025072261691093445,
-0.0453561432659626,
0.06020830199122429,
-0.040059030055999756,
-0.01342026051133871,
0.040650542825460434,
0.023242104798555374,
-0.02021642029285431,
0.02584109455347061,
0.024919388815760612,
-0.050386421382427216,
0.00... | 0.79296 | 0.77756 | 0.015399 |
You are tasked with implementing a Fortran subroutine that performs the matrix-vector operation for a hermitian matrix. The subroutine should take as input the upper/lower triangular part of the matrix A, scalar values alpha and beta, and vectors X and Y. The purpose is to compute the operation y := alpha*A*x + beta*y,... | glaive | [
0.026368677616119385,
0.028166208416223526,
-0.016359535977244377,
-0.04900550842285156,
0.04428911209106445,
-0.017646586522459984,
-0.007620534859597683,
0.07506102323532104,
0.03791620582342148,
-0.0066247861832380295,
0.006524093449115753,
0.043899960815906525,
-0.023278189823031425,
-... | 0.794919 | 0.766941 | 0.027978 |
You are tasked with creating a Java program that generates a random string of a specified length. The program should take an integer input from the user and then output a random string consisting of uppercase letters, lowercase letters, and numbers. The length of the string should be equal to the input integer. | glaive | [
0.004092096816748381,
0.01807565614581108,
-0.024865787476301193,
-0.023803964257240295,
0.04054410755634308,
-0.045978788286447525,
-0.015992285683751106,
0.02791324257850647,
0.025126080960035324,
-0.03177071362733841,
0.03329617157578468,
0.030859721824526787,
-0.04586246982216835,
-0.0... | 0.797319 | 0.775212 | 0.022106 |
Is there a way to write a program that can find two numbers from an array of integers whose sum is equal to a given target? | glaive | [
0.020473534241318703,
0.02267489582300186,
-0.05216245725750923,
-0.02845829166471958,
0.042536791414022446,
-0.026810184121131897,
-0.01959049515426159,
0.039346061646938324,
0.02654058299958706,
-0.04584921523928642,
0.0259670689702034,
0.03614348545670509,
-0.038002580404281616,
-0.0195... | 0.808831 | 0.783902 | 0.024929 |
You are tasked with implementing a CUDA kernel to perform a hash-based sorting algorithm for a given set of particle data. The goal is to reorder the particle data based on their hash keys and store the sorted particle positions and velocities in separate arrays.
The CUDA kernel should take in the following input para... | glaive | [
0.003237187396734953,
0.03204156830906868,
-0.0038794490974396467,
-0.0077773453667759895,
0.015101141296327114,
-0.01986764371395111,
-0.035561252385377884,
0.07846628129482269,
0.04749057814478874,
-0.011212429031729698,
0.020822908729314804,
0.02838616445660591,
-0.002324071479961276,
0... | 0.801163 | 0.783844 | 0.017319 |
You are tasked with implementing a CUDA kernel to increment elements in an array using two different methods. The first method involves each thread incrementing consecutive array elements, wrapping at the array size if necessary. The second method involves using atomic operations to increment the array elements. You ar... | glaive | [
0.022743429988622665,
0.047499578446149826,
-0.012787002138793468,
-0.009695217944681644,
0.02618355117738247,
-0.01575656235218048,
-0.016064804047346115,
0.10987689346075058,
0.045617859810590744,
-0.023806825280189514,
0.025889495387673378,
0.02115665189921856,
-0.01593479886651039,
0.0... | 0.807388 | 0.793074 | 0.014314 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.