uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4acde1ef-989b-4dc7-85f9-2b33403b270a | sunwchoi/BJ | 프로그래머스/0/181863. rny_string/rny_string.cpp | #include <string>
#include <vector>
using namespace std;
string solution(string rny_string) {
string answer = "";
for (int i = 0; i < rny_string.length(); i++)
{
if (rny_string[i] == 'm')
answer += "rn";
else
answer += rny_string[i];
}
return ... | ALGO | 0.998645 | 4.730895 |
ef1453c4-5f5b-424a-93d2-0291feed6424 | MilenaBMaciel/Questoes-OBI | 2019/3051soma.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define f first
#define s second
#define pb push_back
#define ll long long
#define dgb(x) cout << #x << " = " << x << endl
typedef pair<int, int> ii;
int main(){ _
ll n, k; cin >> n >> k;
vector<ll> vt(n);
... | ALGO | 0.999978 | 4.123541 |
adffbd73-9998-40e0-b862-04fcdb7b2127 | vxj9800/quad_sim | src/motorTq.cpp | #include <quad_sim/motorTq.hpp>
double motTq(bool ccwMotor, double u, double V, double motRll, double motKv)
{
// ccwMotor = True if the motor rotates in CCW direction when V is positive.
// u = current angular velocity of the motor in rad/sec
// V = Voltage applied
// motRll = Line-To-Line resistance ... | TOOL | 0.980787 | 6.436161 |
5f57039a-3fd5-4e87-921a-134ec39c69a2 | Yashvihg/DSAbasics | arrays/leftrotate2.cpp | // this is left rotating an array by D using STL - vectors.
#include<iostream>
#include "bits/stdc++.h"
using namespace std;
void rotateleft(vector<int>& v, int d){
if(d==0)
return;
for(int i = 0; i<d; i++)
{
v.push_back(v[0]); // element at 0 put to the end of vector.
v.erase(v... | ALGO | 0.999693 | 3.895293 |
139fbe37-d2f5-4d05-bc83-c4cde31adf2e | rishabg30/Data-Structures-and-Algorithms | arrays_problems/aggressive_cows.cpp | #include <bits/stdc++.h>
using namespace std;
bool checkfn(int distance_cap, vector<int> &stalls, int k)
{
int n = stalls.size();
// For maximum distance to acheive we can place one cow at the stall[0]
k--;
int initial_cow_position = stalls[0];
for (int i = 1; i < n; i++)
{
int curr_dist... | ALGO | 0.999982 | 5.162625 |
926c7a97-78e1-4c69-8997-d164bc2dbbe5 | Raghavendra6005/Practice_CPP | Fabinocci.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int a=0,b=1,c,n;
cin>>n;
vector<int>v;
v.push_back(a);
v.push_back(b);
for(int i=0;i<n-2;i++){
c=a+b;
v.push_back(c);
a=b;b=c;
}
for(int i=0;i<v.size();i++){
cout<<v[i];
return 0;... | ALGO | 0.999975 | 3.45497 |
09fde72a-f7d5-4333-ab6d-f206275a1276 | inzamam-ul/DSA-SETUP | src/@Striver SDE Sheet/day3/mergeIntervals.cpp | #include <bits/stdc++.h>
using namespace std;
/*
intervals[i][0] = start point of i'th interval
intervals[i][1] = finish point of i'th interval
*/
vector<vector<int>> mergeIntervals(vector<vector<int>> &intervals)
{
vector<vector<int>> mergedInterval;
if(intervals.size() == 0){
return merged... | ALGO | 0.99999 | 5.397613 |
c060bb9e-32f9-4f94-9a17-4778baf9ff64 | YanivFais/thesis_msc_dist_alg | RescueProject/RescueProject/Clp-1.9.0/CoinUtils/src/CoinPresolveImpliedFree.cpp | #include "CoinPresolveMatrix.hpp"
#include "CoinPresolveSubst.hpp"
#include "CoinPresolveIsolated.hpp"
#include "CoinPresolveFixed.hpp"
#include "CoinPresolveImpliedFree.hpp"
#include "CoinPresolveUseless.hpp"
#include "CoinPresolveForcing.hpp"
#include "CoinMessage.hpp"
#include "CoinHelperFunctions.hpp"
#include "Coi... | ALGO | 0.999301 | 4.148113 |
05300d9c-5a83-443b-846c-b4a98e8e7cb1 | MihirSinghYadav/programming-basics | C++/Object Oriented Programming in C++/40.cpp | #include <iostream>
#include <iomanip>
using namespace std;
const int DISTRICTS = 4;
const int MONTHS = 3;
int main()
{
int d, m;
double sales[DISTRICTS][MONTHS];
cout << endl;
for (d = 0; d < DISTRICTS; d++)
{
for (m = 0; m < MONTHS; m++)
{
cout << "Enter sales for dist... | TOOL | 0.984802 | 4.574837 |
ba7bb5e4-4b8d-47e1-971e-31fcbf3d5619 | dimmkan/MSHP | lesson26/l26-1/l26-1/main.cpp | #include <iostream>
using namespace std;
int sign(int a){
if(a == 0){
return 0;
}else{
if(a > 0){
return 1;
}
else{return -1;}
}
}
int main()
{
int x, y;
cin >> x >> y;
cout << sign(x) + sign(y);
return 0;
}
| ALGO | 0.999983 | 3.521182 |
d7cabf03-92ba-4a76-b567-59bb45dc7bb9 | TanmayKJha/Data-Structures-Algorithm | HASHMAP/Count Nice Pairs in an Array.cpp | class Solution {
public:
int M = 1e9+7;
int rev(int num) {
long long reversed = 0;
while (num != 0) {
int digit = num % 10;
reversed = reversed * 10 + digit;
num /= 10;
}
return reversed;
}
int countNicePairs(vector<int>& nums) {
unordered_map<int,int>mp;
... | ALGO | 0.999974 | 6.062401 |
f85346be-63df-49c5-83f9-f66fcb7c1bd5 | tanishkamishra2110/LeetcodeDiaries | 104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.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.999733 | 6.106461 |
0f0fe999-ec45-4aa1-b125-41b485527dff | tradecraftio/tradecraft | src/test/miniminer_tests.cpp | #include <test/util/setup_common.h>
#include <test/util/txmempool.h>
#include <boost/test/unit_test.hpp>
#include <optional>
#include <vector>
BOOST_FIXTURE_TEST_SUITE(miniminer_tests, TestingSetup)
const CAmount low_fee{CENT/2000}; // 500 ṩ
const CAmount med_fee{CENT/200}; // 5000 ṩ
const CAmount high_fee{CENT/10};... | TEST | 0.910036 | 6.246725 |
9d68f327-f6d3-4903-8744-2a62ddd869c5 | alexandraback/datacollection | solutions_5669245564223488_0/C++/HaZa/h2.cpp | #include<iostream>
#include<fstream>
using namespace std;
struct Data{
char arr[200];
bool first;
bool last;
};
long factorial(int n)
{
int i;
long result = 1;
for (i = 1; i <= n; i++)
result = result*i;
return (result);
}
long Npr(int n, int r)
{
long result;
result = factorial(n) / factorial(n - r);
... | ALGO | 0.999619 | 3.340219 |
912e1836-f925-4fd2-8da4-25d1a92bfaf8 | mnasser02/cp-notebook | CSES Problem Set/advanced-techniques/dynamic-connectivity.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef tuple<int, int, int> iii;
typedef pair<ll, ll> pll;
typedef ... | ALGO | 0.999959 | 4.558025 |
c8430436-8a8c-437e-b761-32433073d46b | winston98321/ADIP | HW5/HW5/2_3.cpp | /*#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <vector>
#include <cmath>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
const double PI = 3.14159265358979323846;
cv::Mat visualizeSpectrum(const c... | ALGO | 0.98775 | 5.093592 |
88079f1c-6054-4b30-87f6-c2520b4a85fe | hjhng125/Algorithm | BOJ/BOJ11408.cpp | #include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
int n, m;
int cost[802][802], c[802][802], f[802][802];
int main()
{
scanf("%d %d", &n, &m);
int S = 0, T = n + m + 1;
vector<vector<int> > adj(T + 1);
for (int i = 1; i <= n; ++i) {
//S ̾
adj[S].push_back(i);
adj[i... | ALGO | 0.999844 | 3.480773 |
c209ce2a-b0a9-49d0-95c4-0a35362719f8 | MRLintern/Tikhonov_Regularization | src/RegularizationSolver.cpp |
// implements the Regularization solver
#include "RegularizationSolver.hpp"
// constructor to initialise: A, b, regularization parameter and sets the Regularization Matrix to the identity matrix by default
RegularizationSolver::RegularizationSolver(const Eigen::MatrixXd& A, const Eigen::VectorXd& b, double lambda)
... | ALGO | 0.981635 | 6.162445 |
1c2f9ac0-a1e8-47ae-82cf-b2f178861aaf | EvgeniyPrudnikov/Magistracy | Algorithms/Labs/lab1/main.cpp | #include <iostream>
#include <random>
#include <ctime>
#include <fstream>
//__declspec(align(16))
// __restrict
namespace
{
void MultSimple(const double* __restrict a, const double* __restrict b, double* __restrict c, int n)
{
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j... | ALGO | 0.997656 | 3.813345 |
935272bc-05b8-4516-bcc3-ba9ce8579be1 | Limon-s-Interview-Prep-Zone/leetcode | leetcode/0200-0299/206. Reverse Linked List/206.cpp | class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode* prev = nullptr;
ListNode* curr = head;
while (curr) {
ListNode* temp = curr->next;
curr->next = prev;
prev = curr;
curr = temp;
}
return prev;
}
}; | ALGO | 0.999791 | 5.884513 |
a6fbd6ac-9e32-479e-9ee0-9d5bd6d5378b | yarncha/algorithm-solutions | baekjoon/16194.cpp | #include <iostream>
using namespace std;
void Solution16194() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int num_of_card; // 구매하고자 하는 카드의 개수 (1~1000)
int costs_of_card_pack[10001]; // 카드가 n개 들어있는 카드팩의 가격, 하나의 가격 범위는 1~10000
cin >> num_of_card;
for (int i = 1; i <= num_of_card; i++)
{
int cos... | ALGO | 0.999893 | 4.468609 |
7b72592c-294d-409a-80a8-98f4e3d90047 | Ayandip244/CodeSprint2.0 | 45.cpp | #include<bits/stdc++.h>
using namespace std;
int score(vector<int>& nums, int k){
int n=nums.size();
vector<int> a(n);
a[0]=nums[0];
for(int i=1;i<n;i++){
int m=INT_MIN;
for(int j=max(0,i-k);j<i;j++){
m=max(m,a[j]);
}
a[i]=nums[i]+m;
}
return a[n-1];
}
int main(){
string l;
cout<... | ALGO | 0.999582 | 4.420879 |
7f0fcdcb-eec0-44c7-af47-8dc777cfebb9 | BaeSungHyun/Algorithm | helloworld/GreedyMaxMeetings.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct meeting {
int start;
int end;
} mt[100'000];
bool compare(const meeting& m1, const meeting& m2) {
if (m1.end == m2.end) { // if same end time, ascending order in start time
return (m1.start < m2.start);
}
... | ALGO | 0.999983 | 5.147983 |
404ba446-098f-45c5-87fa-2745f0d5bb2a | noornabi-noor/Codeforces | twoSum.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define lld long long double
#define ull unsigned long long
#define pll pair<int, int>
#define mod 1000000007
const int N = (int)1e6;
#define BISMILLAH ios_base::sync_with_stdio(0);cin.tie(0);
#define ALHAMDULILLAH return 0;
#d... | ALGO | 0.999967 | 4.419254 |
195ca8fa-2c44-4df0-9848-ad10ac18588b | mkolesnyova/lab7 | lab7(5).cpp | #include <iostream>
using namespace std;
int main()
{
const int n = 5;
int a[n][n], h[n*n], k[n*n], i, j, m=0, v=0;
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
a[i][j] = rand() % 10;
if (a[i][j] % 2 == 1)
{
h[m] = a[i][j];
... | ALGO | 0.999652 | 3.003832 |
e18e97b2-737e-4adf-aae2-8526c2774800 | dougshidong/PHiLiP_testing | tests/unit_tests/sensitivities/compare_rhs.cpp | #include <deal.II/base/tensor.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_tools.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/sparsity_pattern.h>
#include <deal.II/numerics/vector_tools.h>
#include "dg/dg_factory.hpp"
#include "mesh/grids/g... | TEST | 0.986983 | 6.41478 |
b8bf56d9-b9be-4f85-9bad-f7d6b80d8d2a | linchik-l/Lesson52RevisionSolution | Task03/logic.cpp | // [The Number of extreme elements]
// Количество экстремальных элементов
//
// Дан вектор вещественных значений. Необходимо разработать
// функцию(или программу), которая подсчитывает количество
// экстремальных (минимальных и максимальных) элементов вектора.
// Если вектор задан некорректно, то функция(программа) дол... | ALGO | 0.986292 | 5.128099 |
afe08976-9855-425f-b22d-276ff7e37c17 | RodriFMG/-CNN_Avance | main.cpp | #include "CNN.h"
vector<vector<Vector3i>> MatToVector(const Mat& img){
vector<vector<Vector3i>> total(img.rows);
for(int i=0; i<img.rows; ++i){
vector<Vector3i> retorno(img.cols);
for(int j=0; j<img.cols; ++j){
Vector3i rgb;
for(int k=0; k< static_cast<int>(img.channe... | TOOL | 0.98751 | 4.339925 |
8f43db7b-3b0e-436f-a8d0-ebb7b8b8e838 | Namir-Khan/Leet-Code | 0242-valid-anagram/0242-valid-anagram.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
sort(s.begin(),s.end());
sort(t.begin(),t.end());
if(t == s){
return true;
}
else{
return false;
}
}
}; | ALGO | 0.999988 | 6.048991 |
de0f9f8c-08a6-4170-9914-29f1130280ab | pratiksaha/practice | algorithms/gcdEuclid.cpp | //Euclids algorithm for gcd
#include<iostream>
#include<cmath>
using namespace std;
void swap(int *a, int *b) {
int t = *a;
*a = *b;
*b = t;
}
int Euclid(int m, int n) {//gcd of -ve nos is same as that of +ve nos
if (m<0)
m = -m;
if (n<0)
n = -n;
if( m == n)
return m;
... | ALGO | 0.999849 | 4.08618 |
326201b1-d026-4b58-870d-ba811ba07b8f | NehaVerma825/cpp-all-code | Queue.cpp/firstNonRepeating.cpp | #include<iostream>
#include<unordered_map>
#include<queue>
using namespace std;
class Solution {
public:
string FirstNonRepeating(string A){
unordered_map<char, int> count;
queue<int> q;
string ans = " ";
for(int i = 0 ; i>A.length(); i++){
char ch = A[i];
//i... | ALGO | 0.999729 | 3.807673 |
aa2b2bad-274c-45cb-a68d-658bb701ddec | iamslash/learntocode | leetcode/AddingTwoNegabinaryNumbers/a.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
// A: 1 0 0 0 0
// B: 1 0 1
// C: 1 2 1 2
// A: 1 1 1 1 1
// B: 1 0 1
// R: 0 0 0 0 1-1
// A: 1
// B: 1
// C: 0 1 1
// // 12ms 77.54% 9MB 100.00%
// // O(N) O(N)
// class Solution {
// public:
// std::vector<int> addNegabinary(
// std::vector... | ALGO | 0.999982 | 5.788756 |
c01cad7a-300f-4b92-bedd-73888b06d9e1 | JaoPhu/Abstract-Datatypes-HW68 | week7/6630300351_1.cpp | #include <iostream>
using namespace std;
struct node{
struct node* left;
int value;
struct node* right;
};
struct node* Insert(struct node* tree,int num){
if(tree==NULL){
tree=new struct node;
tree->value=num;
tree->left=tree->right=NULL;
}else{
if(num<tree->value){... | ALGO | 0.999781 | 4.25663 |
4da4234f-dcbc-48b4-a8a6-3bb7fb0d3c5e | powerlic/inferengine | src/infer/libtorch/ssd.cpp | #include "ssd.h"
#include "torch/script.h"
#include "utils/logging.hpp"
#include "anchors.hpp"
#include "nms.h"
#include <fstream>
#ifdef TIME_LOG
#include "utils/timer.hpp"
#endif
using namespace easycv;
using namespace std;
SSD::SSD(int device_id) : device_(torch::kCUDA, device_id)
{
}
void SSD::Init(const std::... | DATA | 0.895334 | 4.624779 |
585ab1ff-69c6-47ae-88b3-2aa61c9990e3 | wbzhang233/online_test_imitation | huawei/1.cpp | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <unordered_set>
using namespace std;
int main()
{
int n;
cin>>n;
int charSet[256]={0};
// unordered_set<int> chars;2752771
string nstr;
int ans=0;
stringstream ss;
ss<<n;
ss>> nstr;
cout<<... | ALGO | 0.99985 | 4.4052 |
bc521bd6-4c00-423c-a2f1-b89b561bb514 | derzhavin3016/SUM2018 | CAMP/SOLVE4/SOLVE4.CPP | #include "SOLVE4.H"
/* Number sign function (template).
* ARGUMENTS:
* - number:
* T A;
* RETURNS:
* (INT) 0 if A is zero, 1 if A positive, -1 if A negative.
*/
template <class T>
static INT Sign( T A )
{
return A == 0 ? 0 : A > 0 ? 1 : -1;
}
/* Solve equation of the fourth degree function.... | ALGO | 0.999995 | 5.324668 |
a65ba352-7bed-4cc3-bf4b-f1438067861e | Abhay811/hackerearth-basic | basic/friendrelationship.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main()
{
fast;
int t;
cin >> t;
int n;
while (t--)
{
cin >> n;
for (int i = 1; i <= n; i++)
{
string s = "";
... | ALGO | 0.999799 | 3.698526 |
89889336-4a8a-4a49-ab77-2f4be8d23d7c | sudoLife/id1021-algorithms | Hash tables/zip_as_index/main.cpp | #include "Zip.hpp"
#include <chrono>
#include <iostream>
#include <vector>
typedef std::chrono::high_resolution_clock hclock;
using std::chrono::duration_cast;
typedef std::chrono::microseconds us;
typedef std::chrono::nanoseconds ns;
int main()
{
Zip zip("../postnummer.csv");
// std::cout << zip.linear("111... | DATA | 0.972442 | 3.527126 |
a7fc4508-90dd-4f2f-b477-e284e1ddc188 | EduardoCardozo/competitive-programming | obi/2002/lua.cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int main()
{
int n, teste = 1, m;
while(true){
scanf("%d %d", &n, &m);
if(!n and !m)break;
vector<int> intervalos(n+1, 0);
for(int i=1;i<=n;i++)
scanf("%d", &intervalos[i]);
int men = inf, mai=-1;
for... | ALGO | 0.999523 | 3.494818 |
80910866-8563-48fe-afef-2e6d8798c6b6 | codingNoob12/algorithm-study | cpp/바킹독_알고리즘/그래프/1707.cpp | #include <bits/stdc++.h>
using namespace std;
int k, V, E;
vector<int> adj[20'001];
bool bfs() {
queue<int> q;
vector<int> vis(V + 1, -1);
for (int i = 1; i <= V; i++) {
if (vis[i] != -1) continue;
q.push(i);
vis[i] = 0;
while (!q.empty()) {
int cur = q.front();
q.pop();
for (int nxt : adj[cur])... | ALGO | 0.999933 | 5.271593 |
c2376109-0232-43ff-9a55-cb62cbff5ac2 | raihanislam-71/Phitron | Data Structure/Module_7/insert.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
void print_linked_list(Node *head) //O(n)
{
Node *tmp = head;
while(tmp != NULL)
{
cout<<tmp->val<<" ";
tmp =... | ALGO | 0.999906 | 4.369249 |
6204c6e4-e698-4704-92a8-a9fff5a17ec6 | om-verma-03/DSA_sp | Searching/First_Occurence.cpp | #include<bits/stdc++.h>
using namespace std;
int first_occur(vector<int>& nums,int target){
int ans = INT_MAX;
int start = 0;
int end = nums.size()-1;
while(start<=end){
int mid = (start+end)/2;
if(nums[mid] == target){
ans = mid;
end = mid-1;
}
... | ALGO | 0.999918 | 5.579394 |
adfb25c1-5832-40ba-a561-710f1aafdcbe | mengbin92/leetcode | T9键盘/main.cpp | #include <iostream>
#include <string>
#include <vector>
using std::cout;
using std::endl;
using std::string;
using std::vector;
vector<string> getValidT9Words(string num, vector<string> &words)
{
vector<char> table = {'2', '2', '2', '3', '3', '3', '4', '4', '4', '5', '5', '5', '6', '6', '6', '7', '7', '7', '7', '... | ALGO | 0.990606 | 5.42377 |
47bf6280-6739-438f-a6a4-de3475065b8e | haxpor/comppuva | TMA.cpp | /**
* TMA - The Mating Algorithm as per Gale-Shapley algorithm
* The problem based on N suitors (boys) and N girls.
*
* Time complexity: O(N^2)
* Space complexity: O(N^2)
*/
#include <iostream>
#include <unordered_map>
#include <vector>
#include <cstring>
// N is the number of man or woman
// thus 2*N is total n... | ALGO | 0.999982 | 6.284613 |
6ee44ee8-9fc2-4ee9-a987-2116dea93e05 | yoonjaehee/STL-algorithm | src/string/bak9251.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;
int arr[1001][1001]={0,};
int main(){
string str1,str2;
getline(cin,str1);
getline(cin,str2);
int len1 = str1.size();
int len2 = str2.size();
for(int i=0;i<len1+1;i++){
memset(arr[i],0,siz... | ALGO | 0.999708 | 4.031856 |
fcbf414e-6bc3-400e-8e49-1240727ad498 | SamuelWu2001/LeetCode2024 | Backtracking/79. Word Search/solution.cpp | class Solution {
public:
bool exist(vector<vector<char>>& board, string word) {
pair<int, int> current;
for(int i=0;i<board.size();i++) {
for(int j=0;j<board[i].size();j++) {
if(board[i][j] == word[0] && wordSearch({i, j}, word, board, 1))
return true;
... | ALGO | 0.999773 | 6.137901 |
fc6f02a4-9a85-48e9-972e-ff423ab93e4c | w181496/OJ | LeetCode/1019.Next_Greater_Node_In_Linked_List.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
vector<int> nextLargerNodes(ListNode* head) {
vector<int>ans;
ListNode *prev = head;
if(!head) return ans;
... | ALGO | 0.999954 | 5.519503 |
1255775f-995f-46d4-85ae-edf88673160f | jasmneazzhra/prakKehadiranKelas_Jasmine2D | 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.998733 | 6.76775 |
2cb7b30c-a557-4f9f-bbaa-439e4bb61d2a | Kavin1421/Leetcode-Solution | 1600-1699/1674.Minimum Moves to Make Array Complementary/Solution.cpp | class Solution {
public:
int minMoves(vector<int>& nums, int limit) {
int n = nums.size();
vector<int> d(limit * 2 + 2);
for (int i = 0; i < n >> 1; ++i) {
int a = min(nums[i], nums[n - i - 1]);
int b = max(nums[i], nums[n - i - 1]);
d[2] += 2;
... | ALGO | 0.999976 | 5.492585 |
b2126719-239b-46de-8574-a72682fa4006 | Ketbome/Tesis | Trabajo/simulated-annealing-joa-parallel/src/numeric/ibex_Newton.cpp | #include "ibex_Newton.h"
#include "ibex_Linear.h"
#include "ibex_LinearException.h"
#include <cassert>
using namespace std;
namespace ibex {
double default_newton_prec=1e-07;
double default_gauss_seidel_ratio=1e-04;
namespace {
//
//inline bool newton_step(const Fnc& f, IntervalVector& box,
// IntervalVector& mid... | ALGO | 0.999883 | 5.591372 |
d557f326-a426-41fc-b108-76fa484bddb2 | Nasir-1310/Codeforces-Problem-Solve. | A Series/1593B.cpp | #include <iostream>
#include <string>
using namespace std;
int minStepsToDivisibleBy25(string num) {
int n = num.size();
// Check if the number is already divisible by 25
if (stoi(num) % 25 == 0) {
return 0;
}
// Iterate from right to left to find the digit to remove
for (int i = n -... | ALGO | 0.998964 | 6.596721 |
53aad66b-519d-487c-9489-2daa1ae692b3 | Midnight1938/My_Cpp_Path | Basics/Section_5:_Pointers_and_Memory/44._Reversing_String/Reverse_String.cpp | #include <iostream>
using namespace std;
/*
* Its easier to use a for loop and reverse a string
* But we use an array for funzies
*/
int main()
{
char text[] = "Hellow";
int nChars = sizeof(text) - 1; //? (7-1)
char *pStart = text; //? A start point
char *pEnd = text + nChars - 1; //? 0 +... | ALGO | 0.995132 | 3.611725 |
c300da25-1329-4b41-8a55-b6fc4d9af7a3 | kayaru28/programming_contest | old_contest/at_coder_abc226_C.cpp |
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <bitset>
using namespace std;
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define rep2(i,n,i2,n2) for (ll i = 0; i < (n) ; i++) for (ll i2 = 0;... | ALGO | 0.999806 | 3.243319 |
229e6f3b-97ca-4648-8b25-e3b7fca3f8b9 | skjmp/ProCon | Other/APC001/APC001/a.cpp | //#include<math.h>
//#include<limits.h>
//#include<iostream>
//#include<string>
//#include<vector>
//#include<stdio.h>
//#include<sstream>
//#include<list>
//#include<queue>
//#include<algorithm>
//#include<functional>
//#include<map>
//#include<set>
//#include<utility>
//#include<initializer_list>
//#include<tuple>
//... | ALGO | 0.999777 | 3.125874 |
70103fb5-66b3-427f-b8f7-49a1d40879bc | Dutta-SD/CC_Codes | cp/GameWithSticks.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long unsigned llu_t;
int main() {
int n, m;
cin >> n >> m;
cout << (min(n, m) % 2 ? "Akshat" : "Malvika") << endl;
return 0;
} | ALGO | 0.999852 | 3.793858 |
f87758ee-d7d4-4f16-be53-398ffc8c6531 | nishant-argade-dev/DSA | Heap/#PROBLEMS/5_Sort_Acord_most_frequent_no.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <unordered_map>
using namespace std;
int main()
{
priority_queue<pair<int, int>> maxheap;
vector<int> arr{1, 3, 4, 5, 6, 2, 2, 1, 1, 1, 3, 3};
vector<int> frq;
unordered_map<int, int> mp; // size complexity = O(n+k) k for map size
fo... | ALGO | 0.999983 | 5.313221 |
c15d6132-a114-4138-ae89-7175308d4da1 | thuannv/LatinIME | native/jni/src/dictionary/utils/probability_utils.cpp | #include "dictionary/utils/probability_utils.h"
namespace latinime {
const float ProbabilityUtils::PROBABILITY_ENCODING_SCALER = 8.58923700372f;
} // namespace latinime
| ALGO | 0.943367 | 4.831943 |
4bb39301-1911-4225-9344-5d2f59d2bd9f | rafaelportomoura/ufla-gcc218-algoritmos-em-grafos | Algoritmos/Arvore Geradora Mínima/Kruskall/main.cpp | #include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
struct Vertex {
int father;
int rank;
Vertex() {
father = 0;
rank = 0;
}
};
struct Edge {
int u;
int v;
int weight;
Edge( int u, int v, int weight ) : u( u ), v( v ), weight( weight ) {};
};
struct Comparator {
... | ALGO | 0.999949 | 5.092679 |
c0399ed4-840b-4a2c-b08e-1abbbbf0dd4f | Devika03/Leetcode_Daily_progress | 0215-kth-largest-element-in-an-array/0215-kth-largest-element-in-an-array.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int i = nums.size();
return nums[i-k];
}
}; | ALGO | 0.999851 | 5.213025 |
eee98159-4846-4012-a69f-821695021983 | ishandutta2007/codeforces | alexluchianov/normal/1558/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
using ll = long long;
int const nmax = 2021;
int v[1 + nmax];
std::vector<int> sol;
bool makemove(int n, int p) {
if(1 <= p && p <= n && p % 2 == 1) {
sol.push_back(p);
std::reverse(v + 1, v + p + 1);
return 1;
} else
... | ALGO | 0.999918 | 3.919088 |
f99d588a-4edb-4842-bdb4-fc7e4ca698ba | rezaagung48/uas_43a87006190328_pemmob | 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.998859 | 6.785645 |
fbc1ba63-459e-4c8b-89cf-0ed68e09ac38 | JacquelineCasey/ICPC-Practice | old/jan-29/problem_a.cpp |
#include <iostream>
#include <vector>
bool check_query(const std::vector<int>& clusters, int query) {
int left {0}; // [)
int right {static_cast<int>(clusters.size())}; // past the end. [)
int sum {0};
/* First, run right and build up sum */
while (sum < query) {
if (left == static_cast<... | ALGO | 0.999996 | 5.50388 |
b5b33cde-19ba-4164-b446-710e1dec891e | Viktory4121/Numerical_mathematics | lab4_vm/lab4_vm.cpp | // Вариант 2.
#include <iostream>
#include<cmath>
#include<vector>
#include<fstream>
#include<iomanip>
#include<cstdlib>
#include<string>
using namespace std;
//---------------------ПО ВАРИАНТУ---------------------
const double A = 1.0;
//инициализация границ для x и t происходит в функции calculating
//------------... | ALGO | 0.99985 | 3.852183 |
7a4da19b-1d30-4b9e-942c-d09660a5f09f | bhutoriaumang/competitvecoding | codejamround1b.cpp | #include <bits/stdc++.h>
using namespace std;
long long int getClosest(long long int, long long int, long long int);
long long int findClosest(vector <long long int> arr,long long int n, long long int target){
if (target <= arr[0])
return arr[0];
if (target >= arr[n - 1])
return arr[n - 1];
... | ALGO | 0.997687 | 3.830199 |
ae4f7e2e-75fd-4ea8-8444-42ab122f0559 | hzratali/DSA-Problems | Trace Path - GFG/trace-path.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
int isPossible(int n, int m, string s){
// code here
int lowr = 0, lowc = 0, highr = 0, highc = 0, r = 0, c = 0;
f... | ALGO | 0.999912 | 5.927189 |
8f288369-99ed-41a1-a5c7-41e36db23684 | abhi-s-03/CrackYourPlacement | LargestBST.cpp | class Solution{
public:
/*You are required to complete this method */
// Return the size of the largest sub-tree which is also a BST
int ans=0;
vector<int> solve(Node* root){
if(!root) return {0,INT_MAX,INT_MIN};
vector<int> l=solve(root->left);
vector<int> r=solve(root->righ... | ALGO | 0.99996 | 6.378451 |
b0cb8cf3-4864-4c0c-8327-c0fa28373887 | EulerLee/OJ | SGU/100.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
cout << A + B << endl;
}
| ALGO | 0.998906 | 3.881449 |
d5200530-e547-4206-9186-81e88912f175 | facebookresearch/pando | software/labgraph_nodes/contrast_calcs/src/frame_average_class.cpp | #include "add_arrays.h"
using namespace std;
class FrameAverage {
// std::deque<std::vector<int>> Aggregator;
std::vector<int> Aggregator;
public:
void init_aggregator(std::vector<short int>);
void update_aggregator(std::vector<short int>);
};
void FrameAverage::init_aggregator(std::vector<short int> init_f... | ALGO | 0.995263 | 4.965757 |
c2a2da43-abba-493e-8c27-548ea2723c79 | Didarul342/Problem-Solving | C++/Beecrowd/1039.cpp | #include <cstdio>
typedef long long ll;
int main() {
ll a, b, c, d, e, f, q, x, y;
while (scanf("%lld %lld %lld %lld %lld %lld", &a, &b, &c, &d, &e, &f) !=
EOF) {
x = e + d, y = f;
q = (x - b) * (x - b) + (c - y) * (c - y);
if (q > a * a) {
printf("MORTO\n");
... | ALGO | 0.999912 | 3.456043 |
997c683c-8990-4ce7-82c5-1bf8c213dfb2 | JBlakd/self-study | two-pointer-sort-array-parity/sort_array_by_parity.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> sortArrayByParity(vector<int>& nums) {
vector<int> ret(nums.size());
int even_pointer = 0;
int odd_pointer = nums.size() - 1;
for (int i = 0; i < nums.size(); ++i) {
if (... | ALGO | 0.999961 | 5.89387 |
6b496801-bdb8-4e8c-852c-720b77ebbf6d | gautamJayesh/mischievious69 | infix to prefix.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_SIZE 100
// Structure to represent a stack
struct Stack {
int top;
char items[MAX_SIZE];
};
// Function prototypes
void push(struct Stack* stack, char item);
char pop(struct Stack* stack);
int isOperator(char ch);
int getPrecedence(char c... | ALGO | 0.999747 | 6.839371 |
b8be3f12-cc33-46ff-aa53-52e7858ec3bc | wanderer2201/Hacktober-Files-2022 | CPP Codes/LRU_Cache.cpp | // Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.
struct Node {
int key;
int value;
Node(int key, int value) : key(key), value(value) {}
};
class LRUCache {
public:
LRUCache(int capacity) : capacity(capacity) {}
int get(int key) {
if (!keyToIterator.count(ke... | ALGO | 0.997996 | 7.337462 |
8b5d67ac-5b36-43bd-9c02-0e046bc2358c | thanitsakdue/Myalgo | top-downf.cpp | #include <bits/stdc++.h>
using namespace std;
int memo[100]= {0};
int f(int n,int k,int memo[])
{
if(n>=k){
if (n ==k || k==0 || k==1)
{
return 1;
}
else if ( memo[n] !=0)
{
return memo[n];
}
else
{
memo[n]=f(n-1,k,memo) +f(n-1,k-2,memo);
return memo[n];
}
}
}
int main(){
cout << f(6,4,memo);
}
| ALGO | 0.99998 | 4.411422 |
deec3652-dd7f-4e7e-942d-ef81a2ed8ca8 | edinakaknjo/CPPvjezba | CPPvjezba/ZSR5/Z41/main.cpp | //TP 2018/2019: ZSR 5, Zadatak 41
#include <iostream>
#include <iostream>
#include <complex>
#include <algorithm>
#include <deque>
using namespace std;
void Sortiraj (deque<complex<double>> &dek){
sort(dek.begin(),dek.end(), []( complex<double> x, complex<double> y){
if(x.real()<y.real()) return x.real()<... | ALGO | 0.99877 | 3.964042 |
7d3cf298-8689-463a-b32c-a3357ee4bda2 | abhishek18124/PPCPPJune2024 | Lecture 33/01 - BT/005BinaryTrees_BuildTreeFromLevelOrder.cpp | /*
given the level order traversal of a binary tree, design an algorithm to construct a
binary tree from it.
Example
Input: 10 20 30 40 50 -1 60 -1 -1 70 -1 -1 -1 -1 -1
*/
#include<iostream>
#include<queue>
using namespace std;
class TreeNode {
public:
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int v... | ALGO | 0.99994 | 5.312289 |
063892aa-2a9d-48df-b207-2cc28efd9645 | rodcaseribe/C | selection_sort.cpp | #include <stdio.h>
#include <stdlib.h>
void selecao(int Vet[],int n){
int Menor, aux;
for(int i=0;i<n-1;i++){
Menor=i;
for(int j=i+1 ; j<n ; j++){
if(Vet[Menor] > Vet[j])
Menor=j;
}
if(i!=Menor){
aux=Vet[i];
Vet[i]=Vet[Menor]... | ALGO | 0.999703 | 4.172621 |
abc64bdd-9c51-4799-aebf-0bedb5c00cb3 | junkkerrigan/algorithmics | geometry/52.cpp | // #define CURRENT true
#ifdef CURRENT
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
double a, b, angleInDegrees;
cin >> a >> b >> angleInDegrees;
double angleInRadians = (M_PI * angleInDegrees) / 180;
double area;
if (angleInDegrees == 0) {
... | ALGO | 0.996313 | 5.178967 |
ab01d6d7-c128-418c-8d89-91851fc85434 | samiullah88/gfg-160-challenge | Day45.cpp | // Intersection of Two arrays with Duplicate Elements
class Solution {
public:
vector<int> intersectionWithDuplicates(vector<int>& a, vector<int>& b) {
//Code Here
unordered_map<int,int>mp;
for(int i=0;i<a.size();i++){
mp[a[i]]++;
}
vector<int>ans;
for(... | ALGO | 0.999899 | 5.227405 |
bc0ea93b-1cf8-4332-9446-537a6039ecec | RJD02/DSA-Practice | codeforces/contests/codeforces_edu_round_103/B.cpp |
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#def... | ALGO | 0.999804 | 4.151781 |
140ddb7f-3d27-46c1-821c-b9914b4a63cb | kashyaparka/LC-Journey | 520-detect-capital/520-detect-capital.cpp | class Solution {
public:
bool detectCapitalUse(string word)
{
vector<int> v(word.size(),0);
for(int i=0;i<word.size();i++)
{
if(word[i]>='A' && word[i]<='Z')
v[i] = 0;
else if(word[i]>='a' && word[i]<='z')
v[i] = 1;
}
... | ALGO | 0.999935 | 6.112507 |
494fa8c8-9349-44e0-a048-c9c049acd207 | rootoverswapno/All-Programming- | contest/div_4_p1.cpp | #include<bits/stdc++.h>
#define swapno king of the world
#define int long long
using namespace std;
void solve_de()
{
//rootover swapno.......
int m,n,o;
cin>>m>>n>>o;
if(m<n&&n<o)
{
cout<<"STAIR"<<endl;
}
else if(m<n&&n>o)
{
cout<<"PEAK"<<endl;
}
else
{
cout<<"NONE"<<endl;
}
}
in... | ALGO | 0.999485 | 3.902827 |
570a3088-f60e-437e-ae84-46945f652e25 | thetalhamirza/OOP-Lab-5 | Q6.cpp | #include <iostream>
#include <string>
using namespace std;
struct Item {
string itemName;
string itemCategory;
double itemPrice;
};
class JuiceShop {
private:
int menuSize;
string* orderQueue;
int currentOrders;
public:
const string shopName;
Item* menu;
JuiceShop(const strin... | TOOL | 0.958227 | 6.307799 |
b4a76057-1a51-4d19-956c-dca9ca1a5f5d | retwick/turboCPM | graph_lib.cpp | #include <bits/stdc++.h>
using namespace std;
class Graph {
private:
set < int > Vertices; //vertex index starts from 1
set < pair < int, int > > Edges; //<u,v>
unordered_map < int, set < int > > AdjList_of_Vertices; /... | ALGO | 0.9997 | 4.455377 |
a7fb470f-e802-44bf-8a54-137d7b2e3b0e | kfernandez31/Competitive-programming | leetcode/0100-0199/0160. Intersection of Two Linked Lists/solution_1.cpp | // Approach: Keep track of all traversed nodes.
// TC: O(m+n)
// SC: O(max(m,n))
class Solution {
public:
ListNode* getIntersectionNode(ListNode* a, ListNode* b) {
unordered_set<ListNode*> s;
ListNode* cur = a;
while (cur) {
s.insert(cur);
cur = cur->next;
}
... | ALGO | 0.999964 | 5.738918 |
4137eb9b-60c0-463d-8807-9cdc6120fe4a | godely/Problems | CodeMarshal/A.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
#define fr(a,b,c) for (int a = b; a < c; a++)
#define rp(a,b) fr(a,0,b)
#define cl(a,b) memset(a,b,sizeof a)
#define MOD 1000000007
typedef long long ll;
int main()... | ALGO | 0.998906 | 3.952141 |
6fc0de44-dac9-4479-8118-d278a4d3f249 | thiess-cristian/ImageProcessing | src/Tools/ZhangSuen.cpp | #include "ZhangSuen.h"
#include <qimage.h>
#include <qcolor.h>
#include <iostream>
#include <memory>
ZhangSuen::ZhangSuen():m_neighbors(std::vector<QColor>(8))
{
}
QImage * ZhangSuen::modify(QImage * image)
{
if (image == nullptr) {
return nullptr;
}
std::unique_ptr<QImage> tempImage1;
s... | ALGO | 0.986235 | 5.010283 |
038edbcc-1d06-4a26-a882-5242d25cd86a | forked-llvm/Polaris-Obfuscator | libc/src/math/generic/log10f.cpp | #include "src/math/log10f.h"
#include "common_constants.h" // Lookup table for (1/f)
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FMA.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PolyEval.h"
#include "src/__supp... | ALGO | 0.996088 | 6.654267 |
1e82a8d3-8005-409a-ad38-27cc2438faca | Anshuu-Sharma/LeetCode-my-solutions | 0002-add-two-numbers/0002-add-two-numbers.cpp | /**
* Definition for singly-linked list.
* 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) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.999968 | 6.263153 |
315db684-0925-454b-9ae8-3032c5eda9c5 | lukechencqu/bluerov_zed_tracking | pcl/src/other/tracking_sample.cpp | #include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/openni_grabber.h>
#include <pcl/console/parse.h>
#include <pcl/common/time.h>
#include <pcl/common/centroid.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/io/pcd_io.h>
#include <pcl/f... | TOOL | 0.989063 | 6.657022 |
3abbcbf7-f734-4c6e-a0d8-00cfe1f11db1 | cweinber/secure-file-transfer-client-server | Client/cryptopp/md4.cpp | // md4.cpp - modified by Wei Dai from Andrew M. Kuchling's md4.c
// The original code and all modifications are in the public domain.
// This is the original introductory comment:
/*
* md4.c : MD4 hash algorithm.
*
* Part of the Python Cryptography Toolkit, version 1.1
*
* Distribute and use freely; there are n... | ALGO | 0.999351 | 6.482319 |
a2ce4846-5c74-4c0a-9521-5b29dda0c61b | ieiu/Niu | include/tensor/core/arithmetic/MatrixMul2DParallel.cpp | /*
* $Created by: XIAO Tong (email: <EMAIL>) 2018-04-24
*/
#include "../../XTensor.h"
#include "MatrixMul2DParallel.h"
#include "MatrixMul2DMultiTheading.h"
#include "../utilities/XMatrixSegment.h"
namespace nts { // namespace nts(NiuTrans.Tensor)
/*
matrix multiplication (for 2d tensors) with multi-threading
c = tr... | ALGO | 0.996894 | 5.799492 |
f9857c55-662f-41ad-9799-14829d76337d | pranavundre/L33tC0d3 | BFS of graph - GFG/bfs-of-graph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to return Breadth First Traversal of given graph.
vector<int> bfsOfGraph(int V, vector<int> adj[]) {
queue<int> q;
vector<int> bfs, vis(V, 0);
q.emplace(0);
... | ALGO | 0.999955 | 6.319187 |
2ad5ec09-1bd9-4c63-9d88-53fb94e7922e | Minhaz0100/GAME-IN-CPP | Snake game.cpp | #include <iostream>
#include <conio.h> // for _kbhit() and _getch()
#include <windows.h> // for Sleep()
using namespace std;
bool gameOver;
const int width = 20;
const int height = 20;
int x, y, fruitX, fruitY, score;
int tailX[100], tailY[100];
int nTail;
enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN };
eDirecti... | TOOL | 0.997685 | 5.934086 |
dd1bd523-48c1-44d8-86a7-0a1e19e8d5f5 | Siabus/Problem-Solving | Binary Search/Valid Perfect Square.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isPerfectSquare(int num) {
if(num<2){
return num;
}
long long l=1,h=num;
while(l<=h)
{
long long mid=(l+h)/2;
if(mid*mid==num)
return mid;
... | ALGO | 0.999778 | 4.725822 |
5e4a4240-f5f5-4bc2-9756-306cc366883e | ragibshahrier/cp | Contests/adv_contest_july6/G_G.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pair<int,int>>
#define rep(ii,st, n) for(int ii=st; ii<n; ii++)
#define gp " "
// #define DEBG
#define debug(n)
#define debugc(a)
#ifde... | ALGO | 0.999985 | 3.873967 |
68775109-0a68-4766-9075-406f7512e262 | lorenzo-ferrari/cses | src/Range Queries/1739-Forest Queries II.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("O3")
using namespace std;
const int N = 1001;
int m[N][N];
int t[N][N];
void update(int i, int j) {
m[i][j] ^= 1;
int v = m[i][j] ? +1 : -1;
for (int ii = i; ii < N; ii |= ii + 1)
for (int jj = j; jj < N; jj |= jj + 1)
t[ii][jj] += v;
}
... | ALGO | 0.9993 | 4.262922 |
d7b2f306-8546-4016-aa32-c1fda3986587 | Itakello/Competitive-programming | Categories/Graphs/torn2pieces/torn2pieces.cpp | // https://open.kattis.com/contests/z4dra4/problems/torn2pieces
#pragma GCC optimize ("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <sstream>
using namespace std;
unordered_map<string, set<string>> adj;
unordered_map<string, bool> visited;
unordered_map<string, string> parent;
... | ALGO | 0.999987 | 5.153237 |
2c01b3da-eed9-44c6-80a4-bb1cb3501ecd | jashanbhullar/hacker-rank | Algorithms/Implementation/apple and orange.cpp | /*
* Contributer : github.com/tanmayag8958
* Email : <EMAIL>
*/
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a,b,s,t,m,n,i,ca=0,co=0,d;
cin>>s>>t;
cin>>a>>b;
cin>>m>>n;
int p[m],q[n];
for(i=0;i<m;i++)
... | ALGO | 0.999824 | 3.415318 |
a0b02270-0b87-441a-aec7-8a4259e38a7f | anandprakash01/my-learnings | C++/Templet2.cpp | #include <iostream>
using namespace std;
template <class T>
class vector
{
public:
T *arr;
int size;
vector(int m)
{
size = m;
arr = new T[size];
}
T dotProduct(vector &v){
T d=0;
for (int i = 0; i < size; i++)
{
... | ALGO | 0.999559 | 4.101175 |
2d544c21-a6e0-4717-ae52-693f2863353d | Iw2w3I/Projects | Algorithms/FFT.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <complex>
//https://codeforces.com/group/PVbQ8eK2T4/contest/405815/submission/178535453
//complexity N*logN
//inspired by https://e-maxx.ru/algo/export_fft_multiply
void fft (std::vector<std::... | ALGO | 0.999998 | 3.537961 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.