text string | size int64 | token_count int64 |
|---|---|---|
template <typename T> std::string SerialPort::formatVal(T val, int type) {
std::ostringstream os;
switch (type) {
case BIN: {
std::bitset<8 * sizeof(val)> bits(val);
os << bits;
break;
}
case HEX: {
os << std::hex << val;
brea... | 520 | 159 |
/*******************************************************************************
* Copyright (C) 2007 by the members of PG 510, University of Dortmund: *
* d-collide-devel@lists.sourceforge.net *
*
* Andreas Beckermann, Christian Bode, Marcel Ens, Sebastian Ens, ... | 14,264 | 4,409 |
/* Copyright (c) <2003-2016> <Newton Game Dynamics>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* includi... | 20,386 | 13,795 |
#include "GUIButton.h"
#include "GUIAlphaElement.h"
#include "GUIClippedRectangle.h"
#include "../Tools/Logger.h"
GUIButton::GUIButton(const char *cbs) : GUIAlphaElement(cbs), GUIClippedRectangle()
{
setBordersColor(0.0f, 0.0f, 0.0f);
setDimensions(40, 22);
setPosition(0.5, 0.5);
setColor(100, 150,... | 2,592 | 894 |
#include <cmath>
#include "pinba/globals.h"
#include "pinba/limits.h"
#include "pinba/dictionary.h"
#include "pinba/packet.h"
#include "pinba/bloom.h"
#include "proto/pinba.pb-c.h"
////////////////////////////////////////////////////////////////////////////////////////////////
request_validate_result_t pinba_valida... | 3,669 | 1,549 |
///////////////////////////////////////
// AUTO GENERATED FILE - DO NOT EDIT //
///////////////////////////////////////
/* SPDX-License-Identifier: BSD-2-Clause-Patent
*
* SPDX-FileCopyrightText: 2016-2020 the prplMesh contributors (see AUTHORS.md)
*
* This code is subject to the terms of the BSD+Patent license.
... | 5,091 | 1,883 |
// Copyright Emil Fresk 2015-2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <iostream>
#include "serialpipe.hpp"
using namespace std;
void test(const std::vector<uint8_t> &data)... | 1,218 | 407 |
/*
Description
小Hi在虚拟世界中有一只小宠物小P。小P有K种属性,每种属性的初始值为Ai。小Ho送给了小Hi若干颗药丸,每颗药丸可以提高小P指定属性1点。通过属性值,我们可以计算小P的强力值=(C1(1/B1))*(C2(1/B2))*...*(CK(1/BK)),其中Ci为小P第i项属性的最终值(Ai+药丸增加的属性)。 已知小Ho送给小Hi的药丸一共有N颗,问小P的强力值最高能够达到多少?
Input
第一行包含两个整数N,K,分别表示药丸数和属性种数。
第二行为K个整数A1 - AK,意义如前文所述。
第三行为K个整数B1 - BK,意义如前文所述。
对于30%的数据,满足1<=N<=10, 1<=K<=3
... | 1,081 | 792 |
//
// Name: PrefDlg.cpp
//
// Copyright (c) 2007-2011 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#include "PrefDlg.h"
#include "vtui/AutoDialog.h"
// WDR: class implementations
//-------------... | 2,787 | 1,218 |
/*
* Copyright (c) 2016 Alvin Wong <alvinhochun@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy,... | 8,840 | 3,821 |
#include "stdafx.h"
#include "Wind_strike.h"
#include "util.h"
#include "kdb+.util/util.h"
#include "kdb+.util/type_convert.h"
#include <iostream>
#include <sstream>
Wind::callback::Result::Result() : result_(new Wind::callback::Result::promise_ptr::element_type) {}
Wind::callback::Result::promise_ptr* Wind::callba... | 10,821 | 4,305 |
class Solution {
public:
int numberOfSteps (int num) {
if(!num) return 0;
else if(num&1) return numberOfSteps(num - 1) + 1;
else return numberOfSteps(num / 2) + 1;
}
};
| 220 | 80 |
#include "JobButton.h"
#include <JenkinsJobInfo.h>
#include <QLabel>
#include <QIcon>
#include <QHBoxLayout>
#include <QMouseEvent>
namespace Jenkins
{
JobButton::JobButton(const JenkinsJobInfo &job, QWidget *parent)
: QFrame(parent)
, mJob(job)
{
mJob.name.replace("%2F", "/");
mJob.color.remove("_anime"... | 1,222 | 446 |
// Copyright (c) 2019 ASMlover. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list ofconditions and... | 8,192 | 2,769 |
#include <memory>
#include <utility>
#include <functional>
struct Vector
{
float x, y, z;
};
struct Del
{
void del(Vector*)
{
printf("Call Del::del\n");
}
};
int main()
{
{
std::unique_ptr<Vector, std::function<void(Vector*)>> v(new Vector{ 1, 1, 1 },
[](Vector* p) { p... | 556 | 210 |
/* ////////////////////////////////////////////////////////////
File Name: ysshellext_splitop.cpp
Copyright (c) 2017 Soji Yamakawa. All rights reserved.
http://www.ysflight.com
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are m... | 14,958 | 7,897 |
/*
libember -- C++ 03 implementation of the Ember+ Protocol
Copyright (C) 2012-2016 Lawo GmbH (http://www.lawo.com).
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef __LIBEMBER_GLOW_UTIL_TRAITS... | 5,177 | 1,392 |
//
// See README-LCALS_license.txt for access and distribution restrictions
//
//
// Header file defining macros, routines, structures used in Loop Subset A.
//
#ifndef SubsetDataA_HXX
#define SubsetDataA_HXX
//
// Some macros used in kernels to mimic real code usage.
//
#define NDPTRSET(v,v0,v1,v2,v3,v4,v5,v6,v7) ... | 3,781 | 1,552 |
#include "core.hpp"
#include "aprilgrid.hpp"
#include "ceres_utils.hpp"
#include "calib_data.hpp"
#include "calib_params.hpp"
#include "calib_mono.hpp"
#include "calib_stereo.hpp"
#include "calib_mocap.hpp"
| 207 | 90 |
#include "JsonImportPrivatePCH.h"
#include "JsonRigidbody.h"
#include "macros.h"
using namespace JsonObjects;
JsonRigidbody::JsonRigidbody(JsonObjPtr data){
load(data);
}
void JsonRigidbody::load(JsonObjPtr data){
/*I should probably get rid of those helper macros due to reduced error checking...*/
JSON_GET_VAR(d... | 1,113 | 430 |
#include "MeshLoader.h"
namespace sereno
{
MeshLoader* MeshLoader::loadFrom3DS(const std::string& path)
{
Lib3dsFile* file3ds = lib3ds_file_open(path.c_str());
if(!file3ds || !file3ds->meshes)
{
LOG_ERROR("Could not load properly the file %s\n", path.c_str());
if... | 4,703 | 1,472 |
#include "nau/material/material.h"
#include "nau.h"
#include "nau/slogger.h"
#include "nau/debug/profile.h"
#include "nau/material/uniformBlockManager.h"
using namespace nau::material;
using namespace nau::render;
using namespace nau::resource;
Material::Material() :
m_Color (),
//m_Texmat (0),
m_Shader (NULL),
... | 17,404 | 6,875 |
#include "correlationmatrix.h"
#include "correlationmatrix_model.h"
#include "correlationmatrix_pair.h"
/*!
* Return a qt table model that represents this data object as a table.
*/
QAbstractTableModel* CorrelationMatrix::model()
{
EDEBUG_FUNC(this);
if ( !_model )
{
_model = new Model(this);
... | 1,969 | 608 |
#pragma once
#include <memory>
#include "transformation.hpp"
namespace potato
{
class Camera
{
public:
typedef std::shared_ptr<Camera> ptr;
Camera();
void transformation(Transformation const& p);
Transformation const& transformation() const;
f32 tan_half_fov() const;
private:
Transformation t_;
... | 698 | 255 |
//////////////////////////////////////////////////////////////////////////////////////
// This file is distributed under the University of Illinois/NCSA Open Source License.
// See LICENSE file in top directory for details.
//
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
//
// File developed by: Jeongnim ... | 2,987 | 1,183 |
/*MT*
MediaTomb - http://www.mediatomb.cc/
object.cc - this file is part of MediaTomb.
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
Copyright (C) 2006-2010 Gena Batyan <bgeradz@mediatomb.cc>,
... | 2,022 | 753 |
#include "treemap.h"
#include <algorithm>
#include "base/math/interpolation.h"
using namespace Vizzu;
using namespace Vizzu::Charts;
using namespace Geom;
TreeMap::TreeMap(const std::vector<double> &sizes, const Point &p0, const Point &p1)
{
for (auto j = 0u; j < sizes.size(); j++)
sums.push_back({ j, sizes[j] }... | 1,439 | 637 |
#include <cstdio>
#include <algorithm>
typedef long long ll;
ll gcd(ll a, ll b)
{
if (a < b)
std::swap(a, b);
while (a)
{
ll tmp = b % a;
b = a;
a = tmp;
}
return b;
}
int main()
{
ll a, b, m;
scanf("%lld %lld", &a, &b);
m = gcd(a, b);
printf("%lld", (a / m)*b);
} | 285 | 159 |
#pragma once
#define GLFW_INCLUDE_VULKAN
#include "../../External/Vulkan/Windows/Header/glfw3.h"
#include "../Runtime/Interface.hpp"
namespace gpx
{
class runtime;
class glfw_window : public window
{
friend class vulkan_runtime;
public:
glfw_window(const window_desc& desc, obs<runtime> rt);
virtual ~g... | 814 | 278 |
#pragma once
#include <functional>
#include <memory>
#include "core/intermediate/abstract_intermediate_store.hpp"
#include "core/map_output/abstract_map_output.hpp"
#include "core/map_output/map_output_stream.hpp"
#include "core/partition/abstract_partition.hpp"
#include "core/cache/abstract_fetcher.hpp"
#include "io... | 2,674 | 836 |
#ifndef _POLYNOMIAL_H_
#define _POLYNOMIAL_H_
#include "../matrix/matrix.hpp"
#include "../matrix/matrix_utility.hpp"
template<typename T>
class polynomial {
public:
// constructor with memory allocation
polynomial(size_t d,T x=0) : D(d) {
P.resize(d+1, 1, x);
}
// default constructor
pol... | 5,713 | 2,084 |
#include <bits/stdc++.h>
using namespace std;
/* Generating Subsets : Method 2
You are given a set of numbers : {0 , 1 , 2 , 3 , 4}
You have to find all the subsets of this set.
*/
int n;
int A[100];
void search()
{
// 1 << n means 2^n i.e this number of combinations are possible
// Now 2^n will take n bits ... | 864 | 322 |
#include "stdafx.h"
// General
#include "Sky_Material.h"
Sky_Material::Sky_Material() :
MaterialWrapper(_RenderDevice->CreateMaterial())
{
std::shared_ptr<Shader> g_pVertexShader = _RenderDevice->CreateShader(
Shader::VertexShader, "shaders_D3D/Sky.hlsl", Shader::ShaderMacros(), "VS_main", "latest"
);
g_pVer... | 681 | 272 |
#include <Meshler/Interactors/CommandInteractor.hpp>
#include <Meshler/MController.hpp>
namespace Meshler
{
CommandInteractor::CommandInteractor(MController& controller) : m_controller(&controller)
{
}
void CommandInteractor::onEvent(const Graphics::KeyEvent& keyEvent)
{
if (auto nextInteractorCommand = m_intera... | 460 | 141 |
#include "ModelComponent.h"
#include "TransformComponent.h"
#include "CameraComponent.h"
#include "GL/glew.h"
#include "../ResourceManagement/ResourceManager.h"
#include "../Maths/Mat4.h"
#include "../Core/Logging.h"
#include "../Rendering/OpenGLRendering.h"
ModelComponent::~ModelComponent()
{
}
void ModelComponent:... | 7,436 | 3,022 |
/*
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
*/
/*
*
*/
#include "helper.h"
class Solution {
public:
string convertToTitle(int n) {
string res;
while (... | 574 | 205 |
#ifndef PYTHONIC_NUMPY_COPY_HPP
#define PYTHONIC_NUMPY_COPY_HPP
#include "pythonic/utils/proxy.hpp"
#include "pythonic/utils/numpy_conversion.hpp"
#include "pythonic/types/ndarray.hpp"
#include "pythonic/types/ndarray.hpp"
namespace pythonic {
namespace numpy {
// list case
template<class E>
... | 1,437 | 455 |
/*****************************************************************************
*
* Copyright (c) 2019 SafeNet. All rights reserved.
*
* This file contains information that is proprietary to SafeNet and may not be
* distributed or copied without written consent in SafeNet.
*
*********************************************... | 4,850 | 1,992 |
#include "../external/catch.hpp"
#include "splitStrByDelim.h"
TEST_CASE("splitStrByDelim")
{
{
std::vector<std::string> r = splitStrByDelim("1-2", '-');
REQUIRE(r.size() == 2);
REQUIRE(r[0] == "1");
REQUIRE(r[1] == "2");
}
{
std::vector<std::string> r = splitStrByDe... | 929 | 415 |
#include <wamr/native.h>
#include <wasm_export.h>
#include <faabric/util/logging.h>
namespace wasm {
// -------------------------------------------
// 14/04/21 - WAMR threading not implemented
// All of these functions are stubbed as threading with WAMR isn't yet
// implemented. Once it is, we will need to implement... | 2,586 | 948 |
/*
subdivide.cpp: Subdivides edges in a triangle mesh until all edges
are below a specified maximum length
This file is part of the implementation of
Instant Field-Aligned Meshes
Wenzel Jakob, Daniele Panozzo, Marco Tarini, and Olga Sorkine-Hornung
In ACM Transactions on Graphics (... | 5,523 | 2,260 |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "config.h"
#include "public/web/WebDocument.h"
#include "core/CSSPropertyNames.h"
#include "core/dom/Document.h"
#include "core/dom/NodeRenderS... | 1,822 | 589 |
#include "fv_mapping.h"
#include "ChiMesh/MeshContinuum/chi_meshcontinuum.h"
#include "ChiMesh/chi_mesh_utils.h"
using namespace chi_math::finite_element;
//###################################################################
/**Constructs a Finite Volume mapping of a cell.*/
FiniteVolume::
FiniteVolume(const chi_m... | 1,278 | 404 |
#ifndef __READERLP_MODEL_HPP__
#define __READERLP_MODEL_HPP__
#include <limits>
#include <memory>
#include <string>
#include <vector>
enum class VariableType {
CONTINUOUS,
BINARY,
GENERAL,
SEMICONTINUOUS
};
enum class ObjectiveSense {
MIN,
MAX
};
struct Variable {
VariableType type = VariableTy... | 1,320 | 465 |
//TLE
#include <bits/stdc++.h>
#define LLI long long
using namespace std;
int main() {
LLI t;
cin >> t;
while (t--) {
LLI n;
cin >> n;
string s;
cin >> s;
vector<LLI> arr;
for (LLI i=0;i<n;i++) {
arr.push_back(s[i] - '0');
}
LLI... | 531 | 220 |
// :copyright: (c) 2017 Alex Huszagh.
// :license: MIT, see LICENSE.md for more details.
/*
* \addtogroup Tests
* \brief STL forward_list alias unittests.
*/
#include <pycpp/stl/forward_list.h>
#include <gtest/gtest.h>
PYCPP_USING_NAMESPACE
// TESTS
// -----
TEST(forward_list, forward_list)
{
using forwa... | 383 | 165 |
#include <iostream>
#include <regex>
#include <string>
auto read_position()
{
static const std::regex re{R"(\s+Enter the code at row ([1-9][0-9]*), column ([1-9][0-9]*).)"};
static const auto to_number = [] (const auto& s) {
return strtol(s.data(), nullptr, 10);
};
std::string line;
getli... | 1,301 | 502 |
#include "ghpch.h"
#include "ShaderType.h"
namespace Ghurund {
const ShaderType &ShaderType::VS = ShaderType(1, "vs", "vertexMain", D3D12_SHADER_VISIBILITY_VERTEX);
const ShaderType &ShaderType::PS = ShaderType(2, "ps", "pixelMain", D3D12_SHADER_VISIBILITY_PIXEL);
const ShaderType &ShaderType::GS = ShaderT... | 842 | 353 |
#include <parser.h>
#include <gtest/gtest.h>
#include <string>
#include <memory>
#define TESTAGENCYID "US"
#define TESTAUTHOR "glasstest"
// glass3::parse::Parser is an abstract class and
// must be derived into a concrete class before use.
class parserstub : public glass3::parse::Parser {
public:
parserstub()
... | 1,630 | 578 |
#pragma once
#include "Skill.hh"
/**
* @brief Skill library
*
* For scalings see https://docs.google.com/spreadsheets/d/1z9b23xHPNQuqmZ5t51SeIMq2rlI6d8mPyWp9BmGNxjc/
*/
struct Skills
{
public:
private:
template <Weapon weapon, DmgType dmgtype>
struct Base
{
protected:
Base() = delete;
... | 39,011 | 13,733 |
/*
* This is using wfqueue C ++ class
* mkdir build
* cd build
* cmake ..
* make
*/
#include <iostream>
#include <thread>
#include <atomic>
#include <wfqueue.h>
#include <limits.h>
#include <gtest/gtest.h>
static const int MILLION = 1000000;
static const int TEST_MAX_INPUT = MILLION;
#define addcount(x, y) std::... | 5,487 | 2,017 |
#pragma once
//SELF
//LIBS
//STD
#include <array>
#include <vector>
#include <functional>
namespace core
{
struct Pixel
{
std::uint8_t r = 0;
std::uint8_t g = 0;
std::uint8_t b = 0;
std::uint8_t a = 0;
};
class TextureGL
{
public:
TextureGL();
void load(std::vector<Pixel> pixels, unsigned ... | 839 | 297 |
#pragma once
#include "light.h"
using namespace DW::IMAGE;
using namespace std;
Light::Light()
{
}
Light::~Light()
{
}
void Light::SetLight(vtkSmartPointer<vtkLight> light)
{
vtk_light_ = light;
}
vtkSmartPointer<vtkLight> Light::GetLight()
{
return vtk_light_;
} | 275 | 115 |
#ifndef TRANSLATE_HPP
#define TRANSLATE_HPP
#include <vector>
#include <string>
#include <bitset>
#include <map>
#include "util.hpp"
std::string translate_a_instructions(std::string instruction);
std::string translate_c_instructions(std::string instruction);
std::vector<std::string> translate(std::vector<std::string>... | 343 | 116 |
/** @file OBJECTS/Obj.cpp
* @brief Class that stores all object/material information
*
* A class that determines if a grid point is inside the object, stores the material parameters, and
* finds the gradient to determine the surface normal vector.
*
* @author Thomas A. Purcell (tpurcell90)
* @bug No known b... | 43,319 | 17,739 |
#include "panel.h"
#include "settings.h"
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qwt_plot.h>
#include <qwt_plot_legenditem.h>
Panel::Panel( QWidget *parent ):
QWidget( parent )
{
// crea... | 7,363 | 2,494 |
//---------------------------------------------------------------------------------------------
// ** MyProgram.cpp (template)
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------... | 3,174 | 562 |
/*
https://leetcode.com/problems/sort-characters-by-frequency/
TC: O(N), SC: O(1)
Sorting 256 chars is constant + linear traversal
*/
class Solution {
public:
string frequencySort(string s) {
// (char, frequency)
vector<pair<int, int>> char_freq(256);
for(int i = 0; i < char... | 1,152 | 367 |
void CArchiveDlg::OnButtonWrite()
{
CFile file("demo.txt", CFile::modeCreate | CFile::modeWrite);
CArchive ar(&file,CArchive::store); // 定义一个存档对象
int idata = 100;
char ch = 'a';
double fdata = 12.12;
CString str = "lishuyu";
ar << idata << ch << fdata << str; // 写入数据
MessageBox("Write success", "title",MB_OKC... | 692 | 303 |
class Solution {
public:
bool check(char a, char b) {
if (a == '1') return true;
if (a == '2' && b <= '6') return true;
return false;
}
int numDecodings(string s) {
if (s.length() == 0) return 0;
vector<int> dp(s.length() + 1, 0);
dp[0] = 1;
for (int i... | 536 | 221 |
#include "stdafx.h"
#include "pol.h"
#include <iostream>
using namespace std;
int enter_size();
char *enter_symbols(int &size);
int *enter_numbers(int &size);
char *enter_expression();
void main(void)
{
int size;
char *str = NULL;
char *dstr = NULL;
char *symbols = NULL;
int *numbers = NULL;
while (1)
{ ... | 1,369 | 518 |
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "matlib.h"
#include "neu.h"
void
bpe_forward(matrix * netind, mlp_net * netvark, matrix ** netud);
/*********************************************************************/
/* */
/* */
/* */
/* */
/* */
/******************************... | 32,093 | 13,033 |
//
// SinWave.hpp
// Rain
//
// Created by James Tiller on 2/25/16.
//
//
#ifndef SinWave_hpp
#define SinWave_hpp
#include <stdio.h>
#include "IWave.hpp"
class SinWave : public IWave
{
public:
friend class Oscillator;
protected:
SinWave() :
IWave() { updateIncrement(); };
virtual void generate(do... | 410 | 161 |
/*
* Copyright (C) 2017 Chen Hung-Nien
* Copyright (C) 2017 Weida Hi-Tech
*
* 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
*
* Unl... | 20,603 | 10,505 |
// Copyright (c) 2017-2017 Josh Blum
// SPDX-License-Identifier: BSL-1.0
#include <Pothos/Plugin.hpp>
#include <QJsonObject>
#include <QJsonArray>
#include <QCheckBox>
/***********************************************************************
* Check box with labels
***************************************************... | 1,816 | 538 |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <linux/input.h>
#include <linux/uinput.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
class VirtualKeyboard {
public:
VirtualKeyboard() {
ssize_t ret;
fd_ = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
... | 1,585 | 717 |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "bindings/core/v8/JSONValuesForV8.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptState.h"
#include "bindings/c... | 3,886 | 1,206 |
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,k,ans;
bool map[8][8],used[8];
void dfs(int row,int num)
{
if (num==k)
{
ans++;
return ;
}
else if (row>=n) return ;
else if (num+n-row<k) return ;
else
{
if (row+1<n)... | 1,009 | 389 |
#include <iostream>
#include <limits>
#include <iomanip>
#include <cmath>
namespace mino2357{
template<typename T = double>
class vector{
private:
T componentX;
T componentY;
public:
vector(T x, T y) noexcept : componentX(x), componentY(y) {}
vector() noexcept : vector{T... | 3,164 | 947 |
// -- cgi_service_impl.hpp --
//
// Copyright (c) Darren Garvey 2007-2009.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
///////////////////////////////////////////////////... | 6,901 | 2,235 |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
... | 24,661 | 8,506 |
#include <stdio.h>
int main (){
char a[101];
int i;
scanf("%s",a);
for(i=0;a[i]!=NULL;i++){
printf("%c",a[i]);
if(i % 10 ==9)
{printf("\n");}
}
return 0;
}
| 229 | 102 |
#include <iostream>
#include <cstring>
using namespace std;
constexpr size_t MAX = 258;
int main() {
size_t n, orilen, len;
char str[MAX], suffix[MAX];
if(!scanf("%zu\n", &n)) return 0;
cin.getline(suffix, MAX); orilen = len = strlen(suffix);
for(size_t i = 1, slen, j; i < n; ++i, len = j) {
... | 594 | 249 |
#ifndef _HABITAT_H_
#define _HABITAT_H_
#include "GFX.hpp"
class Habitat : public GFX {
public:
/**
* @brief create lifegame habitat (playfield)
*
* @param devAddr device i2c address.
* @param size oled display size (W128xH64 or W128xH32)
* @param i2c i2c instance
*/
Habitat(uint... | 2,145 | 681 |
#include "GPUTimer.h"
#include "Kernel.h"
#include "GraphReader.h"
using namespace PageRank;
int main(int argc, char **argv) {
if (argc <= 1) return 0;
string path = argv[1];
Matrix g_matrix, i_vector;
int *out_degrees;
int nodes_count;
GPUTimer gpu_timer;
// Read graph file.
vecto... | 1,303 | 466 |
#include "process.h"
#include <unistd.h>
#include <cctype>
#include <sstream>
#include <string>
#include <vector>
using std::string;
using std::to_string;
using std::vector;
// DONE: Return this process's ID
int Process::Pid() const { return pid_; }
void Process::Pid(int pid) { pid_ = pid; }
// DONE: Return the u... | 1,412 | 441 |
/*
** Modified from https://github.com/ArashPartow/bloom
** (1) simplify the design
** (2) add serialize/deserialize interfaces
*/
#ifndef KUNLUN_BLOOM_FILTER_HPP
#define KUNLUN_BLOOM_FILTER_HPP
#include "../include/std.inc"
#include "../crypto/ec_point.hpp"
#include "../utility/murmurhash3.hpp"
#include "../utility/... | 10,977 | 4,877 |
// Copyright (c) 2017 Vivaldi Technologies AS. All rights reserved
//
// Based on code that is:
//
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "calendar_service_factory.h"
#include "ba... | 2,727 | 760 |
#pragma once
namespace Hazel
{
class Timestep
{
public:
Timestep() = default;
Timestep(float time)
: m_Time(time)
{ }
operator float() const { return m_Time; }
float GetSeconds() const { return m_Time; }
float GetMilliseconds() const { return m_Time * 1000.f; }
private:
float m_Time;
};
} // namespace Ha... | 324 | 127 |
#include "CorePch.h"
#include <rtp++/rfc3550/RtpSessionBase.h>
#include <boost/exception/all.hpp>
#include <rtp++/rfc3550/RtcpPacketBase.h>
#include <rtp++/util/ApplicationParameters.h>
#ifndef EXIT_ON_TRUE
#define EXIT_ON_TRUE(condition, log_message) if ((condition)){\
LOG(WARNING) << log_message;return false;}
#e... | 9,590 | 3,372 |
#include <iostream>
using namespace std;
/*---------------------------------------------------------------------------*/
class QUEUE{
private:
int cqueue[5];
int front, rear, n;
public:
QUEUE(); //default constructor
void insertCQ(int);
void deleteCQ();
void... | 3,122 | 936 |
#include <stdio.h>
#include <math.h>
double hornerequation(int n,double x,double a[]);
double bisection(double x1,double x2,int n,double a[]);
int main(void)
{
int i,n;
printf("Enter the highest order of polynomial equation: ");
scanf("%d",&n);
double a[n+1];
printf("Please provide value of follow... | 1,898 | 881 |
#define FORTIFY_SOURCE 2
class Solution {
public:
int uniquePaths(int m, int n) {
int all = n-1+m-1;
int mi = min(n-1, m-1);
vector<int> f(2 * (mi+1));
for (int i=0; i<=all; ++i)
for (int j=0; j<=mi; ++j)
{
if (!j) { f[(i%2) * (mi+1) + j] = 1; ... | 767 | 330 |
// Copyright (c) 2018 Graphcore Ltd. All rights reserved.
#include <numeric>
#include <popart/error.hpp>
#include <popart/ir.hpp>
#include <popart/op/l1.hpp>
#include <popart/popx/devicex.hpp>
#include <popart/popx/op/l1x.hpp>
#include <popart/popx/opxmanager.hpp>
#include <popart/tensor.hpp>
#include <popops/ElementW... | 5,336 | 1,702 |
#include "../../include/catch.hpp"
#include <string>
#include <iostream>
#include "src/utility.hpp"
#include "src/middlewares/Volume/volume.hpp"
#include "src/middlewares/Volume/marshaller.hpp"
using namespace TinyCDN;
using namespace TinyCDN::Utility;
using namespace TinyCDN::Middleware::Volume;
TEST_CASE("VolumeP... | 1,669 | 673 |
/*
* Copyright (c) 2015 - 2022, Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <memory>
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "FrequencyGovernorImp.hpp"
#include "geopm/Helper.hpp"
#include "geopm_test.hpp"
#include "MockPlatformIO.hpp"
#include "MockPlatformTopo.hpp"
... | 6,525 | 2,713 |
// Copyright (c) 2020, BlockProject 3D
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list ... | 4,679 | 1,818 |
/* Motor <motor.devel@gmail.com>
see LICENSE for detail */
#ifndef MOTOR_WORLD_WORLD_EVENT_EVENT_HH_
#define MOTOR_WORLD_WORLD_EVENT_EVENT_HH_
/**************************************************************************************************/
#include <motor/world/stdafx.h>
#ifndef MOTOR_COMPUTE
namespace Motor ... | 932 | 294 |
#include "include/Pancake/Graphics/Color.hpp"
| 46 | 17 |
// Generated from /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar
#pragma once
#include <fwd-POI.hpp>
#include <org/w3c/dom/fwd-POI.hpp>
#include <java/lang/Object.hpp>
struct org::w3c::dom::NodeList
: public virtual ::java::lang::Object
{
virtual int32_t getLength() = 0;
... | 423 | 173 |
/*
* Copyright (c) 2016 Clyde Stanfield
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, pub... | 2,120 | 762 |
#ifndef GENERS_IOISUNSIGNED_HH_
#define GENERS_IOISUNSIGNED_HH_
namespace gs {
template <class T>
struct IOIsUnsigned
{
enum {value = 0};
};
}
#define gs_declare_type_as_unsigned(T) /**/ \
namespace gs { ... | 890 | 300 |
//
// Created by 86759 on 2022-01-14.
//
#include "ProgramRegister.h"
//uint32_t ProgramRegister::IP_r = 0x1234FFF0;
uint32_t ProgramRegister::IP_r = 0x0000FFF0;
uint16_t ProgramRegister::IP() { return (uint16_t)IP_r; }
uint32_t ProgramRegister::EIP() { return (uint32_t)IP_r; }
void ProgramRegister::IP(uint... | 445 | 204 |
#include "dialoginfocontent.h"
#include "properties.h"
#include "helpers/helper.h"
#include "helpers/widgethelper.h"
#include "controls/separators.h"
#include <QDebug>
#include <QApplication>
#include <QIcon>
#include <QToolBar>
#include <QVBoxLayout>
#include <QTextBrowser>
#include <QScrollBar>
DialogInfoContent::D... | 3,467 | 1,149 |
#include <iostream>
using namespace std;
void print_pyramid(int height);
// Prints a pyramid of specified height. Must be between 1 to 30 inclusive.
int main()
{
int desired_height = 0;
bool acceptable_input = false;
cout << "This program prints a 'pyramid' shape of\n"
<< "a specified height on the scree... | 1,123 | 413 |
/// @file
/// @brief console variable
#pragma once
struct ICvar
{
///
virtual const char *GetName() const = 0;
///
virtual const char *GetDescription() const = 0;
///
virtual void SetValue(const char *asValue) = 0;
///
virtual const char *GetValue() const = 0;
///
virtual const char *GetDefValue() c... | 371 | 139 |
//
// Created by fbdtemme on 8/17/20.
//
#include <catch2/catch.hpp>
#include <bencode/traits/all.hpp>
#include "bencode/bvalue.hpp"
#include <bencode/events/debug_to.hpp>
#include <sstream>
namespace bc = bencode;
static const bc::bvalue b{
{"a", 1},
{"b", 1u},
{"d", false},
{"e", ... | 1,128 | 442 |
int main() {
int *i = new int(42);
int j = *i;
delete i;
return j;
}
| 78 | 40 |
//%2005////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Cor... | 4,605 | 1,643 |
#include <stream>
using namespace std;
void main () {
return 0;
}
| 69 | 26 |