text string | size int64 | token_count int64 |
|---|---|---|
\*
Author: allannozomu
Runtime: 4 ms
Memory: 11.5 MB*\
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void binaryTreecPathsRec(TreeNode* root... | 941 | 314 |
#include "parser/expression_defs.h"
#include <string>
namespace noisepage::parser {
std::string ExpressionTypeToShortString(ExpressionType type) {
switch (type) {
// clang-format off
case ExpressionType::OPERATOR_PLUS: return "+";
case ExpressionType::OPERATOR_MINUS: ... | 2,015 | 589 |
#include "imgLoaderSaver.h"
#ifdef SIM_WITH_QT
#include "tGAFormat.h"
#include "stb_image.h"
#include "ttUtil.h"
#include "vVarious.h"
#include <QImage>
#include <QImageWriter>
#include <QColor>
#include <QtCore/QBuffer>
#endif
unsigned char* CImageLoaderSaver::load(const char* filename... | 12,341 | 4,450 |
/*
Copyright (c) 2014, Hookflash Inc.
All rights reserved.
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 fol... | 9,947 | 2,325 |
#include "KB/KBHeadLiteral.h"
#include "Eval/EvalSubgoal.h"
#include "Eval/TestUtils.h"
#include "thirdparty/Catch/include/catch.hpp"
#include <string>
using namespace fovris;
TEST_CASE("Check subgoal evaluation result", "[EvalSubgoal]") {
// given
unsigned relId = 0xDEADBEEF;
KBRelation relation{
... | 3,509 | 1,243 |
#include "my_graph.h"
#include "graph_exception.h"
#include "my_rand.h"
#include <fstream>
#include <iomanip>
void my_graph::random()
{
const int v_number = my_rand::random_int(min_vert, max_vert);
const int density = my_rand::random_int(min_dens, max_dens);
random(v_number, density);
}
void my_graph::random(int... | 1,362 | 633 |
#include "GdbUtils.h"
#include <memory>
#include <ide/Core/Logger.h>
#include <ide/Common/CommandLineOptions.h>
using namespace Upp;
One<IGdbUtils> GdbUtilsFactory::Create()
{
#if defined(PLATFORM_WIN32)
return MakeOne<GdbWindowsUtils>();
#elif defined(PLATFORM_POSIX)
return MakeOne<GdbPosixUtils>();
... | 2,115 | 833 |
// ============================================================================
// SeqAn - The Library for Sequence Analysis
// ============================================================================
//
// Copyright (c) 2006-2018, Knut Reinert & Freie Universitaet Berlin
// Copyright (c) 2016-2018,... | 4,141 | 1,358 |
#include "ofMain.h"
#include "ofApp.h"
#include "unistd.h"
int main(int argc, char *argv[])
{
int opt;
int qopt = 0;
char qparam[128] = "";
int topt = 0;
char tparam[128] = "";
int fopt = 0;
char fparam[128] = "";
int ropt = 0;
char rparam[128] = "";
int sopt = 0;
char spara... | 5,010 | 1,859 |
#include "threads.h"
#include "export-js.h"
#include "fs.h"
#include "util.h"
#include "vm.h"
#include <map>
#include <mutex>
using std::map;
using std::thread;
using std::string;
using std::mutex;
using std::lock_guard;
typedef map<threadId, thread*> ThreadMap;
static volatile int nextId = 0x10;
static mutex lock_... | 3,978 | 1,434 |
/**********************************************************************************
Copyright (C) 2005-2019 Intel Corporation. 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 sourc... | 9,749 | 3,684 |
int height(int i,int size)
{
int l,r;
if(i>size)
return 0;
else
{
l=height(2*i,size);
r=height(((2*i)+1),size);
if(l>r)
{
l=l+1;
return l;
}
else
{
r=r+1;
return r;
}
}
}
| 206 | 125 |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include "../cpu_kernel_emitter.hpp"
#include "nnfusion/core/operators/generic_op/generic_op.hpp"
namespace nnfusion
{
namespace kernels
{
namespace cpu
{
template <typename ElementType>
... | 4,281 | 1,210 |
#pragma once
#include <Util/Util.hpp>
class Device;
class Texture;
class Buffer;
class Sampler;
class DescriptorSet {
public:
ENGINE_EXPORT DescriptorSet(const std::string& name, Device* device, VkDescriptorSetLayout layout);
ENGINE_EXPORT ~DescriptorSet();
ENGINE_EXPORT void CreateStorageBufferDescriptor(Buffer... | 2,108 | 693 |
# include <iostream>
# include <fstream>
# include <string.h>
# include <stdio.h>
# include <stdlib.h>
# include <sstream>
# include <math.h>
using namespace std;
void swap_line(int &froma, int &toa, double &coeffa, int &fromb, int &tob, double &coeffb){
int tempfrom, tempto;
double tempcoeff;
tempfrom = ... | 2,102 | 995 |
/*
* Copyright 2021 IBM Corporation
*
* 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 applicable law or agreed... | 1,481 | 459 |
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int getMissingNumber(vector<int>& nums) {
int left = 0, right = nums.size();
while (left < right) {
int mid = left + (right - left) / 2;
if (mid == nums[mid]) left = mid + 1;
els... | 522 | 185 |
#include <iostream>
#include <boost/python.hpp>
#include "prx/visualization/three_js_group.hpp"
void (prx::three_js_group_t::*update_vis_infos_1_1)(prx::info_geometry_t, const prx::trajectory_t&, std::string, prx::space_t*, std::string color) = &prx::three_js_group_t::add_vis_infos;
void (prx::three_js_group_t::*upd... | 1,929 | 785 |
/*
* Copyright (C) 2018 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 app... | 13,324 | 4,854 |
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <fstream>
#include <ctime>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <climits>
#include "./layer/layer.h"
#include "./io/json/json.h"
#include "global.h"
#include <cassert>... | 20,275 | 8,131 |
// Node object
//
#include <iostream>
#include <vector>
#include <gtest/gtest.h>
#include "args.h"
#include "macros.h"
#include "util/node.h"
using namespace std;
using namespace ctci;
using namespace ctci::util;
TEST(Node, Initialize)
{
int value = 5;
Node<int> node(value);
ASSERT_EQ(node.value, val... | 3,276 | 1,152 |
#include"MidiEvent.h"
namespace tau
{
SysexEvent::~SysexEvent()
{
free(data);
}
void SysexEvent::CreateData(byte* d, size_t len)
{
if (len <= 0)
return;
try
{
data = (byte*)malloc(len);
if (data != nullptr)
memcpy(data, d, len);
this->size = len;
}
catch (exception)
{
}
}
Unk... | 600 | 308 |
/* Copyright (c) 2020 Yang, Chung-Fan @ Fixstars corporation
* <chungfan.yang@fixstars.com>
* All rights reserved.
*
* 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 ... | 3,679 | 1,303 |
/*
* Class providing interface to renderscript implementation of mel bank filters.
*
* Created by Petr Flajsingr on 15/12/2017.
*/
#include <RSMelFilterBank.h>
#include <constants.h>
SpeechRecognition::Feature_Extraction::RSMelFilterBank::RSMelFilterBank(const char* cacheDir) {
this->renderScriptObject = new... | 2,474 | 789 |
#pragma once
#include "Array.h"
#include "SelectionSort.h"
#include "Inimigos.h"
#include <iostream>
int compararEnergiaInimigos(Inimigos a, Inimigos b);
int main(){
Array<Inimigos> numbs(5);
numbs[0].energia = 13;
numbs[1].energia = 30;
numbs[2].energia = 20;
numbs[3].energia = 10;
numbs[4].energia = 5;
sel... | 634 | 293 |
/* --------------------------------------------------------------------------
*
* File Tower.cpp
* Description
*
* Ported By Young-Hwan Mun
* Contact xmsoft77@gmail.com
*
* Created By Kirill Muzykov on 8/22/13.
*
* ---------------------------------... | 5,553 | 1,976 |
/*
* open-bo-api - C++ API for working with binary options brokers
*
* Copyright (c) 2020 Elektro Yar. Email: git.electroyar@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 withou... | 2,121 | 884 |
/*
23. Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Example:
Input:
[
1->4->5,
1->3->4,
2->6
]
Output: 1->1->2->3->4->4->5->6
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
... | 986 | 334 |
#include <caller/executor/executor.hpp>
CALLER_BEGIN
ExecutionContext::ExecutionContext()
{
}
ExecutionContext::~ExecutionContext()
{
}
Executor::Executor()
{
}
Executor::~Executor()
{
}
CALLER_END
| 233 | 93 |
#ifndef EVOLUTIONARY_STRATEGY_VULKAN_HPP
#define EVOLUTIONARY_STRATEGY_VULKAN_HPP
#include <math.h>
#include <array>
#include <random>
#include <chrono>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
//Graphic math types and functions//
#include <glm\glm.hpp>
#include "Evolutionary_Strategy.hpp"
#include "Benc... | 70,427 | 25,185 |
#include <iostream>
#include <stdexcept>
#include <vector>
#include <deque>
#include <type_traits>
#include <cmath>
#include <algorithm>
#include <iomanip>
int SumaCifara(long long int x)
{
int suma=0;
while(x!=0)
{
suma+=std::abs(x%10);
x=x/10;
}
return suma;
}
int SumaDjelilaca(long lon... | 7,227 | 3,797 |
#include "stdafx.h"
#include "Terrain.h"
const float height_base = 200.0f;
namespace Necromancer {
Terrain::Terrain(const char* file_name, ID3D11Device* device)
{
std::fstream terrain_file;
terrain_file.open(file_name, std::ios::binary | std::ios::in);
terrain_file.seekg(0, std::ios::beg);
auto start_poi... | 7,619 | 3,485 |
struct X {
/**
* foo does things.
*/
void foo(int x) {
}
};
int main() {
X x;
x.
}
| 101 | 50 |
#include "StdAfx.h"
#include "PersonDetector.h"
#include <math.h>
PersonDetector::PersonDetector()
{
m_cell = cvSize(8, 8);
m_block = cvSize(2, 2);
m_winSize = cvSize(64, 128);
m_stepOverlap = 1;
classifier.SetParams(m_cell, m_block , m_stepOverlap);
startScale = 1;
scaleStep = 1.5;
m_widthStep = 8;
m_heigth... | 8,628 | 3,751 |
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "game/LevelListLoader.hpp"
#include <fstream>
#include <iostream>
#include "game/Resource.hpp"
std::vector<std::string> LevelListLoader() {
std::ifst... | 618 | 214 |
#include <hxcpp.h>
#ifndef INCLUDED_flash_Lib
#include <flash/Lib.h>
#endif
#ifndef INCLUDED_flash_display_BitmapData
#include <flash/display/BitmapData.h>
#endif
#ifndef INCLUDED_flash_display_Graphics
#include <flash/display/Graphics.h>
#endif
#ifndef INCLUDED_flash_display_IBitmapDrawable
#include <flash/display/IB... | 12,757 | 5,833 |
#include <Eigen/Core>
#include <Eigen/Geometry>
#include "mesh/mesh.h"
namespace telef::mesh {
void ColorMesh::applyTransform(Eigen::MatrixXf transform) {
Eigen::Map<Eigen::Matrix3Xf> v(position.data(), 3, position.size() / 3);
Eigen::Matrix3Xf result =
(transform * v.colwise().homogeneous()).colwise().hnor... | 431 | 158 |
//
// Author: Vladimir Migashko <migashko@gmail.com>, (C) 2013-2015
//
// Copyright: See COPYING file that comes with this distribution
//
#include "btp_deprecated_gateway_multiton.hpp"
#include "btp_deprecated_gateway.hpp"
#include <wfc/module/multiton.hpp>
#include <wfc/module/instance.hpp>
#include <wfc/name.hpp>
... | 963 | 361 |
#include <game-emu/common/physicalmemorymap.h>
namespace GameEmu::Common
{
PhysicalMemoryMap::Entry* BinaryTreeMemoryMap::Map(u8* hostReadMemory, u8* hostWriteMemory, u64 size, u64 baseAddress,
Entry::ReadEventFunction readEvent, Entry::WriteEventFunction writeEvent)
{
entries.push_back(Entry(baseAddress &addres... | 3,571 | 1,443 |
#pragma once
#include <vector>
#include <tuple>
#include <memory>
#include "IComponent.hpp"
namespace prefab
{
//用来操作tuple的foreach算法
template <typename Tuple, typename F, std::size_t ...Indices>
void for_each_impl(Tuple&& tuple, F&& f, std::index_sequence<Indices...>) {
using swallow = int[];
... | 5,364 | 1,663 |
#pragma once
#include "UdpSocket.hpp"
#include "IPEndpoint.hpp"
#include "Network/SessionState.hpp"
#include <cstdint>
#include <functional>
#include <stack>
namespace MORL {
class Game;
namespace Network {
class Session;
class StateNotRunning : public SessionState {
public:
StateNotRunning(S... | 2,388 | 733 |
#include "HighScoreEntry.h"
HighScoreEntry::HighScoreEntry()
{
name = "noName";
score = -1;
level = -1;
}
HighScoreEntry::~HighScoreEntry()
{
}
| 152 | 65 |
#include "Player.h"
#include "SDLGameObject.h"
#include "LoaderParams.h"
#include "InputHandler.h"
#include "Bullet.h"
#include "Game.h"
#include "Log.h"
#include "Enemy.h"
#include "PlayState.h"
#include "Physics.h"
#include "AudioManager.h"
#include "GameOverState.h"
#include "Childmaiden.h"
#include "Timer.h"
#incl... | 9,108 | 3,888 |
/*
* main-db-tester.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any l... | 6,813 | 2,604 |
#include<iostream>
using namespace std;
int main()
{
string names[4];
cout << "Enter 4 names:" << endl;
for (int i = 0; i < 4; i++) // user enters the names
{
cout << "name " << i+1 <<": ";
cin >> names[i];
}
for (int i = 0; i < 4; i++)
{
cout <<... | 414 | 148 |
#include "Minus.h"
Minus::Minus(char s) : Operator(s)
{
setImage("../flower_equals_win/meshes/textures/blocks/block_minus.png");
} | 132 | 57 |
/*=========================================================================
Library: CTK
Copyright (c) Kitware Inc.
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.ap... | 4,087 | 1,464 |
#ifndef __PW_WINDOWS_HPP__
#define __PW_WINDOWS_HPP__
#define NOMINMAX
#include <Windows.h>
#endif
| 101 | 51 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x, y, l, r;
cin >> x >> y >> l >> r;
long long powX = 1, powY = 1;
vector<long long> vecX, vecY, vecSum;
while (1) {
vecX.push_back(powX);
if (r / x < powX)
break;
powX *= x;
}
while (... | 926 | 380 |
#include "DirectStream.h"
#include "../container/Buffer.h"
using namespace L;
Buffer DirectStream::read_into_buffer() {
Buffer buffer(size());
seek(0);
read(buffer, buffer.size());
return buffer;
}
| 209 | 71 |
#include "TexturePathEditor.h"
#include <qboxlayout.h>
#include <qdir.h>
#include <qfiledialog.h>
#include <Settings.h>
#include <AssetManagement/AssetDatabase.h>
namespace TristeonEditor
{
TexturePathEditor::TexturePathEditor(const nlohmann::json& pValue, const std::function<void(nlohmann::json)>& pCallback) : Abs... | 1,294 | 499 |
#include <iostream> // cin, cout
#include <set>
#include <iterator>
using namespace std;
int main() {
int test_cases;
scanf("%d", &test_cases);
int B, SG, SB, current;
multiset <int, greater <int> > greens, blues;
multiset <int, greater <int> > temp_greens, temp_blues;
mult... | 2,707 | 794 |
#include <fstream>
#include <iostream>
#include <memory>
#include <Eigen/Dense>
#include "datatypes.hpp"
#include "utility.hpp"
std::default_random_engine generator;
template<typename T>
void
writeCsvMatrix (std::ostream &fd,
const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &data,
const Eigen::VectorXi &a... | 12,105 | 4,847 |
#include "iconeditor.h"
#include <QIcon>
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QImage icon(":/images/mouse.png");
IconEditor w;
w.setIconImage(icon);
w.show();
return a.exec();
}
| 254 | 96 |
#include "UpdateEntityPositionSystem.h"
#include <entt.hpp>
#include <tracy/Tracy.hpp>
#include <Utils/DebugHandler.h>
#include "../../Utils/ServiceLocator.h"
#include "../Components/Singletons/MapSingleton.h"
#include "../Components/Network/ConnectionComponent.h"
#include <Gameplay/Network/PacketWriter.h>
#include <... | 4,862 | 1,334 |
// Copyright 2019 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 <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <stddef.h>
#include <stdint.h>
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buff... | 4,298 | 1,557 |
/*=========================================================================
Program: ALBA (Agile Library for Biomedical Applications)
Module: albaOpImporterLandmark
Authors: Daniele Giunchi, Simone Brazzale
Copyright (c) BIC
All rights reserved. See Copyright.txt or
This software is distributed WITHOUT ANY W... | 7,027 | 2,636 |
#include "containerWithMostH2O.h"
int containerWithMostH2O::naive(vector<int>& height){
int l=0;int r=height.size()-1;
int maxV = min(height[l],height[r])*r;
while (l<r){
if (height[l]>=height[r])r-=1;
else l+=1;
maxV = max(maxV,min(height[l],height[r])*(r-l));
}
return maxV... | 324 | 140 |
#include <smoke_basin.hpp>
#include <catch.hpp>
#include <sstream>
TEST_CASE("Smoke Basin")
{
char const sample_input[] = "2199943210" "\n"
"3987894921" "\n"
"9856789892" "\n"
"8767896789" "\n"
... | 3,500 | 1,356 |
// Fill out your copyright notice in the Description page of Project Settings.
#include "BaseCharacterAnimInstance.h"
#include "PracticeVeter/Characters/BaseCharacter.h"
#include "PracticeVeter/Components/MovementComponents/MyBaseCharacterMovementComponent.h"
void UBaseCharacterAnimInstance::NativeBeginPlay()
{
Su... | 1,054 | 323 |
Remove loop in Linked List : https://practice.geeksforgeeks.org/problems/remove-loop-in-linked-list/1#
solution:
void removeLoop(Node* head)
{
Node* low=head;
Node* high=head;
while(low!=NULL and high!=NULL and high->next!=NULL){
low=low->next;
high=high-... | 741 | 223 |
/*
* gpio.cxx
*
* Created on: 30 июля 2014 г.
* Author: root
*/
#include "gpio.h"
eErrorTp GpioInInit(u8 gpio)
{
string str;
str= "echo \"" + intToString(gpio) + "\"> /sys/class/gpio/export";
printf("%s\n",str.c_str());
system(str.c_str());
str= "echo \"in\" > /sys/class/gpio/gpio"+intToString(gpio)+... | 2,542 | 1,191 |
#include "pch.h"
#include "SpatialAudioPlayer.h"
SpatialAudioPlayer::SpatialAudioPlayer()
{
}
| 96 | 41 |
#define SOL_CHECK_ARGUMENTS
#include <catch.hpp>
#include <sol.hpp>
TEST_CASE("storage/registry=construction", "ensure entries from the registry can be retrieved") {
const auto& script = R"(
function f()
return 2
end
)";
sol::state lua;
sol::function f = lua["f"];
sol::reference r = lua["f"];
sol::function ... | 791 | 318 |
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually
#pragma once
#include <common/common.h>
START_ATF_NAMESPACE
struct tagLITEM
{
unsigned int mask;
int iLink;
unsigned int state;
unsigned int stateMask;
wchar_t... | 385 | 128 |
#pragma once
#include "Engine/Math/Vec2.hpp"
class Ray3;
class Ray2
{
public:
// This is not normalized so that the Evaluate T will match with the 3D version
static Ray2 FromRay3XZ( const Ray3& ray3 );
Ray2() {};
Ray2( const Vec2& point, const Vec2& dir );
~Ray2() {};
void SetStartEnd( const ... | 515 | 182 |
#include "Action.h"
#include "ActionableObject.h"
namespace lust {
void ActionableObject::addAction(Action *action)
{
m_dependentActions.insert(action);
}
void ActionableObject::removeAction(const Action *action)
{
auto found = std::find(
m_dependentActions.begin(), m_dependentActions.en... | 583 | 183 |
//
// Created by bichlmaier on 07.02.2020.
//
#include "parser.h"
namespace angreal::parser {
Parser::Parser(const error_handler_t& error_handler)
: error_handler_(error_handler) {}
template <typename Type, typename... Args>
std::shared_ptr<Type> Parser::MakeASTNode(Args&&... args) {
{
... | 13,140 | 3,723 |
#include "../../includes/user_interface/game_over.h"
#include "ui_GameOver.h"
#include "../../includes/threads/play_result.h"
#include <QWidget>
#include <QDesktopWidget>
#include <string>
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
/*
PRE: Recibe un resultado de juego.
POST:Iniicaliza una ventana de fin d... | 1,800 | 602 |
/*
Copyright (c) 2007 Cyrus Daboo. All rights reserved.
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... | 9,663 | 3,637 |
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int x)
{
data = x;
left = nullptr;
right = nullptr;
}
};
bool isIdentical(Node* T, Node* S) {
if (!T && !S)
return true;
if (!T || !S... | 676 | 252 |
#include "SampleState.h"
namespace ReeeEngine
{
SampleState::SampleState(Graphics& graphics)
{
// Create sampler default options for UV read type.
D3D11_SAMPLER_DESC samplerOptions = {};
samplerOptions.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
samplerOptions.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerOp... | 755 | 292 |
#include "analysis/control_flow_graph.hpp"
#include "analysis/live_variables.hpp"
#include "ir/ir_printer.hpp"
#include "x86_assembler.hpp"
#include "x86_conv.hpp"
#include "utils/headers.hpp"
#include <list>
#include <iostream>
namespace
{
Ir::Block rewrite_block(SymbolTable &st, const Ir::Block &_block)
{
Ir:... | 3,632 | 1,166 |
// SPDX-FileCopyrightText: 2020 CERN
// SPDX-License-Identifier: Apache-2.0
#include "common.h"
#include "loop.h"
#include <iostream>
int main(int argc, char **argv)
{
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " nparticles" << std::endl;
return 0;
}
int nparticles = std::atoi(argv[1]);
#ifndef _... | 407 | 189 |
#include<bits/stdc++.h>
using namespace std;
string s;
string o;
main(){
long long a;
bool first=true;
cin>>a;
s+=to_string(a);
sort(s.begin(),s.end());
for(int i=2;i<=9;i++){
o.clear();
o+=to_string(a*i);
sort(o.begin(),o.end());
if(s==o){
if(!first) cout<<" ";
cout<<i;
first=false;
}
}
if(f... | 354 | 182 |
/* =====================================================================================
TChem version 2.0
Copyright (2020) NTESS
https://github.com/sandialabs/TChem
Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Governme... | 11,285 | 4,635 |
#pragma once
namespace tdc {
/// \brief Computes the LCP array from the suffix array using Kasai's algorithm.
/// \tparam char_t the character type
/// \tparam idx_t the suffix/LCP array entry type
/// \param text the input text, assuming to be zero-terminated
/// \param n the length of the input text including the z... | 1,276 | 451 |
#include <boost/mpl/aux_/preprocessed/no_ctps/vector.hpp>
| 58 | 26 |
#include "lcv.hpp"
#include "lvalue.hpp"
#include "../sdl/rw.hpp"
#include "../apppath.hpp"
#include "rewindtop.hpp"
#include "lubee/src/freelist.hpp"
extern "C" {
#include <lauxlib.h>
#include <lualib.h>
}
namespace rev {
// ----------------- LuaState::Exceptions -----------------
LuaState::EBase::EBase(const std... | 18,693 | 8,284 |
#include <fstream>
#include <iostream>
#include <memory>
#include <SDL.h>
#include <libChip-8/include/chip8vm.hpp>
using namespace std;
// Screen dimensions.
const int SCALING = 16;
const int SCREEN_WIDTH = Chip8VM::SCREEN_WIDTH * SCALING;
const int SCREEN_HEIGHT = Chip8VM::SCREEN_HEIGHT * SCALING;
enum { SUCCEED... | 4,199 | 1,930 |
#include "code_complete_cache.h"
void CodeCompleteCache::WithLock(std::function<void()> action) {
std::lock_guard<std::mutex> lock(mutex_);
action();
}
bool CodeCompleteCache::IsCacheValid(lsTextDocumentPositionParams position) {
std::lock_guard<std::mutex> lock(mutex_);
return cached_path_ == position.textDo... | 412 | 132 |
#include <iostream>
/*Ordenação por referência
Complete o programa dado para que com apenas uma chamada
para o procedimento ordenarTres, os valores das variáveis a, b e c sejam colocados em ordem crescente.
Note que nenhuma alteração da função main nem do procedimento ordenarTres é necessária.*/
using namespace std... | 829 | 354 |
#include <functional>
#include <string>
#include <gtest/gtest.h>
#include "twEventHandler.h"
#include "twEventManager.h"
#include "twConsoleLog.h"
using namespace TwinkleGraphics;
class SampleListener
{
public:
SampleListener(){}
~SampleListener(){}
void OnBaseEvent(Object::Ptr sender, BaseEventArgs::P... | 8,390 | 2,569 |
#include "atom.h"
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include "string.h"
#include <chrono>
#include <pybind11/stl.h>
#include <complex>
//-------------------------------------------------------
// Constructor, Destructor
//----------------------------------------... | 10,624 | 4,142 |
#include "../db/db.h"
using namespace db;
#include "vi.h"
using namespace vi;
#include "../ut/utils.h"
void Geometry::draw(Visualizer* v, const Layer& L) const {
if ((L.rIndex >= 0 || L.cIndex >= 0) && layer != L) {
return;
}
if (layer.rIndex >= 0) {
v->setFillColor(v->scheme.metalFill[l... | 4,716 | 1,814 |
#pragma once
#include <array>
#include <SFML/Graphics.hpp>
#include "State.hpp"
#include "SettingsBag.hpp"
#include "MapCell.hpp"
class OptionsState : public State {
public:
OptionsState(std::shared_ptr<sf::RenderWindow>);
~OptionsState();
static uint8_t player;
static uint8_t computer;
virtua... | 543 | 179 |
#pragma once
template <typename T> inline bool quadnode_t<T>::empty() const
{
return this->_tree == 0 || this->_ring < 0 || this->_branch < 0;
}
template <typename T> inline size_t quadnode_t<T>::index() const
{
return tree_index(this->_ring, this->_branch, 4);
}
template <typename T> inline quaditerator_t<T> quad... | 4,689 | 1,872 |
/* parser.tcc -*- C++ -*-
Rémi Attab (remi.attab@gmail.com), 12 Apr 2015
FreeBSD-style copyright and disclaimer apply
*/
#include "json.h"
#pragma once
namespace reflect {
namespace json {
/******************************************************************************/
/* GENER... | 3,575 | 1,062 |
#ifndef GAME_H
#define GAME_H 1
#include "SFML/Graphics.hpp"
#include "Snake.hpp"
using namespace sf;
class Game
{
private:
RenderWindow * window;
void run();
void event_handler();
void draw();
Snake snake;
public:
Game();
~Game();
void start();
};
#endif | 290 | 107 |
/*
* PROJECT: Mouri Optimization Plugin
* FILE: MoManageCompactOS.cpp
* PURPOSE: Implementation for Manage Compact OS
*
* LICENSE: The MIT License
*
* DEVELOPER: Mouri_Naruto (Mouri_Naruto AT Outlook.com)
*/
#include "MouriOptimizationPlugin.h"
#include <string>
#include <vector>
namespace
{
... | 14,020 | 3,618 |
// 0 1 2 3 4 5 6 7
// [10,9,2,5,3,7,101,18]
// o/p = 4 [2,3,7,101]
// idx -> f -> LIS
// (0, [])
// 2 (1, [10]) (1, [])
// (2,[10]) (2,[9]) (2,[])
// (3,[10]) ... | 3,184 | 1,243 |
class Solution {
public:
vector<string> findRelativeRanks(vector<int>& nums) {
vector<pair<int, int>> v;
for (int i = 0; i < nums.size(); ++i) {
v.push_back({nums[i], i});
}
sort(v.begin(), v.end());
vector<string> ans(nums.size());
for (int i = 0; i < num... | 759 | 269 |
#include "comm/communicator_base.h"
#include "comm/communicator_manager.h"
namespace rdc {
namespace comm {
void Communicator::TryAllreduce(Buffer sendrecvbuf, ReduceFunction reducer) {
if (sendrecvbuf.size_in_bytes() >
CommunicatorManager::Get()->reduce_ring_mincount()) {
return this->TryAllreduce... | 7,948 | 2,648 |
#include "common.hpp"
#include "minhook_api.hpp"
#include "minhook.h"
namespace minhook_api {
#if defined(USE_MINHOOK) && (USE_MINHOOK == 1)
void init() {
if(MH_Initialize() != MH_OK) {
DEBUG_TRACE("MH_Initialize : failed\n");
}
}
void cleanup() {
MH_Uninitialize();
}
#else
void init() {}
void cl... | 2,249 | 856 |
#include <iostream>
using namespace std;
class Point
{
int x;
int y;
public:
Point(int _x = 0, int _y = 0) :x(_x), y(_y) {}
void Print() const { cout << x << ',' << y << endl; }
const Point operator+(const Point& arg) const
{
Point pt;
pt.x = this->x + arg.x;
pt.y = this->y + arg.y;
return pt;
}
};
in... | 483 | 233 |
#pragma once
#ifndef SOCKETSERVER_H
#define SOCKETSERVER_H
#include <WebSocketsServer.h>
namespace TableDisco
{
class SocketServer
{
public:
SocketServer();
void loop();
void broadcast(String data);
private:
WebSocketsServer... | 389 | 118 |
#include "index_file_handler.h"
#include <assert.h>
IndexFileHandler::IndexFileHandler(BufManager* _bm){
bm = _bm;
header = new IndexFileHeader;
}
void IndexFileHandler::openFile(const char* fileName){
fileID = bm->openFile(fileName);
int headerIndex;
if (fileID == -1){
bm->createFile(fileN... | 2,391 | 791 |
#include <all_lib.h>
#pragma hdrstop
#if defined(__MYPACKAGE__)
#pragma package(smart_init)
#endif
#if !defined(__HWIN__)
static char *lwrChars = "йцукенгшщзхъфывапролджэячсмитьбю";
static char *uprChars = "ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ";
char MYRTLEXP ToUpper( char ch )
{
if ( ch >= 'A' && ch <= 'Z' ) retu... | 2,833 | 1,143 |
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include "CompanyPriceDataStorage.h"
/*
That's a sample test case
*/
TEST_CASE( "Company price data is stored and selecte3d", "[storage]" ) {
CompanyPriceData etalonData{0, "1", "2", "3", "4"}
CompanyPriceDataStorage storage("test.db");
const int id = stora... | 655 | 224 |
#include "OptionDialog.h"
#include <iostream>
//(*InternalHeaders(OptionDialog)
#include <wx/font.h>
#include <wx/intl.h>
#include <wx/settings.h>
#include <wx/string.h>
//*)
//(*IdInit(OptionDialog)
const long OptionDialog::ID_BUTTONSAVE = wxNewId();
const long OptionDialog::ID_KEYCHOICE = wxNewId();
const l... | 5,231 | 2,100 |