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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1a5ff418d9c9e2279471f86ac63faa3c1e04f49f | C++ | liuyaqiu/LeetCode-Solution | /386-Lexicographical-Numbers.cpp | UTF-8 | 1,246 | 3.8125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
/*
* Lexicographical Numbers
*
* Given an integer n, return 1 - n in lexicographical order.
*
* For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9].
*
* Please optimize your algorithm to use less time and space. The input si... | true |
7ded95aebcb754e339ac4a3b112532bf669bb043 | C++ | aetrnm/CPPBinaryTree | /BinaryTreeProject/Cell.h | UTF-8 | 383 | 3.1875 | 3 | [] | no_license | #pragma once
class Cell {
public:
Cell(int value);
int get_value() const;
void add(int value);
bool contains(int value);
Cell* find_and_remove_min_cell_in_sub_tree();
Cell* remove_in_sub_tree(int value);
void print_sub_tree() const;
int get_height_of_sub_tree() const;
private:
int value_;
Cell* left_cell;... | true |
06993df276e6264075349764ec0eb99e098269b3 | C++ | Ablustrund/PATCode | /PAT_B/PAT_B1084.CPP | UTF-8 | 485 | 2.546875 | 3 | [
"BSD-2-Clause"
] | permissive | #include <bits/stdc++.h>
using namespace std;
int d, n;
int main()
{
scanf("%d%d", &d, &n);
string str = "0";
str[0] += d;
for (int i = 0; i < n-1; i++)
{
string tempStr = "";
int j = 0, k = 0;
while(j < str.size())
{
while(k < str.size() && str[j] == str[... | true |
a90ce3d4cccf5d5d2d125ee55e16a447b3ac28fb | C++ | CYChack/KUDAEDEM | /KUDAMCHIM/KUDAMCHIM/main.cpp | UTF-8 | 951 | 2.5625 | 3 | [] | no_license | #include <iostream>
void main() {
int a = 0, b = 0, c = 0, d = 0, e = 0;
std::cout << "lubish teplo? 1-da, 2-net";
std::cin >> a;
std::cout << "Hochesh na more? 1-da, 2-net";
std::cin >> b;
std::cout << "Hochesh v gorbI? 1-da, 2-net";
std::cin >> c;
std::cout << "za legalayz? 1-da, 2-net";
std::ci... | true |
8af18f860bed04e568ccbcabbadc630f2bd2e02c | C++ | perryiv/generic_scene_graph | /source/GSG/Tools/Visitors/Callbacks/Const.cpp | UTF-8 | 4,593 | 2.578125 | 3 | [
"MIT"
] | permissive |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, Perry L Miller IV
// All rights reserved.
// MIT License: https://opensource.org/licenses/mit-license.html
//
///////////////////////////////////////////////////////////////////////////////
///////////////////... | true |
f33f6f44a34be4731b22e1ac1b19ea975eb16569 | C++ | sanchitahuja/CollegeCodes | /4th Semester/Operating Systems Lab/06_Multilevel.cpp | UTF-8 | 6,874 | 2.78125 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
struct pq
{
int pno;
int at,bt,ct,tat,wt,rt,st;
struct pq* nextp;
}*tmp1,*tmp2,*tmp3;
struct pq *q1=NULL;
struct pq *q2=NULL;
struct pq *q3=NULL;
struct pq *q4=NULL;
struct pq *qd=NULL;
struct pq *nwnd=NULL;
int pnum=1;
int currt=0;
int insertq1(int arr,int bur)
{
nwnd=(stru... | true |
a3d22ca790980071c85b6c4f15885a2b18d075bb | C++ | DBurden1997/Elemental | /Elemental/ECS/Modifiers/headers/Modifier.hpp | UTF-8 | 966 | 3.09375 | 3 | [] | no_license | //
// Modifier.hpp
// Elemental
//
// Created by Dylan Burden on 2018-08-22.
// Copyright © 2018 Elemental. All rights reserved.
//
#ifndef Modifier_hpp
#define Modifier_hpp
#include <string>
class Modifier {
public:
//Constructor
Modifier( unsigned long ownerId, std::string stat, std::string precedence... | true |
ac2ea79071c23cb908c77b19810e5c57d7faa985 | C++ | diego3/ludum-game-engine | /LudumGameEngine/Src/Components/TransformComponent.h | UTF-8 | 965 | 2.859375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <SDL.h>
#include "../../Libs/glm/glm/ext/vector_float2.hpp"
#include "../Core/Component.h"
#include "../Core/Game.h"
class TransformComponent : public Component
{
public:
glm::vec2 position;
glm::vec2 velocity;
int width;
int height;
int scale;
SDL_Rect box;
bool show... | true |
a8c60e4faeab0c25905bfa856e8e0e3db7d7ba7e | C++ | Ziyadnaseem/Hackerblocks-practice | /BFS - Shortest Path1.cpp | UTF-8 | 1,326 | 3.015625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class Graph {
private:
map<long long int, list<long long int>> adjList;
public:
Graph(long long int n)
{
for (long long int i = 1; i <= n; i++)
{
adjList[i].push_back(0);
}
}
void addEdge(long long int u, long long int v)
{
adjList[u].push_back(v);
adjList... | true |
ca8e199488950b84480618eb1afa0ec8ddad6c1e | C++ | kanukam/School-Projects | /CS202-COMPUTER-PROGRAMMING-II-master/proj9/Node.h | UTF-8 | 871 | 3.453125 | 3 | [] | no_license | #ifndef NODE_H_
#define NODE_H_
#include "DataType.h"
class Node{
friend class NodeQueue; //allows direct accessing of link and data from class NodeList
public:
Node() :
m_next( NULL )
{
}
Node(const DataType & data, Node * next = NULL) :
m_next( next ),
m_data( data )
{
}
Node(const Node & ... | true |
9376c1a52f4b4d0a28f0f6dae422f3929cdb1cd5 | C++ | blizmax/wage-engine | /engine/memory/reference.h | UTF-8 | 1,756 | 2.921875 | 3 | [] | no_license | #pragma once
#include <cstddef>
#include <assert.h>
namespace wage { namespace memory {
template <typename T, typename IndexType = uint32_t>
class Reference {
public:
class Source {
public:
virtual bool valid(Reference ref) = 0;
virtual void destroy(Reference ref) = 0;
virtual T* ... | true |
31a8aab3fb92431b5c8b106a917c45d9353f313d | C++ | DongHaiYuan/Database-System-Implementation | /Phase3/Source/RelOp.cc | UTF-8 | 23,812 | 2.734375 | 3 | [] | no_license | #include "RelOp.h"
// SelectPipe
typedef struct params{
Pipe *inPipe;
Pipe *outPipe;
CNF *selOp;
DBFile *inFile;
Record *literal;
int *keepMe;
int numAttsInput;
int numAttsOutput;
} params;
void *SelectPipe::selectPipe(void *arg) {
params *sp = (params *) arg;
cout<<"created thread"<<endl;
Record *tmp... | true |
492b7404f742c87ca7db98a2a4a7855f54ebd95e | C++ | Blue12108Rabit/CPPhomework | /Chapter6/6-27.cpp | GB18030 | 751 | 3.65625 | 4 | [] | no_license | #pragma warning(disable : 4996)
#include<iostream>
#include<cstring>
using namespace std;
class employee {
private:
char name[50];
char streetAdd[50];
char city[50];
char postcode[50];
public:
employee(const char* n, const char* s, const char* c, const char* p);
void setname(const char *n);
void display();
};
vo... | true |
7e5ef54bda7c582060df93259942a36b955a4fda | C++ | acc-cosc-1337-fall-2018/acc-cosc-1337-fall-2018-ayla00 | /assignments/05-classes-test/invoice_detail_test.cpp | UTF-8 | 1,150 | 2.5625 | 3 | [] | no_license | #define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "invoice_detail.h"
#include "invoice.h"
#include "invoice_utility.h"
TEST_CASE("test get_extended")
{
InvoiceDetail invoice(10, 10);
REQUIRE(invoice.get_extended_cost() == 100);
}
TEST_CASE("Test")
{
Invoice invoice;
invoice.add_invoice_detail(InvoiceDetai... | true |
22538115dc202cf7c378d8ca621b8e0899412690 | C++ | vivekpatel8/code_cpp | /lenth of longest common subsequence.cpp | UTF-8 | 1,121 | 3.046875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int lenthofLCS(string a, string b){
int lena = a.length();
int lenb = b.length();
int grid[100][100] = {0};
for(int i = 1;i<=lena;i++){
for(int j = 1;j<=lenb;j++){
int q = 0;
if(a[i-1] == b[j-1]){
q = 1 + grid[i-1][j-1];
}
el... | true |
0edb6d62c91f8a9f5854b4a462e86fd01518d511 | C++ | wuli2496/material | /学习资料/竞赛例题解(三)光盘/第五章-综合题例题分析/5.10-最短绳长/permetr.cpp | UTF-8 | 3,017 | 2.625 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<assert.h>
const int MAXN = 100;
const double PI2 = acos(-1.0) * 2.0;
const double EPS = 1e-5;
struct REC{
double x, y, r;
}list[MAXN];
int ptr[2*MAXN];
char flag[MAXN][MAXN];
inline double arctan(const double& dy, const double& dx)
{
... | true |
b9860cd6eaa398e4934d9eb134dbcc492351d200 | C++ | zy15662UNUK/mooc_cpp | /section8/include/Observer.h | UTF-8 | 324 | 2.828125 | 3 | [] | no_license | #ifndef OBSEVER_H_1
#define OBSEVER_H_1
class Observer
{
private:
/* data */
public:
// 单纯为了编译通过加上大括号
Observer(/* args */) {;};
virtual ~Observer(){;};
// 当被观察对象发生变化时候,通知被观察者调用这个方法
virtual void update(void * pArg) = 0;
};
#endif | true |
bf47c6f89ba5997e5e7fc1bb34bc69cb480789be | C++ | jdavidberger/stencet | /src/tags/VerbatimTag.cc | UTF-8 | 1,940 | 2.703125 | 3 | [
"MIT"
] | permissive | /* Copyright (C) 2012-2013 Justin Berger
The full license is available in the LICENSE file at the root of this project and is also available at http://opensource.org/licenses/MIT. */
#include <stencet/tags/VerbatimTag.h>
#include <stencet/parser.h>
#include <string.h>
namespace stencet {
void VerbatimTag::rende... | true |
136ad2e8ab8611ab41679edfb6dd06bdfda10bad | C++ | BookmanHan/CalGraph | /Logging.hpp | UTF-8 | 3,437 | 2.859375 | 3 | [] | no_license | #pragma once
#include "Import.hpp"
inline string time_namer()
{
const time_t log_time = time(nullptr);
struct tm* current_time = localtime(&log_time);
stringstream ss;
ss << report_path;
ss << 1900 + current_time->tm_year << ".";
ss << setfill('0') << setw(2) << current_time->tm_mon + 1 << ".";
ss << setfill('... | true |
3b2ece0fa103492f27c0e5cf7dd0005e6184a370 | C++ | andrzejg123/ProjektPK4 | /Projekt/Projekt/FileNameHelper.cpp | UTF-8 | 4,062 | 2.71875 | 3 | [] | no_license | #include "stdafx.h"
#include "FileNameHelper.h"
std::string FileNameHelper::getTranslationFileName(const LanguageIndicator language)
{
const std::string prefix = "translations/";
std::string name;
const std::string suffix = ".txt";
switch (language) {
case LanguageIndicator::English:
name = "english";
br... | true |
4578103f3d0b9aab7d8dfa419f229c381d59690e | C++ | martinkro/tutorial-qt | /Beautiful/PP/customcontrol/pushbutton.cpp | UTF-8 | 1,633 | 2.96875 | 3 | [
"MIT"
] | permissive | #include "pushbutton.h"
#include <QPainter>
PushButton::PushButton(QWidget *parent)
: QPushButton(parent)
{
}
PushButton::PushButton(const QString& text, QWidget *parent)
: QPushButton(text,parent)
{
}
void PushButton::paintEvent(QPaintEvent *event)
{
QString pixmapPath;
switch (m_status)
... | true |
7d3b02c5e04f5fa9dc0fc761e3227b95811a4db3 | C++ | Sicarim/UmDoYun | /과제제출/API/Mine/Doyun's_Engine/Scene.h | UHC | 628 | 2.59375 | 3 | [] | no_license | #pragma once
#include "GlobalDefine.h"
namespace DoEngine
{
/**
* @brief ӿ Ǵ Scene θ Ŭ
* @details ӿ Ǵ Scene θ Ŭ(߿!!!).Sceneؾ ϴ Լ
*/
class Scene
{
public:
Scene(); //
virtual void Init(HWND hWnd) = 0; //ʱȭ
virtual bool Input(float _fETime) = 0; //ŰԷ
virtual void Update(float _fETime) = 0; //Updat... | true |
c9f9a742bf2165e63fccc3af65d7429d81986d45 | C++ | Edean2023/HackingTerroristsForCoffee | /HackingTerroristsForCoffee/Source.cpp | UTF-8 | 3,299 | 3.671875 | 4 | [] | no_license | #include <iostream>
using namespace std;
// functions being declared
// function for the hacked transaction
void hackedTransaction(int& a, int& b);
// function for regular transaction
void regularTransaction(int a, int b);
// function for showing the accounts
void showAccounts(int joe, int terrorists);
///////... | true |
bbb5c9894660ea1a42b444e2d2289f238d035c9e | C++ | tlanc007/CPP20_Ranges | /JeffGCPPNow2019/30_dropWhile.cpp | UTF-8 | 532 | 3.453125 | 3 | [
"MIT"
] | permissive | /*
30_dropWhile.cpp
*/
#include <iostream>
#include <ranges>
#include <vector>
#include "rangeNamespace.hpp"
namespace view = std::view;
int main()
{
std::vector<int> v { 6, 2, 3, 4, 5, 6 , 7 };
auto is_even = [](int i) { return i % 2 == 0; };
auto print = [](int i) { std::cout << i << " "; };
... | true |
f5d0ce43b8e4a4136e53f19cb5e0e7c00f762de1 | C++ | TheMrKiko/Comp_S1819 | /ast/for_node.h | UTF-8 | 1,089 | 2.625 | 3 | [] | no_license | // $Id: for_node.h,v 1.4 2019/03/21 19:00:02 ist186400 Exp $ -*- c++ -*-
#ifndef __M19_FOR_NODE_H__
#define __M19_FOR_NODE_H__
#include <cdk/ast/expression_node.h>
// include sequence?
namespace m19 {
/**
* Class for describing for-cycle nodes.
*/
class for_node: public cdk::basic_node {
cdk::sequence_... | true |
ec5a13893ee832f2c0e25994c1012fc8e6dda769 | C++ | ejk6218/lv3.1-recovery | /controlSystem/RecoveryBoard/FirmWare/recovery_board_firmware/Core/Src/checkupCode.cpp | UTF-8 | 5,009 | 2.703125 | 3 | [] | no_license | #include "checkupCode.h"
#include "recoveryUtils.h"
#include "main.h"
// test the LED
void ledBlink(){
int i=0;
while(i<5){
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
HAL_Delay(500);
i++;
}
}
// test the speaker
void spkrTest(){
int i=0;
// turn on speaker
HAL_GPIO_WritePin(SPKR_GPIO_Port, SPKR_Pin, GPIO_... | true |
d01f582dd33755280b471d96fce414b61c7ecf96 | C++ | christat/inOneWeekend | /src/ch_12/main.cpp | UTF-8 | 4,359 | 2.875 | 3 | [] | no_license | #include <iostream>
#include "camera.h"
#include "dielectric.h"
#include "lambertian.h"
#include "metal.h"
#include "ray.h"
#include "scene.h"
#include "sphere.h"
#include "utils.h"
#include "vec3.h"
Intersectable *random_scene() {
int n = 500;
Intersectable **list = new Intersectable*[n+1];
list[0] = ne... | true |
e28eb3f0969dd8edd80ef9b72357e7fcf9405af1 | C++ | Teemperor/raytracer | /lib/Vec3.h | UTF-8 | 2,343 | 3.53125 | 4 | [
"MIT"
] | permissive | #ifndef RAYTRACER_VEC3_H
#define RAYTRACER_VEC3_H
#include <cmath>
class Vec3 {
public:
typedef double Unit;
private:
Unit X, Y, Z;
public:
Vec3() = default;
Vec3(Unit X, Unit Y, Unit Z) : X(X), Y(Y), Z(Z) {
}
Unit dot(const Vec3 &Other) const {
return X * Other.X + Y * Other.Y + Z * Other.Z;
}
... | true |
4c098d7c4a1a7ec60b37a9490b87d1b3b61c1071 | C++ | FardMan69420/aimbot-57 | /src/Utils/Misc/Arrays.h | UTF-8 | 946 | 3.375 | 3 | [] | no_license | #ifndef arrays_h
#define arrays_h
/*
* Efficient array allocation and deletion
* minimizing calls to new and delete
*/
template <class T>
class Arrays
{
private:
public:
static T* oneD(int rows)
{
return new T[rows];
}
static T** twoD(int rows, int cols)
{
T** pointers = new T*[rows];
... | true |
8f5ab84072ae5a7283edc1d58b463c67f2e65ad4 | C++ | Akshay-Ravi/Array-4 | /next_permutation.cpp | UTF-8 | 970 | 3.078125 | 3 | [] | no_license | //Time Complexity-O(n)
//Space Complexity-O(1)
//Ran successfully on leetcode
class Solution {
public:
void nextPermutation(vector<int>& nums){
if(nums.empty() || nums.size()==1)
return;
//find the greater number position
int i=nums.size()-1;
int pos;
while(i>0)
... | true |
9964cb3dab6eae62f231df554c78e85d978515e4 | C++ | achillez16/CS_22A | /Midterms/GetScoreTotalWithoutHighLow.cpp | UTF-8 | 2,839 | 3.546875 | 4 | [] | no_license | // Created by Preetesh Barretto on 5/24/20.
//Write a function named “GetScoreTotalWithoutHighLow.cpp” that reads in a
//list of scores until the user enters a negative number. It will add all the given
//scores up and subtract the largest and smallest scores to get a true score total. If
//there are only 2 numbers or... | true |
6a4998daef0ac95b7cd36d6182d6f97d08724f89 | C++ | Dblaze47/Problems-Solved---Category-Beginner | /UVA11877.cpp | UTF-8 | 348 | 2.75 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int n;
while(cin>>n && n!=0){
int diff = 0, full = 0;
while(n != 0){
n += diff;
full += (n/3);
diff = n%3;
n /= 3;
}
if(diff == 2){full++;};
cout<<full<<endl... | true |
848b6383eed19058b5434f5f73a9ecdc2cf1893f | C++ | alejandrocoria/MinerDisplay | /TextBox.h | UTF-8 | 1,488 | 2.703125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/Graphics/View.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Time.hpp>
#include <SFML/... | true |
1420a77039ef870ddbac8ab70bbbed31a47fad8d | C++ | yxinyi/AutoPixelOnline | /BaseEngine/Tcp/Connection.h | GB18030 | 9,179 | 2.546875 | 3 | [] | no_license | #pragma once
#include "asio.hpp"
#include "../../Common/include/tool/Buffer.h"
#include <set>
#include <map>
#include <mutex>
#include "include/tool/UniqueNumberFactory.h"
#include "include/tool/ObjectPool.h"
#include "PakcageList.h"
#include "ServerTypeStruct.h"
const uint64_t g_recv_once_size = 1024;
static uint32_t... | true |
554c47329223d94f9ac26aea0f00124bd2fcc80c | C++ | evalveny/MP20-21 | /Tema 1/CodiSessions/S5 - Classe Complex/ComplexosOperadors/complex.h | UTF-8 | 485 | 2.65625 | 3 | [] | no_license | #pragma once
class Complex
{
public:
Complex() { m_real = 0; m_img = 0; }
float getReal(); //TO VALIDATE TEST
float getImg(); //TO VALIDATE TEST
void setReal(float pReal); //TO VALIDATE TEST
void setImg(float PImg); //TO VALIDATE TEST
void mostra() const;
Complex suma(const Complex &c) const;
Complex resta(con... | true |
a11b4310b849d21315de7778e2d20d26f095943a | C++ | MaciejWadowski/cpp | /JIMP_AI/lab_3/smarttree/SmartTree.cpp | UTF-8 | 1,587 | 3.359375 | 3 | [] | no_license | //
// Created by maciej on 31.03.18.
//
#include "SmartTree.h"
using std::unique_ptr;
using std::ostream;
using std::string;
using std::make_unique;
using std::cout;
namespace datastructures{
unique_ptr <SmartTree> CreateLeaf(int value){
auto Leaf = make_unique<SmartTree>();
Leaf->left = nullptr;... | true |
abeaa4bc71b9d56bf03f6ff47ae38e361ed68df3 | C++ | CSUAITeam19/MazeAlgorithm | /DF/MazeBfs.cpp | UTF-8 | 6,850 | 2.578125 | 3 | [] | no_license | #include "class.cpp"
int width, height;//地图的长宽
int startx, starty, endx, endy;
int step = 0;
int flag = 0;
int f = 0;
vector<vector<int>> maze;//迷宫地图数据
vector<vector<int>> vis;//是否访问过和能否访问
vector<vector<int>> cost;//耗费
vector<vector<int>> b;//步数
string path1, path2;//输入输出路径
vector<vector<int>> precost;
queue<Point> o... | true |
08c1cdad5979a081e728fd143307df1020795c15 | C++ | kcwzzz/KCW | /cocos/Project 모음/170908/Classes/CEnemyrAniBox.cpp | UTF-8 | 3,990 | 2.578125 | 3 | [] | no_license | #include "cocos2d.h"
#include "CActorAniBox.h"
#include "Define.h"
#include "GameScene.h"
void CActorAniBox::CreateAniBox(string tAniName, Vec2 tVec, int tWidth, int tHeight, float tSetDelay)
{
this->CreateTexture(tAniName, tWidth, tHeight);
this->SetPosition(tVec);
this->CreateAniMoveDown(tWidth, tHeight, tSetDe... | true |
605890bef5988868cbd140864b4dc82c3f3bbe8c | C++ | 4roring/KK1_Eternal_Crusade | /KK1_Tool/Code/NavTri.cpp | UTF-8 | 2,404 | 2.578125 | 3 | [] | no_license | #include "stdafx.h"
#include "NavTri.h"
#include "NavPoint.h"
#include "Transform.h"
NavTri::NavTri(LPDIRECT3DDEVICE9 ptr_device)
: ptr_device_(ptr_device)
{
}
NavTri::~NavTri()
{
Release();
}
HRESULT NavTri::Initialize(const std::array<NavPoint*, 3>& nav_point_array)
{
const int max_point = nav_point_array.size... | true |
a5949930b15cfb29fe8aac7f14520160ef55d12b | C++ | colinmaher/comsc200 | /Week4/PayRoll.h | UTF-8 | 448 | 2.890625 | 3 | [] | no_license | #ifndef PAYROLL_H
#define PAYROLL_H
#include <iostream>
using namespace std;
class PayRoll{
private:
double payRate;
double hrs;
public:
//constructors
PayRoll(){ payRate = 0; hrs = 0; };
PayRoll(double r, double h){payRate = r; hrs = h;}
//mutators
void setHours(double h){ hrs = h;... | true |
d0d12b395e02e9aeece4f5b1de6c7d795048e91f | C++ | fmi-lab/up-2018-kn-group3-sem | /Exercises/Exercise 6/kontrolno1variantBzad3.cpp | UTF-8 | 405 | 2.90625 | 3 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
int main(){
int N;
cin>>N;
double x,y;
double maxX, minX, maxY, minY;
for(int i = 0; i<N; i++){
cin>>x>>y;
if(i==0){
maxX = minX = x;
maxY = minY = y;
} if(x>maxX){
maxX = x;
} if(x<minX){
minX = x;
} if(y<maxY){
maxY = y;
} if(y<... | true |
b79c122ad444a31720f9b9430e73b307d04b9e52 | C++ | 0sk4r/Uwr | /Algorytmy_i_struktury_danych/3podejscie/C/main.cpp | UTF-8 | 3,945 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <climits>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long tab[1000010];
long long massa[1000010];
int solutions[1000010];
int ans_max[1000010], ans_min[1000010... | true |
d9379aa7b1579eaac344b43cda9523479d2101cd | C++ | ErsaSatriaPradana/P4-Febry-Dwi-Firianto | /Jobsheet 1 C++.cpp | UTF-8 | 444 | 3.03125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main (){
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
cout<<"NAMA : Ersa Satria Pradana\n";
cout<<"NIM : 8\n";
cout<<"KELOMPOK : 10\n";
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
int nim[8]={0,4,7,8,9};
cout<<"Nim ke-1 adalah "<<nim[0]<<endl;
cout<<"Nim ke-2 adalah "<<ni... | true |
62e8b4cbd653285c15516e5c1303ad0d5143c9ad | C++ | SaberDa/CPP_Basic_Projects_WareHouse | /MyDocker/src/main.cpp | UTF-8 | 533 | 2.5625 | 3 | [] | no_license |
#include <iostream>
#include "docker.hpp"
int main(int argc, char** argv) {
std::cout << "...start container" << std::endl;
docker::container_config config;
// Container config
// ...
config.host_name = "mydocker";
config.root_dir = "./image";
config.ip = "192.168.0.100"; // Container IP
config.bridge_name =... | true |
cf0369880252286e218d74d15240fc70c30a7a3d | C++ | mosesmccabe/C-review-2- | /Structure/basicUseOfStruct.cpp | UTF-8 | 1,373 | 4 | 4 | [] | no_license | /* Moses Peace Mccabe
This program demonstrates the use of structures
(UseOfStruct.cpp)
*/
#include <iostream>
#include <string>
using namespace std;
struct PayRoll
{
int empNumber; // Employee number
string name; // Enployee name
double hours; // Hours worked
double payRate; ... | true |
cd3fc29b0d711c7f6a5ad7920c68c98d5f2da9ec | C++ | logsniper/learningCpp | /nameHiddenWhenOverloading.cpp | UTF-8 | 443 | 3.53125 | 4 | [] | no_license | #include <iostream>
using namespace std;
class base{
public:
void f(){ cout<<"base::f()"<<endl; }
void f(int){ cout<<"base::f(int)"<<endl; }
void f(char){ cout<<"base::f(char)"<<endl; }
};
class child : public base{
public:
void f(int){ cout<<"child::f(int)"<<endl; }
void f(double){ cout<<"child::... | true |
8a7fda814617ffbf765f8a657754cc6fc5dbeeeb | C++ | adamleonardhubble/Game-Engine-Development | /Solution/engine/enginecode/include/independent/rendering/model.h | UTF-8 | 709 | 3.03125 | 3 | [] | no_license | #pragma once
namespace Engine
{
class Model
{
public:
//! Constructor
Model() : vertices(nullptr), indices(nullptr), verticesSize(0), indicesSize(0) {}
//! Destructor
~Model()
{
delete vertices;
vertices = nullptr;
delete indices;
indices = nullptr;
delete posVertices;
posVertices = nul... | true |
f7c3fcdcdc0738a96b32e89a56deb4dc2c9c9851 | C++ | phresnel/ICalLib | /include/rfc3986.hh | UTF-8 | 2,987 | 2.5625 | 3 | [
"MIT"
] | permissive | #ifndef RFC3986_HH_INCLUDED_20190201
#define RFC3986_HH_INCLUDED_20190201
// -- URI (RFC 3986) Parser Helpers. ------------------------------------
// [RFC 3986](https://tools.ietf.org/html/rfc3986)
#include <iosfwd>
#include <string>
#include <optional>
inline namespace rfc3986 {
using std::string;
using std::opt... | true |
d59e29895d6aa36eabd0763cc7df1dc4d96ed7c4 | C++ | yuri410/rpg | /external/DirectXShaderCompiler/tools/clang/test/CXX/class.derived/class.virtual/p3-0x.cpp | UTF-8 | 4,380 | 2.96875 | 3 | [
"NCSA",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
namespace Test1 {
struct B {
virtual void f(int);
};
struct D : B {
virtual void f(long) override; // expected-error {{'f' marked 'override' but does not override any member functions}}
void f(int) override;
};
}
namespace Test2 {
struct... | true |
c7cdc70421a46332c5821f8be0a97785208afca3 | C++ | rpuntaie/c-examples | /cpp/types_is_trivially_copyable.cpp | UTF-8 | 778 | 3.125 | 3 | [
"MIT"
] | permissive | /*
g++ --std=c++20 -pthread -o ../_build/cpp/types_is_trivially_copyable.exe ./cpp/types_is_trivially_copyable.cpp && (cd ../_build/cpp/;./types_is_trivially_copyable.exe)
https://en.cppreference.com/w/cpp/types/is_trivially_copyable
*/
#include <iostream>
#include <type_traits>
struct A {
int m;
};
struct B {
... | true |
65425e588e21c889289f53622adb64253a3f86b3 | C++ | john801205/practice | /UVa/11218/11218.cpp | UTF-8 | 1,519 | 3.234375 | 3 | [] | no_license | #include <bitset>
#include <iostream>
#include <vector>
struct Group
{
int a, b, c, s;
Group(int a, int b, int c, int s): a(a), b(b), c(c), s(s) {}
};
int DFS(const std::vector<Group> &groups,
const std::vector<Group>::size_type start,
std::bitset<9> &people,
... | true |
7ffe63fe26d97ce56bd442abafaa47574ccb6976 | C++ | polpo/espweather | /espweather.ino | UTF-8 | 5,922 | 2.53125 | 3 | [
"MIT"
] | permissive | #include <ESP8266WiFi.h>
#include <ArduinoOTA.h>
#include <JsonStreamingParser.h>
#include "WeatherListener.h"
#include "icons.h"
#include "constants.h"
// spin while connecting to WiFi
const char spinner[] = {'/', '-', 0b11111011, 0b11111110};
void load_icon(const uint8_t icon[]) {
for (uint8_t c = 0; c < 8; c++... | true |
c2ef6c0cc2fbdf43143014f13730d4990a4948c0 | C++ | primenumber/LSmethod | /solver.cpp | UTF-8 | 1,108 | 2.5625 | 3 | [
"MIT"
] | permissive | #include "solver.hpp"
#include <cmath>
#include <iostream>
#include <thread>
#include <future>
namespace math {
Real eps = 1.0;
Vector CGLSMethod(const SpMat &mat, const Vector &vec) {
Vector r = trans_mv(mat, vec);
Vector x(r.size());
Vector p, d, t;
std::future<Real> sqn_r_f = std::async(std::launch::asy... | true |
41353d20af53c8b5d2d98812bd5110859cd32b38 | C++ | btcup/sb-admin | /exams/2558/02204111/1/midterm/2_2_713_5820501110.cpp | UTF-8 | 1,074 | 3.125 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main ()
{
char A,a,B,b,C,c,wa,flr;
int h,w,d,pa,pb,pc;
float va,vb,vc;
cout << "Welcome to The Fantastic Tiles!!" << endl;
cout << "Please enter room size in meter (H x W x D) : ";
cin >> h >> w >> d ;
cout << "Please select floor tile. . .(A/B/C)... | true |
7c2d5e2612f1d4056cfed83a624fef316a1556c0 | C++ | rie1010/multi-h | /MultiH/MultiH/moduls/feature_detection/EllipticKeyPoint.cpp | UTF-8 | 2,617 | 2.671875 | 3 | [] | no_license | #define _USE_MATH_DEFINES
#include <cmath>
#include "EllipticKeyPoint.h"
EllipticKeyPoint::EllipticKeyPoint() : cv::KeyPoint()
{
this->transformation = cv::Mat_<double>::eye(2,2);
}
EllipticKeyPoint::~EllipticKeyPoint()
{
}
EllipticKeyPoint::EllipticKeyPoint(const EllipticKeyPoint& ekp) : cv::KeyPoint(ekp)
{
this... | true |
240d895862f5f504211cff1dac2b6b71114cafae | C++ | seddon-software/cplusplus | /A4_Boost/DateTime/11.TimeIterators.cpp | UTF-8 | 717 | 3.265625 | 3 | [] | no_license | #include "boost/date_time/posix_time/posix_time.hpp"
#include <iostream>
using namespace std;
int main()
{
using namespace boost::posix_time;
using namespace boost::gregorian;
//get the current time from the clock -- one second resolution
ptime now = second_clock::local_time();
//Get the date part... | true |
3f71eaacbb6ebf3a6265f1d5d29d5d51bba33eb7 | C++ | AnneLivia/Competitive-Programming | /Online Judges/URI/2750/main.cpp | UTF-8 | 505 | 2.859375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n[16];
for ( int i = 0; i < 16; i++)
n[i] = i;
cout << "---------------------------------------\n";
cout << "| decimal | octal | Hexadecimal |\n";
cout << "---------------------------------------\n";
for(... | true |
9ba82f856a7ab3af5bf5c0ca2f427a23fc1969a7 | C++ | p4ajst/avoiding | /avoiding/GameSource/Object/Character.h | UTF-8 | 1,760 | 2.75 | 3 | [] | no_license | // ------------------------------------------------------------------------------------------------ //
// @ file : Character.h //
// @ brief : キャラクターに関するクラス //
// @ date : 2017/06/25 ... | true |
43356ba955da46c6e99753f36ef537cf7477449b | C++ | manhtung001/Datastructure-Algorithm-PTIT | /contest/Contest2/bai26.cpp | UTF-8 | 470 | 3 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
void Try(string s, int k, string &max){
if(k==0) return;
int n=s.length();
for(int i=0; i<n-1; i++){
for(int j=i+1; j<n; j++){
if(s[i]<s[j]){
swap(s[i], s[j]);
if(s.compare(max)>0) max=s;
Try(s, k-1, max);
swap(s[i], s[j]);
}
}
}... | true |
095c5b2cefce16511d82e65527a6ba15237c4f3d | C++ | russellgrim/6_axis_arm | /Main/Joint.cpp | UTF-8 | 1,317 | 3.21875 | 3 | [] | no_license |
#include "Joint.h"
//--------------------------- Joints ---------------------------
Joint::Joint (int attachTo , int homeAngle) :
pin(attachTo),
homePosition(homeAngle) {}
void Joint::setup() {
servo.attach(pin);
servo.write(homePosition);
currentPosition = homePosition;
}
void Joint::loop() {
// ... | true |
e121ffe3cc15ac942add4dfc7144175b0209cfa3 | C++ | Omar6re/Online-Judges | /Codeforces/263A - BeautifulMatrix.cpp | UTF-8 | 854 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main (){
int t = 4;
int z[t];
int x[t];
int w[t];
int y[t];
int g[t];
int i;
int b;
int c;
int r1;
int r2;
int r;
b = 0;
c = 0;
r1 = 0;
r2 = 0;
r = 0;
i = 0;
for (i = 0; i < 5; i++){
cin >> z[i];
if (z[i] != 0){
... | true |
20eeb52a73c91846dacde0a630ae7ba3708f8170 | C++ | chengwuxinlin/EE553-CPP | /session07/testreadbmp.cc | UTF-8 | 2,366 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
#if 0
template<typename T>
void read(istream& f, T& val) {
f.read((char*)&val, sizeof(T));
// TODO: flip if bigendian
}
#endif
void read(istream& f, uint32_t& val) {
f.read((char*)&val, sizeof(int));
// TODO: flip if bigendian
}
vo... | true |
756b3191740c450c1b62f00a33a38f23bce97eb2 | C++ | LaelRodrigues/Atividade7 | /src/questao03/main3.cpp | UTF-8 | 664 | 2.96875 | 3 | [] | no_license | /**
* @file main3.cpp
* @brief Codigo fonte de teste da funcao que calcula o
* valor de uma determinada expressao escrita na
* notacao polonesa inversa
* presente no aquivo imprime.h
* @author LaelRodrigues (laelRodrigues7@gmail.com)
* @since 08/06/2017
* @date 08/06/2017
*/
#include <iostream>
using ... | true |
9533dd443a5c889c64acd8c6e4e670c37cf38e4b | C++ | YueLeeGitHub/algorithm | /leetcode/number/xor/1738.cpp | UTF-8 | 915 | 3.109375 | 3 | [] | no_license | // https://leetcode-cn.com/problems/find-kth-largest-xor-coordinate-value/
// Created by admin on 2021/5/19.
// 前缀异或+优先队列
class Solution {
public:
int kthLargestValue(vector<vector<int>>& matrix, int k) {
int m,n;
m = matrix.size();
n = matrix[0].size();
vector<vector<int>> dp(m+1,v... | true |
6accd190ea984191cb82e7a913de68d165fbae22 | C++ | wallabra/xhack | /src/matrix.cpp | UTF-8 | 1,991 | 3.375 | 3 | [
"MIT"
] | permissive | #include <assert.h>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
using std::setw;
#include "matrix.h"
Matrix::Matrix(unsigned short rows, unsigned short cols, double* data) {
this->rows = rows;
this->cols = cols;
this->data = new double[rows * cols];
if (data != 0)
... | true |
a0fc4cc0e1348a09f3efcf0052c122677df48495 | C++ | barongeng/vSLAM-2 | /cpp/tf.cpp | UTF-8 | 2,016 | 3.140625 | 3 | [] | no_license | /// Matrix operations
// All the matrices are saved in OpenGL-compatible 4x4 matrices (column-major order)
#include "tf.h"
#include <math.h>
#define PI 3.141592653589793
// 2D matrix element intexing
#define I(m,row,col) m[row + col*4]
// Switch some axes, ROS -> our algorithm
double axes[] = {0,0,1,0 , -1,0,0,0 , ... | true |
030c3f72772af2dfbbcd4b5bb9b88d86bebb5c8a | C++ | FoolingBears101/Example_1 | /TODO1/remoteControl/remoteControl.ino | UTF-8 | 2,480 | 2.796875 | 3 | [] | no_license | #include <ArduinoJson.h>
#include <Arduino.h>
#include <analogWrite.h>
#include "OneWire.h"
#include "DallasTemperature.h"
#define TRUE 1
#define FALSE 0
String receivedStr;
// Numero de pins a modifié suivant votre carte.
// les pins actuels correspond au branchement pour une carte ESP32 clone(chinois... | true |
1bf4fa1eaca35ab3bec9f110e464d6a5c0a77844 | C++ | Kewth/OJStudy | /hdu869_1002.cpp | UTF-8 | 2,119 | 2.875 | 3 | [] | no_license | #if 0
2019.08.23
由于 a 是个排列,对于每个 a[i] = x 设 b[x] = i 。
修改操作相当于删掉一个点,在 b 上就是令 b[x] = INF 。
询问操作就是找到不小于 k 的最小 x 满足 b[x] > r 。
先不考虑修改,处理询问,发现一次二分后问题转换为 rmq ,
具体地,二分 x 判断答案是否在 [k, x] 内,那么 check 就是求 b[k:x] 的最大值。
用线段树维护最大值的话,不仅能解决这个问题,还能轻松处理修改。
但是套上二分是 O(log^2n) 的。
考虑使用 ST 表,虽然 ST 表不支持修改,但是对于修改操作有其他处理方法。
把删掉的点加入到 set 里边,那么询问... | true |
d8078778c981bc089986cc2993dc8efcc9dabd14 | C++ | venusshum/MakeMe | /Sketches/140611-shakeTemp/MakeMe3/TemperatureLEDs.ino | UTF-8 | 1,325 | 3.109375 | 3 | [] | no_license | float baseTemp = 0;
void TemperatureLEDs() {
uint16_t r, b, g;
//int t;
float t;
int TBLUE = baseTemp;
int TRED = baseTemp + 5;
int TRANGE = TRED - TBLUE;
for (int i=0;i<100; i++)
t = (i*t + getTemp())/(i+1);
// Choose the next point in RGB space by temperature - this is a
// l... | true |
b9a85dcb505cd48ec878a316bbff4a687d9a8d33 | C++ | rahul-ramadas/leetcode | /find-minimum-in-rotated-sorted-array/Solution.13518195.cpp | UTF-8 | 628 | 2.96875 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int findMin(vector<int> &num) {
int low = 0;
int high = num.size() - 1;
while (low < high)
{
if (num[low] < num[high])
{
return num[low];
}
int middle = low + (... | true |
270321a1e451b31ad23abe7d7292842598f28a77 | C++ | sidorovis/cpp_craft_1013 | /solutions/max_kaskevich/6/tests/multicast_communication_tests/udp_listener_tests.cpp | UTF-8 | 1,794 | 2.515625 | 3 | [] | no_license | #include "test_registrator.h"
#include <udp_listener.h>
#include <cstring>
namespace multicast_communication
{
namespace tests_
{
namespace detail
{
void service_thread( boost::asio::io_service& service );
}
}
}
void multicast_communication::tests_::detail::service_th... | true |
f40d48794d299ed08038cd23fcc510bdcc152993 | C++ | LuisRGameloft/PubBus | /test/MessageBusTest.cpp | UTF-8 | 1,899 | 3.21875 | 3 | [
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | #include "catch.hpp"
#include <PubBus/Message.hpp>
#include <PubBus/MessageBus.hpp>
TEST_CASE("Adding subscriber returns a valid SubscriberHandle", "[MessageBus]")
{
// Arrange
class DummyMessage : public pub::Message
{
};
pub::MessageBus bus;
// Act
pub::SubscriberHandle handle = bus.subscribe<DummyMessage>... | true |
5dac4515747697d5f264434aa677b5dce00dafdd | C++ | iamdatyoung1/EnginesProjectFull | /EnginesProject/EnginesProject/Engine/Camera/Camera.cpp | UTF-8 | 2,599 | 3.046875 | 3 | [] | no_license | #include "Camera.h"
#include "../Core/CoreEngine.h"
Camera::Camera(): position(glm::vec3()), fieldOfView(0.0f), forward(glm::vec3()), up(glm::vec3()),
right(glm::vec3()), worldUp(glm::vec3()), nearPlane(0.0f), farPlane(0.0f),
yaw(0.0f), pitch(0.0f), perspective(glm::mat4()), orthographic(glm::mat4()), view(glm:... | true |
3d680db87daf20a0e1c2a22bdf14df965b9fdda7 | C++ | angelgomezsa/Cplusplus | /Dubtes/Consolidation 3/ex10-3.cc | UTF-8 | 4,447 | 2.828125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using namespace std;
struct Enviament {
string dni;
string exer;
int temps;
string res;
};
struct exercici {
string nom;
int temps;
string res;
};
struct alums {
string dni;
vector<exercici> exer;
};
typedef vector<Enviament> Historia;
typedef vector<alums> Alumne... | true |
22bcd1c652a2756417bebc39a686984347c7a3b7 | C++ | shaih/HElib | /include/helib/timing.h | UTF-8 | 4,114 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | /* Copyright (C) 2012-2020 IBM Corp.
* This program is Licensed under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or a... | true |
8f45c854169fe69a91b2032702d7c12128e70d76 | C++ | BigBang019/Code_Library | /hdu/hdu_4347.cpp | UTF-8 | 3,054 | 2.515625 | 3 | [] | no_license | /*
KDTREE
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
const int K = 6;
int di;
struct NODE{
ll d[K];
//vector<ll> d;
bool operator < (const NODE & a) const {
return d[di] < a.d[di];
}
bool operator > (const NODE & a) const ... | true |
f9b77e1d01c695788858412b18c1924c24610557 | C++ | lk16/squared | /src/bots/bot_random.cpp | UTF-8 | 377 | 2.515625 | 3 | [] | no_license | #include "bots/bot_random.hpp"
REGISTER_BOT(random);
bot_random::bot_random()
{
set_name("random");
}
void bot_random::do_move(const board* in, board* out)
{
board moves[32];
board* moves_end = in->get_children(moves);
*out = moves[rand() % (moves_end - moves)];
output() << "bot_" << get_name() << " pic... | true |
100c6736f3b0c98561b19069afb09779f3c64d94 | C++ | samanseifi/Tahoe | /tahoe/src/primitives/globalmatrix/DiagonalMatrixT.cpp | UTF-8 | 8,894 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | /* $Id: DiagonalMatrixT.cpp,v 1.22 2011/12/01 21:11:40 bcyansfn Exp $ */
/* created: paklein (03/23/1997) */
#include "DiagonalMatrixT.h"
#include <iostream>
#include <iomanip>
#include "toolboxConstants.h"
#include "iArrayT.h"
#include "ElementMatrixT.h"
#include "StringT.h"
#include "ofstreamT.h"
#include "Communicat... | true |
cf3b63f14e09b43508932012f5399c6dd4f9cc0e | C++ | macielbarbosa/UVa | /prova3/a.cpp | UTF-8 | 549 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
using namespace std;
long double calculado [5001];
long double fibonacci (int n) {
if (calculado[n] != -1) return calculado[n];
calculado[n] = fibonacci(n-1) + fibonacci(n-2);
return calculado[n];
}
int main () {
int n;
calculado[0] = 0;
ca... | true |
fd27bbfedf057d161fe373de073fbc5d7444676d | C++ | AnishKumarAkGk/Laptop_projects_Arduino | /Http_Thingspeak/Http_Thingspeak.ino | UTF-8 | 1,595 | 2.546875 | 3 | [] | no_license |
#include <ESP8266WiFi.h>
// Wi-Fi Settings
const char* ssid = ""; // your wireless network name (SSID)
const char* password = ""; // your Wi-Fi network password
WiFiClient client;
// ThingSpeak Settings
const int channelID = 489907;// write channelID key for your ThingSpeak
String writeAPIKey = ""; // write API key ... | true |
0f6ee27fa8656bc22a20d9b8f6c75ae276f17cb8 | C++ | Minusie357/Algorithm | /BackjoonAlgorithm/4344. 평균은 넘겠지.cpp | UTF-8 | 496 | 2.59375 | 3 | [
"Unlicense"
] | permissive | //#include <stdio.h>
//
//int main()
//{
// int c;
// scanf("%d", &c);
//
// int scores[1000];
// while (c--)
// {
// int n;
// scanf("%d", &n);
//
// int sum = 0;
// for (int i = 0; i < n; ++i)
// {
// scanf("%d", &scores[i]);
// sum += scores[i];
// }
//
// double avg = sum / (double)n;
// int num_avg_u... | true |
fa622a5f24e63f14431be3b4573239825292f76f | C++ | harshp8l/deep-learning-lang-detection | /data/train/cpp/7b95cac5059aebb7379553888f0bee952ba3c763Chunk.cpp | UTF-8 | 2,631 | 2.515625 | 3 | [
"MIT"
] | permissive | #include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include "../Block/Block.hpp"
#include "Chunk.hpp"
#include "ChunkManager.hpp"
#include "LocalChunkSystem.hpp"
#define DEBUG_GRAPH
bool Chunk::isStrictelyInside(const sf::Vector3i & blockPosition)
{
return blockPosition.x > 0 && blockPosit... | true |
6d8481524e818db9d227a6d89c9fa9fe90ece782 | C++ | tongyuantongyu/image-resampler | /Source/Utilities/vnImageBlock.cpp | UTF-8 | 2,258 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | #include "vnImageBlock.h"
VN_STATUS vnConvertBlock(CONST VN_PIXEL_BLOCK& pSrc, VN_IMAGE_FORMAT destFormat,
VN_PIXEL_BLOCK* pDest) {
if (VN_PARAM_CHECK) { if (!pDest) { return vnPostError(VN_ERROR_INVALIDARG); } }
//
// (!) Note: this function is written to support aliased conversion. That ... | true |
64949d048a5b7bf2dc87564110e4fd343e95b3a9 | C++ | pelmenka/120_bomberman | /render/shader.cpp | UTF-8 | 2,266 | 2.5625 | 3 | [] | no_license | #include <GL/glew.h>
#include <stdio.h>
#include <assert.h>
#include <memory.h>
#include "shader.h"
#include "../log.h"
shader::shader()
{
shaders[0] = 0;
shaders[1] = 0;
program = -1;
}
shader::~shader()
{
if(program == -1) return;
unbind();
glDetachShader(program, shaders[0]);
glDetachS... | true |
b67a6e7c9ad2e95d9795ac7bbaea0a41e423833c | C++ | s-bond/Miscellaneous-Codes | /4/its a murder.cpp | UTF-8 | 753 | 2.546875 | 3 | [] | no_license | /* ~
* Siddharth Maloo
*/
#include <iostream>
#include <cstring>
/////////////////
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ULL unsigned long long int
#define Max 1000001
/////////////////
using namespace std;
ULL tree[Max], a[Max];
ULL read(int idx){
ULL sum = 0;
while (idx > 0){
sum += tree[... | true |
520db78c75bd885288fe18d0961cb7520e0875a5 | C++ | Iristudio/Iris-c | /源码/079类和对象的练习.cpp | GB18030 | 648 | 3.53125 | 4 | [] | no_license | #include<iostream>
using namespace std;
//еԺΪͳһΪ Ա
// Ա Ա
//Ϊ Ա Ա
class stu {
public:
string stu_name;
int stu_code;
void setname(string name) {
stu_name = name;
}
void setcode(int code) {
stu_code = code;
}
void showstu() {
cout << "ѧ:" << stu_name << " ѧ:" << stu_code << endl;
}
};
int main() {... | true |
d2cb043f9c57344c82ef63191a6c8370f552108f | C++ | jleun1403/BOJ_CPP | /Q14709.cpp | UTF-8 | 473 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
vector<pair<int, int>> v;
for (int i = 0 ; i <n ; i++) {
int a, b;
cin >> a>> b;
if (a > b)
swap(a, b);
v.push_back(make_pair(a, b));
}
sort(v.begin(), v.end());
vector<pair<int, int>> t(3);
t[0] = {... | true |
78145e37dc79a68c864051e9fb359d9ef28cb57d | C++ | ashish1508/ds-algo | /binarysearch/smallerOrEqualElements.cpp | UTF-8 | 542 | 3.59375 | 4 | [] | no_license | // finding last. element less tha or equal to B
int Solution::solve(vector<int> &A, int B) {
int lo=0,n=A.size(),hi=n-1,mid;
while(lo<=hi){
mid=lo+(hi-lo)/2;
if(A[mid]<=B) lo=mid+1;
if(A[mid]>B) hi=mid-1;
}
return hi+1;
}
// finding first element greater than B
int Solution::sol... | true |
b1287944aa88c5b34aac52c68637ed68d43dc0eb | C++ | ailyanlu/ACM_Code | /HDU/HDU_4584.cpp | UTF-8 | 1,733 | 2.5625 | 3 | [] | no_license | /**
* @file HDU_4584.cpp
* @brief 水题,枚举1A!
* @author FinalTheory
* @version 0.1
* @date 2013-08-13
*/
#if defined(__GNUC__)
#pragma GCC optimize ("O2")
#endif
#if defined(_MSC_VER)
#pragma comment(linker, "/STACK:36777216")
#endif
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>... | true |
a4155ca444070ba570496eee31f1e5e1313382e7 | C++ | mmi366127/Online_Judge | /zerojudge/b963 GIIA v.s. 死亡之握/b963 GIIA v.s. 死亡之握.cpp | UTF-8 | 906 | 2.828125 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
char s[100];
int n, m;
int to_num(char c) {
if('A' <= c && c <= 'Z') {
return 10 + c - 'A';
}
if('a' <= c && c <= 'z') {
return 10 + c - 'a';
}
return c - '0';
}
char to_char(int x) {
if(x >= 10) {
return 'A' + x... | true |
a903c35b506329d68bdf3a47af5085d0e8cbceb7 | C++ | Cl0v1s/IUT-sta | /Sta/HardEnemy.h | UTF-8 | 1,592 | 3.265625 | 3 | [] | no_license | #ifndef HARDENEMY_H
#define HARDENEMY_H
#include <string>
#include <sstream>
#include <math.h>
#include "EntityEnemy.h"
#include "EntityPlayer.h"
class HardEnemy : public EntityEnemy
{
public:
/** \brief HardEnemy
* Créer un nouvel enemi présentant une difficulté de niveau trois
* \param int x position... | true |
49f5739da18ff7944dd7676e23c152c473ae8cc5 | C++ | dongguadan/playsdk | /dgdplaysdk/scopelock.h | UTF-8 | 897 | 2.859375 | 3 | [] | no_license | #ifdef WIN32
#pragma once
#include <Windows.h>
class CCriticalSection
{
CCriticalSection(const CCriticalSection &refCritSec);
CCriticalSection &operator=(const CCriticalSection &refCritSec);
CRITICAL_SECTION m_CritSec;
public:
CCriticalSection()
{
InitializeCriticalSection(&m_CritSec);
... | true |
d4cca8a829e6d25a3112398a8f7640b3fb55fb6a | C++ | tingpan/dxsimhair | /HairSim/wrColorGenerator.cpp | UTF-8 | 813 | 2.984375 | 3 | [] | no_license | #include "precompiled.h"
#include "wrColorGenerator.h"
#include "wrMath.h"
wrColorGenerator::wrColorGenerator()
{
}
wrColorGenerator::~wrColorGenerator()
{
}
void wrColorGenerator::genRandLightColor(float* output)
{
for (int i = 0; i < 3; i++)
output[i] = 0.5 + 0.5 * randf();
}
void wrColorGenerator... | true |
97ed67956c7c108fe6d5e3286c392fd241889f93 | C++ | hydrogen69/Probelm-solved | /UVA/11152/18058329_AC_20ms_0kB.cpp | UTF-8 | 443 | 2.5625 | 3 | [] | no_license |
#include<stdio.h>
#include<math.h>
#define pi 2*acos(0)
int main()
{
double a,b,c,i,j;
double s,r1,r2,triangle,circum,inscribed;
while(scanf("%lf%lf%lf",&a,&b,&c)==3)
{
s=(a+b+c)/2;
triangle=sqrt(s*(s-a)*(s-b)*(s-c));
r1=((a*b*c)/sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c)));
r2=triangle/s;
circum=(pi*pow(r1,2))-triangle;
i... | true |
ef2644b5c7fd491de620c3bcf77d6ff21d702ab5 | C++ | snailbaron/buzz-legacy | /src/res_cache.hpp | UTF-8 | 1,274 | 2.6875 | 3 | [] | no_license | #ifndef _RES_CACHE_HPP_
#define _RES_CACHE_HPP_
#include <list>
#include <map>
#include <string>
#include <memory>
#include "res_handle.hpp"
#include "resource.hpp"
#include "resource_file.hpp"
typedef std::list<std::shared_ptr<ResHandle>> ResHandleList;
typedef std::map<std::string, std::shared_ptr<ResHandle>> ResHa... | true |
d615754dbd780df0b84dab82dad4b09457773389 | C++ | NanlinW/NanlinCode | /exercise_11_9/Date.h | GB18030 | 495 | 3.046875 | 3 | [] | no_license | #include<iostream>//ͷļ
using namespace std; //c++
class Date
{
friend std::ostream& operator<<(std::ostream&, Date&);//
friend std::istream& operator>>(std::istream&, Date&); //
public:
Date();//յĹ캯
Date(int y, int m, int d);
void setDate(int y, int m, int d);
int getyear()
{
return year;
}
voi... | true |
183cab270d87f086b9ebe1b572eddf60e91a9642 | C++ | andrenho/perminal | /.old/cpp/emulator/cursor.h | UTF-8 | 572 | 2.796875 | 3 | [] | no_license | #ifndef CURSOR_H
#define CURSOR_H
#include "config.h"
#include "chars.h"
struct P {
int x, y;
inline bool operator<(P const& other) const {
return ((x<<16) + y) < ((other.x<<16) + other.y);
}
inline bool operator==(P const& other) const {
return other.x == x && other.y == y;
}
};... | true |
7e5169b449230cd619d96f9e76fcf8aa616f10bb | C++ | cli851/noi | /1065.cpp | UTF-8 | 187 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int m,n;
int sum=0;
cin>>m>>n;
for(int i=m;i<=n;i++){
if(i%2!=0){
sum+=i;
}
}
cout<<sum;
return 0;
}
| true |
bcea01a0d77cfe44e7a8fbd758ab063d8cd6828e | C++ | hank08tw/poj | /3046.cpp | UTF-8 | 957 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
long long dp_first[1000001];
long long dp_second[1000001];
int a[1001];
const int mod=1e6;
int t,A,s,b,tmp;
int main(){
scanf("%d %d %d %d",&t,&A,&s,&b);
memset(a,0,sizeof(a));
memset(dp_first,0,sizeo... | true |
d636760c630f250483e072ac6c5882269cd61520 | C++ | kkimmm/Cpp-Program | /MyBinaryTree/bt.cpp | GB18030 | 1,213 | 3.78125 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct BiNode
{
char data;
BiNode *lchild, *rchild;
};
void CreatBiTree(BiNode *&T)
{
char ch;
ch = getchar();
if (ch== '#')//עʹ''""
T = NULL;
else
{
T = new BiNode;
T->data = ch;
CreatBiTree(T->lchild);
CreatBiTree(T->rchild);
}
}
//
void PreOrderTraverse(Bi... | true |