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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
79a671892ae582c540cae013af16f74592fc4626 | C++ | keyto123/whatever | /TheGame/player.cpp | UTF-8 | 1,490 | 2.796875 | 3 | [] | no_license | #include "player.h"
#include "utils.h"
Player::Player(const char* name, Stats stats, int job = 0) : Job(job), Alive(name, stats) {
Player::job = job;
}
int Player::exp_up(int exp_gain) {
if(total_exp == MAX_EXP) {
return 0;
}
total_exp += exp_gain;
if(stats.level == MAX_LEVEL) {
return 0;
}
if(stats.exp... | true |
d1fe070ea3bafca53655042cea8c8d18f85cebd6 | C++ | Maklowic/Tic-Tac-Toe-with-AI | /tic tac toe vol. 2/bot.h | UTF-8 | 2,349 | 3.234375 | 3 | [] | no_license | #pragma once
#include <vector>
#include "board.h"
struct botPlay
{
botPlay() {}
botPlay(int Score) : score(Score){}
int x;
int y;
int score;
};
class Bot {
public:
// Initializes the Bot player
void init(int botPlayer);
// Performs the Bot move
void performMove(Board& board)... | true |
8e0820a448c3343b4abd968c57941078e2d0d38b | C++ | pdpreez/SwallowEngine | /Swallow/src/Swallow/Core/Timestep.cpp | UTF-8 | 354 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #include "swpch.hpp"
#include "Timestep.hpp"
namespace Swallow {
Timestep::Timestep(float time)
:m_Time(time)
{
}
Timestep::~Timestep(){}
Timestep::Timestep(const Timestep& cpy)
{
if (this != &cpy)
*this = cpy;
}
Timestep &Timestep::operator=(const Timestep& rhs)
{
if (this != &rhs)
this->m_Time ... | true |
700520205a6f3472af1d1ace89f0559e94f87cab | C++ | solareenlo/42cpp-module-03 | /ex02/main.cpp | UTF-8 | 1,857 | 2.53125 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | true |
6e1122a91a2a04e8686b400c2cc7c5ffbf0be980 | C++ | CLDP/USACO-Training | /Section-2/lamps.cpp | UTF-8 | 4,334 | 2.703125 | 3 | [] | no_license | /*
ID: CHN
PROG: lamps
LANG: C++
*/
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int n, c;
vector<string> ans[16];
vector<int> on, off;
bool lamp[101];
bool check(string s) {
for (int i = 0; i < on.size(); +... | true |
3e199b2f4fa7514404f7eaa776be383e782772f0 | C++ | ashleyh/kakoune | /src/word_db.hh | UTF-8 | 1,013 | 2.703125 | 3 | [
"Unlicense"
] | permissive | #ifndef word_db_hh_INCLUDED
#define word_db_hh_INCLUDED
#include "buffer.hh"
#include <set>
namespace Kakoune
{
class String;
// maintain a database of words available in a buffer
class WordDB : public BufferChangeListener_AutoRegister
{
public:
WordDB(const Buffer& buffer);
void on_insert(const Buffer& b... | true |
a5b0c6490923d632173e06beb5d2965322b43202 | C++ | jiaxin96/MyTemplate | /c++/最小生成树.cpp | UTF-8 | 1,991 | 3.03125 | 3 | [] | no_license | #include<iostream>
#include<fstream>
using namespace std;
#define MAX 100
#define MAXCOST 0x7fffffff
int graph[MAX][MAX];
int prim(int graph[][MAX], int n)
{
int lowcost[MAX]; // 记录到已经找到的子图的最短距离 0为找到
int mst[MAX]; // 记录最小距离的终点 0为在子图中
int i, j, min, minid, sum = 0;
mst[1] = 0;
... | true |
dbf06bbcf21a883c63bbdac17fa2cfc09194c0e5 | C++ | gasburner/OJ | /niuke/3.cpp | UTF-8 | 1,112 | 3.65625 | 4 | [] | no_license | /*请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。*/
class Solution {
public:
void replaceSpace(char *str,int length) {
if (str==nullptr||length<=0)
{return ;}
int orignalLength = 0;
int numberOfBlank = 0;
int i = 0;
while (str[i]!='\0')
... | true |
812f0e8c0da9821eaa05da751599018d0a565c46 | C++ | trslater/cpp | /cpp-essential-training/Chap04/struct.cpp | UTF-8 | 313 | 2.90625 | 3 | [] | no_license | // struct.cpp by Bill Weinman [bw.org]
// updated 2022-06-16
#include <fmt/core.h>
#include <iostream>
using fmt::format;
using std::cout;
struct S {
int i {};
double d {};
const char * s {};
};
int main() {
S s1 { 3, 47.9, "string one" };
cout << format("s1: {}, {}, {}\n", s1.i, s1.d, s1.s);
}
| true |
705044fde6a71242f1318b296f15e40ac4a6cd3d | C++ | yidansun0112/Exchange-Matching-Engine | /docker-deploy/src/database.cpp | UTF-8 | 12,970 | 2.71875 | 3 | [] | no_license | #include "database.hpp"
pthread_mutex_t dbmutex = PTHREAD_MUTEX_INITIALIZER;
int Database::trans_id=0;
void Database::openDatabase(){
C = new connection("dbname=exchange user=postgres password=passw0rd host=db port=5432");
if (C->is_open()) {
cout << "Opened database successfully: " << C->dbname() << endl;
}... | true |
fb72dd2cdc2ea625508378fc0596c1fc8ead451d | C++ | milindbhavsar/Leetcode-Templates-and-Examples | /code/0897. Increasing Order Search Tree.h | UTF-8 | 1,345 | 3.5625 | 4 | [] | no_license | /*
Given a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child.
Example 1:
Input: [5,3,6,2,4,null,8,1,null,null,null,7,9]
5
/ \
3 6
/ \ \
2 4 8
/ / \
1 ... | true |
5a6d96c1b9e5088ec5712124bb4e6254ba272f2c | C++ | Tingwei-Jen/SLAM_Project02 | /include/myslam/mappoint.h | UTF-8 | 1,730 | 2.703125 | 3 | [] | no_license | #ifndef MAPPOINT_H
#define MAPPOINT_H
#include "myslam/common_include.h"
#include "myslam/frame.h"
namespace myslam
{
// forward declare :
//if there is any change in Frame.h or Frame.cpp, mappoint.cpp will not compile.
//class Frame;
class MapPoint
{
public:
typedef std::shared_ptr<MapPoint> Ptr;
unsigned long ... | true |
60e8bcb8fb17695e3c8696c2a12ef3dd3f8d9462 | C++ | sholsapp/gallocy | /test/test_singleton.cpp | UTF-8 | 2,117 | 3 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gtest/gtest.h"
#include "libgallocy.h"
class SingletonHeapTests: public ::testing::Test {
protected:
virtual void TearDown() {
__reset_memory_allocator();
}
};
TEST_F(SingletonHeapTests, ZeroMalloc) {
void* ptr = NULL;
ptr = ... | true |
ee5f69f4519b0919543b46b6d4c5d1539c692bc9 | C++ | ReFantasy/IPL | /sample/ch09/P424F9_29.cpp | UTF-8 | 2,389 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include "opencv2/opencv.hpp"
#include "utility/utility.hpp"
#include "algorithm/algorithm.hpp"
using namespace std;
using namespace cv;
bool IsSame(const Mat A, const Mat B)
{
Mat dif = A - B;
for (auto it = dif.begin<uchar>(); it != dif.end<uchar>(); it++)
{
if (*it != 0)
return f... | true |
61283475dad033e939c72c1d7b8c49f456691ab2 | C++ | dmin0211/Codeforces-Round-719 | /1520A.cpp | UTF-8 | 896 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cstring>
using namespace std;
bool visit[30];
int main(){
int t=0;
int number_size=0;
cin>>t;
for (int i = 0; i < t; ++i) {
cin>>number_size;
memset(visit,false,30);
for (int j = 0; j < number_size; ++j) {
char tmp,pr... | true |
7dbaceff320dbca5631bbaa069dd4895b22a5ca5 | C++ | adityanjr/code-DS-ALGO | /CodeForces/Complete/700-799/797A-kFactorization.cpp | UTF-8 | 534 | 2.9375 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <vector>
int main(){
long n; int k; scanf("%ld %d", &n, &k);
std::vector<long> factors;
long div(2);
while(n > 1){
if(n % div == 0){factors.push_back(div); n /= div;}
else{++div;}
}
if(factors.size() < k){puts("-1");}
else{
for(int p = 0;... | true |
07766b483bc536a4d7cb2ddad1577f7c741f1f95 | C++ | firewood/topcoder | /atcoder/abc_207/e.cpp | UTF-8 | 1,821 | 2.53125 | 3 | [] | no_license | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;
static const int64_t MOD = 1000000007;
struct modint {
int64_t x;
modint() { }
modint(int _x) :... | true |
d86ad5f701c459423e314aef6f4e061dc899093c | C++ | BenjaminSchulte/fma | /fma65816/include/lang/InstructionArguments.hpp | UTF-8 | 5,207 | 2.640625 | 3 | [
"MIT"
] | permissive | #ifndef __FMA65816_LANG_INSTRUCTIONARGUMENTS_H__
#define __FMA65816_LANG_INSTRUCTIONARGUMENTS_H__
#include <fma/interpret/ParameterList.hpp>
#include <fma/types/Base.hpp>
#include <fma/symbol/Reference.hpp>
#include <fma/assem/Operand.hpp>
#include <fma/Project.hpp>
namespace FMA65816 {
namespace lang {
struct Instr... | true |
8bdae4056cd370ccdb3de60848a79a4bbf02ce02 | C++ | 74kw/ICPP | /CPP_07_soubory_pretezovani/Main.cpp | UTF-8 | 4,108 | 2.90625 | 3 | [] | no_license | #include "Person.h"
#include <fstream>
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
static void WriteString(std::ofstream& output, const std::string& obj) {
int stringLength = obj.length();
output.write((const char*)&stringLength, sizeof(stringLength));
output.write(obj.c_str(), stringLength)... | true |
d132136686d56cc865781e923c7d7ea52a9a1bd0 | C++ | pconrad/old_pconrad_cs16 | /14F/lect/10.13/argvArgc/argvArgcDemo.cpp | UTF-8 | 302 | 2.90625 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include <cmath> // #include <math.h> is what we would write in a C program
#include <cstdlib> // for atof
int main(int argc, char *argv[]) {
double x = atof(argv[1]);
cout << "x=" << x << endl;
cout << "sqrt(x)=" << sqrt(x) << endl;
return 0;
}
| true |
bb823bc22b7b1d123efcf85d7740b1a6efb79a61 | C++ | fanyazhi/Scientific-Computing | /CompactSPICE/src/circuit.cpp | UTF-8 | 1,843 | 2.625 | 3 | [] | no_license | /*
* circuit.cpp
* ODESolver
* This file contains functions for RC circuit and CS amplifier
*
* Created by Yijia Chen (yc2366) and Yazhi Fan (yf92) on 4/18/18.
* Copyright © 2018 Yijia and Yazhi. All rights reserved.
*
*/
#include "circuit.h"
using namespace std;
using namespace Eigen;
// --------------... | true |
9a73c7cd12f3c3bd46bf2781308af15d738c3034 | C++ | alissastanderwick/OpenKODE-Framework | /01_Develop/libXMCocos2D-v3/Source/3d/StringTool.cpp | GB18030 | 4,023 | 2.75 | 3 | [
"MIT"
] | permissive | #include "3d/StringTool.h"
namespace cocos3d
{
StringTool::StringTool()
{
}
StringTool::~StringTool()
{
}
std::vector<std::string> StringTool::StringSplitByString(const std::string &str, const std::string &strKey, int IgnoreCase /* = false */)
{
std::vector<std::string> Result;
const char *cpPos = NULL... | true |
f34a5aebcce2a9a15303018c9f145722202c2ceb | C++ | YosenChen/CodePractice | /OJLeetCode/TwoSum_sol1_map.cpp | UTF-8 | 1,163 | 2.8125 | 3 | [] | no_license | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
map<int, int> M;
map<int, int>::iterator it;
vector<int> res;
for (int i=0; i<nums.size(); i++) // O(NlogN)
{
M[nums[i]] = i; // std::map::operator[], Complexity: Logarithmic in size.
... | true |
a7c3db311851308ceddc6343b6ad5cbb417fc58a | C++ | MaraPapMann/pprbf | /src/benchmark_arith_innerproduct/common/innerproduct.cpp | UTF-8 | 2,408 | 2.5625 | 3 | [] | no_license | #include "innerproduct.h"
int32_t test_inner_product_circuit(e_role role, char * address, uint16_t port, seclvl seclvl,uint32_t nvals,
uint32_t bitlen, uint32_t nthreads, e_mt_gen_alg mt_alg,e_sharing sharing, uint32_t r, uint32_t c)
{
// Initialization.
ABYParty * party = new ABYParty(role, address, por... | true |
3512ffd9a798c44cae53af99d0464879eb243d46 | C++ | tanmaygandhi2/apccodes | /Queuearray.cpp | UTF-8 | 473 | 2.84375 | 3 | [] | no_license | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int backind=-1;
int frontind=0;
int qu[1000];
void push(int x)
{
++backind;
qu[backind]=x;
}
void pop()
{
qu[frontind]=0;
++frontind;
}
bool isempty()
{
if(backind<frontind)
return true;
else
return false;
}
int top(... | true |
da46cecf62b28021c13eb7b7eee513f9f0a6ca19 | C++ | vvstormhao/MyTests | /CPP/leetCode/No00028/main.cpp | UTF-8 | 2,522 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Solution {
public:
int strStr(string haystack, string needle) {
return KMP(haystack, needle);
}
void GetNext(string &needle, int *pNext, int arrySize)
{
if (nullptr == pNext || 0 == arrySize)
{
return;
... | true |
6e00245a72be353131bf866a21bdc6c5b1c36262 | C++ | edubeckha/Compiladores | /TrabalhoII/implementacao/st.cpp | UTF-8 | 7,643 | 3.109375 | 3 | [] | no_license | /*Ja previamente definido por Laércio Lima Pilla e ampliado para aceitar funcoes e outros tipos de estruturas*/
#include "st.h"
#include "ast.h"
using namespace ST;
extern SymbolTable symtab;
/*Cria uma nova variavle na tabela de simbolos*/
AST::Node * SymbolTable::newVariable ( std::string id, Tipos::Tipo tipoVariav... | true |
efae9ebf3641e919ab7d7a6324e87c03d4802e59 | C++ | heikipikker/cve_2013_0640_full_exploit | /deobsfuscation/deobsfuscation/string_decode.cc | UTF-8 | 1,363 | 2.875 | 3 | [] | no_license | #include "string_decode.h"
#include <memory>
StringDecode* StringDecode::Get(){
static StringDecode* r_interface = nullptr;
if(r_interface==nullptr){
static std::tr1::shared_ptr<StringDecode> share;
r_interface = reinterpret_cast<StringDecode*>(&share);
}
return r_interface;
}
bool StringDecode::ReplaceString... | true |
92f8be19250587c33a2f7745edfcd828a5a88617 | C++ | Josephnicolay/Fisica_Computacional-1_2020-II | /EjemHeader.cpp | UTF-8 | 449 | 3.53125 | 4 | [] | no_license | /**
* Programa para ilustrar el uso de los headers
* definidos por el usuario
*/
//Incluyo el header de la librería estándar de entrada y salida
#include <iostream>
using namespace std;
// Incluyo el header de la librería de usuario
#include "suma.hpp"
// Programa
int main()
{
// Definimos dos números
... | true |
416cd5dda643ce8932348e9003df291c7a686ea2 | C++ | yuyafu/leetcode | /hello/isPalindInt.cpp | UTF-8 | 416 | 2.953125 | 3 | [] | no_license | //
// isPalindInt.cpp
// hello
//
// Created by 静静 on 2/4/17.
// Copyright © 2017年 jing. All rights reserved.
//
#include <stdio.h>
bool isPalindInt(int x) {
//边界条件
if(x<0 || (x!=0 && x%10 == 0)) return false;
int revInt = 0;
//很好的判断条件
while (x > revInt) {
revInt = revInt*10 + x%1... | true |
6b97fd1b5da60a71e19a06e91a5b369adf6fd05a | C++ | Mbaey/MyDataStruct- | /homework/sort&search/AVL_CSDN_ERROR.cpp | GB18030 | 13,730 | 3.703125 | 4 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
#define LH +1 //
#define EH 0 //ȸ
#define RH -1 //Ҹ
#define EQ(a,b) ((a) == (b))
#define LT(a,b) ((a) < (b))
#define LQ(a,b) ((a) <= (b))
//Ԫ
typedef struct Student
{
int key;
string major;
Student(){}
Student(int k,string ... | true |
42480a854183b1b4c417fb789a5e5ca7bbcff643 | C++ | andreihu/asio-fsm | /include/afsm/util/fmt.hpp | UTF-8 | 430 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | #pragma once
// thirdparty
#include <fmt/format.h>
// std
#include <system_error>
template <> struct fmt::formatter<std::error_code> {
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const std::error_code &ec,... | true |
c0bff345b6d4df3e460423ecc621f74fec7a5e57 | C++ | Pipi24/OJ | /second_time_111/二叉树/589. N 叉树的前序遍历.cpp | UTF-8 | 748 | 3.328125 | 3 | [] | no_license | /*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
vector<int> preorder(Node* ... | true |
60280633c160d9169f0684cef5b8237a740aced4 | C++ | JonnySunny/Courses-Project | /C++ Applications/VotingSystem/Project 1 - Waterfall Voting/src/plurality.h | UTF-8 | 1,127 | 3.09375 | 3 | [] | no_license | /**
* @file plurality.h
*
* @copyright Spring 2018 CSci 5801 Team 10, All rights reserved.
*/
#ifndef SRC_PLURALITY_H_
#define SRC_PLURALITY_H_
// Includes
#include <vector>
#include "./algorithm.h"
// Forward declarations
class Ballot;
class Candidate;
/*************************************************************... | true |
19477eac06cff8d2a77a41a218f85af8f673e888 | C++ | BruceWang1030/Tetris | /include/blocks/Block.h | UTF-8 | 1,482 | 3.25 | 3 | [] | no_license | #ifndef _BLOCK_H_
#define _BLOCK_H_
#include <tuple>
#include <vector>
#include <memory>
class Block : public std::enable_shared_from_this<Block>
{
protected:
//the coordinates_ records the bottom left corner of the block (might be empty block)
std::tuple<int, int> coordinates_;
//4 rotationTypes: (indexe... | true |
6e9c8c6247adf1b0d80476dd500ac0802ddd6965 | C++ | LKinahan/SpaceInvaders | /CInvader.h | UTF-8 | 498 | 2.828125 | 3 | [] | no_license | #pragma once
#include "CGameObject.h"
/**
*
* @brief This is the game invader class
*
* The game invader class with its own unique constructor to set the size, sprite, and lives.
*
* @author
*
*/
class CInvader:
public CGameObject
{
public:
/** @brief The class constructor
*
* @details This method will ... | true |
0ad45e7b7288055e2964390929a3502c21a192cd | C++ | chistyakova-ann/MyWork | /src/search_char.cpp | UTF-8 | 317 | 2.671875 | 3 | [] | no_license | #include "../include/search_char.h"
int search_char(char32_t c, const char32_t* array){
char32_t ch;
int curr_pos = 0;
for(char32_t* p = const_cast<char32_t*>(array); (ch = *p++); ){
if(ch == c){
return curr_pos;
}
curr_pos++;
}
return THERE_IS_NO_CHAR;
}
| true |
761f13b57d1e716fc70dfa6a6ce7fa672fb86bbb | C++ | JaceRiehl/Council-Of-Jerrys | /src/Level.cpp | UTF-8 | 1,397 | 2.859375 | 3 | [] | no_license | #include "Level.h"
Level::Level(string n, PlayableCharacter* pc, map<string, Room*> levelRooms, string openingText) : key(n), jerry(pc), rooms(levelRooms), openingMessage(openingText)
{
nextRoom = "town";
}
Level::Level(string levelKey, string startingRoom, map<string, Room*> levelRooms) : key(levelKey), nextRoom... | true |
015eef71b38e289d8084c57fcf6f0a3e10d6bc1b | C++ | GreateCode/curlion | /src/connection_manager.cpp | UTF-8 | 8,770 | 2.59375 | 3 | [
"MIT"
] | permissive | #include "connection_manager.h"
#include "connection.h"
#include "log.h"
#include "socket_factory.h"
#include "socket_watcher.h"
#include "timer.h"
namespace curlion {
static inline LoggerProxy WriteManagerLog(void* manager_idenditifier) {
return Log() << "Manager(" << manager_idenditifier << "): ";
}
C... | true |
f6b6a5c56a71087e49f77bcfbf665c1082a43f41 | C++ | mockingbird225/TagCloud | /Partition.cpp | UTF-8 | 324 | 2.703125 | 3 | [] | no_license | #include "Partition.hpp"
void Partition::addRect(string word, double xLeft, double yLeft, double l, double b, double frequency) {
rectPartitions.push_back(new Rectangle(xLeft, yLeft, l, b, word, frequency));
}
void Partition::print() {
for(int i = 0; i < rectPartitions.size(); i++) {
rectPartitions[i]->print();
... | true |
833e055e4f5e34e32879f85350c1f7652f49474a | C++ | Datos2Sem22018/Proyecto3.2 | /node.h | UTF-8 | 400 | 3.59375 | 4 | [] | no_license | #ifndef NODE_H
#define NODE_H
#include <iostream>
/**
* Clase Nodo, utilizada para almacenar
* @tparam T
*/
template <class T>
class Node {
public:
T data;
Node* next;
Node<T> (T var);
};
/**
* Constructor de la clase Nodo
* @tparam T
* @param var : valor a almacenar
*/
template <class T>
Node<T>::N... | true |
2e1f13ad881619629fa9eed7c712ead79ac63e93 | C++ | fuadsaud/BlockSoccer | /Point.cpp | UTF-8 | 381 | 3.234375 | 3 | [] | no_license | #include "Point.h"
Point::Point() {
x = y = z = 0;
}
Point::Point(float x, float y, float z) {
Point::x = x;
Point::y = y;
Point::z = z;
}
Point* Point::operator+(const Point* p) const {
Point self = *this;
Point* result = new Point(
p->x + self.x,
p->y + se... | true |
ddfc2f8803f64204b6b1505426ccad091480645c | C++ | GDC-CEG/Galaxy-Shooter | /HeroShip.h | UTF-8 | 2,417 | 3.8125 | 4 | [] | no_license | #include"SFML\Graphics.hpp"
#include"Bullets.h"
const int VEL=10;//Velocity with which ship will move i.e. 10 pixels
class HeroShip
{
public:
sf::IntRect box; // a box to store the dimensions i.e.x,y,width and height of ship
sf::RectangleShape rect; //rectangle shape that is displayed
int xVel,yVel; // variables... | true |
d4fb1d75fa28640517c789d7d5f1bb55797719a3 | C++ | patrick1964/Data-Structures-Work | /in class 1.cpp | UTF-8 | 1,988 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
struct pasInfo
{
string name;
string tnum;
int ffnum;
double price;
int fnum;
string seat;
string date;
};
static vector<pasInfo> pas;
void enterPas(){
pasInfo temp;
string t;
cout<<"enter Passenger Name then pr... | true |
0c1e8057f3b2495fe69bdd7afb7f98a7155d4074 | C++ | MustBeDeletedOne/ass | /compiler/include/emit.hpp | UTF-8 | 400 | 2.5625 | 3 | [] | no_license | #ifndef __ASS_EMIT_HPP__
#define __ASS_EMIT_HPP__
#include <string>
namespace ass {
class emitter {
public:
emitter(std::string filename);
void emit(std::string code);
void emit_line(std::string code);
void header_line(std::string code);
void write_file();
private:
... | true |
a5c86d3a3c2e923f80b5e7a44b6a072017984175 | C++ | R-Sandor/AminoAcidMatcher | /solutionPts.h | UTF-8 | 403 | 3.078125 | 3 | [] | no_license | using namespace std;
class SolutionPts
{
public:
SolutionPts(){}
~SolutionPts(){}
void setvals(int i, double a, double b, double c){id = i; x = a; y=b; z=c;}
int getid(){return id;}
double getx(){return x;}
double gety(){return y;}
void display(){cout<<"#"<<id<<" at ("<<x<<", "<<y<<", "<< ... | true |
550f28e5b702e9b13f3ddb75e61d30a7c42f1320 | C++ | chriswpark00/C_Algorithm | /day01/pointer_01.cpp | UHC | 439 | 3.6875 | 4 | [] | no_license | #include <stdio.h>
void swap(int *x, int *y); // a, b
int main(){
int a = 10;
int b = 20;
printf("%d, %d\n", a, b);
swap(&a, &b);
printf("%d, %d\n", a, b);
return 0;
}
// ### ϳ??
// main() Լ
// ܺ Լ ȭ ٶ
void swap(int *a, int *b){
int pointer = *a;
*a = *b;
*b = pointer;
... | true |
a74c0f11902171467ee9662f357a01f7f2b71f80 | C++ | koosaga/olympiad | /ICPC/CERC/cerc2018_d.cpp | UTF-8 | 1,227 | 2.78125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
using real_t = long double;
using pi = pair<int, int>;
real_t Tf, Vf, Hf;
real_t Td, Vd, Hd;
real_t joobjoob(){
real_t frisbee_run = sqrt(2 * Hf);
real_t distance = frisbee_run * Vf;
return max(frisbee_run + Tf, distance / Vd + Td) + distance / ... | true |
68de386cf8b491db262ec6779f923d1d0533d1c5 | C++ | jimmyshuyulee/duke-ece751 | /025_expr_eval2/expr.h | UTF-8 | 1,902 | 3.71875 | 4 | [] | no_license | #include <sstream>
#include <string>
class Expression {
public:
Expression() {}
virtual std::string toString() const = 0;
virtual ~Expression() {}
};
class NumExpression : public Expression {
protected:
long number;
public:
NumExpression(long num) : number(num) {}
std::string toString() const {
st... | true |
7f63da3b7c06c4623e38b0f3142efdbc5795bf50 | C++ | qseft0402/2019_POSD | /資料/R1/HW7/fs/src/null_iterator.h | UTF-8 | 452 | 2.90625 | 3 | [] | no_license | #ifndef NULL_ITERATOR
#define NULL_ITERATOR
#include "node_iterator.h"
class NullIterator:public NodeIterator
{
public:
NullIterator(Node* node): _node(node) {}
void first()
{
//definition by yourself
}
Node* currentItem()
{
return this->_node;
}
void n... | true |
e86825cee57ce3767b16828b3b4bc9f7029557ef | C++ | Khairul-Anam-Mubin/UVa-Solutions | /10038 - Jolly Jumpers.cpp | UTF-8 | 1,012 | 2.53125 | 3 | [] | no_license | /***
** Author: Khairul Anam Mubin
** Bangladesh University of Business and Technology,
** Dept. of CSE.
***/
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long i,j,temp,n,a[3000],sum,sum1;
while(scanf("%lld",&n)==1)
{
sum=0;
sum1=0;
for(i=1;i<=n;i++... | true |
922ad879db8c61a9c9581b5a73862995d48b2c52 | C++ | ailyanlu1/c100 | /P3/BitInputStream.cpp | UTF-8 | 430 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
* P3
* BitInputStream.cpp
* Implementation of BitInputStream class
*
* Author: Jay Dey cs100vaj
* Author: Joshua Yuen cs100vbc
*/
#include "BitInputStream.hpp"
void BitInputStream::fill()
{
buf = in.get();
nbits = 0;
}
int BitInputStream::readBit()
{
// all bits in buffer are read
if( nbits == 8 )
... | true |
9e665a82255eab9544ccccb91419e137ced706f3 | C++ | jjzhang166/SWAG | /src/vertical_slider.cpp | UTF-8 | 1,477 | 2.640625 | 3 | [] | no_license | #include "vertical_slider.h"
#include "event_queue.h"
#include <iostream>
Vertical_slider::Vertical_slider()
{
Enable_fixed_width();
}
Widget* Vertical_slider::Clone() const
{
return new Vertical_slider(*this);
}
void Vertical_slider::Set_pane_position(float p)
{
float max_y = Get_size().y-pane_size;
pane_positi... | true |
fae2aaa77190242722ca1a1582540831baaffa8e | C++ | Pranit5895/DATA-STRUCTURES-CPP | /Dynamic-Programming/Floyd-Warshall.cpp | UTF-8 | 1,390 | 3.546875 | 4 | [] | no_license | #include <iostream>
using namespace std;
void floyds_algorithm(int parent_array[][10], int no_of_vertices)
{
int i, j, k;
for (k = 0; k < no_of_vertices; k++)
{
for (i = 0; i < no_of_vertices; i++)
{
for (j = 0; j < no_of_vertices; j++)
{
if ((parent_... | true |
18e71155be973885734ddaded4ffc989b3d2b7b0 | C++ | yamikumo-DSD/my_game_project_unified | /source/destroy_enemy_rate.cpp | UTF-8 | 2,983 | 2.625 | 3 | [] | no_license | //destroy_enemy_rate.cpp
#include "destroy_enemy_rate.h"
#include "decl_static_image_handler.h"
#include "image_pool.h"
#include <type_traits>
#include "lock_weight_to_rate.h"
#include "mathematics.h"
#include "print_digit.h"
#include <boost/lexical_cast.hpp>
#include "debug_value.h"
#include <boost/format.hpp>
#ifnd... | true |
c534fef20c12c9d5e1a176190d260e9e7dc06c0e | C++ | alaksana96/SoftwareEngineering2 | /Lab3/FarthestPoint.cpp | UTF-8 | 1,297 | 3.875 | 4 | [] | no_license | /*
* FarthestPoint.cpp
*
* Created on: Nov 12, 2016
* Author: LaksanaAufar
*
* Write a (global) function which takes as argument a vector of points and
* returns the index of the one which is farthest from the origin. Write a main
* to test the function.
*/
#include <iostream>
#include <vector>
#include "... | true |
ee9b859b29acbbded34326acce5f89434b0c7fc0 | C++ | Ixilthrin/SMURF | /graphics/include/GuiGlyph.h | UTF-8 | 1,015 | 2.890625 | 3 | [] | no_license | #ifndef GENG_GUI_GLYPH_H
#define GENG_GUI_GLYPH_H
#include <map>
struct GuiGlyph
{
/// The left position of the character image in the texture.
int x;
/// The top position of the character image in the texture.
int y;
/// The width of the character image in the texture.
int width;... | true |
d3bf13f9b09d0a9a111503c429ea90be85b549ef | C++ | sgumhold/cgv | /cgv/math/geom.h | UTF-8 | 3,201 | 3.34375 | 3 | [] | permissive | #pragma once
#include "fmat.h"
namespace cgv {
namespace math {
//! rotate vector v around axis n by angle a (given in radian)
/*! the cos and sin functions need to be implemented for type T.*/
template <typename T>
cgv::math::fvec<T, 3> rotate(const cgv::math::fvec<T, 3>& v, const cgv::math::fvec<T, 3>& n, ... | true |
bd14218c2076274169d8de03c8895538462eb108 | C++ | carlostojal/opendb | /InsertData.cpp | UTF-8 | 581 | 3.15625 | 3 | [] | no_license | #include "InsertData.h"
using namespace std;
InsertData::InsertData(Table* table1)
{
table = table1;
}
void InsertData::render()
{
vector<Column> cols = table->structure;
vector<Column> data;
cout << "\n** Insert into \"" << table->name << "\" **\n" << endl;
for (unsigned int i = 0; i < cols.size(); i++)
{
... | true |
1112b26b8a5067dd1753d935a49e98b698d56783 | C++ | grastvei007/device | /msg/messagepair.h | UTF-8 | 835 | 2.875 | 3 | [] | no_license | #ifndef MESSAGEPAIR_H
#define MESSAGEPAIR_H
#include <QObject>
class MessagePair
{
public:
enum Type
{
eFloat = 0,
eString,
eBool,
eInt
};
MessagePair();
void setKey(QString aKeyName);
void setType(Type aType);
void setFloatFromBytes(char *aValue); ///< 4 ... | true |
23ae5ecc16ec24338f6ba9e23496f12fb316220e | C++ | kmj91/kmj-api | /2019_06_30_Gunbird/2019_06_30_Gunbird/ObjectEffect.cpp | UTF-8 | 1,193 | 2.609375 | 3 | [] | no_license | #include "stdafx.h"
#include "ObjectEffect.h"
ObjectEffect::ObjectEffect(int iType, int iPosX, int iPosY)
{
m_ComprehensiveType = df_COMPREHENSIVE_TYPE_NEUTRAL;
m_Type = iType;
m_X = iPosX;
m_Y = iPosY;
switch (m_Type) {
case df_TYPE_OBJECT_EFFECT_KABOOM_1:
m_iSpriteIndex = df_SPRITE_ITEM_KABOOM_1_1;
m_iA... | true |
2d3626d4f1e5fdd7f1b75af2a1b7b9ebd404fe6f | C++ | andy-sheng/leetcode | /proj/alog/581. Shortest Unsorted Continuous Subarray/581. Shortest Unsorted Continuous Subarray.h | UTF-8 | 2,022 | 3.140625 | 3 | [
"MIT"
] | permissive | //
// 581. Shortest Unsorted Continuous Subarray.h
// leetcode
//
// Created by andysheng on 2019/10/7.
// Copyright © 2019 Andy. All rights reserved.
//
#ifndef _81__Shortest_Unsorted_Continuous_Subarray_h
#define _81__Shortest_Unsorted_Continuous_Subarray_h
#include <vector>
using namespace std;
namespace Sho... | true |
325c7a8cfb8cd3887aec7fb9e8e962757bd4b678 | C++ | ligand-lg/leetcode | /codingInterview/27_字符串排列.cpp | UTF-8 | 785 | 3.0625 | 3 | [] | no_license | #include "../leetcode.h"
class Solution {
vector<string> help(const string &str, int index) {
if (index < 0)
return {""};
vector<string> ans;
auto pre_ans = help(str, index-1);
for (auto s : pre_ans) {
for (int i = 0; i <= s.length(); ++i) {
s.insert(s.begin() + i, str[index]);
... | true |
4820586574ca2d533b4ec6e16fa5c187767e48f9 | C++ | zeienko-vitalii/se-cpp | /zeienko-vitalii/src/zeienko01/Manipulator.cpp | UTF-8 | 962 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
* @file Manipulator.cpp
* Realization of the Manipulator class.
* @author Vitalii Zeienko
* @version 0.0.3
* @date 2017.09.09
*/
#include "Manipulator.h"
#include <stdio.h>
const int Manipulator::MIN_NUM_BTNS = 2;
const int Manipulator::MAX_NUM_BTNS = 20;
Manipulator::Manipulator(void) : a... | true |
e6a20b69f877a454738ac26d4008e920346d8ae2 | C++ | Napradean-Andrei/University | /Doubly Linked List on Array/main.cpp | UTF-8 | 6,159 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stdlib.h>
#include <assert.h>
template <typename T>
struct Node
{
T info;
int next;
int prev;
};
template <typename T>
class List
{
private:
int cap = 100;
int size = 0;
int firstEmpty = 0;
int tail = -1;
int head = -1;
Node<T> elems[100];
bool(*r)(T, T);
pu... | true |
283447074ab81c6cd49193d980241d875d033a78 | C++ | heiseish/CPLib | /Math/StringParser.hpp | UTF-8 | 1,107 | 3.15625 | 3 | [] | no_license | #include <string>
/**
Python Eval in C++
*/
class Parser {
private:
std::string input;
int stringidx = 0;
inline char peek() {
return input[stringidx];
}
inline char get() {
return input[stringidx++];
}
inline int expression();
inline int number() {
int result = get() - '0';
while (peek() >= '0' && p... | true |
85f70178862f98012ea5e3cd7d670838c9df20f5 | C++ | emisner15/Die-Roller- | /RNG.h | UTF-8 | 1,009 | 3.546875 | 4 | [] | no_license | #ifndef RNG_H
#define RNG_H
#include <ctime>
#include <cstdlib>
using namespace std;
class RNG
{
private:
public:
//by default, use current time as seed
RNG()
{
srand(time(NULL));
}
//also allow custom seed
RNG(int seed)
{
srand(seed);
}
... | true |
9877e850dc992dcc97a07358392089f5f03648c8 | C++ | WolfireGames/overgrowth | /Projects/bullet3-2.89/examples/ThirdPartyLibs/Gwen/Controls/Text.cpp | UTF-8 | 2,041 | 2.546875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"Zlib"
] | permissive | /*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#include "Gwen/Gwen.h"
#include "Gwen/Controls/Text.h"
#include "Gwen/Skin.h"
#include "Gwen/Utility.h"
using namespace Gwen;
using namespace Gwen::ControlsInternal;
GWEN_CONTROL_CONSTRUCTOR(Text)
{
m_Font = NULL;
m_Color = Gwen::Colors::Blac... | true |
bb0a42a400f4454af390399192f8d05a0d432cc0 | C++ | prasadnallani/LeetCodeProblems | /Medium/1004-MaxConsecutiveOnesIII.cpp | UTF-8 | 2,296 | 3.828125 | 4 | [] | no_license |
/*
* Author: Raghavendra Mallela
*/
/*
* LeetCode 1004: Max Consecutive Ones III
*
* Given a binary array nums and an integer k, return the maximum number of
* consecutive 1's in the array if you can flip at most k 0's.
*
* Example 1:
* Input: nums = [1,1,1,0,0,0,1,1,1,1,0], k = 2
* Output: 6
* Explanation:... | true |
e07bfd39947e82828d1e91d9b84f5c0aa2181570 | C++ | JohannesRuder/workspace | /mylib/team.h | UTF-8 | 1,289 | 2.921875 | 3 | [] | no_license | //
// Created by hannes on 11.02.18.
//
#ifndef TEAM_H_
#define TEAM_H_
#include <string> // for string
#include <vector> // for vector
#include <opencv2/core/core.hpp> // IWYU pragma: keep
#include <opencv2/core/persistence.hpp> // for FileStorage (ptr only), Fi... | true |
86140c2049b495d5bdbf88ab0d28410bebb9b797 | C++ | RyoFuji2005/ShilitoriCPP | /shilitori.cpp | UTF-8 | 9,188 | 3.046875 | 3 | [
"MIT"
] | permissive |
// (c)2021 Ryo Fujinami.
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <vector>
#include <ctime>
#include <cstdlib>
#include <unistd.h>
#include "converters.hpp"
// 乱数初期化
std::mt19937 initialize_rand() {
std::srand(std::time(NULL));
std::mt19937 mt(std::rand());
return... | true |
ea4465de17a0ce17b1ef6b18808c667f4e90eea9 | C++ | rafaelhdr/tccsauron | /Sauron/Common/Line.h | UTF-8 | 273 | 2.953125 | 3 | [] | no_license | #pragma once
namespace sauron
{
class Line
{
public:
Line(double rWall, double theta)
: m_rWall(rWall), m_theta(theta){
}
inline double getRWall() const { return m_rWall; }
inline double getTheta() const { return m_theta; }
private:
double m_rWall, m_theta;
};
}
| true |
74de149bf4ab9d3cfb52095f74e1c8b3fab0afaa | C++ | AntSworD/ACM | /HDU/2056.cpp | UTF-8 | 967 | 2.96875 | 3 | [] | no_license | #include<stdio.h>
double x[4],y[4],t;
void sortx()
{
int i,j;
for(i=1;i<4;i++)
for(j=0;j<3;j++)
{
if(x[j]>x[j+1])
{
t=x[j];
x[j]=x[j+1];
x[j+1]=t;
}
}
}
void sorty()
{
int i,j;
for(i=1;i<4;i++)
for(j=0;j<3;j++)
{
if(y[j]>y[j+1])
{
t=y[j];
y[j]=y[j+1];
y[j+1]=t;
}
... | true |
5217ba6d0b1da0f5b70105460c0cf73712939020 | C++ | nCine/nCine | /unit_tests/gtest_statichashset.cpp | UTF-8 | 7,194 | 3.15625 | 3 | [
"MIT"
] | permissive | #include "gtest_statichashset.h"
namespace {
class StaticHashSetTest : public ::testing::Test
{
protected:
void SetUp() override { initHashSet(hashset_); }
HashSetTestType hashset_;
};
TEST_F(StaticHashSetTest, Capacity)
{
const unsigned int capacity = hashset_.capacity();
printf("Capacity: %u\n", capacity);
... | true |
cf5e77eec8cfdbe59a32012105fe849266463a60 | C++ | cbritopacheco/rodin | /src/Rodin/Variational/QuadratureRule.h | UTF-8 | 2,620 | 2.9375 | 3 | [
"BSL-1.0"
] | permissive | #ifndef RODIN_VARIATIONAL_QUADRATURERULE_H
#define RODIN_VARIATIONAL_QUADRATURERULE_H
#include <vector>
#include <utility>
#include "Rodin/Math.h"
#include "Rodin/Geometry.h"
#include "MFEM.h"
namespace Rodin::Variational
{
class QuadratureRule
{
using Key = std::pair<Geometry::Type, size_t>;
static std... | true |
3360645325a87904c51265070dcc3e57754ab397 | C++ | masamichiIto/atcoder_ | /cpp/kp06.cpp | UTF-8 | 960 | 3.109375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;
cin >> x >> y;
if(x < 10){
cout << "xは10より小さい" << endl;
}
else if(x > 20){
cout << "xは10より小さくなくて,20より大きい" << endl;
}
else if(x == 15){
cout << "xは10より小さくなくて,20より大きくなくて,15である" << endl;
}
else{... | true |
6c4ff3b0123103376552c7ad5aad687fd8206344 | C++ | jackytop/VARE | /base/header/DenseField2D.h | UTF-8 | 2,844 | 2.734375 | 3 | [] | no_license | //----------------//
// DenseField2D.h //
//-------------------------------------------------------//
// author: Wanho Choi @ Dexter Studios //
// Jaegwang Lim @ Dexter Studios //
// Julie Jang @ Dexter Studios //
// last update: 2018.04.25 ... | true |
e1f210f6d579bd871ccaafa95f6fa3ce5d5bdaea | C++ | dbowker/othello | /setupBoard.cpp | UTF-8 | 646 | 2.546875 | 3 | [] | no_license | /*
* File: setupBoard
* Author: dan bowker
* Project: othello
*
* setup the initial state of the board.
*
* Created on February 7, 2012, 7:30 PM
*/
#include "othello.h"
void setupBoard(char b[BS]) {
int i;
for (i = 0; i < BS; i++)
b[i] = ' ';
b[bsToAi(4,4)] = C;
b[bsToAi(5,5)] = C;
b[bsToAi(4,5)] ... | true |
0722a52ee74ec2f817440a3c1c7e712107a5b43b | C++ | RoberInside/TPV | /P2/ProyectosSDL/HolaSDL/Texture.h | UTF-8 | 581 | 2.859375 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
#include <SDL.h>
#include <SDL_image.h>
using uint = unsigned int;
class Texture
{
public:
Texture();
~Texture();
bool loadTexture(SDL_Renderer* renderer, std::string const& path, uint rows, uint cols);
void render(SDL_Renderer* renderer, const SDL_Rect& desRec... | true |
7e7bbdf6ff99bb86f402150ec618730753ec3b37 | C++ | Longseabear/AlgorithmStudy | /2583.cpp | UTF-8 | 1,243 | 2.6875 | 3 | [] | no_license | #include <stdio.h>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
int map[102][102];
vector<int> rv;
int dx[4] = { 0,0,1,-1 };
int dy[4] = { 1,-1,0,0 };
void setMap(int sx, int sy, int ex, int ey) {
for (int i = sy; i <= ey; i++) {
for (int j = sx; j <= ex; j++) {
map[i][j] = 0;
}
... | true |
a50e645100801b70782f7187ae93039d83e86cbd | C++ | Tim-Paik/cpp | /date/20210613/成绩.cpp | UTF-8 | 330 | 3.171875 | 3 | [] | no_license | //平均数 最大值 最小值
#include<iostream>
using namespace std;
int a[5];
int main() {
for(int i=0;i<5;i++)
cin >> a[i];
cout << (a[0]+a[1]+a[2]+a[3]+a[4])/5 << " ";
int max=0,min=a[0];
for(int i=0;i<5;i++) {
max = max>a[i]?max:a[i];
min = min<a[i]?min:a[i];
}
cout << max << " " << min << endl;
return 0;
}
| true |
e3da7daf05e3fe9595932393b56b48ef1e586efb | C++ | patches11/djcontroller | /djController.ino | UTF-8 | 3,754 | 2.5625 | 3 | [] | no_license | #include <Bounce.h> // Bounce library makes button change detection easy
#include <Encoder.h>
const int channel = 1;
const int debounce = 5;
const int buttonVel = 127;
const int numButtons = 28;
const int analogChange = 2;
int muxChannel[16][4]={
{0,0,0,0}, //channel 0
{1,0,0,0}, //channel 1
{0,1,0,0}, //chann... | true |
cebba2e04149c6216a3c244e3a8c654baf4810b5 | C++ | WolfCub15/Systems_of_Linear_Equations | /SLE/methods.cpp | UTF-8 | 6,926 | 3.125 | 3 | [] | no_license | #include "methods.h"
void printMatrixA(const vector<vector<double>> &A) {
for (int i = 0; i < A.size(); ++i) {
for (int j = 0; j < A[0].size(); ++j) {
cout << A[i][j] << ' ';
}
cout << '\n';
}
}
void printAnsX(const vector<double>& x){
for (int i = 0; i < x.size(); ++i)... | true |
402d2de9aa4493518642f2e00e01e786508e0c83 | C++ | IgorYunusov/Mega-collection-cpp-1 | /CPP_cookbok_source/10-9.cpp | UTF-8 | 733 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
const static int BUF_SIZE = 4096;
using std::ios_base;
int main(int argc, char** argv)
{
std::ifstream in(argv[1],
ios_base::in | ios_base::binary); // Use binary mode so we can
std::ofstream out(argv[2], // handle all kinds of file
... | true |
8112905ca237134ad921112539a0ffdab64180c8 | C++ | gs0622/leetcode | /combinations.cc | UTF-8 | 671 | 3.109375 | 3 | [] | no_license | /* https://leetcode.com/problems/combinations/description/
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
void helper(int n, int i, int k, vector<int>&cmb, vector<vector<int>>& res) {
if (k==0) {
res.push_back(cmb);
return;
}
for (int j=i; j<=n; ++j) {
cmb.push_back(j);
helper(n, j... | true |
9e8efbe62ca86751b3db96eb73669788c43c3b68 | C++ | 15831944/Utility | /Network/SocketChannel.h | UTF-8 | 1,938 | 2.765625 | 3 | [] | no_license | /*
* File: SocketChannel.h
* Author: 0007989
*
* Created on 2014年1月27日, 上午 11:03
*/
#ifndef UTILITY_SOCKETCHANNEL_H
#define UTILITY_SOCKETCHANNEL_H
#include <mutex>
#include "SocketBase.h"
namespace KGI_TW_Der_Utility
{
///
/// SocketChannel
/// Use socket TCP protocol to communicate
///
/// After ... | true |
37a90acd7e2c455e6098835bfe721532ee6d53b0 | C++ | Hackerifyouwant/IIM_Judge | /answer_code/PN.cpp | UTF-8 | 763 | 2.859375 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n, m, cnt;
cin >> n >> m >> cnt;
vector< vector <int > > martix(n, vector<int>(m));
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> martix[i][j];
}
}
cnt %= 4;
for(int s = 0... | true |
d696561e447e2017d94cdfb37791a580f07c1208 | C++ | viveksinghvi/Competitive-Coding-Playbook | /sortComparison/main.cpp | UTF-8 | 1,172 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool way (vector<int>a,vector <int>b ){
if (a[0]==b[0]){
if (a[2]==b[2]){
return a[1]<b[1];
}
return a[2]<b[2];
}
return a[0]<b[0];
}
int main()
{
int n,time,stile,scost,cos... | true |
cad914d998c8705abce0d71b53a77a8bf97c982a | C++ | rising-stark/Competitive-Questions | /Hackerearth/Micro_and_Prime_Prime.cpp | UTF-8 | 6,069 | 3.140625 | 3 | [] | no_license | /*
The function to look up for the logic/solution is void solve() at the bottom.
Above the solve function is main function which calls the solve function simply.
https://www.hackerearth.com/practice/math/number-theory/primality-tests/practice-problems/algorithm/micro-and-prime-prime-1/description/
Problem Description:... | true |
271242bd0218a482fab1e2d5225aed3a6cfb250e | C++ | namhong2001/Algo | /aoj/jlis.cpp | UTF-8 | 1,164 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <limits>
#include <algorithm>
using namespace std;
const int N_MAX = 100;
const long long NEGINF = numeric_limits<long long>::min();
int A[N_MAX];
int B[N_MAX];
int cache[N_MAX+1][N_MAX+1];
int n, m;
int solve(int a_pos, int b_pos) {
int &ret = cache[a_pos+1][b_pos... | true |
a0e0963ad6ca77428bb326d6c63735f7d2e0022a | C++ | arthurarp/Maratonas-de-programacao | /tep/3 - /contest/B/b.cpp | UTF-8 | 451 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
int N;
cin >> N;
if (N % 4 == 0 || N % 7 == 0)
{
cout << "Yes\n";
return 0;
}
else
for (int four = 1; four < 100; ++four)
{
for (int seven = 1; seven < 100; ++seven)
{
int sum = 4 * four + 7 * seven;
... | true |
b516461b8ea70673f8850dabb44638ad360ab3b8 | C++ | tewarig/OOP-With-CPP-assignments | /assignment-1/answer1.cpp | UTF-8 | 534 | 4.0625 | 4 | [] | no_license | //To find greatest of three numbers.
#include <iostream>
using namespace std;
#define INT_MIN -2147483627 ;
int findMax(int num1,int num2,int num3){
int min = INT_MIN;
if(num1>min)
{
min = num1;
}
if(num2>min)
{
min = num2;
}
if(num3>min)
{
min = num3;
}
return min;
}
int ma... | true |
8ab29624f9913829ea29f04d14aae02375ec8c0d | C++ | HNSS-US/DelTech | /CSC/CSC114/GaddisExamples/Chapter10/Pr10-10.cpp | UTF-8 | 1,083 | 4.1875 | 4 | [
"MIT"
] | permissive | // This program demonstrates the tolower and stoi functions.
#include <iostream>
#include <cctype> // For tolower
#include <string>
using namespace std;
int main()
{
string input; // To hold user input
int total = 0; // Accumulator
int count = 0; // Loop counter
doubl... | true |
17b66a8207581f0e42635c00382b9cf9d7d3bf0b | C++ | bogdan-kovalchuk/June-leetcoding-challenge | /day_28.cpp | UTF-8 | 1,338 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <stack>
#include <algorithm>
using std::vector;
using std::string;
using std::unordered_map;
using std::multiset;
using std::stack;
class Solution {
public:
vector<string> findItinerary(vector<vector<string>> ... | true |
d4e578d5013622c6ca5a372e24e2cf2704458b4b | C++ | xiaopeng-whu/Calculator-complier | /Calculator/Calculator/MyStack.h | GB18030 | 1,036 | 3.90625 | 4 | [] | no_license | #pragma once
#include <iostream>
#define MAX 100
using namespace std;
template <class T>
class MyStack
{
public:
T data[MAX];
int top;
public:
void init(); // ʼջ
bool empty(); // жջǷΪ
T getTop(); // ȡջԪ(ջ)
void push(T x); // ջ
T pop(); // ջ
};
template<cla... | true |
35125973400f0fbb4079899cb005b08e35bfb580 | C++ | lanpham09/OmniFrameExecutable | /OmniFrame3/Configuration5DOF_Producer.cpp | UTF-8 | 6,652 | 2.78125 | 3 | [] | no_license | #include "Producers/Configuration5DOF_Producer.h"
Configuration5DOF_Producer::Configuration5DOF_Producer( std::string name, distanceUnits units, Math::Frame in_frame, unsigned int historyLength ):
PositionProducer(name, units, in_frame, historyLength)
{
_constPosition = Math::Position(Math::Zero(),in_frame,uni... | true |
7508e225d608bf9e6a8fbe3020657612f161376b | C++ | ngtcs1989/Artificial-Intelligence | /Resolution Refutation/sammy.cpp | UTF-8 | 6,170 | 2.5625 | 3 | [] | no_license |
/////////////////////////////////////
// File Name :
// Purpose :
// Creation Date : 21-03-2015
// Last Modified : <modified_date>
// Created By : Naveen Thomas
//////////////////////////////////////
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include ... | true |
02d195cf44ff1447aeec505af7a711b4ce1c9b1d | C++ | liuxueyang/liuxueyang.github.io | /assets/src/poj/1860_1.cpp | UTF-8 | 1,433 | 2.78125 | 3 | [] | no_license | #include <algorithm>
#include <cstring>
#include <queue>
#include <cstdio>
using namespace std;
const int N = 210, INF = 0x3f3f3f3f;
struct W {
W() {}
W(double r, double c) : r(r), c(c) {}
double r, c;
};
int st[N], n, cnt[N];
int e[N], ne[N], h[N], idx;
W w[N];
int S;
double V, dis[N];
void Init() {
idx =... | true |
86262f4ced61cffee3e800d6f678eaa3fffb25bf | C++ | irstavr/1942-FeedTheBirds | /1942-FeedTheBirds/src/Animation/FlashingAnimation.cpp | UTF-8 | 851 | 2.640625 | 3 | [] | no_license | #include "../../include/Animation/FlashingAnimation.h"
FlashingAnimation::FlashingAnimation(frame_t n,
delay_t show,
delay_t hide,
animid_t id) :
repetitions(n),
hideDelay(hide),
showDelay(show),
Animation(id) {
}
void FlashingAnimation::setRepetitions(frame_t n) {
repetitions =... | true |
0a30ec14085d993fae5c4ecabe680ca085085d40 | C++ | scially/LintCode | /98.h | UTF-8 | 4,117 | 3.5625 | 4 | [] | no_license | /**
* Definition of ListNode
* class ListNode {
* public:
* int val;
* ListNode *next;
* ListNode(int val) {
* this->val = val;
* this->next = NULL;
* }
* }
*/
class Solution {
public:
/*
* @param head: The head of linked list.
* @return: You should return the ... | true |