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 |
|---|---|---|---|---|---|---|
87d8381f-3e06-4696-b885-b35051374435 | azatalg/matury | 2019/zad4/zad4.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int SIZE = 1e6+10;
bool isExpo[SIZE];
void isThree() {
for(int i=3; i<=SIZE; i*=3) {
isExpo[i] = 1;
}
}
int main() {
cin.tie(0); cout.tie(0); ios::sync_with_stdio(0);
ifstream file; file.open("../Dane/liczby.txt");
... | ALGO | 0.999344 | 3.63097 |
4cf11844-1857-4f21-87fa-9766a6f102fb | tschumann/basis | game_shared/modbot/bot_profile.cpp | // Author: Michael S. Booth (<EMAIL>), 2003
#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning
#define DEFINE_DIFFICULTY_NAMES
#include "bot_profile.h"
#include "shared_util.h"
#include "simple_checksum.h"
BotProfileManager *TheBotProfiles = NULL;
//---... | TOOL | 0.872946 | 3.292529 |
14bfa7df-c9b8-4451-8851-f69e200a146c | CoderDream/java-architect-util | hello-algo/hello-algo-main/zh-hant/codes/cpp/chapter_searching/hashing_search.cpp | /**
* File: hashing_search.cpp
* Created Time: 2022-11-25
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 雜湊查詢(陣列) */
int hashingSearchArray(unordered_map<int, int> map, int target) {
// 雜湊表的 key: 目標元素,value: 索引
// 若雜湊表中無此 key ,返回 -1
if (map.find(target) == map.end())
return -... | ALGO | 0.999526 | 5.461356 |
09b5264a-0c05-420f-8d78-ad0900f71353 | camil0palacios/Competitive-programming | solutions/codeforce/Codeforces Round #757 (Div. 2)/b.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define fori(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define fore(i,a,b) for(int i = a; i <= b; i++)
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()
#define mp make... | ALGO | 0.999396 | 3.463984 |
c2bdd6d5-d530-4e5b-bdf0-94c93fed5101 | haozha111/algo | 115.cpp | #include "leetcode.h"
using namespace std;
class Solution {
public:
int numDistinct(string s, string t) {
return numDistinct1(s, t);
}
int numDistinct1(string s, string t) {
if (s.empty() or t.empty()) {
return 0;
}
int n = s.size(), m = t.size();
long long res = 0;
vector<long lo... | ALGO | 0.999643 | 5.910477 |
0ff14c1e-9651-40f4-9088-0c1809044539 | MohamadAshrafSalama/User-Stories-generation | Code_Snippets/91-100/s167720491.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
template<class T>
inline bool chmax(T &a, T b) {
... | ALGO | 0.99997 | 3.338079 |
a0042171-a9bf-4bf2-902c-bd5c2f15d492 | mdan16/atcoder | abc163/b.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(v) v.begin(), v.end()
#define UNIQ(v) sort(ALL(v)); v.erase(unique(ALL(v))... | ALGO | 0.999993 | 4.132463 |
e16d188f-369c-4994-b537-ec532d2fccf8 | pingchungchang/CP | CF743D.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
struct node{
vector<int> p;
vector<ll> vals;
ll val;
ll biggest;
ll sum;
bool goneto;
node(){
goneto = false;
val = -1;
biggest = -1;
sum = -1;
}
};
vector<node> v;
ll ans = LONG_LONG_MIN;
bool error = true;
void dfs(int now){
v[now].... | ALGO | 0.99968 | 4.242115 |
827675fb-e29f-4b70-9312-14716d540920 | mint6421/kyopro | atcoder/abc/140/abc_140_b.cpp |
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define... | ALGO | 0.999927 | 3.269349 |
3f6b8135-8911-46e7-b385-355b95f50a58 | X-czh/Algorithms-LeetCode | 400-499/404-Sum-of-Left-Leaves.cpp | // Time complexity: O(n)
// Space complexity: O(h)
/**
* 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:
int sumOfLeftLeaves(TreeNode* root) {
... | ALGO | 0.999943 | 6.914938 |
1a385266-8259-4f95-ac5d-6cf9ee10da40 | gaonK/AlgorithmStudy | Session 1/hy00nc/3.다이나믹/2156.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
cin.tie(NULL);
ios::sync_with_stdio(false);
int n;
cin>>n;
int arr[n+1];
for(int i=1;i<=n;i++){
cin>>arr[i];
}
int d[n+1][3];
d[0][0]=d[0][1]=d[0][2]=0;
for(int i=1;i<=n;i++){
... | ALGO | 0.999962 | 3.675039 |
f1eb3a9c-f73f-46f8-a8dc-741658947146 | mrdcvlsc/APA | tests/bint_add.cpp | #include <iostream>
#include <vector>
#ifndef _MAKE_LIB
#include "../core.hpp"
#else
#include <bint.hpp>
#endif
#include "mini-test.hpp"
int main() {
START_TEST;
// test variables
apa::bint num1 = "0x182379807482704987138971389471980478123748657105182347086873";
apa::bint num2 = "-0xabcdeffe... | TEST | 0.912051 | 5.552275 |
319b2a09-e0f4-4ccd-adad-430f0e159017 | mrjrozycki/Hybrids | hybrid-IC-IC/hybrid4.1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
// ---------------FFD -> BFD-------------------
class Item
{
public:
Item(int size) : size_(size) {}
int getSize() const { return size_; }
private:
int size_;
};
class Bin
{
public:
Bin(int capacity) : capacity_(capacity), ... | ALGO | 0.999988 | 7.125816 |
bae3a3a9-b4e2-4eb4-9276-60b30c520889 | JawadKotaichh/Codeforces | Divisions/Div 3/Div_3_950/B_ChoosingCubes.cpp | #include <bits/stdc++.h>
# define forn(n,i) for(int i=0;i<n;i++)
# define int long long
using namespace std;
/*
We have n cubes numbered from left to right from 1 to n
The cube with index f is favorite
He arragend the cubes in increasing order of their values
He removed the first k elements of the so... | ALGO | 0.999879 | 4.329411 |
f3edc761-6b81-4690-ae21-c988a8fd8bef | ChibiKev/Leetcode | 830. Positions of Large Groups/solution.cpp | class Solution {
public:
vector<vector<int>> largeGroupPositions(string s) {
vector<vector<int>> result;
int count = 0;
char lastLetter;
int startIndex = 0;
for (int index = 0; index < s.size(); index++){
char letter = s[index];
if (lastLetter == letter){
count += 1;
... | ALGO | 0.999858 | 6.398169 |
7917607a-d8c3-4320-abb0-d3b2ae2909a7 | AustinBoyuJiang/Competitive-Programming | competitions/DMOJ/contests/UTS Open '24/brute force p4.cpp | /*
* Author: Austin Jiang
* Date: 12/31/2024 3:29:23 AM
* Problem:
* Source:
* Description:
*/
/* Configuration */
//#define MULTICASES
//#define LOCAL
//#define READLOCAL
//#define FILESCOMP
//#define SETMEM
#define FASTIO
//#define NDEBUG
#define OPTIMIZE
//#define INTTOLL
#ifdef OPTIMIZE
#pragma GCC optimize(... | ALGO | 0.999397 | 4.209407 |
22f5410a-7a45-4e9b-8547-3ca6e9e3dda5 | elitiumofficial/eums | src/crypter.cpp | #include "crypter.h"
#include "script/script.h"
#include "script/standard.h"
#include "util.h"
#include <boost/foreach.hpp>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <string>
#include <vector>
bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::vector<unsigned char>& chSal... | TOOL | 0.920477 | 7.538431 |
f3d301af-e443-4524-8e45-df02ac687794 | PAL-ULL/software-metco | oplink/algorithms/team/src/plugins/multiObjectivizations/MultiObjBestDistThreshold_SelfAdaptive/MultiObjBestDistThreshold_SelfAdaptive.cpp | #include "MultiObjBestDistThreshold_SelfAdaptive.h"
#include <stdlib.h>
#include <math.h>
void MultiObjBestDistThreshold_SelfAdaptive::convertToMultiObjective(vector<Individual *> *population, vector<Individual *> *offSpring, vector<Individual *> *reference, int ordObj, int numberGeneration){
//Look for best indivi... | ALGO | 0.999744 | 5.904722 |
31773dba-70cd-489d-a6e7-9dd0c65c9859 | bashar404/Sample_Programming-Object_Oriented- | Object_Oriented/stl/adt/main.cpp | #include <iostream>
using namespace std;
class ArrayADT
{
private:
int capacity;
int last_index;
int *ptr;
public:
ArrayADT()
{
capacity=0;
last_index=-1;
ptr=NULL;
}
void createArray(int capacity);
int get_item(int index);
void set_item (int index, int value);
void edit... | ALGO | 0.998599 | 4.023904 |
16801f4d-dc84-403a-aec7-396eec3d37ed | ss-coder30/Leetcode-Questions | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-darkreader-inline-bgcolor-rgba0-0-0-005-data-darkreader-inline-bgcolordivamazon-divdiv-classcompanytagscontainer-tagoccurence1-... | class Solution {
public:
vector<int> rearrangeArray(vector<int>& nums) {
int n = nums.size();
vector<int> ans(n, 0);
int posIndex = 0, negIndex = 1;
for(int i = 0; i<n; i++){
if(nums[i] > 0){
ans[posIndex] = nums[i];
posIn... | ALGO | 0.999961 | 5.701889 |
120f33f7-42b8-4bdc-9ea3-6a9a52cff724 | rdunning0823/tophat | src/Engine/Airspace/AirspaceAircraftPerformance.cpp | #include "AirspaceAircraftPerformance.hpp"
#include "Math/ZeroFinder.hpp"
#include <algorithm>
#define fixed_big fixed(1000000)
fixed
AirspaceAircraftPerformance::SolutionGeneral(fixed distance, fixed dh) const
{
const fixed t_cruise =
positive(distance) ? distance / GetCruiseSpeed() : fixed(0);
const fix... | ALGO | 0.998862 | 6.098793 |
6f2ff8d0-9687-4a42-9f30-fb18a219598a | Orange-pipi/Homework | 第五次试验/Point/main.cpp | /*************************************************
** : һʮ
** : tsingke
** : 2020-11-21 / 19:38
** Ȩ : <EMAIL>
** (Ȩ) : Orange-pipi
/**************************************************/
#include <iostream>
#include <cstdlib>
#include <windows.h>
#include "Point.h"
using namespace std;
/*--------------------------... | TOOL | 0.96363 | 3.633708 |
1f390faf-8b63-4884-8bb5-862014530801 | nnusT1903/CN8-CACLC3_AdvProgram | BT/01.HelloWorld/TriangleArea.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int long long
#define fi first
#define se second
#define mod 1000000007
#define maxn 100005
#define AWP "_____"
#define base 31
#define pii pair<int,int>
#define pi 3.141592654
... | ALGO | 0.999675 | 3.911662 |
617b1321-5ad7-492d-952b-f751b4195035 | nightfury063/HackerRank-ProjectEuler | euler018.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int T;
scanf("%d", &T);
while(T--){
int N;
scanf("%d", &N);
int arr[N][N];
//initialize
for (int i = 0; i < N; ++i)
{
for (int j = 0; j < ... | ALGO | 0.99981 | 3.753121 |
8fb3eb3b-d1a5-44f2-a0df-0266361c7ac2 | hsupeiyu12/CSC317ComputerGraphics | mass-spring-systems/libigl/tests/include/igl/copyleft/cgal/order_facets_around_edges.cpp | #include <test_common.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <igl/copyleft/cgal/order_facets_around_edges.h>
#include <igl/unique_edge_map.h>
#include <igl/readDMAT.h>
#include <igl/per_face_normals.h>
namespace {
typedef ... | TEST | 0.886234 | 7.502157 |
0243f1a2-bf66-4f60-a564-0155c0be2ce9 | agarciab28/Graficacion | Graficacion/Practicas/Figuras/figuras.cpp | #include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
//g++ -Wall %f -o %n `pkg-config --cflags --libs opencv`
void corazon();
void infinito();
void flor();
int main(int argc, char const *argv[]) {
int opc;
cout << "1.-Corazon\n2.-Infinito\n3.-Flor\n4.-Salir" << endl;
cin >> opc;
swit... | ALGO | 0.862652 | 4.053132 |
35546918-7334-4870-a53e-783e24a53a38 | bloodlinesresurgence/bloodlines-resurgence | src-2011/src/game/server/point_entity_finder.cpp | //-----------------------------------------------------------------------------
// class CPointEntityFinder
//
// Purpose: Finds an entity using a specified heuristic and outputs it as !caller
// with the OnFoundEntity output.
//-----------------------------------------------------------------------------
#include "... | ALGO | 0.968242 | 6.872623 |
020ab655-ee83-4cc5-b176-5abf6d5495bf | alexandraback/datacollection | solutions_5639104758808576_1/C++/tomlau/A.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int T;
cin >> T;
for (int t=1; t<=T; t++) {
int Smax;
string S;
cin >> Smax >> S;
int cnt = S[0]-'0', friends = 0;
for (int i=1; i<=Smax; i++) {
if (cnt < i) {
friends += i-cnt;
cnt = i;
}
... | ALGO | 0.99949 | 3.941251 |
3595c181-da9d-40d9-a411-958e823935c9 | Flymingo2004/Code-C | C02005;Hinh binh hanh nguoc.cpp | #include<stdio.h>
#include<math.h>
int main(){
int n, m;
scanf("%d%d", &n, &m);
for(int i = 1; i<=n ; ++i){
for( int j = 2; j<= i; ++j){
printf("~");
}
for(int k = 1; k<= m; ++k){
printf("*");
}
printf("\n\n");
}
return 0;
} | ALGO | 0.99971 | 3.369393 |
bcd2d321-02a6-4235-ae52-6cd8bfd86b16 | ParticulateFlow/LIGGGHTS-PFM | src/fix_setforce.cpp | #include <string.h>
#include <stdlib.h>
#include "fix_setforce.h"
#include "atom.h"
#include "update.h"
#include "modify.h"
#include "domain.h"
#include "region.h"
#include "respa.h"
#include "input.h"
#include "variable.h"
#include "memory.h"
#include "error.h"
#include "force.h"
using namespace LAMMPS_NS;
using name... | ALGO | 0.942723 | 6.788871 |
0517c4e5-193d-4753-a78e-e3aa6e39ace7 | TejasVijaya74/Strings | find-the-index-of-the-first-occurrence-in-a-string.cpp | /*Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.*/
class Solution {
public:
int strStr(string haystack, string needle) {
if (needle.empty()) return 0;
int m = haystack.length();
int n =... | ALGO | 0.99995 | 5.964319 |
e21e2af2-0f25-4d45-949c-e27c0cc51c42 | PriyankaNohria/C- | factorial .cpp | #include<iostream>
using namespace std;
int fact(int);
int main()
{
int num,res;
cin>>num;
res=fact(num);
cout<<res;
return 0;
}
int fact(int n)
{
int f=1;
for(int i=n;i>0;i--)
{
f=f*i;
}
return f;
}
| ALGO | 0.999914 | 4.389184 |
d08636ec-960c-44c9-9aa8-bd7dbb9d1bb6 | Amarjeet264/DSA-problems | 2631-sort-the-students-by-their-kth-score/sort-the-students-by-their-kth-score.cpp | class Solution {
public:
vector<vector<int>> sortTheStudents(vector<vector<int>>& score, int k) {
vector<int>vec(score.size());
for(int i=0;i<score.size();i++){
vec[i] = score[i][k];
}
unordered_map<int,int>mp;
for(int i=0;i<vec.size();i++){
mp[vec[i]]... | ALGO | 0.999973 | 5.602183 |
dc95905b-08de-47cc-99fa-f1494656f197 | serega-krutoi/Encryption-Algorithm-RGR | CleanArchiticture/Entities/CodeWordCipher.cpp | #include "../include/CodeWordCipher.h"
#include <stdexcept>
#include <algorithm>
using namespace std;
CodeWordCipher::CodeWordCipher(const vector<uint8_t>& codeWordBytes)
: codeWordBytes(codeWordBytes)
{
if (codeWordBytes.empty()) {
throw runtime_error("Кодовое слово не может быть пустым");
}
... | ALGO | 0.985349 | 6.151508 |
3513276c-2af5-4fb1-a09b-4b4b3ad75d5b | ibqn/codeforces | 231-a-team/team.cpp | #include <iostream>
using namespace std;
int main()
{
int w;
cin >> w;
int res = 0;
int a, b, c;
for (int i = 0; i < w; i++)
{
cin >> a >> b >> c;
res += (a + b + c > 1) ? 1 : 0;
}
cout << res << endl;
} | ALGO | 0.999243 | 4.206621 |
bd3009b6-4404-40b6-93fb-55e987c9207d | ishandutta2007/codeforces | fanache99/normal/798/D.cpp | #include <fstream>
//#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
using namespace std;
const int SIZE = 1 << 17;
const int MAXN = 100000;
char buffer[SIZE];
int pointer = SIZE;
char Advance() {
if (pointer == ... | ALGO | 0.99998 | 3.00181 |
ae254797-15d8-4157-85fb-c7eba94ad809 | GregWagner/Udemy-DSA-Courses | Other/Zero_to_Mastery/Section_13_Recursion_Advanced/convert_string_to_int.cpp | /*
* Convert String to Integer
*/
#include <iostream>
int convert_string_to_integer(const std::string &s, int n) {
return (n == 0 ?
0 :
(convert_string_to_integer(s, n - 1) * 10) + (s[n - 1] - '0'));
}
int main() {
std::cout << convert_string_to_integer("12345", 5) << '\n';
}
| ALGO | 0.9853 | 6.440415 |
a2cf6b3c-f504-42ed-b2c1-55316f2a6620 | Pulakesh5/_DSA_ | OCTOBER 24/11 October/Reorganize The Array gfg.cpp | class Solution {
public:
vector<int> rearrange(const vector<int>& arr) {
// Code here
int N = arr.size();
vector<int> ans(N, -1);
int pos = 0;
while(pos<N) {
if(arr[pos]>=0 && arr[pos]<N)
ans[arr[pos]] = arr[pos];
pos++;
}
... | ALGO | 0.999973 | 5.585326 |
54049a28-21e2-49cc-b59c-1f21611d782d | ZhouWeikuan/zoj | zju.finished/2031.cpp | #include<iostream>
#include<set>
using namespace std;
enum {
SIZ = 10004,
};
struct Node {
int pos;
char author[12];
char type;
};
int num;
Node tree[SIZ];
int ptr[SIZ];
unsigned step[SIZ];
struct author_cmp {
bool operator ()(const int&a, const int&b)const{
return strcmp(tree[a].author, t... | ALGO | 0.999939 | 4.037252 |
c3a7aecf-6bed-439b-a556-20c938085b73 | ezsystems/ezpublish-legacy | support/ezlupdate-qt4.5/shared/translatortools.cpp | #include "translatortools.h"
#include "simtexth.h"
#include "translator.h"
#include <QtCore/QDebug>
#include <QtCore/QMap>
#include <QtCore/QStringList>
#include <QtCore/QTextCodec>
#include <QtCore/QVector>
typedef QList<TranslatorMessage> TML;
typedef QMap<QString, TranslatorMessage> TMM;
QT_BEGIN_NAMESPACE
stat... | TOOL | 0.983473 | 6.99052 |
5efff28e-52b8-4118-a121-c5cde3887652 | bitcoin-core/gui | src/pow.cpp | #include <pow.h>
#include <arith_uint256.h>
#include <chain.h>
#include <primitives/block.h>
#include <uint256.h>
#include <util/check.h>
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
assert(pindexLast != nullptr);
unsigned int n... | ALGO | 0.997558 | 7.580484 |
64dae175-bfdb-4c28-a4e2-b7318ae4dd90 | vlasoka/c-- | lab3z1.cpp | #include <iostream>
#include <string>
using namespace std;
void checking(int num[]) {
int z = num[0] * 9 + num[1] * 8 + num[2] * 7 + num[3] * 6 + num[4] * 5 + num[5] * 4 + num[6] * 3 + num[7] * 2 + num[8];
if (z < 100) {
z = z;
}
else if (z == 100 || z == 101) {
z = 0;
}
else {... | ALGO | 0.984332 | 3.330003 |
6b796916-226e-41d1-a500-1578af8fc0df | OceanMiki/DataStructure | BiTree/main.cpp | /**输入格式:
第一行两个正整数n, r. 代表树的结点数量与根节点编号。
接下来n行, 每行3个整数x, y, z
表示结点x的左儿子是y, 右儿子是z
数据保证输入是合法二叉树,所有结点编号均在1~n的范围内
*
* 思路:
* 题目已经说明每个结点的编号不一样
* 而且如果某个结点的左右两个子结点都为0的话,
* 说明再往下就没有子树了
* 所以很容易由此每次找到结点创建它的左右子树
* 当然如果题目直接给前(中、后)序遍历结果就更简单了
* 求深度,递归左右子树后比较得到最大深度即可
*/
#include <iostream>
using namesp... | ALGO | 0.999909 | 4.438309 |
968e0035-857a-4c50-8480-60ab60542566 | maruf-hossain74/Codeforces_problem_Solve | Rating_1000-1100/Pushing Balls.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
string s;
s.reserve(m);
vector<bool> cd(m);
bool g=1;
for(int i = 0;i < n;i++){
cin>>s;
bool rd=false;
for(int j = 0;j < m;j++){
if(s[j]=='0')rd=cd[j]=1;
else if(rd&&cd[j])g=false;
... | ALGO | 0.999895 | 5.121861 |
e675f3c3-d9b0-47b1-8159-ca07dc9c32f7 | kabyadeb/practice | cp/end year.cpp |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define nl '\n'
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ff first
#define ss second
const ll sz=2e5+7,Inf=1e9+7;
void solve(){
cout<<"hello"<<nl;
}
int main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.t... | ALGO | 0.966031 | 3.014961 |
e1be8b15-e6d4-4d0b-88e3-06480fe7b1eb | sarvex/solution-cpp | 2400.number_of_ways_to_reach_a_position_after_exactly_k_steps.cpp | class Solution {
public:
int numberOfWays(int startPos, int endPos, int k) {
const int mod = 1e9 + 7;
int f[k + 1][k + 1];
memset(f, -1, sizeof(f));
function<int(int, int)> dfs = [&](int i, int j) -> int {
if (i > j or j < 0) {
return 0;
}
... | ALGO | 0.999995 | 5.671586 |
af0ad5d5-d316-4dbd-bf4d-ba8261e94b13 | tanus786/CP-Codes-HackOctober-Fest-2023 | C++ STL/Count number of ways.cpp | // A C++ program to count number of
// possible ways to a given score
// can be reached in a game where a
// move can earn 3 or 5 or 10
#include <iostream>
using namespace std;
// Returns number of ways
// to reach score n
int count(int n)
{
// table[i] will store count
// of solutions for value i.
int table[n + 1]... | ALGO | 0.999853 | 5.6428 |
f7705bf7-d1bf-4a99-ad4e-567f149b78fa | codeandkey/kami | kami/evaluate.cpp | #include "evaluate.h"
#include "env.h"
#include "mcts.h"
#include "options.h"
#include <iostream>
using namespace kami;
bool kami::eval(NN* current_model, NN* candidate_model, int trainer)
{
int ebatch = options::getInt("evaluate_batch");
int egames = options::getInt("evaluate_games");
int enodes = optio... | ALGO | 0.998382 | 6.395072 |
ede97ed8-b701-4596-97ed-eb933b84921f | Jeevan-kumar-Raj/LeetCode-Algorithms-Solutions-Topicwise | binary-tree-longest-consecutive-sequence.cpp | // Time: O(n)
// Space: O(h)
/**
* 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:
int longestConsecutive(TreeNode* root) {
int max_len = 0... | ALGO | 0.999922 | 6.148355 |
6f834944-edaa-4099-b40d-50baa70de65f | williamfridh/Vehicle-Classifying-and-Counting-Convolution-Neural-Networks-Onboard-Cost-Efficient-Microcontrollers | dataset-converter/librosa/eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,4);
Eigen::VectorXf v(2);
m << 1, 23, 6, 9,
3, 11, 7, 2;
v << 2,
3;
MatrixXf::Index index;
// find nearest neighbour
(m.colwise() - v).colwise().squaredNorm()... | ALGO | 0.999952 | 4.138078 |
0382dce7-1e88-4f50-8974-05efb145676d | cbch2832/cpp2 | sorting/upperbound.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n];
int y;
cin>>y;
for(int x=0;x<n;x++)
{
cin>>arr[x];
}
int left=0;
int right = n-1;
... | ALGO | 0.999997 | 3.778856 |
4cd0bb7b-75b0-4b15-ba90-30dab7c7992a | mattteochen/AoC | advent_2021/2/custom_parser.cpp | #include "custom_parser.h"
bool N_custom_parsing::is_number(char &c)
{
return (c >= '0' && c <= '9');
}
bool N_custom_parsing::is_uppercase_letter(char &c)
{
return (c >= 'A' && c <= 'Z');
}
bool N_custom_parsing::is_lowercase_letter(char &c)
{
return (c >= 'a' && c <= 'z');
}
void N_custom_parsing::Par... | TOOL | 0.918403 | 4.031464 |
46a35548-8335-4b43-9243-94f77401d863 | canaddy/tank | demo/frameworks/cocos2d-x/tools/simulator/libsimulator/lib/ProjectConfig/ProjectConfig.cpp |
#include <sstream>
#include "ProjectConfig/ProjectConfig.h"
#include "ProjectConfig/SimulatorConfig.h"
#ifdef _MSC_VER
#define strcasecmp _stricmp
#endif
#if defined(_WINDOWS)
#define DIRECTORY_SEPARATOR "\\"
#define DIRECTORY_SEPARATOR_CHAR '\\'
#else
#define DIRECTORY_SEPARATOR "/"
#define DIRECTORY_SEPARATOR_CHA... | TOOL | 0.989743 | 5.933113 |
d0d5dbda-7e58-42c3-944f-6219a66cf876 | morris821028/UVa | OnlineJudge/LeetCodeOJ/150. Evaluate Reverse Polish Notation.cpp | class Solution {
public:
int isoperator(string e) {
if (e == "+")
return '+';
if (e == "-")
return '-';
if (e == "*")
return '*';
if (e == "/")
return '/';
return 0;
}
int evalRPN(vector<string>& tokens) {
if (to... | ALGO | 0.999948 | 5.614561 |
2debd8b4-2e2d-4de2-b6a6-000ba5755ef1 | dhuamanilu/programacion | 1538/1538F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map <ll,ll> mll;
typedef vector <pair<ll,ll>> vpll;
#define FOR(i, a, b) for (long long i=a; i<(b); i++)
#define FOR1(i, a, b) for (long long i=a... | ALGO | 0.999519 | 4.041515 |
b6d32e8d-449f-42ea-a1be-a95fe31290ef | JinHyung16/Algorithm_Practice | Solvedac & Baekjoon/[Algorithm]Other/1094.cpp | #include<iostream>
#include<vector>
#define FastIO ios::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL);
using namespace std;
/// <summary>
/// Silver5 막대기 - 수학 알고리즘
/// 23 -> 4
/// 32 -> 1
///
/// 23 = 16 + 4 + 2 + 1
/// 32 = 32
/// 48 = 32 + 16
///
/// 이진수 합들로 구성이 가능하다.
/// 23기준
/// 각 필요 숫자를 이진수... | ALGO | 0.99939 | 4.857414 |
154088b0-de2e-4456-8c6a-2eda51aaaa5e | jakob-ristner/SFML-project | classes/Utils.cpp | #include "../headers/Utils.h"
// A pure function that returns a normalized version of the input vector
// Args:
// vec - vector to be normalized
sf::Vector2f normalizedVec(sf::Vector2f vec) {
float length = std::sqrt(vec.x * vec.x + vec.y * vec.y);
return sf::Vector2f(vec.x / length, vec.y / length);
}
// A p... | TOOL | 0.982606 | 5.741263 |
7d6ba804-259d-46d9-b058-a8ce16da6f63 | emreariyurek/leetcode | cpp/array/0066 Plus One.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
vector<int> result;
int carry = 1;
int idx = digits.size();
while (idx--) {
int sum = digits[idx] + carry;
carry = sum / 10;
result.push_back(sum % 10);
}
... | ALGO | 0.99979 | 6.784232 |
31dc5194-4b27-4ef6-bdb5-860461a920a5 | tcOops/Go-F-L-A-G | hack-tool/archive/1411.cpp | #include <cstdio>
#include <vector>
using namespace std;
int a[1010];
bool vis[1010];
vector<int > ans;
int main() {
int n;
scanf("%d", &n);
for(int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
}
long long sum = 0;
bool suc = true;
for(int i = 1; i <= n; ++i) {
bool sta =... | ALGO | 0.99998 | 3.348795 |
e49736bb-0578-4209-9071-f4ca4403e408 | nolifejavadeveloper/codeforces | 231A - Team.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int ans = 0;
for (int i = 0; i < N; i++) {
int a, b, c;
cin >> a >> b >> c;
if (a + b + c >= 2) {
ans++;
}
}
cout << ans;
}
| ALGO | 0.999841 | 5.16124 |
dd33bc69-aaee-4d3d-98f3-a8a0a4f77bf4 | sumondebnath/Data-Structure | Hashing/char_hash_method.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string str; cin>>str;
int hash[26] = {0};
// int hash[256] = {0};
for(int i=0; i<str.size(); i++){
hash[str[i] - 'a']++;
// hash[str[i]]++;
}
int t; cin>>t;
while(t--) {
char x; cin>>x;
cout<<ha... | ALGO | 0.999928 | 4.311005 |
5dac50bb-bfb2-4017-8629-5d57a8c08052 | ishandutta2007/codeforces | 1092515503/normal/204/E.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200100;
int n,m,id[N],A,B,len[N];
int x[N],y[N],buc[N],sa[N],ht[N],rk[N],s[N];
char str[N];
bool mat(int a,int b,int k){
if(y[a]!=y[b])return false;
if((a+k<n)^(b+k<n))return false;
if((a+k<n)&&(b+k<n))return y[a+k]==y[b+k];
return true;... | ALGO | 0.999926 | 3.649126 |
7849c440-5ac3-47d9-a9f8-2a3d701cb300 | brunobarretofreitas/ProjetoAnaliseAlgoritmos | monitoria/grafos/grafo-bipartido.cpp | #include <iostream>
#include <list>
#include <ctime>
using namespace std;
#define N 9
/*Enumeracoes*/
enum Cores{branco, cinza, preto};
enum Pecas{cueca,calca,cinto,camisa,gravata,paleto,meias,sapatos,relogio};
list<int> Adj[N];
Cores cor[N];
int d[N]; //tempo inicial em que o vertice foi acessado
int f[N]; //tempo ... | ALGO | 0.998448 | 4.335618 |
e1a708cf-0ae8-46bf-b9b9-7358b00a14eb | Synchrotron-Radiation-Workshop/srwpy | core/src/core/srtrjdat3d.cpp | /************************************************************************//**
* File: srtrjdat3d.cpp
* Description: Electron Trajectory (and relevant characteristics) calculation in 3D Magnetic Fields
* Project: Synchrotron Radiation Workshop
* First release: 2000
*
* Copyright (C) European Synchrotron Radiation ... | ALGO | 0.999387 | 3.544094 |
71f6b29e-6bba-41f7-b3cf-4061605fa30c | juruoO-o/CPP_LC | LC2923.cpp | #include <bits/stdc++.h>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
struct TreeNode {
int val;
TreeNode *left;
TreeNode *... | ALGO | 0.999861 | 4.958381 |
3b0b0cba-63be-46fa-a44d-0c37f17cb9d4 | jmonrealr/Problems | Solutions/Palindrome Permutation/main.cpp | #include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
/*
Given a string, write a function to check if it is a permutation of a pelindrome. A pelindrome is.
aword or phrase that is the same fowards andd backwards. A permutation is a rearrangement of lette... | ALGO | 0.999968 | 4.095459 |
88c78a42-573e-4371-9d88-f18938839060 | KartikeyJadli/LEETCODE | 2311-longest-binary-subsequence-less-than-or-equal-to-k/2311-longest-binary-subsequence-less-than-or-equal-to-k.cpp | class Solution {
public:
int longestSubsequence(string s, int k) {
int val = 0,cnt = 0,pow = 1;
for(int i=s.size()-1;i>= 0 && val + pow <= k; --i) {
if (s[i] == '1') {
cnt++;
val += pow;
}
pow <<= 1;
}
... | ALGO | 0.999833 | 6.024378 |
0c096385-aeca-4567-9c56-973fbdc127f8 | sarvex/leetcode-factor | solution/1600-1699/1695.Maximum Erasure Value/Solution.cpp | class Solution {
public:
int maximumUniqueSubarray(vector<int>& nums) {
int d[10001]{};
int n = nums.size();
int s[n + 1];
s[0] = 0;
for (int i = 0; i < n; ++i) {
s[i + 1] = s[i] + nums[i];
}
int ans = 0, j = 0;
for (int i = 1; i <= n; ++i)... | ALGO | 0.99989 | 6.316894 |
29b8969f-d189-41fe-8176-b8acfd55fce4 | yudong-0222/CC-Practice | Codeforces/contest_1873/pD.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(void) {
fastio;
int t; cin >> t;
while(t--) {
int n,k; cin >> n >> k;
int time = 0;
//k => 每次能消除黑色細胞的數量
string s;
cin >> s;
for(int i = 0; i < n; i++) {
if(s[i] ... | ALGO | 0.999535 | 3.73964 |
09be280f-cd87-46ad-921f-71ce988bb360 | ishandutta2007/codeforces | tokusakurai/normal/1476/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define each(e, v) for(auto &e: v)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x)... | ALGO | 0.999932 | 3.883737 |
cb9ac2b6-cf9d-4391-a6e4-f6a0d0a9409e | Henrik-Yao/NEUQ-ACM-Solution | winter-day2/朱智帅/7-8.cpp | #include<iostream>
#include<stack>
#include<queue>
using namespace std;
int number[1005] = { 0 };
typedef struct TNode
{
int data;
TNode* L, * R;
}*Tree;
int maxhigh = 0;
void Build(Tree& T,int n,int max,int high)
{
if (number[n] && n <= max)
{
T = (Tree)malloc(sizeof(TNode));
T->data = number[n];
T->L = NULL... | ALGO | 0.999648 | 3.602478 |
654e80d0-2bd3-411b-b35f-cc86f9b8ee3f | Zhenghao-Liu/LeetCode_problem-and-solution | 1486.数组异或操作/solution.cpp | class Solution {
public:
int xorOperation(int n, int start) {
int ans=0;
for (int i=0;i<n;++i)
{
int ii=start+2*i;
ans^=ii;
}
return ans;
}
};
| ALGO | 0.999982 | 4.942 |
2f3f827a-9a99-4f99-ae0b-140cc64dd59f | Syeda-Hira-Rizvi/LEETCODE | 698. Partition to K Equal Sum Subsets/698. Partition to K Equal Sum Subsets.cpp | class Solution {
public:
bool canPartitionKSubsets(vector<int>& nums, int k) {
int totalSum = accumulate(nums.begin(), nums.end(), 0);
// If the total sum is not divisible by k, it's not possible to partition
if (totalSum % k != 0) return false;
int target = totalSum / k;
... | ALGO | 0.999991 | 6.939185 |
67a9868e-4113-48ee-83f3-e6e5edfdd524 | trojsten/proboj-2015-jesen | hlavnykomp/buildy/pms/2015-11-28-17-24-11/main.cpp |
#include <iostream>
#include <unistd.h>
#include <ctime>
#include <random>
#include <functional>
using namespace std;
#include "common.h"
#include "marshal.h"
#include "update.h"
#include <complex>
typedef complex<double> Vec;
Vec vecovat(Bod blbec) {
return Vec(blbec.x, blbec.y);
}
Bod odvecovat(Vec vec) {
... | ALGO | 0.993608 | 4.293436 |
57e13890-1e71-4b4c-b2c6-6d9bceb68740 | imdar1/Maze | bfs.cpp | #include<bits/stdc++.h>
#define ff first
#define ss second
#define N 100
using namespace std;
void init(bool visit[N][N]){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
visit[i][j]=false;
}
}
}
void readInput(char arr[N][N],int* brs,int*kol){
string nama;
int i;
cin >> nama;
ifstream inFile;
inFile.op... | ALGO | 0.999887 | 4.394253 |
5e66a3c1-b23a-4c4b-95ae-cf4c1cc1667a | jcd1994/MatlabTools | Compiled/Eigen/unsupported/doc/examples/FFT.cpp | // To use the simple FFT implementation
// g++ -o demofft -I.. -Wall -O3 FFT.cpp
// To use the FFTW implementation
// g++ -o demofft -I.. -DUSE_FFTW -Wall -O3 FFT.cpp -lfftw3 -lfftw3f -lfftw3l
#ifdef USE_FFTW
#include <fftw3.h>
#endif
#include <vector>
#include <complex>
#include <algorithm>
#include <iterator>... | ALGO | 0.991861 | 6.127654 |
c4696cd5-701f-4b04-afa5-a8afd442ea12 | WelderFoundation/WelderEngineRevamp | Code/Libraries/Foundation/Common/Math/DecomposedMatrix4.cpp | namespace Math
{
DecomposedMatrix4::DecomposedMatrix4()
{
Translation.ZeroOut();
Scale.Splat(real(1.0));
Rotation.SetIdentity();
}
DecomposedMatrix4::DecomposedMatrix4(Mat4Param transform)
{
Set(transform);
}
void DecomposedMatrix4::Set(Mat4Param transform)
{
transform.Decompose(&Scale, &Rotation, &Transla... | ALGO | 0.985773 | 6.262208 |
524cf2c2-55f4-432c-905a-3b939080f269 | GaoguoYan/homework | third/3_26.cpp | #include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int> v={1,3,5,7,9};
int sought = 0;
auto beg = v.begin(),end = v.end();
auto mid = v.begin()+(end - beg)/2;
cout << *mid << endl;
while(mid != end && *mid !=sought)
{
if (sought < *mid)
end = m... | ALGO | 0.998847 | 3.602042 |
cccd4db3-29de-463b-9986-82c86b053f76 | Atulp48/DSA_with_CPP | 14_dynamic_programing/minimum swapp to make increasing subsequence.cpp | // the problem is solved with the help of the dynamic programing and used memoazation method
class Solution
{
vector<vector<int>> dp;
private:
int answer(vector<int> &nums1, vector<int> &nums2, int ind, bool swapp)
{
int result = INT_MAX;
if (ind == nums2.size())
{
r... | ALGO | 0.999997 | 5.670269 |
bfce1276-ddf4-4334-8f10-dfb1ee716acf | KienDangTrung369/common-datastructures-and-algorithms | erea_polygon.cpp | #include<bits/stdc++.h>
using namespace std;
long long rd() {
long long x = 0;
int f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') {
if(ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' &&ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
ret... | ALGO | 0.999838 | 4.134983 |
6516daf7-ea3f-4105-8ef3-51a4eb47e6fc | darling105/Project2 | cocos2d/extensions/Particle3D/PU/CCPUSimpleSpline.cpp | #include "CCPUSimpleSpline.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
//---------------------------------------------------------------------
PUSimpleSpline::PUSimpleSpline()
{
// Set up matrix
// Hermite polynomial
_coeffs.m[0] = 2;
_coeffs.m[1] = -2;
_coeffs.m[2] = 1;
_coeffs.m[3] = 1;
_co... | ALGO | 0.995332 | 6.936941 |
1e2e210f-fb6b-4f96-a547-dec1df66d5b1 | JiatongLiu97/cs354 | p4A/pin-fw/source/tools/Tests/ifuncmemcpy.cpp | #include "pin.H"
#include <iostream>
#include <fstream>
#include <string.h>
/* ===================================================================== */
/* Global Variables */
/* ===================================================================== */
std::ofstream TraceFile;
/* ======================================... | TOOL | 0.883115 | 6.348722 |
017243d2-b81f-458c-8e5f-0c08677c417d | adityakumarsinha03/LeetCode-Questions | 74-search-a-2d-matrix/74-search-a-2d-matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int m= matrix.size(), n=matrix[0].size();
int low=0, high=(n*m)-1;
int mid, i, j;
while(low<=high){
mid= (low+high)/2;
i= mid/n;
j= mid%n;
... | ALGO | 0.99996 | 6.247487 |
fa6a59f4-1fb1-43c3-9e23-3ccf6dd1cb47 | pedrofranki/fut2d-cross | FCP_GPR_2020/src/chain_action/actgen_cross.cpp | // -*-c++-*-
/////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "actgen_cross.h"
#include "cross_generator.h"
#include "action_state_pair.h"
#include "predict_state.h"
#include <rcsc/common/logger.h>
//#define DEBUG_PRINT
using namespac... | ALGO | 0.890411 | 4.691689 |
57dd059b-6e8a-4a7d-9cea-fb0a55a1d929 | ros-perception/openslam_gmapping | particlefilter/range_bearing.cpp | #include <stdlib.h>
#include <iostream>
#include <fstream>
#include <gmapping/utils/point.h>
#include "gmapping/particlefilter/particlefilter.h"
using namespace std;
using namespace GMapping;
#define test(s) {cout << s << " " << flush;}
#define testOk() {cout << "OK" << endl;}
struct Particle{
Particle(): p(0,0), ... | ALGO | 0.998939 | 4.613624 |
db5d1a16-b06c-43bd-b07c-1802f0e0162e | pokaa3a/LeetCode | problems/1383_Maximum_Performance_of_a_Team.cpp | #include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
#include <cmath>
#include <numeric>
using namespace std;
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(... | ALGO | 0.999866 | 4.976552 |
04d3614b-6c6c-43b7-be26-5026fe361efe | teofr/PAP | virtFr/main.cpp | #include "bits/stdc++.h"
using namespace std;
class UF{
public:
UF(int n = 0): p(n, -1), sz(n, 1){};
int Find(int c){return (p[c] == -1 ? c : p[c] = Find(p[c]));};
int Union(int a, int b){
int ra = Find(a), rb = Find(b);
if (ra == rb) return sz[ra];
if (sz[ra] < sz[rb]) swap(ra, rb);
p[rb] = ra;
retur... | ALGO | 0.999955 | 5.193 |
255c5c3e-d48b-461f-b9f5-0659c87d6dc3 | hardik302001/leetcode | problems/minimize_the_total_price_of_the_trips/solution.cpp | // house robber 3
class Solution {
public:
int minimumTotalPrice(int n, vector<vector<int>>& edges, vector<int>& price, vector<vector<int>>& trips) {
vector<list<int>> g(n);
for (auto& edge: edges) {
g[edge[0]].push_back(edge[1]);
g[edge[1]].push_back(edge[0]);
}
... | ALGO | 0.999799 | 5.320475 |
7017e212-8b6d-4815-af1b-bd13a45ac5d2 | hcnhcn012/algorithms | array/RemoveDuplicates/RemoveDuplicates/main.cpp | //
// main.cpp
// RemoveDuplicates
//
// Created by ChengnanHu on 10/22/20.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int removeDuplicates(vector<int>& nums);
int main(int argc, const char * argv[]) {
vector<int> v = {0,0,1,1,1,2,2,3,3,4};
int len = removeDuplicate... | ALGO | 0.998143 | 5.817651 |
87942b8f-58c2-4195-bc33-5fd2557fabad | AmarjeetJyotis/GeeksForGeeks- | Difficulty: Basic/Reverse a String/reverse-a-string.cpp | // User function Template for C++
class Solution {
public:
void reverse(string &s, int i, int j){
if(i>=j){
return ;
}
swap(s[i], s[j]);
reverse(s, i+1, j-1);
}
string reverseString(string& s) {
// code here
int i=0;
int j=s.length()-1;
... | ALGO | 0.999873 | 5.887717 |
98c78a7d-ace5-401d-8b55-de0716d97dd3 | apavlenko/android-ndk | sources/cxx-stl/llvm-libc++/libcxx/test/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp | // <algorithm>
// template<class T, StrictWeakOrder<auto, T> Compare>
// requires !SameType<T, Compare> && CopyConstructible<Compare>
// const T&
// min(const T& a, const T& b, Compare comp);
#include <algorithm>
#include <functional>
#include <cassert>
template <class T, class C>
void
test(const T& a, const T... | TEST | 0.912338 | 5.902403 |
1b77895a-f83a-4fd6-bdd7-1469f98801b3 | MahfuzLinkon/Phitron_CS | Basic Data Structures/Module_10_5_Practice_Day_01/5_doubly_linked_list_sort_ascending_order.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node *prev;
Node(int val)
{
this->val = val;
this->next = NULL;
this->prev = NULL;
}
};
void print_list(Node *head)
{
while (head != NULL)
{
cout << head->val << " "... | ALGO | 0.999793 | 4.653119 |
598f6d22-0ce0-4d31-89bf-0680405c3ce5 | parth-jangam/leethub | 0094-binary-tree-inorder-traversal/0094-binary-tree-inorder-traversal.cpp | /**
* Definition for a binary tree node.
* 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), l... | ALGO | 0.999987 | 6.50906 |
59dca706-5edd-4d99-9704-8afcc291f30f | shubhamkapoor01/LeetCode | 10-regular-expression-matching/10-regular-expression-matching.cpp | class Solution {
private:
bool valid(string& p, int j) {
j ++;
if (j == p.size() || p.back() != '*') {
return false;
}
while (j < p.size()) {
if (p[j] != '*') {
return false;
}
j += 2;
}
... | ALGO | 0.999944 | 5.553133 |
e5dbb5c8-38c6-4ac4-afd4-6886cea91062 | pouya-haghi/workload_imbalance | miniFE_skew_diff_filesv2_writeAtTheEnd/kokkos/utils/utils.cpp | #include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#ifdef HAVE_MPI
#include <mpi.h>
#endif
#ifdef MINIFE_HAVE_TPI
#include <TPI.h>
#endif
#ifdef MINIFE_HAVE_TBB
#include <tbb/task_scheduler_init.h>
#endif
#include <param_utils.hpp>
#include <Parameters.hpp>
#include <utils.hpp>
namespace m... | TOOL | 0.990365 | 4.967222 |
8cfe238f-783b-425c-bb45-1275ff43ea7d | KhoiBui16/Fullhouse_Code_Online | DSA/Contest/10_LyThuyetDoThi/Bai_17/BFS_DuongDiTrenDoThiCoHuong.cpp | #include <bits/stdc++.h>
using namespace std;
void BFS(int u, vector<vector<int>>& adjList, vector<bool>& visited, vector<int>& parent)
{
queue<int> q;
q.push(u);
visited[u] = true;
while (!q.empty())
{
int x = q.front();
q.pop();
for (int v : adjList[x])
{
... | ALGO | 0.999973 | 4.276476 |
90bab9ef-5ae1-4b4f-82fd-4f30df9de98a | ishandutta2007/codeforces | dmitrygrigorev/normal/1534/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
const int mod = 1000000007;
void add(int& a, int b) {
a += b;
if (a >= mod) a -= mod;
if (a < 0) a += mod;
}
in... | ALGO | 0.999732 | 4.435301 |
f7af2eed-27b1-4a9f-9102-eca99d458469 | pavanpvl/cp_problems | codejam/20_1C_A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(int &res)
{
int x, y, nx, ny;
string s;
cin >> x >> y >> s;
map<int, int> m;
m['N'] = 1;
m['S'] = -1;
m['E'] = 1;
m['W'] = -1;
int dis{};
nx = x;
ny = y;
for (int i = 0; i < s.length(); i++)
{
if (s[i]... | ALGO | 0.999982 | 4.568201 |
10966cb4-badd-43d7-8ac5-3a813f01e14f | BSkin/Rune | RuneServer/Bullet/TEMPM/src/BulletCollision/Gimpact/gim_contact.cpp | #include "gim_contact.h"
#define MAX_COINCIDENT 8
void gim_contact_array::merge_contacts(
const gim_contact_array & contacts, bool normal_contact_average)
{
clear();
if(contacts.size()==1)
{
push_back(contacts.back());
return;
}
gim_array<GIM_RSORT_TOKEN> keycontacts(contacts.size());
keycontacts.resize(... | ALGO | 0.9977 | 4.558418 |
2ecf884d-735e-4a4a-86d0-59fa45f6c2da | ThiagoGuim/Grafos | GrafoL.cpp | #include "GrafoL.h"
#include "Fila.h"
#include "limits.h"
#include "ListaArestaSolucao.h"
#include "ListaVerticeSolucao.h"
#include "ArestaSolucao.h"
#include "VerticeSolucao.h"
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
GrafoL::GrafoL(){
numVertices = 0;
numArestas = 0;
... | ALGO | 0.990825 | 3.761904 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.