text
string
size
int64
token_count
int64
class Solution { public: int minMalwareSpread(vector<vector<int>> &graph, vector<int> &initial) { int N = graph.size(); vector<bool> flag(N, false); vector<vector<int>> connected(N, vector<int>()); vector<vector<int>> edges(N, vector<int>()); for (int i = 0; i < N; ++i)...
1,755
526
#include "downloaddialog.h" DownloadDialog::DownloadDialog(QWidget * parent) : QDialog(parent) { dialogText = QString("Downloading file:\n%1\n\nTarget directory:\n%2\n"); pixmap = QIcon::fromTheme("download").pixmap(QSize(48, 48)); } DownloadDialog::~DownloadDialog() { destroy(); } // TODO prompt for dir...
7,348
2,267
#include "Viewport.h" #include <Hildur.h> #include <ImGui/imgui.h> #define BIND_EVENT_FN(x) std::bind(&Viewport::x, this, std::placeholders::_1) namespace Editor { Viewport::Viewport() { } Viewport::~Viewport() { } void Viewport::Init(uint32_t width, uint32_t height) { m_ObjectIDFrameBuffer = Hild...
4,292
1,725
///////////////////////////////////////////////////////////////////////////// // Copyright (c) 2012, Jared Duke. // This code is released under the MIT License. // www.opensource.org/licenses/mit-license.php ///////////////////////////////////////////////////////////////////////////// #include <fpcpp.h> #include <ios...
5,883
2,279
#include "querytable.h" #include <QVector> #include <renderer.h> #include <db/dbdatabase.h> #include <db/dbtable.h> QVector<unsigned long long> scripting::query_table( const sad::String& table, const sad::String& type_of_objects ) { sad::db::Database* db = sad::Renderer::ref()->database(""...
683
238
#include "lyn/thread.hpp" #include <chrono> #include <iostream> #include <thread> // event example lyn::thread::event<true> ev; // true = auto reset int state = 0; void a_thread() { // waits for ev to be signaled // runs the lambda // sets ev to non-signaled bool executed = ev.wait_for(std::chrono::...
1,105
380
/* The Image Registration Toolkit (IRTK) * * Copyright 2008-2015 Imperial College London * * 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...
52,395
15,743
#include <phiotimer.h> void phastaio_time(phastaioTime*) {} size_t phastaio_time_diff(phastaioTime*, phastaioTime*) { return 1; } void phastaio_addReadBytes(size_t) {} void phastaio_addWriteBytes(size_t) {} void phastaio_addReadTime(size_t) {} void phastaio_addWriteTime(size_t) {} void phastaio_setfile(int) {} void p...
448
178
#include "stdafx.h" //#include "ExampleDirectories.h" #include "..\RunExamples.h" using namespace Aspose::Page::Xps; using namespace Aspose::Page::Xps::XpsModel; void AddImage() { //ExStart: AddImage // Create new XPS Document System::SharedPtr<XpsDocument> doc = System::MakeObject<XpsDocument>(); // Add Image S...
920
391
/* * Copyright (C) 2013 Jolla Mobile <andrew.den.exter@jollamobile.com> * * You may use this file under the terms of the BSD license as follows: * * "Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistrib...
16,127
5,432
#include "monitormanager.h" #include <X11/Xlib.h> #include <cassert> #include <memory> #include "ewmh.h" #include "floating.h" #include "frametree.h" #include "globals.h" #include "ipc-protocol.h" #include "layout.h" #include "monitor.h" #include "settings.h" #include "stack.h" #include "tag.h" #include "tagmanager.h...
8,928
2,893
#include <Shared/assert.h> #include "matrix4.h" #include "vector4.h" #include "misc.h" Matrix4 Matrix4::IDENTITY; void Matrix4::Init() { IDENTITY.SetIdentity(); } void Matrix4::SetIdentity() { _11 = 1.0f; _12 = 0.0f; _13 = 0.0f; _14 = 0.0f; _21 = 0.0f; _22 = 1.0f; _23 = 0.0f; _24 = 0.0f; _31 = 0.0f; _...
3,297
1,702
#pragma once #include <png.h> #include <cstdint> #include <list> #include <array> using std::list; using std::array; // struct for PNG image struct inputImage { int width, height; // width & height of the image png_byte depth; // color depth of the image png_byte colo...
1,863
593
//+--------------------------------------------------------------------------- // // Microsoft Windows // Copyright (c) 1992 - 1999 Microsoft Corporation. All rights reserved.*/// // File: headers.hxx // // Contents: include files for Forms Debug DLL // //---------------------------------------------...
2,350
1,074
#include<iostream> using namespace std; int main() { int n;cin>>n; int a[1000]; int currentsum=0; int maxsum=0; int left=-1; int right=-1; for(int i=0;i<n;i++) { cin>>a[i]; } for(int i=0;i<n;i++) { for(int j=i;j<n;j++) { currentsum=0; ...
687
270
#include<cstdio> #include<algorithm> #include<functional> using namespace std; const int MAXN=1e3; int N,heap[MAXN],path[MAXN],cnt; void dfs(int o) { path[cnt++]=heap[o]; int lc=o*2+1,rc=o*2+2; if(lc>=N && rc>=N) for(int i=0; i<cnt; i++) printf("%d%c",path[i],i==cnt-1?'\n':' '); ...
1,019
582
#include <iostream> #include <fstream> #include <string> #include <string.h> #include <stdlib.h> #include <vector> using namespace std; int main(int argc, char *argv[]){ ifstream bin_file(argv[1], ios::out); ofstream outfile(argv[2], ios::out); if(argc < 3) { cout << "Provide input and output files" <...
1,248
493
// tltime.c Copyright A C Norman 2019 // Released under the modified BSD license - you can find the terms // of that easily enough! // $Id: tltime.cpp 5331 2020-04-25 13:47:28Z arthurcnorman $ // Cygwin and mingw32 both seem to use "emutls" to support the C++11 // keyword "threa...
10,770
3,437
#include "software/gui/robot_diagnostics/threaded_robot_diagnostics_gui.h" #include <QtCore/QTimer> #include <QtWidgets/QApplication> ThreadedRobotDiagnosticsGUI::ThreadedRobotDiagnosticsGUI(int argc, char** argv) : FirstInFirstOutThreadedObserver<SensorProto>(), termination_promise_ptr(std::make_shared<std...
3,396
1,013
/* * Port.cpp * * An open port on a container */ #include "Port.h" using namespace openapi; // macro should do the same job. Not really // OPENAP_JSON_CONVERT_FUNCS(Port, IP, PrivatePort, PublicPort, Type) void Port::ToJSON(Json & j) const { // OPENAPI_FOR_EACH(OPENAPI_TO_JSON_MEMBER, __VA_ARGS__) j.Add...
1,715
665
#include "StringType.h" bool StringType::IsBooleanType() { return false; } bool StringType::IsFloatType() { return false; } bool StringType::IsIntType() { return false; } bool StringType::IsStringType() { return true; } bool StringType::IsVoidType() { return false; } bool StringType::IsClassTy...
640
223
int Rgpz , u7, nT//a ,M4ElL /*d*/,DhV , xKKv7, Aev7f ,puj, E,hI, TGe,oN /*G6Iat*/ , //k aA, //U6 zWZLO ,//DEw MTL ,rq , a9 //Xt ,vu5 ,eHB,v8Y , osHw/*jo*/, h ,M,IT,//fpe dq5 ,PEwG, xq, dOu , AzCI, Z3sCV , sOO , LJ , WbN5,z ,pzg8 , duU4, QztyO , oDdEz/*UQ*/, Fndz , GdVz, OkxM,r,Vzf, xi// ,Di...
15,257
10,512
#include <iostream> using namespace std; inline void use_io_optimizations() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { use_io_optimizations(); unsigned int winner_number {0}; unsigned int winner_points {0}; for (unsigned int i {0}; i < 5; ++i) { unsigne...
703
232
/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or t...
3,794
1,151
//https://practice.geeksforgeeks.org/problems/alternative-sorting1311/1/# vector<int> alternateSort(int arr[], int n) { sort(arr,arr+n);int p=0; vector<int>v(n); for(int i=0;i<=n/2;i++) { v[p++]=arr[n-i-1]; p+1<n?v[p++]=arr[i]:0; } return v; }
270
147
#include <iostream> #include <string> #include <set> #include <map> using namespace std; int main() { int N; set<string> word_list; char cmd; string buf; std::ios::sync_with_stdio(false); cin >> N; for (int i = 0; i < N; i++){ cin >> buf; word_list.insert(buf); } ...
1,638
447
#include "Warp.h" Warp::Warp() { } Warp::~Warp() { } /*void Warp::add_static_point(QPoint P) { static_point_list.push_back(P); }*/ void Warp::add_map_point(map_pair Pair) { map_pair_list.push_back(Pair); } int Warp::map_pair_length() { return map_pair_list.size(); } map_pair Warp::get_map_pair(int i) { return...
340
165
#if 1 #include <stdio.h> int main() { int map[101][101] = { 0, }; long long dp[101][101] = { 0, }; int width; scanf("%d", &width); for (int i = 1; i <= width; i++) { for (int j = 1; j <= width; j++) { scanf("%d", &map[i][j]); } } for (int i = (width * 2 - 1); i > 1; i--) { int a, b; if (i > width) ...
830
500
/* * Copyright (C) 2009-2021 Alex Smith * * Permission to use, copy, modify, and/or 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 PROVIDED "AS IS" AND THE AUTHOR DIS...
6,267
2,109
#include "stdafx.h" #include "test_libevent.h" struct timeval lasttime; int times = 0; static void timeout_cb(evutil_socket_t fd, short e, void *arg) { struct timeval newtime, difference; struct event *timeout = (event *)arg; double elapsed; evutil_gettimeofday(&newtime, NULL); evutil_timersub(&n...
1,289
474
#include <cstdio> using namespace std; int n, ans = 1; int num[4] = {6, 8, 4, 2}; int main() { scanf("%d",&n); for(int p = n; p > 0; p /= 5, ans = ans * num[p%4] %10) for (int i = 1; i <= p%10; i++) if(i != 5) ans = ans * i %10; printf("%d",ans); return 0; }
311
145
/** Queue implementation Iterator pattern Rasul Kerimov (CoderINusE) */ #include <inc_libs.h> #include "queue.h" #include <time.h> using namespace alg; using namespace std; const int MAX_ELEMENTS = 10005; int main() { srand (time(NULL)); //init random Queue<int> q0, q1; for(int i = 0; i < 10; ++i) q0.pushBac...
474
203
/* also: Advanced Logic Synthesis and Optimization tool * Copyright (C) 2019- Ningbo University, Ningbo, China */ /** * @file exact_m3ig.hpp * * @brief exact synthesis using MIG as the underlying data * structure * * @author Zhufei Chu * @since 0.1 */ #ifndef EXACT_M3IG_HPP #define EXACT_M3IG_HPP #include ...
6,311
2,052
#include <params.hpp> template class Params < MagP64 >; template class Params < MagT64 >;
91
34
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include "doctest.h" #include "Day1.h" TEST_CASE("Testing Day 1") { Day1 day1; vector<int> input = day1.parseIntegerLines(day1.loadLinesString("199\n200\n208\n210\n200\n207\n240\n269\n260\n263")); CHECK_MESSAGE(7 == day1.process1(input), "test process 1"); ...
382
184
/* * This software is distributed under BSD 3-clause license (see LICENSE file). * * Authors: Viktor Gal, Bjoern Esser, Thoralf Klein, Heiko Strathmann, * Soeren Sonnenburg */ #ifdef _WIN32 #define _CRT_RAND_S #include <stdlib.h> #endif #include <shogun/mathematics/Random.h> #include <shogun/base/Paramet...
9,391
4,324
// DlgVolumeCalc.cpp : implementation file // #include "stdafx.h" #include "audtest.h" #include "DlgVolumeCalc.h" #include "Utils.h" #include "Math.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // ------------------------------------------------------------------...
8,659
3,381
#include "Visualizer.h" reg::Visualizer::Visualizer(vtkImageData *image) { Initialize(image); Execute(image); } void reg::Visualizer::Execute(vtkImageData *image) { Wrapper<vtkRenderWindow>::Get()->AddRenderer(Wrapper<vtkRenderer>::Get()); Wrapper<vtkRenderWindowInteractor>::Get()->SetRenderWindow( ...
2,649
858
/*Implementation of the different methods of the Atom Class*/ #include <stdio.h> #include "Atomo.h" using namespace std; /*Table with the principal elements*/ Element Table_Elements::table_Elements[NUM_ELEMENTS]= { // Symbol Symbol group period number weight atomic cov vdw ...
40,544
24,154
#include "ImageSortGadget.h" namespace Gadgetron{ int ImageSortGadget::index(GadgetContainerMessage<ISMRMRD::ImageHeader>* m1) { std::string sorting_dimension_local = sorting_dimension.value(); if (sorting_dimension_local.size() == 0) { return -1; } else if (sorting_dimension_local.compare(...
1,898
705
// // Created by rui.zhou on 5/6/2019. // #include <codech/codech_def.h> using namespace std; using namespace CODECH; namespace { class Solution { public: ListNode* findKth(ListNode *head,int k) { ListNode *p1 = head; ListNode *p2 = head; if (k==0) return nullptr; ...
899
358
#include<vector> #include<iostream> using namespace std; class Solution { public: int xorOperation(int n, int start) { vector<int> a(n); for(int i=0;i<n;i++) { a[i] = start + 2*i; } int x = a[0]; for(int i=1;i<n;i++) { x ^= a[i]; } ...
475
185
#include "HexView.h" NAMESPACE_UPP #ifdef PLATFORM_WIN32 inline int FormatHexDigit(int c) { return c < 10 ? c + '0' : c - 10 + 'a'; } void FormatHex(char *buffer, int64 number, int n) { buffer[n] = '\0'; while(n) { buffer[--n] = FormatHexDigit((byte)number & 0x0f); number >>= 4; } } void HexViewInfo::Print...
9,630
4,870
/* * File: PowersOfTwo.cpp * --------------------- * This program generates a list of the powers of * two up to an exponent limit entered by the user. */ #include <iostream> #include <sstream> #include <string> #include <iomanip> using namespace std; /* Function prototypes */ int getInteger(string prompt); int ...
1,806
544
#include "driver.h" #if EPIMAGE_DRIVER == EPDRIVER_QT #include "hal/image.h" #include <QImage> #include <QImageReader> #include <QBuffer> void epImage_InitInternal() { } void epImage_DeinitInternal() { } epImageFormat ConvertQTImageFormatToEP(QImage::Format imageFormat) { switch (imageFormat) { case QImag...
3,728
1,418
/* * NiceConnection.cpp */ #include <nice/nice.h> #include <cstdio> #include <string> #include <cstring> #include <vector> #include "NiceConnection.h" #include "SdpInfo.h" using std::memcpy; // If true (and configured properly below) erizo will generate relay candidates for itself // MOSTLY USEFUL WHEN ERIZO ITSE...
18,789
6,651
#include "file_system.h" void FileSystem::openFile(int id) { return; } void FileSystem::closeFile(int id) { return; }
126
56
#if 1 #include <QApplication> #include <QGridLayout> #include <QProcess> #include <QLabel> #include <QTimer> #include <QTextStream> #include <QRegExp> #include <cstdio> // QT 5, C++11 int main(int argc, char *argv[]) { if (argc > 1) { QCoreApplication app(argc, argv); // output 3 random values per line...
3,391
1,259
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include "Rules/IOperandPrototype.hpp" #include "Rules/Patterns/AnyPattern.hpp" namespace microsoft { namespace quantum { AnyPattern::AnyPattern() = default; AnyPattern::~AnyPattern() = default; bool AnyPattern::match(Value* inst...
558
169
#ifdef _WIN32 #include "../FileSystem.h" #include "System/Core/Platform/PlatformHelpers_Win32.h" #include "System/Core/Algorithm/Hash.h" #include "System/Core/Math/Math.h" #include <windows.h> #include <shlwapi.h> #include <shlobj.h> #include <shellapi.h> #include <fstream> #include "../Time/Timers.h" #i...
3,076
943
#pragma once #include <boost/intrusive/list.hpp> #include <nexus/quic/detail/connection_state.hpp> #include <nexus/quic/detail/service.hpp> #include <nexus/quic/detail/stream_impl.hpp> #include <nexus/udp.hpp> struct lsquic_conn; struct lsquic_stream; namespace nexus::quic::detail { struct accept_operation; struct ...
2,894
961
#include <iostream> #include <algorithm> #include <cmath> using namespace std; #define MAGIC_NUMBER 6174 void ReadDigits(int n,int digits[]){ for (int i=0; i<4; i++) { digits[i]=n%10; n/=10; } // for } int MakeMaxNumber(int digits[],int n){ int tmp=0; for (int i=n-1; ...
1,099
546
#pragma once #include <string> namespace Logger { bool init(); void log(std::string pattern, ...); }
104
35
// // lubySequence.hpp // graphExplorer // // Created by Francesco Quinzan on 06.09.17. // Copyright © 2017 Francesco Quinzan. All rights reserved. // #ifndef lubySequence_hpp #define lubySequence_hpp #include <vector> #include <limits> #include <thread> #include "EA.hpp" using namespace std; /* overloaded vect...
1,148
377
/******************************************************************************** * HON HAI Precision IND.Co., LTD. * * Personal Computer & Enterprise Product Business Group * * Enterprise Product Business Gro:qup ...
4,847
1,465
#include <catch/catch.hpp> #include <world/core.h> #include <world/terrain.h> using namespace world; TEST_CASE("Terrain - getExactHeightAt", "[terrain]") { Terrain terrain(2); terrain(0, 0) = 1; terrain(0, 1) = 0; terrain(1, 0) = 0; terrain(1, 1) = 1; SECTION("getExactHeightAt trivial coordi...
2,903
1,200
/* * Copyright (c) 2000, 2020, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ #include "cxxtest/TestSuite.h" #include "common/TestUtils.hpp" #include "mock/CommonMocks.hpp" #include "coherence/lang.ns" #include "coherenc...
13,941
3,722
// ********************************************************************************************************************* // Data structure that represents one face of a NurbsBRep object. // // Note. All indices refer to containing NurbsBRep, starting from 0. // *********************************************************...
3,001
1,076
/** * @file * * Class implementing sanity checks for Mutex objects. */ /****************************************************************************** * Copyright (c) Open Connectivity Foundation (OCF), AllJoyn Open Source * Project (AJOSP) Contributors and others. * * SPDX-License-Identifier: Apache-...
11,741
3,650
#include <Arduino.h> #include <WiFiUdp.h> #include <WiFi.h> #include <aero_servo.h> #include <aero_gyro.h> WiFiUDP udp; int port = 12000; int i = 0; bool connected = false; int motor_pin = GPIO_NUM_4; int motor_chn = 2; int throttle = 0; void setup() { setup_servos(); setup_gyro(); pinMode(motor_pin, OUTPUT_O...
3,348
1,394
/* * Copyright (C) 2018 Open Source Robotics Foundation * * 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 by appl...
2,438
774
#include "save_scene_as_menu_item.h" #include <awesome/data/archive.h> #include <awesome/asset/asset.h> #include <awesome/encoding/json.h> #include <awesome/entity/world.h> namespace editor { void SaveSceneAsMenuItem::render() { m_saveFileDialog.render(); } void SaveSceneAsMenuItem::execute() { m_saveFileDi...
582
237
/* * Copyright (C) 2007 The Android Open Source Project * * 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 by appl...
62,842
25,655
#include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <sstream> #include <algorithm> #include <complex> #include <deque> #include <list> #include <map> #include <queue> #include <set> #include <stack...
2,329
960
// // Copyright (c) 2008-2017 the Urho3D project. // // 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, m...
16,389
5,241
#include "halley/ui/widgets/ui_gamepad_image.h" using namespace Halley; UIGamepadImage::UIGamepadImage(UIStyle style, JoystickButtonPosition button, std::function<Sprite(JoystickButtonPosition, JoystickType)> iconRetriever, Colour4f col) : UIImage(Sprite()) , style(style) , button(button) , iconRetriever(std::mov...
906
333
// URL : https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/ // Author : Modnar // Date : 2020/03/14 // Thanks : armeria(@leetcode.cn) #include <bits/stdc++.h> /* ************************* */ /** * 暴力搜索 * 直接遍历,获取最小元素即可。 * 本题存在一个简单优化,当发现某两个值之间发生“递减”,则可直接返回最小值。 */ // Complexity: Tim...
1,777
937
// Copyright (C) 2015 Technische Universitaet Muenchen // This file is part of the Mamico project. For conditions of distribution // and use, please see the copyright notice in Mamico's main folder, or at // www5.in.tum.de/mamico #include "simplemd/molecule-mappings/VelocityStoermerVerletMapping.h" simplemd::moleculem...
10,445
3,994
/* Copyright (c) 2008,2009,2010, CodeSLoop Team Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaim...
12,100
4,687
class Solution { public: vector<int> findMinHeightTrees(int n, vector<pair<int, int>>& edges) { vector<int> vec[n+1]; int degree[n+1]; for(int i=0;i<=n;i++) degree[i]=0; for(int i=0;i<n-1;i++){ int a=edges[i].first; int b=edges[i...
1,227
416
// // Created by mojiajun on 2020/3/6. // #include "http_request.h" using namespace tinyreactor; bool HttpRequest::setMethod(const char *start, const char *end) { assert(method_ == kInvalid); std::string m(start, end); if (m == "GET") { method_ = kGet; } else if (m == "POST") { method_...
1,656
542
// Copyright (c) 2019-2020 Xenios SEZC // https://www.veriblock.org // Distributed under the MIT software license, see the accompanying // file LICENSE or http://www.opensource.org/licenses/mit-license.php. #ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_VBK_BLOCK_TREE_HPP_ #define ALT_INTEGRATION_INCLUDE_VERIBLO...
7,885
2,648
/* * QCDNonIsolatedElectronSelection.cpp * * Created on: 12 Apr 2012 * Author: kreczko */ #include "../../interface/Selections/QCDNonIsolatedElectronSelection.h" namespace BAT { QCDNonIsolatedElectronSelection::QCDNonIsolatedElectronSelection(unsigned int numberOfSelectionSteps) : QCDPFRelIsoEPlusJetsSe...
1,226
472
// :copyright: (c) 2017 Alex Huszagh. // :license: MIT, see licenses/mit.md for more details. #if defined(HAVE_ZLIB) // This module is basically identical to zlib, // so just include the private error handling. #include <pycpp/compression/zlib.cc> #include <pycpp/compression/gzip.h> #include <pycpp/preprocessor/byt...
11,030
4,147
#ifndef AOC_2019_DAY10_LOS_HPP #define AOC_2019_DAY10_LOS_HPP #include <cstddef> #include <set> #include "Location.hpp" std::set<Location> getVisible(const std::set<Location> &asteroids, const Location &origin, coordinate size); inline size_t countVisible(const std::set<Location> &asteroids, const Location &origin,...
402
150
// Copyright 2021 Jan Niklas Hasse <jhasse@bixense.com> // For conditions of distribution and use, see copyright notice in LICENSE.txt #ifndef NOWEBP #include "ImageDataWebP.hpp" #include <boost/math/special_functions/round.hpp> #include <future> #include <thread> #include <vector> namespace jngl { ImageDataWebP::Im...
2,236
866
#include<stdio.h> int arr[1005][1005]={{0}}; void catalan() { int i,j; for(i=0;i<1005;i++) { for(j=0;j<=i;j++) { if(j==0) arr[i][j]=1; else arr[i][j]=(arr[i][j-1]+arr[i-1][j])%1000000; } } } int main() { catalan(); i...
445
211
class Solution { public: vector<string> findAndReplacePattern(vector<string>& words, string pattern) { vector<string>res; for (auto& s: words) { if (isValid(s, pattern)) { res.push_back(s); } } return res; } bool isValid(string& a,...
1,473
479
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // 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 re...
41,199
15,633
struct S1 { alignas(8) int n; };
36
21
/* * lua_source_stream.cpp * * Created on: Nov 23, 2017 * Author: zmij */ #include <wire/idl/generator.hpp> #include <wire/idl/syntax_error.hpp> #include <wire/wire2lua/lua_source_stream.hpp> #include <iomanip> namespace wire { namespace idl { namespace lua { namespace { ::std::string const autogenerate...
4,413
1,291
#include <GBuffer.h> #include <Scene.h> GBuffer::GBuffer(Scene* scene, GLuint texUnit) : m_texUnitStart(texUnit), m_fbo(0), m_scene(scene) { assert(fillGBuffer() && "Error creating GBuffer content!"); } GBuffer::~GBuffer() { glDeleteFramebuffers(1, &m_fbo); } bool GBuffer::fillGBuffer() { glGenFramebuffers(1, &...
3,077
1,350
//given an array which is k sorted that means all the elements are atmost 'k' //distance far from where they should be if they would have been sorted //sort the array /* using heap: take first 'k' elements and then heapify it now for i = k to n-1 : pop min from heap and insert arr[i] into heap do this for th...
1,299
520
/* * GRPCClient.cc * * Created on: Jun 7, 2016 * Author: theo */ #include <cassert> #include <unistd.h> #include "GRPCClient.h" GRPCClient::RequestHandler::RequestHandler(GRPCClient *grpc_client, const std::string &addr) : _grpc_client(grpc_client), _addr(addr) {} GRPCClient::RequestHandler::~RequestH...
8,609
3,281
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2011 New Dream Network * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License ...
10,195
3,815
// Copyright (c) 2017 Lanceolata #include "kafka/kafka_handle.h" namespace log2hdfs { std::shared_ptr<KafkaHandle> KafkaHandle::Init(rd_kafka_t* rk) { if (!rk) return nullptr; return std::make_shared<KafkaHandle>(rk); } const std::string KafkaHandle::MemberId() const { char* str = rd_kafka_memberid(rk_); ...
453
183
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- // * 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/. */ #include "mozilla/layers/TextureCl...
4,076
1,426
// This code is based on Sabberstone project. // Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva // RosettaStone is hearthstone simulator using C++ with reinforcement learning. // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon #ifndef ROSETTASTONE_PLAYMODE_COST_MANAGER_HPP #define ROSETTA...
2,924
912
#include "../AcdUtil/AcdCalib.h" #include "CalibData/Acd/AcdPed.h" #include "CalibData/Acd/AcdGain.h" #include "CalibData/Acd/AcdVeto.h" #include "CalibData/Acd/AcdCno.h" #include "CalibData/Acd/AcdRange.h" #include "CalibData/Acd/AcdHighRange.h" #include "CalibData/Acd/AcdCoherentNoise.h" #include "CalibData/Acd/AcdR...
4,209
1,814
// // Color.hpp // Aha // // Created by Priyanshi Thakur on 01/05/18. // Copyright © 2018 Saurabh Sinha. All rights reserved. // #pragma once #include "../Math/Vec3.hpp" #include "../Math/Vec4.hpp" namespace aha { class Color : public Vec4f { public: Color() : Vec4f() { ...
2,374
838
//******************************************************************** // created: 27:7:2008 0:07 // file: pci.agpintrf.cpp // author: tiamo // purpose: agp interface //******************************************************************** #include "stdafx.h" #pragma alloc_text("PAGE",agpintrf_Constructor) #pragma ...
4,349
1,868
class Solution { #define trace(x) cout << #x << ": " << x << endl; public: int minHeightShelves(vector<vector<int>>& books, int shelfWidth) { int oo = int(1e9); int n = int(books.size()); vector<int> dp(n, 0); int current_width = 0; const int WIDTH = 0; c...
990
366
#pragma comment(lib, "LogitechGkeyLib.lib") #include <jni.h> #include <string> #include <LogitechGkeyLib.h> #include "JlawUtil.h" #include "JlawGkey.h" namespace jlaw_gkey { const char *callbackMethodName = "call"; const char *callbackMethodSignature = "(IZIZLjava/lang/String;)V"; char *threadName = "logi-gkey-cal...
3,225
1,202
class Solution { public: int evalRPN(vector<string>& tokens) { stack<long> st; int n=tokens.size(); for(string str : tokens){ if(str=="+" || str=="-" || str=="*" || str=="/"){ int num1, num2; if(!st.empty()){ num1...
1,263
325
include<iostream.h> int main() { cout<<"1"; cout<<"Hello"; }
65
30
#include <string> #include <iostream> #include <vector> #include "WebS.h" #include <algorithm> #include "menu.h" using namespace std; int main(int argc, char* argv[]) { if (argc > 1 && argv[1][0] == '/') { if (argv[1][1] == 's') { string IP = argv[2]; int port = stoi(argv[3]); WebS siteserv(IP.c_str(), po...
781
381
#include "HeliumRain/UI/Menus/FlareSkirmishSetupMenu.h" #include "../../Flare.h" #include "../../Data/FlareCompanyCatalog.h" #include "../../Data/FlareSpacecraftCatalog.h" #include "../../Data/FlareSpacecraftComponentsCatalog.h" #include "../../Data/FlareCustomizationCatalog.h" #include "../../Data/FlareOrbitalMap.h"...
39,694
17,763
#include <iostream> #include <string> #include "Ozeki.Libs.Rest.h" using namespace std; int main() { //Function to create unique identifier for each messages srand((unsigned)time(0)); Configuration configuration; configuration.Username = "http_user"; configuration.Password = "qwe123"; configu...
574
181
#include <bits/stdc++.h> #define fastio cin.tie(0)->sync_with_stdio(0) using namespace std; #define double long double const double PI = acos(-1); int main() { fastio; cout << fixed << setprecision(3); for (double D, V; cin >> D >> V && D;) { const double val = D * D * D - V * 6 / PI; cout << cbrt(val) << '\n'...
326
138
/** * @file value_item_map.h * * @author Tobias Anker <tobias.anker@kitsunemimi.moe> * * @copyright Apache License Version 2.0 * * Copyright 2019 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with ...
9,060
2,956