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
I need to write a function in Scheme that takes an integer as input and returns the bitwise complement of that integer. The function should then print the bitwise complement of the input integer, followed by the bitwise complement of the bitwise complement of the input integer. Write a function test that takes an int...
glaive
[ 0.030199984088540077, 0.039145052433013916, -0.0245570819824934, -0.03601042553782463, 0.04438534006476402, -0.05150855332612991, 0.0009746814030222595, 0.058330658823251724, 0.04232064634561539, -0.008264977484941483, 0.027297871187329292, 0.04334762319922447, -0.03726224973797798, 0.0029...
0.810669
0.794465
0.016204
You are tasked with creating a function to determine if a given number is a prime number or not. The function should take two parameters, $n (the number to be checked) and $k (the number of iterations for the Miller-Rabin primality test). The function should return 1 if the number is prime and 0 if it is not.
glaive
[ 0.01738559640944004, 0.03125293180346489, -0.020952455699443817, -0.026407266035676003, 0.03768580034375191, -0.017731424421072006, 0.01635301113128662, 0.07432247698307037, 0.027447117492556572, 0.009898345917463303, 0.016516247764229774, 0.02194938436150551, -0.02947763167321682, -0.0138...
0.812656
0.783649
0.029007
You are tasked with implementing a function that determines the relative positions of two numbers x and y in a bit-vector. The function should return true if x is less than y, and false otherwise. The function should also take into account overflow and underflow conditions. Specifically, if both x and y are non-negativ...
glaive
[ 0.012134604156017303, 0.034322720021009445, -0.032239191234111786, -0.024868521839380264, 0.0428650826215744, 0.0013682689750567079, -0.011562377214431763, 0.07913709431886673, 0.05274997279047966, -0.019698532298207283, 0.011147973127663136, 0.03447772562503815, -0.031598757952451706, -0....
0.824291
0.781441
0.04285
You are tasked with implementing a Java class that can generate overflow sequence numbers for a given table prefix in an Oracle database. The class should have the following properties and behavior: Properties: - `ConnectionSupplier conns`: A connection supplier for the database - `String tablePrefix`: A prefix for th...
glaive
[ 0.01863303780555725, 0.011517456732690334, -0.01596645824611187, -0.013637732714414597, 0.013540472835302353, -0.03019886463880539, -0.028462756425142288, 0.04759356752038002, 0.040095534175634384, -0.023595232516527176, 0.01997058279812336, 0.02339540608227253, -0.039157018065452576, 0.01...
0.800756
0.784624
0.016132
You are tasked with implementing a function to perform a specific operation on strings and numbers. Your task is to create a function that takes two operands and performs the specified operation on them. The operations include addition, subtraction, multiplication, division, modulus, left shift, right shift, bitwise AN...
glaive
[ 0.02429313026368618, 0.02750413678586483, -0.03055630251765251, -0.02620064467191696, 0.03886944428086281, -0.025680813938379288, -0.008574158884584904, 0.07879956066608429, 0.04533717781305313, -0.003151478711515665, 0.010280022397637367, 0.03279188275337219, -0.020527517423033714, -0.021...
0.808877
0.785397
0.02348
You are tasked with creating a function that calculates the Hamming distance between two strings. The Hamming distance is the number of positions at which the corresponding characters in the two strings are different. Write a function called `calculate_hamming_distance` that takes in two string parameters `s1` and `s2...
glaive
[ 0.023567084223031998, 0.020005296915769577, -0.010634812526404858, -0.029713870957493782, 0.0434415303170681, -0.040874581784009933, -0.03902830928564072, 0.038968611508607864, 0.026513265445828438, -0.02041545882821083, 0.011604306288063526, 0.017943181097507477, -0.015261905267834663, -0...
0.800478
0.757839
0.042639
You are asked to implement a program that calculates the winner of a game based on a given set of input values. The program should take the following inputs: - N: the number of elements in the array A - X: a 64-bit integer representing a value - Y: a 64-bit integer representing a value - A: an array of N 64-bit integer...
glaive
[ 0.023550327867269516, 0.015640202909708023, -0.032999150454998016, -0.02283003367483616, 0.017097927629947662, -0.016398543491959572, -0.040520742535591125, 0.06381591409444809, 0.06267955154180527, -0.04320911690592766, 0.03211017698049545, 0.04033442959189415, -0.0477217435836792, 0.0034...
0.83652
0.777509
0.059011
You are tasked with creating a program that calculates the probability distribution of a quantum state defined by the given amplitude function. The amplitude function is a complex-valued function defined as amplitude[x_,y_] and amplitude2[x_,y_]. The probability distribution is calculated using the probability[x, y_] f...
glaive
[ 0.009478352032601833, 0.028594575822353363, -0.032384201884269714, -0.03169284015893936, 0.03742033988237381, -0.028436727821826935, -0.01736551523208618, 0.07509353011846542, 0.0411357507109642, 0.002668831031769514, 0.025572137907147408, 0.030942216515541077, -0.016440337523818016, -0.00...
0.796046
0.769535
0.02651
Can you provide an algorithm that can determine if a given string contains a palindrome?
glaive
[ 0.007890736684203148, 0.019874131307005882, -0.00666210288181901, -0.026074588298797607, 0.02803119830787182, -0.04502765089273453, 0.0020429729484021664, 0.0627538189291954, 0.023661620914936066, -0.026684539392590523, 0.02110998146235943, 0.024123312905430794, -0.028557471930980682, -0.0...
0.798848
0.782957
0.015891
You are given the scores of 10 students in their first and fourth exams of their Statistics I course. You need to calculate the skewness, excess kurtosis, covariance, and correlation between the scores of the two exams. Create a program that takes the scores of the students in both the first and fourth exams as input ...
glaive
[ -0.0034373619128018618, 0.015543485060334206, -0.034952372312545776, -0.035773489624261856, 0.028585556894540787, -0.01620340347290039, -0.027211103588342667, 0.052701398730278015, 0.039358120411634445, 0.00018614932196214795, 0.0017896925564855337, 0.018949437886476517, -0.03394690528512001...
0.800585
0.777637
0.022947
You are tasked with implementing a function that performs matrix operations using the Algodiff module and Dense Ndarray in Core. The function should be able to perform basic matrix operations such as addition, subtraction, multiplication, and division on two input matrices. The function should also handle error cases s...
glaive
[ 0.03416120633482933, 0.018821222707629204, -0.024933211505413055, -0.03737778216600418, 0.0381750650703907, -0.02111137844622135, -0.03945963829755783, 0.0805535614490509, 0.05468212068080902, 0.003644372569397092, 0.013696103356778622, 0.007950329221785069, -0.01088329590857029, -0.000766...
0.799287
0.783481
0.015806
You are tasked with writing a program that takes a string input and prints each character of the string surrounded by square brackets. For example, if the input string is "hello", the program should output "[h][e][l][l][o]".
glaive
[ 0.035853780806064606, 0.03140966594219208, -0.00044889640412293375, -0.05651700496673584, 0.04601427912712097, -0.03681927174329758, -0.023342840373516083, 0.04192311689257622, 0.04568503424525261, -0.049879156053066254, 0.01805126667022705, 0.02779598906636238, -0.034782055765390396, -0.0...
0.803175
0.776687
0.026487
You are tasked with implementing a series of reduction operations on a given dataset using the provided API functions. The dataset will be in the form of a tensor, and the reduction operations include finding the sum, product, maximum, minimum, norm, and other statistical measures along a specified axis. You are requi...
glaive
[ 0.0021181032061576843, 0.02748255245387554, -0.035150475800037384, -0.03569047898054123, 0.04797092452645302, -0.014608643017709255, -0.017252877354621887, 0.0684075653553009, 0.06365302950143814, 0.014921554364264011, 0.0032877293415367603, 0.015638329088687897, -0.008173640817403793, 0.0...
0.807677
0.790407
0.01727
You are tasked with creating a program that takes a number as input and checks if the sum of its digits is greater than or equal to 10. If the sum is greater than or equal to 10, the program should return 1; otherwise, it should return 0 along with the number itself and the sum of its digits modulo 10 in a tuple format...
glaive
[ 0.01860230602324009, 0.03129290044307709, -0.02929666079580784, -0.01968752034008503, 0.04888215661048889, -0.02997160144150257, -0.02303844876587391, 0.05546630918979645, 0.019511716440320015, -0.011519070714712143, 0.024181080982089043, 0.03493911772966385, -0.053629472851753235, -0.0103...
0.829954
0.792464
0.03749
Is it possible for a neural network to find the i-th permutation of a fixed size list? Can it emulate factorial decomposition or some other method to provide a list permutation given the permutation's unique index? To provide context, I have a list of 10 items which can be arranged in 3628800 (10 factorial) unique orde...
glaive
[ 0.014429908245801926, 0.022268878296017647, -0.006248812191188335, -0.028450477868318558, 0.02845713123679161, -0.03548111021518707, -0.03594990447163582, 0.05580292269587517, 0.014335090294480324, -0.02919926866889, 0.020893851295113564, 0.0072367689572274685, -0.025957845151424408, -0.01...
0.803914
0.784556
0.019358
You have been tasked with implementing a Merill Equational Reasoning System in Standard ML. The system requires an implementation of KBO (Knuth-Bendix Ordering) with a fixed ordering on operators and fixed weights. Specifically, you need to define a function for testing whether one term is greater than another in KBO, ...
glaive
[ 0.024026911705732346, 0.021109646186232567, -0.03810330852866173, -0.0465218760073185, 0.04005014896392822, -0.029114753007888794, -0.005454560741782188, 0.07417098432779312, 0.049049634486436844, -0.014191537164151669, 0.00827305018901825, 0.03756440430879593, -0.01048962865024805, 0.0098...
0.815845
0.797768
0.018076
What is a solution to finding the maximum of three integers without using a comparison operator?
glaive
[ 0.031814564019441605, 0.016330579295754433, -0.03907499834895134, -0.026903025805950165, 0.03397185355424881, -0.004227654077112675, -0.007446642033755779, 0.04402798041701317, 0.018682371824979782, -0.05528697744011879, 0.02208072505891323, 0.04356151074171066, -0.027177833020687103, -0.0...
0.796867
0.771896
0.024971
How can I write a program that finds the maximum number within an array?
glaive
[ 0.018796812742948532, 0.029003476724028587, -0.03783916309475899, -0.027383476495742798, 0.03260500356554985, -0.03958846628665924, -0.030643634498119354, 0.044428929686546326, 0.02341315522789955, -0.04518091678619385, 0.02404211275279522, 0.04296950623393059, -0.044250696897506714, -0.01...
0.802068
0.77993
0.022138
You are tasked with implementing a data structure and related functions for managing Dual message counters in a network routing application. The structure should include the following components: - A DUAL message type enum with values for UPDATE, QUERY, and REPLY - A DualMessage struct with fields for destination ID, d...
glaive
[ 0.005193654447793961, 0.005879228003323078, -0.020949559286236763, -0.03955782949924469, 0.015105423517525196, -0.015917010605335236, -0.02344246581196785, 0.0745193138718605, 0.039299286901950836, -0.00986532773822546, 0.03600040450692177, 0.0371067151427269, -0.008953961543738842, -0.012...
0.812901
0.796344
0.016556
You need to create a function to calculate the weighted running mean of a given array of values. The function should take an AbstractVector of type T1 as input and return an AbstractVector of the same type, representing the smoothed array using the weighted running mean. The function should also take two optional param...
glaive
[ 0.00693766912445426, 0.04531257972121239, -0.03145594522356987, -0.04527755826711655, 0.0514763779938221, -0.028612490743398666, -0.04643914848566055, 0.07607254385948181, 0.03343132510781288, -0.008348474279046059, 0.027443397790193558, 0.026144584640860558, -0.010424966923892498, 0.00339...
0.804404
0.781555
0.02285
You are tasked with designing a multiplexer (mux) that selects an operation based on the input signal. The mux has 4 input ports, D, R, ST, and PC, each of which is a 4-bit std_logic_vector. Additionally, there is a 2-bit input port S and a 4-bit output port Y. The mux should select the appropriate input based on the v...
glaive
[ 0.02784646488726139, 0.02063128538429737, -0.04102634638547897, -0.016195116564631462, 0.0375940166413784, -0.021071262657642365, -0.045335039496421814, 0.07318189740180969, 0.0603470578789711, 0.002670712536200881, 0.0219078678637743, 0.04726971313357353, 0.005069184582680464, -0.02760216...
0.788694
0.772069
0.016625
You are tasked with creating a function that will perform 2d summarization on a dataset. The function should take in the following parameters: - mapping: the data mapping - data: the dataset - geom: the geometric object to use for plotting - position: the position adjustment to use - bins: the number of bins to divide ...
glaive
[ -0.006293404847383499, 0.02737678773701191, -0.05271606147289276, -0.06353399157524109, 0.053471505641937256, -0.011697808280587196, -0.038125358521938324, 0.05876411870121956, 0.04509904608130455, 0.017500873655080795, 0.013299765065312386, 0.026868699118494987, -0.023145968094468117, 0.0...
0.781829
0.762517
0.019311
You are tasked with calculating the maximum probability of a quantum state for a given set of qubits and states. The quantum state is defined by the amplitude function, which takes two variables x and y, and returns a complex number. The probability of the quantum state is calculated using the absolute square of the am...
glaive
[ 0.015603093430399895, 0.02833465114235878, -0.0412549152970314, -0.0320618711411953, 0.042693451046943665, -0.01866750977933407, -0.016412390395998955, 0.06924518942832947, 0.04201412573456764, 0.0037673916667699814, 0.026957964524626732, 0.02863945998251438, -0.02109345607459545, -0.00774...
0.784799
0.752918
0.031881
You are tasked with writing a program in 64-bit mode to allocate and deallocate memory using system calls in assembly language. The program needs to process a structure containing a list of memory allocations and deallocations, and then execute the necessary system calls to perform the memory operations. Additionally, ...
glaive
[ 0.039043769240379333, 0.02266549877822399, -0.0066142636351287365, -0.02005850523710251, 0.026567358523607254, -0.0514012947678566, -0.01811303198337555, 0.07938289642333984, 0.048557646572589874, -0.009923921898007393, 0.024692751467227936, 0.02921082265675068, -0.031036920845508575, -0.0...
0.795178
0.777528
0.01765
You are tasked with implementing a singly linked stack in a programming language of your choice. A singly linked stack is a data structure that follows the Last In First Out (LIFO) principle, where elements are added and removed from the same end, called the top. Your implementation should include the following functio...
glaive
[ 0.0014453183393925428, 0.03637232258915901, -0.007224813103675842, -0.03772955760359764, 0.02881229668855667, -0.03418498486280441, -0.007846619933843613, 0.0864872932434082, 0.030482081696391106, -0.01353096030652523, 0.02952406369149685, 0.026366598904132843, -0.01806504651904106, 0.0061...
0.814717
0.792708
0.022009
You are tasked with creating a program that calculates the probability of a quantum state based on a given amplitude function. The program should use the provided amplitude function, and calculate the probability using the formula Abs[amplitude[x, y]]^2. Additionally, the program should find the maximum probability wit...
glaive
[ 0.011423134244978428, 0.030292054638266563, -0.03304315358400345, -0.026664072647690773, 0.03567492216825485, -0.03518351539969444, -0.018156513571739197, 0.06750305742025375, 0.035408925265073776, -0.0003121911140624434, 0.027389446273446083, 0.03424878790974617, -0.016070004552602768, -0...
0.791258
0.764922
0.026336
You are tasked with implementing a function to split an edge in a graph. The graph is represented using the Snek programming language. You need to create a function called `split-edge!` that takes the following parameters: - `snk`: The graph instance - `u`: The index of the first vertex of the edge to be split - `v`: ...
glaive
[ 0.0022872898261994123, 0.023116638883948326, -0.02699992060661316, -0.04320420324802399, 0.029753196984529495, -0.033053312450647354, -0.02997288852930069, 0.044075701385736465, 0.032633546739816666, -0.00939446222037077, 0.035172246396541595, 0.019405927509069443, -0.027059463784098625, -...
0.806165
0.777316
0.028848
You are tasked with implementing a Verlet integration algorithm using GLSL (OpenGL Shading Language) for simulating the movement of particles in a 3D space. The algorithm calculates the new position and velocity of each particle based on the forces acting on it, such as gravitational attraction and mass. You are provi...
glaive
[ 0.01592579111456871, 0.03294079750776291, -0.006474578287452459, -0.0579666942358017, 0.03378298878669739, -0.031122824177145958, -0.038845811039209366, 0.06750144064426422, 0.046896569430828094, -0.028689224272966385, 0.03734184429049492, 0.03280723839998245, 0.011345948092639446, -0.0020...
0.796664
0.77715
0.019514
How can I generate Java code that returns the maximum number among two inputs?
glaive
[ 0.021089868620038033, 0.014328175224363804, -0.04011513292789459, -0.019582558423280716, 0.02085498347878456, -0.028765976428985596, -0.019920794293284416, 0.03256141394376755, 0.026732517406344414, -0.048130713403224945, 0.03422131389379501, 0.05643888935446739, -0.03455140441656113, -0.0...
0.806306
0.791328
0.014979
I need to create a program that can perform matrix multiplication on a lower triangular matrix and its self-transpose. The program should take an input integer `d_int` and a matrix `d_matrix` of dimensions `d_int` by `d_int`. It should then multiply the lower triangular of `d_matrix` with its self-transpose to create a...
glaive
[ 0.01714501529932022, 0.032379236072301865, -0.02204155921936035, -0.049185749143362045, 0.04563809558749199, -0.011842157691717148, -0.01066380925476551, 0.06250469386577606, 0.02586231753230095, -0.009180055931210518, 0.009187992662191391, 0.02998412773013115, -0.024704866111278534, -0.01...
0.802314
0.780272
0.022041
You are tasked with implementing a high-quality pseudorandom number generator for use in Monte-Carlo simulations, such as path tracing. The generator should be fast and have excellent pseudorandom statistical properties. The goal is to create a class for the Mersenne Twister pseudorandom number generator, making it thr...
glaive
[ -0.0036733036395162344, 0.02270595170557499, -0.010640100575983524, -0.02431800402700901, 0.032098930329084396, -0.022686205804347992, -0.03349948674440384, 0.0772867426276207, 0.022796571254730225, -0.007865157909691334, 0.016599074006080627, 0.035010918974876404, -0.013941610231995583, -...
0.813747
0.796041
0.017705
You are tasked with writing a program to generate a sequence of numbers based on the given algorithm. The algorithm is as follows: - Initialize a variable $0 to 1 - Initialize a variable $1 to 1 - Initialize a variable $2 to 1 - Initialize a variable $3 to 0 - Repeat the following steps until the value of $1 becomes g...
glaive
[ 0.022484052926301956, 0.028062181547284126, -0.019582772627472878, -0.03338339924812317, 0.0253354012966156, -0.01585402525961399, -0.03939218446612358, 0.08586951345205307, 0.018233507871627808, -0.028847241774201393, 0.03253750875592232, 0.04168042913079262, -0.05419323965907097, -0.0004...
0.824927
0.77486
0.050067
You are tasked with creating a test bench for an arithmetic logic unit (ALU) in a CPU. The ALU has various operations such as shift left logical (SLL), shift right logical (SRL), addition (ADD), subtraction (SUB), bitwise AND (AND), bitwise OR (OR), bitwise XOR (XOR), bitwise NOR (NOR), set less than (SLT), and set les...
glaive
[ 0.03762166202068329, 0.027390209957957268, -0.04362844303250313, -0.041907332837581635, 0.01931055635213852, -0.01782054454088211, -0.023027023300528526, 0.07256113737821579, 0.047078367322683334, -0.02902732603251934, 0.017057200893759727, 0.03283895552158356, -0.01603429578244686, 0.0019...
0.790854
0.776063
0.014792
You are tasked with implementing a program to play a solitaire card game. The game has two primary objectives: to build the four families in ascending order on the foundation, and to build continuous sorted columns starting from the largest card. The game involves metrics such as available freecells, available columns,...
glaive
[ 0.006958251353353262, 0.029543844982981682, -0.03092602640390396, -0.019952164962887764, 0.02733771689236164, -0.009663582779467106, -0.03241788595914841, 0.06474850326776505, 0.04484020173549652, -0.02805640920996666, 0.019409315660595894, 0.02603946439921856, -0.03419337049126625, 0.0004...
0.816858
0.781006
0.035851
I was concerned about the performance of C# when it comes to heavy calculations that require significant CPU power. I decided to compare the speed of C# and C++ by running some tests. The first test involves computing prime numbers below a given integer, and the second test involves finding pandigital numbers. I wrote ...
glaive
[ 0.02205009199678898, 0.03775370121002197, -0.01242461334913969, -0.016143545508384705, 0.02267373725771904, -0.04997152462601662, -0.013997584581375122, 0.1492556482553482, 0.04754010587930679, -0.02542676217854023, 0.010084131732583046, 0.029060911387205124, -0.02962612174451351, -0.02508...
0.786124
0.770102
0.016022
You are tasked with implementing a CUDA kernel function to perform the operation ax_dot_y, which multiplies each element of array x by a scalar alpha and then multiplies the result by the corresponding element of array y. The function takes in four parameters: alpha (the scalar), x (the input array), y (the output arra...
glaive
[ 0.010059762746095657, 0.05153539404273033, -0.02032010816037655, -0.016624815762043, 0.03539636731147766, -0.005768538918346167, -0.033442556858062744, 0.0848451480269432, 0.046294908970594406, -0.021945171058177948, 0.012909315526485443, 0.03144777938723564, -0.014459043741226196, -0.0038...
0.803018
0.77985
0.023168
I have an array and I need to write a function that will output the middle 3 elements of the array. However, the function should be flexible enough to handle arrays of different sizes and should also handle cases where the array size is less than 3. In cases where there is an even number of elements in the array and th...
glaive
[ 0.029636487364768982, 0.030153051018714905, -0.037675537168979645, -0.034013986587524414, 0.03476987034082413, -0.02501022256910801, -0.04928330332040787, 0.06899301707744598, 0.025798482820391655, -0.019319333136081696, 0.035726387053728104, 0.029147986322641373, -0.033493075519800186, -0...
0.811165
0.786114
0.025051
You are tasked with generating table entries giving character ranges for POSIX/Perl character classes. Your task is to figure out what the definition is, and it is easier to ask Perl about each letter from 0-128 and write down its answer. You will need to define the Perl and POSIX character classes, as well as compute ...
glaive
[ -0.0012443241430446506, 0.02085794508457184, -0.02945663593709469, -0.033744219690561295, 0.046420857310295105, -0.04879554361104965, -0.008772904984652996, 0.04983416572213173, 0.049460284411907196, -0.02459372952580452, 0.029303524643182755, 0.045737940818071365, -0.021979572251439095, -...
0.793232
0.77795
0.015282
How can I design an algorithm in Java that finds the median of a given array?
glaive
[ 0.008636600337922573, 0.015048910863697529, -0.04962855949997902, -0.03884890675544739, 0.028286060318350792, -0.02883533202111721, -0.031140010803937912, 0.0453268364071846, 0.014472798444330692, -0.04460817947983742, 0.026853134855628014, 0.011387425474822521, -0.03235376626253128, -0.01...
0.789754
0.775082
0.014672
You are tasked with implementing a function in the given programming framework that identifies whether a given input satisfies a set of conditions. Specifically, you need to create a function that checks if a given input `theta` meets certain criteria, and if not, provides a reason. The function `is_element/E/subdiv` ...
glaive
[ 0.03189391642808914, 0.0063704028725624084, -0.03513218089938164, -0.036489471793174744, 0.041971947997808456, -0.030539941042661667, 0.003936854191124439, 0.08463871479034424, 0.024698853492736816, -0.005224534310400486, 0.023718567565083504, 0.022052686661481857, -0.006260786205530167, -...
0.820771
0.78904
0.031732
How can I develop a Python function that takes in an array of numerical values and returns the index of the greatest entry within that array? I want to iterate over each element and compare it to the remaining ones in order to identify the maximum value and its respective position. ```python arr = [4, 7, 9, 2, 10] de...
glaive
[ 0.042634982615709305, 0.038132019340991974, -0.03359300643205643, -0.022159354761242867, 0.02869250997900963, -0.04146751016378403, -0.026964295655488968, 0.04373694211244583, 0.01796969771385193, -0.023833509534597397, 0.039491962641477585, 0.024942712858319283, -0.0447288416326046, 0.008...
0.810328
0.793508
0.01682
You are required to write a subroutine in Fortran that sets parameters for a matrix generator based on the type of matrix to be generated. The subroutine should take the following input parameters: - PATH: a character string representing the LAPACK path name - IMAT: an integer key describing which matrix to generate fo...
glaive
[ 0.017196791246533394, 0.009166732430458069, -0.03617894649505615, -0.04861818626523018, 0.03806895762681961, -0.033967699855566025, -0.0256931334733963, 0.06026783585548401, 0.03333774954080582, -0.02097201533615589, 0.02476913295686245, 0.05448850616812706, -0.01874188333749771, 0.0089994...
0.783021
0.75912
0.0239
You are tasked with creating a program that calculates the difference between the n-th prime number and the (n+2)-nd prime number. Your program should take an input n and output the difference between the two prime numbers at the n-th and (n+2)-nd positions.
glaive
[ 0.03428440913558006, 0.022223852574825287, -0.01649436540901661, -0.040964607149362564, 0.031044473871588707, -0.02860741876065731, -0.032555676996707916, 0.07027266174554825, 0.0463678315281868, -0.019127987325191498, 0.03552619367837906, 0.02601585164666176, -0.05636909231543541, -0.0055...
0.822096
0.782888
0.039208
I need to create a program that implements the Huffman coding algorithm to compress data. The program should take in a list of elements and their respective frequencies, as well as a parameter 'b' which represents the number of elements to combine at each step. The program should then create a Huffman tree based on the...
glaive
[ -0.006621564272791147, 0.008739541284739971, -0.031749095767736435, -0.050679054111242294, 0.044398147612810135, -0.035650208592414856, 0.017002452164888382, 0.0879945456981659, 0.03432959318161011, -0.03102508746087551, 0.018794218078255653, 0.025630254298448563, -0.020570872351527214, -0...
0.799673
0.780646
0.019027
You are tasked with creating a program that computes the probability of a quantum state for a given set of qubits and states. The program should use the provided functions amplitude[x_,y_], amplitude2[x_,y_], and probability[x_, y_] to calculate the probability of the quantum state. Your program should then use the NM...
glaive
[ -0.00814455933868885, 0.04102440923452377, -0.0233912356197834, -0.018963247537612915, 0.037750549614429474, -0.018718672916293144, -0.011649222113192081, 0.07621653378009796, 0.037434786558151245, 0.0004043768276460469, 0.029309500008821487, 0.03389394283294678, -0.013446602039039135, -0....
0.79221
0.763751
0.028459
You are tasked with creating a function that takes in a table of playsessions and returns the total number of playsessions recorded. Each playsession is represented as a table with a player's name and their corresponding playtime in seconds. Your function should take the playsession table as input and return the tota...
glaive
[ 0.02314870059490204, 0.03749203309416771, -0.05191565304994583, -0.040940482169389725, 0.026454396545886993, -0.010969788767397404, -0.006638265214860439, 0.01368310023099184, 0.04008921608328819, -0.008405285887420177, 0.042058128863573074, -0.0002816219930537045, -0.03567933291196823, -0...
0.791942
0.774715
0.017227
I am trying to generate all possible n-tuples (n-uplets) of integers given a start value, a size, and a maximum value. The n-uplet is essentially a list of integers of length n. For example, if start=1, size=2, and max=3, the possible 2-uplets would be [[1,2], [1,3], [2,3]]. I need to implement a function that can gene...
glaive
[ 0.019408253952860832, 0.024840297177433968, -0.026370154693722725, -0.020927535369992256, 0.03595464676618576, -0.03377273306250572, -0.02271196059882641, 0.0639113038778305, 0.02623198926448822, -0.032091062515974045, 0.02610716223716736, 0.049187663942575455, -0.04513741657137871, -0.025...
0.826498
0.803024
0.023474
You are tasked with implementing a function to calculate the hyperbolic sine of a given input value. The hyperbolic sine function is defined as: sinh(x) = (exp(x) - 1 / exp(x)) / 2 You need to implement this function in either f32 or f64 types, depending on the input type. Additionally, you must account for the follo...
glaive
[ -0.00034520073677413166, 0.03903145343065262, -0.032403670251369476, -0.015750160440802574, 0.03319922089576721, -0.01008838601410389, -0.017552008852362633, 0.09471689164638519, 0.048595622181892395, 0.0003835385723505169, 0.044262465089559555, 0.039426304399967194, -0.01967269368469715, ...
0.797339
0.768824
0.028515
You are tasked with implementing a random number generator in Moscow ML using the Random structure. Your goal is to create a function that generates a list of n random numbers within a specified range (min, max). The random numbers should be generated using the given formula: (min + floor(real(max-min) * seed / m)), wh...
glaive
[ 0.031739965081214905, 0.017365753650665283, -0.026246998459100723, -0.04960181191563606, 0.04661170393228531, -0.02733681909739971, -0.04984761402010918, 0.060798462480306625, 0.03675571829080582, -0.016771333292126656, 0.011241019703447819, 0.053799230605363846, -0.028875872492790222, 0.0...
0.808054
0.783076
0.024979
You are tasked with developing a program that reads a file containing a list of integers and performs some operations on the data. The input file contains a list of integers representing adapters that can be used to connect different devices. Each integer represents the voltage output of the corresponding adapter. Your...
glaive
[ 0.024549240246415138, 0.02316112630069256, -0.039724286645650864, -0.03799785301089287, 0.03284185752272606, -0.030606497079133987, -0.03460095450282097, 0.07089662551879883, 0.037792906165122986, -0.013796082697808743, 0.019737141206860542, 0.030122872442007065, -0.01865842007100582, -0.0...
0.824194
0.800192
0.024002
You are tasked with creating a program that reads data from a CSV file and processes it according to specific rules. The CSV file contains lines of data, each representing a mathematical model and its associated parameters. Each line is formatted as follows: "{a1,a2,a3,a4,a6}&p&f&n&j&k&c", where a1, a2, a3, a4, and a6 ...
glaive
[ 0.010372547432780266, 0.020812762901186943, -0.045431096106767654, -0.022212380543351173, 0.04652518033981323, -0.03847842663526535, -0.012230277992784977, 0.0691775232553482, 0.05444154888391495, -0.019548146054148674, 0.009151695296168327, 0.019311020150780678, -0.026786774396896362, -0....
0.812266
0.792525
0.019741
You are tasked with implementing a CUDA program that demonstrates block reduction using the CUB library. The goal is to find the maximum value in a given array using block reduction with different algorithms. You need to implement the necessary CUDA kernels and functions to achieve this. Your program should include th...
glaive
[ 0.011070985347032547, 0.046011701226234436, -0.04675031825900078, -0.009352550841867924, 0.026561178267002106, -0.004941008053719997, -0.025058986619114876, 0.07665722817182541, 0.04823828861117363, -0.014062391594052315, 0.017141684889793396, 0.028372300788760185, 0.0073404680006206036, 0...
0.808894
0.794131
0.014763
Can you provide a C++ function that can find the maximum element in an array?
glaive
[ 0.032808877527713776, 0.02786567248404026, -0.03293439373373985, -0.026828501373529434, 0.032641828060150146, -0.03252420946955681, -0.01985340379178524, 0.08041435480117798, 0.03993223235011101, -0.02969983033835888, 0.03045317344367504, 0.04202089458703995, -0.029532555490732193, -0.0124...
0.797053
0.778533
0.01852
Can you help me classify the following code? Is it a python function or a code section? ```python def calculate_average(numbers): total = sum(numbers) average = total / len(numbers) return average result = calculate_average([2, 4, 6, 8]) print(result) ```
glaive
[ 0.005436463747173548, 0.029911793768405914, -0.03559178486466408, -0.04314837604761124, 0.04015762731432915, -0.02943265810608864, -0.006686357781291008, 0.04184626787900925, 0.012658397667109966, -0.0002852716133929789, 0.018135521560907364, 0.032174594700336456, -0.023602690547704697, -0...
0.78368
0.764217
0.019463
You are tasked with implementing CUDA kernels for fused vector operations and vector array operations. The goal is to write CUDA kernels for the following operations: 1. Linear combination of nv vectors 2. Scaled sum of one vector with nv other vectors 3. Dot product of one vector with nv other vectors 4. Linear sum of...
glaive
[ 0.011528587900102139, 0.05431597679853439, -0.019558729603886604, -0.02320520207285881, 0.027297120541334152, 0.007321080658584833, -0.02215057611465454, 0.08359616994857788, 0.040345463901758194, -0.015129548497498035, 0.022659994661808014, 0.019781462848186493, -0.00023818302724976093, -...
0.793035
0.774271
0.018764
You are tasked with implementing a tiled ridge detection algorithm using CUDA technology. The goal is to perform ridge detection individually by each tile and with only its data. The algorithm should consider available tile types to use and describe the general ridge detection behavior relative to all tiles. Your task...
glaive
[ -0.007783778477460146, 0.04667108878493309, -0.011495211161673069, -0.014463488943874836, 0.014444470405578613, -0.015521316789090633, -0.01779203489422798, 0.09630708396434784, 0.041695281863212585, -0.014560653828084469, 0.02150736004114151, 0.02456432767212391, -0.0029830983839929104, 0...
0.799195
0.780783
0.018412
You are tasked with writing a program that calculates the chi-square statistic for a given dataset and then compares it to the critical chi-square value to determine if the dataset is uniformly distributed. Your program should perform the following steps: 1. Calculate the mean of the dataset. 2. Calculate the chi-squa...
glaive
[ -0.02048245631158352, 0.021723872050642967, -0.03166276961565018, -0.03625909611582756, 0.0463404543697834, -0.012769118882715702, -0.02435852214694023, 0.07264333963394165, 0.029105328023433685, -0.020961854606866837, 0.0024629479739814997, 0.026385344564914703, -0.028613829985260963, -0....
0.797244
0.777212
0.020031
You are tasked with implementing a module for generating random terms in Standard ML. The module should include algorithms for generating terms with respect to uniform probability over all possible terms of a certain size and type. The module should also include functions for generating all terms up to a fixed size wit...
glaive
[ 0.005720366723835468, 0.01710965298116207, -0.0204328540712595, -0.05001119151711464, 0.03975977748632431, -0.028080236166715622, -0.04249479994177818, 0.035984236747026443, 0.02335452288389206, -0.02542579360306263, 0.011230318807065487, 0.038366205990314484, -0.020862197503447533, 0.0167...
0.810728
0.794619
0.016109
You are tasked with creating a program that generates all unique pairs of integers (i, j) such that 1 <= j < i <= n. You will then need to determine the sum of each pair and check if it is a prime number. If the sum of a pair is a prime number, the pair should be included in the final result. Your program should output...
glaive
[ 0.014126937836408615, 0.022085871547460556, -0.028055017814040184, -0.034787602722644806, 0.03426719084382057, -0.02100551873445511, 0.004515164997428656, 0.060378629714250565, 0.037242911756038666, -0.021876871585845947, 0.023889748379588127, 0.024524202570319176, -0.040939997881650925, -...
0.830269
0.786219
0.04405
You are tasked with creating a typeclass to handle machine arithmetic in Haskell. The typeclass should be able to handle arithmetic operations for the `Int` type, while also taking into account the possibility of arithmetic overflows. This is important because simple arithmetic operations over very large or very tiny i...
glaive
[ 0.04343957081437111, 0.03125376999378204, -0.004957680590450764, -0.028164543211460114, 0.0520399734377861, -0.017823610454797745, -0.0035057764034718275, 0.06285226345062256, 0.044621165841817856, -0.03259815275669098, 0.02234720252454281, 0.04460939019918442, -0.007773114833980799, -0.02...
0.798126
0.777159
0.020968
You are tasked with creating a function in Racket called naive-fxpa that takes in a list of numbers and returns a new list with each number multiplied by 2. For example, if the input list is (1 2 3 4), the output should be (2 4 6 8). Write a Racket function called naive-fxpa that takes a list as input and returns a ne...
glaive
[ 0.04377047345042229, 0.021163422614336014, -0.035384442657232285, -0.03096868097782135, 0.051260583102703094, -0.024926429614424706, 0.001997617771849036, 0.061384543776512146, 0.03775728493928909, -0.008597154170274734, 0.012615970335900784, 0.05768587067723274, -0.04173903167247772, -0.0...
0.805751
0.788888
0.016863
You are tasked with creating a program that reads a series of numbers from a file and organizes them into a specific data structure. The input file contains a list of integers, with each integer representing a value to be stored. Your program should read the input file and store the integers in a specific data structur...
glaive
[ 0.031141437590122223, 0.004183901473879814, -0.0420963279902935, -0.035318270325660706, 0.040736034512519836, -0.03405037149786949, -0.01806572452187538, 0.06193309277296066, 0.034310974180698395, -0.020884985104203224, 0.015181989409029484, 0.02207271009683609, -0.04668174311518669, -0.01...
0.822174
0.780271
0.041903
You are tasked with implementing a DES encryption algorithm using the OpenSSL library in C. The DES (Data Encryption Standard) algorithm is a symmetric key block cipher that encrypts and decrypts data in 64-bit blocks. Your task is to write the code to implement the DES encryption algorithm using the given code snippet...
glaive
[ 0.02431515045464039, 0.02641724981367588, -0.024079300463199615, -0.04684966802597046, 0.036345601081848145, -0.036017872393131256, -0.03631839528679848, 0.08393155783414841, 0.03551468625664711, -0.02307005785405636, 0.018675150349736214, 0.0028466926887631416, -0.03587017208337784, -0.00...
0.788868
0.773257
0.01561
How can I create a function that calculates the sum of the integers in an array?
glaive
[ 0.013308615423738956, 0.041723351925611496, -0.036696210503578186, -0.0322711244225502, 0.05972058326005936, -0.037472378462553024, -0.029736153781414032, 0.044871289283037186, 0.02839290350675583, -0.025684963911771774, 0.015763720497488976, 0.028965281322598457, -0.044980380684137344, -0...
0.791167
0.775993
0.015174
You are tasked with implementing a CUDA kernel that performs various arithmetic operations on arrays of elements. The kernel should be able to handle unary, binary, and trinary operations such as addition, subtraction, multiplication, division, and multiply-accumulate. The input and output should be of the type `cutlas...
glaive
[ 0.0288524366915226, 0.0549953356385231, -0.029306259006261826, -0.01989072374999523, 0.033239997923374176, -0.01201415155082941, -0.021467916667461395, 0.09343117475509644, 0.053816404193639755, -0.017525924369692802, 0.030809279531240463, 0.03545749559998512, 0.0007220176630653441, -0.008...
0.800528
0.781281
0.019246
How can I find the most commonly occurring item in an array using a Java program?
glaive
[ 0.00046673850738443434, 0.02417575940489769, -0.04686727002263069, -0.03093535453081131, 0.03388158231973648, -0.0427452027797699, -0.0352555587887764, 0.049568504095077515, 0.025307103991508484, -0.05125175416469574, 0.025519181042909622, 0.0023223126772791147, -0.023031657561659813, -0.0...
0.782426
0.767796
0.01463
I need to write a program that takes a number 'n' as input and performs the following operations: - If n is less than 0, add 10 to it - If n is equal to 0, multiply it by 1 - If n is greater than 0, divide it by 10 - If n is greater than or equal to 10, multiply it by 10 - Calculate the product of the digits of n and t...
glaive
[ 0.016334351152181625, 0.03507212921977043, -0.03677650913596153, -0.02034057304263115, 0.043949224054813385, -0.024708373472094536, -0.020026076585054398, 0.07765593379735947, 0.03024788200855255, -0.010630478151142597, 0.012406268157064915, 0.022389555349946022, -0.06060374900698662, -0.0...
0.82841
0.796271
0.032139
You are tasked with creating a function in F# that takes in a list of random floats and returns the sum of all the elements in the list. Write a function called "sum_of_random_floats" that takes in a parameter "n" representing the number of random floats to generate. The function should use the "list_of_random_floats"...
glaive
[ 0.0022684289142489433, 0.030007710680365562, -0.017750676721334457, -0.05683250352740288, 0.06776485592126846, -0.033920541405677795, -0.019240740686655045, 0.048767078667879105, 0.02141929417848587, 0.0018783144187182188, 0.0141875259578228, 0.05713243782520294, -0.0468735545873642, -0.00...
0.792767
0.772571
0.020196
You have been tasked with creating a program that calculates the probability of a quantum state in a quantum system. The quantum state is represented by the amplitude function, which takes two parameters (x and y) and is given by the complex mathematical expression provided. The probability of the quantum state is calc...
glaive
[ 0.0049278587102890015, 0.032712843269109726, -0.030750293284654617, -0.016927309334278107, 0.046228647232055664, -0.025743601843714714, -0.021137017756700516, 0.07479363679885864, 0.027835344895720482, 0.0038535045459866524, 0.024193167686462402, 0.037209462374448776, -0.019780512899160385, ...
0.795705
0.762921
0.032784
Can you help me create a program that generates Fibonacci numbers up to a given number?
glaive
[ 0.007406193763017654, 0.013551024720072746, -0.02963870018720627, -0.03062541037797928, 0.029044298455119133, -0.04823713377118111, -0.019990354776382446, 0.0545506551861763, 0.0311902966350317, -0.03594652935862541, 0.027209443971514702, 0.046983037143945694, -0.04449140280485153, -0.0146...
0.798984
0.784635
0.014348
You are tasked with implementing a bucket sort algorithm using CUDA kernels in C programming language. The goal is to sort an input array of floating-point numbers into float4 aligned buckets of roughly equal size. To achieve this, you will need to perform the following steps in your solution: - Create a 1024 bin hist...
glaive
[ 0.015743955969810486, 0.030982645228505135, -0.010104128159582615, -0.02282244712114334, 0.02283022738993168, -0.03510453552007675, -0.03290094807744026, 0.08305595070123672, 0.049247369170188904, -0.021198496222496033, 0.027621259912848473, 0.04512396454811096, -0.013064680621027946, 0.00...
0.815688
0.783173
0.032515
You are tasked with implementing a SHA1 hashing algorithm in Haskell. The SHA1 hashing algorithm takes a string as input and produces a 160-bit (20-byte) hash value known as a message digest. The algorithm is designed to be secure and produce a unique hash value for every unique input. Your task is to implement the fol...
glaive
[ 0.026947788894176483, 0.01602606102824211, 0.01761544682085514, -0.04120128974318504, 0.03997727110981941, -0.02213628590106964, 0.005241535138338804, 0.04495618864893913, 0.04612313583493233, -0.026229161769151688, 0.004577713552862406, 0.0213321465998888, -0.016582878306508064, -0.031136...
0.794223
0.777968
0.016255
You are tasked with creating a program to calculate the probability of a quantum state using the given amplitude function. The amplitude function is defined as follows: ```mathematica amplitude[x_,y_] := (Exp[-13 I y] (2 (I Sin[x])^7 Cos[x]^7) + ... + 1 (I Sin[x])^14) + Exp[13 I y] (1 (I Sin[x])^10 Cos[x]^4 + 1 (I Sin[...
glaive
[ 0.004304561764001846, 0.033994924277067184, -0.023332444950938225, -0.02642442099750042, 0.03904152661561966, -0.021163705736398697, -0.009868760593235493, 0.07657510042190552, 0.04108341038227081, 0.00867538247257471, 0.0324019230902195, 0.03193918615579605, -0.016754010692238808, -0.0271...
0.791942
0.761808
0.030133
You are tasked with creating a C++ program to calculate the maximum-minimum difference of a given array of experimental data. The experimental data is represented by an array of double values. The program should calculate the difference between the maximum and minimum values of the array and return the result. Addition...
glaive
[ 0.0005648497026413679, 0.005776728969067335, -0.03396192565560341, -0.05216772481799126, 0.05004137381911278, -0.024823438376188278, -0.056792523711919785, 0.10273781418800354, 0.05978134647011757, -0.016477864235639572, 0.027660056948661804, 0.041401732712984085, -0.024579206481575966, 0....
0.799281
0.767482
0.031799
You are tasked with implementing a program to calculate the value of the sequence A207836, defined as a(n) = n*A052530(n)/2, where A052530 is the number of Dyck paths of semilength n. The first few terms of the sequence are: 0, 3, 16, 75, 336, 1463, 6240, 26199, 108640, 445995, ... Your program should be able to compu...
glaive
[ 0.0037673315964639187, 0.037695396691560745, -0.020007692277431488, -0.036794550716876984, 0.023057516664266586, -0.018692675977945328, -0.028142835944890976, 0.06057814881205559, 0.024559831246733665, -0.020334962755441666, 0.02475542575120926, 0.044692110270261765, -0.03299897536635399, ...
0.829395
0.781326
0.048069
You are tasked with calculating the sum of the digits in the number of palindromes less than a googol (10^100). A number is considered a palindrome if the digits read the same backwards as forwards. For example, 1, 88, 343, 234565432, etc., are all palindromes. Your task is to count all the palindromes greater than zer...
glaive
[ -0.0013959277421236038, 0.018352577462792397, -0.016114093363285065, -0.037079859524965286, 0.029406538233160973, -0.012099322862923145, -0.01897789165377617, 0.04975301772356033, 0.03229207172989845, -0.01744009554386139, 0.0138764139264822, 0.024153580889105797, -0.03920035436749458, -0....
0.841063
0.788569
0.052494
I need to implement the bubble sort algorithm in Python. Can anyone help me with this? I have a sequence of unique whole numbers: [17, 2, 11, 6, 13].
glaive
[ 0.021251549944281578, 0.0240964125841856, -0.03266647830605507, -0.024287134408950806, 0.032731905579566956, -0.029711889103055, -0.021381886675953865, 0.04413612186908722, 0.01474778726696968, -0.013888933695852757, 0.018770232796669006, 0.032110631465911865, -0.029355768114328384, -0.011...
0.824925
0.804445
0.02048
You are tasked with creating a program in R that computes the correlation matrix for a given set of genetic data. The program will take input arguments in the following order: .raw file, gene set file, MAGMA output file, pheno name, and working directory. The raw file contains genetic data, the gene set file contains a...
glaive
[ 0.009969139471650124, 0.028329653665423393, -0.036299023777246475, -0.03442025184631348, 0.030631253495812416, -0.024954067543148994, -0.03764322027564049, 0.05864325165748596, 0.03165941685438156, -0.01998676173388958, 0.004381204955279827, 0.03957316651940346, -0.033660631626844406, 0.00...
0.783993
0.765536
0.018456
You are tasked with implementing a function to calculate the Levenshtein edit distance between strings using CUDA. The Levenshtein distance is a measure of the similarity between two strings, which is defined as the minimum number of single-character edits (insertions, deletions, or substitutions) required to change on...
glaive
[ -0.0038122183177620173, 0.032219741493463516, -0.013661946170032024, -0.021386180073022842, 0.03557185083627701, -0.010209244675934315, -0.03125503286719322, 0.09789898246526718, 0.05528685078024864, -0.02511909417808056, 0.026234211400151253, 0.03918712958693504, -0.0011423657415434718, 0...
0.811034
0.782865
0.028169
You are tasked with creating a DSL (Domain-Specific Language) for infinite sequences. The DSL should include the following operations: 1. Create a constant sequence with a given value |c|: |conSeq c| 2. Add two sequences componentwise: |addSeq f g| 3. Lift a binary operation |op| to the corresponding operation on seque...
glaive
[ -0.008245399221777916, 0.0367564782500267, -0.0021651878487318754, -0.027558090165257454, 0.02107446826994419, -0.0005297739407978952, -0.0201400276273489, 0.06752528995275497, 0.035906754434108734, -0.03356368839740753, 0.028593236580491066, 0.05131695047020912, -0.01977740228176117, -0.0...
0.815198
0.778346
0.036853
How can I create an algorithm to calculate the maximum path sum of a binary tree using recursion?
glaive
[ -0.00010073651355924085, 0.02085890807211399, -0.02396382950246334, -0.03176969662308693, 0.030897075310349464, -0.023460503667593002, -0.008871420286595821, 0.045234888792037964, 0.02421065792441368, -0.03601699694991112, 0.028274616226553917, 0.02900615520775318, -0.025254035368561745, -...
0.807281
0.784821
0.02246
Can you provide a Python algorithm that finds two numbers in an array whose sum is equal to a given target?
glaive
[ 0.009686397388577461, 0.024402504786849022, -0.04646513983607292, -0.03705107420682907, 0.03436969965696335, -0.02864558808505535, -0.023671606555581093, 0.021362941712141037, 0.019085336476564407, -0.03364447504281998, 0.023781130090355873, 0.019956914708018303, -0.031801555305719376, -0....
0.810857
0.793809
0.017048
You are tasked with creating a game called "GEOWAR". The game is set in the first quadrant of a regular coordinate graph, with five enemy installations located within a 30 by 30 unit area. Your base is located within a 10 by 10 unit area adjacent to the origin. The objective of the game is to hit the enemy installation...
glaive
[ 0.010482600890100002, 0.015465020202100277, -0.04395844042301178, -0.03382159397006035, 0.028199452906847, -0.021417925134301186, -0.025431305170059204, 0.05553697794675827, 0.036737505346536636, -0.03102477826178074, 0.03191437944769859, 0.028749048709869385, -0.03617223724722862, -0.0231...
0.792219
0.764479
0.02774
You are tasked with creating a program that generates a sequence of numbers based on the following rules: - a(0) = a(1) = 0 - thereafter a(n) = 2*a(n-1)*a(n-2) + 1 Your program should be able to take an input n and output the nth number in the sequence.
glaive
[ 0.0398898608982563, 0.028482584282755852, -0.01266514603048563, -0.034604981541633606, 0.020465990528464317, -0.02702517993748188, -0.039804767817258835, 0.06925499439239502, 0.020067084580659866, -0.04160202667117119, 0.031835202127695084, 0.0405782014131546, -0.05161161720752716, -0.0226...
0.826365
0.776745
0.04962
You are tasked with creating a program that takes an array T and transforms its data according to the following rules: - If the value is less than 0, it should be multiplied by 2 - If the value is greater than or equal to 0, it should be divided by 2 The transformed data should then be stored in a new array. Write a f...
glaive
[ 0.028018012642860413, 0.04340902343392372, -0.0460018590092659, -0.024516809731721878, 0.045878734439611435, -0.03627477213740349, -0.03050471656024456, 0.06772319972515106, 0.02040342055261135, -0.019164299592375755, 0.01427420973777771, 0.007450892124325037, -0.03628324344754219, -0.0267...
0.819126
0.787969
0.031157
You are tasked with creating a program that defines a table schema for a database. The table schema should include the definition of columns, their data types, encodings, and other properties. The schema should also include the history of schema evolution and table properties. Your task is to define a data structure i...
glaive
[ 0.027424488216638565, 0.0005050344625487924, -0.05401574447751045, -0.026578834280371666, 0.03904026001691818, -0.0641210675239563, -0.013805117458105087, 0.04614577814936638, 0.02594599314033985, -0.02933390624821186, 0.025660023093223572, 0.020338037982583046, -0.04318748787045479, 0.019...
0.775011
0.757757
0.017254
You are tasked with implementing a CUDA C program to generate a Julia set image. The Julia set is a fractal that can be visualized as an image, with each pixel representing a complex number. The program should use parallel programming techniques to calculate whether each pixel is in the Julia set or not, and then gener...
glaive
[ -0.028576822951436043, 0.045784059911966324, -0.029559165239334106, -0.020011771470308304, 0.02545345388352871, -0.03584907948970795, -0.024142008274793625, 0.10781874507665634, 0.07091788947582245, -0.024310022592544556, 0.03667215257883072, 0.033346280455589294, -0.017095763236284256, -0...
0.792704
0.777123
0.015581
You are tasked with implementing a function that uses series expansion to compute M_n_coeff for a given Transit_Struct. The function should compute the leading coefficient (n=0) and then compute for n_max-3 to n_max. The function should keep track of k^2 < 1 and k^2 >= 1 using a 3-dimensional array. The array Mn_coeff[...
glaive
[ 0.020919548347592354, 0.043878357857465744, -0.03686199709773064, -0.05172652751207352, 0.048254892230033875, -0.021785223856568336, -0.03575030341744423, 0.07205702364444733, 0.026523778215050697, -0.0004986395360901952, 0.004130628891289234, 0.025877462700009346, -0.03584689646959305, -0...
0.81961
0.781628
0.037982
How can I handle this HackerRank challenge in Python? Challenge: Create the following function: ```def dominant_character(string: str) -> str:``` Given a string of length N, find the dominant character. A dominant character is a character that appears more than ⌊ N/2 ⌋ times. However, this time we need to optimize f...
glaive
[ 0.012717542238533497, 0.02379009500145912, -0.022166406735777855, -0.04389603063464165, 0.012436282820999622, -0.025562258437275887, -0.004659241996705532, 0.045126207172870636, 0.02105492167174816, -0.018398160114884377, 0.011737476103007793, 0.028653426095843315, -0.03087860718369484, -0...
0.836759
0.815609
0.02115
You are tasked with creating an Elixir module that calculates the area and perimeter of a rectangle. The module should have functions for calculating the area and perimeter of the rectangle, and the values for the length and width of the rectangle should be passed as parameters to these functions. The module should als...
glaive
[ 0.01305366214364767, 0.053548891097307205, -0.01759856939315796, -0.049410801380872726, 0.004040995612740517, -0.02878131903707981, -0.018360348418354988, 0.0484204962849617, 0.0351489894092083, 0.0004903151420876384, 0.027592314407229424, 0.04328402876853943, -0.019556593149900436, -0.022...
0.784581
0.769963
0.014618
Can you provide an algorithm to check whether a given number is prime or not?
glaive
[ 0.027349255979061127, 0.005620913114398718, -0.004323570989072323, -0.03169950097799301, 0.013657031580805779, -0.04805457592010498, 0.003728994634002447, 0.0552733950316906, 0.03174985572695732, -0.030248776078224182, 0.023593777790665627, 0.011422328650951385, -0.03458444029092789, -0.02...
0.795415
0.773151
0.022264
You are tasked with creating a function that takes two unsigned 64-bit integers, `a` and `b`, and implements the following operations: 1. Calculate the quotient and remainder of `a` divided by `b`. 2. Calculate the quotient of `a` divided by `b`, rounding up if the remainder is non-zero. 3. Determine the smallest numbe...
glaive
[ 0.02453940361738205, 0.04621706157922745, 0.0018242384539917111, -0.02251199446618557, 0.05152887850999832, -0.017775515094399452, -0.0025364526081830263, 0.07152536511421204, 0.03726620227098465, -0.01713295467197895, 0.03173604607582092, 0.03994596004486084, -0.01144362147897482, -0.0082...
0.820979
0.783368
0.037611
You are tasked with implementing a function that performs various arithmetic and logical operations for a CPU. The function takes a set of inputs and based on the opcode and other parameters in the input, it should perform different operations like branching, jumping, shifting, loading, storing, and more. The function ...
glaive
[ 0.03756745532155037, 0.034674856811761856, -0.01269084494560957, -0.009284770116209984, 0.036347970366477966, -0.019792331382632256, -0.022454485297203064, 0.08777005970478058, 0.049004070460796356, 0.0013478053733706474, 0.01624274253845215, 0.04796503484249115, -0.005138217005878687, -0....
0.794896
0.779584
0.015312
You are tasked with creating a function that calculates the result of raising a number to a power, and then manipulating the result in a specific way. Your function should take two parameters: n and k, where n is the base number and k is the exponent. The function should then calculate n raised to the power of k and re...
glaive
[ 0.038808517158031464, 0.04743979498744011, -0.02321409061551094, -0.04848078638315201, 0.040918610990047455, -0.04542435333132744, -0.00428943894803524, 0.06439579278230667, 0.051650021225214005, -0.009327596053481102, 0.023535171523690224, 0.053495731204748154, -0.05276397615671158, -0.01...
0.807685
0.790471
0.017214
You are tasked with implementing a function to shuffle the elements of a list in random order. The function should take a list as input and return a new list with all the elements of the original list shuffled. The output list should have the same length as the input list, and the order of the elements should be comple...
glaive
[ 0.01825656183063984, 0.02847648784518242, -0.015735002234578133, -0.03842409327626228, 0.043164316564798355, -0.021638477221131325, -0.03247644752264023, 0.03597623109817505, 0.04254777729511261, -0.012850111350417137, 0.007089874241501093, 0.029784753918647766, -0.028567537665367126, -0.0...
0.790822
0.769589
0.021232
You are tasked with creating a program that categorizes Japanese words based on their part of speech (POS). The POS categories include "Independent Words," "Declinable Words," "Modifiers," "Conjunctions," "Interjections," and "Ancillary Words." Each category has subcategories like Nouns, Pronouns, Verbs, Adjectives, Ad...
glaive
[ 0.029433773830533028, 0.005584666971117258, -0.019771894440054893, -0.02958732657134533, 0.043582428246736526, -0.021309277042746544, -0.02058880589902401, 0.05408361181616783, 0.03653097525238991, -0.01376084890216589, 0.010219925083220005, 0.00881168246269226, -0.04562148451805115, 0.019...
0.773265
0.755996
0.017269
You are tasked with implementing a function that performs segment sort pairs on a set of keys and values. The function signature is as follows: ```cpp template<class Tkey, class Tval> void segsortpairs( Tkey *d_keys, Tval *d_vals, unsigned N, const int *d_segmen...
glaive
[ 0.017143873497843742, 0.022448353469371796, -0.03788742423057556, -0.009194180369377136, 0.03923162445425987, -0.019873084500432014, -0.01568618416786194, 0.09823301434516907, 0.03488686680793762, 0.0017781088827177882, 0.03743601590394974, 0.026232566684484482, -0.025953011587262154, 0.00...
0.813654
0.783914
0.02974
You are tasked with creating a JavaScript function that can efficiently determine the unique elements in an array and store them in a hash set data structure. Write a function called `createHashSet` that takes in an array as input and returns a hash set containing the unique elements of the array. The hash set should...
glaive
[ 0.037086617201566696, 0.033033259212970734, -0.02139146625995636, -0.010318233631551266, 0.04950663447380066, -0.03580603003501892, -0.01002300251275301, 0.06004805862903595, 0.042910829186439514, -0.025023875758051872, 0.025415444746613503, 0.009498318657279015, -0.01755106821656227, -0.0...
0.808603
0.782804
0.025799
You are tasked with implementing a Python program to calculate the electric force between two point charges. The electric force between two charges is given by the formula: \[F = \frac{k \cdot |q_1 \cdot q_2|}{r^2}\] Where: - \(F\) is the electric force - \(k\) is the Coulomb's constant (\(8.9875 \times 10^9 \, Nm^2/...
glaive
[ 0.012165888212621212, 0.04183880612254143, -0.03234346583485603, -0.06413695961236954, 0.02552028000354767, -0.05596405640244484, -0.018932614475488663, 0.04489251226186752, 0.04856661334633827, -0.0029658032581210136, 0.024869246408343315, 0.04093515872955322, -0.030984682962298393, -0.01...
0.787855
0.773252
0.014603
You are tasked with implementing a program to calculate the value of pi using a specific iterative method. To do this, you will need to define variables a, s, and p, and an iterate function, and then use a for loop to perform the necessary calculations. The variables a, s, and p are initially set to 2.0, 1.0, and 3.0, ...
glaive
[ 0.008467718958854675, 0.05131632462143898, -0.0245224442332983, -0.020823393017053604, 0.052785474807024, -0.04332464560866356, -0.024403948336839676, 0.06572448462247849, 0.03747619688510895, -0.006055751815438271, 0.028584850952029228, 0.03678194433450699, -0.03317706286907196, 0.0095335...
0.800156
0.766448
0.033708