blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 117 | path stringlengths 3 268 | src_encoding stringclasses 34
values | length_bytes int64 6 4.23M | score float64 2.52 5.19 | int_score int64 3 5 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | text stringlengths 13 4.23M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
dbcc333f5bd76ca9711efcf374054bb61e293f01 | C++ | hemang-h/C-Cpp-Programs | /src/Odd-even/code.cpp | UTF-8 | 280 | 3.203125 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
int main()
{
int number = 0;
cout << "Enter integer number\n";
cin >> number;
if (number % 2 == 0) {
cout << "The value " << number << " is an even number.\n";
}
else {
cout << "The value " << number << " is an odd number.\n";
}
return 0;
}
| true |
057156818c3f153f2946967579d591711aa6aeca | C++ | thverney-dozo/Piscine-CPP | /C01/ex02/ZombieEvent.cpp | UTF-8 | 1,764 | 2.53125 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ZombieEvent.cpp :+: :+: :+: ... | true |
34739bb11c69ee11f3323fd1000eeb0ae957ddca | C++ | ctslater/mops_daymops | /include/lsst/mops/Track.h | UTF-8 | 5,861 | 2.515625 | 3 | [] | no_license | // -*- LSST-C++ -*-
/* jonathan myers
8/10/09
*/
#ifndef LSST_TRACK_H
#define LSST_TRACK_H
#include <set>
#include <vector>
#include <Eigen/Dense>
#include "gsl/gsl_cdf.h"
#include "MopsDetection.h"
#include "Tracklet.h"
namespace lsst { namespace mops {
/** \class Track Track.h "lsst/mops/Track.h"
\brief... | true |
a58fba693c5b3f214a856667534dccf7464382c6 | C++ | Hatcher/CSCI-6221 | /W4A1/src/W4A1.cpp | UTF-8 | 1,797 | 3.796875 | 4 | [] | no_license | //============================================================================
// Name : W4A1.cpp
// Author : Anderson Thomas
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================... | true |
afc02bacfa2fe7292ec6150894f8e85b92dc3b6c | C++ | ShakedY/ex4 | /server/Server.cpp | UTF-8 | 6,305 | 2.828125 | 3 | [] | no_license | #include "Server.h"
#include <stdlib.h>
#define BUFFSIZE 1024
volatile int running_threads = 0;
Server::Server(int argc, char* argv[]) :
factory()
{
//Create Udp socket.Port will be in command line arguments.
socket = new Tcp(1, atoi(argv[1]));
socket->initialize();
StringInput input(argc, argv);
input.readMapI... | true |
7bd49c406ebdd0fe04ef46b52478367b1d905c0f | C++ | ClaraShar/csp | /小试牛刀/棋局评估.cpp | UTF-8 | 2,458 | 3.03125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int mp[4][4];//map为棋盘
bool row(int r,int tag){
return mp[r][0]==tag && mp[r][0]==mp[r][1] && mp[r][1]==mp[r][2]; //判断行是否三颗相连
}
bool col(int c,int tag){
return mp[0][c]==tag && mp[0][c]==mp[1][c] && mp[1][c]==mp[2][c]... | true |
ade744ce8a5fb646e19de6135c8d3c7000df81d4 | C++ | AleksanderKirintsev/study | /Olymp/HSE/2019/11/lvl1/A/simple.cpp | UTF-8 | 572 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
string a,b,c;
bool F(string v, string u) {
for(int i = 0; i <= int(u.size()) - int(v.size()); i++){
string x = u.substr(i,v.size());
if(v == x)
return 1;
}
return 0;
}
int main() {
cin >> a >> b >> c;
string ans... | true |
efe5cec6f206311623d23f444b42bfec540a5005 | C++ | aman1228/LeetCode | /Algorithms/longest-common-prefix.cpp | UTF-8 | 815 | 3.546875 | 4 | [] | no_license | 14. Longest Common Prefix
https://leetcode.com/problems/longest-common-prefix/
Write a function to find the longest common prefix string amongst an array of strings.
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
return f1(strs, 0, strs.size());
}
private:
string f1(ve... | true |
7ae4697f86bcfa3cbb33267f28d61abcb6b2bfb1 | C++ | kesar/reward-contract | /reward/src/reward.cpp | UTF-8 | 1,703 | 2.6875 | 3 | [] | no_license | #include <reward/reward.hpp>
void reward::claim()
{
stats stat(_self, 0);
const auto& record = stat.get(0);
auto time = current_time_point().sec_since_epoch();
check(time > record.last_claimed + TIME_TO_CLAIM, "need more time to claim");
if (record.quantity.amount > 0) {
auto dev_amount = ... | true |
93f2fde7b90f35d6020e58ebadc4f04e33d99777 | C++ | SyouheiKobayashi/Kobayashi_Shouhei_GAMEs | /吉田学園情報ビジネス専門学校@小林将兵/C言語/<2>2Dアクション/ソースコード/title.cpp | SHIFT_JIS | 6,490 | 2.53125 | 3 | [] | no_license | //=========================================================================
// ^Cgʂ̏ [title.cpp]
// Author:Kobayashi/
//=========================================================================
#include "main.h" //C
#include "title.h" //^Cg
#include "input.h" //͏
#include "fade.h" //tF[hʐւ
//========================... | true |
8b8c64ce0d712285bff6b08382b7c9614af0aa45 | C++ | tfwio/twix | /TimingInterval.h | UTF-8 | 1,230 | 2.921875 | 3 | [
"MIT"
] | permissive | #ifndef __TIMING_INTERVAL__
#define __TIMING_INTERVAL__
class TimingInterval
{
public:
enum TIMINGPARAMS {
_tTempo,
_tIsRunning,
_tQuarters,
_tDivisions
};
// void Play(){} void Pause(){} void Stop(){} void Reset(){}
int GetQuarters() { return int(quar); }
int GetDivisions() { return int(d... | true |
04b94087f18c1712296bdda7518e899a1aa05330 | C++ | chaojunhou/LeetCode | /Algorithm/CPP/missing_number.cpp | UTF-8 | 407 | 2.625 | 3 | [] | no_license | # include <stdio.h>
# include <iostream>
# include <vector>
# include <string>
# include <cctype>
# include <algorithm>
# include<time.h>
using namespace std;
class Solution {
public:
int missingNumber(vector<int>& nums) {
int sum = 0;
int n = nums.size();
for(int i=0;i<n;++i)
... | true |
8c9f0bdb3febf96dd253ace09327f9467e0d547a | C++ | kalipav/3D_Viewer | /Field3D.h | UTF-8 | 1,815 | 2.953125 | 3 | [] | no_license | #ifndef _FIELD3D_H_
#define _FIELD3D_H_
#include "Point3D.h"
#include <vector>
// параметры метода Field3D::Kramer
struct Kramer_params
{
// спроецированные координаты (x, y, z)
double* proj_coords;
// координаты направляющего вектора (x, y, z)
const double* direction_vector;
// координаты точк... | true |
98bc47429891f0f0db7db3a39755024c990ae780 | C++ | sweng2013team4/shredder | /ShredderSource/DiskManager/diskmanager.h | UTF-8 | 784 | 2.640625 | 3 | [] | no_license | #ifndef DISKMANAGER_H
#define DISKMANAGER_H
#include <string>
#include "disk_drive.h"
#define DISK_BUFFER 100
#define MAX_DRIVE_DEVICES 15
#define DRIVES_TMP_FILE "/tmp/hd.tmp"
#define GET_DRIVES_CMD "sudo Scripts/get_drives.sh " DRIVES_TMP_FILE
#define BOOT_TMP_FILE "/tmp/boot_dev.tmp"
#define GET_BOOT_CMD "s... | true |
d56450f6f4d46d5388594b5c439b032ec42d1e9b | C++ | aviana37/signal | /include/signal/emitter.hpp | UTF-8 | 1,819 | 3.046875 | 3 | [
"BSL-1.0"
] | permissive | #pragma once
#include "detail/control.hpp"
namespace signal
{
template <typename ... signals>
class emitter final : detail::not_copyable
{
private:
template <typename> friend class detail::control;
template <typename Signal> using instance_ptr = detail::make_emitter_instance_ptr<Signal... | true |
c5d22d6da96b6afd236853f6037820e20867ee3f | C++ | 66112/memory_pool | /CentralCache.cpp | GB18030 | 2,829 | 2.765625 | 3 | [] | no_license | #include "CentralCache.h"
#include "PageCache.h"
CentralCache CentralCache::_inst; //һ¾̬Ա
//ĻȡһĶthreadcache
size_t CentralCache::FetchRangeObj(void*& start, void*& end, size_t num, size_t size)
{
//threadcache
//start = malloc(num*size);
//end = (char*)start + size*(num - 1);
//void* cur = start;
//while (cur <... | true |
77ed6ec7c2cdba084af4d69898051545e957f81e | C++ | eugendun/CAD-Practice | /Homogeneous Coordinates/Matrix4.cpp | MacCentralEurope | 4,430 | 3.0625 | 3 | [] | no_license | // ========================================================================= //
// Authors: Matthias Bein //
// mailto:matthias.bein@igd.fraunhofer.de //
// //
... | true |
23a47705a2dce7cf7a2beb169190a0f39dd808a5 | C++ | shudashov/ArduSat-utils | /libraries/SamplingLib/IncSamplingMethod.h | UTF-8 | 2,850 | 2.890625 | 3 | [] | no_license | /*
********************************************************************
Copyright 2014, Jean-François Omhover (jf.omhover@gmail.com, twitter @jfomhover)
********************************************************************
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except... | true |
fb59d1ee7cce8945e628b0ecfcd263339665acba | C++ | vxl/vxl | /contrib/gel/vsol/vsol_line_2d.cxx | UTF-8 | 11,701 | 2.515625 | 3 | [] | no_license | // This is gel/vsol/vsol_line_2d.cxx
#include <iostream>
#include <cmath>
#include "vsol_line_2d.h"
//:
// \file
#include <cassert>
#ifdef _MSC_VER
# include "vcl_msvc_warnings.h"
#endif
#include "vnl/vnl_math.h"
#include <vbl/io/vbl_io_smart_ptr.h>
#include <vsol/vsol_point_2d.h>
#include "vgl/vgl_homg_point_2d.h"
#i... | true |
ebd59f4f089978a620eea845777bcf5b5b3e6298 | C++ | yuishin-kikuchi/eckert | /src/calc/engine/OperatorsRandom.h | UTF-8 | 1,421 | 2.921875 | 3 | [
"MIT"
] | permissive | #ifndef _OPERATORS_RANDOM_H_
#define _OPERATORS_RANDOM_H_
#include "GeneralOperator.h"
#include <random>
namespace engine {
class RandomOperator : public GeneralOperator {
protected:
static std::mt19937_64 mt;
public:
virtual bool operate(StackEngine &stackEngine) const = 0;
virtual std::size_t getRequiredCo... | true |
0ee780d599071c024bb486e3f5456b8ea62992f4 | C++ | kedixa/LeetCode | /C++/126.cpp | UTF-8 | 2,299 | 2.609375 | 3 | [] | no_license | class Solution {
using vs = vector<string>;
vector<vs> result;
vs tmp;
vector<vector<int>> next;
vector<string> vstr;
bool diff_by_one(const string &a, const string &b)
{
int s = 0;
for(int i = 0; s !=2 && i < a.length(); ++i)
s += (a[i]!=b[i]);
return s==... | true |
dce564ab0871e606392432a4e1ed1fb7af381739 | C++ | Chenxiaojiang10/C | /no06-2.cpp | GB18030 | 916 | 3.546875 | 4 | [] | no_license | #include<iostream>
#include<string>
//ַתint
using namespace std;
class Solution {
public:
bool NotIsNumber(char s) {
if ((s > '0' && s < '9') || s == ' ' || s == '-' || s == '+') {
return false;
}
return true;
}
int StrToInt(string str) {
int flag = 1;//
int i = 0;
for (; i < (int)str.size(); i++)... | true |
67e3bb59036612ea9e34644cff26679b480ab422 | C++ | NimeshJohari02/DataStructures | /ARRAY(display).cpp | UTF-8 | 574 | 3.75 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct array
{
int *a;
int size;
int length;
};
void display(struct array arr)
{
cout<<"ELEMENTS ENTERED \n ";
for(int i=0;i<arr.length;i++)
cout<<arr.a[i]<<endl;
}
int main()
{
struct array a1;
cout<<"Enter the size of the array"<<endl;
cin>>a1.size;
... | true |
ab6f52ce1d85df02015f2bc3c773bc5209586079 | C++ | kianoosh-j/HMAX | /SVN/Codes/Hmax/implementations/picture_handler.cpp | UTF-8 | 9,941 | 3.078125 | 3 | [] | no_license | #include "headers.h"
#include "picture_handler.h"
#define MAX_MATRIX_SIZE 1000 * 1000
#define CURRENT_HEIGHT 140
int max_pictures ( Picture result , Picture first , Picture second ){
if ( result.width != first.width || result.width != second.width && result.width < 0){
cerr<<"not equal width for m... | true |
21f9d941c6721aa6f4e26f12e2a72ac414bfc90c | C++ | Itachi546/Software-Renderer | /src/Core/MainWindow.cpp | UTF-8 | 5,451 | 2.9375 | 3 | [] | no_license | #include "MainWindow.h"
#include "InputManager.h"
#include <SDL2/SDL.h>
#include <cmath>
#include <climits>
#include "../Math/Math.h"
MainWindow::MainWindow(int width, int height, const char* title){
this->width = width;
this->height = height;
running = true;
SDL_Init(SDL_INIT_VIDEO);
//Enable default ve... | true |
1b910c39f1d84518f7426c3b56205da43c324889 | C++ | stamborindegui/CS165new | /week03/myAssign03.cpp | UTF-8 | 6,036 | 3.328125 | 3 | [] | no_license | /***********************************************************************
* Program:
* Assignment 03, Digital Forensics with Corrupt Files.
* Brother Dudley, CS165
* Author:
* Sandro Tamborindegui
* Summary:
* This program will read all logs by prompt the user to enter the file
* location start a... | true |
20442ac539e3a47f8703e4eba97d98b1fb10a34f | C++ | LazerTony20/RobusP17APP | /Tests bluetooth/src/main.cpp | UTF-8 | 2,039 | 2.765625 | 3 | [] | no_license | #include <Arduino.h>
/*
--------------------RÉFÉRENCES-----------------
https://www.arduino.cc/en/Tutorial/BuiltInExamples/MultiSerialMega
https://www.arduino.cc/en/Reference/StringLibrary
https://www.arduino.cc/reference/en/language/functions/communication/serial/readstring/
https://www.arduino.cc/reference/en/langua... | true |
9171bb719c6d452c0b25d863d8144fd6a5981ede | C++ | shphrd/bitcoin-sv | /src/invalid_txn_sinks/file_sink.h | UTF-8 | 2,735 | 2.703125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | // Copyright (c) 2020 Bitcoin Association
// Distributed under the Open BSV software license, see the accompanying file LICENSE.
#pragma once
#include <map>
#include <mutex>
#include <string>
#include <boost/filesystem.hpp>
#include "invalid_txn_publisher.h"
#include "util.h"
namespace InvalidTxnPublisher
{
// ... | true |
4d14028107c98d7993529051494eb08d368a53d2 | C++ | jai-singhal/dsa | /competitive/code_quest/collision.cpp | UTF-8 | 779 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include<cmath>
#include <map>
#include <iterator>
using namespace std;
int main(){
int C, x, y, v, t, d;
cin >> C;
map<float, int> collisons;
for(int i = 1; i <= C; i++){
cin >> x >> y >> v;
d = sqrt(pow(x, 2) + pow(y, 2));
t = ceilf((d/v)*100)/100;
... | true |
838a5d15cc5231e8f6192de5c1366abc53a3d47b | C++ | Ediolot/IA-Coche | /src/utility.cpp | UTF-8 | 1,183 | 2.8125 | 3 | [
"MIT"
] | permissive | #include "../include/utility.hpp"
////////////////////////////////////////////////////////////////////////////////
void displayFPS(ALLEGRO_FONT *font)
{
static uint iteration = 0;
static double elapsed = 0;
static double old_time = 0;
static int fps = 0;
double new_time = al_get_time();
if (... | true |
c8523e8f50e1deee086a7458e6330cd8233a216e | C++ | Eigenbaukombinat/arduino-workshop | /Sketches/Ultraschall/Ultraschall.ino | UTF-8 | 1,311 | 2.859375 | 3 | [] | no_license | const int echoPin = 7; // Pin für das analoge Echo
const int trigPin = 8; // Pin für den digitalen Triggerimpuls
const int ledPin = 13; // LED
int target = 0; // minimale Zieldistanz
long duration; // Impulsdauer in µs
long mils;
int state = 0;
int cnt = 0;
void setup() {
Serial.begin (9600);
pinMode(trigPin, OU... | true |
d750ee4ef529115a3a58180d1b01f992cebaae0a | C++ | tommag/Farfadet_Arduino | /Farfadet.cpp | UTF-8 | 3,219 | 2.5625 | 3 | [
"MIT"
] | permissive | #include <Farfadet.h>
void Farfadet::init(uint8_t txPin, int stepsPerTurn, int address)
{
init(txPin, stepsPerTurn, Serial1,address);
}
void Farfadet::init(uint8_t txPin, int stepsPerTurn, HardwareSerial& serial, int address)
{
tmc = Estee_TMC5130_UART_Transceiver(txPin, serial, address);
serial.begin(250000);
... | true |
e66fb3f9b52ebfeaaf86f3be18dee3c565f2d4e7 | C++ | rainscut/tyra | /src/engine/include/modules/camera_base.hpp | UTF-8 | 1,621 | 2.75 | 3 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2020, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#ifndef ... | true |
f03f99561ee73812fa6e03078b2a893c4b1e150c | C++ | gregueiras/proj_AEDA_2017 | /src/VehicleMenuView.cpp | UTF-8 | 1,187 | 2.515625 | 3 | [] | no_license | /*
* VehicleMenuView.cpp
*
* Created on: 28 Dec 2017
* Author: jotaa
*/
#include "VehicleMenuView.h"
VehicleMenuView::VehicleMenuView() {
this->u = new Utilities();
}
VehicleMenuView::~VehicleMenuView() {
// TODO Auto-generated destructor stub
}
void VehicleMenuView::printMessage(const string& message)... | true |
1296a4786dbd0be77b6d6b4248b1d08ce17d217c | C++ | abbyssoul/libsolace | /src/path.cpp | UTF-8 | 8,967 | 2.640625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* Copyright 2016 Ivan Ryabov
*
* 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 to in ... | true |
5be90d0309805bfae41509bd17d626ce98381fb8 | C++ | gypaos/Kinematics | /TNoyau.cxx | UTF-8 | 7,453 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <stdlib.h>
#include <cmath>
using namespace std;
#include "TNoyau.h"
#include "Constant.h"
ClassImp(TNoyau)
TNoyau::TNoyau()
: fNom("unknown"),
fMasse(0),
fCharge(0),
fExcesMasse(0),
fExcitationEnergy(0),
fDemiVie("unknown"),
fSpin(0)... | true |
cb837a00e3e68f3e69a4acc1f4dc69b11d65db6b | C++ | avida/sandbox | /cpp/compare.cpp | UTF-8 | 212 | 2.96875 | 3 | [] | no_license | #include <string>
#include <iostream>
using namespace std;
int main()
{
const char* c_str = "Hello";
cout << "Hi" <<endl;
if ("Hello" == string(c_str))
cout << "MATCH!!\n";
return 0;
} | true |
6eee460a5c6553ed0028eb6a980a848131d6c3aa | C++ | whm200410/suace | /suace.h | UTF-8 | 414 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | #pragma once
#include <opencv2\opencv.hpp>
using namespace cv;
/*
@brief Enhance the contrast with SUACE;
@param src source image with the type CV_8UC1.
@param dst output image
@param distance the old reference contrast range to be enhanced. less value means more contrast.
@param sigma the sigma value of the Gaussina... | true |
c6897eb9263a1df73f68fece13031ee8300c6dfd | C++ | OC-MCS/drawing-01-DietrichWasHere | /Drawing/main.cpp | UTF-8 | 3,522 | 2.890625 | 3 | [] | no_license | //================================================
// Dietrich Versaw
// Drawing Program
// Due 3/25/19
//================================================
#include <iostream>
#include <fstream>
using namespace std;
#include <SFML\Graphics.hpp>
#include <cctype>
#include "SettingsMgr.h"
#include "ShapeMgr.h"
#include "S... | true |
b64678bc621d8411b1a5c3c17a75d5235aee8d3f | C++ | shenjunHZ/PabulumElement | /C_Interface/Common/Util/FileUtil.h | GB18030 | 1,114 | 2.765625 | 3 | [] | no_license | #ifndef __COMMON_FILEUTIL_H__
#define __COMMON_FILEUTIL_H__
#include "Common/CommonGlobal.h"
#include <vector>
#include <string>
namespace Common
{
// ȡļб
COMMON_EXPORT std::vector<std::string> GetFileList(const char* pDirName);
// ȡļб
COMMON_EXPORT std::vector<std::string> GetFileNameList(const char* pDirName);... | true |
8afb49e60a95a03369f15a55fce98f3295e9da16 | C++ | pluruel/Algorithm-Study | /Backjoon/b_17822/main.cpp | UTF-8 | 2,593 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <queue>
#define INSIDE ty <= N && ty > 0
using namespace std;
int dy[4] = { 0, 1, 0, -1 };
int dx[4] = {1, 0, -1, 0};
int N, M, T;
int p[51][51];
bool search(int y, int x) {
int n = p[y][x];
if (!n) return false;
queue<pair<int, int> > q;
queue<pair<int, int> > q2;
... | true |
3a8e1aa9adad934a91ebdf2980fa9650c3fb2231 | C++ | SauliusE/thesisWork | /OpenDaVINCI-msv/apps/2015/driver/src/Driver.cpp | UTF-8 | 8,678 | 2.625 | 3 | [
"AFL-3.0"
] | permissive | /*
* Mini-Smart-Vehicles.
*
* This software is open source. Please see COPYING and AUTHORS for further information.
*/
#include <stdio.h>
#include <math.h>
#include "core/io/ContainerConference.h"
#include "core/data/Container.h"
#include "core/data/Constants.h"
#include "core/data/control/VehicleControl.h"
#incl... | true |
cd0b829bea54179ac8d5602871a8cd646661db3a | C++ | hkduke/MIE-BPR-Tutorial3 | /Tutorial3-TimeSetup/Parser.cpp | UTF-8 | 689 | 3.078125 | 3 | [] | no_license | #include "stdafx.h"
#include "Parser.h"
char Parser::delimiter = '|';
Parser::Parser(){
}
Parser::~Parser(){
}
vector<string> Parser::split(const string &s, char delim) {
stringstream ss(s);
string item;
vector<string> tokens;
while (getline(ss, item, delim)) {
tokens.push_back(item);
}
return tokens;
}
v... | true |
4240cf2a30a1e00ee10abd5f0321205067d74d50 | C++ | HANXU2018/HBU2019programingtext | /2020程序设计天梯赛/未命名7.cpp | UTF-8 | 553 | 2.765625 | 3 | [] | no_license | #include<iostream>
#include<queue>
#include<vector>
using namespace std;
int main(){
int n;
cin>>n;
vector<int>num(n);
queue<int>ans;
for(int i=0;i<n;i++){
cin>>num[i];
}
int flag=0;
ans.push(0);
ans.push(n-1);
int count=n;
while(ans.size()!=0){
int a= ans.front();
ans.pop();
int b= ans.front();
... | true |
1594e48a538e38494b46c1f2867579639e367166 | C++ | nassemz/4inRow | /Game Server/LoginThread.cpp | UTF-8 | 2,704 | 2.671875 | 3 | [] | no_license | ///////////////////////////////////////////////////
// LoginThread.cpp
// By: Nissim Zohar ID: 066412149
///////////////////////////////////////////////////
#include "LoginThread.h"
#include "../common/StreamSocket.h"
LoginThread::LoginThread(StreamSocket *socket,TableManager* manag): m_socket(socket), mannager(mana... | true |
af219cf30733cca41b69b51f18780ee2531e6c20 | C++ | Deeds85/BeginningGameProgramming | /CreateSurface/CreateSurface/winmain.cpp | UTF-8 | 4,629 | 2.796875 | 3 | [] | no_license | #include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <time.h>
#include <iostream>
using namespace std;
//application title
const string APPTITLE = "Create Surface Program";
//macro to read the keyboard
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code)&0x8000)?1:0)
//screen resolution
#define SCREE... | true |
164bcac993a15122fb26cff021759a2163d0a905 | C++ | cs2103jan2015-w10-4c/main | /TaskHubTest/StorageControllerTest.cpp | UTF-8 | 1,078 | 2.625 | 3 | [] | no_license | //@author A0111322E
#include "stdafx.h"
#include "CppUnitTest.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace TaskHubTest{
TEST_CLASS(StorageControllerTest) {
public:
TEST_METHOD(TestSetFileName){
StorageController* test = new StorageController();
//test case 1
std::s... | true |
069057098206f4d72731046428d6dc7ac51cdfb4 | C++ | anirudhbatra/Hackerrank-files | /voters list.cpp | UTF-8 | 675 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n1,n2,n3;
cin >> n1 >> n2 >> n3;
int total = n1 + n2 + n3;
int a[total];
for (int i = 0;i < total;i++)
{
cin >> a[i];
}
sort(a,a+total);
int prev,cont = 1;
prev = a[0];
vector<int> voters;
for (int... | true |
1b5bfc865890fb8919931c9747cfdcc9edd1af9c | C++ | uwuvalem/Roblox-Exploit | /ROBLOX hack creation/ROBLOX hack creation/LuaC/LuaC.cpp | UTF-8 | 3,689 | 2.875 | 3 | [
"MIT"
] | permissive | #include "LuaC.h"
enum LuaC_OPCODES
{
NOTHING,
OP_GETGLOBAL,
OP_GETFIELD,
OP_SETGLOBAL,
OP_SETFIELD,
OP_PCALL,
OP_CALL,
OP_PUSHNIL,
OP_PUSHSTRING,
OP_PUSHVALUE,
OP_PUSHNUMBER,
OP_PUSHBOOLEAN,
OP_SETTOP,
OP_POP,
OP_WAIT,
OP_EMPTYSTACK
};
LuaC_OPCODES returnop(string func)
{
if ... | true |
09dae4166ef42d53cbbc56800676476765937738 | C++ | farmerboy95/CompetitiveProgramming | /XXOpenCup/XXOpenCup-GPNanjing2020-A.cpp | UTF-8 | 3,252 | 2.71875 | 3 | [] | no_license | /*
Author: Nguyen Tan Bao
Status: AC
Idea:
- First simplify: X = x_1^x_2...^x_N^x_1'^x_2'^...^x_N'
- Now all pairs (x_i, y_i) become (0, x_i^y_i)
- So after A's moves then you have some value of X. What does B do to minimize? B should
try to remove max bit of X if possible. ... | true |
5c40968cb52e5a8a085449548b61569bbeb38b85 | C++ | basecq/opentesarenapp | /WinArena/ParseBSA.h | UTF-8 | 10,717 | 2.6875 | 3 | [] | no_license | /////////////////////////////////////////////////////////////////////////////
//
// $Header: /WinArena/ParseBSA.h 10 12/31/06 10:51a Lee $
//
// File: ParseBSA.h
//
//
// Basic layout of Globals.BSA:
// * 16-bit word indicating total number of index entries at end of file
// * all data files packed one af... | true |
c1edef638197deb26f8a181da6947fb145706951 | C++ | lambertwang/tensor_stuff | /src/trainNode/train.cpp | UTF-8 | 1,685 | 2.921875 | 3 | [] | no_license | /**
* Train class
*/
#include "train.h"
#include "tensoralgebra.h"
Train::Train(const TensorNode *val, Tensor n_learning_rate) {
input.push_back(val);
graph = new GraphNode(val);
learning_rate = n_learning_rate;
}
Tensor Train::evaluate(Session *session) const {
Tensor result;
for (const Tens... | true |
1d4e77ad574488f091a850582e45a87549797529 | C++ | SUSREE64/Cplusplus | /strings.cpp | UTF-8 | 967 | 3.765625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
string name = "Sreenivasulu";
string slice;
cout << name << endl;
// string concatenation
cout << "Hi! " + name << endl;
cout << "Legth of string" << name.length() << endl;
//append
name.append(" Gentleman");
cout << name << endl... | true |
8e5b2c64eade45af6d893fae566d8d84a8da45cd | C++ | kelasterbuka/CPP_Lanjut_OOP | /19 - Friend Class/src/Main.cpp | UTF-8 | 1,618 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
// belajar tentang friend class
// akses friend class hanya satu arah, tidak berlaku sebaliknya
// friend class akan memberikan akses dari class yang mendeklarasikan friend
class PersegiPanjang;
class Persegi{
// memberikan akses seluruh atribut dan meth... | true |
c55c4b22d59555732fe4121ffe30262f7f6d5c7c | C++ | thanhnhani654/Megaman--X3 | /Megaman/Component/MoveComponent.h | UTF-8 | 2,204 | 2.53125 | 3 | [] | no_license | #pragma once
#include <d3d9.h>
#include <d3dx9.h>
#include <math.h>
#include <iostream>
class MoveComponent
{
private:
D3DXVECTOR2* position;
D3DXVECTOR2 prevPosition;
D3DXVECTOR2* velocity;
D3DXVECTOR2 acceleration;
float speed;
bool bGravity; //Bằng true cho Player. Tất cả mấy cái còn lại không cần
floa... | true |
5b687b610f1f4c088ea0c12522138347c100e366 | C++ | gnunesmoura/simulador2 | /include/init/instance/edge.hpp | UTF-8 | 521 | 2.578125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <vector>
#include <valarray>
#include <utility>
#define pera getchar()
#define eae std::cout << "Filha da puta\n"
namespace sim {
class Node;
typedef struct edge {
constexpr edge (double t_value, Node& t_node) :
first(t_value), second(t_node) {};
double ... | true |
c746607c58ad602d5ed176f933ce210168fb6f85 | C++ | API-Beast/libColorProcess | /Colors/GenericColor.h | UTF-8 | 1,620 | 3.0625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "ColorSpaces.h"
#include "Colors.h"
class GenericColor
{
protected:
union
{
LinearRGB linRgb;
sRGB sRgb;
sRGB_uint8 sRgbu8;
HSV Hsv;
LinearHSV linHsv;
HCY hcy;
Vec3f genericVec3f;
Vec3u8 genericVec3u8;
};
ColorSpace color_space = ColorSpace::LinearRGB;
p... | true |
96f224f9d49edac96f142ca3beacc346174121af | C++ | IlyaNikiforov/Home_Works | /semester_1/home_work_2/task_5/Задача №5.cpp | WINDOWS-1251 | 1,237 | 3.4375 | 3 | [] | no_license | // 5.cpp : Defines the entry point for the console application.
//
#include "iostream"
#include "time.h"
#include "stdlib.h"
using namespace std;
int max(int a[], int i, int j)
{
if (a[i] >= a[j])
return i;
else
return j;
}
void swap(int &a, int &b)
{
int p = 0;
p = a;
a = b;
b = p;
}
void heaping(int a[... | true |
ed2e289f6cbca94b7b31941b2b61afbc39a8cc2d | C++ | danchris1029/CodingPractice | /C++/simplify-path.cpp | UTF-8 | 1,992 | 3.46875 | 3 | [] | no_license | //Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path.
class Solution {
public:
string simplifyPath(string path) {
string res = "",
dir = "";
int dot = 0;
v... | true |
2bbfb658e3468498a5d2b83fd9ae69592d361ffa | C++ | xairry/PAT-Basic | /1021/S1021_0.cpp | UTF-8 | 534 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int count_char_in_string(string, char);
int main() {
string number;
cin>>number;
for (int i=0; i<10; i++) {
int n;
n = count_char_in_string(number, to_string(i)[0]);
if (n > 0) {
cout<<i<<":"<<n<<endl;
... | true |
a76f86b28107c51661ae996fc33423787ff7ce2e | C++ | Coletinn/dados-projeto2-calculadoraRPN | /projeto2-dados/main.cpp | ISO-8859-1 | 1,354 | 3.265625 | 3 | [] | no_license | /*
Gustavo Coleto de Freitas 32076541
Joo Vitor Teles Centrone 32033125
*/
#include <iostream>
#include <sstream>
#include "DynamicStack.h"
#include <clocale>
using namespace std;
float Math(const std::string& input, DynamicStack& stack);
int main()
{
setlocale(LC_ALL, "portuguese");
DynamicStack stack = Create(... | true |
ac6f4992a7b92e1cc8d252835179e30ca7e85527 | C++ | DPCEKY/myleet | /843.cpp | UTF-8 | 801 | 3.59375 | 4 | [] | no_license | /**
* // This is the Master's API interface.
* // You should not implement it, or speculate about its implementation
* class Master {
* public:
* int guess(string word);
* };
*/
class Solution {
public:
void findSecretWord(vector<string>& wordlist, Master& master) {
vector<string> mywords = wordlist;
fo... | true |
8fe59a3f275acfed48202984f4421ef7410cd1df | C++ | serialization/test.cpp | /test/age/AgeContainsTest.cpp | UTF-8 | 4,380 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by Sarah Stieß on 28.05.19.
//
#include "../../lib/ogss.common.cpp/ogss/internal/AbstractPool.h"
#include "../../src/age/File.h"
#include "../../src/empty/File.h"
#include "../common/utils.h"
#include <gtest/gtest.h>
using ::age::api::File;
TEST(AgePoolAddTest, ContainsNull) {
try {
auto sg... | true |
6ffd64667f75dc08542f4448f529e2cf1b990b5d | C++ | markhuberty/fung_disambiguator | /include/newcluster.h | UTF-8 | 4,853 | 2.6875 | 3 | [] | no_license |
#ifndef PATENT_NEWCLUSTER_H
#define PATENT_NEWCLUSTER_H
#include "engine.h"
#include "clusterhead.h"
/**
* Cluster objects are the molecules of disambiguation,
* while Record objects are atoms of disambiguation.
* Each cluster contains a cluster_head, a list of members, and some other
* information. The aim of d... | true |
682018b75a09329206fee80985c9345c3cbe8007 | C++ | Niyijie/Chinese-Chess | /Classes/ChessClass.h | UTF-8 | 3,499 | 2.5625 | 3 | [] | no_license | #ifndef ChessClass_h
#define ChessClass_h
#include "cocos2d.h"
USING_NS_CC;
#define RED 1
#define BLACK -1
#define BKING -2
#define BROOK -3
#define BKNIGNT -4
#define BCANNON -5
#define BMANDARIN -6
#define BELEPHANT -7
#define BPAWN -8
#define RKING 2
#define RROOK 3
#define RKNIGNT 4
#define RCANNON 5
#define RMAND... | true |
71dca8156c3ae1e1d37cf3906dba8dc6bb142d91 | C++ | GarrettXUPT/C-_updata | /p5_20200505/源.cpp | GB18030 | 4,321 | 3.828125 | 4 | [] | no_license | #include<iostream>
using namespace std;
/*
һع÷
ںУβںòĻԲβֻ֣ͣ(ԭ)Ҳ
ͷŵ֮ǰǰ÷
C++11ú÷ͣںͺУдڲб֮
auto func(int a, int b) ->void auto־Ϊ÷ֵͣǴ->֮ʼ
ǰinlineͨͱ
úԴСǵкƵ
1.inlineӰڱinlineֺдϵͳԽøúĵö滻Ϊ壬
int func(){
return 1;
}
int abc = func(5) εʱϵͳͻ᳢ʹint abc = 1 ԭ
2.inlineֻǿ߶ԱĽ飬ԳȥҲԲȥȡں... | true |
9a46fa058f8f6301e7800342f6c6c1554b5d1113 | C++ | voivoid/ComObjectSample | /ComObject/arithmetics_factory.cpp | UTF-8 | 1,614 | 2.640625 | 3 | [
"MIT"
] | permissive | #include "stdafx.h"
#include "arithmetics_factory.h"
#include "arithmetics_impl.h"
#include <memory>
namespace
{
std::atomic_size_t g_instances = 0;
std::atomic_size_t g_locks = 0;
}
CoArithmeticsFactory::CoArithmeticsFactory() : m_references( 0 )
{
++g_instances;
}
CoArithmeticsFactory::~CoArithmeticsFactory... | true |
8cae40166f632c29864bd6874107d4e055548258 | C++ | jmcarter17/Primes | /tests/testListPrimesUpToANumber.cpp | UTF-8 | 1,190 | 3.1875 | 3 | [] | no_license | #include <CppUTest/TestHarness.h>
#include <list>
#include "PrimeLister.h"
TEST_GROUP(PrimeLister){
PrimeLister pl;
std::list<int> listOfPrimes;
void setup(){
listOfPrimes.clear();
}
void checkListOfPrimesUpTo(int number, std::list<int> list){
pl.sieve(number);
listOfPrime... | true |
5cf24323ea1b51c1323e7639767a85c4d482ba36 | C++ | lgarczyn/Abstract-VM | /src/Operands/Operand.hpp | UTF-8 | 3,060 | 2.90625 | 3 | [] | no_license | #pragma once
#include "Exceptions/VMException.hpp"
#include "IOperand.hpp"
#include "Libs/SafeInt.hpp"
#include <string>
typedef SafeInt<int8_t> safe_int8;
typedef SafeInt<int16_t> safe_int16;
typedef SafeInt<int32_t> safe_int32;
// Implements all operations on the logical level
class AOperand : public virtual IOper... | true |
24e993f57d6a584132f54c16bf25b8f564d24e76 | C++ | colinrlly/Automatic_Plant_Watering_Machine | /first_water_machine/first_water_machine.ino | UTF-8 | 806 | 3.359375 | 3 | [] | no_license | int motorPin = A0; // pin that turns on the motor
int watertime = 90; // how long to water in seconds
int waittime = 4320; // how long to wait between watering, in minutes
void setup() {
pinMode(motorPin, OUTPUT); // set A0 to an output so we can use it to turn on the transistor
pinMode(LED_BUILTIN, OUTPUT); //... | true |
8034f46b694384dc25f7c7ac35e65b8469ea37ba | C++ | hyoilll/hong_cplusplus | /chapter2-3/main.cpp | UHC | 771 | 3.59375 | 4 | [] | no_license | /*
ʺ c++ 11 <cstdint>
ּ ϰ ֱ ü ٸ ִ.
ȮǼ ذϱ Ȱ ϴ ' ʺ '
*/
#include <iostream>
int main()
{
using namespace std;
std::int16_t i(5); //16bit Ҵϰڴ. = short
std::int8_t myint = 65; //8bit ҴѴ. = char
cout << myint << endl; //A
cout << sizeof(i) << endl; //2bytes
cout << sizeof(myint) << endl; //1byte... | true |
bf6654b1ca91fe245dbbf52a20d89d07509d1cb5 | C++ | jasonfan1997/convexoptimization | /project (1)/DENSE_DATA_READ.h | UTF-8 | 1,317 | 2.890625 | 3 | [] | no_license | #ifndef DENSE_DATA_READ_H
#define DENSE_DATA_READ_H
#include <fstream>
#include <cstring>
#include <string>
#include <cstdlib>
#include<vector>
#include <stdlib.h>
#include "Matrix.h"
using namespace std;
void DataGen(int m, int n, string &pathname)
{
Matrix A(m,n);
Matrix b(m,1);
for(int i = 0; i < m; i++)
{
... | true |
6e8752434dfd8d63a352a1524dd4f0ec95ed9608 | C++ | PatiVioleta/Graph-Data-Structure-And-Algorithms | /Graph Data Structure And Algorithms/Huffman/main.cpp | UTF-8 | 3,055 | 2.6875 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;
ifstream f("in");
ofstream g("out");
char s[100],copie[100];
int k,nrCaractere;
struct NOD{
char ch='*';
int st=-1;
int dr=-1;
int fr=0;}nod[100];
struct compara{ bool operator()(NOD x, NOD y) {return x.fr > y.fr;}};
pri... | true |
2457bce72934c9a2a423e7f060f110683d6178ab | C++ | eknaepen/NP | /Candy-Crush-NP/candy_field.h | UTF-8 | 434 | 2.65625 | 3 | [] | no_license | #ifndef CANDY_FIELD_H
#define CANDY_FIELD_H
#include "random_candy.h"
#include "field.h"
class Candy_Field : public Field
{
public:
Candy_Field() : rand(new Random_candy){} // get a new random_candy
virtual ~Candy_Field(){delete rand;}
unsigned char setsign(){ // asign the sign to fill grid
... | true |
81bcbbcee5e3b38d9c4db29fb06d8122da4b2463 | C++ | eli-schwartz/sysdig | /userspace/libsinsp/async_container.h | UTF-8 | 2,964 | 2.671875 | 3 | [
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
Copyright (C) 2019 Draios Inc dba Sysdig.
This file is part of sysdig.
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 applica... | true |
0be5557edc73760e506585d04768c2303e09d88b | C++ | kaikai4n/leetcode_practice | /problems/200-300/207/2021_04_17.cpp | UTF-8 | 1,697 | 3.03125 | 3 | [] | no_license | /*
* https://leetcode.com/problems/course-schedule/
* DFS Search: time: O(V + E), space: O(V + E)
* Runtime: 24 ms, faster than 43.26% of C++ online submissions
* Memory Usage: 17.4 MB, less than 7.52% of C++ online submissions
*/
class Solution {
public:
bool canFinish(int numCourses, vector<vector<int>>& pre... | true |
46d11c4f4703b705da27330b098c68d60042d4ac | C++ | moves-rwth/carl-storm | /src/carl/core/DivisionResult.h | UTF-8 | 371 | 3.125 | 3 | [
"MIT"
] | permissive | /**
* @file DivisionResult.h
* @author Sebastian Junges
*
*/
#pragma once
namespace carl
{
/**
* A strongly typed pair encoding the result of a division,
* being a quotient and a remainder.
*/
template<typename Type>
struct DivisionResult
{
public:
DivisionResult(const Type& q, const Type& r) :
quotie... | true |
8533151ac05eb4021a8fe44797e4c8f92d0b5b2e | C++ | devaar100/SudokuSolver | /sudoku_solver.cpp | UTF-8 | 1,441 | 2.75 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int sudoku[9][9];
int grids[9];
int rows[9];
int cols[9];
bool done=false;
int MAX=(1<<11)-1;
void print(){
for(int i=0;i<9;i++){
for(int j=0;j<9;j++)
cout<<sudoku[i][j]<<" ";
... | true |
8f1eaffae57bf7eee20278f6672a364643c2fe3d | C++ | ProshantaDebnath/CP-chapter | /C++/Basic/Array/4.Program to search for an element in an array using linear search.cpp | UTF-8 | 587 | 3.9375 | 4 | [] | no_license |
#include<iostream>
using namespace std;
int linearsearch(int arr[], int x,int n){
int i;
for(i = 0; i < n; i++)
if(arr[i]== x)
return i;
return -1;
}
int main(){
int arr[] = { 2, 3, 4, 10, 40 };
int n = sizeof(arr) / sizeof(int);
int x;
cout << "Enter the element want to se... | true |
5c3644f02c21ae4c563a76f51c2d0308129bd7f5 | C++ | ideahitme/contest | /hackerearth/thoughworks/points/code.cpp | UTF-8 | 1,408 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll sum_in_range(int l, int r, vector<ll> &prefix){
if (l == 0) return prefix[r];
else return prefix[r] - prefix[l-1];
}
bool is_prime(int n){
if (n == 2) return true;
bool is = true;
int s = floor(sqrt(n)) + 1;... | true |
adbfb07bde1d0bd2e9e9c715ab9149b7a65da104 | C++ | CarlRaymond/TCS3200 | /colorsample/hsv.cpp | UTF-8 | 1,036 | 3.15625 | 3 | [] | no_license | #include "hsv.h";
#include "math.h";
HSV::HSV(int h, unsigned int s, unsigned int v) {
this->h = h;
this->s = s;
this->v = v;
}
HSV::HSV() : HSV(0, 0, 0) {
}
void HSV::fromScaledRGB(unsigned int scale, unsigned int r, unsigned int g, unsigned int b, HSV &out) {
// scale is the maximum range of r, g, b.
// Fin... | true |
089b37fefac1ceee934c73e75e9d987d78ea22cd | C++ | zeikar/Break-Bricks-3D | /BreakBricks3D/BreakBricks3D/GameLevelManager.cpp | UHC | 1,405 | 2.953125 | 3 | [] | no_license | #include "GameLevelManager.h"
#include "GameObjectManager.h"
void GameLevelManager::init()
{
ifstream levelDataFile("Data\\level.txt");
if (!levelDataFile)
{
cout << "Cannot read level.dat File!!" << endl;
return;
}
// ʱȭ
levelDataFile >> totalLevel >> mapHeight >> mapWidth;
for (int i = 0; i < totalLev... | true |
7428acd500a2621c235250ee935c833946bb35da | C++ | benedicka/Competitive-Programming | /UVA/11057/12642592_AC_900ms_0kB.cpp | UTF-8 | 701 | 2.953125 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int n,price[10000],m,ans1,ans2,min;
while (scanf("%d",&n)!=EOF)
{
for (int i=0;i<n;i++)
{
scanf("%d",&price[i]);
}
scanf("%d",&m);
for (int i=0;i<n;i++)
{
for (int j=i+1;j<n;j++)
{
if (price[i]>price[j])
{
int swap;
swap=price[i];
price[i]... | true |
a6659c50049f0d01bc5065b6fcc46f605fdf37a9 | C++ | staryzhu/myTest | /testmmv.cpp | UTF-8 | 547 | 2.78125 | 3 | [] | no_license | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(){
char str[15] = "abcdefghi";
char *dest = &(str[3]);
char *p = (char *)malloc(sizeof(char) * 1024);
memcpy(p, str, 10);
printf("p addr : %x\n", p);
p = (char *)realloc(p, sizeof(char) *2048);
printf("p raddr: %x\n", p);
printf("src : %s\n",... | true |
02647030d0d34cec7f2ce2fc1c7178238ff249a5 | C++ | NazmulHayat/Competitive-Programming | /CodeForces And Random Practice Problems/matchingbrackets.cpp | UTF-8 | 861 | 2.796875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;\
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
char f1 = '(';
char f2 = ')';
char s1 = '[';
char s2 = ']';
char t1 = '{';
char t2 = '}';
int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0, cnt5 = 0, cnt6 = 0;
string s;
c... | true |
a4abd20d6f9926077865bac93c997f2eb33b81b2 | C++ | ShadmanShihab/UVA-Solutions | /uva 10127 Ones(bigmod) .cpp | UTF-8 | 633 | 3.015625 | 3 | [] | no_license | ///uva 10127 Ones(bigmod)
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll BigMod(ll n, ll p, ll m)
{
if(p==0)
return 1;
if(p % 2 == 0)
{
ll ret = BigMod(n, p/2, m);
return ((ret%m) * (ret%m)) %m;
}
else
return ((n%m) * (BigMod(n, p-1, m) %m)... | true |
8bd4825ae7401092c44ff1cf48e13ad5d973a046 | C++ | networkit/networkit | /networkit/cpp/components/RandomSpanningForest.cpp | UTF-8 | 1,403 | 2.65625 | 3 | [
"MIT"
] | permissive | /*
* RandomSpanningForest.cpp
*
* Created on: 06.09.2015
* Author: Henning
*/
#include <unordered_set>
#include <networkit/components/ConnectedComponents.hpp>
#include <networkit/components/RandomSpanningForest.hpp>
#include <networkit/graph/GraphTools.hpp>
namespace NetworKit {
RandomSpanningForest::Ran... | true |
c7df2cd02d3d91cde62e36753ee96c129d9603f7 | C++ | Xylot/Labs | /Lab 8/Data Files/sample_binary1_soln.cpp | UTF-8 | 4,401 | 3.84375 | 4 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
/* this program reads a sequence of 8 binary bytes of data into an int array
and prints them out. The data is output in both decimal and hex.
It then rewinds the file to the beginning, and reads the same binary data
into a ch... | true |
67180052c21010d8f63adf8246a378baf5bc3e8e | C++ | Rhysoshea/Algos | /Data_Structures/week6_binary_search_trees/my_is_bst_hard.cpp | UTF-8 | 3,885 | 3.046875 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#if defined(__unix__) || defined(__APPLE__)
#include <sys/resource.h>
#endif
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using namespace std;
struct Node {
long long int key;
long long int left;
long long int ... | true |
751de7f223370fb93d7c9fe6ae16953269539b1a | C++ | huynguyen1212/bttin | /bttin/9.lagestsmallern.cpp | UTF-8 | 656 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main (){
int t;
cin>>t;
while(t--){
string s;
cin>>s;
if(s.size()==1){
cout<<"-1";
}
else{
int n=s.size();
int i=n-2;
while(i>=0 && s[i]<s[i+1]) i--;
if(i==-1){
cout<<"-1";
}
else{
int k=n-1;
while(s[k]>s... | true |
b5e2f00115c66c26480e0ec6d18b180d0f0aa87e | C++ | kkangzzoo/GoF | /Adapter/src/ObjectAdapter.cpp | UTF-8 | 1,463 | 3.28125 | 3 | [] | no_license | /*
* ObjectAdapter.cpp
*
* Created on: 2018. 1. 2.
* Author: daum
* Description: Object Adapter 패턴에 의한 TextShape 클래스의 구현 및 활용 예
* nonAdapter) 객체의 자료형이 다름. -> 객체의 자료형 통일 -> Shape클래스의 자료형으로 통일
* TextShape와 같은 이름으로 Shape클래스의 하위 클래스로 정의 -> Shape 클래스와 동일한 인터페이스를 갖음.
*
* ... | true |
be44badbdfdbbb3f137fb42a808026186e22ed60 | C++ | carmaselli/Server_Client_simulator | /Client/Client.cpp | UTF-8 | 3,097 | 2.703125 | 3 | [] | no_license | #include "Client.h"
using namespace std;
Client::Client()
{
IO_handler = new boost::asio::io_service();
socket_forClient = new boost::asio::ip::tcp::socket(*IO_handler);
client_resolver = new boost::asio::ip::tcp::resolver(*IO_handler);
error_.type = N_ERROR;
file = fopen("webService.txt", "wb");
if (file == N... | true |
e09c89cd408b6f742fa1cd26fb2226d1962edec5 | C++ | tskirilowa/Project | /Store/Product.h | UTF-8 | 1,358 | 3.109375 | 3 | [] | no_license | #pragma once
# include<iostream>
#include"Warehouse.h"
#include"Date.h"
class Product
{
private:
char name[32];
Date expiryDate;
Date dateAraival;
char manufacturer[32];
double unit;
int quantity;
Warehouse location;
char comment[264];
void copy(const Product& other);
public:
Product();... | true |
170133276e4723d8811cb41fea1deb23821aa4f5 | C++ | gro-mit/LeetCode | /537 Complex Number Multiplication.cpp | UTF-8 | 592 | 2.921875 | 3 | [] | no_license | class Solution {
public:
vector<int>toInt(string a){
int plus=int(a.find('+',1));
int r=atoi(a.substr(0,plus).c_str());
int v=atoi(a.substr(plus+1,a.length()-plus-2).c_str());
return vector<int>({r,v});
}
string complexNumberMultiply(string a, string b) {
if(a==""||b=... | true |
d9bacb2f7195d9311ab1f354dc3d0c226e740b7d | C++ | Enigma228322/NeuralNetwork | /NeuralNet1/Layer.h | UTF-8 | 1,174 | 3.671875 | 4 | [] | no_license | #pragma once
#include <vector>
struct Layer
{
Layer() {}
Layer(int size_)
{
size = size_;
}
Layer(int size_,const std::vector <double> &values_)
{
size = size_;
values = values_;
}
void operator=(const Layer &other)
{
size = other.size;
values.resize(size);
for (int i = 0; i < size; i++)
{
v... | true |
ac49c6945e8a65b6485dc57968542c4196fd28f8 | C++ | Lutila243/C- | /programs/exam 2/exam2-16.cpp | UTF-8 | 742 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include<cmath>
#include<fstream>
#include<iomanip>
using namespace std;
int main()
{
int num=0;
float gal;
float lit;
lit= 3.785;
cout<<"\nEnter the gallon(s)? to convert to liter ";
cin>>gal;
cout<<fixed<<showpoint<<setprecision(3)<<endl;
cout<<"\tnum"<< s... | true |
875ee931d177fb2616a90f710f89d5764c1ad501 | C++ | fireairforce/CPPalgorithm | /pat/1076.cpp | UTF-8 | 838 | 2.5625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e3+7;
struct code
{
string a;
string b;
string c;
string d;
}q[maxn];
int main()
{
int n,emm2[maxn]={0},zoom=0;
map<char,int>emm1;
emm1['A']=1;
emm1['B']=2;
emm1['C']=3;
emm1['D']=4;
scanf("%d",&n);
for(int i=0;i<n;... | true |
728a943ecefc247b8c88ba2773d45fe369147a35 | C++ | jazzy28/DSA-using-CPP | /introduction/14-if-else-if.cpp | UTF-8 | 644 | 4.15625 | 4 | [] | no_license | #include <iostream>
using namespace std;
// ! operator: negates the condition
int main()
{
bool isFemale = false;//stores a true or a false value
bool isTall = false;
if(isFemale) // is its true, then inner code will be executed
{
cout << "You are a tall female" << endl;
}
else if (isFem... | true |
6ce41801366d32fb51d8d3eb8a786f2c6dc47fc9 | C++ | LXMKevince/LXMKevince.github.io | /Arduino/libraries/Ciao/examples/CiaoBluemixMQTT/CiaoBluemixMQTT.ino | UTF-8 | 1,351 | 2.53125 | 3 | [
"MIT"
] | permissive | /*
Arduino Ciao example
This sketch uses Ciao mqtt connector. Sketch sends via MQTT brightness and temperature information that will be shown graphically in the blueMix IBM system.
Upload your sketch an than connect to the webpage:
https://quickstart.internetofthings.ibmcloud.com/#/device/BlueMixTest902345/se... | true |
a54001c0f5e6e8b0f3164cc43eb292fd418166cb | C++ | MarkOates/ncurses-art | /src/Quiz.cpp | UTF-8 | 708 | 3.046875 | 3 | [] | no_license |
#include <Quiz.hpp>
#include <random>
#include <random>
#include <algorithm>
Quiz::Quiz(std::vector<Question> questions)
: questions(questions)
{
}
Quiz::~Quiz()
{
}
void Quiz::set_questions(std::vector<Question> questions)
{
this->questions = questions;
}
std::vector<Question> Quiz::get_questions()
{... | true |