Skip to content

Instantly share code, notes, and snippets.

View nishio's full-sized avatar

NISHIO Hirokazu nishio

View GitHub Profile
test("io-ts, use implemented type", () => {
const obj_string = JSON.parse(`"hello"`); // is any
const obj_number = JSON.parse(`123`); // is any
expect(isRight(t.string.decode(obj_string))).toBeTruthy();
expect(isRight(t.string.decode(obj_number))).toBeFalsy();
const ret = t.string.decode(obj_string);
let string_value: string;
if (isRight(ret)) {
const TestApp = () => {
console.log("render TestApp");
return (
<div>
<Comp1 />
<Comp2 />
</div>
);
};
const Comp1 = () => {
# included from libs/crt.py
"""
Chinese Remainder Theorem
"""
# included from libs/extended_euclidean.py
"""
Extended Euclidean algorithm
"""
1006289308176_1 / 16_1006289308176 = 1/16
100529_1 / 19_100529 = 1/19
100529100529_1 / 19_100529100529 = 1/19
10045662_1 / 22_10045662 = 1/22
1004566210045662_1 / 22_1004566210045662 = 1/22
1004184_1 / 24_1004184 = 1/24
10041841004184_1 / 24_10041841004184 = 1/24
100386_1 / 26_100386 = 1/26
100386100386_1 / 26_100386100386 = 1/26
100358422939068_1 / 28_100358422939068 = 1/28
10000
94 ms ± 46 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
20000
192 ms ± 39 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
30000
275 ms ± 20 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
40000
394 ms ± 21 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
50000
554 ms ± 45 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
10000
95 ms ± 45 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
20000
170 ms ± 49 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
30000
276 ms ± 25 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
40000
367 ms ± 32 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
50000
525 ms ± 58 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
const x: paper.Group = new paper.Group();
const y: paper.Group = { ...x };
---
Type '{ clipped: boolean; tangent: Point; normal: Point; curvature: number; id: number; className: string; name: string; style: Style; locked: boolean; visible: boolean; blendMode: string; ... 49 more ...; onMouseLeave: (event: MouseEvent) => boolean | void; }' is missing the following properties from type 'Group': clone, set, copyContent, copyAttributes, and 66 more.
import React, { Dispatch } from "react";
import { act, render, screen } from "@testing-library/react";
import { MyComponent } from "./MyComponent";
import { MyAsyncComponent, resolve, userTrigger } from "./MyAsyncComponent";
import { useState as originalUseState } from "react";
test("MyComponent1", () => {
type TSetState = React.Dispatch<React.SetStateAction<number>>;
let setValue: TSetState | undefined;
import numpy as np
MOD = 10 ** 9 + 7
assert ((MOD - 1) ** 2).bit_length() == 60
N = 20
assert (N * (MOD - 1) ** 2).bit_length() == 65
x = np.array([MOD - 1] * N, dtype=np.int64)
assert x.dot(x) % MOD == 417656019 # incorrect answer
#!/usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")