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 function in GMScript that takes a large number as input and returns the sign of the number. The sign should be represented as follows: - 1 for positive numbers - 0 for zero - -1 for negative numbers Write a function bignum_sign that takes a single argument, the large number, and returns...
glaive
[ 0.024992359802126884, 0.02812865562736988, -0.046529628336429596, -0.061856288462877274, 0.0342455618083477, -0.030613722279667854, -0.01759433001279831, 0.04890664294362068, 0.02373463846743107, -0.01517174020409584, 0.02509472332894802, 0.04388274997472763, -0.01917482167482376, 0.006006...
0.797011
0.769049
0.027962
You are given an integer n. You need to find the coordinates of n points on a 2D plane. The points should form a zigzag pattern, starting from the origin (0, 0) and moving in a zigzag manner. For example, if n = 3, the points would be: (0, 0) (1, 0) (0, 1) Write a function to solve this problem.
glaive
[ 0.02791486494243145, 0.040734272450208664, -0.03288300335407257, -0.030515354126691818, 0.03937603533267975, -0.01258945744484663, -0.03993426635861397, 0.02895546704530716, 0.0291362926363945, 0.007347756065428257, 0.013105615973472595, 0.040590301156044006, -0.039050325751304626, -0.0239...
0.831124
0.776179
0.054945
You are required to implement a CUDA kernel for a bilateral filter for 1D, 2D, and 3D images using the given framework and technology. The bilateral filter is a non-linear, edge-preserving, and noise-reducing smoothing filter for images. It replaces the intensity of each pixel with a weighted average of its neighboring...
glaive
[ -0.01136308629065752, 0.04361816868185997, -0.019951453432440758, -0.021161526441574097, 0.03153283894062042, -0.00487627973780036, -0.02274053357541561, 0.08367068320512772, 0.04042760282754898, -0.02578268200159073, 0.036482758820056915, 0.016220198944211006, 0.00033786529093049467, -0.0...
0.791144
0.773402
0.017741
You are tasked with creating a function that takes a game record and returns a string that represents the kaku (bishop) movement in a shogi game. The game record contains information about the current state of the game, including the position of the pieces on the board and the moves made so far. The function should gen...
glaive
[ 0.023118741810321808, 0.012845134362578392, -0.04662151262164116, -0.0641913041472435, 0.019953789189457893, -0.01888298988342285, -0.01330992579460144, 0.05721738561987877, 0.042747918516397476, -0.018772168084979057, 0.0523381307721138, 0.031056035310029984, -0.034298960119485855, 0.0074...
0.788447
0.769379
0.019068
You are tasked with creating a function to parse a set of octal fields all at once. The function should take in a type T and a type Z, and return a type OutT. The input Z will consist of multiple fields, each representing an octal number. Your task is to implement the OctalGroupParser function that processes the input ...
glaive
[ 0.02358473278582096, 0.04523841291666031, -0.03701762109994888, -0.03207625448703766, 0.04913373291492462, -0.03986866772174835, -0.024487990885972977, 0.06689594686031342, 0.049467697739601135, -0.005816887132823467, 0.010710052214562893, 0.023033861070871353, -0.017739668488502502, -0.00...
0.812402
0.794561
0.017841
You are tasked with creating a program that can process a list of data items and extract specific information from each item. Each data item is a string that contains various attributes separated by a delimiter. Your program needs to extract the value associated with the attribute "bar" from each data item and store it...
glaive
[ 0.046969033777713776, 0.036349114030599594, -0.05847178027033806, -0.027515767142176628, 0.03606010228395462, -0.040461406111717224, -0.009690472856163979, 0.040923312306404114, 0.0405522882938385, -0.02394004538655281, 0.02028716541826725, 0.03742479905486107, -0.03336431831121445, -0.008...
0.801658
0.781098
0.02056
You are tasked with creating a program that calculates the result of the mathematical expression (1 + 2] using a Java programming language. The program should take the two numbers and the operator as input and provide the correct result as output. Create a Java program that takes two numbers and an operator as input,...
glaive
[ 0.02842559479176998, 0.030296815559267998, -0.05389482155442238, -0.038748107850551605, 0.04783845692873001, -0.021223636344075203, -0.03147449344396591, 0.05417916551232338, 0.040951360017061234, -0.031773779541254044, 0.019366364926099777, 0.032805636525154114, -0.0398489274084568, -0.02...
0.796456
0.758693
0.037763
You are tasked with implementing a complex data structure in C++ using the Apache Thrift framework. The data structure, named ComplexStruct, consists of several nested data types, including Empty, SmallInt, BigInt, SmallString, BigString, Mixed, SmallListInt, BigListInt, LargeListMixed, LargeMapInt, LargeMixed, NestedM...
glaive
[ 0.012865756638348103, 0.023131614550948143, -0.0008733078720979393, -0.02353358268737793, 0.03361235558986664, -0.026584850624203682, 0.004162567667663097, 0.09629228711128235, 0.021317027509212494, -0.018512075766921043, 0.017713000997900963, 0.03015962988138199, -0.01640620268881321, 0.0...
0.802618
0.786276
0.016342
You are tasked with implementing a function that takes a list of integers and returns a new list with the same elements but in reverse order. Write a function `reverseList` that takes a list `l : List Nat` as input and returns a new list with the elements of `l` in reverse order. For example: Input: [1, 2, 3, 4] Outp...
glaive
[ 0.019440965726971626, 0.039066869765520096, -0.009003952145576477, -0.045369718223810196, 0.03761554881930351, -0.019857535138726234, -0.025732284411787987, 0.04054349288344383, 0.04298298433423042, -0.007063205353915691, 0.019953079521656036, 0.03388255462050438, -0.03176359459757805, -0....
0.795811
0.767954
0.027857
You are tasked with creating a program that performs a gamma probability calculation using the parameters a and x. The program should take the values of a and x as input and then calculate the gamma probability using these values. Additionally, the program should include a model that assigns the values of a and x from ...
glaive
[ -0.013909214176237583, 0.012771623209118843, -0.027945639565587044, -0.02642500214278698, 0.05247048661112785, -0.03732839599251747, -0.01851254142820835, 0.05466044321656227, 0.03855718672275543, -0.01805288717150688, 0.007057634182274342, 0.058094944804906845, -0.04554368183016777, -0.01...
0.785286
0.766912
0.018374
I need to create a function in Scheme that calculates the integral of a given function between two given limits using the sum of the function values at equally spaced points within the interval. The function should take the following parameters: - The function to be integrated (f) - The lower limit of integration (a) -...
glaive
[ 0.03695376217365265, 0.026569196954369545, -0.031230630353093147, -0.04170110076665878, 0.043124906718730927, -0.025994054973125458, -0.03376157209277153, 0.043315302580595016, 0.040155548602342606, 0.005372149869799614, 0.029170820489525795, 0.05592524632811546, -0.02920706570148468, -0.0...
0.788225
0.769689
0.018535
You are tasked with creating a program that calculates the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 (denoted as 5!) is 5 x 4 x 3 x 2 x 1 = 120. Write a function that takes an integer as input a...
glaive
[ 0.02767745964229107, 0.025783978402614594, -0.03436747565865517, -0.03428729996085167, 0.05438067764043808, -0.03280404210090637, -0.022647393867373466, 0.046970121562480927, 0.04562898725271225, -0.008192106150090694, 0.009667834267020226, 0.0512159988284111, -0.055569108575582504, -0.025...
0.804684
0.765796
0.038887
Can you provide an AI-based solution to find the maximum difference in a given list of numbers?
glaive
[ 0.03212352842092514, 0.0038326543290168047, -0.007464174181222916, -0.03286093473434448, 0.0360807441174984, -0.02704625017940998, -0.020909486338496208, 0.04661273583769798, 0.05587444826960564, -0.033852506428956985, 0.023698117583990097, 0.031029827892780304, -0.032107945531606674, 0.00...
0.803289
0.782029
0.021259
How can I design an algorithm that generates the Fibonacci sequence?
glaive
[ 0.005689592566341162, 0.00990371685475111, -0.02178794890642166, -0.03572377562522888, 0.03528039529919624, -0.032435350120067596, -0.03356217220425606, 0.07241522520780563, 0.019837507978081703, -0.02579142525792122, 0.018095077946782112, 0.03338513523340225, -0.026158444583415985, -0.020...
0.797957
0.774542
0.023415
You are tasked with creating a function in a linearly-ordered set that determines whether an element is the topmost element in the set. The function should take an element as input and return true if there is no other element greater than it in the set, and false otherwise. You are required to implement the function fr...
glaive
[ 0.034207507967948914, 0.03506210446357727, -0.03909411281347275, -0.023315975442528725, 0.038943100720644, -0.023693758994340897, -0.00493224011734128, 0.08347994834184647, 0.031542543321847916, -0.02562246099114418, 0.013827179558575153, 0.016782203689217567, -0.024387426674365997, -0.013...
0.824429
0.795859
0.02857
You are tasked with implementing a C++ function that performs a specialized matrix multiplication operation using the WMMA API. The function should take input matrices A and B, perform the binary GEMM operation using the WMMA API, and store the result in matrix C. The function should be able to handle various matrix di...
glaive
[ 0.028157366439700127, 0.03725776821374893, -0.016828950494527817, -0.032381217926740646, 0.029569657519459724, -0.013235439546406269, -0.04421344771981239, 0.11252449452877045, 0.040753066539764404, -0.025708768516778946, 0.0113856615498662, 0.029286544770002365, -0.0012721432140097022, -0...
0.805767
0.784567
0.0212
You are given a task to create a program that calculates the probability of a quantum state and then visualizes the results using a 3D plot and a contour plot. The quantum state is defined by the amplitude function, which takes two input variables x and y. The probability of the quantum state is calculated using the am...
glaive
[ 0.0019688208121806383, 0.03597892448306084, -0.030060742050409317, -0.02260221354663372, 0.03617598116397858, -0.02632294036448002, -0.016022760421037674, 0.0744570717215538, 0.044006362557411194, 0.011606095358729362, 0.027951238676905632, 0.030953429639339447, -0.01872718147933483, -0.00...
0.785652
0.756574
0.029078
You are tasked with implementing a program that decodes a specific string pattern and outputs the decoded message. The input string consists of a sequence of characters, each representing a certain action. The actions are as follows: - D: Move Down - W: Move Up - A: Move Left - S: Move Right - #: End of message You ne...
glaive
[ 0.018311118707060814, 0.016015227884054184, -0.017041053622961044, -0.04676694795489311, 0.03407815098762512, -0.04168231412768364, -0.013853074982762337, 0.05576200410723686, 0.044874075800180435, -0.021997608244419098, 0.04122205078601837, 0.03189020976424217, -0.027252284809947014, -0.0...
0.813729
0.791792
0.021937
How can I write a function that finds the elements in an array with the largest sum?
glaive
[ 0.02266438864171505, 0.04319838061928749, -0.03515307977795601, -0.04357509687542915, 0.04219590872526169, -0.02921832725405693, -0.026457713916897774, 0.0393211655318737, 0.02786414325237274, -0.01755588874220848, 0.026662301272153854, 0.04307840019464493, -0.03079412505030632, -0.0154589...
0.803192
0.782604
0.020588
You are given a program that reads a sequence of strings, terminated by the word "END". For each string in the sequence, the program should count the number of times it takes to repeat the length of the string until it reaches a repetition. For example, if the input is "hello", the program should output 3, as it takes ...
glaive
[ 0.019574731588363647, 0.010485738515853882, -0.015184364281594753, -0.057653456926345825, 0.026437290012836456, -0.02125205472111702, -0.029839105904102325, 0.07625503093004227, 0.011424708180129528, -0.028622562065720558, 0.018726825714111328, 0.02854141592979431, -0.04531189426779747, -0...
0.829744
0.809912
0.019832
You are tasked with creating a program that reads in a file containing coordinates and calculates the length of a tour based on these coordinates. The file will contain the dimension and the node coordinate section, with each line in the node coordinate section containing the node number, x-coordinate, and y-coordinate...
glaive
[ -0.004445187747478485, 0.014912094920873642, -0.04314625635743141, -0.04263835772871971, 0.03205922245979309, -0.02960064448416233, -0.04117002338171005, 0.024052465334534645, 0.04315885901451111, -0.00653033796697855, 0.02440645359456539, 0.03560712933540344, -0.011971433646976948, -0.004...
0.814108
0.785742
0.028366
You are tasked with implementing a set of functions for interval arithmetic in Scheme. The following functions need to be implemented: 1. make-interval: This function takes two numbers as input and returns an interval, represented as a pair of numbers, with the first number being the lower bound and the second number ...
glaive
[ 0.06014998257160187, 0.027361493557691574, -0.0051865531131625175, -0.024889174848794937, 0.03679504990577698, -0.01494333241134882, -0.027894459664821625, 0.06010698527097702, 0.034779079258441925, -0.0020245518535375595, 0.03876857832074165, 0.0406024307012558, -0.025144828483462334, 0.0...
0.792816
0.772307
0.020509
You are tasked with implementing a program that can evaluate logical formulas. A logical formula can be one of the following types: - Equality: eqf n1 n2, where n1 and n2 are natural numbers - Conjunction: andf f1 f2, where f1 and f2 are logical formulas - Implication: impf f1 f2, where f1 and f2 are logical formulas ...
glaive
[ 0.023575395345687866, 0.01911165751516819, -0.03174775838851929, -0.03558321297168732, 0.02952856384217739, -0.04215344041585922, -0.0010967104462906718, 0.06971979886293411, 0.04262642189860344, -0.029346266761422157, 0.016234377399086952, 0.034900031983852386, -0.032234277576208115, -0.0...
0.802464
0.775086
0.027377
You are tasked with creating a program using the given code snippet as a reference. Your program should include the following functionalities: - Define a constant "b" of type natural number and check the value of "b + b + b" - Check the truth value of the logical expressions "true ∧ false ∧ true" and "(true ∧ false) ∧ ...
glaive
[ 0.0452156737446785, 0.011946475133299828, -0.034920647740364075, -0.018377022817730904, 0.04388787969946861, -0.03773900866508484, 0.0050631253980100155, 0.07973946630954742, 0.0328323170542717, -0.021001549437642097, 0.023162730038166046, 0.03603898733854294, -0.027766164392232895, -0.023...
0.816115
0.790474
0.025641
You are tasked with writing a CUDA kernel function to perform the SAXPY operation. The SAXPY (Single-precision A*X Plus Y) operation is defined as y = a*x + y, where x and y are arrays of single-precision floating point numbers, and a is a single-precision scalar. Your task is to implement a CUDA kernel function that p...
glaive
[ 0.007257465738803148, 0.03950493410229683, -0.020165232941508293, -0.03246224671602249, 0.02314513549208641, -0.002045802539214492, -0.017554782330989838, 0.07610448449850082, 0.03939379006624222, -0.013866801746189594, 0.04632958769798279, 0.03004816360771656, -0.01025465503334999, -0.014...
0.805433
0.781514
0.02392
You are tasked with implementing a game logic for a board game. The game involves placing pieces on a board and checking for winning combinations. Your task is to create a function that will check for winning combinations on the game board. The board consists of three floors (Top, Middle, Bottom) and each floor has a ...
glaive
[ 0.0050946008414030075, 0.023328227922320366, -0.027924219146370888, -0.022541455924510956, 0.030848054215312004, -0.028330327942967415, -0.015438899397850037, 0.061905525624752045, 0.0397300161421299, -0.01599138230085373, 0.023746797814965248, 0.048115480691194534, -0.013236327096819878, ...
0.824177
0.79743
0.026747
You need to implement a function to calculate the sum of all elements in a list. The function should take a list of integers as input and return the sum of all the elements in the list. If the list is empty, the function should return 0. Write a function called `sumList` that takes a list of integers as input and retu...
glaive
[ 0.017192909494042397, 0.029329800978302956, -0.03150682523846626, -0.052891600877046585, 0.06669206917285919, -0.03846554085612297, -0.009443672373890877, 0.02753225341439247, 0.03958269953727722, -0.012640971690416336, 0.021396534517407417, 0.05133524164557457, -0.031921036541461945, -0.0...
0.811071
0.782465
0.028606
You are working on a project that involves down-sampling an image using CUDA in C++. Your task is to write a CUDA kernel function to perform the down-sampling operation on the input image. The down-sampling process involves replicating every nth pixel of the input image to create a smaller image, where n is the scale f...
glaive
[ -0.025080064311623573, 0.050117116421461105, -0.0183373112231493, -0.021579228341579437, 0.046089738607406616, -0.003879045369103551, -0.010946513153612614, 0.11139700561761856, 0.03383896127343178, -0.011113406158983707, 0.022156478837132454, 0.030548129230737686, -0.014298885129392147, 0...
0.779801
0.765413
0.014387
You are tasked with implementing a set of functions to perform arithmetic operations on a custom data type called `Nat`, which is defined as a list of `Digit` elements. The `Digit` type is a simple enumeration with two possible values: `ONE` and `TWO`. You need to implement the following functions: 1. `inc`: This func...
glaive
[ 0.032851047813892365, 0.03169377148151398, -0.016283415257930756, -0.020423483103513718, 0.04555923491716385, -0.022794796153903008, -0.01886560395359993, 0.06914317607879639, 0.03819332644343376, -0.004527641925960779, 0.023627331480383873, 0.02847748063504696, -0.03697934374213219, -0.01...
0.820693
0.785928
0.034765
You are tasked with creating a topological ring in a given uniform space for a specified type α. This topological ring should have the following properties: - It should be a commutative ring - It should be a topological ring - It should be a uniform space - It should be a uniform additive group - It should be a topolog...
glaive
[ 0.03394298255443573, 0.03976607322692871, -0.027629857882857323, -0.019141945987939835, 0.033387936651706696, -0.02029927633702755, -0.026777345687150955, 0.061985548585653305, 0.033382635563611984, -0.02102670632302761, 0.017067940905690193, 0.029371904209256172, -0.007365099154412746, -0...
0.790665
0.7632
0.027465
I need to create a function in F# that generates a sequence of numbers, with each number being the result of a specific mathematical operation. The function should start with x and y both being 0, then increment x by 1, increment y by 1, yield the value of x, calculate z as the sum of x and y, and yield the value of z....
glaive
[ 0.013138523325324059, 0.026287738233804703, -0.030033018440008163, -0.05070152506232262, 0.04164605960249901, -0.018881822004914284, -0.0281771682202816, 0.0633985698223114, 0.038430992513895035, -0.02277323044836521, 0.017826085910201073, 0.03708170726895332, -0.05329183116555214, -0.0241...
0.807113
0.789969
0.017144
You are working with natural numbers in your programming project. You need to define a function that takes two natural numbers as input and returns whether the first number is less than the second number. The function should handle the case when the first number is the successor of another natural number and still be a...
glaive
[ 0.0024416346568614244, 0.01640598475933075, -0.038273267447948456, -0.03226986527442932, 0.03240884840488434, -0.011335746385157108, -0.019216090440750122, 0.07343334704637527, 0.03869565203785896, -0.013625587336719036, 0.017460592091083527, 0.03487835451960564, -0.0327020026743412, -0.01...
0.81976
0.796617
0.023143
You are tasked with writing a subroutine to calculate the actual body force in each element in a 3-dimensional finite element program. The body force is the sum of gravity and centrifugal/Coriolis forces. You will need to declare and initialize the necessary variables and arrays, and then use nested loops and condition...
glaive
[ 0.026771744713187218, 0.036824990063905716, -0.03532792255282402, -0.06105963885784149, 0.03745733201503754, -0.03650299459695816, -0.005554752890020609, 0.06772441416978836, 0.03781498223543167, -0.009043416939675808, 0.031252507120370865, 0.058576177805662155, -0.04715382680296898, -0.00...
0.793528
0.77602
0.017508
You are required to implement a function that generates sampling paths with different policies. The function should take in a policy, a Gaussian distribution G, matrices x, y, and σ², stripe_conditions, and an integer nsample. It should then proceed to perform several calculations and operations involving these inputs,...
glaive
[ -0.009603633545339108, 0.00430675083771348, -0.032653067260980606, -0.026252813637256622, 0.03839315474033356, -0.03385872393846512, -0.03732791170477867, 0.07028213888406754, 0.029572278261184692, 0.00023018174397293478, 0.023799430578947067, 0.03598128631711006, -0.005196034908294678, -0...
0.804963
0.785632
0.019331
How can I write a C++ program that prints all possible combinations of elements in a given array?
glaive
[ 0.014791280962526798, 0.02665555477142334, -0.013404720462858677, -0.02237537130713463, 0.03901878744363785, -0.03143347427248955, -0.0209706611931324, 0.08469516783952713, 0.0562051385641098, -0.03077051229774952, 0.02575073204934597, 0.04915357753634453, -0.022368937730789185, -0.0278666...
0.792148
0.777489
0.014659
You are given a list of nodes with their respective sizes and used storage. Each node is represented by its position and a map containing its size and used storage. Your goal is to find the number of viable pairs of nodes, where a viable pair is defined as a pair of nodes (a, b) such that node a is not empty, the data ...
glaive
[ 0.025632936507463455, 0.022973114624619484, -0.04541056603193283, -0.020135954022407532, 0.03777400031685829, -0.017625106498599052, -0.02108132839202881, 0.07052937150001526, 0.02586832456290722, -0.007969627156853676, 0.015908900648355484, 0.04313313961029053, -0.022424042224884033, -0.0...
0.837255
0.800283
0.036972
You are tasked with implementing a program to analyze a large string of characters. The string consists of a sequence of uppercase letters representing different commands. Each command is followed by a pair of coordinates in the format (x, y), where x and y are integers. The available commands are: - A: Add the coordin...
glaive
[ 0.020611990243196487, 0.022334672510623932, -0.021366413682699203, -0.025515584275126457, 0.03658704087138176, -0.023880915716290474, -0.014324008487164974, 0.058657560497522354, 0.04902937263250351, -0.018824942409992218, 0.023441368713974953, 0.030901601538062096, -0.02216057851910591, -...
0.830038
0.790436
0.039602
You are tasked with implementing the fast_quantize_b_sse2 function for the VP8 video codec. This function takes in two arguments: a BLOCK pointer and a BLOCKD pointer. Your goal is to write the assembly code for this function, which will perform a series of mathematical operations on the input data and store the result...
glaive
[ 0.031142788007855415, 0.037193212658166885, -0.010475288145244122, -0.011277656070888042, 0.015269091352820396, -0.02764657512307167, -0.03881696239113808, 0.09226926416158676, 0.046142056584358215, 0.008220857009291649, 0.0234744343906641, 0.017228765413165092, -0.017229270190000534, 0.01...
0.801087
0.780276
0.02081
You are tasked with implementing a function that doubles a given 521-bit number modulo a specific prime number. The prime number in question is p_521, which is defined as 68647976601306097149819007990813932172694353001433054093944634591855431833976560521225596406614545549772963113914808580371219879997166438125740282911...
glaive
[ 0.029977411031723022, 0.02461434341967106, -0.017028719186782837, -0.05123496428132057, 0.018617793917655945, -0.029643656685948372, -0.027525391429662704, 0.08854780346155167, 0.022072110325098038, 0.0017474519554525614, 0.015404419973492622, 0.03133655712008476, -0.028171749785542488, 0....
0.816109
0.786016
0.030092
You are required to implement a reduction computation in shared memory using the given code framework. You need to write the code for the WarpReduceUnroll, WarpReduce, ReduceXUnroll, ReduceYUnroll, HalvedReduce1D, HalvedReduce2DX, and HalvedReduce2DY functions within the namespace akg_reduce. Your implementation shoul...
glaive
[ 0.009469500742852688, 0.035893362015485764, -0.018674839287996292, -0.03243535757064819, 0.04285486415028572, -0.00656664976850152, -0.01884261704981327, 0.0873369425535202, 0.0683942660689354, -0.003047756850719452, 0.011622032150626183, 0.013338381424546242, 0.0005642123287543654, 0.0077...
0.813843
0.794095
0.019748
You are tasked with creating a program to solve the house numbering problem. The input will consist of sets of house numbers and a list of residents in each house. The program should calculate the house number for each resident based on a given formula and output the result. The input will be in the following format: ...
glaive
[ 0.02590596117079258, 0.0466771237552166, -0.028421912342309952, -0.022190136834979057, 0.05103389546275139, -0.023197630420327187, 0.0019086792599409819, 0.047368571162223816, 0.03816192224621773, -0.019739944487810135, 0.020487777888774872, 0.05239294096827507, -0.0597117580473423, -0.018...
0.81889
0.77055
0.04834
You are tasked with implementing a program that calculates the distance traveled by a moving object based on the input from a text file. The text file contains a series of directional movements and distances traveled. Each line in the file consists of a direction (forward, down, or up) and a magnitude (an integer value...
glaive
[ -0.0124105429276824, 0.030643479898571968, -0.024615097790956497, -0.04595224931836128, 0.029978670179843903, -0.04551801458001137, -0.0420927032828331, 0.050468988716602325, 0.04214102029800415, -0.015175712294876575, 0.0203887727111578, 0.022636741399765015, -0.030344661325216293, -0.016...
0.811122
0.788764
0.022358
You are required to write a CUDA C kernel function that takes in a set of input arrays and performs a series of computations based on the input data. The function `mapDots` is expected to be executed on a GPU and operates on data organized into blocks and threads. The function takes in multiple input arrays including ...
glaive
[ 0.018422992900013924, 0.060330405831336975, -0.01744210533797741, -0.01708107814192772, 0.03257795795798302, -0.021563738584518433, -0.03504999354481697, 0.09203491359949112, 0.03690769895911217, -0.016709499061107635, 0.02224993333220482, 0.043689269572496414, 0.00421055918559432, -0.0017...
0.798345
0.776124
0.022221
You are required to implement the Modified Euler's Method for solving a first-order ordinary differential equation. The given equation is: y' = y - t^2 + 1. You need to write a Mathematica program to approximate the solution of this equation using the Modified Euler's Method. The initial condition is y(0) = 0.5, and th...
glaive
[ 0.014856265857815742, 0.027139849960803986, -0.010212666355073452, -0.04343918710947037, 0.04688449203968048, -0.027383241802453995, -0.010732165537774563, 0.09349855780601501, 0.06073633208870888, 0.008536345325410366, 0.01272240187972784, 0.031229784712195396, -0.028209475800395012, -0.0...
0.783297
0.758655
0.024642
I have a set of numbers [5, 10, 15, 20, 25, 30]. How can I use the numpy module in Python to find the maximum and minimum values in this dataset, and then calculate the range?
glaive
[ 0.006762054283171892, 0.015479347668588161, -0.05010310932993889, -0.02162417769432068, 0.047006696462631226, -0.038372039794921875, -0.023893754929304123, 0.03591570258140564, 0.020730048418045044, -0.030576050281524658, 0.02935323491692543, 0.034575529396533966, -0.055446408689022064, -0...
0.794553
0.775059
0.019493
You are tasked with implementing a function that takes a list of natural numbers and a specific natural number, and returns a new list with the given natural number appended to the end of the input list. Write a function that takes a list of natural numbers and a specific natural number, and appends the given natural ...
glaive
[ 0.038683582097291946, 0.02879248932003975, -0.013893768191337585, -0.06727086007595062, 0.044569071382284164, -0.013437066227197647, -0.02066827565431595, 0.05112145096063614, 0.04586717486381531, -0.008148430846631527, 0.020271020010113716, 0.05062783509492874, -0.037214495241642, -0.0057...
0.816421
0.786966
0.029454
You are tasked with simulating the opening and closing of doors based on a specific pattern. You will start with 100 closed doors, and then go through 100 passes. During each pass, you will perform a specific action on the doors based on their position. For example, during the first pass, you will toggle the state of e...
glaive
[ 0.019519193097949028, 0.016920942813158035, -0.027958255261182785, -0.02542140521109104, 0.03048580139875412, -0.015009110793471336, -0.028756460174918175, 0.06880050897598267, 0.02453453093767166, -0.013240044005215168, 0.02250427007675171, 0.024940071627497673, -0.03309324011206627, -0.0...
0.816554
0.795603
0.02095
You are tasked with implementing a Treap data structure in the Pascal programming language. The Treap data structure is a combination of a binary search tree and a binary heap. It has two main operations: insertion and deletion. The structure should maintain the binary search tree property and the heap property. In the...
glaive
[ 0.024546487256884575, 0.0205923393368721, -0.016640201210975647, -0.034186143428087234, 0.03834349662065506, -0.039432063698768616, 0.016779892146587372, 0.08717139065265656, 0.03959028795361519, -0.008155460469424725, 0.03276412934064865, 0.013722573406994343, -0.02145177312195301, -0.017...
0.8115
0.778516
0.032984
You are tasked with implementing a function that calculates a twisted complex of a given degree. The twisted complex is defined by the following functions: 1. A_infinity_rel : This function takes a parameter m and returns a function that takes a positive integer n as input. It uses nested loops to perform calculations...
glaive
[ 0.03194435313344002, 0.04089844226837158, -0.001148494309745729, -0.0537257194519043, 0.02702832594513893, -0.02535850740969181, 0.003683945396915078, 0.0471620038151741, 0.0362715981900692, 0.016528472304344177, 0.02575935423374176, 0.03453858941793442, -0.026570292189717293, -0.008304065...
0.813105
0.778315
0.03479
You are tasked with implementing a CUDA kernel function to calculate the census transform for two input images. The census transform is a technique used in computer vision to compare two images and identify disparities. You will need to write a kernel function called `CensusKernelSM2` that takes in two input images `im...
glaive
[ -0.006237611174583435, 0.0592561773955822, -0.027151701971888542, -0.012666430324316025, 0.03002605214715004, 0.009236853569746017, -0.02717534638941288, 0.08638413995504379, 0.04744313657283783, -0.010652332566678524, 0.03283541277050972, 0.015644142404198647, -0.00013630525791086257, 0.0...
0.803408
0.784185
0.019223
You are tasked with writing a CUDA kernel function that performs an element-wise operation on input arrays and stores the result in an output array. The CUDA kernel function should be able to handle different data types and strides. Write a CUDA kernel function that takes in three input arrays (`p1`, `p2`, `p3`), thre...
glaive
[ 0.005495489574968815, 0.05283505097031593, -0.02623877115547657, -0.01914433017373085, 0.038216106593608856, -0.015752224251627922, -0.0314604826271534, 0.10710325837135315, 0.03890012577176094, -0.009943990036845207, 0.029792871326208115, 0.037164825946092606, -0.010991176590323448, -0.00...
0.802926
0.7817
0.021226
You are tasked with implementing a function to determine whether a given set `S` is a subfield of a field `F`. The function should take a set `S` as input and return true if `S` is a subfield of `F`, and false otherwise. A subfield is a subset of a field that is itself a field, so the function should check that `S` sat...
glaive
[ 0.018227800726890564, 0.016443535685539246, -0.03420073166489601, -0.023321310058236122, 0.0555473230779171, -0.02133021503686905, 0.010348876938223839, 0.05058176815509796, 0.043527401983737946, -0.009599008597433567, 0.01849886029958725, 0.030208585783839226, -0.02921956591308117, -0.013...
0.803743
0.768807
0.034936
You are tasked with implementing a function to compare the half-life of certain genes in a given dataset. The function will take the following input parameters: - filename: the name of the input file containing the half-life data - group: a vector containing the group names for comparison - hour: a vector containing ti...
glaive
[ 0.000059648587921401486, 0.0175983514636755, -0.019996600225567818, -0.04268883168697357, 0.025297844782471657, -0.048301272094249725, -0.036959659308195114, 0.10011744499206543, 0.05117003247141838, -0.02436109445989132, 0.013030104339122772, 0.008303526788949966, -0.030850138515233994, 0...
0.7914
0.775662
0.015737
You are tasked with implementing a Fortran 202X module that includes a subroutine to split a string into tokens using characters in a specified set as token delimiters. The module should also include a function to split a string into tokens and return the resulting array of tokens. The subroutine and function should be...
glaive
[ 0.022806180641055107, 0.01884201355278492, -0.026153594255447388, -0.040699414908885956, 0.03233635053038597, -0.030781682580709457, -0.0265900120139122, 0.051720913499593735, 0.0403437465429306, -0.010422816500067711, 0.009040454402565956, 0.032266609370708466, -0.025033026933670044, -0.0...
0.811805
0.794399
0.017406
You have been tasked with creating a program that takes in various data types and performs transformations on them. The program should be able to handle integers, arrays, vectors, row_vectors, matrices, and multidimensional arrays. The transformations include reversing the input data and parameters. Write a program th...
glaive
[ 0.022004561498761177, 0.0331760011613369, -0.035730551928281784, -0.040103789418935776, 0.0407363697886467, -0.025881538167595863, -0.006271993741393089, 0.06151476502418518, 0.04555850103497505, -0.016334209591150284, 0.015214599668979645, 0.029259640723466873, -0.02144751325249672, -0.02...
0.798713
0.77766
0.021053
How can I sort an array of integers in PHP?
glaive
[ 0.009957642294466496, 0.027301471680402756, -0.020097948610782623, -0.02193639799952507, 0.030408941209316254, -0.039309702813625336, -0.021729858592152596, 0.03912942111492157, 0.03466758877038956, -0.018156416714191437, 0.01582847349345684, 0.02585126832127571, -0.049947500228881836, -0....
0.786145
0.771213
0.014932
You are tasked with defining a Zig type that coerces from a mutable pointer to a single-item mutable pointer pointing to an array of length 1, and then using this type to print the value of a letter.
glaive
[ -0.0016609822632744908, 0.04019889608025551, -0.021017299965023994, -0.028059877455234528, 0.05109785869717598, -0.04844580590724945, -0.016508003696799278, 0.046527083963155746, 0.033342283219099045, -0.02713676355779171, 0.032691776752471924, 0.03450443223118782, -0.016300050541758537, -...
0.809953
0.794267
0.015686
You are tasked with creating a Python function that partitions a command and its arguments into smaller chunks, taking into account the maximum length of each chunk. The function should take the following parameters: - `command`: a tuple of strings representing the command and its arguments - `args`: a tuple of strings...
glaive
[ 0.03329566866159439, 0.026953207328915596, -0.027560584247112274, -0.01300845667719841, 0.014804505743086338, -0.008937603794038296, -0.02603975683450699, 0.03861410170793533, 0.025775479152798653, 0.0011195552069693804, 0.013921495527029037, 0.04132146015763283, -0.02403607964515686, 0.01...
0.806892
0.783043
0.023849
I have a fixed list of integers and I want to check if there are any even numbers in it. If there are, can I use a multi-step logic to identify and display the even numbers from the list? Number sequence = [2, 3, 4, 5, 6, 7, 8, 9]
glaive
[ 0.035540059208869934, 0.0019447020022198558, -0.028493015095591545, -0.03691026195883751, 0.030564434826374054, -0.03622595593333244, -0.016516955569386482, 0.06407972425222397, 0.03571251407265663, -0.017120053991675377, 0.01832248456776142, 0.040514230728149414, -0.041767667979002, -0.01...
0.815191
0.791155
0.024036
Can you provide a function to determine whether a given number is a prime number?
glaive
[ 0.03046889789402485, 0.018151886761188507, -0.018000366166234016, -0.035519517958164215, 0.030631760135293007, -0.03830960392951965, 0.009056933224201202, 0.06139548867940903, 0.03776920586824417, -0.015720227733254433, 0.01598733849823475, 0.025220992043614388, -0.03344228118658066, -0.02...
0.78946
0.769578
0.019882
You are tasked with implementing a CUDA kernel for matrix multiplication on the device. The goal is to compute the product of two matrices A and B and store the result in matrix C. The matrices A, B, and C are represented as 1D float arrays in row-major order. The width of matrix A is wA and the width of matrix B is wB...
glaive
[ 0.017571477219462395, 0.05663987621665001, -0.02651338279247284, -0.02535860240459442, 0.04641592130064964, -0.0016005990328267217, -0.034333836287260056, 0.10525080561637878, 0.03461386263370514, -0.02383589744567871, 0.01321487594395876, 0.030675077810883522, -0.010156719014048576, -0.01...
0.792985
0.770471
0.022514
You are tasked with implementing a subroutine in Fortran called "marquardt2" that performs calculations for a specific scientific application. The subroutine takes in several input parameters, including arrays and integers, and is responsible for performing various mathematical operations and returning specific output ...
glaive
[ 0.013198677450418472, 0.029935885220766068, -0.012991131283342838, -0.03156225010752678, 0.029000695794820786, -0.017989952117204666, -0.006226192228496075, 0.06594601273536682, 0.043415311723947525, -0.00019721160060726106, 0.01750146597623825, 0.031773991882801056, -0.009182407520711422, ...
0.791579
0.776823
0.014756
You are tasked with implementing a parallel Breadth-First Search (BFS) algorithm in CUDA for graph traversal. The goal is to find the shortest path from a given source vertex to all other vertices in the graph. You will need to write code to initialize the frontier, visited, and cost vectors for the BFS algorithm. The...
glaive
[ -0.0036971899680793285, 0.04305703192949295, -0.02125820890069008, -0.02304989844560623, 0.018363848328590393, -0.009301804937422276, -0.016605453565716743, 0.07327330112457275, 0.051956042647361755, -0.016283731907606125, 0.018521282821893692, 0.03912016376852989, 0.01483758632093668, 0.0...
0.79952
0.773475
0.026045
What is a Java solution for printing numbers from 0 to a given integer?
glaive
[ 0.003531442256644368, 0.033335208892822266, -0.028063930571079254, -0.023128286004066467, 0.02320818044245243, -0.02820860780775547, -0.006442515179514885, 0.03677353262901306, 0.047939233481884, -0.051816996186971664, 0.025219760835170746, 0.027730809524655342, -0.03421223536133766, -0.02...
0.792006
0.776451
0.015555
You are tasked with implementing a function to calculate the trace and determinant of a square matrix using the fml library for GPU matrix operations. The function should take a square matrix as input and return the trace and determinant of the matrix. Your function should handle matrices of size 2x2 and 4x4, and shou...
glaive
[ 0.016089633107185364, 0.03642953559756279, -0.042575739324092865, -0.055689312517642975, 0.06210622563958168, -0.021051427349448204, -0.03396134078502655, 0.07513968646526337, 0.04702479764819145, -0.01003709714859724, 0.0074737779796123505, 0.03489311411976814, -0.03502558544278145, -0.01...
0.801627
0.774936
0.026691
You are tasked with writing a program to calculate the coefficient of x in the reduction of the n-th polynomial at A157751 by x^2->x+2. The reduction of a polynomial means replacing every instance of x^2 with x+2. Your program should take the input n and output the coefficient of x in the reduced polynomial.
glaive
[ 0.01833450235426426, 0.029815781861543655, -0.031254421919584274, -0.039518602192401886, 0.0298130065202713, -0.033838897943496704, -0.02711285464465618, 0.07275721430778503, 0.04552457109093666, 0.016221391037106514, 0.0067712245509028435, 0.02623269334435463, -0.029211804270744324, 0.004...
0.821821
0.784164
0.037657
You are tasked with creating a function that maps data indices to bit indices in a tree data structure. The tree is structured as a series of levels, each with a different number of leaf nodes. Your function must correctly determine the bit index corresponding to a given data index, taking into account the varying numb...
glaive
[ 0.02831217460334301, 0.04277506098151207, -0.027258682996034622, -0.03504040464758873, 0.03779732063412666, -0.046823110431432724, -0.010501446202397346, 0.0804203450679779, 0.027173003181815147, 0.00006465451588155702, 0.037190914154052734, 0.013489404693245888, -0.04717697203159332, 0.02...
0.801671
0.772517
0.029153
You are given a grid of atomic points, each represented by a unique label (p11, p12, etc). Each atomic point can be a focal point or a target. You are also given a list of mutex groups, states, and goals. Additionally, you are provided with a list of operators, each defining a specific action to be performed on the gri...
glaive
[ 0.018407879397273064, 0.02585069090127945, -0.030011247843503952, -0.030819738283753395, 0.02375628985464573, -0.06021783873438835, -0.032189905643463135, 0.0700388103723526, 0.039091385900974274, 0.0058581409975886345, 0.017316186800599098, 0.03424014896154404, -0.03891635313630104, -0.00...
0.819818
0.799974
0.019844
How can an AI algorithm find the longest continuous substring of unique characters in a given string of characters?
glaive
[ 0.01466220524162054, 0.0180412158370018, -0.004732565488666296, -0.036511339247226715, 0.024963438510894775, -0.039984509348869324, -0.015386074781417847, 0.043631404638290405, 0.033477067947387695, -0.03655330836772919, 0.016427990049123764, 0.01665434241294861, -0.00726625369861722, 0.00...
0.811607
0.789281
0.022326
You are tasked with creating a C# program that will draw a filled square of a given size. The program should take an integer as input and output a square made of asterisks (*) with the given size. For example, if the input is 3, the program should output: *** *** ***
glaive
[ 0.031861063092947006, 0.05145376920700073, -0.02386358380317688, -0.04968703165650368, 0.03692551702260971, -0.03843851760029793, -0.000030956423870520666, 0.09125521034002304, 0.052430786192417145, -0.02429884672164917, 0.04084806144237518, 0.05771269276738167, -0.044611454010009766, -0.0...
0.800825
0.775528
0.025297
Can you help me complete the following code in JavaScript? I have an array of integers called `arr` and a positive integer `k`. I need to return a sorted list with a length of `k`, containing the `k` largest numbers from the `arr` array. Here are some examples: Example 1: Input: arr = [-3, -4, 5], k = 3 Output: [-4, ...
glaive
[ 0.03755323216319084, 0.043908897787332535, -0.03483279421925545, -0.04091976210474968, 0.03902575746178627, -0.03609960898756981, -0.031665410846471786, 0.03446148708462715, 0.032725825905799866, -0.013996669091284275, 0.03200431168079376, 0.031558312475681305, -0.040346745401620865, 0.021...
0.825008
0.783262
0.041746
You are tasked with creating a program in the Chapel programming language that takes in a list of numbers and calculates the average of all the numbers in the list. Your program should take the list of numbers as input and output the calculated average. Write a Chapel program that accomplishes this task, ensuring that...
glaive
[ 0.015713781118392944, 0.024571070447564125, -0.033145301043987274, -0.02559339813888073, 0.057240769267082214, -0.055610764771699905, -0.02141132391989231, 0.04892222583293915, 0.014836348593235016, -0.03014296665787697, 0.024559490382671356, 0.03673035651445389, -0.02979290299117565, 0.00...
0.803828
0.789262
0.014565
You have been tasked with implementing a function in CUDA that copies data from one array to another, specifically copying the upper portion of a matrix. The function should take in the following parameters: - `n`: The size of the matrix - `nb`: The block size - `dV_array`: An array of pointers to the input matrices - ...
glaive
[ 0.004648395348340273, 0.0473996177315712, -0.020544609054923058, -0.01633218489587307, 0.02555152028799057, -0.010713089257478714, -0.017774855718016624, 0.09015940874814987, 0.027466002851724625, -0.018863949924707413, 0.03271473944187164, 0.029594695195555687, -0.013043131679296494, 0.00...
0.794053
0.777984
0.016069
You are tasked with creating a class that represents a half circle in a 2D plane. The class should implement the interface IPointSet2D, which contains a method called Contains that determines whether a given point is inside the half circle. The HalfCircle class should have a property called Radius, which represents th...
glaive
[ -0.00036773408646695316, 0.02774951048195362, -0.019694510847330093, -0.02698688767850399, 0.04044169560074806, -0.029555318877100945, -0.0132397236302495, 0.0808631181716919, 0.05509277060627937, -0.011902231723070145, 0.020226268097758293, 0.04857068508863449, 0.000397053750930354, -0.03...
0.795569
0.776075
0.019494
Can you provide a way to compute the sum of all numbers within an array of integers?
glaive
[ 0.018144940957427025, 0.028474802151322365, -0.035135138779878616, -0.030951790511608124, 0.037240803241729736, -0.04262649640440941, -0.010197713039815426, 0.022565046325325966, 0.03921757638454437, -0.044247690588235855, 0.015339706093072891, 0.04015766829252243, -0.048507120460271835, -...
0.79852
0.770657
0.027864
You are tasked with implementing a hash combinator in OCaml. The hash combinator should take a value of type 'a and return a hash value of type int. The combinator should be able to combine hash values for different types of input data, such as integers, booleans, characters, strings, lists, arrays, options, pairs, tri...
glaive
[ 0.03363092616200447, 0.04000161960721016, -0.0015556400176137686, -0.031425632536411285, 0.03996766358613968, -0.011736394837498665, -0.01615997403860092, 0.05558881536126137, 0.046047311276197433, -0.02370777353644371, 0.0021549107041209936, 0.05070323124527931, -0.005902883131057024, -0....
0.796129
0.779486
0.016644
How can I generate a Pythagorean triple given the dimensions of a triangle using the provided comments as a guide?
glaive
[ 0.009801848791539669, 0.01976805366575718, -0.02030978351831436, -0.06002558767795563, 0.028902923688292503, -0.041403237730264664, -0.017190931364893913, 0.04707944020628929, 0.024781454354524612, -0.012772373855113983, 0.02461789734661579, 0.04674328863620758, -0.040077462792396545, -0.0...
0.783573
0.768737
0.014836
You are tasked with writing a program that takes a string as input and counts the number of occurrences of the character '1' in the string. You should then output the count of '1's in the string. For example, given the input string "1010101", the program should output 4, as there are 4 occurrences of the character '1'...
glaive
[ 0.018163226544857025, 0.020407257601618767, -0.011892183683812618, -0.0471658892929554, 0.05344134569168091, -0.028273655101656914, -0.024462727829813957, 0.050967153161764145, 0.012514276430010796, -0.008120469748973846, 0.01167051587253809, 0.020564313977956772, -0.028572561219334602, -0...
0.814975
0.763177
0.051798
You are tasked with creating a database schema for a university system. The schema should include tables for students, teachers, courses, course schedules, and attendance. Each student has a unique student number, first name, last name, and birthdate. Each teacher has a unique teacher ID, first name, last name, and bir...
glaive
[ 0.022565942257642746, 0.005340860225260258, -0.04068610444664955, -0.028415672481060028, 0.025538979098200798, -0.04962826520204544, -0.028773296624422073, 0.05945182964205742, 0.028906570747494698, 0.001180007471702993, 0.030070317909121513, 0.01886611245572567, -0.01674780435860157, 0.00...
0.774283
0.759018
0.015265
You are tasked with creating a data structure in Java to represent a list of locations. Each location should have a latitude and longitude value. Additionally, you need to create a structure to represent a list of single-element groups, where each group contains a count value. Finally, you need to implement a data stru...
glaive
[ 0.008874110877513885, 0.000584877619985491, -0.0554332435131073, -0.044473644345998764, 0.03690019249916077, -0.04910622909665108, -0.03436623141169548, 0.03925427049398422, 0.03350416198372841, -0.03380260989069939, 0.024968046694993973, 0.028274334967136383, -0.040420446544885635, -0.008...
0.798815
0.774711
0.024104
You are tasked with creating a function in Mathematica 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. Write a function called "sumEvenNumbers" that takes in a list of integers as input an...
glaive
[ 0.03533566743135452, 0.013752994127571583, -0.039217617362737656, -0.05107909440994263, 0.046592481434345245, 0.00013518163177650422, 0.003788030706346035, 0.04484107717871666, 0.03930876404047012, -0.013770143501460552, 0.009212328121066093, 0.05304247885942459, -0.04073149338364601, -0.0...
0.799581
0.758074
0.041506
You are tasked with creating a program to calculate the total points of each team in a football league based on the given data in a table. The table contains the following columns: Team, P (games played), W (games won), D (games drawn), L (games lost), F (goals for), A (goals against), and Pts (total points). Your prog...
glaive
[ 0.010435974225401878, 0.017469050362706184, -0.043884798884391785, -0.05640611797571182, 0.05590077489614487, -0.06423161178827286, -0.0038793175481259823, 0.03635821491479874, 0.03143138065934181, -0.020499682053923607, -0.003698242362588644, 0.030318651348352432, -0.049434516578912735, 0...
0.795112
0.762749
0.032364
You are tasked with implementing a CUDA program to add two arrays of integers and measure the time taken for the addition operation. Write a CUDA program that: - Generates two arrays `a` and `b` of size `n`, with random integer values - Allocates memory for `a`, `b`, and `c` on the device - Copies `a` and `b` from hos...
glaive
[ 0.015868771821260452, 0.04741618037223816, -0.017148345708847046, -0.007902752608060837, 0.018531208857893944, 0.006967748515307903, -0.03990801051259041, 0.10082627832889557, 0.060633812099695206, -0.01431709062308073, 0.016244327649474144, 0.03527919203042984, -0.003231955459341407, -0.0...
0.804937
0.780064
0.024873
You are tasked with implementing a linked list data structure for reference positions. The goal is to create, delete, and manipulate the list, as well as test its functionality. The specific tasks include: 1. Creating a function to create a new reference position list, checking if it is created successfully and if the ...
glaive
[ 0.007644927129149437, 0.014923940412700176, -0.029033169150352478, -0.04726944491267204, 0.047034572809934616, -0.030815817415714264, 0.0017698568990454078, 0.06799153238534927, 0.04009505733847618, -0.021620668470859528, 0.02733047679066658, 0.027327757328748703, -0.017333202064037323, 0....
0.808878
0.794209
0.01467
You are tasked with creating a program that calculates the minimum amount of gas needed for a trip and determines the number of times a gas tank must be filled. The following information is known: the capacity of the gas tank (in liters), the distance between two cities (in kilometers), and the fuel consumption rate (i...
glaive
[ 0.017654642462730408, 0.039674848318099976, -0.012289903126657009, -0.033587388694286346, 0.043628837913274765, -0.051421646028757095, -0.024862900376319885, 0.0557124987244606, 0.01362996082752943, -0.028760962188243866, 0.019799046218395233, 0.014815837144851685, -0.02151343785226345, -0...
0.808483
0.787094
0.021389
You are tasked with implementing a function called `bed_random` that generates random intervals within a genome. The function should take in the genome information, the number of intervals (n), the length of intervals, and a seed for reproducibility. The function should return a data frame with the specified number of ...
glaive
[ 0.012250600382685661, 0.01112023089081049, -0.02654275670647621, -0.02592502348124981, 0.014088081195950508, -0.028019404038786888, -0.044817034155130386, 0.06279465556144714, 0.013497344218194485, -0.009717896580696106, 0.018646450713276863, 0.027039580047130585, -0.018160751089453697, 0....
0.797018
0.778804
0.018214
You are tasked with creating a program that transforms data by assigning a value from a specific location in a matrix to a scalar variable. The transformed data consists of a 2x3 matrix of real numbers, denoted as y, and a real scalar variable, denoted as x. The value of x is to be assigned the value located at the fir...
glaive
[ 0.014453496783971786, 0.03509662300348282, -0.053060200065374374, -0.04415173456072807, 0.04639216884970665, -0.025118764489889145, -0.012778435833752155, 0.07374119013547897, 0.041711412370204926, -0.030924873426556587, 0.011549165472388268, 0.02830878458917141, -0.03538999333977699, -0.0...
0.80351
0.783206
0.020304
Write a Fortran subroutine that calculates the value of VERTEX using the following formula: VERTEX = COUP*S3(5)*(-CI*(TMP8*TMP11)+CI*(TMP2*TMP13)) You are given the following variables: - COMPLEX*16 CI - COMPLEX*16 V2(*) - COMPLEX*16 S3(*) - COMPLEX*16 VERTEX - COMPLEX*16 COUP - COMPLEX*16 V1(*) - COMPLEX*16 TMP2 - COM...
glaive
[ 0.01767265424132347, 0.036698851734399796, -0.02281269058585167, -0.04694334790110588, 0.03881696239113808, -0.03985191509127617, -0.009110192768275738, 0.06774865090847015, 0.03808114677667618, 0.0064453729428350925, 0.03848694637417793, 0.04458072409033775, -0.014283600263297558, -0.0155...
0.800613
0.773071
0.027543
I am working on a program that needs to calculate the factorial of a given number. Can someone help me write a function in Python that takes an integer input and returns the factorial of that number? The factorial of a non-negative integer n is the product of all positive integers less than or equal to n.
glaive
[ 0.029300445690751076, 0.019730474799871445, -0.03390580788254738, -0.01995902694761753, 0.04217463731765747, -0.03551048785448074, -0.028457842767238617, 0.03476054593920708, 0.035240527242422104, -0.01647241786122322, 0.010446062311530113, 0.04404974356293678, -0.039152003824710846, -0.01...
0.79455
0.779578
0.014972
You are tasked with creating a function to calculate the height of a binary tree with a given number of nodes and maximum depth. The function should take two parameters: n, the number of nodes in the binary tree, and m, the maximum depth of the tree. The height of a binary tree is defined as the number of edges on the ...
glaive
[ 0.008597977459430695, 0.020927196368575096, -0.03662215918302536, -0.025701798498630524, 0.04897515848278999, -0.04060979560017586, -0.018795492127537727, 0.06453866511583328, 0.028934426605701447, 0.00303403427824378, 0.01626627705991268, 0.04677743464708328, -0.040670618414878845, 0.0231...
0.805849
0.765391
0.040458
Write a Fortran subroutine to calculate the value of a function and its derivative. The subroutine should take in the following input parameters: time, t, a, b, dd, h1, h2, h3, h4, and should return the value of the function (func) and its derivative (funcp). The function and its derivative should be calculated using t...
glaive
[ 0.008008248172700405, 0.030774464830756187, -0.031212622299790382, -0.04182799533009529, 0.05517847463488579, -0.02302115224301815, -0.021701794117689133, 0.05883069336414337, 0.042099710553884506, 0.010154842399060726, 0.024894440546631813, 0.04696907848119736, -0.03315053507685661, -0.00...
0.793137
0.774017
0.01912
You are tasked with implementing a fast and efficient calculation for the hyperbolic sine function (sinh) in 32-bit floating-point math. The function should take a single input and return the hyperbolic sine value. You are not allowed to use any built-in library functions for this calculation, and you must ensure that ...
glaive
[ 0.005538205150514841, 0.04884150251746178, -0.029825681820511818, -0.021315572783350945, 0.034483812749385834, -0.01610802486538887, -0.02934444509446621, 0.0808531641960144, 0.04433874785900116, -0.012785883620381355, 0.04239316284656525, 0.03990229219198227, -0.006477475631982088, -0.010...
0.808703
0.78411
0.024593
You are tasked with creating a program to calculate the probability of a quantum state and visualize the results. The program should include functions to calculate the amplitude and probability of a given set of quantum states, as well as to find the maximum probability and generate 3D and contour plots of the probabil...
glaive
[ 0.004709694534540176, 0.03032173030078411, -0.03365118056535721, -0.02765330858528614, 0.05050693824887276, -0.022126413881778717, -0.02256423979997635, 0.07347257435321808, 0.037703897804021835, -0.000008633153811388183, 0.029840195551514626, 0.03734305128455162, -0.013248017989099026, -0...
0.790456
0.772405
0.018051
You are tasked with implementing a Bayesian hierarchical model in Stan, a probabilistic programming language. The model should include a parameter "y" that follows a normal distribution with a mean of 0 and a standard deviation of 1. Additionally, the model should contain a 3x3 array "a" of row vectors, where each elem...
glaive
[ 0.017376862466335297, 0.0034728716127574444, -0.034278564155101776, -0.0487925186753273, 0.0421840101480484, -0.02252812124788761, -0.02285381779074669, 0.0620250478386879, 0.03895524516701698, -0.02184811234474182, 0.0011085440637543797, 0.04899256303906441, -0.018586033955216408, 0.00315...
0.802076
0.784066
0.01801
You are tasked with creating a module in Haskell that contains actions to mutate contents of cells and generate new random values. The actions should be in the \texttt{Rand} monad and should not require the \texttt{Thread} monad. The module should include the following functionalities: - Generate a random integer withi...
glaive
[ 0.007216391619294882, 0.029447609558701515, 0.001820902107283473, -0.03259604424238205, 0.041155967861413956, -0.039535362273454666, -0.012010214850306511, 0.03879150003194809, 0.03075573965907097, -0.01510611455887556, 0.0031430635135620832, 0.03214232251048088, -0.030474141240119934, -0....
0.792324
0.776654
0.015671
You are tasked with implementing the Betweenness Centrality (BC) algorithm for a graph using CUDA programming language. The BC algorithm calculates the centrality of each vertex in a graph by measuring the number of shortest paths that pass through it. Your task is to write the CUDA code that will perform the BC calcul...
glaive
[ 0.011359882541000843, 0.029337523505091667, -0.02740366943180561, -0.010282167233526707, 0.011198172345757484, -0.005290071479976177, -0.021108699962496758, 0.06571342796087265, 0.05254583805799484, -0.02742626890540123, 0.02660299651324749, 0.03319134935736656, -0.0035050557926297188, -0....
0.806238
0.780619
0.025619
You are tasked with implementing a function to perform non-maximum suppression (NMS) on bounding boxes and scores for object detection in CUDA. The function signature is as follows: ```cpp pluginStatus_t nmsInference(cudaStream_t stream, const int N, const int perBatchBoxesSize, const int perBatchScoresSize, const...
glaive
[ -0.011423666030168533, 0.02614367939531803, -0.03580891340970993, -0.007221963256597519, 0.029492266476154327, -0.022517763078212738, -0.03589581325650215, 0.08764024823904037, 0.06006656214594841, -0.006725868210196495, 0.029802531003952026, 0.025059441104531288, -0.011053330264985561, 0....
0.818369
0.796551
0.021818
You are tasked with creating a program using the VTK (Visualization Toolkit) and VTKInteraction package in Tcl. The program should create a tetrahedron with specified points, subdivide it, shrink it, and display it on a render window. Write a Tcl program that accomplishes the following: 1. Create a vtkPoints object ca...
glaive
[ 0.012235493399202824, 0.04355883598327637, -0.01722448691725731, -0.03714826703071594, 0.04927481338381767, -0.021657664328813553, -0.015416005626320839, 0.061154887080192566, 0.050684843212366104, -0.00009137382585322484, 0.03565062955021858, 0.04028261825442314, -0.01801435463130474, 0.0...
0.794185
0.777592
0.016592
You are tasked with creating a program that generates a random array of integers and then sorts the array in ascending order using the bubble sort algorithm. The program should take user input for the size of the array and then display the sorted array as the output. Your task is to write a Python program that fulfills...
glaive
[ 0.015378236770629883, 0.025608142837882042, -0.028740117326378822, -0.02844230644404888, 0.026369653642177582, -0.03845474123954773, -0.04018557816743851, 0.04436751455068588, 0.024223919957876205, -0.02673613838851452, 0.025685789063572884, 0.029218237847089767, -0.043565426021814346, 0.0...
0.810725
0.788478
0.022247
You have been tasked with creating a menu system for a video game, where players can navigate through different levels (or presets) of the game. Each level has its own sub-menu with specific sub-presets that players can access. You need to implement the data structure and code logic to represent this menu system. Your...
glaive
[ 0.019076913595199585, -0.01286192238330841, -0.048982322216033936, -0.024954890832304955, 0.035169366747140884, -0.033477749675512314, -0.007454384118318558, 0.0717926174402237, 0.034856755286455154, -0.03377487137913704, 0.04558030143380165, 0.03473705053329468, -0.029650423675775528, -0....
0.805842
0.790719
0.015122