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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8957532ae5224c1242990f09e6a4d412bacd8692 | C++ | aadarshasubedi/Learning-CPlusPlus-by-Creating-Games-w-UE4 | /Ch 3 - If, Else and Switch/Ex0 - IfElse/Source.cpp | UTF-8 | 296 | 3.71875 | 4 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main()
{
cout << "Enter two number integers, separated by a space " << endl;
int x, y;
cin >> x >> y;
if (x > y)
{
cout << "x is greater than y." << endl;
}
else
{
cout << "y is greater than x." << endl;
}
return 0;
} | true |
02d4ed6ed6402ba13ccdfc0178ebdf0537238a83 | C++ | niuxu18/logTracker-old | /second/download/CMake/CMake-gumtree/Kitware_CMake_repos_basic_block_block_307.cpp | UTF-8 | 288 | 2.828125 | 3 | [] | no_license | (typ->status & _LINKED_TYPE)
{
assert(argp != 0);
return(
Next_Choice(typ->left ,field,argp->left) ||
Next_Choice(typ->right,field,argp->right) );
}
else
{
assert(typ->next != 0);
return typ->next(field,(void *)argp);
} | true |
7cb1856aa8cf4fbcc57a98c2b87a7866f8b92e71 | C++ | Axel542/PhysicsEngine | /Physics Engine Source/PhysicsEngine/Box.h | UTF-8 | 1,827 | 3.09375 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Rigidbody.h"
#include "PhysicsObject.h"
#include <Gizmos.h>
using namespace aie;
//Child of Rigidbody.
class Box : public Rigidbody
{
public:
//Constructors and Destructors.
Box();
Box(glm::vec2 position, glm::vec2 velocity,
float mass,const float extenseX,
const float extenseY,
const g... | true |
df9909add6366cddb32c61b790132c291d9051ee | C++ | ctyin/ese421_arduinos | /HW_Point2Point_Starter.ino | UTF-8 | 2,876 | 2.546875 | 3 | [] | no_license | #include <Romi32U4.h>
Romi32U4LCD lcd;
Romi32U4Buzzer buzzer;
Romi32U4ButtonA buttonA;
Romi32U4ButtonB buttonB;
Romi32U4ButtonC buttonC;
Romi32U4Motors motors;
Romi32U4Encoders encoders;
const char beepButtonA[] PROGMEM = "!c32";
const char beepButtonB[] PROGMEM = "!e32";
const char beepButtonC[] PROGMEM ... | true |
a7b7f110990737c832133147cbb312797c93001f | C++ | vladdy-moses/ulstu-ivk-os-2019 | /labworks/lw04/Badamshin/badamshin lab4.2/main.cpp | UTF-8 | 403 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
using namespace std;
int main()
{
int fd;
char name[]="/home/student/Documents/labs/aaa.fifo";
char resstring [30];
mknod(name, S_IFIFO | 0666, 0);
fd = open(name, O_RDONLY);
rea... | true |
059a486790ab20d71fb6dbed9363fc2fe93f935e | C++ | TenFifteen/SummerCamp | /lbc_lintcodeII/397-longest-increasing-continuous-subsequence.cc | UTF-8 | 944 | 3.53125 | 4 | [] | no_license | /*
题目大意:
最长连续上升子序列
解题思路:
见代码。
遇到的问题:
没有。
*/
class Solution {
public:
/**
* @param A an array of Integer
* @return an integer
*/
int longestIncreasingContinuousSubsequence(vector<int>& A) {
// Write your code here
if (A.size() < 2) return A.size();
int len = 1;
... | true |
15e5f43f4d99df94a48fe45f251d3445051ef4e2 | C++ | jobinrjohnson/red_channel_extract | /src/VideoProcessor.cpp | UTF-8 | 1,722 | 2.75 | 3 | [] | no_license | //
// Created by Jobin Johnson on 09/03/20.
//
#include <sys/time.h>
#include "../include/VideoProcessor.hpp"
using namespace cv;
void VideoProcessor::setCaptureDevice(int device) {
this->videoInputDeviceID = device;
}
std::string VideoProcessor::getFileName() {
struct timeval tp;
gettimeofday(&tp, NULL... | true |
637a4b7574d9b2c94c724b9a5a34950a74aa5a94 | C++ | shixv/test | /cpp/05cpp/MyString.h | GB18030 | 740 | 3.34375 | 3 | [] | no_license | #include <iostream>
using std::ostream;
using std::istream;
class MyString
{
private:
char *str; //ڶϿһַĿռ䣬 strָռַ
int len; //ַij
public:
MyString();
MyString(int len);
MyString(const char *str);
MyString(const MyString& another);
~MyString();
//ز[]
char &operator[](int n);
//ز=
MyStr... | true |
d74625b6d7e6418213181c045740a2bdc0a55ed1 | C++ | MissGrass/Lanqiao | /算法训练/2 最大最小公倍数 .cpp | GB18030 | 614 | 3.453125 | 3 | [] | no_license | /*
֪һNʴ1~NѡǵСΪ١
ʽ
һN
ʽ
һʾҵС
9
504
ݹģԼ
1 <= N <= 106
*/
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
long long n,ads;
cin >> n;
if(n <= 2)
ads = n;
else if(n % 2 == 1)
ads = n*(n-1)*(n-2);
else if(n % 3 != 0)
ads = n*(n-1)*(n-3) ;
else
ads = (n-1)*(n-2)*(... | true |
d8f344acaf69154b632037e69a310558b87ba575 | C++ | anchal441/codes | /A_08/reverserecursion.cpp | UTF-8 | 275 | 2.96875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void reverse(int index,int arr[]){
if(index<0){
return;
}
cout<<arr[index]<<" ";
reverse(index-1,arr);
}
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
reverse(n-1,arr);
} | true |
d25dee865f6c72adb58e1505bfca336a1464a9f9 | C++ | rock-core/base-types | /src/samples/Temperature.hpp | UTF-8 | 726 | 2.65625 | 3 | [] | no_license | #ifndef __BASE_SAMPLES_TEMPERATURE_HH__
#define __BASE_SAMPLES_TEMPERATURE_HH__
#include <base/Temperature.hpp>
#include <base/Time.hpp>
namespace base
{
namespace samples
{
struct Temperature : public base::Temperature
{
/** The sample timestamp */
base::Time time;
... | true |
05755c82b49a02c4ea28d815b1a7bbbd88c720f1 | C++ | G0uth4m/daily-coding-problem | /189 - distinct_subarr.cpp | UTF-8 | 1,354 | 3.9375 | 4 | [] | no_license | /*
This problem was asked by Google.
Given an array of elements, return the length of the longest subarray where all its elements are distinct.
For example, given the array [5, 1, 3, 5, 2, 3, 4, 1], return 5 as the longest subarray of distinct elements is [5, 2, 3, 4, 1].
*/
#include <iostream>
#include <vector>
#in... | true |
f1a22292a13e07983037301c3aa40b99c0f3d1d5 | C++ | huntekah/Gra_w_statki | /Gra_w_statki/main.cpp | WINDOWS-1250 | 2,075 | 2.671875 | 3 | [] | no_license | /*
Projekt stworzony na zajcia z Programowania Obiektowo Orientowanego,
przez Mateusza Lewandowskiego (122599) i Krzysztofa Jurkiewicza (122546).
Gra jest grywalna dla rnych rozdzielczoci,lecz projektowana bya domylnie pod rozdzielczo 1280x720,
i wtedy dziaa najlepiej
Sztuczna inteligencja ustawia swoje statki na jed... | true |
4f549f5ed9718495ce077375ae8468dded47387f | C++ | HippoCracker/Qt | /PayrollSystem/mainwindow.cpp | UTF-8 | 979 | 2.734375 | 3 | [
"MIT"
] | permissive | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include "adminwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
adminUsername = "admin";
adminPassword = "admin";
employeeDirectory = new EmployeeDirectory();
connect(ui-... | true |
0bbe68d09f3b3d0a376bd6bf567e85a9b5de9e0d | C++ | jjunCoder/ProblemSolving | /1292/1292/소스.cpp | UTF-8 | 557 | 2.6875 | 3 | [] | no_license | /*
2016.9.19
BaekJoon Online Judge
Problem Solving
Seong Joon Seo (ID: jjunCoder)
Problem
#1292
쉽게 푸는 문제
*/
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v,ps;
for (int i = 1; i <= 50; i++) {
for (int j = 0; j < i; j++) {
v.push_back(i);
}
}
int sum = 0;
for (int ... | true |
736eaf06c40c9503703e310b079453219466da0b | C++ | Matt-Puentes/rationalNumbers | /rational.cpp | UTF-8 | 3,949 | 3.46875 | 3 | [] | no_license | // rational.cpp Andrew Levy Matthew Puentes
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cctype>
#include "rational.h"
int gcd(int a, int b) {
int c;
while (a != 0) {
c = a;
a = b % a;
b = c;
}
return b;
}
double getDouble(int x) {
double a = x;
return a;
}
Rational::Rational()... | true |
b5b0a934917e5937d0fd0c991ce5a3128c1534ab | C++ | radioroy/directionFinding | /DF_tone_test/DF_tone_test.ino | UTF-8 | 576 | 2.890625 | 3 | [] | no_license | // Roy Gross
// 3 - 8 - 2020
// eighth tester program
// switching between ant 1 and ant 2 because of delay problem (#2)
// no LEDs in this program
// - using tone for higher switching rate
// - I was running into the speed limit of a loop with delays
// - tone operates different than delay - switching rate of u... | true |
e814ff0d8ebdf943b2d405ae4f9ae0ed8e01f08b | C++ | PanosGeorgiadis/AccelDevTools | /boost_asio_tcp_example/inc/RawData.h | UTF-8 | 3,208 | 3.078125 | 3 | [] | no_license | #pragma once
#include <stdint.h>
#include <string>
#include <vector>
#include "Generic/noncopyable.h"
namespace Server {
namespace CeosProtocol {
class RawData :
public Infra::Generic::NonCopyable
{
public:
explicit RawData(uint32_t maxLength) :
m_data(maxLength),
m_pStart(m_data.data()),
... | true |
15dc37af5d1e1d8f14e3831507873fce404d2d5e | C++ | AnthonyCusimano/VectorMath | /A_Quaternion.cpp | UTF-8 | 7,152 | 3.0625 | 3 | [] | no_license | #include "A_Quaternion.h"
const float A_Quaternion::S_QuaternionNormalThreshold = 0.0001f;
A_Quaternion::A_Quaternion() {
this->dimensions[0] = 0.0f;
this->dimensions[1] = 0.0f;
this->dimensions[2] = 0.0f;
this->dimensions[3] = 0.0f;
}
A_Quaternion::A_Quaternion(A_Quaternion* const _AQ) {
this... | true |
9c41115f19f27542633cb85794cc8b891f95e4db | C++ | AliHashemi-ai/LeetCode-Solutions | /C++/reverse-substrings-between-each-pair-of-parentheses.cpp | UTF-8 | 531 | 3.359375 | 3 | [
"MIT"
] | permissive | // Time: O(n^2)
// Space: O(n)
class Solution {
public:
string reverseParentheses(string s) {
vector<string> stk = {""};
for (const auto& c : s) {
if (c == '(') {
stk.emplace_back();
} else if (c == ')') {
auto end = move(stk.back()); stk.pop... | true |
c6c46cb855a84285773573ab89ebe336cf836f0a | C++ | AnkitBhagasra/Euler | /1-25/euler013.cpp | UTF-8 | 587 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream fin("euler013.txt");
string num[100];
for (int n = 0; n < 100; n++)
getline(fin, num[n]);
string sum(15, '\0');
for (int n = 0; n < sum.size() - 2; n++) {
int tSum = 0;
for (int m = 0; m < 100; m++)
tSum ... | true |
19897e59536f91ff547de1f5ad88980bdbadc6f0 | C++ | blackenwhite/Competitive-Coding | /DAA-2/disjoint_set_cc.cpp | UTF-8 | 2,886 | 3.0625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
long long int countOps;
struct Node
{
int rank;
int parent;
};
struct Edge
{
int start;
int end;
};
class disjointSet
{
public:
Node *disjSet;
int n;
static int opCount;
disjointSet(int n)
{
opCount = 0;
disjSet ... | true |
ee4810c14f8b9d9ae462c4b91c9e59c72c593ff9 | C++ | Kamfeth/Polski-SPOJ | /Łatwe/C++/Dodawanie liczb całkowitych/DodawanieLiczbCałkowitych.cpp | UTF-8 | 219 | 2.84375 | 3 | [] | no_license | #include <iostream>
int main() {
int firstNumber;
int secondNumber;
int thirdNumber;
std::cin >> firstNumber >> secondNumber >> thirdNumber;
std::cout << firstNumber + secondNumber + thirdNumber;
}
| true |
54c6e1a5ab2c4f138ccf4023e1b6bdeddc3cae30 | C++ | areyykarthik/Zhukouski_Pavel_BSU_Projects | /Other Programming (C++)/Probe_Variant_2_KR/Probe_Variant_2_KR/Footballer.h | WINDOWS-1251 | 1,975 | 3.203125 | 3 | [] | no_license | #pragma once
#include<iostream>
#include<string>
#include<exception>
#pragma warning (disable: 4996)
using namespace std;
enum class Specialization { goalkeeper, defender, midfielder, striker };
class FootballerException
: public exception {
public:
FootballerException(const char *message)
: exception(message) {... | true |
e25a7c8ddcd59c7196797957dbf151e624eda52e | C++ | keithw/ahab | /opq.cpp | UTF-8 | 5,225 | 2.6875 | 3 | [] | no_license | #ifndef OPQ_CPP
#define OPQ_CPP
#include <pthread.h>
#include "opq.hpp"
#include "exceptions.hpp"
#include "mutexobj.hpp"
#include <typeinfo>
#include <stdio.h>
template <class T>
Queue<T>::Queue( int s_max_size )
: count( 0 ),
max_size( s_max_size ),
head( NULL ),
tail( NULL ),
output( NULL ),
... | true |
fc45b22325ee8c312d07dbc54a33d3660a7b033f | C++ | kimnamlhn/OPP-HCMUS | /Tuần 3/18120468/18120468/main.cpp | UTF-8 | 1,850 | 3.765625 | 4 | [] | no_license | #include "CLine.h"
#include "CRectangle.h"
#include "Dice.h"
#include "DynamicArray.h"
#include "Random.h"
int CRectangle::countRectangle = 0;
int CLine::countLine = 0;
int main()
{
//Đường thẳng
CLine line1({ 2,3 }, { 3,4 });
cout << "Display line 1: ";
line1.displayLine();
//copy đường thẳng 1 vào đường thẳn... | true |
96e4296e98a5ef326e96561639fe5ee5ae47e8a4 | C++ | NicoFlorschuetz/Bachelorthesis | /lib/simulation.cpp | UTF-8 | 5,504 | 2.703125 | 3 | [] | no_license | #include <simulation.h>
FDIR_Master::FDIR_Master(){
setup_pins();
}
Protocol::Protocol(){
}
bool Protocol::isMessageValid(){
return (buffer[0] != 0);
}
//create new message
static Message Protocol::receive(){
Message new_message;
new_message.id_board = buffer[0];
new_messag... | true |
177d29903cfc65d7a546b402264dc6df321250ea | C++ | PowerTravel/acg | /include/Camera.hpp | UTF-8 | 1,676 | 2.984375 | 3 | [] | no_license | #ifndef CAMERA_HPP
#define CAMERA_HPP
#include "Group.hpp"
#include "Hmat.hpp"
#include "TransformMatrix.hpp"
#ifndef CAMERA_PTR
#define CAMRA_PTR
class Camera;
typedef std::shared_ptr<Camera> camera_ptr;
#endif //CAMERA_PTR
/*
* Class: Camera
* Purpose: A camera.
* Misc: Derived from group.
*/
class Camera :... | true |
805783dbfa4a49320bcce821fcbf2de29a43adec | C++ | Jimut123/code-backup | /4rth_Sem_c++_backup/PRACTICE/Syllabus/references.cpp | UTF-8 | 372 | 3.03125 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int main()
{
int i = 10;
int &j = i;
cout<<endl<<"i = "<<i<<" j = "<<j;
j = 20;
cout<<endl<<"i = "<<i<<" j = "<<j;
i = 30;
cout<<endl<<"i = "<<i<<" j = "<<j;
i++;
cout<<endl<<"i = "<<i<<" j = "<<j;
j++;
cout<<endl<<"i = "<<i<<" j = "<<j;
cout<<endl<<"address of i = "<... | true |
4f84b72a0b53f0f18de7f1eae957ca6dd2edec03 | C++ | LibelulaV/Game_2D | /polygon/spaceship.cpp | UTF-8 | 1,144 | 2.8125 | 3 | [] | no_license | #include "spaceship.h"
#include "entity.h"
#include "../include/u-gine.h"
CSpaceship::CSpaceship(double x, double y, double width, double height, double angle, double rotateSpeed, double speed) : CEntity(ET_SPACESHIP, x, y, 255, 255, 255, 255) {
m_height = height;
m_width = width;
m_angle = angle;
m_rotateSpeed = ... | true |
49833f7e4b9c96f4effc2e1b2ef6e5e60dae9ec4 | C++ | alekssandrans/OOP | /Company/Manager.cpp | UTF-8 | 1,228 | 3.125 | 3 | [] | no_license | #include "Manager.h"
#include<iostream>
Manager:: Manager(const char* name, unsigned yearsOfWork,unsigned programsCount,unsigned salesCount,const char* nickname,unsigned sharesCount)
:Employee(name,yearsOfWork),
Programmer(name,yearsOfWork,programsCount),
Seller(name,yearsOfWork,salesCount),
... | true |
5622c8dd6086dc4478421bf32cdd93264a109321 | C++ | Nikhil-Vinay/DS_And_Algo | /Graph/krushkal.cpp | UTF-8 | 1,795 | 3.625 | 4 | [] | no_license | /** MST stands for minimum spanning tree ***/
/* MST is calculated for undirected weighted and connected graph only **/
/* Number of MST edges = total number of vertices -1 */
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
class edge
{
public:
int u;
int v;
int wt;
edge(int _u,int _... | true |
ca3c9602f370444e0b6b16c96af25d4579c0b04f | C++ | wilmer05/maratones | /libreria/trie.cpp | UTF-8 | 536 | 2.640625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
char cad[100];
struct trie{
trie *nx[30];
trie(){
for(int i=0;i<30;i++)
nx[i]=NULL;
}
void insert(char *s){
if(*s=='\0') return;
if(nx[*s-'a']==NULL){
nx[*s-'a'] = new trie;
}
(*nx[*s-'a']).insert(s+1);
}
};
void recorro(trie &a){
for(int i=0;i<30... | true |
cb391a9f11cbcba459fc67d4264d49fde6e444c7 | C++ | cbm-fles/flesnet | /lib/monitoring/MonitorSink.cpp | UTF-8 | 4,600 | 2.828125 | 3 | [] | no_license | // SPDX-License-Identifier: GPL-3.0-only
// (C) Copyright 2021 GSI Helmholtzzentrum für Schwerionenforschung
// Original author: Walter F.J. Mueller <w.f.j.mueller@gsi.de>
#include "MonitorSink.hpp"
#include <algorithm>
#include <chrono>
#include <iomanip>
#include <sstream>
namespace cbm {
/*! \class MonitorSink
... | true |
78b7f58ea70b929a19662a3450cba99cdc6b980f | C++ | puannalita19/CPP_TonyGaddis | /PC_10/ch 10 no 2.cpp | UTF-8 | 798 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cstring>
using namespace std;
void Backward (char *);
int main()
{
char word[41];
cout << "This program will display the letters of a word entered in backwards order"
"follwed by a period." << endl;
... | true |
5f6cb0bc5c4a8318bbd14008d3c39b4e2169f6a2 | C++ | caiyaodeng/DataIndex | /include/Kernel/FreeSpace/FreeSpace.h | UTF-8 | 1,611 | 2.5625 | 3 | [] | no_license | #ifndef _INTERFACE_FREE_SPACE_H_
#define _INTERFACE_FREE_SPACE_H_
namespace NS_DataIndex {
/**
* 说明:空闲空间管理口接口
* 创建人:蔡曜镫
* 更新时间:2016/1/29*/
virtual
class FreeSpace {
public:
FreeSpace (){}
virtual
~FreeSpace (){}
/**
* 说明:申请空闲块
... | true |
f445dc0aa3904c15e3749e5361a84d94d9a5ab59 | C++ | bruchs/BattleTank | /BTGame/Source/BTGame/TankBarrel.cpp | UTF-8 | 686 | 2.515625 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#include "TankBarrel.h"
void UTankBarrel::Elevate(float RelativeSpeed)
{
// Move The Barrel The Right Amount This Frame.
// Clamp The Relative Speed So The Barrel Always Move At The Same Speed.
RelativeSpeed = FMath::Clamp(RelativeSpeed... | true |
2470ae9d04ec50969cc75fb4a1f8619fec124fe3 | C++ | yujincheng08/bisoncpp | /bisonc++/terminal/nameorvalue.cc | UTF-8 | 181 | 2.640625 | 3 | [] | no_license | #include "terminal.ih"
ostream &Terminal::nameOrValue(ostream &out) const
{
if (isReserved())
return out << d_readableLiteral;
return out << setw(3) << value();
}
| true |
5a30dc3107967b5fe86db3516bbc1db5b630b174 | C++ | AnubhavShukla09/AlgoPractiseQuestions | /UniqueNumber2.cpp | UTF-8 | 742 | 2.78125 | 3 | [] | no_license | #include<bits/stdc++.h>
#define ll long long
#define el endl
using namespace std;
int indexOfSetbit(int element) {
int pos = 0;
while(element > 0) {
if(( element & 1) == 1) {
break;
}
pos++;
element = element >> 1;
}
return pos;
}
int main() {
int n;
... | true |
e95a85a884b971c99120aac523c2125510643927 | C++ | dreamplayer-zhang/FastImaging | /src/stp/gridder/aw_projection.h | UTF-8 | 9,644 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | /** @file aw_projection.h
* @brief Classes and function prototypes of aw_projection.
*/
#ifndef AW_PROJECTION_H
#define AW_PROJECTION_H
#include "../common/fft.h"
#include "../common/matstp.h"
#include "../common/spline.h"
#include "../types.h"
#include <armadillo>
namespace stp {
/**
* @brief The WideFieldImag... | true |
7d019ed7f81f05db2083bbe3cb737c8373da5c65 | C++ | saberhosneydev/cpp | /FinalExam/src/mathoperators.cpp | UTF-8 | 404 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int main(){
cout << "Enter a number : ";
int N;
cin >> N;
cout << "N after adding " << (N+=2) << endl;
cout << "N after subtract " << (N -= 2) << endl;
cout << "N after dividing " << (N /= 2) << endl;
cout << "N after multiplying " ... | true |
54e4712056f6bff92845cf8ef31ec56de09eeb53 | C++ | thisisziihee/algorithm | /inflearn/35_specialsort(구글).cpp | UHC | 1,161 | 3.453125 | 3 | [] | no_license | /*
N ԷµǸ Էµ ؾ Ѵ. ʿ ʿ ־ Ѵ. Ѵ.
Է¼ : ù ° ٿ N(5<=N<=100) ־, ٺ ־. 0 Էµ ʴ´.
¼ : ĵ Ѵ.
*/
#include<stdio.h>
int main() {
int n, num[101], i, j, minustemp, temp;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &num[i]);
}
// 1
/*int minusIdx = 0;
for (i = 0; i < n; ... | true |
c0dd83a22220254cd466bd612f34f8689fe78f86 | C++ | shivanshcoder/Notes-code | /Code/Problem1_1.cpp | UTF-8 | 369 | 3.40625 | 3 | [] | no_license | #include<iostream>
using namespace std;
/* Lets take example as 3 + 4*/
#define squared(x) x*x //becomes 3+4*3+4
#define squared2(x) (x)*(x) //becomes (3+4) * (3+4)
#define squared3(x) (x*x) //becomes (3+4*3+4)
#define squared4(x) ((x)*(x)) //becomes ((3+4)*(3+4))
void main() {
int ans = 18 / squared(3... | true |
543937a6465072491ad4d4bb0a80fe1e43de34f6 | C++ | aaronschraner/VendMachine | /chardefs.ino | UTF-8 | 965 | 2.78125 | 3 | [] | no_license | #include "chardefs.h"
uint16_t sevsegTo14seg(uint8_t sevseg, uint8_t digit)
{
uint16_t temp=sevseg;
return digit ?
(((temp << 7)&0x3F00) | ((temp&0x01)<<6)):
((temp << 14) | (temp >> 2));
}
uint8_t charTo7seg(char c)
{
if(c >= '0' && c <= '9')
return SEVSEG_NUMS[c-'0'];
if(c >= 'A' && c <= 'F')
... | true |
b23c0e68cdc07ca0548b3d509896135232212666 | C++ | skononov/tiff2root | /tiff2root.cc | UTF-8 | 3,098 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <cstdlib>
#include "TH2F.h"
#include "TString.h"
extern "C" {
#include "tiffio.h"
}
using std::endl;
using std::cout;
using std::cerr;
static const char * progname = "tiff2root";
static void Usage(int status=0)
{
cout << "Usage: " << progname << " file.tif [file.... | true |
c4953972d214dbd491acdf7e89470bca68261ea5 | C++ | nikzsaz/HackerRank | /TheLongestCommonSubsequence.cpp | UTF-8 | 1,020 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int max(int a,int b){
return a>b?a:b;
}
void LCS(int s[],int s1[]){
}
int main() {
// here is the dp implementation of the LCS
int arr[101];
int arr1[101];
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<m;i++){
cin>>arr1[i];
}
... | true |
2c441aee29b1222821efbb6e6cb100d5da3ff9ab | C++ | Sam071100/CPlusPlus-OOPS | /Tutorial29.cpp | UTF-8 | 547 | 3.765625 | 4 | [] | no_license | #include <iostream>
using namespace std;
class complex
{
int a,b;
public:
// Creating a default constructor.
complex();// Constructor Declaration
void printNumber()
{
cout <<"Your number is "<<a<<" + "<<b<<"i"<<endl;
}
};
complex ::complex() // Constructor definition this is a Defa... | true |
29b0effd3826f2663a420d3ab4ab8854c3115647 | C++ | smarchevsky/VisualEngine | /include/mesh.h | UTF-8 | 1,888 | 2.875 | 3 | [
"MIT"
] | permissive | #ifndef MESH_H
#define MESH_H
#include <initializer_list>
#include <memory>
#include <set>
#include <vector>
#include <glm/glm.hpp>
namespace Visual {
class MeshData;
typedef unsigned int GLuint;
typedef int GLsizei;
class Mesh {
public:
struct OBB { // object's bounding box
OBB() : min(FLT_MAX), max(-FL... | true |
839d76898080609162aeea2260868d6b0293fae4 | C++ | tinglai/Algorithm-Practice | /LeetCode/Wildcard Mathcing/main.cpp | UTF-8 | 6,448 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cstring>
using namespace std;
/*
class Solution{
// there are several ways to solve this problem
// 1. To use DP works, it will either use a double vector (O(M * N) in space)
// where M is the length of s and N is the length of p
// or will run a double loop (O(MN) in t... | true |
c8bafe4b0cbc032718e7ea238aec8f26f4d09ca1 | C++ | aaronmaynard/CPlusPlus | /CS 1337 - Computer Science I (C++)/Chapter 3/Average Rainfall/Main.cpp | UTF-8 | 1,164 | 4.25 | 4 | [] | no_license | /*
Write a program that calculates the average rainfall for three months. The program
should ask the user to enter the name of each month, such as June or July, and the
amount of rain (in inches) that fell each month. The program should display a
message similar to the following:
The average rainfall for June, July, ... | true |
90f78eb1f663b106ccecbab2a3f3f21e3eb84f46 | C++ | ucam-comparch-loki/lokisim | /src/Tile/Tile.h | UTF-8 | 3,978 | 2.59375 | 3 | [
"MIT"
] | permissive | /*
* Tile.h
*
* Base class for all types of tile on the Loki chip.
*
* Exposes an interface to each of the global networks on chip. There are no
* routers in the Tile component, however; this is left to the global networks.
*
* All tiles must have the same interface, but particular networks may be unused
* on ... | true |
eaf3a7295d07c3306de9ea28202a58c15294b95a | C++ | jbendtsen/muscles | /Muscles/font.cpp | UTF-8 | 5,956 | 2.546875 | 3 | [] | no_license | #include <ft2build.h>
#include FT_FREETYPE_H
#include FT_BITMAP_H
#include "muscles.h"
#define FLOAT_FROM_16_16(n) ((float)((n) >> 16) + (float)((n) & 0xffff) / 65536.0)
FT_Library library = nullptr;
Font_Face load_font_face(const char *path) {
if (!library) {
if (FT_Init_FreeType(&library) != 0) {
fprintf(st... | true |
1940951b160b479cdbde7d2d075be02976e3598e | C++ | hydrogen69/Probelm-solved | /CodeForces/535A/17605884_AC_31ms_16kB.cpp | UTF-8 | 592 | 2.984375 | 3 | [] | no_license |
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str1[20]={ "zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};//0 to 19
string str2[8]={"twenty","thirty","forty","fifty","sixt... | true |
4bf2f3c7941d8a99cab88cee3783739cfca00665 | C++ | algo-imp/algorithm-practice | /backtrack_subsets.cpp | UTF-8 | 1,467 | 3.453125 | 3 | [] | no_license | /*
* backtrack_subsets.cpp
* Reference: Chapter 7 - The Algorithm Design Manual
* Created on: May 12, 2014
* Author: vietnguyen
*/
#include <iostream>
using namespace std;
class Subset{
private:
int NMAX = 100;
int MAXCANDIDATES = 2;
bool finished = false; /* found all solution yet */
public:
void ba... | true |
5ffa398a3bd15766e629c9a70aee62ae51c897e4 | C++ | NekoSilverFox/CPP | /214 - 排序 - 基数排序(错)/214 - 排序 - 基数排序.cpp | GB18030 | 2,941 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | #include<iostream>
using namespace std;
template<typename T>
int GetArrayLength(T& arr)
{
return sizeof(arr) / sizeof(arr[0]);
}
template<typename T>
int PrintArray(T& arr)
{
int length_arr = GetArrayLength(arr);
cout << "length : " << length_arr << endl;
for (int i = 0; i < length_arr; i++)
{
cout << arr[i] <... | true |
1af0f187d9e741645d668983a40f21d651930b3e | C++ | iiyiyi/solution-book-till-2020 | /Number Theory/欧拉函数欧拉表/BZOJ2818.cpp | UTF-8 | 746 | 2.515625 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=10000000+50;
typedef long long ll;
int n;
int prime[MAXN],pnum=0;
int phi[MAXN];
ll sum[MAXN];
void get_phi(int maxn)
{
memset(phi,0,sizeof(phi));
memset(sum,0,sizeof(sum));
phi[1]=sum[1]=1;
for (int i=2;i... | true |
1f933bc8b820df54a205e1f96f420adffac36b4f | C++ | learnin-tap/LeetCode_practice | /daily/C++版本/26. 删除排序数组中的重复项.cpp | GB18030 | 325 | 2.96875 | 3 | [] | no_license | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int sum=0;
nums.push_back(-9999); //Ϊԭһܼӵsumȥ
for(int i=1;i<nums.size();i++)
if(nums[i]!=nums[i-1])
nums[sum++]=nums[i-1];
return sum;
}
};
| true |
98db1fd550852f6bab7796967276fc20a0152d7c | C++ | alaneos777/club | /project euler/776.cpp | UTF-8 | 1,463 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
using lli = __int128_t;
using ld = long double;
const vector<int> digits = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
const int LEN = digits.size();
lli mem_f[20][200][2][200];
lli mem_g[20][200][2][200];
vector<lli> ten(LEN+1);
lli f(int pos, int sum, bo... | true |
15fbf06f15171417f17f9e1e9fd69ea2b84a738a | C++ | hdsmtiger/Solution4LeetCode | /Distinct Subsequences.cpp | UTF-8 | 943 | 2.734375 | 3 | [] | no_license | class Solution {
public:
int numDistinct(string S, string T) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int lengthS = S.size();
int lengthT = T.size();
if(lengthS < lengthT)
return 0;
int indexS =0, indexT = 0;
long long* lastcount = new lon... | true |
b1a636bb82765d9db20ee8cce6aa4b9ed6c56e3d | C++ | codecsp/SGPA_Calculator | /subjects.h | UTF-8 | 4,563 | 2.609375 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std ;
#include"structHeader.h"
#include<string.h>
#include <sstream>
#include<fstream>
//#include"branch.h"
//#include"pointer.h"
fstream fi;
string lin;
int countsubject;/*typedef struct sub
{
char subname[50];
int credit;
}SUB;
*/
void getgrades()
{
cou... | true |
87b31e3a7ae0144b5357c2babd6b1794814b2b53 | C++ | SOFTK2765/PS | /BOJ/11586.cpp | UTF-8 | 738 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n;
char a[101][101];
void rev1()
{
for(int i=0;i<n;i++)
for(int j=0;j<=(n-1)/2;j++)
{
char tmp = a[i][j];
a[i][j] = a[i][n-1-j];
a[i][n-1-j] = tmp;
}
return;
}
void rev2()
{
for(int i=0;i... | true |
38e3fcf404f1715121319a24aa331a0b6bb9800e | C++ | dengxinlong/Algorithm_4 | /chapter_1/1.3/Bag/bag.h | UTF-8 | 255 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
template<class T>
class Bag
{
public:
Bag()
{}
void add(T item)
{
;
}
bool isEmpty(void)
{
;
}
int size(void)
{
return 0;
}
private:
}; | true |
6cd43f296c9a19cf9bde6d0c9db3ded6bf948b87 | C++ | WIZARD-CXY/misc | /c++/class.cc | UTF-8 | 946 | 3.734375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Base1 { //基类Base1定义
public:
void display() const {
cout << "Base1::display()" << endl;
}
};
class Base2: public Base1 { //公有派生类Base2定义
public:
void display() const {
cout << "Base2::display()" << endl;
}
};
class Derived: public Base2 { /... | true |
b78528763dad320062c5232dcf52e097ef505429 | C++ | Wouter-Engelen/vpw | /cat4/huizenjacht/cpp/WouterE.cpp | UTF-8 | 3,203 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct pos { int x, y; };
struct range { int min, max; };
struct segment { int max, lazy; };
int n, k, power2;
vector<pos> ps;
vector<int> ypx, ymx;
int dist_p(int l, int r) {
return abs((ps.at(ypx.at(l)).y + ps.at(ypx.at(l)).x) - (ps.... | true |
b83e878882c02b366421518c081df9e99cf23b09 | C++ | zyclam/c- | /exercise 4/ex6-2.cpp | GB18030 | 677 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
int main()
{
int x,y;
int t=1;
while(1)
{
cin>>x>>y;
if (x==0 && y==0)
break;
for(int i=x; i<=y,i++)
{
sum= pow(i,2)+i+41;//ʽӼ
if (sum<2)
{
... | true |
4069ee115f5b165bf279ff7f67f00ba9f06c8c9e | C++ | fengrenchang86/PKU | /3386/2694167_WA.cpp | UTF-8 | 190 | 2.640625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main ()
{
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
if ( a <= d && c <=e || c <= b && a <= c )cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
} | true |
855301b14cb2e7ec97b5a50c774ae60ca6ce3f99 | C++ | Karodips/OOPLaba1 | /N6.cpp | UTF-8 | 341 | 2.78125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
setlocale(LC_ALL, "Russian");
double dollar;
cin >> dollar;
cout << "Фунтов: " << dollar*(1/1.1487) << " Немецких марок: " << dollar*(1/0.584) << " Йен: " << dollar*(1/0.00955) << " Франков: " << dollar*(1/0.172) << endl;
system("pause");
return 0;
}
| true |
4eb822ac52369191bc4c0c3e589add2ba6183069 | C++ | yuanzheng/BYU | /cs240_C++_Projects/WebCrawler/inc/StopWordTree.h | UTF-8 | 2,012 | 3.40625 | 3 | [] | no_license | #ifndef STOPWORDTREE_H
#define STOPWORDTREE_H
#include "StopWord.h"
/*
* StopWordTree implements the StopWord binary search tree for load and store the stop word.
* Each word shown up in each page should be searched on this tree.
* By using BST data structure each word can be fast searched.
*/
class StopWordT... | true |
87b4d115d99c03093cbc6c7be3462620a716020d | C++ | davisking/dlib | /dlib/cuda/tensor_abstract.h | UTF-8 | 25,549 | 2.921875 | 3 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Copyright (C) 2015 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_DNn_TENSOR_ABSTRACT_H_
#ifdef DLIB_DNn_TENSOR_ABSTRACT_H_
#include "../matrix.h"
#include "../any/any_abstract.h"
namespace dlib
{
// -------------------------------------------... | true |
ec71b5ae78fd782e7452e02de025d47a6c806a2b | C++ | ambideXtrous9/Data-Structures-and-Algorithms | /coef.cpp | UTF-8 | 841 | 3.25 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int coef(int ,int );
int coefDP(int ,int );
int main()
{
int n,k;
cout<<"ENTER THE NUMBER n = "<<endl;
cin>>n;
cout<<"ENTER THE NUMBER k = "<<endl;
cin>>k;
int num = coef(n,k);
cout<< "COEFFICIENT = "<<num<<endl;
num = coefDP(n,k);
cout<< "COEFFICIENT(DP)... | true |
d6df1628e36e77fa3d5bb44fd32dcf380a579ebe | C++ | panipuri8/interesting-interview-questions | /competitive_p_snippets/maths.cpp | UTF-8 | 1,425 | 3.328125 | 3 | [] | no_license | /* Start of Math Templates */
ll factorial[MAXN];
ll inverse[MAXN];
ll inverseFactorial[MAXN];
ll modInverse(ll a, ll m) { //if a and m are coprime, find a^-1 in mod m
ll m0 = m;
ll y = 0, x = 1;
if (m == 1)
return 0;
while (a > 1) {
ll q = a / m;
ll t = m;
m = a % m, a = t;
t = y... | true |
2566118ddfd32026dbfba1266b633fe644b649f6 | C++ | ScottVisser/pistuff | /co2/hexop.cpp | UTF-8 | 369 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
int main(void)
{
// char *hex1;
// hex1 = new char[5];
char hex1[5] = {0x68, 0x65, 0x6c, 0x6c, 0x6f};
char hex2[3] = {0xFF, 0xFA, 0x00};
printf("%s\n",hex1);
printf("%X\n",hex1[1]);
std::cout << ... | true |
b7a6126b56e51d7a03411e0a38b3a22eb1c8e93a | C++ | herbstluftwm/herbstluftwm | /src/indexingobject.h | UTF-8 | 4,130 | 3.109375 | 3 | [
"BSD-2-Clause"
] | permissive | #ifndef INDEXINGOBJECT_H
#define INDEXINGOBJECT_H
#include <cstddef>
#include <string>
#include <vector>
#include "attribute_.h"
#include "object.h"
/** an object that carries a vector of children objects, each accessible by its
* index
*/
template<typename T>
class IndexingObject : public Object {
public:
Ind... | true |
96f4703bd4cab262ba2487c49d5b5e51c5f18381 | C++ | syedraza011/Project-C- | /Cart.cpp | UTF-8 | 4,279 | 3.234375 | 3 | [] | no_license | #pragma onc
#include "Cart.h"
#include <iostream>
#include "ItemTable.h"
#include<fstream>
#include <string>
#include<cmath>
#include<ctime>
using namespace std;
// This is the Default Constructor
// This does not take parameters
Cart::Cart()
{
}
// This takes the vectorOfAllItems and gives a vector
vect... | true |
18a3467511fe9358639005afe4d0093d8dd89f82 | C++ | sukeyisme/sukey_code | /SocketWithThreadPool/tcp_svr_socket.cpp | UTF-8 | 516 | 2.734375 | 3 | [] | no_license | #include "tcp_svr_socket.h"
CTcpSvrSocket::CTcpSvrSocket()
{
}
CTcpSvrSocket::~CTcpSvrSocket()
{
}
bool CTcpSvrSocket::OnAccept()
{
CTcpSvrSocket *pSocket = new CTcpSvrSocket;
if (!Accept(pSocket)) {
delete pSocket;
pSocket = NULL;
return false;
}
cout << "accept" << endl;
return true;
}
bool CTcpSvrS... | true |
b61d0de429b92be1c314c6b5c2566c257cccaaed | C++ | mmmaxou/imac-cpp | /TP3/ImageRGBU8.cpp | UTF-8 | 628 | 2.890625 | 3 | [] | no_license | #include "ImageRGBU8.hpp"
/// Constructor
ImageRGBU8::ImageRGBU8() : _width(0), _height(0), _data()
{
}
ImageRGBU8::ImageRGBU8(const unsigned int w,
const unsigned int h)
: _width(w),
_height(h),
_data(w * h * 3)
{
std::cout << "Constructeur par VALEURS" << std::endl;
std::fill(_... | true |
7cb37fc4784c2dd1c5faeaa1170cbdcab6e0d231 | C++ | vincentrolypoly/Malice | /Front-End-Compiler/Nodes/callNode.cpp | UTF-8 | 960 | 2.625 | 3 | [] | no_license |
#include "callNode.hpp"
#include "actualParamsNode.hpp"
#include "functionDeclNode.hpp"
#include <iostream>
#include "../CFG.hpp"
#include "../checkInterface.hpp"
callNode::callNode(string name, actualParamsNode *p, int line) {
callName = name;
actualParams = p;
lineNo = line;
callTo = NULL;
}
void callN... | true |
927841c9f2cee4694c759edcc3d6980c1eb1cfb7 | C++ | metaphysis/Code | /UVa Online Judge/volume003/315 Network/program2.cpp | UTF-8 | 2,207 | 2.671875 | 3 | [] | no_license | // Network
// UVa ID: 315
// Verdict: Accepted
// Submission Date: 2017-10-21
// UVa Run Time: 0.000s
//
// 版权所有(C)2017,邱秋。metaphysis # yeah dot net
#include <bits/stdc++.h>
using namespace std;
// 顶点数目。
const int MAXV = 110;
// 使用邻接表来表示图。
vector<set<int>> edges;
// dfn保存各顶点的深度优先数,如果顶点的dfn值为0,表明该顶点尚未被访问。
// ic记录各顶... | true |
f41903372ec3b25cdd0930baf82bcf5e545e77bb | C++ | windystrife/UnrealEngine_NVIDIAGameWorks | /Engine/Source/ThirdParty/nvTextureTools/nvTextureTools-2.0.6/src/src/nvimage/PsdFile.h | UTF-8 | 1,296 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.0-or-later",
"GPL-1.0-or-later"
] | permissive | // This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_IMAGE_PSDFILE_H
#define NV_IMAGE_PSDFILE_H
#include <nvcore/Stream.h>
namespace nv
{
enum PsdColorMode
{
PsdColorMode_Bitmap = 0,
PsdColorMode_GrayScale = 1,
PsdColorMode_Indexed = 2,
PsdColorMode_RGB = 3,
PsdColorMode_CMYK = 4,
PsdCo... | true |
4f42823134223f4c73bfb18b36a02c7dd042f3e3 | C++ | Badstu/leetcode-exercises | /acwing/chapter3/852.cpp | UTF-8 | 1,290 | 2.890625 | 3 | [] | no_license | #include <cstring>
#include <iostream>
#include <queue>
using namespace std;
const int N = 2010, M = 10010;
int n, m;
int h[N], e[M], ne[M], w[M], idx;
int dist[N], cnt[N];
bool st[N];
void add(int x, int y, int z) {
e[idx] = y;
ne[idx] = h[x];
w[idx] = z;
h[x] = idx++;
}
bool spfa() {
// memset... | true |
e9b7f12fe35b4f155455d2babba287a24641dda5 | C++ | Jack10907314/LeetCode | /Contest/Biweekly Contest 45/1750. Minimum Length of String After Deleting Similar Ends.cpp | UTF-8 | 735 | 3.1875 | 3 | [] | no_license | class Solution {
public:
int minimumLength(string s) {
if(s == "")
return 0;
if(s.size() == 1)
return 1;
/*while( s.size() > 1 && s.front() == s.back())
{
char a = s.front();
while(s.size()!=0 && s.front() == a )
s.erase... | true |
f393403e6e9ae737d4955ef7cf587429f89aa565 | C++ | thorstel/Advent-of-Code-2017 | /src/day11.cpp | UTF-8 | 1,661 | 3.4375 | 3 | [
"MIT"
] | permissive | #include <tuple>
#include "default_includes.hpp"
#include "solution.hpp"
// Using the "3D" cube representation for the hex grid, the distance
// between two positions is
//
// d = max(|x2 - x1|, |y2 - y1|, |z2 - z1|).
//
// Since we start at position (0, 0, 0), we only need the end position
// to determine the dist... | true |
3d15d16964dc9fd2e0727001d4d934473aa21606 | C++ | Shubhamag12/Data-Structures-and-Algorithms | /codeforces/gcdSum.cpp | UTF-8 | 521 | 2.671875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
if(b==0)
return a;
gcd(max(a-b,b),min(a-b,b));
}
int count(int n){
int su=0;
while(n!=0){
su+=n%10;
n=n/10;
}
return su;
}
int main(){
int n;
cin>>n;
int sum=0;
sum=count(n);
i... | true |
35aed3f7f516b6e887695fd3c90d928aa538f560 | C++ | BhushanSure/BhushanLearning | /C++/OOPS/Deep_Copy/deep.h | UTF-8 | 942 | 3.328125 | 3 | [] | no_license | #ifndef DEEP_H
#define DEEP_H
#include <iostream>
#include <cassert>
#include <cstring>
/*
One answer to shallow copy problem in case of dynamically allocated variable is to do a deep copy
on any non-null pointers being copied. A deep copy allocates memory for the copy and then copies
the actual value, so that the co... | true |
043a3112d7f3f18d1f826fc36fb43a0bfd721fad | C++ | jc4250/coding | /ccl/flatten-a-multilevel-doubly-linked-list.cpp | UTF-8 | 825 | 3.484375 | 3 | [] | no_license | //https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/
/*
// Definition for a Node.
class Node {
public:
int val;
Node* prev;
Node* next;
Node* child;
};
*/
class Solution {
public:
stack<Node *> st;
void flattenList(Node* head) {
if (head == NULL) return;
... | true |
84c7fe4a7bfafa81f53af69c87d4859c672be0cb | C++ | Checkmate50/posit-arith | /double_suite/add_test.cpp | UTF-8 | 7,141 | 2.8125 | 3 | [] | no_license | #include "../src/util.hpp"
#include <iostream>
#include <fstream>
#include <random>
#include <filesystem>
#include <fenv.h>
namespace fs = std::filesystem;
const int RANDOM_COUNT = 1024;
std::string genplus(double d1, double d2) {
return double_op("\"+\"", d1, d2, d1 + d2);
}
template<typename T>
void generate... | true |
b80fdfcf64f0bcb965cd467cc615d91f31da03da | C++ | BarryChenZ/LeetCode2 | /P229_MajorityElement_II.cpp | UTF-8 | 743 | 2.78125 | 3 | [] | no_license | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
if(nums.size() <= 1) return nums;
vector<int> ans;
unordered_map<int,int> m;
int times = nums.size()/3;
for(int i = 0; i < nums.size(); i++){
if(m.find(nums[i]) == m.end()){
... | true |
1c3aac3179031a7a5c04b0de2997cc881fa67f1b | C++ | s0metimes/aligothm | /week2/1541_lostBracket/1541_lostBracket_youngwoo.cpp | UTF-8 | 783 | 2.71875 | 3 | [] | no_license | #include <stdio.h>
#define MAX 50
char form[MAX+1];
int main(int argc, char const *argv[])
{
int i, len;
bool afterMinus = false;
scanf("%s", form);
for(i = 0; form[i] != '\0'; i++) {
len++;
if(afterMinus && form[i] == '+') form[i] = '-';
else if(form[i] == '-') afterMinus... | true |
f06ccda64ff56b41acbbcf38bb9c8f5ef8a14637 | C++ | leoxiaofei/uvpp | /include/uvpp/error.hpp | UTF-8 | 670 | 2.953125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <stdexcept>
#include <string>
#include <uv.h>
#include <iostream>
namespace uvpp {
class Exception : public std::runtime_error
{
public:
Exception(const std::string& message)
: std::runtime_error(message)
{}
};
class Result
{
public:
Result(int c)
: m_error(c)
{
}
publ... | true |
c64897e64b2b86c4c363fc0196fc9828052d69d1 | C++ | lacarp99/NFL_Football_Source | /main.cpp | UTF-8 | 6,343 | 2.84375 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <random>
#include <time.h>
#include <fstream>
#include "readfromfile.h"
using namespace std;
int chosenTeam = 0;
int skill = NULL;
int slot;
int access = 1;
int tries = 3;
char createOrSignin;
string appdatapath;
string password;
struct newcoach {
... | true |
6ade832078003a97beda6eeb8dac82296bcd58ac | C++ | VitoCastellana/SHAD | /include/shad/data_structures/object_identifier.h | UTF-8 | 8,974 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | //===------------------------------------------------------------*- C++ -*-===//
//
// SHAD
//
// The Scalable High-performance Algorithms and Data Structure Library
//
//===----------------------------------------------------------------------===//
//
// Copyright 2018 Battelle... | true |
79eba4e5a51b0474cadaf5e9e75eda6ef9cb95e4 | C++ | pingany/poj | /1067/3344535_WA.cc | UTF-8 | 239 | 2.921875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
using namespace std;
int p(int x,int y)
{
if(x==y || x==0 || y==0)return 1;
if((x-y)%2==0)return 1;
return 0;
}
int main()
{
int x,y;
while(cin>>x>>y)cout<<p(x,y)<<"\n";
return 0;
} | true |
36968821452e97b27b8d8b242b538d8ec714df63 | C++ | ELUMI/elumi-raytracer | /src/raytracer/AccDataStructImpl/HashDataStruct.cpp | UTF-8 | 3,439 | 2.5625 | 3 | [] | no_license | /*
* HashDataStruct.cpp
*
* Created on: Mar 23, 2012
* Author: ulvinge
*/
#include "HashDataStruct.h"
#include "HashDataStruct.h"
#include "ArrayDataStruct.h"
#include <vector>
using namespace std;
#include <glm/glm.hpp>
using namespace glm;
namespace raytracer {
HashDataStruct::HashDataStruct(float b... | true |
887358a866f69d41f44401e31ca2302d00ac5d1e | C++ | stephaneduarte/P3D_1718 | /Cell.h | UTF-8 | 290 | 2.65625 | 3 | [] | no_license | #ifndef __CELL__
#define __CELL__
#include "Object.h"
#include <vector>
class Cell
{
private:
std::vector<Object*> _objects;
BoundingBox * _bb;
public:
Cell();
~Cell();
std::vector<Object*> getObjects();
BoundingBox * getBoundingBox();
void addObject(Object * object);
};
#endif | true |
11118e7d3eab755c97c57df318d2e66e69f4162d | C++ | michaelrboyd/esp8266 | /master_writer/master_writer.ino | UTF-8 | 1,285 | 2.796875 | 3 | [
"MIT"
] | permissive | // Wire Master Writer
// by devyte
// based on the example of the same name by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this
// This example code is in the public domain.
#... | true |
53842e3eb1e8b3b3fae59a0cf58a729e59cc4d2b | C++ | weaverjm3/JW_info_450_spring_2019 | /week2/practice2/practice2/practice2.cpp | UTF-8 | 477 | 3.65625 | 4 | [] | no_license | #include "pch.h"
#include <iostream>
using namespace std;
int main()
{
int i = 0;
int count = 0;
int num;
for (;;)
{
cout << "Please enter a number to find out if it is prime! (Enter 0 to quit): ";
cin >> num;
if (num == 0)
{
break;
}
else
{
for (i = 2; i < num; i++)
if (num % i == 0)
... | true |
74bfcf4532801719c43050f7259f6530fb2d719f | C++ | avishq/myCollegeProjects | /Improved ACO/Codes/tsp_bb.cpp | UTF-8 | 1,857 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <fstream>
using namespace std;
int d_min = INT_MAX;
vector <int> v;
vector <int> v1;
vector <vector <int> > vv;
void tsp(int a[][100], int n, int i, int col[], int t, int cd, int sum, int c[])
{
// for (int j = 0; j < v.size(); ... | true |
90ccc4ef82cd7ec5d29caccc980bf9da99b3cc6c | C++ | amitkvikram/COMPETITIVE-PROGRAMMING | /codeforces/69A.cpp | UTF-8 | 419 | 2.515625 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
int main(int argc, char const *argv[]) {
int n;
cin>>n;
int a=0, b=0, c=0;
int sum1=0, sum2=0, sum3=0;
for(int i=0; i<n; i++){
cin>>a>>b>>c;
sum1+=a;
sum2+=b;
sum3+=c;
}
if(sum1==0... | true |
0fc06ee0bcffe1671311cffb7ca9d9cff1d67af6 | C++ | kingsenge/machine_learning--bayes | /mc_test.cpp | UTF-8 | 3,437 | 2.796875 | 3 | [] | no_license | #include<stdio.h>
#include<map>
#include<string>
using namespace std;
map<string,double> gWordsVector;
map<string,double> gWordsVectorIllegal;
static double gnLegal = 4;
static double gnIllegal = 1;
static double gnP = 0.8;
typedef struct
{
const char * pContent[10];
int nLegal;
int nNumber;
}STTRANS;
void ... | true |
99243ccdc67b3197422e0ba806ec21404309d695 | C++ | grighth12/algorithm | /HYJ/boj/BackTracking/boj1497.cpp | UHC | 1,233 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
int N, M;
vector<long long> v;
int result, maxbit;
long long a = 1;
int countBit(long long bit) {
int result = 0;
while (bit) {
result += bit & 1;
bit >>= 1;
}
return result;
}
void DFS(int index, long long check_nu... | true |