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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d1f449f09b3d7f5bebe4befc7bf0ec970f7418d8 | C++ | yingziyu-llt/OI | /c/北大题库/1.7/17 字符串判等 hash.cpp | UTF-8 | 862 | 2.921875 | 3 | [] | no_license | #include<algorithm>
#include<string.h>
#include<stdio.h>
using namespace std;
#define bigprime 233317
unsigned long long hashf(char s[])
{
int i = 0,len = strlen(s);
unsigned long long ans = 0;
while(i < len)
{
ans = ans * bigprime + (s[i] - 'A' + 1);
i++;
}
return ans;
}
int main()
{
cha... | true |
251412f91123e6a460775dd4b6b0831b37e13be0 | C++ | V-vp/SPOJ | /last_digit_revisited.cpp | UTF-8 | 668 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
ll ModularExponentiaion(ll x,ll n,int p=10)
{
ll ans=1,temp=x%p;
while(n)
{
if(n&1)
{
ans=(ans*temp)%p;
}
... | true |
f69d8f72dd5a0e9b7c277c36676034454458ffd9 | C++ | ping28198/Thailand_projects | /Projects/ImgprcOCRInstance3.0_0518/ImgprcOCRInstance/Timer.cpp | GB18030 | 2,705 | 2.5625 | 3 | [] | no_license | // Timer.cpp
/*************************
20130827: Timer::Start()һڴݵ̵߳Ķָ
Timer::Start()->Timer::Start(DWORD_PTR dwUser)
************************/
#include "stdafx.h"
#include "Timer.h"
//
Timer::Timer(long p, int id, BOOL r, LPTIMECALLBACK fservice)
{
Init();
lPeriod=p;
wUserID=id;
bRepeat=r;
lpFunction=fservic... | true |
f47b0c7a963c79be7bb8fa298981080cd4248b5d | C++ | orangezeit/leetcode | /CPP/0501-0600/0519-Random-Flip-Matrix.cpp | UTF-8 | 599 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | class Solution {
private:
unordered_set<int> record;
int n, c;
public:
Solution(int n_rows, int n_cols) {
c = n_cols;
n = n_rows * n_cols;
}
vector<int> flip() {
int k;
do {
k = rand() % n;
} while (record.find(k) != record.end());
reco... | true |
70fce16a26fad58eec9b1740ce301b08b8578460 | C++ | ArutoriaWhite/Competitive-programming | /zojc296.cpp | UTF-8 | 206 | 2.640625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int n, m, k;
int f( int n, int k)
{
if (k==0) return 0;
return (f(n-1,k-1)+m%n)%n;
}
int main() {
cin >> n >> m >> k;
cout << f( n, k)+1 << '\n';
return 0;
}
| true |
8e0e3aad530620a308fe6995b5fcb0a9e718d901 | C++ | cratas/dfs-bfs-graph-iterator | /ALG_project-master/Graph_iteratpr/BFSIterator.cpp | UTF-8 | 1,618 | 2.875 | 3 | [] | no_license | #include "BFSIterator.h"
BFSIterator::BFSIterator(Graph* graph)
{
this->graph = graph;
this->verticesCount = graph->GetVerticesCount();
this->minValue = graph->GetMinValue();
isDone = new bool[verticesCount];
for(int i = 0; i < verticesCount; i++)
{
isDone[i] = false;
}
}
BFS... | true |
ece17ece24bc645bb67dc45f1de82b186ed4ff51 | C++ | KB9/BraccioVisualAttention | /environment_analysis/FocusMapper.hpp | UTF-8 | 491 | 2.875 | 3 | [] | no_license | #ifndef _GAUSSIANMAP_H_
#define _GAUSSIANMAP_H_
#include <unordered_map>
#include <vector>
struct FocusPoint
{
float x, y, z;
float radius;
FocusPoint(float x, float y, float z, float radius) :
x(x), y(y), z(z), radius(radius) {}
};
class FocusMapper
{
public:
FocusMapper();
void add(float x, float y, float... | true |
b10777f7ee1947427a20789dee14ba91ae3afb5f | C++ | arron-tij/ArabicCompetitiveProgramming | /18-Programming-4kids/11_homework_1_answer_TODO_1-7.cpp | UTF-8 | 559 | 3.078125 | 3 | [] | no_license | // By Basel Bairkdar: https://www.facebook.com/baselbairkdar
#include<iostream>
using namespace std;
string input,str;
int main()
{
cin >> input >> str;
bool is_prefix=1; /** we will say that it's prefix at the beginning **/
int n=str.size();
/**
check if str is eqaul
to the first n le... | true |
22dc1fbf3bc3af014f6e3d05e940f80225cf2e5a | C++ | WickedShell/zubax_chibios | /zubax_chibios/platform/stm32/flash_writer.hpp | UTF-8 | 2,850 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
* Copyright (c) 2015 Zubax, zubax.com
* Distributed under the MIT License, available in the file LICENSE.
* Author: Pavel Kirienko <pavel.kirienko@zubax.com>
*/
#pragma once
#include <ch.hpp>
#include <hal.h>
#include <cassert>
#include <cstring>
#include <cstdint>
#if !defined(FLASH_SR_WRPRTERR)
# define FLA... | true |
2d1cde20233205c61880bda8a59e8b27caa2062c | C++ | VittalT/USACO-Solutions | /Silver/US Open 2019, Silver/US Open 2019, Silver P1/US Open 2019, Silver P1/main.cpp | UTF-8 | 2,060 | 2.65625 | 3 | [] | no_license | /*
ID: vittalt
TASK: leftout
LANG: C++
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <deque>
#include <queue>
using namespace std;
int N;
string cows[1000];
vo... | true |
b1ab6bcdb82738101e3b17b0e82647bb86e59896 | C++ | JianHangChen/LeetCode | /Lint130. Heapify.cpp | UTF-8 | 2,927 | 3.40625 | 3 | [] | no_license |
//!!! sol2, my shiftdown, O(n), O(1), iteratively
class Solution {
public:
void heapify(vector<int> &A) {
int n = A.size();
for(int i = n/2 - 1; i >= 0; i--){
shiftDown(i, A);
}
}
void shiftDown(int i, vector<int>& A){
int n = A.size();
while(i < n){
... | true |
078317a9737e89850f25b6d8211ad75fee5933c3 | C++ | a-nikolaev/a-nikolaev.github.io | /cpp-spring-2015/lab/13/demo2/main.cpp | UTF-8 | 330 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include "intset.h"
using namespace std;
int main () {
IntSet s;
s.empty();
s.add(10);
s.add(20);
s.add(15);
s.add(5);
s.add(5);
s.add(15);
s.add(7);
s.remove(15);
for(int i = 0; i < 25; i++) {
cout << i << " ";
if (s.member(i)) cout << "yes";
cout << en... | true |
bde0615b48157dbe5a3db32b17f5a23d0304f9c4 | C++ | akstraw/PokerAI | /game/deck.cpp | UTF-8 | 785 | 3.484375 | 3 | [] | no_license | #include "deck.h"
#include "card.h"
#include <chrono>
#include <algorithm>
#include <random>
//create standard 52 card deck
void Deck::fill()
{
for (int suit = CLUB; suit <= SPADE; suit++)
{
for(int rank = TWO; rank <= ACE; rank++)
{
cards.push_back( Card{ static_cast<Rank>(rank), s... | true |
7bec6e1e01fd16793e416c00d431f725473022f7 | C++ | ssyzkhan/mixCode | /cppex/res/mainDijkstra.cpp | UTF-8 | 354 | 2.515625 | 3 | [] | no_license | #include"dijkstra.h"
int main(int argc, char** argv){
pair<double*, int*> r;
double a[]={0,10,0,5,0,
0,0,1,2,0,
0,0,0,0,4,
0,3,9,0,2,
7,0,6,0,0
},*d;
int *pi,i,s=0,n=5;
r=dijkstra(a,n,s);
d=r.first;
pi=r.second;
for(i=0;i<n;i++){
if(i!=s){
printPath(pi,s,i);
cout<<endl<<d[i]<<endl;
... | true |
3c73d9c86828d69039914805878409653e7c74ff | C++ | derrick0714/web_search_engine | /indexing/src/generating/analysis_ctrl.cpp | UTF-8 | 8,283 | 2.6875 | 3 | [] | no_license | #include "analysis_ctrl.h"
#include <sys/stat.h>
#include <iostream>
using namespace std;
#define INDEX_CHUNK 409600 //50KB
#define DATA_CHUNK 20971520 //2.5MB
analysis_ctrl::analysis_ctrl()
{
_dataset_path = "./dataset/";
_file_start = 0;
_file_end = 82;
_file_now = _file_start;
_doc_id = 1;
... | true |
04dd6c9888f8ab79f83723c095d771b11f7bea00 | C++ | InsightSoftwareConsortium/ITK | /Modules/Core/Common/include/itkAnnulusOperator.hxx | UTF-8 | 5,407 | 2.609375 | 3 | [
"IJG",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"SMLNJ",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"LicenseRef-scancode-free-unknown",
"Spencer-86",
"LicenseRef-scancode-llnl",
"FSFUL",
"Libpng",
"libtiff",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
... | permissive | /*=========================================================================
*
* Copyright NumFOCUS
*
* 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
*
* https://www.apache.o... | true |
7499cb0ac09141c50c56c0d5dd0cbe89a81759fa | C++ | pitybea/pmss | /pms/PyramidMatchScore/PMS.h | UTF-8 | 2,982 | 2.53125 | 3 | [] | no_license | #include <vector>
#include <string>
#include <map>
#include <math.h>
using namespace std;
template<class T>
static void prshl(vector<T> p,int n,vector<int>& index)
{
int k,j,i;
T t;
int ii;
k=n/2;
while(k>0)
{
for(j=k;j<=n-1;j++)
{
t=p[j]; ii=index[j]; i=j-k;
while((i>=0)&&(p[i]>t))
{
p[i+k]=p... | true |
c811cba2a28610de5667cc1a148bde2a9cf2a5b2 | C++ | aiekick/engine | /src/modules/voxel/polyvox/Picking.h | UTF-8 | 1,980 | 3.140625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "core/Common.h"
#include "core/Trace.h"
#include "Voxel.h"
#include "Picking.h"
#include "Raycast.h"
namespace voxel {
/**
* @brief A structure containing the information about a picking operation
*/
struct PickResult {
PickResult() {
}
/** Did the picking operation hit anything */
bool ... | true |
4c71e24a4e5896e178fe2796ab4b1c7df051449d | C++ | praesepe/study | /leetcode/067-Add-Binary/lala.cpp | UTF-8 | 589 | 3.203125 | 3 | [] | no_license | #include <string>
using namespace std;
class Solution {
public:
string addBinary(string a, string b) {
// filling leading zero
if (a.size() > b.size()) {
b = string(a.size() - b.size(), '0') + b;
} else if (b.size() > a.size()) {
a = string(b.size() - a.size(), '0') + a;
}
// added
bool carry = fa... | true |
7dc288caf96e2ae6d69e4c1e3bdd54412a7025a5 | C++ | alongoria/mines | /CSCI261_programming_concepts_c++/29_trollBattle/src/battle.cpp | UTF-8 | 561 | 3.46875 | 3 | [] | no_license | #include "battle.h"
#include <iostream>
using namespace std;
void fight(Troll &A, Troll &B) {
cout << A.name << " is fighting " << B.name << "!" << endl;
while (A.health > 0 || B.health > 0) {
if (A.health > 0) {
A.attack(B);
B.health -= A.strength;
}
else {
break;
}
if (B.health > 0) {
B.att... | true |
ad39fce83f42ec330b695d50cc10a717d1266776 | C++ | jjcomline/laser-arduino | /laser.ino | UTF-8 | 637 | 2.6875 | 3 | [] | no_license | int giallo = 4;
int pulsante = 7;
int transistor = 5;
int stato=0; // All'inizio il sistema è spento.
int val=0; // Memorizza il valore dello stato tra un ciclo e l'altro
int luce;
void setup() {
pinMode(giallo, OUTPUT);
pinMode(transistor, OUTPUT);
pinMode(A0,INPUT);
}
void loop() {
val = digital... | true |
b5154f8b5a3ba1861dae4a25757af98884354ba8 | C++ | RieLCho/Speaka | /Speaka/Speaka.cpp | UTF-8 | 1,587 | 2.96875 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include "../SpeakaLib/SpeakaLib.h"
void usage()
{
printf("Speaka (https://github.com/sokcuri/speaka)\n");
printf("Easy switch to default audio device\n");
printf("\n");
printf("usage:\n");
printf("Speaka [FormFactor] [Sequence]\n");
printf("\n");
printf("[FormFactor]: Specifies t... | true |
57977ad937ac95c974257c0bdae0e553d5033b68 | C++ | PLomax/k9code | /k9ControlPanel/k9ControlPanel.ino | UTF-8 | 5,142 | 2.765625 | 3 | [] | no_license |
/*
* Version 1.0
* 2-12-2017
*/
#include <Wire.h>
#include <Math.h>
#include <String.h>
const int ROW1 = 11;
const int ROW2 = 12;
const int ROW3 = 13;
const int COL1 = 4;
const int COL2 = 5;
const int COL3 = 6;
const int COL4 = 7;
const int LASEROUT = 97; //a
const int EARS = 98; //b
const int TAIL = 99; ... | true |
35ef19ad2a3a870d7125b5411a010baa1b74e283 | C++ | Sorally/ColorShop | /ColorFunctions.cpp | UTF-8 | 5,515 | 2.96875 | 3 | [] | no_license | #include "ColorFunctions.h"
#include <math.h>
/****************************************************************************
* rgb2hsb()
*
*
****************************************************************************/
void rgb2hsb(BYTE r, BYTE g, BYTE b, HSB* hsb)
{
float x, f, i, hue, sat, bright;
x = min( min(... | true |
6dc7f47de5e316f7c4d5383268f363fa044ccdf2 | C++ | JasonDeras/P3Lab4_JasonDeras | /Edificios.cpp | UTF-8 | 1,493 | 3.34375 | 3 | [
"MIT"
] | permissive | #include<iostream>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#ifndef EDIFICIOS_CPP
#define EDIFICIOS_CPP
using namespace std;
class Edificios{
private:
string nombre;
int precio_base;
int produccion_base;
protected:
public:
Edificios(){
nombre="";
precio_base=0;
prod... | true |
b680d5e2a86f35e11d1f251e8236c1c90988b33a | C++ | ruiwng/program | /PAT/data_structure_2015/04-3.cpp | UTF-8 | 2,610 | 3.5625 | 4 | [] | no_license | #include <stdio.h>
#include <algorithm>
using namespace std;
struct node
{
int element;
node *parent;
int depth;
node *left_child;
node *right_child;
node(int e=0,node *p=NULL):element(e),parent(p),depth(1),left_child(NULL),right_child(NULL){}
};
inline int get_depth(node *p)
{
return p==NULL... | true |
05f3618c93fa9fad141adff5f1021dd989ed2600 | C++ | BarbaraWitt/arduino | /aula11/jogoDeCartasArray/jogoDeCartasArray.ino | UTF-8 | 456 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Estudo do Array vetor - Jogo de Cartas
* @author BabbyWitt
*/
void setup() {
Serial.begin (9600);
String faces [] = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
String naipes [] = {"♦","♠","♥","♣"};
randomSeed(analogRead(A0));
int f = random(13);
int n = random(4);
Serial... | true |
77aa510e4e45c54e1b51db0b40a5ee97ddd354b4 | C++ | m-taku/sotuken | /GameTemplate/Game/graphics/Primitive.cpp | UTF-8 | 1,146 | 2.765625 | 3 | [] | no_license | #include "stdafx.h"
Primitive::Primitive()
{
}
Primitive::~Primitive()
{
Release();
}
void Primitive::Release()
{
m_vertexBuffer.Release();
m_indexBuffer.Release();
}
bool Primitive::Create(
D3D_PRIMITIVE_TOPOLOGY topology,
int numVertex,
int vertexStride,
void* pSrcVertexBuffer,
int numIndex,
IndexBuffe... | true |
27eea3c087dc0aed44c1266e2274205c153de91d | C++ | xieyangxu/TryQS | /linear_combiner.cpp | UTF-8 | 2,133 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <time.h>
#include <set>
#include <string.h>
#include "linear_combiner.h"
using namespace std;
/*just tool func*/
void boolxor(bool* t,bool* s, long size){
for(long i=0;i<size;++i)
t[i]=(t[i]!=s[i]);
}
/*
randomly choose D_P+1 vectors and u... | true |
34fcb465918a9773f95b8bd534ec2597e886c2d8 | C++ | epfl-mobots/particle-simu | /src/tools/filesystem.cpp | UTF-8 | 905 | 2.5625 | 3 | [] | no_license | #ifndef SIMU_TOOLS_FILESYSTEM_HPP
#define SIMU_TOOLS_FILESYSTEM_HPP
#include <boost/date_time.hpp>
#include <boost/filesystem.hpp>
namespace simu {
namespace tools {
std::string timestamp()
{
char date[30];
time_t date_time;
time(&date_time);
strftim... | true |
66d6f57ad72ac387b2c396a2bb0d1805191b8f17 | C++ | Seoui/Cuphead-imitation | /Cuphead/Objects/VenusSeed.h | UTF-8 | 595 | 2.59375 | 3 | [] | no_license | #pragma once
#include "EnemyObject.h"
enum class VENUS_SEED_STATE { Fall, Grow };
class VenusSeed : public EnemyObject
{
public:
VenusSeed(Vector2 _position, Vector2 _scale = Vector2(1, 1));
~VenusSeed() = default;
public:
void Update(Matrix& V, Matrix& P) override;
void Render() override;
public:
void Play(VE... | true |
73a30cb8b507755666ed1606f85a7f814eb1ed23 | C++ | dulvinrivindu/HackerRank | /C++/Strings/attribute.cpp | UTF-8 | 1,551 | 3.109375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <regex>
using namespace std;
struct dict{
string key;
string value;
};
struct tag{
struct tag* parent = NULL;
string name;
vector<dict> attributes;
vector<tag> children;
};
string get_tag(string inString)... | true |
c5466dfed3fa6912730973f4db170c2b40b6e347 | C++ | durgesh0187/C-plus-plus-Programming | /Integer_convert_in_string.cpp | UTF-8 | 369 | 3.125 | 3 | [] | no_license | #include<bits/stdc++.h>
#include<sstream>
using namespace std;
int main()
{
int n=2345;
// declear output string stream
ostringstream str1;
// sending integer as a stream into ostringstream
str1<<n;
// declare string variable
string s = str1.str();
// output of the string
cout<<"ou... | true |
6d0be64c3c062e7be834f8d7ab74b95c6e5fddfb | C++ | Apex5803/hailstorm | /src/Commands/Autonomous_Commands/GearAndBallsRed.cpp | UTF-8 | 1,275 | 2.65625 | 3 | [] | no_license | /*
* GearAndBallsRed.cpp
*
* Created on: Apr 21, 2017
* Author: Apex5803
*/
#include <Commands/Autonomous_Commands/GearAndBallsRed.h>
GearAndBallsRed::GearAndBallsRed() {
// TODO Auto-generated constructor stub
AddSequential(new TankDrive(-.6), 2);
//printf ("Drove toward gearer /n");
AddSequential(n... | true |
42f91aa92064f491532acb6ab576b3dc5f19d32e | C++ | mardrey/Eda031 | /program/server/on_disc_database.cc | UTF-8 | 14,697 | 2.671875 | 3 | [] | no_license | #include "on_disc_database.h"
#include <string>
#include "news_group.h"
#include "article.h"
#include "database.h"
#include <dirent.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include "article.h"
#include <stdio.h>
namespace database{
std::string int_to_st... | true |
03b602dcc808f7d4395f57f148c48dfd601a4217 | C++ | austinkeil/CTCI | /2-7-b.cpp | UTF-8 | 1,678 | 3.984375 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* next;
};
Node* NewNode(int data) {
Node* n = new Node();
n->data = data;
n->next = nullptr;
return n;
}
Node* Insert(Node* head, int data) {
Node* temp = NewNode(data);
if (head == nullptr) {
return t... | true |
fa6f56a5967c42cd42464326dceb939b5af6692c | C++ | mrnoelle/Chess | /Knight.cpp | UTF-8 | 543 | 2.859375 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<cmath>
#include "Knight.hpp"
using namespace std;
Knight::Knight(string piece_name, string piece_colour): ChessPiece(piece_name, piece_colour)
{
}
Knight::~Knight() {}
bool Knight::validMove(string src, string des, ChessBoard* board)
{
int file_change = abs((int)... | true |
d9504e843e5c29fd4f1662c3c9b92be9e2be4f03 | C++ | skywtchr/pso | /pso/swarm.cpp | UTF-8 | 4,105 | 2.8125 | 3 | [] | no_license | #include "swarm.h"
Swarm::Swarm(ILog &logger,
SwarmConfig &config,
ObjectiveFunction &objectiveFunction) {
_logger = &logger;
_config = &config;
_objectiveFunction = &objectiveFunction;
_isFinished = false;
_iterationCounter = 0;
_configToDelete = nullptr;
}
Swarm::Sw... | true |
af21a7cec17d4af1c6f0513032cef7dae9d511cb | C++ | Drakandes/Portfolio_NicolasPaulBonneau | /Code en C++ de Mage War Online/SkillReinforcement.cpp | ISO-8859-1 | 3,227 | 2.75 | 3 | [
"MIT"
] | permissive | #include "stdafx.h"
#include "SkillReinforcement.h"
SkillReinforcement::SkillReinforcement(int current_language)
{
language = current_language;
if (!texture_icone.loadFromFile("SkillReinforcement.png"))
{
std::cout << "Error while loading SkillReinforcement icone texture" << std::endl;
}
}
SkillRein... | true |
78555f22e2536cc4db02452237d7ebfdb00d6e45 | C++ | rob-DEV/Onyx | /Onyx/src/Platform/OpenGL/OpenGLShader.h | UTF-8 | 1,414 | 2.6875 | 3 | [] | no_license | #ifndef _ONYX_PLATFORM_OPENGL_SHADER_H_
#define _ONYX_PLATFORM_OPENGL_SHADER_H_
#include <Onyx/graphics/Shader.h>
#include <glm/glm.hpp>
typedef unsigned int GLenum;
namespace Onyx {
class OpenGLShader : public Shader {
public:
OpenGLShader(std::string_view filepath);
OpenGLShader(std::string_view name, std:... | true |
2b5ade57c77401733bcfeb4846166554612efd56 | C++ | matthewcpp/recondite | /src/xml/rXMLDocumentLoader.cpp | UTF-8 | 967 | 2.609375 | 3 | [] | no_license | #include "xml/rXMLDocumentLoader.hpp"
rXMLDocumentLoader::rXMLDocumentLoader(){
m_root = NULL;
}
rXMLDocumentLoader::~rXMLDocumentLoader(){
if (m_root)
delete m_root;
}
rXMLElement* rXMLDocumentLoader::DetachRoot(){
rXMLElement* root = m_root;
m_root = NULL;
return root;
}
void rXMLDocumentLoader::OnStartE... | true |
75c1e718f210515ea24f734f7a1fc3316e96acc8 | C++ | JinkyuChoi/C-ScrollingGame | /src/Bonus.cpp | UTF-8 | 1,268 | 2.71875 | 3 | [] | no_license | #include "Bonus.h"
#include "Game.h"
Bonus::Bonus()
{
TheTextureManager::Instance()->load("../Assets/textures/bonus.png",
"bonus", TheGame::Instance()->getRenderer());
// measure size by querying the texture
glm::vec2 size = TheTextureManager::Instance()->getTextureSize("bonus");
setWidth(size.x);
setHeight(si... | true |
015bc8c38fd6608e99e0c2917dad1d5d08992b12 | C++ | Happy-Ferret/WikiAdventure | /WikiAdventure/Source/WA-SDL/SDLMultilineTextObject.h | UTF-8 | 2,516 | 2.578125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive |
#ifndef SDLMULTILINETEXTOBJECT_H
#define SDLMULTILINETEXTOBJECT_H
#include "SDLBaseTextObject.h"
#include "SDLDebugTextObject.h"
#include "SDLTextSelectionList.h"
#include "SDLCenterTextObject.h"
/** A ? object */
class CSDLMultilineTextObject: public CSDLTextSelectionList
{
protected:
string m_sFont;
SDL_Color m... | true |
162339e513c04c3b55a52e171be9be0f65c59aea | C++ | Sparrow116/GameOfLife | /gamewidget.cpp | WINDOWS-1251 | 7,369 | 2.71875 | 3 | [] | no_license | #include <QMessageBox>
#include <QTimer>
#include <QMouseEvent>
#include <QDebug>
#include <QRectF>
#include <QPainter>
#include <qmath.h>
#include "gamewidget.h"
GameWidget::GameWidget(QWidget *parent) :
QWidget(parent),
timer(new QTimer(this)),
generations(-1),
FirstGenSize(40) // ( )
{
timer->... | true |
c17f63ee73b8d473f8fd30c68715d2ecee733061 | C++ | nurtiasrahayu/tbfo-interpreter | /14117086_14117067_14117071/interpreter.cpp | UTF-8 | 5,905 | 2.828125 | 3 | [] | no_license | //Irma Safitri (14117067)
//Nurul Fauzia Azizah(14117071)
//Nurtias Rahayu (14117086)
#include <bits/stdc++.h>
using namespace std;
int matrix[19][128];
void setNull() {
matrix[0][32] = 0;
for(int i = 0 ; i < 128 ; i++){
matrix[7][i] = 7;
}
matrix[0][99] = 1;
matrix[1][101] = 2;
matrix[2][116] = 3;
ma... | true |
2125ba27e85965f75b266c18bddaa886c38546ee | C++ | antaires/animation-engine | /src/Math.cpp | UTF-8 | 21,291 | 3.0625 | 3 | [] | no_license | #include "Math.h"
#include <cmath>
#include <iostream>
// macro for matrix mult
#define M4D(aRow, bCol) \
a.v[0 * 4 + aRow] * b.v[bCol * 4 + 0] + \
a.v[1 * 4 + aRow] * b.v[bCol * 4 + 1] + \
a.v[2 * 4 + aRow] * b.v[bCol * 4 + 2] + \
a.v[3 * 4 + aRow] * b.v[bCol * 4 + 3]
// macro for matrix-vector mult
... | true |
1cb2625799c6322fad9384991d73d85c9e78a76b | C++ | Sl-Alex/CppLearn | /L10/bigint/bigint.cpp | UTF-8 | 10,295 | 3.390625 | 3 | [] | no_license | #include "bigint.h"
#include <algorithm>
#include <cstring>
BigInt::BigInt(int val)
{
mDigCnt = mGetLength(val);
mDigits = new int[mDigCnt];
mDigits[0] = 0;
unsigned int pos_val = abs(val);
int i = 0;
while (pos_val != 0)
{
mDigits[i++] = pos_val %10;
pos... | true |
9856a62fb8e51fc8e6275f42a9fb00e8d90a0ca3 | C++ | NerdyCrow/OAP-sem1 | /Лаб 5/Lab№5 dop 2/Lab№5 dop 2/torgovlya.cpp | WINDOWS-1251 | 482 | 2.890625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
setlocale(LC_CTYPE, "rus");
float q, p;
int n=0;
float procent = 0.03;
cout << ": ";
cin >> q;
cout << " : ";
cin >> p;
while (p<q)
{
p = p+(p * procent);
n++;
}
cout << " : " << p << std::end... | true |
dce552a63e36bd5cede462b081814b89a6cbf03b | C++ | sahil2232/flipster-test | /chef and stones.cpp | UTF-8 | 377 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
long long int n,k;
while(t--)
{
cin >> n;
cin >> k;
long long int i,a[n],b[n],maxVal=0;
for(i=0;i<n;i++)
cin >> a[i];
for(i=0;i<n;i++)
cin >> b[i];
for(i=0;i<n;i++)
{
if((k/a[i])*b[i]>=maxVal)
... | true |
e59df4a24e2ea89ae8289c6f37740569e7df4884 | C++ | CoyoteLeo/Cpp | /NTUST Object Oriented Programming Class/Homework/A1001/B10532013.cpp | UTF-8 | 1,306 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
void printVector(vector<int> &result)
{
cout << result[0];
for (int i = 1; i < result.size(); ++i)
cout << " " << result[i];
cout << endl;
}
void recursiveCombination(vector<int> &stack, int *arrayPtr, int amount, int choose)
{
if (ch... | true |
e2fbbc43ab22ba61d579c20000c5257c23703508 | C++ | jieshicheng/DataStructures | /BinaryTree_class/binaryTree.hpp | UTF-8 | 2,151 | 3.265625 | 3 | [] | no_license | #ifndef _BINARYTREE_
#define _BINARYTREE_
#include"binaryTreeNode.hpp"
#include<iostream>
using namespace std;
template<typename T> class binaryTree{
public:
virtual ~binaryTree() { }
virtual bool empty() const =0;
virtual int size() const =0;
virtual void preOrder(void (*)(binaryTreeNode<T> *)) =0;
virtual v... | true |
1b60610c2bd0bea9de62c14561729515e49ffcf7 | C++ | wizleysw/backjoon | /9019/solve.cpp | UTF-8 | 1,536 | 2.78125 | 3 | [] | no_license | // https://www.acmicpc.net/problem/9019
// DSLR
// Written in C++ langs
// 2020. 03. 17.
// Wizley
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
using namespace std;
long long N;
int A;
int B;
bool VISITED[10001]={0,};
void bfs(){
memset(VISITED, 0, sizeof(VISITED));
queue<pa... | true |
803ee14e2002b59b5db8319475383f7eceae701f | C++ | Askir/Wiiteboard | /QuadrangleMorphing.h | UTF-8 | 1,546 | 2.515625 | 3 | [] | no_license | #ifndef QuadrangleMorphing_h
#define QuadrangleMorphing_h
#include "Point.h"
#include "Rectangle.h"
using namespace uschi;
class QuadrangleMorphing {
private:
uschi::Rectangle QuadrangleMorphing::morphableQuadrangle;
uschi::Rectangle QuadrangleMorphing::finalSquare;
std::vector<uschi::Rectangle> QuadrangleMor... | true |
22c637b36e58214befb2921ec08b2151a5ed6f65 | C++ | hsinyinfu/OOP_RPG | /RpgPerson.h | UTF-8 | 1,037 | 2.828125 | 3 | [] | no_license | #ifndef RPGPERSON_H_INCLUDED
#define RPGPERSON_H_INCLUDED
#include "RpgCreature.h"
#include "Monster.h"
class RpgPerson: public RpgCreature{
public:
RpgPerson(std::string _name, int _maxHp, int _strength, int _defence, int _x, int _y, int _crits, int _level, int _experience, int _coin);
virtual ~RpgPers... | true |
55b00bcb2bf1ac7f5b3d7e3a31681a6cc8359e80 | C++ | samcrow/ColonyServer-v2 | /network/client.cpp | UTF-8 | 297 | 2.578125 | 3 | [] | no_license | #include "client.hpp"
//Init static members
int Client::allocationCount = 0;
Client::Client(QObject *parent) :
QTcpSocket(parent)
{
//Increment the allocation count and assign it as this one's ID
allocationCount++;
id = allocationCount;
}
int Client::getId() {
return id;
}
| true |
82109b9dbaeed23415672deb950e276c7606aa3e | C++ | jabc1/ProgramLearning | /C++/The_C++_Programming_language/string/basic_string.hpp | UTF-8 | 9,006 | 3.71875 | 4 | [] | no_license | /**
basic_string 基础串类
*/
template<class Char_T, class Tr = char_traits<Char_T>, class A = allocator<Char_T> >
class std::basic_string{
public:
// 类型成员
typedef Tr traits_type;
typedef typename Tr::char_type value_type;
typedef A allocator_type;
typedef typename A::size_type size_type;
typedef typena... | true |
3e27c42c9cc20ca2935b41a376f566e9634fdacd | C++ | Molv1659/Hotel_reservation_system | /customerregestrationdlg.cpp | UTF-8 | 1,371 | 2.53125 | 3 | [] | no_license | #include "customerregestrationdlg.h"
#include "ui_customerregestrationdlg.h"
#include<QMessageBox>
extern QHash<QString,Customer*> customerInfo;//customerID
CustomerRegestrationDlg::CustomerRegestrationDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::CustomerRegestrationDlg)
{
ui->setupUi(this);
... | true |
bb25b72b9e2d860b2246c50ddd8fac1e888f04c7 | C++ | ArielOliveira/Opengl2DBasics | /Opengl2DBasics/DiceFace.h | UTF-8 | 739 | 2.796875 | 3 | [] | no_license | #pragma once
#include <vector>
using std::vector;
#include "Square.h"
#include "Circle.h"
using glm::mat4;
class DiceFace : public Object {
private:
const float dicePos[4] = {
.0f, .0f,
-.35f, .35,
};
Square *square;
vector<Circle*>* circles;
void FillDice();... | true |
1525ab4748bb28fb37f89f2e1f877f3dc83e2fc2 | C++ | gchlebus/Life-Universalis | /GameEngine/GameEngine/Transform.h | UTF-8 | 4,600 | 3.09375 | 3 | [] | no_license | #pragma once
#include "GlobalHeaders.h"
#define RAD_TO_DEG(rad) (float)((rad)*(180)/(M_PI))
#define DEG_TO_RAD(deg) (float)((deg)*(M_PI)/(180))
class GAMEENGINE_EXPORT Transform
{
public:
//! Default c'tor. Sets local position to (0, 0, 0), local Euler angles to (0, 0, 0) and
//! local scale to (1, 1, 1).
Transf... | true |
8926bb89b9243dc02a4f4f5f15d9807356ef2a92 | C++ | SidicleyRibeiro/padmec-amr-2.0 | /src/error-analysis/CalculateSmoothGradientNorm_2D.cpp | UTF-8 | 2,978 | 2.765625 | 3 | [] | no_license | /*
* CalculateSmoothGradientNorm.cpp
*
* Created on: 24/04/2012
* Author: rogsoares
*/
#include "ErrorAnalysis_2D.h"
/*
* Calculate smooth gradient Norm (SGN):
* SNG = sum((|gradSw_I|+|gradSw_J|+|gradSw_K|)/3.0)^2
* where sum is for each triangle element with nodes I, J, K.
*/
void ErrorAnalysis_2D:... | true |
2807bbf3c481ace9a2b41fdb5fc93a27b64b36c9 | C++ | code-abil/DSA | /subset_sum_dp.cpp | UTF-8 | 1,488 | 3.328125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define int long long
// Considering that we call the below function only when we have a soln.
void print_values(int val[],int subset[][100],int i,int j)
{
if(subset[i][j]==0)
{
cout<<"No possible subset\n";
return;
}
if(i==0 || j==0)
... | true |
a1c9e14af17665504109341ebc6ba5ce84ae0507 | C++ | Tinsed/8_puzzle | /node.cpp | UTF-8 | 372 | 2.703125 | 3 | [] | no_license | #include <node.h>
Node::Node(){
state = new State(0x23175468,8);
pParentNode = nullptr;
iAction = -1;
iPathCost = 0;
iDepth =0;
}
Node::Node(State* s, Node* parrent, int act, int cost, int depth){
state = s;
pParentNode = parrent;
iAction = act;
iPathCost = cost;
iDepth = depth;
}
Node::~Node(){
if(state!=... | true |
5b2510c28c2d4112ffcc92cf4255397f9591ac13 | C++ | RWang/oklibrary | /Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/FieldMulInvestigations.hpp | UTF-8 | 8,693 | 2.609375 | 3 | [] | no_license | // Matthew Gwynne, 6.8.2009 (Swansea)
/* Copyright 2009 Oliver Kullmann
This file is part of the OKlibrary. OKlibrary 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 and included in this library; either version 3 o... | true |
c344b2a0534816add9c3b1ec0c5a39fb94378eec | C++ | SDG98/Capstone-Graphics | /PizzaBox/Animation/AnimEngine.h | UTF-8 | 725 | 2.71875 | 3 | [] | no_license | #ifndef ANIM_ENGINE_H
#define ANIM_ENGINE_H
#include "Animator.h"
namespace PizzaBox{
class AnimEngine{
public:
static bool Initialize();
static void Destroy();
static void Update(float deltaTime_);
static void RegisterAnimator(Animator* animator_);
static void UnregisterAnimator(Animator* animator_);
... | true |
66e470b877b303d75d731fe9bc10805a16484c7f | C++ | ameth64/hs_sfm | /unit_test/sfm_utility/test_similar_transform_estimator.cpp | UTF-8 | 6,384 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <gtest/gtest.h>
#include "hs_math/random/normal_random_var.hpp"
#include "hs_math/random/uniform_random_var.hpp"
#include "hs_sfm/sfm_utility/similar_transform_estimator.hpp"
namespace
{
template <typename _Scalar>
class TestSimilarTransformEstimator
{
public:
typede... | true |
7137719a65272d701e1ec5787c86817b563ef55b | C++ | sajjadpoores/binary-search | /binary-search.cpp | UTF-8 | 360 | 3.890625 | 4 | [] | no_license | int binary_search(int a[],int x,int low,int high){ // array a must be sorted , x is the integer we are look for , low and high are index
if (low <= high){
int mid = (low + high) / 2;
if (a[mid] == x)
return mid;
else if (a[mid] < x)
binary_search(a, x, mid+1, high);
else
binary_search(a, x, ... | true |
03b1bf3ec34738106b4e84bd7372e1f542053d39 | C++ | close2/alibvr-examples | /src/adc_sync_3inputs.cpp | UTF-8 | 1,542 | 2.578125 | 3 | [
"MIT"
] | permissive | #define F_CPU 8000000UL
#include <util/delay.h>
#include "ports.h"
#include "adc.h"
// Test program.
// A previous Adc version had problems when reading 3 adc values:
// similar to:
//
// do {
// <in1>::init
// adc_8bit
// <in2>::init
// adc_8bit
// <in3>::init
// adc_8bit
// ... | true |
951ff89de1c250da5aca44444bba77b3f7305e14 | C++ | Reicher/Rocket-Rampage | /src/model/Model.h | UTF-8 | 938 | 2.703125 | 3 | [
"Unlicense"
] | permissive | #pragma once
#include <memory>
#include "IObservable.h"
#include "IActor.h"
namespace model {
//! Model for the game
class Model : public IObservable
{
public:
Model();
~Model();
//! Initiates the model
void init();
//! Updates the model
//!
//! @param dt seconds elapsed since the last update call.
void u... | true |
30f42883297250ef74691206d288978a9251d9eb | C++ | Naateri/AED | /polymorphism.cpp | UTF-8 | 7,137 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <time.h>
#include <fstream>
//unsigned long long int can store up to 19 digit numbers
using namespace std;
template <class T>
T* generarArray(unsigned long long size){
srand(time(NULL));
T* ret = new T[size];
T* a = ret;
for(int i = 0; i<size; a++, i++){
*a = T(... | true |
5dff8d5d8597596ead8a6597baf472d6f3588ad1 | C++ | SepehrSalim/MS-Multiprocessor-DB | /C Files/C_PROGS/RAMZ.CPP | UTF-8 | 357 | 3.09375 | 3 | [] | no_license | #include <iostream.h>
#include <string.h>
int sign_on (void)
{
char str [20];
int i = 0;
do {
if (i ++ == 3)
return 0;
cout << "Enter password please : ";
cin >> str;
} while (strcmp (str, "password"));
return 1;
}
void main (void)
{
if (sign_on ())
cout << "Password --> correct\n";
else
co... | true |
32b27202afc4040512d33092fa5a96cafdab339b | C++ | KedarBiradar/Problem-Solving | /Spoj/PHONELST.cpp | UTF-8 | 1,139 | 3.296875 | 3 | [] | no_license | #include <cstdio>
#include <stdlib.h>
#include <string.h>
struct node
{
bool endNode;
node * child[10];
};
node * newNode()
{
node * n=(node *)malloc(sizeof(node));
n->endNode=false;
for(int i=0;i<10;i++)
n->child[i]=NULL;
return n;
}
bool insert(node *root,char number[])
{
int len=strlen(number);
node *cu... | true |
fafb1f4e6f9d40362a1d41a2ba4c8abeaaa34b27 | C++ | SiddharthaSarma/a20j | /level-1A/problem-33.cpp | UTF-8 | 306 | 2.90625 | 3 | [] | no_license | // http://codeforces.com/contest/766/problem/A
// 766/A. Mahmoud and Longest Uncommon Subsequence
#include<bits/stdc++.h>
using namespace std;
int main() {
string a, b;
cin >> a >> b;
if (a == b) {
cout << -1 << endl;
} else {
cout << max(a.size(), b.size()) << endl;
}
return 0;
}
| true |
ace3cbc0f8e6b731cd783de8eebd957efce291e9 | C++ | findobj/HelloAndroid | /jni/findobj/foundation/SearchNode.cpp | UTF-8 | 1,072 | 3.0625 | 3 | [] | no_license | #include "SearchNode.h"
SearchNode::SearchNode()
{
mData = NULL;
mParent = NULL;
mNext = NULL;
mVisited = false;
mWeight = 1;
}
SearchNode::~SearchNode()
{
if(mData != NULL) {
mData->release();
}
if(mNext != NULL) {
mNext->release();
}
}
void SearchNode::setData(Object *data)
{
O... | true |
2a1e7e71c449375f42d73bd953186edfa0b9285e | C++ | Carlosmau97/ProyectoSistemasInteligentes | /PF_Estructura/myLista.cpp | UTF-8 | 1,056 | 3.3125 | 3 | [] | no_license | #include "myLista.h"
myLista::myLista(){
primero=0;
ultimo=0;
}
void myLista::insertarCabezaLista(float entrada){
Nodo_Lista* nuevo;
nuevo = new Nodo_Lista(entrada);
nuevo -> ponerEnlace(primero);
primero = nuevo;
if(ultimo==0)
ultimo=nuevo;
}
void myLista::mostrar(){
Nodo_Lista* aux;
aux=primero;
whil... | true |
4263993fecfe0d6860ccd56b2038afd0ca4e609e | C++ | torres2235/cs100-lab-08-new | /lab-04/add_test.hpp | UTF-8 | 1,411 | 3.078125 | 3 | [] | no_license | #ifndef __ADD_TEST_HPP__
#define __ADD_TEST_HPP__
#include "gtest/gtest.h"
#include "add.hpp"
#include "op.hpp"
/*
TEST(AddTest, AddEvaluateNonZero) {
Base* val1 = new Op(2);
Base* val2 = new Op(2);
Base* test = new Add(val1,val2);
EXPECT_EQ(test->evaluate(), 4);
}
TEST(AddTest, AddEvaluateNegative) {
Base* val... | true |
2fa1c1ac1e62706a598a1f32bb503d2dc97584bc | C++ | gitwyy/SmartCarV4 | /Src/smartcar/obj/Battery.cpp | UTF-8 | 874 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by wangyangyang on 2021-04-10.
//
#include "Battery.h"
#include "adc.h"
Battery::Battery(double minVoltage) : minVoltage(minVoltage) {}
Battery::~Battery() {}
void Battery::init() {
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, 50);
}
bool Battery::isLowVoltage() {
return this-... | true |
89a186dbdc09fa5989d2372e3cfed136bd74abf9 | C++ | civinx/ACM_Code | /ZUCC_Prob/2016新生选拔赛/E.女装门徒/myprob/test3.cpp | UTF-8 | 1,175 | 2.59375 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
struct node {
int hav[3];
int res[3];
} A[1005];
bool vis[1005];
bool check(int id) {
for (int i = 0; i < 3; i++)
if (A[id].hav[i] + A[0].hav[i] < A[id].res[i])
return false;
return true;
}
void del(in... | true |
e1fa4fc0584cf266ece10e98a01496c7933aeb93 | C++ | jvff/mestrado-implementacao | /src/test/cpp/LuminanceFilter/RgbImageImplementationTest.cpp | UTF-8 | 2,635 | 2.609375 | 3 | [] | no_license | #include "LuminanceFilterRgbImageImplementationTest.hpp"
using TypeParameters = ::testing::Types<
Aliases<RgbImage<SimpleArrayImage<std::uint64_t> >,
RgbImage<SimpleArrayImage<std::uint64_t> >,
SimpleArrayImage<unsigned char> >,
Aliases<RgbImage<OpenCLImage<std::uint64_t... | true |
63f29f6b6a136b865ad277aa50e08ac37f85e001 | C++ | ssh352/ronin | /Algo_Engine/ROM_Handler/Client_Session.cpp | UTF-8 | 1,565 | 2.53125 | 3 | [] | no_license | #include "Connection.hpp"
#include "Client_Session.hpp"
#include <bullseye/bullseye_common.hpp>
#if 0
namespace dart {
Connector::Connector (Client_Session *session)
: session_ (session)
{}
Connection *Connector::make_handler ()
{
Connection *connection = new Connection (session_);
... | true |
3bd61dd1702db67f1166931ab5467574c68cedbd | C++ | AlexanderGudov/AlgsAndDataStructuresCoursera | /SumOfTwoDigits.cpp | UTF-8 | 566 | 3.40625 | 3 | [] | no_license | //============================================================================
// Name : SumOfTwoDigits.cpp
// Author : Aleksey Kravchuk
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//=================================================================... | true |
d8cbb1b040a0d3391ef26a176d2550e38567c1f0 | C++ | pchat99/Competitive_Programming | /Array_Problems/kth_smallest_element.cpp | UTF-8 | 337 | 2.84375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int kthsmallest(int arr[], int n, int k)
{
sort(arr, arr + n);
return arr[k - 1];
}
int main () {
int n; cin>>n; int k; cin>>k;
int arr[n];
for (int i = 0; i < n; i++) {
cin>>arr[i];
}
n = sizeof(arr)/sizeof(arr[0]);
cout<<kthsmallest(arr, n, k... | true |
941b4c55e7fabd7561766f5f5b33078c98601121 | C++ | tupieurods/SportProgramming | /CR160/CR160B/main.cpp | UTF-8 | 578 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <algorithm>
using namespace std;
int main()
{
int n, k;
scanf("%d %d\n", &n, &k);
int absSmallest = INT_MAX;
int sum = 0;
for(int i = 0; i < n; i++)
{
int tmp;
scanf("%d", &tmp);
if((k != 0) &&... | true |
83742d4b8203c558d3a6af2a13e86db41efa566d | C++ | grishavanika/task | /src/rename_me/include/rename_me/task.h | UTF-8 | 14,154 | 2.65625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <rename_me/custom_task.h>
#include <rename_me/detail/cpp_20.h>
#include <rename_me/detail/internal_task.h>
#include <rename_me/detail/function_task_base.h>
#include <type_traits>
#include <cassert>
namespace nn
{
class Scheduler;
template<typename>
struct is_task;
templ... | true |
037e330533a9aa3066c01f1b1dd54cdf599aa54d | C++ | csce-315-501-f/project-1 | /tests/RelationTest.cpp | UTF-8 | 4,587 | 3.15625 | 3 | [] | no_license | #include "RelationTest.h"
/**************************************************
* Object Initialization Tests
**************************************************/
bool RelationTest::initTest() {
Relation relation;
return typeid(relation) == typeid(Relation);
}
bool RelationTest::addAttributeTest() {
Relati... | true |
ed23f0d609d7841cb13d24d4b16e4355e1b95d01 | C++ | Deadshot96/Cpp-code | /Sorting/tempQuick.cpp | UTF-8 | 5,930 | 3.65625 | 4 | [] | no_license | # include <iostream>
# include <vector>
using namespace std;
template <typename Comparable>
void PrintArray(vector <Comparable>);
template <typename Comparable>
void quickSort(vector<Comparable> &);
template <typename Comparable>
void quickSort(vector<Comparable> &, size_t, size_t);
template <typename Comparable>
c... | true |
9f61858637a681dafe1dba24909cdf0d9ae6d982 | C++ | yasushi-saito/libmustache | /src/mustache.cpp | UTF-8 | 1,231 | 2.609375 | 3 | [
"MIT"
] | permissive |
#include <stdio.h>
#include "mustache.hpp"
const char * mustache_version() {
return MUSTACHE_PACKAGE_VERSION;
}
int mustache_version_int() {
int maj = 0, min = 0, rev = 0;
sscanf(MUSTACHE_PACKAGE_VERSION, "%d.%d.%d", &maj, &min, &rev);
return (rev + (100 * min) + (10000 * maj));
}
namespace mustache {
... | true |
3ead2364d77655cf696f1fc40af4ed24e91ffd43 | C++ | Cod3lta/SchoolboyBattleQt | /schoolBoyBattle/keyinputs.cpp | UTF-8 | 2,976 | 2.859375 | 3 | [] | no_license | /*
* Description : Cette classe ne crée qu’un seul objet.
* Son utilité est de pouvoir capturer les événements du clavier
* au même endroit avant de les envoyer aux objets Player correspondants.
* Version : 1.0.0
* Date : 25.01.2021
* Auteurs : Prétat Valentin, Ba... | true |
b949c8bbab7c8e5677285e9a07d8e39d6b2ae543 | C++ | jvdbroeck/plugins-siemens-nx | /AddTemperatureLoads/main.cpp | UTF-8 | 3,035 | 2.59375 | 3 | [] | no_license | /* This plugin adds temperature loads to multiple nodes (based on node ID) in an existing simulation.
The temperature data is to be supplied by an external file (1) as described below.
(1) file 'data.csv' in the same directory as the sim/prt files
Format:
0,<t0>,<t1>,...,<tN>
<node0>,<T0>,<T1>,...,<TN>... | true |
3778c44cc77fc37c7c794611f740c477b41263c6 | C++ | Jakstor/C-programs | /Jollygame.cpp | UTF-8 | 840 | 2.625 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
int main()
{
int i,a[100],b[100],j,n,temp;
int flag=0;
int ans=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++)
{
b[i]=abs(a[i]-a[i+1]);
}
for(i = 0 ;i <n-1;i++)
{
printf("%d ",b[i]);
}
printf("\n");
// n=n-1;
for(i=0;i<n-1;i++)
... | true |
b10cb20e3fc771761d5566144241c2001f2584fc | C++ | Zhanzo/opengl-game-engine | /src/resource_manager.hpp | UTF-8 | 3,052 | 2.84375 | 3 | [] | no_license | #pragma once
#define STB_IMAGE_IMPLEMENTATION
#include <fstream>
#include <map>
#include <sstream>
#include <string>
#include <glad/glad.h>
#include <stb_image.h>
#include "shader.hpp"
#include "texture.hpp"
class ResourceManager {
public:
ResourceManager() { }
Shader loadShader(const std::string& name, c... | true |
3b0124af7517193dfc36eaa2d502426846ca9716 | C++ | ParagDrunkenMonster/PanduEngine | /Pandu/Utils/PANDUFlag.h | UTF-8 | 878 | 2.890625 | 3 | [] | no_license | /********************************************************************
filename: PANDUFlag
author: Parag Moni Boro
purpose: Game Engine created for learning
*********************************************************************/
#ifndef __PANDUFlag_h__
#define __PANDUFlag_h__
namespace Pandu
{
template <typenam... | true |
4841f6471aaa7aea2b61ef2d8739dbb641c98be1 | C++ | cmuparlay/PAM | /examples/tpch/queries/monoid.h | UTF-8 | 1,815 | 3.71875 | 4 | [
"MIT"
] | permissive | #pragma once
#include <limits>
#include <tuple>
#include <array>
// Definition of various monoids
// each consists of:
// T : type of the values
// static T identity() : returns identity for the monoid
// static T add(T, T) : adds two elements, must be associative
template <class TT>
struct Add {
using T = TT... | true |
6127403aea03dcb8dafb3cdfa43133d6c45aa60e | C++ | dominichofer/ReversiPerftCUDA | /Core/BitBoard.h | UTF-8 | 6,382 | 2.75 | 3 | [] | no_license | #pragma once
#include <intrin.h>
#include <cassert>
#include <cstdint>
#include "Bit.h"
enum class Field : uint8_t
{
A1, B1, C1, D1, E1, F1, G1, H1,
A2, B2, C2, D2, E2, F2, G2, H2,
A3, B3, C3, D3, E3, F3, G3, H3,
A4, B4, C4, D4, E4, F4, G4, H4,
A5, B5, C5, D5, E5, F5, G5, H5,
A6, B6, C6, D6, E6, F6, G6, H6,
A7,... | true |
eb48e9621bae287e7176009837d389d88748e0f0 | C++ | knight-erraunt/TSP_solver | /tsp_solver.cpp | UTF-8 | 1,914 | 2.859375 | 3 | [] | no_license | #include "tsp_solver.h"
// inversed comparison operator as we want the cheapest to be first
bool operator<(const search_state & a, const search_state & b) {
return a.exp_cost > b.exp_cost;
}
tsp_solver::tsp_solver(const point_vector & npoints) :
n(npoints.size()),
points(npoints),
current... | true |
163be27e712677142bbaedf8c18bd6f492fbc0aa | C++ | chayao2015/c-coco2dx-code- | /function2.cpp | UTF-8 | 2,376 | 3.890625 | 4 | [] | no_license | /*
按照c++ primer第四版 201页 7.22节的说法
普通形参 无法影响实参本身,执行swap时,酯交换了其实参的局部副本,传递给swap的实参本身的值并没有修改
按照此书说法给形参添加了&引用 可以修改
引用类型无法修改const对象 也就是不能通过const对象进行调用
*/
#include<iostream>
using namespace std;
void swt(int &v1,int &v2);
void test(int v1,int v2);
void swp(int &a);
void printValues(cons... | true |
a5d94320bb3e1979db3b3e823f265e8f3096bd51 | C++ | pmann84/chip8_emulator | /chip8-emulator/chip8/cpu.h | UTF-8 | 1,807 | 2.78125 | 3 | [] | no_license | #pragma once
#include "opcode_executions.h"
#include "constants.h"
#include "opcode.h"
#include "clock.h"
#include "keyboard.h"
#include <array>
namespace chip8
{
class cpu
{
public:
cpu();
// Convenience functions for opcode implementation
void set_program_counter(program_counter_t ctr);... | true |
2aa2856a1967b0783aa6edd4d7d3bf5635cdd554 | C++ | Maurya-Grover/Competitive_Coding | /Hackerrank/Algorithms/Implementation/strange_counter/strange_counter.cpp | UTF-8 | 512 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
#define newline cout << "\n"
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int t, currentTop = 3;
cin >> t;
// find max value for given time that is just greater than given time
// along with update diff between top and cur... | true |
0b658b42fa5e399c841667b7d997de5fdfbd70f6 | C++ | nuchyobitva/sem3_lab3 | /main.cpp | UTF-8 | 1,903 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <chrono>
#include <cmath>
#define MAS_LEN 262144
#define WARM_NUM 100
#define NUM_CYCLE 10
using namespace std;
int main(int argc, const char * argv[]) {
int l = 0;
auto begin = chrono::steady_clock::now();
auto end = chrono::steady_clock::now();
auto elapsed_ms = chrono::duration_cast<... | true |
2d6e5f575df74ebbee42af6263a32cc912e69e8e | C++ | 99002554/CPP_PROJECT_ENHANCED | /Hotel_Booking/Client.h | UTF-8 | 2,498 | 3.234375 | 3 | [] | no_license | #ifndef CLIENT_H
#define CLIENT_H
using namespace std;
class Client
{
public:
static int Client_Id_count;
int cost_count;
//using csv file to store & check the user data
virtual void check()
{ //Here searching if a client has his / her account
fstream fin;
fin.o... | true |
3e3d6f0ad030d64c2751944ade2472c4c5c9b084 | C++ | Feroz455/The-CPP-Standard-Template-Library-STL | /STL Vectors/back.cpp | UTF-8 | 534 | 3.34375 | 3 | [] | no_license | /*
Cpp_STL_Reference
VECTOR
program back
TYPE & back();
const TYPE & back() const;
*/
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
//main begin
int main()
{
vector<int> v;
for(int i = 0; i < 5; i++)
{
v.push_back(i);
}
cout << "The first e... | true |