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
How can I create an algorithm to find the maximum sum of a subarray in an array of integers?
glaive
[ 0.017355501651763916, 0.02236989140510559, -0.03242834284901619, -0.026524756103754044, 0.04108801856637001, -0.022038260474801064, -0.03512763977050781, 0.03620673716068268, 0.024739135056734085, -0.03526231646537781, 0.027918020263314247, 0.02956152707338333, -0.03643939644098282, -0.010...
0.807387
0.776541
0.030846
You are tasked with creating a program that reads a file containing binary strings and performs certain operations on the data. The file contains multiple lines of binary strings, and your program needs to calculate the frequency of '0's and '1's at each position across all the strings. You will then use these frequenc...
glaive
[ 0.004686946049332619, 0.025158371776342392, -0.031080948188900948, -0.014014462009072304, 0.04635673388838768, -0.03345877304673195, -0.007334711961448193, 0.07923948019742966, 0.0298544242978096, 0.006220405455678701, 0.0015892030205577612, 0.0262040626257658, -0.019893480464816093, -0.00...
0.82106
0.794008
0.027051
You are tasked with implementing a matrix-vector multiplication operation using CSR (Compressed Sparse Row) and COO (Coordinate List) matrix formats. You will be given a matrix A and a vector x, and your goal is to compute the product b = A * x. The matrix A is represented by its row offsets, column indices, and valu...
glaive
[ 0.02729029953479767, 0.04613111913204193, -0.03240097314119339, -0.04193292558193207, 0.04473273828625679, -0.010817469097673893, -0.022369686514139175, 0.08388964086771011, 0.032302990555763245, -0.019745294004678726, 0.008499570190906525, 0.013848062604665756, -0.017341841012239456, -0.0...
0.808984
0.782572
0.026413
You are tasked with implementing a CUDA kernel for a three-interpolation operation. The operation involves performing a weighted sum of elements in a 3D tensor based on given indices and weights. Your task is to implement the CUDA kernel for both the forward and backward passes of this operation. The forward pass (KeT...
glaive
[ 0.014304164797067642, 0.04610808193683624, -0.012166989035904408, -0.03136337175965309, 0.03229714184999466, -0.001118720043450594, -0.005806317087262869, 0.0995534360408783, 0.04128490760922432, -0.022819671779870987, 0.04140530154109001, 0.03913335129618645, -0.02966519072651863, -0.0068...
0.802305
0.786835
0.015471
You are tasked with implementing a function to calculate the sum of all the elements in an array using the reduce method. The array will contain only numbers, and the function should return the total sum of all the elements in the array. Write a function named "calculateSum" that takes an array of numbers as input and...
glaive
[ 0.008745558559894562, 0.046364281326532364, -0.04030879586935043, -0.03786681964993477, 0.0711834654211998, -0.03221723437309265, -0.00914109218865633, 0.04521621763706207, 0.04293222352862358, 0.00961198192089796, 0.011776093393564224, 0.026503270491957664, -0.047639399766922, -0.01130296...
0.789026
0.758035
0.030991
You are tasked with creating a C# program that generates a random shooting range score for a player. The program should generate a random score between 0 and 100 and display the result to the user.
glaive
[ -0.00010524817480472848, 0.020757317543029785, -0.029572470113635063, -0.03944242000579834, 0.03410881757736206, -0.04294271767139435, -0.036265138536691666, 0.05809749290347099, 0.03938451409339905, -0.023953238502144814, 0.018427709117531776, 0.044896434992551804, -0.04126322269439697, -...
0.773704
0.757908
0.015796
You are tasked with implementing a Bayesian linear regression model using the Stan programming language. The model should take input data consisting of the number of observations (N), a vector of heights, and a vector of weights. The parameters of the model include alpha, beta, and sigma. The model should be defined su...
glaive
[ 0.006684424355626106, 0.012011006474494934, -0.04571733996272087, -0.05854552611708641, 0.045377787202596664, -0.022962916642427444, -0.021536674350500107, 0.06486671417951584, 0.042236827313899994, -0.015819666907191277, 0.0014672024408355355, 0.05024708807468414, -0.01647704280912876, 0....
0.783914
0.769325
0.014589
You are tasked with creating a power switch setup program that calculates the horizontal pitch based on the flatten effort and polypitch values. If the flatten effort is 0, the horizontal pitch should be calculated as 260 times the value of polypitch_x, otherwise, it should be 320 times the value of polypitch_x. Additi...
glaive
[ 0.024385135620832443, 0.01637672819197178, -0.03392981365323067, -0.0389346145093441, 0.02442643605172634, -0.031698357313871384, -0.014341418631374836, 0.056717704981565475, 0.046348702162504196, -0.02078223042190075, 0.030386224389076233, 0.024716993793845177, -0.03683486208319664, -0.01...
0.792076
0.777492
0.014584
You are required to implement a program that calculates the maximum probability of a quantum state using the given amplitude function. The program should use the NMaximize function to find the maximum probability, and then plot a 3D graph and a contour plot to visualize the probability distribution.
glaive
[ 0.014427819289267063, 0.025587784126400948, -0.035599485039711, -0.030002346262335777, 0.03913496807217598, -0.023063385859131813, -0.024536876007914543, 0.07439012825489044, 0.03834007680416107, 0.0009450669167563319, 0.02792244590818882, 0.036504972726106644, -0.01623808965086937, -0.014...
0.804847
0.789183
0.015665
You are tasked with writing a program to calculate the value of a sequence based on the following formula: a(n) = ceiling( (1 + n + 2*n^2 + 4*n^3)/(1 + 2*n + n^2) ) Your program should take an input 'n' and output the corresponding value of a(n).
glaive
[ 0.02359997108578682, 0.02968010865151882, -0.036726173013448715, -0.024243570864200592, 0.03337547183036804, -0.03252032771706581, -0.032917607575654984, 0.06456469744443893, 0.025024758651852608, -0.022453414276242256, 0.025070607662200928, 0.04337690398097038, -0.05302828550338745, -0.00...
0.836982
0.783592
0.05339
You are tasked with creating a function that multiplies two matrices, one of which is a special distributed matrix called a "shaq". The function should check if the matrices are conformable for multiplication and then perform the multiplication. The shaq matrix is distributed identically and the operation should be com...
glaive
[ 0.0294745322316885, 0.04085005819797516, -0.029614515602588654, -0.03371008113026619, 0.04003440961241722, 0.007913446053862572, -0.006299744825810194, 0.07538335770368576, 0.02845143713057041, -0.006850766483694315, 0.00213648471981287, 0.03323274105787277, -0.035072777420282364, -0.01430...
0.808397
0.786999
0.021398
You are tasked with creating a program to calculate the probability distribution of a quantum system with a given number of qubits and states. The system is defined by the amplitude function and the probability function, which are provided in the code snippet below. Your task is to write a program that uses the provide...
glaive
[ 0.0063429963774979115, 0.022971205413341522, -0.03477807343006134, -0.021736158058047295, 0.05340205878019333, -0.03727693483233452, -0.02652340568602085, 0.06409566104412079, 0.0403999462723732, -0.006662789266556501, 0.021780533716082573, 0.030964624136686325, -0.015133349224925041, -0.0...
0.802276
0.776232
0.026043
You are given a simple graph represented by a set of vertices and edges. You need to implement a function to delete a set of edges from a given subgraph of the graph. Implement a function `deleteEdges` that takes a subgraph `G'` and a set `s` of vertex pairs representing edges, and returns a new subgraph with the spec...
glaive
[ 0.017623769119381905, 0.03140432760119438, -0.014057628810405731, -0.025288928300142288, 0.03394709527492523, -0.04730558022856712, -0.024270182475447655, 0.04122242331504822, 0.05752726271748543, 0.006652675569057465, 0.024849791079759598, -0.008970783092081547, -0.021614599972963333, -0....
0.793636
0.761337
0.032299
You are tasked with implementing an XOR gate for a specific size and count in VHDL. The gate should take in four input vectors (in0, in1, in2, in3) and produce an output vector (q) of the same size and count. Additionally, a constant vector (const) of size should be provided as input. The size and count are specified a...
glaive
[ 0.03920764476060867, 0.02692730538547039, -0.007698718458414078, -0.025664623826742172, 0.02405601367354393, -0.0437186174094677, -0.04038438946008682, 0.07809397578239441, 0.036777179688215256, -0.011392884887754917, 0.024819135665893555, 0.039575789123773575, -0.016346311196684837, -0.00...
0.807776
0.782614
0.025161
You are tasked with implementing a function in Stan that calculates the detectable antibodies based on cumulative infections and vaccinations. The function should take in the following parameters: - A vector of new infections - A vector of new vaccinations - A real number representing the proportion (0 - 1) that seroco...
glaive
[ 0.04636900871992111, 0.04148370400071144, -0.03867731988430023, -0.04393695294857025, 0.04418173432350159, -0.046354614198207855, -0.03466273099184036, 0.09315270930528641, 0.0369826965034008, -0.0025007985532283783, 0.01855958066880703, 0.04148930311203003, -0.024853920564055443, -0.00304...
0.800218
0.77587
0.024348
Is there a way to create a Java class that can store integer values in a circular array?
glaive
[ 0.0030271788127720356, 0.02684783935546875, -0.039994873106479645, -0.027684316039085388, 0.037301067262887955, -0.04263809323310852, -0.033442381769418716, 0.040334951132535934, 0.02710096351802349, -0.04834765940904617, 0.03566381707787514, 0.02312565967440605, -0.040490590035915375, -0....
0.789819
0.774725
0.015095
You are required to write a function in R or Python that creates a matrix and performs certain operations on it. The function should: - Create three vectors of length 3 named 'a', 'b', and 'c', with random integer values between 0 and 9. - Combine these three vectors into a 3x3 matrix and calculate its determinant. - C...
glaive
[ 0.013103693723678589, 0.0222038384526968, -0.047249652445316315, -0.04866110906004906, 0.058448050171136856, -0.010147776454687119, -0.02884235605597496, 0.08976265043020248, 0.024762526154518127, -0.009644461795687675, -0.00375632313080132, 0.031408652663230896, -0.03730514273047447, -0.0...
0.788452
0.772236
0.016216
You are tasked with implementing a set of rules for manipulating binary vectors in a programming language that includes specific functions and operations. Your task is to write the code for the following rules: 1. Implement the function to extract specific bits from an integer. The function should return the specified ...
glaive
[ 0.02816099114716053, 0.030572766438126564, -0.00736564677208662, -0.0058108787052333355, 0.0336870402097702, -0.02913099154829979, -0.019150959327816963, 0.062094587832689285, 0.0360855869948864, -0.022361688315868378, 0.008615096099674702, 0.025484425947070122, -0.02073974534869194, -0.00...
0.807902
0.786421
0.021481
You are tasked with creating a function to generate a color map based on a given input value. The color map should consist of red, green, and blue values, each of which is calculated separately based on the input value. The function should then return a vector with the calculated red, green, and blue values, clamped be...
glaive
[ 0.006518654525279999, 0.04267115518450737, -0.013880089856684208, -0.04144050180912018, 0.028824424371123314, -0.02837047167122364, -0.041836291551589966, 0.06750019639730453, 0.03909295052289963, -0.013138849288225174, 0.03691085800528526, 0.03762541338801384, 0.005665587726980448, 0.0022...
0.795398
0.778059
0.017339
You are tasked with creating a program that calculates the probability of a quantum state. The program should include a function to calculate the probability amplitude for a given set of quantum state variables, a function to calculate the probability based on the amplitude, and a function to find the maximum probabili...
glaive
[ -0.004012625198811293, 0.033394526690244675, -0.03420687094330788, -0.02062000147998333, 0.05126054584980011, -0.01934569887816906, -0.01834128424525261, 0.07226525247097015, 0.03157699108123779, -0.0005177190178073943, 0.023476475849747658, 0.03320544585585594, -0.011235752142965794, -0.0...
0.79149
0.768052
0.023438
Can you provide me with an algorithm to determine if a given number is even?
glaive
[ 0.020533209666609764, 0.0016860458999872208, -0.02004813589155674, -0.039696983993053436, 0.025381773710250854, -0.037787094712257385, -0.012972286902368069, 0.04836483672261238, 0.03055271878838539, -0.042569030076265335, 0.016261618584394455, 0.027647050097584724, -0.04775504395365715, -...
0.789551
0.770856
0.018695
You are tasked with creating a program that optimizes the cost of handling workload based on online requests with a double-copy algorithm. The algorithm needs to determine the final location of objects in a specific time slot, considering factors such as storage, read, write, non-migration, latency, and transfer costs....
glaive
[ -0.006617618724703789, 0.02021167241036892, -0.038769401609897614, -0.005593681242316961, 0.015448780730366707, -0.002743407152593136, -0.040607769042253494, 0.06958213448524475, 0.04289740324020386, -0.018269822001457214, 0.026565594598650932, 0.03022274188697338, -0.026734979823231697, -...
0.80601
0.790077
0.015933
You are asked to define a homology functor from `β`-graded complexes to `V`, where `V` is a type parameter representing a category with zero morphisms and `β` represents an additively-graded type. The homology functor should take a complex `C` and a degree `i`, and output the `i`-th homology group of the complex `C`. T...
glaive
[ 0.020652253180742264, 0.010559488087892532, -0.0148617597296834, -0.025910599157214165, 0.02959616109728813, -0.01397401001304388, -0.0033373055048286915, 0.06280438601970673, 0.0450228787958622, -0.010814035311341286, -0.009170646779239178, 0.050760362297296524, -0.02623017504811287, 0.00...
0.784308
0.762799
0.021509
What is the code to create a program that takes two inputs N and K and prints the Kth Fibonacci number of order N?
glaive
[ 0.01333559025079012, 0.022953879088163376, -0.03576286882162094, -0.025374840945005417, 0.03413531929254532, -0.023267332464456558, -0.016376148909330368, 0.042184051126241684, 0.027372144162654877, -0.020726023241877556, 0.03174485266208649, 0.044771675020456314, -0.03753490746021271, -0....
0.807848
0.788548
0.019301
You are tasked with implementing a program that performs a specific mathematical operation on a given matrix. The program should take an integer `d_int` and a matrix `d_matrix` as input, and then apply the `multiply_lower_tri_self_transpose` function to the matrix to produce a transformed matrix `transformed_data_matri...
glaive
[ 0.03299875184893608, 0.03154493868350983, -0.03511389344930649, -0.045815084129571915, 0.04585631936788559, -0.014960252679884434, -0.004473778884857893, 0.07470037043094635, 0.03765241801738739, -0.002427467377856374, 0.00985432043671608, 0.03989291563630104, -0.028362607583403587, -0.011...
0.810834
0.785258
0.025576
I have a 2D array and I want to count the number of zeros and ones in each row. How can I achieve this using an algorithm in Python?
glaive
[ -0.0039484198205173016, 0.03690576180815697, -0.03852725401520729, -0.03085464984178543, 0.02505086362361908, -0.020581860095262527, -0.03516547381877899, 0.04106026142835617, 0.010466746985912323, -0.014899706467986107, 0.0018547388026490808, 0.019362883642315865, -0.030150948092341423, -...
0.794094
0.773255
0.020839
You are tasked with implementing a parallel program in CUDA to calculate option prices using the Heston model. The Heston model is a stochastic volatility model that is widely used in the financial industry to value options. Your program should read input data for the number of outer loop iterations (OUTER_LOOP_COUNT),...
glaive
[ -0.021331463009119034, 0.03360112011432648, -0.021018799394369125, -0.013566642999649048, 0.021325591951608658, -0.022065525874495506, -0.040369678288698196, 0.09310209006071091, 0.054989200085401535, -0.02882678620517254, 0.010853704996407032, 0.04515446349978447, -0.008460750803351402, 0...
0.799246
0.780107
0.019139
What is the code for a quick-sort algorithm to sort a given list of integers?
glaive
[ 0.010194296948611736, 0.023930376395583153, -0.009314235299825668, -0.035538870841264725, 0.03480948135256767, -0.030757509171962738, -0.02916124276816845, 0.04038749262690544, 0.02720480039715767, -0.02566581405699253, 0.02051462233066559, 0.03747647628188133, -0.036908455193042755, -0.01...
0.808238
0.789313
0.018925
You are required to create a program that finds the maximum value of a given mathematical function and then plots it in 3D and as a contour plot. The function is defined as follows: function[x_, y_] := $Conjugate[Exp[10 I y/2] (1 (-I Sin[x])^4 Cos[x]^7 + 1 (-I Sin[x])^7 Cos[x]^4) + ... + Exp[-10 I y/2] (1 (-I Sin[x])^...
glaive
[ 0.019227851182222366, 0.030467631295323372, -0.05435668304562569, -0.03964778780937195, 0.03747245669364929, -0.016011102125048637, -0.02900325134396553, 0.056445248425006866, 0.04734979197382927, -0.0058542354963719845, 0.026563622057437897, 0.053310126066207886, -0.032459963113069534, -0...
0.799246
0.77011
0.029137
You are tasked with implementing a function to calculate the inverse reverse cumulative (upper tail or survivor) gamma distribution. You need to create a function called `invgammaptail` that takes two parameters `a` and `p`, and returns the value of `x` such that `gammaptail(a, x) = p`. The function should have the fol...
glaive
[ -0.020754627883434296, 0.03551167622208595, 0.001412034616805613, -0.03398919850587845, 0.046414222568273544, -0.03883693739771843, -0.02526470646262169, 0.08481267094612122, 0.027190687134861946, -0.001161797670647502, 0.014399527572095394, 0.041194383054971695, -0.046723946928977966, 0.0...
0.79538
0.769339
0.026042
I have an array of numbers and I need to find the frequency of each unique number in the array. How can I design an algorithm to achieve this?
glaive
[ 0.005109407939016819, 0.018953392282128334, -0.03854132071137428, -0.01667420193552971, 0.04215078428387642, -0.025252357125282288, -0.01930375024676323, 0.054612986743450165, 0.00946036446839571, -0.01689232513308525, 0.012381136417388916, 0.01281373854726553, -0.03223800286650658, -0.008...
0.795887
0.766517
0.02937
You are tasked with writing a program in assembly language that prints a message and then calculates the sum of two 64-bit integer variables. The program should use the printf function to display the message "Hello World!" and the result of the sum in the format "summa = <result>". The program should also include the ...
glaive
[ 0.010915650986135006, 0.027592482045292854, -0.015434359200298786, -0.04126422852277756, 0.04354998469352722, -0.0441468246281147, -0.017902590334415436, 0.07746759057044983, 0.0446564219892025, -0.011950669810175896, 0.032641250640153885, 0.03778509423136711, -0.02269631251692772, -0.0095...
0.801248
0.784553
0.016696
I am trying to crack the enigma machine and need to find a crib, which is plaintext known to be in an encrypted string. I need to compare the crib and the encrypted string to see if any character is in the same index in both strings. I also need to align the crib and the encrypted string such that no clashes occur, and...
glaive
[ 0.02017391473054886, 0.03252420946955681, -0.02645379863679409, -0.03309524059295654, 0.0324566476047039, -0.02610478177666664, -0.02024935744702816, 0.03811587393283844, 0.022997155785560608, -0.03307509049773216, 0.021243439987301826, 0.01004281360656023, -0.043853115290403366, -0.013096...
0.830247
0.811076
0.01917
What is the algorithm to compute the factorial of a given number in Java?
glaive
[ 0.0059808832593262196, 0.03338581696152687, -0.02963489666581154, -0.027652155607938766, 0.03288373351097107, -0.0313754677772522, -0.017028719186782837, 0.03287374973297119, 0.028410648927092552, -0.03719441592693329, 0.013540804386138916, 0.04308025911450386, -0.04442499205470085, -0.005...
0.791944
0.766361
0.025583
What is the algorithm to convert a decimal number to its equivalent binary number with the least number of conflicts?
glaive
[ 0.0076156058348715305, 0.013460550457239151, -0.014271419495344162, -0.02741359919309616, 0.029970522969961166, -0.03302767500281334, -0.02220405638217926, 0.0320388525724411, 0.036328818649053574, -0.03610997274518013, 0.023864973336458206, 0.021839523687958717, -0.023184139281511307, -0....
0.799164
0.774723
0.02444
You are tasked with implementing a CUDA program to perform a SAXPY operation (single-precision A*X Plus Y) using the following parameters: - An array of double precision floating point numbers `x` of length `N`. - An array of double precision floating point numbers `y` of length `N`. - A scalar double precision floatin...
glaive
[ 0.004796863533556461, 0.0313374325633049, -0.024785896763205528, -0.03227253630757332, 0.017152946442365646, -0.004358677193522453, -0.014369459822773933, 0.0720783993601799, 0.0440465472638607, -0.01997329667210579, 0.042019352316856384, 0.028156619518995285, -0.007281124126166105, -0.021...
0.8106
0.792966
0.017634
You are tasked with creating a program in C# that calculates the area of a circle. The program should prompt the user to input the radius of the circle and then calculate and display the area. The formula for calculating the area of a circle is A = πr^2, where A is the area and r is the radius. Write a C# program that...
glaive
[ -0.005378064699470997, 0.04124101996421814, -0.027420582249760628, -0.027151163667440414, 0.02027374878525734, -0.03231120854616165, -0.020317576825618744, 0.08308877795934677, 0.044413983821868896, -0.01566593162715435, 0.017987888306379318, 0.036005862057209015, -0.03358886018395424, -0....
0.772156
0.751625
0.020531
You are tasked with implementing a program to calculate the probability of a quantum state, given a certain set of parameters. The program should also include a visualization of the probability in a 3D plot and a contour plot. Write a program that calculates the probability of a quantum state using the given formula: ...
glaive
[ -0.004463089630007744, 0.04419386386871338, -0.02977251261472702, -0.021275164559483528, 0.03404935076832771, -0.02272583171725273, -0.024196503683924675, 0.08472946286201477, 0.03749839961528778, 0.004508706741034985, 0.0306061003357172, 0.036436691880226135, -0.016967471688985825, -0.011...
0.798145
0.769104
0.029041
You are tasked with creating a program to calculate the number of cyclotomic cosets of 3 modulo 10^n. The goal is to write a program that takes an integer n as input and returns the number of cyclotomic cosets of 3 modulo 10^n. The cyclotomic cosets of 3 modulo 10^n can be calculated using the given code snippet as a r...
glaive
[ 0.022941244766116142, 0.025218544527888298, -0.0458395853638649, -0.020783141255378723, 0.028797801584005356, -0.02743670716881752, -0.010239920578897, 0.06311651319265366, 0.013851124793291092, -0.025721020996570587, 0.02174355648458004, 0.03289080783724785, -0.045657165348529816, -0.0187...
0.819457
0.788359
0.031098
What is the probability of two events A and B occurring, given the information provided?
glaive
[ 0.020435141399502754, 0.002071899827569723, -0.0382734052836895, -0.01953805238008499, 0.030719825997948647, -0.020850948989391327, -0.029861655086278915, 0.06911446154117584, 0.06023402139544487, -0.015796490013599396, 0.01984819769859314, 0.03535962477326393, -0.0005415778723545372, -0.0...
0.753261
0.733971
0.01929
You are tasked with creating a function that takes in 5 different ingredients and performs a series of actions based on them. The function should then return a specific item as a result. The ingredients are represented by the following item numbers: 138, 139, 140, 141, and 142. The function should process the ingredien...
glaive
[ 0.03767266869544983, 0.03073127567768097, -0.01638346165418625, -0.03375180438160896, 0.04400903731584549, -0.0274096317589283, -0.03364555910229683, 0.07052850723266602, 0.029397331178188324, 0.013844209723174572, 0.02659662626683712, 0.031856719404459, -0.020369363948702812, -0.005048862...
0.80795
0.791593
0.016357
You are tasked with creating a C++ program that utilizes CUDA to add two arrays. The program should take two arrays of the same size as input, add them element-wise using CUDA, and then output the resulting array. Your program should also be able to handle errors such as invalid input arrays or CUDA runtime errors.
glaive
[ -0.001290618092752993, 0.03335820510983467, -0.013785166665911674, -0.012062053196132183, 0.032757241278886795, 0.0014744162326678634, -0.029140304774045944, 0.10876932740211487, 0.053755007684230804, -0.03057299740612507, 0.013057611882686615, 0.033809270709753036, -0.005373246036469936, ...
0.793135
0.778038
0.015098
You are tasked with implementing a subroutine to solve for the residual for all degrees of freedom in a fluid-structure interaction problem. The subroutine takes in various input arrays representing nodal coordinates, degrees of freedom, pressure, stress, and other fluid variables. It also includes variables related to...
glaive
[ 0.01612994633615017, 0.030637014657258987, -0.005224224179983139, -0.057765163481235504, 0.04399330914020538, -0.021931538358330727, -0.013773380778729916, 0.05808871239423752, 0.03991483151912689, -0.0018205309752374887, 0.017560767009854317, 0.04329107329249382, -0.020770099014043808, 0....
0.799144
0.780552
0.018592
You are tasked with implementing a closure function for a given set in a programming language that supports ring operations. The closure function should take a set of elements and return the smallest subring that contains all of these elements. The closure should be closed under addition, multiplication, and additive i...
glaive
[ 0.030358649790287018, 0.04841769114136696, -0.0272225309163332, -0.029423736035823822, 0.05092068761587143, -0.031024713069200516, -0.009434545412659645, 0.05941421538591385, 0.045514993369579315, -0.013474000617861748, 0.019397523254156113, 0.036178428679704666, -0.012769659049808979, 0.0...
0.830494
0.806591
0.023904
You are tasked with creating a function that takes 8 boolean inputs (B7, B6, B5, B4, B3, B2, B1, B0) and returns the corresponding byte value. The function should use bitwise operations to set the bits of the byte based on the boolean inputs. The function should be efficient and well-optimized.
glaive
[ 0.02815798670053482, 0.034649115055799484, -0.03203068673610687, -0.01411357894539833, 0.027869217097759247, -0.05332561954855919, -0.026818666607141495, 0.06102174520492554, 0.06014028936624527, -0.019379407167434692, 0.0032544208224862814, 0.03752581402659416, -0.021963343024253845, -0.0...
0.811268
0.785163
0.026105
You are tasked with writing a program to calculate the value of a sequence defined by the following recursive formula: a(n) = 2^n + 3^n + 9^n Where n is a non-negative integer. Write a function or method that takes an integer n as input and returns the value of a(n). For example, given n = 3, the output should be 94.
glaive
[ 0.03667408227920532, 0.034073103219270706, -0.037797946482896805, -0.03760432451963425, 0.0327545627951622, -0.02642543613910675, -0.015771398320794106, 0.07711856067180634, 0.0380944199860096, -0.022392673417925835, 0.037120696157217026, 0.043229568749666214, -0.047679826617240906, -0.008...
0.832023
0.789096
0.042928
You are tasked with creating a program that takes a binary input value and converts it into a 7-segment display code. The input value will be stored in a register R3, and the output should be displayed on a 7-segment display connected to port P1.6. Your program should include a subroutine HEX_TO_7S, which takes the va...
glaive
[ 0.03630884364247322, 0.03267953544855118, -0.022382384166121483, -0.040518224239349365, 0.02754325047135353, -0.0382242351770401, -0.026045652106404305, 0.06877654045820236, 0.0371040441095829, -0.022060884162783623, 0.032601017504930496, 0.04806645214557648, -0.020741699263453484, -0.0021...
0.802645
0.784705
0.01794
You are tasked with creating a function that converts a given complex number to its equivalent in a Clifford algebra over a specified quadratic form. The function should take a real number and return the corresponding complex number in the Clifford algebra using the specified quadratic form. Write a function `convertT...
glaive
[ 0.007444326300173998, 0.0571676529943943, -0.029756980016827583, -0.05658372864127159, 0.028669677674770355, -0.02632485330104828, -0.006375203840434551, 0.06304287165403366, 0.04364999383687973, -0.004888445138931274, 0.010809723287820816, 0.04132828116416931, -0.04036475345492363, 0.0034...
0.798818
0.779451
0.019367
You are tasked with implementing a function for partial division in a commutative monoid. Partial division is defined when the second argument is an invertible unit, and it is not totalized at zero. You need to create a function divp that takes two arguments: an element a of the monoid α and a unit u of the same monoi...
glaive
[ 0.028670256957411766, 0.03333327919244766, -0.024280570447444916, -0.024314891546964645, 0.03811110183596611, -0.027137938886880875, 0.005447446834295988, 0.09132558852434158, 0.058801960200071335, 0.004973405972123146, 0.03046131692826748, 0.0337909571826458, -0.020229553803801537, 0.0024...
0.809776
0.775726
0.034051
You are tasked with creating an XSLT stylesheet that includes a template to reverse a given string. The template should have a parameter for the input string and should return the reversed version of the string. The reversal should be done using O(log(n)) stack usage.
glaive
[ 0.010477441363036633, 0.04401690512895584, -0.018238520249724388, -0.026657842099666595, 0.023225199431180954, -0.043376728892326355, -0.0027283630333840847, 0.0790703296661377, 0.04954294115304947, -0.0026064724661409855, 0.01338677667081356, 0.039939407259225845, -0.03492629900574684, 0....
0.800547
0.784394
0.016153
You are tasked with creating a program that calculates the probability function of a quantum system with a given number of qubits and states. The program should also find the maximum probability and plot the 3D and contour plots of the probability function.
glaive
[ 0.0019201987888664007, 0.029125716537237167, -0.044835902750492096, -0.020665979012846947, 0.04471691697835922, -0.02365502342581749, -0.03065641224384308, 0.052320078015327454, 0.031184373423457146, -0.0005328565021045506, 0.02404838800430298, 0.04209713265299797, -0.012916933745145798, -...
0.800614
0.774392
0.026222
What is an efficient algorithm to sort an array in ascending order?
glaive
[ 0.029268741607666016, 0.021587928757071495, -0.02416660636663437, -0.02901497669517994, 0.010905775241553783, -0.037866055965423584, -0.04120725020766258, 0.03665255382657051, 0.0216225516051054, -0.03135109320282936, 0.018844032660126686, 0.013539486564695835, -0.040363095700740814, -0.00...
0.791972
0.766121
0.02585
You are tasked with writing a program to calculate the binomial coefficient C(40, n) for a given value of n. The binomial coefficient C(n, k) represents the number of ways to choose k elements from a set of n distinct elements. Your program should take an input n and output the corresponding binomial coefficient C(40, ...
glaive
[ 0.020873701199889183, 0.027936823666095734, -0.04566926509141922, -0.02109845168888569, 0.02953539974987507, -0.03796485438942909, -0.021725721657276154, 0.06171589344739914, 0.046926211565732956, 0.001021165051497519, 0.031069988384842873, 0.054296232759952545, -0.028958316892385483, 0.00...
0.810143
0.762482
0.047661
You are tasked with implementing a function in the programming language of your choice that takes in the following parameters: - rs: a real number - z: a real number - xs0: a real number - xs1: a real number - u0: a real number - u1: a real number - t0: a real number - t1: a real number The function should calculate t...
glaive
[ 0.029766801744699478, 0.043786726891994476, -0.035173408687114716, -0.04372381791472435, 0.047357432544231415, -0.04320206865668297, -0.028742162510752678, 0.05892236903309822, 0.04271375387907028, -0.01342617254704237, 0.005201131105422974, 0.04081980511546135, -0.03067568875849247, -0.01...
0.816279
0.789498
0.026781
You are tasked with creating a Python function that takes in a list of integers and returns the maximum value in the list. The function should be named "find_max_value" and should take in one parameter, "nums" which is a list of integers. The function should return the maximum value in the list. For example: Input: [5...
glaive
[ 0.03596256673336029, 0.03694993257522583, -0.025952663272619247, -0.0389091856777668, 0.03769237920641899, -0.022290073335170746, -0.030531464144587517, 0.02096048928797245, 0.032760318368673325, -0.015815280377864838, 0.027454951778054237, 0.053725920617580414, -0.027903102338314056, 0.00...
0.806254
0.752156
0.054097
You are tasked with implementing a parallel version of the standard sequential fast Fourier transform algorithm. The algorithm should perform O(n log n) work and have O(log n) depth. The general FFT should work with any commutative ring and take as arguments the n roots of unity (an array w) and the +, * functions on t...
glaive
[ 0.02241501212120056, 0.04384783282876015, -0.009290656074881554, -0.0396205335855484, 0.035033635795116425, -0.004753227345645428, -0.008776100352406502, 0.05034938454627991, 0.050686564296483994, -0.01951860822737217, 0.015182336792349815, 0.03220149502158165, -0.014155297540128231, -0.01...
0.807421
0.782558
0.024864
You are tasked with implementing a Bayesian multinomial model in Stan for a given dataset. The dataset consists of the following variables: - N: the number of observations - v: a positive real number - alpha: a positive real number - total_count: an integer greater than or equal to 2 - y: a matrix of multinomial observ...
glaive
[ 0.023303497582674026, 0.0027229313272982836, -0.03214920684695244, -0.038991525769233704, 0.03163890540599823, -0.02968744933605194, -0.030561204999685287, 0.07037831842899323, 0.040644511580467224, 0.0033897513058036566, 0.016129029914736748, 0.054830148816108704, -0.014326047152280807, 0...
0.794638
0.770125
0.024513
You are required to write a subroutine in Fortran called DLAIC1 that applies one step of incremental condition estimation in its simplest version. The subroutine will take in the following arguments: - JOB: an integer that determines whether an estimate for the largest or smallest singular value is computed. - J: an in...
glaive
[ -0.01691102236509323, 0.03719920292496681, -0.009332059882581234, -0.05364946275949478, 0.027002515271306038, -0.005853169597685337, -0.014850428327918053, 0.07166212797164917, 0.036109596490859985, -0.012061278335750103, 0.029578089714050293, 0.02722446247935295, -0.024708272889256477, 0....
0.806631
0.778676
0.027955
How can I create a program that generates a two-dimensional array of integers with random values?
glaive
[ 0.005616969428956509, 0.036888979375362396, -0.026528852060437202, -0.03142491355538368, 0.027328461408615112, -0.029577797278761864, -0.03883914649486542, 0.055250782519578934, 0.023683002218604088, -0.03872814401984215, 0.01690630428493023, 0.04378007352352142, -0.044072117656469345, -0....
0.785029
0.768619
0.01641
You are tasked with implementing a program that generates arbitrary integers and booleans, as well as ranges of integers. The program should be able to generate lazy-trees and specify the size of the integer. Additionally, it should be able to specify ranges for integers and provide options for shrinking. You also need...
glaive
[ 0.04430334270000458, 0.025312092155218124, -0.01978224143385887, -0.022219661623239517, 0.024964002892374992, -0.037756308913230896, -0.012623672373592854, 0.05631390959024429, 0.04108387231826782, -0.03598618507385254, 0.03430889919400215, 0.04529505595564842, -0.035439200699329376, -0.00...
0.81012
0.780669
0.029451
Write a program to calculate the squares of the second pentagonal numbers using the following formula: (1/4) n^2(3n+1)^2. The program should take an input 'n' and output the square of the second pentagonal number for that input.
glaive
[ 0.02935478463768959, 0.0424422025680542, -0.04332705959677696, -0.04426814243197441, 0.03527728468179703, -0.0410459078848362, -0.02405322901904583, 0.05569855496287346, 0.034255124628543854, -0.011074775829911232, 0.03324410319328308, 0.030365420505404472, -0.042225182056427, -0.026288151...
0.807684
0.768765
0.038919
You are tasked with creating a program to calculate the Principal Component Analysis (PCA) of the Gender Equality Index based on the given datasets. The specific requirements for this task are as follows: 1. Load and set the path for the data. 2. Explore the PCA contributions to visualize the percentage of variance exp...
glaive
[ -0.011510981246829033, 0.020008612424135208, -0.028870709240436554, -0.05173627287149429, 0.026990903541445732, -0.010808967053890228, -0.0030798667576164007, 0.07242344319820404, 0.03839999809861183, -0.00320167513564229, 0.017670931294560432, 0.025760063901543617, -0.015205619856715202, ...
0.779816
0.76089
0.018927
You are tasked with creating a simple game board to track the movement of a player. The game board will be represented by a grid of cells, each identified by its x and y coordinates. Your task is to create a class called GameBoard that includes the following functionalities: 1. A method to add a player to a specific ce...
glaive
[ 0.0031867206562310457, 0.012133314274251461, -0.02445860207080841, -0.03184504806995392, 0.04168421030044556, -0.04626283049583435, -0.02608540654182434, 0.05853120982646942, 0.0411844477057457, -0.034764502197504044, 0.024152593687176704, 0.03228028118610382, -0.025637183338403702, 0.0043...
0.801487
0.786358
0.015129
How can I create a program that finds the most frequent element in an array?
glaive
[ 0.019320888444781303, 0.030585892498493195, -0.04244086146354675, -0.027945443987846375, 0.03871886432170868, -0.037200745195150375, -0.02107258327305317, 0.0658104196190834, 0.024202315136790276, -0.036533255130052567, 0.02452823333442211, 0.025228992104530334, -0.020294226706027985, -0.0...
0.799169
0.779253
0.019916
You are tasked with implementing a module for matrix and vector operations in Haskell. The module should include functions for matrix multiplication, matrix addition, matrix subtraction, vector addition, vector subtraction, vector dot product, vector outer product, vector normalization, vector and matrix negation, scal...
glaive
[ 0.044912103563547134, 0.020052578300237656, -0.009311940521001816, -0.042978234589099884, 0.04479845613241196, -0.031692732125520706, -0.01631753332912922, 0.03959616273641586, 0.05746617168188095, -0.029848365113139153, 0.006853657308965921, 0.021922865882515907, -0.002053480362519622, -0...
0.796807
0.775494
0.021312
You are tasked with writing a program that can read in a specific data format and perform a certain operation on the data. The input data is provided in a file with the following structure: *SET*HR4 2 375 (6E14.6) 1.113100E+001 1.050800E+001 1.041050E+001 1.041050E+001 1.041050E+001 1.041050E+001 1.041050E+001...
glaive
[ 0.024520814418792725, 0.032499924302101135, -0.014138825237751007, -0.03424699231982231, 0.033495668321847916, -0.04995381087064743, -0.019457707181572914, 0.07685692608356476, 0.04958842322230339, -0.015221891924738884, 0.030541865155100822, 0.028879370540380478, -0.020803527906537056, -0...
0.822027
0.794935
0.027092
You are tasked with implementing a function to determine whether a given function `f : E → β` is convex or concave, and then check if a local minimum/maximum of the function is also a global minimum/maximum within a specified set `s`. You should create a function `is_local_min_on` that takes as input a function `f : ...
glaive
[ 0.011742542497813702, 0.03372552990913391, -0.03717561438679695, -0.024977359920740128, 0.055241044610738754, -0.010056409053504467, -0.008707291446626186, 0.07846949994564056, 0.035904254764318466, -0.0018415256636217237, 0.02260027825832367, 0.04392426833510399, -0.024614961817860603, -0...
0.810688
0.780553
0.030135
How can I design a program that generates a random sequence of numbers within a given range?
glaive
[ 0.006031207274645567, 0.018215034157037735, -0.028619250282645226, -0.03071092627942562, 0.041629254817962646, -0.026771361008286476, -0.03639856353402138, 0.05582822114229202, 0.01693131774663925, -0.041070934385061264, 0.01598687283694744, 0.05649065971374512, -0.038475897163152695, -0.0...
0.78534
0.770861
0.014479
You are tasked with writing a parallelized R program that will generate a set of data and save it to a file. The program should use the 'parallel' and 'devtools' libraries, and set the random number generator type to "L'Ecuyer-CMRG". It should also utilize the 'mclapply' function to run a specified function in parallel...
glaive
[ 0.014157403260469437, 0.05033262073993683, -0.026005472987890244, -0.03616568446159363, 0.024605615064501762, -0.0008765385136939585, -0.04664338752627373, 0.07409404963254929, 0.04460391402244568, -0.028417976573109627, 0.008801872842013836, 0.04698330909013748, -0.004242264665663242, -0....
0.793496
0.776415
0.017081
You are tasked with creating a program that manipulates an array of cell objects in C++ using the LibFlatArray library. The program should be able to insert new cells into the array, modify existing cells, and perform tests to ensure the correct functionality of these operations. The program should be designed to work ...
glaive
[ 0.003887020982801914, 0.029158595949411392, -0.02213168516755104, -0.02422941103577614, 0.03693315014243126, -0.019475756213068962, -0.025315001606941223, 0.11052365601062775, 0.034775253385305405, -0.029019372537732124, 0.009012110531330109, 0.03676683083176613, -0.024130014702677727, 0.0...
0.802097
0.782506
0.019591
I need to write a program that will parse a given DNA sequence and its secondary structure to identify specific segments and their corresponding base pairs. The DNA sequence will be represented by a series of letters (A, C, G, or U), and the secondary structure will be represented by a series of dots, parentheses, and ...
glaive
[ 0.03040378727018833, 0.002209656871855259, -0.03977186232805252, -0.045636411756277084, 0.019241660833358765, -0.039899978786706924, 0.00041107204742729664, 0.06623314321041107, 0.024835823103785515, -0.015408048406243324, 0.027607809752225876, 0.013044032268226147, -0.03561190515756607, 0...
0.807182
0.785325
0.021858
I need to create a CUDA kernel function that calculates the reduced dot product of two arrays of floating-point numbers. The kernel function should take in two arrays x1 and x2, an array dst to store the result, an initial value initVal, and the number of elements n in the arrays. The reduced dot product is calculated ...
glaive
[ 0.004029449541121721, 0.05858047306537628, -0.04357605800032616, -0.023501921445131302, 0.05161290615797043, -0.010129350237548351, -0.027311354875564575, 0.09612499177455902, 0.04403574764728546, 0.0036296613980084658, 0.013955558650195599, 0.03745885565876961, -0.019587745890021324, -0.0...
0.800673
0.780216
0.020456
You are given a list of selections, a list of locations, a list of colors, a set of opening brackets, and a set of closing brackets. Your task is to process the selections and locations based on the brackets and colors and generate a specific output string. Write a program that takes the following inputs: - A string r...
glaive
[ 0.026647914201021194, 0.03576650097966194, -0.029794033616781235, -0.030238384380936623, 0.024091269820928574, -0.04615066573023796, -0.03830130025744438, 0.06438383460044861, 0.0605345293879509, -0.020044486969709396, 0.04779975116252899, 0.0397491455078125, -0.024099739268422127, -0.0055...
0.828569
0.805809
0.02276
You are required to implement a function that calculates a mathematical function based on the given parameters. The function is defined as follows: f := (rs, zeta, xt, xs0, xs1) -> gga_exchange(vmt_f, rs, zeta, xs0, xs1): Where vmt_f is a function defined as vmt_f := x -> vmt_f0(X2S*x), and vmt_f0 is defined as vmt_f...
glaive
[ 0.036144282668828964, 0.042987801134586334, -0.0365586131811142, -0.03723471611738205, 0.040750037878751755, -0.044281184673309326, -0.04057123139500618, 0.06678012013435364, 0.04757623374462128, -0.006036577746272087, 0.009498820640146732, 0.036658406257629395, -0.03157293424010277, -0.01...
0.806481
0.781416
0.025065
You are tasked with implementing a CUDA kernel for a permutation operation on a 4D input tensor. The input tensor has dimensions (batch, channel, height, width), and the output tensor should be rearranged according to the specified dimensions. The dimensions are represented by dim0, dim1, and dim2, which determine the ...
glaive
[ 0.005536915268748999, 0.05228174477815628, -0.006892052479088306, -0.026125099509954453, 0.024447666481137276, -0.0005222174804657698, -0.036597225815057755, 0.08145023882389069, 0.03202841430902481, -0.013809872791171074, 0.01929546147584915, 0.032603438943624496, -0.006077832542359829, -...
0.804571
0.785662
0.018908
You are tasked with creating a program to calculate the entropy change of a system and its surroundings for a given thermodynamic process. The program should be able to handle different types of processes, including isothermal, adiabatic, isochoric, and isobaric processes. Additionally, it should be able to calculate t...
glaive
[ 0.02568129636347294, 0.019413916394114494, -0.02416413463652134, -0.03121430054306984, 0.03510257974267006, -0.058188773691654205, -0.03886018320918083, 0.0661725252866745, 0.02541106380522251, -0.016373388469219208, 0.033991362899541855, -0.004997001960873604, -0.0404927060008049, -0.0167...
0.777833
0.758545
0.019288
You are tasked with creating a function that calculates the dot product of two vectors. The dot product of two vectors is the sum of the products of their corresponding elements. In other words, given two vectors A and B, the dot product is calculated as A[0]*B[0] + A[1]*B[1] + ... + A[n]*B[n], where n is the length of...
glaive
[ 0.021593166515231133, 0.03578208014369011, -0.036608245223760605, -0.03089703433215618, 0.053363312035799026, -0.0034477775916457176, -0.04227088391780853, 0.0706392452120781, 0.039719995111227036, -0.018349669873714447, 0.00034131560823880136, 0.038884248584508896, -0.01336528267711401, -...
0.78829
0.743122
0.045168
I have an array of integers and I want to find all the unique pairs [a, b] where a < b and each value appears only once in the pair. Can anyone help me with a solution in Python?
glaive
[ 0.004220285918563604, 0.029739098623394966, -0.04114605113863945, -0.018129339441657066, 0.02730695717036724, -0.024474652484059334, -0.012500839307904243, 0.03771676495671272, 0.040437113493680954, -0.018168341368436813, 0.013910835608839989, 0.004933402873575687, -0.030634719878435135, -...
0.820761
0.799143
0.021618
You are tasked with implementing the A* search algorithm in Prolog to solve a given problem. The problem is represented by an initial state, a set of operators, and a final state. Your goal is to write the Prolog code to implement the A* search algorithm and find the optimal sequence of actions to transition from the i...
glaive
[ 0.010085242800414562, 0.02569558285176754, -0.007884437218308449, -0.038195278495550156, 0.024709153920412064, -0.010873888619244099, -0.02024497650563717, 0.05637858062982559, 0.035879407078027725, -0.006591796409338713, 0.013498621061444283, 0.03295421972870827, -0.011788768693804741, 0....
0.806501
0.774389
0.032112
You are required to implement a priority encoder in VHDL. The priority encoder will take a 16-bit input vector and output a 4-bit vector based on the priority of the input. The priority encoder should identify the most significant bit that is set to 1 in the input vector and assign a value to the output based on the po...
glaive
[ 0.015015845187008381, 0.029500961303710938, 0.004239137750118971, -0.015896720811724663, 0.0301814042031765, -0.018174991011619568, -0.013153613545000553, 0.07908476144075394, 0.0301244854927063, -0.018075117841362953, 0.03157307952642441, 0.0342891551554203, -0.008190364576876163, -0.0181...
0.802513
0.786212
0.0163
You are tasked with writing a function in Clojure that takes a nested list as input and returns a flattened list. For example, given the input (list 1 (list 2 (list 3 4))), the function should return (1 2 3 4).
glaive
[ 0.019350482150912285, 0.0397258922457695, -0.02256995625793934, -0.047323472797870636, 0.05292091146111488, -0.023085519671440125, 0.0020009996369481087, 0.029018603265285492, 0.05351971834897995, -0.0009348795865662396, 0.017694801092147827, 0.04642634093761444, -0.022130122408270836, -0....
0.804402
0.781903
0.022499
You are tasked with creating a program to analyze withdrawal indicators for a given number of quarters and people. The program should calculate the adjusted first withdrawal quarter for each person and estimate the base logit probability of withdrawal for each person. Additionally, the program should calculate the link...
glaive
[ 0.036457788199186325, 0.027916882187128067, -0.037724658846855164, -0.03016825020313263, 0.023863136768341064, -0.02190137282013893, -0.011187358759343624, 0.06315366178750992, 0.05679430812597275, -0.002907783491536975, 0.01380281150341034, 0.041866235435009, -0.027661919593811035, 0.0198...
0.808998
0.78579
0.023208
You are tasked with creating a program that takes in a string as input and prints the string in reverse order. For example, if the input is "hello", the program should output "olleh".
glaive
[ 0.021620385348796844, 0.038087788969278336, 0.001784613006748259, -0.04392501711845398, 0.005915897432714701, -0.012336383573710918, -0.009832160547375679, 0.04549286887049675, 0.03892647847533226, -0.02008422464132309, 0.005645812954753637, 0.025094160810112953, -0.04921453446149826, -0.0...
0.791929
0.76496
0.026969
You are tasked with creating a program that can generate congruence lemmas for the simplifier using a given expression. The program should be able to create both general and specialized theorems based on the arguments of the given application. The program should also be able to handle equivalence relations and construc...
glaive
[ 0.025266367942094803, 0.030512139201164246, -0.039236366748809814, -0.0474623404443264, 0.04287704452872276, -0.008202365599572659, -0.02336866594851017, 0.07295405119657516, 0.020552776753902435, -0.04222660884261131, -0.0002334161545149982, 0.027750201523303986, -0.031617119908332825, 0....
0.808618
0.792883
0.015735
You have been tasked with writing a program to generate the expansion of the following expression: 1/((1-x)(1-5x)(1-10x)). The expansion should produce a sequence of numbers, starting from 1 and following a specific pattern. Your task is to write a program that takes an input value and generates the corresponding numbe...
glaive
[ 0.02767319604754448, 0.03442391753196716, -0.04379348084330559, -0.025639481842517853, 0.03701381757855415, -0.03658870607614517, -0.013049918226897717, 0.0795738697052002, 0.04776318743824959, -0.024461369961500168, 0.037636592984199524, 0.021949274465441704, -0.057223908603191376, -0.011...
0.819797
0.793531
0.026266
You are tasked with implementing a subroutine to draw characters at specified starting or ending points of a line. The subroutine DRWCHR takes in the following parameters: - (X,Y): Starting or ending point of the line to be typed, always left-to-right or top-to-bottom - XYD: (+/-)1 if X is the starting or ending point ...
glaive
[ -0.0026287809014320374, 0.02097450941801071, -0.01312089990824461, -0.03826352208852768, 0.03862525895237923, -0.016007719561457634, -0.021587837487459183, 0.068640798330307, 0.058408454060554504, -0.021866783499717712, 0.021337587386369705, 0.05424007028341293, -0.0004929361748509109, -0....
0.796892
0.780664
0.016228
You are tasked with implementing a Finite Impulse Response (FIR) filter in C++ using Vivado HLS. The FIR filter is a type of digital filter used in signal processing. Your task is to write a C++ program that defines the filter coefficients and processes an input signal through the filter. The FIR filter must have the ...
glaive
[ -0.00271712988615036, 0.024395333603024483, -0.011741281487047672, -0.039846744388341904, 0.05153742432594299, -0.017288245260715485, -0.0267280675470829, 0.10747139900922775, 0.0371214859187603, -0.014630619436502457, 0.025218158960342407, 0.031638845801353455, -0.013870548456907272, 0.00...
0.802123
0.784678
0.017445
You are tasked with creating a programming problem to demonstrate the concept of preserving binary products in a category using a functor. Your task is to write a function that checks whether a given functor `F` preserves binary products in a category `C` and `D`. The function should take the following inputs: - `F`: A...
glaive
[ 0.02225172333419323, 0.02082234062254429, -0.0330469124019146, 0.0012248308630660176, 0.051736824214458466, -0.016628509387373924, 0.0004811820690520108, 0.09304766356945038, 0.05679970234632492, -0.016294892877340317, -0.010737443342804909, 0.046190254390239716, -0.013848207890987396, -0....
0.818217
0.795881
0.022336
You are tasked with simulating the probability distribution of a quantum system with 15 qubits and 4 states. The system is described by the following probability amplitude function: amplitude[x_,y_] := (Exp[-14 I y] ... + Exp[14 I y] ...)/Sqrt[2^nqubits] You need to calculate the probability of measuring the system i...
glaive
[ 0.00251139048486948, 0.014996794983744621, -0.03898540884256363, -0.04743192717432976, 0.037034910172224045, -0.025338713079690933, -0.016134314239025116, 0.05658530071377754, 0.03439107909798622, -0.008701809681952, 0.02521727979183197, 0.03470158576965332, 0.0036134005058556795, -0.01792...
0.796126
0.770262
0.025863
You are tasked with creating a Checkers game using object-oriented programming in C++. You need to define two classes: CheckersBoard and Piece. The CheckersBoard class should represent the game board and manage the pieces on the board. It should have a method to initialize the board and another method to move a piece ...
glaive
[ 0.03066970594227314, 0.0019630820024758577, -0.025768795982003212, -0.020919319242239, 0.03882778063416481, -0.01810142770409584, -0.02019060216844082, 0.09355603903532028, 0.04999590665102005, -0.030272357165813446, 0.019875818863511086, 0.03902106359601021, -0.029966235160827637, -0.0016...
0.781684
0.758109
0.023575
You are tasked with implementing a program to calculate the decimal representation of the n-th iteration of the "Rule 143" elementary cellular automaton starting with a single ON (black) cell. The rules for the automaton are as follows: - If the current cell and its two neighbors are all black or all white, the next ge...
glaive
[ 0.019453532993793488, 0.021823113784193993, -0.015355775132775307, -0.03432261571288109, 0.03772103413939476, -0.027645111083984375, -0.03510136157274246, 0.06845477968454361, 0.016834823414683342, -0.010082606226205826, 0.03287502005696297, 0.022360680624842644, -0.04950970038771629, -0.0...
0.828605
0.782086
0.046519
You are tasked with creating a Haskell class called `Ord` that extends the `Eq` class. The `Ord` class is used for totally ordered datatypes and can be derived for any user-defined datatype whose constituent types are in `Ord`. Your task is to define the complete implementation of the `Ord` class, including the require...
glaive
[ 0.03346750885248184, -0.0020096818916499615, -0.010272495448589325, -0.03980238363146782, 0.017086481675505638, -0.024139851331710815, -0.006578874308615923, 0.037494778633117676, 0.044666651636362076, -0.023749666288495064, 0.014051167294383049, 0.03369361534714699, -0.01737310364842415, ...
0.811788
0.793067
0.018721
You are tasked with implementing a CUDA kernel function for element-wise matrix multiplication with addition. The function should take two input matrices `src1` and `src2`, and perform element-wise multiplication with scaling factors `alpha` and `beta`, and then add the result to the destination matrix `dst`. The dimen...
glaive
[ 0.013332857750356197, 0.053798094391822815, -0.009722215123474598, -0.03258466348052025, 0.03800492733716965, -0.0024073319509625435, -0.024998998269438744, 0.09352407604455948, 0.04771578311920166, -0.008380183950066566, 0.026275983080267906, 0.03766970708966255, -0.025041550397872925, 0....
0.798098
0.781269
0.016829
You are tasked with implementing a raytracing algorithm using interval arithmetic. The goal is to draw 3D shapes using interval arithmetic to define tracing steps with "box" intervals instead of spheres. The default render should be 1/x^2 metaballs and a clamped "diabolo" to show how a high threshold affects rendering ...
glaive
[ 0.03659670054912567, 0.042373985052108765, -0.0177577156573534, -0.02298075146973133, 0.026129113510251045, -0.00035119461244903505, -0.017943406477570534, 0.07546409964561462, 0.02669316902756691, -0.024707701057195663, 0.030384013429284096, 0.023590870201587677, -0.012047911062836647, 0....
0.807297
0.779777
0.02752
What is an implementation for the A* algorithm for finding the shortest path?
glaive
[ 0.007269163616001606, 0.01973210647702217, -0.016194995492696762, -0.027906078845262527, 0.024459628388285637, -0.013618770986795425, -0.029517676681280136, 0.05931032449007034, 0.045030541718006134, -0.024087216705083847, 0.012627947144210339, 0.02716500498354435, -0.001289352192543447, -...
0.792757
0.776015
0.016742
You are tasked with implementing a function that converts a given integer into a verbal index. For example: - 1 should be converted to "first" - 5 should be converted to "fifth" - 21 should be converted to "21st" Write a function that takes an integer as input and returns the corresponding verbal index.
glaive
[ 0.03444623947143555, 0.04505101591348648, 0.008555706590414047, -0.0447002612054348, 0.037147391587495804, -0.030627118423581123, -0.03770414739847183, 0.046203188598155975, 0.02659323811531067, -0.0019218758679926395, 0.03620993345975876, 0.02321579121053219, -0.0359368622303009, 0.008098...
0.807291
0.76886
0.038431
You are given a boolean matrix W of size 30000x30001. The matrix contains mostly true values, with a few random locations containing false values. Your task is to write a function to find the indices of the false values in the matrix. There are three different functions provided as potential solutions, but you need to ...
glaive
[ 0.010106783360242844, 0.030519958585500717, -0.04802224785089493, -0.028064796701073647, 0.0441032312810421, -0.030531127005815506, -0.024060141295194626, 0.07618369907140732, 0.02038854919373989, -0.007050295360386372, 0.022861754521727562, 0.029094921424984932, -0.018306804820895195, -0....
0.819485
0.790261
0.029224
You are tasked with implementing a GPU-accelerated matrix multiplication program using CUDA and cuBLAS. The program should include three different methods: naive matrix multiplication with global memory, matrix multiplication with shared memory, and cuBLAS. The matrix size should be specified through a command-line arg...
glaive
[ 0.024147406220436096, 0.04830321669578552, -0.020190920680761337, -0.027798080816864967, 0.040127430111169815, -0.011445976793766022, -0.025200622156262398, 0.09637504070997238, 0.03267494961619377, -0.030967675149440765, 0.000362318882253021, 0.021682623773813248, -0.012309577316045761, -...
0.794198
0.775663
0.018535
You are tasked with creating a function in a logic programming language that implements the proper-membero function. The proper-membero function takes two arguments: an element and a list. It should return true if the element is a member of the list, and false otherwise. However, it should not return true if the elemen...
glaive
[ 0.049309298396110535, 0.01919088140130043, -0.03975376486778259, -0.04856684431433678, 0.0489051416516304, -0.03977019339799881, -0.003352239029482007, 0.04144669696688652, 0.026027638465166092, -0.02031955122947693, 0.005691171623766422, 0.0533369705080986, -0.011413365602493286, 0.005695...
0.808441
0.792734
0.015707
You are tasked with creating a program that calculates the area of a rectangle. You need to write a function that takes in the length and width of the rectangle as parameters and returns the area. The length and width should both be positive integers. Write a function called "calculate_rectangle_area" that takes two p...
glaive
[ 0.008959420956671238, 0.04944402724504471, -0.04103328287601471, -0.03225593641400337, 0.029480507597327232, -0.0070858728140592575, -0.027886483818292618, 0.06777945160865784, 0.0382997952401638, 0.0008671788382343948, 0.013364887796342373, 0.05349120497703552, -0.026565536856651306, -0.0...
0.776359
0.754091
0.022268