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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dd464c74ed2338d6f06ec1c79d8f29d728a5c4e0 | C++ | 0xF6/CWCPP | /CWC++/File.h | UTF-8 | 1,832 | 2.84375 | 3 | [] | no_license | #pragma once
#include "CString.h"
#include "CWString.h"
#pragma region File
class FileStream;
class File {
friend FileStream;
LPVOID Data;
LARGE_INTEGER size_L;
DWORD size_D;
bool large;
bool null;
bool string;
public:
File(CString &str);
File(LPVOID Data, LARGE_INTEGER size);
File(LPVOID Data, DWORD size... | true |
a2f28c5bfbda1a70bb733122de00cfc6b205d28c | C++ | pbeata/WriteSciSW | /ch5.cpp | UTF-8 | 2,888 | 3.34375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
void prob2();
void prob3();
void prob4();
double compute_radius(double x, double y);
double get_rand();
void print_quadratic_roots(double a, double b, double c);
int main()
{
/*
// investigating overflow
int e;
int my_exp[5] = {10, 100, 1000, 1020,... | true |
b4227620675b0a14ed3cc14219d4729e93abb51b | C++ | RiscadoA/Magma-Lib | /src/Magma/Streams/IOStream.cpp | UTF-8 | 1,198 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "IOStream.hpp"
#include "..\String.hpp"
#include <cstdio>
bool Magma::STDOutStreamBuffer::Overflow(char32_t character)
{
// Put UTF-8 character on STDOUT
char chr[4];
auto chrSize = UTF8::FromUnicode(character, chr);
for (size_t i = 0; i < chrSize; ++i)
if (fputc(chr[i], stdout) == EOF) // Check for EO... | true |
b3f769502d2f791f0635b3007b13f60a8564fde9 | C++ | Shubham2157/Important-Cplus-plus | /inheritanceQues/main.cpp | UTF-8 | 894 | 3.578125 | 4 | [] | no_license | #include <iostream>
using namespace std;
class data
{
public:
int x,y,z;
void accept()
{
cout<<"Input Three integer";
cin>>x;
cin>>y;
cin>>z;
}
};
class largest : public data
{
public:
void big()
{
int lar 0;
if(x>y&&x>>z)
lar=x;
... | true |
a97963993b67cdaf4461041782bf2edd6a021aaa | C++ | LucaJiang/Homework-of-Data-Structures | /Graph/邻接矩阵/directedGraphMain.cpp | UTF-8 | 1,752 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | //
//基于有向图(有权重)的邻接矩阵实现图的各种算法;
//最后修改2019-06-06
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include "directedGraph.cpp"
using namespace std;
int main()
{//Init
int numV;
int arc[MAXV*MAXV];
//read data
fstream fin;
cout << "Open file:";
string filename;
cin >> f... | true |
041082765f6585a70f34e703871ff8d0ea860059 | C++ | ThatMathsyBardGuy/CubeMarchTerrain | /Renderer.h | UTF-8 | 767 | 2.65625 | 3 | [] | no_license | #pragma once
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
#include "Camera.h"
#include "RenderObject.h"
#include "Shader.h"
namespace rendering {
class Renderer
{
public:
Renderer(GLFWwindow& parent, Shader* shader = new Shader());
~Renderer();
Camera* GetCamera() { return m_Camera; }
... | true |
2ccff565ca1176b855a921837ba6e67f2e325f96 | C++ | negarrahmati/muticore-project-regex-parser | /Hill_climbing/Dictionary.h | UTF-8 | 2,165 | 3.03125 | 3 | [] | no_license | #ifndef __DICTIONARY__
#define __DICTIONARY__
#include <list>
#include <iostream>
#include <vector>
#include <string.h>
#include <string>
#include <set>
#include <map>
#include "Dictionary_Tree.h"
#define ALPHABET_SIZE 26
#define MAX_WORD_LENGTH 30
#define MIN_WORD_LENGTH 2
using namespace std;
... | true |
c9d8d562c23dac42a3951c0d1a9e3ccd8da076a8 | C++ | having11/packetMsgSend | /src/InputManager.cpp | UTF-8 | 727 | 2.53125 | 3 | [] | no_license | #include "InputManager.h"
void InputManager::init()
{
pinMode(PAIR_BTN_PIN, INPUT_PULLUP);
pinMode(DRAW_BTN_PIN, INPUT_PULLUP);
pinMode(SEND_BTN_PIN, INPUT_PULLUP);
pinMode(JOYSTICK_X_PIN, INPUT);
pinMode(JOYSTICK_Y_PIN, INPUT);
}
bool InputManager::pairBtnPressed()
{
return !digitalRead(PAIR_... | true |
7de07b8616067ca8c71e179902f354cd4a61d174 | C++ | nDy/EscapeMadness | /EscapeMadness/lib/windows/Story.h | UTF-8 | 3,969 | 2.609375 | 3 | [] | no_license | #ifndef STORY_H_
#define STORY_H_
#include <SDL/SDL.h>
#include "Event.h"
#include "../common/Structure.h"
#include "../common/TextBubble.h"
#include "../common/Button.h"
#include <SDL/SDL_mixer.h>
class Story: public Event {
private:
SDL_Surface* Background;
TextBubble* tb;
int Current;
Mix_Music *music;
bool... | true |
dd842cb00a17a53abb64c1cb6372c89e54655c03 | C++ | Mrhuangyi/leetcode-Solutions | /Cpp/Medium/151. 翻转字符串里的单词.cpp | UTF-8 | 3,603 | 3.890625 | 4 | [] | no_license | /*
给定一个字符串,逐个翻转字符串中的每个单词。
示例:
输入: "the sky is blue",
输出: "blue is sky the".
说明:
无空格字符构成一个单词。
输入字符串可以在前面或者后面包含多余的空格,但是反转后的字符不能包括。
如果两个单词间有多余的空格,将反转后单词间的空格减少到只含一个。
进阶: 请选用C语言的用户尝试使用 O(1) 空间复杂度的原地解法。
*/
class Solution {
public:
string reverseWords(string s) {
string res,temp;
reverse(s.begin(), ... | true |
6cf2093e8885adb712d9e2eb046a4e5dfb06992b | C++ | nafisa11bd/My-Codeforces-AC-submissions | /i_am_miss_nobody/492B.cpp | UTF-8 | 547 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,l;
double d=0,f=0,g=0;
cin>>n>>l;
int p[n+1];
for(int i=0;i<n;i++)
{
cin>>p[i];
}
sort(p,p+n);
for(int i=0;i<n-1;i++)
{
if(abs(p[i]-p[i+1])>d)
{
d=abs(p[i]-p[i+1]);
}
}... | true |
4cc204f66dbef1e768a61a8879350cada444da48 | C++ | GaisaiYuno/My-OI-Code-1 | /1比赛题目/18.5.5专题训练/C.cpp | GB18030 | 905 | 2.84375 | 3 | [] | no_license | #include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#define maxn 100005
using namespace std;
int len[maxn];
void init(){
len[0]=0;
len[1]=1;
for(int i=2;i<maxn;i++){
len[i]=len[i-1]+log10(i)+1;
//iӴȵi-1ӴһiiijΪlog10(i)+1,Ҳ˵iӴȵi-1Ӵijȳlog10(i)+1
}
}
int t,n;
int main(){
init();
scanf("%d",&t);
... | true |
5808a483b735323cf41adb0d188bd1bc76a8a923 | C++ | Harrix/Harrix-MathLibrary | /src/Оптимизация - свалка алгоритмов/HML_BinaryGeneticAlgorithmTwiceGenerations.cpp | UTF-8 | 18,511 | 2.59375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | int HML_BinaryGeneticAlgorithmTwiceGenerations(int *Parameters, double (*FitnessFunction)(int*,int), int *VHML_ResultVector, double *VHML_Result)
{
/*
Генетический алгоритм с двойным количеством поколений для решения задач на бинарных строках.
На четных поколениях целевая функция высчитывается как среднеарифметичес... | true |
3c9f855a92aabf9cf87c1d92d1d02d668d59cfd5 | C++ | BlakeJordan/Compilers_p3 | /symbol_table.cpp | UTF-8 | 1,993 | 3.234375 | 3 | [] | no_license | #include "symbol_table.hpp"
namespace lake{
ScopeTable::ScopeTable(){
symbols = new HashMap<std::string, SemSymbol *>();
}
bool ScopeTable::LookUp(std::string id) {
return(symbols->count(id) > 0);
}
std::string ScopeTable::GetType(std::string id) {
return symbols->find(id)->second->GetType();
}
bool Sc... | true |
0acc532cad99b8b73e6f1ee981c8581e58ee089d | C++ | Maigo/gea | /gea/libs/gea_core/src/gea/core/pattern/delegate_base.inl | UTF-8 | 1,953 | 2.59375 | 3 | [] | no_license | #pragma once
// header include
#include "delegate_base.h"
namespace gea {
// ------------------------------------------------------------------------- //
// delegate_base //
// ------------------------------------------------------------------------- //
te... | true |
6cc61524073f241c9a58a8e120d09b4898236ed7 | C++ | Lawrenceh/AC_Monster | /LeetCode/Swap Nodes in Pairs.cpp | UTF-8 | 1,643 | 3.4375 | 3 | [] | no_license | // recursive version
class Solution {
public:
ListNode *swapPairs(ListNode *head) {
if(!head||!head->next) return head;
ListNode *reverse_head = head->next;
ListNode *next_pair_head = reverse_head->next;
reverse_head->next = head;
head->next = swapPairs(next_pair_head);
... | true |
e571afada4efd820810306863f7870282846e5be | C++ | OSgoodYZ/algorithm_practice | /gcdlcm.cpp | UHC | 1,254 | 3.6875 | 4 | [] | no_license | #include<vector>
#include<iostream>
using namespace std;
//ִ ִ ϴ¹
vector<int> gcdlcm(int a, int b)
{
vector<int> answer;
int small=a, big=b;
int sol1=1, sol2=a*b;
answer.resize(2);
if (a > b)
{
small = b;
big = a;
}
else if(a == b)
{
sol1 = a;
sol2 = a;
}
else
{
small =... | true |
f7a747a02b3e79a29e62b31498a4279197ddaea6 | C++ | hanifwihananto/ksn-p | /ksn-p_2021/b3.cpp | UTF-8 | 367 | 2.890625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
// N : jumlah vitamin
// M : jumlah uang
int N, M;
cin >> N >> M;
// H : Harga
// K : kandungan
// D : dosis
int H, K, D;
int tinggi, rendah;
// D = 1; Tinggi
// D = 0; Rendah
if(D == 1){
D = tinggi;
} else {
D = rendah;
}
int i, j;
... | true |
80c4613e868ae2b050e28cabaea4eafb075541db | C++ | HururuekChapChap/Winter_Algorithm | /Cut_Lan_Line-1654/Cut_Lan_Line-1654/main.cpp | UTF-8 | 1,832 | 3.21875 | 3 | [] | no_license | //
// main.cpp
// Cut_Lan_Line-1654
//
// Created by yoon tae soo on 2020/02/07.
// Copyright © 2020 yoon tae soo. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/*
이분 탐색 문제였다. 오늘은 정말 아무 생각도 하기 싫어서 잘 풀지 못했는데,
아이디어에서 다소 차이가 있었고 별로 문제 풀고 싶은 마음이 없었다.
오늘은 좀... | true |
697c5c9440c07ef15e45cbea904ce0bc19b4f3b1 | C++ | Yozer/SatSolvers | /solvers/riss/classifier-src/FeaturesWriter.h | UTF-8 | 758 | 2.5625 | 3 | [
"LicenseRef-scancode-other-permissive"
] | permissive | /*
* FeaturesWriter.h
*
* Created on: Jan 4, 2014
* Author: gardero
*/
#include <ostream>
#include <string>
#ifndef FEATURESWRITER_H_
#define FEATURESWRITER_H_
using namespace std;
class FeaturesWriter {
private:
ostream& output;
int featuresNumber;
int featuresCount;
int timeout;
public:
FeaturesWri... | true |
adba7bbbc5baf21e07db3e93c36a7494329e05a1 | C++ | usman-tahir/rooks-guide-c-plus-plus | /rooks-guide-tutorials/chapter_10_exercises.cpp | UTF-8 | 483 | 3.921875 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int input_one, input_two;
cout << "Enter a number: ";
cin >> input_one;
cout << "\nEnter a number: ";
cin >> input_two;
if (input_one > input_two) {
cout << input_one << " is greater than " << input_two << endl;
} else if (input_one < input_two... | true |
2d91cc3a41984b1d8b2e90e77f0ecc519b4fda0d | C++ | singhdharmveer311/PepCoding | /Level-1/14. LinkedList/Reverse-in-size-of-K-Groups.cpp | UTF-8 | 6,148 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | #include <bits/stdc++.h>
using namespace std;
class node{
public:
int val;
node* next;
};
void insert_at_tail(node *&head,int val){
if(head==NULL){
node *newnode = new node;
newnode->val=val;
newnode->next=NULL;
head=newnode;
}
else{
node *newnode = ... | true |
edef1171c0cbc72552a8f3b342892d434ec89ec1 | C++ | Anubhav12345678/competitive-programming | /EVENARRAYCODEFORCESVVVVVVVVVVVVVVVVVVVVVIMP.cpp | UTF-8 | 1,402 | 3.28125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#include<vector>
/*
You are given an array a[0…n−1] of length n which consists of non-negative integers. Note that array indices start from zero.
An array is called good if the parity of each index matches the parity of the element at that index. More ... | true |
03eadefb323aee97f77c4df3c5a2ef950d325bc1 | C++ | Dir-MaGaSe/Portafolio_ManuelGallardo | /Portafolio 2 - Ejercicio 16.cpp | ISO-8859-1 | 896 | 3.640625 | 4 | [] | no_license | //Nombre: Manuel Sebastin Gallardo Vsquez
//Canet: GV100520
#include<iostream>
#include<string>
using namespace std;
const string Autor = "Manuel Sebastian Gallardo Vasquez";
const string Carnet = "GV100520";
void imprimirArreglo(int array[], int size){
for(int i=0; i<size; ++i){
cout<<" | "<<array[i];
}
... | true |
9d581f39fc7269f9664bd7bc1e31fa56179ffb2b | C++ | TimKingNF/leetcode | /editor/CodingInterviewGuide/CIG_1_2003.hpp | UTF-8 | 1,284 | 3.140625 | 3 | [] | no_license | //
// Created by timking.nf@foxmail.com on 2021/2/2.
//
#ifndef LEETCODE_CIG_1_2003_HPP
#define LEETCODE_CIG_1_2003_HPP
#include "header.h"
namespace CIG_1_2003 {
struct ListNode {
int val;
ListNode *prev;
ListNode *next;
ListNode() : val(0), prev(nullptr), next(nullptr) {}
ListNode(int x) : val(x), prev(... | true |
d1573504920584b1c14d814cf0b47b6e27b32cd8 | C++ | WShabti-Team/WShabtiPict | /wshabtilib/oracle-generator/oracle-generator.h | UTF-8 | 1,338 | 3.1875 | 3 | [
"MIT"
] | permissive | #ifndef __ORACLE_GENERATOR_H__
#define __ORACLE_GENERATOR_H__
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Takes a vector of oracles to check if AT LEAST one oracle is expressed as interval (e.g 11.0:0.12)
*
* INPUT:
* vector of string (oracles)... | true |
bae30ec34456705ff04f5b92768548acf1797130 | C++ | antifork/awgn | /codes++/probe.hh | UTF-8 | 2,348 | 2.625 | 3 | [] | no_license | /* $Id$ */
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <bonelli@antifork.org> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth ... | true |
fd9abf57d88e4b01abd1f01c62e5f59c8191e042 | C++ | deepakantony/competitive_programming | /project_euler/p1_to_p67/p38_pandigital_max_concat.cpp | UTF-8 | 1,317 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <bitset>
using namespace std;
int reverse(int n) {
int rev = 0;
while(n > 0) {
rev = rev*10+n%10;
n /= 10;
}
return rev;
}
int get_pandigital(int num, int n) {
int pandigital = 0;
for(int i = 1; i <= n; i++) {
int prod = reverse(num*i);
do {
pandigital... | true |
55c72bb0397cf6f97820ccb93188cffe23d9ca7f | C++ | TechAoba/OJ-code | /洛谷/P1219 八皇后.cpp | UTF-8 | 635 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int A[20], N, ans = 0;
bool vis[20], vis1[20], vis2[20];
void print() {
for(int i=1;i<=N;i++) {
printf("%d%c", A[i], i==N?'\n':' ');
}
}
void dfs(int step) {
if(step>N) {
ans++;
if(ans<=3) print();
return;
}
for(int i=1;i<=N;i++) {... | true |
94b42e07c93fa12225a6257ed363badcda162c7f | C++ | bmag52/vehicle_energy_consumption_estimator | /PTC_xcode/PTC_xcode/data_management/Node.cpp | UTF-8 | 530 | 2.5625 | 3 | [] | no_license | /*
* Node.cpp
*
* Created on: Apr 8, 2016
* Author: vagrant
*/
#include "Node.h"
namespace PredictivePowertrain {
Node::Node() {
}
Node::Node(double lat, double lon, float ele, long int id) {
this->lat = lat;
this->lon = lon;
this->ele = ele;
this->id = id;
}
double Node::getLat() {
return this->la... | true |
b08b9aac6af69fea576428d9ca1bd6ec9c0a9dc1 | C++ | solovyov-private/train-cpp | /Accelerated_CPP/10.1.grades/median.h | UTF-8 | 545 | 3.1875 | 3 | [] | no_license | #ifndef GUARD_median_h
#define GUARD_median_h
#include <algorithm>
#include <stdexcept>
#include <vector>
using std::domain_error;
using std::sort;
using std::vector;
template<class T>
T median(vector<T> vec)
{
typedef typename vector<T>::size_type vec_sz;
vec_sz size = vec.size();
if (size == 0) {
... | true |
30a61aa900a25f79550ef8a5552181fe91f432f3 | C++ | petru-d/leetcode-solutions-reboot | /problems/p1198.h | UTF-8 | 883 | 3.140625 | 3 | [] | no_license | #pragma once
#include <algorithm>
#include <vector>
namespace p1198
{
class Solution
{
public:
int smallestCommonElement(std::vector<std::vector<int>>& mat)
{
auto R = mat.size();
auto C = mat.front().size();
if (R == 0 || C == 0)
retur... | true |
7f11fd758b59bfcf5cb108b2aae68dc4b742a25f | C++ | 200439/LAB_3 | /prj/kolejka.hh | UTF-8 | 641 | 2.890625 | 3 | [] | no_license | #ifndef KOLEJKA_HH
#define KOLEJKA_HH
#include <iostream>
#include <string>
#include <iomanip>
#include <cstdlib>
using namespace std;
/*!
* \file
* \brief Definicja klasy kolejka
*
*/
struct element_k {
int liczba;
element_k *nastepny;
};
/*! \brief Definicja klasy kolejka
*
*/
class Kolejka {
eleme... | true |
d977927957e458a5325d71d354a83373624dde42 | C++ | kouya-marino/OOPs-programming | /default value in constructors/main.cpp | UTF-8 | 637 | 3.703125 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Human{
private:
string name;
int age;
public:
/*Human(){
cout<<"default constructor"<<endl;
name="unknown";
age=0;
}*/
Human(string iname="unknown",int iage=0){ // default parameter constructor
cout<<"overloaded co... | true |
c9fd64022ebc66ace144b9228e8dce933ca2b7ad | C++ | Eric-Souza/sorting-algorithms | /include/SortingAlgorithms.h | UTF-8 | 5,756 | 3.765625 | 4 | [] | no_license | #include <string>
#include <iostream>
#include <math.h>
using namespace std;
// Class for both names and binary digits
class NamesAndBinaryDigits {
public:
NamesAndBinaryDigits(const string name, const int binaryDigits) {
this -> name = name;
this -> binaryDigits = binaryDigits;
... | true |
e2915d9483c5b3f8116ec7cba0296c09ab17212e | C++ | Pedro-Mendes/competitiveProgramming | /leetcode/problems/medium/208-implementPrefixTrie.cpp | UTF-8 | 1,197 | 3.4375 | 3 | [] | no_license | /*https://leetcode.com/problems/implement-trie-prefix-tree
git@Pedro-Mendes*/
/*Map search insertion and delete: O(logn)
So if word size is M, O(M*Logn) for all of them for time complexity
Space complexity = O(M) for insert*/
class Trie {
private:
map<char, Trie*> letters = {};
bool isWord = false;
... | true |
4bbad395ec08844dcd7b28176ff264eaae3afd6e | C++ | steventfan/CS100 | /Lab 4/VectorContainer.cpp | UTF-8 | 1,503 | 3.546875 | 4 | [
"BSD-3-Clause"
] | permissive | #include "container.h"
#include "strategy.h"
/* Pure Virtual Functions */
// insert the top pointer of the tree into the container
void VectorContainer::add_element(Base* element)
{
vectorContainer.push_back(element);
}
// iterate through the trees and output values
void VectorContainer::print()
{
for(unsigne... | true |
d0869ee4f4e9f1bd160ac5e54705f394c414316c | C++ | professordutta/arduino | /sach/sach.ino | UTF-8 | 549 | 2.546875 | 3 | [] | no_license | int s1;
int s2;
char temp;
void setup()
{
Serial.begin(9600);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
}
void loop()
{
s1=analogRead(A0);
s2=analogRead(A1);
if(s1> 200 && s2>200)
{
Serial.println("Hi");
delay(500);
}
if(Serial.available()... | true |
daed70fe00ea7fdaeed6344136fee17976314760 | C++ | maximechoulika/My42Cursus | /piscine_cpp/project/source/Menu.cpp | UTF-8 | 4,423 | 2.6875 | 3 | [] | no_license | #include "Menu.hpp"
#include "Vars.hpp"
#include <SFML/Window/Event.hpp>
Menu::Menu(unsigned char escAction) : m_escAction(escAction), m_viewPos(window.getView().getCenter() - window.getView().getSize() / 2.f)
{
m_vertices.setPrimitiveType(sf::Quads);
}
bool Menu::updateMenu()
{
bool buttonClicked = false;... | true |
1ebf306f0794a067625c86028f821f0cc1b98f31 | C++ | Codeon-GmbH/mulle-clang | /test/SemaCXX/cxx1z-init-statement.cpp | UTF-8 | 2,156 | 3.328125 | 3 | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | // RUN: %clang_cc1 -std=c++1z -Wno-unused-value -verify %s
// RUN: %clang_cc1 -std=c++17 -Wno-unused-value -verify %s
void testIf() {
int x = 0;
if (x; x) ++x;
if (int t = 0; t) ++t; else --t;
if (int x, y = 0; y) // expected-note 2 {{previous definition is here}}
int x = 0; // expected-error {{redefiniti... | true |
28f9551dd7d12c2937c04b2a469aefc64cf02b0b | C++ | rafaelflores520/P3Lab9_RafaelFlores | /Reina.hpp | UTF-8 | 2,382 | 2.984375 | 3 | [] | no_license | #ifndef REINA_H
#define REINA_H
#include <iostream>
#include "Pieza.hpp"
using std::string;
class Reina : public Pieza
{
public:
static const int FIXED_REINA_WHITE[];
static const int FIXED_REINA_BLACK[];
const bool isWHITE;
Reina(const int pos[], bool color) : Pieza(pos), isWHITE(color){};
bool ... | true |
a658310d77136e7d2c4a11d716b6fc04606a16e1 | C++ | omarelsobkey/Problem_Solving | /Sheets/Assiut NewCommers/Sheet #6 (Math Geometry)/Divisability.cpp | UTF-8 | 381 | 2.828125 | 3 | [] | no_license | // https://codeforces.com/group/MWSDmqGsZm/contest/223338/problem/I
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
double a, b;
long long x, n1, n2;
cin >> a >> b >> x;
if (a > b)
swap(a, b);
n1 = (floor(b / x) * (floor(b / x) + 1)) / 2;
n2 = (ceil(a / x) * (ceil(... | true |
0257535224df94e773496212b6f858060d37983e | C++ | fangzhouzhang/LeetCodeCpp | /_1368MinimumCosttoMakeatLeastOneValidPathinaGrid.cpp | UTF-8 | 1,488 | 2.671875 | 3 | [] | no_license | //
// Created by Fangzhou Zhang on 2020/3/4.
//
vector<vector<int>> dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
class Solution {
private:
bool isValid(int rows, int n, int a, int b) {
if (a < 0 || a >= rows) return false;
if (b < 0 || b >= n) return false;
return true;
}
public:
int m... | true |
e503c920fa3fd3127bd507e96d2d092aa7c80460 | C++ | xmba15/miscellaneous | /cuda/image_processing/src/Histogram.hpp | UTF-8 | 1,439 | 3.0625 | 3 | [] | no_license | /**
* @file Histogram.hpp
*
* @author btran
*
*/
#pragma once
#include <thrust/device_vector.h>
namespace _cv
{
namespace
{
template <typename T> __global__ void histoKernel(const T* input, int* hist, int size, int numBins)
{
extern __shared__ int sharedHist[];
int tid = threadIdx.x;
if (tid < ... | true |
4994c60ed997e4405637c07b984229a97e50483f | C++ | matheusportela/black-hole-ray-tracer | /src/image.hpp | UTF-8 | 964 | 2.59375 | 3 | [
"MIT"
] | permissive | #ifndef IMAGE_HPP
#define IMAGE_HPP
#include <iostream>
#include <string>
#include <vector>
#include <Eigen/Core>
#include "color.hpp"
#include "log.hpp"
#include "stb_image.h"
#include "stb_image_write.h"
class Image {
public:
Image() {}
Image(int width, int height);
void setPixel(int row, int col,... | true |
34844fe6003583d5ae7505bd16bc8541ff30b0a0 | C++ | N-911/c_plus_plus_white | /w3/family_and_history.cpp | UTF-8 | 4,162 | 3.390625 | 3 | [] | no_license | #include <vector>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
string vector_name_to_str(vector<string> v) {
string res;
int c = v.size();
reverse(begin(v), end(v));
res += v[0];
if (v.size() > 1) {
res += " (";
for (int i = 1; i <... | true |
da1e26595084d97cc30429225dba7e9ee8671b77 | C++ | moth96/leetcode | /1046.最后一块石头的重量.cpp | UTF-8 | 410 | 2.890625 | 3 | [] | no_license | int lastStoneWeight(vector<int>& stones)
{
int n = stones.size();
if (n == 0) return 0;
if (n == 1) return stones[0];
priority_queue<int> q;
for (int x : stones) q.push(x);
while(q.size() > 1)
{
int a = q.top();
q.pop();
int b = q.top();
q.pop();
if(a... | true |
9f968dec63004915f3f598edf29b0940092cd465 | C++ | Thiebosh/M1_S1project_Android | /Arduino/microcode_v3_42d/004console_input_functions.ino | UTF-8 | 13,536 | 2.765625 | 3 | [] | no_license | /*
check console return code and display arror if any
argument(s): return code
return: nothing
*/
void consoleErrorMessage(uint8_t error) {
switch (error) {
case 0: // nothing available on console, no message
break;
case 1:
Serial.print("Error code ");
Serial.print(error);
Se... | true |
a4fe7785bb7b3e96695ef26436e4cbe29079ae7f | C++ | Pugipug/liceu | /Recursivitate/Metode recursive/Metoda „Backtracking”/8.cpp | UTF-8 | 911 | 2.625 | 3 | [] | no_license | #include <iostream>
using namespace std;
/* Sa se genereze toate numerele naturale ale caror cifre se regasesc printre cifrele unui numar dat X si au lungimea cel mult egala
cu lungimea lui X. */
int st[10],v[10],X,n;
int valid(int p)
{
int OK=1;
if (p==1 && st[p]==0)
OK=0;
fo... | true |
afde47e7587b3cc82b2ecb49264349840c61bd11 | C++ | yameenjavaid/Online-Judge-Solutions | /Kattis/tracksmoothing.cpp | UTF-8 | 859 | 3 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
// Track Smoothing
#define EPS 1e-9
struct point{
double x, y;
point() = default;
point(double x, double y){
this->x = x, this->y = y;
}
point& operator=(const point& o) = default;
double dist(const point& o){
return... | true |
1e9852640ed608c554ce034a30c03d1b725b5bdb | C++ | sandeep2119/CPP | /5.cpp | UTF-8 | 312 | 3.625 | 4 | [] | no_license | //Write a program which accept temperature in Farenheit and print it in centigrade
#include <iostream>
using namespace std;
int main() {
float c,f;
cout<<"Enter the Temperature in Fahrenheit : "<<endl;
cin>>f;
c = (f-32)*5/9;
cout<<"The Temperature in Centigrade is :"<<c<<endl;
return 0;
}
| true |
348808d86c6c9614b4a195e1afcf4640d9af9c8c | C++ | Ely4s/InfiniteConquest | /src/Entity/Entity.h | UTF-8 | 2,955 | 2.640625 | 3 | [] | no_license | //
// Created by Elyas EL IDRISSI on 28/02/2021.
//
#ifndef INFINITECONQUEST_ENTITY_H
#define INFINITECONQUEST_ENTITY_H
#include <SFML/Graphics.hpp>
#include "Library/hashmap.h"
#include "Sprite/SpriteSheet.h"
#include "Interface/Transformable.h"
#include "Interface/Drawable.h"
#include "Entity/EntityTeam.h"
#includ... | true |
14ac51b91220711328ce214d17524e320c7d3bd6 | C++ | AnyTimeTraveler/C-CPP-course | /code/08_PTRN/src/base/Logger.hpp | UTF-8 | 368 | 2.703125 | 3 | [] | no_license | // file Logger.hpp
#ifndef Logger_hpp
#define Logger_hpp
#include <iostream>
class Logger {
static Logger* _theInstance;
public:
virtual void log(std::string message, std::string file="", int line=0) = 0;
static Logger* getInstance();
};
class StdoutLogger: public Logger {
public:
void log(std::string messag... | true |
b015a7d2496b7aa8a267b46df0659475a7e6121f | C++ | hungpham2511/toppra | /cpp/src/toppra/geometric_path/piecewise_poly_path.hpp | UTF-8 | 5,118 | 3.03125 | 3 | [
"MIT"
] | permissive | #ifndef TOPPRA_PIECEWISE_POLY_PATH_HPP
#define TOPPRA_PIECEWISE_POLY_PATH_HPP
#include <array>
#include <toppra/geometric_path.hpp>
#include <toppra/toppra.hpp>
#include <toppra/export.hpp>
namespace toppra {
struct BoundaryCond {
BoundaryCond() = default;
/**
* @brief Construct a new BoundaryCond object wi... | true |
fde3d9c1904e0b11deb7f9eb43a6ec6862a9a986 | C++ | girim/cplusplusPrimerExamples | /STL_Algorithms/modifying/replace_copy_if.cpp | UTF-8 | 542 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <deque>
#include "../point.hpp"
#include "../printSeqContainer.hpp"
int main(int argc, char const *argv[])
{
Point pt0{}, pt1{1, 3}, pt2{5, 4}, pt3{9, 3}, pt4{4}, pt5{2, 8};
std::deque<Point> points = {pt0, pt1, pt2, pt3, pt4};
printSequentialContainer(poi... | true |
e4a9463427d182d51a1e51b371e48eeab533f546 | C++ | trxo/cpp_study_notes | /chapter3-Function and function template/3.11函数返回值作为函数的参数/main.cpp | UTF-8 | 191 | 3 | 3 | [
"AFL-3.0"
] | permissive | #include <iostream>
using namespace std;
int max(int,int);
int main()
{
cout << max(55, max(25, 39)) << endl;
}
int max(int m1, int m2){
return m1 > m2 ? m1 : m2;
}
// print
//55 | true |
b0c9046694bafdd4b33ed58b7a92aebebf6bb9ad | C++ | DcmTruman/my_acm_training | /UVA/12716/15177670_AC_970ms_0kB.cpp | UTF-8 | 390 | 2.765625 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
using namespace std;
int const maxn = 30000005;
int ans[maxn];
int main()
{
for(int c = 1;c < maxn; c++)
{
for(int a = c + c; a < maxn; a += c){
if((a ^ (a - c)) == c)ans[a] ++;
}
ans[c] += ans[c - 1];
}
int T;
scanf("%d", &T);
for(int t = 1; t <= T; t++)
{
... | true |
59ce221fef423f6ad8b9716aa6b071a8faeac4eb | C++ | roshihie/At_Coder | /ABC_B/ABC072_B_OddString.cpp | UTF-8 | 379 | 3.203125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void fnInput(string& rsStr)
{
cin >> rsStr;
}
string fnOddString(string sStr)
{
string sOddStr = "";
for (int i = 0; i < sStr.size(); i++)
if (i % 2 == 0) sOddStr += sStr[i];
return sOddStr;
}
int main()
{
string sStr;
fnInput(sStr)... | true |
92112db47df54570da0d4dba0a324dd658795ced | C++ | Feldrise/FeldEngineFirstCode | /FeldEngine-Core/src/Maths/Vector4.h | UTF-8 | 3,420 | 3.015625 | 3 | [
"MIT"
] | permissive | /*
* The MIT License(MIT)
*
* Copyright(c) 2016 Victor DENIS (victordenis01@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files(the "Software"), to deal
* in the Software without restriction, including without limitation the r... | true |
d32ca12c35512145660255d5c6de530d6d19eb14 | C++ | mrLarbi/CPAEgrep | /include/FileList.h | UTF-8 | 408 | 2.640625 | 3 | [] | no_license | #ifndef H_FILELIST
#define H_FILELIST
#include <string>
#include <vector>
class FileList
{
private:
static FileList* instance;
std::vector<std::string> files;
FileList();
FileList(const FileList&);
void operator=(const FileList&);
public:
static FileList* getFileListInstance();
void addFile(... | true |
ddf585d65350667f161897afe3f7dae0fa353cce | C++ | AbhijithMadhav/Notes | /Programming, Data Structures and Algorithms/src/Kernighan and ritchie/4-7.cpp | UTF-8 | 408 | 2.90625 | 3 | [] | no_license | /* Exercise 4-7. Write a routine ungets(s) that will push back an entire string onto the input.
Should ungets know about buf and bufp, or should it just use ungetch?
*/
#include <stdio.h>
#include "calc.h"
#define MAX 10
int main()
{
char s[MAX] = "012345678";
int i = 0;
// while (i != 10)
s[i++] = g... | true |
f2681e443f548a08572e131d2b30057004e98ef2 | C++ | NamaWho/University | /Fondamenti di Programmazione/Lab07/main.cpp | UTF-8 | 6,176 | 3.84375 | 4 | [
"MIT"
] | permissive | /**
* @author Daniel Namaki Ghaneh
* @date 11/11/2020
*/
#include <iostream>
using namespace std;
void componenti_negative(const int vett[], const unsigned int l, int *&newVect, unsigned int &lengthNewVect);
void first();
int somma_diag(const int mat[][3]);
void second();
int somma_diag(const int *mat, int n)... | true |
b5c96c0a66b68763235d27c9b877163ce957abd5 | C++ | petru-d/leetcode-solutions-reboot | /problems/p1332.h | UTF-8 | 523 | 3.15625 | 3 | [] | no_license | #pragma once
#include <string>
namespace p1332
{
class Solution
{
public:
int removePalindromeSub(std::string s)
{
auto S = s.size();
if (S == 0)
return 0;
bool is_palindrome = true;
for (size_t i = 0; i <= S / 2; ++i)
... | true |
16efbf1c6ec159552633fcf099e0e79429a5f606 | C++ | yistoyanova18/SP2020-Exercises | /Last Digit Ultimate/Last Digit Ultimate.cpp | UTF-8 | 254 | 3.046875 | 3 | [] | no_license | #include <iostream>
using namespace std;
bool lastDig(int a, int b, int c)
{
int aa = a % 10;
int bb = b % 10;
int cc = c % 10;
int d = aa * bb;
if (d % 10 == cc)
{
return true;
}
return false;
}
int main()
{
cout << lastDig(154, 52, 254);
} | true |
ebd39751bca481dc07ae7ced506bbfd804c493ae | C++ | eburghardt/cs252WebApp | /server/src/bag.cpp | UTF-8 | 1,261 | 3.390625 | 3 | [] | no_license | /**
* @file bag.cpp
* @brief This file models a bag of tiles. Players will get tiles from here, and the game will end when the bag is empty.
*
* @author Eric Burghardt
* @date 11/30/2017
*/
#include "../include/bag.hpp"
#include <ctime>
#include <cstdlib>
Bag::Bag() {
add('a', 9 * 15);
add('b', 2 * 15);
add(... | true |
63ae22124e67cb065807ecc6604f8083a28f3cce | C++ | JinnyJingLuo/Expanse | /Paradis_Hydrogen/ParadisJHU06012020/ParadisJHU06012020/ezmath/Edge.h | UTF-8 | 953 | 2.65625 | 3 | [] | no_license | #ifndef EDGE_H_
#define EDGE_H_
#include "GenericNode.h"
#include "GeometricComponent.h"
#include "Vector.h"
#include "Face.h"
using namespace EZ;
namespace GeometrySystem
{
class Edge : public GeometricComponent
{
public:
Edge();
Edge(const Edge& oEdge);
~Edge();
Edge& operator=(const Edge& oEdge);
void Reset(... | true |
63c29f8857d1717ae956b70bdb3827d2b8893d0f | C++ | cnanlmlin/piccante | /include/gl/filtering/filter_scatter.hpp | UTF-8 | 7,428 | 2.53125 | 3 | [] | no_license | /*
PICCANTE
The hottest HDR imaging library!
http://vcg.isti.cnr.it/piccante
Copyright (C) 2014
Visual Computing Laboratory - ISTI CNR
http://vcg.isti.cnr.it
First author: Francesco Banterle
PICCANTE is free software; you can redistribute it and/or modify
under the terms of the GNU Lesser General Public License as
p... | true |
6e5f96994d3ef430c4f84540c3e7053d96214ebc | C++ | sohana08/week_of_code | /prime_number.cpp | UTF-8 | 920 | 3.359375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool primeorNot(int n ) {
int flag=0;
if (n<=1){
return false;
}
for(int i=2; i<=n; i++) {
if(n%i == 0) {
flag++;
}
}
if(flag>1){
return false;
}else {
return true;
}
}
int main() {
int T;
cin>>T;
int n[T];
bool isPrime;
for(int i... | true |
1df943233ae2092e36666ecab1b4b3e0cec1c4b7 | C++ | bhamon/codingDojo-2016-arkanoid | /tests-arkanoid-model/TestVector2.cpp | UTF-8 | 3,575 | 3.203125 | 3 | [] | no_license | #include "CppUnitTest.h"
#include <arkanoid-model\Vector2.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace tests
{
TEST_CLASS(TestVector2)
{
public:
TEST_METHOD(defaultConstructor)
{
math::Vector2<int> v;
Assert::AreEqual(0, v.getX());
Assert::AreEqual(0, v.getY());
}
... | true |
2acd18dd51902b551d4fff1aff0ec6af07fdbb9b | C++ | corea1314/delirium-wars | /backup/Camera/Camera.cpp | UTF-8 | 2,219 | 2.578125 | 3 | [] | no_license | #include "Camera.h"
#include "Engine/Engine.h"
#include "Engine/Entities/Clock/Clock.h"
CCamera::CCamera()
{
m_MovementData.bMoving = false;
m_ZoomData.bZooming = false;
m_vCurrPos.Set(0,0);
m_fCurrZoom = 1.0f; // 1X
}
void CCamera::Goto( Vector2 in_vNewPos, float in_fDelayToDest )
{
m_MovementD... | true |
4d0418aa026ea8128def5b52868dc3a946b76321 | C++ | triffon/oop-2019-20 | /exercises/3/week3/main.cpp | UTF-8 | 398 | 3.34375 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
class Person{
public:
Person(){
cout << "constructor" << endl;
};
Person(Person& other){
cout << "copy constructor" << endl;
};
};
int swap(int& a, int& b){
int temp = a;
a = b;
b = temp;
}
///Person p1 = p2;
void func(... | true |
cfe74324438a6cc8bee0d6443c517808d9abe2c4 | C++ | Hotiakov/PiAA_8304 | /Butko_Artem/CAA_lab4/main.cpp | UTF-8 | 1,213 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
void getPrefix(std::string pattern, std::vector<int>& prefix)
{
int index = 0;
for (int i = 1; i < pattern.size(); ++i)
{
while (index != -1 && pattern[index] != pattern[i]) index--;
index++;
prefix.push_back(index);
}
}
v... | true |
897b197dd7e1cbe8f1e9d25196ae096af1bae2dd | C++ | spelka/LinuxChat | /server.cpp | UTF-8 | 4,212 | 2.796875 | 3 | [] | no_license | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <strings.h>
#include <arpa/inet.h>
#include <unistd.h>
#define DEFAULT_PORT 7000
#define MAX_CLIENTS 5
#define BUFFER_LENGTH 255
int main ()
{
//socket handling variables
int listen_socket, client_... | true |
0391af017c4e158abb87378a1c61c7c65b7a982b | C++ | icgw/practice | /LeetCode/C++/0099._Recover_Binary_Search_Tree/solution.h | UTF-8 | 915 | 3.171875 | 3 | [
"MIT"
] | permissive | /*
* solution.h
* Copyright (C) 2021 Guowei Chen <icgw@outlook.com>
*
* Distributed under terms of the Apache license.
*/
#ifndef _SOLUTION_H_
#define _SOLUTION_H_
#include <algorithm>
using std::swap;
#include "../data_structures.hpp"
class Solution {
private:
TreeNode* firstWrongNode = nullptr;
TreeNode* ... | true |
1839e9c68c2c214c53ed3df36ce76da12923db51 | C++ | YupengHan/LeetCode | /trapping_rain_water.cpp | UTF-8 | 4,945 | 3.34375 | 3 | [] | no_license | /*
class Solution {
public:
//cal sub water
int subwater(int a, int b, vector<int>& height) {
int min_tip = height[a]>height[b]? height[b]: height[a];
int sum = 0;
for (int i = a+1; i < b; ++i) {
sum += (height[i]<min_tip) ? (min_tip-height[i]) : 0;
}
return s... | true |
e8e4338e9b785efd6aadf1833a67a908d941b1ac | C++ | Jitendra-Sahu/cpp | /THREAD/th1.cpp | UTF-8 | 726 | 3.125 | 3 | [] | no_license | #include<pthread.h>
#include <unistd.h>
#include<iostream>
using namespace std;
void *hello(void *tid)
{
// long t;
// t = (long) tid;
for(int i = 20; i > 10; --i)
{
cout<<i<<"\n";
}
cout<<"\n Hello world, ";
pthread_exit(NULL);
}
int main(int argc, char *argv[])
{
pid_t pid;
pthread_t tid;
long t;
pid = ... | true |
6572bd1e3345746b9c573dc15e846116f6f73b13 | C++ | lichen-liu/TFTvm | /TFTvm/PARSER.cpp | UTF-8 | 1,230 | 2.890625 | 3 | [] | no_license | #include "PARSER.h"
#include <cassert>
#include <string>
namespace PARSER {
radix_e& operator << (radix_e& rad, const std::string &str)
{
if (str == "BIN") {
rad = radix_e::BIN;
}
else if (str == "HEX") {
rad = radix_e::HEX;
}
else if (str == "O... | true |
a8a3f8cb92104770cfe8671ead157cfad7578157 | C++ | LVladislav/mp2-lab1-set | /src/tbitfield.cpp | UTF-8 | 6,716 | 3.078125 | 3 | [] | no_license | // ННГУ, ВМК, Курс "Методы программирования-2", С++, ООП
//
// tbitfield.cpp - Copyright (c) Гергель В.П. 07.05.2001
// Переработано для Microsoft Visual Studio 2008 Сысоевым А.В. (19.04.2015)
//
// Битовое поле
#include "tbitfield.h"
TBitField::TBitField()
{
BitLen = 0;
MemLen = 0;
pMem = 0;
}
TBitField::TBitFi... | true |
d91a84262ff9cba107c3a513dc979a601f77d786 | C++ | shashank-13/GeeksForGeeks-InterviewBit | /equal.cpp | UTF-8 | 3,994 | 3.015625 | 3 | [] | no_license | vector<int> Solution::equal(vector<int> &A) {
vector<int>answer;
unordered_map<int,pair<int,int>>myMap;
int n=(int)A.size();
for(int i=0;i<n-1;i++)
{
for(int j=i+1;j<n;j++)
{
int sum=A[i]+A[j];
if(myMap.find(sum)==myMap.end())
{
pai... | true |
70d195584c2d4937a73b1337d7ca21c91e45fe77 | C++ | phramos07/taskminer | /tests/temp/functionCallTasks/lib/Graph.hpp | UTF-8 | 1,444 | 3.015625 | 3 | [] | no_license | #ifndef __GRAPH_H__
#define __GRAPH_H__
#include <iostream>
#include <list>
#include <vector>
#include <queue>
template<class NodeType, class EdgeType> struct Edge;
template<class NodeType, class EdgeType> struct Node;
template<class T> struct Coord;
template<class T>
struct Coord
{
T x;
T y;
};
template<class N... | true |
9eb84a8842a93ebad1138eb4273714232f3c2852 | C++ | zhangz5434/code | /2016/1459 最小公倍数.cpp | UTF-8 | 460 | 2.59375 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<cstdio>
int a[100];
using namespace std;
int zui(int x,int y)
{
int i;
cin>>x>>y;
int m=min(x,y);
for(i=m;i>1;i--)
if(x%i==0&&y%i==0)
break;
int a=(x*y)/i;
return a;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
... | true |
fd276144fa247f55385278f3582e71e749a03a1f | C++ | GautamSachdeva/Depth_first_search_reachibilty | /reachability.cpp | UTF-8 | 953 | 3.265625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using std::vector;
using std::pair;
void depth(int current,int finish,vector<vector<int> > &adj,vector<bool> &visited,bool &reachable){
if(current == finish){
reachable = true;
}
visited[current] = true;
for(int i = 0; i < adj[current].size() ; i++){
if(!visited[adj[curre... | true |
a6133f412ae80dca19aa6075180c5514a2dbdc63 | C++ | joydip10/Code-Practise-with-C- | /three.cpp | UTF-8 | 821 | 3 | 3 | [] | no_license | #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b,c;
int test;
scanf("%d",&test);
while(test--)
{
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
if(a>c)
{
swap(a,c);
}
el... | true |
92a43e0a7bfe48c887366a48c719caede4f89021 | C++ | ManasHarbola/CTCI_Solutions | /Chapter1/oneAway.cpp | UTF-8 | 949 | 3.34375 | 3 | [] | no_license | #include <iostream>
using namespace std;
bool isOneEditAway(string s1, string s2) {
int diff = s1.size() - s2.size();
if (diff < -1 || diff > 1) {
return false;
}
string *smaller, *larger;
if (diff < 0) {
smaller = &s1;
larger = &s2;
} else {
smaller = &s2;
... | true |
b54b5c334265d25c70709dbecfbf186823b99d44 | C++ | kate-ly-zhao/Eckel_ThinkingInCPP | /Chp5/Questions/C5Q06.cpp | UTF-8 | 851 | 4.125 | 4 | [] | no_license | // C5Q06.cpp
/* Create a Hen class. Inside this, nest a Nest class. Inside Nest, place an
Egg class. Each class should have a display() member function. In main(),
create an instance of each class and call the display() function for each
one. */
#include <iostream>
using namespace std;
class Hen {
pu... | true |
6fd650e5585b8256daaad5ff80ad0c1bbd18c0b1 | C++ | patiwwb/placementPreparation | /Trees/BinaryTrees/pruneWithPathSumLessThanK.cpp | UTF-8 | 1,372 | 3.453125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *left,*right;
Node(int x){
data=x;
left=right=NULL;
}
};
Node *pruneWithPathSumLessThanK(Node *root,int k,int *sum){
if(root==NULL)return NULL;
int lsum=*sum+root->data;
int rsum=lsum;
root->left=pruneWithPathSumLessThanK(root->l... | true |
7d631a94acae5eea9b2b19ac1ac054670a0c22a2 | C++ | arangodb/windows-procdump-wrapper | /corewriter/main.cpp | UTF-8 | 378 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | // corewriter.cpp : Defines the entry point for the console application.
//
#include "CoreWriter.h"
#include <iostream>
int main(int argc, char** argv)
{
CoreWriter coreWriter;
try {
coreWriter.run(argc, argv);
} catch (std::exception &e) {
std::cerr << "Error: " << e.what();
return 1;
} catch (...) {
st... | true |
cae711add9b88d47bf86d79b09fb77c9d8438a35 | C++ | lakshyajit165/Hackerrank1 | /Test_fraction.cpp | UTF-8 | 405 | 2.640625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int main(){
double n,pos=0,neg=0,zero=0; double fp,fn,fz;
cin>>n;
int A[100];
for(int i=0;i<n;i++)
cin>>A[i];
for(int j=0;j<n;j++){
if(A[j]>0)
pos++;
else if(A[j]<0)
neg++;
else if(A[j]==0)
zero++;
}
... | true |
a5e30e0e75d98bff385fba3621e4b2b5b255f5f7 | C++ | hgneer/PAT | /1053.cpp | UTF-8 | 1,785 | 2.875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
const int MAX = 10014;
using namespace std;
int number,nonleaf,neededweight;
struct{
int weight;
vector<int> child;
}node[MAX];
int num = 0;
vector<int> track[MAX];
vector<int> nowtrack;
... | true |
fd240cf5b29c144a6c6f863ef9252c02eeb4e5f0 | C++ | daybrush/HCI_DrawingPad | /src/PenLine.h | UTF-8 | 315 | 2.578125 | 3 | [] | no_license | #include "PenGroup.h"
class PenLine : public PenGroup{
public:
PenLine();
~PenLine();
void add(ofPoint point, ofColor c);
virtual void setup();
virtual void add(int x, int y);
virtual void draw();
virtual void clear();
private:
vector<ofPoint> position;
vector<ofColor> color;
}; | true |
5055ddd11c9effe909b48a77de3596814aedacae | C++ | AsadUllahShaikh123/push-it-hacktoberfest | /C++/Postfix_conversion.cpp | UTF-8 | 2,753 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
// Implementaion if simple stack
template <class T>
class Stack{
T *x;
int p, size;
public:
Stack(int s=10){ size = s; x = new T[size]; p = 0; }
bool isFull(){ return p == size; }
bool isEmpty(){ return p == 0; }
void push(T d){
if (isFull()) thr... | true |
4ec1fcf08a14b59aff5ed51e7b4684c6e438b99e | C++ | Mindful/sos | /data_structures/lab_6/min_stack.cpp | UTF-8 | 1,223 | 3.671875 | 4 | [] | no_license | #include <stack>
#include <iostream>
using namespace std;
class MinStack{
private:
stack<int> s;
stack<int> mins;
int min;
int curSize;
public:
MinStack() : curSize(0){}
bool isEmpty(){
return curSize==0;
}
void push(int i){
if(isEmpty() || i <= min){
min = i;
mins.push(i);
}
... | true |
5fbe93cfa9191cbd57baef40071948c3b95f6ba9 | C++ | libaoke/Cpp-Practices | /modern/for_range/for_range.cpp | UTF-8 | 387 | 3.078125 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <vector>
int main() {
std::vector<int> vec = {1, 2, 3, 4};
if (auto itr = std::find(vec.begin(), vec.end(), 3); itr != vec.end())
*itr = 4;
for (auto e : vec) {
std::cout << e << std::endl;
}
for (auto &e : vec) {
e += 1;
}
std::cout << std::e... | true |
5a27fe95de39d3a00fae25f11d29af30cd31f61c | C++ | samuelharroch/Pandemic-CPP | /sources/Player.cpp | UTF-8 | 3,382 | 3.359375 | 3 | [] | no_license | #include "Player.hpp"
#include "City.hpp"
#include "Color.hpp"
#include <string>
#include <exception>
using namespace std;
using namespace pandemic;
const unsigned int cards_to_cure = 5;
Player::Player(Board& board, City city):board(board), current_city(city){
}
Player& Player::take_card(City city){
... | true |
19bcb000b7fba16427538c969dd15db5cc96cb20 | C++ | fwolle30/VectorTest | /src/Math/Vector.cpp | UTF-8 | 2,110 | 3.5 | 4 | [] | no_license | #include "./Math/Vector.hpp"
#include <algorithm>
#include <cmath>
#include "./Math/Point.hpp"
Vector_2d::Vector_2d() : x(0), y(0) {}
Vector_2d::Vector_2d(float x, float y) : x(x), y(y)
{
if (isnanf(x))
{
this->x = 0;
}
if (isnanf(y))
{
this->y = 0;
}
}
Vector_2d::Vector_2d(... | true |
9ade46d1def1bab104ef0f05dd91f381f482c9f7 | C++ | evrudenko/path_searching_directed_graph | /main_header.hpp | UTF-8 | 632 | 2.765625 | 3 | [] | no_license | #ifndef _MAIN_G_HEADER_
#define _MAIN_G_HEADER_
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <regex>
using namespace std;
/*
* ~~~~ Описание структуры:
* Вспомогательная структура данных, представляющая направленное ребро графа (дугу),
... | true |
9a4538ef666f5c5cf37eef309e93ac678c014a2a | C++ | muhammadosmanali/Data-Structure | /linklist & stack Queue.cpp | UTF-8 | 2,071 | 3.859375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class node {
public:
int data;
node * next;
};
class LL {
protected:
node * head;
public:
LL() {
head = NULL;
}
void insert(int v) {
node * nptr = new node();
nptr->data = v;
nptr->next = NULL; // Because next contain the garbage value so w... | true |
7d95f921bccb47791f0a65c09d2ccfb8c44cdb99 | C++ | JakubSzym/Library-for-home-usage | /inc/user.hh | UTF-8 | 1,575 | 3.328125 | 3 | [] | no_license | #ifndef USER_HH
#define USER_HH
/*
*Plik zawiera deklaracje klasy User, prototypy metod i przeciazenia operatorow wczytywania/zapisywania dla strumieni plikowych
*/
#include<string>
#include<iostream>
#include<fstream>
#include<ncurses.h>
class User{
private:
std::string name; //imie i nazwisko
std::string pes... | true |
dead11d9288e6d77eae187bc32aacae408bc252f | C++ | Rastorguev0/graph_algorithms_course | /week2/toposort.cpp | UTF-8 | 1,240 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using std::vector;
using std::pair;
class DirectedGraph {
public:
DirectedGraph(vector<vector<int>> adj_list) {
adj = move(adj_list);
used.assign(adj.size(), false); //V
}
void DFS(int v, vector<int>& order) {
used[v] = true;
for (int... | true |
634d730fe83ba12dcd1a3be123b5d0ff8f5f53ba | C++ | vignesh-raghavan/SAT-solver | /parse_c.h | UTF-8 | 2,925 | 2.515625 | 3 | [] | no_license | #ifndef PARSE_C_H_
#define PARSE_C_H_
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<stdlib.h>
#include"types.h"
#include<algorithm>
using namespace std;
using namespace SAT;
int getint(ifstream *inf, char *c)
{
int neg,val,factor;
int i = 0;
char buf[32];
val = 0;
factor = ... | true |