Skip to content

Instantly share code, notes, and snippets.

// Copyright (c) 2011-2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <test/data/base58_encode_decode.json.h>
#include <base58.h>
#include <test/util/json.h>
#include <test/util/random.h>
#include <test/util/setup_common.h>
// Copyright (c) 2024 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <chainparams.h>
#include <wallet/coincontrol.h>
#include <consensus/merkle.h>
#include <kernel/chain.h>
#include <node/context.h>
@BenchmarkMode(Mode.Throughput)
@State(Scope.Benchmark)
@Fork(value = 1)
@Measurement(iterations = 3, time = 1)
@Warmup(iterations = 3, time = 1)
public class LongNumberParsing {
static final String DIGITS = "1234567890";
static final int REPETITIONS = 100;
static final String LONG_INT = join("", nCopies(REPETITIONS, DIGITS));
static final String LONG_FP = DIGITS + "." + join("", nCopies(REPETITIONS - 1, DIGITS));
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
void main() => runApp(const SticksApp());
class SticksApp extends StatelessWidget {
const SticksApp({super.key});
@override
Widget build(BuildContext context) {
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => const MaterialApp(home: Scaffold(body: MyStatelessWidget()));
}
package com.crossover.trial;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.assertEquals;
public class Solution {
package com.crossover.trial;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.assertEquals;
public class Solution {
package com.crossover.trial;
import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Solution {
public class TimeParser {
public LocalDateTime parseDuration(String duration, LocalDateTime now) {
for (Matcher m = Pattern.compile("(\\d+) (\\w)s?").matcher(duration);m.find();)
import java.lang.Math.*
data class Point(private val x_: Int, private val y_: Int) {
fun x() = max(0, min(x_, 2))
fun y() = max(0, min(y_, 2))
operator fun plus(p: Point) = Point(x() + p.x_, y() + p.y_)
override fun toString() = "${y() * 3 + x() + 1}"
}
private fun solve(input: String) = input.fold(mutableListOf(Point(1, 1)), { res, c ->
package com.crossover.trial;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class Node<T extends Comparable<? super T>> {
T value;
Node<T> left, right;