uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
37f292c6-fb3c-4169-8279-3ca275112522 | JugalPatel01/CPPTutorial | 40-square_root_decomposition/40-srd01-range_sum_query.cpp | /*
* Square root decomposition
-> we use this technique to reduce amortize time complexity of the program.
-> amortize time compleixty : It will give the average time taken per operation, which will be better than worst-case time
complexity.
-> here in this technique ... | ALGO | 0.999849 | 5.391589 |
92286719-f46c-471a-bc47-450cf074a1dc | Schulz11/Jimenez_Navdev | Arduino.app/Contents/Java/libraries/Temboo/src/utility/tmbmd5.cpp | #include <string.h>
#include <avr/pgmspace.h>
#include "tmbmd5.h"
static const uint8_t Worder[64] PROGMEM = {
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,
5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,
0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9
};
static const uint8_t Rorder[64] PROGME... | ALGO | 0.993087 | 6.111832 |
12ad79fe-d39d-4834-b1b5-990d9074ab71 | ashraf452b/Competitive-programming | Learning Phase/Algorithm/Week 3/Practice M/Road_Construction.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int par[N];
int group_size[N];
int mx;
int find(int node)
{
if(par[node] == -1)
{
return node;
}
int leader=find(par[node]);
par[node]=leader;
return leader;
}
void dsu(int a, int b)
{
int leaderA=find(a);
int leader... | ALGO | 0.999976 | 3.93854 |
a1a0ffa2-8963-4c9d-99f0-dfe8d2cf9e70 | Video-Streaming-Pipeline/Video-Streaming-Pipeline | opencv/sources/apps/traincascade/lbpfeatures.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "lbpfeatures.h"
#include "cascadeclassifier.h"
using namespace cv;
CvLBPFeatureParams::CvLBPFeatureParams()
{
maxCatCount = 256;
name = LBPF_NAME;
}
void CvLBPEvaluator::init(const CvFeatureParams *_featureParams, int _maxSampleCount, Size ... | ALGO | 0.853881 | 6.227878 |
31bdef89-b62c-4e63-85a1-4fd59def6c06 | aceyan/UE4.18.3_release | Engine/Source/ThirdParty/CryptoPP/5.6.5/include/base64.cpp | // base64.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "base64.h"
NAMESPACE_BEGIN(CryptoPP)
namespace
{
const byte s_stdVec[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const byte s_urlVec[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123... | TOOL | 0.904986 | 7.07731 |
856b3131-9792-4be5-a458-3c3b0a9b6b58 | AimanShowkat/robertlafore-cpp | Chapter-5/9.cpp | /*
Repeat Exercise 8, but instead of two int variables, have the swap() function inter-
change two struct time values (see Exercise 6).
*/
//author @Nishant
#include <iostream>
using namespace std;
struct timee{
int hours, mins, secs;
};
void swap(timee&, timee&);
int main(){
timee time1, time2;
cout <... | ALGO | 0.851204 | 5.018193 |
940bb975-cc00-4e45-a2e9-2d21d6d341fc | StarRocks/starrocks | be/src/exec/pipeline/sort/local_partition_topn_context.cpp | #include "exec/pipeline/sort/local_partition_topn_context.h"
#include <exec/partition/chunks_partitioner.h>
#include <utility>
#include "exec/chunks_sorter_topn.h"
namespace starrocks::pipeline {
LocalPartitionTopnContext::LocalPartitionTopnContext(const std::vector<TExpr>& t_partition_exprs, bool has_nullable_key... | DATA | 0.99609 | 7.755844 |
8dacb0e2-60aa-407a-8a28-7a4043f02af9 | Pyowoojin/Algo | 프로그래머스/lv1/12932. 자연수 뒤집어 배열로 만들기/자연수 뒤집어 배열로 만들기.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> solution(long long n) {
string s; s = to_string(n);
vector<int> answer;
for(int i = s.length() -1; i > -1; i--){
answer.push_back(s[i]-'0');
}
return answer;
} | ALGO | 0.999775 | 4.698443 |
6f4f34c4-de7c-467e-a66a-76a8d59936c1 | RPedreira/Beecrowd | Futebol.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 100000
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int matches, balance;
while (cin >> matches >> balance) {
int ans = 0;
bool flag = true;
vector<int> diff;
for (int i = 0; i < matches; i++) {
int a, b;
cin... | ALGO | 0.999602 | 3.784573 |
4d03c9e4-cbb0-40e8-aa70-27e38b2ddb5f | MichiganTechRoboticsLab/SLAM-Scan-Matching | ICP/libicp/matlab/sparsifyMex.cpp | #include "mex.h"
#include <iostream>
#include <string.h>
#include "matrix.h"
#include "kdtree.h"
using namespace std;
void sparsify (double *M,int32_t M_num,int32_t dim,int32_t* idx_sparse,int32_t &idx_size,double min_dist,double out_dist,int32_t idx_start) {
// copy model data to M_data
kdtree::KDTreeArray M... | ALGO | 0.996023 | 5.856135 |
f00abe98-d3ef-4ef2-b038-181ce274ab6e | LiyaoTang/Research-Lib | Interface/cpp/src/unit_test/utils/file_read_write.cpp | #include "file_read_write.h"
#include <fstream>
#include <iostream>
#include "file_utils.h"
std::string trim(const std::string &s, char t) {
if (s.empty()) {
return s;
}
int begin_idx = 0;
int end_idx = s.length() - 1;
if (t != 'z') {
while (begin_idx <= end_idx && s[begin_idx] == ... | TOOL | 0.925576 | 4.235188 |
caf7b97b-22ca-4532-9eab-0f5d05364530 | merja-shourov/Codeforces | linked_list.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int val;
Node *next;
Node(int val ){
this->val = val;
next = NULL;
}
};
void print_node( Node *head ){
Node *tmp = head;
while (tmp != NULL )
{
cout << tmp->val << endl;
... | ALGO | 0.999738 | 4.139118 |
0b2b1133-97e0-466f-918f-e865d4445810 | hjiang13/LLMs-in-IR | POJ-104/101/954.cpp | #include <iostream>
using namespace std;
int pa(int i,int j,int k)
{
int d=0;
if(i==0)
{
if(j>=i&&k!=i)
d=1;
return d;
}
if(i==1)
{
if((j>=i&&k==i)||(j<i&&k!=i))
d=1;
return d;
}
if(i==2)
{
if(j<i&&k==i)
d=1;
return d;
}
}
int pb(int i,int j,int k)
{
int d=0;
if(j==0)
{
if(j<=i&&k<=i)
d=1;
return d;
}
if(j==1)
{
if((j>... | ALGO | 0.999886 | 3.584231 |
2e331ed9-374b-4117-9e62-d2e9e9389187 | utkusenocak/CppTemplatesAndSTL | 2-Stl Containers/list.cpp | #include <iostream>
#include <list>
using namespace std;
template <typename T>
void printl(const list<T> & l) {
if (l.empty()) return;
for (const T& i : l) cout << i << " ";
cout << endl;
}
void message(const char* s) { cout << s << endl; }
void message(const char* s, const int n) { cout << s << ": " << n << endl;... | TOOL | 0.921052 | 4.071071 |
3a976f88-743f-4d8b-bf35-5190fae15d46 | Ali-Elshorpagi/algorithms | sorting_algorithms/problem_solving/LeetCode_1921.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef vector<int> vi;
#define _CRT_SECURE_NO_DEPRECATE
#define __elshorpagi__ (ios_base::sync_with_stdio(false), cin.tie(NULL))
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define edl '\... | ALGO | 0.999835 | 4.758702 |
210b519b-e8e7-4116-81de-a6f2abc71feb | ChinmayiCR/CPP-Codes | coinChangeMin.cpp | #include <iostream>
#include <string.h>
#define N 4
#define val 4
using namespace std;
int coinChangeMin(int num, int coins[])
{
int dp[num + 1];
memset(dp, 0, sizeof dp);
dp[0] = 0;
for (int i = 1; i <= num; i++)
{
dp[i] = INT_MAX;
for (int j = 0; j < N; j++)
{
... | ALGO | 0.999895 | 5.00539 |
98ea9ba1-8c49-419b-af7c-14ef03f5a70b | divyanshgarg97/Coding-Practise | Leetcode/Binary Tree Level Order Traversal(iterative,recursive).cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<vector<int> > ans;
vector<int> anstemp;
//way1: normal BFS approach
/*
v... | ALGO | 0.999992 | 5.984228 |
077ef6ce-baf0-4024-b822-0a0f5e61aa97 | old-yan/leetcode-solutions | leetcode_solutions/leetcode_900/871/871.cpp | #include "utils.h"
class Solution {
public:
int minRefuelStops(int target, int startFuel, vector<vector<int>>& stations) {
int n=stations.size();
priority_queue<int>Q;
int cur=startFuel;
REP(i,n){
while(Q.size()&&cur<stations[i][0]){
cur+=Q.top();
... | ALGO | 0.9995 | 5.301436 |
2ea7256c-866b-4080-80e7-fe682ddd7694 | veraksiik/homework30.03 | Project10/homework30.03.cpp | #include <iostream>
#include <cstdlib>
#include <Windows.h>
using namespace std;
void generateRandomArray(int arr[], int size) {
for (int i = 0; i < size; ++i) {
arr[i] = rand() % 100;
}
}
int findMinSequenceStart(int arr[], int start) {
if (start > 90) {
return -1;
}
int minSum... | ALGO | 0.998568 | 4.553122 |
f70ca723-7313-4011-b764-86709aec81a6 | alexanderkoo04/cmplrsp24 | A2/H2Q5P2.cpp | #include <bits/stdc++.h>
int main() {
int table[4][3] = {
{0, 2, 1},
{3, 2, 1},
{2, 3, 2},
{3, 3, 3}
};
std::string inputStr;
std::string variable;
std::string equalSign;
std::cin >> variable >> equalSign >>inputStr;
int finState = 2;
int currState = 0;
... | ALGO | 0.999359 | 4.249722 |
7fb0f5ac-3707-420d-9f41-6bbc0e6ecacc | DrawFun/OctaneBlender | blender/source/blender/freestyle/intern/geometry/normal_cycle.cpp | /** \file blender/freestyle/intern/geometry/normal_cycle.cpp
* \ingroup freestyle
* \author Bruno Levy
*/
#include "matrix_util.h"
#include "normal_cycle.h"
namespace Freestyle {
namespace OGF {
//_________________________________________________________
NormalCycle::NormalCycle()
{
}
void NormalCycle::begin... | ALGO | 0.998132 | 4.279031 |
c636f93e-bb34-45cd-af3f-697a8249625f | TEswarreddy/C-Basic-Programs | Main (13).cpp | #include<stdio.h>
int main()
{
int n=5,res=1;
for(int i=1;i<=n;i++)
{
res *=i;
}
printf("%d",res);
} | ALGO | 0.999983 | 4.001062 |
a8610895-77f3-4ea8-b5b0-01fdde17281a | farhan0011/lightOj | B - Large Division.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int tc;
cin>>tc;
for(int t=1;t<=tc;t++)
{
string a;
ll b;
cin>>a;
cin>>b;
if(b<0)
b=b*(-1);
vector<int>dig;
for(int i=0;i<a.size();i++)
{
... | ALGO | 0.998157 | 4.006762 |
4d03cdcd-fbeb-42a4-ba63-5eb22dedf050 | 77Arafat383/Previous-contest-problem | Magical_World.cpp | //**************BISMILLAHIR RAHMANIR RAHIM****************
#include<bits/stdc++.h>
using namespace std;
#define check cout<<'?'<<endl;
#define ll long long
const int M = 1e9+7;
#define all(x) x.begin(), x.end()
#define w(x) while(x--)
#define pi acos(-1.00)... | ALGO | 0.99991 | 3.863497 |
299597af-3dc4-478f-b3a4-ae9ab9b2fb73 | artysta/cpp-simple-algorithms | zadanie-time-h.cpp | #include <time.h>
#include <conio.h>
#include <iostream>
using namespace std;
int main() {
time_t start, koniec;
int rozwiazanie, a, b;
double roznica;
srand(time(NULL));
time( & start);
for (int i = 0; i < 10; i++) {
a = rand() % 10;
b = rand() % 10;
cout << "Ile to "... | ALGO | 0.922577 | 3.171585 |
7e097934-557c-458f-8857-6a602414e94f | NazmulHasanMoon/OJ | Random/lightoj-1354.cpp | #include<bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define sz 100000
#define ff first
#define ss second
#define pi acos(-1.0)
#define ll long long
#define all(a) a.begin(),a.end()
#define mem(a,v) memset((a), v, sizeof(a))
#define faster ios_base::sync_with_stdio(0);cin.tie(0);
#define p... | ALGO | 0.999787 | 3.309995 |
6f2d7b71-f3b6-4f0e-94e9-141936b68ac2 | MohitMehta257/Strivers-SDE-Sheet-Challenge | Rat in a Maze.cpp | #include <bits/stdc++.h>
void ratInMazeHelper(vector<vector<int>> &maze,int i,int j,vector<int> &ds,vector<vector<int>> &ans){
int n = maze.size();
if(i < 0 || j < 0 || i >= n || j >= n)return ;
if(i == n-1 && j == n-1){
ds[n*n-1] = 1;
ans.push_back(ds);
return ;
}
if(maze[i][j] == 0 || maze[i][j... | ALGO | 0.999327 | 5.034537 |
c80a5c64-25bf-4852-883e-535b3f6ce725 | Citrine-q/ChordAnalyzer | makeWAVdata.cpp | #include <bits/stdc++.h>
#include "wave.hpp"
using namespace std;
double r = pow(2.0, 1.0/12.0);
double A_4 = 440.0; // A4(69) = 440Hz
int n = 3;
int main(){
wave sinwave;
sinwave.fs = 44100;
sinwave.bits = 16;
sinwave.L = sinwave.fs * sinwave.bits * 1 / 8 * 6 / 2;
int notes[n] = {72,76,79};
s... | ALGO | 0.988423 | 3.610037 |
f5924c30-242b-4f87-b13f-6153eb7b74f1 | FedericoBrusadin/Laboratorio | lab05/es02.cpp | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cout << "Inserire un numero intero a: ";
cin >> a;
cout << "Inserire un numero intero b: ";
cin >> b;
cout << "Inserire un numero intero c: ";
cin >> c;
if (a >= b && a <= c) {
cout << -1 << endl;
} else i... | ALGO | 0.999802 | 4.708243 |
23aaa74a-c76d-4c69-bb56-3c21dd6b4f13 | ssyphon/LeetCode | 1971. Find if Path Exists in Graph.cpp | /*
There is a bi-directional graph with n vertices, where each vertex is labeled from 0
to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges,
where each edges[i] = [ui, vi] denotes a bi-directional edge between vertex ui and
vertex vi. Every vertex pair is connected by at most one... | ALGO | 0.999966 | 6.5891 |
05bd147b-9fcc-44de-aece-c48fbe752649 | sanhoeeko/packing4 | code/OMPFrame/grid.cpp | #include"pch.h"
#include"grid.h"
#include"gradient.h"
#include"state.h"
#include <cassert>
const int max_particles_in_cell = 32;
const int max_grid_size = 256 * 256;
Grid::Grid() {
p = new VectorList<int, CORES, grid_single_capacity>[max_grid_size];
collision_detect_region = new int[4];
id = -1;
}
void Grid::init(... | ALGO | 0.999314 | 5.398676 |
ca79e6ad-87df-406e-8063-231389223f0f | Bobeye/pydybot | Packages/V-REP_PRO_EDU_V3_2_3_64_Linux/programming/v_repExtPovRay/povray/point.cpp | #include "frame.h"
#include "vector.h"
#include "point.h"
#include "matrices.h"
#include "objects.h"
#include "colour.h"
#include "povray.h"
BEGIN_POV_NAMESPACE
/*****************************************************************************
* Local preprocessor defines
*************************************************... | TOOL | 0.932065 | 5.726136 |
5fce57eb-84b8-4038-86d3-0981e485c585 | DuyhocAI/Play-chess-on-chess.com-with-your-voice | stockfish-windows-x86-64-avx2/stockfish/src/movegen.cpp | #include "movegen.h"
#include <cassert>
#include <initializer_list>
#include "bitboard.h"
#include "position.h"
namespace Stockfish {
namespace {
template<GenType Type, Direction D, bool Enemy>
ExtMove* make_promotions(ExtMove* moveList, [[maybe_unused]] Square to) {
constexpr bool all = Type == EVASIONS || T... | ALGO | 0.97817 | 6.626182 |
a24d1c78-c4bf-4ee1-bc11-326344104f74 | Wolframe/Wolframe | src/libwolframe/utils/stringUtils.cpp | ///\file stringUtils.cpp
///\brief Some utility string function implementations.
/// They are mainly boost wrappers that are separated because of some warnings needed to be disabled
#ifdef _WIN32
#pragma warning(disable:4996)
#endif
#include "utils/stringUtils.hpp"
#include <cstring>
#include <sstream>
#include <strin... | TOOL | 0.931583 | 5.680241 |
314c2b8d-244e-457b-881d-233d1f119a54 | dlvguo/NoobOJCollection | LeetCode/Normal/900-999/968.cpp | #include <bits/stdc++.h>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right... | ALGO | 0.999939 | 6.531724 |
175745c6-3821-43ac-9112-995cbe62ff81 | Rocky-6/atcoder_cpp | abc285/c.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
long long ans = 0;
for (int i = 0; i < s.size(); i++)
{
long long tmp = s[i] - 'A' + 1;
ans = ans * 26 + tmp;
}
cout << ans << endl;
return 0;
}
| ALGO | 0.99979 | 4.298538 |
6d3c8e8d-a574-407b-8ed8-fd5e1d4ab0fb | Inori/Games202HW | homework2/prt/ext/tbb/examples/parallel_for/tachyon/src/trace.tbb1d.cpp | #include "machine.h"
#include "types.h"
#include "macros.h"
#include "vector.h"
#include "tgafile.h"
#include "trace.h"
#include "light.h"
#include "shade.h"
#include "camera.h"
#include "util.h"
#include "intersect.h"
#include "global.h"
#include "ui.h"
#include "tachyon_video.h"
// shared but read-only so could be p... | TOOL | 0.851273 | 4.050345 |
1c9477e0-6d64-4b82-beec-a18faef34128 | Raunak1001/Competitive-Coding | SPOJ/WACHOVIA.cpp | #include<bits/stdc++.h>
using namespace std;
#define vi vector<long long int>
#define vvi vector<vector<long long int> >
#define ll long long int
#define pr pair<long long int,long long int>
#define mp make_pair
int main(){
ll t;
cin >> t;
for(ll q=0;q<t;q++){
ll ans=0;
ll w,n;
cin >> w>>n;
vi a(n),b(n);
for(ll i=... | ALGO | 0.999859 | 3.344884 |
ea1be2cd-6cd1-473a-b08b-92ee81b0516d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12302_1.cpp | #include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int d_, x_, y_;
void gcd(int a, int b) {
if (b == 0)
d_ = a, x_ = 1, y_ = 0;
else {
int tmp;
gcd(b, a % b);
tmp = x_ - a / b * y_, x_ = y_, y_ = tmp;
}
}
int inv(int a) {
gcd(... | ALGO | 0.999965 | 3.945922 |
361b5a36-2b2b-419a-b2cc-b7c66f512bb7 | caomincan/leectcode | 163Missing_Ranges.cpp | class Solution {
public:
vector<string> findMissingRanges(vector<int>& nums, int lower, int upper) {
vector<string> ans;
// O(n) solution
long cur_lower = lower;
for(auto n : nums){
if(n > cur_lower){
if(n == cur_lower+1)
ans.push_back(... | ALGO | 0.999941 | 5.436689 |
3f91095a-729e-4d7f-a42e-3023b55c004f | pateash/cp | src/main/my_codes/ap_algo_codes/Heap/heap_new.cpp | #include <iostream>
#include<conio.h>
#include<cstdlib>
#include<algorithm>
#include<math.h>
#define N 11
using namespace std;
struct heap{
int arr[N];
int size;//size points last element
};
void insert(struct heap *p,int val){
int i=++(p->size);
p->arr[i]=val;
while(i/2!=0&&p->arr[i]>p->arr[i/2]){
... | ALGO | 0.999218 | 3.551844 |
fdbe4c11-29cd-447d-846f-ffac2aea412a | DarshanTank18/CPP-programs | Conditional Logic Programs/Pro - 19.cpp | //Write a program in C to calculate and print the electricity bill
#include<stdio.h>
main(){
int unit,id;
float cha,cou;
char name[20];
printf("Enter id : ",id);
scanf("%d",&id);
printf("Enter name : ",name);
scanf("%s",&name);
printf("Enter electricity bill : ",unit);
scanf("%d",&unit);
if(unit < 35... | TOOL | 0.901356 | 3.339617 |
84886a0f-2f0c-42d1-ac2b-3b13f297bb7d | shreyamalogi/CP-practice | leetcode/A_ASTEROID COLLISION.cpp | class Solution {
public:
vector<int> asteroidCollision(vector<int>& asteroids) {
vector<int> result;
for (const auto& asteroid : asteroids) {
bool is_exploded = false;
while (!result.empty() && asteroid < 0 && 0 < result.back()) {
if (result.back() < -asteroid... | ALGO | 0.999983 | 6.149962 |
71d95ee3-d1f0-40dc-9402-1710afff3f85 | Octobug/notes | algorithms_and_data_structures/leetcode/tree/m_00236_lowest_common_ancestor_of_a_binary_tree/main.cpp | #include <iostream>
#include <vector>
#include "bintree.h"
using namespace std;
class Solution
{
TreeNode *pnode;
TreeNode *qnode;
TreeNode *result = nullptr;
public:
bool postFind(TreeNode *node)
{
if (result != nullptr)
return true;
bool leftFound = false;
b... | ALGO | 0.999977 | 5.064459 |
8696523b-298b-44a9-98ba-f462ce816e59 | ishandutta2007/codeforces | anz/normal/1345/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }
int main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int t; cin >> t;
while (t--)
{
int a, b; cin >> a >> b;
if... | ALGO | 0.999741 | 5.13117 |
a590e64a-5d33-4788-9c7c-120bbf8b7203 | ishandutta2007/codeforces | mr.robot_28/normal/1084/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n, k, ans = 0, temp = 1, f = 0, x = 1;
cin >> n >> k;
string s1, s2;
cin >> s1 >> s2;
for(ll i=0;i<n;i++)
{
if(f == 0)
{
x = (x * 2);
... | ALGO | 0.999886 | 3.826188 |
fd82b347-a00a-4f39-981b-a76f5ed3b520 | amit-62/MyDsa | nge_leetcode.cpp | // https://leetcode.com/problems/next-greater-element-i/
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v,v1;
int n;
cin >> n;
for(int i=0; i<n; ++i){
int x;
cin >> x;
v.push_back(x);
}
int n2;
cin >> n2;
for(int i=0; i<n2; ++i){
int x;
cin >> x;
v1.push_back(x);
}
stack<... | ALGO | 0.999978 | 4.399986 |
c96b4320-f655-4ee9-af6e-c652a893a622 | Arpit2601/CS210-ds-lab | lab work/level_order_traversal.cpp |
// Recursive C program for level order traversal of Binary Tree
#include <stdio.h>
#include <stdlib.h>
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct node
{
int data;
struct node* left, *right;
};
/* Function protoypes */
void printGivenLevel(stru... | ALGO | 0.999986 | 5.162655 |
2beef416-8f5e-4170-836d-a5290618d5f1 | fkanehiro/etc | pgs/pgs.cpp | #include <fstream>
#include <iostream>
#include <Eigen/Core>
#include <hrpUtil/uBlasCommonTypes.h>
#include <sys/time.h>
using namespace Eigen;
using namespace hrp;
using namespace boost::numeric::ublas;
typedef boost::numeric::ublas::matrix<double, row_major> rmdmatrix;
#ifdef USE_EIGEN
void ProjectedGaussSeidel(con... | ALGO | 0.998776 | 4.654726 |
d6ee27b0-f9cf-4d21-ac24-5a5c9827aa6e | tinku06071999/gfg-solutions | Easy/Union of Two Linked Lists/union-of-two-linked-lists.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
// } Driver Code Ends
/*
// structure of the node is as follows
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
ne... | ALGO | 0.999962 | 4.804752 |
888e367f-f9c3-4e45-a69e-b34488fea9bb | siddik7181/Work | Graph/Practice/is_it_tree_spoj.cpp | #include<bits/stdc++.h>
using namespace std;
vector <int> adj[20005];
int vis[20005];
void dfs(int x){
vis[x] = 1;
for(auto u : adj[x]){
if(!vis[u])
dfs(u);
}
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("Practice.txt","r",stdin);
#endif
int node,edge,cnt = 0;
cin >> node ... | ALGO | 0.99999 | 4.508335 |
da35803c-89e6-4179-8caf-2552aff70d08 | alexandraback/datacollection | solutions_2749486_0/C++/z451538473/Pogo.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int abs(int k)
{
return k>0?k:-k;
}
int main()
{
freopen("B-small-attempt0.in","r",stdin);
freopen("output.txt","w",stdout);
int t;
cin>>t;
for(int cas=1;cas<=t;cas++)
{
printf("Case #%d: ",cas);
in... | ALGO | 0.99967 | 3.263968 |
0f554f5c-4013-40ca-9853-6e9f980de328 | ajitkushwaha123/Recurrsion | Q_3_n_1_sequence.cpp | #include<bits/stdc++.h>
using namespace std;
int seq(int n , int ans)
{
if(n == 1) return ans;
// cout << n << endl;
if(n % 2 == 0)
seq(n / 2 , ans+1);
else
seq(3 * n + 1 , ans+1);
}
int main()
{
int n;
cin >> n;
cout<<seq(n , 1)<<endl;
return 0;
}
| ALGO | 0.99996 | 4.35934 |
8851be90-dce7-4cf4-a462-7493bbcc60be | hyeonjin25/problemSolving | baekjoon/11328.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
string str1, str2;
cin >> n;
for (int i = 0; i < n; i++)
{
int check[30]{};
cin >> str1 >> str2;
for (auto s : str1)
{
check[s - 'a']++;
}
for (auto s : str2)
{
... | ALGO | 0.999953 | 4.679873 |
954b290c-fed6-421b-8544-ac09313af610 | junhochoi-dev/algorithm | [PS]BOJ/20000_29999/25000_25999/25558/boj25558.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
using namespace std;
#define endl '\n'
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main() {
fastio;
long long tc, sx, sy, ex, ey, sz, minIdx = -1;
long long minSum = LLONG_MAX;
... | ALGO | 0.999784 | 4.110233 |
684a78bc-6a02-4750-989a-94e62cd358b8 | aneeqaf/Quantum-Simulation | QuantumSim/compression/compression/gnuplot-iostream/boost_1_75_0/libs/sort/example/reverseintsample.cpp | // See http://www.boost.org/libs/sort for library home page.
// Caution: this file contains Quickbook markup as well as code
// and comments, don't change any of the special comment markups!
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
... | ALGO | 0.997428 | 4.58563 |
d42c3394-a102-4d21-82d6-e3d835a0a7d3 | ChoeMinji/godot | thirdparty/squish/squish.cpp | #include <string.h>
#include "squish.h"
#include "colourset.h"
#include "maths.h"
#include "rangefit.h"
#include "clusterfit.h"
#include "colourblock.h"
#include "alpha.h"
#include "singlecolourfit.h"
namespace squish {
static int FixFlags( int flags )
{
// grab the flag bits
int method = flags & ( kDxt1 | kD... | TOOL | 0.902094 | 6.462617 |
ce4a57f3-a0cd-48dd-ab40-6d120bfec929 | ishandutta2007/codeforces | nigus/normal/1368/A.cpp | #pragma GCC optimize("O3") //
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int... | ALGO | 0.999863 | 4.630863 |
134aba99-eb9d-4bc5-bbb3-136353949a3d | tom6m6/files_upload_blog | cprogrammingforfinal2022/others/zju/题/C程上机/70032.cpp | #include "stdio.h"
#define MAXLEN 80
int main(void)
{
char cc, ch;
char str[MAXLEN];
int count, flag, i, index;
int repeat, ri;
scanf("%d", &repeat);
getchar();
for(ri = 1; ri <= repeat; ri++){
cc = getchar();
getchar();
i = 0;
while((ch = getchar()) != '\n... | ALGO | 0.981849 | 3.096948 |
c2cea5a8-fd1b-411d-9a6c-54e507c17b70 | abhishek10V/Leetcode_Solutions | 0664-strange-printer/0664-strange-printer.cpp | class Solution {
public:
int n;
vector<vector<int>> t;
int solve(int l, int r, string& s){
if(l == r)
return 1;
else if(l > r)
return 0;
if(t[l][r] != -1)
return t[l][r];
int i = l+1;
while(i <= r && s[i] == ... | ALGO | 0.999993 | 5.660125 |
e5ce1600-d407-4365-9438-132e07a32d87 | SunNailin/Optimization_HEVC | x265_2.3/source/common/deblock.cpp | #include "common.h"
#include "deblock.h"
#include "framedata.h"
#include "picyuv.h"
#include "slice.h"
#include "mv.h"
using namespace X265_NS;
#define DEBLOCK_SMALLEST_BLOCK 8
#define DEFAULT_INTRA_TC_OFFSET 2
void Deblock::deblockCTU(const CUData* ctu, const CUGeom& cuGeom, int32_t dir)
{
uint8_t blockStrengt... | ALGO | 0.949416 | 5.209162 |
a860b929-21a2-4eef-91d3-66f056901964 | atsu8864/Atcoder | abc/abs/product.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (long long i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
const long double PI = (acos(-1));
const int MOD = 1e9+7;
int main(){
int a, b;
cin >> a >> b;
int ans = a * b;... | ALGO | 0.999995 | 5.116582 |
8d71975d-51b1-47e6-9490-a2c9166cbd51 | SCI-ElVis/ElVis | src/Externals/boost/libs/graph/example/edge-connectivity.cpp | namespace boost
{
template < typename Graph >
std::pair < typename graph_traits < Graph >::vertex_descriptor,
typename graph_traits < Graph >::degree_size_type >
min_degree_vertex(Graph & g)
{
typename graph_traits < Graph >::vertex_descriptor p;
typedef typename graph_traits < Graph >::degree_s... | ALGO | 0.999358 | 7.146661 |
884ed216-42fd-47c6-9c2f-cac363613dff | henrya2/Programming-Challenges | Solutions/TheTrip/TheTrip.cpp | /***
The Trip
http://www.programming-challenges.com/pg.php?page=downloadproblem&probid=110103&format=html
***/
#include <stdio.h>
#include <math.h>
#define NUM_STUDENT 1000
void TheTripProc()
{
double costs[1000];
int num = 0;
while (true)
{
scanf("%d", &num);
if (num <= 0)
break;
for (int i = 0; ... | ALGO | 0.998685 | 3.200025 |
1e01d60d-2785-467e-976e-8aa19445a55f | yashss1/Sublime_CP | credenz_23_d.cpp | //YashS
#include <bits/stdc++.h>
using namespace std;
#define test int T;cin>>T;while(T--)
#define int long long
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pVec(v) for(auto e:v)cout<<e<<"... | ALGO | 0.99996 | 4.434398 |
073c1a47-6b1d-45d7-8380-5bfed13a600d | suhyun444/ProblemSolving | 1918번 후위 표기식.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
vector<char> ans;
stack<pair<char,int>>operators;
int stackCount = 0;
for (int i = 0; i < s.length(); i++)
{
if ('A' <= s[i] && s[i] <= 'Z')
... | ALGO | 0.999963 | 4.011425 |
9ec121ed-9e1c-42a1-8460-e9e458c3d34e | RydKrm/Competitive_Program | Codeforces/1030C.cpp | //#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cstring>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<iterator>
#include<algorithm>
#include<bitset>
#de... | ALGO | 0.999963 | 3.433391 |
9e431bdd-d6b7-44d2-b80f-528458d425a3 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8098_5.cpp | #include<iostream>
using namespace std;
int main(){
int N,a;
cin>>N;
a = min(9,N)+min(900,max(0,N-99))+min(90000,max(0,N-9999));
cout<<a;
return 0;
} | ALGO | 0.995744 | 3.014551 |
41354100-7323-4c6a-bf7f-753de7a1995b | JrSousaJ/Uri-Solved-Problems | 2062.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int n;scanf("%d",&n);
getchar();
for(int i=0;i<n;i++)
{
string s;cin >> s;
if(i==0)
{
if(s.size()==3 && s[0]=='O' && s[1]=='B')
printf("OBI");
else if(s.size()==3 && s[0]=='U' && s[1]=='R')
printf("URI");
else... | ALGO | 0.999127 | 4.011233 |
d94e5017-0dbc-4715-abdf-794d97cb318b | beelisais2793/FX | Synthesizer/Waves/Oscillators/NOISE/Noises/noise/DiffSamp/src/code/Scripts/behead.cpp | /*
behead.cpp
chop off the leading portions of a .dat file
e.g. unreliable anisotropy due to lack of low frequency data
Li-Yi Wei
10/14/2010
*/
#include <iostream>
#include <fstream>
#include <string>
#include <deque>
using namespace std;
#include <stdlib.h>
#include <math.h>
struct Datum
{
Datum(vo... | DATA | 0.851872 | 4.285984 |
0bcd878b-3b96-4915-93c9-02682f4ed1a5 | ronak-goyal-code/Cpp | PATTERN/reversestarpyramid2.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter number of raws in star pyramid : ";
cin>>n;
cout<<"REQUIRED PATTERN :-"<<endl;
int nst = 2*n - 1;
int nsp = 0;
for(int i = 1 ; i<=n ; i++){
for(int j = 1 ; j<=nsp ; j++){
cout<<" ";
}
... | ALGO | 0.999008 | 3.89641 |
4761e2fa-ecf3-4432-83a3-d6286361331a | GwegZilla/AI_MicroMachins | MicroMachins/MicroMachins/MicroMachins/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp | #include "Box2D/Dynamics/Joints/b2RevoluteJoint.h"
#include "Box2D/Dynamics/b2Body.h"
#include "Box2D/Dynamics/b2TimeStep.h"
// Point-to-point constraint
// C = p2 - p1
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-r... | ALGO | 0.997236 | 7.727699 |
6cc74118-1a45-47bc-992a-3a3897250331 | ishandutta2007/codeforces | rama_pang/normal/1385/E.cpp | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
vector<vector<int>> adj(n), radj(n);
vector<pair<int, int>> edge;
vector<pair<int, int>> fixed;
... | ALGO | 0.999981 | 4.298834 |
0876f4cd-5dd2-4fae-8ca9-7c5092b66263 | aniketbiswas21/ds-algo-assignments | assignment-2/doubly-linked-list.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node *prev;
};
// * Q4(x)
void insertNode(Node **n, int value)
{
Node *head = *n;
Node *newNode = new Node();
newNode->data = value;
newNode->next = NULL;
if (head != NULL)
{
while (head->n... | ALGO | 0.999698 | 4.824174 |
e30581e1-3689-4882-be9e-40d9ed804537 | sarvex/leetcode-beef | solution/0600-0699/0605.Can Place Flowers/Solution.cpp | class Solution {
public:
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
int m = flowerbed.size();
for (int i = 0; i < m; ++i) {
int l = i == 0 ? 0 : flowerbed[i - 1];
int r = i == m - 1 ? 0 : flowerbed[i + 1];
if (l + flowerbed[i] + r == 0) {
... | ALGO | 0.999998 | 6.951285 |
2b7e037f-cd5d-46c4-be6f-8b8525421791 | zcae1020/algorithm_problems | baekjoon/exercise/14425/14425.cpp | #include <iostream>
#include <string>
#include <set>
using namespace std;
int N, M, ans;
set<string> s;
void Input()
{
cin >> N >> M;
while (N--)
{
string t;
cin >> t;
s.insert(t);
}
}
void Solution()
{
while (M--)
{
string t;
cin >> t;
if (s.c... | ALGO | 0.999857 | 4.241678 |
51b6d6a6-30f2-4d88-975a-eacefd7e416c | pydmy7/CPP-SCL | DataStructure/MLong.cpp | using i64 = long long;
template<class T>
constexpr T power(T a, i64 b) {
T res = 1;
for (; b; b /= 2, a *= a) {
if (b % 2) {
res *= a;
}
}
return res;
}
constexpr i64 mul(i64 a, i64 b, i64 p) {
i64 res = a * b - i64(1.L * a * b / p) * p;
res %= p;
if (res < 0) ... | ALGO | 0.996407 | 4.321176 |
500fd80f-601a-4b92-ad22-b6ea433f5332 | RajaBabu15/DSA_Learning | Bessies_Birthday_Cake_Easy_Version.cpp | #include<bits/stdc++.h>
using namespace std;
void solve() {
int n, x, y; cin >> n >> x >> y;
vector<int> vec(x);
set<int> s; for (int i = 0, ele; i < x && cin >> ele; i++) s.insert(ele - 1), vec[i] = ele - 1;
int cnt = 0;
for (int i = 0; i < x; i++) {
if (s.find((vec[i] + 1) % n) == s.end() && s.find((vec[i] +... | ALGO | 0.999522 | 3.887063 |
f10ad2d3-5278-495c-88ed-7c17ea7efd41 | ManishMahale/Cpp | DSA/Power.cpp | /*Given an integer n, return true if it is a power of two. Otherwise, return false.
An integer n is a power of two, if there exists an integer x such that n == 2x.
Example 1:
Input: n = 1
Output: true
Explanation: 20 = 1
Example 2:
Input: n = 16
Output: true
Explanation: 24 = 16
Example 3:
Input: n = 3
Output: fals... | ALGO | 0.999106 | 6.195001 |
a4322761-79a5-4996-a147-77b4dc6a2b13 | swetankraj/leetcode | 1291-sequential-digits.cpp | class Solution
{
vector<int> result;
void solve(int x, int i, int low, int high)
{
if (x > high || i > 9)
return;
if (x >= low && x <= high)
result.push_back(x);
solve((x * 10) + (i + 1), i + 1, low, high);
}
public:
vector<int> sequentialDigits(int l... | ALGO | 0.999959 | 6.378318 |
18d84837-7303-4163-bad8-94e6201dc072 | Trevorchenmsu/LeetCode-Solutions | leetcode/editor/en/[207]Course Schedule.cpp | //There are a total of numCourses courses you have to take, labeled from 0 to nu
//mCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai,
// bi] indicates that you must take course bi first if you want to take course ai.
//
//
//
// For example, the pair [0, 1], indicates that to take course... | ALGO | 0.998886 | 6.889524 |
e5ca2929-891a-4691-9eb9-23a90b2e03c3 | Alamshah1617/100DaysofCodingChallenges | Day23/day23.cpp |
// Day 23 coding Statement : Write a program to Replace all 0’s with 1 in a given integer
// Description: Get a number as input from the user and find the zeros present in that number.
// Then convert the zeros into one and then print it.
// Input: 310020
// Output: 311121
#include <iostream>
using namespace std;
int... | ALGO | 0.999937 | 5.620002 |
aedc5491-a52d-4b3a-a831-8ac21d256ce7 | pinakdas163/CPP-Projects | BFS/core.cpp | #include<iostream>
#include<vector>
#include<list>
using namespace std;
class Graph
{
private:
int vertices, edges;
int firstCore, secondCore;
public:
Graph(int vertices, int edges);
~Graph() {};
int getFirstCore() { return firstCore; }
int getSecondCore() { return secondCore; }
int BFS... | ALGO | 0.999883 | 4.237224 |
fa302293-3537-440c-9df7-99b532b2d43c | ishandutta2007/codeforces | pashka/normal/1531/C.cpp | #include <bits/stdc++.h>
#define long long long int
using namespace std;
// @author: pashka
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
for (int m = 1; m <= 15; m++) {
for (int k = 0; k < m; k++) {
int nn = m * m - k * k;
int pp = k * (m - k);
... | ALGO | 0.999894 | 4.440132 |
437f8db3-c892-444b-9447-8f898d134b6d | ishefalichopra/CPP | 298_ReverseALLStack.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *next;
};
void rearrangeList(Node *&head)
{
if (!head || !head->next)
return;
stack<Node *> nodeStack;
Node *temp = head;
// Push all nodes except the last one into the stack
while (temp->next != NULL)
... | ALGO | 0.999993 | 5.833189 |
172c7a29-ff4f-49b1-a192-9daa1876935e | chetverochka/cascade2d | Cascade2d/CCDMath.cpp | #include "CCDMath.h"
#include <cmath>
float cascade::math::radiansToDegrees(float num) {
return (num * 180) / 3.14;
}
float cascade::math::degreesToRadians(float num) {
return (num * 3.14) / 180;
}
cascade::Vec cascade::math::rotatePoint(cascade::Vec point, float degrees) {
float angleRadians = degrees * 3.14f / 18... | ALGO | 0.886454 | 5.630105 |
5ec682d1-7697-445d-9bb0-71a353429c6b | coschain/contentos | externals/binaryen/test/emscripten/tests/bullet/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp | #include "btConvexPointCloudShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
void btConvexPointCloudShape::setLocalScaling(const btVector3& scaling)
{
m_localScaling = scaling;
recalcLocalAabb();
}
#ifndef __SPU__
btVector3 btConvexPointCloudShape::localG... | ALGO | 0.940121 | 7.05725 |
6b2703b6-55fb-4e98-a4e5-9d5f883dde34 | Jinesh013/Calculator_App | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
8862ff0a-ac69-4720-900c-1262d87103e1 | KausBoss/CP-SubGrouped | LeetCode/207.cpp | //DAG to be abale to complete all courses
// Usage of topological sort to find a valid pattern
class Solution {
public:
bool canFinish(int numCourses, vector<vector<int>>& prerequisites) {
vector<list<int>> adj(numCourses);
vector<int> inDegree(numCourses, 0);
for(auto p:prerequisites){
... | ALGO | 0.999571 | 6.2543 |
e5208e5f-1c46-4b8a-9940-ec03dffa8e36 | ishandutta2007/codeforces | blackyuki/normal/1341/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bo... | ALGO | 0.999969 | 4.118806 |
a4ea1987-1ced-466a-a16c-d98e3579cfec | jacksontcollier/topcoder-srm | srm-302/div-2/250/NounReform.cpp | #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
class NounReform{
public:
vector <string> makePlural(vector <string> nouns);
};
vector <string> NounReform::makePlural(vector <string> nouns){
int i = 0;
ch... | ALGO | 0.889979 | 4.576684 |
1bd1ec4f-8181-4fb5-9e0c-3ea4b845d6ff | Y-Leo/DataStruct | InsertionSort/InsertionSort/test.cpp | #include<iostream>
using namespace std;
//ԪؼϽӽʱ,ֱӲЧʽϸ.
//ֱӲ,˳
void Insertion_Sort(int* arr, int n)
{
int i = 0, flag = 0, step = 0;
for (i = 1; i < n; i++)
{
flag = arr[i];
step = i - 1;
while (step >= 0 && flag<arr[step])
{
arr[step + 1] = arr[step];
step--;
}
arr[step + 1] = flag;
}
}
//ֱӲֲ
... | ALGO | 0.999989 | 3.967279 |
55a5d590-2617-46c3-a354-a7f123e2b20b | matriiix67/cpp-primer | ch03/exercise3.36.cpp | #include <iostream>
#include <vector>
#include <iterator>
using namespace std;
bool compare(int * const pb1, int *const pe1, int * const pb2, int * const pe2)
{
if((pe1-pb1) != (pe2-pb2))
return false;
else{
for(int* i = pb1, *j = pb2; (i != pe1) && (j != pe2); ++i, ++j)
if(*i != *j)
return ... | TEST | 0.982798 | 4.704415 |
97af405f-86f9-4ddc-9dcb-caa16922fa15 | Fazzioni/Tap | Aula2/A.cpp | #include <iostream>
using namespace std;
int main(){
int N;
cin>>N;
int office = 0;
int crime = 0;
while (N--){
int e = 0;
cin >> e;
if (e != -1){ // police
office += e;
}else // = -1
if (office > 0 )
office --;
... | ALGO | 0.999893 | 3.95343 |
7e5a1f4a-6dbb-4fe4-bd1b-9f4c91267d30 | Edw590/VISOR---Android-Version-Assistant | app/src/main/cpp/ORB/Thirdparty/g2o/g2o/core/sparse_block_matrix_test.cpp | #include "sparse_block_matrix.h"
#include <iostream>
using namespace std;
using namespace g2o;
using namespace Eigen;
typedef SparseBlockMatrix< MatrixXd >
SparseBlockMatrixX;
std::ostream& operator << (std::ostream& os, const SparseBlockMatrixX::SparseMatrixBlock& m) {
for (int i=0; i<m.rows(); ++i){
for (int... | TOOL | 0.913464 | 3.370966 |
3d374d47-da8e-4522-b43a-0b2741b0ca3f | sir-rasel/Online_Judge_Problem_Solve | Codeforces/codeforces_363B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
ull normalSum[1000000];
int main(){
int n,k;
scanf("%d %d",&n,&k);
ull num;
for(int i=1;i<=n;i++){
cin>>num;
normalSum[i]+=(normalSum[i-1]+num);
}
int minn=INT_MAX,ans;
for(int i=1;i<=n-k+1;i... | ALGO | 0.999965 | 3.738089 |
99481618-4605-4f98-8725-2fa8c6edf305 | Amanatri0/DSA | leetcode/13.ReverseInteger.cpp | // Leetcode 7
#include <iostream>
using namespace std;
int main()
{
int num = -12345;
int reverseSum = 0;
while (num != 0)
{
int a = num % 10;
reverseSum = reverseSum * 10 + a;
num = num / 10;
}
cout << reverseSum << endl;
return reverseSum;
} | ALGO | 0.999932 | 5.057676 |
61c3f290-8a36-4113-b36c-861de8b1db48 | DaFeiZong/thread_pool | DSSAD/DoubleLoopLinkList.cpp | #include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
Node* pre;
Node* next;
};
Node* initList()
{
Node* l = new Node;
l->data = 0;
l->pre = l;
l->next = l;
return l;
}
void headInsert(Node* l, int data)
{
Node* node = new Node;
node->data = data;
if (l->data == 0... | ALGO | 0.999979 | 3.966732 |
ba66bc07-1497-4f7b-94ea-5a6ac919b6aa | JakubZojdzik/Algorithms | 0-1bfs/main.cpp | #include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> kraw[500007];
int from[500007];
int dist[500007];
deque<int> q;
int main()
{
cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(0);
int n, m, a, b, c;
cin >> n >> m;
for(int i = 0; i < m; i++)
{
cin >> a >> b >> c;
... | ALGO | 0.99998 | 3.931056 |
3ddfc478-a747-4dc1-a5ef-a556a3b8eaab | ishandutta2007/codeforces | purplecrayon/normal/1285/C.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void fsc(int &x){
register int c;
x = 0; c=getchar()... | ALGO | 0.99981 | 4.820817 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.