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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c4841ec9969c5efe7a342de5256696d001e694b2 | C++ | valnmv/vbackup | /src/zlib_intf.cpp | UTF-8 | 3,601 | 2.71875 | 3 | [] | no_license | #include "pch.h"
#include "zlib_intf.h"
#include "zlib.h"
#include <vector>
#include <assert.h>
#include <stdio.h>
/* Compress from file source to file dest until EOF on source.
def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
allocated for processing, Z_STREAM_ERROR if an invalid compression
... | true |
5b30b9fe025833805df7cd35b01144c29825d65d | C++ | 23ksw10/LeetCode | /algorithm/1493_Longest_Subarray_of_1's_After Deleting_One_Element/solution.cpp | UTF-8 | 547 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include<string>
#include <algorithm>
using namespace std;
class Solution {
public:
int longestSubarray(vector<int>& nums) {
int l = 0;
int r = 0;
int delete_count = 0;
int ans = 0;
for (int i = 0; i < nums.size(); i++) {
if (delete_count) {
if (nums[i])r++;
... | true |
0f69bb943dbcb0965fc25d56499794d9835b6461 | C++ | masato-sso/AtCoderProblems | /ABC001_100/ABC009/B.cpp | UTF-8 | 628 | 2.75 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<stdio.h>
#include<bits/stdc++.h>
#include<map>
#include<vector>
using namespace std;
int main(){
int N;
cin>>N;
vector<int>A(N,0);
for(int i=0;i<N;i++){
cin>>A[i];
}
int first_max=-1;
int second_max=-1;
for(int i=0;i<N;i++){
... | true |
d442067909136348d9c8b8fce51420fb6f7af641 | C++ | DeadBlasoul/os | /lab6/slave/src/main.cpp | UTF-8 | 4,388 | 2.859375 | 3 | [] | no_license | //
// Hello World client in C++
// Connects REQ socket to tcp://localhost:5555
// Sends "Hello" to server, expects "World" back
//
#include <zmq.hpp>
#include <string>
#include <iostream>
#include <sstream>
#include <Windows.h>
#undef interface
#include <utility/commandline.hpp>
#include <network/response.hpp>
#i... | true |
f251c3bc44608023f255b76dcab82a0434647bca | C++ | KalahariKanga/ooImages | /printExpression.cpp | UTF-8 | 579 | 3.078125 | 3 | [] | no_license | #include "printExpression.h"
#include "Array.h"
printExpression::printExpression()
{
noArguments = 1;
optimisable = 0;
}
printExpression::~printExpression()
{
}
Variable printExpression::evaluate()
{
auto result = arguments[0]->getResult();
if (result.isType<Real>())
{
float value = *result.get<Real>();
st... | true |
8c6d766063c90f97c9e1bfb4db7f34d79646df29 | C++ | muneebGH/oop-misc-cpp | /tic-tac-toe-class-implementation/TicTacToe.cpp | UTF-8 | 1,404 | 3.453125 | 3 | [] | no_license | #include"TicTacToe.h"
void TicTacToe::gamePlay()
{
GameBoard GB;
char symbolA, symbolB,pos;
bool check;
do
{
cout << "enter the character for player 1 : ";
cin >> symbolA;
check = GB.isValidPosition(symbolA);
} while (check);
do
{
cout << "enter the character for player 2 : ";
cin... | true |
9210735f3bf6a420834e6be507ca0239700c76f5 | C++ | vbirds/Bex | /Bex/src/Bex/stream/serialization/text_oarchive.hpp | UTF-8 | 4,203 | 2.75 | 3 | [] | no_license | #ifndef __BEX_STREAM_SERIALIZATION_TEXT_OARCHIVE__
#define __BEX_STREAM_SERIALIZATION_TEXT_OARCHIVE__
#include "base_serializer.hpp"
#include <boost/lexical_cast.hpp>
//////////////////////////////////////////////////////////////////////////
/// 文本式序列化 out
namespace Bex { namespace serialization
{
class text_oar... | true |
a0004784a1e83440c082eddaa848629429e5307a | C++ | sarahkittyy/bullet-heck | /src/Application.cpp | UTF-8 | 860 | 2.953125 | 3 | [
"MIT"
] | permissive | #include "Application.hpp"
Application::Application()
: mWindow(sf::VideoMode(800, 600), "Bullet Heck"),
mResources(),
mAppState(&mWindow, &mResources, new States::Menu())
{
}
int Application::run()
{
sf::Clock appClock; //The application time manager.
while (mWindow.isOpen()) //App loop
{
//Poll eve... | true |
f498583a41c3c360a6dc420b280a9bf13e8a572a | C++ | clatisus/ACM-ICPC-Team-Archive | /zhongzihao-personal/Atcoder/grand005/C.cpp | UTF-8 | 514 | 2.65625 | 3 | [] | no_license | #include<bits/stdc++.h>
const int N = 110;
int cnt[N];
void no(){
puts("Impossible");
exit(0);
}
int main(){
int n;
scanf("%d", &n);
int min = INT_MAX, max = 0;
for (int i = 0, x; i < n; ++ i){
scanf("%d", &x);
++ cnt[x];
min = std::min(min, x);
max = std::max(max, x);
}
if (cnt[min] < 1 || cnt[min]... | true |
77c23dea35b2a572c5b5bd1554a19466dd048e8e | C++ | mayankagg9722/Placement-Preparation | /leetcode/**nthDigit.cpp | UTF-8 | 1,087 | 3.46875 | 3 | [] | no_license | /*
400. Nth Digit
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...
Note:
n is positive and will fit within the range of a 32-bit signed integer (n < 231).
Example 1:
Input:
3
Output:
3
Example 2:
Input:
11
Output:
0
Explanation:
The 11th digit of the sequence 1, 2, 3, 4... | true |
4cab56c976e67e5f4f69a257c4ca14d394bb8611 | C++ | dogguts/Transcendence | /Alchemy/Kernel/Math.cpp | UTF-8 | 3,844 | 3.09375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | // Math.cpp
//
// Integer math package
#include "Kernel.h"
#include <math.h>
#define m ((unsigned long)2147483647)
#define q ((unsigned long)44488)
#define a ((unsigned int)48271)
#define r ((unsigned int)3399)
DWORD g_Seed = 0;
int mathNearestPowerOf2 (int x)
// mathNearestPowerOf2
//
// Returns the largest ... | true |
17b6e83b2a5f74c380b51556daf201d81afc376a | C++ | janhancic/CHIC | /lib/arrayset/arrayset.h | UTF-8 | 586 | 2.90625 | 3 | [
"MIT"
] | permissive | #include <stdlib.h>
#include <stdio.h>
#ifndef __arrayset_h
#define __arrayset_h
#define DEFAULT_SIZE 10
class ArraySet {
private:
void **_arr;
int _num_elements;
int _size;
int _index_of(void *elem);
public:
ArraySet() : ArraySet(DEFAULT_SIZE) {}
... | true |
d9aad5f8863f65f9039ddc3d0897da879fcbc8dc | C++ | dsr373/phase-locked-loops | /Arduino/serial_test/serial_test.ino | UTF-8 | 595 | 2.734375 | 3 | [] | no_license | // var declarations
//int pin = 9;
int ledpin = 13;
String message = "";
String reply = "";
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
// pinMode(pin, OUTPUT);
pinMode(ledpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()) {
... | true |
d44fc09dad0a3cbd9f99498d089e68f694099d77 | C++ | 4solo/leetcode | /25 Reverse Nodes in k-Group.cpp | UTF-8 | 843 | 3.34375 | 3 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* reverseKGroup(ListNode* head, int k) {
int newk=k;
ListNode* current=head;
ListNode* temp;
... | true |
b7bbca010b873e617af7e8721e8138c9c1068f63 | C++ | iiwolf/Competitive | /HackerRank.cpp | UTF-8 | 3,246 | 3.375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool checkNext(string s, int digitSize, int i, int increaseFactor){
cout << "STARTING INFO: " << s << " - " << digitSize << " - " << i << endl;
int location = i*digitSize;
cout << "Giving a location of " << location << endl;
//went through the whole ... | true |
f068221d2c7f6512815f5261827fdae4820b2c59 | C++ | Skyway666/Assignment-1--2D-Platformer | /Dev_class5_handout/Motor2D/j1Collisions.h | UTF-8 | 1,515 | 2.671875 | 3 | [] | no_license | #ifndef __j1COLLISIONS_H__
#define __j1COLLISIONS_H__
#define MAX_COLLIDERS 10000
#include "j1Module.h"
#include "p2Log.h"
#include "SDL/include/SDL.h"
#include "SDL_image/include/SDL_image.h"
#pragma comment( lib, "SDL_image/libx86/SDL2_image.lib" )
enum COLLIDER_TYPE
{
COLLIDER_NONE = -1,
COLLIDER_WALL,
COLLIDE... | true |
cd411102fd6f7ff255b0518952deb9f34a234daf | C++ | colin016/smart | /src/handle/test/smartdll/dll_if.cpp | UTF-8 | 3,159 | 2.625 | 3 | [] | no_license | #include <stdio.h>
#include "dll.h"
class dllib *dllinf;
//动态库接口函数
int init(struct task_user *head, int (*callback)(int type, void* msg))
{
int i;
DBG("enter init( )......\n");
//构造动态库的任务信息定义
dllinf = new dllib; //本模块
dllinf->setcb(callback);
dllinf->setstatus(DLL_INITED);
if(head)
i = dllinf->settask... | true |
edeb48e8a65aaf4815ee648d114ca8caac33f760 | C++ | G-GFFD/Cendric2 | /src/FileIO/MapReader.cpp | UTF-8 | 21,820 | 2.515625 | 3 | [] | no_license | #include "FileIO/MapReader.h"
#ifndef XMLCheckResult
#define XMLCheckResult(result) if (result != XML_SUCCESS) {g_logger->logError("MapReader", "XML file could not be read, error: " + std::to_string(static_cast<int>(result))); return false; }
#endif
using namespace std;
MapReader::MapReader()
{
}
MapReader::~MapRe... | true |
33cfaf241489e6294963c4e27d3838fd2c9d9062 | C++ | 1148583946/AutoEngine | /AutoEngine/RunTime/Includes/Math/Matrix3x3.cpp | UTF-8 | 2,722 | 2.75 | 3 | [] | no_license | #include "Matrix3x3.h"
MATH_BEGIN
Matrix3x3::Matrix3x3(const Matrix4x4 & other)
{
m_Data[0] = other.m_Data[0];
m_Data[1] = other.m_Data[1];
m_Data[2] = other.m_Data[2];
m_Data[3] = other.m_Data[4];
m_Data[4] = other.m_Data[5];
m_Data[5] = other.m_Data[6];
m_Data[6] = other.m_Data[8];
m_Data[7] = other.m_Da... | true |
9ab0d25ab841e6911e590b58f0891f5cf1a7d02a | C++ | Argons/LeetCode | /Combination_Sum_II.cpp | UTF-8 | 1,518 | 3.453125 | 3 | [] | no_license | // Given a collection of candidate numbers (C) and a target number (T),
// find all unique combinations in C where the candidate numbers sums to T.
// Each number in C may only be used once in the combination.
// Note:
// All numbers (including target) will be positive integers.
// Elements in a combination (a1, a2, ... | true |
e988cd42f52b2e51cc2c9fddb5f3e03050b861c3 | C++ | chiba-lab/measure-project-mac | /Coordinates.h | UTF-8 | 276 | 2.765625 | 3 | [] | no_license | #pragma once
class Coordinates
{
public:
Coordinates();
Coordinates(int new_x, int new_y);
~Coordinates();
int get_x();
int get_y();
void set_x(int new_x);
void set_y(int new_y);
void set_coords(int new_x, int new_y);
private:
int x;
int y;
};
| true |
597fce76cdda2d29dcf2c9471131a0bb8c5d0cf2 | C++ | verri/uatlib | /test/simple.cpp | UTF-8 | 3,292 | 2.84375 | 3 | [
"MIT"
] | permissive | #include <limits>
#include <stdexcept>
#include <uat/simulation.hpp>
#include <cool/indices.hpp>
#include <jules/array/array.hpp>
#include <jules/base/random.hpp>
#include <random>
#include <variant>
using namespace uat;
class my_agent
{
public:
explicit my_agent(mission_t mission) : mission_{std::move(mission)} {... | true |
ec4798c8cae99536906bdd6180b8429eaeb79dc1 | C++ | DogeCoding/Algorithm | /LeetCode/69.cpp | UTF-8 | 466 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>
using namespace std;
int mySqrt(int x) {
if (x == 0) return 0;
double last=0;
double res=1;
whi... | true |
548247a9b8aad8c3d56d3fbabbaba6029c766277 | C++ | ClickHouse/ClickHouse | /src/Common/Throttler.h | UTF-8 | 2,860 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <Common/Throttler_fwd.h>
#include <Common/ProfileEvents.h>
#include <mutex>
#include <memory>
#include <base/sleep.h>
#include <base/types.h>
#include <atomic>
namespace DB
{
/** Allows you to limit the speed of something (in tokens per second) using sleep.
* Implemented using Token Bucket T... | true |
1f88f1051846c6ec2a576d63becf2a2f8dfec880 | C++ | Plypy/Lifestyle | /Rqoj/roundnumber.cpp | GB18030 | 1,369 | 2.953125 | 3 | [] | no_license | // ͳһ
// Ʊʾ0ĸ1ĸĸ
//
#include <iostream>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
class Problem
{
private:
static const int MAXN = 35;
ull st, ed;
ull f[MAXN][MAXN];
public:
void init()
{
f[0][0] = 1;
for (int i = 1; i < MAXN; ++i)
{
... | true |
55cdf231de89888b55be80513de0e8c374872ee3 | C++ | lulyon/poj-archive | /emperorlu/1256/3092220_WA.cc | UTF-8 | 664 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cctype>
using namespace std;
int transfer(char c)
{
if(c<='Z'&&c>='A')
return (c-'A')*2;
else if(c<='z'&&c>='a')
return (c-'A')*2+1;
}
int cmp(char a,char b)
{
int c,d;
c=transfer(a);
d=transfe... | true |
8877bfef61111fc2e3d375c738c1beeb0fc35e0d | C++ | capnemo/distributed-sort | /incl/worker.h | UTF-8 | 1,090 | 2.796875 | 3 | [] | no_license | /***************************************************************************************
FILENAME: worker.h
DESCRIPTION:
Class to run a subTask in an independent thread.
Supervised by an instance of threadPool.
NOTES:
Cannot be copy constructed and cannot be assigned.
************************************... | true |
aad92c1f67a8c2ce88c05d7c22b54fb8e8ce8329 | C++ | Lord-Aman/GFG | /Programming Languages/SimpleCPP/Name.cpp | UTF-8 | 1,044 | 2.53125 | 3 | [] | no_license | #include <simplecpp>
main_program{
turtleSim();
// A
left(60); wait(0.2);
forward(20); wait(0.2);
repeat(3){
forward(20);
right(120);
wait(0.2);
}
right(60);
penUp();
forward(20);
penDown();
right(60);
forward(20);
// M
penUp();
le... | true |
dc3519c7f5d9576794d4fb4d13c3a20f0178b490 | C++ | mcetting/Advanced-Programming-in-C- | /Assignment4/TurnIn/shape.cpp | UTF-8 | 7,444 | 2.546875 | 3 | [] | no_license | // $Id: shape.cpp,v 1.1 2015-07-16 16:47:51-07 - - $
/*
* Name: Michael Ettinger
* ID: mcetting : 1559249
* Email:mcetting@ucsc.edu
* Date: 3/5/2018
*/
#include <typeinfo>
#include <unordered_map>
#include <cmath>
using namespace std;
#include "shape.h"
#include "graphics.h"
#include "util.h"
GLubyte borderColor[3]... | true |
6975ac46d5638844518c0038b706550bf16f88b7 | C++ | Ngiong/tcframe | /include/tcframe/spec/core/StyleConfig.hpp | UTF-8 | 1,871 | 3.09375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <tuple>
#include <utility>
using std::move;
using std::tie;
namespace tcframe {
enum class EvaluationStyle {
BATCH,
INTERACTIVE
};
struct StyleConfig {
friend class StyleConfigBuilder;
public:
static const EvaluationStyle DEFAULT_EVALUATION_STYLE = EvaluationStyle::BATCH;
... | true |
d6d21dd02705e7e17503ac05661b16024bebbca7 | C++ | OperDoc/Problems | /trains/#2/A.cpp | UTF-8 | 345 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main() {
int T;
cin >> T;
for(int t = 0; t < T; t++) {
int n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
if(n + 1 <= 2 * (a + b + c + d)) {
cout << "Yes\n";
} else {
cout << "No\n";
... | true |
200bcd1d287b7151d7aac78c7d6dff5627e5a2fc | C++ | Rishis3D/ElasticImplicitSkinning | /include/ScalarField/fieldfunction.h | UTF-8 | 1,526 | 2.609375 | 3 | [] | no_license | #ifndef FIELDFUNCTION_H
#define FIELDFUNCTION_H
#include <glm/glm.hpp>
#include "Hrbf/hrbf_core.h"
#include "Hrbf/hrbf_phi_funcs.h"
#include "ScalarField/field1d.h"
typedef HRBF_fit<float, 3, Rbf_pow3<float> > DistanceField;
class FieldFunction
{
public:
FieldFunction(glm::mat4 _transform = glm::mat4(1.0f));
... | true |
9feaa485e59672c8aea821b877a54b6e225278ee | C++ | sakshamaggarwal/LEETCODE | /Q165.cpp | UTF-8 | 780 | 2.84375 | 3 | [] | no_license | class Solution {
public:
int compareVersion(string version1, string version2) {
int n1=version1.size();
int n2=version2.size();
long int i=0,j=0,a=0,b=0;
while((i<n1)||(j<n2))
{
a=0,b=0;
while((version1[i]!='.')&&(i<n1))
{... | true |
e520eebc6b4cb898152203ecc435c3981f23986a | C++ | abagali1/ascent | /src/common/StateFieldRegistry.cpp | UTF-8 | 940 | 3.046875 | 3 | [] | no_license | #include "StateFieldRegistry.hpp"
ReadableStateFieldBase* StateFieldRegistry::find_readable_field(const std::string& name) const{
for(ReadableStateFieldBase* r: this->readable_fields){
if(r->get_name() == name)
return r;
}
return nullptr;
}
WriteableStateFieldBase* StateFieldRegistry::... | true |
72166ebb1e468416404472da84033a89f0c7a41f | C++ | JulianSchroden/InputDevices | /src/Encoder.cpp | UTF-8 | 1,854 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* Copyright (c) 2019 Julian Schroden. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for
* full license information.
*/
#include <InputDevices/Encoder.h>
using namespace std::chrono;
using namespace SimpleGPIO;
namespace InputDevices
{
Encoder::Encoder(DigitalI... | true |
a475e710f374f0902bc5244b124f03a7adbffe4b | C++ | namrataparekar/Complex-Numbers | /Complex.h | UTF-8 | 874 | 2.828125 | 3 | [] | no_license |
#ifndef COMPLEX_H
#define COMPLEX_H
#include <iostream>
class Complex{
private:
int r;
int i;
public:
Complex();
Complex(int, int);
void setComplex(int, int);
int getReal() const;
int getImg() const;
/*Operator overloading*/
friend std::ostream& op... | true |
96ebf4c8f4a4c80a387a49e54c0260abe8cd9bbf | C++ | GDxU/mini-fifa | /BackgroundObject.hpp | UTF-8 | 1,277 | 2.671875 | 3 | [] | no_license | #pragma once
#include "Camera.hpp"
#include "Shader.hpp"
#include "ShaderProgram.hpp"
#include "ShaderAttrib.hpp"
#include "Texture.hpp"
#include "Tuple.hpp"
struct BackgroundObject {
gl::ShaderProgram<
gl::VertexShader,
gl::FragmentShader
> program;
gl::VertexArray vao;
gl::Attrib<GL_ARRAY_BUFFER, gl... | true |
15091a098b899654240fc6ff39de5e0fd0b3ba1a | C++ | Ryeoryeon/Algorithm_study | /ryeoryeon/Baekjoon/15988:1,2,3 더하기 3/main.cpp | UTF-8 | 1,107 | 3.171875 | 3 | [] | no_license | //
// main.cpp
// 1, 2, 3 더하기 (3)
//
// Created by 이영현 on 2021/07/03.
// Copyright © 2021 이영현. All rights reserved.
//
#include <iostream>
using namespace std;
int dividedNum;
int tempSaveFinal = 3; // 마지막으로 저장된 수
unsigned long long int divideMemo[1000001] = {0, };
void divideFunc(int num)
{
if(divideMem... | true |
63030097c14afd99faa1d601b6bb164bd0596487 | C++ | mortennobel/kick | /src/kick/math/ray.h | UTF-8 | 884 | 2.78125 | 3 | [] | no_license | //
// ray.h
// KickCPP
//
// Created by Morten Nobel-Jørgensen on 18/12/13.
// Copyright (c) 2013 Morten Nobel-Joergensen. All rights reserved.
//
#pragma once
#include "glm/glm.hpp"
namespace kick {
class Ray {
public:
Ray();
Ray(glm::vec3 origin, glm::vec3 direction);
b... | true |
340407ff368e5d9b839c6961cf0c1b6d112e1d72 | C++ | R-penguins/ICPC-Live-Archive-Solutions | /7952gen.cpp | UTF-8 | 546 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
default_random_engine e(time(0));
uniform_int_distribution<int> nGen(1, 2000);
uniform_int_distribution<long long> numGen(10000000000000000, 1000000000000000000);
for (int i = 0; i < 100; ++i)
{
int n = nGen(e);
cout << n << ... | true |
b7da5168035085647e7963a33fc215a2a00fe642 | C++ | HarrisonHesslink/Harrisons-College-Programs | /tempchanger.cpp | UTF-8 | 1,993 | 4.0625 | 4 | [] | no_license | /*
Program: Change temp from either C to F or F to C
Author: Harrison Hesslink
Date: Jan 9, 2019
Description: Made this in class from the "program" design example.
*/
#include <iostream>
#include <string>
double convertToF(double temp){
return (temp * 1.8)+ 32;
}
double convertToC(double temp){
return (temp - 32) * 1.... | true |
cc48cbbd467f6d66f22b04f25b63baadf36e6faa | C++ | dramenti/jayscript | /jaytools.cpp | UTF-8 | 5,724 | 3.265625 | 3 | [] | no_license | #include "globals.h"
#include<string>
#include<exception>
#include<cstdlib>
#include<iostream>
#include "jaytools.h"
#define ASCII_SHIFT 48
//48 to 57 inclusive is the range of digits in ASCII
bool is_num(std::string s)
{
int i = 0;
if (s.at(i) == '-' && s.size() > 1) i++;
int first_char = (int)s.at(i);
... | true |
43f3c76bd4a8260bbcd801f59baa1e505fa3cafe | C++ | AAAmer91/Evaluator_Stack | /Stack_Class.h | UTF-8 | 392 | 3.5 | 4 | [] | no_license | // A class to represent a stack
#include <iostream>
#include <string>
struct node
{
int data;
struct node *next;
};
// Creating a class STACK
class stack
{
struct node *ptop;
public:
stack() // constructor
{
ptop = NULL;
}
void push(int data); // to insert an element
int pop(); // to ... | true |
61883dbb8b4572d6af0fbb00679a542782de9b37 | C++ | anagorko/zpk2015 | /grupa3/monikao/p2/duz.cpp | UTF-8 | 1,252 | 3.296875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void porownaj(int s1, int s2, string znak, bool &prawda, bool &koniec)
{
if(s1 > s2){
koniec = true;
if(znak == ">" || znak == ">=" || znak == "!=")
prawda = true;
else
prawda = false;
}
if(s1 < s2){
... | true |
1eb8a261475cab8abf3e18b720188cde621c4fcf | C++ | fwsGonzo/LiveUpdate | /liveupdate.hpp | UTF-8 | 8,481 | 2.953125 | 3 | [] | no_license | /**
* Master thesis
* by Alf-Andre Walla 2016-2017
*
**/
#pragma once
#ifndef LIVEUPDATE_HEADER_HPP
#define LIVEUPDATE_HEADER_HPP
#include <net/tcp/connection.hpp>
#include <delegate>
#include <string>
#include <vector>
struct storage_entry;
struct storage_header;
namespace liu
{
struct Storage;
struct Restore;
ty... | true |
b898db66a3fde84d6a2f4e43c5014c3fcaf2d2c2 | C++ | TakuyaKimura/Leetcode | /136 Single Number/136.cpp | UTF-8 | 777 | 3.546875 | 4 | [] | no_license | /*
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
*/
#include <unordered_set>
using namespace std;
// O(1) space, bit manipulation
class Solution2 {
publi... | true |
741e5aa0b1f2abe002cb00442c83b736ee217f20 | C++ | ydykid/leetcode_cpp | /2021m9/17.2.minOperations.cpp | UTF-8 | 551 | 3 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
int minOperations(vector<string>& logs) {
int ans = 0;
for (int i=0; i<logs.size(); i++) {
if (logs[i][0]=='.'&&logs[i][1]=='.') {
if (ans>0){ans--;}
}else if (logs[i][0]!='.'){
... | true |
be6d664e143bd0994553df394a2f05eb970914ac | C++ | marcelsan/PathTracer | /src/light.h | UTF-8 | 1,212 | 2.953125 | 3 | [] | no_license | #ifndef LIGHT_H
#define LIGHT_H
#include <glm/glm.hpp>
#include "color.h"
using namespace glm;
namespace PathTrace {
class Object;
class Light
{
public:
Light(bool d = false, float ip = 1.0f, Object* o = nullptr) : directional(d), ip(ip), obj(o) { }
virtual ~Light() = default;
bool directional;
fl... | true |
11ccf92a37cca9a6a048080c0e906f28d6b22971 | C++ | electro1rage/OJProblemsCodes | /Problem Storage/Dynamic Programming/Masks/2013-2014_neerc_Moscow_B_BlackList.cpp | UTF-8 | 1,466 | 2.78125 | 3 | [] | no_license | /*
reality, be rent!
synapse, break!
Van!shment Th!s World !!
*/
#include <bits/stdc++.h>
using namespace std;
#define EQL 0
#define LESS 1
#define MORE 2
const int MN = 22;
char s[MN];
int a[MN], ans[MN];
int memo[MN][1 << 16][3];
string d = "0123456789ABCDEF";
int get_cmp(int a, int b, int cmp) {
if (cmp != EQL... | true |
0fb58c32350986f359cb0d0c013cb0f8fa0db7bf | C++ | hdhyy/thrust_offer | /src/test36.hpp | UTF-8 | 1,273 | 3.296875 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
/**
* 输入两个链表,找出它们的第一个公共结点。
*
**/
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
class Solution
{
public:
ListNode *FindFirstCommonNode(ListNode *pHead1, ListNode *pHead2)
{
int len1 = 0, len2 = 0;
... | true |
c533441dc54a502d0b60a9b7b2df42a1f7fb746c | C++ | DanylAnikushyn/pseudo3d_game | /weapon_manager.cpp | UTF-8 | 1,105 | 2.875 | 3 | [] | no_license | #include "weapon_manager.h"
#include "appconfig.h"
std::vector<std::string> WeaponManager::pathes_to_weapons = {
"textures/weapon.png"
};
WeaponManager* WeaponManager::instance = nullptr;
WeaponManager::WeaponManager(SDL_Renderer* renderer)
{
for (int i = 0; i < pathes_to_weapons.size(); ++i)
{
weapons.push_bac... | true |
1b3558da523b04ddf2954e1ec2dc3a9d4e3b9771 | C++ | JeffersonLab/QwAnalysis | /Tracking/src/QwHitContainer.cc | UTF-8 | 3,288 | 2.71875 | 3 | [] | no_license | #include "QwHitContainer.h"
ClassImp(QwHitContainer)
#include <boost/bind.hpp>
static struct logical_not_s{
bool operator()(bool a){return !a;};
} logical_not_;
// Iterator methods to obtain subsets of QwHitContainer elements - rakitha (08/2008)
QwHitContainer::iterator QwHitContainer::GetStartOfHits (
EQwRegion... | true |
df351b87227d8cb48f79481a2468dfec2b1f10c0 | C++ | daria-kulikova/base-data-structures | /labs/tests/dynamic_array_test.cpp | UTF-8 | 2,763 | 3.84375 | 4 | [] | no_license | #include <dynamic_array/dynamic_array.h>
#include <exception>
#include <iostream>
#include <sstream>
int main() {
DynamicArray a_def;
std::cout << "Let's create default array. Array is " << a_def << std::endl;
std::cout << "Size is " << a_def.Size() << std::endl;
std::cout << "Let's try to create array0 where ... | true |
7a8698b0b198c08b8f9128a60d8875c261949e60 | C++ | 740299743/cppTest | /cppTest/main.cpp | UTF-8 | 2,116 | 3.5625 | 4 | [] | no_license | //
// main.cpp
// cppTest
//
// Created by pactera on 2/9/15.
// Copyright (c) 2015 pactera. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
class MyClass
{
public:
int x;
int y;
void foo()
{
cout<<"x + y = "<<x+y<<endl;
}
private:
float z;
... | true |
6ca9282a1f53774dab64ad0e2496cae83c7ed223 | C++ | osmanuss/Programming | /Practice/25/C++/25/25/25.cpp | UTF-8 | 3,042 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
std::vector<int> bozoSort(std::vector<int> arr, bool bl = 1)
{
bool check = 1;
while (check)
{
int a = rand() * arr.size() / RAND_MAX;
int b = rand() * arr.size() / RAND_MAX;
int tmp = arr[a];
arr[a] = arr[b];
arr[b] = tmp;
if (b... | true |
df1fc112f00efcaf9b369aa6bbaddabb40b5bb0e | C++ | Wildflowerr/data-structures | /graph/SingleChild.cpp | UTF-8 | 329 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <list>
#include "Graph.h"
using namespace std;
template <typename T> //problem 1a
bool singleChild(Graph<T>& g, const T& a) {
list<T> vertic = g.vertices();
for (T v : vertic) {
if (g.containsEdge(v, a)) {
if (g.neighbours(v).size() > 1) return false;
}
}
return... | true |
fc0b4aed4c94e83179a3a8407fd912a74e8d5a6d | C++ | Vikalp19041999/LeetCode-solutions | /Nearest Exit from Entrance in Maze.cpp | UTF-8 | 1,057 | 2.640625 | 3 | [] | no_license | class Solution {
public:
int nearestExit(vector<vector<char>>& maze, vector<int>& e) {
queue<pair<int,int>> q;
q.push({e[0],e[1]});
int moves = 1;
int rows = maze.size();
int cols = maze[0].size();
vector<vector<int>> offsets = {{0,1}, {1,0}, {0,-1}, {-1,0}};
... | true |
e2616992e2f3e5da2d3706dd6a30c2e536e62578 | C++ | YannisLamp/doc-search | /posting_list.h | UTF-8 | 634 | 2.84375 | 3 | [] | no_license | #ifndef SYSPRO_PROJECT_1_POSTINGLIST_H
#define SYSPRO_PROJECT_1_POSTINGLIST_H
#include "posting.h"
/*
* Main PostingList class, a single-linked list
* Works as a head
* It points to a Posting object (the first one)
* To make inserts faster, it also points to the last Posting
* Handles all main tasks of the Posti... | true |
c8b6f2140dc5e7c2f0e927c97f85ff2e65d54c11 | C++ | irvifa/online-judges | /cheatsheets/Fenwick.cpp | UTF-8 | 290 | 2.828125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct Fenwick {
vector<int> f;
Fenwick(int n) : f(n) {}
void update(int k, int v) {
for(k++; k<f.size(); k+= k & -k)
f[k] ^= v;
}
int query(int k) {
int res = 0;
for(k++; k>0; k-= k & -k)
res ^= f[k];
return res;
}
};
| true |
1f11e02db58dc55bae9a58b722206f72108745e8 | C++ | AntanasJurk/Projects | /C++/OpenGL Sphere/Project1/main.cpp | UTF-8 | 4,072 | 2.640625 | 3 | [] | no_license | #include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define X .525731112119133606
#define Z .850650808352039932
int n;
static GLfloat vdata[12][3] = {
{ -X, 0.0, Z }, { X, 0.0, Z }, { -X, 0.0, -Z }, { X, 0.0, -Z },
{ 0.0, Z, X }, { 0.0, Z, -X }, { 0.0, -Z, X }, { 0.0, -Z, -X },
{ Z, X,... | true |
651ffae81bf0a30a4216446ec512f75eb571519f | C++ | julie-yc/FlightBookingSystem | /FlightBookingSystem/FlightBookingSystem.cpp | UTF-8 | 4,216 | 3.53125 | 4 | [] | no_license | // FlightBookingSystem.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include "Database.h"
using namespace std;
using namespace FlightBookingSystem;
int displayMenu();
void flightDetailQuery(Database& db);
void getTicketInfo(Database& d... | true |
7aebdfd40ad78e414baeda5d9418a98f972bc0f6 | C++ | Aznad-Maruf/Algo | /General/shuntingYardAlgorithm.cpp | UTF-8 | 2,363 | 2.875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
string stInfix, stPostfix;
stack < char > stk;
map < char, int > mp;
double evaluateIt( string st ){
int a_i, b_i, n s = st.size();
stack < char > stk1, stk2;
for( a_i = s-1; a_i>=0; a_i-- ) stk2.push( st[a_i] );
while( !stk2.empty() ){
... | true |
6a1757abbfe25efcf94fa173a556d59d5644a4a0 | C++ | dreamiond/LeetCode | /leetcode_35.cpp | UTF-8 | 869 | 3.484375 | 3 | [] | no_license | //leetcode35:Search Insert Position
/*
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Example 1:
Input: [1,3,5,6], 5
Output: 2
Example 2:
Input: [1,3,5,6], 2
Output:... | true |
a685734682a45c064f69cbafc7178a21a226ef48 | C++ | iguessthislldo/cmake-build-extension | /example/src/mymath.h | UTF-8 | 907 | 3.5 | 4 | [
"MIT"
] | permissive | #ifndef MYMATH_H
#define MYMATH_H
#include <vector>
namespace mymath {
/**
* Perform the inner product between two 1D vectors.
*
* @param vector1 The first vector.
* @param vector2 The second vector.
* @throws If the vectors sizes do not match.
* @return The double product of the in... | true |
dd54a15cde50fb2af6ec1a49a4f989951c840793 | C++ | PurbayanNC/Far_Behind | /Codebook/code/Data_Structures/SegmentTree.cpp | UTF-8 | 1,025 | 3.09375 | 3 | [
"MIT"
] | permissive | /*All arrays are 0 indexed. call bld(0,n-1,1)
upd(0,n-1,1,x,y,val) -> increase [x,y] by val
sum(0,n-1,1,x,y) -> sum [x,y]
array of size N -> segment tree of size 4*N*/
ll arr[N],st[N<<2], lz[N<<2];
void ppgt(ll l, ll r,ll id){
if(l==r) return;
ll m=l+r>>1;
lz[id*2]+=lz[id];lz[id<<1|1]+=lz[id];
st[id << 1] += (m - l... | true |
1aef8c3a51c823d64285b70c0d642aaf9ce119a8 | C++ | ChandlorRatcliffe/Computer-Graphics--Group-Project-2 | /CGProject2/ShearYMatrix.cpp | UTF-8 | 1,195 | 3.359375 | 3 | [] | no_license | #include "ShearYMatrix.h"
#include "CompositeMatrix.h"
/**
* ShearYMatrix constructs a homogeneous linear transformation matrix
* intended to shear a 3 vector in the y direction with respect to the x-axis
* by a factor of sy.
*/
ShearYMatrix::ShearYMatrix(float sy) {
this->matrix[0][0] = 1.0;
this->matrix[0][1] ... | true |
27c8b11282d68f98aab42354b191d32109cd6737 | C++ | rajkumawat01/CSES-Problem-Set | /2.missing.cpp | UTF-8 | 756 | 3.515625 | 4 | [] | no_license | /*
You are given all numbers between 1,2,…,n except one.
Your task is to find the missing number.
->Input
The first input line contains an integer n.
The second line contains n−1 numbers.
Each number is distinct and between 1 and n (inclusive).
->Output
Print the missing ... | true |
256730bbcb4b62475672b980449a22e611324baa | C++ | ill/illEngine | /Graphics/serial/BitmapFont.cpp | UTF-8 | 15,005 | 2.796875 | 3 | [] | no_license | #include "Graphics/serial/BitmapFont.h"
#include "Graphics/GraphicsBackend.h"
#include "FileSystem/FileSystem.h"
#include "FileSystem/File.h"
#include "Logging/logging.h"
const int32_t HEADER = 0x424D4603; //"BMF" followed by format specifier 3 in big endian form
namespace illGraphics {
glm::vec2 BitmapFont::getP... | true |
7d8b8e0156a0b6989a82818d057ecf220e713b42 | C++ | ha271923/TestCpp | /testdome/cpp/sum3.cpp | UTF-8 | 1,862 | 4.09375 | 4 | [] | no_license | /*
Question: TestDome - Sum3
Solution by Arash Partow 2014
Design a data structure that can EFFICIENTLY handle two types of
requests: add a list of elements at the end of the internal list, and
answer whether there is a sum of any three consecutive elements in the
internal list equal to the given sum... | true |
30e631fefcc2dba935fab53e7739bb35704265d3 | C++ | jaankaup/my_opencl_project | /src/OpenCL/GPU_Device.h | UTF-8 | 6,532 | 2.53125 | 3 | [] | no_license | #ifndef GPU_DEVICE_H
#define GPU_DEVICE_H
//#define __CL_ENABLE_EXCEPTIONS
//#define CL_HPP_TARGET_OPENCL_VERSION 200
#include <vector>
#include <unordered_map>
#include <memory>
#include <GL/glew.h>
//#include <CL/cl2.hpp>
#include <CL/cl.hpp>
#include <CL/cl_gl.h>
#include "../Utils/log.h"
#include "CL_Helper.h"
c... | true |
044eed2793357a79a52eff45ec3440e4330f3326 | C++ | xcgj/QT_Lesson | /0202InputToSaveToFile/writefile.cpp | UTF-8 | 1,257 | 3.03125 | 3 | [] | no_license | #include "writefile.h"
#include "data.h"
#include <QDebug>
#include <QFile>
#include <QDataStream>
writefile::writefile(QWidget *parent) : QWidget(parent)
{
name = new QLineEdit(this);
name->move(10, 40);
name->setPlaceholderText("请输入姓名");
age = new QLineEdit(this);
age->move(10, 110)... | true |
b68893bff44ca45690318cbe5807638d3681f692 | C++ | 4LG0R4/amazing-code | /4963/HoduGwaja.cpp | UHC | 1,726 | 3.40625 | 3 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
int w, h; // ,
int map[50][50]; // ü
bool visited[50][50]; // ʿ ϱ?
// ü
typedef struct { // ü
int dx, dy; // x, y
}dir;
dir direction[8] = { {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1} }; //ʺ ð
void VisitIsland(int y, int x) {
... | true |
224528615aa7148f16a3a8fad6bbfcd0429f5261 | C++ | ly774508966/GameRender3D | /lonely3D/Vector3.h | UTF-8 | 4,748 | 3.21875 | 3 | [] | no_license | #pragma once
#ifndef __Vector3_H__
#define __Vector3_H__
#include "MathTools.h"
class Vector2;
class Vector4;
class Vector3
{
public:
Vector3();
Vector3(float32 _x, float32 _y, float32 _z) :x(_x), y(_y), z(_z) {}
Vector3(const Vector2& inVec);
Vector3(const Vector3& inVec);
Vector3(const Vector4&... | true |
10250501518371f2538e960407ef9828dd2ccc2a | C++ | gelatinstudios/Shmetris | /tetrominos.cpp | UTF-8 | 3,768 | 2.734375 | 3 | [] | no_license |
#include <SDL2/SDL.h>
#include "shmetris_math.hpp"
#include "tetrominos.hpp"
const SDL_Point I[] = {{5, -1}, {3, -1}, {4, -1}, {6, -1}};
const SDL_Point O[] = {{4, -2}, {5, -2}, {4, -1}, {5, -1}};
const SDL_Point T[] = {{4, -1}, {3, -1}, {5, -1}, {4, -2}};
const SDL_Point J[] = {{4, -1}, {5, -1}, {3, -1}, {3, -2}};
c... | true |
8522bd7a9a5d70a985715774f0fee083117f5260 | C++ | huangruikai/ATM | /mian.cpp | UTF-8 | 1,862 | 3.34375 | 3 | [] | no_license | #include <iostream>
using namespace std;
/*用户类*/
class people {
protected:
int account_number;
int password;
public:
people(int n, int m) {
account_number = n;
password = m;
}
int get_account_number(void);
int get_password(void);
private:
int i;
};
int people::get_account_number(void) {
... | true |
c25dbe37de48499b13eb535abff44fb9b857da01 | C++ | A-STAR0/hackerrank-solutions-1 | /Algorithms/Strings/alternating-characters.cpp | UTF-8 | 558 | 2.828125 | 3 | [
"MIT"
] | permissive | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int main() {
int t; cin >> t;
vector<string> inputs(t);
for (int i = 0; i < t; i++)
cin >> inputs[i];
for (int i = 0; i < t; i++) {
int charsT... | true |
694bb0b27f5a68e2093d68f8d9715fb7b9faa6bf | C++ | Maxai2/CharArray | /CharArray/CharArray/Source.cpp | UTF-8 | 8,316 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <Windows.h>
#include <stdio.h>
#include <ctype.h>
#include "Functions.h"
#include "CharLibrary.h"
#define size 255
// const int size = 255;
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
using namespace std;
int main()
{
/*1. Дана строка символов. Заменить в ней все пробелы на табуляции
... | true |
af7e95bc9298cb0b5a8e81c14818133b7d3a01f5 | C++ | a-colombo/Identikeep | /Plugins/Linux/Mem/Mem.cpp | UTF-8 | 1,830 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include "Utils.h"
#include "multire.h"
#include "Mem.h"
// Logging
#include "plog/Log.h"
#define MEM_INFO_FILE "/proc/meminfo"
bool MEM::Collect(int argc, char *argv[])
{
bool is_ok=true;
LOG_VERBOSE << "Parsing " << this->Name() << " info...";
/* Open /proc... | true |
c031173a93912902025c5a6cf912c47bcbbadcdf | C++ | XingXingXudong/LeetCodePractice | /11_strings/implement_strstr_28.cpp | UTF-8 | 1,735 | 3.4375 | 3 | [] | no_license | // https://leetcode.com/problems/implement-strstr/
#include <string>
#include <gtest/gtest.h>
void calNext(const std::string& needle, std::vector<int>& next) {
for (int j = 1, p = -1; j < (int)needle.length(); ++j) {
while (p > - 1 && needle[p+1] != needle[j]) {
p = next[p]; // 如果下一位置不同,往前回溯
... | true |
106346d599b44ac96771616bc82878753be86959 | C++ | Saptarshi-Nag189/Data-Structure-in-C- | /arr_rev_using_stack.cpp | UTF-8 | 302 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include "stack_class.cpp"
using namespace std;
int main()
{
class Stack s;
int arr[]={1,2,3,4,5};
for (int i = 0; i < 5; i++)
{
s.push(arr[i]);
}
for (int i = 0; i < 5; i++)
{
arr[i] = s.pop();
}
return 0;
} | true |
0e2e675605f668fbddb39a5bd0374ad934921951 | C++ | huyquynh2302/Game | /gamedev-intro-tutorials-master/02-Sprite/Enemy1.cpp | UTF-8 | 1,752 | 2.609375 | 3 | [] | no_license | #include "Game.h"
#include "Enemy1.h"
//CEnemy1::CEnemy1(float x, float y, float vx) :CEnemy(x, y)
//{
// this->vx = vx;
//};
//CEnemy1::CEnemy1()
//{
// this->x = ENEMY_X;
// this->y = ENEMY_Y;
// this->vx = ENEMY_WALKING_SPEED;
// this->vy = 0.0f;
//}
void CEnemy1::Update(DWORD dt)
{
CEnemy::GetVX();
CEnemy::Upda... | true |
c25b3517dce921c1dc039f185cec80a1c11ab005 | C++ | RajasekharMugada/cpp_programming | /02_template_function.cpp | UTF-8 | 343 | 3.609375 | 4 | [] | no_license | /*
@author: Rajasekhar Mugada
@brief : template function/ generic function
*/
#include <iostream>
using namespace std;
template <class T>
T max_num(T a, T b)
{
if(a > b)
return a;
else
return b;
}
int main()
{
cout << max_num(1, 2) << endl;
cout << max_num(1.0f, 2.... | true |
274ee2f4f98bc1cb989823f66b5218fb9232207d | C++ | shunail2029/algorithm | /sort/radix_sort.cpp | UTF-8 | 2,451 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <new>
#include <typeinfo>
template<class RandomAccessIterator>
void radix_sort(RandomAccessIterator first, RandomAccessIterator last, long long digit = 1) {
if (first == last) {
return;
}
auto val = *first;
using type = decltype(val);
if (typeid(val) != typeid... | true |
800b603c2fa3985ce846fec9204fc58c83605ff9 | C++ | Paul-Kummer/angleDetection | /angleProject/getAngleModule/functions/functions.cpp | UTF-8 | 8,269 | 2.890625 | 3 | [] | no_license | #include "..\prototypes.h"
#include "..\escapi3\escapi.h"
//for purpose of line drawing, the bottom left of the image is (0,0)
//draw x and y are both needed for cases of vertical and horizxontal lines
void makeLine(imageArr& pixArr, float yIntercept, float slope, Pixel lineColor, int lineSize)
{
int y... | true |
a642d83852a72fcabbe80af4289a9c9abcb93608 | C++ | seoushi/Mini-Net | /samples/Client/main.cpp | UTF-8 | 1,169 | 3.046875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | /*
* File: main.cpp
* Author: sean
*
* Created on January 13, 2011, 7:29 PM
*/
#include <iostream>
#include "Connection.hpp"
#include "Message.hpp"
int main(int argc, char** argv)
{
Connection con;
if(!con.connect("127.0.0.1", 7777))
{
std::cout << "could not connect to server, exiting" ... | true |
ca684aaa4fcced25e730117528218b84476ab654 | C++ | EdCornejo/ImitateKRF | /Classes/Towers/BarrackTower.cpp | UTF-8 | 620 | 2.734375 | 3 | [] | no_license | #include "BarrackTower.h"
const float BarrackTower::kBarrackTowerLv1Scope = 150.0f;
const float BarrackTower::kBarrackTowerLv2Scope = 200.0f;
const float BarrackTower::kBarrackTowerLv3Scope = 250.0f;
BarrackTower::BarrackTower(): BaseTower(
TowerType::BARRACK, // type
"Barrack Tower", // name
1, // level
kBarrac... | true |
2d73f6448b4b1ba19af10b01ba2ffd1c1800299d | C++ | iCodeIN/code-forces | /427e/main.cpp | UTF-8 | 1,397 | 2.859375 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
using namespace std;
#define BUF_LEN 1048576
uint8_t* buf;
uint32_t cur, len;
void fillBuf() {
cur = 0;
len = fread(buf, sizeof(uint8_t), BUF_LEN, stdin);
}
void initBuf() {
buf = (uint8_t*) calloc(BUF_LEN, sizeof(uint8_t));
f... | true |
3c190006219a295a61d2e5d4f0aa810898c8d91f | C++ | naveen-ku/Competitive-Programming | /contests/codechef/8-2020-challange/ac4-w.cpp | UTF-8 | 794 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void smallestKMP() {
// vector<string> s;
// vector<string> p;
// string input1, input2;
// cin >> input1;
// cin >> input2;
// s.push_back(input1);
// p.push_back(input2);
string s;
string p;
cin >> s;
cin >> p;
map<int, ch... | true |
73bf7ae2cbb1c2ed626277e5dd9f698f8269a517 | C++ | gabrielkoyama/getting_started_with_Cplusplus | /a.cpp | UTF-8 | 1,095 | 3.25 | 3 | [] | no_license | // lista de exercicios http://www.inf.pucrs.br/~pinho/PRGSWB/Exercicios/Introducao/Introducao.html
#include <iostream>
using namespace std;
void ex1(){
int matriz[2][2];
int menor = 0;
//poppulando a matriz
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
cout << "matriz " << i << " " << j << ": "... | true |
2700b396c9365544d708717dab91ab954e2c542d | C++ | WojciechMula/random-binary-trees | /cpp/src/random.cpp | UTF-8 | 284 | 2.515625 | 3 | [] | no_license | #include "random.h"
namespace lcg {
static uint32_t state = 0;
const uint32_t a = 1103515245;
const uint32_t c = 12345;
uint32_t init(uint32_t seed) {
const uint32_t prev = state;
state = seed;
return prev;
}
uint32_t next() {
state = a * state + c;
return state;
}
}
| true |
3fa594b652517c9dabcd2dbc9b68b93fd44cc981 | C++ | jwalter229/CS3304 | /HW1_Quad/main.cpp | UTF-8 | 2,723 | 3.6875 | 4 | [] | no_license | #include "Quad.h"
#include <iostream>
#include <string>
using namespace std;
//testing Getters
bool Test_Gets()
{
//Declare Objects
//Passing 1,2,3 as parameters
Quad test(1,2,3);
bool passed = true;
//GetA Test
if(test.GetA() != 1)
{
cout << "Get A failed" << endl;
... | true |
7ef31970e02bd1be6568bf68cb349e7e91ee6b5b | C++ | Azhao1993/Leetcode | /AnswerByCpp/0683_K Empty Slots.cpp | UTF-8 | 1,712 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
/*
683. K 个空花盆
花园里有 N 个花盆,每个花盆里都有一朵花。这 N 朵花会在 N 天内依次开放,每天有且仅有一朵花会开放并且会一直盛开下去。
给定一个数组 flowers 包含从 1 到 N 的数字,每个数字表示在那一天开放的花所在的花盆编号。
例如, flowers[i] = x 表示在第 i 天盛开的花在第 x 个花盆中,i 和 x 都在 1 到 N 的范围内。
给你一个整数 k,请你输出在哪一天恰好有两朵盛开的花,他们中间间... | true |
90c25a5ae78bae371d8994110f480331afcc7a27 | C++ | mallius/CppPrimer | /ch16/1624ex.cpp | UTF-8 | 281 | 3.25 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
template <typename T>
int compare(const T& v1, const T& v2)
{
if(v1 < v2)
return -1;
if(v2 < v1)
return 1;
return 0;
}
int main(void)
{
short si = 1;
int i = 2;
cout << compare(static_cast<int>(si), i) << endl;
return 0;
}
| true |
f0025de6cc2e312eb4fe7a564c127fe8bb6e99bc | C++ | Svengali/cblib | /profiler.h | UTF-8 | 4,778 | 2.59375 | 3 | [
"Zlib"
] | permissive | #pragma once
#include "Base.h"
#include "Timer.h"
#include "cblib_config.h"
/*****************
In-game real-time profiler
Reasonably light-weight when in Disabled mode.
Clients should primarily use the PROFILE macro, like :
void func()
{
PROFILE(func);
... do stuff ...
}
-------------------------------------
... | true |
dc2c8012b7b8286986dab49a8af95bf7b1dbf301 | C++ | robertgilmartin/Master | /ModuleWindow.cpp | UTF-8 | 1,854 | 2.921875 | 3 | [
"MIT"
] | permissive | #include "Globals.h"
#include "Application.h"
#include "ModuleWindow.h"
#include "MemoryLeaks.h"
ModuleWindow::ModuleWindow()
{
}
// Destructor
ModuleWindow::~ModuleWindow()
{
}
// Called before render is available
bool ModuleWindow::Init()
{
LOG("Init SDL window & surface");
ret = true;
if(SDL_Init(SDL_INIT_VID... | true |
f8f57d289157902b4856cbddd8e66e8033c13a25 | C++ | lsiddiqsunny/programming-contest | /Code chef Long/December/1.cpp | UTF-8 | 279 | 2.671875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,r;
cin>>n>>r;
while(n--){
int x;
cin>>x;
if(x>=r){
cout<<"Good boi"<<endl;
}
else{
cout<<"Bad boi"<<endl;
}
}
}
| true |
2accd952346aa11f4bff6c6b0ed129a7ba85da42 | C++ | dlufy/SPOJSOLUTION | /SPOJSOLUTION/PIGBANK.cpp | UTF-8 | 624 | 2.625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define MAX 1000000000
int main()
{
int t;
cin>>t;
while(t--)
{
int e,f;
cin>>e>>f;
int n;
cin>>n;
vector<pair<int,int> > coin(n+5);
for(int i=0;i<n;i++)
{
int x,y;
cin>>x>>y;
coin[i].first=y;
coin[i].second=x;
}
int dp[f+10];
dp[0]=0;
for... | true |
66b06cdae2ad6f57a1f9209e2f3ed3ffc449319f | C++ | DamianBocanegra/TextAdventure | /test.cpp | UTF-8 | 934 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include "item.h"
#include "inventory.h"
#include "room.h"
using namespace std;
int main()
{
inventory inv;
Room rm = Room("test room", 1,0,0,0,0);
inv.add(item("Potion", 1, 1));
inv.add(item("Elixir", 1, 2));
inv.add(item("Ether", 1, 3));
inv.add(item("Revive", 1, 4));
... | true |
9c010ba8baa6bf772ad3d0756d949dad6461253e | C++ | fanll4523/algorithms | /Part13算法竞赛宝典/第一部资源包/附录/字符串数字转整数.cpp | GB18030 | 225 | 2.734375 | 3 | [
"LicenseRef-scancode-mulanpsl-1.0-en",
"MulanPSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //ַתֵ
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
using namespace std;
int main()
{
char s1[50];
int a;
gets(s1);
a=atof(s1);
cout<<a;
}
| true |
84a2c1367d673eb1d7254af0927064b5fa40aacf | C++ | HarVi0/reszta | /main.cpp | UTF-8 | 797 | 3.03125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
float nominal[15]= {50000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};
float reszta;
int liczba_banknotow, i=0;
cout << "Podaj reszte: ";
cin >> reszta;
reszta = reszta * 100;
while (reszta>0)
{
i... | true |