instruction_seed
stringlengths
43
8.03k
source
stringclasses
1 value
embeddings
listlengths
1.02k
1.02k
mean_positive_score
float64
0.73
0.85
mean_negative_score
float64
0.71
0.82
difference_score
float64
0.01
0.07
You have been tasked with implementing a function to generate a list of prime numbers. The function should take no input and should return a list of prime numbers. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. You should create a module called Primes with a fun...
glaive
[ 0.047429945319890976, 0.020584646612405777, -0.010936141014099121, -0.038949597626924515, 0.039423782378435135, -0.038731448352336884, -0.0053781745955348015, 0.041342757642269135, 0.03992395102977753, -0.015319128520786762, 0.025624673813581467, 0.03222063183784485, -0.03496447205543518, ...
0.81394
0.783668
0.030273
You are tasked with implementing a function `unwarp_gpu` that takes in two arrays `in` and `out`, and a floating point number `duty`. The `in` array represents the input data, while the `out` array is the output data. The `duty` parameter is a floating point number. The goal is to implement the `unwarp_gpu` function u...
glaive
[ 0.009308821521699429, 0.04920446127653122, -0.019181041046977043, -0.012058728374540806, 0.03667254373431206, -0.0246218703687191, -0.025996174663305283, 0.09841033816337585, 0.036903608590364456, -0.02109842374920845, 0.027394814416766167, 0.03466404229402542, 0.0031454411800950766, -0.00...
0.789261
0.774692
0.014569
I need help determining the total number of unique subarrays in an array, regardless of the order of elements within the subarrays. How can I efficiently solve this problem for large inputs up to 10^6 elements?
glaive
[ 0.007984365336596966, 0.037948597222566605, -0.04174254462122917, -0.02070118673145771, 0.025180427357554436, -0.0221098642796278, -0.0156838558614254, 0.038855522871017456, 0.0344935841858387, -0.028261525556445122, 0.019330253824591637, 0.003537598764523864, -0.022555368021130562, -0.023...
0.82023
0.791414
0.028816
You are tasked with creating a function that calculates the difference between the sum of the squares of the first 100 natural numbers and the square of the sum of the first 100 natural numbers. The function should take no input and should return the calculated difference as the output.
glaive
[ 0.02161850780248642, 0.02119523286819458, -0.026045694947242737, -0.04283817112445831, 0.04052122309803963, -0.016422810032963753, -0.03343870863318443, 0.06176573783159256, 0.05372039973735809, -0.022716671228408813, 0.03649873286485672, 0.022969719022512436, -0.055994220077991486, -0.021...
0.806409
0.764041
0.042368
You are tasked with implementing a GPU kernel for the binomial options pricing model. The given code snippet provides the necessary data structures and helper functions to perform the calculations. Your goal is to write the GPU kernel to calculate the call value for a given set of input option data. The input option d...
glaive
[ -0.02010161615908146, 0.028657937422394753, -0.02470903843641281, -0.0301075279712677, 0.03119552507996559, -0.03966771811246872, -0.022500479593873024, 0.08484040200710297, 0.04870082065463066, -0.008554826490581036, 0.028214383870363235, 0.04098525270819664, -0.01623995043337345, 0.02151...
0.816254
0.795991
0.020263
Can you provide a recursive algorithm to check if a given array contains a pair of consecutive integers?
glaive
[ -0.0003060262242797762, 0.029337046667933464, -0.023694664239883423, -0.03187980875372887, 0.02992343157529831, -0.018652090802788734, -0.010993126779794693, 0.06186315417289734, 0.021463681012392044, -0.04563358798623085, 0.025908030569553375, 0.014168097637593746, -0.02472752518951893, -...
0.818369
0.791893
0.026476
You are tasked with creating a function that takes in a list of integers and returns the sum of all the even numbers in the list. If the list is empty or does not contain any even numbers, the function should return 0.
glaive
[ 0.02257046103477478, 0.022094279527664185, -0.03616761788725853, -0.05431903153657913, 0.044796183705329895, -0.008899430744349957, -0.019738607108592987, 0.042152658104896545, 0.030907878652215004, -0.01466270349919796, 0.0044571938924491405, 0.047466378659009933, -0.034684352576732635, -...
0.81092
0.76618
0.04474
Is there a way to write an algorithm that can calculate the sum of all three-digit numbers in an array?
glaive
[ 0.009289253503084183, 0.02172318659722805, -0.04464405030012131, -0.03757833316922188, 0.05148189142346382, -0.0295372623950243, -0.027142344042658806, 0.039475083351135254, 0.013685663230717182, -0.02905356138944626, 0.021463682875037193, 0.04757574200630188, -0.05393132194876671, -0.0428...
0.792451
0.769493
0.022958
Can you help me create an algorithm to calculate the Fibonacci number at a specific index?
glaive
[ 0.009145857766270638, 0.024285610765218735, -0.022803841158747673, -0.0331326499581337, 0.03650571405887604, -0.0436006560921669, -0.03687715902924538, 0.0356677807867527, 0.03178209066390991, -0.0339151956140995, 0.023738402873277664, 0.014804692938923836, -0.04484501853585243, -0.0157007...
0.7998
0.779955
0.019846
You are tasked with developing a program that calculates the probability of a quantum state for a given set of input parameters. The quantum state is defined by the amplitude function, which takes two parameters (x and y) and returns a complex number. The probability of the quantum state is then calculated as the absol...
glaive
[ 0.006480532698333263, 0.03438868373632431, -0.036471132189035416, -0.020321352407336235, 0.04986388236284256, -0.018332315608859062, -0.013015259988605976, 0.07375524193048477, 0.03369569778442383, -0.006333860103040934, 0.02615540288388729, 0.03099740296602249, -0.014125349000096321, -0.0...
0.794432
0.768913
0.025519
You are tasked with implementing a program to generate a Quantile-Quantile (QQ) plot for two specified variables. The program should take in a minimum of two variables and a maximum of two variables. The program should create a QQ plot comparing the distribution of the two variables and should handle cases where the nu...
glaive
[ -0.03381703421473503, 0.0016933521255850792, -0.034015897661447525, -0.0355796292424202, 0.02282571606338024, -0.02065514214336872, -0.018509354442358017, 0.06473179161548615, 0.046122461557388306, -0.020746536552906036, 0.03747441619634628, 0.03537696972489357, -0.029841160401701927, 0.01...
0.793809
0.776188
0.017621
You are tasked with implementing a function in a programming language that takes an allocator and a size as input and returns an array of unsigned 16-bit integers. The function should allocate memory using the given allocator, initialize the array in descending order from the given size, and then return the array. Addi...
glaive
[ 0.02687518298625946, 0.03767898678779602, -0.018069230020046234, -0.026384815573692322, 0.029571693390607834, -0.032246798276901245, -0.03491968289017677, 0.07102321833372116, 0.03025580383837223, -0.00939734373241663, 0.02753452956676483, 0.03691476583480835, -0.028565481305122375, -0.001...
0.822925
0.791966
0.030959
You are required to write a program that takes input from the keyboard and sorts it using two different algorithms. The program should provide the option to choose between heap sort and quick sort, as well as the level of debugging information to display. The input will be a list of characters, and the program should d...
glaive
[ 0.029732853174209595, 0.012641151435673237, -0.009945751167833805, -0.023095153272151947, 0.033967435359954834, -0.017768118530511856, -0.007619829848408699, 0.07024004310369492, 0.04027595371007919, -0.013575206510722637, 0.028621604666113853, 0.015147439204156399, -0.02945171855390072, -...
0.81351
0.788983
0.024527
You are required to create a C++ program that calculates the sample rate for a given set of parameters. The program should take into account the number of layers, dilation, batch size, number of samples, and mode. The program should also factorize and factorize_pow2 the given number and print the output. The code shoul...
glaive
[ -0.007348570041358471, 0.03437897562980652, -0.04239371046423912, -0.018196213990449905, 0.04487495496869087, -0.010692850686609745, -0.04858873412013054, 0.09784054011106491, 0.020939955487847328, -0.03203782066702843, 0.01621464267373085, 0.046720001846551895, -0.027088908478617668, 0.00...
0.795278
0.774297
0.020981
## I am facing a computational challenge that involves calculating the cumulative sum of even integers after specific alterations. Here are the details: I have an integer array called `A`, and a separate array called `queries` that contains specific instructions for alterations. Each alteration is represented by `v...
glaive
[ 0.009920448996126652, 0.03468092158436775, -0.022957168519496918, -0.026331109926104546, 0.024606019258499146, -0.03523387759923935, -0.01823306269943714, 0.08846841007471085, 0.030131490901112556, -0.0339369997382164, 0.018931783735752106, 0.009533410891890526, -0.048578061163425446, -0.0...
0.840437
0.799689
0.040748
You are tasked with creating a shader program in GLSL (OpenGL Shading Language) for a 3D rendering application. The program should implement Phong lighting model with two point lights and a texture map. The given uniforms and inputs are: - Uniforms: - vec3 u_emissive: emissive color of the object - vec3 u_diffuse: ...
glaive
[ 0.01625521294772625, 0.023312831297516823, -0.011313503608107567, -0.044183455407619476, 0.026205584406852722, -0.05319127440452576, -0.03732905164361, 0.07754006236791611, 0.029305173084139824, -0.02770794928073883, 0.050673749297857285, 0.040719520300626755, -0.009688296355307102, -0.007...
0.792519
0.777042
0.015477
You are tasked with implementing a function that takes a string as input and splits it into two parts based on a given predicate. You should define a function splitString that takes three arguments: a predicate function p, a reader function f, and a source string src. The predicate function p should take a character as...
glaive
[ 0.02146916650235653, 0.02159094624221325, -0.02349175326526165, -0.026618020609021187, 0.04563991725444794, -0.04532667621970177, -0.016112906858325005, 0.07044052332639694, 0.04188042879104614, -0.008039913140237331, 0.014653169550001621, 0.03169052302837372, -0.02120840549468994, -0.0094...
0.810966
0.795355
0.01561
You are tasked with implementing a program in a functional programming language that defines two functions and uses them to calculate a result. The first function, f, takes two boolean values as input and returns the logical AND of the two values. The second function, g, takes one boolean value as input and returns the...
glaive
[ 0.01963312365114689, 0.024449370801448822, -0.04136500135064125, -0.02607850171625614, 0.047690507024526596, -0.02584584429860115, -0.018319493159651756, 0.06767517328262329, 0.04249046370387077, -0.016649212688207626, 0.019475845620036125, 0.058234769850969315, -0.013494651764631271, -0.0...
0.813758
0.792595
0.021163
Can you provide a list of numbers between 0 and 10 that are divisible by 3?
glaive
[ 0.012474177405238152, 0.018653685227036476, -0.023029519245028496, -0.02692124992609024, 0.04419330880045891, -0.0402955636382103, -0.026966966688632965, 0.02693469636142254, 0.020477069541811943, -0.02554996684193611, 0.03863831236958504, 0.037667691707611084, -0.06284885853528976, -0.030...
0.778458
0.74858
0.029877
What is the time complexity of the given code snippet?
glaive
[ 0.004163022618740797, 0.032878391444683075, -0.025414982810616493, -0.03149304911494255, 0.0377022847533226, -0.011369124054908752, -0.019653525203466415, 0.07420080900192261, 0.03249596431851387, -0.026491347700357437, 0.0291272159665823, 0.030314410105347633, -0.002297020284458995, -0.00...
0.798253
0.780294
0.017959
You need to write a program that counts the number of arrays with three elements that meet the following criteria: the zeroth through 2nd differences are all nonzero. In other words, you need to find the number of arrays x(0..2) within the range -n to n that satisfy this condition.
glaive
[ 0.009865188039839268, 0.005591637920588255, -0.05101342126727104, -0.022925710305571556, 0.026142554357647896, -0.0073996600694954395, -0.04021848738193512, 0.056431181728839874, 0.023951392620801926, -0.020435022190213203, 0.017275365069508553, 0.03702068328857422, -0.04692874848842621, -...
0.843457
0.799279
0.044178
You are tasked with designing a program that performs scalar addition on a set of numbers. The program should take input from the user and output the sum of the numbers. You should implement the program in C++ using the Vivado tool.
glaive
[ 0.006650491617619991, 0.02112029679119587, -0.03433677926659584, -0.030272170901298523, 0.07006941735744476, -0.0076309917494654655, -0.0013441689079627395, 0.09606706351041794, 0.03895047307014465, -0.0208535585552454, 0.014750503934919834, 0.0507907010614872, -0.03641922399401665, -0.006...
0.80241
0.779889
0.022521
You are tasked with implementing a Fortran subroutine to solve a complex generalized Hermitian-definite eigenproblem. The subroutine CHEGVX computes selected eigenvalues and, optionally, eigenvectors of a complex generalized eigenvalue problem, of the form A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A ...
glaive
[ 0.021751079708337784, 0.014902406372129917, -0.0159929022192955, -0.043321527540683746, 0.03174858167767525, -0.019009456038475037, -0.0034915024880319834, 0.06122206524014473, 0.03922567516565323, -0.0191397313028574, 0.012223305180668831, 0.04108485206961632, -0.02343941107392311, -0.001...
0.80213
0.78174
0.02039
You are tasked with implementing a game called SameGame using Elm. SameGame is a single-player puzzle game where the player needs to clear the game board by removing groups of adjacent, same-colored cells. Your task is to implement the model, update, subscriptions, and view functions in Elm to create the game. Here ar...
glaive
[ 0.002305098343640566, 0.017609281465411186, -0.009433235973119736, -0.040607769042253494, 0.014444800093770027, -0.022564534097909927, -0.007329957094043493, 0.07859145849943161, 0.0397784486413002, -0.03666991367936134, 0.02650562860071659, 0.03155549243092537, -0.029508741572499275, -0.0...
0.811155
0.794058
0.017097
What is the code to generate the Fibonacci sequence?
glaive
[ 0.0011533863143995404, 0.01983904093503952, -0.018117044121026993, -0.038250718265771866, 0.03238486498594284, -0.03714681789278984, -0.017621606588363647, 0.06451696157455444, 0.02612742781639099, -0.03690457344055176, 0.022258512675762177, 0.04872818663716316, -0.032293178141117096, -0.0...
0.800282
0.777333
0.022949
I am trying to create a program that calculates the factorial of a given number. Can someone help me write a function to accomplish this in Python? The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 (denoted as 5!) is 5*4*3*2*1 = 12...
glaive
[ 0.02476496621966362, 0.020989423617720604, -0.033733583986759186, -0.03088248521089554, 0.049584146589040756, -0.03877675533294678, -0.021261336281895638, 0.042495280504226685, 0.029100166633725166, -0.009045571088790894, 0.008562121540307999, 0.04034360498189926, -0.05268688127398491, -0....
0.793361
0.773353
0.020008
You are tasked with writing a program to determine the maximum number in a sequence of natural numbers that is divisible by 5. The program should take as input the number of elements in the sequence, followed by the actual numbers in the sequence. It is guaranteed that at least one number in the sequence will be divisi...
glaive
[ 0.036147210747003555, 0.014344276860356331, -0.04012014716863632, -0.02213195152580738, 0.03931356221437454, -0.0289441030472517, -0.03242364153265953, 0.06145033240318298, 0.02678823657333851, -0.01907990872859955, 0.023469269275665283, 0.04152742773294449, -0.03028111532330513, 0.0030305...
0.826022
0.776523
0.0495
You are tasked with implementing a function that parses brace expressions in a given string. These brace expressions take the form of {n}, {n,m}, {,n}, or {n,} where n and m are non-negative integers. The function should take the following inputs: - A string `str` representing the input string - An index `idx` represe...
glaive
[ 0.05330682918429375, 0.037414684891700745, -0.023717597126960754, -0.02396564558148384, 0.04492602497339249, -0.0290011428296566, -0.002611770760267973, 0.055324453860521317, 0.04312637075781822, -0.0013802488101646304, 0.01226709969341755, 0.018718479201197624, -0.030532244592905045, -0.0...
0.795599
0.777114
0.018485
How can I merge two arrays of equal length, where the resulting array alternates between elements from the first and second array?
glaive
[ 0.018506675958633423, 0.024725226685404778, -0.0218407791107893, -0.034584127366542816, 0.01775277964770794, -0.023901237174868584, -0.021121030673384666, 0.05087098851799965, 0.032305918633937836, -0.03919379040598869, 0.019436517730355263, 0.018113255500793457, -0.04189405217766762, -0.0...
0.80063
0.786027
0.014603
You are tasked with implementing a CUDA-accelerated function in C that adds two arrays in parallel. The function signature should be as follows: ```c void addEle(float* A, float* B, float* C) ``` This function takes in two arrays A and B of type float, and adds their corresponding elements together, storing the result ...
glaive
[ 0.017126692458987236, 0.05663059279322624, -0.013143070042133331, -0.029553959146142006, 0.03654102981090546, 0.004358467645943165, -0.030089180916547775, 0.10810445994138718, 0.04411233961582184, -0.025017954409122467, 0.008438300341367722, 0.03464055433869362, -0.012496081180870533, -0.0...
0.794979
0.777061
0.017919
You are tasked with implementing a function that generates a topological sort of a directed acyclic graph (DAG) for a given set of functions. The topological sort should reflect the order in which the functions need to be executed to produce the desired output. Your task is to create a function that takes a set of fun...
glaive
[ 0.04801495373249054, 0.031147900968790054, -0.04305410757660866, -0.024948788806796074, 0.028961410745978355, -0.0002693803689908236, -0.04070616886019707, 0.04896603897213936, 0.02114485763013363, 0.007728071417659521, 0.005267764441668987, 0.04087011516094208, -0.030295569449663162, -0.0...
0.830386
0.79497
0.035416
Can anyone suggest a solution for optimizing the given mathematical problem?
glaive
[ 0.02346520870923996, 0.01944483444094658, -0.04430777579545975, -0.03150507062673569, 0.02811408042907715, -0.01554452907294035, -0.017743216827511787, 0.05217192694544792, 0.06242541968822479, -0.031791504472494125, -0.006952934432774782, 0.0019675293006002903, -0.04347701370716095, -0.02...
0.787293
0.76116
0.026133
You are tasked with creating a CUDA C++ program to perform parallel reduction using helper functions provided in the utils.cuh file. The goal is to implement the parallelReduce function, which is designed to reduce an array of elements in parallel using CUDA. The parallelReduce function takes in three parameters: a poi...
glaive
[ 0.004644474480301142, 0.051828667521476746, -0.024799369275569916, -0.016420749947428703, 0.03751639649271965, 0.011101633310317993, -0.03335456922650337, 0.11660949885845184, 0.06212659180164337, 0.007306108716875315, 0.0024151059333235025, 0.04074680805206299, 0.0010325188050046563, 0.00...
0.79553
0.78006
0.01547
You are tasked with implementing a function called list_pad that takes a list and a padding element as input and returns the padded list. The padding element should be added to the end of the input list until the list reaches the desired length. If the list is already longer than the desired length, it should remain un...
glaive
[ 0.029761483892798424, 0.031183291226625443, -0.007004900835454464, -0.07065113633871078, 0.05252465605735779, -0.029536819085478783, -0.007189661730080843, 0.04505389556288719, 0.019629916176199913, -0.01136476919054985, -0.0021716738119721413, 0.04443081468343735, -0.04322286695241928, -0...
0.80207
0.763476
0.038594
You are tasked with implementing a function called "merging" in a programming language of your choice. The function should take in two arrays as input and merge them into a single array in a specific way. The "chooseIncoming" function should also be implemented to select the incoming elements based on a certain conditi...
glaive
[ 0.021589897572994232, 0.04774525389075279, -0.019979359582066536, -0.025351213291287422, 0.046171095222234726, -0.0200007576495409, -0.01853412762284279, 0.0654798299074173, 0.0414997898042202, -0.004491401370614767, 0.024443062022328377, 0.01455165445804596, 0.0030659844633191824, -0.0158...
0.804947
0.784774
0.020173
You are given a programming problem to calculate a sequence of numbers based on the following formula: a(n) = Sum_{k=1..n} floor(n/k)^2. Your task is to write a program to generate and output the sequence of numbers based on this formula for a given input n. Implement a function or program that takes an integer n as i...
glaive
[ 0.022018559277057648, 0.03432159870862961, -0.027919236570596695, -0.03642365336418152, 0.03485479950904846, -0.025607816874980927, -0.032725997269153595, 0.0711936354637146, 0.018964165821671486, -0.02651551365852356, 0.03359391540288925, 0.03828944265842438, -0.05208662152290344, 0.00473...
0.828772
0.781298
0.047473
You are tasked with creating a function that takes in a list of integers, along with two integer values, a and b. The function should return the sum of all the elements in the list that are greater than a and less than b. If there are no such elements in the list, the function should return 0. For example, if the inpu...
glaive
[ 0.020353194326162338, 0.026219837367534637, -0.04138515889644623, -0.03802473098039627, 0.058311812579631805, 0.002960121026262641, -0.025442950427532196, 0.05097949504852295, 0.04843830689787865, -0.007476938888430595, 0.015060482546687126, 0.05312515050172806, -0.038329944014549255, -0.0...
0.817361
0.757229
0.060132
You are tasked with implementing a program to perform sequence alignment using the Smith-Waterman algorithm. The goal is to align a set of DNA sequences (reads) to a set of reference DNA sequences (contigs) and determine the optimal alignment score, start, and end positions for each alignment. The program should utiliz...
glaive
[ 0.031030159443616867, 0.0054967571049928665, -0.03394493833184242, -0.03816290199756622, 0.021220434457063675, -0.022485144436359406, -0.03281933069229126, 0.06452767550945282, 0.03349932283163071, -0.029286077246069908, 0.027648232877254486, 0.021131137385964394, -0.011659158393740654, 0....
0.812168
0.791378
0.02079
You are tasked with implementing a function to split a given text node into two nodes at a specified offset, and keep both nodes in the tree as siblings. The function should take the following parameters: - The text node to be split - The offset at which the node should be split The function should return the new text...
glaive
[ 0.03091242164373398, 0.02634577639400959, -0.024136554449796677, -0.03152089938521385, 0.02685139700770378, -0.03443772345781326, -0.01238606870174408, 0.08128677308559418, 0.02566692605614662, -0.01657644286751747, 0.03665456548333168, 0.004960923455655575, -0.028129540383815765, 0.004218...
0.790833
0.768336
0.022497
You are tasked with creating a program that takes in a list of integers and returns the maximum difference between any two numbers in the list. If the list is empty or contains only one element, the program should return 0. Write a function called `max_difference` that takes in a list of integers and returns the maxim...
glaive
[ 0.04538954049348831, 0.01721564121544361, -0.023575754836201668, -0.038949109613895416, 0.042559195309877396, -0.019818712025880814, -0.04531088471412659, 0.05195581912994385, 0.05089307576417923, -0.03682571277022362, 0.02585836686193943, 0.04366029053926468, -0.027509160339832306, 0.0121...
0.82268
0.767537
0.055143
You are tasked with implementing a function to calculate the real and imaginary parts of a complex number. You should create a linear map version of the real part function, `re_lm`, and the imaginary part function, `im_lm`, from `ℂ` to `ℝ`. Your function should take a complex number as input and return its real and ima...
glaive
[ 0.03263705223798752, 0.058267589658498764, -0.015682879835367203, -0.04854118451476097, 0.04879986122250557, -0.017446545884013176, -0.00783342681825161, 0.06219448149204254, 0.03294290602207184, -0.0012963145272806287, 0.036420248448848724, 0.03835278004407883, -0.037051159888505936, -0.0...
0.801493
0.769694
0.031799
You are tasked with implementing a CUDA program to perform a 3D Fast Fourier Transform (FFT) using cuFFT library. The goal is to create three stages of FFT plans for a 2D grid in a 3D space and then execute these plans. You need to create three functions to plan the FFT stages: - void plan_2Dgrid_3D_stage1(int M, int ...
glaive
[ 0.020108480006456375, 0.05577487125992775, -0.03374001011252403, -0.04045606404542923, 0.043061092495918274, -0.009917310439050198, -0.03000296838581562, 0.08636388927698135, 0.05249073728919029, -0.0016209344612434506, 0.023948874324560165, 0.03133606165647507, -0.01059024315327406, -0.01...
0.792388
0.777535
0.014852
You are tasked with creating a program in TI-BASIC that simulates a coin flip and displays the results. The program should continuously flip the coin and display the outcomes of each flip until the user decides to stop the program. The program should also display "HEADS" or "TAILS" for each flip. Your task is to write ...
glaive
[ -0.006990916561335325, 0.03364448994398117, -0.028535887598991394, -0.042227838188409805, 0.03397846966981888, -0.026943137869238853, -0.0038269406650215387, 0.056205444037914276, 0.03593997657299042, -0.024450454860925674, 0.030836815014481544, 0.03739767149090767, -0.027415264397859573, ...
0.795271
0.778216
0.017055
You are tasked with solving a logic puzzle that involves determining the color of each house, the nationality of each resident, the type of pet each resident has, what they drink, and what brand of cigar they prefer. The following criteria should be met: 1. The Brit lives in the red house. 2. The Swede keeps dogs as p...
glaive
[ 0.007798606995493174, 0.04463516175746918, -0.03472732752561569, -0.024537477642297745, 0.03058820590376854, -0.04352400079369545, -0.019004175439476967, 0.034226611256599426, 0.06179913505911827, -0.028304364532232285, 0.02283240109682083, 0.0376071073114872, -0.04468989744782448, -0.0363...
0.801045
0.77759
0.023455
You are tasked with creating a function that checks if a given number is prime or not. The function should take an integer as input and return a boolean value indicating whether the number is prime or not. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. You shoul...
glaive
[ 0.02950151078402996, 0.019167782738804817, -0.0160968154668808, -0.026779407635331154, 0.038557298481464386, -0.030283123254776, 0.015698600560426712, 0.07466839253902435, 0.027063321322202682, -0.008484093472361565, 0.011682027950882912, 0.02188030071556568, -0.020731016993522644, -0.0275...
0.805332
0.77336
0.031973
You are required to implement a function that calculates the combination of two sets of orbs in a video game. Each orb has two attributes: health and energy, both represented as f32. You need to implement the following functions: 1. `either(a: &[Orbs], b: &[Orbs]) -> Vec<Orbs>`: This function takes two arrays of orbs,...
glaive
[ 0.019002389162778854, 0.024770591408014297, -0.0027136283461004496, -0.02371399849653244, 0.023863116279244423, -0.03137625753879547, -0.004452984314411879, 0.08786280453205109, 0.04543239250779152, -0.0012056680861860514, 0.02030944637954235, 0.03950365260243416, -0.009931372478604317, -0...
0.807659
0.787822
0.019837
How do I generate a Fibonacci sequence using Java?
glaive
[ -0.0068485368974506855, 0.016724232584238052, -0.025534693151712418, -0.03217212110757828, 0.028714032843708992, -0.041477400809526443, -0.017724743112921715, 0.048604175448417664, 0.028534822165966034, -0.04501312971115112, 0.02131780795753002, 0.03969899192452431, -0.03917601332068443, -...
0.787588
0.771757
0.015831
You are given an array of integers. Your task is to sort the array based on its values and their corresponding index in the array. For example, given the array [8, 3, 1, 2, 5, 4, 6, 7], after sorting, the array should look like [1, 2, 3, 4, 5, 6, 7, 8] because the value 1 is at index 2, the value 2 is at index 3, and s...
glaive
[ 0.03768032416701317, 0.03262392804026604, -0.009930321015417576, -0.03293241932988167, 0.024180317297577858, -0.03114853799343109, -0.03786339610815048, 0.04061222821474075, 0.03179772570729256, -0.017789732664823532, 0.022898977622389793, 0.015663819387555122, -0.05649030953645706, 0.0013...
0.811586
0.760338
0.051248
You are tasked with implementing a function MEMBERP-OF-REVERSE-LIST that takes a list L and an element X as input and returns true if X is a member of the reverse of L. You must ensure that the function efficiently utilizes the provided rewrite rules and type prescriptions to optimize its performance.
glaive
[ 0.013231164775788784, 0.021600745618343353, -0.024974649772047997, -0.03717384859919548, 0.0445638969540596, -0.025190191343426704, -0.009298009797930717, 0.062496598809957504, 0.05283918231725693, -0.0027816251385957003, 0.006458011455833912, 0.0471089668571949, -0.006357855629175901, -0....
0.80987
0.794768
0.015102
How can I generate a binary tree in Java using an array of integers?
glaive
[ -0.0033757993951439857, 0.02924179844558239, -0.0366327278316021, -0.029566112905740738, 0.02762802131474018, -0.062348462641239166, -0.01389403361827135, 0.045202914625406265, 0.02153501845896244, -0.0458231158554554, 0.02636725828051567, 0.020166536793112755, -0.044770773500204086, -0.00...
0.797949
0.778369
0.01958
You are required to implement a program that involves matrix multiplication and addition operations. Your program should be able to take input matrices x, w, and b, and perform the following operation: (x * w) + b. The program should be capable of compiling the operations and handling gradient calculations for backprop...
glaive
[ 0.021679529920220375, 0.02448117919266224, -0.015379377640783787, -0.04534044861793518, 0.048148345202207565, -0.0038665803149342537, -0.02365642786026001, 0.11755374073982239, 0.045763708651065826, -0.01658744178712368, 0.0014884115662425756, 0.03038172423839569, -0.031983375549316406, -0...
0.80149
0.783129
0.01836
How can I find the indices of the k smallest values in a numpy array? I'm currently using the `argmin` function to find the index of the single smallest value, but I need to find multiple smallest values. For example, with the array `A`: ```python import numpy as np A = np.array([1, 7, 9, 2, 0.1, 17, 17, 1.5]) print(A...
glaive
[ 0.018425578251481056, 0.04941222444176674, -0.0318777970969677, -0.014186138287186623, 0.0417262502014637, -0.03872444108128548, -0.017733002081513405, 0.04958212748169899, 0.012718060985207558, -0.014292079024016857, 0.029147174209356308, 0.007768314331769943, -0.027304550632834435, 0.019...
0.804376
0.77761
0.026766
You are tasked with creating a program that takes an array of exactly four unsigned 16-bit integers and prints the powers of two for each number in the array. The program should include two functions: one that contains a "for" loop and one that contains a "while" loop. The "printPowersOfTwo" function should take the ar...
glaive
[ 0.029425201937556267, 0.07106908410787582, -0.011662638746201992, -0.0352785661816597, 0.046523865312337875, -0.034482598304748535, -0.016622524708509445, 0.07449745386838913, 0.041272521018981934, -0.03937690705060959, 0.030144626274704933, 0.026629017665982246, -0.017011165618896484, -0....
0.813536
0.788767
0.02477
You are tasked with implementing a function that calculates the square of a given integer. However, there are certain constraints that need to be taken into account. The function should be able to handle both signed and unsigned integers, and it should also ensure that the result does not exceed the maximum value allow...
glaive
[ 0.02912203222513199, 0.04773494973778725, -0.022629553452134132, -0.029840480536222458, 0.04277951270341873, -0.01685643196105957, -0.018412770703434944, 0.07336361706256866, 0.042452286928892136, -0.010908510535955429, 0.043567854911088943, 0.030016278848052025, -0.031147178262472153, -0....
0.817884
0.786473
0.031411
You are required to write a program that reads a file containing data and performs a specific computation on it. The input file can be specified as a command-line argument. The program will read the input file and perform a series of operations on the data, including generating a set of points and triangles based on th...
glaive
[ 0.02313769795000553, 0.0281918253749609, -0.02704528346657753, -0.038478247821331024, 0.03696677088737488, -0.040415503084659576, -0.0179461482912302, 0.06351800262928009, 0.04383037984371185, -0.008602664805948734, 0.024341732263565063, 0.04955965653061867, -0.009664880111813545, -0.01422...
0.800919
0.786268
0.014651
I need to create a function in Scheme that takes in a function `fn`, and two integers `a` and `b`. The function should return the sum of the values of `fn` applied to each integer from `a` to `b`, inclusive. For example, if `fn` is `square`, and `a` is 1 and `b` is 3, the function should return 1^2 + 2^2 + 3^2 = 14.
glaive
[ 0.04371420666575432, 0.049926724284887314, -0.05059812217950821, -0.042267315089702606, 0.058499615639448166, -0.027058525010943413, -0.019907215610146523, 0.03972053900361061, 0.03118995763361454, 0.006619899999350309, 0.028957631438970566, 0.05656122416257858, -0.030982377007603645, -0.0...
0.808894
0.783731
0.025162
You are tasked with implementing a program to solve a harmonic oscillator ordinary differential equation (ODE) using the BDF (Backward Differentiation Formula) method. The system of ODEs is as follows: dy/dt = x[1] * y[2] d^2y/dt^2 = -y[1] - theta[1] * y[2] You are given initial conditions y0 = [y[1](0), y[2](0)], an ...
glaive
[ 0.011993189342319965, 0.031036216765642166, -0.04187903553247452, -0.04964631795883179, 0.035897448658943176, -0.0325368195772171, -0.00479459622874856, 0.07415025681257248, 0.057148486375808716, -0.004495088942348957, 0.012678937055170536, 0.022122228518128395, -0.03229241445660591, -0.00...
0.806588
0.784908
0.021679
How can I create a function that generates the Fibonacci sequence up to the n-th term?
glaive
[ 0.01594461128115654, 0.023926282301545143, -0.022406624630093575, -0.03089597448706627, 0.03237959370017052, -0.033661339432001114, -0.029569540172815323, 0.06565692275762558, 0.01872670091688633, -0.018551839515566826, 0.025788558647036552, 0.04230552539229393, -0.04321563243865967, -0.01...
0.800822
0.785681
0.015141
You are tasked with implementing a statistical model for a behavioral task using Stan, a probabilistic programming language. The model is based on the Linear Ballistic Accumulator (LBA) model, which is a mathematical model used to simulate decision making. The model includes functions for a probability density function...
glaive
[ 0.015091048553586006, 0.016419673338532448, -0.03353779390454292, -0.03624683618545532, 0.029417354613542557, -0.02228611707687378, -0.022397706285119057, 0.05764486640691757, 0.026389185339212418, -0.017879610881209373, 0.005449795164167881, 0.04866283759474754, -0.01971074938774109, 0.00...
0.799227
0.782255
0.016972
You are tasked with implementing a dual simplex algorithm to solve linear programming problems. The algorithm should take as input the number of variables (vars) and inequalities (ineqs), generate test data, and then run the dual simplex algorithm using both CPU and GPU parallel processing. The goal is to compare the p...
glaive
[ -0.003980466164648533, 0.02245279587805271, -0.033330321311950684, -0.032769978046417236, 0.024827634915709496, 0.009504128247499466, -0.024632107466459274, 0.10491956770420074, 0.042736150324344635, -0.03341811150312424, 0.016969820484519005, 0.02431974932551384, 0.016522279009222984, -0....
0.805963
0.784045
0.021918
You are tasked with implementing a quantum circuit simulation for a system with 16 qubits. The quantum state is represented by a complex-valued function called `amplitude(x, y)`. The probability of measuring a particular state is given by the absolute square of the amplitude, which can be calculated using the `probabil...
glaive
[ -0.006174635607749224, 0.026795387268066406, -0.031925708055496216, -0.028360165655612946, 0.04787905886769295, -0.026877453550696373, -0.023735778406262398, 0.07965394109487534, 0.023809192702174187, -0.006919208448380232, 0.034086063504219055, 0.03813117742538452, 0.0076102446764707565, ...
0.788906
0.761751
0.027155
You are tasked with implementing a set of functions in Mata for bracketing and bracket convergence used by censlope. The functions include _bcsf_bracketing(), _bcsf_bisect(), _bcsf_regula(), and _bcsf_ridders(). The goal is to find pairs of X values that bracket specific Y values and then converge these brackets to a u...
glaive
[ 0.041846442967653275, 0.026539893820881844, -0.029170537367463112, -0.027758972719311714, 0.04215738922357559, -0.025916671380400658, -0.02760547772049904, 0.06074460223317146, 0.050466783344745636, -0.03206631541252136, 0.00463289488106966, 0.039081525057554245, -0.01325758546590805, 0.00...
0.799882
0.784802
0.015081
You are tasked with creating a program that calculates the area of a circle using the formula A = πr^2. You need to write a function that takes the radius of the circle as input and returns the area. The value of π is 3.14. Your program should also include a main function that prompts the user to input the radius of th...
glaive
[ 0.0005926775629632175, 0.05290502682328224, -0.03307967260479927, -0.02859829179942608, 0.04923718050122261, -0.01866799220442772, -0.027481477707624435, 0.04171277955174446, 0.036975301802158356, 0.010656195692718029, 0.022001707926392555, 0.033274777233600616, -0.012205414474010468, -0.0...
0.787759
0.762073
0.025686
You are tasked with creating a program to calculate the probability amplitudes and probabilities for a quantum system with a given number of qubits, states, and name. The program should use the provided code snippet as a reference to define the functions amplitude, amplitude2, and probability, and then use NMaximize to...
glaive
[ 0.013412004336714745, 0.028534557670354843, -0.03162509202957153, -0.01823914796113968, 0.04443450644612312, -0.046597450971603394, -0.018142646178603172, 0.062089111655950546, 0.027194300666451454, 0.004132047761231661, 0.02211078256368637, 0.033281102776527405, -0.030275994911789894, -0....
0.796695
0.769289
0.027406
You are tasked with creating a class that represents a Rectangle and implementing a method to determine if two rectangles overlap. The class should have a method `overlaps` that takes another Rectangle as an argument and returns true if the two rectangles overlap, and false otherwise. The `overlaps` method should be a ...
glaive
[ 0.0012625382514670491, 0.018815219402313232, -0.018882466480135918, -0.019576597958803177, 0.024722762405872345, -0.016093049198389053, -0.009402049705386162, 0.0634901374578476, 0.03360256552696228, -0.01573946885764599, 0.033882055431604385, 0.04213659465312958, -0.010167917236685753, -0...
0.805166
0.789672
0.015494
You are tasked with creating and updating partitioned updatable AO tables in a database using SQL. The tables need to be created with specific partitioning and subpartitioning criteria, and then updated with new values. After updating the tables, you need to perform various queries to count the tuples and set certain p...
glaive
[ 0.04667667672038078, 0.0226456131786108, -0.02088106982409954, -0.005555377341806889, 0.011129920370876789, -0.033786289393901825, -0.006894886028021574, 0.07510151714086533, 0.03343620523810387, 0.009849660098552704, 0.020790837705135345, 0.022399550303816795, -0.01227992121130228, 0.0291...
0.788248
0.773941
0.014306
You are tasked with creating a function in a programming language that takes a real number as input and returns the result of a specific mathematical operation. The function should be named "bar" and should accept a single parameter of type real. Inside the function, you need to perform the following operation: add 2.0...
glaive
[ 0.044908665120601654, 0.04808594658970833, -0.04410169646143913, -0.026221226900815964, 0.03888458386063576, -0.003508542897179723, -0.014258377254009247, 0.0687299370765686, 0.03661119565367699, -0.0020770819392055273, 0.0061067454516887665, 0.05027638003230095, -0.020981205627322197, -0....
0.803501
0.787035
0.016466
You are tasked with implementing a program that calculates the sum of the 8th powers of the divisors of a given number. The program should take an input integer, n, and output the sum of the 8th powers of all the divisors of n. For example, if n=10, the divisors of 10 are 1, 2, 5, and 10. The sum of their 8th powers ...
glaive
[ 0.013417674228549004, 0.042736273258924484, -0.008183655329048634, -0.039776768535375595, 0.02992883138358593, -0.021619001403450966, -0.022751450538635254, 0.0579230971634388, 0.0523713044822216, -0.03044511377811432, 0.009839748032391071, 0.017607036978006363, -0.05387672409415245, -0.02...
0.806076
0.767103
0.038973
You are tasked with creating a DSL (Domain-Specific Language) called "Puzzler" for the streamlined creation of 2D puzzle games. The DSL should allow users to express simple grid-based puzzle games in a succinct and declarative way. Your task is to define the syntax and semantics of the Puzzler language, including the r...
glaive
[ -0.0033944975584745407, 0.016547219827771187, -0.024217719212174416, -0.04147912561893463, 0.029091157019138336, -0.002505481243133545, -0.017049677670001984, 0.03890560194849968, 0.04265907406806946, -0.031178927049040794, 0.029037943109869957, 0.040848035365343094, -0.017883339896798134, ...
0.806468
0.787694
0.018774
You are tasked with simulating a random variable and then approximating its mean using Monte Carlo integration. Specifically, you need to calculate the integral of the function h(x) = 4x^4 over the interval [0,1] using the classic Monte Carlo method. Write a program in R that generates a specified number of random sam...
glaive
[ 0.008498737588524818, 0.04178916662931442, -0.016736993566155434, -0.035874586552381516, 0.04706936702132225, -0.014046945609152317, -0.03814762830734253, 0.05863768607378006, 0.04225229099392891, 0.0000018366471294939402, 0.008465437218546867, 0.026633258908987045, -0.0039354790933430195, ...
0.787483
0.76436
0.023123
You are tasked with writing a Python function that takes a multi-dimensional array as input and returns a flattened version of the array. The function should handle arrays of any shape and size, and it should preserve the order of the elements in the original array. Write a function called `flatten_array` that takes o...
glaive
[ 0.01953813061118126, 0.05533992871642113, -0.0346328541636467, -0.047959934920072556, 0.054103411734104156, -0.025908639654517174, -0.007132571190595627, 0.03773782029747963, 0.03193866088986397, -0.016421210020780563, 0.00468422519043088, 0.016626087948679924, -0.03403674066066742, 0.0035...
0.793389
0.758535
0.034854
How can I create a code to find an element in a 2D matrix, where each row and column are sorted in ascending order?
glaive
[ 0.01919144205749035, 0.0175466425716877, -0.02953954227268696, -0.04393153637647629, 0.021222952753305435, -0.035963501781225204, -0.022286823019385338, 0.05938190966844559, 0.02038734033703804, -0.026588551700115204, 0.02150820568203926, 0.023152107372879982, -0.047844137996435165, -0.000...
0.804194
0.786959
0.017235
You are tasked with implementing a subroutine in Fortran that initializes default values for a given array V based on the input parameter ALG. If ALG is 1, the subroutine should set specific regression constants in the array V. If ALG is 2, the subroutine should set general unconstrained optimization constants in the a...
glaive
[ 0.009888584725558758, 0.0114176319912076, -0.02704721875488758, -0.048090383410453796, 0.04703466594219208, -0.010410529561340809, 0.004237037617713213, 0.052162475883960724, 0.04251391068100929, -0.03268436715006828, 0.007110239006578922, 0.022699695080518723, -0.007633973378688097, 0.007...
0.798664
0.783034
0.01563
What is the code to find the greatest common divisor of two given numbers?
glaive
[ 0.009865904226899147, 0.03185001015663147, -0.030022090300917625, -0.04832847788929939, 0.028247712180018425, -0.02025725692510605, -0.012068841606378555, 0.04272155463695526, 0.012264289893209934, -0.043534379452466965, 0.027176588773727417, 0.03530032932758331, -0.03051534667611122, -0.0...
0.791295
0.77095
0.020346
I have a circular doubly linked list represented as a bidirectional linked list. I need to solve the following two cases: 1) Reorganize the list by reversing the elements of each node connected to the last node. 2) Reverse all the nodes connected to the second last node without using any additional storage space. Ad...
glaive
[ -0.0057494062930345535, 0.041673969477415085, -0.014049279503524303, -0.04680024832487106, 0.01464790478348732, -0.013474499806761742, -0.012928578071296215, 0.056785698980093, 0.0444825142621994, 0.01749621145427227, 0.021395746618509293, 0.015283284708857536, -0.0006791496998630464, 0.00...
0.810065
0.788264
0.021801
You are tasked with implementing a function in C++ that takes in multiple arrays of float values, as well as various other parameters, and performs calculations on them. The function is expected to iterate through the arrays and apply a series of mathematical operations to the elements, updating the values in the desti...
glaive
[ 0.021910857409238815, 0.0413038432598114, -0.016116542741656303, -0.033012084662914276, 0.04268042743206024, -0.028316877782344818, -0.03352975845336914, 0.10095739364624023, 0.039884816855192184, -0.01221459824591875, 0.011004019528627396, 0.043055836111307144, -0.029678376391530037, -0.0...
0.813729
0.786381
0.027348
You are tasked with creating a program that takes a real number `x` as input and calculates the value of the expression (x + 1)^2 * x. Your program should then output the result of the expression in the form of x^3 + 2 * x^2 + x.
glaive
[ 0.029279330745339394, 0.027819711714982986, -0.04326849430799484, -0.04567255452275276, 0.03904286399483681, -0.04496316984295845, -0.016253944486379623, 0.0838366374373436, 0.06148107349872589, -0.028464244678616524, 0.02756451815366745, 0.04373980313539505, -0.04644770547747612, -0.03919...
0.824857
0.787669
0.037188
You are tasked with implementing a symbolic differentiation function in Scheme. The function should take in an expression and a variable and return the derivative of the expression with respect to the given variable. The expression can consist of addition, multiplication, and variables. For example, given the expressi...
glaive
[ 0.022451631724834442, 0.03196343034505844, -0.035074591636657715, -0.04807812720537186, 0.038315776735544205, -0.04859787970781326, -0.023354092612862587, 0.05753694102168083, 0.053647350519895554, 0.004570240620523691, 0.03021538257598877, 0.05834086239337921, -0.033221326768398285, 0.011...
0.787476
0.760914
0.026562
I'm trying to solve a programming problem called the 24 Game. The problem is as follows: I have 4 cards, each containing a number from 1 to 9. I need to determine if it is possible to use the operations of addition, subtraction, multiplication, and division, along with parentheses and exponentiation, to obtain the valu...
glaive
[ 0.030846770852804184, 0.019004490226507187, -0.026318779215216637, -0.024695951491594315, 0.030983665958046913, -0.043920036405324936, -0.002827207325026393, 0.06483834981918335, 0.03585939481854439, -0.028008650988340378, 0.016240885481238365, 0.025800036266446114, -0.027113236486911774, ...
0.835964
0.798778
0.037186
You are tasked with implementing a function in the programming language of your choice that calculates the value of pkzb_f based on the following equations: - pkzb_c is a constant with a value of 0.53 - pkzb_perp is a function that takes rs, z, xt, xs0, xs1, ts0, ts1 as input and calculates a value based on the given e...
glaive
[ 0.030544821172952652, 0.040689751505851746, -0.051469940692186356, -0.04780099540948868, 0.04760831594467163, -0.029659127816557884, -0.0044730836525559425, 0.05619756877422333, 0.042209260165691376, -0.0007524181855842471, 0.014846832491457462, 0.042084258049726486, -0.018528325483202934, ...
0.82774
0.801326
0.026414
You have a dataset containing information about race checkboxes, with a variable for each checkbox indicating whether it is checked 'Y' or not. Your task is to tabulate the count of 'Y' and 'N' for each race checkbox and output the total count of 'Y' checkboxes for each race category. Write a SAS program to read the ...
glaive
[ 0.009494525380432606, 0.0025583766400814056, -0.04358981177210808, -0.01694628596305847, 0.03157299384474754, -0.02191595360636711, -0.01972343400120735, 0.07234710454940796, 0.04882891848683357, -0.009400672279298306, 0.00366975087672472, 0.02794709801673889, -0.018260406330227852, -0.014...
0.804891
0.782512
0.022379
You are given a list of 2000 floating-point numbers, followed by a list of 200 integers. Your task is to implement a function that takes these two lists as input and returns the sum of each pair of corresponding elements from the two lists. For example, the sum of the first element in the first list and the first eleme...
glaive
[ 0.014581532217562199, 0.029999610036611557, -0.04821429401636124, -0.044575661420822144, 0.039108313620090485, -0.004476484842598438, -0.021743686869740486, 0.03205529972910881, 0.03728282451629639, -0.01950635388493538, 0.019914299249649048, 0.05508057773113251, -0.02573775313794613, -0.0...
0.824174
0.781327
0.042847
You are tasked with implementing a method for degree calculation on a partitioned graph using multiple GPUs. The method should be able to compute in-degree, out-degree, or the sum of both for a given vertex partitioning of the global graph. The function signature should be: ```cpp template<typename idx_t> gdf_error sn...
glaive
[ 0.022494815289974213, 0.02924150414764881, -0.024491487070918083, -0.022954322397708893, 0.019282272085547447, -0.027552375569939613, -0.038049474358558655, 0.07726100087165833, 0.02575141005218029, -0.02327701263129711, 0.04702236130833626, 0.03095715492963791, -0.00705756526440382, 0.010...
0.813166
0.783773
0.029393
You are tasked with implementing a function to calculate the product of two numbers. Write a function called "calculateProduct" that takes two arguments, "num1" and "num2", both of type "Int", and returns their product.
glaive
[ 0.023565685376524925, 0.039392001926898956, -0.02683916874229908, -0.02815534733235836, 0.054769255220890045, -0.011833188124001026, -0.033499833196401596, 0.07816089689731598, 0.045555230230093, -0.02014368772506714, 0.013912083581089973, 0.048120543360710144, -0.029677623882889748, -0.03...
0.797515
0.772315
0.0252
I have a list of integers and a target sum. How can I determine whether or not the target sum can be obtained from the integers provided?
glaive
[ 0.025113560259342194, 0.017742006108164787, -0.03569023683667183, -0.03066679649055004, 0.054988618940114975, -0.033778298646211624, -0.010815291665494442, 0.03522909805178642, 0.029716987162828445, -0.026058608666062355, 0.024851225316524506, 0.04372086748480797, -0.04332529380917549, -0....
0.801386
0.780741
0.020646
You are tasked with creating a program that includes data transformation and parameter transformation using the Stan programming language. The program should involve the use of different data types such as integers, real numbers, arrays, matrices, vectors, and row vectors. The transformation of data and parameters shou...
glaive
[ 0.031194183975458145, 0.028160924091935158, -0.04334481060504913, -0.050370823591947556, 0.04735876992344856, -0.016454732045531273, -0.017870452255010605, 0.05421661213040352, 0.027460766956210136, -0.02422397956252098, 0.010658841580152512, 0.04875045642256737, -0.02422007918357849, -0.0...
0.798359
0.783388
0.014971
Can you provide a function that can find the prime factorization of a given number?
glaive
[ 0.04120740666985512, 0.0353919193148613, -0.027016988024115562, -0.0374009795486927, 0.02396535314619541, -0.034383416175842285, -0.008113319985568523, 0.054300952702760696, 0.0429413877427578, -0.02047400176525116, 0.019342971965670586, 0.02567948028445244, -0.04009194299578667, -0.019841...
0.7923
0.774756
0.017544
You are tasked with implementing a program to simulate the process of simulated annealing and the canonical distribution in a thermodynamic system. The goal is to calculate the properties of the system based on its energy states and temperature. You will need to create a function that calculates the probability distri...
glaive
[ 0.024146001785993576, 0.01853579469025135, -0.03243323788046837, -0.020864326506853104, 0.029461069032549858, -0.04591714218258858, -0.029799925163388252, 0.08094525337219238, 0.01762380450963974, -0.006982807070016861, 0.030762089416384697, 0.035911429673433304, -0.02688400074839592, -0.0...
0.800494
0.776455
0.024039
You are tasked with implementing a function that splits a sequence of lines into three parts: `before-lines`, `range`, and `after-lines`, based on a given start and end range. The `range` is a string between the `start` and `end` indices in the input sequence of lines. If the `end` index is negative, there will be no r...
glaive
[ 0.02618478238582611, 0.01602737233042717, -0.03488871827721596, -0.033138033002614975, 0.045148685574531555, -0.025617673993110657, -0.04921538382768631, 0.06824449449777603, 0.04073215648531914, -0.011315123178064823, 0.016234541311860085, 0.042049091309309006, -0.03350069373846054, -0.02...
0.819688
0.791633
0.028054
You are tasked with implementing a CUDA template for a uniform random sort. The template should include a method for performing a prefix sum and a method for sorting a given array of real numbers. The prefix sum method should calculate the cumulative sum of a real number using bitwise shift operations, and the sort met...
glaive
[ 0.013344942592084408, 0.027328239753842354, -0.012645673006772995, -0.021893927827477455, 0.021092716604471207, -0.022709088400006294, -0.03170288726687431, 0.06875467300415039, 0.03413861244916916, -0.014712679199874401, 0.019999582320451736, 0.029621580615639687, -0.015565634705126286, 0...
0.809478
0.788554
0.020924
You are tasked with implementing a program that deals with relations and operations on them. The program will take in a set of relations and perform various operations on them. The operations include finding the inverse of a relation, restricting a relation to a specific set, finding the image and inverse image of a se...
glaive
[ 0.05085974186658859, 0.018194664269685745, -0.038485605269670486, -0.013011493720114231, 0.03751640394330025, 0.000898535072337836, -0.01758018136024475, 0.06684122234582901, 0.06113371625542641, -0.006894049234688282, 0.022131701931357384, 0.02952028438448906, -0.006352196913212538, 0.000...
0.806873
0.787925
0.018949
You are tasked with implementing a function that takes in a list of numbers and returns the maximum value from the list. Your function should be able to handle lists of any length and should return the maximum value found within the list.
glaive
[ 0.04596766084432602, 0.024381108582019806, -0.03136274218559265, -0.04736795648932457, 0.04898694157600403, -0.031694911420345306, -0.029622497037053108, 0.030968578532338142, 0.036725789308547974, -0.015240488573908806, 0.026913506910204887, 0.05670884624123573, -0.02370573580265045, -0.0...
0.811084
0.771973
0.039111
You are given a pyramid of numbers, where each number represents a node in the pyramid. Starting from the top of the pyramid and moving to adjacent numbers on the row below, find the maximum total from top to bottom. For example: ``` 75 95 64 17 47 82 ``` In this pyramid, the maximum total from top to bott...
glaive
[ 0.03033825196325779, 0.012592784129083157, -0.0038222160656005144, -0.04133828729391098, 0.02094098925590515, -0.030212609097361565, -0.013187814503908157, 0.05907018855214119, 0.02951005846261978, -0.014941878616809845, 0.026041654869914055, 0.040537334978580475, -0.031031189486384392, -0...
0.835856
0.804813
0.031042
How can I apply the Breadth-First Search algorithm to find the maximum distance between any two nodes in an n-ary tree, where n is a prime number?
glaive
[ 0.014088657684624195, 0.020477188751101494, -0.033403582870960236, -0.03283331170678139, 0.008522759191691875, -0.03713294863700867, -0.002554840175434947, 0.03016272373497486, 0.028842899948358536, -0.031065920367836952, 0.02801351249217987, 0.03152242302894592, -0.027394620701670647, -0....
0.812059
0.788759
0.0233
Can you provide a function that prints the numbers in an array in sorted order?
glaive
[ 0.030908066779375076, 0.03321320191025734, -0.03501158580183983, -0.03784415125846863, 0.03148543834686279, -0.03156024590134621, -0.026057429611682892, 0.03814249858260155, 0.0328930988907814, -0.02157890610396862, 0.019640985876321793, 0.032243870198726654, -0.05145031586289406, -0.02129...
0.800351
0.783875
0.016476
You are tasked with creating a Scala program that calculates the sum of all even numbers from 1 to 100. Your program should output the total sum of all even numbers.
glaive
[ 0.011519364081323147, 0.009992229752242565, -0.013424541801214218, -0.058222655206918716, 0.03303930535912514, -0.026730922982096672, -0.009211763739585876, 0.029944604262709618, 0.02765713632106781, -0.03784862905740738, 0.021214596927165985, 0.051852911710739136, -0.046793244779109955, -...
0.810563
0.7763
0.034263
You are tasked with creating a program that simulates a music beat tracker. The program will take in a series of time and beat information and output the corresponding note for each beat. The time and beat information will be provided in the form of a list of tuples, where each tuple contains the time (in milliseconds)...
glaive
[ 0.047878049314022064, 0.032259251922369, -0.047702301293611526, -0.013032287359237671, 0.0314713753759861, -0.030515138059854507, -0.027067987248301506, 0.059983279556035995, 0.03652367740869522, -0.01712544821202755, 0.03728263080120087, 0.01681438833475113, -0.025798430666327477, 0.01222...
0.804431
0.782606
0.021825
You are required to implement a CUDA kernel function that updates stress values in a 2D grid based on the given equations and input parameters. The function takes in various arrays as input, including d_vz, d_vx, d_szz, d_mem_dvz_dz, d_mem_dvx_dx, d_mem_dszz_dz, d_mem_dsxx_dx, d_Lambda, d_Den, d_ave_Byc_a, d_ave_Byc_b,...
glaive
[ -0.0031757319811731577, 0.051692090928554535, -0.02369183860719204, -0.038042910397052765, 0.030989794060587883, -0.0219943318516016, -0.02241687849164009, 0.08501975238323212, 0.03872830048203468, -0.015341686084866524, 0.021340247243642807, 0.03670698031783104, -0.005910180509090424, 0.0...
0.798611
0.780914
0.017697
What is the code to compute the maximum value of an array using a divide-and-conquer approach?
glaive
[ 0.011958697810769081, 0.03163086995482445, -0.022887734696269035, -0.031114818528294563, 0.020061267539858818, -0.03209363669157028, -0.018034443259239197, 0.045703087002038956, 0.0213942714035511, -0.05284695699810982, 0.033062342554330826, 0.05354120954871178, -0.03450939804315567, -0.00...
0.808769
0.790297
0.018472
You are tasked with writing a subroutine in Fortran to compute the harmonic mean of Kx on the cell face in the positive x-direction. The subroutine takes in grid indices i, j, k, and local sample index ismpl as input parameters and returns the hydraulic conductivity over delx. The harmonic mean is computed as follows: ...
glaive
[ 0.024286238476634026, 0.029948806390166283, -0.041680097579956055, -0.046364765614271164, 0.03329319879412651, -0.02862381748855114, -0.009705401957035065, 0.06481708586215973, 0.03012135811150074, 0.0060394536703825, 0.02574150823056698, 0.027995608747005463, -0.025620730593800545, 0.0124...
0.808617
0.784144
0.024473