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 given a grid of size `gridl` x `gridw` containing integer values, representing the cost of moving from one cell to another. Your task is to implement a Dijkstra algorithm to find the shortest path from the top-left cell (1,1) to the bottom-right cell (`gridl`,`gridw`). The valid moves from any cell are to the c... | glaive | [
-0.00984357763081789,
0.025729071348905563,
-0.028453702107071877,
-0.03490297123789787,
0.029229076579213142,
-0.033194467425346375,
-0.029561908915638924,
0.06234924867749214,
0.03567246347665787,
-0.023157652467489243,
0.025454135611653328,
0.028170743957161903,
-0.018940860405564308,
-... | 0.826213 | 0.779902 | 0.04631 |
You are tasked with implementing a CUDA kernel for cropping a multi-dimensional array. The goal is to create a function that takes input array 'x', and starting indices 'starts', and dimensions of the output array 'y_dims', and crops 'x' according to the given starting indices and output dimensions. The cropped result ... | glaive | [
-0.003701921785250306,
0.05183057859539986,
-0.02032313123345375,
-0.016494009643793106,
0.028581511229276657,
-0.01815934106707573,
-0.04007476940751076,
0.10408278554677963,
0.051775429397821426,
-0.01849689893424511,
0.015597078949213028,
0.030222183093428612,
-0.016507111489772797,
0.0... | 0.805586 | 0.781462 | 0.024124 |
You are tasked with creating a 7-stage ring oscillator in VHDL using the given code snippet as a reference. The ring oscillator should be designed to use a single slice and the following attributes should be defined:
- SLICE_NUM1: String
- SLICE_NUM2: String
- OSC_SLICE_NUM: String
The entity "Right_RO_Design_File" sh... | glaive | [
0.04524017870426178,
0.04176831245422363,
-0.0181227196007967,
-0.048350945115089417,
0.03063630685210228,
-0.03413509204983711,
-0.027711518108844757,
0.06504470854997635,
0.027797246351838112,
-0.015220625326037407,
0.026019642129540443,
0.03931494802236557,
-0.015569965355098248,
-0.011... | 0.785411 | 0.769221 | 0.01619 |
You are tasked with implementing a CUDA parallel version of the estimation of multidimensional random variable density function using the ridge detection algorithm. Your task is to create a CUDA kernel that simulates the algorithm's brute-force approach to evolve and decimate sample points until a convergence condition... | glaive | [
-0.015272247605025768,
0.04931364580988884,
-0.015538355335593224,
-0.03408816084265709,
0.013104422017931938,
-0.004448534455150366,
-0.03607834503054619,
0.09472642093896866,
0.04416922852396965,
-0.02560730278491974,
0.007470858749002218,
0.032554712146520615,
-0.004443773068487644,
0.0... | 0.806947 | 0.785582 | 0.021365 |
You are required to write a program in CUDA C++ that reads input arguments from the command line and performs certain computations based on those inputs. The program should be able to handle MPI communication and be CUDA-aware.
The program should take 9 command line arguments: SNP0, SNP1, SNP2, ALG, MF, MG, N, and FN.... | glaive | [
0.012904774397611618,
0.022665096446871758,
-0.02640765905380249,
-0.0191932525485754,
0.024780554696917534,
-0.021510006859898567,
-0.03055717796087265,
0.0930035412311554,
0.042741939425468445,
-0.027567539364099503,
0.022025007754564285,
0.048369407653808594,
-0.004401841666549444,
0.00... | 0.794715 | 0.777881 | 0.016833 |
You are tasked with implementing a k-means clustering algorithm from scratch in Mathematica. The algorithm should take a set of data points and cluster them into k clusters. The algorithm should involve the following steps:
1. Initialize k cluster centroids randomly.
2. Assign each data point to the nearest centroid.
3... | glaive | [
0.022283874452114105,
0.025197338312864304,
-0.03794105723500252,
-0.04202515259385109,
0.03755812346935272,
-0.014987054280936718,
-0.010345066897571087,
0.051897358149290085,
0.051972322165966034,
-0.001831780537031591,
0.0074689798057079315,
0.009358047507703304,
-0.019671570509672165,
... | 0.794142 | 0.765076 | 0.029067 |
I have a Python code that is supposed to identify the number with the highest frequency from a sequence of numbers. If there are multiple numbers with the same highest frequency, it should return the number with the highest frequency and the smallest value. Additionally, I need to optimize the solution so that it runs ... | glaive | [
0.016943752765655518,
0.0317913182079792,
-0.05156955122947693,
-0.01563401333987713,
0.023334745317697525,
-0.010460595600306988,
-0.022963890805840492,
0.06859471648931503,
0.006291779689490795,
-0.009636417031288147,
0.0007801236934028566,
0.017494305968284607,
-0.01406390592455864,
0.0... | 0.81687 | 0.779168 | 0.037702 |
You are working on a .NET Core web application using F#. You need to implement a function that can calculate 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 is 5*4*3*2*1 = 120.
Write a function c... | glaive | [
0.014508123509585857,
0.037097714841365814,
-0.014721818268299103,
-0.032703835517168045,
0.04151579737663269,
-0.041899677366018295,
-0.02375619113445282,
0.07783812284469604,
0.045722730457782745,
-0.007279078476130962,
0.008365942165255547,
0.04377805069088936,
-0.04562816023826599,
-0.... | 0.804705 | 0.783839 | 0.020866 |
You are tasked with creating a program that counts the number of (n+1) X (n+1) 0..1 arrays with the number of rightwards and downwards edge increases in each 2 X 2 subblock equal to the number in all its horizontal and vertical neighbors. In other words, you need to create a program that can calculate the specific patt... | glaive | [
0.003103167051449418,
0.02354312315583229,
-0.051626987755298615,
-0.010193441063165665,
0.026290586218237877,
-0.017976708710193634,
-0.04131188243627548,
0.072929747402668,
0.03467695042490959,
-0.00957510620355606,
0.015459098853170872,
0.01566990278661251,
-0.03561186045408249,
-0.0205... | 0.845691 | 0.79755 | 0.048141 |
You are tasked with implementing a CUDA program that calculates depth maps using SIMD SAD (Sum of Absolute Difference) intrinsics. The program should take two input images, compute the stereo disparity, and output the resulting disparity map. The CUDA program should include the necessary headers, kernels, and helper fu... | glaive | [
0.0026126247830688953,
0.030430905520915985,
-0.018875954672694206,
-0.023302139714360237,
0.025438247248530388,
0.0013970034196972847,
-0.02176661230623722,
0.09521079063415527,
0.05000194534659386,
-0.021704209968447685,
0.03868842497467995,
0.02831152081489563,
-0.0024357917718589306,
-... | 0.795419 | 0.77872 | 0.016699 |
You are tasked with implementing a One Permutation Hashing (OPH) algorithm in Rust. The OPH algorithm involves sketching data and then densifying the sketch using either an optimal method or an improved method. The densification process involves filling in empty values in the sketch according to specific rules, either ... | glaive | [
0.018392419442534447,
0.028552716597914696,
-0.011896640993654728,
-0.03274611011147499,
0.015666456893086433,
-0.025934763252735138,
-0.011827646754682064,
0.07038117945194244,
0.028512829914689064,
-0.005861311685293913,
0.0010408313246443868,
0.019470393657684326,
0.004425765015184879,
... | 0.814185 | 0.797331 | 0.016854 |
You are tasked with implementing a function that will try to find the index and item in a list that satisfies a given predicate function. The function should take in the predicate function and a list as input and return an option type containing the index and the item if found, or None if not found.
Write a function c... | glaive | [
0.022905727848410606,
0.03654194623231888,
-0.02896452322602272,
-0.03359115868806839,
0.04588167369365692,
-0.0362204872071743,
-0.026678375899791718,
0.05908055976033211,
0.018136972561478615,
-0.0169252697378397,
0.027812769636511803,
0.029541268944740295,
-0.019862990826368332,
0.00780... | 0.809774 | 0.792839 | 0.016935 |
You are tasked with creating a Python class that represents a simple calculator. The class should have methods for addition, subtraction, multiplication, and division. It should also have a method to clear the calculator's memory.
Create a class named "Calculator" and implement the following methods:
1. `add(self, num... | glaive | [
0.03595275804400444,
0.053645871579647064,
-0.01986869052052498,
-0.03316513076424599,
0.06324439495801926,
-0.04032507911324501,
-0.0054396167397499084,
0.04841277375817299,
0.04327680915594101,
-0.02701185829937458,
0.018304329365491867,
0.037682920694351196,
-0.009607749991118908,
-0.01... | 0.799969 | 0.785048 | 0.01492 |
Can you provide an algorithm for executing a binary search in an array of integers? | glaive | [
0.012747623026371002,
0.031807128340005875,
-0.032390695065259933,
-0.007275060284882784,
0.023709969595074654,
-0.04458312690258026,
-0.0335506908595562,
0.03503391891717911,
0.04096756875514984,
-0.0442408062517643,
0.02308673970401287,
0.016115235164761543,
-0.029670635238289833,
-0.012... | 0.809449 | 0.784889 | 0.024559 |
You are tasked with implementing a function to calculate the formal power series of a continuous linear map `f : E →L[𝕜] F` at a given point `x : E`. The formal power series is defined as `f y = f x + f (y - x)`. Your task is to write a function that takes a continuous linear map `f` and a point `x` as input, and retu... | glaive | [
0.024269480258226395,
0.04960322752594948,
-0.02807115577161312,
-0.06561277061700821,
0.03551366180181503,
-0.04706594720482826,
-0.012417366728186607,
0.06375760585069656,
0.04510287567973137,
-0.019499139860272408,
0.02517772652208805,
0.036264270544052124,
-0.033508654683828354,
-0.005... | 0.808973 | 0.782282 | 0.026691 |
You are tasked with writing a program to calculate the coefficient of x^4 in the expansion of (1+x+x^2)^n. The input will be the value of n, and the output should be the coefficient of x^4 in the expansion. Your program should be able to handle large values of n efficiently. | glaive | [
0.025370800867676735,
0.04335068538784981,
-0.04168423265218735,
-0.028350306674838066,
0.04080132767558098,
-0.029682807624340057,
-0.03394345939159393,
0.0713038519024849,
0.061279475688934326,
-0.010455289855599403,
0.021959438920021057,
0.02187059260904789,
-0.042629677802324295,
-0.02... | 0.820159 | 0.786311 | 0.033848 |
You are tasked with implementing a function that checks if a given filter in a topological space is eventually bounded above and below. You need to write a function that takes a filter and a point in the topological space and returns whether the filter is eventually bounded above and below at that point.
You are provi... | glaive | [
0.017191683873534203,
0.03673577681183815,
-0.009561358019709587,
-0.01734323240816593,
0.025250760838389397,
-0.024334659799933434,
-0.026730544865131378,
0.06450588256120682,
0.030194807797670364,
-0.011155631393194199,
0.011978513561189175,
0.035750582814216614,
-0.012291338294744492,
-... | 0.808374 | 0.779996 | 0.028378 |
You are tasked with creating a program that takes in a list of boolean values and packs them into a bit vector. The program should be able to handle a list of any size and output the corresponding packed bit vector. | glaive | [
0.029377661645412445,
0.029458222910761833,
-0.03298424929380417,
-0.02020171657204628,
0.039736151695251465,
-0.04789653792977333,
-0.02196299284696579,
0.060053370893001556,
0.049134474247694016,
-0.03287450969219208,
0.018445810303092003,
0.056288257241249084,
-0.020271599292755127,
-0.... | 0.807899 | 0.779816 | 0.028083 |
You are tasked with implementing a C++ program that manipulates a 2D array using functions and templates. The program should have functions for reading, writing, accessing, getting value at a specific index, and setting a value at a specific index in the 2D array. Additionally, you need to implement a main function tha... | glaive | [
0.03538890928030014,
0.03505590558052063,
-0.017166871577501297,
-0.03138676658272743,
0.043365105986595154,
-0.03148956596851349,
-0.03886667639017105,
0.09584347158670425,
0.03496275097131729,
-0.00624182028695941,
0.026221489533782005,
0.042665913701057434,
-0.02052919752895832,
-0.0080... | 0.791185 | 0.766261 | 0.024924 |
How can I write a Java program that finds the closest pair of points from a given array of coordinates? The array consists of points like (2, 3), (12, 30), (40, 50), (5, 1), and (12, 10). Can you provide a detailed solution? | glaive | [
0.014538183808326721,
0.034949641674757004,
-0.046678874641656876,
-0.02029046230018139,
0.031103046610951424,
-0.048849403858184814,
-0.023186475038528442,
0.02864959090948105,
0.04353110492229462,
-0.029584873467683792,
0.026011105626821518,
0.030862029641866684,
-0.03084512986242771,
-0... | 0.806536 | 0.782166 | 0.024369 |
Write a program that generates a sequence of positions of primes among the powers of primes (A000961). The program should output the positions of prime numbers among the powers of primes up to a given number n. For example, for n=100, the output should be: 2,3,5,6,9,10,12,13,14,17,18,20,21,22,23,25,26,27,29,30,31,32,34... | glaive | [
0.031581684947013855,
0.02881006710231304,
-0.006194995250552893,
-0.04913679510354996,
0.018981220200657845,
-0.03377354517579079,
-0.026236897334456444,
0.05315059795975685,
0.04291621223092079,
-0.03319917619228363,
0.0330786295235157,
0.034193381667137146,
-0.053894974291324615,
-0.021... | 0.812096 | 0.763889 | 0.048207 |
You have been tasked with implementing a function to compute bounds on the p-value for rank products in R. The function should take in a vector of integers corresponding to the rank products for which one wishes to compute the p-value, the number of molecules, the number of replicates, and a character string indicating... | glaive | [
0.010844136588275433,
0.035048406571149826,
-0.02190699614584446,
-0.014080562628805637,
0.037519365549087524,
-0.019930431619286537,
-0.01896459050476551,
0.04839484393596649,
0.03051074780523777,
0.008273707702755928,
-0.011637993156909943,
0.047488994896411896,
-0.01836402341723442,
-0.... | 0.797044 | 0.762179 | 0.034865 |
You are tasked with optimizing a complex mathematical function using a brute force approach. The function is defined as follows:
$$
function(x, y, x2, y2) = \Re(e^{7i y2} (e^{7i y} ( \cos(x)^7 + (i \sin(x))^7) + e^{3i y} (7(i \sin(x))^1 \cos(x)^6 + 7(i \sin(x))^6 \cos(x)^1 + 7(i \sin(x))^2 \cos(x)^5 + 7(i \sin(x))^5 \... | glaive | [
0.022837450727820396,
0.04922708868980408,
-0.04032120853662491,
-0.044521428644657135,
0.022771179676055908,
-0.0071770003996789455,
-0.03500494733452797,
0.057071320712566376,
0.04633317515254021,
-0.004707052372395992,
0.007013784721493721,
0.028586434200406075,
-0.027384722605347633,
-... | 0.824867 | 0.783277 | 0.041589 |
You are tasked with creating a program that manages a database of people's information. Each person in the database should have a name (String) and a height in centimeters (Int). Your program should allow users to add new people to the database, retrieve a person's information by their name, and calculate the average h... | glaive | [
0.019891146570444107,
0.011099619790911674,
-0.05290698632597923,
-0.0298638716340065,
0.041541341692209244,
-0.05518864840269089,
-0.007344403769820929,
0.022165821865200996,
0.041405580937862396,
-0.02614966407418251,
0.02271234057843685,
0.02613675966858864,
-0.020355872809886932,
0.012... | 0.798769 | 0.780222 | 0.018547 |
You are tasked with implementing a module for working with one-dimensional index sets in a programming language. The module should include the following functionalities:
- Creation of an index set containing the indices 1, 2, ..., size
- Retrieval of the begin index of the set
- Retrieval of the end index of the set
- ... | glaive | [
0.028171304613351822,
0.035844024270772934,
-0.023081310093402863,
-0.029860936105251312,
0.042313024401664734,
-0.02816477231681347,
-0.018211007118225098,
0.05435478687286377,
0.02877415344119072,
-0.02565319836139679,
0.03189510479569435,
0.028490236029028893,
-0.026144273579120636,
-0.... | 0.827882 | 0.802384 | 0.025497 |
You are tasked with writing a C program that initializes and prints a 2D array of integers. The program should contain the following functions:
1. `initializeArrays`: This function initializes the two arrays referenced by the first two parameters for Jacobi iteration. The width and height of the arrays are given by th... | glaive | [
0.02935045398771763,
0.05377892032265663,
-0.019573327153921127,
-0.02510085329413414,
0.03856122866272926,
-0.03811148181557655,
-0.03347431495785713,
0.07444799691438675,
0.03797725588083267,
-0.01054411567747593,
0.027180489152669907,
0.027523428201675415,
-0.039801329374313354,
-0.0228... | 0.800516 | 0.757678 | 0.042838 |
You are tasked with implementing a counting sort algorithm in VBA. Counting sort is an efficient sorting algorithm that sorts an array by counting the number of occurrences of each unique element in the array. The given code snippet provides a VBA function `countingSort` that takes an array of integers, `array_`, along... | glaive | [
0.0063923723064363,
0.016937289386987686,
-0.009521005675196648,
-0.011534061282873154,
0.03250241279602051,
-0.010838200338184834,
-0.031481098383665085,
0.06400371342897415,
0.038770779967308044,
-0.012612715363502502,
0.008545567281544209,
0.025223437696695328,
-0.02818380668759346,
0.0... | 0.810343 | 0.77046 | 0.039883 |
Write a function in the programming language that takes three parameters: a function f, and two integers a and b. The function should calculate the sum of f(b) + f(b-1) + f(b-2) + ... + f(a) and return the result. If a is greater than b, the function should return 0. | glaive | [
0.020718352869153023,
0.028370464220643044,
-0.04720357432961464,
-0.03826938197016716,
0.053061820566654205,
-0.01581326685845852,
-0.027832675725221634,
0.07302708923816681,
0.030706943944096565,
-0.0037676708307117224,
0.021571019664406776,
0.05480954423546791,
-0.05007334426045418,
-0.... | 0.823444 | 0.794852 | 0.028591 |
You are tasked with implementing a program that can perform matrix operations using lists in Haskell. The program should be able to handle matrix addition, matrix multiplication, and transpose of a matrix. You need to write functions to perform these operations on matrices represented as lists in Haskell.
Write a func... | glaive | [
0.032512117177248,
0.013147703371942043,
-0.01271391473710537,
-0.05388648062944412,
0.06276370584964752,
-0.020758887752890587,
-0.004467142280191183,
0.05555114522576332,
0.049835264682769775,
-0.016223078593611717,
0.004011254757642746,
0.04223257303237915,
-0.01678967848420143,
-0.0396... | 0.789378 | 0.774546 | 0.014832 |
You are tasked with implementing a CUDA kernel function to calculate the sum of squares of a given array and then use the results to compute a distance matrix.
Write a CUDA kernel function to accomplish the following tasks:
1. Calculate the sum of squares of each element in an input array and store the results in a se... | glaive | [
-0.0002746921090874821,
0.06675475090742111,
-0.03105902671813965,
-0.028600655496120453,
0.036775823682546616,
0.0012603315990418196,
-0.035511862486600876,
0.08587498962879181,
0.04707096144556999,
-0.013324208557605743,
0.019798200577497482,
0.027328865602612495,
-0.024048294872045517,
... | 0.813266 | 0.780416 | 0.03285 |
Is there a way to find all the prime numbers within a given range using Java? | glaive | [
0.020174236968159676,
0.02248547039926052,
-0.03767929598689079,
-0.03514610975980759,
0.025330742821097374,
-0.05095253884792328,
0.0017539724940434098,
0.021883869543671608,
0.027925634756684303,
-0.04498090595006943,
0.01925661787390709,
0.027773417532444,
-0.03883600980043411,
-0.03103... | 0.786959 | 0.770028 | 0.016931 |
You are tasked with implementing a function that generates a random integer within a given range, but with a distribution that gives more weight to lower values. The function should take in two parameters: min and max, representing the range of the random integer to be generated. The random integer generated should hav... | glaive | [
0.00986578967422247,
0.015385526232421398,
-0.03623311221599579,
-0.021408773958683014,
0.04457801580429077,
-0.014219495467841625,
-0.03647017106413841,
0.06342195719480515,
0.029217462986707687,
-0.004240953829139471,
0.02867713011801243,
0.04885997250676155,
-0.036177702248096466,
-0.00... | 0.802055 | 0.77589 | 0.026165 |
You are tasked with creating a program that takes two inputs, a month (m) and a day (d), and determines the day of the week for that date. The program should calculate the total number of days passed from January 1st to the given date, and then determine the day of the week based on the remainder when dividing the tota... | glaive | [
0.009082434698939323,
0.03306914493441582,
-0.04256230965256691,
-0.03279852494597435,
0.06499136984348297,
-0.0591263473033905,
-0.024676533415913582,
0.06115611642599106,
0.04287325590848923,
-0.02356494404375553,
0.017473116517066956,
0.03440388664603233,
-0.018829574808478355,
-0.01500... | 0.800798 | 0.772412 | 0.028386 |
I need to implement a subroutine that can find the zeros of a real polynomial given its coefficients. The subroutine should be able to handle polynomials of any degree. The algorithm should use single precision calculations for scaling, bounds, and error calculations, while all calculations for the iterations should be... | glaive | [
0.013037125580012798,
0.04116080328822136,
-0.02269556187093258,
-0.034238867461681366,
0.013128810562193394,
-0.0028791383374482393,
-0.007128643337637186,
0.05408916622400284,
0.02661367878317833,
-0.016635039821267128,
0.012302525341510773,
0.02529880218207836,
0.0004786935169249773,
-0... | 0.803698 | 0.786643 | 0.017055 |
You are tasked with creating a program that takes in a list of numbers and returns the sum of all the even numbers in the list.
Create a function called "sumEvenNumbers" that takes in a list of numbers as input and returns the sum of all the even numbers in the list.
For example:
Input: [1, 2, 3, 4, 5, 6]
Output: 12 ... | glaive | [
0.02740519493818283,
0.014888488687574863,
-0.03813448175787926,
-0.051284320652484894,
0.04729042947292328,
-0.01593794673681259,
-0.016955282539129257,
0.030230410397052765,
0.031618304550647736,
-0.020651422441005707,
0.01754903607070446,
0.05594829097390175,
-0.04992147907614708,
-0.02... | 0.804515 | 0.761523 | 0.042992 |
You are tasked with creating a module in Elixir that computes the prime factors for a given positive integer. The prime factors are prime numbers that, when multiplied, give the desired number. Your task is to implement a function that takes a positive integer as input and returns a list of its prime factors, ordered f... | glaive | [
0.045946329832077026,
0.023433459922671318,
-0.011777080595493317,
-0.040599651634693146,
0.031235897913575172,
-0.04055945947766304,
-0.01685974933207035,
0.037858083844184875,
0.04757854714989662,
-0.0094436164945364,
0.02439710684120655,
0.038112152367830276,
-0.04328346624970436,
-0.02... | 0.808663 | 0.791655 | 0.017008 |
You are tasked with creating a program that generates a sequence based on the smallest prime factor of a given number raised to the power of 3. The sequence should start from 1 and continue indefinitely, generating the cube of the smallest prime factor for each subsequent number. For example, the first few elements of ... | glaive | [
0.020772894844412804,
0.04839884489774704,
-0.017467286437749863,
-0.03028496913611889,
0.03165344521403313,
-0.02395075187087059,
-0.02521861530840397,
0.08996415138244629,
0.04102465510368347,
-0.03054630383849144,
0.02753833867609501,
0.03647597134113312,
-0.035765551030635834,
-0.01328... | 0.822874 | 0.783779 | 0.039095 |
You are given two arrays, A and B, both with 9 columns. Additionally, you have a grouping variable, GRP. You need to sum the values of the B array columns based on the corresponding non-zero values in the A array, and do so for each group specified by the GRP variable. If the value in the A array is 1, then you need to... | glaive | [
-0.0146078085526824,
0.016908792778849602,
-0.04540255665779114,
-0.04581211879849434,
0.03431867063045502,
-0.026163848116993904,
-0.015489918179810047,
0.0699087530374527,
0.055165719240903854,
-0.012938810512423515,
0.013450207188725471,
0.03395574539899826,
-0.02639620378613472,
-0.004... | 0.808636 | 0.781945 | 0.026691 |
You are tasked with creating a function that will take an input string and return the truncated version of the string. The truncation will be based on a specified length. If the length of the input string is greater than the specified length, then the function should return the first n characters of the string. Otherwi... | glaive | [
0.012546943500638008,
0.031025737524032593,
-0.008070698007941246,
-0.040452755987644196,
0.0416485033929348,
-0.04526287317276001,
-0.007405508309602737,
0.04712507128715515,
0.04648967832326889,
-0.0023893897887319326,
0.01642569899559021,
0.019987991079688072,
-0.04498497396707535,
-0.0... | 0.791519 | 0.761597 | 0.029923 |
You are tasked with writing a program that calculates the number of n X 3 arrays with the following conditions:
- No element in the array can be equal to any value at offset (-1,-2), (-2,-1), (0,-1), or (-1,0)
- New values are introduced in order 0, 1, and 2
Write a function or program that takes an integer n as input... | glaive | [
0.012627243995666504,
0.013391389511525631,
-0.05675812438130379,
-0.01658524200320244,
0.03960176184773445,
-0.014583813957870007,
-0.041553668677806854,
0.05665642023086548,
0.01646627113223076,
-0.01795506291091442,
0.017060846090316772,
0.03346278518438339,
-0.0537785105407238,
-0.0405... | 0.847845 | 0.794616 | 0.053229 |
You are tasked with creating a program that reads input data from a file and processes it according to the following format:
- The file contains a series of lines, each representing a set of coordinates and values.
- Each line contains either 5 numbers or 17 numbers, separated by spaces.
- Lines with 5 numbers represe... | glaive | [
-0.0024651437997817993,
0.03476819396018982,
-0.03560994938015938,
-0.03900335356593132,
0.03772931918501854,
-0.032605040818452835,
-0.0132825318723917,
0.058057207614183426,
0.04441363736987114,
-0.03143152967095375,
0.02997548319399357,
0.04183920472860336,
0.0024900571443140507,
-0.016... | 0.816474 | 0.78671 | 0.029764 |
I am trying to estimate the number of infections in different countries over a period of time, taking into account various factors such as population, age, and reported deaths. I have data on the number of initial days for which to estimate infections, the days of observed data for each country, the days of observed da... | glaive | [
0.018032824620604515,
0.006502280477434397,
-0.056614577770233154,
-0.04524959996342659,
0.035349007695913315,
-0.014490783214569092,
-0.03142700344324112,
0.05214153975248337,
0.03570208325982094,
-0.019797414541244507,
0.010357070714235306,
0.06550240516662598,
-0.016951484605669975,
0.0... | 0.780327 | 0.763571 | 0.016756 |
You are tasked with creating a program in Visual Basic that implements the following logic:
- Define a function f1 that takes three integer parameters (i, j, k) and returns a boolean value based on the expression (k - i) > (j - i).
- Define a function f2 that takes two integer parameters (l, m) and returns a boolean v... | glaive | [
0.018520891666412354,
0.017199682071805,
-0.045736316591501236,
-0.03432145342230797,
0.05369275063276291,
-0.03913132846355438,
0.0008376208716072142,
0.08640213310718536,
0.040707096457481384,
-0.020385894924402237,
0.029371658340096474,
0.04522881656885147,
-0.04879560321569443,
-0.0239... | 0.813707 | 0.796418 | 0.017289 |
You are tasked with writing a program to calculate the complement of the positions of 0 in a given sequence. The sequence is not explicitly provided but is denoted as A287725. The algorithm to calculate the complement is to find the positions of 0 in the given sequence and then subtract each position from the total len... | glaive | [
0.00864974781870842,
0.03300090879201889,
-0.012845177203416824,
-0.023119069635868073,
0.0425807349383831,
-0.04135426506400108,
-0.010649498552083969,
0.07053998857736588,
0.0403236486017704,
-0.029481345787644386,
0.022136760875582695,
0.015053381212055683,
-0.04103688523173332,
-0.0047... | 0.822673 | 0.791804 | 0.030869 |
You are tasked with creating a lag/lead (shift) function for univariate and multivariate series in R. The function should take in a vector or a matrix, a shift parameter, and a fill value, and return a lag/lead variable or matrix based on the shift parameter. For the univariate series, the function should shift the ele... | glaive | [
-0.002288032090291381,
0.0402015782892704,
-0.02859390527009964,
-0.04646499082446098,
0.043134916573762894,
-0.009940475225448608,
-0.03433048352599144,
0.07857950031757355,
0.024221302941441536,
-0.012644275091588497,
0.005925513803958893,
0.035902075469493866,
-0.034142859280109406,
0.0... | 0.789758 | 0.769978 | 0.01978 |
You are tasked with creating a module in Elixir that calculates the total number of hours worked by an employee within a given time period. The module should include a function called calculate_total_hours that takes in a list of tuples, where each tuple represents the start and end times of a work shift. The start and... | glaive | [
0.016141818836331367,
0.022649001330137253,
-0.01701245829463005,
-0.037510357797145844,
0.023754552006721497,
-0.022364700213074684,
-0.03605340048670769,
0.03451051190495491,
0.03630242869257927,
-0.004377697128802538,
0.03946492820978165,
0.029877029359340668,
-0.023243030533194542,
-0.... | 0.794563 | 0.771825 | 0.022738 |
How can I develop an array of digits within the interval of [0, 10), where each individual number is divisible by 3? | glaive | [
0.018980523571372032,
0.01604052633047104,
-0.0425809770822525,
-0.03165173530578613,
0.04409196227788925,
-0.04832646623253822,
-0.028804631903767586,
0.05229724571108818,
0.01708729937672615,
-0.03118019364774227,
0.030762046575546265,
0.0341670997440815,
-0.0639367327094078,
-0.02040772... | 0.809324 | 0.784988 | 0.024336 |
You are tasked with creating a Java program that manages answer forms for students. The program should include classes for Authority, Instructor, Student, AnswerForm, AnswerSection, Article, ArticleText, Section, Classroom, and Comment. Each class has specific attributes and methods, and relationships with other classe... | glaive | [
0.003945567645132542,
-0.0007960324874147773,
-0.04314340278506279,
-0.04077935963869095,
0.0316297709941864,
-0.04803589731454849,
0.002775890752673149,
0.03749464079737663,
0.03170548379421234,
-0.032615747302770615,
0.037177201360464096,
0.04424463212490082,
-0.023451784625649452,
0.008... | 0.789242 | 0.774338 | 0.014904 |
You are required to implement a function in Fortran that finds the index of the element in an array with the maximum absolute value. The function should have the following signature:
```fortran
INTEGER FUNCTION ISAMAX(N,SX,INCX)
INTEGER INCX,N
REAL SX(*)
```
Where `N` is the number of elements in the array `SX`, ... | glaive | [
0.038335930556058884,
0.039211247116327286,
-0.02086464688181877,
-0.03147806227207184,
0.020217621698975563,
-0.024203479290008545,
-0.016201473772525787,
0.06637515127658844,
0.02739504911005497,
-0.01191488467156887,
0.03216462954878807,
0.03575090691447258,
-0.024497684091329575,
-0.00... | 0.820838 | 0.78394 | 0.036897 |
I am trying to design an algorithm that can find the longest common sub-sequence between two strings. Can someone help me with this? | glaive | [
0.0039097610861063,
0.00876867026090622,
-0.03485803306102753,
-0.031023388728499413,
0.02608846127986908,
-0.03137560188770294,
-0.0213836170732975,
0.03971831873059273,
0.018542582169175148,
-0.0333733856678009,
0.01681821048259735,
0.011509610339999199,
-0.030455034226179123,
-0.0186444... | 0.806321 | 0.786686 | 0.019634 |
You are tasked with implementing a program that utilizes the `lkj_cov_log` function to calculate the log probability density function of the LKJ distribution. The program should take in various inputs such as integers, real numbers, matrices, vectors, and row vectors to compute the transformed data and parameters. Your... | glaive | [
-0.0028340735007077456,
0.03535198047757149,
-0.04134344309568405,
-0.022530782967805862,
0.03652135282754898,
-0.009266473352909088,
-0.017980966717004776,
0.04598202928900719,
0.03768393024802208,
-0.00907597690820694,
0.019290415570139885,
0.05012435466051102,
-0.024937091395258904,
0.0... | 0.79703 | 0.781015 | 0.016015 |
You are tasked with creating a subroutine in Fortran that initializes a 2D array to all zeros. The subroutine should take in four parameters: p, n, in, and msq. The array msq should be of size (-nf:nf,-nf:nf), while p and n should be of size (mxpart,4) and (4) respectively. The parameter in is an integer. The subroutin... | glaive | [
0.024152124300599098,
0.021798748522996902,
-0.025959746912121773,
-0.040045350790023804,
0.045839063823223114,
-0.016557153314352036,
-0.0006285802810452878,
0.0576896034181118,
0.04267265275120735,
-0.011844633147120476,
0.009703757241368294,
0.034236032515764236,
-0.014163468033075333,
... | 0.81357 | 0.785716 | 0.027854 |
You are tasked with creating a program that simulates a simple mathematical model. The model is described by the following equations:
N_0 = 100
y_0 = 10
N = 1000
y = 200
cc = 1
dd = 1
nu = 1
eta = 1
The model is defined by the following equations:
N(t) = N_0 + cc*t
y(t) = y_0 + dd*t
N(t+1) = N(t) + nu*N(t) - eta*y(t)... | glaive | [
0.019476842135190964,
0.015143589116632938,
-0.03620875999331474,
-0.04404705762863159,
0.04099191725254059,
-0.04024741053581238,
-0.05185529217123985,
0.08461635559797287,
0.045366279780864716,
-0.03196108341217041,
0.011995968408882618,
0.0476059652864933,
-0.0396839901804924,
-0.008332... | 0.812449 | 0.783311 | 0.029137 |
You are tasked with creating a function that takes in an array of numbers and returns the sum of all the even numbers in the array. The function should be named "calculateEvenSum" and should be implemented in the Hack programming language. | glaive | [
0.02872946672141552,
0.025116849690675735,
-0.030285274609923363,
-0.052470240741968155,
0.0419587641954422,
-0.021571386605501175,
-0.018066098913550377,
0.04987334460020065,
0.03193369880318642,
-0.024480849504470825,
0.012630787678062916,
0.04302159696817398,
-0.04273131117224693,
-0.02... | 0.811323 | 0.777793 | 0.03353 |
You are asked to write a Python program that calculates the sum of all the even numbers in a given list. The program should take a list of integers as input and return the sum of all the even numbers in the list.
For example, given the input:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
The program should output:
30
Write a Pytho... | glaive | [
0.015476085245609283,
0.016633756458759308,
-0.03606581687927246,
-0.06210450455546379,
0.043758247047662735,
-0.02525012567639351,
-0.019217800348997116,
0.022469745948910713,
0.03725568577647209,
-0.02781585045158863,
0.01699894107878208,
0.053991515189409256,
-0.04829039424657822,
-0.01... | 0.806688 | 0.76745 | 0.039239 |
Is there a way to compare two strings and count the number of common characters they have? | glaive | [
0.014216211624443531,
0.010141917504370213,
-0.03973513841629028,
-0.04275420680642128,
0.039282698184251785,
-0.047647811472415924,
0.005405498202890158,
0.034756869077682495,
0.02212238311767578,
-0.040764015167951584,
0.008030115626752377,
0.02374616637825966,
-0.03003653697669506,
-0.0... | 0.79125 | 0.774834 | 0.016416 |
You are tasked with implementing a CUDA kernel for calculating the harmonic angle forces on a GPU. Given a set of particles, their positions, box dimensions for periodic boundary condition handling, and parameters for the angle force, you need to compute the forces and virials for each particle based on the harmonic an... | glaive | [
0.016710937023162842,
0.05075361207127571,
-0.02603723667562008,
-0.022468356415629387,
0.018173949792981148,
-0.013552520424127579,
-0.01371387206017971,
0.06868289411067963,
0.05026612430810928,
-0.016436301171779633,
0.030755924060940742,
0.04156290739774704,
-0.012155983597040176,
-0.0... | 0.793065 | 0.777617 | 0.015448 |
You are tasked with implementing a random number generator function in Fortran. The function should generate random numbers using the algorithm provided below. The function should take an integer parameter `idum` and return a real*8 value as the random number.
The random number generator algorithm is as follows:
```f... | glaive | [
0.013618006370961666,
0.026596589013934135,
-0.020098881796002388,
-0.05224821716547012,
0.028737489134073257,
-0.024031883105635643,
-0.019807711243629456,
0.05933307856321335,
0.034151315689086914,
-0.0006699622608721256,
0.01938842423260212,
0.04198848828673363,
-0.03779255598783493,
-0... | 0.800461 | 0.772622 | 0.027839 |
What is the problem with the given algorithm for calculating Fibonacci numbers? | glaive | [
0.023939121514558792,
0.01550830714404583,
-0.030725572258234024,
-0.021806305274367332,
0.041176363825798035,
-0.010577999986708164,
-0.019720539450645447,
0.0711599588394165,
0.0212161373347044,
-0.025231605395674706,
0.011494508013129234,
0.029422970488667488,
-0.03528977930545807,
-0.0... | 0.794483 | 0.773285 | 0.021198 |
I need to write a program that can calculate the number of occurrences of a specific element in an array. Can you help me with this? | glaive | [
0.015279525890946388,
0.02439432218670845,
-0.04394584894180298,
-0.029115086421370506,
0.043861594051122665,
-0.04595646262168884,
-0.034613627940416336,
0.055748939514160156,
0.042410608381032944,
-0.035927437245845795,
0.015740059316158295,
0.004285481758415699,
-0.03819268196821213,
-0... | 0.799659 | 0.781403 | 0.018256 |
You are tasked with writing an assembly language program to store specific data in memory and perform bitwise operations on it. You will be given a memory address `0xe0000000` and the following data to store:
- Store the hexadecimal value `0x4142434445464748` at the memory address `0xe0000008`
- Store the hexadecimal v... | glaive | [
0.035554684698581696,
0.018823767080903053,
-0.01719365082681179,
-0.02604612149298191,
0.02246413752436638,
-0.050180062651634216,
-0.02126920223236084,
0.08166064321994781,
0.05508001521229744,
-0.014997733756899834,
0.025862758979201317,
0.024012021720409393,
-0.02967064082622528,
-0.02... | 0.801937 | 0.779421 | 0.022516 |
You are tasked with implementing a piecewise function in the programming language of your choice. The function needs to take a parameter Q and return different outputs based on the value of the input.
The function should follow the logic below:
- If br89_y(Q) is less than or equal to 0, the output should be calculated... | glaive | [
-0.00012675111065618694,
0.027685724198818207,
-0.028700176626443863,
-0.02776510640978813,
0.03563735634088516,
-0.032770562916994095,
-0.02315959334373474,
0.07039781659841537,
0.03840102255344391,
0.004805461503565311,
0.03617265447974205,
0.04870740696787834,
-0.03408025950193405,
0.00... | 0.820613 | 0.793502 | 0.027111 |
:
You are tasked with implementing a CUDA kernel for a sequence topk average pooling operation in the PaddlePaddle deep learning framework. The kernel is responsible for processing input data and performing a topk average pooling operation based on specific parameters.
The kernel should take input data, input row and ... | glaive | [
0.020409997552633286,
0.03755854442715645,
-0.01969194784760475,
-0.01818639412522316,
0.02523517608642578,
-0.015807637944817543,
-0.02678888849914074,
0.07353876531124115,
0.03437917307019234,
-0.013601137325167656,
0.03227448835968971,
0.015665603801608086,
-0.010948613286018372,
0.0143... | 0.815174 | 0.797048 | 0.018125 |
You are working on a payroll system and need to add time entries for multiple employees on a specific date. Write a SQL query to execute the stored procedure `p_add_time_entry` for each employee, providing their employee ID, the entry date, and the hours worked. You need to add time entries for the following employees ... | glaive | [
0.04061320051550865,
0.01663043536245823,
-0.034159354865550995,
-0.018482686951756477,
0.03183811157941818,
-0.03213787078857422,
-0.002154088346287608,
0.04934195056557655,
0.05836072936654091,
-0.0005476777441799641,
0.04630737379193306,
0.025375714525580406,
-0.0077894749119877815,
-0.... | 0.782576 | 0.763733 | 0.018843 |
You are tasked with implementing the DrawIndexedPrimitive function for the Microsoft Direct3D runtime. This function is responsible for drawing indexed primitives on a display device (graphics context). The function takes a handle to the display device and a pointer to a D3DDDIARG_DRAWINDEXEDPRIMITIVE structure that de... | glaive | [
0.0022964400704950094,
0.0363636240363121,
-0.009158442728221416,
-0.03513563424348831,
0.03147806227207184,
-0.02563631907105446,
-0.013850550167262554,
0.07519220560789108,
0.0471343956887722,
-0.006561938673257828,
0.03847852721810341,
0.029461821541190147,
-0.006457009352743626,
-0.015... | 0.809365 | 0.791677 | 0.017688 |
You are tasked with creating a program to find the maximum probability of a quantum state based on a given set of amplitudes. The program should be able to calculate the probability using the provided amplitude function and then use the NMaximize function to find the maximum probability within a specified range. Finall... | glaive | [
0.011893359012901783,
0.02691342867910862,
-0.031084612011909485,
-0.024179480969905853,
0.04484350606799126,
-0.021957023069262505,
-0.02116079442203045,
0.07245809584856033,
0.03543752804398537,
-0.0024508165661245584,
0.024772770702838898,
0.03748881816864014,
-0.016052745282649994,
-0.... | 0.802852 | 0.777768 | 0.025084 |
You are tasked with creating a program that calculates the distance between two points on a 2D plane using the Pythagorean theorem. Your program should take in the coordinates of two points as input and output the distance between them.
Write a function called `calculateDistance` that takes in four parameters: `x1`, `... | glaive | [
-0.00008380937651963905,
0.04402126744389534,
-0.03468906879425049,
-0.04548311233520508,
0.04354105144739151,
-0.021870138123631477,
-0.04232735186815262,
0.043631721287965775,
0.06728415936231613,
-0.016028253361582756,
0.01180146262049675,
0.04303043708205223,
-0.028629081323742867,
0.0... | 0.803682 | 0.767695 | 0.035987 |
You are tasked with implementing a function in Scheme that takes a string as input and converts it to a number. The input string may represent a positive or negative integer, a decimal number, or a floating point number. The function should handle both integer and floating point numbers, and should also consider the pr... | glaive | [
0.03476428613066673,
0.02614457532763481,
-0.017177382484078407,
-0.051257479935884476,
0.041999492794275284,
-0.059193458408117294,
-0.016667747870087624,
0.04354497790336609,
0.023378809913992882,
0.0028237421065568924,
0.0363692082464695,
0.04938620328903198,
-0.01582704856991768,
0.006... | 0.799775 | 0.783686 | 0.016089 |
You are tasked with creating a Verilog module that calculates the hypotenuse of a right-angled triangle using the given catheti. The formula to calculate the hypotenuse is √(a^2 + b^2). Your module should take two input parameters, representing the lengths of the catheti, and output the calculated hypotenuse.
Write a ... | glaive | [
0.013300253078341484,
0.04328380152583122,
-0.027632569894194603,
-0.033229682594537735,
0.025791343301534653,
-0.026724010705947876,
-0.03002421371638775,
0.0779544785618782,
0.05370252951979637,
-0.01750386878848076,
0.029609574005007744,
0.04914918914437294,
-0.0065141101367771626,
-0.0... | 0.803741 | 0.783965 | 0.019776 |
You are tasked with implementing a spatial fractional max pooling function in CUDA for a neural network library. The function should take as input a tensor, and perform fractional max pooling on it, generating an output tensor and indices of the maximum values. The function should also have the capability to update the... | glaive | [
0.008294780738651752,
0.038414567708969116,
-0.011624597944319248,
-0.014210885390639305,
0.03523780405521393,
-0.018465951085090637,
-0.02732328698039055,
0.0746307298541069,
0.05726929381489754,
-0.013971425592899323,
0.0374135859310627,
0.020548798143863678,
-0.004101708997040987,
-0.00... | 0.807344 | 0.788805 | 0.018539 |
You are tasked with implementing a set of mathematical operations in a programming environment using the given syntax and functions. The operations include addition, subtraction, multiplication, division, finding the maximum, minimum, absolute value, floating point conversion, integer conversion, inverse trigonometric ... | glaive | [
0.04330411180853844,
0.03242868185043335,
-0.035398416221141815,
-0.030414002016186714,
0.044630032032728195,
-0.011576658114790916,
-0.017994606867432594,
0.0488140769302845,
0.05389798432588577,
-0.009820734150707722,
0.01011905912309885,
0.030670655891299248,
-0.008704452775418758,
-0.0... | 0.796603 | 0.774912 | 0.021692 |
You are tasked with implementing a program that calculates the largest integer less than or equal to a given number which is coprime to a specific sequence of numbers. The sequence of numbers is defined by the following algorithm:
1. Start with the number 1.
2. For each subsequent number, calculate the difference betwe... | glaive | [
0.03305380791425705,
0.031664811074733734,
-0.018192041665315628,
-0.03936578333377838,
0.01905357837677002,
-0.013571584597229958,
-0.00949510931968689,
0.08498119562864304,
0.030837005004286766,
-0.020418668165802956,
0.03392426669597626,
0.016944866627454758,
-0.04277578368782997,
0.005... | 0.837279 | 0.782187 | 0.055092 |
You are tasked with creating a program to calculate the probability amplitudes and probabilities for a quantum system with a given number of qubits. The amplitudes are calculated using the following formula:
amplitude[x_,y_] := (big long complex expression)/Sqrt[2^nqubits]
Where nqubits is the number of qubits in the... | glaive | [
0.007565018255263567,
0.03072347678244114,
-0.036297090351581573,
-0.019434338435530663,
0.042323339730501175,
-0.03770386800169945,
-0.023783912882208824,
0.06229952350258827,
0.03197062388062477,
-0.008382235653698444,
0.0310110691934824,
0.03613031283020973,
-0.01340967696160078,
-0.019... | 0.804589 | 0.770693 | 0.033896 |
You are tasked with creating a module for handling matrices in a programming language. The matrix module should have the following functionality:
- Create a new matrix with a fixed number of rows and columns, and a default value for missing elements.
- Retrieve the default term for the missing values in the matrix.
- R... | glaive | [
0.03129588067531586,
0.020517583936452866,
-0.036223821341991425,
-0.038219157606363297,
0.060855597257614136,
-0.05000767111778259,
-0.007756270468235016,
0.04023592174053192,
0.04057744890451431,
-0.028370101004838943,
0.007824661210179329,
0.027377033606171608,
-0.028295159339904785,
-0... | 0.806921 | 0.78509 | 0.021831 |
You are required to write a program that calculates the maximum value of a given function and then plots a 3D graph of the function. The function is defined as follows:
\[function[x, y] := \sum_{i=1}^{15} Exp[-(4i-1)I y] \left(\sum_{j=1}^{15} a_{ij} (I Sin[x])^{2j-1} Cos[x]^{2(16-j)}\right)\]
Here, \((a_{ij})\) are def... | glaive | [
0.01822679489850998,
0.03555911034345627,
-0.04825150594115257,
-0.032564498484134674,
0.05080670118331909,
-0.015259744599461555,
-0.032168254256248474,
0.055353932082653046,
0.04473985731601715,
0.0038349339738488197,
0.04596801847219467,
0.05179322883486748,
-0.02932177297770977,
-0.004... | 0.79713 | 0.766357 | 0.030773 |
You are tasked with implementing a ray tracing algorithm to find the closest intersection of a ray with a scene containing entities such as spheres and triangle meshes. The algorithm involves traversing an octree to efficiently search for intersecting triangles. The ray tracing algorithm needs to handle entities with s... | glaive | [
0.04313467815518379,
0.039346642792224884,
-0.01174916885793209,
-0.01625438965857029,
0.027697036042809486,
-0.019906139001250267,
-0.033321112394332886,
0.05206240341067314,
0.0463450662791729,
-0.01571814902126789,
0.03645528852939606,
0.020928069949150085,
0.008796916343271732,
-0.0062... | 0.786076 | 0.760098 | 0.025979 |
You are tasked with creating a Common Lisp function that calculates the difference between the sum of squares and the square of the sum of the first n natural numbers.
Write a function called solution that takes an integer n as input and returns the difference between the sum of the squares of the first n natural numb... | glaive | [
0.021869439631700516,
0.030000656843185425,
-0.03395772725343704,
-0.05535030737519264,
0.048231225460767746,
-0.026035863906145096,
-0.0210427138954401,
0.06230354309082031,
0.05114779621362686,
-0.006736660376191139,
0.04425828903913498,
0.024712249636650085,
-0.05784744396805763,
-0.025... | 0.820391 | 0.787273 | 0.033118 |
You are tasked with implementing a function called cvt_uid that takes an input index and performs a specific operation based on the value of the index. If the index is less than 19, the output should be the same as the input. If the index is between 19 and 31, the output should be the input plus 2. For any index greate... | glaive | [
-0.0074785808101296425,
0.02843150869011879,
-0.03732551261782646,
-0.0061677913181483746,
0.036837127059698105,
-0.03252902999520302,
-0.030430147424340248,
0.081050343811512,
0.03786005079746246,
-0.015875311568379402,
0.04121803492307663,
0.03404891490936279,
-0.025558289140462875,
0.00... | 0.8202 | 0.801031 | 0.01917 |
You are tasked with implementing a function in Scheme that calculates the sum of a given list of numbers, but with a twist. The twist is that the sum should only include the numbers that are not divisible by 3. The function should take in a list of numbers and return the sum of all non-divisible by 3 numbers in the lis... | glaive | [
0.025254447013139725,
0.01518890168517828,
-0.03418496623635292,
-0.03273758664727211,
0.06542631983757019,
-0.02413780242204666,
-0.016673529520630836,
0.0370621457695961,
0.02616543136537075,
0.0016263937577605247,
0.02502097189426422,
0.04995797574520111,
-0.046201832592487335,
-0.01590... | 0.817864 | 0.793419 | 0.024445 |
You are tasked with creating a Clojure function to classify the symmetry of a given matrix. The function should take a matrix as input and return one of the following classifications:
- :perfect if the matrix exhibits both vertical and horizontal symmetry
- :vertical if the matrix exhibits only vertical symmetry
- :hor... | glaive | [
0.03208504989743233,
0.02479761280119419,
-0.01852310635149479,
-0.054169151932001114,
0.037996724247932434,
-0.029472924768924713,
-0.009667345322668552,
0.05542348697781563,
0.03925289213657379,
-0.015370966866612434,
0.013084710575640202,
0.019697105512022972,
-0.008742113597691059,
-0.... | 0.797517 | 0.757057 | 0.04046 |
You are tasked with creating a program that calculates the probability of a quantum state. The program should take into account the number of qubits, the name of the state, and the number of states. The program should use the given amplitude function to calculate the probability and then use NMaximize to find the maxim... | glaive | [
-0.000336008844897151,
0.031233113259077072,
-0.03363567963242531,
-0.01941201090812683,
0.044623374938964844,
-0.017945315688848495,
-0.019207624718546867,
0.0787656158208847,
0.02816208451986313,
0.0001828466629376635,
0.02744945138692856,
0.03868560120463371,
-0.01974053680896759,
-0.01... | 0.793289 | 0.765512 | 0.027777 |
I have an array of numbers and I need to find the two largest numbers in it. Can someone help me generate an algorithm to solve this problem? | glaive | [
0.03155963867902756,
0.018154814839363098,
-0.03612926974892616,
-0.02929849736392498,
0.02964230254292488,
-0.02409009449183941,
-0.025228925049304962,
0.05499456450343132,
0.026945393532514572,
-0.028799405321478844,
0.03076053410768509,
0.023310275748372078,
-0.04323713853955269,
-0.015... | 0.812194 | 0.778758 | 0.033436 |
You are tasked with processing a dataset containing five columns: X, Y, TStamp, Pres., and EndPts. The dataset has a size of 173. Your goal is to write a program that reads this dataset and performs the following operations:
1. Calculate the average value of the X, Y, TStamp, and Pres. columns.
2. Identify the maximum ... | glaive | [
0.005401058122515678,
0.010572047904133797,
-0.049934085458517075,
-0.051911696791648865,
0.04670490324497223,
-0.0507451631128788,
-0.03318847715854645,
0.07049582153558731,
0.04550543427467346,
-0.011553216725587845,
0.02949322760105133,
0.02172178402543068,
-0.03133738785982132,
0.00935... | 0.810823 | 0.790006 | 0.020817 |
You are tasked with implementing finite difference methods on a grid for a given set of functions. The specific task is to create functions for setting derivative parameters and computing derivatives and laplacians using the finite difference methods.
You need to create functions for setting 1st, 2nd, 3rd, and 4th der... | glaive | [
0.014550511725246906,
0.032007765024900436,
-0.025725796818733215,
-0.04288068413734436,
0.05014955252408981,
-0.03204282000660896,
-0.028470849618315697,
0.058781079947948456,
0.04286228120326996,
-0.010997151955962181,
0.027368394657969475,
0.04468100145459175,
-0.022003712132573128,
0.0... | 0.801602 | 0.785127 | 0.016475 |
You are tasked with creating a function that performs a binary search for a range of values within a sorted slice. The function should take in three parameters: a reference to a slice of values, a range of values to search for, and a closure that defines the comparison logic. The closure should take in two parameters (... | glaive | [
-0.003499516285955906,
0.03698346018791199,
-0.0442483127117157,
-0.008903576992452145,
0.03727112337946892,
-0.025973189622163773,
-0.04114093258976936,
0.05387004837393761,
0.03651620075106621,
-0.005238343961536884,
0.02827710658311844,
0.02546944096684456,
-0.02559518627822399,
0.00994... | 0.831319 | 0.801074 | 0.030245 |
Can you provide an algorithm to traverse a binary tree in postorder? | glaive | [
0.0037564877420663834,
0.015572825446724892,
-0.012038198299705982,
-0.04100469872355461,
0.01392830815166235,
-0.03765753284096718,
-0.0057635740377008915,
0.02989884279668331,
0.01953117735683918,
-0.032132718712091446,
0.03173569217324257,
0.023501642048358917,
-0.027891403064131737,
0.... | 0.803181 | 0.787242 | 0.015938 |
You are tasked with creating a program that calculates the "safadeza" and "anjo" percentages based on a person's date of birth. The "safadeza" percentage is calculated by adding all the month's digits of the person's date of birth and multiplying by two. Then, the result is added to the day of the month and multiplied ... | glaive | [
0.02114563062787056,
0.02184370905160904,
-0.055030353367328644,
-0.05155405029654503,
0.027854574844241142,
-0.04960361868143082,
-0.015085587278008461,
0.09369949251413345,
0.03480180725455284,
-0.001221678452566266,
0.015263041481375694,
0.029626354575157166,
-0.05246232822537422,
0.013... | 0.78751 | 0.765318 | 0.022192 |
You are tasked with creating a Thrift service that calculates the nth number in the Fibonacci sequence. The input parameter for the function should be a byte representing the value of n. The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the two preceding ones. Your task is to implemen... | glaive | [
0.014140005223453045,
0.023576674982905388,
-0.01373014785349369,
-0.030482688918709755,
0.04679303243756294,
-0.03299803286790848,
-0.013003257103264332,
0.06432128697633743,
0.03138675540685654,
-0.005351442378014326,
0.02585485205054283,
0.026147296652197838,
-0.03574836254119873,
-0.01... | 0.819091 | 0.798032 | 0.021059 |
You are tasked with implementing a function that takes a list of `TryOption` instances and returns a new `TryOption` instance containing a list of the successful values from the input list. If any of the input `TryOption` instances is a failure, the output should also be a failure.
Write a function `Sequence` that tak... | glaive | [
0.02272220328450203,
0.03896774724125862,
-0.020444322377443314,
-0.0398046039044857,
0.04202471300959587,
-0.012373200617730618,
-0.019290411844849586,
0.09283959120512009,
0.031916819512844086,
-0.014958575367927551,
0.032468024641275406,
0.020736100152134895,
-0.01843670755624771,
-0.00... | 0.819884 | 0.798602 | 0.021282 |
You are tasked with implementing a function that reads in TPTP (Thousands of Problems for Theorem Provers) problems and maps first-order formulas to HOL (Higher-Order Logic) terms. The TPTP format is a common way of representing first-order logic problems for use with automated theorem provers.
Your function should ta... | glaive | [
0.039247751235961914,
0.020231839269399643,
-0.012861046940088272,
-0.03821015730500221,
0.028048256412148476,
-0.039756935089826584,
-0.015830712392926216,
0.06550615280866623,
0.027485279366374016,
-0.018931780010461807,
0.0011736535234376788,
0.02054331824183464,
-0.021890046074986458,
... | 0.810717 | 0.795065 | 0.015652 |
You are given a list of integers representing a sequence of changes in frequency. Each integer represents a change in frequency, and the goal is to find the resulting frequency after all the changes are applied.
Write a function that takes in a list of integers and returns the resulting frequency after applying all th... | glaive | [
0.03314976021647453,
0.030779842287302017,
-0.03907443955540657,
-0.03945549950003624,
0.03738199546933174,
-0.028348593041300774,
-0.02476021833717823,
0.058602962642908096,
0.01628781668841839,
-0.010864333249628544,
0.018540378659963608,
0.035849787294864655,
-0.05063281208276749,
0.005... | 0.81934 | 0.778556 | 0.040785 |
Why is there a difference in output between the C and Java versions of this code? I understand the output in Java, but I cannot understand the output in C. Additionally, if I apply the prefix ++ operator, I get the same result in both languages. Can you explain why?
```c
#include <stdio.h>
int main()
{
int a[] = {1... | glaive | [
0.02169586718082428,
0.03587761148810387,
-0.03316938504576683,
-0.012047752737998962,
0.031825363636016846,
-0.05521273985505104,
-0.024482661858201027,
0.10600660741329193,
0.03799271583557129,
-0.048004548996686935,
0.024759309366345406,
0.009541001170873642,
-0.05982314050197601,
-0.01... | 0.804023 | 0.779661 | 0.024363 |
You are required to write a shader program in GLSL (OpenGL Shading Language) that uses texture gathering functions to sample textures in various ways. The shader program should include the necessary uniform variables for sampler2D, sampler2DArray, samplerCube, and samplerCubeArray. It should also include input variable... | glaive | [
0.00025063796783797443,
0.04174491763114929,
-0.026600539684295654,
-0.04440318048000336,
0.04229319468140602,
-0.05691172927618027,
-0.0370783694088459,
0.06277173012495041,
0.026437830179929733,
-0.030005192384123802,
0.041891153901815414,
0.028247453272342682,
-0.010893133468925953,
0.0... | 0.783894 | 0.768732 | 0.015162 |
You are tasked with creating a subroutine in Fortran that calculates the coefficients for a specific mathematical formula. The subroutine should take an array `xnval` as input and use it to perform the necessary calculations. The subroutine should also utilize the external function `cwig3j` to calculate the coefficient... | glaive | [
0.010603607632219791,
0.04202479496598244,
-0.039701469242572784,
-0.03245984762907028,
0.03830268234014511,
-0.004773178603500128,
-0.012899684719741344,
0.060426563024520874,
0.037769217044115067,
0.00734842149540782,
0.006681360304355621,
0.03563772886991501,
-0.03999731317162514,
0.006... | 0.799542 | 0.76867 | 0.030871 |
What is a program that can identify the largest number in a list? | glaive | [
0.03300126641988754,
0.025642020627856255,
-0.038297899067401886,
-0.04951558634638786,
0.04290062561631203,
-0.01857689954340458,
-0.009965989738702774,
0.04760116711258888,
0.03116173855960369,
-0.045678410679101944,
0.030344665050506592,
0.06386294215917587,
-0.03417884558439255,
-0.015... | 0.794672 | 0.774414 | 0.020259 |
Can you provide a code snippet to find the maximum subarray sum in an array of integers? | glaive | [
0.013040220364928246,
0.03624430671334267,
-0.031227417290210724,
-0.027378588914871216,
0.036277394741773605,
-0.02445019781589508,
-0.024235837161540985,
0.031376808881759644,
0.038883864879608154,
-0.04303748160600662,
0.03725176304578781,
0.0326148197054863,
-0.03953908756375313,
-0.00... | 0.809396 | 0.784476 | 0.02492 |
What is an algorithm that can be used to find the maximum element in a two-dimensional array? | glaive | [
0.03008394129574299,
0.03323166444897652,
-0.02872093766927719,
-0.030113231390714645,
0.01807023584842682,
-0.016568651422858238,
-0.038601104170084,
0.05790629982948303,
0.020469507202506065,
-0.02684459649026394,
0.026136577129364014,
0.04036295413970947,
-0.033184830099344254,
-0.00912... | 0.795277 | 0.758687 | 0.036589 |
How can I calculate the sum of all the odd numbers in a given list of integers using Python? | glaive | [
-0.002356072189286351,
0.029001662507653236,
-0.03322344273328781,
-0.05512043833732605,
0.03932185843586922,
-0.031061556190252304,
-0.012681092135608196,
0.012203882448375225,
0.04903000593185425,
-0.03063466213643551,
0.00595651101320982,
0.02582288533449173,
-0.04760689660906792,
-0.00... | 0.787142 | 0.772669 | 0.014474 |
You are tasked with implementing a CUDA kernel function that calculates the similarity between feature vectors in two graphs. The function takes in three arrays: a distance matrix, graph A, and graph B, as well as the length of each feature vector, and the sizes of graph A and graph B.
The kernel function should itera... | glaive | [
0.002795587060973048,
0.04499043524265289,
-0.026644600555300713,
-0.02761588990688324,
0.04307927191257477,
-0.005118092522025108,
-0.028852403163909912,
0.08198666572570801,
0.042159274220466614,
-0.015470094978809357,
0.028528407216072083,
0.03789348900318146,
-0.015187400393188,
0.0099... | 0.802917 | 0.78433 | 0.018588 |
You are tasked with implementing a CUDA C++ program to perform various operations on vectors and clouds. The specific tasks include:
1. Implementing a function to add a constant shift to each element of a vector, measured in terms of operations/ms and gflops.
2. Implementing functions to find the minimum, maximum, and ... | glaive | [
0.01038356777280569,
0.03820820897817612,
-0.013373314402997494,
-0.010086305439472198,
0.03441113233566284,
0.003843594342470169,
-0.03288983926177025,
0.10641241073608398,
0.05402182787656784,
-0.018546031787991524,
0.02533445693552494,
0.02106964960694313,
0.008334680460393429,
0.013199... | 0.796932 | 0.774935 | 0.021997 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.