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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ff20f8ce22289c9e01a7f7c438a2c9f477922233 | C++ | alexandrocw/CP-training | /Codeforces/785A_AntonandPolyhedrons.cpp | UTF-8 | 656 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, cnt = 0;
string s;
cin >> n;
while(n--) {
cin >> s;
if(s.compare("Tetrahedron") == 0) {
cnt += 4;
} else if (s.... | true |
708dc98887ade134bc0ef60fa354522d401e0191 | C++ | tgtn007/LeetCode-Solutions | /search in sorted and rotated.cpp | UTF-8 | 1,461 | 3.40625 | 3 | [] | no_license | // will not work for duplicates
class Solution {
public:
int get(int lo, int hi, vector<int>& nums, int target)
{
int mid;
while(lo <= hi)
{
mid = lo + (hi - lo)/2;
if(nums[mid] == target)
return true;
if(nums[mid] < t... | true |
1d76d4105379ec402e313faf9c29890014a540ff | C++ | maziars/GeometricMedianADMM | /GeometricMedian/GeometricMedian/main.cpp | UTF-8 | 3,110 | 2.65625 | 3 | [
"MIT"
] | permissive | //
// main.cpp
// GeometricMedianADMM
//
// Created by Maziar Sanjabi on 11/6/17.
// Copyright © 2017 Maziar Sanjabi. All rights reserved.
//
#include <iostream>
#include "IO_MANAGER.hpp"
#include "Constants.h"
#include <ctime>
#include "GeoMedianADMM.hpp"
int main(int argc, const char * argv[]) {
// inse... | true |
3ada7a4f929380dd5c8cedbd0542db0afcd9f75a | C++ | soulsystem00/bj_2798 | /bj_2798/bj_1065.cpp | UTF-8 | 507 | 2.921875 | 3 | [] | no_license | //#include <iostream>
//#include <string>
//using namespace std;
//
//bool chkNum(int num)
//{
// string Num = to_string(num);
// if (Num.length() == 1 || Num.length() == 2)
// return true;
//
// for (int i = 0; i < Num.length() - 2; i++)
// {
// if (Num[i + 1] - Num[i] != Num[i + 2] - Num[i + 1])
// return false;
... | true |
50511997da70a8f0a7e1d0baad02c22b948ef9c4 | C++ | matthewnyee/cs202 | /lab/Lab1/cs202_lab1.cpp | UTF-8 | 1,143 | 3.203125 | 3 | [] | no_license | #include "employee.h"
using namespace std;
const int MAX = 100;
//This code is to test out the hierarchy of the clases created
int main()
{
char temp[MAX];
char response;
//experiment with the hourly employee class
person person_applying;
do
{
hourly_employee new_hire;
... | true |
ba988d055e3803f19b4fd780fd350649527bbb9a | C++ | rodrigocolor/Git | /Projetos/C++/Aula 8 - Pilhas/Exercicio 1.cpp | ISO-8859-1 | 1,724 | 3.34375 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<string>
#include <conio.h>
#include <locale.h>
struct pilha {
int topo, item[8];
};
void iniciaPilha(pilha &p) {
p.topo = -1;
}
bool pilhaVazia(pilha p) {
if(p.topo == -1) return true;
else return false;
}
bool pilhaCheia(pilha p) {
if(p.topo == 8-1) re... | true |
13cfbe5878aec36e70ed51ee5d3e8a044b152f73 | C++ | MartinEthier/DataStructuresAndAlgorithmsLabs | /Lab 2/patient_record.cpp | UTF-8 | 792 | 2.59375 | 3 | [] | no_license | //
// Martin Ethier, 20660931
//
#include "patient_record.h"
PatientRecord::PatientRecord()
: categoryID(0), patientID(0), name(""), address(""), DOB("")
{}
PatientRecord::PatientRecord(unsigned int newCatID, unsigned int newPatID, string newName, string newAddress,
st... | true |
9bf0cf453d55269a3b7fd79cac15dc96c55cc239 | C++ | Thyagr/programming | /cprogs/filemaxlines.cpp | UTF-8 | 1,419 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
#include <queue>
#define NOFILENAME -1
#define FILEOPENERR -2
#define MAXCHARS 512
#define MINHEAPSIZE 50
#define DEBUG 0
struct CustomCompare
{
bool operator()(const string str1, const string str2)
{
return str1.length(... | true |
6922b450ff3c4773b41ed616434846418ee8e40e | C++ | AIBilly/Distributed-Temperature-Control-System | /SubMachine/room.h | UTF-8 | 474 | 2.578125 | 3 | [] | no_license | #ifndef ROOM_H
#define ROOM_H
#include<stdio.h>
class Room
{
private:
float temperature_Outside;
float temperature_Room;
int room_Num;
public:
Room(float temO,float temR,int num);
Room();
void setRoomN(int num);
void setOutT(float out_in);
void setRoomT(floa... | true |
27d42927831f9dd64aa076a65620048ee60acd1c | C++ | 1998factorial/leetcode | /virtual contest/contest91/distanceK.cpp | UTF-8 | 1,455 | 2.984375 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
vector<int> g[500];
class Solution {
public:
void dfs(vector<int>& ans, int from, int dis, vector<bool>& seen){
... | true |
13e3d97e2312300cb25d24c231456a75c8b4e11f | C++ | jangwoo28/vending_machine | /widget.cpp | UTF-8 | 2,351 | 2.515625 | 3 | [] | no_license | #include "widget.h"
#include "ui_widget.h"
#include <QMessageBox>
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
ui->pbCoffee->setEnabled(false);
ui->pbTea->setEnabled(false);
ui->pbCoke->setEnabled(false);
ui->pbReturn->setEnabled(false);
}
... | true |
3f576db6afa912d7b2492883e695967f76d11923 | C++ | lxiaodongdong/practice | /list_traverse.h | UTF-8 | 337 | 2.671875 | 3 | [] | no_license | #pragma once
template < typename T>
void list<T>::traverse(void (*visit)(T &)){
for(ListNodePosi(T) p = header->succ;p != trailer; p = p->succ){
visit(p->data);
}
}
template< typename T >
template<typename VST> void list<T>::traverse(VST & visit){
for(ListNodePosi(T) p = header->succ;p != trailer; p = p->succ) ... | true |
1b13f4ee3a5cf02889d2c24b9e94b38a11ed0bcb | C++ | NurullahGundogdu/Object-Oriented-Programming-Project-Cpp | /HW3-2017_Matrix_Operation/SparseVector.cpp | ISO-8859-9 | 5,269 | 3.21875 | 3 | [] | no_license | #include "SparseVector.h"
#include <fstream>
#include <iostream>
using namespace std;
SparseVector::SparseVector()
{
}
SparseVector::SparseVector(string vectorFilename){
int a;
double b;
char c;
setFilename(vectorFilename);
ifstream file;
file.open(getFilename()); ... | true |
e47d49d7f10c09287bb3c380ac0cafac7dd1341f | C++ | glemerenb/Kernigan-Ritchi | /K-R 1.8/K-R 1.8/Source.cpp | UTF-8 | 339 | 3.421875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int c;
int tab = 0;
int space = 0;
int end = 0;
while ((c = getchar()) != EOF) {
if (c == '\t') {
++tab;
}
if (c == ' ') {
++space;
}
}
if (c == EOF) {
++end;
}
cout << "tab: " << tab << "\tspace: " << space << " en... | true |
45bdd6d32561349bc0a64fd13407f4213a1ea48d | C++ | rfeynman/jklib | /microsleep.cxx | UTF-8 | 330 | 2.625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
void microsleep(int sec, int usec)
{
struct timeval tv;
tv.tv_sec = sec;
tv.tv_usec = usec;
int retval = select(1, NULL, NULL, NULL, &tv);
/* Don't rely on the value of tv n... | true |
9807a617d9e4d94229d8f03ffb9acba8dcdf1d22 | C++ | yifatBi/cppCalendar | /MyDate.h | UTF-8 | 1,915 | 3.515625 | 4 | [] | no_license | /*
This Class handle Date and manipulate the date
*/
/*
* File: MyDate.h
* Author: Yifat Biezuner
*
* Created on 08 March 2016, 17:41
*/
#ifndef MYDATE_H
#define MYDATE_H
#define DAY_SUBMISSION 21
#define MONTH_SUBMISSION 3
#define YEAR_SUBMISSION 2016
#include <iostream>
class MyDate {
private:
int ... | true |
85b690113dacf25c9847e82e73f9890f468e58ca | C++ | osama-afifi/Online-Judges-Solutions | /TopCoder/TopCoder/SRM 563.cpp | UTF-8 | 928 | 2.90625 | 3 | [] | no_license | // 250
class FoxAndHandleEasy
{
public:
string isPossible(string S, string T)
{
int pos=temp.find(S);
if(pos==-1)return"No";
else
{
for(int i = 0; i<T.length();i++)
{
string temp = T.substr(0,i)+S+T.substr(i,T.length()-1-i);
if(temp==T)
return "YES";
}
return "No";
}
}
};
// 1... | true |
b88e7b5d5cdd5ff7496862e25c3e60dc772db7f1 | C++ | mdelorme/advent_of_code | /2020/07.cpp | UTF-8 | 1,690 | 3.125 | 3 | [
"Unlicense"
] | permissive | #include <bits/stdc++.h>
using Bag = std::string;
using Storage = std::pair<Bag, int>;
std::map<Bag, std::vector<Storage>> bags;
Bag readBag(std::istream &is) {
Bag b;
std::string type, color;
is >> type >> color;
b = type + " " + color;
return std::move(b);
}
bool findShiny(std::string bag) {
if (... | true |
252e696dc528f58d152ddba2b763520a5fe5f407 | C++ | maiducgiang/CTDLVGT | /DSA03012.cpp | UTF-8 | 903 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
void solve(){
string s, s1 = "";
cin>>s;
int code = 1;
vector <char> c;
vector <int> a;
for(int i = 0; i < s.length(); i++)
{
int code = 0;
if(c.size() == 0){
c.push_back(s[i]);
a.push_back(1);
}
else{
for(int... | true |
f4361753a74345755b715f9914959c8d6acb4cad | C++ | deejayslay/Graphing-Algorithms | /graph_algorithms.cpp | UTF-8 | 4,664 | 2.828125 | 3 | [] | no_license | #include "graph.h"
#include <iostream>
#include <map>
#include <list>
#include <algorithm>
#include <deque>
#include <vector>
#include <random>
int get_diameter(Graph graph)
{
int dMax = 0;
std::pair<int, int> furthest;
auto it = graph.adj.begin();
std::advance(it, rand() % graph.adj.size());
int r = it->first;
... | true |
1ad0e813dfc2fdf2aa3bdb3af2edd20e7e0d9d30 | C++ | Sosnovskiy2116/oop-1 | /praks/пр 2/ооп пр 2.2.cpp | UTF-8 | 985 | 2.6875 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
double t, z, a = -0.6, b = 5.3;
if (a < b) { z = pow(abs(a*a - b * b), (1.0 / 2)); }//proverka sootnoshenia a i b
else z = 1 - 2 * cos(a) *sin(b);
if (z < b) { t = pow... | true |
64d586be6f5b952b14ac2ec9503f69b8f0d625b3 | C++ | GeroZeppeli/- | /跳台阶/跳台阶.cpp | UTF-8 | 251 | 2.875 | 3 | [] | no_license | #include<iostream>
using namespace std;
void main()
{
int a=1,b=2,c,n,x;
cin>>n;
if(n==1)
x=1;
else if(n==2)
x=2;
else
{
for(n;n>2;n--)
{
c=a+b;
a=b;
b=c;
}
x=c;
}
cout<<x<<endl;
} | true |
5138482e55d9acf79cabbc0d1af25255c4d582f5 | C++ | xuwg/base | /D_Event.cpp | UTF-8 | 1,216 | 2.734375 | 3 | [] | no_license | #include "StdAfx.h"
#include "D_Event.h"
D_Event::D_Event(bool manualReset, bool initialState)
{
m_Event = ::CreateEvent(NULL, manualReset, initialState, NULL);
}
D_Event::~D_Event(void)
{
::CloseHandle(m_Event);
}
bool D_Event::Set()
{
return (::SetEvent(m_Event) == TRUE);
}
bool D_Event::Reset()
{
return (:... | true |
99e4d6a66cb4d88304ae455e168c514071e3eb9a | C++ | JokerSSmile/KPO | /Lab3/Lab3/Point.cpp | UTF-8 | 282 | 2.796875 | 3 | [] | no_license | #include "stdafx.h"
#include "Point.h"
CPoint::CPoint(int x, int y)
: m_x(x)
, m_y(y)
{
}
int CPoint::GetX() const
{
return m_x;
}
int CPoint::GetY() const
{
return m_y;
}
double CPoint::GetPerimeter() const
{
return 0.0;
}
double CPoint::GetArea() const
{
return 0.0;
}
| true |
7a27053d2ac7b9e5ae65378697e7319e98d25ff9 | C++ | MateoParrado/ArtificialIntelligence | /ArtificialIntelligence/SellState.cpp | UTF-8 | 602 | 2.75 | 3 | [] | no_license | #include "SellState.h"
#include "Fisherman.h"
#include "FishingState.h"
using namespace std;
SellState* SellState::instance = nullptr;
void SellState::enter(Fisherman* f)
{
f->display("going to the market to sell my fish");
f->setLocation(Location::MARKET);
}
void SellState::exit(Fisherman* f)
{
f->display("Lea... | true |
9276a197546a76141579739bb225cba1a8a5951f | C++ | vmeno0020/CS-100-Final-Project | /main.cpp | UTF-8 | 1,159 | 3.265625 | 3 | [] | no_license | #include "src/SudokuBoard.cpp"
#include <iostream>
using namespace std;
int main() {
SudokuBoard* test;
char input = 'x';
cout << "Welcome to our Soduku game! Press 1 to start." << endl;
cin >> input;
if (input == '1') {
test = test->getInstance();
test->createGame();... | true |
bc2dd3ecb8c3300e05cbce37293461b98588d547 | C++ | hjw21century/Algorithm | /LeetCode/CountSortedVowelStrings/main.cxx | UTF-8 | 904 | 2.984375 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <gtest/gtest.h>
using namespace std;
class Solution {
public:
int countVowelStrings(int n) {
return count(5, n);
}
private:
map<pair<int, int>, int> mm;
int count(int v, int n) {
if (v == 1) return 1;
if (n == 1) return v;
auto f = m... | true |
966db51f3fc4fa7862ca68b27384abcf96b41148 | C++ | syshim77/FirstTouch | /2017년 1학기/study 17-2/study 17-2/1932_2.cpp | UTF-8 | 663 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, res;
int tri[501][501] = { 0 };
int sum[501][501] = { 0 };
cin >> n;
for (int i = 0; i < n; i++)
{
for (int j = 0; j <= i; j++)
cin >> tri[i][j];
}
sum[0][0] = tri[0][0];
for (int i = 1; i < n; i++)
{
for (int j = 0; ... | true |
2c5c55bc208d8a1d5b428cd51ad548e3eb15bc69 | C++ | intheory0/data_structures | /heap.h | UTF-8 | 344 | 2.75 | 3 | [] | no_license | #ifndef HEAP_H
#define HEAP_H
class Heap
{
private:
int *arr;
int size;
int capacity;
public:
Heap();
Heap(Heap &h);
Heap(int capacity);
Heap(int *arr, int capacity);
void insert(int value);
void shift_down(int i);
void shift_up(int i);
void merge(Heap &h);
void make_heap();
in... | true |
42eea56a4a2ac01abec89cbe67a7ac814aa9b302 | C++ | asyncvlsi/SPRoute | /include/lefDataBase.h | UTF-8 | 9,444 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef LEFDATABASE_H
#define LEFDATABASE_H
#include "header.h"
#include "sprouteDataType.h"
namespace sproute_db
{
class ViaRuleGenerateLayer
{
public:
string layerName;
Rect2D<float> rect;
Size2D<float> spacing;
Size2D<float> enclosureOverhang;
ViaRuleGenerateLayer( ) { }
void print()... | true |
0be9a36fcd0f938bb36ea9c05f3ad42fc7f2dae4 | C++ | estifanos-si/Ares | /include/utils/game/game.hh | UTF-8 | 3,122 | 3.03125 | 3 | [] | no_license | #ifndef GAME_HH
#define GAME_HH
#include "utils/gdl/clause.hh"
#include "utils/memory/namer.hh"
#include "utils/threading/locks.hh"
#include "utils/utils/hashing.hh"
#include <iostream>
#include <thread>
#include <unordered_map>
namespace ares
{
class State;
typedef const Term Move;
typedef const Term Rol... | true |
5d02a54ffcbaace00297cdf56aa64e733b87d52f | C++ | wuxiang/servercode | /pushServer/src/process/model/selfstock/StkCodeOperate.cpp | GB18030 | 3,967 | 2.703125 | 3 | [] | no_license | #include "StkCodeOperate.h"
#include "../../../util/util.h"
// תС
static const int MaxExchangeBufSize = 1280;
// ʽַĬϳ
static const short DefaultFormatLen = 128;
CStkCodeOperate::CStkCodeOperate(const unsigned short AlignLen)
: m_uAlignLen(AlignLen)
{
}
CStkCodeOperate::~CStkCodeOperate(void)
{
}
// Ӵ
const int
CSt... | true |
5e2fd6379069686ed0ba12fb1cf115dbd0e7ad77 | C++ | saswatraj/project_eular | /ques25.cpp | UTF-8 | 792 | 3.125 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
vector<int> add(vector<int> num1,vector<int> num2)
{
vector<int> num3;
int carry = 0,sum=0,d1,d2;
while(!((num1.size()==0)&&(num2.size()==0)))
{
if(num1.size()>0){
d1 = num1.back();
num1.pop_back();
}
else
d1 = 0;
if(num2.size()>0){
d2 = ... | true |
f8d44547d452b029c26e4a433dd9233eda48d964 | C++ | icecoolr1/c | /前50个素数.cpp | UTF-8 | 319 | 2.984375 | 3 | [] | no_license | #include <stdio.h>
int main()
{
int x;
int count=0;
for(x=1;count<=50;x++){
int i;
int isprime=1;
for(i=2;i<x;i++){
if( x % i==0){
isprime=0;
break;
}}
if(isprime==1){
count++;
printf("%d\t ", x);
if(count%5==0){ printf("\n");
}
}
}
return 0;
}
| true |
18c12b62bc662ed407ea1616a065f43edc386a33 | C++ | sharadregoti/Old_College_Stuff | /AntopHill_Monitoring_Project/Without_Debug_Code/AntopHill_Project/Alarm_Router_On_Off.ino | UTF-8 | 1,511 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive |
// turn on or off alarm or jioRelay
void turnOn_Off(int pos, int value ) {
digitalWrite(pos, value);
}
// whatever the current time go for deep sleep every 30th minute or 60th(00) minute of each hour
void dynamicDeepSleep() {
Serial.println("DYNAMIC SLEEP");
// first parameter: Time zone in floating point (fo... | true |
55688fdbad941e6d891bd61f1d7fae27b84704bc | C++ | Tahfimul/CPlusPlus-Projects | /Program100.cpp | UTF-8 | 452 | 3.234375 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
using namespace std;
//Tahfimul Latif
//Program100
//Print the elements in an array set by users
//March 5, 2018
int main()
{
int n[10];
cout<<"Enter Elements of the array"<<endl;
for(int i = 0; i<(sizeof(n)/sizeof(*n));i++)
{
cout<<"Element"<<setw(13)<<i<<en... | true |
4bb68131f34cf1369155e4ce3c16a8f71e07db96 | C++ | i-shalev/Stowage-Model | /src/simulator/main.cpp | UTF-8 | 2,883 | 3.046875 | 3 | [] | no_license | #include <algorithm>
#include "main.h"
#define PATH_TO_EMPTY_FILE R"(.\empty.empty_file)"
int main(int argc, char **argv){
std::map<std::string, std::string> args;
std::vector<std::string> errors;
int numThreads;
bool errorInCreateArgs = false;
if(createArgs(args, argc, argv)){
errorInCre... | true |
1e569551db8630820b892dbf051d4cf94226beb3 | C++ | rene128x/OpencvTest_Cpp | /lib/ConfigParser.h | UTF-8 | 628 | 2.921875 | 3 | [] | no_license | #ifndef CONFIGPARSER_H_
#define CONFIGPARSER_H_
#include <map>
#include <string>
using namespace std;
class ConfigParser {
public:
ConfigParser(const string &configFile);
int getProperty(const string &name);
bool getFlag(const string &name);
string getText(const string &name);
void setProperty(const string &na... | true |
ba010253aabf3c73daaa6dd663ffe37ffdbff0c6 | C++ | Twice22/acceleratedcpp | /Chapter10/chapter10.2/chapter10.2/chapter10.2.cpp | ISO-8859-1 | 1,835 | 3.71875 | 4 | [] | no_license | // chapter10.2.cpp: dfinit le point d'entre pour l'application console.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
template <class T, class Iterator>
T median(Iterator b, Iterator e) {
if (b == e)
thr... | true |
f90ff2249e49e2e7658a51e9dc194f5eef600686 | C++ | knightzf/review | /leetcode/numberOfAtoms/main.cpp | UTF-8 | 2,118 | 3.1875 | 3 | [] | no_license | #include "header.h"
class Solution {
public:
string countOfAtoms(string formula) {
const map<string, int>& res = impl(formula);
stringstream ss;
for(auto& p : res)
{
ss << p.first;
if(p.second > 1)
ss << p.second;
}
... | true |
71a0132923ee8cdccaa94ad4407f5f0e93ed0080 | C++ | markstev/arduinoio3 | /bidir_serial_main_for_test.cc | UTF-8 | 1,918 | 2.609375 | 3 | [] | no_license | #include "arduino_simulator.h"
#include "bidir_serial_module.h"
#include "message.h"
#include <cstring>
#include <stdlib.h>
const int kOtherAddress = 1;
int main(int argc, char **argv) {
// arg1 = incoming serial file.
// arg2 = outgoing serial file.
if (argc < 4) {
printf("Call with args:\nbidir_serial_mai... | true |
e91a0da4bf8587b699060b6a6b48e332e3739d15 | C++ | Naooki/stroustrup_ppp_exercises | /Chapter-11/ex 12.cpp | UTF-8 | 879 | 3.09375 | 3 | [] | no_license | /*
Okay, so here I have a bug: in input like "ab/n cd" some 1 character just goes nowhere...
Here is a discussion about an issue:
http://www.cplusplus.com/forum/general/120661/
*/
#include "../../../../libs/std_lib_facilities.h"
int main()
try
{
cout << "Input file name: ";
string file_name;
cin ... | true |
b17e3ee5a70415098057e81519f013762a94682d | C++ | shaikhsajid1111/data-structure-and-algorithms | /Algorithms/Sorting Algorithms/insertion sort.cpp | UTF-8 | 2,356 | 4.21875 | 4 | [] | no_license | #include<iostream>
#include<cstdlib>
int *insertion_sort(int arr[],int size);
void printArray(int arr[],int size);
int main(int argc, char const *argv[])
{
int arr[5] = {5,8,9,0,4};
insertion_sort(arr,5);
printArray(arr,5);
/*output : 2,3,4,5,8*/
system("pause");
return 0;
}
int *insertion_sort(int arr[],int s... | true |
c78dae71b55eb379dc3070d404eb5d62261da67f | C++ | daniel8060/CodeSnippets | /BruinopolyFiles/statics.h | UTF-8 | 889 | 3.15625 | 3 | [] | no_license | #ifndef STATICS_H
#define STATICS_H
/*
This class will be responsible for taking data from the Game Setting screen and passing to
any other in-game object that need them.
*/
class Statics {
private:
int MONEY_MAX, HOUSES_MAX, HOTELS_MAX, STARTING_AMOUNT;
public:
Statics(
//default setti... | true |
5661b937e93ac03bf379e02a68da4383acdfad57 | C++ | masterchef2209/coding-solutions | /codes/codeforces/1093B.cpp | UTF-8 | 475 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
int arr[26];
int bulb=1;
memset(arr,0,sizeof(arr));
for(int i=0;i<s.size();i++)
{
if(i>0)
{
if(s[i]!=s[i-1])
bulb=0;
}
arr[s[i]-'a']++;
}
if(bulb==1)
cout<<-1<<endl;
e... | true |
c2bd45b8ef0df0283bd7178b6d643b2008f2ed8d | C++ | Tecprog-voID/voID | /src/Customs/GameOverScript.cpp | UTF-8 | 3,101 | 2.890625 | 3 | [
"MIT"
] | permissive | /**
@file GameOverScript.cpp
@brief Methods that manages the game over script of the game.
@copyright LGPL. MIT License.
*/
#include "Customs/GameOverScript.hpp"
#include "Log/log.hpp"
#include <cassert>
const int quantityFrameLine = 22;
const int quantityFrameColumn = 12;
GameOverScript::GameOverScript... | true |
0784d8a7951748db96059c0bf637ff888f7e5dda | C++ | douglascastrorj/compilador | /Exemplos Cython/operadores/expressao.cpp | UTF-8 | 697 | 3.25 | 3 | [] | no_license |
/*Compilador Bolado*/
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int temp1;
int temp2;
int temp3;
int temp4;
float temp5;
float temp6;
float temp7;
float temp8;
float temp9;
float temp10;
float temp11;
float temp12;
float temp13;
float temp14;
int main(void)
{
temp1 = 1;
temp2 ... | true |
fa56c16e0a8ebe2c64e623075fa9df13152b5004 | C++ | mikechen66/CPP-Programming | /CPP-Programming-Language/chapter22-runtime/ex04.cpp | UTF-8 | 689 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <map>
#include <numeric>
using namespace std;
void readitems(map<string,int>& m) {
string word;
int val = 0;
while (cin >> word >> val)
m[word] += val;
}
int tally_word(int total, const pair<string,int>& p) {
cout << p.first << '\t' << p.second << '\n';
return... | true |
569fc05f5862e3268348281032e17aa6c9b4750f | C++ | cisc0f/genealogicalTreeGraph | /main.cpp | UTF-8 | 5,203 | 3.421875 | 3 | [] | no_license | #include "genogram.h"
#if defined(_WIN32) || defined(WIN32)
const char* clearTerminalCmd = "cls";
void prettyPrint(int color, std::string text){
std::cout << text;
}
void prettyPrintError(std::string text){
std::cout << text;
}
#else
const char* clearTerminalCmd = "clear";
void prettyPrint(int c... | true |
daccd6119cea0cd75748219d2ace4446ea01cc20 | C++ | breadpitt/DU-CS | /CompProg/Assignments/Assignment4/Apartment.cpp | UTF-8 | 2,076 | 3.640625 | 4 | [] | no_license | //
// Created by jasha on 11/5/2017.
//
#include "Dwelling.h"
#include "Apartment.h"
#include <iostream>
// Default Constructor
Apartment::Apartment() : Dwelling(), apartment_number(0), rent(0) {
}
Apartment::Apartment(int rooms, int bathrooms, float square_footage, int apt_number, float temp_rent) :
... | true |
97986e220c276ef7fa7faf182ac3e41f29047374 | C++ | TomatoVampire/MySchedulingTest | /ScheduleTest/HRF.h | UTF-8 | 2,105 | 2.890625 | 3 | [] | no_license | #pragma once
#include"Scheduling.h"
#include<vector>
class HRF : Scheduling {
private:
//响应比
double* Rp;
virtual void init() {
}
virtual void schedule() {
int doneCount = 0;
int* doneProcess = new int[num];//[i]:第i个进程是否已经完成 0:未完 1:完成
for (int i = 0; i < num; i++) { doneProcess[i] = 0; }
int nowTime = 5... | true |
1610f9ea17e8f6e2c682b9594fd35ed8ed422263 | C++ | ReFRACtor/framework | /lib/Support/array_with_unit.h | UTF-8 | 6,732 | 3.234375 | 3 | [] | no_license | #ifndef ARRAY_WITH_UNIT_H
#define ARRAY_WITH_UNIT_H
#include "printable.h"
#include "unit.h"
#include "double_with_unit.h"
#include <blitz/array.h>
namespace FullPhysics {
/****************************************************************//**
We frequently have a array of numbers with units associated with
them. Th... | true |
cad7a5f20106bcf9f1c7a0ac89662be2eb06df7b | C++ | SaintGimp/MPPTSolarCharger | /code/source/console/console_internal.cpp | UTF-8 | 4,311 | 3.015625 | 3 | [] | no_license | #include <stdint.h>
#include <stdlib.h>
#include <cstring>
#include <ctype.h>
#include <utility>
#include "console_io.h"
#include "console_commands.h"
#include "console_internal.h"
namespace console
{
// Local functions
static int32_t StringToNumber(const char *p, char **out_p, int base);
void CommandCom... | true |
b88c2e0d42392839b43a80f87d52e104c1f60d0c | C++ | dhk1349/Data_Structure | /2020_TA/Lab3_pointer example/Lab03/TempType.cpp | UTF-8 | 430 | 2.640625 | 3 | [] | no_license | #include "pch.h"
#include "TempType.h"
TempType::TempType()
{
numOfItems = 0;
}
TempType::~TempType()
{
}
void TempType::AddtItem(ItemType* _tItem)
{
tItemList.AddToCircularQueue(_tItem);
numOfItems++;
}
ItemType* TempType::DequeueFromtItemList()
{
ItemType* tmp;
tmp = new ItemType;
tItemList.DeleteFrCircula... | true |
12fd916af223c9ec936c4c3165d5505bc882c09d | C++ | MrAsminaf/TicTacToe_SFML | /MainWindow.h | UTF-8 | 1,386 | 2.953125 | 3 | [
"MIT"
] | permissive | #pragma once
// SFML headers
#include <SFML\Graphics.hpp>
// my headers
#include "Button.h"
#include "Scoreboard.h"
// other imports...
#include <vector>
class MainWindow
{
public:
MainWindow();
void RunGameLoop();
private:
void PlayerInput();
void Logic();
void RoundEnd(float x_winningLine, float y_winningLi... | true |
6d331437ec063efe1581e55515745587906f67fa | C++ | visotw/test | /src/ringbuffer.h | UTF-8 | 2,034 | 3.234375 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown",
"GPL-2.0-only",
"Unlicense"
] | permissive | #ifndef RINGBUFFER_H
#define RINGBUFFER_H
#include <algorithm> // for std::min
#include <cstdint>
#include <chrono>
using hrc = std::chrono::high_resolution_clock;
using ms = std::chrono::milliseconds;
using us = std::chrono::microseconds;
using ns = std::chrono::nanoseconds;
using sec = std::chrono::seconds;
class R... | true |
9a186f8b2eba8559d1aa2bbfa1b0c84633a9db9c | C++ | JordyMoos/lazyfoo-sdl2 | /Texture.h | UTF-8 | 665 | 2.890625 | 3 | [] | no_license | #pragma once
#include <string>
#include <SDL.h>
class Texture {
public:
Texture();
~Texture();
bool loadFromFile(const std::string &path);
bool loadFromRenderedText(const std::string &text, SDL_Color color);
void free();
void setColor(Uint8 red, Uint8 green, Uint8 blue);
void setAlpha(U... | true |
997ed997f3c8817b39399ae37288258dbe5ac145 | C++ | notoraptor/cigmar | /src/cigmar/classes/StringView.hpp | UTF-8 | 1,463 | 3.25 | 3 | [] | no_license | /* Work In Progress. */
#ifndef CIGMAR_CSTRING_HPP
#define CIGMAR_CSTRING_HPP
#include <cstring>
#include <algorithm>
namespace cigmar {
class StringView {
public:
static const char *empty;
static const char* empty_characters;
private:
const char *member;
size_t len;
public:
StringView() : member(empty... | true |
98dc44c7da9dc15f93d5c11d36adc837bf7b4a2e | C++ | n0lavar/qxLib | /include/qx/algo/contains.h | WINDOWS-1252 | 2,397 | 3.359375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
@file contains.h
@brief Contains "contains" functions (ba-dam-tss)
@details ~
@author Khrapov
@date 6.08.2022
@copyright Nick Khrapov, 2022. All right reserved.
**/
#pragma once
#include <algorithm>
namespace qx
{
/**
@brief Check if range cont... | true |
3c29e7bf1f710c8e43afdbeb26498ad528d6ec68 | C++ | pedroamadorb/semana07 | /ejemplo_random.cpp | UTF-8 | 490 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
//Limite maximo
cout << "Limite Maximo de Random :" << RAND_MAX << endl << endl;
//Generar numeros randoms
for (int i=0; i < 10; i++)
{
cout << "numero " << i + 1 << " : " << rand() << endl;
}
//Gene... | true |
5154f4a790a115a1c0379ba2d5208a36ea3990e7 | C++ | shin-eunji/TIL-1 | /Algorithms/N!_ZeroCount.cpp | UTF-8 | 534 | 2.796875 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main() {
int n, num, tmp;
int count1=0, count2=0;
cin >> n;
for(int i=2; i<=n; ++i) {
tmp = i;
while(tmp != 0) {
if(tmp%2 == 0) {
count1++;
tmp=tmp/2;
}
if(tmp%5 == 0) {
... | true |
3f6accabf15fe70eb51e5febee81996ac13f0049 | C++ | JosanSun/MyNote | /C++/关键字/volatile/volatile/volatile.cpp | GB18030 | 751 | 3.171875 | 3 | [] | no_license | /*
* ---------------------------------------------------
* Copyright (c) 2017 josan All rights reserved.
* ---------------------------------------------------
*
* ߣ Josan
* ʱ䣺 2017/10/2 15:10:51
*/
#include <iostream>
using namespace std;
int main()
{
//α
{
const int a = 100;
in... | true |
d062dbf98b8fc98b37a94a38086d17e46fbfa6ee | C++ | empireofyt/pat-yiji | /1081/1081.cpp | UTF-8 | 919 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include"string.h"
#define M 20
using namespace std;
int mima(char str[],int n)
{
int shuzi=0,zimu=0,fal=0;
if(6>n)
printf("Your password is tai duan le.\n");
else
{
for(int i=0;i<n-1;i++)
{
if(str[i]>='0'&&str[i]<='9')
... | true |
ca1de2f934f8ac635f49ae77b3ddae5f13ce2da6 | C++ | barteqx/geo2015 | /geometric/deleted/ruleset.cpp | UTF-8 | 3,607 | 2.796875 | 3 | [] | no_license |
// written by Hans de Nivelle, June 2014.
#include "ruleset.h"
std::ostream& geometric::operator << ( std::ostream& out, rule_use r )
{
switch(r)
{
case rule_use::disj_res_active:
out << "disj_act"; return out;
case rule_use::disj_res_passive:
out << "disj_pass"; return out;
case rule_use... | true |
1092217d05fbc9223a37eec2c04d6fe1b8f16838 | C++ | pythonicrane/ComptuerGraphics | /Simple.cpp | GB18030 | 1,119 | 3.046875 | 3 | [] | no_license | /**
*ͼѧڶ¸
*@author ZhaoHeln 20171130 17:18:30
*/
#include<gl/glut.h>
void init(void)
{
glutSetColor(0, 0.0f, 0.0f, 0.0f);
glutSetColor(1, 1.0f, 0.0f, 0.0f);
glutSetColor(2, 0.0f, 1.0f, 0.0f);
glutSetColor(3, 0.0f, 0.0f, 1.0f);
glClearColor(1.0, 1.0, 1.0, 0.5);//ڱɫ
glMatrixMode(GL_PROJECTION);//ģͣʲô
gluOrtho2D(0... | true |
7a47efe6404ab36969cf3d6e80bd2353e0bc27cd | C++ | cies96035/CPP_programs | /Kattis/AC/nodup.cpp | UTF-8 | 384 | 2.53125 | 3 | [] | no_license | #include<iostream>
#include<set>
using namespace std;
string ipt;
bool dup;
set<string> dic;
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
while(cin >> ipt){
if(dic.find(ipt) != dic.end()){
dup = true;
}
dic.insert(ipt);
}
if(dup){
cout << "... | true |
879966f0fbb73c4408dd821a279c3aa58f327ddb | C++ | Victor-Frocrain/FUN_imageCompressor_2019 | /bonus/imageReader/src/Parser.cpp | UTF-8 | 552 | 2.6875 | 3 | [] | no_license | /*
** EPITECH PROJECT, 2020
** Parser
** File description:
** Parser.cpp
*/
#include "../include/Parser.hpp"
#include "../include/ImageReaderException.hpp"
Parser::Parser(const int &ac, char **&args)
{
if (ac == 2) {
_filePath = args[1];
}
else {
throw ImageReaderException("Please, enter 2... | true |
7583e725ce83bdd9986b0f7581ac6b7b342b5dd8 | C++ | bluedawnstar/algorithm_study | /library/polynomial/pentagonalNumber.cpp | UTF-8 | 1,713 | 2.78125 | 3 | [
"Unlicense"
] | permissive | #include <vector>
#include <algorithm>
using namespace std;
#include "pentagonalNumber.h"
/////////// For Testing ///////////////////////////////////////////////////////
#include <time.h>
#include <cassert>
#include <string>
#include <iostream>
#include "../common/iostreamhelper.h"
#include "../common/profile.h"
#i... | true |
14fe24d13fcfcd459cb9dddfaa97c6e2d4a6a4d6 | C++ | tigoe/MakingThingsTalk2 | /chapter9/project27/SonMicroFirmware/SonMicroFirmware.ino | UTF-8 | 924 | 3.0625 | 3 | [] | no_license |
/*
SM130 Firmware reader
Context: Arduino
*/
#include <Wire.h>
void setup() {
// initialize serial and I2C:
Serial.begin(9600);
Wire.begin();
// give the reader time to reset:
delay(2000);
Serial.println("asking for firmware");
// open the I2C connection,
// the I2C address for the reader is 0x42... | true |
e8f06007e3d2f3b80be9adbc01b4b1ac50739970 | C++ | llwwlql/Dictionary | /代码库/Dev c++/Dividing.cpp | GB18030 | 1,082 | 2.71875 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
int dp[120005];
void ZeroOnePack(int v,int w,int V)
{
int j;
for(j=V;j>=w;j--)
{
if(dp[j-w]+v>dp[j])
dp[j]=dp[j-w]+v;
}
}
int main()
{
int n[10],N=6;
int V;
int i,j,k;
int index=0;
while(scanf("%d %d %d %d %d %d",&n[1],&n[2],&n[3],&n[4],&n[5],&n[6]),n[1]||n[2]||n[3]... | true |
bf88eca22575c7a327b80de4940332e008297eb1 | C++ | ctkhanhly/C- | /homework/hw07/gameOfMedievalTIme/Lord.cpp | UTF-8 | 2,633 | 3.109375 | 3 | [] | no_license | #include "Lord.h"
#include "Protector.h"
using namespace std;
namespace WarriorCraft{
size_t Lord::lookForProtector(Protector& protector) const{
size_t pIndex = armyOfProtectors.size();
for(size_t i = 0; i < armyOfProtectors.size(); ++i){
if(armyOfProtectors[i] == &protector){
... | true |
c41d9dc7a5a25a7668963e8b1c6beb0c2c4b2a3d | C++ | sfofgalaxy/Summary-of-Software-Engineering-Coursework-in-Zhejiang-University | /2大二/面向对象程序设计/教师内部资料/Courseware/review/异质list/IntNode.h | WINDOWS-1252 | 144 | 2.765625 | 3 | [] | no_license | class IntNode : public Node
{
int i;
public:
IntNode(int ii=0): i(ii)
{}
void print() const
{
cout << "" << i << endl;
}
};
| true |
d30a8c5d863724f314d0688760c2e1cb916fca75 | C++ | conornewton/timetabling-bristol | /src/Data/Teachers.cpp | UTF-8 | 1,480 | 3.140625 | 3 | [] | no_license | #include "Teachers.hpp"
#include "../CSV/CSV.hpp"
#include "Data.hpp"
#include "Activities.hpp"
#include <sstream>
std::string Teacher::to_string() {
std::stringstream s;
s << ID << ", ";
for (int a : activities) {
s << a << " ";
}
s << pathway_one << ", ";
for (int t : bad_timeslots) {
s << t << " ";
... | true |
d327c3cdd93bae5a8113f84fc7a5e0c4959ce7c5 | C++ | matanki-saito/BMFont | /source/acutil_path.cpp | UTF-8 | 6,135 | 2.671875 | 3 | [
"Zlib"
] | permissive | /*
AngelCode Tool Box Library
Copyright (c) 2012-2016 Andreas Jonsson
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this softwar... | true |
65003774c8ea5694f9149bcd273b3866b666ce8a | C++ | mobi12/study | /cpp/move.cpp | UTF-8 | 217 | 3 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int *pt = new int [10];
pt[0] = 1;
pt[1] = 2;
pt[5] = 5;
cout << pt[0] << endl;
cout << pt[1] << endl;
cout << pt[5] << endl;
delete pt;
return 0;
}
| true |
52b73f93ab41e1a0743fd177800792b062667d3a | C++ | sebbekarlsson/cpluspong | /Game.h | UTF-8 | 3,965 | 3.109375 | 3 | [] | no_license | extern const int WIDTH;
extern const int HEIGHT;
extern const int SCALE;
SDL_Window* display = NULL;
class Game {
public:
bool quit;
std::list<Instance*> instances;
std::list<Instance*>::iterator iter;
SDL_GLContext context;
/**
* Constructor
*/
... | true |
9457c8855f4d858292a772845038bc2c676d614c | C++ | alisw/AliPhysics | /PWGCF/FEMTOSCOPY/AliFemto/AliFemtoTrio.cxx | UTF-8 | 5,127 | 2.71875 | 3 | [] | permissive | ///
/// \file AliFemtoTrio.h
/// \author Jeremi Niedziela
#include <TMath.h>
#include "AliFemtoTrio.h"
#include "AliFemtoLorentzVector.h"
AliFemtoTrio::AliFemtoTrio():
fTrack1(nullptr),
fTrack2(nullptr),
fTrack3(nullptr),
fTrack1type(kUnknown),
fTrack2type(kUnknown),
fTrack3type(kUnknown)
{
}
AliFemtoTrio::AliFe... | true |
694bb7b4f86223a1a8f56fcee58502bb193f206c | C++ | firiexp/contest_log | /yukicoder/193.cpp | UTF-8 | 1,002 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;
template<class T> constexpr T INF = ::numeri... | true |
5a926376cf797866af128e9798f86e788285fbb3 | C++ | devang-m/DataStructure-Algo-Practice | /Dijkstra2.cpp | UTF-8 | 1,347 | 2.578125 | 3 | [] | no_license | //http://codeforces.com/problemset/problem/20/C
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#define loop(i,n) for(int i = 0; i < n; i++)
#define pb push_back
#define INF 1e15
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int, int> ipair;
int m... | true |
3f8a62139f015f426e1aca5f9da71778ea00d484 | C++ | xucaimao/netlesson | /pa3/cy08-02.cpp | UTF-8 | 1,401 | 3.484375 | 3 | [] | no_license | /*
程序设计实习MOOC /程序设计与算法(三)第八周测验(2018秋季)
2:按距离排序
write by xucaimao,2018-10-24
非常神奇的函数对象,
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
template <class T1,class T2>
struct Closer {
// 在此处补充你的代码
private:
T1 n;
T2 op;
public:
Closer(T1 n_,T2 op_):n(n_),op... | true |
91f2157ff06cd8692f0c70b0205c31d298e68506 | C++ | k-eck/DataStructures-List | /List.h | UTF-8 | 4,906 | 3.578125 | 4 | [] | no_license | #pragma once
template <typename T>
class List
{
struct ListNode
{
ListNode()
{
}
T mData;
ListNode* mPrev;
ListNode* mNext;
};
int mSize;
ListNode* mHead;
ListNode* mTail;
T mUndefined;
public:
List()
{
mHead = new ListNode;
mTail = new ListNode;
mHead->mNext = mTail... | true |
303740e021735cbe4e62992c8e2d3a57f932bccd | C++ | Oureyelet/Chapter-9-Arrays--Strings--Pointers--and-References--vsCode- | /9.14 — Dynamically allocating arrays (vsCode)/Question2(anwser).cpp | UTF-8 | 1,396 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <algorithm>// std::sort
#include <cstddef>// std::size_t
#include <limits>// std::numeric_limits
#include <string>
using namespace std;
//forward functions declaration
size_t getNameCount();
void getNames(string*,size_t);
void printNames(string*,size_t);
int main()
{
std::size_t leng... | true |
b5825c69b65a0cd85d642805a2451fa47f782a24 | C++ | 4eetah/AlgoLib | /clients/EdgeWeightedGraph_cli.cpp | UTF-8 | 778 | 3.0625 | 3 | [] | no_license | #include "EdgeWeightedGraph.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char** argv)
{
if (argc != 2) {
cerr << "Using: ./main EdgeWeightedInputFile\n";
exit(1);
}
fstream fin(argv[1]);
if (!fin.is_open()) {
cerr << "Can't... | true |
b166f22986d42844acca3f8232f671b6aa7a9039 | C++ | Argons/Cracking-the-Coding-Interview | /Bit_Manipulation-6.cpp | UTF-8 | 454 | 3.8125 | 4 | [] | no_license | # include <iostream>
using namespace std;
// Write a program to swap odd and even bits in an integer with as
// few instructions as possible.
// e.g., bit 0 and 1 are swapped, bit 2 and bit 3 are swapped, etc.
int iwapOddAndEvenBits(int num) {
// &0xA (= 1010), record the odd bits;
// &0x5 (= 0101), record ... | true |
574cc66015a1657439e98231437bb339d13c8d68 | C++ | zahidzhp/ALL-MY-ACM-CODES | /CodeForces/750C. New Year and Rating.cpp | UTF-8 | 1,214 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
int arr[200005];
int divis[200005];
int n;
int check(int k)
{
register int i,j;
for(i=n-1; i>=0; i--)
{
k-=arr[i];
if(divis[i]==1&&k<1900) return 1;
else if(divis[i]==2&&k>=1900) return -1;
}
return 0;
}
int main()... | true |
a54bfd93888274a945a09aaa5f20867b82bf6e4e | C++ | pleasemarkdarkly/iomega_hipzip | /dev/player/util/registry/src/Registry.cpp | UTF-8 | 1,776 | 2.71875 | 3 | [] | no_license | // Registry.cpp: system wide class registry
// danc@iobjects.com 07/08/01
// (c) Interactive Objects
#include "RegistryImp.h"
#include <util/debug/debug.h>
//
// C style API
// note that these routines have C linkage
//
int registry_add_item( RegKey key, void* data, short flags, short length )
{
return CRegistr... | true |
f3bf3313d670bc307d7bcd60791b3c115f8260b9 | C++ | SimoGecko/ctci | /src/17_hard/17_6_count_of_2s.cpp | UTF-8 | 1,055 | 3.234375 | 3 | [] | no_license | // (c) Simone Guggiari 2019 - CTCI
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
constexpr int d = 2;
int clamp(int v, int lo, int hi) {
return max(lo, min(hi, v));
}
int countNumDigitsD(const int N) {
int sum = 0;
int K = floor(log10(N) + 1);
for (int i = 0;... | true |
0b02b3f962a4f3dd450a84ba5a018316ca92bd33 | C++ | boleaczek/FileTransfer | /src/tools/StringToEnumNumber.cpp | UTF-8 | 1,454 | 2.890625 | 3 | [] | no_license | #include <algorithm>
#include "StringToEnumNumber.h"
#include "CommandPacket.h"
std::map<std::string, MessageType> StringToEnumNumber::message_type_map = {{"file", MessageType::file}, {"command", MessageType::command}};
std::map<std::string, CommandType> StringToEnumNumber::command_type_map =
{{"remove", Command... | true |
9cbe5131207d2175a01cfd2fdc0c8192cc5433e9 | C++ | yoghourtzzy/DataStructs | /RNP/postfix.cpp | GB18030 | 1,790 | 3.734375 | 4 | [] | no_license | #include<iostream>
#include<string>
#include<cassert>
#include<cctype>
#include<stack>
using namespace std;
/*һʽתΪʽ
صıʽַÿͲ֮䶼һ
*/
string postfix(string exp)
{
char token,//char in exp
topToken;//top element in stack
stack<char>opStack;//the stack to storage operator in exp
string postfixExp;
for (int i = 0;i < e... | true |
b8a04e4c5a74e046c0ec620b6429b1b02bdf9e58 | C++ | leethomason/OpenSaber | /src/st7735/Grinliz_Util.h | UTF-8 | 10,393 | 3.109375 | 3 | [] | no_license | #ifndef GRINLIZ_UTIL_INCLUDED
#define GRINLIZ_UTIL_INCLUDED
#include <string.h>
#include <stdint.h>
class Stream;
#include "grinliz_assert.h"
#include "fixed.h"
template<class T>
T clamp(T value, T lower, T upper) {
if (value < lower) return lower;
if (value > upper) return upper;
return value;
}
template<class... | true |
8428119b979a909ad57b0863e545ff0f10c81677 | C++ | KoTLiK/VUT-FIT | /2015-2016/IJC/du2/tail2.h | UTF-8 | 1,243 | 2.9375 | 3 | [
"MIT"
] | permissive | /**
* @file tail2.h
* @brief Riesenie IJC-DU2-1, 12.4.2016
* @author Milan Augustin, xaugus09, VUT-FIT
* @details Prelozene: g++ 4.8
* Ze zadaného vstupního souboru vytiskne posledních 10 řádků.
* Není-li zadán vstupní soubor, čte ze stdin. Je-li programu
* zadán parametr -n číslo,... | true |
ef4a0e87c2268f5e3f5b0fa7ccba8b6cd78bd0a1 | C++ | amitnautiyalcsf/Ciphers | /Code for Alphabetic Substitution.cpp | UTF-8 | 1,171 | 3.59375 | 4 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
void encrypt();
void decrypt();
char lookup(char a, int ch);
int main()
{
int choice;
cout<<"Enter the choice: 1 for Encryption and 0 for Decryption"<<endl;
cin>>choice;
if(choice==1)
encrypt();
else if(choice==0)
decrypt();
return 0;
}
void encrypt()... | true |
421fbf4b9fe5b7f20dc0490d70b9088d32dd22ea | C++ | NiwdEE/Sous-Marin-Autonome | /physic.hpp | UTF-8 | 8,327 | 2.59375 | 3 | [] | no_license | #ifdef WIN32
#include <GL/glew.h>
#endif
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp>
using namespace glm;
/*
Conventions de codage :
La première lettre du nom d'un vec3 correspond à la nature du vec3. Avec V => Vecteur, P => Point, I => Indéfini(mais l'un... | true |
54889e9367971f43d7ac76a6d6f89d84223b7fb5 | C++ | GradyLealand/C | /Searching/HashTable/FileHandler.cpp | UTF-8 | 1,601 | 3.265625 | 3 | [] | no_license | //
// Created by prog2100 on 10/04/18.
//
#include <fstream>
#include <iostream>
#include <cstring>
#include "FileHandler.h"
#include <locale>
using namespace std;
Hash FileHandler::sortDictionary(string readFile, Hash hash)
{
string line;
ifstream fileIn;
try{
fileIn.open(readFile);
}
ca... | true |
ae91d2dcf04964629f59933d53c6653af72e183c | C++ | KaelMa/leetcode | /C++/Palindrome Linked List.cpp | UTF-8 | 1,535 | 3.484375 | 3 | [
"MIT"
] | permissive | // Palindrome Linked List My Submissions Question
// Total Accepted: 25431 Total Submissions: 104985 Difficulty: Easy
// Given a singly linked list, determine if it is a palindrome.
// Follow up:
// Could you do it in O(n) time and O(1) space?
// Subscribe to see which companies asked this question
//My solution
/... | true |
e95ae331081dc5fbd8b51c69925c7f2d11edfd49 | C++ | jjoe64/babydevelop | /beispiele/Qt/mp3_player/gui.cpp | UTF-8 | 3,868 | 2.859375 | 3 | [] | no_license | /* gui.cpp */
#include "gui.h"
//Globale Variablen
extern QString aktuellerPfad;
/* Konstruktor */
GUI::GUI (QWidget *elternWidget) : QWidget (elternWidget)
{
this->setGeometry(0,0,480,383);
//Farbsteuerung ist leider etwas aufwaendig
QColor farbe_gelb; // Gelb soll es sein
fa... | true |
767c8e822a27eb73ad460ac53482a1ee27689c98 | C++ | zg2nets/windows-backend | /Dali/dali-core/dali/internal/event/common/demangler-unix.cpp | UTF-8 | 3,114 | 2.828125 | 3 | [] | no_license | /*
* Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | true |
8e7ec7a2eb4e14e3646ef5534869f4e97a0ed755 | C++ | milanvujmilovic/OSI2019-Grupa-6 | /Dogadjaj.h | UTF-8 | 1,592 | 3.140625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<ctime>
#include <iterator>
class Dogadjaj
{
friend std::ostream& operator<<(std::ostream& stream, const Dogadjaj& other);
std::string naziv;
std::vector<std::string> komentari;
std::string opis;
std:... | true |
07c42d35e8a42dd421bed0bd3c974ce579aad085 | C++ | swallville/java-class | /lib/pop_dup_swap.cpp | UTF-8 | 2,747 | 2.96875 | 3 | [
"MIT"
] | permissive | #include "pop_dup_swap.hpp"
void i_pop(Frame* frame)
{
frame->operandStack.pop();
return;
}
void i_pop2(Frame* frame)
{
frame->operandStack.pop();
frame->operandStack.pop();
return;
}
void i_dup(Frame* frame)
{
frame->operandStack.push(frame->operandStack.top());
return;
}
void i_dup_x1(Fram... | true |
bf041c29ad76d23fa305ff5c8b2be76bee63665e | C++ | ankushgarg1998/Competitive_Coding | /contests/codechef-contests/OCT17/chefcoun.cpp | UTF-8 | 2,009 | 2.703125 | 3 | [] | no_license | #include<iostream>
#include<cstdlib>
#include<vector>
typedef long long int ll;
using namespace std;
int correctSolver(vector <int> a, int N) {
int min = a[0], i;
int ind = 0;
for(i=0; i<N; i++)
{
if(a[i]==1)
{
ind = i;
break;
}
if(a[i]<min)
{
... | true |