content stringlengths 10 4.9M |
|---|
# include <cstdio>
int main()
{
char x = getchar();
if( x >= 'a' && x <= 'z' )
putchar(x-32);
else putchar(x);
while( (x=getchar()) != '\n' )
putchar(x);
return 0;
}
|
def _transform_depthmap(self, verts_3d, intrinsics, R_mat, t_mat, orig_size):
verts_3d_cam = self.convert_depthmap_to_cam(verts_3d, intrinsics, orig_size)
verts_3d_cam = verts_3d_cam.transpose(2, 1)
pose_mat = torch.cat([R_mat, t_mat], dim=2)
verts_3d_ones = torch.ones_like(verts_3d_... |
import { Component, FormEvent } from "react";
import { Navigate } from "react-router";
import UsuarioService from "../../service/usuario.service";
type UsuarioForm = {
nome: string;
email: string;
redirect: boolean;
}
class UserCreate extends Component<{}, UsuarioForm> {
constructor(props... |
/** Sort the array, according to the comparator. */
@SuppressWarnings("unchecked")
private static <E> void sort(
Object[] array, Comparator<? super E> comparator) {
Arrays.sort(array, (Comparator<Object>) comparator);
} |
// Level to stat string conversion
func (level Level) statString() *string {
switch level {
case PanicLevel:
return &panicStat
case FatalLevel:
return &fatalStat
case ErrorLevel:
return &errorStat
case WarnLevel:
return &warnStat
case TraceLevel:
return &traceStat
case InfoLevel:
return &infoStat
ca... |
import { commandRunner, getCommitMessage, gitSHASerializer, initFixtureFactory } from "@lerna/test-helpers";
import path from "path";
// eslint-disable-next-line jest/no-mocks-import
jest.mock("@lerna/core", () => require("@lerna/test-helpers/__mocks__/@lerna/core"));
jest.mock("./git-push");
jest.mock("./is-anything... |
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE... |
<filename>fuzz/input-fuzzer.c
/*
* Copyright (c) 2020 <NAME> <<EMAIL>>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDE... |
Athletic Director Dave Brandon is dreaming. It’s the night of Michigan’s Spring Game, which took place on the same weekend that Brandon unveiled the lavish new Schembechler Hall as well as the announcement of a preseason international soccer game that will be played in Michigan Stadium in August. In the dream, Brandon ... |
While past presidential candidates have done all they can to appear relatable and responsible when it comes to their personal finances, it has become clear that those rules don’t seem to apply to Donald Trump.
Trump’s wealth and perceived independence from donors and their concerns allows him to almost circle back aro... |
use std::env;
use std::process;
use std::error::Error;
use std::fs;
struct Config {
day: String,
filename: String,
}
impl Config {
fn new (mut args: env::Args) -> Result<Config, &'static str> {
args.next();
let day = match args.next() {
Some(arg) => arg,
None => re... |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define inf 0x3fffffff
#define rep(i,s,e) for (int i=(s);i<(e);i++)
using namespace std;
struct da
{
int dt,nx;
}a[400000];
int fir[200000],v[200000],w[200000],f[200000];
int asd[200000];
int ans,a0;
... |
/**
* Reads a single line from the server, using either \r\n or \n as the delimiter. The delimiter
* char(s) are not included in the result.
*/
public String readLine(boolean loggable) throws IOException {
StringBuffer sb = new StringBuffer();
InputStream in = getInputStream();
int d;
while ((d... |
<reponame>mythoss/midpoint
/*
* Copyright (c) 2010-2017 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schema.processor;
import java.util.Collection;
import java.util.List;
i... |
package android.io.mobilestudio.fcmNotification;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.io.piso.fcmNotification.managers.FCMSubscriptionManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog;
im... |
Membrane Phosphatidylserine Regulates Surface Charge and Protein Localization
Electrostatic interactions with negatively charged membranes contribute to the subcellular targeting of proteins with polybasic clusters or cationic domains. Although the anionic phospholipid phosphatidylserine is comparatively abundant, its... |
// Given a cubic and a t-range, determine if the stroke can be described by a quadratic.
SkPathStroker::ResultType SkPathStroker::tangentsMeet(const SkPoint cubic[4],
SkQuadConstruct* quadPts) {
this->cubicQuadEnds(cubic, quadPts);
return this->intersectRay(quadPts, kResultType_RayType STROKER_DEBUG_PA... |
<gh_stars>1-10
import { Field, ID, ObjectType } from '@nestjs/graphql'
import { ProposalStatus } from 'src/common/enums'
import { Coin } from 'src/common/models'
import { ProposalContentUnion, ProposalContentType } from 'src/common/unions'
import { Tally } from './tally.model'
@ObjectType()
export class Proposal {
@... |
from bs4 import BeautifulSoup
import requests
import dconlib
from time import sleep
def getlist(pg,url2):
namelist = []
web_url = "https://dccon.dcinside.com/hot/"+str(pg)+url2
with requests.get(web_url) as response:
#html = response.read()
soup = BeautifulSoup(response.text, 'html.parser')... |
import { ProvenanceGraph } from '@visdesignlab/provenance-lib-core';
import { createContext } from 'react';
import { AppConfig } from './AppConfig';
import { ProvenanceActions } from './Store/Provenance';
import { StudyActions } from './Store/StudyStore/StudyProvenance';
import { TaskDescription } from './Study/TaskLi... |
/**
* We have already handled etag, and will add 'If-Match' & 'Range' value if it works.
* <p/>
* Created by Jacksgong on 1/17/16.
*/
public class FileDownloadHeader implements Parcelable {
private Headers.Builder headerBuilder;
private String nameAndValuesString;
private String[] namesAndValues;
... |
/** @jsx jsx */
import * as React from 'react'
import { jsx } from 'theme-ui'
import { css } from '@emotion/react'
import { colors } from '@uswitch/trustyle.styles'
import * as st from './styles'
type Position = 'first' | 'middle' | 'last'
interface BulletProps {
children: React.ReactNode
position: Position
}
... |
Competition between Naegleria fowleri and Free Living Amoeba Colonizing Laboratory Scale and Operational Drinking Water Distribution Systems.
Free living amoebae (FLA), including pathogenic Naegleria fowleri, can colonize and grow within pipe wall biofilms of drinking water distribution systems (DWDSs). Studies on the... |
# https://codeforces.com/problemset/problem/1343/C
import math
def sign(x: int):
if x > 0:
return 1
if x < 0:
return -1
return 0
def solve(arr):
prev_sign = sign(arr[0])
acc_sum, i = 0, 0
while i < len(arr):
block_max = float('-inf')
while i < len(arr) and ... |
def assign_override_material(rpr_context, rpr_shape, obj, material_override) -> bool:
rpr_material = material.sync(rpr_context, material_override, obj=obj)
rpr_displacement = material.sync(rpr_context, material_override, 'Displacement', obj=obj)
rpr_shape.set_material(rpr_material)
rpr_shape.set_displac... |
class Solution:
"""
@param A : a list of integers
@param target : an integer to be searched
@return : a list of length 2, [index1, index2]
"""
def searchRange(self, A, target):
# write your code here
length = len(A)
start = 0
end = length - 1
if end < 0:... |
import { Injectable } from '@nestjs/common';
import { CreateMileStoneDto } from './dtos/create-milestone.dto';
import { Milestone } from './entities/milestone.entity';
import { v4 as uuid } from 'uuid';
import MilestoneStore from './milestone-store.service';
@Injectable()
export class MilestoneService {
async c... |
/**
* KafkaClientHelperTest
* author: gaohaoxiang
* date: 2020/4/9
*/
public class KafkaClientHelperTest {
@Test
public void simpleTest() {
Assert.assertEquals("test_app", KafkaClientHelper.parseClient("test_app"));
Assert.assertEquals("test_app", KafkaClientHelper.parseClient("test_app-0")... |
<reponame>Buzzec/concurrency_traits
use crate::mutex::{Mutex, SpinLock};
use crate::queue::*;
use crate::semaphore::*;
use crate::ThreadFunctions;
use alloc::boxed::Box;
use alloc::collections::VecDeque;
use async_trait::async_trait;
use core::time::Duration;
use num::Zero;
/// A queue based on a semaphore to block on... |
<gh_stars>0
import * as React from 'react';
import {Link, NavLink} from 'react-router-dom';
const activeStyle = {
color: '#ececec',
fontSize: '18px'
};
const Navigator: React.SFC = (): JSX.Element => (
<div>
<ul>
<li><NavLink to="/" activeStyle={activeStyle} exact={true}>Home</NavLink><... |
// plain or tls
class Connection : public boost::enable_shared_from_this<Connection<endpoint_type> >{
public:
typedef typename endpoint_type::handler::connection_ptr connection_ptr;
Connection(connection_ptr con, boost::asio::io_service &io_service) :
websocket_connection(con), readBuffer(1024), mqttMessage(""), co... |
/** Convert Java data type to Java VM type signature. */
public static final String javaTypeSig(Class<?> cls) throws InvalidNameException {
if (cls.isArray()) return "[" + javaTypeSig(cls.getComponentType());
if (cls.equals(void.class)) return "V";
if (cls.equals(boolean.class)) return "Z";
if (cls.equa... |
NBC 7's Omari Fleming reports from Imperial Valley after a military jet crashes and creates a firestorm, destroyed three homes. No one was injured. (Published Thursday, June 5, 2014)
Military officials are investigating what caused a military plane to crash into homes in an Imperial Valley neighborhood about two hours... |
Widespread mass-wasting processes off NE Sicily (Italy): insights from morpho-bathymetric analysis
Abstract The NE Sicilian continental margin is largely affected by canyons and related landslide scars. Two main types of submarine canyons are recognizable: the first type carves the shelf up to depths <20 m, a few hund... |
/**
Gets an existing UserRecord object in the database under the specified data 'Store' and with the
specified 'Key'.
Parameters:
Store- the data store name to retrieve the UserRecord from
Key- the unique key that was used when creating the UserRecord
Returns:
the requested UserRecord object, or null if no matching r... |
Every journey is a series of choices.
Früher hatte ich einen immer wiederkehrenden Albtraum. In diesem Traum wurde ich in einem Labyrinth, oder zumindest in etwas das danach aussah, von einer riesigen Kugel oder Murmel verfolgt. So wie bei Indiana Jones – ihr wisst schon, diese große Steinkugel – nur alles in surreal ... |
<gh_stars>0
import os
import unittest
from pynwb.form.data_utils import DataChunkIterator
from pynwb.form.backends.hdf5.h5tools import HDF5IO
from pynwb.form.build import DatasetBuilder
import h5py
import tempfile
import numpy as np
class H5IOTest(unittest.TestCase):
"""Tests for h5tools IO tools"""
def se... |
/// <reference path="typings/tsd.d.ts" />
/// <reference path="sandbox.d.ts" />
import acorn = require('acorn/dist/acorn_loose');
import walk = require('acorn/dist/walk');
var literals = [];
var names = [];
var vars = {};
var builtins = {};
function tryParseInt(s: string) {
return parseInt(s);
}
function ins(i: ... |
Response Time Analysis and Priority Assignment of Processing Chains on ROS2 Executors
ROS (Robot Operating System) is currently the most popular robotic software development framework. Robotic software in safe-critical domain are usually subject to hard real-time constraints, so designers must formally model and analy... |
/**
* A Wizard style dialog with back, next, finish, and cancel buttons.
*/
public abstract class Wizard extends JPanel {
protected JButton btnNext = new JButton("Next");
protected JButton btnBack = new JButton("Back");
protected JButton btnCancel = new JButton("Cancel");
protected JPanel top;
protected JD... |
<filename>samples/dump_points.cpp<gh_stars>0
#include <iostream>
#include <fstream>
#include <chrono>
#include <string>
#include <memory>
#include <cassert>
#include <cmath>
#include <cmdline.h>
#include "evolvents.hpp"
void initParser(cmdline::parser& parser);
int main(int argc, char** argv)
{
cmdline::parser pa... |
// AddEntry adds an entry to the chain
func (c *Chain) AddEntry(entry []byte) error {
if !c.writable {
return fmt.Errorf("chain opened as read-only")
}
c.merkle.AddHash(entry)
return nil
} |
<reponame>bugvm/robovm
/*
* Copyright (C) 2013-2015 RoboVM AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required ... |
<filename>src/components/basic/CustomScroll/index.tsx
import React, { ReactNode } from 'react';
import classNames from 'classnames';
import { useThemeContext, ScrollBar } from '@biffbish/aave-ui-kit';
interface CustomScrollProps {
children: ReactNode;
className?: string;
onUpdate?: (value: any) => void;
}
expo... |
package ackhandler
import (
"time"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/utils"
"github.com/lucas-clemente/quic-go/internal/wire"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Received Packet Tracker", func() {
var (
tr... |
class Topology:
"""
This class unifies the functions to deal with **Complex Networks** as a network topology within of the simulator. In addition, it facilitates its creation, and assignment of attributes.
"""
LINK_BW = "BW"
"Link feature: Bandwidth"
LINK_PR = "PR"
"Link feauture: Propaga... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int m, num, x, i;
bool chk;
cin >> num;
if(num==1)
{
cout << '3' <<endl;
return 0;
}
if(num==2)
{
cout << '4' <<endl;
return 0;
}
for(chk=false,m=1; m<num; m++)
{
... |
<reponame>huongdg/Apache-Spark-2x-for-Java-Developers<gh_stars>0
package com.packt.sfjd.ch7;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.spark.HashPartitioner;
import org.apache.spark.RangePartitioner;
import org.apache.spark.SparkConf;
import org.apache.spark.api.jav... |
<filename>unn/models/heads/utils/accuracy.py<gh_stars>1-10
from functools import reduce
import torch
def binary_accuracy(output, target, thresh=0.5, ignore_index=-1):
"""binary classification accuracy. e.g sigmoid"""
output = output.view(-1)
target = target.view(-1)
keep = torch.nonzero(target != ign... |
export * from './config.util'
export * from './consts.util'
export * from './objs.util'
|
// putValueByPath puts the value in the user specified sr.ByPath
func (sr *SearchReplace) putValueByPath(object *yaml.RNode) error {
path := strings.Split(sr.ByPath, PathDelimiter)
node, err := object.Pipe(yaml.LookupCreate(yaml.MappingNode, path[:len(path)-1]...))
if err != nil {
return errors.Wrap(err)
}
sn :=... |
def _gather_points(self):
x = self.index.get_data()
y = self.value.get_data()
rad= min(self.width/2.0,self.height/2.0)
sx = x*rad+ self.x + self.width/2.0
sy = y*rad+ self.y + self.height/2.0
points = transpose(array((sx,sy)))
self._cached_data_pts = points
... |
Electroweak single-pion production off the nucleon: from threshold to high invariant masses
Neutrino-induced single-pion production (SPP) provides an important contribution to neutrino-nucleus interactions, ranging from intermediate to high energies. There exists a good number of low-energy models in the literature ... |
# encoding: utf-8
import os
import sys
import time
import random
import argparse
import logging
from collections import OrderedDict, defaultdict
import torch
import torch.utils.model_zoo as model_zoo
import torch.distributed as dist
class LogFormatter(logging.Formatter):
log_fout = None
date_full = '[%(asctim... |
def on_set_fraction( self, value ):
if not len(self.key) or not len(self.keyValue):
return
previous = None
previousKey = None
start,stop = -1,-1
for index,(key,orient) in enumerate(zip( self.key, self.keyValue )):
if key > value:
if previou... |
<gh_stars>0
/**
* Copyright (C) 2011-2019 Red Hat, Inc. (https://github.com/Commonjava/indy)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/... |
<gh_stars>0
import React from 'react'
import PropTypes from 'prop-types'
import Image from 'next/image'
HeroImage.propTypes = {
img: PropTypes.string,
}
export default function HeroImage({img}) {
return (
<div className="hero-image-wrapper">
<Image
src={img}
layout="intrinsic"
wi... |
<reponame>christopher-burke/warmups
#!/usr/bin/env python3
"""Baseball stat formulas.
Collection of baseball formulas used for statistical analysis.
"""
from fractions import Fraction
def innings(innings: str):
"""Convert the partial innings pitched (outs) to a fraction.
Baseball represents the thirds of ... |
<reponame>MartinPippel/DAmar
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "dalign/align.h"
#define LAZ_MAGIC 0x254c415a
typedef struct
{
uint32_t magic;
uint16_t version;
uint16_t twidth;
uint64_t novl;
uint64_t reserved1;
uint64_t ... |
<gh_stars>0
import { MockRuntimeError } from '@jamashita/anden-error';
import { Contradiction } from '../Contradiction';
import { Schrodinger } from '../Schrodinger';
describe('Contradiction', () => {
describe('get', () => {
it('throws given error', () => {
const error1: MockRuntimeError = new MockRuntimeE... |
package main
import (
"fmt"
"math"
)
func leftmostDigit(n int) int {
for n >= 10 {
n = n / 10
}
return n
}
func numDigits(n int) int {
var count int = 0
for n > 0 {
n = n / 10
count = count + 1
}
return count
}
// assumes leftDigit and E are valid constraints for producing a sequential number, per v... |
/**
* Paints the renderer part of a row. The receiver should NOT modify
* clipBounds, or insets.
*
* @param g - the graphics configuration
* @param clipBounds -
* @param insets -
* @param bounds - bounds of expand control
* @param path - path to draw control for
* @param row - row to draw co... |
Dictyostelium RbrA is a putative Ariadne‐like ubiquitin ligase required for development
The RBR family of ubiquitin ligases is a large and complex family with members present in animals, plants, fungi, and protists. The Ariadne subfamily appears to be the most ancient. The Dictyostelium rbrA gene encodes a protein wit... |
import java.util.Scanner;
public class NewClass {
public static void main(String[] args) {
Scanner s = new Scanner (System.in);
int n=s.nextInt() , l ,v=0;
boolean bool=false;
String str ,ar[]=new String[n];
for (int i = 0; i < n; i++) {
l=s.... |
/** @file
*
* Copyright (c) 2007-2014, Allwinner Technology Co., Ltd. All rights reserved.
* http://www.allwinnertech.com
*
* tangmanliang <<EMAIL>>
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License ... |
#! /usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""An example CompilerGym service in python."""
import logging
from concurrent import futures
from multiprocessing i... |
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
import io.ebean.config.dbplatform.DatabasePlatform;
public class Postgres9Ddl extends PostgresDdl {
public Postgres9Ddl(DatabasePlatform platform) {
super(platform);
}
/**
* Map bigint, integer and smallint into their equivalent serial types.... |
<filename>rotor_connect.py<gh_stars>0
#!/usr/bin/python
from bluepy import btle
import time
import binascii
dev_name_uuid = btle.UUID(0x2A00)
rotorServicesUUID = btle.UUID("fb8e8220-1797-11e6-900b-0002a5d5c51b")
bootloaderServices = btle.UUID("00060000-f8ce-11e4-abf4-0002a5d5c51b")
genericServices = btle.UUID("8ab... |
<gh_stars>1-10
// Package jsons implements encoding and decoding of JSONS files and streams.
// The JSONS format is defined as compact JSON objects delimited by one
// newline. Each JSON object resides on its own line.
package jsons
|
//special case, because do not overwrite the spellchecking styles
protected void applyHighlighting(StyleSpans<Collection<String>> highlighting) {
int currentPosition = 0;
List<Replacement<Collection<String>, String, Collection<String>>> replacements = new ArrayList<>();
for (StyleSpan<Collection... |
/** This method should clearly display all the contents of the structure in
* textual form, sending it to a CStream.
* The default implementation in this base class relies on \a
* saveToConfigFile() to generate a plain text representation of all the
* parameters.
*/
void CLoadableOptions::dumpToTextStream(mrpt::... |
// isWinning returns true if the board is winning.
func (b *board) isWinning(winningNumbers []int) bool {
var markedSquares []square
for _, square := range b.squares {
if contains(winningNumbers, square.value) {
markedSquares = append(markedSquares, square)
}
}
xOccurrences := map[int]int{}
yOccurrences := ... |
package com.netflix.eureka.registry;
import javax.annotation.Nullable;
import java.util.concurrent.atomic.AtomicLong;
/**
* @author David Liu
*/
public interface ResponseCache {
void invalidate(String appName, @Nullable String vipAddress, @Nullable String secureVipAddress);
AtomicLong getVersionDelta();
... |
/**
* Return a page from the buffer, or null if none exists
*/
public synchronized Page poll()
{
if (settableFuture != null) {
settableFuture.set(null);
settableFuture = null;
}
return pages.poll();
} |
<filename>src/app/app.pipes.ts
import { Pipe, PipeTransform } from '@angular/core';
import {DataPoint, XMLSource} from "./app.reducer";
@Pipe({name: 'getValue'})
export class GetValuePipe implements PipeTransform {
transform(file: File, dataPoint: DataPoint): string{
// const node = file.document?.getElementsBy... |
/**
* Test the parsing of the game summary<br>
* Passed game
*/
@Test
public void testParseGameSummary_PassedGame() {
final String gameSummary = "(;GM[Skat]PC[International Skat Server]CO[]SE[32407]ID[756788]DT[2011-05-28/08:46:19/UTC]P0[xskat]P1[bonsai]P2[bernie]R0[]R1[0.0]R2[]MV[w C8.DQ.DJ.... |
def _calculate_roc_points(data, sensitive_feature_value, flip=True):
scores, labels, n, n_positive, n_negative = _get_scores_labels_and_counts(data)
if n_positive == 0 or n_negative == 0:
raise ValueError(DEGENERATE_LABELS_ERROR_MESSAGE.format(sensitive_feature_value))
scores.append(-np.inf)
lab... |
Squamous Cell Carcinoma Associated with Cosmetic Use of Bleaching Agents: About a Case in Ivory Coast
Voluntary skin depigmentation is defined as a set of procedures for obtaining skin clarification for cosmetic purposes. Skin cancers are possible complications, but rarely reported. We describe a case observed in Ivor... |
import React from "react";
import { Story, Meta } from "@storybook/react";
import Section, { SectionProps } from "../layout/section";
export default {
title: "Layout/Section",
component: Section,
} as Meta;
const Template: Story<SectionProps> = (args) => (
<Section {...args}>
<p>
This is a long chil... |
<filename>core/cache_thread_member.go
package core
import "github.com/DisgoOrg/snowflake"
type (
ThreadMemberFindFunc func(threadMember *ThreadMember) bool
ThreadMemberCache interface {
Get(threadID snowflake.Snowflake, userID snowflake.Snowflake) *ThreadMember
GetCopy(threadID snowflake.Snowflake, userID snow... |
# 860. Lemonade Change
# At a lemonade stand, each lemonade costs $5.
# Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bills).
# Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must provide the correct change to each custom... |
import { Attribute } from './attribute';
import { D3Node } from './node';
import { GravityPoint } from '../';
export interface View {
_rev?: string;
description?: string;
links?: { [key: string]: ViewLink };
name?: string;
userState?: ViewUserState;
nodes?: { [key: string]: ViewNode };
url?: string;
}
e... |
def olcnt(s):
i = 0
lst = []
while i < len(s):
j = 1
while i + j < len(s) and s[i] == s[i + j]:
j += 1
lst.append((s[i], j))
i += j
return lst
s = list(input())
k = int(input())
if len(set(s)) == 1:
print(int(len(s)*k/2))
else:
cnt1 = sum([int(x[1... |
/**
* A reader-writer lock from "Java Threads" by Scott Oak and Henry Wong.
*
* @author Scott Oak and Henry Wong
*/
public class ReaderWriterLock {
/**
* A node for the waiting list.
*
* @author Scott Oak and Henry Wong
*/
private static class ReaderWriterNode {
/** A reader. *... |
/**
* Check file extension for containing in list of needless extensions.
* @param fileName File name.
* @param extensions List of files extensions.
* @return True if file extension not contains in list of extensions.
*/
boolean checkExtension(String fileName, List<String> extensions) {
... |
<reponame>shc0743/CLearn
// MFCLoginGUIDlg.cpp: 实现文件
//
#include "pch.h"
#include "framework.h"
#include "MFCLoginGUI.h"
#include "MFCLoginGUIDlg.h"
#include "afxdialogex.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#include <fstream>
#include "CDlgMainLoginBox.h"
#include "user.h"
#include "resource.h"
// 用于应用程... |
Pamela Anderson has attacked Donald Trump during a speech in which she calls on people not to use pornography.
The former Baywatch star - who recently wrote an opinion piece about porn for the Wall Street Journal - hit out at the Presidential candidate's comments about women.
A recording emerged last week in which th... |
// GetSource returns the Source with the given ID
func GetSource(node sqalx.Node, id string) (*Source, error) {
if value, present := node.Load(getCacheKey("source", id)); present {
return value.(*Source), nil
}
s := sdb.Select().
Where(sq.Eq{"id": id})
sources, err := getSourcesWithSelect(node, s)
if err != ni... |
<reponame>krapnikkk/FairyGUI-createjs
import { UISprite } from './display/UISprite'
import { GObject } from './GObject'
import { IColorGear } from './interface/IColorGear'
import { StringUtil } from './utils/StringUtil'
import { Utils } from './utils/Utils'
import { XmlNode } from './utils/XMLParser'
export class GGr... |
<reponame>huazhouwang/electrum
package org.haobtc.onekey.event;
/**
* Created by 小米粒 on 2019/4/12.
*/
public class FirstEvent {
//11 --> update wallet list
//22 --> update transaction list
//33 --> Whether the custom node is added successfully
private String mMsg;
public FirstEvent(String msg) {... |
<gh_stars>1-10
// tslint:disable:no-expression-statement
import test from 'ava';
import * as child_process from 'child_process';
import { echoChildProcessOutput } from './echo';
test('echo child process (expect two lines of output)', async t => {
await t.notThrowsAsync(async () => {
const child = child_process.s... |
import { Post, modelManager, createData } from './models';
(async () => {
await createData();
// Read all published posts, sorted by Title
const postsByTitle = await modelManager.read(Post, {
where: {
published: true
},
limit: 100,
orderBy: ['title']
});
... |
<filename>LuoGu/1525.cc
/**
* luogu 1525
*
* binary check anwser
* */
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
const int N = 2e4 + 5;
const int M = 1e5 + 5;
struct Edge { int next, to, val; } e[M * 2];
int head[N], color[N];
int n, m;
void insert(int u, int v, int w) {
st... |
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const int maxn=1e6+10;
#define mod 1000000007
int main(){
fast;
int n,m; cin>>n>>m;
vector<vector<int>> a(n,vector<int>(m,0)),sv;
for(auto i=0;i<n;++i){
for(auto j=0;j<... |
import { Box, Button, Input, Modal } from "@artsy/palette"
import { FormikActions } from "formik"
import React from "react"
import * as Yup from "yup"
import { CreateSmsSecondFactorMutationResponse } from "__generated__/CreateSmsSecondFactorMutation.graphql"
import { useSystemContext } from "Artsy"
import { Step, Wiza... |
//
// Function: cmdLineValidate
//
// Validate a single command line for use in a command list and, if needed,
// add or find a program counter control block and associate it with the
// command line.
// Return values:
// -1 : invalid command
// 0 : success (with valid command or only white space without command)
// >... |
<reponame>TheArtistGuy/scion
use std::ops::Range;
use wgpu::util::BufferInitDescriptor;
use crate::{
core::components::{material::Material, maths::coordinates::Coordinates},
rendering::{gl_representations::TexturedGlVertex, scion2d::Renderable2D},
};
const INDICES: &[u16] = &[0, 1, 3, 3, 1, 2];
/// Renderab... |
// *********************************************************************
// Count the number of bits set
// *********************************************************************
inline uint32_t udCountBits32(uint32_t v)
{
v = v - ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x3... |
// Function createJobObject creates a new job object.
func createJobObject(jobAttrs *syscall.SecurityAttributes, name *uint16) (handle syscall.Handle, err error) {
r1, _, e1 := CreateJobObjectW.Call(
uintptr(unsafe.Pointer(jobAttrs)),
uintptr(unsafe.Pointer(name)))
handle = syscall.Handle(r1)
if handle == 0 {
... |
import math
def getSeq(n, g, b):
need = math.ceil(n/2)
d = math.ceil(need/g)-1
td = d*(g+b)
td += need-d*g
return max(td, n)
T = int(input())
for i in range(T):
n, g, b = list(map(int, input().split()))
print(getSeq(n, g, b))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.