This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io; | |
macro_rules! read { | |
($($t:ty),*) => {{ | |
let mut input = String::new(); | |
io::stdin().read_line(&mut input).unwrap(); | |
let mut iter = input.split_whitespace(); | |
($( | |
iter.next().unwrap().parse::<$t>().unwrap() | |
),*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SegmentTree { | |
private: | |
vector<int> data; | |
int n; | |
public: | |
SegmentTree() { | |
} | |
void resize(int len) { | |
n = len; | |
data.resize(4*n, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
John: RefCell { value: Person { name: "John", partner: Some((Weak)) } } | |
John's partner: Some("Susan") | |
Susan: RefCell { value: Person { name: "Susan", partner: Some((Weak)) } } | |
Susan's partner: Some("John") | |
John's partner after dropping Susan: | |
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/main.rs:16:51 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt::Debug; | |
#[derive(Debug)] | |
struct Node { | |
value: i32, | |
next: Option<Box<Node>>, | |
} | |
impl Node { | |
fn new(x: i32) -> Self { | |
Self { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
import {useSelector, useDispatch} from 'react-redux' | |
import { v4 as uuidv4 } from 'uuid'; | |
import moment from "moment"; | |
function Payment() { | |
const [current, setCurrent] = useState({}) | |
const [done, setDone] = useState(false) | |
const [total, setTotal] = useState(0) | |
const cartList = JSON.parse(localStorage.getItem('CART')) | |
useEffect(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="grid min-h-screen min-w-full place-items-center"> | |
<div class="relative grid place-items-center"> | |
<input type="checkbox" id="liked" class="peer appearance-none text-4xl text-gray-400 duration-200 before:content-['🤍'] checked:text-red-500 checked:before:content-['❤'] active:scale-75" /> | |
<p class="absolute -bottom-full w-max opacity-0 duration-200 peer-checked:opacity-100">This button does nothing</p> | |
<label for="liked" class="absolute aspect-square origin-center rounded-full border-fuchsia-400 peer-checked:animate-bubble-expand" /> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tailwind base; | |
@tailwind components; | |
@tailwind utilities; | |
.gradient-text { | |
background: linear-gradient( | |
141.27deg, | |
#ff904e -4.24%, | |
#ff5982 21.25%, | |
#ec68f4 44.33%, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef long long ll; | |
typedef vector<int> vi; | |
typedef vector<vector<int>> vvi; | |
typedef vector<ll> vl; | |
typedef vector<vl> vvl; | |
typedef pair<ll, int> pli; | |
vl dijkstra(int n, map<int, vector<pli>>& adj, int start) { | |
vl dist(n, -1); | |
dist[start] = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
void solve() { | |
} | |
int main() { | |
int t; | |
cin>>t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// precondition: a & b are both sorted | |
bool overlap(vector<string>& a, vector<string>& b) { | |
auto i = a.begin(); | |
auto j = b.begin(); | |
auto n = upper_bound(i, a.end(), *b.rbegin()); | |
auto m = upper_bound(j, b.end(), *a.rbegin()); | |
while(i < n && j < m) { | |
if(*i == *j) { | |
return true; | |
} |
NewerOlder