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
What is the program to find the sum of all possible subarray sums for a given array of numbers?
glaive
[ 0.001751868985593319, 0.023049747571349144, -0.05198080092668533, -0.03969384357333183, 0.040835149586200714, -0.019209781661629677, -0.01572270318865776, 0.03878052905201912, 0.03745846822857857, -0.04072540998458862, 0.028147347271442413, 0.05479073151946068, -0.04831891506910324, -0.020...
0.798286
0.772251
0.026035
You are tasked with creating a program that can identify and extract specific segments of a given DNA sequence based on the provided annotations. The DNA sequence is represented as a string of characters, and the annotations specify the start and end positions of each segment, along with additional details such as the ...
glaive
[ 0.025311406701803207, 0.013989844359457493, -0.04080834612250328, -0.03449537232518196, 0.010712143033742905, -0.03818902373313904, 0.002209925791248679, 0.060109756886959076, 0.027850566431879997, 0.004690210800617933, 0.017943721264600754, 0.030518244951963425, -0.027188297361135483, 0.0...
0.801472
0.7827
0.018771
What is an algorithm to calculate the average marks of students in an array?
glaive
[ 0.018135378137230873, 0.026191402226686478, -0.04466429352760315, -0.049322791397571564, 0.04170826077461243, -0.04029126092791557, -0.050922293215990067, 0.03748175874352455, 0.013750702142715454, -0.03874795883893967, 0.01674293540418148, 0.02183832786977291, -0.027006473392248154, -0.01...
0.784271
0.758442
0.025829
You are tasked with creating a program that calculates whether a given point is inside a circle based on different distances and bearings. The circle is defined by a center point and a radius. You need to implement the logic to determine if a given point is inside the circle based on the distance and bearing from the c...
glaive
[ 0.01138384360820055, 0.025086194276809692, -0.0405876561999321, -0.016958024352788925, 0.04760032519698143, -0.028767963871359825, -0.025474445894360542, 0.043468426913022995, 0.041981205344200134, -0.014931277371942997, 0.026656046509742737, 0.03663232922554016, -0.015849201008677483, -0....
0.797454
0.772064
0.02539
You are tasked with writing a program that allocates 16 byte aligned stack space for packed values and performs specific operations on 128-bit values using the xmm0 register. The program should load a 128-bit value into xmm0, then perform a series of operations on the values, including storing new values, shuffling the...
glaive
[ 0.027277464047074318, 0.02155589871108532, -0.038744401186704636, -0.018401410430669785, 0.038151226937770844, -0.023022416979074478, -0.039936162531375885, 0.0664370134472847, 0.048142753541469574, -0.01881890557706356, 0.027251144871115685, 0.041963547468185425, -0.02298375777900219, -0....
0.807835
0.786044
0.021791
You are tasked with creating a SQL query that calculates the count of distinct values, the sum, and the rounded average of a specific column in a table. The result should be grouped by multiple columns and ordered accordingly. Write a SQL query to achieve the following: - Select the count of distinct values, the sum, a...
glaive
[ 0.01046619564294815, 0.041849516332149506, -0.04387257248163223, -0.032869093120098114, 0.020381467416882515, -0.033950868993997574, -0.02322673797607422, 0.03591448441147804, 0.058878540992736816, 0.0002269032265758142, 0.008744644932448864, 0.015553080476820469, -0.017219582572579384, 0....
0.788744
0.750235
0.038508
You are tasked with creating a function in a programming language that takes a boolean input and returns either 0 or 1 based on the input value. However, the function should only work if the input type implements the Bits interface for a specific type 'm'. The function should be defined as follows: function Bit#(m) fn...
glaive
[ 0.018626760691404343, 0.0376889705657959, -0.035826072096824646, -0.02580297365784645, 0.045138947665691376, -0.03984617441892624, -0.01833096705377102, 0.0905333161354065, 0.032394297420978546, -0.02362198941409588, 0.018227234482765198, 0.06003973260521889, -0.010534053668379784, -0.0189...
0.81097
0.794822
0.016148
You are required to design a stack that supports the following operations and can retrieve the minimum element in constant time: - push(x): Add element x to the stack. - pop(): Remove the top element of the stack. - top(): Get the top element of the stack. - getMin(): Retrieve the minimum element in the stack. Design...
glaive
[ 0.03212575986981392, 0.020374875515699387, -0.03153276443481445, -0.01516228262335062, 0.04337106645107269, -0.03370195999741554, -0.02473295107483864, 0.08583492040634155, 0.041376955807209015, -0.009170761331915855, 0.026087159290909767, 0.02688855305314064, -0.02308492362499237, -0.0119...
0.830971
0.795106
0.035865
I need to implement a pairwise sequence alignment on a GPU using CUDA. The goal is to create a function that will process the Smith-Waterman algorithm for pairwise sequence alignment on a GPU. The input will consist of sequences of references, candidates, and queries, along with alignment results. The alignment should ...
glaive
[ 0.016616659238934517, 0.030299894511699677, -0.033076997846364975, -0.03258007764816284, 0.019912676885724068, -0.002199218375608325, -0.031669341027736664, 0.07985739409923553, 0.03140150383114815, -0.03498941287398338, 0.023096390068531036, 0.019023938104510307, 0.0099278399720788, 0.009...
0.791096
0.776664
0.014432
You are required to implement a program in HolKernel using the libraries: boolLib, bossLib, numLib, arithmeticTheory, prim_recTheory, gcdTheory, dividesTheory, binomialTheory, congruentTheory, summationTheory, and powerTheory. The program needs to prove the following theorems: 1. GCD_PQ: For all prime numbers p and q,...
glaive
[ 0.03348822146654129, 0.03260228782892227, -0.01825929991900921, -0.04340746998786926, 0.02739919163286686, -0.028646953403949738, 0.001226047519594431, 0.054616451263427734, 0.030024247244000435, -0.023185666650533676, 0.000689231208525598, 0.02144536003470421, -0.021329302340745926, -0.01...
0.815318
0.781911
0.033407
You are tasked with creating a Stan program to estimate the parameters of a linear regression model. The data consists of a single real variable, "short", representing the length of a certain object, and the model to be estimated is of the form y = mx + c, where y is the dependent variable, x is the independent variabl...
glaive
[ 0.0064493631944060326, 0.03224675729870796, -0.05012035369873047, -0.06623665243387222, 0.05259197577834129, -0.009780853055417538, -0.022851942107081413, 0.0664948970079422, 0.0462300106883049, -0.02139873243868351, 0.013224417343735695, 0.044740427285432816, -0.028336578980088234, 0.0134...
0.791333
0.774599
0.016734
You are tasked with creating a program that implements a Combinational Digital Function (CDF) table for the given logic. The table has an input (A) and an output (Y). The function to be implemented is Y = (!A), where ! represents the logical NOT operation. You also need to define the incap, delay dpower, and lpower for...
glaive
[ 0.033004168421030045, 0.015745462849736214, -0.038561612367630005, -0.028083479031920433, 0.030289342626929283, -0.013169010169804096, -0.003345491597428918, 0.06945499777793884, 0.05075298622250557, -0.01589503325521946, 0.024730028584599495, 0.03264812007546425, -0.0217792559415102, -0.0...
0.805995
0.785236
0.020759
You are working on a project to analyze the performance of a new algorithm for image processing. The algorithm's output is a set of data points representing the pixel intensity values in an image. You need to implement a program that will calculate the mean and standard deviation of these pixel intensity values for a g...
glaive
[ -0.02679305523633957, 0.02224693074822426, -0.04411467909812927, -0.05690354108810425, 0.04270479828119278, -0.023963196203112602, -0.03226388245820999, 0.056658871471881866, 0.04247686639428139, -0.025932827964425087, 0.016764188185334206, 0.018105948343873024, -0.02238139510154724, -0.01...
0.790625
0.769421
0.021204
You are tasked with implementing a function to calculate the population count (number of set bits) of a given integer. The function should return the number of set bits in the binary representation of the input integer. You need to implement the following functions: - popcount_sparse(x): This function should use a spa...
glaive
[ 0.015310710296034813, 0.02900693565607071, -0.024966049939393997, -0.006603614892810583, 0.046517711132764816, -0.03001250885426998, -0.02365787699818611, 0.06222037971019745, 0.04464103654026985, 0.00691328477114439, 0.007714040111750364, 0.025833701714873314, -0.01081591472029686, -0.003...
0.814296
0.779479
0.034817
You are tasked with creating a subroutine to determine the number of knots and their position for a least-squares curve sinf(u) and the corresponding sum of squared residuals fp=f(p=inf). The subroutine should be able to check whether the knots can be accepted based on a given criterion, increase the number of knots if...
glaive
[ 0.006384765729308128, 0.0393185168504715, -0.036681193858385086, -0.03961482271552086, 0.03932804986834526, 0.0027501126751303673, -0.014944866299629211, 0.05828949809074402, 0.01767539605498314, 0.005590132437646389, 0.011847998946905136, 0.04367396607995033, -0.02660483308136463, 0.00306...
0.817976
0.784433
0.033543
You are tasked with implementing a function in the programming language that takes two natural numbers, a and b, and returns their sum. The function should ensure that the addition operation is commutative, meaning that a + b should be equal to b + a for any given natural numbers a and b. Implement a function that sat...
glaive
[ 0.02902633138000965, 0.013978985138237476, -0.037046823650598526, -0.03929366171360016, 0.04642322659492493, -0.01786363683640957, -0.005109413992613554, 0.06841482222080231, 0.04382955655455589, -0.01287135761231184, 0.00944795086979866, 0.03450120612978935, -0.030351782217621803, -0.0183...
0.816602
0.796705
0.019897
How can I find the longest increasing subsequence from a given array in Python?
glaive
[ -0.0057342699728906155, 0.03261176496744156, -0.03395599126815796, -0.04432953894138336, 0.01947500929236412, -0.019958965480327606, -0.03832358494400978, 0.03922333940863609, 0.022082943469285965, -0.02857278846204281, 0.021225078031420708, 0.011216615326702595, -0.04072406888008118, 0.01...
0.803702
0.78222
0.021482
Is it possible to create a program that can take an array as an input and produce a new array where each element contains the product of all other elements?
glaive
[ 0.031825073063373566, 0.033758942037820816, -0.029743343591690063, -0.021934853866696358, 0.03618272393941879, -0.046320073306560516, -0.018093839287757874, 0.07305720448493958, 0.034466471523046494, -0.05324682965874672, 0.012378363870084286, 0.03323598578572273, -0.032974932342767715, -0...
0.802112
0.784453
0.017659
Write a function to calculate the arithmetic function uhat(n,3,5) for a given input n. The arithmetic function is defined as follows: uhat(n,3,5) = n - 9 if n is less than or equal to 10 uhat(n,3,5) = uhat(uhat(n-1,3,5),3,5) if n is greater than 10 Implement a function that takes an integer input n and calculates the ...
glaive
[ 0.04169763997197151, 0.039192505180835724, -0.02039964683353901, -0.0259567704051733, 0.04188069328665733, -0.03156350925564766, -0.027871891856193542, 0.06326901167631149, 0.029509196057915688, 0.0062031932175159454, 0.02312568388879299, 0.044387657195329666, -0.04024871811270714, -0.0255...
0.812107
0.777699
0.034408
You need to create a program that multiplies two matrices using CUDA for parallel processing. The program should also include a function to multiply two matrices using CPU for comparison. Additionally, the program should have a function to compare two matrices to check for equality. The main function should initialize ...
glaive
[ 0.022797107696533203, 0.0392473042011261, -0.02606089599430561, -0.020847419276833534, 0.026896703988313675, -0.002183387288823724, -0.037695690989494324, 0.10049861669540405, 0.03295978531241417, -0.03507981076836586, 0.007859418168663979, 0.03071637824177742, -0.006669407710433006, -0.01...
0.800366
0.785443
0.014922
You are tasked with implementing an adaptive automaton that accepts a sequence of unary numbers as input and applies two adaptive functions to determine the accepted inputs. The adaptive functions are as follows: 1. Multiply the input by 12, then subtract 9, and finally divide by 8. 2. Subtract 1 from the input. Your ...
glaive
[ 0.028105029836297035, 0.02794477716088295, -0.024791860952973366, -0.017071478068828583, 0.03317096084356308, -0.04725439473986626, -0.019504565745592117, 0.07735064625740051, 0.018369469791650772, -0.00785587728023529, 0.016053522005677223, 0.01469135470688343, -0.025294141843914986, -0.0...
0.826951
0.792756
0.034196
You are tasked with implementing a function that takes a 32-bit value and reverses the bit order of the value. The function should return the value with its bits in reverse order. Write a function `reverseBitOrder` that takes an unsigned 32-bit integer as input and returns another unsigned 32-bit integer with the bit ...
glaive
[ 0.005333453882485628, 0.04408996179699898, -0.010427050292491913, -0.02588106133043766, 0.030963195487856865, -0.01415120717138052, -0.028774399310350418, 0.0719188004732132, 0.05189109221100807, 0.004018143750727177, 0.031087877228856087, 0.028253648430109024, -0.04010303318500519, -0.012...
0.795499
0.776665
0.018834
Can you provide an example of an HTML page that displays the Fibonacci Sequence up to 10 numbers?
glaive
[ 0.0112617751583457, 0.018000205978751183, -0.023831740021705627, -0.026532771065831184, 0.031682614237070084, -0.04978754743933678, -0.006486417725682259, 0.05959143117070198, 0.01807265169918537, -0.0336470864713192, 0.024894511327147484, 0.04414823278784752, -0.06036665290594101, -0.0019...
0.79691
0.781647
0.015263
You are tasked with creating a class in C# to represent a student's information. The class should have the following properties: - Name (string): the student's name - Age (int): the student's age - Grade (char): the student's grade (A, B, C, etc.) Create a method within the class that calculates the student's grade ba...
glaive
[ 0.010595926083624363, 0.0017752654384821653, -0.021557316184043884, -0.04053289070725441, 0.03619631752371788, -0.06014971435070038, -0.022301189601421356, 0.0832783579826355, 0.03845749422907829, -0.013120995834469795, 0.0379801020026207, 0.03777606040239334, -0.04627005010843277, -0.0033...
0.782774
0.765295
0.017478
You are tasked with implementing a CUDA kernel to calculate the sum and dot product of two arrays in parallel. The given snippet provides the necessary CUDA kernel and wrapper functions. Your task is to write the main CUDA kernel functions `sum_` and `dot_` as well as the wrapper functions `sum` and `dot`. The `sum_` k...
glaive
[ 0.005464300513267517, 0.06045752763748169, -0.0230468288064003, -0.03129084035754204, 0.050786614418029785, 0.0010909641860052943, -0.03154059872031212, 0.09364490956068039, 0.03904355689883232, -0.021426154300570488, 0.022891122847795486, 0.04223673790693283, 0.005332102067768574, -0.0094...
0.795597
0.776576
0.019021
You are tasked with implementing a program to calculate the decimal expansion of Pi/180. Your program should take no input and output the decimal expansion of Pi/180.
glaive
[ -0.017700854688882828, 0.03296279162168503, -0.03177577629685402, -0.04542320594191551, 0.021041061729192734, -0.02609592117369175, -0.003663556883111596, 0.06076858565211296, 0.04134253412485123, -0.028468336910009384, 0.011641687713563442, 0.023812511935830116, -0.0461479015648365, -0.01...
0.791131
0.766204
0.024927
You are working with a set data structure in a programming language that supports sets and finite types. You need to implement a function that takes two sets, `s` and `t`, both of which are finite, and checks if the cardinality of set `s` is strictly less than the cardinality of set `t`. Write a function that takes tw...
glaive
[ 0.014738807454705238, 0.024135034531354904, -0.04951063171029091, -0.010544325225055218, 0.042155638337135315, -0.032354071736335754, -0.023578288033604622, 0.08113760501146317, 0.033129382878541946, -0.02408035658299923, 0.02488105185329914, 0.030773993581533432, -0.01010975893586874, 0.0...
0.844291
0.814819
0.029473
You are tasked with implementing a function to perform dequantization and inverse Discrete Cosine Transform (IDCT) on a block of coefficients, producing a reduced-size 4x4 output block. The input block consists of 8x8 DCT coefficients, and the output will be a 4x4 pixel block. The function prototype is as follows: ``` ...
glaive
[ 0.012719410471618176, 0.04207569360733032, -0.03192096948623657, -0.012855143286287785, 0.04315120726823807, -0.017112478613853455, -0.029119348153471947, 0.09295289218425751, 0.03499724343419075, 0.002416345989331603, 0.015145315788686275, 0.009021572768688202, -0.01896297186613083, 0.021...
0.800499
0.782671
0.017828
You are tasked with creating a program that calculates the probability of a quantum state for a given set of inputs. The program should be able to find the maximum probability and plot the 3D and contour graphs of the probability distribution.
glaive
[ 0.0027053363155573606, 0.02633233740925789, -0.044928260147571564, -0.020455794408917427, 0.047710880637168884, -0.013714993372559547, -0.02170216664671898, 0.06645436584949493, 0.03995775058865547, -0.012433559633791447, 0.03571774438023567, 0.04202090576291084, -0.012152140960097313, -0....
0.800969
0.777626
0.023343
You are required to create two arrays using Zig array operators. The first array should be the result of concatenating two arrays: le = [1, 3] and et = [3, 7]. The second array should be created by repeating a specific pattern. The pattern is: 1 0 0 1 1 0 0 1 1 0 0 1. You should use the provided one and zero arrays, al...
glaive
[ 0.016597716137766838, 0.03528834134340286, -0.009025353007018566, -0.028468476608395576, 0.054741960018873215, -0.017960039898753166, -0.02218499779701233, 0.04118724539875984, 0.02275669574737549, -0.021394552662968636, 0.01849992200732231, 0.0150593351572752, -0.03498416766524315, -0.031...
0.812055
0.776969
0.035086
You are to create a function that calculates the Fibonacci sequence up to a given number using the `roption` data type in Lean. Write a function `fibonacci : ℕ → roption ℕ` that takes a natural number `n` and returns an `roption` with the Fibonacci number at index `n`. The Fibonacci sequence is defined as follows: - `...
glaive
[ 0.015157675370573997, 0.027091272175312042, -0.03063291124999523, -0.018379805609583855, 0.0360691137611866, -0.026821786537766457, -0.027318807318806648, 0.07592335343360901, 0.029038848355412483, 0.006349614821374416, 0.033679138869047165, 0.04228240251541138, -0.026556266471743584, -0.0...
0.822642
0.785602
0.03704
You are tasked with implementing a function that simulates the compound assignment operator `+=` in JavaScript. The function should take two parameters, the left-hand side expression and the right-hand side expression, and return the result of applying the `+=` operator to the two expressions. The `+=` operator adds th...
glaive
[ 0.022702589631080627, 0.02767658606171608, -0.03431260213255882, -0.03174000605940819, 0.03491681441664696, -0.004563598427921534, -0.0004978114739060402, 0.07267660647630692, 0.04220966994762421, -0.012025213800370693, 0.01273548323661089, 0.0387393981218338, -0.03978549689054489, -0.0144...
0.798268
0.777278
0.02099
You are tasked with designing a memory (RAM/ROM) module for a hardware implementation. The memory module should have the following specifications: - ID: 33 - Memory name: dct_dct_2d_row_outbuf - Core name: ap_simcore_mem - Port list: 2, 3 - Data width: 16 - Address range: 64 - Address width: 6 - Implementation style: b...
glaive
[ 0.033883802592754364, 0.010786469094455242, -0.04918143153190613, -0.03502608835697174, 0.03487810119986534, -0.051263757050037384, -0.029405727982521057, 0.07543284446001053, 0.04174031689763069, -0.001751509727910161, 0.007167958654463291, 0.0334228090941906, -0.010623148642480373, 0.010...
0.774875
0.756958
0.017917
You are tasked with implementing a parallelized Cholesky decomposition using Pthreads in C. Cholesky decomposition is a method for decomposing a positive definite matrix into the product of a lower triangular matrix and its transpose. The given matrix is represented as a one-dimensional array, and the size of the matri...
glaive
[ 0.020650912076234818, 0.043406594544649124, -0.0336511991918087, -0.015294903889298439, 0.030544493347406387, -0.023314306512475014, -0.032386016100645065, 0.08892491459846497, 0.03629092127084732, -0.018919333815574646, 0.002759015653282404, 0.021730517968535423, -0.013806143775582314, -0...
0.806947
0.773897
0.03305
You are tasked with creating a program using the Rayon library in Rust to find specific elements in a given vector. Write a function that takes in a vector of integers and finds the first occurrence of the following elements: 1. The number 9 2. Any even number greater than 6 3. Any number greater than 8 Your function ...
glaive
[ 0.04250550642609596, 0.03214610740542412, -0.023504003882408142, -0.027004627510905266, 0.027180299162864685, -0.024416496977210045, -0.008784987963736057, 0.07370901107788086, 0.03513708710670471, -0.00968314427882433, 0.03484952822327614, 0.021763689815998077, -0.02772856131196022, -0.01...
0.826715
0.805713
0.021002
You are tasked with creating a subroutine called AMPD that computes or retrieves the value of QHH. The subroutine is expected to take input parameters QJHUA, QHHO, SKJ, GKI, QHH, SCR1, SCR2, SCR3, and SCR4. If QHH already exists in QHHO, the subroutine should copy the value from QHHO to QHH. Otherwise, it should comput...
glaive
[ 0.030311772599816322, 0.013430534861981869, -0.0058891428634524345, -0.030497554689645767, 0.03936123102903366, -0.049650970846414566, -0.010179804638028145, 0.07389573752880096, 0.03853124380111694, -0.010410442017018795, 0.016484417021274567, 0.04482142627239227, -0.02786657214164734, -0...
0.805121
0.785187
0.019934
I need to implement a signed long divide routine in assembly language. The purpose of this routine is to perform a signed long divide of the arguments without changing the arguments themselves. The routine should take the divisor and dividend as input and return the quotient in the EDX:EAX register pair. The routine sh...
glaive
[ 0.024036839604377747, 0.01458683330565691, -0.026408983394503593, -0.020310228690505028, 0.017242278903722763, -0.035783927887678146, -0.024836895987391472, 0.06708745658397675, 0.029512843117117882, -0.02446109987795353, 0.03324391692876816, 0.035907745361328125, -0.017282087355852127, 0....
0.787569
0.772455
0.015114
You are tasked with creating a set of Verilog modules to implement a simple digital circuit. The main module, TOP, has inputs CLK, RST, IN, and IN2, and outputs reg1 and OUT. It also instantiates two submodules, SUB and SUB2. The SUB module has inputs CLK, RST, and IN, and an output OUT1, while the SUB2 module has inpu...
glaive
[ 0.012455537915229797, 0.031085161492228508, -0.03352560102939606, -0.022687887772917747, 0.026287460699677467, -0.03832925856113434, -0.02625001035630703, 0.06439700722694397, 0.02726103737950325, -0.010103781707584858, 0.026012040674686432, 0.038783490657806396, -0.0052456120029091835, -0...
0.799339
0.784334
0.015005
You are tasked with creating a program that prompts the user to input two integer values, representing a range. The program should then output all the integers within that range, inclusive of the input values, in ascending order. Write a program that accomplishes this task using a while loop.
glaive
[ 0.028652330860495567, 0.03852778673171997, -0.03533530235290527, -0.016727596521377563, 0.03016052022576332, -0.02938617579638958, -0.03888772428035736, 0.04833625257015228, 0.0468987375497818, -0.03252996876835823, 0.029212193563580513, 0.046104542911052704, -0.03931024670600891, -0.00923...
0.824207
0.780286
0.043921
You are tasked with implementing a recursive function to calculate the sine of an angle using the given mathematical formula. The function should take an angle in radians as input and return the sine of that angle. The formula for calculating the sine is as follows: sine(angle) = p(sine(angle/3)), if abs(angle) > 0.1 s...
glaive
[ 0.013111002743244171, 0.04193223640322685, -0.02841096930205822, -0.03482793644070625, 0.03205769136548042, -0.02474234625697136, -0.007595745846629143, 0.058338604867458344, 0.03322628512978554, 0.0235461238771677, 0.045011892914772034, 0.03526371717453003, -0.036108240485191345, -0.00941...
0.797174
0.769212
0.027962
You are tasked with implementing a function to differentiate a given function using Lagrange interpolation for a polynomial of 3rd order. The function difcub(x,f,xi) takes in three arrays: x(0:3) containing 4 points x0, x1, x2, x3, f(0:3) containing the function values at those points, and xi containing the point at wh...
glaive
[ 0.012171539478003979, 0.03217005729675293, -0.030034461989998817, -0.0502895787358284, 0.03930579125881195, -0.01858416385948658, -0.017061356455087662, 0.05120339244604111, 0.03644522279500961, -0.005854118149727583, 0.018316343426704407, 0.037068385630846024, -0.037999436259269714, 0.003...
0.801252
0.779949
0.021302
You are tasked with implementing a method for comparing numbers and objects for approximate equality in Common Lisp. The method should compare two numbers A and B for approximate equality, checking corresponding elements when applicable. Two numbers A and B are considered approximately equal if |a-b|/max(1,|a|,|b|) is ...
glaive
[ 0.02822859212756157, 0.021576644852757454, -0.008530257269740105, -0.04635247960686684, 0.041498586535453796, -0.03654789924621582, 0.016342520713806152, 0.05828997865319252, 0.034234050661325455, -0.021315161138772964, 0.034874070435762405, 0.04490159824490547, -0.01829027384519577, -0.00...
0.805112
0.788638
0.016474
You are tasked with implementing a subroutine that performs a triangular solve with transpose in 'BSR'-storage. The subroutine should take in a matrix and a vector, and then perform the solve operation based on the properties and description of the matrix. The matrix and vector are stored in a specific format, and the ...
glaive
[ 0.02970302850008011, 0.009818064980208874, -0.03940734267234802, -0.03887658193707466, 0.03616952523589134, -0.01464889757335186, -0.010918636806309223, 0.07028511166572571, 0.05873951315879822, -0.007235804107040167, 0.02852100133895874, 0.054585229605436325, -0.005016067996621132, 0.0033...
0.805327
0.78986
0.015467
You are tasked with writing a program to find the first set of m consecutive numbers with exactly m prime factors. Your program should take in an integer m and output the m consecutive numbers with exactly m prime factors. If no such set of numbers exists within a given range, your program should indicate so.
glaive
[ 0.027718987315893173, 0.03664815425872803, -0.02304959110915661, -0.04609641432762146, 0.03820409998297691, -0.02114550769329071, -0.021103858947753906, 0.061274752020835876, 0.050370313227176666, -0.04298161342740059, 0.015293019823729992, 0.018363837152719498, -0.033811699599027634, -0.0...
0.827912
0.793316
0.034596
You are tasked with creating a data structure to store statistical information about various system resources. Specifically, you need to define a set of structs to represent CPU statistics, memory information, network interface statistics, TCP and UDP statistics, virtual memory statistics, disk statistics, and process ...
glaive
[ 0.005056675057858229, 0.01050904393196106, -0.04600277543067932, -0.014594724401831627, 0.045783039182424545, -0.023837044835090637, -0.02011914551258087, 0.07875779271125793, 0.045419976115226746, -0.0025709602050483227, 0.016758309677243233, 0.024593820795416832, -0.012582456693053246, 0...
0.790259
0.769009
0.021249
You are tasked with creating a program that takes in a series of numbers and calculates the average of the positive numbers only. You need to implement a function that will take in the series of numbers and return the average of the positive numbers. If there are no positive numbers in the series, the function should r...
glaive
[ 0.004817904904484749, 0.018933000043034554, -0.04640794172883034, -0.028722168877720833, 0.05267561599612236, -0.019287457689642906, -0.03532131016254425, 0.05930640548467636, 0.03341218829154968, -0.019183406606316566, 0.001770156784914434, 0.012785309925675392, -0.02591213770210743, -0.0...
0.80663
0.779652
0.026978
You are tasked with creating a function in F# that takes a list of integers as input and returns the sum of all the even numbers in the list. The function should be named "sumEvenNumbers" and should take in a list of integers as a parameter. Write an F# function that meets the following criteria: - Function name: sumE...
glaive
[ 0.025655413046479225, 0.019534382969141006, -0.030511217191815376, -0.05950188264250755, 0.04804311692714691, -0.022705592215061188, -0.0016720285639166832, 0.039368513971567154, 0.031788721680641174, -0.008285603486001492, 0.012806639075279236, 0.05283626541495323, -0.046980515122413635, ...
0.804714
0.768582
0.036132
How can I create a C++ program that generates an array of integers of size n and finds the sum of the second and fourth elements in the array?
glaive
[ 0.010489413514733315, 0.023678844794631004, -0.02365962043404579, -0.03733624145388603, 0.04076053202152252, -0.017742959782481194, -0.033933524042367935, 0.08168473839759827, 0.0435028113424778, -0.02637464925646782, 0.027017785236239433, 0.041079167276620865, -0.03785894066095352, -0.028...
0.796132
0.773998
0.022134
You are tasked with creating a program to calculate the probability amplitudes and plot the probability distribution for a quantum system with 15 qubits. The system is described by the amplitude and amplitude2 functions, which take two parameters x and y. The probability of measuring a specific state is given by the pr...
glaive
[ 0.009188582189381123, 0.03008618764579296, -0.03009496070444584, -0.029421743005514145, 0.04437100514769554, -0.03262854367494583, -0.023740222677588463, 0.07173818349838257, 0.035364799201488495, -0.0021571675315499306, 0.019137028604745865, 0.03160573169589043, -0.01610354147851467, -0.0...
0.791018
0.764666
0.026352
You are tasked with creating a program to calculate the probability of a quantum system being in a certain state, based on the amplitudes of its wave function. The system has `nqubits` number of qubits, with `nstates` possible states. The amplitudes of the wave function are given by the functions `amplitude[x_,y_]` and...
glaive
[ 0.003772846655920148, 0.024233262985944748, -0.03274625912308693, -0.021676121279597282, 0.040572911500930786, -0.027467213571071625, -0.02028835192322731, 0.06777913868427277, 0.03272285684943199, 0.005446459632366896, 0.02175501175224781, 0.02827787585556507, -0.006981245707720518, -0.01...
0.806007
0.775292
0.030714
I have a table called "CUSTOMERS" with the following schema: CUSTOMERS (id INT, name VARCHAR(10), height VARCHAR(10), weight INT) The "id" column is the primary key. I need to find rows where people have the exact same name, height, and weight. In other words, I want to find duplicates based on the values of the "na...
glaive
[ 0.043585922569036484, 0.042916473001241684, -0.05031733587384224, -0.04003452509641647, 0.015898246318101883, -0.025651775300502777, -0.010194598697125912, 0.056295476853847504, 0.018999388441443443, 0.006178438663482666, 0.022582363337278366, 0.004387089982628822, -0.022336583584547043, -...
0.770037
0.751816
0.018222
You are tasked with implementing a GPU hash function using the Shabal-512 algorithm for X14/X15. The provided code snippet includes the necessary GPU kernel function and CPU function for the Shabal-512 hash algorithm. Your task is to write the complete implementation of the GPU hash function using the given code as a s...
glaive
[ 0.02412116900086403, 0.037982743233442307, -0.0074596162885427475, -0.0199273768812418, 0.0295281819999218, -0.01627073809504509, -0.011881738901138306, 0.08328058570623398, 0.028727557510137558, -0.01221452560275793, 0.0032094966154545546, 0.014620658941566944, 0.0024273041635751724, 0.00...
0.807218
0.789668
0.01755
You have been tasked with implementing a GPU-based sorting algorithm using CUDA for a given code snippet. The goal is to sort an array of characters and return the sorted indices. The input consists of a block of characters and the size of the block. You need to write a function that takes these inputs and returns the ...
glaive
[ 0.023112237453460693, 0.043281350284814835, -0.009740586392581463, -0.021141842007637024, 0.02341419644653797, -0.02788085862994194, -0.03903399035334587, 0.07241624593734741, 0.041408687829971313, -0.021069947630167007, 0.02032969333231449, 0.02089337818324566, -0.009504918940365314, 0.00...
0.809811
0.783314
0.026497
You are tasked with implementing a series of functions using OCaml. The functions to be implemented are as follows: 1. `sqsum`: a function that takes a list of integers and returns the sum of the squares of all the elements in the list. 2. `pipe`: a function that takes a list of functions and a value, and applies each...
glaive
[ 0.009198837913572788, 0.045640382915735245, -0.008724083192646503, -0.0642363503575325, 0.053755756467580795, -0.03139881789684296, -0.013559379614889622, 0.05432654917240143, 0.05422625318169594, -0.004196339752525091, 0.031580980867147446, 0.046394187957048416, -0.01713843084871769, -0.0...
0.804111
0.783838
0.020273
You are tasked with implementing a function that can extract a specific integer type (uint16, uint32, or int32) from a byte slice, taking into account the byte order based on a given boolean flag. The function should be able to handle both little-endian and big-endian byte orders. Write a function named `extractInt` t...
glaive
[ 0.012016728520393372, 0.037699487060308456, -0.023439373821020126, -0.030555205419659615, 0.021974749863147736, -0.032457705587148666, -0.02459084428846836, 0.0708044022321701, 0.05154552310705185, -0.0052850316278636456, 0.02710997499525547, 0.03664427250623703, -0.017843307927250862, -0....
0.807099
0.791525
0.015573
You are tasked with creating a function that takes in a number and returns the square of that number. The function should be implemented using JavaScript and should follow the ES6 syntax. Create a function called "squareNumber" that takes in a parameter "num" and returns the square of that number.
glaive
[ 0.03049493581056595, 0.04654949530959129, -0.03507024794816971, -0.051934823393821716, 0.05599497631192207, -0.007525784429162741, -0.008903704583644867, 0.0602835975587368, 0.02941003255546093, -0.010016735643148422, 0.04020356014370918, 0.039788421243429184, -0.05702268332242966, -0.0180...
0.789295
0.772058
0.017238
You are required to write a Mathematica function that takes a Coxeter matrix M and a string w as arguments. The function should produce a list of all possible reduced words representing w in the Coxeter system associated with M. You need to implement the CoxeterReduce function to achieve this.
glaive
[ 0.03255083039402962, 0.014395717531442642, -0.029639415442943573, -0.04504847899079323, 0.057335373014211655, -0.03460445627570152, -0.014141392894089222, 0.07377047091722488, 0.06200568005442619, -0.008622990921139717, 0.010618219152092934, 0.04183859005570412, -0.017672855406999588, -0.0...
0.805275
0.789783
0.015492
You are working on a project to model the spread of a disease across different countries. Your task is to write a Stan program to estimate the number of deaths due to the disease in each country based on various factors such as the population, age distribution, contact rates, and other relevant parameters. The data inc...
glaive
[ 0.030396893620491028, 0.021238043904304504, -0.05097541958093643, -0.05468592420220375, 0.03289543837308884, -0.013134394772350788, -0.030626706779003143, 0.05514489859342575, 0.025449123233556747, -0.01833799108862877, 0.01252035889774561, 0.05778319761157036, -0.022304542362689972, 0.028...
0.792526
0.772681
0.019845
You are tasked with creating a program that generates a DIT or DIF codelet based on the input provided. The program should take in a number and generate the corresponding codelet. The codelet should specialize for a given input stride, vector stride, and ms. The program should also have the option to reload twiddle fac...
glaive
[ 0.008210239931941032, 0.019624849781394005, -0.02005777694284916, -0.038462135940790176, 0.045353181660175323, -0.036570582538843155, -0.028331536799669266, 0.06876475363969803, 0.05359119921922684, -0.02582620643079281, 0.02920231595635414, 0.02724488079547882, -0.04240862652659416, -0.00...
0.812001
0.790219
0.021782
You are tasked with implementing a binary operation on two matrices using CUDA in C++. The goal is to optimize the performance of the operation by reducing cache misses. You are given two matrices `big2s` and `big3s` of dimensions `m x n` filled with the values 2 and 3 respectively. Additionally, there are two matrice...
glaive
[ 0.007640823256224394, 0.028392117470502853, -0.04027557373046875, -0.008445716463029385, 0.03494923934340477, -0.0026950708124786615, -0.03339819237589836, 0.12545688450336456, 0.04577259719371796, -0.012026242911815643, 0.014758718200027943, 0.022427532821893692, 0.00429411930963397, 0.00...
0.798721
0.774136
0.024585
You have been tasked with implementing a concurrent hash table (cht) in C++ using CUDA, which is a parallel computing platform and application programming interface model created by Nvidia. The cht class is a concurrent hash table that supports insert, find, and clear operations. It uses four hash functions to distribu...
glaive
[ 0.03641575574874878, 0.038964081555604935, -0.009330084547400475, -0.00019862419867422432, 0.03759431838989258, -0.01528625562787056, -0.027196887880563736, 0.10688614845275879, 0.05145328491926193, -0.032142359763383865, 0.01532345823943615, 0.032713230699300766, 0.008612938225269318, 0.0...
0.792195
0.772296
0.019899
You are tasked with implementing a scoring system for a bridge game. The system should calculate the scores for each team based on the level of the contract, the trump type, doubling status, and the number of tricks made. You need to create a ScoreKeeper object with the following functionalities: - AddResult(team:team...
glaive
[ 0.014228652231395245, 0.01647060737013817, -0.03130898252129555, -0.050146158784627914, 0.060988351702690125, -0.04036932811141014, -0.01913372427225113, 0.07083866000175476, 0.04217272996902466, -0.021654045209288597, 0.017421526834368706, 0.0494169145822525, -0.018819591030478477, 0.0046...
0.797852
0.772952
0.024901
In a quantum computing environment, you are given a list of quantum gate operations represented by IBMGateSet.coq_IBM_ucom_l. Your task is to optimize the 1-qubit gates in the list by applying certain transformation rules. Specifically, you need to implement the optimize_1q_gates' function, which takes the following pa...
glaive
[ 0.013511697761714458, 0.052575867623090744, -0.02812906913459301, -0.01872526854276657, 0.03755901753902435, -0.04080502316355705, -0.039057888090610504, 0.0521719790995121, 0.031060805544257164, -0.0026249783113598824, 0.0009716195054352283, 0.0133883748203516, -0.01833195984363556, 0.007...
0.812185
0.785545
0.026641
I need help writing an algorithm that can find the largest number in a given array of numbers. Can you provide a solution?
glaive
[ 0.025741202756762505, 0.02727554365992546, -0.026768602430820465, -0.03535251319408417, 0.03304348513484001, -0.035766880959272385, -0.030279966071248055, 0.03875172138214111, 0.02705422043800354, -0.0331590510904789, 0.02587893232703209, 0.010827364400029182, -0.03414582088589668, -0.0145...
0.802796
0.774686
0.02811
You are tasked with implementing a function ILACLR that scans a given matrix for its last non-zero row. The function should take the number of rows, M, the number of columns, N, the matrix A, and the leading dimension of the array A, LDA, as input arguments. The matrix A is represented as a two-dimensional array of com...
glaive
[ 0.012216847389936447, 0.04209808260202408, -0.022337084636092186, -0.047914788126945496, 0.04004207253456116, 0.007503248751163483, -0.043244361877441406, 0.06047413870692253, 0.03248469531536102, -0.008274600841104984, 0.007332762237638235, 0.0246647410094738, -0.027666373178362846, -0.00...
0.805561
0.773411
0.03215
You are tasked with creating a program to find the maximum value of a given function within a certain range, and then plot the function in 3D and as a contour plot. The function to be used is as follows: function[x, y] := $Conjugate[Exp[11 I y/2] (1 (-I Sin[x])^5 Cos[x]^7 + ... (long expression) You are also required...
glaive
[ 0.02734268642961979, 0.030636180192232132, -0.051014892756938934, -0.03566138818860054, 0.039946384727954865, -0.022758645936846733, -0.01972709596157074, 0.05871184170246124, 0.04693641886115074, 0.0071600694209337234, 0.03051208332180977, 0.05492576211690903, -0.03595336154103279, -0.000...
0.794088
0.766395
0.027692
Can you provide a program that finds all unique triplets in an array whose sum is zero?
glaive
[ 0.0030274358578026295, 0.02904648147523403, -0.03099503554403782, -0.040840230882167816, 0.03872565180063248, -0.029353510588407516, -0.00990423746407032, 0.03553396835923195, 0.03441610932350159, -0.03790736943483353, 0.019016792997717857, 0.012875298969447613, -0.02645713835954666, -0.03...
0.807704
0.788543
0.019162
You are tasked with creating a program that calculates the area of a circle. The program should take the radius of the circle as input and then output the area. You should ensure that your program includes error handling for invalid input, such as negative radius values.
glaive
[ 0.001836518757045269, 0.040552325546741486, -0.03622012585401535, -0.011616650968790054, 0.03475087881088257, -0.013726649805903435, -0.030229559168219566, 0.046520158648490906, 0.04057556763291359, -0.011296610347926617, 0.026409434154629707, 0.039553508162498474, -0.026082536205649376, -...
0.775805
0.751528
0.024277
You are required to implement a CUDA kernel for computing the Jacobian determinant associated with a tridimensional displacement field. The Jacobian is a scalar map defined on a grid with the same size as the image. It is computed by approximating partial derivatives with first-order central differences. The displaceme...
glaive
[ -0.0017304208595305681, 0.033114757388830185, -0.03531740605831146, -0.02734673209488392, 0.02724660374224186, -0.017562637105584145, -0.009845316410064697, 0.09116905182600021, 0.046832405030727386, -0.015457033179700375, 0.035929836332798004, 0.03192988783121109, -0.011613300070166588, -...
0.800174
0.784807
0.015367
You are tasked with implementing a new function called `calculate_distance` in a programming language that supports object-oriented programming. This function should take in two parameters, `x` and `y`, which are both arrays of integers representing the x and y coordinates of two points. The function should calculate t...
glaive
[ -0.006722459569573402, 0.042615871876478195, -0.027804173529148102, -0.04093128815293312, 0.05358073115348816, -0.022991232573986053, -0.042703352868556976, 0.04924030974507332, 0.060461197048425674, -0.026335107162594795, 0.02358272671699524, 0.039156198501586914, -0.008791879750788212, 0...
0.802586
0.774002
0.028585
You are tasked with writing a program to solve the following mathematical expression: (5 + 4 + (2 - (3 - (6 + 4/5)))) / (3 * (6 - 2) * (2 - 7)) Write a function that takes no input and returns the result of the above expression. The function should be accurate to at least 5 decimal places.
glaive
[ 0.046616557985544205, 0.03237329050898552, -0.04126948118209839, -0.05569782853126526, 0.05762776732444763, -0.02425422891974449, -0.026883147656917572, 0.0659128874540329, 0.056577928364276886, -0.018425889313220978, 0.022459782660007477, 0.03669793903827667, -0.014173084869980812, -0.024...
0.825952
0.798149
0.027804
I am trying to create a program that generates and solves mazes. The maze is represented as a grid, and each cell in the grid can have walls that block movement. The program should be able to generate the maze and then find a path from the top-left corner to the bottom-right corner. I need to implement the following f...
glaive
[ 0.01898064836859703, 0.031974080950021744, -0.019143763929605484, -0.035980984568595886, 0.03869292512536049, -0.02686483785510063, -0.026147769764065742, 0.045595504343509674, 0.03679069131612778, -0.009687033481895924, 0.028485752642154694, 0.028611326590180397, -0.02652619034051895, -0....
0.808252
0.788304
0.019948
You are tasked with implementing a function to generate a set of windowed sincs for a given number of points, oversampling factor, cutoff frequency, and window function. The sinc function is defined as sinc(x) = sin(πx)/(πx) and the windowed sincs are calculated using this function and a specified window function. The ...
glaive
[ 0.02056042291224003, 0.03803078457713127, -0.021236147731542587, -0.012678387574851513, 0.0476967878639698, -0.019077695906162262, -0.017732560634613037, 0.0487213209271431, 0.02628319524228573, 0.01246098056435585, 0.03663961961865425, 0.050574369728565216, -0.038856055587530136, 0.011433...
0.809497
0.784379
0.025119
You are tasked with implementing a queue data structure using CUDA (Compute Unified Device Architecture) for parallel processing on GPUs. The queue should be able to enqueue and dequeue elements in a parallel and thread-safe manner. The queue should also support additional data associated with each element and should b...
glaive
[ 0.017028488218784332, 0.022119509056210518, -0.013561433181166649, -0.016194285824894905, 0.023738017305731773, -0.023091929033398628, -0.039669863879680634, 0.1115528792142868, 0.0473816953599453, -0.018896518275141716, 0.04012177512049675, 0.03709166869521141, -0.011809354647994041, 0.00...
0.804758
0.785626
0.019133
You are required to create a CUDA C program to calculate the bandwidth for pageable or pinned memory from host-to-device and device-to-host for a given range in MB/s. The program should take the following inputs: - Memory mode: 0 for pageable, 1 for pinned - Start data size in bytes - End data size in bytes - Incremen...
glaive
[ 0.0177106074988842, 0.04272007942199707, -0.036464594304561615, -0.021426929160952568, 0.02514668181538582, -0.033879589289426804, -0.04171092063188553, 0.08519172668457031, 0.050468191504478455, -0.02588038519024849, 0.005938326939940453, 0.06006697565317154, -0.014027810655534267, -0.005...
0.790846
0.775573
0.015274
You are tasked with implementing a C++ function that performs a bitwise right shift operation on an array of integers. The function should take in the input array, the output array, and the number of bits to shift. The bitwise right shift operation should shift all the bits in each integer to the right by the specified...
glaive
[ 0.031202567741274834, 0.03214452788233757, -0.013263015076518059, -0.01087806187570095, 0.031521111726760864, -0.01483374834060669, -0.03152574226260185, 0.0903109535574913, 0.05913062021136284, -0.015325630083680153, 0.012342922389507294, 0.024312390014529228, -0.019825072959065437, -0.00...
0.805323
0.776465
0.028858
You are tasked with writing a program that calculates the real part of the expression (1 + n*i)^5, where n is a given integer. The program should take an input integer n and output the real part of the expression. For example, if n = 2, the program should calculate the real part of (1 + 2i)^5 and output the result. W...
glaive
[ 0.04264393076300621, 0.05293577164411545, -0.02866250090301037, -0.04094807803630829, 0.033453427255153656, -0.03363480418920517, -0.0025316078681498766, 0.08858297020196915, 0.0438639335334301, -0.012150418944656849, 0.029456255957484245, 0.03452331945300102, -0.04716908559203148, -0.0178...
0.816773
0.780093
0.03668
You are tasked with implementing a function that converts a given array of valid type to a binary string representation. The function should take the array of valid type and the column size as input, and output a string representing the binary values of the valid type array. Write a function with the following signatu...
glaive
[ 0.0020048676524311304, 0.03516899049282074, -0.0036737965419888496, -0.04545936360955238, 0.05154676362872124, -0.04088941216468811, -0.008093851618468761, 0.10749787837266922, 0.0517067052423954, -0.019106091931462288, 0.025760261341929436, 0.040446456521749496, -0.009739634580910206, -0....
0.797631
0.779312
0.018319
You are required to implement parallel graph coloring using CUDA. The graph is represented as a set of vertices and edges, with each vertex needing to be assigned a color such that no adjacent vertices have the same color. The main components of the problem include: - `assignColorsKernel`: A kernel function that assi...
glaive
[ -0.0021273773163557053, 0.048213206231594086, -0.002679530531167984, -0.016221661120653152, -0.0012007002951577306, 0.0023359586484730244, -0.031212640926241875, 0.08268046379089355, 0.04240060970187187, -0.021126171573996544, 0.029384011402726173, 0.035240013152360916, 0.02544122189283371, ...
0.795488
0.778357
0.017132
You are tasked with writing a program that performs forward computation on a Long Short-Term Memory (LSTM) neural network using CUDA for parallel processing. The program should take the number of hidden nodes and the number of iterations as command line arguments, and then measure the time it takes to perform the forwa...
glaive
[ 0.007095560431480408, 0.030279692262411118, -0.027796803042292595, -0.025595061480998993, 0.022176457569003105, -0.0017003632383421063, -0.04400133341550827, 0.07584930211305618, 0.029723340645432472, -0.022427557036280632, 0.019631285220384598, 0.04147668927907944, -0.013385241851210594, ...
0.804583
0.788428
0.016155
You are tasked with implementing a program that simulates folding a piece of paper. The paper is represented as a grid of dots, and each fold is defined by a line along which the paper is folded. The folds are performed in sequence, and the final result is the pattern of dots on the paper after all the folds have been ...
glaive
[ 0.017777448520064354, 0.04402591660618782, -0.019781125709414482, -0.04517084360122681, 0.040383078157901764, -0.023307567462325096, -0.01838717609643936, 0.048496004194021225, 0.033037055283784866, -0.012331675738096237, 0.027504343539476395, 0.029219189658761024, -0.018843891099095345, -...
0.816382
0.789686
0.026696
: You are tasked with writing a program that performs a non-parametric test on a given dataset. The dataset consists of a list of observations, where each observation is labeled as either "A" or "B". Your task is to implement a Wilcoxon rank sum test to compare the two groups and determine if there is a significant dif...
glaive
[ 0.004117400385439396, -0.009889574721455574, -0.036128751933574677, -0.04591135308146477, 0.035849932581186295, -0.01573893241584301, 0.012668541632592678, 0.06816922873258591, 0.05296223610639572, -0.02666459232568741, 0.011056168004870415, 0.03385596722364426, -0.009206527844071388, 0.02...
0.799663
0.781929
0.017734
You are tasked with creating a program to generate the sequence A056640. At stage 1, start with a unit square. At each successive stage, add 4*(n-1) new squares around the outside with edge-to-edge contacts. The sequence gives the number of squares (regardless of size) at the n-th stage. Your program should be able to ...
glaive
[ 0.018081896007061005, 0.04375695437192917, -0.024059606716036797, -0.039029039442539215, 0.03913303092122078, 0.0015836417442187667, -0.030410394072532654, 0.0805601254105568, 0.03843351826071739, -0.02044788934290409, 0.01699068769812584, 0.03506864979863167, -0.05002139136195183, -0.0297...
0.829123
0.784509
0.044613
You are working on a project that requires you to implement a data structure to represent and perform operations on non-negative integers, including addition and multiplication. The data structure should support the concept of infinity to represent numbers beyond a certain limit, and it should be able to handle both fi...
glaive
[ 0.019415253773331642, 0.0011640817392617464, -0.04040209576487541, -0.02880002371966839, 0.03526163846254349, -0.019049040973186493, -0.02057451754808426, 0.060173727571964264, 0.035692594945430756, -0.021976051852107048, 0.017945226281881332, 0.017259296029806137, -0.01634514331817627, -0...
0.808395
0.788419
0.019976
You are tasked with creating a program that calculates the probability distribution of a quantum state for a given number of qubits and states. The program should use a specified method for optimization and generate 3D and contour plots to visualize the probability distribution.
glaive
[ -0.003501245751976967, 0.02416878379881382, -0.04594290256500244, -0.024871164932847023, 0.040180373936891556, -0.015238187275826931, -0.03196484223008156, 0.06291038542985916, 0.03548591956496239, -0.013377433642745018, 0.025476284325122833, 0.038820959627628326, -0.01923942007124424, -0....
0.794491
0.773062
0.021429
You are tasked with matching a fixed number of controls to each patient based on a specific condition. You are guaranteed that at least 2 controls with a weight greater than 40 lbs are available for each case. Your goal is to create a program that will merge the case and control datasets, and then output only the contr...
glaive
[ 0.008673829957842827, 0.010520678013563156, -0.060439325869083405, -0.03279389068484306, 0.026410290971398354, -0.01538600493222475, -0.017092501744627953, 0.0834217518568039, 0.04747691750526428, -0.015742449089884758, 0.02294853888452053, 0.04572022333741188, -0.012483554892241955, 0.006...
0.82203
0.804888
0.017142
You are tasked with creating a Lisp program that calculates the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. Your program should take an input from the user and output the factorial of that number. Write a function called factor...
glaive
[ 0.02839898318052292, 0.037763942033052444, -0.02588319592177868, -0.03347764536738396, 0.04729903116822243, -0.03481835499405861, -0.014974049292504787, 0.04197591915726662, 0.0523495152592659, -0.009174806997179985, 0.02546730637550354, 0.05740085244178772, -0.039196811616420746, -0.02087...
0.805756
0.783052
0.022704
What is the C++ code to find the maximum number in an array?
glaive
[ 0.014582755975425243, 0.0309627503156662, -0.030146777629852295, -0.027626005932688713, 0.032439813017845154, -0.02360086888074875, -0.023964542895555496, 0.07292254269123077, 0.027333589270710945, -0.038275692611932755, 0.02221834845840931, 0.048576731234788895, -0.029826143756508827, -0....
0.799715
0.773406
0.026309
I have a table called "emp" with the following structure: | EmpNo | Ename | Salary | DeptNo | |-------|-------|--------|--------| | 1 | John | 1000 | 10 | | 2 | Anna | 2000 | 10 | | 3 | Mark | 1500 | 12 | | 4 | Alice | 500 | 12 | | 5 | Emma | 3000 | 15 | | 6 |...
glaive
[ 0.03978567197918892, 0.02549062669277191, -0.049357008188962936, -0.03613583371043205, 0.03185134381055832, -0.019712503999471664, -0.016903026029467583, 0.06586197763681412, 0.027832694351673126, -0.012843682430684566, 0.039941687136888504, 0.026345744729042053, -0.05155840888619423, -0.0...
0.772586
0.756844
0.015742
You are tasked with developing a CUDA kernel for a local planar guidance algorithm. The kernel should take in input data, focal length, and output depth data. The input data is a 4-channel float array, the focal length is a float array, and the output depth data is a float array. The CUDA kernel should calculate the de...
glaive
[ -0.01166748907417059, 0.051805559545755386, -0.03246575593948364, -0.02602972835302353, 0.04672995209693909, -0.01011607889086008, -0.02646722085773945, 0.07757681608200073, 0.03629558905959129, -0.019644446671009064, 0.033905766904354095, 0.0437222458422184, -0.008894353173673153, 0.00182...
0.789762
0.77339
0.016371
You are tasked with implementing a set of functions to convert a matrix from one format to another. The functions take a variety of input types including double, float, and complex numbers. The input parameters include the number of walkers, the number of k-points, the maximum number of molecular orbitals, the total nu...
glaive
[ 0.03523630276322365, 0.028227215632796288, -0.0340559296309948, -0.037235699594020844, 0.04048072546720505, -0.04867228865623474, -0.025406157597899437, 0.04910149425268173, 0.05120740458369255, -0.004089052323251963, 0.01761036179959774, 0.029167423024773598, -0.01942172273993492, -0.0015...
0.81026
0.789389
0.020871
I have a table called "TopTen" that stores player performance data. The table has the following columns: id (auto-incremented primary key), home (unsigned integer), datetime (datetime), player (string), and resource (integer). I want to write a query that will return the rows for each distinct "home" value, while only ...
glaive
[ 0.0521392896771431, 0.053651273250579834, -0.046819161623716354, -0.0021113213151693344, 0.015583310276269913, -0.03311502933502197, -0.02131747081875801, 0.0702010840177536, 0.0370679572224617, -0.00651527801528573, 0.03003556840121746, 0.04845204949378967, -0.03603540360927582, -0.004892...
0.781537
0.762935
0.018602
You are required to create a program that calculates the maximum value of a given function over a specified range of input variables. The function is defined as follows: ```mathematica function[x_, y_] := $Conjugate[Exp[-15 I y] (1 (I Sin[x])^7 Cos[x]^8 + 1 (I Sin[x])^8 Cos[x]^7) + Exp[-11 I y] (38 (I Sin[x])^6 Cos[x]...
glaive
[ 0.027595870196819305, 0.043146852403879166, -0.04363264515995979, -0.038348980247974396, 0.03842591494321823, -0.011522643268108368, -0.026875721290707588, 0.05468205735087395, 0.05260683596134186, -0.0010272449580952525, 0.0365447923541069, 0.0413607694208622, -0.034410156309604645, -0.01...
0.81147
0.771812
0.039657
You are tasked with implementing an 8-bit adder-subtractor in VHDL. The adder-subtractor should take two 8-bit input vectors, a and b, along with an additional input add_sub, which determines whether the operation is an addition or a subtraction. The output should include the sum of the two input vectors and the carry ...
glaive
[ 0.01943913660943508, 0.030682874843478203, -0.004478492308408022, -0.03708893060684204, 0.045593563467264175, -0.01112618949264288, -0.023381758481264114, 0.08502852916717529, 0.0733930692076683, -0.01827973499894142, -0.006954129785299301, 0.02468690648674965, -0.027536673471331596, -0.00...
0.801284
0.777711
0.023573
You are tasked with creating an animation of a visualization using the R programming language. The animation will depict the transformation of a set of x, y coordinates over a series of iterations. The animation should start with an initial state and gradually transition to a final state. Your task is to write R code ...
glaive
[ -0.005891941487789154, 0.04798197001218796, -0.008790554478764534, -0.04908042028546333, 0.018497811630368233, -0.024327900260686874, -0.037149570882320404, 0.08447924256324768, 0.03666864335536957, -0.01069892942905426, 0.026628270745277405, 0.00903807021677494, -0.024676570668816566, 0.0...
0.788432
0.770653
0.017779
You are tasked with writing a program to generate a sequence of numbers based on the following recursive formula: a(n) = a(n-1)*(2n-1) + 2n with a(0)=0. The initial terms of the sequence are as follows: 0,2,10,56,400,3610,39722,516400,7746016,131682290,2501963530,52541234152,1208448385520,30211209638026,815702660226730...
glaive
[ 0.02792241983115673, 0.054238371551036835, -0.013584770262241364, -0.049965277314186096, 0.01899614930152893, -0.02331293560564518, -0.03443501889705658, 0.07513732463121414, 0.02262048050761223, -0.035532765090465546, 0.03569171950221062, 0.034078240394592285, -0.037964336574077606, -0.01...
0.82565
0.768576
0.057074
You are tasked with implementing a program that simulates feedback amplification of signals using a series of amplifiers. Each amplifier has its own phase setting, and the input signal is passed through each amplifier in sequence. The output of one amplifier becomes the input of the next amplifier. The amplifiers are c...
glaive
[ 0.018699755892157555, 0.03443409875035286, -0.022076541557908058, -0.0314386822283268, 0.034356776624917984, -0.03341678902506828, -0.022052718326449394, 0.07426442205905914, 0.033676110208034515, -0.020257286727428436, 0.020230673253536224, 0.03951755538582802, -0.028945645317435265, -0.0...
0.827995
0.804729
0.023265
You are tasked with implementing a CUDA kernel for elementwise multiplication gradient computation. The function signature for the CUDA kernel is as follows: ```cpp template <typename T> static __global__ void SimpleElemwiseMulGradCUDAKernel(const T* x, const T* y, ...
glaive
[ 0.004913663025945425, 0.055112771689891815, -0.0029602053109556437, -0.028000837191939354, 0.03447313606739044, -0.015482312999665737, -0.023358488455414772, 0.11151740700006485, 0.04101209715008736, -0.018641425296664238, 0.029381850734353065, 0.04869342967867851, -0.017912482842803, -0.0...
0.797373
0.77736
0.020013
You are tasked with implementing a ray-triangle intersection algorithm using CUDA C++ for a 3D rendering application. Your goal is to write a function that can determine if a given ray intersects with any triangle in a given geometry, as well as find the closest intersection if there is one. The function should take as...
glaive
[ 0.044950176030397415, 0.03985379636287689, -0.00859413854777813, -0.02164376713335514, 0.025419512763619423, 0.0024947745259851217, -0.03104545548558235, 0.09025932848453522, 0.05834824964404106, -0.016854189336299896, 0.03755800053477287, 0.022095726802945137, 0.01034450437873602, -0.0282...
0.795098
0.772148
0.022951
Can you help me design a function that can generate all prime numbers less than a given number 'n'?
glaive
[ 0.013697640039026737, 0.02264147624373436, -0.021778911352157593, -0.04077837988734245, 0.02364269085228443, -0.046221714466810226, -0.010168556123971939, 0.04786818102002144, 0.035964928567409515, -0.017039624974131584, 0.015148052014410496, 0.03238243609666824, -0.032649341970682144, -0....
0.804546
0.788646
0.0159