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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c6016e2fda7acdb0e563f49667f98a81141b014a | C++ | wenfh2020/c_test | /interview/test_index.cpp | UTF-8 | 395 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <map>
int main() {
int n, k, v;
std::map<int, int> _map;
std::cin >> n;
while (n-- > 0) {
std::cin >> k >> v;
auto it = _map.insert({k, v});
if (!it.second) {
it.first->second += v;
}
}
for (auto it : _map) {
std... | true |
eb335f0441e234a1a21a656211b21209fd006775 | C++ | yuliy/sport_programming | /codeforces/379/B/main.cpp | UTF-8 | 1,074 | 2.609375 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <vector>
#include <deque>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <list>
#include <algorithm>
using namespace std;
int main() {
int n;
scanf("%d", &n);
vector<int> a(n);
for (int i = 0; i < n; ++i)
scanf("%d", &... | true |
1c67622340e90ca099f0d2c3efbce4f16be4d95c | C++ | dgquintas/my-code-samples | /cpp/compilador/TS/tipoarray.h | UTF-8 | 464 | 2.625 | 3 | [] | no_license | #ifndef TIPOARRAY_H
#define TIPOARRAY_H
#include "tipo.h"
#include <string>
using namespace std;
class TipoArray: public Tipo {
public:
TipoArray(Tipo*, size_t tam);
TipoArray(unsigned int tam);
virtual unsigned int getTam ( );
virtual string getNombre() { return "array";};
Tipo* getTipo ( ... | true |
816b3de962d63d9d4ebd1c2846f0e3b61c1087b7 | C++ | JahooYoung/RISCV-Simulator | /src/elf.hpp | UTF-8 | 4,027 | 2.671875 | 3 | [] | no_license | #ifndef ELF_HPP
#define ELF_HPP
#include <cstdint>
/* Type for a 16-bit quantity. */
typedef uint16_t Elf64_Half;
/* Types for signed and unsigned 32-bit quantities. */
typedef uint32_t Elf64_Word;
typedef int32_t Elf64_Sword;
/* Types for signed and unsigned 64-bit quantities. */
typedef uint64_t Elf64_Xword;
... | true |
e67aa36d75fe57a5c85bea93157f1e9e3a3b7fd3 | C++ | Pentagon03/competitive-programming | /project-euler/volume07/319.cc | UTF-8 | 1,472 | 2.875 | 3 | [] | no_license | #include <bits/stdc++.h>
const int mod = 1000000000;
const int N = 1000000;
long t[N], d[N];
std::map<long, long> cache;
inline long mul_mod(long a, long b, long mod) {
if (mod < int(1e9)) return a * b % mod;
long k = (long)((long double)a * b / mod);
long res = a * b - k * mod;
res %= mod;
if (res < 0) res... | true |
b8c38182c2ce8b557c7366b28fe7c28b6c996d08 | C++ | jiandingzhe/treeface | /src/treeface/misc/StringCast.cpp | UTF-8 | 44,461 | 2.625 | 3 | [
"MIT"
] | permissive | #include "treeface/misc/StringCast.h"
#include <stdexcept>
using namespace treeface;
namespace treecore
{
template<>
bool fromString<treeface::MaterialType>( const treecore::String& string, treeface::MaterialType& result )
{
String str_lc = string.toLowerCase();
if (str_lc == "raw") result ... | true |
29820f0073e55f644a6da2fc8c6c2b48b7dd80af | C++ | JackThomson2/Bilging-Cpp | /Searcher.cpp | UTF-8 | 1,641 | 2.8125 | 3 | [] | no_license | //
// Created by Jack Thomson on 07/03/2021.
//
#include "Searcher.hpp"
float Search(Board board, byte max_depth, byte depth, byte move_number) {
float score = board.swap(move_number);
if (score < 0 || depth == 1) {
return score;
}
byte actual_depth = (max_depth - depth) + 1;
auto moves =... | true |
e01e73d0cb46b8f2ad936f113c16180c06feefdb | C++ | BlackCapCoder/factory | /src/Undergroundee.cpp | UTF-8 | 3,655 | 2.6875 | 3 | [] | no_license | #include "Undergroundee.h"
#include "Rendering.h"
#include <SDL2/SDL2_gfxPrimitives.h>
void Undergroundee::render (SDL_Renderer & rend, long time)
{
// ----------- Background
static constexpr float k = 0.14; // slope
SDL_SetRenderDrawColor (&rend, 16*5, 16*5, 16*1, 255);
SDL_FRect r = { 0, 0, 1, 1 };
sw... | true |
9cad8bd847f2941d5352923f794913542b2a7db1 | C++ | taku-xhift/labo | /c++/CUIRolling/main.cpp | UTF-8 | 335 | 2.84375 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <unistd.h>
int main(void) {
while(1){
printf(" -\r");
usleep(100000);
fflush(stdout);
printf(" \\\r");
usleep(100000);
fflush(stdout);
printf(" |\r");
usleep(100000);
fflush(stdout);
printf(" /\r");
usleep(100000);
fflush(std... | true |
d0c614ae6e8eb1144d49fbb092fda0efb0856723 | C++ | YoussefSaied/MagneticFrustration | /progprojet/trial/general/Dodec.cc | UTF-8 | 4,038 | 2.6875 | 3 | [
"MIT"
] | permissive | #include "Dodec.h"
#include "Vecteur3D.h"
#include "Plan.h"
#include "Dalle.h"
#include "Obstacle.h"
#include <cmath>
#include <vector>
#include <memory>
using namespace std;
unique_ptr<Dodec> Dodec:: cloneMe() const
{
return unique_ptr<Dodec>(new Dodec(*this));
}
unique_ptr<Obstacle> Dodec:: copie() const
{
... | true |
45a85f73fab6d783ff94448e7f0a9db6ba026084 | C++ | flameshimmer/leet2019.io | /Leet2019/WildcardMatching.cpp | UTF-8 | 2,934 | 3.28125 | 3 | [] | no_license | #include "stdafx.h"
//Given an input string (s) and a pattern (p), implement wildcard pattern
//matching with support for '?' and '*'.
//'?' Matches any single character.
//'*' Matches any sequence of characters (including the empty sequence).
//The matching should cover the entire input string (not partial).
//
//Not... | true |
baddb02849d119be5fdaad515721483a2d8839db | C++ | viscrisn/mit-algo-cpp | /CPP Projects/Top Coder/SRM 551 Live/250_try1.cpp | UTF-8 | 854 | 3.09375 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<cctype>
#include<algorithm>
#include<sstream>
#include<queue>
#include<cstdlib>
#include<map>
#include<set>
using namespace std;
class ColorfulBricks
{
public:
int countLayouts(string mem)
{
char color1 = 'a';
c... | true |
2841a44bb27a178cd5ddad51d9e778618d46062b | C++ | sahil32/DataStructureandAlgorithm | /practise/stupidq.cpp | UTF-8 | 515 | 2.90625 | 3 | [] | no_license | #include<iostream>
using namespace std;
long long lcm(int a,long long int b)
{
long long int temp1=a;
long long int temp2=b;
while(temp2!=0)
{
long long int newtemp=temp2;
temp2=temp1%temp2;
temp1=newtemp;
}
return (long long) temp1*((a/temp1)*(b/temp1));
}
long long int getlcm(int n)
{
long long int resu... | true |
4343bcd9ca52df3b44a186da7670885b0ee5811c | C++ | hamedmirlohi/Reverse-Characters | /Reverse/main.cpp | UTF-8 | 530 | 3.296875 | 3 | [] | no_license | //
// main.cpp
// Reverse
//
// Created by Hamed Mirlohi on 3/4/19.
// Copyright © 2019 Hamed Mirlohi. All rights reserved.
//
#include <iostream>
using namespace std;
void reverse(char word[])
{
unsigned long size = strlen(word);
char temp;
for (int i = 0; i < strlen(word) / 2; ++i, --size)
... | true |
cc24ef7c0a12f630145f2c701aa2a49904ee5299 | C++ | niebayes/UZH-Robot-Perception | /include/matlab_port/find.h | UTF-8 | 2,193 | 3.09375 | 3 | [
"MIT"
] | permissive | #ifndef UZH_MATLAB_PORT_FIND_H_
#define UZH_MATLAB_PORT_FIND_H_
#include <algorithm> // std::transform, std::copy_if
#include <numeric> // std::iota
#include <tuple>
#include <vector>
#include "armadillo"
#include "matlab_port/nnz.h"
namespace uzh {
//@brief Remove zeros in an array.
std::vector<int> remove_zer... | true |
663ce56c138a2fdd90e385834616e52b3701a944 | C++ | mattylenepveu/MattTennis | /Matt's Tennis/project2D/StateMachine.h | UTF-8 | 3,149 | 2.96875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Renderer2d.h"
#include "DynamicArray.h"
#include "State.h"
#include "Stack.h"
using namespace aie;
class StateMachine
{
public:
//--------------------------------------------------------------------------------------
// Default Constructor.
//--------------------------------------------------... | true |
91fe4c4c5bf0626bfdcf7e3c2a241e748bdb0538 | C++ | chav0028/AC_GAM1546_FinalProject | /Source/Framework/ECS/Entity.h | UTF-8 | 1,293 | 2.90625 | 3 | [] | no_license | #pragma once
#include <vector>
#include <string>
class Scene;
class Component;
class TransformComponent;
class Entity
{
public:
Entity(Vector2 position, Vector2 size,Scene* ownerScene, std::string name);
~Entity();
virtual void loadContent();
virtual void update(double delta);
virtual void draw();
... | true |
30e9dfd0222a8ca7dd66eb3e4804298bc08fa15e | C++ | DinoEhman/Competitive-Programming | /Codeforces/466A.cpp | UTF-8 | 438 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int main()
{
int m, n, a, b;
cin >> n >> m >> a >> b;
int extra = 0;
if (n > m)
{
if (n % m)
extra += min(a * (n % m), b);
}
int ticks = 1;
if (n > m)
... | true |
ed4d49dd6cc1c62e3902c49415e366a80cee39fb | C++ | Sookmyung-Algos/2021algos | /algos_semina/1st_semina/seminar_2/C_1145/kijh30123_1145.cpp | UTF-8 | 524 | 2.515625 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
void init() {
cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(false);
}
int main() {
int N1, N2, N3, N4, N5;
cin >> N1 >> N2 >> N3 >> N4 >> N5;
int max = 1000000;
for (int i = 1; i <= max; i++) {
int count = 0;
if (i%N1 == 0) {
count++;
}
... | true |
164b8984cd73745a55d6c1b64077440a12246af5 | C++ | Krebrov001/C-Experiments | /structs_and_objects/constructor_initializer_list_examples/initializer_list5_1.cpp | UTF-8 | 744 | 3.828125 | 4 | [] | no_license | /**
* @file initializer_list5_1.cpp
* @author Konstantin Rebrov
* @version 09/02/2018
*
* @section DESCRIPTION
*
* This program demonstrates the fifth reason why you should use constructor
* initializer lists.
* When you have a data member of a class with the same name as the parameter
* to the constructo... | true |
909ce3c75c2273837cdf6a60bd279499adf300e2 | C++ | Jonathan-Louis/Games2D | /Zombie Game/Agent.h | UTF-8 | 1,281 | 2.8125 | 3 | [] | no_license | #pragma once
#include <glm/glm.hpp>
#include <Bengine/SpriteBatch.h>
#include <string>
const float AGENT_WIDTH = 60.0f;
const float AGENT_RADIUS = AGENT_WIDTH / 2.0f;
//including classes for human and zombie to avoid circular includes with header files
class Human;
class Zombie;
//class used for detecting collision... | true |
c0e954f39e1d14e3389e25e5610e5db36f612fcb | C++ | zzz0906/LeetCode | /2021_Nov/25.cpp | UTF-8 | 598 | 3.03125 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int left = 0;
int right = 1;
int res = nums[0];
int sum = nums[0];
while (right < nums.size()){
res = max(res,sum);
cout << left << endl;
while (sum < 0 && left < right){
... | true |
716814da9e8d941c485509083f24296cf7337ca2 | C++ | 3303550641/Curriculum-Book-information-management-system | /123/图书管理系统/Biz.h | GB18030 | 1,255 | 2.859375 | 3 | [] | no_license | #include<iostream.h>
#include<fstream.h>
#include<string.h>
#include"Library.h"
#include"Magazines.h"
#include"Teacher.h"
#include"Student.h"
class Biz{
public:
int addLibrary(Library &lib); //ͼ ¼ͱ
int updateLibrary(Library &lib); //ͼ
int deleteByIdLibrary(int id); //ͼ ɾ
void findByIdLibrary(int id); //ͼ ݱŲ
v... | true |
50b6ef7774025b70c2e926063f20c68af6a4b1a8 | C++ | bbernardoni/Nib | /Nib/core/object.cpp | UTF-8 | 713 | 3.15625 | 3 | [
"MIT"
] | permissive | #include "object.h"
void Object::draw(RenderTarget& target, RenderStates states) const{
states.transform *= getTransform();
for(auto drawable: drawables)
target.draw(*drawable, states);
for(auto child: children)
target.draw(*child, states);
}
void Object::addChild(Object* child){
children.push_back(child);
}
... | true |
e111a40c6f4c29f2d3faa816b0c1aeaf52d7a655 | C++ | Azurelol/Algorithms | /Algorithms/Algorithms/Sorting.hpp | UTF-8 | 1,843 | 3.921875 | 4 | [] | no_license | #include "Sorting.h"
namespace Algorithms
{
template<typename T>
void Sorting::BubbleSort(std::vector<T> & array)
{
// Set the flag to true for the first pass
bool continueSorting = true;
for (int i = 0; i < array.size() && continueSorting; i++)
{
// If there is no swaps on this iteration,... | true |
733ceb0f76861ff6bec4303576ed1cdb48bfeeda | C++ | Arvinhahaha/C | /[二叉树]FBI树2.cpp | GB18030 | 1,479 | 3.296875 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int cnt;
typedef struct TreeNode {
char s[1025];
struct TreeNode* left;
struct TreeNode* right;
}*BinTree;
BinTree CreateTree(char* s1)
{
char p[513], q[513];
BinTree root = (BinTree)malloc(sizeof(struct TreeNode));
strcp... | true |
695d64e79b4390696433a5deef676059a79a2417 | C++ | housewithinahouse/Build-A-Bot | /Lines/Followy/Followy.ino | UTF-8 | 4,067 | 3.453125 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | /*
* This is a very simple line following robot.
* The only feature is that it rams up its speed
* if it doesn't see a line.
*
* Edwin Fallwell, MCPL 3/25/18
*/
// We've attached a daughter board to our Feather. This additional board.
// also known as a Wing, or a Shield if we were using an Arduino, ne... | true |
a7aadf883f0dd6a913d28a736b150d1ed93a20e2 | C++ | anroysko/contestlib | /src/datastruct/convhull/sqrt_hull/main.cpp | UTF-8 | 687 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
#include "code.cpp"
void solve() {
int n, q;
cin >> n >> q;
vector<Line> lines(n);
for (auto& pr : lines) cin >> pr.a >> pr.b;
SqrtHull hull(lines);
for (int qi = 0; qi < q; ++qi) {
string op;
cin >> op;
... | true |
9e249952b1f38c33b5a53fd350fbfd5af1ac1517 | C++ | bobstine/lang_C | /oldC/mgs/ranges/range_ops.h | UTF-8 | 9,855 | 2.890625 | 3 | [] | no_license | // $Id: range_ops.h,v 1.2 2002/06/17 14:35:09 bob Exp $ -*- c++ -*-
/*
15 Mar 02 ... Created to hold the un-localized functions of ranges.
*/
#ifndef _RANGE_OPS_H_
#define _RANGE_OPS_H_
#ifdef __APPLE__
#include "patch_iterator.h"
#endif
#include "range_traits.h"
#include <iostream>
///////////////////////////... | true |
d6a9734815e98a14d0c395eb663179e5db3d1e6a | C++ | cailun01/leetcode | /solutions/leetcode_36_solution_2.cc | UTF-8 | 3,188 | 3.609375 | 4 | [] | no_license | #include "headers.h"
/* 36 有效的数独
请你判断一个 9x9 的数独是否有效。只需要 根据以下规则 ,验证已经填入的数字是否有效即可。
数字 1-9 在每一行只能出现一次。
数字 1-9 在每一列只能出现一次。
数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。(请参考示例图)
数独部分空格内已填入了数字,空白格用 '.' 表示。
注意:
一个有效的数独(部分已被填充)不一定是可解的。
只需要根据以上规则,验证已经填入的数字是否有效即可。
示例1:
输入:board =
[["5","3",".",".","7",".",".",".","."]
,["6",".",".","1",... | true |
846b5150e7b6a4c0594d8f133f5389ccd8239707 | C++ | willcassella/RealTournament | /RealTournament/include/RealTournament/SpawnPad.h | UTF-8 | 1,313 | 2.859375 | 3 | [
"MIT"
] | permissive | // SpawnPad.h - Copyright 2013-2016 Will Cassella, All Rights Reserved
#pragma once
#include <Core/Reflection/SubClassOf.h>
#include <Engine/Entity.h>
namespace real_tournament
{
using namespace willow;
class SpawnPad final : public Entity
{
///////////////////////
/// Information ///
public:
REFLECTA... | true |
982217fcd5577b4c0ceac3c1fc98de642e01abcb | C++ | hogansung/leetcode | /cplusplus/p503.cpp | UTF-8 | 527 | 2.8125 | 3 | [] | no_license | class Solution {
public:
vector<int> nextGreaterElements(vector<int>& nums) {
int n = nums.size();
vector<int> ret(n, -1);
stack<pair<int,int>> st;
for (int i = 0; i < 2 * n; i++) {
while (st.size() and st.top().first < nums[i%n]) {
auto p = st.to... | true |
7dbe29ce9c3ecbfc108e96bfb823bc5e50367764 | C++ | terngkub/computor_v2 | /test/evaluator_test.cpp | UTF-8 | 13,324 | 2.828125 | 3 | [] | no_license | #include <boost/test/unit_test.hpp>
#include "ast.hpp"
#include "evaluator.hpp"
#include "parser.hpp"
BOOST_AUTO_TEST_SUITE(ts_evaluator)
std::string get_result(std::vector<std::string> v)
{
computorv2::evaluator evaluate;
std::string result_str;
for (auto & str : v)
{
std::transform(str.begi... | true |
d17be12a242b41fc940086a41f33559f181e5c2c | C++ | sygh-JP/FbxModelViewer | /SharedUtility/MyUtils/MyMathConsts.hpp | UTF-8 | 2,251 | 2.5625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "MyMathTypes.hpp"
namespace MyMath
{
const float F_PI = 3.14159265358979323846f;
const double D_PI = 3.14159265358979323846;
const float F_2PI = 2.0f * F_PI;
const double D_2PI = 2.0 * D_PI;
const float F_PIDIV2 = 0.5f * F_PI;
const double D_PIDIV2 = 0.5 * D_PI;
const... | true |
208efb94a04b26a7a72514408f04cdf5ce39e3ab | C++ | Tommy0603/HW5 | /6.33/source/Main.cpp | UTF-8 | 939 | 3.65625 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#define SIZE 100
int binarySearch(int key, int* a, int right, int left);
int main(void)
{
int a[SIZE] ;
int right = SIZE;
int left = 1;
int x;
int key;
int element;
for (x = 0; x < SIZE; x++)
{
a[x] = 2 * x;
}
printf("Enter integer search key:\n");
scanf_s("%d", ... | true |
0eb173e8920c5e43a07f5b118a85ad23180921c4 | C++ | MArsalanKhan/CNavSystem3 | /CWaypoint.cpp | UTF-8 | 3,889 | 3.515625 | 4 | [] | no_license | /*
* CWaypoint.cpp
*
* Created on: 7.11.2015
* Author: Arsalan
*/
#include "cWaypoint.h"
#include <iostream>
using namespace std;
#include<math.h>
/* Implementation of the Constructor of CWaypoint & printing addresses of Object and attributes*/
cWaypoint::cWaypoint(string name,double lat... | true |
03cd193af77dc88daec0911fb86e8378a016a86b | C++ | faxinwang/OJ_PAT | /C4_GPLT/L1_10.cpp | UTF-8 | 351 | 2.78125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int min(int a,int b,int c){
return a<b?(a<c?a:c):(b<c?b:c);
}
int max(int a,int b,int c){
return a>b?(a>c?a:c):(b>c?b:c);
}
int main(){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
int min_=min(a,b,c);
int max_=max(a,b,c);
int mid_=(a+b+c)-(max_+min_);
printf("%d->%d->%d\n",min... | true |
a464f263076cae7e7bab366dc2a809194ff827f1 | C++ | manosgior/A-plus-plus-Programming-Language | /function_actions.cpp | UTF-8 | 43,110 | 2.65625 | 3 | [] | no_license | #include "function_actions.h"
#include "defines_header.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define BON "\e[1m"
#define BOFF "\e[0m"
Object* Manage_stmt_default() {
Object* tmp = new Object();
tmp->set(AST_TAG_TYPE_KEY, Value(AST_TAG_STMT));
tmp->set(AST_TAG_SUBTYPE_KEY, Value(AST... | true |
9fc46cf07ea36f5ecdae7181157987108572edc1 | C++ | Minakshi-probuz/cPlusPlus | /pract41.cpp | UTF-8 | 373 | 2.765625 | 3 | [] | no_license | /*
A
B B
C C C
*/
#include<iostream>
using namespace std;
int main(){
char ch='A';
//int space=3;
for(int i=1;i<=3;i++){
for (int j = 3; j >=i; j--)
{
cout<<" ";
}
for(int k=1;k<=i;k++){
cout<<ch<<" ";
}cout... | true |
d8639b21c58d45a7017162f31c2956a523d72854 | C++ | yingziyu-llt/OI | /c/vjudge/DP/数位DP/hud 2089_DFS.cpp | UTF-8 | 910 | 2.609375 | 3 | [] | no_license | #include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int len;
int dight[9];
int make_dight(int n)
{
len = 1;
memset(dight,0,sizeof(dight));
while(n)
{
dight[len] = n % 10;
n /= 10;
len++;
}
len--;
return len;
}
long long f[9][10];
int dfs(int dep,bool limit,bool... | true |
0c87a990b90eb3c3545b362d591bc3ad2e036743 | C++ | ashbob999/Advent-of-Code | /cpp/2020/day08.cpp | UTF-8 | 2,540 | 3.09375 | 3 | [] | no_license | #include "../aocHelper.h"
enum class instruction_type : int
{
nop = 0,
jmp = 1,
acc = 2
};
enum class stopped_type : int
{
infinte_loop = 0,
out_of_bounds = 1
};
struct VM
{
vector<pair<instruction_type, int>> instructions;
int accumulator = 0;
int pc = 0;
int* seen;
int swap_index = -... | true |
56bf51d3c608dfc7907f6e59192130da5776188a | C++ | jmaack24/VortexSim | /src/SphereFlow.cpp | UTF-8 | 1,970 | 2.796875 | 3 | [] | no_license | /*******************************************************************************
* \class SphereFlow
*
* \brief Computes the flow field for point vortices on the unit sphere --
* explicitly assumes 3D
*
* Author: Jonathan Maack
*
******************************************************************************/
#... | true |
1bec4fb126201e475af4db50f424f493c5b4d50a | C++ | bajaj99prashant/algorithms-implementation | /data-structures/linked-list/linkedlist.cpp | UTF-8 | 2,619 | 4.09375 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct Node {
int data;
Node* link;
};
Node* head;// global variable that can be accessed anywhere
// inserting a node at the end
void insertEnd(int x){
Node* temp = new Node();
temp->data = x;
temp->link = NULL;
Node* temp1 = head;// when we declare temp1 like this it ... | true |
cbca36be206e7b6ae05e276394ce4e96de108d0a | C++ | 11AbhijithROY/IPMP | /week2/Array_Prob2.cpp | UTF-8 | 553 | 3.421875 | 3 | [] | no_license | //Hashing method
int getOddOccurrence(int arr[], int n) {
// code here
unordered_map<int, int> umap;
for(int i = 0;i < n;i++) {
umap[arr[i]]++;
}
for(auto i : umap) {
if(i.second%2 != 0) {
return i.first;
}
}
... | true |
2fe33d62df98a54b0279f9b888e41363dd65a0f7 | C++ | GUDHI/gudhi-devel | /src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h | UTF-8 | 2,805 | 2.5625 | 3 | [
"MIT"
] | permissive | /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
* Author(s): Siargey Kachanovich
*
* Copyright (C) 2019 Inria
*
* Modification(s):
* - YYYY/MM Autho... | true |
1bd76d560fb76f7459c88aebcfe13aac0402b3cb | C++ | mashai/CaanooPlatformer | /Source/CDieOffscreenComponent.h | UTF-8 | 691 | 2.59375 | 3 | [] | no_license | #ifndef CDIE_OFFSCREEN_COMPONENT_H
#define CDIE_OFFSCREEN_COMPONENT_H
#include "CComponent.h"
#include "CKillComponent.h"
#include "CPositionComponent.h"
class CDieOffscreenComponent : public CComponent{
public:
//Constructor
CDieOffscreenComponent();
//Destructor
~CDieOffscreenC... | true |
14923359c59a7b358bc05c06ea2e1bd575e35f15 | C++ | Shyguy226/csci13600-labs | /lab_11/funcs.cpp | UTF-8 | 1,181 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <locale>
using std::string;
void printRange(int left, int right){
if(left > right)
std::cout << std::endl;
else{
std::cout << left << " ";
printRange(left+1, right);
}
return;
}
int sumRange(int left, int right){
... | true |
325b04ec17e2820659a5774a794ef2b0285f140b | C++ | d0iasm/aoj-libraries | /DSL/range-query/range_minimum_query.cpp | UTF-8 | 1,163 | 3.109375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n, q;
class RangeMinimumQuery {
private:
int* tree;
public:
int size;
RangeMinimumQuery(int n) {
size = 1; while(size < n) size *= 2;
tree = new int[2*size - 1];
for (int i=0; i < 2*size - 1; i++) tree[i] = INT_MAX;
}
void update(int i, int x);
... | true |
ed5d4f8ef5e52f4a8911ca8eb40e98f2883d54cd | C++ | vsroy/Data-Structures-and-Algorithms | /Cumulative Problems/Parenthesis_Checker_Using_Stack.cpp | WINDOWS-1252 | 1,008 | 4.40625 | 4 | [] | no_license | /*Given an expression string exp. Examine whether the pairs and the orders of {,},(,),[,] are correct in exp.*/
#include<iostream>
#include<string>
#include<stack>
using namespace std;
bool CheckBalancedParenthesis(string& str)
{
stack<char> parenthesisStack;
for (int i = 0; i < str.size(); i++)
{
if (str[i] == '... | true |
dc414beb1c347c34e013135f1474f0f2d1cc0ec1 | C++ | nanlan2017/lang-cpp | /TemplateLang/haskell_to_cpp.h | GB18030 | 5,841 | 3.4375 | 3 | [] | no_license | #ifndef h_haskell2cpp
#define h_haskell2cpp
#include "prelude.h"
/* [Haskell]
type Uri = String
type LocalName = String
type NameClass = AnyName
| QName Uri LocalName
| NsName Uri
| NameClassChoice NameClass NameClass
*/
/*
In C++, the variants of NameClass are not connect... | true |
7ead0f6351f8c106c71237b38b5808a4f65d9df3 | C++ | descrip/competitive-programming | /ccc/sol/2006/s5.cpp | UTF-8 | 2,493 | 2.515625 | 3 | [] | no_license | /* Was stuck on this question for a while, got this great hash table idea.
* But my idea it still times out. So I went and looked at the mmhs solution.
* Apparently they looped to an arbitrary number of 50, and if they couldn't find it, they just printed -1.
* So I'm going to put this question off for a while.
*/
... | true |
40b8ad199a6caf102d64be1c7f0f91f817bf4a85 | C++ | erosnick/TheRayTracerChallenge | /TheRayTracerChallenge/utils.h | UTF-8 | 686 | 2.640625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <random>
inline float Q_rsqrt(float number) {
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = *(long*)&y; // evil floating point bit level hacking
i = 0x5f3759df - (i >> 1); // what the fuck?... | true |
b2ef5124639aac58892b1fa2be77b33a6ab4f0b1 | C++ | novostary/codes | /LeetCode/String/implement-strstr.cpp | UTF-8 | 486 | 2.953125 | 3 | [] | no_license | #include <string>
using std::string;
// Runtime: 8 ms
// Best: 4 ms
// https://leetcode.com/discuss/38998/explained-4ms-easy-c-solution KMP
class Solution {
public:
int strStr(string haystack, string needle) {
int size1 = haystack.size(), size2 = needle.size();
for (int i = 0; i < size1 - size2 + 1; i++) {
int ... | true |
68cc8dc2bd9b44579b7c07025067f340ef07e692 | C++ | moonseokchoi-kr/CupheadCloneGame | /Client/CUI.h | UHC | 1,533 | 2.625 | 3 | [] | no_license | #pragma once
#include "CObject.h"
class CUI :
public CObject
{
public:
CUI(bool _cameraAffeted);
CUI(const CUI& _origin);
~CUI();
public:
// CObject() ӵ
virtual void Update() override;
virtual void Render(HDC _dc);
virtual void FinalUpdate();
virtual void MouseOn();
virtual vo... | true |
24985466a19a931c5a4c15234b4df73949df54ca | C++ | khbence/COVIDAgentModel | /src/agentData/globalStates.cpp | UTF-8 | 874 | 2.546875 | 3 | [] | no_license | #include "globalStates.h"
#include "customExceptions.h"
namespace states {
__host__ __device__ SIRD& operator++(SIRD& e) {
return e = static_cast<SIRD>(static_cast<int>(e) + 1);
}
[[nodiscard]] states::WBStates parseWBState(const std::string& rawState) {
if (rawState.length() != 1) { throw... | true |
e0ee326e9a0b54de6a84c06f6534fa5d93c431ef | C++ | gergelyn/Prog1 | /labdaifnelkul.cpp | UTF-8 | 821 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <ncurses.h>
#include <unistd.h>
#include <curses.h>
using namespace std;
int main()
{
int xj = 0, xk = 0, yj = 0, yk = 0;
int mx = 80 * 2, my = 24 * 2;
WINDOW *myScreen;
myScreen = initscr();
noecho();
cbreak();
nodelay(myScreen, true);
f... | true |
2d9327ae843e928745f1c53fdd280c922be8fd40 | C++ | 3013216006/ACM | /17-7-27/test.cpp | UTF-8 | 239 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
#include <iostream>
using namespace std;
vector<int> v;
int main(){
for(int i=0;i<10;i++)
v.push_back(i);
for(int i=0;i<=10;i++){
cout << lower_bound(v.begin(),v.end(),i)-v.begin() << endl;
}
}
| true |
9c42837861495c64e953d31e41ef94eaf7ce4091 | C++ | Tuuby/AMSDogBot | /PioneerBV/SharedMemory/Shared_Memory.h | ISO-8859-1 | 805 | 2.796875 | 3 | [] | no_license | #ifndef _SHARED_MEMORY_H
#define _SHARED_MEMORY_H
#include "windows.h"
#include <string>
#include <iostream>
using namespace std;
class Shared_Memory
{
public:
//(De-)Konstruktor
Shared_Memory();
~Shared_Memory();
//Initialisierungsfunktion fr den Speicher
void SM_Init();
//Entladen des Speichers
void SM... | true |
98a20a137788ee7642d198b99fb7fc626d9dc3df | C++ | Karaokruk/sia_td3 | /src/mesh.cpp | UTF-8 | 9,686 | 2.515625 | 3 | [] | no_license | #include "mesh.h"
#include "bvh.h"
#include "shader.h"
#include <cstdio>
#include <fstream>
#include <iostream>
#include <sstream>
#include <pmp/SurfaceNormals.h>
using namespace std;
using namespace Eigen;
using namespace pmp;
Mesh::~Mesh() {
if (_ready) {
glDeleteBuffers(7, _vbo);
glDeleteVertexArrays(1... | true |
9b64bd98493164e8d43d115c76e9b58c934b781c | C++ | Ali-Omrani/Advanced-Programming | /Assignment5/pair.h | UTF-8 | 286 | 2.6875 | 3 | [] | no_license | #ifndef _PAIR_
#define _PAIR_
#include <iostream>
class Pair
{
public:
Pair(const double _x,const double _y);
double get_x() const;
double get_y() const;
void set_y (const double _y);
double& get_y_refrence();
void print_pair() const;
private:
double x;
double y;
};
#endif | true |
07ee42dfe135b5ccedc001366dd82327391e4c9b | C++ | Mohamed-Eid/ProblemSolving--Arabic | /Material/3.cpp | UTF-8 | 709 | 2.875 | 3 | [] | no_license |
///3- Preprocessing: Prefix(cumulative) sum.
A = 2 5 5 3 5 2
Query: O(N)
- What is the sum of elements in A[0:4]
- What is the sum of elements in A[2:5]
- How many times did 5 appear in A[1:3]
0 1 2 3 4 5
A = 2 5 5 3 5 2
prefix_sum = 2 7 12 15 20 22
... | true |
84f11b57732cb538ef85b36ec9b4bb7a7f041e96 | C++ | gonglixue/RangeScanLine | /RangeScanOO/ActiveEdge.cpp | UTF-8 | 5,498 | 2.546875 | 3 | [] | no_license | #include "ActiveEdge.h"
ActiveEdge::ActiveEdge(Edge* e1, Edge* e2)
{
// 初始时与两条边交于一点,e1与e2应有共同的上端点 NOOOO!
//if (abs(e1->x_ - e2->x_) < 0.0001)
//{
// printf("ActiveEdge::ActiveEdge: two edges should have the same up end point.\n");
// exit(1);
//}
// 如果两边有相同的上端点,扫描线每向下处理一个单位,e1x的增量小于d2x,e1为左,增量小的为左
if (fabs(e... | true |
7592a20f5561f78435c3b694af18670bee2de3eb | C++ | dheerajkhatri/bajinga | /interviewbit/makeTree.cpp | UTF-8 | 1,045 | 3.265625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
TreeNode* getNode(int val){
TreeNode *newnode = new TreeNode(val);
newnode->left = NULL;
newnode->right = NULL;
return newnode;
}
void inorder(T... | true |
8eb68e8f410a5014ba07c8a614cf35182ef5d494 | C++ | adinosaur/minihttpd | /include/Base/Logger.cc | UTF-8 | 1,809 | 2.984375 | 3 | [] | no_license | #include "Logger.h"
#include <assert.h>
#include <pthread.h>
#include <string>
using namespace std;
// 日志分隔符
char Logger::seperator = '|';
// 日志记录级别
int Logger::_curruct_level = TRACE;
// 日志输出文件
ostream& Logger::_output(cerr);
// instance数组
vector<Logger*> Logger::_instances(LEVEL_SIZE, nullptr);
// 阻塞队列
Blocking... | true |
ad63b832f5768c9aa6888d0cb9d00c5fc931a0ad | C++ | antoniospoletojr/Image-Processing | /Isodata/main.cpp | UTF-8 | 6,658 | 3.015625 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <vector>
#include <numeric>
#include <math.h>
#include <opencv2/opencv.hpp>
#include <stdlib.h>
#include <time.h>
using namespace cv;
using namespace std;
#define K 3 //numero di cluster iniziali
#define VAR_THRESHOLD 1000 //se aumenta, diminiuisce il num... | true |
40475c2ccb019072a50cd4d5ca4964e1ce37b359 | C++ | jrsala/Peano | /NegativeNumber.hpp | UTF-8 | 1,042 | 2.9375 | 3 | [] | no_license | #ifndef NEGATIVENUMBER_H
#define NEGATIVENUMBER_H
#include "Add.hpp"
#include "Mul.hpp"
/**
* Minus
*/
template<typename A>
struct Minus_
{
static constexpr int value = -A::value;
typedef Minus_<A> result;
};
template<>
struct Minus_<Zero>
{
typedef Zero result;
};
template... | true |
2450a4a900a40cf54c08c72e3ee1011b36e3ab39 | C++ | xvallspl/Examples-Books-and-Exercises | /Books/CrackingtCI/Ch8-Recursion/02.numberPaths.cpp | UTF-8 | 1,203 | 3.53125 | 4 | [] | no_license | /*Imagine a robot sitting on the upper left hand corner of an NxN grid.
The robot can only move in two directions: right and down How many possible
paths are there for the robot?
FOLLOW UP
Imagine certain squares are “off limits”, such that the robot can not step on
them Design an algorithm to get all possible paths ... | true |
4f5fbad5636d9edaad2e0b837715786ec262cd72 | C++ | fulviocrivellaro/cpp-2048-ai | /2048.Core/MilGrid.cpp | UTF-8 | 3,476 | 3.03125 | 3 | [] | no_license | #include "MilGrid.h"
#include "TileLineIterator.h"
#include <time.h>
#include <cstdlib>
#include <math.h>
namespace MilCore
{
MilGrid::MilGrid()
{
srand((unsigned int)time(NULL));
resetGrid();
}
void MilGrid::resetGrid()
{
for (tilePtr r = 0; r < SIZE; ++r)
{
for (tilePtr c = 0; c < ... | true |
248ac462e3b8e37f4f26c162aca8befbcb87e523 | C++ | Txusheng/OpenCVFrame | /OpenCVFrame/MyAlgorithms.cpp | UTF-8 | 335 | 2.828125 | 3 | [] | no_license | #include "MyAlgorithms.h"
float CalChiSquareDis(vector<float> vA, vector<float> vB)
{
float sum = 0;
if (vA.size() != vB.size())
{
return -1;
}
for (int i = 0; i < vA.size(); i++)
{
if (vA[i] == 0 && vB[i] == 0)
{
continue;
}
else
{
sum += powf(vA[i] - vB[i], 2) / (vA[i] + vB[i]);
}
}
ret... | true |
72bb9fe88ef621bce06af961f715f67840df2d78 | C++ | eala/leetcode | /test/test/testSolution.cpp | UTF-8 | 2,060 | 2.6875 | 3 | [] | no_license | #include <vector>
#include "solution.h"
#include "testSolution.h"
#include "LeetcodeConfig.h"
//using ::testing::Return;
using namespace std;
SolTest::SolTest() {
/*
// Have qux return true by default
ON_CALL(m_bar,qux()).WillByDefault(Return(true));
// Have norf return false by default
ON_CALL(m_... | true |
620218036163338d52c6c6c95e08473f080878b0 | C++ | shreyarandive/game-combat-simulation | /PatrolBoat.h | UTF-8 | 448 | 2.515625 | 3 | [] | no_license | //
// PatrolBoat.h
// CombatSimulation
//
// Copyright © 2019 Shreya Randive. All rights reserved.
//
class PatrolBoat : public Ships
{
int health = 100;
static const int damage = 50;
//const int attack_range = 1;
public:
int getHealth() { return health;}
int getDamage() { return damag... | true |
0c8a7a2d94ecad6fcb62864f23d1cd4d4ca40246 | C++ | hongwei7/netpro | /epoll.h | UTF-8 | 1,813 | 2.546875 | 3 | [] | no_license | #ifndef __NETPRO__EPOLL__H
#define __NETPRO__EPOLL__H
#include <sys/epoll.h>
#include <assert.h>
#include <string.h>
#include <memory>
#include "dbg.h"
#include "noncopyable.h"
#include "threadPool.h"
#include "tcpconn.h"
const int EPOLL_INIT_SIZE = 5;
const int MAX_CLIENTS = 60000;
class epoll : public noncopyable ... | true |
d3e15a4d642e9382301c08b83e5fd72a797481ee | C++ | trmrsh/cpp-ultracam | /src/plot.cc | UTF-8 | 30,674 | 2.75 | 3 | [] | no_license | /*
!!begin
!!title Plots an ultracam file
!!author T.R. Marsh
!!created 20 April 2001
!!revised 06 July 2007
!!root plot
!!index plot
!!descr plots an Ultracam data frame
!!css style.css
!!class Programs
!!class Display
!!head1 plot - displays an ultracam image
!!emph{plot} provides some basic dis... | true |
18d3ef3fe267a9df9ff748ca8ffcc3c838d1e4c9 | C++ | keleron/2DSPP | /code/rect.cpp | UTF-8 | 577 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include "extras.h"
#include <vector>
#include <string>
Rect::Rect(int idd, int ww, int hh)
{
id = idd;
w = ww;
h = hh;
}
void Rect::rotate(){
if (rot == false){
right.x = left.x + h;
right.y = left.y + w;
} else {
right.x = left.x ... | true |
6a4e47f8bac9f1b798fa557fba0f2ac5f9b0136a | C++ | bss9395/bss9395.github.io | /_en/Computer/Tools/Pointer_Inline.cpp | UTF-8 | 4,644 | 3.0625 | 3 | [] | no_license | /* Pointer_Inline.cpp
Author: BSS9395
Update: 2023-05-25T16:02:00+08@China-China-Guangdong-Zhanjiang+08
Design: Pointer Inline
*/
#include <iostream>
#include <string>
using namespace std;
//////////////////////////////////////////////////////////////////////////////
#define _Delete(pointer) (delete pointer, pointer... | true |
f943ab588df414aa7f4103251ecdd0b3d8b33962 | C++ | innocentboy/myrepository | /src/codee/tc/dp/SRM468_DV1_L2.cpp | UTF-8 | 2,402 | 3.125 | 3 | [] | no_license | /**
http://community.topcoder.com/stat?c=problem_statement&pm=10765&rd=14183
SOL:
http://apps.topcoder.com/wiki/display/tc/SRM+468
*/
/**
INPUT:
//
3
4 6 8
1 7 4
1
//
3
4 6 8
1 11 4
1
//
3
4 6 8
1 11 4
2
OUTPUT:
//
12
//
//
14
//
//
11
//
14
122365
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#incl... | true |
676564f12ba1310b104d0ff826fd52050e552151 | C++ | prajneya/IOI | /ioi-training-master/Code Chef/Number of Factors.cpp | UTF-8 | 877 | 2.6875 | 3 | [] | no_license | /*
Created By: Malvika Joshi
Problem: NUMFACT
Link: http://www.codechef.com/problems/NUMFACT
*/
#include <stdio.h>
#include <string.h>
#define MAXL 1000000
#define MAXP 80000
#define MAXN 10
bool fac[MAXL];
int primes[MAXP];
short count[MAXP];
int P,N;
int init(){
int i,j;
for(i = 2; i*i < MAXL; i++){
if(f... | true |
4002e77d2e44fc177a7a89815232b6ac951be3bf | C++ | HenningEggertz/Arduino | /Mats/matstest.ino | UTF-8 | 2,663 | 2.671875 | 3 | [] | no_license | unsigned char cmd[9],checksumma;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
cmd[0] = 1; // adress i sändpaketet läggs i cmd[0]
cmd[1] = 3; //kommando -"- cmd[1]
cmd[2] = 0; ... | true |
7b0a2b9aae51a79b3cddbbe5820060cc28df76a0 | C++ | akhtamov/PMT | /OOP/container.h | UTF-8 | 643 | 2.59375 | 3 | [] | no_license |
#include <fstream>
#include <iostream>
#include <string>
#include "shape.h"
using namespace std;
class List
{
public:
Shape* shape;
//Rectangle * rectangle;
//Circle * circle;
// Triangle * triangle;
List* prev;
List* next;
static List* initialization();
static List* addElement(Lis... | true |
e7a04b1d55bdbf69b2e1a8fabcaec56c59dcbde7 | C++ | DanielWhite94/Tremor | /engine/src/udppacket.h | UTF-8 | 695 | 2.640625 | 3 | [] | no_license | #ifndef TREMORENGINE_UDPPACKET_H
#define TREMORENGINE_UDPPACKET_H
#include <cstdint>
#include <SDL2/SDL.h>
#include <SDL2/SDL_net.h>
namespace TremorEngine {
class UdpPacket {
public:
struct PlayerEntry {
float x, y, z, yaw;
};
UdpPacket();
UdpPacket(uint32_t id);
~UdpPacket();
bool initFromRecvD... | true |
6342c26f00c80cf3f21f15361614d5566b84185f | C++ | xuhw16/master_coder | /sort_algorithm.cpp | UTF-8 | 4,450 | 3.484375 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
/*
input: n //size of sorted numbers
[x1,x2,x3..xn]//vector to be sort
sort algorithm:
bubble sort: o(n^2),stable sort.
insert sort: o(n^2),stable sort.
merge sort:o(nlog(n)),table sort.(not in place)
heap sort:o(nlog(n)),distable sort. (in place)
quick_sort:o(n... | true |
fb407c76ff821518c5731a6f58a2cb303462e38d | C++ | chrisoldwood/COM | /ClassFactory.hpp | UTF-8 | 1,154 | 2.515625 | 3 | [
"MIT"
] | permissive | ////////////////////////////////////////////////////////////////////////////////
//! \file ClassFactory.hpp
//! \brief The ClassFactory class declaration.
//! \author Chris Oldwood
// Check for previous inclusion
#ifndef COM_CLASSFACTORY_HPP
#define COM_CLASSFACTORY_HPP
#if _MSC_VER > 1000
#pragma once
#endif
nam... | true |
e75339e4cdd74b4dbe1ec63b0bd17791672efd24 | C++ | WinstonLy/Job | /TestProject/data_structure/List/List.cpp | UTF-8 | 1,828 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include "List.h"
#include "Coordinate.h"
using namespace std;
CList::CList(int size)
{
m_iSize = size;
m_pList = new Coordinate[m_iSize];
m_iLength = 0;
}
CList::~CList()
{
delete []m_pList;
m_pList = NULL;
}
void CList::ClearList()
{
m_iLength = 0;
}
bool CList::ListEmpty()
{
if(0 == ... | true |
d66b6c91bdcca20dc3e672612f10cbfcf77274b8 | C++ | meijieman/CPPHub | /aurora/alpha/CCar.cpp | UTF-8 | 628 | 3.265625 | 3 | [] | no_license | //
// Created by Administrator on 2019/2/11.
//
#include <iostream>
using namespace std;
// 轮胎
class CTyre {
private:
int radius;
int width;
public:
CTyre(){}
CTyre(int r, int w) : radius(r), width(w) {}
};
class CEngine {
};
class CCar {
private:
int price;
CTyre tyre;
CEngine engin... | true |
f20ffa388f83515d0aec88f05ab8a22959495ba3 | C++ | AmiraNoaman/DataStructure_RestaurantSimulation | /Restaurant/Rest/Order.h | UTF-8 | 1,451 | 3.09375 | 3 | [] | no_license | #ifndef __ORDER_H_
#define __ORDER_H_
#include "..\Defs.h"
#include <cmath>
class Order
{
protected:
int ID; //Each order has a unique ID (from 1 --> 999 )
ORD_TYPE type; //order type: Normal, Frozen, VIP
REGION Region; //Region of this order
int Distance; //The distance (in meters) between the order lo... | true |
5a7a57b0fba22431c52e7f4ee92d60b386e423fa | C++ | weilaidb/qtexample | /map_key_is_arrayORstruct/main2.cpp | GB18030 | 4,738 | 3.890625 | 4 | [] | no_license | ///******************************************************************
// mapĻ
// C++ Mapsһֹʽؼ/ֵ
// begin() ָmapͷĵ
// clear( ɾԪ
// count() ָԪسֵĴ
// empty() mapΪtrue
// end() ָmapĩβĵ
// equal_range() Ŀĵ
// erase() ɾһԪ... | true |
912733b4da1d61f6573a4a9bdb557566ee143143 | C++ | stone725/CompetitiveProgramming | /AtCoder/joi2006yo/joi2006yo_b.cpp | UTF-8 | 535 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <map>
using namespace std;
int main()
{
int n;
cin >> n;
map<char, char> change;
for (int i = 0; i < n; i++)
{
char from, to;
cin >> from >> to;
change[from] = to;
}
int m;
cin >> m;
for (int i = 0; i < m; i++)
... | true |
2dacfcf5a38853772b58150ff5ee4e2d83e6c525 | C++ | SecurityExceptionGames/SEGlibCPP2019w | /SEGlibCPP/SEGlibCPP/Headers/org/segames/library/io/file_attributes.h | UTF-8 | 3,424 | 3.15625 | 3 | [] | no_license | #pragma once
#include <org/segames/library/util/array_list.h>
#ifndef SEG_API_SYSTEM_DIR_SEPARATOR
#ifdef _WIN32
#define SEG_API_SYSTEM_DIR_SEPARATOR_CHAR '\\'
#define SEG_API_SYSTEM_DIR_SEPARATOR "\\"
#else
#define SEG_API_SYSTEM_DIR_SEPARATOR_CHAR '/'
#define SEG_API_SYSTEM_DIR_SEPARATOR "/"
#endif
#endif
namespace... | true |
d189f1080cb38ba4f6940866dd876fc69b1764df | C++ | acsm66/catninja | /Ninja.h | UTF-8 | 549 | 2.546875 | 3 | [] | no_license | #pragma once
#include "stdafx.h"
#include "SpriteSheet.h"
class Ninja {
public:
enum Direction { DIR_NONE, DIR_RIGHT, DIR_LEFT };
Ninja(int maxSpeed, int maxPaceLevel, int xSize);
void init(SDL_Renderer *renderer, int initX, int initY);
void setDirection(Direction dir);
void refresh();
private:
void calcula... | true |
9a1f1b5b418be1172c83828276408fc807badc19 | C++ | ibestvina/reAligner | /reAligner/FragmentReader.h | UTF-8 | 2,281 | 3.28125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iostream>
#include <istream>
#include <string>
#include <fstream>
#include <list>
#include <map>
#include "FileReader.h"
class FragmentReader :
public FileReader
{
std::istream &inStream;
std::map<int, Fragment*> fragments;
std::map<std::string, int> stringIDtoID;
public:
FragmentReader... | true |
dfbc9cb46b4cefe774bc5e65a34e9bfbb92709cc | C++ | okiochan/coding-help | /OTHER/cтруктуры/lca_and_jump.cpp | UTF-8 | 1,081 | 2.640625 | 3 | [] | no_license |
int up[N][L], tin[N], tout[N], len[N];
int timer, l;
void dfs(int v, int p)
{
tin[v] = timer++;
up[v][0] = p;
len[v] = len[p] + 1;
for(int i=1; i<=l; i++)
{
int pr = up[v][i-1];
up[v][i] = up[pr][i-1];
}
for(int i=0; i<g[v].size(); i++)
{
int to = g[v][i];
if(to != p)
dfs(to,v);
}
tout[v] = t... | true |
f97a7aeaf819fd6a2b1ab0f18ac54c5bbc6f8f80 | C++ | itsanshulverma/du-cs-undergrad-course | /Semester2/DiscreteStructures/Practicals/02-set2/main.cpp | UTF-8 | 4,036 | 3.859375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Set
{
public:
int elements[100];
int size = 0;
Set();
void input();
void print();
bool subset_of(Set);
Set union_with(Set);
Set intersection_with(Set);
Set complement(Set);
Set difference(Set);
Set difference_sym(Set);
voi... | true |
dc83bcd15010aefe9461edfb282df98917af3e80 | C++ | colinw7/CSVG | /include/CSVGClip.h | UTF-8 | 871 | 2.703125 | 3 | [
"MIT"
] | permissive | #ifndef CSVGClip_H
#define CSVGClip_H
#include <CSVGInheritVal.h>
#include <COptVal.h>
#include <CFillType.h>
class CSVG;
class CSVGClip {
public:
using FillType = CSVGInheritValT<CFillType>;
public:
CSVGClip(CSVG &svg) :
svg_(svg), rule_() {
}
CSVGClip(const CSVGClip &clip) :
svg_(clip.svg_), rule... | true |
41da1c8a7e4f537369bb8678bf2c6e53f8e7842b | C++ | AnthonyDas/HackerRank | /HackerRank/Problem Solving/Data Structures/Queues/Castle on the Grid.cpp | UTF-8 | 2,138 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <utility> // std::make_pair
#include <unordered_set>
// #include <functional> // std::hash
int key(const std::pair<int, int> &pt) {
// return std::hash<int>()(x) ^ std::hash<int>()(y);
return (pt.first * 100) + pt.second; // Max n = 1... | true |
9aa5a0c988484fc06b7143ffea15af8c93278ad9 | C++ | JqkerN/Artificial-Intelligence-dd2380 | /A2_duckhunt_hmm/HMM1/printVector.cpp | UTF-8 | 403 | 3.125 | 3 | [] | no_license | # include "printVector.hpp"
using namespace std;
void print_float_vector(vector<float> A)
{
int idx = 2;
for (int r = 0; r < A[0]; r++) {
for (int c = 0; c < A[1]; c++) {
cout << A[idx++] << ' ';
}
cout << endl;
}
cout << " " << endl;
}
void print_sequence(vector<float> A)
{
for (int r = 0; r <... | true |
297c3949b0586c04d1ecf4cad828dcb6df3bcbcc | C++ | AfrikyanA/Homeworks | /10daysOfSuffering/Lesson6/ex1.cpp | UTF-8 | 207 | 2.71875 | 3 | [] | no_license | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main () {
int arr[5] = {0};
for ( int i = 5-1; i >= 0; --i ) {
cout << "\t" << arr[i];
}
cout << endl ;
}
| true |
abf8e877890b2da0d9cad9ac3d486f22b448114c | C++ | PeterStalmach/Tetris | /shape.h | WINDOWS-1250 | 1,587 | 2.796875 | 3 | [] | no_license | #ifndef shape_h
#define shape_h
class Shape
{
public:
int polohaX, polohaY, tvar,natoc,polohapoleriadok,polohapolestlpec;
// premenn polohaX a polohaY uchovvaj sradnice polohy tvaru vzhadom na hern mapu/obrazovka/konzola
// premenn polohariadok a polohastlpec uchovvaj sradnice polohy tvaru vzhadom na vecto... | true |
17a02857714da63b3860ac1ea64ff3aa56853dd3 | C++ | Juanp-Romero/Programacion-J1_21_1 | /c++/Classes_abstractas.cpp | UTF-8 | 1,238 | 3 | 3 | [] | no_license | /******************************************************************************
Name: Clases Abstractas
Author: Juan Romero
Date: 14/09/2021
Purpose:
Usage: Plug and place
*******************************************************************************/
#include <stdio.h>
#include <iostream>
using namespace std;
... | true |
1a43c346539d9d3aece848d254743b7a94a7cd28 | C++ | CanCanZeng/ceres_solver_practice | /include/SLAM/frame_database.h | UTF-8 | 682 | 3.0625 | 3 | [] | no_license | #ifndef SLAM_FRAME_DATABASE_H
#define SLAM_FRAME_DATABASE_H
#include <iostream>
#include <vector>
namespace SLAM
{
class Frame;
class FrameDatabase
{
public:
~FrameDatabase();
void AddFrame(Frame* frame) { frames_.push_back(frame);}
// void EraseFrame(Frame* frame);
inline size_t size() {return fram... | true |
011c68c847a95c9afc2f98ca15aa7596d43a88ef | C++ | duansuperman/Solve-OOP-exercises | /Bài tập hướng đối tượng/30.Template 2/Source.cpp | UTF-8 | 977 | 3.15625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int ucln(int a, int b);
class Phanso{
int tu, mau;
public:
void Nhap(){
cin >> tu >> mau;
}
void Xuat(){
if (mau < 0){
tu *= -1;
mau *= -1;
}
int uc = ucln(tu, mau);
tu /= uc;
mau /= uc;
cout << tu << "/" << mau << endl;
}
Phanso(){
... | true |