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 implementing a function that trims a string and then splits it using a specified delimiter. The function should remove any white spaces in the string before splitting it.
Write a function named `trim_and_split` that takes two parameters:
- `str` (string): The input string to be trimmed and split
- ... | glaive | [
0.02641260251402855,
0.03302138298749924,
-0.008508831262588501,
-0.05722514167428017,
0.05512591823935509,
-0.05732984095811844,
-0.0198906771838665,
0.0440637432038784,
0.014622838236391544,
-0.020739879459142685,
0.00755317835137248,
0.016572091728448868,
-0.0406474806368351,
-0.0231484... | 0.78107 | 0.764298 | 0.016772 |
You are tasked with creating a program that finds the shortest path between a start person and their friends in a social network. The program should use the provided personId, country, tagClass, minPathDistance, and maxPathDistance to generate a list of friends who are within a certain path distance from the start pers... | glaive | [
0.019688185304403305,
0.006412965711206198,
-0.02944030426442623,
-0.03182132914662361,
0.023389654234051704,
-0.02600191719830036,
-0.026188043877482414,
0.022148557007312775,
0.04388148710131645,
-0.024276822805404663,
0.04197635129094124,
0.025829602032899857,
-0.005384726915508509,
-0.... | 0.813194 | 0.783342 | 0.029852 |
You are tasked with implementing a function in Rust that calculates the factorial of a given non-negative integer. 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 function call... | glaive | [
0.022656453773379326,
0.04108252748847008,
-0.009883095510303974,
-0.03850919380784035,
0.03258344531059265,
-0.021564491093158722,
-0.016971850767731667,
0.07190506160259247,
0.04465170204639435,
-0.0012258063070476055,
0.013240431435406208,
0.04716283082962036,
-0.024447252973914146,
-0.... | 0.809083 | 0.784095 | 0.024988 |
You are tasked with creating a C++ class for representing a graph and implementing various methods for graph operations. The class should be able to read a graph from a file in the GR format, store the graph data, and perform operations like computing the alias offset, loading the graph, and computing the maximum out-d... | glaive | [
0.012404263950884342,
0.008956600911915302,
-0.013358375057578087,
-0.030822884291410446,
0.031286660581827164,
-0.038720790296792984,
-0.03902200981974602,
0.09144456684589386,
0.040075454860925674,
-0.023149944841861725,
0.029182113707065582,
0.03450925648212433,
-0.012632884085178375,
0... | 0.798082 | 0.775106 | 0.022976 |
You are tasked with implementing a function in the programming language of your choice that takes in five parameters: rs, z, xt, xs0, and xs1. The function should calculate the value of f_tcs(rs, z, xt) multiplied by the value of revtca_fD(rs, z, X2S*2^(1/3)*xt), where f_tcs and revtca_fD are defined as follows:
f_tcs... | glaive | [
0.014783776365220547,
0.054361943155527115,
-0.0534886009991169,
-0.03975151106715202,
0.0511881522834301,
-0.02213420905172825,
-0.022791728377342224,
0.07138269394636154,
0.029216784983873367,
0.005092986393719912,
0.017876168712973595,
0.04852062836289406,
-0.04165276885032654,
-0.02518... | 0.825051 | 0.802288 | 0.022763 |
You are tasked with creating a program that trains on a dataset and uses a polynomial to make predictions. The program should also calculate and include additional features based on trigonometric functions. The specific steps for the program are as follows:
1. Train the program on data in the range [0.03, 0.5], using a... | glaive | [
0.019079985097050667,
0.029107043519616127,
-0.0443054661154747,
-0.03949717804789543,
0.04604280740022659,
-0.02438175119459629,
-0.024631869047880173,
0.06100665032863617,
0.0449259877204895,
-0.002268996788188815,
0.01456984132528305,
0.03899860754609108,
-0.024710075929760933,
0.011666... | 0.795272 | 0.777869 | 0.017403 |
You are tasked with creating a program to simulate the movement of particles through a field of obstacles. The obstacles are defined by their x and y coordinates, their radii, and the number of obstacles. The particles are defined by their x and y coordinates, their radii, and their velocities in the x and y directions... | glaive | [
-0.011724989861249924,
0.018566088750958443,
-0.029206590726971626,
-0.027057046070694923,
0.036642078310251236,
-0.0317632332444191,
-0.05286196991801262,
0.0733199417591095,
0.054293058812618256,
-0.013781425543129444,
0.017331531271338463,
0.033448562026023865,
-0.021730652078986168,
-0... | 0.792561 | 0.776951 | 0.01561 |
How can I write a Java program to find the largest and smallest number from an array of integers? | glaive | [
0.0071895006112754345,
0.02844257652759552,
-0.03696831315755844,
-0.036551643162965775,
0.033328570425510406,
-0.028562702238559723,
-0.019949087873101234,
0.02504236437380314,
0.029497940093278885,
-0.04425514116883278,
0.03629183769226074,
0.03630885109305382,
-0.050972357392311096,
-0.... | 0.798161 | 0.774066 | 0.024095 |
What is an algorithm to find the longest common sequence from two strings? | glaive | [
0.00760939484462142,
0.01539793610572815,
-0.033667389303445816,
-0.03693952411413193,
0.020763808861374855,
-0.03221902996301651,
-0.029591264203190804,
0.03926718980073929,
0.0035083526745438576,
-0.04962273687124252,
0.01341488491743803,
0.0250666756182909,
-0.021456392481923103,
-0.015... | 0.80185 | 0.772498 | 0.029352 |
You are tasked with implementing a CUDA kernel to perform atomic addition on an array of floats. The kernel should take in a float array `A` and its length `num_A`, and add 1.0 to the first element of `A` using atomic operations. Additionally, you need to create a CUDA kernel to operate on an array of custom data struc... | glaive | [
0.0021626404486596584,
0.046359188854694366,
-0.007184151094406843,
-0.015969304367899895,
0.03505370020866394,
-0.024922126904129982,
-0.019717993214726448,
0.10385152697563171,
0.04896033555269241,
-0.02556798793375492,
0.03616170957684517,
0.031470153480768204,
-0.01464053988456726,
0.0... | 0.807641 | 0.792447 | 0.015193 |
I need help with finding the smallest number that can be evenly divided by all numbers from 1 to n. Can someone provide me with a code solution for this problem? | glaive | [
0.004576364066451788,
0.015647878870368004,
-0.021345088258385658,
-0.04412539675831795,
0.03512299060821533,
-0.033630672842264175,
-0.008064117282629013,
0.04609430953860283,
0.030515603721141815,
-0.0340692363679409,
0.026152649894356728,
0.020419573411345482,
-0.04357663169503212,
-0.0... | 0.819176 | 0.797256 | 0.02192 |
How can I design a C++ function that can search an array of integers and return the index of the first occurrence of a desired integer? | glaive | [
0.01858816295862198,
0.03942550718784332,
-0.0288724135607481,
-0.02277984656393528,
0.03821522369980812,
-0.029798714444041252,
-0.04039256274700165,
0.07936421781778336,
0.021591588854789734,
-0.02308318391442299,
0.035337917506694794,
0.01856459677219391,
-0.02450699917972088,
-0.016255... | 0.802896 | 0.787735 | 0.015161 |
You are tasked with creating a piece-wise approximation of the asin(x) function with the following constraints:
1) Each piece should be completely well behaved in its range.
2) Adjacent pieces will be blended using linear approximation so their regions should overlap.
3) The blended result should have continuity.
4) Sy... | glaive | [
0.00979890301823616,
0.036970652639865875,
-0.01704220287501812,
-0.009585702791810036,
0.03132609650492668,
-0.022239351645112038,
-0.02725375071167946,
0.04004574939608574,
0.027584468945860863,
0.009442749433219433,
0.03625078871846199,
0.03525383770465851,
-0.009456366300582886,
0.0083... | 0.802888 | 0.767948 | 0.03494 |
You are tasked with creating a program that can print the contents of an array using C++ and CUDA. The program should be able to handle both regular arrays and CUDA arrays, and should print the content of the arrays in a readable format. The program should also be able to handle arrays of different data types, such as ... | glaive | [
0.013257477432489395,
0.04972008615732193,
-0.00862276554107666,
-0.022346995770931244,
0.034846529364585876,
-0.027247760444879532,
-0.03913695737719536,
0.10258884727954865,
0.053820859640836716,
-0.030764169991016388,
0.027506500482559204,
0.03876505792140961,
-0.0021808443125337362,
-0... | 0.788071 | 0.771723 | 0.016348 |
You are tasked with creating a program that finds the indices of triangular numbers that are also pentagonal. Triangular numbers are the sums of the natural numbers up to a certain number, while pentagonal numbers are a sequence of figurate numbers that form a pentagon. Your program should output the indices of the tri... | glaive | [
0.005215986166149378,
0.05378487706184387,
-0.022845817729830742,
-0.0506899319589138,
0.027929790318012238,
-0.031006673350930214,
-0.02979089878499508,
0.03511429578065872,
0.013492453843355179,
0.007422395050525665,
0.023900704458355904,
0.038189083337783813,
-0.04412210360169411,
-0.00... | 0.804809 | 0.743935 | 0.060874 |
How can I find the largest number in an array using Java? | glaive | [
0.02063888870179653,
0.04444815218448639,
-0.03130808472633362,
-0.03590859845280647,
0.026284968480467796,
-0.04125237464904785,
-0.01783895120024681,
0.020360393449664116,
0.022168902680277824,
-0.0444411002099514,
0.02554488740861416,
0.019587742164731026,
-0.044058240950107574,
-0.0000... | 0.787216 | 0.76218 | 0.025036 |
I'm trying to solve a programming problem in JavaScript. I have an array with some numbers, and I need to remove elements that are adjacent duplicates or multiples of the previous element in the array. Can someone help me write a function for this?
Here's the array I'm working with:
```javascript
var arr = [2, 3, 3, ... | glaive | [
0.031221838667988777,
0.02640099823474884,
-0.032565291970968246,
-0.024884147569537163,
0.04558467119932175,
-0.03196455165743828,
-0.01861128956079483,
0.07471913844347,
0.039246611297130585,
-0.014198753982782364,
0.012728624045848846,
-0.008203649893403053,
-0.031917862594127655,
-0.01... | 0.806242 | 0.781007 | 0.025234 |
You are tasked with creating a function that takes four positive real numbers (a, b, c, d) as input and returns a value based on the following formula:
a^2 / b + b^2 / c + c^2 / d + d^2 / a ≥ a + b + c + d
You need to implement the function using the given input parameters and ensure that it satisfies the inequality me... | glaive | [
0.022273480892181396,
0.029847068712115288,
-0.03902832046151161,
-0.03215017169713974,
0.050137441605329514,
-0.004593961406499147,
-0.02928163670003414,
0.07118503749370575,
0.05549135059118271,
-0.015372663736343384,
0.006009721662849188,
0.04642678052186966,
-0.016258206218481064,
-0.0... | 0.823903 | 0.770328 | 0.053575 |
You are tasked with developing a program to forecast the number of infections and deaths due to an epidemic in multiple countries. The program should take into account various parameters such as the number of days of observed data, reported deaths, and pre-calculated transmission rates. Additionally, the program should... | glaive | [
0.026367004960775375,
0.02474990300834179,
-0.04024641960859299,
-0.0324520468711853,
0.04296692833304405,
-0.021288780495524406,
-0.04325445741415024,
0.0703171119093895,
0.03137674555182457,
-0.016957100480794907,
0.015650557354092598,
0.06358922272920609,
-0.005526277702301741,
0.033529... | 0.778981 | 0.761851 | 0.01713 |
I need to implement a function to perform Singular Value Decomposition (SVD) on a given 2D array of floats. The SVD is a factorization of a real or complex matrix, with various applications in signal processing, statistics, and other fields. The function needs to compute the SVD in place and return the left singular ve... | glaive | [
-0.003955473657697439,
0.04561112821102142,
-0.04462675750255585,
-0.04113320633769035,
0.04331819713115692,
-0.021106580272316933,
-0.008604828268289566,
0.07195451855659485,
0.05488862469792366,
-0.012262885458767414,
0.01943778432905674,
0.0238643791526556,
-0.010869929566979408,
-0.025... | 0.80006 | 0.781541 | 0.01852 |
You are given a quantum computing problem to calculate the probability of a quantum state. The given code snippet includes a function `probability[x, y]` that calculates the probability of a given quantum state defined by the variables `x` and `y`. Your task is to use the `NMaximize` function to find the maximum probab... | glaive | [
-0.006917622406035662,
0.026887735351920128,
-0.03263281285762787,
-0.013907899148762226,
0.040991827845573425,
-0.0074727488681674,
-0.016505884006619453,
0.06891059130430222,
0.04435521364212036,
0.008599532768130302,
0.029161641374230385,
0.04124638810753822,
-0.00921293068677187,
-0.00... | 0.808444 | 0.782853 | 0.025591 |
I need to write a Python algorithm that can find the maximum number in a given list. Can you provide a solution for this problem? | glaive | [
0.015314308926463127,
0.009893572889268398,
-0.02210550755262375,
-0.03963013365864754,
0.04493352025747299,
-0.02890956588089466,
-0.023470165207982063,
0.02825050614774227,
0.03559503331780434,
-0.027183152735233307,
0.02082163840532303,
0.03172120079398155,
-0.02632392942905426,
-0.0082... | 0.80503 | 0.789508 | 0.015522 |
You are tasked with implementing a solution to avoid deadlock in a multi-process system. Deadlock occurs when two or more processes are waiting for each other to release resources, resulting in a standstill. The conditions for deadlock to occur include mutual exclusion, partial allocation, non-preemption, and circular ... | glaive | [
0.03162684291601181,
0.010333605110645294,
-0.03630651533603668,
-0.010694941505789757,
0.034025970846414566,
-0.004655192606151104,
-0.026469772681593895,
0.08860089629888535,
0.051186978816986084,
-0.024734070524573326,
0.012158984318375587,
0.0261142086237669,
-0.01137628499418497,
-0.0... | 0.79585 | 0.768714 | 0.027135 |
You are tasked with creating a shader program that will generate a visual effect similar to the one described in the given code snippet. The shader should produce an animated image based on the provided algorithm.
Your task is to implement the mainImage function, which takes in a vec2 parameter and an out vec4 paramet... | glaive | [
0.013472621329128742,
0.044732388108968735,
0.00013960411888547242,
-0.04032280668616295,
0.02626756764948368,
-0.039732903242111206,
-0.035906143486499786,
0.09778933972120285,
0.037464577704668045,
-0.024289056658744812,
0.049365852028131485,
0.01707434467971325,
-0.005760781466960907,
0... | 0.788124 | 0.770814 | 0.01731 |
You are tasked with simulating a type 1 experiment using the provided parameters and functions. The goal is to generate a simulation of the experiment and save the results to a file. The parameters for the simulation are as follows:
- Seed: 999983
- k: 1000
- n: 500
- m: 7
You need to use the `mclapply` function from t... | glaive | [
0.0051637073047459126,
0.032994236797094345,
-0.017790023237466812,
-0.04530933499336243,
0.032072342932224274,
-0.021008791401982307,
-0.027799490839242935,
0.08501194417476654,
0.041362419724464417,
-0.025031745433807373,
0.02351680025458336,
0.036877505481243134,
-0.008039284497499466,
... | 0.797999 | 0.783406 | 0.014593 |
:
You are tasked with implementing a program that can calculate the b97mv_f function, which is a mathematical function defined by a series of nested calculations. The function takes six input parameters (rs, z, xs0, xs1, ts0, ts1) and involves multiple sub-functions such as b97mv_g, b97mv_ux, b97mv_wx_ss, b97mv_wx_os, ... | glaive | [
0.027280347421765327,
0.026659928262233734,
-0.0413784459233284,
-0.0335429385304451,
0.04574090987443924,
-0.021039456129074097,
-0.020540617406368256,
0.06026875972747803,
0.06049291789531708,
-0.004661895800381899,
0.018335537984967232,
0.04297705739736557,
-0.025597278028726578,
-0.014... | 0.817198 | 0.785475 | 0.031723 |
You are tasked with creating a subroutine in Fortran called "shrinkagetarget" that calculates the shrinkage target in the Ledoit-Wolf formula. The subroutine takes the number of assets (p), the covariance matrix (cov), and returns the shrinkage target (f), the mean of the correlation matrix values (corrmean), and a dia... | glaive | [
-0.0034967423416674137,
0.036800749599933624,
-0.040384918451309204,
-0.05276664346456528,
0.0479900985956192,
0.00332657340914011,
-0.02221744693815708,
0.0653899610042572,
0.043603941798210144,
0.007683498784899712,
0.002311739372089505,
0.034400515258312225,
-0.03626343980431557,
-0.005... | 0.798305 | 0.77532 | 0.022985 |
You are tasked with creating a macro in Rust that can generate a sequence or recurrence based on the given input. The macro should be able to take in a mathematical expression and produce a sequence based on the expression. For example, the macro should be able to take in a sequence expression like `sequence![ n: u64 =... | glaive | [
0.02017076499760151,
0.03355174511671066,
-0.0022741907741874456,
-0.03791733831167221,
0.029256420210003853,
0.00032104068668559194,
-0.01962331496179104,
0.1007799357175827,
0.03407257795333862,
-0.014288543723523617,
0.025617927312850952,
0.03742147237062454,
-0.013793980702757835,
-0.0... | 0.810707 | 0.787907 | 0.0228 |
How can I create a program that rotates an array by X places to the right? | glaive | [
0.007294093258678913,
0.029091782867908478,
-0.02272547408938408,
-0.017771540209650993,
0.00827568769454956,
-0.019453737884759903,
-0.022176269441843033,
0.05155516788363457,
0.024836299940943718,
-0.04328460246324539,
0.005048184655606747,
0.030819492414593697,
-0.04475985839962959,
-0.... | 0.79397 | 0.778406 | 0.015564 |
You are tasked with writing a program that involves pushing and popping values onto and off of a stack in assembly language. The program should take in a value, print its binary representation, push it onto the stack, pop it off the stack, and then print its binary representation again. Additionally, the program should... | glaive | [
0.030302077531814575,
0.011583376675844193,
-0.018921297043561935,
-0.024806657806038857,
0.04169562831521034,
-0.04308243840932846,
-0.00935895461589098,
0.06761052459478378,
0.0407710000872612,
-0.009695230051875114,
0.024958979338407516,
0.049256712198257446,
-0.03289016708731651,
-0.01... | 0.804968 | 0.790492 | 0.014476 |
You are tasked with creating a Haskell module that contains the definitions of common data types and type classes. This module should include the following:
- Definition of a data type Range, which represents (sub)words represented by a range of integers
- Definition of a type Letter, which represents a character and i... | glaive | [
0.014035798609256744,
0.003724450711160898,
-0.030600760132074356,
-0.042675651609897614,
0.0447818785905838,
-0.05756331607699394,
-0.0014090050244703889,
0.04099814593791962,
0.044659655541181564,
-0.035115331411361694,
0.01852644421160221,
0.032374124974012375,
-0.011317030526697636,
-0... | 0.799848 | 0.780867 | 0.018982 |
You are tasked with creating a program that calculates the probability of a quantum state using a given amplitude function. The amplitude function is defined as follows:
amplitude[x_,y_] := (long mathematical expression);
You are required to write a probability function that takes two input variables x and y, and retur... | glaive | [
0.006236452143639326,
0.03290758281946182,
-0.03102264553308487,
-0.026983199641108513,
0.036154501140117645,
-0.02054518461227417,
-0.014679506421089172,
0.07106120884418488,
0.03912194073200226,
0.006849686615169048,
0.029158899560570717,
0.029883358627557755,
-0.013122688978910446,
-0.0... | 0.783374 | 0.753682 | 0.029693 |
You are tasked with implementing a function that examines the relation between the associativity indicators of two guards, one of which is nested within the other. The function should pretty-print expressions of the form as follows:
cm{ dn{ ... } ... dn{ ... } }
Where c, d denotes the association direction (L, R, N), a... | glaive | [
0.036484476178884506,
0.027041878551244736,
-0.04803885519504547,
-0.029900919646024704,
0.03237168863415718,
-0.015522926114499569,
-0.011300337500870228,
0.08618281036615372,
0.041642338037490845,
0.005317524075508118,
0.001108490745536983,
0.03499472886323929,
-0.023814359679818153,
0.0... | 0.814273 | 0.79093 | 0.023344 |
You are tasked with implementing a function that can evaluate an expression tree in the form of the following data type:
```fsharp
type Expression =
| Number of int
| Add of Expression * Expression
| Multiply of Expression * Expression
| Variable of string
```
The function should take an environment r... | glaive | [
0.03341786563396454,
0.01647210493683815,
-0.035089049488306046,
-0.04505452141165733,
0.050087735056877136,
-0.05512586236000061,
-0.001195612596347928,
0.09355717897415161,
0.06232541427016258,
0.007821067236363888,
0.032576460391283035,
0.042914245277643204,
-0.054535459727048874,
-0.02... | 0.803845 | 0.787475 | 0.01637 |
You are tasked with implementing a subroutine in Fortran called PLTREG. This subroutine should perform the following tasks:
1. Initialize the GRAPHP array by setting the first 6 elements to the values of TGRAPH array with indices (I, IPOPG) and the remaining elements from 21 to 100 to the values of TGRAPH array with in... | glaive | [
-0.002717682160437107,
0.016069404780864716,
-0.007034061010926962,
-0.04053216055035591,
0.036916766315698624,
-0.04122020676732063,
-0.0030106843914836645,
0.06181018427014351,
0.04632063955068588,
-0.00413413206115365,
0.013495353981852531,
0.04255067929625511,
-0.03719116002321243,
-0.... | 0.814904 | 0.796981 | 0.017923 |
Can you provide a code solution for calculating the sum of all numbers from 1 to a given input `n`? | glaive | [
0.007070034742355347,
0.030490636825561523,
-0.0218783188611269,
-0.030749134719371796,
0.0459495447576046,
-0.04053521156311035,
-0.004247481469064951,
0.021468864753842354,
0.03981631621718407,
-0.03008643351495266,
0.029339583590626717,
0.04332086816430092,
-0.04797099903225899,
-0.0197... | 0.816653 | 0.792734 | 0.023919 |
You are tasked with writing a function or program that calculates the value of a sequence based on the following formula: a(n) = n*(n+1)*(n+2)*(n+3)*(n+4)/8. The input will be an integer n, and the output should be the value of a(n) according to the given formula. Your implementation should be able to handle large inpu... | glaive | [
0.037776704877614975,
0.041452556848526,
-0.033912256360054016,
-0.025872791185975075,
0.035750314593315125,
-0.025289442390203476,
-0.03977032005786896,
0.07831666618585587,
0.036773908883333206,
-0.0193021297454834,
0.020752105861902237,
0.03877625614404678,
-0.03421623632311821,
-0.0215... | 0.832259 | 0.785106 | 0.047153 |
You are tasked with implementing a function that finds the k smallest elements in an iterator of items. The function should take in an iterator of items and an integer k, and should return a binary heap containing the k smallest items from the iterator.
Your task is to write a function with the following signature:
``... | glaive | [
0.01199661660939455,
0.05672242119908333,
-0.016779180616140366,
-0.04347885772585869,
0.04417791962623596,
-0.02648783288896084,
-0.013267647475004196,
0.09032958745956421,
0.05120361968874931,
-0.005791372153908014,
0.026429954916238785,
0.024617915973067284,
-0.01386474072933197,
0.0090... | 0.819166 | 0.798951 | 0.020216 |
You are tasked with writing a program to calculate the probability of a quantum state given certain parameters. The program should include a function to calculate the amplitude of the state, a function to calculate the probability based on the amplitude, and a method to find the maximum probability within given constra... | glaive | [
-0.004491809289902449,
0.03795322775840759,
-0.022926054894924164,
-0.01880503259599209,
0.04350431635975838,
-0.01674807257950306,
-0.01651163399219513,
0.0734596773982048,
0.029262714087963104,
-0.00021474195818882436,
0.02388610690832138,
0.03420163318514824,
-0.01310533843934536,
-0.00... | 0.797574 | 0.769282 | 0.028292 |
You are tasked with implementing a matrix multiplication module using CUDA in C++. You are given the following requirements and constraints:
- You need to create a module that performs forward and backward matrix multiplication operations.
- The module should take in three arrays (a, b, and c) and their gradients (a_g... | glaive | [
0.025144800543785095,
0.03927360102534294,
-0.021429823711514473,
-0.025507789105176926,
0.03357020020484924,
-0.009686267003417015,
-0.029766079038381577,
0.1066470518708229,
0.04316182807087898,
-0.023517105728387833,
-0.0025413057301193476,
0.03417137265205383,
-0.0093657486140728,
-0.0... | 0.793965 | 0.771675 | 0.022289 |
You are tasked with creating a program that can handle and manipulate a set of points in a model. The program should be able to store and retrieve these points, and perform operations such as calculating the distance between two points, finding the closest point to a given point, and determining if the path is closed o... | glaive | [
0.036220818758010864,
0.014647243544459343,
-0.03426181897521019,
-0.02804388850927353,
0.035539668053388596,
-0.048127248883247375,
-0.038440264761447906,
0.06057107448577881,
0.05258722975850105,
-0.020102400332689285,
0.011515882797539234,
0.0617901086807251,
-0.01786714605987072,
-0.00... | 0.795474 | 0.777844 | 0.01763 |
You are tasked with creating a Python module that calculates the lattice parameters of a crystal structure. The lattice parameters are the lengths of the edges of the unit cell, and the angles between them. Your module should be able to take in the atomic positions of the crystal and output the lattice parameters based... | glaive | [
0.02862926758825779,
0.025836020708084106,
-0.038163233548402786,
-0.02626820094883442,
0.03980466350913048,
-0.037788067013025284,
-0.03177538514137268,
0.05539482459425926,
0.023248691111803055,
-0.0021360416430979967,
0.02145453542470932,
0.026715708896517754,
-0.047729261219501495,
0.0... | 0.784532 | 0.767035 | 0.017497 |
You are tasked with implementing a program that calculates the factorial of a number and then performs a series of operations on it. You are given the following code snippet as a starting point:
```pascal
const a = 1, b = 2, c = 3, d = 4;
var x, y, z, i: integer;
function p1(var a: integer): integer;
begin
for i ... | glaive | [
0.018447935581207275,
0.050406020134687424,
-0.001968078315258026,
-0.027480721473693848,
0.04443073645234108,
-0.027996094897389412,
0.0013511145953088999,
0.06032562628388405,
0.04348013550043106,
0.004139025695621967,
0.01534691359847784,
0.0456252284348011,
-0.032018031924963,
-0.01686... | 0.809244 | 0.785637 | 0.023608 |
You are tasked with implementing a CUDA program that calculates the sum of a sequence of numbers using parallel processing. The program needs to use CUDA C++ to achieve this, and the main function should call a wrapper function that will then call the core kernel function. The kernel function should take a parameter 'n... | glaive | [
0.002966322237625718,
0.0522245354950428,
-0.020508727058768272,
-0.021539513021707535,
0.04328717291355133,
0.015335168689489365,
-0.026143565773963928,
0.10621362179517746,
0.03613169491291046,
-0.01851314678788185,
0.01811775006353855,
0.05861784890294075,
-0.01272808387875557,
0.007254... | 0.794525 | 0.769072 | 0.025453 |
You are tasked with implementing a function to find the intersection of two lists in a programming language that supports theorem proving and has a built-in 'list' namespace. The function should take two lists as input and return a new list containing only the elements that appear in both input lists. | glaive | [
0.03281435742974281,
0.01071814727038145,
-0.03335223346948624,
-0.038993075489997864,
0.0419757254421711,
-0.0064743575640022755,
-0.021699778735637665,
0.03938804939389229,
0.06270114332437515,
-0.022353850305080414,
0.027021534740924835,
0.029449768364429474,
0.0033714945893734694,
-0.0... | 0.809183 | 0.789696 | 0.019487 |
You are tasked with implementing a function that performs exclusive scan on an input array and stores the result in an output array. The exclusive scan operation transforms an input array into an output array where each element is the sum of all preceding elements in the input array.
You are provided with the followin... | glaive | [
0.035333484411239624,
0.05064786970615387,
-0.03359021246433258,
-0.023118292912840843,
0.04867934435606003,
-0.02286040410399437,
-0.02004825323820114,
0.09963459521532059,
0.0493927076458931,
-0.009404291398823261,
0.019774852320551872,
0.026289725676178932,
-0.005317913834005594,
-0.019... | 0.823908 | 0.791869 | 0.032038 |
You are tasked with writing a program to analyze data from a sensor. The sensor provides readings for X, Y, TStamp, Pres., and EndPts. The data is in the following format:
X, Y, TStamp, Pres., EndPts
DataSize: 139
14000 14336 0 52 0
14000 14336 10 58 0
14000 14336 30 63 0
...
Your task is to write a program that reads... | glaive | [
-0.01119301002472639,
0.02118079736828804,
-0.04559791833162308,
-0.051340557634830475,
0.03886272385716438,
-0.05741811916232109,
-0.03037957474589348,
0.07254482805728912,
0.042840924113988876,
-0.005289037246257067,
0.03031180612742901,
0.031649816781282425,
-0.020968079566955566,
-0.00... | 0.809434 | 0.794304 | 0.015129 |
Write a program that creates a list of numbers, including integers and floats, using the ArrayList class in Java. The program should utilize autoboxing and unboxing to convert between primitive data types and their corresponding wrapper classes. The list should contain at least 4 elements, including both integers and f... | glaive | [
0.028650283813476562,
0.017351821064949036,
-0.021121907979249954,
-0.03324158117175102,
0.06778079271316528,
-0.041881855577230453,
-0.021368183195590973,
0.048432912677526474,
0.0320422425866127,
-0.04482858628034592,
0.02671210840344429,
0.04891515523195267,
-0.026461487635970116,
-0.02... | 0.798615 | 0.778425 | 0.02019 |
You are required to create a Kotlin function that takes in an array of integers and returns the sum of all the even numbers in the array.
Write a function called `sumOfEvenNumbers` that takes in an array of integers as a parameter and returns the sum of all the even numbers in the array.
For example, if the input arr... | glaive | [
0.01977715454995632,
0.013237745501101017,
-0.023229390382766724,
-0.05546348914504051,
0.04159189388155937,
-0.031130604445934296,
-0.016923367977142334,
0.05253937840461731,
0.023425037041306496,
-0.019086463376879692,
0.015915023162961006,
0.03270024433732033,
-0.036426037549972534,
0.0... | 0.81508 | 0.785622 | 0.029459 |
You are tasked with implementing a function in Java that removes underscores from a list of binary digits and underscores. The function should take in a list of binary digits and underscores and return the underlying sequence of binary digits, excluding the prefix of the binary numeral. Additionally, the function shoul... | glaive | [
0.0105829406529665,
0.03710300847887993,
-0.012985342182219028,
-0.03864743933081627,
0.040086254477500916,
-0.04936414584517479,
-0.001371134421788156,
0.04011265188455582,
0.04990019276738167,
-0.023147908970713615,
0.015677645802497864,
0.03155846893787384,
-0.022399837151169777,
-0.027... | 0.808403 | 0.780212 | 0.028191 |
You are tasked with proving the following propositions related to binary relations and properties of numbers:
A. Prove that for any given binary relation, if it is asymmetric, then it is also irreflexive.
B. Prove that for any given binary relation, if it is irreflexive and transitive, then it is also asymmetric.
C. P... | glaive | [
0.04219520464539528,
0.02842877432703972,
-0.03722671791911125,
-0.018846752122044563,
0.04420308768749237,
-0.02271195873618126,
0.001330578001216054,
0.05995751544833183,
0.027064412832260132,
-0.014833045192062855,
0.017736580222845078,
0.007047570310533047,
-0.030341319739818573,
-0.01... | 0.800258 | 0.77065 | 0.029608 |
You are tasked with implementing a GPU Sparse Tensor class in C++ using the provided code snippet as a reference. The class should include the following functionalities:
- Reshaping the tensor to a new shape, with support only for sparse matrix (2D) tensors.
- Resizing the sparse matrix to accommodate a new number of n... | glaive | [
0.016200339421629906,
0.03162495046854019,
-0.008725419640541077,
-0.02514014020562172,
0.03906799480319023,
-0.009333867579698563,
-0.03391633927822113,
0.09500371664762497,
0.02973930351436138,
-0.0269211046397686,
0.02793036587536335,
0.02544788084924221,
-0.00017140901763923466,
0.0199... | 0.789878 | 0.767873 | 0.022005 |
####
Is there an equivalently efficient sequence for counting signed comparisons in a sorted array?
Let's say I want to find the first occurrence of a value in a sorted array. For small arrays, I can achieve this by simply counting the number of values less than that value: the result is the index I am after.
In x86... | glaive | [
0.00575433811172843,
0.03341063857078552,
-0.03529932722449303,
-0.021876445040106773,
0.011586029082536697,
-0.02035239152610302,
-0.01070044282823801,
0.09561221301555634,
0.034251194447278976,
-0.029112692922353745,
0.031064612790942192,
0.0028655752539634705,
-0.03573774918913841,
-0.0... | 0.812467 | 0.787454 | 0.025013 |
You are tasked with creating a function that reads the monotonous clock and returns a list of counters. The function should utilize the GHC.Stats module and the GHC.Clock module to retrieve the necessary data. The function should return counters for various statistics such as allocated bytes, live bytes, maximum live b... | glaive | [
0.02538115158677101,
0.022921375930309296,
-0.026057876646518707,
-0.048331063240766525,
0.018511835485696793,
-0.020316563546657562,
-0.04126227647066116,
0.059762705117464066,
0.047188326716423035,
-0.010296961292624474,
0.0011022771941497922,
0.03457479923963547,
-0.019628731533885002,
... | 0.796982 | 0.781613 | 0.015369 |
You are tasked with creating a program that calculates the probability distribution for a given quantum state. The program should take into account the number of qubits (nqubits), the name of the quantum state (name), and the number of states (nstates). The program should use the provided amplitude and probability func... | glaive | [
-0.006100857630372047,
0.025245897471904755,
-0.034775715321302414,
-0.02635006047785282,
0.0434650257229805,
-0.01829332485795021,
-0.017018800601363182,
0.07583870738744736,
0.03509347885847092,
0.004932908341288567,
0.023913051933050156,
0.04167890176177025,
-0.01615329086780548,
-0.008... | 0.787666 | 0.760237 | 0.027429 |
You have been tasked with implementing a function that evaluates a polynomial at a specific point. The polynomial is represented as a list of tuples, where each tuple consists of the coefficient and the power of the term. Your task is to write a function that takes the polynomial list and a point as input and returns t... | glaive | [
0.044383980333805084,
0.02602475881576538,
-0.04926244169473648,
-0.05469125136733055,
0.03670523688197136,
-0.03907576575875282,
-0.019501106813549995,
0.05298854783177376,
0.053512152284383774,
0.0030010042246431112,
0.021606236696243286,
0.06094035506248474,
-0.025289980694651604,
-0.00... | 0.803032 | 0.774826 | 0.028205 |
You are tasked with creating a program using the LaTeX package pstricks to draw a specific pattern. The pattern consists of eight concentric circles, each with a different shade of gray. Additionally, the circles are intersected by eight triangles, each with a specific fill color. The triangles are drawn using the psli... | glaive | [
0.005337084643542767,
0.034417711198329926,
-0.027686143293976784,
-0.037078116089105606,
0.03947659954428673,
-0.022328302264213562,
-0.008978040888905525,
0.055887624621391296,
0.04720311984419823,
-0.00579098192974925,
0.015482383780181408,
0.04040365293622017,
-0.002315544057637453,
-0... | 0.799727 | 0.784789 | 0.014938 |
You are tasked with writing a program that takes a set of numbers as input and calculates the sum of all the numbers in the set. The input will be provided in scientific notation, and your program should be able to handle both positive and negative exponents.
Write a function `calculateSum` that takes a list of number... | glaive | [
0.017947964370250702,
0.023784756660461426,
-0.038149718195199966,
-0.044028814882040024,
0.05457109585404396,
-0.035928260535001755,
-0.025109395384788513,
0.03106626681983471,
0.038547832518815994,
-0.01972465217113495,
0.021578682586550713,
0.04824555665254593,
-0.04525322839617729,
-0.... | 0.811557 | 0.774383 | 0.037174 |
You are tasked with calculating the maximum probability of a quantum state for a given set of parameters. The quantum state is defined by the functions amplitude[x, y] and probability[x, y] in the code snippet below. Your goal is to find the maximum probability value for a specified number of states (nstates) and print... | glaive | [
0.018822813406586647,
0.025024142116308212,
-0.03530338034033775,
-0.022593172267079353,
0.04960685968399048,
-0.022743768990039825,
-0.009954002685844898,
0.07007594406604767,
0.043045468628406525,
-0.003475072793662548,
0.02259255386888981,
0.03138766437768936,
-0.026361174881458282,
-0.... | 0.795986 | 0.773216 | 0.02277 |
You are tasked with processing a dataset containing five columns: X, Y, TStamp, Pres., and EndPts. The dataset has a size of 123. Your goal is to write a program that reads in this dataset and performs a specific operation on the data.
Your program should read the dataset and calculate the average value of the "Pres."... | glaive | [
0.006190301850438118,
0.010397057980298996,
-0.04847157374024391,
-0.04811564460396767,
0.03824935480952263,
-0.0508049875497818,
-0.021591870114207268,
0.07990535348653793,
0.053289610892534256,
-0.007576309144496918,
0.028577759861946106,
0.025135954841971397,
-0.029897402971982956,
0.01... | 0.805468 | 0.784454 | 0.021014 |
You are tasked with creating a number guessing game in Lua. The program should generate a random number between 1 and 100 and then prompt the user to guess the number. The user will have a maximum of 10 guesses to correctly identify the secret number. For each incorrect guess, the program should inform the user whether... | glaive | [
0.004116415046155453,
0.03451484069228172,
-0.032371267676353455,
-0.03215911611914635,
0.04493814334273338,
-0.016906876116991043,
-0.03824993222951889,
0.03139136731624603,
0.03822261467576027,
-0.03911551460623741,
0.03230522945523262,
0.03704109787940979,
-0.044322527945041656,
-0.0113... | 0.798161 | 0.773528 | 0.024633 |
You are tasked with creating a program that calculates the probability of a quantum state and then maximizes that probability using simulated annealing. The program should also plot a 3D graph of the probability function and a contour plot.
The quantum state is described by the amplitude function, which takes two para... | glaive | [
0.0020021614618599415,
0.03601441904902458,
-0.029098372906446457,
-0.024492979049682617,
0.03413209319114685,
-0.023808157071471214,
-0.014238324947655201,
0.07807227224111557,
0.03193901106715202,
0.004137951415032148,
0.021343497559428215,
0.034275274723768234,
-0.011226975359022617,
0.... | 0.79806 | 0.770213 | 0.027847 |
How can I find the minimum value in a given array using Python? | glaive | [
-0.013063022866845131,
0.036425791680812836,
-0.033152006566524506,
-0.033699460327625275,
0.044907450675964355,
-0.0399995855987072,
-0.02202867716550827,
0.030626337975263596,
0.028706016018986702,
-0.02731385827064514,
0.01711423322558403,
0.010473286733031273,
-0.024470245465636253,
0.... | 0.792364 | 0.77669 | 0.015674 |
You are tasked with writing a Prolog program that can take a list of elements and then output two different lists: one that contains unique elements (Set) and one that contains all the elements (Bag) including duplicates. The program should be able to handle any input list and produce the correct Set and Bag lists. | glaive | [
0.03404408320784569,
0.012842124328017235,
-0.040960606187582016,
-0.025670235976576805,
0.027436381205916405,
-0.034260887652635574,
-0.020926231518387794,
0.050705436617136,
0.050262290984392166,
-0.015651656314730644,
0.029077153652906418,
0.05143352970480919,
-0.02140139788389206,
-0.0... | 0.813661 | 0.793282 | 0.020379 |
You are tasked with creating a function that will convert a given bitrate in Mbps to the interarrival time in multiples of 1e-8sec (10ns). The function should take the bitrate as input and return the calculated interarrival time. | glaive | [
0.028845692053437233,
0.04193305969238281,
-0.01985342800617218,
-0.011324526742100716,
0.0392763614654541,
-0.015370531938970089,
-0.057458218187093735,
0.0583760067820549,
0.06256671249866486,
0.0012354180216789246,
0.03464968875050545,
0.029786884784698486,
-0.048107728362083435,
0.0048... | 0.777181 | 0.761839 | 0.015342 |
I have a sorted list and a key. How can I find the position of the key in the list using an algorithm? | glaive | [
0.03212279826402664,
0.022891074419021606,
-0.03938276693224907,
-0.0463886521756649,
0.039367225021123886,
-0.029372088611125946,
-0.027905795723199844,
0.039890021085739136,
0.0315425768494606,
-0.033989883959293365,
0.03242233395576477,
0.018481126055121422,
-0.04049350321292877,
-0.012... | 0.784113 | 0.767905 | 0.016207 |
You are tasked with creating a set of functions to manipulate and perform operations on lists and integers.
1. Implement a function `sumList` that takes a list of integers and returns the sum of all the elements in the list.
2. Implement a function `digitsOfInt` that takes an integer and returns a list of its digits.... | glaive | [
0.032592423260211945,
0.031379442662000656,
-0.02089739590883255,
-0.03643505275249481,
0.058656901121139526,
-0.03886637091636658,
-0.005944609642028809,
0.0339609757065773,
0.047445978969335556,
-0.0011891607427969575,
0.012107979506254196,
0.04476718232035637,
-0.027982641011476517,
-0.... | 0.823959 | 0.791401 | 0.032557 |
How can I create a Java program that reverses the values in an array of integers? | glaive | [
0.005784631706774235,
0.027760261669754982,
-0.030810343101620674,
-0.029194919392466545,
0.03452913835644722,
-0.03807327523827553,
-0.01269752811640501,
0.048949070274829865,
0.03884706273674965,
-0.04151737317442894,
0.019525820389389992,
0.02605465054512024,
-0.0462651364505291,
-0.025... | 0.794894 | 0.779932 | 0.014962 |
You are required to implement a program that calculates the maximum value of a given complex function and then plots the function in 3D and as a contour plot. The function is defined as follows:
function[x_, y_] := $Conjugate[Exp[-16 I y] (1 (I Sin[x])^6 Cos[x]^10 + 1 (I Sin[x])^10 Cos[x]^6) + ... (long expression)
You... | glaive | [
0.02268308214843273,
0.028773542493581772,
-0.053131382912397385,
-0.03427231311798096,
0.04162820801138878,
-0.01537355501204729,
-0.021145155653357506,
0.05577292665839195,
0.05273635685443878,
-0.0015030376380309463,
0.05106770619750023,
0.05984977260231972,
-0.024811357259750366,
-0.00... | 0.803053 | 0.784157 | 0.018896 |
You are tasked with implementing a CUDA kernel function for temporal max pooling in a neural network. The function should take in an input tensor, perform max pooling along the temporal dimension, and return the output tensor and indices of the maximum values. The input tensor can be either 2D or 3D, representing a sin... | glaive | [
0.012550471350550652,
0.045071858912706375,
-0.01950177550315857,
-0.018158573657274246,
0.021121390163898468,
-0.0005635090637952089,
-0.03429969400167465,
0.0776420384645462,
0.043122582137584686,
-0.0055722082033753395,
0.03682053089141846,
0.036463409662246704,
-0.01068365853279829,
0.... | 0.79832 | 0.776444 | 0.021876 |
You are required to write a Prolog program to simplify a boolean expression of the form A*B+C*D... into a simpler form. The input expression will consist of variables A, B, C, D, etc., combined with the * (AND), + (OR), and not operators. The goal is to simplify the expression as much as possible using the rules of boo... | glaive | [
0.015545029193162918,
0.02845173142850399,
-0.03836435079574585,
-0.039210256189107895,
0.04027893766760826,
-0.025306763127446175,
-0.004860617220401764,
0.058511193841695786,
0.053176261484622955,
-0.005651612300425768,
-0.004254412837326527,
0.03579217568039894,
-0.00888898130506277,
-0... | 0.799466 | 0.769734 | 0.029732 |
You are tasked with implementing a k-means clustering algorithm in the Julia programming language using the HPAT library. The k-means algorithm aims to partition n data points into k clusters in which each point belongs to the cluster with the nearest mean. Your task is to write a Julia program that takes in input para... | glaive | [
-0.020745720714330673,
0.03494405746459961,
-0.04113364219665527,
-0.03574708104133606,
0.03738586604595184,
-0.020285431295633316,
-0.030711883679032326,
0.06582744419574738,
0.04558825492858887,
-0.014219241216778755,
0.014339806511998177,
0.013818277046084404,
-0.018028348684310913,
0.0... | 0.799533 | 0.780703 | 0.018831 |
I'm trying to convert this C code into MIPS assembly:
```c
int A[10];
int sum = 0;
int i = 0;
while (i<10){
sum += A[i++];
sum *= 2;
}
```
I've made some progress, but I'm stuck inside the while loop. Here's what I have so far:
```assembly
**Reg. Allocation Table:
A = $s1
sum = $s2
i = $s3
10 = $s4**
loop:... | glaive | [
0.011437959969043732,
0.02236359566450119,
-0.018572449684143066,
-0.019089652225375175,
0.048252057284116745,
-0.056833960115909576,
-0.035580825060606,
0.08307727426290512,
0.03434063121676445,
-0.008023359812796116,
0.025952879339456558,
0.022545550018548965,
-0.03903050720691681,
-0.01... | 0.800214 | 0.780918 | 0.019296 |
You are tasked with creating a program to calculate the maximum probability for a given set of quantum states. The program should take into account the number of qubits, the name of the quantum system, and the amplitude and probability functions. The program should also include a visualization of the probability functi... | glaive | [
0.007820540107786655,
0.027781479060649872,
-0.04063381999731064,
-0.016218218952417374,
0.050325971096754074,
-0.02178066596388817,
-0.02508397586643696,
0.05951700359582901,
0.031493693590164185,
-0.007849377579987049,
0.022660555317997932,
0.039006948471069336,
-0.01044941134750843,
-0.... | 0.79393 | 0.766375 | 0.027556 |
You are tasked with creating a data structure in the programming language that includes various types of constants, enums, structs, and unions. Additionally, you are required to define a map and a list with specific data types and initial values. Finally, you need to define a negative field and specify the use of speci... | glaive | [
0.018237488344311714,
0.0009612891008146107,
-0.03818372264504433,
-0.009400714188814163,
0.03656435012817383,
-0.06570110470056534,
-0.004391627851873636,
0.07145274430513382,
0.035888295620679855,
-0.03787072002887726,
0.02976091019809246,
0.029516104608774185,
-0.021734138950705528,
-0.... | 0.80834 | 0.787824 | 0.020516 |
You are tasked with creating a program that reads mps files from a specified directory and performs numerical performance analysis on them. The program should be able to extract data such as the number of rows, columns, non-zero elements, and sparsity of the matrices. Additionally, the program should have the capabilit... | glaive | [
0.011346655897796154,
0.002924855798482895,
-0.04300142824649811,
-0.031054921448230743,
0.025892771780490875,
-0.02363451197743416,
-0.03130665421485901,
0.046609923243522644,
0.036069106310606,
0.0037162485532462597,
0.003610556712374091,
0.02012978494167328,
-0.023856833577156067,
-0.01... | 0.79201 | 0.775979 | 0.016032 |
I need to write a program that takes in a list of integers and rearranges them in such a way that all the even numbers come before all the odd numbers. Additionally, the even numbers should be sorted in ascending order, and the odd numbers should be sorted in descending order. Can someone provide a solution in Python? | glaive | [
0.028262250125408173,
0.01654587686061859,
-0.034820545464754105,
-0.046216465532779694,
0.019100861623883247,
-0.0185946524143219,
-0.011010964401066303,
0.02987620420753956,
0.03174382075667381,
-0.022387487813830376,
0.00786477979272604,
0.029904482886195183,
-0.04882635921239853,
-0.02... | 0.807948 | 0.793285 | 0.014663 |
You are tasked with implementing a CUDA kernel function that updates the top boundary of a 2D array. The function signature should be as follows:
```c++
__device__ void EzTopUpdater::operator() (const int indx);
```
The function should take an integer index `indx` and update the top boundary of the 2D array `Ez` usin... | glaive | [
0.016493406146764755,
0.054036445915699005,
-0.005211639683693647,
-0.01266475673764944,
0.02925986982882023,
-0.012765057384967804,
-0.04056980460882187,
0.0896836668252945,
0.04177568107843399,
-0.014910701662302017,
0.030304135754704475,
0.03653492033481598,
-0.006413244642317295,
0.002... | 0.802894 | 0.785116 | 0.017778 |
You are tasked with designing a system to manage and process a queue of job requests. Each job request has a URL and a host associated with it, and optionally a host IP address. Your task is to create a class or data structure to represent a job, and implement methods to add a job to the queue, remove a job from the qu... | glaive | [
0.002563892863690853,
0.01975639909505844,
-0.02673984132707119,
-0.011068904772400856,
0.02780546061694622,
-0.02156280353665352,
-0.036834169179201126,
0.04229024797677994,
0.03879164159297943,
-0.01898571103811264,
0.03483546897768974,
0.02721836045384407,
-0.03267617151141167,
-0.00283... | 0.80758 | 0.792597 | 0.014983 |
You are tasked with implementing a CUDA kernel function that performs a specific computation on a given input array. The goal is to calculate the residue of a mathematical operation and store the results in an output array. The input array contains phase values, and the computation to be performed involves a series of ... | glaive | [
0.021868648007512093,
0.051727473735809326,
-0.02462938241660595,
-0.028500258922576904,
0.04370027035474777,
-0.008151816204190254,
-0.031594306230545044,
0.09637689590454102,
0.06233462691307068,
-0.0071135349571704865,
0.024948418140411377,
0.035432249307632446,
-0.008968142792582512,
0... | 0.804525 | 0.785271 | 0.019254 |
You are tasked with creating a subroutine to generate a nodal mask based on certain input parameters. The subroutine should take in an integer 'n', a type 'lmultifab' named 'mask', and two type 'imultifab' variables 'mm_crse' and 'mm_fine'. Additionally, it should take in a type 'ml_layout' named 'mla'. The subroutine ... | glaive | [
0.01633600890636444,
0.040561214089393616,
-0.024506492540240288,
-0.03260033205151558,
0.04725128784775734,
-0.013388190418481827,
-0.03170795366168022,
0.07169820368289948,
0.023935111239552498,
0.012660196051001549,
0.016517028212547302,
0.03757980093359947,
-0.00029625650495290756,
0.0... | 0.804029 | 0.787886 | 0.016144 |
Can you provide a Python implementation of the selection sort algorithm to sort the following numerical arrangement in ascending order: [4, 1, 10, 8, 5]? | glaive | [
0.034639403223991394,
0.02035721205174923,
-0.008399352431297302,
-0.02576628141105175,
0.029139673337340355,
-0.035426829010248184,
-0.03565184772014618,
0.03672362491488457,
0.027311032637953758,
-0.0010427412344142795,
0.019193748012185097,
0.009442878887057304,
-0.05172315984964371,
0.... | 0.822983 | 0.795913 | 0.027069 |
You are required to implement a CPU hash function using the whirlpool algorithm. The function takes in a state and input, and should produce a 32-byte hash as the output. The input is processed in multiple stages using the whirlpool algorithm to generate the final hash. The initial memory for the hash functions must be... | glaive | [
0.027593392878770828,
0.03718968853354454,
-0.009066315367817879,
-0.018923994153738022,
0.02642747014760971,
-0.0174200851470232,
-0.024822330102324486,
0.07248988002538681,
0.03839090093970299,
-0.01950150914490223,
0.026412930339574814,
0.023283187299966812,
-0.004379487130790949,
-0.00... | 0.805484 | 0.790996 | 0.014488 |
You are tasked with creating a function that slices a given array into smaller arrays of a specified length. The function should take in an array and a slice length as parameters and return an array of smaller arrays.
For example, if the input array is [1, 2, 3, 4, 5] and the slice length is 2, the output should be [[... | glaive | [
0.00011746712698368356,
0.04912598058581352,
-0.029459703713655472,
-0.04378984868526459,
0.047305382788181305,
-0.02401583269238472,
-0.0489981584250927,
0.050399333238601685,
0.04557233676314354,
-0.0036140712909400463,
0.036906998604536057,
0.0249154195189476,
-0.04810812324285507,
-0.0... | 0.800271 | 0.763398 | 0.036873 |
You are tasked with implementing a parallel computation problem using the Kokkos library. The problem involves computing generators and integrating regions in a high-dimensional space. The specific task is to create a function to compute generators and integrate regions on a GPU using the given template functions.
You... | glaive | [
0.042936645448207855,
0.0442536436021328,
-0.008453129790723324,
-0.038960300385951996,
0.016706377267837524,
0.0010533432941883802,
-0.010054957121610641,
0.08238860219717026,
0.04387975111603737,
-0.011955383233726025,
0.017118971794843674,
0.05092991888523102,
0.005531523376703262,
0.00... | 0.808384 | 0.793553 | 0.014831 |
You are tasked with implementing a function that converts a given graph into a grid structure. The grid structure is defined by the following data type:
```elm
type Grid n e
= Cell (Graph.NodeContext n e)
| Serial (Grid n e) (Grid n e)
| Parallel (List (Grid n e))
| End
```
You need to create a functi... | glaive | [
0.0008183239260688424,
0.017625538632273674,
-0.017691735178232193,
-0.051121149212121964,
0.03846752643585205,
-0.04708661139011383,
-0.007727251388132572,
0.0707550048828125,
0.03842027112841606,
-0.007116734981536865,
0.019764814525842667,
0.03754393011331558,
-0.03536679595708847,
0.00... | 0.794956 | 0.780294 | 0.014662 |
Write a program that takes a real number as input and calculates the value of the given mathematical model:
target += (5000/x^2)*(x-11)
The program should prompt the user to input a real number within the range of 0 to 100, and then calculate the value of the above mathematical model using the input number. | glaive | [
0.043266650289297104,
0.02326946333050728,
-0.04587464779615402,
-0.03424676135182381,
0.04894968494772911,
-0.03354448452591896,
-0.02534833550453186,
0.05521320551633835,
0.048852454870939255,
-0.02131759747862816,
0.014226722531020641,
0.048972297459840775,
-0.032452695071697235,
-0.025... | 0.813915 | 0.793906 | 0.020009 |
You have been tasked with writing a function to calculate the square root of a complex number. The function should return a complex number with the real and imaginary parts having the same sign as the imaginary part of the input number. The function should be able to handle both 32-bit and 64-bit floating point complex... | glaive | [
0.02202635072171688,
0.06217839941382408,
-0.03996212035417557,
-0.03938961401581764,
0.034939706325531006,
-0.012907151132822037,
-0.01653805375099182,
0.05933716148138046,
0.03954559937119484,
-0.008350208401679993,
0.04388943314552307,
0.03151500225067139,
-0.04855649545788765,
-0.01954... | 0.799268 | 0.777293 | 0.021974 |
You have been tasked with creating a program to calculate the area of a circle. The program should take the radius of the circle as input and output the area. You need to implement a function that takes the radius as a parameter and returns the area of the circle. | glaive | [
0.009616563096642494,
0.04257916286587715,
-0.037448037415742874,
-0.016991881653666496,
0.036546118557453156,
-0.0192875973880291,
-0.03546086326241493,
0.05077013745903969,
0.046370718628168106,
0.0012537529692053795,
0.02474624291062355,
0.03961479663848877,
-0.029734337702393532,
-0.01... | 0.774084 | 0.750456 | 0.023628 |
Can you provide a solution to determine the nth Fibonacci number? | glaive | [
0.02082962542772293,
0.012693666853010654,
-0.028458809480071068,
-0.028480248525738716,
0.026317620649933815,
-0.029788734391331673,
-0.01204670500010252,
0.04772398620843887,
0.04787115380167961,
-0.0220963042229414,
0.029337676241993904,
0.016564931720495224,
-0.04561455547809601,
-0.03... | 0.791623 | 0.764149 | 0.027474 |
You are tasked with creating a SQL query that retrieves data from multiple tables and combines them into a single result set. The tables are named node_0, node_3, node_6, node_8, node_17, node_20, node_78, node_97, node_190, and node_489. Your task is to write a SQL query that selects the id column from the first table... | glaive | [
0.04040772095322609,
0.026046298444271088,
-0.03293947875499725,
-0.03882008418440819,
0.01479108352214098,
-0.00785690825432539,
-0.008243926800787449,
0.03601997345685959,
0.057763393968343735,
0.01029845792800188,
0.020484216511249542,
0.013553846627473831,
-0.021510522812604904,
-0.003... | 0.781368 | 0.760987 | 0.020382 |
You have been tasked with creating a CUDA kernel to generate Bernoulli samples using a specific algorithm. The kernel should generate random numbers and apply a threshold to produce a binary output. The input to the kernel is an array of floating-point numbers, and the output should be an array of binary values, which ... | glaive | [
-0.019481228664517403,
0.043746598064899445,
-0.026524566113948822,
-0.016682658344507217,
0.02557617984712124,
-0.016902873292565346,
-0.028570527210831642,
0.0832197442650795,
0.04301050677895546,
-0.032864004373550415,
0.025745367631316185,
0.05669625476002693,
-0.008483916521072388,
0.... | 0.795792 | 0.776436 | 0.019356 |
You are tasked with implementing the Floyd-Warshall algorithm for finding the shortest paths in a weighted graph. The algorithm works on both directed and undirected graphs and also handles negative edge weights. Your task is to implement the Floyd-Warshall algorithm using CUDA C++, a parallel computing platform and ap... | glaive | [
0.0016627779696136713,
0.029890667647123337,
-0.015615071170032024,
-0.011717735789716244,
0.021208619698882103,
-0.00824111606925726,
-0.027821185067296028,
0.09518291801214218,
0.04552941769361496,
-0.020957037806510925,
0.03379778191447258,
0.026570241898298264,
0.009890449233353138,
-0... | 0.808025 | 0.776861 | 0.031164 |
You are tasked with implementing a function to calculate the binomial transform of a given sequence. The binomial transform of a sequence {a0, a1, a2, ...} is defined as the sequence {b0, b1, b2, ...} where b0 = a0, and for n>0, bn = a(n) - a(n-1). You are given a sequence of numbers and you need to write a program to ... | glaive | [
0.011986183933913708,
0.034247200936079025,
-0.02881537936627865,
-0.02799147553741932,
0.033345770090818405,
-0.01995675452053547,
-0.018551988527178764,
0.060164351016283035,
0.041679497808218,
0.0020634783431887627,
0.016511347144842148,
0.022420870140194893,
-0.03919966146349907,
0.006... | 0.814268 | 0.761088 | 0.053179 |
You are tasked with implementing an A* algorithm to find the shortest path from the top-left corner to the bottom-right corner in a given matrix. The matrix is represented as a 2D grid of numbers, where each number represents the cost of moving through that cell. You need to read the input matrix from the standard inpu... | glaive | [
0.018712418153882027,
0.01990858092904091,
-0.013324171304702759,
-0.03010297194123268,
0.03184926509857178,
-0.016194147989153862,
-0.03523747995495796,
0.06654544174671173,
0.04277642071247101,
-0.01089231576770544,
0.015574704855680466,
0.020428679883480072,
-0.020402219146490097,
0.003... | 0.820822 | 0.771727 | 0.049095 |
You are required to write a CUDA C++ program that processes a lists column and removes any duplicated entries within each list. The lists column contains nested lists, and your task is to drop the duplicate entries within each list while maintaining the original order of the lists.
The program needs to handle various ... | glaive | [
-0.007294529117643833,
0.02411211095750332,
-0.02351614087820053,
-0.024374695494771004,
0.04224663972854614,
-0.007735085673630238,
-0.00824652798473835,
0.10767944902181625,
0.05275101214647293,
-0.034397270530462265,
0.013455073349177837,
0.020608436316251755,
0.01133440900593996,
-0.01... | 0.809558 | 0.784221 | 0.025338 |
You are tasked with creating a moving average NPS (Notes Per Second) calculator for a rhythm game. The calculator should track the number of notes hit within a specified time window and display the current NPS as well as the peak NPS achieved. The window size should be adjustable within a specified range, and the calcu... | glaive | [
0.021890483796596527,
0.03791820630431175,
-0.037355173379182816,
-0.018624508753418922,
0.050968799740076065,
-0.034315403550863266,
-0.03432745113968849,
0.07121878117322922,
0.040396712720394135,
-0.017221730202436447,
0.04460873454809189,
0.022431276738643646,
-0.04520287737250328,
-0.... | 0.806067 | 0.786937 | 0.01913 |
What type of classification problem is this? | glaive | [
0.005927351303398609,
-0.002005694666877389,
-0.02494337223470211,
-0.033785223960876465,
0.037357352674007416,
-0.004103594459593296,
-0.010147955268621445,
0.0516836941242218,
0.02943597361445427,
-0.021520189940929413,
0.00037057738518342376,
0.018534503877162933,
-0.0068586342968046665,
... | 0.774953 | 0.749771 | 0.025182 |
I have a list of names and I need to find the longest name from it. Can you help me with the code to solve this problem? | glaive | [
0.012052014470100403,
0.004966731183230877,
-0.03046805039048195,
-0.03814658150076866,
0.02662317454814911,
-0.04892314597964287,
-0.021105920895934105,
0.023278046399354935,
0.027891933917999268,
-0.024657350033521652,
0.02637522853910923,
0.038894712924957275,
-0.0413503423333168,
-0.01... | 0.805575 | 0.788932 | 0.016643 |
You are tasked with creating a Clojure program that takes in a text file called "input.txt" and processes it to solve the following problem:
You are given a list of numbers in the "input.txt" file. Each number represents a node in a tree structure. The first number is the number of child nodes, the second number is th... | glaive | [
-0.0020163797307759523,
0.022044191136956215,
-0.0357254333794117,
-0.03760593384504318,
0.036519430577754974,
-0.03636517748236656,
0.006332254968583584,
0.04239790886640549,
0.03858238086104393,
-0.018116572871804237,
0.02536001242697239,
0.01540420763194561,
-0.02736959420144558,
-0.011... | 0.815587 | 0.797588 | 0.017998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.