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 |
|---|---|---|---|---|---|
Write a program in Go that takes an integer input from the user and prints the sum of all the numbers from 1 to the input number. | glaive | [
0.007455374114215374,
0.02801838330924511,
-0.018678000196814537,
-0.04616152122616768,
0.04175739362835884,
-0.0383208729326725,
-0.024518145248293877,
0.028977936133742332,
0.03722849488258362,
-0.029797885566949844,
0.017194299027323723,
0.03949597477912903,
-0.04352783411741257,
-0.018... | 0.810411 | 0.788214 | 0.022197 |
You are tasked with creating a program to solve the Traveling Salesman Problem (TSP) using a specific framework. The TSP is a classic algorithmic problem in the field of computer science and operations research. The goal is to find the shortest possible route that visits each city exactly once and returns to the origin... | glaive | [
-0.0057421037927269936,
0.013651697896420956,
-0.035322435200214386,
-0.015647869557142258,
0.04709021747112274,
-0.01680135168135166,
-0.01610388047993183,
0.04255910962820053,
0.044727131724357605,
-0.029917296022176743,
0.0325201116502285,
0.023438718169927597,
-0.0067054773680865765,
-... | 0.802123 | 0.772948 | 0.029175 |
I need to implement a labset data structure in my code, using a bitset implementation. The labset should have the following functions:
1. Set the size of the labset
2. Check if a given element is present in the labset
3. Create a labset with a single element
4. Find the intersection of two labsets
5. Check if the labs... | glaive | [
0.02274882048368454,
0.014781894162297249,
-0.027637068182229996,
-0.02096187137067318,
0.03969164192676544,
-0.02621336281299591,
-0.030633313581347466,
0.06523492932319641,
0.043439336121082306,
-0.02239803969860077,
0.03854859992861748,
0.02778770588338375,
-0.04267879202961922,
-0.0121... | 0.811765 | 0.787217 | 0.024548 |
You are tasked with implementing a subroutine in Fortran called "ellu_rad_upper" that determines the radius r of the ball covering the ellipsoid E given by { x | norm(G^T * x) <=1 ), where G is an n x n lower triangular matrix. The subroutine takes three inputs: n (an integer), g (an n x n real matrix), and r (a real o... | glaive | [
0.0005615305271930993,
0.04502213001251221,
-0.014326031319797039,
-0.039458323270082474,
0.02659943886101246,
-0.012089733965694904,
-0.01931317150592804,
0.05838325619697571,
0.02696596086025238,
-0.006387658417224884,
0.020155711099505424,
0.04234590753912926,
-0.019355302676558495,
0.0... | 0.798482 | 0.775286 | 0.023196 |
You are tasked with creating a program that calculates the probability of a quantum system being in a specific state, based on a given code snippet. The quantum system is described by a set of 16 qubits, and the probability is determined by the `amplitude` and `amplitude2` functions, which are dependent on the variable... | glaive | [
-0.0007243828731589019,
0.032351888716220856,
-0.026261044666171074,
-0.014103650115430355,
0.0479423813521862,
-0.0313703678548336,
-0.025800494477152824,
0.07227436453104019,
0.0327923484146595,
0.0037093786522746086,
0.030568353831768036,
0.03624119237065315,
-0.004584422335028648,
-0.0... | 0.800637 | 0.76467 | 0.035968 |
You are tasked with implementing a VertexBinner class using C++ and CUDA to distribute vertices into bins based on their degree in a graph. The VertexBinner class should have the following functionalities:
1. The setup function should take in the following parameters:
- An array of offsets (ET* offsets)
- An ar... | glaive | [
0.022222451865673065,
0.013860330916941166,
-0.005857357755303383,
-0.012726444751024246,
0.01444492768496275,
-0.012690270319581032,
-0.02889159880578518,
0.09825094789266586,
0.051503755152225494,
-0.019533712416887283,
0.03167052939534187,
0.04102399945259094,
0.0011288435198366642,
0.0... | 0.80687 | 0.786549 | 0.020321 |
You are tasked with implementing a CPU-based reference snn ranking algorithm. The algorithm takes input of a graph, the number of points, the number of nearest neighbors (k), the minimum number of SNN to increase snn-density (eps), the minimum snn-density to be a core point (min_pts), and arrays for knns, cluster, core... | glaive | [
0.01098653208464384,
0.025487983599305153,
-0.02840735763311386,
-0.01223728246986866,
0.025866804644465446,
-0.02893131412565708,
-0.024366706609725952,
0.05811106786131859,
0.025232722982764244,
-0.01206585019826889,
0.026052620261907578,
0.027715004980564117,
-0.026388900354504585,
0.01... | 0.816401 | 0.794457 | 0.021943 |
You are tasked with creating a Python script to implement a game using the provided Game class. The game should have the following configuration parameters:
- Number of switches
- Number of columns
- Number of rows
- Number of shapes to display next
- Frames per second
- Countdown timer
- Interval between shapes
- Scor... | glaive | [
0.011164712719619274,
0.018564455211162567,
-0.03763474524021149,
-0.025116197764873505,
0.028541728854179382,
-0.03475955128669739,
-0.03170038387179375,
0.052055031061172485,
0.04256502166390419,
-0.03169144690036774,
0.0414452850818634,
0.04295135661959648,
-0.010647743940353394,
0.0011... | 0.799511 | 0.784377 | 0.015134 |
How can an AI determine if each number in a 2D array is greater than a given value? | glaive | [
0.009470019489526749,
0.02248566225171089,
-0.020174862816929817,
-0.031156525015830994,
0.029500383883714676,
-0.03486330434679985,
-0.01824786700308323,
0.06086282432079315,
0.031168600544333458,
-0.025097209960222244,
0.021966004744172096,
0.03961672633886337,
-0.02772008627653122,
0.00... | 0.802753 | 0.783823 | 0.01893 |
You have been tasked with creating a function in Common Lisp that takes a list of integers as input and returns the sum of all the elements in the list. The input list can be of any length and may contain both positive and negative integers.
Write a function called "sum-list" that takes a list of integers as input and... | glaive | [
0.00904239434748888,
0.01653778925538063,
-0.02941060997545719,
-0.05863632634282112,
0.05271986126899719,
-0.04052889347076416,
-0.012007216922938824,
0.01727925054728985,
0.05028952658176422,
-0.00486707640811801,
0.03335552662611008,
0.06918460875749588,
-0.029138408601284027,
-0.033815... | 0.801647 | 0.774991 | 0.026656 |
You are required to write a program to calculate the histogram of a gray image with a specified number of pixels. The program should be able to execute either a simple or an optimized version of the histogram calculation, and also have the option to create either a random or black image. The program should also be able... | glaive | [
-0.0012241242220625281,
0.01496912818402052,
-0.030276482924818993,
-0.024671416729688644,
0.03930722549557686,
-0.02646714262664318,
-0.029761480167508125,
0.0765807256102562,
0.043050866574048996,
-0.03356802463531494,
0.020341843366622925,
0.025224503129720688,
-0.027302466332912445,
0.... | 0.804486 | 0.774694 | 0.029792 |
You are tasked with creating a Python program that calculates the area of a circle. The program should take the radius of the circle as input and output the calculated area. Assume the value of π to be 3.14159. | glaive | [
-0.0209853183478117,
0.04790712893009186,
-0.03740355372428894,
-0.03510957583785057,
0.0397438146173954,
-0.0135812321677804,
-0.02753070369362831,
0.02088378742337227,
0.03601321578025818,
0.003217973280698061,
0.024498578161001205,
0.03781435266137123,
-0.023082934319972992,
-0.01364367... | 0.771468 | 0.744341 | 0.027127 |
You are tasked with implementing a function to count the number of leaf nodes in a binary tree. A leaf node is a node that has no children. The binary tree is defined using the following data type:
```ocaml
type 'a binary_tree =
| Empty
| Node of 'a * 'a binary_tree * 'a binary_tree;;
```
Your task is... | glaive | [
-0.008220509625971317,
0.017935089766979218,
-0.048074088990688324,
-0.0355091318488121,
0.042930468916893005,
-0.02990751899778843,
-0.0013996607158333063,
0.0836479440331459,
0.03756297007203102,
0.011096819303929806,
0.022497737780213356,
0.019748449325561523,
-0.025154458358883858,
0.0... | 0.807955 | 0.780008 | 0.027947 |
You are tasked with creating a program that generates a sprite for a 2D game. The sprite should be named "spr_planet_shadow" and should have the following properties:
- It should not be used for 3D rendering
- It should not be horizontally tiled
- It should not be vertically tiled
- It should have a bottom bounding box... | glaive | [
-0.01117485947906971,
0.02458227425813675,
-0.020727865397930145,
-0.05376641824841499,
0.04532326012849808,
-0.051216382533311844,
-0.033028870820999146,
0.07337962836027145,
0.028784524649381638,
-0.037158939987421036,
0.051575567573308945,
0.031203553080558777,
-0.01268547959625721,
-0.... | 0.771417 | 0.754565 | 0.016852 |
You are tasked with implementing an efficient algorithm for performing an all-reduce operation using a parallel programming framework. An all-reduce operation takes an input value from each process in a parallel program and combines them using a specified operation (e.g., sum, maximum, minimum) to produce a single outp... | glaive | [
0.003606292186304927,
0.030594663694500923,
-0.024176297709345818,
-0.016678962856531143,
0.010345147922635078,
0.00035578699316829443,
-0.03497698903083801,
0.06667152047157288,
0.060032181441783905,
-0.007895654067397118,
0.008270918391644955,
0.040199846029281616,
0.0012904166942462325,
... | 0.803269 | 0.77505 | 0.02822 |
Can you provide an algorithm to determine if a given number is an Armstrong number or not? | glaive | [
0.021207813173532486,
0.004003772512078285,
-0.018435321748256683,
-0.027055909857153893,
0.021635612472891808,
-0.04615941271185875,
0.0054844338446855545,
0.04446373134851456,
0.03651515766978264,
-0.02096349559724331,
0.019303996115922928,
0.033327843993902206,
-0.032766882330179214,
-0... | 0.794628 | 0.772716 | 0.021912 |
You are tasked with implementing a program that calculates the coefficient of q^n in the expression (1-q)^3 / (1-3q). This problem is related to the dimensions of the enveloping algebra of the derived free Lie algebra on 3 letters. Your program should take an input value n and output the corresponding coefficient. | glaive | [
0.040398016571998596,
0.027244606986641884,
-0.04755392298102379,
-0.04782015457749367,
0.04083063825964928,
-0.012127488851547241,
-0.02556624263525009,
0.059157103300094604,
0.04340290278196335,
-0.0047179036773741245,
0.02044445089995861,
0.042326025664806366,
-0.05499783530831337,
-0.0... | 0.820928 | 0.787855 | 0.033073 |
You are tasked with creating a program that calculates the exponential of a given number using the provided mathematical functions. Your program should be able to take a number as input and output its exponential value. You must also ensure that your program works for negative real numbers and complex numbers. | glaive | [
0.02999619022011757,
0.021378789097070694,
-0.025436213240027428,
-0.041995346546173096,
0.04351736977696419,
-0.03685561567544937,
-0.016437185928225517,
0.06533064693212509,
0.0412738136947155,
-0.025823744013905525,
0.025589505210518837,
0.051121000200510025,
-0.0582435317337513,
-0.017... | 0.793164 | 0.772634 | 0.020529 |
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. You should implement a function called "sum_even_numbers" that accepts a list of integers and returns the sum of all the even numbers in the list. | glaive | [
0.01902586780488491,
0.011944467201828957,
-0.03717486932873726,
-0.05865791440010071,
0.05458010733127594,
-0.02186717465519905,
-0.016214638948440552,
0.03674514591693878,
0.0365368090569973,
-0.01785839907824993,
0.007080147974193096,
0.05320760980248451,
-0.040716808289289474,
-0.01862... | 0.802607 | 0.766547 | 0.03606 |
You are working with a dataset of automobile insurance policies, where the number of accidents per policyholder is the key variable of interest. The dataset includes a total of 7,483 policies and the average number of accidents per policyholder is 0.06989. You have fitted a Poisson distribution to the data and obtained... | glaive | [
0.026224154978990555,
0.0015499633736908436,
-0.014254624955356121,
-0.06094701960682869,
0.02769300900399685,
-0.03241613507270813,
-0.009239326231181622,
0.07516864687204361,
0.046948447823524475,
-0.008713777177035809,
-0.0067838323302567005,
0.01526972372084856,
-0.01848769560456276,
-... | 0.788614 | 0.772398 | 0.016216 |
What is the code in C++ to find the maximum value among three integers? | glaive | [
0.017070423811674118,
0.01984662003815174,
-0.039265770465135574,
-0.027099955826997757,
0.03610878437757492,
-0.014594674110412598,
-0.015561926178634167,
0.0674334317445755,
0.02702436037361622,
-0.04172937944531441,
0.03383015841245651,
0.06688573211431503,
-0.031392902135849,
-0.025605... | 0.795927 | 0.777496 | 0.018431 |
You are tasked with creating a FIFO (First-In-First-Out) level in a hardware description language using the LevelFIFO and Vector modules. The FIFO level should have a capacity of 8 elements and should support operations such as enqueuing, dequeuing, and clearing. Additionally, you need to implement logic to track wheth... | glaive | [
0.04328479617834091,
0.020680226385593414,
-0.014483173377811909,
-0.05176890268921852,
0.043586961925029755,
-0.034382835030555725,
-0.03550998494029045,
0.07099735736846924,
0.027214445173740387,
-0.00680374214425683,
0.02341376431286335,
0.03520561009645462,
-0.035299211740493774,
-0.00... | 0.802134 | 0.779736 | 0.022397 |
You are tasked with writing a function that takes in the number of users (N) and the state probability for the last user in the chain (s_N), and returns the maximum likelihood estimate of s_0 rounded to 2 decimal places. The function should calculate the maximum likelihood estimate based on the given parameters and ret... | glaive | [
0.021879954263567924,
0.026242591440677643,
-0.04721485450863838,
-0.05132049694657326,
0.05810914188623428,
-0.011014222167432308,
-0.03852738440036774,
0.03916540369391441,
0.03452710434794426,
-0.0017891967436298728,
0.01811065338551998,
0.03856346011161804,
-0.0031813085079193115,
-0.0... | 0.806271 | 0.777748 | 0.028522 |
I need to write a program that calculates the numerator of the sigma(4n)/sigma(n) sequence. The sequence is as follows: 7,5,7,31,7,5,7,21,7,5,7,31,7,5,7,127,7,5,7,31,7,5,7,21,7,5,7,31,7,5,7,85,7,5,7,31,7,5,7,21,7,5,7,31,7,5,7,127,7,5,7,31,7,5,7,21,7,5,7,31,7,5,7,511,7,5,7,31,7,5,7,21,7,5,7,31,7,5,7,127,7,5,7,31,7,5,7,2... | glaive | [
-0.00002462507654854562,
0.033138830214738846,
-0.049467310309410095,
-0.03341827169060707,
0.044603414833545685,
-0.021553779020905495,
-0.034290753304958344,
0.06372921168804169,
0.022314323112368584,
-0.025987748056650162,
0.0180202629417181,
0.039664871990680695,
-0.04528191685676575,
... | 0.823702 | 0.791947 | 0.031754 |
You are tasked with creating a tic-tac-toe game using Java and JUnit testing. The game consists of a board with 3 rows and 3 columns, and two players taking turns to place their respective marks (X or O) on the board. The game logic needs to determine the winner or if the game ends in a draw.
Create a class `Game` tha... | glaive | [
0.011988132260739803,
0.006864449940621853,
-0.04166771098971367,
-0.03690105676651001,
0.030464105308055878,
-0.037708766758441925,
-0.005442886147648096,
0.04915977269411087,
0.02123699150979519,
-0.03588758781552315,
0.02674977481365204,
0.031606949865818024,
-0.024448413401842117,
-0.0... | 0.793917 | 0.775063 | 0.018854 |
You are tasked with implementing a simplified drawline function in ACL2. The drawline function takes three arguments: a and b are integers, and screen is a list. The function should draw a line on the screen from the point (0,0) to (a,b) using the Bresenham's line algorithm. The screen is represented as a list of point... | glaive | [
0.01418973971158266,
0.024890124797821045,
-0.030452465638518333,
-0.049559302628040314,
0.058567408472299576,
-0.023520158603787422,
-0.025103796273469925,
0.07204248756170273,
0.048580434173345566,
-0.015472538769245148,
0.016735156998038292,
0.046858154237270355,
-0.004814793821424246,
... | 0.804705 | 0.788265 | 0.016439 |
You are tasked with implementing a data structure for a Most Recently Used (MRU) cache. The cache should have the following functionalities:
- Get(key): Retrieve the value associated with the given key. If the key is not present in the cache, return None.
- Set(key, value): Add or update the value associated with the g... | glaive | [
0.05224323272705078,
0.03416518494486809,
-0.03163488209247589,
-0.026208220049738884,
0.02546415664255619,
-0.03677768632769585,
-0.0243099145591259,
0.07190654426813126,
0.02901010774075985,
-0.030013127252459526,
0.04200419411063194,
0.005128837656229734,
-0.026331858709454536,
0.016618... | 0.822938 | 0.799996 | 0.022942 |
Can you provide a solution to develop a sorting algorithm that sorts an array of integers in ascending order using the selection sort method? | glaive | [
0.028147321194410324,
0.006144959945231676,
-0.0217825286090374,
-0.02450011484324932,
0.0280393548309803,
-0.042020365595817566,
-0.03371964022517204,
0.04283716902136803,
0.01804041489958763,
-0.024170441552996635,
0.025747843086719513,
0.004668745212256908,
-0.04776744917035103,
-0.0067... | 0.803736 | 0.78902 | 0.014717 |
You are tasked with implementing a program that involves transforming data using a specific set of variables and functions. The program should include the following components:
- An integer variable N with a value of 2
- An integer variable M with a value of 3
- An array d_y_a of size N with the values {1, 0}
- A matri... | glaive | [
-0.002165126847103238,
0.03456168994307518,
-0.052711982280015945,
-0.055613309144973755,
0.037232570350170135,
-0.01569562405347824,
-0.024532968178391457,
0.05786675587296486,
0.03146519139409065,
-0.0092287827283144,
0.0006831971113570035,
0.038830265402793884,
-0.023216839879751205,
-0... | 0.814189 | 0.783641 | 0.030548 |
You are tasked with creating a program in R that simulates a type 1 experiment with the following parameters:
- Seed: 999983 + 2000
- k: 1000
- n: 500
- m: 7
Your program should use parallel processing to run the simulation on 2 cores and save the results in a file named "sim_type1_5007_2.RData". | glaive | [
-0.0033177549485117197,
0.037084389477968216,
-0.022495144978165627,
-0.041370876133441925,
0.02050984650850296,
-0.015153483487665653,
-0.030063796788454056,
0.08607850968837738,
0.03247350826859474,
-0.021263200789690018,
0.018410850316286087,
0.04735097289085388,
-0.00541910994797945,
-... | 0.79634 | 0.780202 | 0.016138 |
You are tasked with creating a function that takes in an array of numbers and returns the sum of all the numbers in the array. The function should be named "calculateSum" and should take in one parameter, an array of numbers. | glaive | [
0.02481495589017868,
0.040488798171281815,
-0.041582267731428146,
-0.04575945436954498,
0.06840699911117554,
-0.028972240164875984,
-0.026960458606481552,
0.034508027136325836,
0.030488913878798485,
-0.003603218588978052,
0.019712086766958237,
0.03626864030957222,
-0.042780376970767975,
-0... | 0.788582 | 0.745331 | 0.043251 |
How can I write a Java program that performs a binary search on a sorted array of numbers? | glaive | [
-0.002758243354037404,
0.022217456251382828,
-0.04812992364168167,
-0.019642170518636703,
0.02462559938430786,
-0.03472476080060005,
-0.02261432446539402,
0.038307808339595795,
0.031347811222076416,
-0.04308014363050461,
0.02448301762342453,
0.019093725830316544,
-0.04533512890338898,
-0.0... | 0.796676 | 0.782257 | 0.014419 |
You are tasked with implementing a C++ program that calculates the sum of the power of a set of input numbers. The program should take in a list of numbers and calculate the sum of their powers, where the power is a predefined constant. The program should be able to handle input of any size and produce the correct sum ... | glaive | [
0.026968939229846,
0.038069501519203186,
-0.022203994914889336,
-0.03664719685912132,
0.05421190336346626,
-0.01979733817279339,
-0.0030053802765905857,
0.08604952692985535,
0.05649124085903168,
-0.042127933353185654,
0.01059596799314022,
0.041978005319833755,
-0.038070954382419586,
-0.025... | 0.801002 | 0.772632 | 0.02837 |
You are tasked with implementing a subroutine that takes in an array of x and y coordinates and a number n, and returns a modified array with only the non-zero x and y coordinates. If the last element in the array is also non-zero, it should be included in the modified array as well.
Write a subroutine `points(x, y, n... | glaive | [
0.011541469022631645,
0.043240685015916824,
-0.023789849132299423,
-0.03166043758392334,
0.032279349863529205,
-0.02357749454677105,
-0.018554918467998505,
0.049210790544748306,
0.053954653441905975,
-0.004917817655950785,
0.009399257600307465,
0.04837329685688019,
-0.028654741123318672,
-... | 0.822061 | 0.782845 | 0.039215 |
You are tasked with creating a program that incorporates Bayesian statistics to model data. Specifically, you need to write a program that takes in an integer t and a real number x as input. Depending on the value of t, the program should use different probability distributions to model the data. If t is non-zero, the ... | glaive | [
0.00567062571644783,
-0.0013554891338571906,
-0.04851005598902702,
-0.03737761080265045,
0.04864479601383209,
-0.023042859509587288,
-0.022552872076630592,
0.0696268305182457,
0.05314387008547783,
-0.010801016353070736,
0.0030557760037481785,
0.053669482469558716,
-0.004421585705131292,
0.... | 0.79302 | 0.777918 | 0.015102 |
You are tasked with implementing a Monte Carlo integration algorithm for a six-dimensional function using the Vegas library. The integrand function is defined as follows:
```c++
class GENZ_6_6D {
public:
__device__ __host__ double
operator()(double u, double v, double w, double x, double y, double z)
{
... | glaive | [
0.02864217385649681,
0.027919776737689972,
-0.006376903969794512,
-0.04088053107261658,
0.056568462401628494,
-0.004136233124881983,
-0.03318946063518524,
0.07813703268766403,
0.03308909386396408,
-0.01608603447675705,
0.028772644698619843,
0.043287064880132675,
-0.005450380500406027,
-0.0... | 0.802564 | 0.779998 | 0.022566 |
You are tasked with implementing a program to calculate the genus of the modular curve X_0(p) for a given prime number p. The genus of the modular curve is represented by the sequence A116563. You need to write a function or method that takes a prime number as input and returns the corresponding genus value. If the inp... | glaive | [
0.0032064970582723618,
0.03268464282155037,
-0.023949595168232918,
-0.05009347200393677,
0.031603824347257614,
-0.04182882979512215,
-0.026229187846183777,
0.06372638046741486,
0.03334810212254524,
-0.02305813692510128,
0.017266202718019485,
0.039650313556194305,
-0.03926011919975281,
-0.0... | 0.816182 | 0.785243 | 0.030938 |
You are tasked with writing a recursive function in a programming language of your choice that takes an integer as input and returns a list of its digits in reverse order. For example, if the input is 123, the output should be [3, 2, 1]. | glaive | [
0.025781627744436264,
0.03154836595058441,
-0.025498831644654274,
-0.05264844372868538,
0.031776659190654755,
-0.020664948970079422,
-0.014567423611879349,
0.054033491760492325,
0.028953662142157555,
-0.008712965063750744,
0.03301900997757912,
0.0378333181142807,
-0.04735114052891731,
-0.0... | 0.828327 | 0.792456 | 0.03587 |
You are tasked with writing a CUDA kernel that performs diagonalization on a given matrix. The goal is to zero out all elements of the matrix except for the diagonal elements. You will need to implement two separate kernels, one for real-valued matrices and another for complex-valued matrices, using CUDA C++.
Your tas... | glaive | [
0.010772570967674255,
0.03866224363446236,
-0.02970653399825096,
-0.03278268873691559,
0.027339836582541466,
-0.00935306865721941,
-0.003226392436772585,
0.09948956966400146,
0.0511460155248642,
-0.02282221056520939,
0.024900175631046295,
0.024225149303674698,
-0.00677104527130723,
-0.0030... | 0.802468 | 0.779785 | 0.022682 |
You are tasked with writing a function that ensures each column of a matrix is lexicographically less than the next column. Formally, for two columns x and y in the matrix, there exists a j such that x_j < y_j, and for all i < j, x_i = y_i. You need to create a function that encodes the matrix by stacking the columns, ... | glaive | [
-0.008806790225207806,
0.021523362025618553,
-0.03681468218564987,
-0.039673928171396255,
0.05368322879076004,
-0.017811620607972145,
-0.020029153674840927,
0.08081625401973724,
0.04281206056475639,
-0.01614951714873314,
0.0008721205522306263,
0.04251628369092941,
-0.024710485711693764,
-0... | 0.818231 | 0.797874 | 0.020357 |
You have been tasked with implementing a function that visits a series of linked elephants. Each elephant is represented by a struct with a letter and an optional tail pointing to the next elephant. You need to write a function that visits each elephant once, starting with the first elephant and following the tails to ... | glaive | [
-0.015443982556462288,
0.041906826198101044,
-0.01522089447826147,
-0.019756071269512177,
0.023485708981752396,
-0.014225984923541546,
-0.019808491691946983,
0.0660209059715271,
0.02085072547197342,
-0.003328196704387665,
0.03525079786777496,
0.04380251094698906,
-0.024654030799865723,
0.0... | 0.807643 | 0.791577 | 0.016066 |
You are tasked with implementing a program that deals with set operations. Specifically, you need to write a function that takes in two sets and determines whether one set is a subset of the other. The function should return true if the first set is a subset of the second set, and false otherwise. The sets are represen... | glaive | [
0.034695547074079514,
0.024474916979670525,
-0.03529326617717743,
-0.017009496688842773,
0.04797478765249252,
-0.014838403090834618,
0.00017741997726261616,
0.05641256645321846,
0.05312757194042206,
-0.0212041474878788,
0.023641807958483696,
0.03014683723449707,
-0.02166307158768177,
-0.01... | 0.807491 | 0.761388 | 0.046103 |
You are tasked with creating a program to calculate the area of different geometric shapes such as triangles, quadrilaterals, and circles. The program should be able to handle various input parameters such as side lengths, base, height, radius, and diagonals. It should also be capable of determining the characteristics... | glaive | [
0.015576549805700779,
0.03594731166958809,
-0.042653635144233704,
-0.03714064136147499,
0.036565739661455154,
-0.019317278638482094,
-0.01935192383825779,
0.045287616550922394,
0.03366968408226967,
-0.02866031974554062,
0.01917782798409462,
0.044622913002967834,
-0.034976013004779816,
-0.0... | 0.774466 | 0.736755 | 0.037711 |
:
You are tasked with implementing a function to calculate crossing distances in a spherical grid. The function will take in the grid type, position, direction, and a maximum distance, and return a set of distances at which the trajectory crosses grid cells.
The grid is defined in a single dimension, with vertices at ... | glaive | [
-0.006598873529583216,
0.02097870595753193,
-0.023029612377285957,
-0.04539143294095993,
0.03624652698636055,
-0.029515065252780914,
-0.04490907862782478,
0.055396247655153275,
0.03547394275665283,
-0.0006541271577589214,
0.023687008768320084,
0.030033111572265625,
0.010342031717300415,
0.... | 0.812898 | 0.784842 | 0.028056 |
You are required to write a CUDA program to process an input image and apply various image processing operations on it. The input image is a 2D array of integers with dimensions 2x1228800. The program needs to perform the following operations on the input image:
1. Extract the red channel from the input image and store... | glaive | [
-0.0052637155167758465,
0.04967621713876724,
-0.02508668042719364,
-0.016997607424855232,
0.014480909332633018,
-0.0170447938144207,
-0.028380215167999268,
0.10898692160844803,
0.049930185079574585,
-0.015950340777635574,
0.03433496877551079,
0.0142409922555089,
0.009557806886732578,
-0.00... | 0.789606 | 0.771926 | 0.01768 |
You are requested to create a program that computes Gtilde for one tile in angular units, using GPU parallelization. The program requires an input file with omega and standard deviation of redshift weighting. In case the standard deviation of redshift weighting is set to 0, no redshift weighting is performed. The compu... | glaive | [
-0.008244127966463566,
0.04210102930665016,
-0.01651427522301674,
-0.036819204688072205,
0.025810575112700462,
-0.03224484249949455,
-0.037650465965270996,
0.07370118051767349,
0.04886831343173981,
-0.01398845762014389,
0.021368391811847687,
0.009779330343008041,
-0.026689408347010612,
0.0... | 0.811972 | 0.794695 | 0.017277 |
You are given a quantum computing problem to calculate the probability of a certain outcome. The problem involves calculating the probability function for a quantum system with a given number of qubits and a specific set of states. Your task is to implement the probability function and then find the maximum probability... | glaive | [
-0.0018157114973291755,
0.007402155548334122,
-0.027452632784843445,
-0.0038358098827302456,
0.040253110229969025,
-0.005762187298387289,
-0.01652435213327408,
0.053044531494379044,
0.03977837786078453,
0.011822928674519062,
0.016128936782479286,
0.019935257732868195,
-0.003163308138027787,
... | 0.792701 | 0.76431 | 0.028391 |
You are tasked with creating a program that computes the final cash flow graph of financial transactions for various participants. The program should be able to handle different types of cash flow accounts, including merchant, provider, system, external, and wallet accounts, each with their own specific account types. ... | glaive | [
0.020869988948106766,
0.019717693328857422,
-0.04140070825815201,
-0.03346536308526993,
0.0354483425617218,
-0.015406573191285133,
-0.023171143606305122,
0.05026761814951897,
0.04556554555892944,
-0.019493436440825462,
0.03772323951125145,
0.029345232993364334,
-0.003567424602806568,
-0.01... | 0.789918 | 0.774077 | 0.01584 |
What is an algorithm for sorting a given random array using the Quick Sort algorithm? | glaive | [
0.003399871289730072,
0.023299183696508408,
-0.013826500624418259,
-0.023910779505968094,
0.022687425836920738,
-0.030738843604922295,
-0.039405178278684616,
0.03487895429134369,
0.016292423009872437,
-0.02042805776000023,
0.019169557839632034,
0.01726209931075573,
-0.033880531787872314,
-... | 0.790166 | 0.769887 | 0.020278 |
What is the code to create a program that takes two integers as input and outputs all the numbers in between them? | glaive | [
0.024715235456824303,
0.02350808121263981,
-0.030291948467493057,
-0.027619339525699615,
0.02819029428064823,
-0.021115584298968315,
-0.019538499414920807,
0.04741890728473663,
0.028039297088980675,
-0.052597176283597946,
0.0245125200599432,
0.06256906688213348,
-0.03478061035275459,
-0.02... | 0.803153 | 0.785886 | 0.017267 |
You are tasked with writing a subroutine in Fortran called `slapgc` that computes the laplacian of a scalar field. The laplacian is computed at specified grid points on the surface of a sphere. The subroutine takes as input the scalar spherical harmonic coefficients `a` and `b` that have been precomputed by another sub... | glaive | [
-0.01755516789853573,
0.042085468769073486,
-0.03212260827422142,
-0.0427212156355381,
0.048955660313367844,
-0.020914869382977486,
-0.026881026104092598,
0.05148231238126755,
0.026620591059327126,
-0.01669115014374256,
0.010700330138206482,
0.04468467831611633,
-0.03696977719664574,
-0.00... | 0.795157 | 0.77627 | 0.018887 |
You are working with a dataset called "meghalaya.csv" which contains information about electors in the state of Meghalaya. The dataset includes columns such as ID, sex, age, pin code, net electors, elector name, district, police station, mandal, district, and main town. Your task is to write R code to perform the follo... | glaive | [
0.015005911700427532,
0.0020378539338707924,
-0.02720949612557888,
-0.04455581679940224,
0.026415422558784485,
-0.04492057114839554,
-0.018722569569945335,
0.05236569419503212,
0.045485809445381165,
-0.006962335668504238,
0.021557673811912537,
0.015769077464938164,
-0.019742805510759354,
0... | 0.801351 | 0.784159 | 0.017192 |
You are required to implement the Jacobi Method for solving a system of linear equations on an NVIDIA GPU using CUDA. The Jacobi Method is an iterative algorithm for finding the numerical solution of a system of linear equations. The method is based on performing iterations to update an initial guess until a convergenc... | glaive | [
0.0037120250053703785,
0.03012702241539955,
-0.031518980860710144,
-0.03103397600352764,
0.01962321251630783,
-0.021798210218548775,
-0.00772562250494957,
0.09303215146064758,
0.03744124621152878,
-0.014109653420746326,
0.030141383409500122,
0.02597501501441002,
0.0101776747033,
0.00511702... | 0.798758 | 0.781098 | 0.01766 |
You are tasked with implementing a Generalized Linear Model (GLM) for a binomial outcome using Stan programming language. The model should include the following components:
- Data: You are given the number of observations (N), number of predictors (K), predictor matrix (X), mean of the predictor matrix (xbar), dense_X,... | glaive | [
-0.008066756650805473,
0.012594719417393208,
-0.0363037995994091,
-0.07860700786113739,
0.035062093287706375,
-0.04098862409591675,
-0.03869593143463135,
0.06465605646371841,
0.03424756973981857,
-0.022624041885137558,
0.02588595636188984,
0.05187265947461128,
-0.026268677785992622,
0.0264... | 0.796552 | 0.779981 | 0.016571 |
You are tasked with creating a program that calculates the probability distribution of a quantum state, given a set of parameters. The program should use the provided amplitude and probability functions to calculate the probability of a state for a given set of input parameters. Additionally, the program should utilize... | glaive | [
0.0013267539907246828,
0.023747002705931664,
-0.03325057774782181,
-0.023576857522130013,
0.045083124190568924,
-0.018769217655062675,
-0.012384694069623947,
0.07472041994333267,
0.03528160601854324,
0.0024665025994181633,
0.02662603370845318,
0.0437762513756752,
-0.017837002873420715,
-0.... | 0.786386 | 0.761074 | 0.025312 |
Can you provide a program in C that can generate Fibonacci numbers up to the nth position? | glaive | [
0.014440498314797878,
0.015187278389930725,
-0.028929462656378746,
-0.03158188611268997,
0.029492342844605446,
-0.04615676775574684,
-0.021212661638855934,
0.05902998149394989,
0.03224837779998779,
-0.03970927745103836,
0.03239566832780838,
0.05076158046722412,
-0.05649597942829132,
-0.028... | 0.79549 | 0.776569 | 0.018922 |
You are tasked with creating a program that transforms a given input data by performing a series of mathematical operations. The input data is a real number, and it needs to be multiplied by 2.7 and then raised to the power of 3. After the transformation, the program should use the transformed value to generate a new r... | glaive | [
0.02359919250011444,
0.019196277484297752,
-0.0482093021273613,
-0.04279790446162224,
0.0411229245364666,
-0.0017369112465530634,
-0.01622549630701542,
0.06237439438700676,
0.03125539794564247,
-0.014483827166259289,
0.005090964958071709,
0.03262919560074806,
-0.027536099776625633,
-0.0191... | 0.808723 | 0.793442 | 0.01528 |
How can I find the maximum value in an array of numbers using C++? | glaive | [
0.01687167026102543,
0.029128994792699814,
-0.02600880153477192,
-0.023050300776958466,
0.03983210772275925,
-0.019633503630757332,
-0.023481955751776695,
0.07612353563308716,
0.028821516782045364,
-0.040005508810281754,
0.023649977520108223,
0.04683755338191986,
-0.037800565361976624,
0.0... | 0.793119 | 0.765236 | 0.027883 |
You have been tasked with implementing a quantum probability distribution and visualizing it in 3D and 2D. The problem involves implementing a function to calculate the probability distribution based on given amplitudes and then using this function to visualize the distribution.
You are given the following functions a... | glaive | [
-0.003432408208027482,
0.033180393278598785,
-0.038754452019929886,
-0.034235402941703796,
0.03249691426753998,
-0.03544386848807335,
-0.016483325511217117,
0.06656481325626373,
0.04856070503592491,
0.020942246541380882,
0.03149459883570671,
0.031112048774957657,
-0.006956917699426413,
-0.... | 0.795021 | 0.775982 | 0.019039 |
You are given a singly linked list and an integer n. Write a function to remove the nth node from the end of the list and return the head of the updated list. Note that you are only allowed to traverse the list once.
The ListNode class is defined as follows:
```
public class ListNode {
int val;
ListNode next;
... | glaive | [
0.01899908110499382,
0.04027758911252022,
-0.011128486134111881,
-0.04930798336863518,
0.03851979598402977,
-0.049365509301424026,
-0.018965134397149086,
0.06149643287062645,
0.044371459633111954,
-0.008214492350816727,
0.027138501405715942,
0.0077071404084563255,
-0.0364556610584259,
-0.0... | 0.816769 | 0.788477 | 0.028292 |
I am trying to approximate a measurable function by a sequence of simple functions in the L¹ norm. Specifically, I need to create a function `approx_on` that takes a measurable function `f : β → α`, a measurable set `s : set α`, a point `y₀ : α` in `s`, and a natural number `n`, and returns a simple function in `β → α`... | glaive | [
-0.0009469576762057841,
0.043402623385190964,
-0.01923087053000927,
-0.04364532232284546,
0.04979582130908966,
-0.035849545150995255,
-0.029043706133961678,
0.0631628930568695,
0.03814171627163887,
-0.0006087285000830889,
0.013047579675912857,
0.027375783771276474,
-0.011128231883049011,
0... | 0.807487 | 0.786552 | 0.020935 |
You are tasked with implementing a function to compute weights from distances, using a decreasing exponential function. The function should take the following input parameters:
* `d` : A vector of distances.
* `h` : A scaling positive scalar defining the shape of the function.
* `cri` : A positive scalar defining outl... | glaive | [
-0.010677412152290344,
0.052922558039426804,
-0.028256043791770935,
-0.03420053422451019,
0.04109908640384674,
-0.019371218979358673,
-0.030131511390209198,
0.05082540959119797,
0.05292399972677231,
0.002666739746928215,
0.03090423345565796,
0.02314305491745472,
-0.047242529690265656,
0.00... | 0.803571 | 0.764641 | 0.03893 |
You are tasked with implementing a program that performs various operations on matrices and real numbers in a Stan program. Specifically, you need to write code that performs the following operations:
1. Multiply a 2x2 matrix `z` by a real number `x`.
2. Add a real number `x` to a 2x2 matrix `z`.
3. Subtract a real nu... | glaive | [
0.06600451469421387,
0.04746177792549133,
-0.024113375693559647,
-0.04714193940162659,
0.03434675559401512,
-0.011214944534003735,
-0.006525466218590736,
0.06582567095756531,
0.03714867681264877,
-0.019544685259461403,
0.013614372350275517,
0.03244725987315178,
-0.0374523289501667,
-0.0103... | 0.814625 | 0.783922 | 0.030703 |
You are tasked with implementing a CUDA kernel that performs matrix-vector multiplication using shared memory tiling. The matrixDotVector function takes in a matrix, a vector, and the dimensions of the matrix, and is meant to be executed on a GPU. The function utilizes shared memory tiling to optimize memory access and... | glaive | [
0.023892324417829514,
0.04839044809341431,
-0.022758949548006058,
-0.031496334820985794,
0.03800666704773903,
-0.00025810813531279564,
-0.02778441272675991,
0.0995316281914711,
0.036210089921951294,
-0.02107786014676094,
0.013597982004284859,
0.031132372096180916,
-0.0009902181336656213,
-... | 0.794216 | 0.779029 | 0.015187 |
You are tasked with implementing a function to calculate the coefficient of a given term in a specified power series. The function should take in the power series, the variable of interest, and the desired term, and return the coefficient of that term. Additionally, you need to implement a function that can pack variab... | glaive | [
0.026151275262236595,
0.04633493721485138,
-0.03504479303956032,
-0.042465727776288986,
0.043001264333724976,
-0.020642943680286407,
-0.026354214176535606,
0.06495872139930725,
0.05065934732556343,
-0.01688355952501297,
0.006714783143252134,
0.02389245480298996,
-0.029362602159380913,
-0.0... | 0.812755 | 0.789316 | 0.02344 |
You are tasked with creating a program that calculates the phase of the moon given a specific date. The program should take in the date in the format of day, month, and year, and output the approximate phase of the moon as a percentage. The phase of the moon should be represented as a decimal value, where 0.00 represen... | glaive | [
0.04985834285616875,
0.04711195081472397,
-0.04927193745970726,
-0.04172690212726593,
0.03764541819691658,
-0.05374537408351898,
-0.01527944765985012,
0.07528040558099747,
0.05158957839012146,
0.006339606828987598,
0.030445698648691177,
0.03539174795150757,
-0.02571643702685833,
-0.0087285... | 0.771603 | 0.755355 | 0.016248 |
You are tasked with writing a program to calculate the sum of the n-th powers of divisors of a given number n. The program should take an input n and output the sum of the n-th powers of all divisors of n.
For example, for n=6, the divisors of 6 are 1, 2, 3, and 6. The sum of the squares of these divisors is 1^2 + 2^2... | glaive | [
0.01717398688197136,
0.05097174644470215,
-0.022808026522397995,
-0.040394578129053116,
0.03640158474445343,
-0.029083412140607834,
-0.01819768361747265,
0.0396672822535038,
0.04437009245157242,
-0.024254105985164642,
0.021485816687345505,
0.02590765245258808,
-0.06538433581590652,
-0.0212... | 0.814408 | 0.768548 | 0.04586 |
You are developing a CUDA kernel for a forward pass in a deep learning model. The task is to implement the `AveragedistanceForward` function, which calculates the losses and gradients for the given input data. The input data includes predictions, targets, weights, points, symmetries, batch size, number of classes, numb... | glaive | [
0.004979069344699383,
0.04244109243154526,
-0.02899061143398285,
-0.044312890619039536,
0.031599465757608414,
-0.01257900707423687,
-0.032159555703401566,
0.07089293003082275,
0.04304395616054535,
-0.013669443316757679,
0.01637229323387146,
0.026493586599826813,
-0.01730305701494217,
0.011... | 0.80644 | 0.790802 | 0.015638 |
You are given an array of integers `nums` and an integer `limit`. Your task is to find the length of the longest continuous subarray such that the absolute difference between any two elements in the subarray is less than or equal to `limit`.
Write a function `longestSubarray` that takes in the following parameters:
- ... | glaive | [
0.01843237690627575,
0.032086264342069626,
-0.030127599835395813,
-0.02369634620845318,
0.02667587623000145,
-0.01807098090648651,
-0.05935397371649742,
0.04995901882648468,
0.05343405902385712,
-0.030441604554653168,
0.02042686566710472,
0.019089525565505028,
-0.020411165431141853,
0.0213... | 0.828718 | 0.771612 | 0.057106 |
You are tasked with implementing a Bayesian hierarchical model for a dataset consisting of the following variables:
- `n`: the number of observations
- `ng`: the number of guilds
- `nreg`: the number of regions
- `y`: a vector of length `n` containing observed values
- `guild`: a vector of length `n` containing guild a... | glaive | [
0.006134755909442902,
0.0021473451051861048,
-0.030371559783816338,
-0.04842305928468704,
0.02817639149725437,
-0.03774818405508995,
-0.015931859612464905,
0.07701437175273895,
0.04695141687989235,
-0.010912291705608368,
0.007784336805343628,
0.04163229092955589,
-0.021209560334682465,
0.0... | 0.802477 | 0.784599 | 0.017878 |
How can I create a C++ program that takes an array of integers and returns the number of unique values in the array? | glaive | [
0.00251809973269701,
0.026849333196878433,
-0.03359314799308777,
-0.02033943496644497,
0.043798480182886124,
-0.01882721483707428,
-0.026911361142992973,
0.0856928750872612,
0.03150860592722893,
-0.030073381960392,
0.015531066805124283,
0.029563112184405327,
-0.022041505202651024,
-0.01389... | 0.799145 | 0.776308 | 0.022837 |
You are tasked with implementing a 4-bit comparator in VHDL. The comparator should take two 4-bit inputs, B and A, and output three signals: B_less_A_o, B_greater_A_o, and B_equals_A_o. The output signals should indicate whether B is less than, greater than, or equal to A, respectively. The VHDL design should include a... | glaive | [
0.01305641420185566,
0.021831737831234932,
-0.014857848174870014,
-0.032212622463703156,
0.045208267867565155,
-0.022575857117772102,
-0.02496807649731636,
0.08317101746797562,
0.04124341160058975,
-0.020191499963402748,
0.013806543312966824,
0.02955763228237629,
-0.013640649616718292,
-0.... | 0.787497 | 0.772312 | 0.015185 |
You are tasked with creating a program that generates a sequence of frames for a sprite animation. The program should include the following features:
- The sprite should have a width of 12 and a height of 18.
- The sprite should not be horizontally or vertically tiled.
- The sprite should have a texture group named "D... | glaive | [
0.0059183333069086075,
0.01775772124528885,
-0.010121731087565422,
-0.037730418145656586,
0.02928011491894722,
-0.025116881355643272,
-0.04866641014814377,
0.10061015188694,
0.021191606298089027,
-0.03575868532061577,
0.043460600078105927,
0.018267808482050896,
-0.02985692210495472,
0.0215... | 0.790617 | 0.77519 | 0.015427 |
You are required to implement a function to solve a system of linear equations using the factorization of a complex Hermitian matrix. The matrix is factorized as A = U*D*U^H or A = L*D*L^H, and the function should solve the equation A*X = B, where A is the complex Hermitian matrix and X and B are complex matrices. The ... | glaive | [
0.03017199970781803,
0.032716330140829086,
-0.027301756665110588,
-0.05020149424672127,
0.037638138979673386,
-0.041935380548238754,
-0.019139785319566727,
0.07551410794258118,
0.03500504419207573,
-0.03243516385555267,
0.016696009784936905,
0.036748867481946945,
-0.017693085595965385,
-0.... | 0.817711 | 0.790451 | 0.02726 |
You are tasked with conducting a hypothesis test to compare the average of two random vectors, *a* and *b*, made up of binary elements. The average of *a* is 0.1467, while the average of *b* is 0.19. The ideal average of *a* is 0.15, and the ideal average of *b* is 0.2. You need to determine the sample size required to... | glaive | [
0.011558444239199162,
0.00800145510584116,
-0.041045308113098145,
-0.0478714220225811,
0.04247232526540756,
-0.03334710747003555,
-0.0177160631865263,
0.0637199729681015,
0.04956889525055885,
-0.02595400996506214,
0.0011430459562689066,
0.01657826453447342,
-0.020122729241847992,
-0.006029... | 0.784118 | 0.76305 | 0.021069 |
You need to implement a linear assignment auction algorithm using CUDA. Given a cost matrix for each graph, the algorithm should find the optimal assignment of nodes in each graph. The algorithm should run independently for each graph and should stop when the maximum number of iterations is reached or when the maximum ... | glaive | [
-0.010951709002256393,
0.034249018877744675,
-0.02377231977880001,
-0.015169285237789154,
0.01860341802239418,
-0.002207044046372175,
-0.033042144030332565,
0.0737026259303093,
0.039677634835243225,
-0.02945939637720585,
0.016304587945342064,
0.024372920393943787,
0.0044144559651613235,
0.... | 0.800737 | 0.774759 | 0.025977 |
You are tasked with implementing a function in assembly language that retrieves the CPU register values and stores them in an array. The function should take three parameters: a pointer to an array, the value of the EAX register, and the value of the ECX register. The function should retrieve the values of the EAX, EBX... | glaive | [
0.03787142410874367,
0.02144196629524231,
-0.017910314723849297,
-0.013889813795685768,
0.02320561558008194,
-0.04886576905846596,
-0.01465817354619503,
0.07239197939634323,
0.04930706322193146,
0.000418086041463539,
0.028623349964618683,
0.04717041179537773,
-0.01960321143269539,
-0.00519... | 0.791679 | 0.776934 | 0.014745 |
You are tasked with implementing a CUDA program to perform vector addition on large arrays of floating-point numbers. The goal is to add each element of two input arrays and store the result in an output array. The program should allocate memory on the device, transfer data from the host to the device, execute a kernel... | glaive | [
0.006425626575946808,
0.04739709571003914,
-0.014224737882614136,
-0.00846351869404316,
0.025000689551234245,
-0.012816179543733597,
-0.023964321240782738,
0.09890587627887726,
0.039984699338674545,
-0.02549394778907299,
0.009309454821050167,
0.041271649301052094,
-0.006185874342918396,
-0... | 0.804635 | 0.776461 | 0.028174 |
You are tasked with creating a program that calculates the sin and cos values of a given angle in degrees. Your program should include a struct called SinCos with two fields sin and cos of type f32. Additionally, you need to define three type aliases: Abc which is a tuple of three f32 values, AlphaBetaGamma which is a ... | glaive | [
0.0014010975137352943,
0.02835765853524208,
-0.03314966335892677,
-0.03496454283595085,
0.0359179712831974,
-0.01781335473060608,
-0.02270178683102131,
0.05916735529899597,
0.03427494689822197,
-0.002732911380007863,
0.046439532190561295,
0.05552423372864723,
-0.03395886719226837,
-0.01197... | 0.800329 | 0.775122 | 0.025206 |
You are tasked with creating a program that simulates drawing random values from a uniform distribution within a specified range. The program should include a parameter for the initial guess of the value, denoted as "theta_guess_me." Additionally, the program should handle cases where the initial guess is outside the s... | glaive | [
-0.0040636220946908,
0.02412191778421402,
-0.04073835536837578,
-0.02866455167531967,
0.04620174691081047,
-0.03650178015232086,
-0.03495388478040695,
0.06201433390378952,
0.03807777538895607,
-0.02703351527452469,
0.022071342915296555,
0.04845423996448517,
-0.01833992451429367,
0.00292979... | 0.798772 | 0.784257 | 0.014515 |
Write a Pascal program that calculates the sum of the first 10 natural numbers and prints the result. Ensure that the program includes a for loop to iterate through the numbers and a variable to store the sum. | glaive | [
0.012500273995101452,
0.026115909218788147,
-0.018240103498101234,
-0.02874801494181156,
0.036882106214761734,
-0.029669038951396942,
-0.010917016305029392,
0.05839816853404045,
0.039061564952135086,
-0.016550982370972633,
0.02295014262199402,
0.03893132880330086,
-0.05378204211592674,
-0.... | 0.801967 | 0.784508 | 0.017459 |
How can an AI generate a program that creates an array of length n, filled with 0s and 1s? | glaive | [
0.019686954095959663,
0.03148820996284485,
-0.010906897485256195,
-0.028313664719462395,
0.037101298570632935,
-0.04785172641277313,
-0.03065461479127407,
0.06771880388259888,
0.03313974291086197,
-0.03731432557106018,
0.01423283014446497,
0.041287828236818314,
-0.023253878578543663,
-0.02... | 0.807511 | 0.792036 | 0.015475 |
Can you provide a function that checks whether an array is sorted in O(N) complexity? | glaive | [
0.01623344048857689,
0.029379503801465034,
-0.032235682010650635,
-0.02276195026934147,
0.01966000348329544,
-0.03235999867320061,
-0.014989040791988373,
0.06104098632931709,
0.02204088494181633,
-0.01889101415872574,
0.017413923516869545,
0.008067618124186993,
-0.022699497640132904,
-0.02... | 0.807852 | 0.788218 | 0.019635 |
You are tasked with implementing a system that uses a TurboFIFO module to enqueue, increment, and dequeue elements. The system should have the following components:
- A register called "count" that stores a 16-bit value and is initialized to 0.
- A TurboFIFO module called "turbo" for enqueuing and dequeuing elements.
-... | glaive | [
0.04907797649502754,
0.005243546329438686,
-0.013992654159665108,
-0.03315702825784683,
0.029337825253605843,
-0.024205584079027176,
-0.016855621710419655,
0.09308505058288574,
0.027241326868534088,
0.0037857070565223694,
0.026318559423089027,
0.035833690315485,
-0.0295107439160347,
-0.015... | 0.798824 | 0.782991 | 0.015833 |
You are tasked with implementing a simple Java program to define a class and its associated methods. The class, called `Coord`, should have two fields, `x` and `y`, both of type `Integer`. The class should also have a constructor that takes two `Integer` parameters and initializes the fields with these values. Addition... | glaive | [
0.011436019092798233,
0.022241586819291115,
-0.03106510452926159,
-0.015512542799115181,
0.03341175243258476,
-0.03188783675432205,
-0.029668670147657394,
0.03148612752556801,
0.04857747256755829,
-0.033249691128730774,
0.03524891287088394,
0.04087337851524353,
-0.034771788865327835,
-0.00... | 0.796837 | 0.77965 | 0.017187 |
You are asked to write a program that processes a series of data points and calculates a specific value for each data point.
The data points are given in the format:
```
x_value y_value
```
where x_value is the independent variable and y_value is the dependent variable. The data points are given in increasing order of... | glaive | [
0.0008574099047109485,
0.030094575136899948,
-0.052770406007766724,
-0.03652074187994003,
0.03933202475309372,
-0.03757089003920555,
-0.017686573788523674,
0.07661747187376022,
0.061452388763427734,
-0.010383011773228645,
0.02448858879506588,
0.044015977531671524,
-0.03752877935767174,
0.0... | 0.810697 | 0.790134 | 0.020563 |
You are given an array @a containing a mix of letters ("a" through "e") and numbers (0). You need to create a program to count the occurrences of each element in the array and determine if each element is unique.
Write a Perl program that takes the array @a and uses the Set::Object module to create a set object to st... | glaive | [
-0.0012158517492935061,
0.012794546782970428,
-0.032066646963357925,
-0.020451517775654793,
0.034667421132326126,
-0.02100619301199913,
0.009916439652442932,
0.06947653740644455,
0.048706572502851486,
-0.0195012129843235,
0.019152849912643433,
0.019421299919486046,
-0.012691300362348557,
-... | 0.817432 | 0.79171 | 0.025722 |
You are tasked with creating a program that calculates the probability distribution for a quantum system with a given number of qubits and states. The program should also find the maximum probability and plot the 3D and contour graphs for the probability distribution. | glaive | [
-0.00112841185182333,
0.015686895698308945,
-0.043060485273599625,
-0.019035471603274345,
0.04560728371143341,
-0.022365102544426918,
-0.03302847966551781,
0.05367063358426094,
0.03573659807443619,
-0.015984345227479935,
0.02421126514673233,
0.04082871600985527,
-0.015645483508706093,
-0.0... | 0.797595 | 0.770597 | 0.026998 |
You are tasked with creating a program that calculates the probability of a quantum state using the provided amplitude functions. The amplitude functions are defined as follows:
- amplitude[x_,y_] := (Exp[-14 I y] (…)) /Sqrt[2^nqubits]
- amplitude2[x_,y_] := (Exp[-14 I y] (…)) /Sqrt[2^nqubits]
- probability[x_, y_] := ... | glaive | [
0.0036490431521087885,
0.0442851297557354,
-0.025506386533379555,
-0.019636258482933044,
0.04313218966126442,
-0.027778565883636475,
-0.015383115969598293,
0.06529638171195984,
0.03406592831015587,
0.006285220384597778,
0.03003082238137722,
0.031845126301050186,
-0.014590184204280376,
-0.0... | 0.790601 | 0.758949 | 0.031652 |
You are tasked with creating a program that generates a Fibonacci sequence, beginning with the numbers 4 and 26. The program should use the following operations:
- `mov $a,$b` - Moves the value of variable `$b` into variable `$a`
- `sub $a,$b` - Subtracts the value of variable `$b` from variable `$a` and stores the res... | glaive | [
0.014898620545864105,
0.028789790347218513,
-0.018617238849401474,
-0.020221440121531487,
0.04285828024148941,
-0.023876812309026718,
-0.031800441443920135,
0.06870780885219574,
0.034004852175712585,
-0.009856067597866058,
0.05142613500356674,
0.040192585438489914,
-0.04539845883846283,
-0... | 0.817627 | 0.77248 | 0.045147 |
You are tasked with creating a function that takes a string as input and returns a list of characters in the string in the order they appear. Additionally, the function should handle surrogate pairs, which are code points in the Unicode standard that require two 16-bit code units to represent a single character.
Write... | glaive | [
0.012667348608374596,
0.03965315967798233,
-0.017405515536665916,
-0.04805491864681244,
0.05533018335700035,
-0.01658352091908455,
-0.008001361973583698,
0.04631252586841583,
0.025413956493139267,
-0.028073223307728767,
0.017893429845571518,
0.041307974606752396,
-0.03697638586163521,
-0.0... | 0.811871 | 0.795211 | 0.01666 |
You are required to implement the ZLAR1V subroutine which computes the (scaled) r-th column of the inverse of the submatrix in rows B1 through BN of the tridiagonal matrix L D L^T - sigma I. The goal is to accurately compute an eigenvector when sigma is close to an eigenvalue. You need to follow the steps below to acco... | glaive | [
0.0008434856426902115,
0.04611982777714729,
-0.008965459652245045,
-0.03637295588850975,
0.050108473747968674,
-0.0014341975329443812,
0.0006866065668873489,
0.07523657381534576,
0.030024657025933266,
-0.009997055865824223,
0.015460544265806675,
0.03386026620864868,
-0.04584158957004547,
-... | 0.806734 | 0.781385 | 0.025349 |
How can I write a Python function that finds two numbers in an array with the largest sum? | glaive | [
0.00799513328820467,
0.039786603301763535,
-0.04308004304766655,
-0.04115959629416466,
0.03124169260263443,
-0.013229062780737877,
-0.028196534141898155,
0.030664803460240364,
0.02020571008324623,
-0.02036266215145588,
0.02536001242697239,
0.04074990376830101,
-0.02572757750749588,
-0.0000... | 0.804423 | 0.787851 | 0.016571 |
You are tasked with implementing a guessing game algorithm. The guessing game algorithm takes in two inputs: an integer n representing the upper limit of the range, and a list of strings representing the guesses. The guesses can be either 'Lower', 'Higher', or 'Correct'.
Your task is to write a Python function called... | glaive | [
-0.0020960629917681217,
0.015967179089784622,
-0.028785301372408867,
-0.014159874059259892,
0.03949795663356781,
-0.04322344437241554,
-0.039912786334753036,
0.04427045211195946,
0.03786339983344078,
-0.023802127689123154,
0.017052337527275085,
0.032326970249414444,
-0.022541621699929237,
... | 0.809658 | 0.768886 | 0.040772 |
How can I create a function that finds the longest common subsequence between two arrays of integers? | glaive | [
0.01619129255414009,
0.02206212282180786,
-0.04874870181083679,
-0.03538448363542557,
0.027941551059484482,
-0.01926496811211109,
-0.0381770133972168,
0.04487032815814018,
0.028148207813501358,
-0.03854954242706299,
0.016752012073993683,
0.02602727897465229,
-0.015209279023110867,
-0.00478... | 0.812952 | 0.787015 | 0.025937 |
You are tasked with implementing a CUDA-based sorting algorithm for a set of keys. The keys are 32-bit integers, and you need to implement three different sorting functions:
1. `sort_hi_bits`: This function takes in the number of keys `count` and an array of keys `keys`, and it returns a pointer to an "index" into the... | glaive | [
0.01695079356431961,
0.031421784311532974,
-0.02039121463894844,
-0.008460954762995243,
0.021285537630319595,
-0.01367358397692442,
-0.022627556696534157,
0.08522128313779831,
0.03734341636300087,
-0.004333261400461197,
0.034240126609802246,
0.01028648391366005,
-0.004153566900640726,
-0.0... | 0.807177 | 0.78883 | 0.018347 |
You are tasked with implementing a program that takes an array of two real numbers as input and performs a transformation on the array. The transformation involves converting the array into a vector and storing it in a new variable. Additionally, the program should generate a random real number and apply a normal distr... | glaive | [
0.0186912901699543,
0.02915646880865097,
-0.03279833123087883,
-0.03313353285193443,
0.04005245864391327,
0.00366497621871531,
-0.023421479389071465,
0.0656871348619461,
0.0389900803565979,
-0.028445562347769737,
0.0037959988694638014,
0.02670395001769066,
-0.020914997905492783,
-0.0067661... | 0.804561 | 0.782927 | 0.021634 |
You are tasked with implementing a function that converts a given integer into its octal representation as a string. The function should also have an optional parameter to specify the minimum number of digits to be included in the output.
Write a function called `convertToOctal` that takes an integer `num` as its firs... | glaive | [
0.007509860675781965,
0.04483679682016373,
-0.008362446911633015,
-0.040451761335134506,
0.04503091797232628,
-0.05608208850026131,
-0.026657158508896828,
0.05424097552895546,
0.04782168194651604,
-0.000598536804318428,
0.025136688724160194,
0.019942188635468483,
-0.03516414761543274,
-0.0... | 0.787643 | 0.767365 | 0.020278 |
You are tasked with creating a program using Elm that takes a list of integers as input and returns the sum of all the even numbers in the list. The program should also exclude any negative numbers from the sum.
Create a function called "sumEvenNonNegative" that takes a list of integers as input and returns the sum of... | glaive | [
0.012024685740470886,
0.009932325221598148,
-0.029331939294934273,
-0.05915841460227966,
0.03327547013759613,
-0.013068356551229954,
-0.002781151095405221,
0.02110365219414234,
0.03490506112575531,
-0.02726622112095356,
0.02425532415509224,
0.05096106976270676,
-0.043613653630018234,
-0.02... | 0.808418 | 0.770846 | 0.037572 |
You are required to write a CUDA kernel for computing Betweenness Centrality. The kernel should take in the following parameters:
- bc: Stored in global memory variable bc
- nodes: Number of nodes in the graph
- edges: Number of edges in the graph
- V: Array of size nodes+1 containing the compressed adjacency list
- E:... | glaive | [
0.015187585726380348,
0.030218299478292465,
-0.03160732984542847,
-0.010515265166759491,
0.018781734630465508,
-0.0019767514895647764,
-0.0241397712379694,
0.061999741941690445,
0.04544378072023392,
-0.022388359531760216,
0.03935858607292175,
0.03682287037372589,
-0.016656208783388138,
-0.... | 0.803558 | 0.778947 | 0.02461 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.