instruction_seed
stringlengths
43
8.03k
source
stringclasses
1 value
embeddings
listlengths
1.02k
1.02k
mean_positive_score
float64
0.73
0.85
mean_negative_score
float64
0.71
0.82
difference_score
float64
0.01
0.07
You are tasked with creating a program that organizes a list of events based on their event type. The program should take in a list of event objects, each containing an event type and other relevant information, and sort them in ascending order based on their event type. The event type is represented by an integer valu...
glaive
[ 0.03927133232355118, -0.0010486360406503081, -0.033942464739084244, -0.040289439260959625, 0.01939488761126995, -0.02297799289226532, -0.03659692779183388, 0.07059430330991745, 0.0700354054570198, -0.003669778350740671, 0.03817948326468468, 0.05175064131617546, -0.027813255786895752, 0.000...
0.792411
0.777424
0.014987
What is the best way to separate each number in a list onto its own line?
glaive
[ 0.03449317440390587, 0.005494993645697832, -0.03946331515908241, -0.05456109717488289, 0.03792501240968704, -0.03322676569223404, 0.0009398889378644526, 0.023731492459774017, 0.04525868594646454, -0.03574047237634659, 0.0016102897934615612, 0.06008234992623329, -0.026156986132264137, -0.01...
0.784935
0.767844
0.017091
You are given a dataset with five columns: X, Y, TStamp, Pres., and EndPts. The DataSize is 575. Your task is to process this dataset and find the maximum value in the TStamp column. Write a program that reads the dataset and identifies the maximum value in the TStamp column. Your program should output the maximum val...
glaive
[ 0.022263988852500916, 0.016225771978497505, -0.04783214256167412, -0.049252789467573166, 0.0365496426820755, -0.047632426023483276, -0.018972301855683327, 0.07607555389404297, 0.05018727108836174, -0.01519740466028452, 0.03464102745056152, 0.037459976971149445, -0.034905705600976944, 0.008...
0.80951
0.789859
0.019651
You are tasked with creating a function that takes in a list of integers and returns the sum of all the positive integers in the list. If the list is empty, the function should return 0. If there are no positive integers in the list, the function should also return 0.
glaive
[ 0.01758744940161705, 0.02072829380631447, -0.03778884559869766, -0.0423298254609108, 0.05737480893731117, -0.014598770067095757, -0.028946278616786003, 0.030406899750232697, 0.039677027612924576, -0.008881204761564732, 0.00973163265734911, 0.03955748304724693, -0.031425971537828445, -0.035...
0.817574
0.772383
0.045191
You are tasked with implementing a CUDA kernel function to initialize particles for a Particle Swarm Optimization (PSO) algorithm. The kernel function should take in arrays for particle positions (xx), velocities (vx), personal best positions (pbestx), and a global best index (gbest), as well as the number of dimension...
glaive
[ -0.004580753855407238, 0.04505610093474388, -0.016341932117938995, -0.02137255109846592, 0.02572319097816944, -0.011449948884546757, -0.027046676725149155, 0.06075376644730568, 0.046725448220968246, -0.007590157445520163, 0.02066877856850624, 0.027401214465498924, -0.003924237098544836, -0...
0.797254
0.779855
0.017399
You are tasked with implementing a subroutine in Fortran called cmove. The subroutine takes four arguments: c1, c2, nmv, and i1. c1 is an array of characters, c2 is a string of 120 characters, nmv is an integer, and i1 is an integer. The subroutine should move nmv characters from c2 to c1, starting at index i1. Your ta...
glaive
[ 0.01201173197478056, 0.025792760774493217, -0.012411139905452728, -0.023360153660178185, 0.0491698756814003, -0.023151852190494537, -0.009858716279268265, 0.06111587956547737, 0.04855049028992653, -0.004308054689317942, 0.020462805405259132, 0.03126492723822594, -0.039435241371393204, -0.0...
0.812673
0.791443
0.02123
What is the algorithm to create an array of products where each element is the product of all the other elements in a given array?
glaive
[ 0.02544473111629486, 0.027905726805329323, -0.030930746346712112, -0.03367810696363449, 0.03509743884205818, -0.03228992596268654, -0.0348161943256855, 0.06761901080608368, 0.032171495258808136, -0.04082236438989639, 0.004908564500510693, 0.033013004809617996, -0.029285123571753502, -0.039...
0.810014
0.781465
0.028549
You are tasked with creating a function to calculate the probability of a quantum state. The function should take in two parameters, x and y, and return the squared absolute value of the amplitude calculated using the given formula: amplitude[x_,y_] := (complex calculations); probability[x_, y_] := Abs[amplitude[x, y]...
glaive
[ -0.002083407249301672, 0.036220867186784744, -0.036139167845249176, -0.02456679753959179, 0.04336702078580856, -0.013457030057907104, -0.008646453730762005, 0.071332648396492, 0.043717678636312485, 0.01563594862818718, 0.024404780939221382, 0.04112511873245239, -0.014393845573067665, -0.01...
0.78066
0.755004
0.025655
Can you provide an algorithm to find the closest pair of points in a given set of points?
glaive
[ 0.020038532093167305, 0.03153844550251961, -0.02680796943604946, -0.0140615813434124, 0.023978885263204575, -0.03276447951793671, -0.02600511722266674, 0.023074151948094368, 0.042918611317873, -0.03106350637972355, 0.021908624097704887, 0.03617432340979576, -0.020750610157847404, -0.012445...
0.791404
0.765501
0.025903
You are tasked with implementing a parallelized sparse matrix-vector multiplication (SpMV) using multiple GPUs. The goal is to efficiently perform the matrix-vector multiplication on a sparse matrix represented in Compressed Sparse Row (CSR) format. The given code snippet provides a baseline implementation for SpMV usi...
glaive
[ 0.009055360220372677, 0.03943999111652374, -0.0200017299503088, -0.02498524636030197, 0.034221336245536804, -0.006263363175094128, -0.03419189155101776, 0.0892927497625351, 0.03238381817936897, -0.02150646783411503, 0.009441947564482689, 0.02400091104209423, 0.014722935855388641, 0.0001163...
0.798166
0.778295
0.019871
You are tasked with implementing a parser for a simple arithmetic expression using the given grammar rules and token definitions. The grammar rules are as follows: - Define a token for NUM, representing a numeric value - Define a non-terminal symbol E, which represents an arithmetic expression - E can be a numeric valu...
glaive
[ 0.05983356758952141, 0.024048084393143654, -0.02084815315902233, -0.04250157251954079, 0.03705553710460663, -0.03533735126256943, -0.02163532003760338, 0.0879741907119751, 0.037940993905067444, -0.012757058255374432, 0.022296221926808357, 0.030232753604650497, -0.04283419996500015, -0.0384...
0.804809
0.779135
0.025674
You are required to write a program that performs matrix-matrix product using the CUBLAS library. The program should be able to generate two random matrices of size n x n and then calculate the product of these two matrices using both CPU and GPU. The program should also include functionality to check for correctness a...
glaive
[ 0.021380793303251266, 0.04537447541952133, -0.03934236615896225, -0.019093230366706848, 0.040326569229364395, -0.021225258708000183, -0.034999340772628784, 0.086234450340271, 0.029507901519536972, -0.03226789832115173, 0.0020811413414776325, 0.03769215568900108, -0.006268222350627184, -0.0...
0.800024
0.780201
0.019823
You are tasked with implementing a program to transform a given input data into a specific format. The input data consists of a list of numbers, and the transformation involves applying a mathematical operation to each number in the list. The transformed data should then be output in a new format. Write a program to t...
glaive
[ 0.042657606303691864, 0.04687971621751785, -0.04100293293595314, -0.05805417150259018, 0.052584100514650345, -0.023403111845254898, -0.014868561178445816, 0.04445395991206169, 0.03360579535365105, -0.03161637485027313, 0.015721211209893227, 0.02621455304324627, -0.05229290947318077, -0.024...
0.818231
0.771816
0.046415
You are tasked with implementing a BinarySerializer class in Java. The BinarySerializer should be able to serialize data into a binary format for storage or transmission. The class should have methods to write ASCII fixed-length strings, UTF-8 strings, 32-bit integers, binary data, arrays of UTF-8 strings, and hashmaps...
glaive
[ -0.0055795288644731045, 0.01931571774184704, -0.020483771339058876, -0.026024816557765007, 0.039945680648088455, -0.05721317231655121, -0.007661336101591587, 0.05240821838378906, 0.05970409885048866, -0.03164732828736305, 0.03579426184296608, 0.019666308537125587, -0.021148599684238434, -0...
0.776936
0.761887
0.01505
You need to implement a Prolog predicate that finds the maximum element in a list. The predicate should take a list of integers and return the maximum value in that list.
glaive
[ 0.043670713901519775, 0.021146927028894424, -0.01796836405992508, -0.051666442304849625, 0.040037911385297775, -0.031218497082591057, -0.01631084643304348, 0.03781420364975929, 0.036265429109334946, -0.0207375381141901, 0.02607123926281929, 0.06378643214702606, -0.01807943359017372, 0.0073...
0.81418
0.792996
0.021184
You are tasked with creating a robot task to make a robot reach a specific point. The robot specifications and initial configuration are provided as follows: Robot Specifications: - Robot Name: TALOS - Operational Points Map: - 'left-wrist' : 'arm_left_7_joint' - 'right-wrist' : 'arm_right_7_joint' - 'lef...
glaive
[ 0.01688523218035698, 0.023290181532502174, -0.02054734155535698, -0.03636312857270241, 0.025444235652685165, -0.010599817149341106, -0.010531202889978886, 0.042212728410959244, 0.03340485319495201, -0.009635530412197113, 0.023825375363230705, 0.060931723564863205, -0.020363379269838333, -0...
0.802134
0.78339
0.018744
You are required to write a program that takes a list of three numbers as input and prints the sum of the squares of the two greater numbers.
glaive
[ 0.01238218229264021, 0.029659820720553398, -0.042282115668058395, -0.05242118239402771, 0.05102599412202835, 0.00875234603881836, -0.01957298070192337, 0.054728757590055466, 0.0405600368976593, -0.030078787356615067, 0.04339241981506348, 0.05556381121277809, -0.06061294302344322, -0.038316...
0.81295
0.778601
0.034348
You are tasked with implementing a function to compare an input image to a reference image and compute the L2-norm between them. The input image and reference image are represented as arrays of real numbers, and the comparison should be performed in parallel using CUDA C++. Your task is to create a function that takes...
glaive
[ -0.02112385630607605, 0.03994303569197655, -0.01266227662563324, -0.02287568897008896, 0.029965389519929886, -0.0033896903041750193, -0.03642934188246727, 0.10424940288066864, 0.045658133924007416, -0.022296536713838577, 0.016863804310560226, 0.021769750863313675, -0.0044621871784329414, 0...
0.801815
0.782594
0.019221
You are tasked with implementing a subroutine in Fortran called WRESS. This subroutine is responsible for writing the side set information for a 3D database. The subroutine takes in various input parameters, including ids for front and back surface side sets, the elements and nodes in the front and back surface side se...
glaive
[ 0.018024910241365433, 0.021349499002099037, -0.02236238867044449, -0.03412441164255142, 0.027686376124620438, -0.0002823226386681199, -0.009756038896739483, 0.06780421733856201, 0.04879762977361679, 0.007984190247952938, 0.03298705071210861, 0.06578286737203598, -0.012801133096218109, 0.00...
0.799893
0.78548
0.014412
Can you provide a C program that generates a 2D array filled with random numbers between 0 and 9?
glaive
[ 0.00034624795080162585, 0.03295988589525223, -0.02762705646455288, -0.03159186616539955, 0.019046423956751823, -0.046347834169864655, -0.042419228702783585, 0.057878367602825165, 0.030315183103084564, -0.03790033981204033, 0.03111245110630989, 0.04644177481532097, -0.05866742134094238, -0....
0.792464
0.772631
0.019834
You are tasked with implementing a batched reduction operation on a matrix. The output matrix will have different dimensions than the input matrix, and the reduction will be applied at a specific dimension of the input matrix. The types of the input matrix elements (A), accumulation, alpha, and beta are provided, as we...
glaive
[ 0.029570093378424644, 0.030660608783364296, -0.04469757154583931, -0.01493634469807148, 0.0581965334713459, -0.020390396937727928, -0.005098849534988403, 0.08469511568546295, 0.05968160554766655, -0.0015740470262244344, 0.003624402219429612, 0.03401592746376991, -0.02928314544260502, -0.00...
0.808071
0.785366
0.022705
You are required to write a Fortran module that calculates the convex hull of a set of points using the qhull algorithm. The module should contain a function `qhull` that takes in the points as a two-dimensional array of real numbers, along with optional flags and an optional output file name. The function should retur...
glaive
[ -0.0032308276277035475, 0.04501188546419144, -0.022679254412651062, -0.038237787783145905, 0.024506228044629097, -0.014433588832616806, -0.021874021738767624, 0.06279784440994263, 0.03924081102013588, -0.020617833361029625, 0.017987340688705444, 0.041139647364616394, -0.043006811290979385, ...
0.806812
0.788927
0.017885
You are tasked with writing a function to compute the characteristic "feature size" for a given mesh. The feature size is defined as an approximation to the median edge length of the mesh. The function should take into account the number of faces in the mesh and compute the feature size based on a set of random samples...
glaive
[ 0.01620309054851532, 0.030123896896839142, -0.03502426669001579, -0.054925817996263504, 0.045043233782052994, -0.00165532564278692, -0.038887832313776016, 0.09254773706197739, 0.025339264422655106, -0.0012499985750764608, 0.032348692417144775, 0.04805758222937584, -0.022523649036884308, -0...
0.797514
0.772558
0.024956
You are tasked with writing a program to find all numbers k such that 23*k+1 is a perfect square. Your program should output the list of all such numbers.
glaive
[ 0.030694594606757164, 0.04927998408675194, -0.037134792655706406, -0.06873220950365067, 0.047578003257513046, -0.03229891508817673, -0.005957385059446096, 0.03518800809979439, 0.033378198742866516, -0.03458869084715843, 0.04253852739930153, 0.03070095367729664, -0.041761092841625214, -0.02...
0.818467
0.780208
0.038259
You are tasked with implementing a program to calculate the value of a given sequence based on the following formula: G.f.: Sum_{n>=0} (n+2)^n * x^n / (1 + (n+2)*x)^n. The input to the program will be a single integer representing the value of 'n'. The program should then calculate the nth value of the sequence base...
glaive
[ 0.03148874640464783, 0.05029851198196411, -0.029577691107988358, -0.03563401475548744, 0.040285855531692505, -0.01884354278445244, -0.021233903244137764, 0.08250211179256439, 0.03916032239794731, -0.03306472301483154, 0.02297750674188137, 0.026562029495835304, -0.05234876275062561, -0.0212...
0.830294
0.78302
0.047274
Write a program in Dart that demonstrates the use of List, Set, and Map data structures. Create a List of approved names, add a duplicate name, and then print the list, access an element at a specific index, and print the length of the list. Then, create a Map of names and phone numbers, including a duplicate key, and ...
glaive
[ 0.025002216920256615, 0.01983751729130745, -0.01047766488045454, -0.042002756148576736, 0.029649954289197922, -0.0422692596912384, -0.032822199165821075, 0.049706194549798965, 0.03217371925711632, -0.03446689993143082, 0.022869322448968887, 0.030480200424790382, -0.03330441564321518, -0.01...
0.80525
0.790309
0.014941
In the given programming problem, we are working with sets and defining operations on them. The goal is to implement a function that takes a set of type α and returns another set of type β based on a given function. We need to define the image function, which takes a function f : α → β and a set s : Set α, and returns ...
glaive
[ 0.023015905171632767, 0.02516874112188816, -0.03331303223967552, -0.011644070968031883, 0.04945999011397362, -0.02403845824301243, -0.00681880209594965, 0.08600936830043793, 0.054664045572280884, -0.015239001251757145, 0.019902897998690605, 0.024131162092089653, -0.014422204345464706, -0.0...
0.80458
0.78997
0.01461
You are tasked with implementing a parallel pseudo-random number generator (PRNG) using CUDA and cuRAND library. The goal is to generate a sequence of random numbers on the GPU and store the results in an array. You will need to implement two functions: uniform_prng_launcher and gaussian_prng. The uniform_prng_launcher...
glaive
[ -0.006583986803889275, 0.037277448922395706, -0.021139362826943398, -0.036256343126297, 0.01340445689857006, 0.0023714802227914333, -0.046177253127098083, 0.08461610972881317, 0.026190493255853653, -0.01468071062117815, 0.01674644835293293, 0.0422554574906826, -0.0014043228002265096, 0.016...
0.798458
0.777963
0.020495
You are tasked with implementing a function to correct the disparity range in a stereo matching algorithm. The function will take an input disparity map represented as a 2D array of uint16_t, along with the width, height, and pitch of the array. The function should also take in a boolean flag for subpixel disparity and...
glaive
[ -0.0023888444993644953, 0.03495374321937561, -0.013273951597511768, -0.02715167962014675, 0.031427595764398575, -0.0007274272502399981, -0.033296532928943634, 0.08624915778636932, 0.05274413153529167, -0.012903913855552673, 0.027443232014775276, 0.02743126079440117, -0.0058296676725149155, ...
0.801732
0.781157
0.020575
Is there a way to search for a specific element in a sorted array using a variant of the binary search algorithm called the Interpolation Search algorithm? Can you provide a C program example that demonstrates how to implement this algorithm?
glaive
[ 0.013373471796512604, 0.03629392385482788, -0.025039341300725937, -0.02862207591533661, 0.012719687074422836, -0.048308223485946655, -0.01816985197365284, 0.07432843744754791, 0.03011489473283291, -0.033480606973171234, 0.036639049649238586, 0.011833978816866875, -0.051815129816532135, -0....
0.799302
0.781275
0.018027
You are required to implement a function in C++ using the CUDA and NVGRAPH libraries to perform spectral clustering on a given graph. The function should take in a graph represented by a gdf_graph struct, the number of clusters, the number of eigen vectors, eigenvalue tolerance, maximum eigenvalue iterations, k-mean to...
glaive
[ 0.0008994988165795803, 0.01475577987730503, -0.030023550614714622, -0.027012180536985397, 0.04452046751976013, -0.008715745061635971, -0.028819356113672256, 0.08232128620147705, 0.04779649153351784, -0.003555850824341178, 0.01683645509183407, 0.03211100772023201, -0.003043748438358307, 0.0...
0.796585
0.779498
0.017088
You are tasked with writing a Fortran program that includes a subroutine to perform matrix multiplication. The program should take input from various arrays and perform matrix multiplication operations on them. The arrays have been initialized with specific values, and the program is expected to produce specific result...
glaive
[ 0.023842407390475273, 0.030917925760149956, -0.019000887870788574, -0.0355561263859272, 0.04393979161977768, -0.014829455874860287, -0.013652690686285496, 0.07048501819372177, 0.028470760211348534, -0.00036200915928930044, 0.002525262301787734, 0.03367083519697189, -0.03688259795308113, -0...
0.803883
0.777997
0.025886
You are tasked with creating an XSLT stylesheet that counts the number of preceding text nodes for each "center" element in an XML document and displays their positions and values. Create an XSLT stylesheet with the following requirements: - Use the XML namespace "http://www.w3.org/1999/XSL/Transform" and version 1.0....
glaive
[ 0.016771959140896797, 0.016395004466176033, -0.04643159732222557, -0.04075024649500847, 0.008851383812725544, -0.025402730330824852, -0.003454460296779871, 0.0746598169207573, 0.03948871046304703, -0.018732383847236633, 0.020167266950011253, 0.032720066606998444, -0.03745187446475029, 0.00...
0.795331
0.771578
0.023753
Can you provide a function that finds the kth largest element in a given array?
glaive
[ 0.04105113074183464, 0.05967921018600464, -0.034212689846754074, -0.051064860075712204, 0.034732885658741, -0.0427934005856514, -0.015956776216626167, 0.046437185257673264, 0.035238947719335556, -0.01904052309691906, 0.03952595591545105, 0.02699573151767254, -0.035981185734272, 0.000687482...
0.806888
0.785222
0.021666
You are tasked with creating a program in a type theory language that defines instances for ring, semiring, and related structures on Pi Types.
glaive
[ 0.0034041255712509155, 0.03088916465640068, -0.030293399468064308, -0.018786445260047913, 0.03870764002203941, -0.035333290696144104, -0.008849638514220715, 0.051506344228982925, 0.028452634811401367, -0.020703570917248726, 0.033918481320142746, 0.025395352393388748, -0.01736186072230339, ...
0.806401
0.786905
0.019495
You are tasked with implementing a CUDA program that performs the SAXPY (Single-precision A*X Plus Y) operation. The SAXPY operation is defined as y[i] = alpha * y[i] + x[i] for each element i in the input arrays x and y, where alpha is a scalar value. Your task is to write a CUDA kernel function called saxpy that ta...
glaive
[ 0.006866258569061756, 0.03368359059095383, -0.022116713225841522, -0.026245499029755592, 0.022657087072730064, -0.0010660368716344237, -0.01976650580763817, 0.08429470658302307, 0.04218165576457977, -0.028337404131889343, 0.036074165254831314, 0.03406331315636635, -0.0077712684869766235, -...
0.804382
0.787001
0.017381
You are tasked with creating a Python function that calculates the factorial of a given integer. The function should take an integer as input and return its factorial as an integer. The factorial of a non-negative integer *n*, denoted as *n!*, is the product of all positive integers less than or equal to *n*. For examp...
glaive
[ 0.0188901349902153, 0.0543682761490345, -0.01868644542992115, -0.027317121624946594, 0.04573784023523331, -0.0353114977478981, -0.025342505425214767, 0.04008322209119797, 0.03027264028787613, -0.004932514391839504, 0.018110033124685287, 0.04970065876841545, -0.04274044930934906, -0.0033223...
0.789928
0.74554
0.044387
You are working on a project that involves implementing the Permutohedral algorithm using C++ and CUDA for GPU acceleration. The Permutohedral algorithm is used for high-dimensional filtering and is a crucial part of your project. You need to implement the reverse operation of the Permutohedral algorithm on the GPU. Th...
glaive
[ 0.005952502600848675, 0.046343639492988586, -0.006000037305057049, -0.018189260736107826, 0.01974036544561386, -0.006979755591601133, -0.03746393322944641, 0.10949032753705978, 0.039547353982925415, -0.02080264501273632, 0.013082769699394703, 0.028928471729159355, 0.0032698852010071278, 0....
0.80561
0.78447
0.02114
I need to create a program that calculates the factorial of a given number using C programming language. The program should take a single integer input from the user and then calculate and print the factorial of that number. The factorial of a number n is defined as the product of all positive integers less than or equ...
glaive
[ 0.027738748118281364, 0.03492765873670578, -0.027419792488217354, -0.019605617970228195, 0.05203119292855263, -0.04988139495253563, -0.023631064221262932, 0.06128304824233055, 0.04519663006067276, -0.02606051415205002, -0.0017166483448818326, 0.05090905353426933, -0.04926493018865585, -0.0...
0.794392
0.768018
0.026374
You are required to create a cost function for a GPU using CUDA and implement the quadratic optimization problem. The cost function is for minimizing the quadratic equation in a form of f(x) = x^TAx + bx + c, where A is a matrix, b is a vector, and c is a scalar constant. The problem is to implement the 'f_gradf' metho...
glaive
[ 0.0006623881636187434, 0.05129403993487358, -0.03066219575703144, -0.02689484879374504, 0.03488186374306679, -0.025355709716677666, -0.02168196253478527, 0.09614986181259155, 0.034761715680360794, -0.01960698515176773, 0.019565070047974586, 0.031052930280566216, -0.01632196642458439, 0.003...
0.80022
0.784998
0.015222
You are tasked with creating a program to calculate the probability of a quantum state and then visualize the results in a 3D plot and contour plot. The probability function is given by: \[ \text{probability}[x, y] = \left| \text{amplitude}[x, y] \right|^2 \] Where the amplitude function is defined as: \[ \text{ampl...
glaive
[ 0.004440926015377045, 0.03997764736413956, -0.034133538603782654, -0.021398508921265602, 0.03804894536733627, -0.024964042007923126, -0.03304791823029518, 0.0776515007019043, 0.037026453763246536, 0.014895837754011154, 0.02664998173713684, 0.03454942628741264, -0.023029383271932602, -0.003...
0.801835
0.770357
0.031478
How can an algorithm be created to detect collisions between two circles?
glaive
[ 0.008849787525832653, 0.017959754914045334, -0.01593589410185814, -0.015938669443130493, 0.03137822821736336, -0.00265939231030643, -0.03846978396177292, 0.04532450810074806, 0.028457799926400185, -0.032734550535678864, 0.01871270127594471, 0.021054735407233238, -0.008570637553930283, -0.0...
0.779998
0.760128
0.01987
You are given a series of navigation instructions to move a ship in a 2D grid. The navigation instructions are represented by a series of actions, each with a specific direction and distance. The ship starts at the origin (0, 0) and has a initial heading of east (1, 0). The actions include the following: - Action::Nort...
glaive
[ 0.01550232619047165, 0.02163851447403431, -0.02004231885075569, -0.03445708751678467, 0.0216671209782362, -0.017501192167401314, -0.0347716249525547, 0.047938935458660126, 0.04885437712073326, -0.007892000488936901, 0.038434676826000214, 0.01436071377247572, -0.030683886259794235, -0.00629...
0.80682
0.76599
0.04083
You have been tasked with implementing a program that deals with edges in a 2D environment. You need to create an enum called Edge, with the following variants: right, left, top, and bottom. Additionally, you need to implement the following methods for the Edge enum: - opposing: a method that returns the opposite edge ...
glaive
[ 0.02479088492691517, 0.013308832421898842, -0.018996911123394966, -0.02252587117254734, 0.022846920415759087, -0.04074620455503464, -0.022158069536089897, 0.0637015700340271, 0.03892295062541962, -0.017600463703274727, 0.0392807200551033, 0.03642048314213753, -0.011246866546571255, -0.0090...
0.812596
0.787751
0.024844
You are given a task to implement a solution for parsing and processing a specific input format. The input consists of nested arrays containing either numbers or nested arrays. The goal is to process the input and perform specific operations on the values to calculate the magnitude of the resulting value. Write a func...
glaive
[ 0.021289439871907234, 0.03543395176529884, -0.018724944442510605, -0.045221030712127686, 0.04737498611211777, -0.023557811975479126, -0.015937430784106255, 0.0421842522919178, 0.041873108595609665, -0.010433249175548553, 0.010751266032457352, 0.027160102501511574, -0.04487558454275131, -0....
0.831249
0.779206
0.052043
You are working with a dataset called "NASAUnderstory.csv" that contains information about NASA Understory species. You need to perform hierarchical clustering on the dataset using different distance methods and visualize the clustering results. Specifically, you need to: 1. Read the dataset "NASAUnderstory.csv" into R...
glaive
[ -0.008604023605585098, 0.02426697500050068, -0.01743309013545513, -0.041740793734788895, 0.023723658174276352, -0.0148075632750988, -0.02142644114792347, 0.047736041247844696, 0.05411643534898758, 0.020283538848161697, 0.019972218200564384, 0.02397308126091957, -0.0185613464564085, -0.0057...
0.783709
0.763798
0.019911
You are tasked with creating a program that calculates the average of a set of numbers. The program should take in a list of integers as input and return the average of those numbers. You should implement this program in C++ using the Clang-CXX compiler. Write a function called calculateAverage that takes in a vector ...
glaive
[ 0.02127736061811447, 0.03296868875622749, -0.02325013466179371, -0.03596130758523941, 0.05499658361077309, -0.02070448361337185, -0.04555787518620491, 0.08885619789361954, 0.024279111996293068, -0.02301960252225399, 0.015749478712677956, 0.026859311386942863, -0.03500343859195709, -0.01065...
0.793987
0.748669
0.045319
You are tasked with creating a program that takes a string as input and counts the frequency of each character in the string. The program should then output the characters along with their frequencies in descending order. For example, if the input string is "hello world", the program should output: l: 3 o: 2 d: 1 e: 1...
glaive
[ 0.01923360303044319, 0.026372583582997322, -0.023173855617642403, -0.040633704513311386, 0.03711758553981781, -0.02835562638938427, -0.005328487139195204, 0.04169487580657005, 0.009993031620979309, -0.015445083379745483, 0.013279888778924942, 0.02772444114089012, -0.03891434147953987, -0.0...
0.812845
0.761303
0.051542
You are tasked with optimizing a given mathematical function and visualizing its output. The function is defined as follows: function[x_, y_] := $Conjugate[Exp[-16 I y] (1 (I Sin[x])^6 Cos[x]^10 + 1 (I Sin[x])^10 Cos[x]^6) + Exp[-12 I y] (15 (I Sin[x])^5 Cos[x]^11 + 15 (I Sin[x])^11 Cos[x]^5 + ... + 2 (I Sin[x])^8 Cos...
glaive
[ 0.018921004608273506, 0.02853534184396267, -0.0456170029938221, -0.025480452924966812, 0.03921746835112572, -0.020153211429715157, -0.03586660325527191, 0.05915050581097603, 0.05355332791805267, 0.014508754946291447, 0.02931472659111023, 0.04333822801709175, -0.025889607146382332, -0.00593...
0.803265
0.769844
0.033421
You are given a problem to implement the ECL-MIS (Maximal Independent Set) algorithm that operates on graphs stored in binary CSR format. The goal is to create a high-quality and fast implementation for GPUs. The algorithm should find the maximal independent set of a given graph. The input to the algorithm consists of...
glaive
[ 0.01771712303161621, 0.018161052837967873, -0.007198421750217676, -0.02773156575858593, 0.03283672407269478, -0.02154500223696232, -0.03429177403450012, 0.054367709904909134, 0.04641979932785034, -0.03311339393258095, 0.014183650724589825, 0.01858786679804325, -0.01825166866183281, 0.00288...
0.820571
0.785871
0.0347
You are given a function f(x) and an integer x. The function f(x) takes an integer as input and returns an integer. You also have the following information: - f(x) + f(x-1) = x^2 - f(19) = 94 Your task is to write a program to calculate the value of f(94) % 1000.
glaive
[ 0.03523143008351326, 0.021177498623728752, -0.04910307377576828, -0.03362817317247391, 0.032010965049266815, -0.047892652451992035, -0.011984799988567829, 0.0613175630569458, 0.04414820298552513, -0.00010202080011367798, 0.04422580450773239, 0.031571146100759506, -0.029579684138298035, -0....
0.82538
0.792199
0.033181
You are tasked with implementing a weighted low-rank approximation algorithm using alternating minimization. The goal is to recover a ground truth low-rank matrix from noisy observations of the entries. The algorithm should provide a provable recovery guarantee, bounding the spectral norm of the difference between the ...
glaive
[ 0.004333027638494968, 0.023278336971998215, -0.020134354010224342, -0.027622533962130547, 0.024312973022460938, -0.035021744668483734, -0.009540321305394173, 0.07077310234308243, 0.010016296990215778, -0.022793354466557503, 0.009565777145326138, 0.021786225959658623, -0.003986998926848173, ...
0.799615
0.776878
0.022737
Can you provide a Java program that performs a linear search on elements of an array and returns true if the element is found or false if not?
glaive
[ -0.0023452178575098515, 0.02131401188671589, -0.055379100143909454, -0.03717251121997833, 0.025350181385874748, -0.05574862286448479, -0.0073802233673632145, 0.056192997843027115, 0.029327748343348503, -0.05022132769227028, 0.030735520645976067, 0.01571803353726864, -0.028947802260518074, ...
0.808709
0.794079
0.01463
Can you help me modify this code to print out the summation of all positive numbers in the given array?
glaive
[ -0.007593910209834576, 0.02863972820341587, -0.02554405853152275, -0.03610586002469063, 0.04372771456837654, -0.05190454423427582, -0.026998691260814667, 0.03634871542453766, 0.04724781960248947, -0.029168207198381424, 0.005584394093602896, 0.022325409576296806, -0.06245821341872215, -0.02...
0.809968
0.793344
0.016623
You are tasked with creating a program to solve a system of ordinary differential equations (ODEs) using the integrate_ode_rk45 function in Stan. The program should take in input data consisting of N observations, each with two variables (V1 and V2) and two standard deviation variables (V1stds and V2stds). Additionally...
glaive
[ 0.020059531554579735, 0.02377217635512352, -0.03318331763148308, -0.052877604961395264, 0.04532356932759285, -0.006503772456198931, -0.01917303539812565, 0.061472032219171524, 0.04790075123310089, -0.0020735180005431175, 0.014103111810982227, 0.03666003420948982, -0.03386518359184265, -0.0...
0.805631
0.782272
0.023359
You are tasked with implementing a graph data structure that supports different types of representations. The graph can be represented as an adjacency matrix, an adjacency list, an edge list, or a pointer structure. Each representation has its own advantages and disadvantages, and you need to provide a way to create an...
glaive
[ 0.014072232879698277, 0.0026300002355128527, -0.029670070856809616, -0.020675338804721832, 0.03650565445423126, -0.039194125682115555, -0.023890670388936996, 0.08382415771484375, 0.05280296504497528, -0.022757966071367264, 0.026438497006893158, 0.03286116197705269, -0.0067105102352797985, ...
0.808838
0.789117
0.019721
You are given the task of writing a program to implement matrix multiplication using shared memory in CUDA C. The program should take two matrices A and B as input and produce the result matrix C. The dimensions of the matrices are assumed to be multiples of a specified block size. The matrices are represented using th...
glaive
[ 0.02770283818244934, 0.041779741644859314, -0.026302438229322433, -0.02481672912836075, 0.039996154606342316, -0.01873852126300335, -0.027128584682941437, 0.10150585323572159, 0.03475344553589821, -0.03304886445403099, 0.009029150009155273, 0.018359726294875145, -0.023938966915011406, -0.0...
0.789517
0.758856
0.03066
You are tasked with creating a class that simulates the sum of two dice rolls and returns the probability distribution function (pdf) of the sum. The class should have a method called `sum_two_dice` that returns a dictionary where the keys are the possible sums of the two dice and the values are the corresponding proba...
glaive
[ -0.009001401253044605, 0.012854660861194134, -0.03264577314257622, -0.028320573270320892, 0.03899310901761055, -0.012885088101029396, -0.02216864936053753, 0.04969845712184906, 0.03384432941675186, -0.013697478920221329, 0.027241574600338936, 0.037691812962293625, -0.006748322397470474, -0...
0.804521
0.789386
0.015134
Is there an efficient sorting algorithm that I can use to sort a given list of integer values?
glaive
[ 0.026416270062327385, 0.005334066692739725, -0.026292530819773674, -0.02981163188815117, 0.034710243344306946, -0.0415867418050766, -0.02958044968545437, 0.035466939210891724, 0.037612125277519226, -0.033005695790052414, 0.02934071607887745, 0.041163019835948944, -0.05300725996494293, -0.0...
0.793705
0.773342
0.020363
You are tasked with creating a program that generates a sprite for a 2D game. The sprite should have the following properties: - Model name: GMSprite - MVC version: 1.12 - Name: spr_pinkman_fall - The sprite should not be for 3D - It should not be horizontally tiled - It should not be vertically tiled - The bottom bou...
glaive
[ -0.019506333395838737, 0.02139190025627613, -0.008184741251170635, -0.04785200208425522, 0.04987485706806183, -0.04565756767988205, -0.033755164593458176, 0.08060766011476517, 0.04159114882349968, -0.02665419690310955, 0.03936171531677246, 0.036090150475502014, -0.019616298377513885, 0.003...
0.770915
0.755571
0.015344
You are tasked with implementing a function to calculate the form factor (FF) of a given atom based on the WassKirf (WK) functionals. The WK functionals are represented by the array WK[66], where the first 6 elements (index 0-5) correspond to the constants a[1-5] and c, and the subsequent elements correspond to the con...
glaive
[ 0.016799354925751686, 0.039601780474185944, -0.05495448783040047, -0.0681261196732521, 0.04587230086326599, -0.04943191260099411, -0.011904061771929264, 0.07490410655736923, 0.034486256539821625, 0.0011472824262455106, 0.026270335540175438, 0.04647340625524521, -0.04490631818771362, -0.017...
0.791238
0.764372
0.026866
You are tasked with creating a simple checkers game (with no AI player) using the `games/gl-board-game` library in Racket. The game should allow two human players to take turns moving their pieces on the board. The board should be an 8x8 grid and each player should have 12 pieces. The goal is for a player to capture al...
glaive
[ 0.03229355439543724, 0.030010385438799858, -0.028892531991004944, -0.022095005959272385, 0.029600802809000015, -0.024576595053076744, -0.018737420439720154, 0.04457242041826248, 0.04516174644231796, -0.051086582243442535, 0.0069337463937699795, 0.032918427139520645, -0.028813140466809273, ...
0.796718
0.774877
0.021841
You have been tasked with creating a program that calculates the probability density of a quantum state. The program should take into account the given quantum state amplitudes and use the NMaximize function to find the maximum probability, as well as visualize the probability density using 3D and contour plots. The qu...
glaive
[ 0.00546710891649127, 0.032752059400081635, -0.03388594835996628, -0.02626507170498371, 0.042518533766269684, -0.01926502399146557, -0.020050393417477608, 0.07068988680839539, 0.03341754525899887, 0.003234201343730092, 0.0177445225417614, 0.03829745948314667, -0.009520329535007477, -0.01078...
0.778344
0.749336
0.029008
You are tasked with precalculating hashes using CUDA for a specific cryptographic algorithm. The goal is to initialize context and hash certain data to generate unfinalized hashes contexts and hashes. The specific details are as follows: - The input parameters are: - `keep`: an integer representing whether to keep th...
glaive
[ 0.026075227186083794, 0.040957607328891754, -0.023702792823314667, -0.0018180184997618198, 0.026559237390756607, -0.021601054817438126, -0.021954424679279327, 0.0924617275595665, 0.041036758571863174, -0.027624959126114845, 0.01676223985850811, 0.027355773374438286, -0.0027280740905553102, ...
0.804856
0.790312
0.014544
You are tasked with implementing a function that takes a mathematical expression as a string and produces its abstract syntax tree. The input string will consist of numbers, addition, subtraction, multiplication, division, and parentheses. Your function should tokenize the input string and then parse it to create the a...
glaive
[ 0.048047035932540894, 0.02432440221309662, -0.02900240384042263, -0.039451222866773605, 0.044008366763591766, -0.04006001725792885, -0.005579771939665079, 0.07427989691495895, 0.04998303949832916, -0.0030538756400346756, 0.019141944125294685, 0.029286973178386688, -0.031480491161346436, 0....
0.808912
0.79332
0.015592
Is there an algorithm available to perform deduction in first-order logic?
glaive
[ 0.027637198567390442, 0.02101198397576809, -0.024430248886346817, -0.039181146770715714, 0.04224976524710655, -0.039607081562280655, -0.025762751698493958, 0.05560348182916641, 0.05637146905064583, -0.03801467642188072, 0.01311563141644001, 0.015353497117757797, -0.021197374910116196, -0.0...
0.785301
0.770448
0.014853
You are tasked with implementing a program to find the first invalid number in a list and then find a contiguous set of at least two numbers in the list which sum to the invalid number. You are given a module 'nine' with the following functions: 1. part1_solve(Input, PreambleSize) - This function takes a list of integ...
glaive
[ 0.013422823511064053, 0.019202742725610733, -0.0109969237819314, -0.04220016300678253, 0.056118372827768326, -0.006211935542523861, -0.012875010259449482, 0.05520276352763176, 0.021434295922517776, -0.006614070851355791, 0.018861306831240654, 0.03364168107509613, -0.024294229224324226, -0....
0.837886
0.801875
0.036011
You are tasked with creating a program that generates the sequence A161765. This sequence is defined as follows: the nth term of the sequence is the smallest multiple of the number of 1's in the binary representation of n that is greater than or equal to n. For example, the first few terms of the sequence are 1, 2, 4, ...
glaive
[ 0.04552038758993149, 0.026740506291389465, -0.007624304853379726, -0.03233210742473602, 0.0419759526848793, -0.023308783769607544, -0.03458770364522934, 0.07062464207410812, 0.012500184588134289, -0.011842531152069569, 0.038256727159023285, 0.020932946354150772, -0.04474629461765289, 0.001...
0.823582
0.777342
0.04624
What is the number of possible combinations when randomly choosing five cards from a standard deck of 52 cards?
glaive
[ 0.013079140335321426, 0.015622906386852264, -0.03834102675318718, -0.04253506287932396, 0.024079369381070137, -0.016252409666776657, -0.03856627643108368, 0.019303621724247932, 0.02515474148094654, -0.027956528589129448, 0.005849526263773441, 0.029500063508749008, -0.031486328691244125, 0....
0.777681
0.754576
0.023105
You are tasked with implementing a function that calculates the sum of all elements in an array of integers. The function should take an array of integers as input and return the sum of all elements. If the input array is empty, the function should return 0. Example: Input: [1, 2, 3, 4, 5] Output: 15 Input: [] Output...
glaive
[ 0.01690639927983284, 0.028269076719880104, -0.03501215577125549, -0.04481286555528641, 0.05730951949954033, -0.018684137612581253, -0.012913656421005726, 0.030280916020274162, 0.03140425682067871, -0.02089778333902359, 0.012149173766374588, 0.026795487850904465, -0.04232166334986687, -0.03...
0.806577
0.749119
0.057457
You are given a reference to the node of an undirected connected graph. Your task is to create a deep copy (clone) of the graph. Each node in the graph contains its value `val` (an integer) and a list of its neighbors (`List<Node>`). The graph is represented in the form of an adjacency list, where each node's value is...
glaive
[ 0.02118215151131153, 0.03552267700433731, -0.01734064146876335, -0.01909123733639717, 0.026637759059667587, -0.027356622740626335, 0.0048792725428938866, 0.0618390254676342, 0.013365737162530422, -0.03541228547692299, 0.041232820600271225, 0.02764902450144291, -0.027484605088829994, 0.0069...
0.812764
0.788069
0.024695
You are tasked with creating a module in Verilog that compares two floating-point numbers and returns the result based on the specified comparison instruction. The module should handle different scenarios such as comparing NaN, infinity, and zero values. The comparison instructions include FEQ.D, FEQ.S, FLT.D, FLT.S, F...
glaive
[ 0.019227582961320877, 0.013847952708601952, -0.025635933503508568, -0.048087310045957565, 0.029360296204686165, -0.032875366508960724, -0.023181386291980743, 0.06487035751342773, 0.0336570106446743, -0.02694118395447731, 0.02726852148771286, 0.043516505509614944, -0.023592384532094002, 0.0...
0.797847
0.782671
0.015176
I am trying to determine if a given group is solvable or not. A group is solvable if its derived series is eventually trivial. The derived series of a group `G` is obtained by starting from the subgroup `⊤` and repeatedly taking the commutator of the previous subgroup with itself for `n` times. A commutator of two subg...
glaive
[ 0.015254655852913857, 0.025155121460556984, -0.019555822014808655, -0.05532035231590271, 0.0557587556540966, -0.06283670663833618, 0.008268891833722591, 0.07103407382965088, 0.03393279388546944, -0.007543964311480522, 0.007148752920329571, 0.01039072498679161, -0.03944197669625282, -0.0217...
0.799535
0.7693
0.030235
You are tasked with implementing a function to solve a linear system using the Conjugate Gradient (CG) method in CUDA C++. The function is expected to take in a linear system of equations, a CG state, a tolerance value, a maximum number of iterations, and other optional parameters. The function should use the CG method...
glaive
[ -0.007559636142104864, 0.03844399377703667, -0.014921051450073719, -0.04598653316497803, 0.04574161022901535, -0.023969784379005432, -0.0326429158449173, 0.10321856290102005, 0.03646494448184967, -0.013419154100120068, 0.020377766340970993, 0.03596227988600731, -0.003511061891913414, 0.005...
0.80217
0.782563
0.019607
You are required to implement a function to generate a graph from an edgelist in C++ using the `cugraph` library, which is a part of the NVIDIA CUDA toolkit. The function should take in the following parameters: - `handle`: a handle to the CUDA toolkit - `vertices`: a device vector of vertex IDs - `edgelist_rows`: a de...
glaive
[ -0.005273663438856602, 0.012107700109481812, -0.0215854961425066, -0.029804181307554245, 0.036608628928661346, -0.03566772863268852, -0.03932378068566322, 0.10445484519004822, 0.05371512845158577, -0.01770344190299511, 0.03022594377398491, 0.04934005066752434, 0.014951726421713829, 0.00912...
0.794495
0.780186
0.014309
You are working with a netCDF file and need to write a subroutine that retrieves the real and imaginary parts of a specified variable from the file. The subroutine must take the netCDF dataset ID, the variable name, the size of the array in the 1st dimension, and an array for output as input, and it should return the r...
glaive
[ 0.007790130563080311, 0.03912052884697914, -0.025666648522019386, -0.03754711523652077, 0.029900232329964638, -0.011315387673676014, -0.01296544075012207, 0.060231342911720276, 0.04881247878074646, 0.0042806752026081085, 0.0359051413834095, 0.023450681939721107, -0.03897303342819214, 0.012...
0.807068
0.791948
0.01512
You are tasked with creating a function in Python that takes in a list of blocks and a collection function and returns the result of applying the collection function to the blocks. The collection function will be provided as an argument and can be any function that acts on a collection of elements (e.g., sum, max, min,...
glaive
[ 0.042592987418174744, 0.03003103844821453, -0.04743312671780586, -0.03321502357721329, 0.043443500995635986, -0.022009797394275665, -0.043932247906923294, 0.038210924714803696, 0.030377386137843132, 0.002310704905539751, 0.022900311276316643, 0.05141587182879448, -0.028133777901530266, 0.0...
0.809086
0.788628
0.020458
You are tasked with implementing a stack data structure in Pascal. Your stack should have the following operations: 1. Push: Add an element to the top of the stack 2. Pop: Remove the top element from the stack and return it 3. Peek: Return the top element of the stack without removing it 4. isEmpty: Return true if the ...
glaive
[ 0.040736518800258636, 0.018241964280605316, -0.010812019929289818, -0.027393406257033348, 0.0348183773458004, -0.036405403167009354, 0.006417186930775642, 0.07883583754301071, 0.043063923716545105, 0.003157008206471801, 0.023756586015224457, 0.0507630929350853, -0.02973194047808647, -0.026...
0.807523
0.784774
0.022749
You are tasked with implementing a nearest neighbor search algorithm in Julia using the provided code snippet as a starting point. The goal is to find the k nearest neighbors to a given query point within a dataset of 3-dimensional vectors. Your task is to write a function that takes the dataset, query point, value of...
glaive
[ -0.004601761698722839, 0.05110195651650429, -0.032964855432510376, -0.030255181714892387, 0.03804434835910797, -0.00945413950830698, -0.02458910644054413, 0.04463605582714081, 0.05144762247800827, 0.004169040825217962, 0.02904650568962097, 0.03125894069671631, -0.024151239544153214, 0.0005...
0.811328
0.787584
0.023743
You are tasked with implementing a function that calculates the sum of all the elements in a list. The function should take a list of integers as input and return the sum of the elements. You need to write the code for the function from scratch.
glaive
[ 0.019956368952989578, 0.028471998870372772, -0.040176570415496826, -0.045848991721868515, 0.07321323454380035, -0.033867087215185165, -0.013459830544888973, 0.04001808166503906, 0.04366733878850937, -0.010737711563706398, 0.022809313610196114, 0.05167734995484352, -0.03296052664518356, -0....
0.804986
0.782339
0.022647
I have a list of stock prices over a period of time, and I want to find the maximum profit I can make by buying on one day and selling on a different day. Can someone provide me with a function that can solve this problem? Here is the list of stock prices: [11, 13, 8, 12, 15, 7, 10]
glaive
[ 0.014651737175881863, 0.01284101977944374, -0.04597046598792076, -0.027295108884572983, 0.03888300061225891, -0.03445598483085632, -0.030612895265221596, 0.05148342251777649, 0.0327388197183609, -0.010471896268427372, 0.005179900676012039, 0.04231998696923256, -0.04051220789551735, -0.0389...
0.817466
0.788285
0.029181
I have an unsorted array of integers and I need to find the number that repeats the most. How can I design a function to accomplish this task?
glaive
[ 0.022032512351870537, 0.027463847771286964, -0.03654909133911133, -0.021173106506466866, 0.045339178293943405, -0.02493978850543499, -0.025377219542860985, 0.055431921035051346, 0.015978576615452766, -0.02102125808596611, 0.028538236394524574, 0.01708425208926201, -0.02799786627292633, -0....
0.810474
0.787092
0.023382
You are tasked with implementing a program that calculates the value of a sequence based on a given formula. The sequence is defined by the following rules: - $a(1) = 1 - $a(2) = n - $a(3) = 7 - $a(4) = 5 - $a(k) = $a(k-4) + $a(k-1) for k > 4 Your task is to write a program that takes an input value n and calculates t...
glaive
[ 0.040776681154966354, 0.037120115011930466, -0.03188856318593025, -0.023197706788778305, 0.044780183583498, -0.026184501126408577, -0.017765851691365242, 0.07483508437871933, 0.04090477153658867, -0.023019379004836082, 0.031672779470682144, 0.04346030578017235, -0.045293428003787994, -0.01...
0.827828
0.790563
0.037265
You have been tasked with creating a program to measure the oxygen radical scavenging (ORS) activity of a given substance. The ORS activity is an important factor in determining the antioxidant capacity of a substance. Your program should take in the necessary input related to the substance, and then calculate and retu...
glaive
[ 0.023698722943663597, 0.020007384940981865, -0.03572525829076767, -0.026678360998630524, 0.024000167846679688, -0.06330767273902893, -0.019929639995098114, 0.08519802242517471, 0.0611543171107769, 0.0025260893162339926, -0.01369731966406107, 0.025236278772354126, -0.01761576347053051, 0.01...
0.792812
0.778052
0.01476
You are tasked with implementing two CUDA kernels to construct a compressed sparse row (CSR) representation of a graph, specifically the Block Sparse Row (BSR) format. The first kernel, construct_bsr_row_ptr_per_thread, should calculate the number of block rows for each vertex in the graph and store the result in an ar...
glaive
[ 0.01255157869309187, 0.0382942296564579, -0.02919142320752144, -0.018765242770314217, 0.02133423648774624, -0.01308252103626728, -0.03813103213906288, 0.0858817771077156, 0.05714251101016998, -0.027077117934823036, 0.031091803684830666, 0.03416391834616661, 0.0010802255710586905, 0.0066215...
0.802096
0.781733
0.020363
Write a program that takes two integer inputs from the user and calculates their product. Then, display the result in the format "PROD = <product>".
glaive
[ 0.03943806514143944, 0.022822152823209763, -0.03968202322721481, -0.039332080632448196, 0.03454447165131569, -0.030948946252465248, -0.020561188459396362, 0.07016175985336304, 0.05185176059603691, -0.03100484050810337, 0.010515202768146992, 0.04224696010351181, -0.02565206028521061, -0.035...
0.800821
0.783477
0.017344
You are working on a computer program to compute the numerical value of the gradient of a matrix function. Consider the situation where the entries of a matrix A(x) ∈ R^{M×N} are computed using the following explicit example: A(x) = [sin(x_1)^2 + x_2, x_1; e^(x_1/x_2), x_3; log(x_1 + x_3*x_2), 0;] Now...
glaive
[ 0.011296330951154232, 0.040244340896606445, -0.03453682363033295, -0.032650936394929886, 0.049457695335149765, -0.020416341722011566, -0.009674961678683758, 0.08326168358325958, 0.02560446225106716, -0.019271448254585266, 0.010327978059649467, 0.042378995567560196, -0.05423066020011902, -0...
0.809085
0.77967
0.029416
You are tasked with creating a function that will find the paths between two given entities in a movie database. The database contains information about movies, people involved in the movies, and their relationships. The function should take the database, the starting entity ID, and the target entity ID as input and re...
glaive
[ 0.027026092633605003, 0.01830054633319378, -0.028172610327601433, -0.009536484256386757, 0.021963024511933327, -0.013058928772807121, -0.02509136125445366, 0.05151956528425217, 0.03067038021981716, -0.01758945919573307, 0.042697709053754807, 0.005207552574574947, -0.011125319637358189, -0....
0.808092
0.784703
0.02339
You are tasked with implementing a function s_prepare_buffers that prepares buffers for a specific operation. The function should take in two arrays, addresses_D_ht and addresses_WC_ht, and perform a series of operations on these arrays to prepare the buffers for the operation. The specific operations to be performed a...
glaive
[ 0.03486263379454613, 0.049804672598838806, -0.035551849752664566, -0.009495860897004604, 0.03768493980169296, -0.037206098437309265, -0.020574085414409637, 0.0774226188659668, 0.06815110892057419, -0.011398467235267162, 0.009456200525164604, 0.04138174280524254, -0.030546125024557114, -0.0...
0.807633
0.78538
0.022254
You are tasked with implementing a CUDA-based kernel scheduling system for a GPU-accelerated application. The goal is to determine the optimal number of blocks and threads per block for a given GPU based on its architecture and capabilities. The scheduling system should be able to handle 1D, 2D, and 3D kernel launches....
glaive
[ 0.014702802523970604, 0.03952803090214729, -0.016699621453881264, -0.007440798915922642, 0.03303530067205429, -0.014472268521785736, -0.04871555417776108, 0.06393259018659592, 0.04582078382372856, -0.026184702292084694, 0.027735382318496704, 0.03129935637116432, -0.004773046355694532, 0.02...
0.796228
0.780836
0.015392
You are tasked with implementing a function that checks for a specific geometric property in a quadrilateral. The function should take four points (A, B, C, D) as input and determine if the given quadrilateral is convex and if the angles at points A and C are right angles. Additionally, the function should find the foo...
glaive
[ 0.012015569023787975, 0.033385299146175385, -0.0399848148226738, -0.027565672993659973, 0.035147421061992645, -0.0130503810942173, 0.0010773728135973215, 0.06738974899053574, 0.031862616539001465, -0.0002505284792277962, 0.007355901412665844, 0.047125641256570816, -0.00970393791794777, -0....
0.787495
0.761635
0.02586
You are tasked with creating a program that simulates a Rubik's Cube. The program should allow the user to perform various moves on the cube, such as rotating a specific side or layer of the cube in a specific direction. The program should also be able to scramble the cube and then solve it using a series of moves. Yo...
glaive
[ 0.017883099615573883, 0.043855730444192886, -0.027697520330548286, -0.016871066763997078, 0.03643807768821716, -0.011762448586523533, -0.01093988586217165, 0.07240322977304459, 0.030485106632113457, -0.02773302048444748, 0.032162681221961975, 0.027797510847449303, -0.014076831750571728, -0...
0.805755
0.784624
0.021131
You are tasked with implementing a memory allocation subroutine for a scientific computing software used for simulating multi-phase methods. The subroutine needs to allocate memory for various global main arrays of dynamic size, as well as perform additional ccNUMA (Cache-Coherent Non-Uniform Memory Access) initializat...
glaive
[ 0.012343849055469036, 0.03750409185886383, -0.01699993759393692, -0.02409382350742817, 0.027930080890655518, -0.02202812395989895, -0.014959752559661865, 0.06834321469068527, 0.026151562109589577, -0.014900471083819866, 0.009556308388710022, 0.044471368193626404, -0.006977433804422617, 0.0...
0.802184
0.784469
0.017714
You are tasked with implementing a function using F# computation expression syntax. The function should take in a sequence of integers and return the sum of all the even numbers in the sequence. You are required to use the task computation expression builder provided in the code snippet.
glaive
[ 0.025285489857196808, 0.02713547646999359, -0.030913028866052628, -0.049514878541231155, 0.044558264315128326, -0.02564813941717148, -0.016417797654867172, 0.05523709952831268, 0.039217591285705566, -0.0117641044780612, 0.01519903913140297, 0.04409288987517357, -0.04023071378469467, -0.019...
0.813007
0.786214
0.026793
You are tasked with writing a program that takes a user input string and prints the input string in reverse order. For example, if the user inputs "hello world", the program should output "dlrow olleh".
glaive
[ 0.01003185287117958, 0.036845773458480835, 0.0014727337984368205, -0.04978781193494797, 0.009308487176895142, -0.012531480751931667, -0.01830669492483139, 0.039594538509845734, 0.03878196328878403, -0.014107022434473038, 0.008391720242798328, 0.030621390789747238, -0.04050854966044426, -0....
0.788971
0.76455
0.024422
You are tasked with creating a SQL query that will retrieve specific aggregated data from two different tables and return the result based on certain conditions. The first table, lineitem1, contains columns l_partkey and l_suppkey. The second table, part1, contains columns p_partkey and p_size. Your goal is to write a ...
glaive
[ 0.01303829625248909, 0.03131057694554329, -0.038590993732213974, -0.03466948866844177, 0.015176336281001568, -0.0029361778870224953, -0.020272929221391678, 0.049340229481458664, 0.03454725071787834, 0.017134057357907295, 0.019062642008066177, 0.021379290148615837, -0.019374659284949303, 0....
0.780436
0.753598
0.026838
You are tasked with creating a program that reads in a string and counts the number of unique characters in the string. The program should then output the count of each unique character in the format "character: count". For example, if the input string is "hello", the program should output: h: 1 e: 1 l: 2 o: 1 Create...
glaive
[ -0.0016226624138653278, 0.010379516519606113, -0.018478943035006523, -0.05731711536645889, 0.04071376472711563, -0.027862440794706345, 0.0020778803154826164, 0.04878128319978714, 0.037369366735219955, -0.01984131522476673, 0.007044132333248854, 0.03411181643605232, -0.017941925674676895, -...
0.808816
0.778015
0.030801
You are tasked with implementing a function to calculate the area and perimeter of a rectangle. You are given the following helper functions: - make-point(x, y): returns a point with x and y coordinates - x-point(p): returns the x coordinate of a point - y-point(p): returns the y coordinate of a point - make-rectangle...
glaive
[ 0.020700011402368546, 0.04581537842750549, -0.021939095109701157, -0.028647685423493385, 0.02426891215145588, -0.008865799754858017, -0.030484270304441452, 0.05807717144489288, 0.05150981619954109, 0.019961442798376083, 0.013334469869732857, 0.05324557051062584, -0.029887627810239792, -0.0...
0.768296
0.728067
0.040229
You are tasked with implementing a CUDA kernel that performs transform reduce operations on arrays. Your task is to create four separate CUDA kernels with the following requirements: 1. The first kernel, test_transform_reduce_block, should fill a shared array with a given number of elements and then perform a transform...
glaive
[ 0.00523102143779397, 0.05745498090982437, -0.026953380554914474, -0.020007384940981865, 0.044788461178541183, -0.0076043978333473206, -0.018976442515850067, 0.09193398058414459, 0.03592860698699951, -0.008796191774308681, 0.01981843076646328, 0.022668171674013138, -0.00754938181489706, 0.0...
0.810427
0.79519
0.015237
You are tasked with writing a SQL query to retrieve the top 5 countries with the highest peak elevation and longest river length. You will need to query the "Geography" database, specifically the following tables: "Countries", "MountainsCountries", "Mountains", "Peaks", "CountriesRivers", and "Rivers". The query should...
glaive
[ 0.03468216210603714, 0.017603624612092972, -0.036471735686063766, -0.05071588233113289, -0.000377891818061471, -0.024744555354118347, -0.026515182107686996, 0.03464968502521515, 0.04059307649731636, -0.009610283188521862, 0.014056050218641758, 0.012983767315745354, -0.02464861236512661, 0....
0.754527
0.736946
0.017581