id
stringlengths
12
26
prompt
stringlengths
24
3.12k
expected_domain
stringclasses
1 value
ground_truth_answer
stringlengths
94
5.44k
⌀
hybrid_synthetic_gsm8k_201
Code a daily revenue tracker for Charlie that applies his standard $80/hour rate to 4 lessons and a 25% discounted rate to 2 veteran lessons, outputting the total dollars earned.
hybrid
def total_revenue(): standard_rate = 80 standard_lessons = 4 discount_rate = standard_rate * (1 - 0.25) veteran_lessons = 2 total = (standard_rate * standard_lessons) + (discount_rate * veteran_lessons) return int(total) print(total_revenue())
hybrid_synthetic_gsm8k_202
Create a daily-to-weekly revenue script for Lloyd's egg farm, calculating his weekly income by converting his 252 daily eggs into dozens and multiplying by the $2 per dozen sale price.
hybrid
def weekly_income(): daily_eggs = 252 eggs_per_dozen = 12 daily_dozens = daily_eggs / eggs_per_dozen price_per_dozen = 2 daily_income = daily_dozens * price_per_dozen weekly_income = daily_income * 7 return int(weekly_income) print(weekly_income())
hybrid_synthetic_gsm8k_203
Construct a mathematical model in code to solve for the first person's share of a $1920 pool, given the second person took $80 more than the first, and the third took twice the second person's amount.
hybrid
def first_person_share(): total = 1920 # x + (x + 80) + 2*(x + 80) = 1920 # 4x + 240 = 1920 x = (total - 240) / 4 return int(x) print(first_person_share())
hybrid_synthetic_gsm8k_204
Jamaar heads to the store with $10. Prices including tax are: peaches and pears $.50 each, apples $.75 each, kiwis $1, and plums$.25 each. If he buys 3 peaches, 4 pears, 2 kiwis, and 5 apples, output a programmatic calculation showing the maximum number of plums he can purchase with his remaining money.
hybrid
def max_plums(): total_money = 10.0 peaches = 3 * 0.50 pears = 4 * 0.50 kiwis = 2 * 1.00 apples = 5 * 0.75 spent = peaches + pears + kiwis + apples remaining = total_money - spent plum_price = 0.25 plums = remaining // plum_price return int(plums) print(max_plums())
hybrid_synthetic_gsm8k_205
Write a function returning the number of tune-ups Jon needs in a 30-day month if he drives 100 miles daily and requires a tune-up every 1000 miles.
hybrid
def total_tune_ups(): days = 30 daily_miles = 100 total_miles = days * daily_miles tune_up_interval = 1000 tune_ups = total_miles / tune_up_interval return int(tune_ups) print(total_tune_ups())
hybrid_synthetic_gsm8k_206
Create a programmatic fraction solver parsing a 12-pint wall mural to find the pints of red paint used. Yellow paint covers half the mural, while the rest consists of equal amounts of red, white, and purple paint.
hybrid
def pints_of_red(): total_pints = 12 yellow = total_pints / 2 remaining = total_pints - yellow red = remaining / 3 return int(red) print(pints_of_red())
hybrid_synthetic_gsm8k_207
Create a statistics function averaging Mack's bird sightings over a 7-day period with 50 over days one and two, 0 on day three, 120 over days four and five, 20 on day six, and 90 on day seven.
hybrid
def average_sightings(): days_1_2 = 50 day_3 = 0 days_4_5 = 120 day_6 = 20 day_7 = 90 total = days_1_2 + day_3 + days_4_5 + day_6 + day_7 days = 7 avg = total / days return int(avg) print(average_sightings())
hybrid_synthetic_gsm8k_208
Create a tracking algorithm for Paul's marble collection that adds the 28 new marbles he received to his original 52, computes a 25% loss representing the ones he misplaced, and securely outputs his current total.
hybrid
def current_marbles(): original = 52 new_marbles = 28 total = original + new_marbles loss = total * 0.25 current = total - loss return int(current) print(current_marbles())
hybrid_synthetic_gsm8k_209
John manages 20 playlists, each containing 300 songs, with each song lasting exactly 10 hours. Create a script to compute the total runtime in hours for all 20 playlists combined.
hybrid
def total_runtime_hours(): playlists = 20 songs_per_playlist = 300 hours_per_song = 10 total = playlists * songs_per_playlist * hours_per_song return total print(total_runtime_hours())
hybrid_synthetic_gsm8k_210
Formulate a script to calculate the absolute maximum number of 15-pound boxes that can be loaded onto a delivery truck without exceeding a 5000-pound wooden bridge limit, accounting for the 3755-pound baseline weight of the truck and driver.
hybrid
def max_boxes(): bridge_limit = 5000 baseline_weight = 3755 box_weight = 15 available_weight = bridge_limit - baseline_weight boxes = available_weight // box_weight return int(boxes) print(max_boxes())
hybrid_synthetic_gsm8k_211
Mark is making a quadruple batch of brownies, where the normal recipe calls for 3 cups of flour and 1 cup of milk. Since flour is sold in 2-cup bags and milk in 2-cup bottles, program an algorithm to output how many more bags of flour than bottles of milk he needs to buy.
hybrid
def more_flour_bags(): batches = 4 flour_per_batch = 3 milk_per_batch = 1 total_flour = batches * flour_per_batch total_milk = batches * milk_per_batch flour_bag_size = 2 milk_bottle_size = 2 flour_bags = total_flour / flour_bag_size milk_bottles = total_milk / milk_bottle_size d...
hybrid_synthetic_gsm8k_212
Billie's rectangular bedroom has an area of 360 square feet and a length of 3 yards. Construct an algorithm that outputs the room's perimeter in feet.
hybrid
def perimeter_feet(): area = 360 length_yards = 3 length_feet = length_yards * 3 width_feet = area / length_feet perimeter = 2 * (length_feet + width_feet) return int(perimeter) print(perimeter_feet())
hybrid_synthetic_gsm8k_213
Code an algorithm to simulate Artie's rounded-price flower sales, calculating his total income from 12 marigolds rounded from $2.74, 9 petunias rounded from $1.87, and 17 begonias rounded from $2.12.
hybrid
def total_income(): marigolds_qty = 12 marigolds_price = round(2.74) petunias_qty = 9 petunias_price = round(1.87) begonias_qty = 17 begonias_price = round(2.12) total = (marigolds_qty * marigolds_price) + (petunias_qty * petunias_price) + (begonias_qty * begonias_price) return int(total...
hybrid_synthetic_gsm8k_214
Implement a method to deduce the total number of portraits and selfies Olivia uploaded to Facebook. She distributed 72 pictures evenly into 8 albums, where 3 albums were strictly selfies and 2 were strictly portraits.
hybrid
def total_portraits_selfies(): total_pictures = 72 total_albums = 8 pictures_per_album = total_pictures / total_albums selfie_albums = 3 portrait_albums = 2 selfies = selfie_albums * pictures_per_album portraits = portrait_albums * pictures_per_album total = selfies + portraits retur...
hybrid_synthetic_gsm8k_215
Write a program counting the pairs of $1,000 shoes Jessica can buy in a year if she saves 25% of her $2,000 monthly income for them.
hybrid
def pairs_of_shoes(): income = 2000 savings_rate = 0.25 monthly_savings = income * savings_rate yearly_savings = monthly_savings * 12 shoe_cost = 1000 pairs = yearly_savings / shoe_cost return int(pairs) print(pairs_of_shoes())
hybrid_synthetic_gsm8k_216
Write a short script to determine how many dozens of eggs Claire consumes in a 4-week period if she uses exactly 3 eggs for her breakfast omelet every single morning.
hybrid
def dozens_of_eggs(): weeks = 4 days = weeks * 7 eggs_per_day = 3 total_eggs = days * eggs_per_day dozens = total_eggs / 12 return int(dozens) print(dozens_of_eggs())
hybrid_synthetic_gsm8k_217
Implement code to determine my total payment when splitting a $50 dinner bill evenly with my wife, but independently covering a 20% tip on the total bill.
hybrid
def total_payment(): bill = 50 split_share = bill / 2 tip = bill * 0.20 total = split_share + tip return int(total) print(total_payment())
hybrid_synthetic_gsm8k_218
Develop a code block to track Suzanne's earnings after selling 80 cookies for $1 each and 60 cupcakes for $4 each, and then paying her two sisters $10 each for their help. Return her remaining money.
hybrid
def remaining_money(): cookies = 80 * 1 cupcakes = 60 * 4 revenue = cookies + cupcakes sisters_pay = 2 * 10 remaining = revenue - sisters_pay return remaining print(remaining_money())
hybrid_synthetic_gsm8k_219
Implement logic to calculate the required speed for the final leg of Marissa's 12-mile hike. The program should use her goal of a 4 mph average speed and account for the 2 hours already spent hiking the first 6 miles.
hybrid
def required_speed(): total_distance = 12 goal_avg_speed = 4 total_time = total_distance / goal_avg_speed spent_time = 2 spent_distance = 6 remaining_time = total_time - spent_time remaining_distance = total_distance - spent_distance speed = remaining_distance / remaining_time return...
hybrid_synthetic_gsm8k_220
Program a food logistics calculator for Ted the T-Rex to figure out total pounds of potato salad needed, processing 20 adults at 10 lbs each and 5 children at half that portion.
hybrid
def total_pounds(): adults = 20 adult_portion = 10 children = 5 child_portion = adult_portion / 2 total = (adults * adult_portion) + (children * child_portion) return int(total) print(total_pounds())
hybrid_synthetic_gsm8k_221
Create a solver tracing the timeline to deduce Shiloh's nephew's current age, noting that in 7 years, Shiloh who is currently 44 will be three times the nephew's age.
hybrid
def nephew_current_age(): shiloh_current = 44 shiloh_future = shiloh_current + 7 nephew_future = shiloh_future / 3 nephew_current = nephew_future - 7 return int(nephew_current) print(nephew_current_age())
hybrid_synthetic_gsm8k_222
Implement a script to calculate the combined daily chocolate production of Ruiz and Marissa. Your code must account for Ruiz producing 120 pounds every two hours, Marissa making 3/4 of that amount in just one hour, and both of them working a full 12-hour shift.
hybrid
def total_chocolate(): ruiz_rate = 120 / 2 marissa_rate = 120 * (3 / 4) combined_rate = ruiz_rate + marissa_rate shift_hours = 12 total = combined_rate * shift_hours return int(total) print(total_chocolate())
hybrid_synthetic_gsm8k_223
Each solid 10-foot section of a redwood tree weighs 400 pounds. Termites ate 30% of this redwood's wood. If the redwood is 200 feet tall, construct a data script calculating how much it weighs.
hybrid
def tree_weight(): height = 200 section_length = 10 weight_per_section = 400 sections = height / section_length original_weight = sections * weight_per_section termite_damage = 0.30 current_weight = original_weight * (1 - termite_damage) return int(current_weight) print(tree_weight())
hybrid_synthetic_gsm8k_224
Develop a calculation code to find the square footage of Octavia's quilt by multiplying 11 small shirts by 3 sq ft, 8 medium by 4 sq ft, and 6 large by 6 sq ft, then summing the results.
hybrid
def quilt_sq_ft(): small = 11 * 3 medium = 8 * 4 large = 6 * 6 total = small + medium + large return total print(quilt_sq_ft())
hybrid_synthetic_gsm8k_225
Implement a program to find the combined salary of Adrien and Lylah after four years. Initialize Adrien's past salary at $40000, noting it was 30 percent higher than Lylah's, then apply a 40 percent increase to both their salaries to find the final total.
hybrid
def combined_salary(): adrien_past = 40000 lylah_past = adrien_past / 1.30 adrien_final = adrien_past * 1.40 lylah_final = lylah_past * 1.40 total = adrien_final + lylah_final return int(total) print(combined_salary())
hybrid_synthetic_gsm8k_226
Tony is painting the four walls of a room (two are 10x8 feet, two are 5x8 feet). Paint costs $12 per gallon, and one gallon covers 20 square feet. Write a program to output the total cost to paint the room.
hybrid
def paint_cost(): wall1_area = 10 * 8 wall2_area = 5 * 8 total_area = (2 * wall1_area) + (2 * wall2_area) coverage_per_gallon = 20 gallons = total_area / coverage_per_gallon cost_per_gallon = 12 total_cost = gallons * cost_per_gallon return int(total_cost) print(paint_cost())
hybrid_synthetic_gsm8k_227
Write a program computing the total number of corn chips shared by Amora, Lainey, and Collins, given Amora and Lainey got 70 chips each and Collins received 15 more than that amount.
hybrid
def total_chips(): amora = 70 lainey = 70 collins = 70 + 15 total = amora + lainey + collins return total print(total_chips())
hybrid_synthetic_gsm8k_228
Produce a script that aggregates burrito production for a shop by mathematically summing the 125 chimichangas made on Tuesday, the 125 made on Wednesday, and the explicitly doubled amount produced on Friday.
hybrid
def total_production(): tuesday = 125 wednesday = 125 friday = 125 * 2 total = tuesday + wednesday + friday return total print(total_production())
hybrid_synthetic_gsm8k_229
Design a script projecting bamboo growth for Mrs. Jameson. Convert the current 20-foot height to inches, and calculate how many 30-inch growth days are required to reach a target of 600 inches.
hybrid
def growth_days(): current_feet = 20 current_inches = current_feet * 12 target_inches = 600 growth_needed = target_inches - current_inches growth_per_day = 30 days = growth_needed / growth_per_day return int(days) print(growth_days())
hybrid_synthetic_gsm8k_230
Program an entomology tally script that sums up 90 spiders, one-third as many millipedes, and a stink bug count equal to twice the millipedes minus 12.
hybrid
def total_insects(): spiders = 90 millipedes = spiders / 3 stink_bugs = (2 * millipedes) - 12 total = spiders + millipedes + stink_bugs return int(total) print(total_insects())
hybrid_synthetic_gsm8k_231
Develop a script to find how many friends Morgan can invite with 90 dollars, where each person needs a 5 dollar mini-golf round, 5 dollars in tokens, and two 10 dollar go-kart rides.
hybrid
def friends_invited(): budget = 90 mini_golf = 5 tokens = 5 go_kart = 2 * 10 cost_per_person = mini_golf + tokens + go_kart friends = budget / cost_per_person return int(friends) print(friends_invited())
hybrid_synthetic_gsm8k_232
Formulate a computational method to divide the remaining marshmallows in a 35-piece bag between John and DeSean, accounting for the 9 s'mores each child has already made and the 3 individual marshmallows dropped on the ground.
hybrid
def remaining_per_child(): total = 35 john_smores = 9 desean_smores = 9 dropped = 3 remaining = total - (john_smores + desean_smores + dropped) per_child = remaining / 2 return int(per_child) print(remaining_per_child())
hybrid_synthetic_gsm8k_233
Code an allocation script for Lani's cookies that deducts the 5 she ate from her initial batch of 55 and programmatically divides the remainder equally among five jars, returning the per-jar amount.
hybrid
def cookies_per_jar(): initial = 55 ate = 5 remainder = initial - ate jars = 5 per_jar = remainder / jars return int(per_jar) print(cookies_per_jar())
hybrid_synthetic_gsm8k_234
Write an algorithm determining how many graduation tickets each student receives. The Fine Arts Center holds 6000 people. Subtract 950 seats for graduates and 300 for faculty, then distribute the remaining tickets equally among the graduates.
hybrid
def tickets_per_graduate(): total_seats = 6000 graduates = 950 faculty = 300 remaining = total_seats - graduates - faculty tickets_per_grad = remaining / graduates return int(tickets_per_grad) print(tickets_per_graduate())
hybrid_synthetic_gsm8k_235
Design a script analyzing easter egg data to find how many more eggs Camden painted than Arnold. Arnold, Madeline, Camden, and Sarah painted 56 eggs total, with Arnold and Madeline painting the same amount. Camden and Sarah painted 30 eggs combined, with Camden painting 12 more than Sarah.
hybrid
def camden_more_than_arnold(): total = 56 camden_sarah_combined = 30 arnold_madeline_combined = total - camden_sarah_combined arnold = arnold_madeline_combined / 2 camden = (camden_sarah_combined + 12) / 2 diff = camden - arnold return int(diff) print(camden_more_than_arnold())
hybrid_synthetic_gsm8k_236
Develop a revenue-calculating algorithm for Marcel's bicycle store. Out of 300 bikes sold, half were Trekking ($450 each) and 15% were BMX (half the price of a $500 MTB). The remainder were MTBs. Calculate his total earnings.
hybrid
def total_earnings(): total_bikes = 300 trekking_qty = total_bikes / 2 trekking_price = 450 bmx_qty = total_bikes * 0.15 mtb_price = 500 bmx_price = mtb_price / 2 mtb_qty = total_bikes - trekking_qty - bmx_qty earnings = (trekking_qty * trekking_price) + (bmx_qty * bmx_price) + (mtb_qty ...
hybrid_synthetic_gsm8k_237
Program a week-long sleep tracker for Sadie that logs 8 hours on Monday, subtracts 2 hours for both Tuesday and Wednesday due to assignments, and then adds 1 hour to that reduced amount for the remaining four days of the week, returning the final weekly sum.
hybrid
def weekly_sleep(): monday = 8 tuesday = monday - 2 wednesday = monday - 2 remaining_days = 4 other_days = tuesday + 1 total = monday + tuesday + wednesday + (remaining_days * other_days) return total print(weekly_sleep())
hybrid_synthetic_gsm8k_238
Develop a script determining the number of full pizza pies Kate must purchase. Her 6 friends will each eat 6 cheese pizza slices (from pies cut into 12 slices) and 4 pepperoni pizza slices (from pies cut into 8 slices).
hybrid
def total_pies(): friends = 6 cheese_slices_per_person = 6 cheese_slices_per_pie = 12 total_cheese_slices = friends * cheese_slices_per_person cheese_pies = total_cheese_slices / cheese_slices_per_pie pepperoni_slices_per_person = 4 pepperoni_slices_per_pie = 8 total_pepperoni_slices = f...
hybrid_synthetic_gsm8k_239
Develop a function that calculates the number of leftover soup meals each child gets, assuming Calvin's pot holds enough for 4 adults or 8 children, and he feeds his adult wife, himself, and two children one bowl each.
hybrid
def leftover_per_child(): pot_child_capacity = 8 adults_eating = 2 child_portion_per_adult = 8 / 4 children_eating = 2 used_by_adults = adults_eating * child_portion_per_adult used_by_children = children_eating * 1 total_used = used_by_adults + used_by_children leftover = pot_child_capac...
hybrid_synthetic_gsm8k_240
It takes Matthew 3 minutes to dig a small hole for shrubs and 10 minutes to dig a large hole for trees. Implement a loop determining how many hours it will take him to dig 30 small holes and 15 large holes.
hybrid
def digging_hours(): small_mins = 3 large_mins = 10 total_mins = (30 * small_mins) + (15 * large_mins) hours = total_mins / 60 return int(hours) print(digging_hours())
hybrid_synthetic_gsm8k_241
Create an automated checkout script summing Catherine's fruit basket: 1 kilo of apples at $4, 2 kilos of bananas at $2 per kilo, and 2 kilos of oranges at $3 per kilo.
hybrid
def total_cost(): apples = 1 * 4 bananas = 2 * 2 oranges = 2 * 3 total = apples + bananas + oranges return total print(total_cost())
hybrid_synthetic_gsm8k_242
Implement code determining Geb's age through the parameters that Haley is 26 years old, and Geb is 10 less than half her age.
hybrid
def geb_age(): haley = 26 geb = (haley / 2) - 10 return int(geb) print(geb_age())
hybrid_synthetic_gsm8k_243
Write an algorithmic calculator to determine Greg's projected expenses for an outdoor jello party, computing the total cups needed for 30 kids at 4 cups each, dividing by a 10-cup yield per box, and multiplying the required integer boxes by a $1.25 sale price.
hybrid
def jello_expenses(): kids = 30 cups_per_kid = 4 total_cups = kids * cups_per_kid yield_per_box = 10 boxes = total_cups / yield_per_box price_per_box = 1.25 cost = boxes * price_per_box return int(cost) print(jello_expenses())
hybrid_synthetic_gsm8k_244
Develop a script to compute the total count of onions and potatoes Sophia bought at the market, given that Rose bought 4 times Sophia's amount, totaling 12 onions and 4 potatoes for Rose.
hybrid
def sophia_total(): rose_onions = 12 rose_potatoes = 4 sophia_onions = rose_onions / 4 sophia_potatoes = rose_potatoes / 4 total = sophia_onions + sophia_potatoes return int(total) print(sophia_total())
hybrid_synthetic_gsm8k_245
Create a programmatic optimizer to calculate Vincent's savings when buying 18 flowers. The script should compare the total cost of purchasing them in $2.50 packs of 3 versus the alternative $1.00 packs of 2.
hybrid
def calculate_savings(): flowers = 18 pack3_price = 2.50 pack3_qty = 3 cost3 = (flowers / pack3_qty) * pack3_price pack2_price = 1.00 pack2_qty = 2 cost2 = (flowers / pack2_qty) * pack2_price savings = abs(cost3 - cost2) return int(savings) print(calculate_savings())
hybrid_synthetic_gsm8k_246
Jennifer's dog has 8 puppies with 3 spotted, and Brandon's dog has 12 puppies with 4 spotted. Build an algorithm that outputs the percentage of all the puppies that have spots.
hybrid
def spotted_percentage(): jen_puppies = 8 jen_spotted = 3 bran_puppies = 12 bran_spotted = 4 total_puppies = jen_puppies + bran_puppies total_spotted = jen_spotted + bran_spotted percentage = (total_spotted / total_puppies) * 100 return int(percentage) print(spotted_percentage())
hybrid_synthetic_gsm8k_247
Write an algorithm to dynamically backtrack the runtime of Elaina's standard concert by subtracting her 15-minute encore from the 65-minute finale runtime and computationally dividing the remainder by two.
hybrid
def standard_concert_runtime(): finale_runtime = 65 encore = 15 remainder = finale_runtime - encore runtime = remainder / 2 return int(runtime) print(standard_concert_runtime())
hybrid_synthetic_gsm8k_248
Implement an algorithm comparing the spending of two sports coaches. Calculate the difference in cost between 9 baseballs at $3 each and 8 basketballs at $14 each.
hybrid
def spending_difference(): baseballs_cost = 9 * 3 basketballs_cost = 8 * 14 diff = abs(basketballs_cost - baseballs_cost) return diff print(spending_difference())
hybrid_synthetic_gsm8k_249
Write software logic to calculate the average height of heels at a cocktail party, given three women are wearing 4-inch heels and three are wearing 2-inch heels.
hybrid
def average_heel_height(): group1 = 3 * 4 group2 = 3 * 2 total_height = group1 + group2 total_women = 3 + 3 avg = total_height / total_women return int(avg) print(average_heel_height())
hybrid_synthetic_gsm8k_250
Write a simple program to sum the total instructions Kelian must read, processing a first recipe with 20 steps and a second recipe with double that amount.
hybrid
def total_steps(): recipe1 = 20 recipe2 = recipe1 * 2 total = recipe1 + recipe2 return total print(total_steps())
hybrid_synthetic_gsm8k_251
Develop a system of equations script to find the total number of animal legs on Farmer Brown's farm, given 60 total animals and twice as many chickens as cows.
hybrid
def total_legs(): total_animals = 60 cows = total_animals / 3 chickens = 2 * cows legs = (cows * 4) + (chickens * 2) return int(legs) print(total_legs())
hybrid_synthetic_gsm8k_252
Program a resource allocator to find total stuffing needed if a Rottweiler takes 8 pounds, a Chihuahua takes 2 pounds, and a Collie takes the average of the first two, outputting the requirement for 4 Chihuahua and 3 Collie beds.
hybrid
def total_stuffing(): rottweiler = 8 chihuahua = 2 collie = (rottweiler + chihuahua) / 2 total = (4 * chihuahua) + (3 * collie) return int(total) print(total_stuffing())
hybrid_synthetic_gsm8k_253
I have a 200 SqFt kitchen floor and want to install 1ft x 1ft square tiles that cost $12 each. Provide a programmatic solution to output the total renovation cost.
hybrid
def renovation_cost(): area = 200 tile_area = 1 * 1 tiles_needed = area / tile_area cost_per_tile = 12 total = tiles_needed * cost_per_tile return int(total) print(renovation_cost())
hybrid_synthetic_gsm8k_254
Implement a revenue calculator for Shawnda's bike inflation service. Multiply the 25-cent rate by the total tires inflated: 5 bicycles with 2 tires each, 3 tricycles with 3 tires each, and 1 unicycle with 1 tire.
hybrid
def total_revenue(): rate = 0.25 bicycles = 5 * 2 tricycles = 3 * 3 unicycles = 1 * 1 total_tires = bicycles + tricycles + unicycles revenue = total_tires * rate return revenue print(total_revenue())
hybrid_synthetic_gsm8k_255
Melanie needs 200 toothpicks for a sculpture. She has saved 10 a week for 12 weeks from her sandwiches. Formulate a while-loop or equation in code to determine how many more weeks it will take to reach her goal.
hybrid
def more_weeks_needed(): goal = 200 saved_per_week = 10 weeks_passed = 12 already_saved = saved_per_week * weeks_passed remaining = goal - already_saved weeks_needed = remaining / saved_per_week return int(weeks_needed) print(more_weeks_needed())
hybrid_synthetic_gsm8k_256
Tyson needs to serve 20 people muffaletta sandwiches, where each sandwich serves 4 and requires 1 pound of meat at $7.00/lb and 1 pound of cheese at $3.00/lb. Design a program that calculates his total expenditure on these ingredients.
hybrid
def total_expenditure(): people = 20 serves_per_sandwich = 4 sandwiches = people / serves_per_sandwich meat_lbs = 1 meat_price = 7.00 cheese_lbs = 1 cheese_price = 3.00 cost_per_sandwich = (meat_lbs * meat_price) + (cheese_lbs * cheese_price) total_cost = sandwiches * cost_per_sandwi...
hybrid_synthetic_gsm8k_257
Program a solution to find out how many boxes Jam and Meg need to store all their pencils, given Jam has 3 boxes and 2 loose ones totaling 26 pencils, while Meg has 46 pencils.
hybrid
def total_boxes_needed(): jam_total = 26 jam_loose = 2 jam_boxes = 3 per_box = (jam_total - jam_loose) / jam_boxes meg_total = 46 total_pencils = jam_total + meg_total total_boxes = total_pencils / per_box return int(total_boxes) print(total_boxes_needed())
hybrid_synthetic_gsm8k_258
Write a cost-analysis program to find out how much money James lost after buying ten $15 CDs at a 40% discount and later selling 5 of them for a total of $40.
hybrid
def money_lost(): cds = 10 original_price = 15 discount = 0.40 price_paid = original_price * (1 - discount) total_spent = cds * price_paid revenue = 40 lost = total_spent - revenue return int(lost) print(money_lost())
hybrid_synthetic_gsm8k_259
Terri is knitting a sweater with two sleeves, a collar, and a decorative rosette. The body of the sweater takes 900 stitches to complete, the collar takes a tenth of that number of stitches, and the rosette takes twice as many as the collar. The whole sweater is an 1800-stitch project. Formulate an executable evaluatin...
hybrid
def stitches_per_sleeve(): total = 1800 body = 900 collar = body / 10 rosette = collar * 2 used = body + collar + rosette remaining = total - used per_sleeve = remaining / 2 return int(per_sleeve) print(stitches_per_sleeve())
hybrid_synthetic_gsm8k_260
A dance studio charges $25 per session for rent plus $1.50 per student. With 10 students and rentals happening 3 days a week, programmatically determine the expected monthly earnings for the studio.
hybrid
def monthly_earnings(): rent_fee = 25 student_fee = 1.50 students = 10 daily_earnings = rent_fee + (students * student_fee) days_per_week = 3 weekly_earnings = daily_earnings * days_per_week weeks_per_month = 4 monthly = weekly_earnings * weeks_per_month return int(monthly) print(mo...
hybrid_synthetic_gsm8k_261
Mark is choosing between a venue charging a $200 flat fee (plus an estimated $5 per person for food) and a second venue charging $25 per person with food included. Design an algebraic solver in code identifying how many guests make the two venues equal in cost.
hybrid
def break_even_guests(): # 200 + 5x = 25x # 200 = 20x flat_fee = 200 venue1_per_person = 5 venue2_per_person = 25 diff_per_person = venue2_per_person - venue1_per_person guests = flat_fee / diff_per_person return int(guests) print(break_even_guests())
hybrid_synthetic_gsm8k_262
Write a script calculating the net distance between a bird's northern and southern homes after flying south for 10 hours at 30 mph, north for 2 hours at 18 mph, and south again for 5 hours at 22 mph.
hybrid
def net_distance(): south1 = 10 * 30 north = 2 * 18 south2 = 5 * 22 net = south1 - north + south2 return net print(net_distance())
hybrid_synthetic_gsm8k_263
Write a computational script to find John's total tie expenditure. He buys blue ties at $40 each totaling $200, buys twice as many red ties, and pays a 50% premium for the price of each red tie.
hybrid
def total_expenditure(): blue_total = 200 blue_price = 40 blue_qty = blue_total / blue_price red_qty = blue_qty * 2 red_price = blue_price * 1.50 red_total = red_qty * red_price total = blue_total + red_total return int(total) print(total_expenditure())
hybrid_synthetic_gsm8k_264
Write a pencil box inventory function. Subtract the 4 missing pencils from the 20-pencil capacity, then divide the remainder by 2 to return the number of pencil pairs currently inside.
hybrid
def pencil_pairs(): capacity = 20 missing = 4 remainder = capacity - missing pairs = remainder / 2 return int(pairs) print(pencil_pairs())
wildchat_001
In a hypothetical application, a program must calculate the divergence of a centerline of slip-road diverging from a main carrigeway with a fixed radius. For a given distance d from the start of the divergence , write a program to calculate the offset of the center line of the slip-road from the main carrigeway, and...
hybrid
import math def calculate_divergence(R, d): # angle in radians: theta = d / R angle_rad = d / R angle_deg = math.degrees(angle_rad) # Offset from the main carriageway offset = R * (1 - math.cos(angle_rad)) print(f"Offset from main carriageway: {offset:.4f}") print(f"Angle of diver...
wildchat_002
in the above code, i want to give coordinated to master drone and follower shoulf follow at the distance of 5 meters and at an angle of 60 degerees.please give me the modifies correct full code
hybrid
import math def get_follower_position(master_x, master_y, distance=5.0, angle_deg=60.0): """ Calculates the target coordinates for a follower drone given the master drone's coordinates, following distance, and angle. """ angle_rad = math.radians(angle_deg) # Compute offsets using trigonom...
wildchat_003
please give me the full intergrated code with gwo for 2 wolfs and for 100 iterations
hybrid
import numpy as np def objective_function(x): # Simple sphere function for minimization testing return np.sum(x**2) def gwo(objf, lb, ub, dim, SearchAgents_no=2, Max_iter=100): # Initialize Alpha, Beta, and Delta wolves Alpha_pos = np.zeros(dim) Alpha_score = float("inf") Beta_pos = np.zeros(d...
wildchat_004
Write me a code in python that I input the number of times a coin toss is tail, the total number of coin tosses, and the program returns the probability of the coin toss being tail and the probability of that probability being the real probability
hybrid
import scipy.stats as stats def coin_toss_analysis(tails, total_tosses): if total_tosses <= 0 or tails < 0 or tails > total_tosses: raise ValueError("Invalid inputs for coin tosses.") # Frequentist probability of landing tails prob_tail = tails / total_tosses # Using a Beta distributi...
wildchat_005
This exercise expands on the calculator, which was made in chapter 4, exercise 4. In this exercise, add sin() and cos() -calculations from the library module math to the calculator. Add these actions as selections 5 and 6, simultaneously moving the "change numbers" feature to 7 and "Quit" to 8. When the user calls eith...
hybrid
import math def main(): print("Calculator") try: num1 = float(input("Give the first number: ")) num2 = float(input("Give the second number: ")) except ValueError: return def format_num(n): return int(n) if n.is_integer() else n while True: print("(1) +") ...
wildchat_006
Create a program that has a class named Sphere that: Takes a numeric value (float or int) representing the radius when it is declared...
hybrid
import sys class Sphere: def __init__(self, radius): self.radius = float(radius) self.pi = 3.14 def get_surface_area(self): return 4 * self.pi * (self.radius ** 2) def get_volume(self): return (4 / 3) * self.pi * (self.radius ** 3) def set_radius(self, new_radius): ...
wildchat_007
float to upper int in python
hybrid
import math def float_to_upper_int(val): # math.ceil() rounds a float up to the nearest integer return math.ceil(val) # Example usage: # print(float_to_upper_int(4.2)) # Output: 5
wildchat_008
con`sider the following question: The velocity of water... b. Determine the head for v = 3 - 6 m/s... c. Perform the same series of solutions with the regula falsi method... Then write the code for c
hybrid
import math def f(H, v_target, t, L=5.0): g = 9.81 # Equation: f(H) = sqrt(2gH) * tanh(sqrt(2gH) / (2L) * t) - v_target # We want to find H where f(H) = 0 return math.sqrt(2 * g * H) * math.tanh(math.sqrt(2 * g * H) / (2 * L) * t) - v_target def regula_falsi_method(v_target, t, xl, xu, es=0.001, max_i...
wildchat_009
write a python function to find the price of an option using a Firefly Algorithm
hybrid
import numpy as np from scipy.stats import norm import math def black_scholes_call(S, K, T, r, sigma): d1 = (np.log(S / K) + (r + 0.5 * sigma**2) * T) / (sigma * np.sqrt(T)) d2 = d1 - sigma * np.sqrt(T) return S * norm.cdf(d1) - K * np.exp(-r * T) * norm.cdf(d2) def firefly_algorithm_option_pricing(S, K, ...
wildchat_010
Can you write a python function that compute the distance between a point and a set of points
hybrid
import numpy as np def distance_to_points(point, points_set): """ Computes the Euclidean distance between a single point and a set of points. Args: - point: A list, tuple, or 1D NumPy array representing the coordinates of the target point. - points_set: A 2D list, tuple, or NumPy array where e...
wildchat_011
Python function to calculate the Kelly Criterion
hybrid
def kelly_criterion(win_probability, win_loss_ratio): """ Calculates the optimal bet size using the Kelly Criterion. Args: - win_probability (float): The probability of a winning trade or bet (between 0 and 1). - win_loss_ratio (float): The ratio of the average win to the average loss (e.g., b ...
wildchat_012
qr = QuantumRegister(3, 'q') circ = QuantumCircuit(qr) circ.h(1) circ.cx(1,0,ctrl_state=0) circ.cx(1,2,ctrl_state=0) qcirc=circ now they have equal super position of 101> and 010>, now I want 101> have 75% probability and 010> have 25%, can you fix it for me?
hybrid
from qiskit import QuantumRegister, QuantumCircuit import numpy as np qr = QuantumRegister(3, 'q') circ = QuantumCircuit(qr) # In order to get 75% probability for |101> and 25% for |010>, # we need the probability of q_1 being in state |0> to be 0.75. # Instead of an H-gate which gives 50/50 superposition, we use an ...
wildchat_013
write a program that finds an approximate of the root in [-1,0], with an absolute error less than 10^-4, checking the error after each iteration with the following equation: cos(2x) - ln(x2+1)=0
hybrid
import math def f(x): return math.cos(2 * x) - math.log(x**2 + 1) def bisection_root_finder(a, b, tol): if f(a) * f(b) >= 0: raise ValueError("The function must have different signs at endpoints a and b.") iteration = 1 c_prev = a print(f"{'Iteration':<10} {'a':<12} {'b':<12} {'c...
wildchat_014
cos(2x) - ln(x2+1)=0 write a program that finds an approximate of the root in [-1,0], with an absolute error less than 10^-4, checking the error after each iteration
hybrid
import math def f(x): return math.cos(2 * x) - math.log(x**2 + 1) def find_root(a, b, tol): # Ensure root is bracketed if f(a) * f(b) > 0: return None c_prev = a iteration = 1 while True: c = (a + b) / 2.0 error = abs(c - c_prev) print(f"I...
wildchat_015
how to calculate sqrt in python?
hybrid
import math def calculate_sqrt(number): # Method 1: Using the math library sqrt_math = math.sqrt(number) # Method 2: Using the exponentiation operator sqrt_operator = number ** 0.5 # Method 3: Using the built-in pow() function sqrt_pow = pow(number, 0.5) return sqrt_math, sqr...
wildchat_016
Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between my_sqrt(a) and math.sqrt(a)... Modify your program so that it outputs lines for a values from 1 to 25 instead of just 1 to 9.
hybrid
import math def my_sqrt(a): # Using Newton's method to approximate square root if a == 0: return 0 x = a / 2.0 while True: y = (x + a / x) / 2.0 if abs(y - x) < 1e-15: return y x = y def test_sqrt(): a = 1 while a <= 25: my_val = my_sqrt(a) ...
wildchat_017
write a udf code for calculating the degree in a cirlce based on the 2D x and y coordinates
hybrid
import math # Standard Python Function def get_degree(x, y): """ Calculate the degree (0 to 360) in a circle based on 2D coordinates (x, y). """ # math.atan2 returns angle in radians from -pi to pi radians = math.atan2(y, x) # Convert to degrees degrees = math.degrees(radians) ...
wildchat_018
i want the general format to look like, max((4 * math.ceil(nlist/4 / 4)), 10) but nlist most be divisable by the result if it is not chang the value
hybrid
import math def get_divisible_chunk_size(nlist): # Calculate the initial format as requested val = max(4 * math.ceil((nlist / 16.0)), 10) # If nlist is divisible by the result, return it immediately if nlist % val == 0: return val # If not divisible, find the closest value that di...
wildchat_019
use python to calculate l2 distance between 2 points
hybrid
import math def calculate_l2_distance(p1, p2): """ Calculates the L2 (Euclidean) distance between two points in n-dimensional space. """ if len(p1) != len(p2): raise ValueError("Points must have the same number of dimensions.") # Method 1: Using built-in math.dist (Available in Pyt...
wildchat_020
Can you make a phyton code which is demonstraing a ball that`s a reference of a plane. We`ll use this ball to navigate like a plane in the next steps.
hybrid
import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D def plot_reference_ball(center=(0, 0, 0), radius=1.0): fig = plt.figure(figsize=(8, 8)) ax = fig.add_subplot(111, projection='3d') # Generate sphere coordinates u = np.linspace(0, 2 * np.pi, 100) v = np.lins...
wildchat_021
consider a source outputs independent letters according to the frequency that they appear in the English language, calculate the entropy of this source use pyhton
hybrid
import math def calculate_english_entropy(): # Approximate frequencies of English letters letter_frequencies = { 'a': 0.08167, 'b': 0.01492, 'c': 0.02782, 'd': 0.04253, 'e': 0.12702, 'f': 0.02228, 'g': 0.02015, 'h': 0.06094, 'i': 0.06966, 'j': 0.00153, 'k': 0.00772, 'l': 0.04025, ...
wildchat_022
Write a function that takes an integer as input. The function should return the power of the given integer raised to 3. Make sure to import the math module to use the related function.
hybrid
import math def cube_integer(n): """ Takes an integer as input and returns it raised to the power of 3. """ return math.pow(n, 3) # Example usage: # result = cube_integer(4) # print(result) # Output: 64.0
wildchat_023
G=n(y+3.5)+√2 result pytoncode Code to calculate (n,y) any number
hybrid
import math def calculate_G(n, y): """ Calculates the formula G = n * (y + 3.5) + sqrt(2) """ G = n * (y + 3.5) + math.sqrt(2) return G # Example usage: # n_val = 5 # y_val = 2.5 # print(calculate_G(n_val, y_val))
wildchat_024
How do i find the probability in python for 500, 1000 and 2500 points?
hybrid
null
wildchat_025
Create a class shape that consists of member variables such as length, breadth, height and radius... Derive classes such as box, triangle, circle, cylinder, and square from the class shape...
hybrid
import math class Shape: def __init__(self): self.length = 0 self.breadth = 0 self.height = 0 self.radius = 0 def setLength(self, length): self.length = length def setBreadth(self, breadth): self.breadth = breadth def setHeight(self, height): s...
wildchat_026
Write a program that asks the user to enter 5 numbers (float) i-e., obtains them from the user, and prints their sum, product, average, quotient, and remainder (you may use fmod by including math.h). You are required to use while-loop statement to calculate sum and product.
hybrid
import math def calculate_stats(): numbers = [] print("Please enter 5 numbers:") while len(numbers) < 5: try: num = float(input(f"Number {len(numbers) + 1}: ")) numbers.append(num) except ValueError: print("Invalid input. Please enter a float.") ...
wildchat_027
how do i find the relation from two objects for example an apple and a train, the relation betwen their gravitational time dilation in contrast to their small mass in kilograms, provide formulas and pythond code
hybrid
import math def gravitational_time_dilation(planet_mass, distance_from_center, time_interval=1.0): """ Formula: T_dilated = T_0 / sqrt(1 - (2GM / rc^2)) Notice that the mass of the object experiencing the dilation (apple/train) does NOT appear in the equation, because it cancels out in General Relativ...
wildchat_028
make it so that the car rect can move diagonally and the rectangle rotates
hybrid
import pygame import math def main(): pygame.init() screen = pygame.display.set_mode((800, 600)) clock = pygame.time.Clock() # Create original car surface car_surface = pygame.Surface((100, 50), pygame.SRCALPHA) car_surface.fill((255, 0, 0)) # Red car x, y = 400.0, 300.0 angle...
wildchat_029
a) Develop an efficient algorithm to find a list of all the prime numbers up to a number n (say 100).
hybrid
def sieve_of_eratosthenes(n): """ Finds all prime numbers up to a given limit n using the Sieve of Eratosthenes. """ if n < 2: return [] # Create a boolean array "prime[0..n]" and initialize all entries it as true. primes_boolean = [True] * (n + 1) primes_boolean[0] = primes...
wildchat_030
give me algorithm to detection circle to circle continuous detection
hybrid
import math def continuous_circle_collision(c1_pos, c1_vel, r1, c2_pos, c2_vel, r2): """ Sweep test for continuous collision detection between two moving circles. Returns the time 't' (between 0.0 and 1.0) of impact, or None if they don't collide. """ # Relative velocity vx = c2_vel[0] - c1_vel...
wildchat_031
Write Python program that counts digits of pi number.
hybrid
def count_pi_digits_spigot(n): """ Generates and counts 'n' digits of pi using the Spigot algorithm. Since pi has infinite digits, we count up to a user-defined limit. """ q, r, t, k, m, x = 1, 0, 1, 1, 3, 3 count = 0 for _ in range(n): if 4 * q + r - t < m * t: coun...
wildchat_032
4.1 Consider the example of calculating the probability having at least two people having the same birthday in a class size of 40 as we covered in class. Now write a function p(n,x) that will calculate this probability as a function of class size, n, and the number of people, x, having the same birthday. Draw a 3d g...
hybrid
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import math def p(n, x): """ Approximates the probability that at least 'x' people share a birthday in a class of size 'n' using the Poisson approximation. """ if n < x: return 0.0 # Using l...
wildchat_033
python code to calculate average waiting time in queue for an erlang C assuming N workers to process calls
hybrid
import math def erlang_c(traffic_intensity, agents): """ Calculates the Probability of Delay using the Erlang C formula. """ A = traffic_intensity N = agents if N <= A: return 1.0 # System is overloaded, probability of delay is 100% # Calculate numerator: (A^N / N!) * ...
wildchat_034
Fencing Problem Problem Description Most of the people in the villages are farmers... Given the coordinates of starting and ending points viz. {A, B} where A is the centre of the circular land and B is a point on the circumference, the coordinates of wrongly noted point (C), print the name of the person who is receiv...
hybrid
import math import sys def calculate_compensation(ax, ay, bx, by, cx, cy): pi = 3.14 # Actual Area computation based on prompt's specific example logic (ceil of radius and area) r_actual = math.ceil(math.sqrt((ax - bx)**2 + (ay - by)**2)) area_actual = math.ceil(pi * r_actual**2) # Wrong ...
wildchat_035
what is a simple python sigmoid function that takes in linear inputs from 0-1 to smooth output from 0-1
hybrid
def smoothstep(x): """ A simple polynomial sigmoid (S-curve) that maps 0-1 inputs to 0-1 smooth outputs. """ # Ensure the input is clamped between 0 and 1 x = max(0.0, min(1.0, x)) # The standard smoothstep formula: 3x^2 - 2x^3 return x * x * (3 - 2 * x) # Example usage: # print(smooth...
wildchat_036
What about math.cos(pi/2*t/T) if t < T/2 else 1-math.sin(pi/2*t/T)
hybrid
import math def calculate_wave(t, T): """ Calculates a piecewise trigonometric function. """ if T == 0: raise ValueError("Period T cannot be zero.") if t < T / 2.0: return math.cos((math.pi / 2.0) * (t / T)) else: return 1.0 - math.sin((math.pi / 2.0) * (t / T))...