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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
adfc06a2934bd4e60e466c3c2dcbdf56ddec8396 | C++ | guptavarun619/Data-Structure | /Array/SumSubMatric2.cpp | UTF-8 | 1,885 | 3.359375 | 3 | [] | no_license | #include<iostream>
#include<climits>
using namespace std;
int main()
{
// prefix sum matrix approach
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int row, col, tempSum = 0, maxSum = INT_MIN;
cin >> row >> col;
int a[row][col];
// Input
for (int i = 0; i < row; ... | true |
0184cdd2a0a81d4fc2727c7f49d651579515eace | C++ | luckcul/LeetCode | /algorithms/Construct Binary Tree from Inorder and Postorder Traversal/Construct Binary Tree from Inorder and Postorder Traversal.cpp | UTF-8 | 1,076 | 3.21875 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) {
int in_length = ino... | true |
c3519668965a1bca0e92fd8b81e80e97ee42a23d | C++ | tinypie/algorithms | /string_connect_order.cc | UTF-8 | 1,141 | 3.703125 | 4 | [] | no_license | /*
* 字符串的连接顺序
*
* "abdbcca"
* "abc"
* 第二个在第一个中的连接顺序为
* 125, 126,145,146.
*
* 用递归方法
*/
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
void print_array(char *p, int p_len,
char *s, int s_len,
int *array, int n,
int p_start, int s_start)
{
int tn, tp, ts;
tn = n;
tp... | true |
6cd3a9d6c04809175b1aec095da80d88efecbf23 | C++ | adamMaor/myProject | /myProject/main.cpp | UTF-8 | 258 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int add(int x, int y);
int main()
{
int pause;
string str = "Hello World";
cout << str << " " << add(5,7) << endl;
cin >> pause;
return 0;
}
int add(int x, int y)
{
return x + y;
}
| true |
14e63bd83c8aadc5a3bd8edbf5854d01a7fd0e4a | C++ | KLatitude/SNL_Complier | /SNL/Syntax_Analysis/Cpp/syn_analysis.cpp | UTF-8 | 40,871 | 2.546875 | 3 | [] | no_license | #include "../Head/syn_analysis.h"
#include<string>
#include<iostream>
using namespace std;
bool SynAnalysis::isError() {
return error_;
}
void SynAnalysis::printNode(TreeNode* root, int k) {
for (int i = 1; i <= k; i++)
cout<<"\t";
if (root->node_kind_ == ProK) {
cout<<"ProK"<<endl;
... | true |
f804fe8232c4ede9c1abe9239233f66b708718c0 | C++ | Porechniy13/openGL | /lab3/zd1_5.cpp | UTF-8 | 2,100 | 2.609375 | 3 | [] | no_license | void RenderScene(void)
{
// Угол поворота вокруг ядра
static GLfloat fElect1 = 0.0f;
// Очищаем окно текущим цветом очистки
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Обновляем матрицу наблюдения модели
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//Транслируем всю сцену в поле зрения
//Это исход... | true |
68e284b2d7a7d98e71dff7da908cab765491551c | C++ | royson/enigma | /Main.cpp | UTF-8 | 1,949 | 2.921875 | 3 | [] | no_license | #include <stdexcept>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <cstdlib>
#include <memory>
#include "Rotor.hpp"
#include "Plugboard.hpp"
using namespace std;
int main(int argc, char **argv) {
//Check if there is an least a plugboard
if (argc <= 1) {
ce... | true |
daff4a1a83b9c2549784f99deb1a8d8c52e80945 | C++ | cheydrick/CSInteropStructTest | /InteropStructTest.cpp | UTF-8 | 2,554 | 2.78125 | 3 | [] | no_license | // InteropStructTest.cpp : Defines the exported functions for the DLL application.
// This is the source code for InteropStructTest.dll.
#include "stdafx.h"
#include <stdio.h>
#ifdef INTEROPSTRUCTTEST_EXPORTS
#define INTEROPSTRUCTTEST_API __declspec(dllexport)
#else
#define INTEROPSTRUCTTEST_API __declspec(dllimport)... | true |
bec6a9f6eb1b042a9ee90ac6811139616c930883 | C++ | zamfiroiu/SDD2020 | /1050_seminar01.cpp | UTF-8 | 1,423 | 3.15625 | 3 | [] | no_license | #include<stdio.h>
#include<string>
struct Virus {
char* nume;
float diametru;
int nrZileIncubatie;
};
Virus initializareVirus(const char* nume, float diametru, int nrZile) {
Virus v;
//v.nume = new char[strlen(nume) + 1];
v.nume = (char*)malloc(sizeof(char)*(strlen(nume) + 1));
strcpy(v.nume, nume... | true |
6f5dad432538ee4123fe5ac6e4b03e20d04f9085 | C++ | jaidurn/BasicEngine | /BasicEngine/FileLog.h | UTF-8 | 532 | 2.546875 | 3 | [] | no_license | #pragma once
//==========================================================================================
// File Name: FileLog.h
// Author: Brian Blackmon
// Date Created: 10/16/2019
// Purpose:
// Logs messages to a file and saves the file.
//==========================================================================... | true |
2278638c75ecd0aa356276812843314a4cb2df81 | C++ | Stiffstream/json_dto | /dev/sample/tutorial17/main.cpp | UTF-8 | 4,010 | 3.28125 | 3 | [
"BSD-3-Clause",
"JSON",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
A sample using json_dto
*/
#include <iostream>
#include <string>
#include <forward_list>
#include <list>
#include <map>
#include <unordered_map>
#include <tuple>
#include <json_dto/pub.hpp>
struct property_info_t
{
// Is this property mandatory?
bool m_mandatory;
// Priority of this property.
int m_priori... | true |
046209b49b54b6fafae80f886d1791ad426deff8 | C++ | danyaaaaaa/University | /lab9/LR9A/main.cpp | UTF-8 | 237 | 2.875 | 3 | [] | no_license | #include <iostream>
#include "vectortemplate.h"
using namespace std;
int main()
{
VECTOR<int> v1(1, 4);
VECTOR<int> v2(2, 3);
v1 == v2 ? cout << "Ravni\n" : v1 > v2 ? cout << "Bolshe\n" : cout << "Menshe\n";
return 0;
}
| true |
693cecde1e25142f9320d62814ba59772bf9db68 | C++ | Lunahri17/1k4-lunahri | /2.C++/TP2_Parte3_Codificacion.en.DevC/TP01_P3_EJ03.cpp | UTF-8 | 549 | 3.171875 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{
float x1,x2,y1,y2,a,b,d;
printf("Ingrese la coordenada X de su Primer punto: ");
scanf("%f",&x1);
printf("Ingrese la coordenada Y de su Primer punto: ");
scanf("%f",&y1);
printf("\nIngrese la coordenada X de su Segundo punto: ");
scanf("%f",&x... | true |
e81a7e792da0f6d5c4681fce0d84c40b5cf3caa5 | C++ | SidhantPuntambekar/CSCI-1300 | /hmwk3_Puntambekar/countDigits.cpp | UTF-8 | 872 | 3.859375 | 4 | [] | no_license | //CS1300 Fall 2019
//Author: Sidhant Puntambekar
//Recitation: 304 - Reddy
//Homework 3 - Problem 4
#include <iostream>
#include <string>
using namespace std;
int countDigits(int n) //This algorithm counts the number of digits in a certain number
{
if (n < 0) //if n is less than zero, multiply it by negative 1
... | true |
b65670e8fe5dd1bc0c3ae1da93d79dab833913ff | C++ | sweet-iriska/--- | /Исходный код.cpp | WINDOWS-1251 | 1,244 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <random>
#include <vector>
#include <iterator>
#include <algorithm>
#include <fstream>
#include <ctime>
using namespace std;
// 2, 1
class FunctorClass
{
public:
int operator()(int &n){
if (n % 2 == 0) {
n = 2 * n;
}
else {
n++;
}
return n;
}... | true |
6cbbd4501ff4cd9d761f6d6cbfa0e0f99f39299e | C++ | YunHoseon/InhaStudy | /c++/0630/0630/GeometricObject.cpp | UTF-8 | 1,400 | 3.40625 | 3 | [] | no_license | #include "GeometricObject.h"
GeometricObject::GeometricObject()
{
}
double GeometricObject::GetArea()
{
return 0.0;
}
double GeometricObject::GetPerimeter()
{
return 0.0;
}
GeometricObject::~GeometricObject()
{
}
Triangle2::Triangle2()
{
side[0] = 1.0;
side[1] = 1.0;
side[2] = 1.0;
isTriangleFull = false;
}
... | true |
80f2e7a34520192c5ef842a966fdb140a4b672a8 | C++ | FRC-3637-Daleks/Asimov | /src/Commands/ControlSwissVelocity.h | UTF-8 | 1,067 | 2.53125 | 3 | [
"CC0-1.0"
] | permissive | /*
* ControlSwissVelocity.h
*
* Created on: Mar 3, 2016
* Author: Edward
*/
#ifndef SRC_COMMANDS_CONTROLSWISSVELOCITY_H_
#define SRC_COMMANDS_CONTROLSWISSVELOCITY_H_
#include "WPILib.h"
#include "Subsystems/Swiss.h"
#include "Utility/ValueStore.h"
namespace commands
{
using namespace dman;
/** Command... | true |
a009d5d97cc528dbb105a9f3b8d00e3e2ed04d65 | C++ | lechangjun/STUDY-Directx2D | /STUDY-directx2D/STUDY-directx2D-main/코드 교정/class_dx11/Rect.cpp | UTF-8 | 2,602 | 2.53125 | 3 | [] | no_license | #include "stdafx.h"
#include "Rect.h"
Rect::Rect(wstring shaderFile)
:position(0.0f, 0.0f), scale(1.0f, 1.0f), color(1, 1, 1, 1)
{
shader = new Shader(L"./_Shader2D/Effect.fx");
CreateBuffer();
Color(color);
}
Rect::Rect(wstring shaderFile, D3DXVECTOR2 position, D3DXVECTOR2 scale, D3DXCOLOR color)
... | true |
20de2ddb05174a26b9c9463bc6514f2191c9f532 | C++ | bogdanenciu/gravitySimulator | /Game/src/DrawAble.cpp | UTF-8 | 1,619 | 2.90625 | 3 | [] | no_license | #include "DrawAble.h"
DrawAble::DrawAble(std::string name, int x, int y)
{
texture = IMG_Load(name.c_str());
glGenTextures(1, &textureId);
pos.x = x;
pos.y = y;
Rotation = 0.f;
}
DrawAble::~DrawAble()
{
}
void DrawAble::draw()
{
glBindTexture(GL_TEXTURE_2D, textureId);
// Set the texture's stretching prop... | true |
d5b516e0b861167b49a845d228ce45338bff7c9b | C++ | Vesion/Misirlou | /leetcode/024-SwapNodesInPairs.cpp | UTF-8 | 1,456 | 3.546875 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
struct ListNode {
int val;
ListNode* next;
ListNode(int val) : val(val), next(NULL) {}
};
// Solution 1 : recursive
class Solution {
public:
ListNode* swapPairs(ListNode* head) {
if (!head || !hea... | true |
3075f0ebcd849fba4d1b88bb9d75998c7602f10a | C++ | PatriceVignola/astral-tides | /Source/ProjectLuna/Public/StreamSection.h | UTF-8 | 885 | 2.578125 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
/**
*
*/
class PROJECTLUNA_API StreamSection
{
public:
StreamSection(FVector p1, FVector p2, FVector p3, FVector p4, FVector tangent,
FVector normal, float radius);
~StreamSection();
/*
Applies the current force to t... | true |
0c69c5fa489f4b9946eb6e979345c1206210e06e | C++ | danel2005/triple-of-da-centry | /mathLazy.cpp | UTF-8 | 2,460 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <math.h>
#include <iomanip>
unsigned int baranoliFunc(int n, int k)
{
int calcN = 1;
int calcK = 1;
int calcD = 1;
int result = 1;
for (int i = 1; i <= n; i++) calcN *= i;//n! זה מחשב את ה
for (int i = 1; i <= k; i++) calcK *= i;//k! זה מחשב את ה
for (int i = 1; i <= n - k; i++) c... | true |
2ace08300624c6bb80e7f7dc1b5d842f7396b119 | C++ | abhinav-iitkgp/Data-Structures-and-Algorithms | /old Comp/stacks/basic_functions.cpp | UTF-8 | 507 | 3.234375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void printstack(stack<int> s)
{
while(!s.empty())
{
cout<<s.top()<<" ";
s.pop();
}
cout<<endl;
}
int main()
{
stack <int> s;
s.push(10);
s.push(23);
s.push(5);
s.push(2);
s.push(4);
s.push(3);
s.push(2);
s.push(32);
printsta... | true |
2e79e8da3d3d74c49a97a322bb451353336ade7f | C++ | teaspring/problems | /topics/stackqueue/header/genstack.h | UTF-8 | 836 | 3.578125 | 4 | [] | no_license | /*
* *********** <DataStructureInC++> chapter4 Stack & Queue *************
* generic stack implementation of vector
*
*/
#ifndef STACK
#define STACK
#include <vector>
using namespace std;
template<typename T, int capacity=30>
class Stack{
public:
Stack(){
pool.clear();
}
v... | true |
17a741b466bcd204215e64d2a2d9f3d9b25f2f10 | C++ | wangwen135/Arduino | /LCD/LCD.ino | UTF-8 | 4,642 | 3.1875 | 3 | [] | no_license | //8位接法
//接口说明:
//1、两组电源 一组是模块的电源 一组是背光板的电源 一般均使用5V供电。本次试验背光使用3.3V供电也可以工作。
//2、VL是调节对比度的引脚,串联不大于5KΩ的电位器进行调节。本次实验使用1KΩ的电阻来设定对比度。其连接分高电位与低电位接法,本次使用低电位接法,串联1KΩ电阻后接GND。
//注意:不同液晶的对比度电阻是不同的,最好是接一个电位器进行测试,本次实验使用的1KΩ电阻在其他液晶上不一定正确。
//3、RS 是很多液晶上都有的引脚 是命令/数据选择引脚 该脚电平为高时表示将进行数据操作;为低时表示进行命令操作。
//4、RW 也是很多液晶上都有的引脚 是读写选择端 该脚电平为高是表示要... | true |
2ea703ae3e21fc304a18909f0ca3894cfd6ebe60 | C++ | jordantangy/cpp-messageboard-b | /Board.hpp | UTF-8 | 468 | 2.546875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iostream>
#include <vector>
using namespace std;
#include "Direction.hpp"
namespace ariel{
class Board{
std::vector<std::vector<char>> board;
public:
Board(){
board.resize(5,vector<char>(5,'_'));
}
void post(unsigned int row, unsigned int column,D... | true |
bad35c5b22096733be4d45afcfa0c495b3329eb9 | C++ | xlnwel/Leetcode | /leetcode/0051.cpp | UTF-8 | 1,121 | 3.15625 | 3 | [] | no_license | #include <vector>
#include <string>
using namespace std;
class Solution {
public:
vector<vector<string>> solveNQueens(int n) {
col = vector<bool>(n, false);
diag1 = vector<bool>(2*n-1, false); // there are 2*n-1 diagonals
diag2 = vector<bool>(2*n-1, false);
vector<string> m(n, stri... | true |
e818c41c05c3532c2541a6cf69bf58d0b59bafdb | C++ | SamsonHunk/FPS-level-gen | /Honours/Honours.cpp | UTF-8 | 27,477 | 3.046875 | 3 | [
"MIT"
] | permissive | #include <cstdlib>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <writer.h>
#include "document.h"
#include "filewritestream.h"
#include "Rooms.h"
using namespace rapidjson;
//grid dimensions
int size;
//max players in the map
int maxPlayers = 8;
std::string fileName = "test";
... | true |
cbf5a992c35105b5bb3ccebc6a88d09908b4dcc2 | C++ | windystrife/UnrealEngine_NVIDIAGameWorks | /Engine/Source/Runtime/Core/Public/Misc/FrameValue.h | UTF-8 | 1,698 | 2.953125 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreGlobals.h"
/**
* This struct allows you to cache a value for a frame, and automatically invalidates
* when the frame advances.
* If the value was set this frame, IsSet() returns true and GetValue() is valid.
*/
template<typen... | true |
584330a68795999d64b9dbc5bd957d000b674471 | C++ | krupowies/Loty | /Projekt Loty/Projekt Loty/getData.cpp | UTF-8 | 1,755 | 3.109375 | 3 | [] | no_license | #include "stdafx.h"
#include "getData.h"
void addPassenger(passenger *& pHead, std::string & name, int seat)
{
if (pHead == nullptr)
{
pHead = new passenger{ name,seat, nullptr };
}
else
{
passenger *temp = pHead;
if (seat < temp->seat)
{
passenger * newTemp = new passenger{ name, seat, p... | true |
e10407a1221450243f3a9e63870ee28b1957d0f7 | C++ | curtischung/UNR-CS | /CS-202/Project 9/project9/proj9.cpp | UTF-8 | 2,596 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <cstring>
#include "NodeQueue.h"
#include "ArrayQueue.h"
using std::endl;
using std::cout;
using std::cin;
int main () {
cout << "\n"
<< "//////////////////////////////////////////\n" <<
"////////// ArrayQueue Testing ///////////\n" <<
"////////////////////////////////////////... | true |
e989a821dc731021ba5907fd9816032e0f056765 | C++ | dxmtb/OICodeShare | /SPOJ/spoj282.cpp | UTF-8 | 1,589 | 2.765625 | 3 | [] | no_license | /*
ID: dxmtb
PROG: spoj282 Muddy Fields
TIME: 2010.8.22
STATE: Solved
MEMO: 二分图最小覆盖建模
*/
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN=50,MAXM=MAXN*MAXN;
struct Node
{
int v;
Node *next;
Node(int a,Node *b):v(a),next(b){}
};
int R,C;
char map[MAXN][MAXN+10];
int r[MAXN][MAXN],c[MAXN][MA... | true |
8746998df7d43f92a17970a25d5cfd6292748eec | C++ | qli51/treasure | /code/sort/mergesort.cpp | UTF-8 | 1,046 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
void merge(vector<int>& a,int left,int middle,int right){
int i=left;
int j=middle+1;
int *store=new int[right-left+1];
int index=0;
while(i<middle && j<right){
if(a[i]<a[j]){
store[index++]=a[i++];
}
else... | true |
000ce9802b929463d6ba2145be98020b71f4e3d5 | C++ | J-AugustoManzano/livro_Eixos-C-CPP | /Fontes/Cap03/CPP/C03EX06.cpp | UTF-8 | 270 | 2.953125 | 3 | [] | no_license | // C03EX06.CPP
#include <iostream>
#include <ciso646>
using namespace std;
int main()
{
int N;
cout << "Entre um valor inteiro: "; cin >> N;
cin.ignore(80, '\n');
cout << "\n";
if (not (N >= 3))
{
cout << N << endl;
}
return 0;
}
| true |
459d4117ee5dc01de0fdfbfd71b185ee1c499cbc | C++ | RawanMoukalled/ShaunGames_3 | /game1/cannon.cpp | UTF-8 | 1,402 | 3.09375 | 3 | [] | no_license | #include "cannon.h"
#include "game1scene.h"
/**
* \file cannon.cpp
* \brief Contains Cannon class definition
*/
/**
* Sets the cannonimage and initializes variables.
*/
Cannon::Cannon(QObject *parent) :
QObject(parent)
{
this->setPixmap(QPixmap("pictures/cannon.png"));
setScale(0.3);
setTransformOrigi... | true |
2fadb97bc9c4f9a91febc664cbbb1e84ae390eaf | C++ | hasw7569/Myhobby | /Problem_solving/5052_트라이.cpp | UTF-8 | 975 | 3.046875 | 3 | [] | no_license | #include<stdio.h>
struct Trie
{
Trie* trie[10];
bool finish;
Trie()
{
finish = 0;
for (int i = 0; i < 10; i++)
trie[i] = 0;
}
~Trie()
{
for (int i = 0; i < 10; i++)
delete trie[i];
}
bool find(const char* pos)
{
if (*pos != '\0' && finish) return true;
if (*pos == '\0' && finish) return false;... | true |
25e02f58e1d18550c0bb9dca0a4239817b21e683 | C++ | tonilsz/AlphaOmega | /Source/AlphaOmega/ProceduralLandscape.cpp | UTF-8 | 7,233 | 2.546875 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#include "AlphaOmega.h"
#include "ProceduralLandscape.h"
/** Sets up the values to generate the landscape*/
void AProceduralLandscape::GenerateMesh() {
// Setup example height data
int32 NumberOfPoints = (widthSections + 1) * (lenghtSe... | true |
80016bdde184c5738d955f92b85dde13b0e7e619 | C++ | Skywt2003/codes | /XJOI/Level2/XJOI3595 欧拉函数/eular.cpp | UTF-8 | 388 | 2.515625 | 3 | [] | no_license | #include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
using namespace std;
int n,ans;
inline void Build_Phi(){
long long x=n;ans=n;
for (long long i=2;i<sqrt(n)&&x>1;i++) if (x%i==0){
ans=ans/i*(i-1);
while (x%i==0) x/=i;
}
if (x>1) ans=ans/x*(x-1);
}
int main(){
scan... | true |
23547e226ac2ea2bf915a90e3719f91bbe05c779 | C++ | zhangyanuuuuu/760p2 | /src/v2.cpp | UTF-8 | 5,284 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <math.h>
#include <assert.h>
#include "cg_user.h"
#define DEBUG
using namespace std;
const string delimiter = " \t\n\r";
const double alpha = 1.0;
const double delta_h = 0.01;
//data structure definition
struct pin {... | true |
ca746792683e40f14003e5e2c881e1c94b6fea51 | C++ | sejinik/Discovering_modern_cpp | /c++11/argc_argv_test.cpp | UTF-8 | 178 | 2.703125 | 3 | [] | no_license | #include <iostream>
using std::cout;
using std::endl;
int main(int argc, char* argv[]){
for(int i=0; i<argc;i++){
cout<<argv[i]<<endl;
}
return 0;
} | true |
d3c84a56978d77fcef19c5522b0a18e825ac1283 | C++ | kohn/kohn-zoj-sol | /zoj-1902.cpp | UTF-8 | 1,588 | 3.265625 | 3 | [] | no_license | #include "stdio.h"
#include "stdlib.h"
#include "string.h"
struct word
{
char string[17];
int money;
struct word *next;
};
int Hashing(char target[17])
{
int i;
int Sum_Value=0;
for(i=0;target[i]!=0;i++)
{
Sum_Value+=target[i]-'a';
}
return Sum_Value%100;
}
st... | true |
063f1930114b860b59d97e2f9e0417e02572bb66 | C++ | SergiiKusii/Cracker | /src/unhesher/UnhesherNative.cpp | UTF-8 | 373 | 2.546875 | 3 | [] | no_license | #include "UnhesherNative.h"
#include "unistd.h"
std::string UnhesherNative::Crypt(const HashType, const std::string& salt, const std::string& saltPrefix, const std::string& data)
{
auto fullSalt = saltPrefix + salt;
std::string result = crypt(data.c_str(), fullSalt.c_str());
return fullSalt.size() < resul... | true |
d8269623a4b25b489ece99d0b75c20cbd8a33411 | C++ | StutiSulg/MovieProject | /LinkedList.h | UTF-8 | 839 | 3.125 | 3 | [] | no_license | //---------------------------------------------------------------------------
// LINKEDLIST.H
// A container that represents a Linked List
//---------------------------------------------------------------------------
// Linked list Class:
// -- inserts items into linked list
// -- removes items from linked list
//... | true |
4b634ba9062f6caf087f96542bf195be70d7b944 | C++ | cdjames/sagitta-runner | /main.cpp | UTF-8 | 2,885 | 2.546875 | 3 | [] | no_license | /*********************************************************************
** Author: Collin James
** Date: 7/9/17
** Description: Main routines Team Sagitta's infinite runner game
*********************************************************************/
#include <unistd.h>
#include <iostream>
#include "GameManager.hpp"
#incl... | true |
0952282916f2e339ae570792e8eeda29d813bc7c | C++ | snacchus/DeferredRenderer | /src/graphics/SimpleImageEffect.hpp | UTF-8 | 935 | 2.609375 | 3 | [] | no_license | #ifndef SIMPLEIMAGEEFFECT_HPP
#define SIMPLEIMAGEEFFECT_HPP
#include "ImageEffect.hpp"
class Material;
class SimpleImageEffect : public ImageEffect
{
public:
explicit SimpleImageEffect(Entity* parent);
Material* material() { return m_material; }
const Material* material() const { return m_material; }
void setMa... | true |
0e5c1dfcb8b4750c2340dc7468e83c6a88651218 | C++ | ToLoveToFeel/LeetCode | /Cplusplus/_0668_Kth_Smallest_Number_in_Multiplication_Table/_0668_main.cpp | UTF-8 | 914 | 3.28125 | 3 | [] | no_license | // Created by WXX on 2021/2/27 23:44
#include <iostream>
using namespace std;
/**
* 执行用时:20 ms, 在所有 C++ 提交中击败了34.86%的用户
* 内存消耗:5.6 MB, 在所有 C++ 提交中击败了98.62%的用户
*/
class Solution {
public:
// 返回小于等于mid的数据个数,将每列中小于mid的数的个数相加即可
int get(int m, int n, int mid) {
int res = 0;
for (int i = 1; i <= ... | true |
895b10cd211954c1754e22f8cbbce4d6ce3010bf | C++ | Arcade-Bytes/Rifted | /Headers/AnimationComponent.h | UTF-8 | 1,152 | 2.796875 | 3 | [] | no_license | #ifndef ANIMATIONCOMPONENT_H
#define ANIMATIONCOMPONENT_H
#include <unordered_map>
#include <rapidjson/document.h>
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/filereadstream.h>
#include "Animation.h"
#include "ResourceManager.h"
class AnimationComponent
{
private:
// Pl... | true |
b850743137aa7a9099030e03347c4f380eb55864 | C++ | Tudor67/Competitive-Programming | /LeetCode/Explore/March-LeetCoding-Challenge-2021/#Day#22_VowelSpellchecker_sol1_unordered_map_O((N+Q)L)_time_O((N+Q)L)_extra_space_68ms_34MB.cpp | UTF-8 | 1,943 | 3.234375 | 3 | [
"MIT"
] | permissive | class Solution {
private:
string getLowerForm(const string& WORD){
string lowerWord = WORD;
transform(WORD.begin(), WORD.end(), lowerWord.begin(), ::tolower);
return lowerWord;
}
string getVowelForm(const string& WORD){
string vowelWord;
for(int i = 0; ... | true |
a587f110ad6f49b7f70d3a574a9008b68e595a14 | C++ | iron-phoenix/scan_opencl | /Lab2/main.cpp | UTF-8 | 4,934 | 2.84375 | 3 | [] | no_license | #include "cl.hpp"
#include <vector>
#include <fstream>
#include <iostream>
#include <iterator>
#include <iomanip>
#include <assert.h>
#define BLOCK_SIZE 256
struct scanner {
scanner(cl::Context& context, cl::Program& program, cl::CommandQueue& queue) :
context(context),
program(program),
queue(queue)
{
sca... | true |
8c6a60065af33992d7d1ef69ac7149caa555cfaf | C++ | tangjz/acm-icpc | /lydsy/4751.cpp | UTF-8 | 1,488 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #include <stdio.h>
const int maxt = 101, maxn = 1001, maxo = 2001, lown = 11, maxst = 11;
int t, n, m, sz, out[maxo][4];
void addLine(int x1, int y1, int x2, int y2)
{
out[sz][0] = x1;
out[sz][1] = y1;
out[sz][2] = x2;
out[sz][3] = y2;
++sz;
}
void solve1(int n, int m)
{
if(n <= m)
for(int i = 1; i <= n; ++i)
... | true |
2d21c638ce4018d402392f3a1100d609d7dfaca8 | C++ | roberteliason/COM-09480-driver | /7seg4digDriver.ino | UTF-8 | 3,492 | 3.46875 | 3 | [] | no_license | /**
* Proof of concept code that drives a
* Sparkfun 4-digit 7-segment display.
* https://www.sparkfun.com/products/9480
*
* Datasheet:
* https://www.sparkfun.com/datasheets/Components/LED/7-Segment/YSD-439AY2B-35.pdf
*
* Add 100 Ohm resistors to pins 9-12
* or risk burning out segments.
*
* The quirk w... | true |
211c6c8bde5b6f8a5c8ee9f17065e0658def14de | C++ | HoaLD20/CPP | /CPP201/Resource/Advanced C Plus Plus Programming - Working Files/Chapter 05/Chap0502.cpp | UTF-8 | 426 | 2.625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
/*cout.put('h');
cout.put('e');
cout.put('l');
cout.put('l');
cout.put('o');
cout.put(' ');
cout.put('w');
cout.put('o');
cout.put('r');
cout.put('l');
cout.put('d');
cout.put('!').put('\n');*/
cout << "hello, wo... | true |
29b6e797a2fe1fbe914f8e575c19681142152519 | C++ | mregorova/true_equation | /tests.cpp | UTF-8 | 1,819 | 2.84375 | 3 | [] | no_license | #include "tests.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
int equationTest(int numTest, double a, double b, double c, int numSols_main, double x1_main, double x2_main)
{
assert(isfinite(a));
assert(isfinite(b));
assert(isfinite(c));
assert(isfinite(x... | true |
2a3ef0bf7035f8586cbab05eb5211ef94bc6fb97 | C++ | Ninja182/Coding | /C++/switch.cpp | UTF-8 | 460 | 3.328125 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main()
{
int num = 6;
switch ( num)
{
case 1 : cout << num << " : Monday\n" ; break ;
case 2 : cout << num << " : Tuesday\n" ; break ;
case 3 : cout << num << " : Wednesday\n" ; break ;
case 4 : cout << num << " : Thursday\n" ; b... | true |
baa7b64c4da02d9328f209ae78c7904cea9a1699 | C++ | dzuberi/cache-coherency-project | /protocols/MESI_protocol.cpp | UTF-8 | 7,748 | 2.546875 | 3 | [] | no_license | #include "MESI_protocol.h"
#include "../sim/mreq.h"
#include "../sim/sim.h"
#include "../sim/hash_table.h"
extern Simulator *Sim;
/*************************
* Constructor/Destructor.
*************************/
MESI_protocol::MESI_protocol (Hash_table *my_table, Hash_entry *my_entry)
: Protocol (my_table, my_ent... | true |
e7a6f6ff6d13383dc482e08a2129bf8cc34dcd5c | C++ | AlecsGesser/ABC-Language-Compilers | /Syntactic Analysis/src/tabParse.hpp | UTF-8 | 3,820 | 2.546875 | 3 | [] | no_license | #ifndef tabParse_hpp
#define tabParse_hpp
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
void init_tab(vector<vector<int> >& tabParsing){
int size_H = 85, size_W = 60;
for(int i = 0 ; i < size_H ; i++){
vector<int> temp;
for(int j = 0 ; j < size_W ; j++){
temp.push_back(-1);
... | true |
e4e4629578f03eef7ecad7c7c565003bc2fd431e | C++ | rschlenk87/AirQuest | /alvr_server/FFR.cpp | UTF-8 | 8,305 | 2.5625 | 3 | [
"MIT"
] | permissive | #include "FFR.h"
#include "Settings.h"
#include "resource.h"
#include "Utils.h"
using Microsoft::WRL::ComPtr;
using namespace d3d_render_utils;
namespace {
struct FoveationVars {
uint32_t targetEyeWidth;
uint32_t targetEyeHeight;
uint32_t optimizedEyeWidth;
uint32_t optimizedEyeHeight;
float focusPositio... | true |
545e4f91df4bbe379d97c05d6348ee3e4e19bfc9 | C++ | Pennliu/uva | /699.cpp | UTF-8 | 2,260 | 2.6875 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: 699.cpp
*
* Description:
*
* Version: 1.0
* Created: 2014年10月03日 21时28分41秒
* Revision: none
* Compiler: gcc
*
* Author: loop (),
* Organization:
... | true |
d90fef0d034c32b9b7fc70205e41e87d40e009ae | C++ | Kareem21/CS253-project-code | /Image.cc | UTF-8 | 14,925 | 3.0625 | 3 | [] | no_license | #include "Image.h"
#include "Alpha.h"
#include <fstream>
#include "PGM.h"
using namespace std;
//what is going on in this >> thing
Image* Image::create(const std::string &filename) //static factory method
{
//Check if file is alpha or PGM
bool filetype = 0; // 0 for alpha 1 for PGM
std::if... | true |
7943a2540e962dacd8b8d8ca7b8ab33dfa4200a1 | C++ | mi2think/DoPixel | /DpLib/DpGeometry.cpp | UTF-8 | 4,620 | 2.53125 | 3 | [] | no_license | /********************************************************************
created: 2015/11/21
created: 21:11:2015 11:05
filename: D:\OneDrive\3D\DpLib\DpLib\DpGeometry.cpp
file path: D:\OneDrive\3D\DpLib\DpLib
file base: DpGeometry
file ext: cpp
author: mi2think@gmail.com
purpose: Geometry
*******************... | true |
2d09768b5ed26623c9f9bb6a6be79a7b9b223572 | C++ | catboost/catboost | /library/cpp/cache/ut/cache_ut.cpp | UTF-8 | 21,490 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #include <library/cpp/cache/cache.h>
#include <library/cpp/cache/thread_safe_cache.h>
#include <library/cpp/testing/unittest/registar.h>
struct TStrokaWeighter {
static size_t Weight(const TString& s) {
return s.size();
}
};
Y_UNIT_TEST_SUITE(TCacheTest) {
Y_UNIT_TEST(LRUListTest) {
typede... | true |
0f4f330e2e4b313e906ee36c2111b10d01d86b2c | C++ | dinhtai1104/SPOJ_PTIT | /P142SUME.cpp | UTF-8 | 1,148 | 2.765625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int a[100000] ;
int k , n, s, res;
void printResult() { // hà m dùng d? in m?t c?u hình ra ngoà i
for(int i = 1 ; i <=k ; i++) {
cout<<a[i]<<" " ;
}
cout<<endl ;
}
bool check(int a[], int s)
{
int sum = 0;
for (int i = 1; i <= k; i++) sum += a[i];
... | true |
6514cd272d5066ae39a4a39fcb68b400715a222c | C++ | Bananzarama/Babel | /babelbot.cpp | UTF-8 | 2,628 | 2.84375 | 3 | [] | no_license | /** //\
* V \
* \ \_
* \,'.`-.
* |\ `. `.
* ( \ `. `-. _,.-:\
* \ \ `. `-._ __..--' ,-';/
* \ `. `-. `-..___..---' _.--' ,'/
* `. `. `-._ __..--' ,' /
* `. `-_ ``--..'' _.-' ,'
* `-_ `-... | true |
1fd125a61ecc48bc15430dabac100dd31793bd31 | C++ | super-ast/analyzers | /src/super_ast/analyzer/visitor/simple_fors.cpp | UTF-8 | 5,930 | 2.8125 | 3 | [] | no_license | #include "simple_fors.hpp"
namespace super_ast {
void SimpleFors::Visit(const super_ast::Node* node) {
node->AcceptChildren(*this);
}
std::vector<Error> SimpleFors::GetErrors() {
return errors_;
}
void SimpleFors::Visit(const For* forstmt) {
// Check that init is a declaration or an assignment
bool valid_ini... | true |
40ecad014018d633adff80dbcf40c6cd16e53575 | C++ | thelwyn/AI-on-the-edge-device | /code/components/jomjol_image_proc/CRotateImage.h | UTF-8 | 594 | 2.546875 | 3 | [
"MIT"
] | permissive | #include "CImageBasis.h"
class CRotateImage: public CImageBasis
{
public:
CImageBasis *ImageTMP;
CRotateImage(std::string _image) : CImageBasis(_image) {ImageTMP = NULL;};
CRotateImage(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channel... | true |
ffadc262d131093f68507d9e23b07459b4d28eb8 | C++ | nikhilpanju/CubeSolver | /Sources/scrambledialog2x2.cpp | UTF-8 | 3,351 | 2.75 | 3 | [] | no_license | #include "../Header/scrambledialog2x2.h"
#include "ui_scrambledialog2x2.h"
// Initialize the scramble variables which store the scrambled state of the cube
QString whiteFace2_scramble = "wwww", yellowFace2_scramble = "yyyy", greenFace2_scramble = "gggg",
blueFace2_scramble = "bbbb", redFace2_scramble = "rr... | true |
2562c794428de7b1f414dcf34a22fdad9f34fe86 | C++ | EdwardLam10/C- | /CSCI 235 Project 3/dictionary.cpp | UTF-8 | 1,959 | 3.484375 | 3 | [] | no_license | /***************************************************************
Title: dictionary.cpp
Author: Edward Lam
Date Created: 5/07/2017
Class: Spring 2017, CSCI 235-03, Mon & Wed 5:35pm-6:50pm
Professor: Michael Garod
Purpose: Assignment #3
Description: .cpp file for dictionary class.
********************************... | true |
622fbd968d8dc9302165597a647551bac513d90d | C++ | denis-gubar/Leetcode | /Greedy/0402. Remove K Digits.cpp | UTF-8 | 718 | 3.078125 | 3 | [] | no_license | class Solution {
public:
string removeKdigits(string num, int k) {
string result(num);
string prefix;
auto pos = result.find('0');
while (pos != string::npos && pos <= k)
{
result = result.size() > pos + 1 ? result.substr(pos + 1) : "";
k -= pos;
pos = result.find('0');
}
for (char c = '1'; k &&... | true |
cfe63001933ee9ded0367a71a79c16e6b28ff1c8 | C++ | Priyadarshanvijay/Codingblocks-2018 | /Linked_lists/detectCycleLinkList.cc | UTF-8 | 1,249 | 4.03125 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Node{
public:
int data;
Node* next;//self referential classes
Node(int d){
data = d;
next = NULL;
}
};
Node* createLinkList(){
int x;
Node* head = NULL;
Node* tail = NULL;
while(true){
cin>>x;
if(x==-1) break;
Node* newNode = new Node(x);
if(head==... | true |
f7f9d2389b0ce6510e99e6d54ba8a056434a05fe | C++ | vashj1995/Galactic-Polar-Wars-Final | /Galactic Polar Wars/src/Floor.h | UTF-8 | 503 | 2.65625 | 3 | [] | no_license | #pragma once
#ifndef __FLOOR__
#define __FLOOR__
#include "DisplayObject.h"
#include "FloorType.h"
class Floor final : public DisplayObject {
public:
Floor();
Floor(glm::vec2 position, FloorType type);
~Floor();
// Inherited via GameObject
virtual void draw() override;
virtual void update() override;
virtual... | true |
9e60d6a261178551958fa37a9a6e4164ddaf13ad | C++ | Moaz-Elmaatawy/Algorithmic-toolbox | /week3_greedy_algorithms/7_maximum_salary/largest_number3.cpp | UTF-8 | 704 | 2.625 | 3 | [] | no_license | #include <algorithm>
#include <sstream>
#include <iostream>
#include <vector>
#include <string>
using namespace std ;
void largest_number(vector<string> v ,int n) {
string max0;int index=0 ;
for (int j=0;j<n;++j){
for (int i=0;i<n;++i){
if (v[i][0]>max0[0]){
max0=v[i];
index=... | true |
deb661c635a8d6bf9f5a8d80c343a495062fba63 | C++ | gsrbr/SrDuino | /Code/ping_pong/ping_pong.ino | UTF-8 | 6,282 | 2.75 | 3 | [
"MIT"
] | permissive | // Projeto 37 – Jogo do Ping Pong com LCD Nokia 5110
//Edited by Cogumelinho and gsrbr
// Setando os pinos do LCD Nokia 5110 no Arduino Uno
#define PIN_SCE 11
#define PIN_RESET 12
#define PIN_DC 10
#define PIN_SDIN 9
#define PIN_SCLK 8
#define PIN_BUZZER 3
#define pot 2
#define LCD_C LOW
#define LCD_D ... | true |
cf3fb58e6ae0448f4e4f02979b7306df45b4d47f | C++ | geekscape/rgb_led | /rgb_led.ino | UTF-8 | 5,713 | 3.1875 | 3 | [] | no_license | /*
* File: rgb_led.ino
* Version: 0.0
* Author: Andy Gelme (@geekscape)
* License: GPLv3
*/
#include <math.h>
#include <TimerOne.h>
#include "rgb_led.h"
const byte PIN_LED_CLOCK = 7;
const byte PIN_LED_DATA = 8;
const byte LED_COUNT = 16;
rgb_t led[LED_COUNT];
const long BLEND_RATE = 100; // millisecond... | true |
ba19a6baa845db8be97a1b4852b7a434b4db346a | C++ | zxnrbl/micromouse | /State.cpp | UTF-8 | 4,569 | 2.53125 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include "State.h"
#include "API.h"
#include "Map.h"
#include "Mouse.h"
void IState::Enter( Mouse& context ) {
}
void IState::Exit( Mouse& context ) {
}
void IState::PreUpdate( Mouse& context ) {
}
void IState::PostUpdate( Mouse& context )... | true |
1508fa1bac1e0903fdaf455af8aee792906ac1fa | C++ | Zarakinoa/Design-Patterns | /parciales/2017/DataCompOp.h | UTF-8 | 243 | 2.625 | 3 | [] | no_license | #include <string>
using namespace std;
class DataCompOp{
private:
string comp, op;
float precioOp;
public:
DataCompOp(string , string , float);
virtual ~DataCompOp();
string getComp();
string getOp();
float getPrecioOp();
}
| true |
33eca16490d133360d3d30c64f2f165e34679362 | C++ | rdpoor/mu | /sketches/sketch_estream6.cpp | UTF-8 | 3,848 | 3.59375 | 4 | [
"MIT"
] | permissive | /*
* side-effect free streams. Uses lambda to create deferred evaluation.
* Specialized streams are static methods of the general class.
*/
#include <functional>
#include <string>
#include <vector>
#define NULL_ESTREAM nullptr
#define IS_NULL_ESTREAM(s) ((s) == NULL_ESTREAM)
#define DEFER(form, T) [=]()->EStream<... | true |
da3224a2d52e9e8778083c8559ed43b85dd22861 | C++ | rhiestan/RegardRGBD | /src/Vector.h | UTF-8 | 1,036 | 3.640625 | 4 | [
"MIT"
] | permissive | #ifndef VECTOR_H
#define VECTOR_H
/**
* This template is a simple N-dimensional vector.
*
* The data members are not initialized to 0!
*/
template <typename T, unsigned int C>
class SimpleVector
{
public:
SimpleVector() { }
SimpleVector(const SimpleVector &other)
{
for(unsigned int i = 0; i... | true |
780fc0257b0ba7055a22b41d03924b4121a9ed72 | C++ | ioleon13/LeetCode | /Unique Paths.cpp | UTF-8 | 444 | 2.953125 | 3 | [] | no_license |
class Solution {
public:
int uniquePaths(int m, int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
vector<int> vec(m,0);
vec[m-1] = 1;
for(int j = n-1; j >= 0; j--)
for(int i = m-1; i >= 0; i--)
{
in... | true |
39fa8c2c389f5989cd792ddbb8f44665c869a481 | C++ | optifat/chess_engine | /main.cpp | UTF-8 | 3,484 | 2.859375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <chrono>
#include <iomanip>
#include "pieces/include/Input_processor.h"
#include "tree/include/Tree.h"
#include "tree/include/Evaluator.h"
int main(int argc, char* argv[]) {
bool analysisMode = true;
for(int i = 1; i < argc; i++){;
auto flag = std::string(argv[i]);
... | true |
d89d2a16885dbe9eb8b41406c36e7ba30fed41fe | C++ | lim-james/Wind | /Core/Events/EventsManager.h | UTF-8 | 5,449 | 2.859375 | 3 | [] | no_license | #ifndef EVENTS_MANAGER_H
#define EVENTS_MANAGER_H
#include "Event.h"
#include "../Logger/Logger.h"
#include <string>
#include <map>
#include <vector>
#include <functional>
namespace Events {
class EventsManager {
static EventsManager* instance;
std::map<std::string, std::vector<std::function<void()>>> emptyC... | true |
010a9bd6c9582ae2149909bb4161fc2098fb2b50 | C++ | harshasbu/Algorithms | /Algorithms/AddingBitStrings.cpp | UTF-8 | 1,262 | 3.671875 | 4 | [] | no_license | /*
* AddingBitStrings.cpp
*
* Created on: Jan 16, 2015
* Author: harsha
*/
#include<iostream>
using namespace std;
string makeStringEqualLength(string Number, int length){
//cout << "length is :" << length << endl;
for(int i=0;i<length;i++)
Number = '0' + Number;
//cout << Number << endl;
return N... | true |
85b5f65e7da885c716c1add13fd7d26c7bedb660 | C++ | Hammad-Ikhlaq/Computer-Programming | /CP Lectures/Structures/Structures_And_StructureArray(Simple).cpp | UTF-8 | 2,863 | 3.828125 | 4 | [] | no_license | # include <iostream>
using namespace std;
struct Wajahat
{
int id;
int age;
int name;
};
void input_Single_Data(Wajahat *S);
void input_All_Data(Wajahat *S, int &count);
void display(Wajahat S);
void display_All(Wajahat *S, int count);
int main()
{
//This Code is Only For Understanding So... | true |
10ecbce6370fc3390062fae0bfc2eba237acfe97 | C++ | jiunbae/prime | /core/solver.hpp | UTF-8 | 1,119 | 2.828125 | 3 | [
"MIT"
] | permissive | //
// Created by Jiun Bae on 2020/05/25.
//
#ifndef PRIME_SOLVER_HPP
#define PRIME_SOLVER_HPP
#include <gridarray.hpp>
#include <pool.hpp>
namespace prime {
template <typename T=uint64_t>
class Solver {
public:
Solver() = default;
explicit Solver(T size)
: size(size), sieve(std::m... | true |
e0e0f802145ef60ca17cc8a1167d14839fa2b6f3 | C++ | ashlei-bevington-bluefruit/snake | /src/Engine/Game.cpp | UTF-8 | 1,238 | 2.96875 | 3 | [] | no_license | #include "Game.hpp"
#include "Coord.hpp"
#include "Food.hpp"
#include "Snake.hpp"
Game::Game(GraphicsWrapper &graphics, std::vector<GameObject*> &objectsIn) : graphics(graphics) {
for (std::size_t i = 0; i < objectsIn.size(); i++)
objects.push_back(objectsIn[i]);
}
void Game::Loop() {
Update();
Render();
}
... | true |
fa292de392dfe5cc17478ab3429b69cdab08e328 | C++ | dszajda/cmsc240_f2020_lab7_red | /Triangle.cpp | UTF-8 | 488 | 3.140625 | 3 | [] | no_license | #ifndef __TRINAGLE_CPP__
#define __TRIANGLE_CPP__
#include <iostream>
#include "Shape.h"
#include "Triangle.h"
using namespace std;
Triangle::Triangle(string name, double base, double height) : Shape(name){
baseAmount = base;
heightAmount = height;
}
Triangle::~Triangle(){}
double Triangle::getArea(){
return (b... | true |
e9029b8e888ec13eea05244d5d7ae5e776b393f1 | C++ | jdalseno/Mint2 | /src/Mojito/Efficiencies/symMultiPolyTerm.cpp | UTF-8 | 2,244 | 3.046875 | 3 | [] | no_license | #include "Mint/symMultiPolyTerm.h"
#include "Mint/Utils.h"
#include <iostream>
using namespace std;
using namespace MINT;
symMultiPolyTerm::symMultiPolyTerm(int dimension, int order)
: MINT::PolymorphVector< symPolyTerm >()
{
init(dimension, order);
}
symMultiPolyTerm::symMultiPolyTerm(const symMultiPolyTerm& oth... | true |
28bfa1523d3967f6e6168fe93b6748a244cc414b | C++ | W-Schlesner/WSchlesner-Portfolio | /C++/Lab 2/Client.cpp | UTF-8 | 2,242 | 3.59375 | 4 | [] | no_license | #include "Client.h"
using namespace std;
Client::Client()
{
accountBalance = 0;
firstName = "";
lastName = "";
accountBalance = 0.0;
}
Client::Client(int id, string fname, string lname, double balance)
{
accountID = id;
firstName = fname;
lastName = lname;
accountBalance = balance;
}
... | true |
3278a967b2714eb47a49d0f617c6fa637e71390f | C++ | SinPatrones/trabajofinalada | /main.cpp | UTF-8 | 7,948 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include <stdlib.h>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
/*
5 3 4 5
3 2 2 1 3 1 3 2 <- función fitnes/aptitud
101010101 11000111 110101110 110100101
5 5... | true |
e539d285b09d97536f2c3b56d03e24331257c46b | C++ | asperaa/Data_Structure_Problems | /bst/lca.cpp | UTF-8 | 1,581 | 3.8125 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node* left;
struct node* right;
};
struct node* newNode(int data)
{
struct node* treeNode=(struct node*)malloc(sizeof(struct node));
treeNode->data=data;
treeNode->left=NULL;
treeNode->right=NULL;
return treeNode;
}
struct node*... | true |
d7d4fb6a79e4aa37d4be47ad18002aa82896b576 | C++ | Jakelamers64/OpStratsGame2.0 | /Engine/Level.cpp | UTF-8 | 1,378 | 2.890625 | 3 | [] | no_license | #include "Level.h"
#include <algorithm>
#include <assert.h>
Level::Level(Graphics & gfx, const int levelEvel_in)
:
gfx(gfx),
levelEvel(levelEvel_in)
{
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
if (levelEvel_in == 0)
{
blocks.emplace_back(Block::Contents::Stone, Block::Disp... | true |
34d547cbf27cae479b0fc95114ec6eb519cacae5 | C++ | whing123/C-Coding | /LeetCode/560.cpp | UTF-8 | 1,010 | 3.890625 | 4 | [] | no_license | /* *题目:
* 560
* Subarray Sum Equals K
prefix sum & map
*/
/*
Brief explaination:
To solve the problem, we want to know how to sum to a particular value and how many times did this value appear.
That is, how to find the value of sum[i, j], the sum from nums[i] to nums[j] , where [i, j] are indexes of the array... | true |
dc8e328f40ad97607da06343c3e06a81885fd952 | C++ | JeffTheK/rella | /test/id_test.cpp | UTF-8 | 390 | 2.546875 | 3 | [
"MIT"
] | permissive | #include "../include/doctest.h"
#include "../src/id.hpp"
TEST_CASE("get_free_id") {
reset_free_id();
CHECK(get_free_id() == 1);
CHECK(get_free_id() == 2);
}
TEST_CASE("get_type_id") {
CHECK(get_type_id<int>() != get_type_id<char>());
}
TEST_CASE("reset_free_id") {
reset_free_id();
CHECK(get_f... | true |
3ab90219a93d4045854eefc51f91b334d943cef1 | C++ | JasonHenault/Nine | /Log.cpp | UTF-8 | 3,758 | 2.578125 | 3 | [] | no_license | #include "Nine.hpp"
#include "FastAccess.hpp"
using namespace NTOOLS;
Log::Log() {
std::cout << "Start logging." << std::endl;
}
Log::~Log() {
SaveReport();
}
void Log::RegisterInfo (const std::string &info) {
_info.push_back(info);
}
void Log::RegisterWarning (const std::string &warn, std::string file... | true |
b8f653804d962337e8b6b8915db88d45aa59c273 | C++ | dskleviathan/contest | /POJ3050.cpp | UTF-8 | 1,013 | 2.609375 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
#include<map>
#include<math.h>
using namespace std;
int a[5][5];
int y = 0;
map<int,int> value;
map<int,int>::const_iterator itr;
void solve(int i,int j,int tmp[],int k){
if(k < 5){
tmp[k] = a[i][j];
if(i != 0) solve(i-1,j,tmp,k+1);
if(j != 4) solve(i... | true |
755d3912476ce6389c3f140b82b20061dea77371 | C++ | a2677331/My-Solutions-CS121-HW | /Lab3/Lab3(cin.ignore,setw,setfill,setprecision).cpp | UTF-8 | 2,282 | 3.40625 | 3 | [] | no_license | //********************************************************
//
// Jian Zhong
// Professor MacKay
// CS121-01
// Lab 3
// 2/17/2019
// Program Name: calculate the downpayment
// Program file:
// Input Files:
// Output Files:
// Included files:
// Purpose:
//
//********************************************************
#in... | true |
9b82521945b0f3e01499f5c36913b158311c131c | C++ | H-Shen/Collection_of_my_coding_practice | /Leetcode/485/485.cpp | UTF-8 | 612 | 2.640625 | 3 | [] | no_license | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int maxConsec(0);
int curConsec(0);
int lastVal(-1);
for (size_t i = 0; i != nums.size(); ++i) {
if (nums[i] == 1 && lastVal != 1) {
curConsec = 1;
lastVal = 1;
... | true |
d4a5a26f928640be08f2095f4be09eb9d4196b9c | C++ | Khaeshah/ACM-ICPC | /Graphs/3988.cpp | UTF-8 | 1,598 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef vector<pair<int,pair<int,int> > > V;
V v;
int N; // numero de nodos
int mf[2010],ranking[2010];
int set(int n) { // conjunto conexo de n
if (mf[n] == n) return n;
else mf[n] = set(mf[n]);
return mf[n];
}
/... | true |
e932654a6d060223c57bf582d0f985f25c05d746 | C++ | Alan-Lee123/POJ | /Greedy algorithm/2325.cpp | UTF-8 | 1,114 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <string>
using namespace std;
string idiv(string s, int d, int& r)
{
string ans = s;
r = 0;
for (int i = 0; i < s.size(); ++i)
{
int x = r * 10 + s[i] - '0';
ans[i] = x / d + '0';
r = x % d;
}... | true |
a95b876313c7ffd7a9d62392ffcd639c5f495387 | C++ | samalvz/Basic-Raytracer | /include/Disk.h | UTF-8 | 502 | 2.671875 | 3 | [] | no_license | #ifndef DISK_H
#define DISK_H
#include "Shape.h"
namespace Raytracer148 {
class Disk : public Shape {
public:
enum type {plane, disk, ring};
Disk(Eigen::Vector3d& center, double diameter, Eigen::Vector3d color, type type) : c(center), d(diameter), color(color), type(type) {}
... | true |
4d1d4bacbea42614658669baebe8ad19a56284ea | C++ | roshihie/At_Coder | /ABC_C/ABC153_C_Fennec_vs_Monster.cpp | UTF-8 | 741 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
using llong = long long;
void input(int& rnFinCnt, vector<int>& rvnLifePnt)
{
int nMonstr;
cin >> nMonstr >> rnFinCnt;
rvnLifePnt.resize(nMonstr);
for (int& rnLifePnt : rvnLifePnt)
cin >> rnLifePnt;
sort(begin(rvnLifePnt), end(rvnLifePnt), grea... | true |