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 writing a function in the complex number library to calculate the argument of a complex number. The argument of a complex number is defined as a real number in the range (-π, π], such that for `x ≠ 0`, `sin (arg x) = x.im / x.abs` and `cos (arg x) = x.re / x.abs`, while `arg 0` defaults to `0`. Your... | glaive | [
0.02674226276576519,
0.04312319681048393,
-0.034969355911016464,
-0.033622000366449356,
0.04601054638624191,
-0.02570650540292263,
-0.008654422126710415,
0.040808774530887604,
0.048295170068740845,
-0.000008284306204586755,
0.02556198462843895,
0.04887070134282112,
-0.035538654774427414,
-... | 0.808393 | 0.788593 | 0.0198 |
I need to write a program that calculates the distance between two indices in a given space. The indices represent the location of points in the space, and the distance should be calculated using the Euclidean distance formula. The program should take two indices as input and output the distance between them. | glaive | [
0.0014916781801730394,
0.029494373127818108,
-0.04769549518823624,
-0.02721155248582363,
0.04790471866726875,
-0.031617671251297,
-0.04373841732740402,
0.05175025016069412,
0.06044045090675354,
-0.02902352064847946,
0.025184456259012222,
0.03093920648097992,
-0.022591302171349525,
-0.01791... | 0.80227 | 0.773024 | 0.029246 |
You are tasked with creating a CUDA program that performs vector addition. The program should be able to add two vectors of floating-point numbers and store the result in a third vector. The program should also handle memory allocation, data transfer between the host and device, launching the kernel, and verifying the ... | glaive | [
-0.00016172385949175805,
0.041908666491508484,
-0.013302664272487164,
-0.009838774800300598,
0.032282523810863495,
0.0010449182009324431,
-0.020536603406071663,
0.10418977588415146,
0.0410977341234684,
-0.02108079195022583,
0.008274083957076073,
0.0446263812482357,
-0.007602384779602289,
-... | 0.798041 | 0.777387 | 0.020654 |
You are tasked with writing a CUDA program to perform element-wise addition of two arrays. The arrays contain random integer values between 0 and 9. The program should allocate memory for the arrays on both the host and the device, copy the data from the host to the device, perform the addition using a CUDA kernel, and... | glaive | [
0.004064150154590607,
0.04647543653845787,
-0.022917019203305244,
-0.014382760040462017,
0.028466492891311646,
-0.0062218899838626385,
-0.01895938254892826,
0.08799467235803604,
0.05589330196380615,
-0.022610248997807503,
0.014847999438643456,
0.046029940247535706,
-0.021363498643040657,
-... | 0.80347 | 0.782068 | 0.021402 |
You are required to implement a data structure to represent regular trees in OCaml. The regular tree type is defined as follows:
- Param denotes tree variables, with the first int representing the depth of the occurrence and the second int representing the index in the array of trees introduced at that depth. Note that... | glaive | [
0.0038086925633251667,
0.03926990181207657,
-0.01838172972202301,
-0.047619711607694626,
0.026959050446748734,
-0.039773207157850266,
0.007201360538601875,
0.07539235055446625,
0.041817452758550644,
-0.018175935372710228,
0.04131369665265083,
0.03828692063689232,
-0.022732868790626526,
-0.... | 0.799961 | 0.777776 | 0.022185 |
You are required to implement a CUDA kernel function for compacting an input array based on a set of flags. The compact function should take in an input array, an output array, an array of flags, and the length of the input array. The goal is to filter out elements from the input array based on the flags and store the ... | glaive | [
0.008133998140692711,
0.06159047409892082,
-0.02038286067545414,
-0.013438432477414608,
0.03812691941857338,
-0.02400980331003666,
-0.023725226521492004,
0.08415143191814423,
0.03990597650408745,
-0.004107619170099497,
0.02338952198624611,
0.0203994233161211,
0.00044554888154380023,
-0.005... | 0.816582 | 0.793713 | 0.022869 |
You are tasked with creating a set of functions to perform various operations on unsigned integer vectors in CUDA. These functions should enable users to create, manipulate, and perform arithmetic operations on vectors of different dimensions (2, 3, and 4).
Specifically, you need to implement the following operations:... | glaive | [
0.028104489669203758,
0.04738394543528557,
-0.01881096325814724,
-0.012236312963068485,
0.036298878490924835,
0.0012948878575116396,
-0.03308619186282158,
0.09188476949930191,
0.04203353822231293,
-0.009635775350034237,
0.03044910915195942,
0.022212665528059006,
0.019526880234479904,
-0.01... | 0.796791 | 0.773177 | 0.023615 |
You are tasked with implementing the Strassen algorithm for matrix multiplication in Fortran. The Strassen algorithm is a divide-and-conquer method that is more efficient than the standard matrix multiplication algorithm for large matrices. Your task is to write a recursive subroutine `strassen` that takes in two input... | glaive | [
0.0105104586109519,
0.025045087561011314,
-0.007905020378530025,
-0.03297083079814911,
0.04372945800423622,
-0.0034862332977354527,
-0.015188444405794144,
0.08021625131368637,
0.04468429461121559,
-0.005063572898507118,
0.006391240283846855,
0.03650348633527756,
-0.026176033541560173,
-0.0... | 0.821922 | 0.78528 | 0.036643 |
You are tasked with creating a program that calculates the sum of two numbers and stores the result in a variable. The first number is 90 and the second number is 100. You need to write a function or method that takes these two numbers as input, calculates the sum, and stores the result in a variable. The variable shou... | glaive | [
0.010775099508464336,
0.014092550612986088,
-0.04545587673783302,
-0.02743622660636902,
0.0564148873090744,
-0.012310587801039219,
-0.020088832825422287,
0.07284042239189148,
0.04975103214383125,
-0.02273653633892536,
0.016559062525629997,
0.04993480071425438,
-0.03610387444496155,
-0.0208... | 0.802654 | 0.782302 | 0.020352 |
You are tasked with implementing a Carry Save Adder with 8 20-bit inputs in VHDL. The entity should have 8 input ports, each with a 20-bit std_logic_vector, and 2 output ports for the sum and carry, also 20-bit std_logic_vectors. The architecture should be defined to handle the addition of the 8 inputs and generate par... | glaive | [
0.029135970398783684,
0.03418440744280815,
-0.01910119317471981,
-0.03267930820584297,
0.03139433264732361,
-0.015505739487707615,
-0.037933360785245895,
0.08796636760234833,
0.048662710934877396,
-0.022327931597828865,
-0.0076688737608492374,
0.040128856897354126,
-0.022500712424516678,
-... | 0.798363 | 0.778915 | 0.019447 |
You are required to write a subroutine to compute the coefficients of a real polynomial matrix P(x), where P(x) is defined as P(x) = P1(x) * P2(x) + alpha * P3(x). P1(x), P2(x) and P3(x) are given real polynomial matrices, and alpha is a real scalar. Each of the polynomial matrices P1(x), P2(x) and P3(x) may be the zer... | glaive | [
0.026672424748539925,
0.03623386099934578,
-0.03638412058353424,
-0.04069739952683449,
0.03052304871380329,
-0.019711259752511978,
-0.014244450256228447,
0.061188582330942154,
0.04051091521978378,
0.006376464851200581,
0.009931688196957111,
0.04335732012987137,
-0.032213661819696426,
-0.01... | 0.800745 | 0.766873 | 0.033872 |
You are tasked with creating a Julia program that can calculate the median of a given set of numbers. You need to implement a function that takes in an array of numbers and returns the median value. The median is the middle value in a sorted list of numbers, or the average of the two middle values if the list has an ev... | glaive | [
0.009817487560212612,
0.016968058422207832,
-0.05929986760020256,
-0.037747956812381744,
0.05067462474107742,
-0.014790799468755722,
-0.02723044715821743,
0.08258826285600662,
0.048131782561540604,
-0.01789078861474991,
0.027364308014512062,
0.025034574791789055,
-0.03008386492729187,
-0.0... | 0.797379 | 0.776687 | 0.020692 |
You are tasked with creating a CUDA kernel function to perform matrix multiplication for various data types. The kernel function should take in two matrices A and B, as well as scalar values alpha and beta, and produce the resulting matrix C using the following formula:
C = alpha * A * B + beta * C
The kernel function... | glaive | [
0.014508895576000214,
0.055522143840789795,
-0.02595461718738079,
-0.023264257237315178,
0.04334074258804321,
-0.013889934867620468,
-0.028621336445212364,
0.09724047034978867,
0.04061228409409523,
-0.026524700224399567,
0.017371144145727158,
0.03951549530029297,
-0.01757054403424263,
-0.0... | 0.786676 | 0.765358 | 0.021318 |
You are required to create a simulation model for a Susceptible-Infected-Recovered (SIR) compartmental model for infectious diseases. The model should be able to predict the spread of the disease through a given population over time. The SIR model consists of the following differential equations:
dy_dt[1] = -beta*y[1]... | glaive | [
0.003482684027403593,
0.012852337211370468,
-0.03805026412010193,
-0.0351787768304348,
0.038797423243522644,
-0.05658888444304466,
-0.03268468379974365,
0.08399311453104019,
0.032240595668554306,
-0.023702004924416542,
0.02365882508456707,
0.0530826672911644,
-0.027314791455864906,
-0.0013... | 0.792637 | 0.777896 | 0.01474 |
I have two sorted arrays, `arr1` and `arr2`, and I need to merge them together while keeping track of the total number of inversions that occur during the merging process. An inversion occurs when a value from `arr2` is inserted before a value from `arr1`. Can you provide an algorithm that solves this problem and also ... | glaive | [
0.01573331654071808,
0.03361833095550537,
-0.01754099316895008,
-0.0249672532081604,
0.03246770426630974,
-0.014110695570707321,
-0.04082588106393814,
0.06005754694342613,
0.03095616027712822,
-0.014284010976552963,
0.020115116611123085,
-0.004980303347110748,
-0.017198413610458374,
-0.000... | 0.811425 | 0.778835 | 0.03259 |
You are tasked with creating a program to calculate the probability of a quantum state using a given amplitude function. The amplitude function is defined as follows:
```python
amplitude[x_,y_] := (Exp[-15 I y] (1 (I Sin[x])^5 Cos[x]^11 + 1 (I Sin[x])^11 Cos[x]^5) + ... + Exp[15 I y] (1 (I Sin[x])^7 Cos[x]^9 + 1 (I Sin... | glaive | [
0.00017041376850102097,
0.04026609659194946,
-0.030227767303586006,
-0.02597503550350666,
0.03398435562849045,
-0.027454206719994545,
-0.021924728527665138,
0.06253735721111298,
0.02818194217979908,
0.006266708951443434,
0.02900451421737671,
0.02567114308476448,
-0.020360704511404037,
-0.0... | 0.800434 | 0.776101 | 0.024334 |
I have an array of integers in Java. I want to write a function that performs two tasks:
i) It should delete all numbers from the array that are divisible by three.
ii) It should sort the remaining numbers in ascending order. However, I am not allowed to use any built-in sort methods for the sorting task. Additionally... | glaive | [
0.019433295354247093,
0.02371305786073208,
-0.05386316031217575,
-0.03163434565067291,
0.047546640038490295,
-0.05059082806110382,
-0.012690899893641472,
0.06391935050487518,
0.026455096900463104,
-0.022445963695645332,
0.02633257396519184,
0.020321348682045937,
-0.047829098999500275,
-0.0... | 0.809867 | 0.787176 | 0.022692 |
You are tasked with implementing an asynchronous pre-divider in VHDL, which can be selected up to 1/4 of the input frequency. The output frequency will be used by a synchronous divider. The output ClkOut1 can be either Clk_CI or Clk_CI/2 for Select_SI = 0 and Select_SI > 0, respectively. The ClkOut1 is intended to prov... | glaive | [
0.002904280787333846,
0.034482479095458984,
-0.029997022822499275,
-0.025146985426545143,
0.031887125223875046,
-0.023093611001968384,
-0.03672731667757034,
0.08063489943742752,
0.0370497852563858,
-0.009452294558286667,
0.043055664747953415,
0.051332805305719376,
-0.015413783490657806,
-0... | 0.79707 | 0.780691 | 0.016378 |
You are tasked with implementing a set of procedures to work with polynomials of the form 0 or +/- epsilon^d with 0 <= d < N, where N is a positive integer. The procedures needed are as follows:
1. `is_element/E`(N)(u): This procedure should take a polynomial u and determine if it is an element of the set E(N) describe... | glaive | [
0.03380930796265602,
0.003824974177405238,
-0.027332555502653122,
-0.02577575296163559,
0.038307271897792816,
-0.03685075789690018,
0.006190630607306957,
0.07817496359348297,
0.043331872671842575,
0.006113630253821611,
0.016419462859630585,
0.04948877543210983,
-0.02549717016518116,
-0.018... | 0.813919 | 0.778076 | 0.035843 |
Can you provide a function that can print the nth element of a Fibonacci sequence? | glaive | [
0.02768143266439438,
0.023741427809000015,
-0.020356299355626106,
-0.038231220096349716,
0.03610808402299881,
-0.03293921425938606,
-0.024574540555477142,
0.0659620389342308,
0.0432601161301136,
-0.020347774028778076,
0.034235887229442596,
0.03156763315200806,
-0.04071342200040817,
-0.0301... | 0.795092 | 0.78046 | 0.014632 |
You are tasked with creating a program that processes a series of "Beat" and "Note" data and calculates the total duration of each type of note. The "Beat" data contains a timestamp and a numerical value, while the "Note" data contains a start timestamp, end timestamp, and a numerical value. Your program should output ... | glaive | [
0.029288552701473236,
0.011840062215924263,
-0.07011003792285919,
-0.016800640150904655,
0.03176182880997658,
-0.028429655358195305,
-0.044238634407520294,
0.06857158988714218,
0.041379835456609726,
-0.009372279047966003,
0.04803432524204254,
0.013288627378642559,
-0.04075099527835846,
0.0... | 0.797304 | 0.768548 | 0.028755 |
You are tasked with creating a program that calculates and visualizes the probability of a quantum state for a given set of qubits and states. The program should include the following components:
- Define the number of qubits as a variable 'nqubits' with a value of 13.
- Define the name of the quantum state as a string... | glaive | [
-0.010027148760855198,
0.04299723729491234,
-0.027346480637788773,
-0.01925520971417427,
0.043598998337984085,
-0.02416003867983818,
-0.01669350452721119,
0.07736942917108536,
0.03794281929731369,
0.011320699006319046,
0.03163608908653259,
0.04003867879509926,
-0.012955056503415108,
-0.008... | 0.794776 | 0.766307 | 0.028469 |
You are tasked with implementing a subroutine in Fortran called `move_river_t` that takes several input arrays and outputs a modified version of the `runoff` array. The subroutine is responsible for moving water runoff from one point to another in a river system. The input arrays include:
- `runoff`: a 2D array of real... | glaive | [
0.0122964633628726,
0.037467844784259796,
-0.017098942771553993,
-0.0338614396750927,
0.0340178981423378,
-0.029805252328515053,
-0.030234407633543015,
0.0648004338145256,
0.04546281695365906,
-0.006872650235891342,
0.02312704734504223,
0.04023587331175804,
-0.028723852708935738,
0.0002860... | 0.797883 | 0.777564 | 0.020318 |
How can I remove duplicate rows from a 2 dimensional numpy array? For instance, I have the following numpy array:
```python
data = np.array([[1,8,3,3,4],
[1,8,9,9,4],
[1,8,3,3,4]])
```
I would like to remove one of the duplicate rows, so the resulting array should look like this:
``... | glaive | [
0.010119273327291012,
0.02794654853641987,
-0.03791947662830353,
-0.029606347903609276,
0.024885065853595734,
-0.04223792627453804,
-0.0045130494982004166,
0.06400121748447418,
0.03897547349333763,
0.0009147244272753596,
0.004979358986020088,
-0.010567989200353622,
-0.02153638005256653,
-0... | 0.784565 | 0.766711 | 0.017854 |
You are tasked with implementing a program that simulates a specific set of instructions. The program should start with the value 4 in register 0. It should then add 2 to register 0, move the value from register 2 to register 12, and enter a loop that multiplies the value in register 0 by the value in register 2, adds ... | glaive | [
0.026984848082065582,
0.03536049276590347,
-0.02306246943771839,
-0.03542264923453331,
0.041524238884449005,
-0.03420627862215042,
-0.02594771422445774,
0.07274306565523148,
0.0450139045715332,
-0.015581190586090088,
0.024824276566505432,
0.04435199126601219,
-0.033843010663986206,
-0.0097... | 0.815751 | 0.779159 | 0.036592 |
You are tasked with implementing a function majorityElement that takes in a list of integers and returns the majority element. The majority element is the element that appears more than ⌊n/2⌋ times, where n is the length of the input list.
For example, given the input [3, 2, 3], the majority element is 3.
Given the in... | glaive | [
0.03834852576255798,
0.013112361542880535,
-0.02724408358335495,
-0.05102914944291115,
0.0479307696223259,
-0.03322647511959076,
-0.010943455621600151,
0.0584380142390728,
0.04063070937991142,
0.004657486453652382,
0.0175378005951643,
0.03413597494363785,
-0.01977948285639286,
0.0035070569... | 0.81068 | 0.765228 | 0.045452 |
You are tasked with writing a Fortran program that performs matrix multiplication and outputs the sum of the resulting matrix. The program should include the following components:
- Declare a 3x2 matrix A of real numbers
- Declare a 6-element array B of real numbers
- Declare an allocatable array C of real numbers
- In... | glaive | [
0.030830662697553635,
0.03505402430891991,
-0.02071429044008255,
-0.050458502024412155,
0.05181356891989708,
-0.01897914707660675,
-0.014945514500141144,
0.061033278703689575,
0.0291370190680027,
-0.017534442245960236,
-0.0011902947444468737,
0.03944450989365578,
-0.05634438246488571,
-0.0... | 0.801245 | 0.765668 | 0.035577 |
You are given two arrays:
const le = [_]u8{ 1, 3 };
const et = [_]u8{ 3, 7 };
Problem 1:
Please set the array leet by concatenating the two arrays above. It should result in: 1 3 3 7
Problem 2:
Please set the array bit_pattern using repetition. It should result in: 1 0 0 1 1 0 0 1 1 0 0 1 | glaive | [
0.010797382332384586,
0.037659529596567154,
-0.009945869445800781,
-0.03447195515036583,
0.03314758837223053,
-0.021088995039463043,
-0.019627949222922325,
0.06780298799276352,
0.03138076886534691,
-0.014183965511620045,
0.01800406351685524,
0.02266773022711277,
-0.04317181557416916,
-0.02... | 0.830163 | 0.804786 | 0.025377 |
You are tasked with writing a program that takes an input value, n, and calculates the result of the following mathematical expression: (9*n+4)*(9*n+5).
Write a function or program that takes an integer input, n, and returns the result of the above expression for that input.
For example, if the input is 5, the progra... | glaive | [
0.04234396293759346,
0.02240666188299656,
-0.05073881149291992,
-0.044704899191856384,
0.04565479978919029,
-0.03325032815337181,
-0.032411959022283554,
0.06737813353538513,
0.05778854340314865,
-0.005970012862235308,
0.032069552689790726,
0.04596466198563576,
-0.049395568668842316,
-0.023... | 0.826655 | 0.79079 | 0.035864 |
You are tasked with implementing a function called cpDiv_BNU32. This function is written in Assembly language and takes in several parameters as input. The function performs a complex series of operations involving bitwise manipulation, arithmetic operations, and memory manipulation. Your task is to implement this func... | glaive | [
0.02743532508611679,
0.028472524136304855,
-0.030041001737117767,
-0.014173549599945545,
0.04212398827075958,
-0.036987144500017166,
-0.0019782527815550566,
0.07758574932813644,
0.046688053756952286,
-0.008250531740486622,
0.03041847050189972,
0.036768924444913864,
-0.008741071447730064,
0... | 0.798568 | 0.783346 | 0.015222 |
How can I implement a bubble sort algorithm in Java to sort an array of integers? | glaive | [
0.004436187911778688,
0.019736910238862038,
-0.02319326251745224,
-0.0241228174418211,
0.024142203852534294,
-0.045418597757816315,
-0.026706404983997345,
0.03778081387281418,
0.019357696175575256,
-0.03538695350289345,
0.01993999071419239,
0.02189905382692814,
-0.035437144339084625,
-0.01... | 0.79678 | 0.781218 | 0.015562 |
You are tasked with writing a program that takes a list of floating-point numbers as input and returns the sum of the numbers that are less than 1.0.
Write a function called "sum_of_numbers_less_than_one" that takes a list of floating-point numbers as input and returns the sum of all numbers that are less than 1.0.
F... | glaive | [
-0.014812538400292397,
0.03254183754324913,
-0.012964076362550259,
-0.04814279079437256,
0.05600694939494133,
-0.008544716984033585,
-0.010559252463281155,
0.04704661667346954,
0.022218355908989906,
-0.011388818733394146,
0.019551478326320648,
0.03984551504254341,
-0.029625823721289635,
-0... | 0.808987 | 0.762815 | 0.046172 |
You are tasked with analyzing a dataset containing information about hits, false alarms, dprime, and C values. Your goal is to calculate the mean and standard deviation for each combination of the following variables: isInstructed, isPracticed, isTarget, and isFoil. The dataset is structured in a way that there are sep... | glaive | [
0.004323013126850128,
0.010455640032887459,
-0.05970679968595505,
-0.06908566504716873,
0.057428766041994095,
-0.034539490938186646,
-0.018471872434020042,
0.07000025361776352,
0.04220452532172203,
-0.004022224806249142,
0.010316364467144012,
0.00535932881757617,
-0.030213071033358574,
-0.... | 0.795544 | 0.780389 | 0.015155 |
You are tasked with implementing a graph coloring module for simple graphs in a programming language that utilizes the Lean theorem prover. The module should define colorings of simple graphs (also known as proper colorings in the literature). A graph coloring is the attribution of "colors" to all of its vertices such ... | glaive | [
0.00023049730225466192,
0.02408875897526741,
-0.012310775928199291,
-0.0419638566672802,
0.020684966817498207,
-0.03750590607523918,
-0.025414029136300087,
0.04539583623409271,
0.02571037784218788,
-0.03842942789196968,
0.030050408095121384,
0.02481408230960369,
0.014915352687239647,
0.003... | 0.809003 | 0.792225 | 0.016778 |
You are tasked with implementing a function that performs bit-reversal on unsigned and signed integers. The function should be able to handle different bit widths and both compile-time and runtime integers. The bit-reversal operation should reverse the order of the bits in the input integer. For example, bit-reversing ... | glaive | [
0.023340540006756783,
0.050232719630002975,
-0.02101907692849636,
-0.02406552992761135,
0.036962851881980896,
-0.02644072100520134,
-0.0218499805778265,
0.07048426568508148,
0.04181445762515068,
0.00037391591467894614,
0.03116506151854992,
0.030569950118660927,
-0.028372688218951225,
-0.00... | 0.790165 | 0.75993 | 0.030235 |
You are tasked with creating a C++ program that processes data from a GGeoLib dump and provides the total number of volumes and the number of instanced volumes. The program should iterate through each merged mesh, retrieve the number of volumes and number of instanced transforms for each mesh, and calculate the total n... | glaive | [
0.023641444742679596,
0.017494549974799156,
-0.019219767302274704,
-0.04712069034576416,
0.03555085137486458,
-0.01878359355032444,
-0.047749362885951996,
0.09487507492303848,
0.026212336495518684,
-0.021759167313575745,
0.025275055319070816,
0.03328559175133705,
-0.01132494118064642,
-0.0... | 0.807019 | 0.786279 | 0.02074 |
You are tasked with implementing a program to work with the symmetric square, which is a type of unordered pairs in a given type α. The symmetric square is defined as `α × α` modulo swapping. Your task is to create a function that determines whether a given term is a member of the symmetric square. From this point of v... | glaive | [
0.0317070446908474,
0.03884201496839523,
-0.04488018527626991,
-0.02648291550576687,
0.04268227517604828,
-0.01004711352288723,
-0.006738655734807253,
0.06452231109142303,
0.037906941026449203,
-0.01432752050459385,
0.0067316750064492226,
0.03245624527335167,
-0.03096640668809414,
-0.01875... | 0.825473 | 0.790846 | 0.034627 |
You are tasked with creating a program that counts the occurrences of the word "cat" in a list of text files. The program should utilize a scheduler to distribute the task of counting the occurrences of "cat" in each file to multiple processes. Each process should read a file, count the occurrences of "cat", and then r... | glaive | [
0.002560613676905632,
0.024501442909240723,
-0.03566043823957443,
-0.005913495551794767,
0.028073035180568695,
-0.02259937673807144,
-0.04895314946770668,
0.05458204448223114,
0.031516510993242264,
-0.014481029473245144,
0.013579433783888817,
0.03362886235117912,
-0.038439035415649414,
0.0... | 0.813965 | 0.799487 | 0.014478 |
You are tasked with creating a program that calculates the number of reduced words of a specific length in a Coxeter group on 9 generators. The Coxeter group has relations defined by (S_i)^2 = (S_i S_j)^46 = I, where S_i represents the generators and I is the identity element. Your program should take an input for the ... | glaive | [
0.024921491742134094,
0.02209142968058586,
-0.04252510145306587,
-0.03811686113476753,
0.0327787920832634,
-0.05014719069004059,
-0.02581883780658245,
0.06658374518156052,
0.05198746174573898,
-0.012026023119688034,
0.028681209310889244,
0.025017565116286278,
-0.05214936286211014,
-0.01533... | 0.826653 | 0.782241 | 0.044412 |
You are working on a Clojure project and need to implement a function 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*4*3*2*1 = 120.
Write a Clojure function ... | glaive | [
0.014019452035427094,
0.049379248172044754,
-0.025703907012939453,
-0.037824537605047226,
0.044307298958301544,
-0.03800763189792633,
-0.018658876419067383,
0.0385892391204834,
0.047967635095119476,
-0.012478326447308064,
0.019149204716086388,
0.04128840193152428,
-0.030124418437480927,
-0... | 0.800101 | 0.779521 | 0.020579 |
I need to create a program that can efficiently handle large-scale dynamical systems and perform model reduction for them. The program should be able to handle different types of systems and equations, including algebraic equations, linear and nonlinear matrix equations, partial differential equations, and parametrized... | glaive | [
0.00884873978793621,
0.033449795097112656,
-0.028975388035178185,
-0.039592426270246506,
0.03320286422967911,
-0.024267110973596573,
-0.02306365966796875,
0.05726628750562668,
0.0422697551548481,
-0.023631518706679344,
0.0028479243628680706,
0.042019322514534,
-0.021623753011226654,
-0.004... | 0.792963 | 0.775409 | 0.017554 |
You are tasked with creating a program that processes a series of musical beats and notes, and calculates the total duration of each note. The input is a set of beats and notes, where each line represents a beat or note, along with its start and end time and a corresponding value. Your task is to write a program that t... | glaive | [
0.03017679788172245,
0.021771419793367386,
-0.06461936235427856,
-0.007878519594669342,
0.03666297718882561,
-0.03519890084862709,
-0.03217475488781929,
0.05673913657665253,
0.038273219019174576,
-0.01624552346765995,
0.04278627038002014,
0.014170200563967228,
-0.04407498240470886,
-0.0020... | 0.808976 | 0.773042 | 0.035934 |
You are tasked with analyzing a dataset containing 12 variables (x1 to x12) stored in a file named "day3.txt". Your goal is to find the mode for each variable, but in a rather convoluted way. You are required to perform the following steps for each variable:
1. Calculate the mode for the variable.
2. Create a new datas... | glaive | [
0.008358299732208252,
0.017206424847245216,
-0.05353020504117012,
-0.0169067345559597,
0.02526158280670643,
-0.03427751362323761,
-0.013700997456908226,
0.08062667399644852,
0.0329468697309494,
-0.004587299656122923,
0.013914418406784534,
0.02101125195622444,
-0.020228251814842224,
-0.0177... | 0.813246 | 0.798077 | 0.015169 |
You are given a list of exercises to complete in R. Each exercise is documented with a description and specific tasks to be completed. Your task is to implement the code for each exercise as described.
## Exercise 1: R Basics
### a. Arithmetic operations
Compute various arithmetic operations using R.
### b. Matrix o... | glaive | [
0.031167279928922653,
0.03519304841756821,
-0.022603604942560196,
-0.04729466512799263,
0.04096512869000435,
-0.014653276652097702,
-0.003325904719531536,
0.05016208067536354,
0.05879644677042961,
0.0018902471056208014,
0.016503117978572845,
0.036320608109235764,
-0.02715141884982586,
-0.0... | 0.797156 | 0.780493 | 0.016663 |
You are tasked with creating a Haskell program that calculates the factorial of a given number using a recursive function. Your program should take an input from the user and then output the factorial of that number. | glaive | [
0.019460201263427734,
0.0345882773399353,
-0.00731445150449872,
-0.04059036821126938,
0.032293207943439484,
-0.023097863420844078,
-0.008790971711277962,
0.03570929914712906,
0.04519173502922058,
-0.03153330832719803,
0.012148036621510983,
0.04566827416419983,
-0.03900176286697388,
-0.0245... | 0.809486 | 0.780755 | 0.028731 |
You are required to implement the aggregation block on a GPU using CUDA. The goal is to compute the maximum, average, and log-sum-exp (LSE) of the input data. The aggregation functions are implemented as separate kernel functions in the code snippet. You need to write the kernel functions for the backward pass of the a... | glaive | [
0.007892169989645481,
0.04023977369070053,
-0.02938385121524334,
-0.02727256715297699,
0.040793124586343765,
-0.006281245034188032,
-0.03893662616610527,
0.09004294872283936,
0.0352180115878582,
0.0022478392347693443,
0.023322315886616707,
0.02404685877263546,
-0.0055202338844537735,
0.011... | 0.803983 | 0.787497 | 0.016486 |
Can you provide Java code to sort an array of integers using bubble sort? | glaive | [
0.0038920841179788113,
0.021897422149777412,
-0.024079391732811928,
-0.020350076258182526,
0.017435317859053612,
-0.05247920751571655,
-0.023233985528349876,
0.031770627945661545,
0.02512228488922119,
-0.04429809749126434,
0.02188212051987648,
0.023084841668605804,
-0.04794949293136597,
-0... | 0.797385 | 0.783044 | 0.014341 |
You are tasked with creating a C# console application that calculates the area of a circle. You need to prompt the user to input the radius of the circle, and then calculate and display the area. The formula to calculate the area of a circle is A = πr^2, where A is the area and r is the radius. You should use the value... | glaive | [
0.004171798471361399,
0.04444003850221634,
-0.025729887187480927,
-0.02990693412721157,
0.030966153368353844,
-0.03687918931245804,
-0.021439941599965096,
0.06461628526449203,
0.05200717970728874,
-0.005072771105915308,
0.025513039901852608,
0.027635231614112854,
-0.023065801709890366,
-0.... | 0.769806 | 0.747944 | 0.021862 |
You are tasked with creating a function that calculates the sum of pairs of numbers in a given string based on specific rules. The input string will represent a sequence of digits, and the function should sum the pairs of numbers according to the given rule.
The function should take two parameters: the input string an... | glaive | [
0.002491199178621173,
0.01888292469084263,
-0.02684592455625534,
-0.041674621403217316,
0.051304493099451065,
0.0030122329480946064,
-0.017978543415665627,
0.04167737066745758,
0.012375193648040295,
-0.0028234743513166904,
0.014425565488636494,
0.041472770273685455,
-0.03993688523769379,
-... | 0.825911 | 0.767937 | 0.057974 |
You are tasked with writing a program that processes a series of musical beats and notes. The input will consist of multiple lines, each containing the word "Beat" or "Note" followed by start time, end time, and a numerical value.
For each "Beat" line, you need to keep track of the cumulative sum of the numerical val... | glaive | [
0.02184266969561577,
0.03644317761063576,
-0.0533028319478035,
-0.008210514672100544,
0.03838673606514931,
-0.024457156658172607,
-0.03128959238529205,
0.06837283074855804,
0.03883976861834526,
-0.01542715448886156,
0.04208933934569359,
0.01574994996190071,
-0.046834561973810196,
-0.005970... | 0.809261 | 0.777374 | 0.031887 |
You are tasked with writing a program that takes in a series of numbers and sorts them in ascending order. The program should then output the sorted numbers. Your program should be able to handle a large set of numbers and efficiently sort them. | glaive | [
0.03614650294184685,
0.01575656421482563,
-0.03834453970193863,
-0.026541797444224358,
0.02827434428036213,
-0.02240530401468277,
-0.02499357983469963,
0.05691783130168915,
0.027278056368231773,
-0.02626156620681286,
0.02328760176897049,
0.03057669848203659,
-0.055252958089113235,
0.003013... | 0.811784 | 0.781335 | 0.030449 |
How can I use an AI to perform a linear search on an array of integers? | glaive | [
0.01207709964364767,
0.0309621412307024,
-0.026747124269604683,
-0.033883120864629745,
0.025793129578232765,
-0.029714660719037056,
-0.025727730244398117,
0.0455995611846447,
0.032885484397411346,
-0.03840486705303192,
0.016655907034873962,
0.01731165312230587,
-0.01816653460264206,
-0.017... | 0.80001 | 0.784378 | 0.015633 |
You are tasked with implementing a CUDA kernel to sort the kth value along a specified axis in a given input tensor. The input tensor is a 2D tensor with dimensions (num_rows, num_cols). Your task is to sort the kth value along the specified axis and return the sorted output tensor and the corresponding indices tensor.... | glaive | [
0.026794573292136192,
0.0436520054936409,
-0.026554904878139496,
-0.011193806305527687,
0.02987358346581459,
-0.016507048159837723,
-0.024363573640584946,
0.08505407720804214,
0.04737814888358116,
-0.010993058793246746,
0.029357921332120895,
0.030092347413301468,
-0.02052723616361618,
0.00... | 0.809396 | 0.785119 | 0.024277 |
You are tasked with implementing two CUDA kernels for performing forward and inverse Number Theoretic Transforms (NTT) on a set of polynomials. The forward NTT is responsible for transforming a set of polynomials into a different domain, while the inverse NTT converts the transformed polynomials back to their original ... | glaive | [
0.015425325371325016,
0.04558490961790085,
-0.02989291027188301,
-0.022521264851093292,
0.023745235055685043,
-0.0006224471144378185,
-0.01977137103676796,
0.08442682027816772,
0.04437298700213432,
-0.006088509224355221,
0.015208551660180092,
0.02817092090845108,
-0.028420904651284218,
0.0... | 0.806688 | 0.783447 | 0.023241 |
You are tasked with creating a program that will process a series of sprite frames and generate a sequence for a game. The sequence will involve displaying different frames of the sprite in a specific order and at a specific speed. The sprite frames are defined by their unique IDs and paths, and each frame has a specif... | glaive | [
0.011651763692498207,
0.013287762179970741,
-0.022313402965664864,
-0.024961186572909355,
0.03221943601965904,
-0.008117148652672768,
-0.042957767844200134,
0.08457154035568237,
0.043500758707523346,
-0.03586171567440033,
0.029727667570114136,
0.025194866582751274,
-0.023596448823809624,
0... | 0.791208 | 0.772727 | 0.018481 |
You are tasked with creating a C# program that manipulates a list of names. The program should perform the following tasks:
- Create a list of names with the following names: "Hoover", "Roosevelt", "Truman", "Eisenhower", "Kennedy"
- Print the entire list of names
- Print the name at index 1 in the list
- Create a list... | glaive | [
0.022382566705346107,
0.030173493549227715,
-0.01755204051733017,
-0.03189346194267273,
0.02699369378387928,
-0.05562548711895943,
0.004997714888304472,
0.0783831849694252,
0.04532865434885025,
-0.004395127762109041,
0.033625487238168716,
0.04141431301832199,
-0.04119221121072769,
-0.02279... | 0.789473 | 0.772334 | 0.017139 |
You are tasked with creating a Python program that takes in a list of numbers and returns the sum of all the even numbers in the list. You should write a function called "sum_even_numbers" that takes a list of integers as input and returns the sum of all the even numbers in the list.
For example, if the input list is ... | glaive | [
0.013770409859716892,
0.013382959179580212,
-0.03969810530543327,
-0.052915845066308975,
0.04832163453102112,
-0.019423725083470345,
-0.009971393272280693,
0.03875517472624779,
0.03163519874215126,
-0.01694651134312153,
0.005006203427910805,
0.054414570331573486,
-0.03882836550474167,
-0.0... | 0.801362 | 0.769492 | 0.03187 |
You are tasked with writing a program to compute the value of the bond angle between four given points in 3D space. The coordinates of the four points are represented by the variables pos1, pos2, pos3, and pos4. The bond angle is computed using the positions of these points and various mathematical operations involving... | glaive | [
0.020626289770007133,
0.028988629579544067,
-0.03828006610274315,
-0.03457072749733925,
0.031293392181396484,
-0.016839204356074333,
-0.006579622160643339,
0.029768474400043488,
0.044921327382326126,
0.010753781534731388,
0.020463230088353157,
0.03907197713851929,
-0.03897787258028984,
-0.... | 0.800142 | 0.769304 | 0.030838 |
I encountered this programming problem while trying to solve the Advent of Code 2018 Day 2 Part 1 in Rust. The problem requires me to calculate the count of strings that have exactly two of the same letter, multiplied by the count of strings that have exactly three of the same letter. Can someone explain how to solve t... | glaive | [
0.012901930138468742,
0.01801629737019539,
-0.023913171142339706,
-0.03721601516008377,
0.026232311502099037,
-0.016629721969366074,
-0.009427808225154877,
0.08225906640291214,
0.017649570479989052,
-0.00974385067820549,
-0.008997115306556225,
0.01999608799815178,
-0.012404247187077999,
-0... | 0.820505 | 0.791834 | 0.02867 |
You are tasked with creating a Haskell program to calculate the maximum of two numbers, as well as a recursive function to compute the least common divisor of two integers. Additionally, you need to implement a function to determine whether a given triangle is equilateral, isosceles, or scalene.
Your program should in... | glaive | [
0.02576468512415886,
0.018966807052493095,
-0.01617378555238247,
-0.02919679321348667,
0.0425395704805851,
-0.012795188464224339,
-0.011543592438101768,
0.04240337386727333,
0.02668195776641369,
-0.029966630041599274,
0.034793201833963394,
0.046245086938142776,
-0.00872632022947073,
-0.028... | 0.817149 | 0.789401 | 0.027748 |
You are tasked with implementing a CUDA kernel function for image processing. The function, named "pyrUp", is responsible for performing the pyrUp operation on an input image and storing the result in an output image. The pyrUp operation involves upsampling the input image and applying a specific filter to generate the... | glaive | [
-0.025742897763848305,
0.044818151742219925,
-0.006442971061915159,
-0.01652267575263977,
0.025956088677048683,
0.0038867173716425896,
-0.03026433475315571,
0.09597241133451462,
0.04499868303537369,
-0.014900457113981247,
0.03316125646233559,
0.032520752400159836,
-0.00016977809718810022,
... | 0.791769 | 0.776812 | 0.014957 |
You have been tasked with implementing a GPU kernel to calculate the LZ-complexity of a single member in a given array. The LZ-complexity is a measure of the complexity of a string, which is calculated based on the compression ratio of the string. The kernel should be able to handle multiple threads, with each block wo... | glaive | [
-0.011471080593764782,
0.06159387156367302,
-0.014009152539074421,
-0.037107113748788834,
0.03807605057954788,
-0.017681531608104706,
-0.030751146376132965,
0.07626312226057053,
0.017276424914598465,
-0.01858360692858696,
0.021455107256770134,
0.02138531766831875,
-0.0036887195892632008,
0... | 0.813597 | 0.790385 | 0.023212 |
You are required to create an XSLT stylesheet that generates numbering maps for tables, figures, and footnotes in a given XML document. The numbering map should provide the count of each element and the starting count for each element. The stylesheet should also be able to output the generated numbering maps to separat... | glaive | [
0.025713445618748665,
0.0034473882988095284,
-0.04190780222415924,
-0.03340353071689606,
0.021614791825413704,
-0.013274283148348331,
0.003970700316131115,
0.06824298948049545,
0.03455544635653496,
-0.01500382274389267,
0.01025298796594143,
0.03414633870124817,
-0.036547306925058365,
0.000... | 0.789712 | 0.773954 | 0.015758 |
You are tasked with implementing a k-Nearest Neighbors (KNN) algorithm in Dart. The KNN algorithm is a simple, easy-to-implement supervised machine learning algorithm that can be used for both classification and regression tasks.
Your task is to implement the KNN algorithm, which involves the following steps:
1. Calc... | glaive | [
-0.007272627204656601,
0.03593750670552254,
-0.008317113853991032,
-0.045345112681388855,
0.04479478672146797,
-0.015484846197068691,
-0.020660830661654472,
0.048870302736759186,
0.03440763056278229,
0.0035681105218827724,
0.025811588391661644,
0.026190608739852905,
-0.019575566053390503,
... | 0.807661 | 0.783298 | 0.024363 |
You are tasked with creating a program to calculate the probability of a quantum state using a given code snippet. The program should use the provided amplitude and probability functions to calculate the probability of a given quantum state and then find the maximum probability using simulated annealing method. Additio... | glaive | [
0.00015588912356179208,
0.03614174574613571,
-0.022180067375302315,
-0.02308565564453602,
0.041857216507196426,
-0.023829080164432526,
-0.017156586050987244,
0.07686617225408554,
0.02921806462109089,
-0.004141415003687143,
0.025012128055095673,
0.03547068312764168,
-0.012847390957176685,
-... | 0.789772 | 0.763821 | 0.025952 |
You are tasked with implementing a subroutine in Fortran that calculates a stencil operation on complex numbers. The subroutine, named hpsi1_RT_stencil_LBLK, takes in multiple arrays as input, including A, B, C, D, and E, and computes the values of the output array F based on a series of mathematical operations. The su... | glaive | [
0.002276364015415311,
0.045252956449985504,
-0.0006705387495458126,
-0.039808813482522964,
0.03747191280126572,
-0.02641228586435318,
-0.021378127858042717,
0.06926983594894409,
0.038818273693323135,
-0.005164198577404022,
0.027581773698329926,
0.04685907065868378,
-0.008048580028116703,
0... | 0.81253 | 0.787845 | 0.024685 |
You are required to create a program that calculates the probability of a given quantum state and then visualizes the results using a 3D plot and a contour plot. The program should use the provided amplitude and probability functions to calculate the probability of a quantum state for different values of x and y. The N... | glaive | [
0.0027453002985566854,
0.028145790100097656,
-0.04077599197626114,
-0.023146022111177444,
0.041376225650310516,
-0.01861729472875595,
-0.02271118201315403,
0.07893884927034378,
0.03788148984313011,
0.008096810430288315,
0.030285855755209923,
0.049075499176979065,
-0.021342327818274498,
-0.... | 0.802344 | 0.782274 | 0.02007 |
You are tasked with implementing a thread-local aggregate counter functionality for partitioning upsweep reduction kernels. Each warp must periodically expand and aggregate its shared-memory composite-counter lanes into registers before they overflow. The task involves iterating through the composite counters, extracti... | glaive | [
0.012971366755664349,
0.03319036215543747,
-0.015003129839897156,
-0.0318591445684433,
0.02848009392619133,
-0.013396380469202995,
-0.034137651324272156,
0.08552984893321991,
0.031176259741187096,
0.0007175061036832631,
0.02626040391623974,
0.03656405955553055,
-0.010549226775765419,
0.005... | 0.82206 | 0.80363 | 0.01843 |
You are tasked with implementing a CUDA kernel to calculate the Discrete Fourier Transform (DFT) of a given input array using complex numbers. The DFT is a fundamental operation in signal processing and is used to analyze the frequency content of a signal. The input array is represented as an array of complex numbers, ... | glaive | [
0.0022897517774254084,
0.059834521263837814,
-0.0373384915292263,
-0.026701422408223152,
0.02333306148648262,
-0.014940540306270123,
-0.008129681460559368,
0.07015812397003174,
0.051801275461912155,
-0.009831550531089306,
0.035989534109830856,
0.028001753613352776,
-0.012940720655024052,
0... | 0.807268 | 0.782806 | 0.024462 |
Can you provide a C++ function that calculates the factorial of a given number? | glaive | [
0.01095749344676733,
0.033732280135154724,
-0.023786794394254684,
-0.02260449528694153,
0.037681132555007935,
-0.031093580648303032,
-0.018528606742620468,
0.07058219611644745,
0.04855816438794136,
-0.027315137907862663,
0.016839616000652313,
0.04847590625286102,
-0.04180475324392319,
-0.0... | 0.791202 | 0.776603 | 0.0146 |
How can I solve a cubic equation of the form ax^3 + bx^2 + cx + d, where a, b, c, d are real numbers and a is not equal to zero? | glaive | [
0.018393242731690407,
0.02206110581755638,
-0.06612498313188553,
-0.041309699416160583,
0.023286279290914536,
-0.025003420189023018,
0.007264094427227974,
0.06306905299425125,
0.04870930686593056,
-0.02979399263858795,
0.01809229701757431,
0.020942820236086845,
-0.031565677374601364,
-0.04... | 0.778859 | 0.763966 | 0.014893 |
You are tasked with implementing a function that takes a list of elements and an element 'a', and filters out all occurrences of 'a' from the list. The function should return a new list with all instances of 'a' removed.
Write a function called 'filter' that takes in a list 'l' and an element 'a', and returns a new li... | glaive | [
0.030792424455285072,
0.035230882465839386,
-0.027082037180662155,
-0.03882491961121559,
0.04250512272119522,
-0.043460920453071594,
-0.025412453338503838,
0.05414699763059616,
0.0339328907430172,
-0.016005275771021843,
0.006325629539787769,
0.01724942959845066,
-0.012994776479899883,
-0.0... | 0.792587 | 0.763234 | 0.029353 |
You are tasked with creating a program to handle a variety of data structures in a specific programming language. The program needs to define and implement the following data structures:
1. Struct1: A struct with one optional field of type string.
2. Struct2: A struct with one optional field that is a list of Struct1 ... | glaive | [
-0.003723993431776762,
0.008366000838577747,
-0.0315733328461647,
-0.031864047050476074,
0.04956209659576416,
-0.045224159955978394,
-0.0025677771773189306,
0.07439800351858139,
0.04489589110016823,
-0.023872507736086845,
0.029748085886240005,
0.03324419632554054,
-0.03584370017051697,
-0.... | 0.805977 | 0.787449 | 0.018528 |
You are required to write a program that calculates the probability of a quantum state using a given formula. The program should then find the maximum probability for a specific range of input values and plot a 3D graph and contour plot of the probability distribution. | glaive | [
0.0008628114592283964,
0.021440433338284492,
-0.0419030636548996,
-0.028870925307273865,
0.03988678380846977,
-0.02012750506401062,
-0.02870992198586464,
0.06777166575193405,
0.04214344173669815,
-0.01235757302492857,
0.030757231637835503,
0.04011144861578941,
-0.013054346665740013,
-0.010... | 0.808696 | 0.787299 | 0.021397 |
I need to create a Sudoku solver using Haskell. The solver should be able to take in a 9x9 grid of digits, with blank spaces denoted as '0', and return a valid solution to the Sudoku puzzle. The solution should adhere to the rules of Sudoku, where each row, column, and 3x3 subgrid must contain all the digits from 1 to ... | glaive | [
-0.006156314630061388,
0.0013739241985604167,
-0.030123788863420486,
-0.05356699228286743,
0.03654498979449272,
-0.02502833679318428,
-0.003574828850105405,
0.03576856106519699,
0.04813086614012718,
-0.026711177080869675,
0.01581745594739914,
0.02956409566104412,
-0.014588791877031326,
-0.... | 0.806851 | 0.784497 | 0.022354 |
You are tasked with creating a module in YAP Prolog that includes term manipulation operations. Specifically, you need to implement the following predicates:
- euclidean_distance/3: This predicate should calculate the Euclidean distance between two points in a 2D space.
- in_range/4: This predicate should determine if ... | glaive | [
0.012098992243409157,
0.028839601203799248,
-0.015811817720532417,
-0.040615830570459366,
0.04633394628763199,
-0.04459592327475548,
-0.0248909592628479,
0.05200016126036644,
0.03519362583756447,
-0.012164954096078873,
0.010886356234550476,
0.05271891877055168,
-0.016246847808361053,
0.007... | 0.806712 | 0.792226 | 0.014486 |
You are tasked with implementing a function in a programming language that calculates the convergents of a continued fraction. A continued fraction is a way of representing a number as an infinite sequence of integers. The convergents of a continued fraction are the rational numbers formed by truncating the sequence at... | glaive | [
0.015769222751259804,
0.05036306008696556,
-0.019528362900018692,
-0.020268073305487633,
0.051957111805677414,
-0.017571499571204185,
0.00847063772380352,
0.06416001915931702,
0.045951806008815765,
-0.004716066177934408,
0.020686866715550423,
0.025795388966798782,
-0.027294892817735672,
0.... | 0.802864 | 0.77788 | 0.024984 |
You are tasked with creating a data structure to represent a graph in C++. The graph will consist of vertices and edges, and each vertex will have associated metadata. Your task is to create a class that represents the graph, with methods to access the number of vertices and edges, retrieve a specific vertex, and get t... | glaive | [
0.012618830427527428,
0.00077551428694278,
-0.027466516941785812,
-0.019348332658410072,
0.03680156543850899,
-0.030442479997873306,
-0.032955996692180634,
0.0973133072257042,
0.03870139643549919,
-0.03638872876763344,
0.02860076166689396,
0.03818172961473465,
-0.008334239944815636,
0.0071... | 0.787336 | 0.772078 | 0.015258 |
You are tasked with implementing a code transformation function in a specific programming language. The function should take a tree structure as input and perform the following tasks:
- Add implicit "Labelled"-nodes for Loops, Funs, and Case
- Replace For with While
- Add implicit "Fall-through"-node
- Add implicit "re... | glaive | [
0.001534516690298915,
0.041061632335186005,
-0.01189150009304285,
-0.02929842658340931,
0.03780696168541908,
-0.03669324144721031,
-0.004907615017145872,
0.08875790983438492,
0.029948726296424866,
-0.014360498636960983,
0.02930978685617447,
0.01583767496049404,
-0.044015683233737946,
-0.01... | 0.815082 | 0.800492 | 0.01459 |
You are tasked with implementing a method that takes in a list of integers and returns the sum of all the even numbers in the list. If the list is empty, the method should return 0.
Implement the following method:
```java
public class SumOfEvenNumbers {
public static int sumOfEven(List<Integer> numbers) {
// You... | glaive | [
0.023730291053652763,
0.015767211094498634,
-0.03492746502161026,
-0.04609876126050949,
0.04153546690940857,
-0.02544032409787178,
0.00651372317224741,
0.03383571654558182,
0.028379639610648155,
-0.030540604144334793,
0.011610123328864574,
0.04887250065803528,
-0.028847873210906982,
-0.015... | 0.803916 | 0.769046 | 0.03487 |
You are tasked with implementing the K-means algorithm in R for clustering a given set of data points. The K-means algorithm is an unsupervised learning algorithm that aims to partition a set of data points into k clusters, based on the distance between the data points. The goal is to minimize the sum of squared distan... | glaive | [
0.003142280038446188,
0.047365788370370865,
-0.02927335910499096,
-0.05424797534942627,
0.03522111102938652,
-0.010010837577283382,
-0.02241532877087593,
0.05522948503494263,
0.04046592861413956,
-0.0007069308776408434,
0.0006324990536086261,
0.026002420112490654,
-0.015362845733761787,
0.... | 0.781925 | 0.754006 | 0.027919 |
You are working on a data analysis project and need to calculate the cumulative sum of a specific column in a dataset. The dataset is in the form of a list of tuples, where each tuple contains three elements: a float value, an integer value, and another float value. You need to write a function that takes this list of ... | glaive | [
-0.015266524627804756,
0.04260115325450897,
-0.05209769681096077,
-0.048539482057094574,
0.05382736027240753,
-0.020529020577669144,
-0.016118524596095085,
0.06452570110559464,
0.023897608742117882,
-0.01586957648396492,
0.023647049441933632,
0.03769689425826073,
-0.040199264883995056,
0.0... | 0.787789 | 0.758116 | 0.029673 |
How can I write a function that returns the indices of the two largest values in an array? | glaive | [
0.025612445548176765,
0.046105287969112396,
-0.039288170635700226,
-0.025098416954278946,
0.0293577928096056,
-0.02136891335248947,
-0.03290684521198273,
0.05510636791586876,
0.030407795682549477,
-0.026595767587423325,
0.0338837094604969,
0.032302726060152054,
-0.034826118499040604,
-0.01... | 0.809557 | 0.791455 | 0.018102 |
What is an implementation of a function that takes two integers and returns their greatest common divisor? | glaive | [
0.03311006352305412,
0.032420024275779724,
-0.044205326586961746,
-0.04168517142534256,
0.030527522787451744,
-0.006162292789667845,
-0.030179645866155624,
0.06157533451914787,
0.01966785453259945,
-0.030536286532878876,
0.03026602230966091,
0.030275261029601097,
-0.010519348084926605,
-0.... | 0.800088 | 0.779332 | 0.020756 |
Can you provide an algorithm to sort an array of integers using insertion sort? | glaive | [
0.02972131222486496,
0.010203462094068527,
-0.013177947141230106,
-0.021443724632263184,
0.022806914523243904,
-0.03210119158029556,
-0.027768800035119057,
0.03681974485516548,
0.03795021399855614,
-0.033971045166254044,
0.02489272877573967,
0.013796799816191196,
-0.04548322781920433,
-0.0... | 0.802591 | 0.779864 | 0.022726 |
You are tasked with implementing a function that modifies and accesses elements of a fixed-size unsigned 16-bit integer vector (u16vector) in a specific manner. The function should take in the vector, an index, and a value, and then perform the following steps:
1. Set the element at the given index in the vector to 0.
... | glaive | [
0.020405756309628487,
0.03294770419597626,
-0.002132534282281995,
-0.02093333564698696,
0.05031809210777283,
-0.0344746969640255,
-0.01907024346292019,
0.09050159901380539,
0.03378930687904358,
-0.008412996307015419,
0.03648239001631737,
0.03351256623864174,
-0.004984177649021149,
-0.01528... | 0.813244 | 0.79394 | 0.019304 |
You are tasked with implementing a function called desenha-fill-a-pix that takes a two-dimensional array as input. The array represents a solution to a fill-a-pix problem, where each cell contains a 0 if it should not be drawn, or a 1 if it should be drawn. Your function should draw the image on the screen, with each 0... | glaive | [
0.007788217626512051,
0.047048550099134445,
-0.007623936980962753,
-0.05288432165980339,
0.03184355050325394,
-0.028933940455317497,
-0.006794216576963663,
0.09540711343288422,
0.03545999526977539,
-0.01082816906273365,
0.019178561866283417,
0.03498174250125885,
-0.016153939068317413,
-0.0... | 0.803524 | 0.779208 | 0.024317 |
You are tasked with implementing a function that subtracts a series of numbers from a given initial value. The function should be able to handle various scenarios, such as subtracting a single number, subtracting multiple numbers in succession, and handling special cases like subtracting from positive and negative infi... | glaive | [
0.026452060788869858,
0.025417564436793327,
-0.025853639468550682,
-0.03351648524403572,
0.05764101445674896,
-0.021629828959703445,
-0.02975604683160782,
0.06518197059631348,
0.07639627158641815,
-0.007859180681407452,
0.01716478355228901,
0.028551796451210976,
-0.042043305933475494,
0.00... | 0.804124 | 0.77932 | 0.024804 |
:
You are tasked with writing a program in assembly language that calculates the sum of four numbers and stores the result in a register. You need to use the provided template and define four variables (A, B, C, D) with the value 1 each, then add them together and store the result in another register.
Write the compl... | glaive | [
0.03365619108080864,
0.015884654596447945,
-0.02528809756040573,
-0.025084737688302994,
0.05383815988898277,
-0.0424187146127224,
-0.015442227013409138,
0.057819001376628876,
0.054752130061388016,
-0.008777834475040436,
0.021839268505573273,
0.03798630088567734,
-0.02814829722046852,
-0.02... | 0.805841 | 0.788543 | 0.017297 |
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 calculated as 5 * 4 * 3 * 2 * 1, which equals 120. Write a function that t... | glaive | [
0.030872009694576263,
0.026450179517269135,
-0.03121119923889637,
-0.0364476703107357,
0.056621018797159195,
-0.03514261543750763,
-0.023069553077220917,
0.0553559735417366,
0.046559661626815796,
-0.009971901774406433,
0.010745689272880554,
0.05321025103330612,
-0.05419222265481949,
-0.019... | 0.804719 | 0.764571 | 0.040148 |
You are tasked with creating a C++ program that calculates the factorial of a given number using a recursive function.
Create a C++ program that defines a recursive function to calculate the factorial of a given number. The program should prompt the user to enter a number and then call the recursive function to calcul... | glaive | [
0.022266250103712082,
0.036395732313394547,
-0.02361893467605114,
-0.0300432238727808,
0.04916609823703766,
-0.023828981444239616,
-0.017087755724787712,
0.08486249297857285,
0.04418647661805153,
-0.01078871637582779,
0.014691095799207687,
0.045479755848646164,
-0.04173668101429939,
-0.000... | 0.802855 | 0.77489 | 0.027965 |
You are tasked with implementing a class in a programming language that supports object-oriented programming, such as Python or Java. The class should represent a scheme in algebraic geometry and have the following properties:
1. `is_integral`: A scheme is integral if its carrier is nonempty, and `𝒪ₓ(U)` is an integra... | glaive | [
0.03139980882406235,
0.027374835684895515,
-0.041388288140296936,
-0.033771295100450516,
0.03186221420764923,
-0.03494330495595932,
-0.01987820491194725,
0.05874169245362282,
0.04002831503748894,
-0.016657648608088493,
0.011614560149610043,
0.0422782376408577,
-0.01976211741566658,
0.01485... | 0.81197 | 0.788634 | 0.023337 |
You are tasked with implementing a function that performs the "currying" operation on a given function. Currying a function means transforming a function that takes multiple arguments into a sequence of functions, each taking a single argument.
Write a function called `curry` that takes a function `f : α × β → φ` and ... | glaive | [
0.026079494506120682,
0.047690313309431076,
-0.004692699760198593,
-0.026594650000333786,
0.01847027614712715,
-0.0009839708218351007,
-0.016106650233268738,
0.06905240565538406,
0.028451645746827126,
-0.01888156309723854,
-0.0010859626345336437,
0.026726271957159042,
-0.022358538582921028,
... | 0.808254 | 0.789124 | 0.01913 |
You are tasked with creating a function that takes in an array of numbers and returns the sum of all the positive numbers in the array. You need to handle the case where the input array is empty or does not contain any positive numbers.
Write a function called "sumOfPositiveNumbers" that takes an array of numbers as i... | glaive | [
0.016222678124904633,
0.009394549764692783,
-0.033208221197128296,
-0.03534366562962532,
0.04881785809993744,
-0.026254616677761078,
-0.014322315342724323,
0.025479789823293686,
0.03064224123954773,
-0.01855689473450184,
0.005169606301933527,
0.02449989505112171,
-0.05187852680683136,
-0.0... | 0.81041 | 0.756735 | 0.053675 |
Can you analyze and determine the output of the following Python program? The program uses a condition-checking paradigm and involves two variables, 'a' and 'b', which are initially assigned the values 5 and 10, respectively.
```python
a = 5
b = 10
if a > b:
print("a is greater than b")
elif a == b:
print("a ... | glaive | [
0.008126582950353622,
0.021208690479397774,
-0.04122930020093918,
-0.01892131194472313,
0.033431123942136765,
-0.03247164562344551,
0.0029880227521061897,
0.07369285076856613,
0.028866920620203018,
-0.018855132162570953,
0.021736163645982742,
0.029197953641414642,
-0.03887674957513809,
-0.... | 0.81198 | 0.793423 | 0.018557 |
You are tasked with creating a program that calculates the height difference between the tallest student and you. You will be given a dataset of students' names and heights. Using SAS programming, your program should calculate the difference in height between the tallest student and you. | glaive | [
0.021637754514813423,
0.02147100307047367,
-0.050989504903554916,
-0.05488252267241478,
0.031230751425027847,
-0.033709507435560226,
-0.027626458555459976,
0.04713130369782448,
0.06042887642979622,
-0.01846444234251976,
0.043242692947387695,
0.04246094077825546,
-0.04982040077447891,
0.003... | 0.805094 | 0.788721 | 0.016374 |
You are tasked with implementing a function to perform sparse-matrix * dense-vector multiplication (SpMV) on a CUDA device. The SpMV computation involves the matrix-vector operation y = alpha*A*x + beta*y, where:
- A is an m x n sparse matrix in compressed-storage-row (CSR) format, represented by three arrays: values, ... | glaive | [
0.02328350953757763,
0.0376032330095768,
-0.024244800209999084,
-0.03050977922976017,
0.04729176685214043,
-0.011110881343483925,
-0.03820798173546791,
0.10171174257993698,
0.040346380323171616,
-0.016917232424020767,
0.017087411135435104,
0.02790416032075882,
0.0037137065082788467,
-0.010... | 0.801523 | 0.780091 | 0.021432 |
You are tasked with implementing a CUDA C++ program that includes classes for performing reduction operations, specifically finding the maximum value and its index in an array. The program should utilize the provided template classes and methods to achieve this.
Your task is to create the following classes:
1. BaseMax... | glaive | [
0.015284847468137741,
0.03396788612008095,
-0.02076280675828457,
-0.005391695071011782,
0.04177829623222351,
-0.01879807561635971,
-0.02075090818107128,
0.10518898814916611,
0.05412633717060089,
-0.01863122545182705,
0.023702524602413177,
0.03650577738881111,
-0.009333462454378605,
0.00392... | 0.818004 | 0.796444 | 0.02156 |
You are tasked with creating a program that performs various mathematical operations on integer and real numbers. Your program should be able to handle addition, subtraction, multiplication, and division operations between two numerical values. Additionally, the program should be able to handle unary operations such as... | glaive | [
0.05005554482340813,
0.01955832727253437,
-0.03514356166124344,
-0.02677576243877411,
0.04169329255819321,
-0.012628494761884212,
-0.019397692754864693,
0.059966687113046646,
0.043044425547122955,
-0.02322431467473507,
0.011254619807004929,
0.03805522620677948,
-0.019257251173257828,
-0.02... | 0.789833 | 0.76163 | 0.028203 |
You are tasked with creating a program to calculate the Tribonacci sequence using a positive real Pisot root of x^3 - x^2 - x - 1. The program should take an input n and output the nth number in the sequence. The Tribonacci sequence is similar to the Fibonacci sequence, but each term is the sum of the three preceding t... | glaive | [
0.04089035093784332,
0.030242564156651497,
-0.03782108053565025,
-0.02302204631268978,
0.03451668471097946,
-0.03791528940200806,
-0.02601885050535202,
0.06284043937921524,
0.025326676666736603,
-0.009630140848457813,
0.027859553694725037,
0.02703268639743328,
-0.05717771127820015,
-0.0268... | 0.813318 | 0.772565 | 0.040753 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.