uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
316f8c42-4d1b-4c3f-9786-63dc8a0a4547 | ishandutta2007/codeforces | moririn2528/normal/1371/D.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair... | ALGO | 0.999892 | 3.130676 |
9f097401-dae8-41ee-974e-c13416049ab2 | QbitQuantum/Basics | Исходники/NewtonMinimizerGradHessian.cpp | bool NewtonMinimizerGradHessian::lineSearch(double& alpha, const double& wolfe1, const double& wolfe2, VectorXd& try_grad, VectorXd& direction, double& grad0_dir, double& val0, VectorXd& init_params, VectorXd& try_params, const double& precision, const double& accuracy, unsigned int max_iter, double& result)
{
dou... | ALGO | 0.999969 | 5.769673 |
874291ca-93bb-420e-af17-12b0e48dc146 | amitprat/PracticeCode | AddWithoutPlusOperator.cpp | #include <iostream>
using namespace std;
int sum(int a,int b)
{
while(b)
{
int tmp = (a&b)<<1;
a = a^b;
b = tmp;
}
return a;
}
int main()
{
for(int i=0;i<10;i++) {
cout<<i<<" + "<<(i+1)<<" = "<<sum(i,i+1)<<endl;
}
return 0;
}
| ALGO | 0.999795 | 3.592127 |
0e1cb04e-32a0-465f-aca5-8435299e7286 | santibreo/pj-site | doing/programming/c++/HW_2.cpp | #ifndef GRAPH_H
#define GRAPH_H
#include <vector>
// I think the best way to define graph is via adjacent matrix
class Graph{
public:
Graph(){}
Graph(int verticeNum);
Graph(int verticeNum, double density);
int getVerticeNum() const {
return ve... | ALGO | 0.884372 | 4.658021 |
ce2e4d9a-384e-4b4a-bb24-5b57ab66af88 | ishandutta2007/codeforces | vercingetorix/normal/1214/D.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.9999 | 4.130267 |
f1cd37f3-efc6-496e-a4dd-110d841d0a16 | prakash1909/data-structure-and-algorithms | algorithms/brokenCalc.cpp | #include<iostream>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<math.h>
#include<set>
using namespace std;
void print(int a[], int n) {
for (int i = 0; i < n; i++) {
cout << a[i] << " ";
}
cout << endl;
}
void print(vector<int> a) {
int n = ... | ALGO | 0.999958 | 4.580593 |
3e31e80e-bcde-43f3-802f-de4d15082567 | Amylo-jh/baekjoon | 25000s/25178.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
string str1;
string str2;
string new_str1 = "";
string new_str2 = "";
int str1_aeiou[5] = {0};
int str2_aeiou[5] = {0};
cin >> n >> str1 >> str2;
for(int i = 0; i < n; i++)
{
string temp = ... | ALGO | 0.999981 | 4.646236 |
86672d10-753e-4da5-b336-f17d3f794cd2 | JINJAEHWAN/magic_wand_ble33_DFPlayerMini | wand_dfplayerMINI/lib/Arduino_TensorFlowLite/src/tensorflow/lite/micro/kernels/pooling.cpp | #include "tensorflow/lite/kernels/internal/reference/pooling.h"
#include "tensorflow/lite/c/builtin_op_data.h"
#include "tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h"
#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
#include "tensorflow/lite/kernels/kernel_util.h"
#include "tensorflow/li... | TOOL | 0.958691 | 7.40465 |
490021fb-b8b8-40e1-93aa-8e274b988a55 | Mellow-Sky/code | VS2022_code/240627/240627/240627.cpp | #include<iostream>
#include<vector>
using namespace std;
int parent(int i) {
return (i - 1) / 2;
}
int left(int i) {
return 2 * i + 1;
}
int right(int i) {
return 2 * i + 1 + 1;
}
void max_heapify(vector<int>& a, int i, int heap_size) {
int l = left(i);
int r = right(i);
int largest;
if ... | ALGO | 0.999969 | 5.020994 |
b186b96d-dd8d-492d-b35f-6d4ab5696fb8 | vrnanshuman/Leetcode | 3sum/3sum.cpp | class Solution {
bool comp(vector<int> &a, vector<int> &b){
return a[0]==b[0] && a[1]==b[1] && a[2]==b[2] ? true: false;
}
public:
vector<vector<int>> threeSum(vector<int>& nums) {
int len = nums.size();
if(len<3)
return {};
vector<vector<int>> result;
sor... | ALGO | 0.999985 | 5.809199 |
f2e820f6-b64a-4796-920e-bf39005edf51 | minhvpham/codeblock | VNOI/dtksub.cpp | /*
🛸 🌎 ° 🌓 • .°• 🚀 ✯
★ * ° 🛰 °· 🪐
. • ° ★ • ☄
______________________________________________________
You are watching a brute force code
CODE IS WRITTEN BY 13MINUSONE
*/
#include<bits/stdc++.h>
using namespace std;
#define task "c"
#define SZ(c) c.size... | ALGO | 0.999993 | 4.444785 |
9e64b131-120e-421f-90d1-65436a900706 | Polidea/SiriusObfuscator-SymbolExtractorAndRenamer | lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/main.cpp | #include <string>
#ifdef _LIBCPP_INLINE_VISIBILITY
#undef _LIBCPP_INLINE_VISIBILITY
#endif
#define _LIBCPP_INLINE_VISIBILITY
#include <set>
typedef std::multiset<int> intset;
typedef std::multiset<std::string> stringset;
int g_the_foo = 0;
int thefoo_rw(int arg = 1)
{
if (arg < 0)
arg = 0;
if (!arg)
arg = 1;
... | TOOL | 0.91615 | 4.814418 |
dcd5bcb1-12d6-41fe-b231-23ae87b4611e | Mr-Bangladesh/Problem-Solving | UVa/616 Coconuts, Revisited.cpp | /**In the name of Allah, the Most Merciful, the Most Merciful.**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define INF 9223372036854775806
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 2*acos(0.0)
#define EPS 1e-9
ll max(ll a,ll b)... | ALGO | 0.999954 | 3.490723 |
7879c847-ba34-4d35-b47b-a875b25e1076 | moinhameed27/Ultimate-DSA | Linked List/Palindrome Linked List.cpp | // LeetCode : https://leetcode.com/problems/palindrome-linked-list/
// GFG : https://www.geeksforgeeks.org/problems/check-if-linked-list-is-pallindrome/1
// [C++]-----------------------------------------------------------------------------------------------------------------------
/**
* Definition for singly-linked... | ALGO | 0.9994 | 5.854179 |
cc2cacaa-b2e9-4ad1-a008-628297a4935e | FuChaolei/leetcode_ago | 238.除自身以外数组的乘积.cpp | /*
* @lc app=leetcode.cn id=238 lang=cpp
*
* [238] 除自身以外数组的乘积
*/
// @lc code=start
class Solution
{
public:
vector<int> productExceptSelf(vector<int> &nums)
{
vector<int> a(nums.size(), 1);
int n = nums.size();
for (int i = 1; i < nums.size(); i++)
{
a[i] = a[i -... | ALGO | 0.999938 | 6.371041 |
68a847b0-585f-4df7-bee4-fe43aac5050c | nmpogg/CodePTIT | c++/thi_thu_thcs2_28tech_test_8/bai1.cpp | #include <bits/stdc++.h>
using namespace std;
bool check(long long n){
long long res = sqrt(n);
if(res * res == n) return true;
return false;
}
int main(){
long long a ,b;
cin >> a >> b;
for(long long i = sqrt(a); i <= sqrt(b); i++){
if(i * i < a) continue;
cout << i*i << " ";
}
} | ALGO | 0.999836 | 3.549587 |
9afd8521-ba91-403c-af64-d2fd91c8bafb | Talha137m/flip_card_with_animation | 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 |
a37ae0dc-6850-4d5c-ab5d-56ccdae79b11 | hackerguy2000/Coding_Journey | STL/array_of_vector.cpp | #include <bits/stdc++.h>
using namespace std;
void printvector(vector<int> &v)
{
for(int i=0;i<v.size();i++)
{
cout<<v[i]<<" ";
}
}
int main()
{
int N;
cout << " Number of element you want in array " << endl;
cin >> N;//the number of elements of array and each array element consist of a... | ALGO | 0.99689 | 3.898304 |
5af2ed03-f549-4f7c-82f7-cf8a05b0a291 | AOSiP/platform_external_libcxx | test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T, Predicate<auto, T, Iter::value_type> Compare>
// constexpr Iter // constexpr after c++17
// upper_bound(Iter first, Iter last, const T& value, Compare comp);
#include <algorithm>
#include <functional>
#include <vector>
#include <cassert>
#include <cstdd... | TEST | 0.993 | 7.045025 |
dae37b5c-fa9b-48b2-878d-b4cca010201f | ibea-llp/ibea | Data_structure_and_algorithm/普通算法/bubble_Sort.cpp | // 冒泡排序:小数据复杂度不高,数据够大时效率太慢; 交换次数太多
#include <iostream>
#include <time.h>
using namespace std;
void bubble_sort(int List[],int n);
enum PN{ //定义一个常数
N = 30
};
int main ()
{
int a[N];
srand(time(NULL)); //每次伪随机数不同
for(int i = 0; i < N; ++i)// 随机生成数组
{
a[i] = rand() % N + 1... | ALGO | 0.999323 | 3.801106 |
11dbbc31-7d7d-4f00-add8-996d160991d4 | idontwantcookies/biblioteca-digital | src/pilha.cpp | #include <iostream>
#include "pilha.hpp"
Item::Item(ulint esquerda, ulint direita) {
esq = esquerda;
dir = direita;
}
Pilha::Pilha() {}
void Pilha::imprimir()
{
if(vazia()) return;
Item *item = topo;
while(item->prox != nullptr) {
std::cout << item->esq << ' ' << item->dir << '\n';
... | ALGO | 0.962541 | 4.648358 |
f382c7ab-017b-4ac0-a31b-f2aef1def27a | Palgu09T4/Leetcode | 0647-palindromic-substrings/0647-palindromic-substrings.cpp | class Solution {
public:
int countSubstrings(string s) {
int n=s.size();
int cnt=0;
for(int i=0;i<n;i++)
{
int left=i,right=i;
while(left>=0 && right<n && s[left]==s[right])
{
cnt++;
left--;
right++;
... | ALGO | 0.999923 | 6.202679 |
eec38324-87fc-426a-8da1-7a04b3cadf75 | aidenbarrett/C_plus_plus_Programs | Random_Number_Generator/main.cpp | /*
----------------------------------------
Program to calculate winning lotto numbers for Jane.
Programmer: Aiden Barrett
----------------------------------------
/*
c standard library, rand function generates random number.
cout << rand(); // not actually random!
srand(); add value to srand function and generates ra... | ALGO | 0.996636 | 3.44758 |
5442156e-6852-4137-99b7-b5dd72d70323 | Fauzan-Aldi/OpenSourceComputerVisionLibrary | 3rdparty/openexr/IlmImf/ImfDeepCompositing.cpp | #include "ImfDeepCompositing.h"
#include "ImfNamespace.h"
#include <algorithm>
#include <vector>
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
using std::sort;
using std::vector;
DeepCompositing::DeepCompositing()
{
}
DeepCompositing::~DeepCompositing()
{
}
void
DeepCompositing::composite_pixel (float outputs[],
... | ALGO | 0.967425 | 5.113023 |
65964cbf-36b1-4ca3-94a2-5a3f97526be1 | andyyhchen/cp-codes | AC-codes/USACO 1.1.2.cpp | /*
ID: andypcu2
LANG: C
TASK: ride
*/
#include <stdio.h>
main ()
{
char C[7], G[7];
int Ct, Gt, i, j;
FILE *fin = fopen ("ride.in", "r");
FILE *fout = fopen ("ride.out", "w");
while((~fscanf(fin, "%s", C)) && (~fscanf(fin, "%s", G)))
{
Ct = Gt = 1;
for(i = 0; C[i]; i++)
Ct *= (C[i] - 'A' + ... | ALGO | 0.99991 | 3.296566 |
af83cde3-a835-41e8-8847-7930e1b64ded | Bgguy154/-CrackYourPlacement | 0088-merge-sorted-array/0088-merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int i = m - 1; // Index of last element in nums1
int j = n - 1; // Index of last element in nums2
int k = m + n - 1; // Index of last element in the merged array
while (i >= 0 && j >=... | ALGO | 0.999955 | 6.188481 |
5e9805da-a752-4618-9505-338eae5fa7ea | deathcod/google-preparation | CORMEN/CHAPTER-10/10_2-4.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
private:
int value;
node *next;
public:
node(int v)
{
value = v;
next = NULL;
};
~node();
void set_next(node *y) { next = y;}
void set_value(int val) { value = val;}
node *get_next() { return next;}
int get_value() { return value;}
};
class LIN... | ALGO | 0.999299 | 4.125062 |
c7012846-213d-4287-8e07-3198fff07bb5 | ajakhotia/eyeKin | boost/boost/boost_1_57_0/libs/numeric/odeint/performance/rt_generic_rk4_phase_lattice.cpp | #include <boost/array.hpp>
#include "rt_explicit_rk.hpp"
#include "rk_performance_test_case.hpp"
#include "phase_lattice.hpp"
const size_t N = 1024;
typedef boost::array< double , N > state_type;
typedef rt_explicit_rk< state_type > rk_stepper_type;
const size_t stage_count = 4;
class rt_generic_wrapper
{
publi... | ALGO | 0.954801 | 3.85516 |
2e3a449a-e275-43d9-91fd-6f0971e07959 | chitamha/CPlusPlus_HighSchool_Exercises | C++_Va_C/Self-Study/C++/DSA_LapTrinhThiDau/Mang/MangCongDon_MangHieu/2_Bai6_TongLonNhat/bt1.cpp | #include <bits/stdc++.h>
using namespace std;
int n, q;
int main(){
cin>> n>> q;
int A[n+5];
int F[n+5];
memset(F, 0, sizeof F);
for (int i=0; i<n; i++) cin>> A[i];
while (q--){
int l, r;
cin>> l>> r;
l--, r--;
F[l]+=1;
F[r+1]-=1;
}
int preSF[n+5... | ALGO | 0.999966 | 4.115296 |
b410919a-6f59-493f-b237-3c24a3fe4001 | AlekseyKop/1c | ConsoleApplication2/ConsoleApplication2.cpp | //Прибавить к каждому числу корень квадратный из произведения максимума и последнего числа
//макросы - это препроцессорные функции, созданные с помощью директивы #define, которые принимают параметры подобно функциям.
#include <iostream>//iostream заголовочный файл с классами, функциями и переменными для организации вво... | ALGO | 0.994047 | 3.319434 |
a7976256-59ac-4b75-b035-0bae5845f60e | ravimenariya/LEETCODE_GFG_POTD | GFG_POTD/May 2025/17-05-2025.cpp | class Solution {
public:
vector<int> sortArray(vector<int> &arr, int A, int B, int C) {
// code here
for(int&i:arr) i=A*pow(i,2)+B*i+C;
sort(arr.begin(),arr.end());
return arr;
}
};
| ALGO | 0.999839 | 5.06218 |
b39290ac-d6d5-4f22-8045-88ee820b8a1c | unknownJoe24/structProject | Fibonacci.cpp | //program written in C++ that returns the n-th Fibonacci term
#include <iostream>
int fib(int);
int main()
{
int n;
//user input for n
std::cout << "Enter Fibonacci term: " << std::endl;
std::cin >> n;
//call fib using n
fib(n);
return 0;
}
int fib(int term)
{
//setup starting terms
... | ALGO | 0.999563 | 5.151707 |
e7a75fdd-713c-47ea-9897-22991eae5409 | omega-icl/mcpp | src/3rdparty/cpplapack-2015.05.11-1/test/zgematrix/zgematrix-calc/main.cpp | /*****************************************************************************/
/* noname */
/*****************************************************************************/
//=============================================================================... | ALGO | 0.974953 | 3.00382 |
bad2fa17-72c8-4910-92c3-2001d05b23e7 | suziyxm/llvm-15 | mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp | #include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Vector/Transforms/VectorDistribution.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BlockAndVal... | TOOL | 0.970096 | 7.177807 |
4fbb721a-87e2-415a-b88b-570837a28b21 | TiagoMLucio/Competitive-Programming | codeforces/Contests/933/D_Rudolf_and_the_Ball_Game.cpp | #include "bits/stdc++.h"
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
#define sz(x) static_cast<int>((x).size())
#define MAXX 1073741823
#define MAX (1 << 20)
#define INF 0x3f3f3f3f
#define MODN 1000000007
#define endl '\n'
#define int ll
using ii = pair<in... | ALGO | 0.999987 | 4.59532 |
d25ad469-5117-4529-8c49-4a4c6a986dc8 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/06/0608/personal_submission/cf1056b_md.cpp | // 0608
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 n, m;
std::cin >> n >> m;
i64 ans = 0;
for (i64 i = 1; i <= m; ++i) {
i64 cnt1 = (n + m - i) / m;
for (i64 j = 1; j <= m; ++j) {
if ((... | ALGO | 0.999958 | 4.970783 |
611c26d9-ca2b-4ecd-8aab-3bc67346cc0d | daveredrum/Pointnet2.ScanNet | pointnet2/_ext_src/src/group_points.cpp | #include "group_points.h"
#include "utils.h"
void group_points_kernel_wrapper(int b, int c, int n, int npoints, int nsample,
const float *points, const int *idx,
float *out);
void group_points_grad_kernel_wrapper(int b, int c, int n, int npoints,
... | DATA | 0.951995 | 7.059612 |
2a5e231a-0974-4643-85b5-0af6d1c0ea50 | TechTycoon-Jitu/LoveBabbarDSA | Lecture34-Recursion-with-strings/selection-sort.cpp | #include <iostream>
using namespace std;
void selectionsort(int arr[], int start, int end)
{
// Base case
if (start >= end)
{
return;
}
int minindex = start;
for (int i = start; i <= end; i++)
{
if (arr[i] < arr[minindex])
{
minindex = i;
}
}
... | ALGO | 0.999989 | 4.883868 |
98f3ec96-a0c2-44f3-829c-a7d26b9c1d13 | SadiHassan/Codeforces | CodeforcesRound291/A.cpp | #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
string str;
int a, b;
cin>>str;
for(int i=0; i<str.size();i++){
if(i==0){
a = str[i] - 48;
b = 9 - a;
if(a==0) str[i] = b + 48;
else if(b==0) str[i] = a + 48;
else if(a<=b) str[i] = a + 48;
else ... | ALGO | 0.999955 | 4.142677 |
ec742b85-7d26-47a5-9a57-adc4b9f61ae8 | Tayss1r/ps | cppcf/A_Legs.cpp | #include <bits/stdc++.h>
#define all(t) t.begin(),t.end()
#define rev(t) reverse(t.begin(), t.end())
using namespace std;
void solve() {
int n;
cin >> n;
cout << n / 4 + (n%4)/2 << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
... | ALGO | 0.999309 | 4.454185 |
bf125170-4074-4c02-91d1-eca2751d2096 | avinashmaurya19/video_assignment | 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.998809 | 6.763549 |
17381436-40f8-43ca-8933-f38ed5bdf015 | 6108/codetree-TILs | 240425/배열의 특정 위치 찾기 4/find-specific-location-of-array-4.cpp | #include <iostream>
using namespace std;
int main() {
int n;
int cnt = 0, sum = 0;
for (int i = 0; i < 10; i++) {
cin >> n;
if (n == 0)
break;
if (n % 2 == 0) {
cnt++;
sum += n;
}
}
cout << cnt << ' ' << sum;
return 0;
} | ALGO | 0.999803 | 4.331368 |
9ba41de7-0615-4b03-816e-e07ee5d78eb1 | lizardoluis/irSearch | utils/cmph.cpp | #include <cmph.h>
#include <string.h>
// Create minimal perfect hash function from in-memory vector
int main(int argc, char **argv) {
// Creating a filled vector
unsigned int i = 0;
const char *vector[] = { "aaaaaaaaaa", "bbbbbbbbbb", "cccccccccc",
"dddddddddd", "eeeeeeeeee", "ffffffffff", "gggggggggg",
"hhhh... | TEST | 0.960962 | 3.990749 |
94377114-27f6-4117-a006-703e0dbb16eb | sumanmalakar/Complete-DSA | Lecture008 Switch Statement & Functions/functionsIntro.cpp | #include<iostream>
using namespace std;
int main() {
// pow(a,b)
int a , b;
cin >> a >> b;
int ans = 1;
for(int i = 1; i<=b; i++) {
ans = ans * a;
}
cout<<" answer is " << ans <<endl;
int c , d;
cin >> c >> d;
ans = 1;
for(int i = 1; i<=d; i++) {
an... | ALGO | 0.999964 | 3.440827 |
ac67c4d5-a82f-422c-87eb-b68df4df1212 | JustDoYoung/Algorithm | Section 1/Combination.cpp | #include <bits/stdc++.h>
using namespace std;
int n = 5, k = 3;
int arr[] = {1, 2, 3, 4, 5};
void print(vector<int> v)
{
for (int i : v)
cout << i << ' ';
cout << '\n';
}
void Combination(int s, vector<int> v)
{
if (v.size() == k)
{
print(v);
return;
}
for (int i = s... | ALGO | 0.999815 | 4.462937 |
64464ec0-1397-41aa-b8d1-5ff11759d1be | gustavofadel/Exercises | URI/2177.cpp | # include <bits/stdc++.h>
using namespace std;
# define _ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
bool first = true, possible;
int n, x, xm, y, ym, t;
int main () {_
cin >> xm >> ym >> n;
for (int i = 1; i <= n; i++) {
cin >> x >> y >> t;
if (hypot(x - xm, y - ym) < t) {... | ALGO | 0.999901 | 3.831526 |
44459c37-13ca-4da9-9526-4986c1778f1a | Tinalexman/Flutter-Clean-Code-Generator | 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 |
535f73af-695a-439e-81ab-2f219035e3c8 | gem5/gem5 | src/systemc/tests/systemc/misc/user_guide/chpt3.1/fsmr.cpp | /*****************************************************************************
fsmr.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.998598 | 4.888353 |
803a3b11-e8f0-41df-af59-2d685ddef9da | DivyaRaval1909/CP-31-Sheet- | 800R/800_7.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
string x, s;
cin >> x >> s;
string curr = x;
int ans = -1;
for (int op = 0; op <= 5; ++op) {
if (curr.find(s) != string::n... | ALGO | 0.999981 | 4.749622 |
d1df109a-a77c-4a93-93a9-22f7d53553db | mmmosd/baekjoon | 2470.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
typedef struct {
int x, y;
} Water;
int ary[100005];
int n;
bool cmp(int a, int b) {
return a < b;
}
Water find() {
int p1 = 0, p2 = n-1;
Water result = {ary[p1], ary[p2]};
while (p1 < p2) {
if (ary[p1] + ary[p2] == 0) {
result.x = ary[p1];
... | ALGO | 0.999991 | 4.483818 |
46d84cd0-5ff1-483d-aa27-c441e91bfa60 | jaisharma687/LeetCode | 2401 to 2500/C++/2491_divide-players-into-teams-of-equal-skill.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int mod = 1e9+7;
class Solution {
public:
long long dividePlayers(vector<int>& skill) {
sort(skill.begin(),skill.end());
int n = skill.size();
long long s = skill[0] + skill[n-1];
long long l ... | ALGO | 0.999956 | 4.635233 |
24eae30d-69f4-47fc-ad94-d5a64536d2c4 | imSrbh/Data-Structures-Lab-Program | srbh/srk/queue.cpp | #include<iostream>
using namespace std;
#define max 20
void push(int a[]);
void pop(int a[]);
void display(int a[]);
void peek(int a[]);
int front=-1,rear=-1;
int main()
{int i,n,k;
int a[max];
while (k!=5)
{cout<< "\nChoose from the list\n";
cout<< "1. Push an element\n2. Pop an element\n3. Display elments\n4. P... | ALGO | 0.8874 | 3.53264 |
311e7540-3519-4d96-bfa5-e1a90af91f96 | ishandutta2007/codeforces | intothenight/normal/607/A.cpp | #include <bits/stdc++.h>
using namespace std;
template<class T, class U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<class T, class U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }
// DEBUG BEGIN
#ifdef LOCAL
template<class L, class R> ostream &operator<<(ostream &out, const pair<L, R> &p)... | ALGO | 0.999916 | 4.663527 |
332bc836-ce64-44a4-920e-53f8278a5352 | Tasmia231/cpp-Code | 4. sumation of dihits of a number.cpp | #include<iostream>
using namespace std;
class Number{
public:
void calculations()
{
int n, r, sum = 0;
cin>>n;
while(n != 0){
r = n%10;
sum += r;
n = n/10;
}
cout<<sum<<endl;
}
};
int main()
{
Number obj;
obj.calculations()... | ALGO | 0.999755 | 4.988435 |
1bddfb89-d887-45cb-90ef-88ffdfadedd8 | nhan20721/cpp | test.cpp | #include <iostream>
using namespace std;
int main(){
int m;
int n;
cin >> m >> n;
cout << m * n;
return 0;
}
| ALGO | 0.984239 | 3.353575 |
ee2217c3-2739-4a98-8c84-97bdb7fe4434 | foyreet/cpp_learning_notes | algorithms/800/realization/1829A.cpp | #include <iostream>
#include <string>
using namespace std;
int solve() {
string str = "codeforces";
string s;
cin >> s;
int count = 0;
for (int i = 0; i < s.size(); i++) {
if (str[i] != s[i]) {
count++;
}
}
cout << count << '\n';
}
int main() {
int t;
cin ... | ALGO | 0.999537 | 4.514447 |
b9b18ed6-dc0e-40a3-84a3-c1a103ebd741 | ojas-doshi/leetcode | src/medium/2352-equal-row-and-column-pairs/2352-equal-row-and-column-pairs.cpp | class Solution {
public:
int equalPairs(vector<vector<int>>& grid) {
int n = grid.size();
int count = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
bool isEqual = true;
for (int k = 0; k < n; ++k) {
if (grid[i]... | ALGO | 0.999933 | 6.082768 |
28d24065-a6d2-48f1-b4ea-8de9656d0ed0 | Aditya20743/Leetcode | 0744-find-smallest-letter-greater-than-target/0744-find-smallest-letter-greater-than-target.cpp | class Solution {
public:
char nextGreatestLetter(vector<char>& letters, char target) {
for(int i=0;i<letters.size();i++){
if(letters[i]>target){
return letters[i];
}
}
return letters[0];
}
}; | ALGO | 0.999344 | 5.790596 |
338091ea-f390-4ae0-a3e2-7517aab0b9c5 | goodchai0/Problems | 2256-minimum-average-difference/2256-minimum-average-difference.cpp | class Solution {
public:
int minimumAverageDifference(vector<int>& nums) {
int n=nums.size(),minAverageDifference=INT_MAX,index;
long long sumFromFront=0,sumFromEnd=0;
for(auto &num:nums) sumFromEnd+=num;
for(int i=0;i<n;i++){
sumFromFront+=nums[i];
... | ALGO | 0.999981 | 6.589264 |
f30da162-a096-4839-9a5f-3e87e4c8ece0 | iftikhoq/Phitron | cp/Week8/Day7/A_Maximum_GCD.cpp | #include <bits/stdc++.h>
#define ll long long
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define f1(n) for(int i=0;i<n;i++)
#define f2(a,n) for(int i=a;i<n;i++)
#define vector <int> vi
using namespace std;
void solve(){
int n;
cin >> n;
... | ALGO | 0.999332 | 4.853614 |
9efe6c32-c172-4960-bd2a-dabdff86d374 | Shubhf18425/Binary-Trees | Traversals/7_Iterative_PostOrder_2Stack.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* left;
Node* right;
Node(int val){
data = val;
left = right = nullptr;
}
};
void Iterative_Iterative_PostOrder_2Stack(Node* node){
if(node == nullptr) return;
vector<int> PostOrder;
stack<Node*> st... | ALGO | 0.999976 | 5.688923 |
cb6bd99d-81d0-443a-a48f-49fcd5c540a4 | camuschino/SFML | laberinto/main.cpp | #include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <string>
using namespace std;
class Game {
public:
Game();
void run();
private:
void handlePlayerInput(sf::Keyboard::Key key, bool isPressed);
void processEvents();
void update();
... | TOOL | 0.929648 | 3.090318 |
64655e26-d543-4d88-9eea-4c6a1d2cca46 | andrewchernyh/mel.net | libmel/utils.cpp | #include "utils.h"
#include <Eigen/Core>
#include <unsupported/Eigen/FFT>
static Vectorf pad(const Vectorf& x, int left, int right, const std::string& mode, float value) {
Vectorf x_paded = Vectorf::Constant(left + x.size() + right, value);
x_paded.segment(left, x.size()) = x;
if (mode.compare("reflect") ... | ALGO | 0.998585 | 6.204009 |
4ee4692d-de69-4590-87ac-32b470ef0e67 | rtkcs/Cpp | workspace/SdlBasic4/src/Swarm.cpp | /*
* Swarm.cpp
*
* Created on: Apr 8, 2016
* Author: rtakacsux
*/
#include "Swarm.h"
namespace std {
Swarm::Swarm():lastTime(0) {
m_pParticles = new Particle[NPARTICLES];
}
Swarm::~Swarm() {
delete [] m_pParticles;
}
void Swarm::update(int elapsed) {
int interval = elapsed - lastTime;
for (int i =... | ALGO | 0.920293 | 5.417283 |
b89056fa-9e1f-4336-acf8-0e0170fcf9df | bharathulaprasad/Leetcode-Solutions | 080. Remove Duplicates from Sorted Array II.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if (nums.size() < 3)
return nums.size();
const int NUM_DUPS_ALLOW = 2;
int finalIndex = 0;
int count = 1;
int curIndex = 1;
while (curIndex < nums.size()) {
if (nums[... | ALGO | 0.999741 | 6.491447 |
3f7d1c94-e827-4f5b-ba48-5e68c006fe23 | tonni-akter-dev/phitron | introduction_to_dsa/Insert_it.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int M;
cin >> M;
vector<int> B(M);
for (int i = 0; i < M; i++) {
cin >> B[i];
}
int X;
cin >> X... | ALGO | 0.999991 | 3.860991 |
d4a7dad9-8f11-43a2-b1f1-dcc29cc1d9da | ishandutta2007/codeforces | lucaperju/normal/915/A.cpp | #include <iostream>
using namespace std;
long long cmmdc(long long a,long long b)
{
long long r;
while(b)
{
r=a%b;
a=b;
b=r;
}
return a;
}
long long lgput (long long cnt, long long mod,long long put)
{
long long r=1,p=put;
if(cnt==0)
return 1;
else
if(... | ALGO | 0.99994 | 3.49095 |
6f4fc927-b8ee-4478-96e1-d7de73e8ec21 | Abhishek87911/LeetCode-Journey | 0984-most-stones-removed-with-same-row-or-column/0984-most-stones-removed-with-same-row-or-column.cpp | class DSU {
public:
vector<int> parent,size;
DSU(int n)
{
parent.resize(n+1,0);
for(int i=0;i<=n;i++) parent[i]=i;
size.resize(n+1,1);
}
int findUPar(int u)
{
if(parent[u]==u) return u;
return parent[u] = findUPar(parent[u]);
}
void merge(int u... | ALGO | 0.999654 | 5.536692 |
4b4cfa73-5686-4ade-8f7a-b7db7b265760 | Mindjolt2406/Competitive-Programming | Codechef/COOK132A/ODDARY.cpp | #include<bits/stdc++.h>
// g++ -std=c++17 -Wl,-stack_size -Wl,0x10000000 main.cpp
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.e... | ALGO | 0.999885 | 4.173786 |
97ec609a-2836-4e87-8892-4ffdccff163f | AmitPinhas/Work | advcpp/iq/Codility/Lesson 3 - Time Complexity/TapeEquilibrium/tape_equilibrium.cpp | #include "mu_test.h"
#include <vector>
#include <cmath> // abs
using namespace std;
int solution(vector<int> &A)
{
const size_t vectorSize = A.size();
int firstSum = A[0];
int secondSum = 0;
for(size_t i = 1; i < vectorSize; ++i)
{
secondSum += A[i];
}
size_t minim... | TEST | 0.995862 | 6.415078 |
71273213-616b-4ea3-958c-8bcf93348181 | SonarSystems/SGE | Code/PROJECT XYZ/External Libraries/Mac/Box2D/include/Box2D/Collision/b2Distance.cpp | #include <Box2D/Collision/b2Distance.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
// GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
int3... | ALGO | 0.999956 | 3.659391 |
a07ef858-ce23-4d88-b9c2-6c7b94b6ed09 | akhilr007/Leetcode-problems | 1402-reducing-dishes/1402-reducing-dishes.cpp | class Solution {
public:
int solve(int idx, vector<int>& satisfaction, int curTime, int n,
vector<vector<long long>>& dp){
if(idx >= n)
return 0;
if(dp[idx][curTime] != -1)
return dp[idx][curTime];
long long take = ((long long)curTime * ... | ALGO | 0.999785 | 5.673801 |
996469a2-8dea-4fb9-9e79-3e0076b89f3c | Sravankumar-14/LEETCODE-SOLUTIONS | 2059-unique-length-3-palindromic-subsequences/unique-length-3-palindromic-subsequences.cpp | class Solution {
void uniqueStrings(string& s, int start, int end , unordered_set<string>& st)
{
for(int i=start+1; i<end; i++)
{
string str;
str.push_back(s[start]);
str.push_back(s[i]);
str.push_back(s[end]);
st.insert(str);
}... | ALGO | 0.999828 | 6.286592 |
9697594f-f9a6-4195-9c96-20bf139d63c3 | AVVKavvk/DSA | basic(pattern.....)/halfSolidDiamond.cpp | #include <bits/stdc++.h>
#define pi 3.14
#define fl(a, b) for (int i = a; i < b; i++)
#define ma(a, b) ((a) > (b) ? (a) : (b));
#define mi(a, b) ((a) < (b) ? (a) : (b));
#define pb push_back
#define ps(a, b) std::cout << a << ' ' << b << std::endl;
#define pn(a) std::cout << a << std::endl;
#define p(a) std::cout << a;... | ALGO | 0.999962 | 3.7279 |
52af84fe-7473-4c78-ac49-3003920eb9f5 | GuruneLee/CPP-Algo | codeup/notEZtoSolveAtOnce/2021/src.cpp | #include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> val;
vector<int> cnt;
void swap(vector<int>& v, int x, int y) {
int temp = v[x];
v[x] = v[y];
v[y] = temp;
}
void quicksort(vector<int> &vec, int L, int R) {
int i, j, mid, piv;
i = L;
j... | ALGO | 0.999929 | 3.992198 |
034706f4-211e-453e-8140-c83f50a6a6c7 | luuvus/UdacityCpp-RoutePlanning | src/route_planner.cpp | #include "route_planner.h"
#include <algorithm>
RoutePlanner::RoutePlanner(RouteModel &model, float start_x, float start_y, float end_x, float end_y): m_Model(model) {
// Covert inputs into percentage
start_x *= 0.01;
start_y *= 0.01;
end_x *= 0.01;
end_y *= 0.01;
start_node = &m_Model.FindClosestNo... | ALGO | 0.994526 | 4.576997 |
cad3754b-bc2c-4c8f-af8a-17a3bc5042a6 | ChemCryst/crystals | bits/SpaceGroup/MergedData.cpp | #include "MergedData.h"
#include "MathFunctions.h"
#include <math.h>
#include <iostream>
#include <iterator>
/********************************************************/
/* DataMerger */
/********************************************************/
DataMerger::DataMerger(const HKLData& pData, const float pUnitCel... | ALGO | 0.977821 | 4.76818 |
f65f6ff2-59df-43d0-89c0-4f6286057888 | PabloMessina/Competitive-Programming-Material | Solved problems/URI/FantasticBeasts.cpp | // tags: CRT, implementation, number theory, modular arithmetic, math
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; ++i)
using namespace std;
typedef long long int ll;
int B,Z;
int cur_zoo[10];
int next_zoo[10][100];
int cycle_index[10][100];
int zoo_count[100];
ll remainders[10];
ll cycle_size[10];
... | ALGO | 0.999962 | 3.145886 |
44b43c8b-797e-47e8-aa87-289e0d3b18c1 | VadVergasov/OlympTasks | BSUIR/Open/2020/Qualification/F/broot.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define all(x) (x).begin(), (x).end()
#define inf 1e18
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less_e... | ALGO | 0.999902 | 5.801115 |
f88cf6ea-8dab-4fe7-ba43-cf0b21207b89 | hoangviet148/Applied-algorithm-hust | Training-2-DST/SIGNAL.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 1e9 + 5;
int n, b;
int main() {
cin >> n >> b;
int a[n+2];
int max_prefix[n+2], max_suffix[n+2];
// memset(a, 0, n);
// memset(max_prefix, 0, n);
// memset(max_suffix, 0, n);
for (int i = 1; i <= n; i++) cin >> a[i];
max_prefi... | ALGO | 0.999616 | 4.002275 |
f2540bec-5375-4195-9145-fa4a8c9dfb88 | aritra741/Competitive-Programming | Codeforces/RasisingBacteria.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n;
cin>>n;
cout<< __builtin_popcount(n) <<endl;
}
| ALGO | 0.999427 | 4.481209 |
0638e37f-1a3f-41af-b4fe-2981a04b0709 | linwater0216/2023-2023_nuu_PCT2 | 20230313/572 Oil Deposits1.cpp | /*
572 Oil Deposits
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits.
GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides
the land into numerous square plots. It then analyzes each plot separately, using sensing equipment to... | ALGO | 0.999315 | 4.738473 |
9311245c-2948-430d-a1fa-a9cc2db9a1a8 | kurobaron/AtCoder | cpp/practice/abc175e.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;
int main(){
int i,j,ri,ci,r,c,k;
ll v;
cin >> r >> c >> k;
vector<vector<vector<ll>>> dp(r+1, vector<vector<ll>>(c+1, vector<ll>(4)));
vector<vector<ll>> mp(r+1, vector<ll>(c+1));
vector<vector<ll>> val(r+1, vector<... | ALGO | 0.999677 | 3.850513 |
f62b31e3-16d8-48cd-9db7-e8e84a4e0e88 | merkelfan/AngelaMerkelCoin | src/hash.cpp | #include "hash.h"
inline uint32_t ROTL32 ( uint32_t x, int8_t r )
{
return (x << r) | (x >> (32 - r));
}
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash)
{
// The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurH... | ALGO | 0.987335 | 6.199227 |
190e895a-7835-497a-a0e6-fadf6eba3629 | Mopolino8/femSIM3d-PBC | script/mainHelmholtz.cpp | // =================================================================== //
// this is file mainRisingBubble.cpp, created at 10-Jun-2009 //
// maintained by Gustavo Rabello dos Anjos //
// e-mail: <EMAIL> //
// =======================================... | ALGO | 0.969486 | 3.361279 |
15701a06-b42a-497e-955c-6ff5eddbaf61 | OnComputable/Code-Snippets | 14.Interview_Ques/Algorithms_GforG/1.Searching_and_Sorting/2.Binary_Search/2.Method1.2.cpp | // https://www.geeksforgeeks.org/binary-search/
//Method 1.2: Used check function for easier look
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 4; // a large value for array size is taken
int a[N];
int n; // array size
int k; // element to be searched
// function declaration
bool Check(int);... | ALGO | 0.999625 | 5.830073 |
0a384618-7961-43a4-b103-342623357059 | ellrussbest/leetcode | general/easy/242_valid_anagram.cpp | #include <algorithm>
#include <iostream>
#include <vector>
class Solution {
public:
bool isAnagram(std::string&& s, std::string&& t) {
if (s.size() != t.size()) return false;
std::vector<int> count(26, 0); // for 'a' to 'z'
for (char c : s) {
++count[static_cast<size_t>(c ... | ALGO | 0.999842 | 6.331161 |
07fe7740-0907-4284-95da-6e4f96231b13 | serzaxlucifer/Leetcode | Dynamic Programming/44. Wildcard Matching.cpp | /*
DYNAMIC PROGRAMMING!
*/
class Solution {
public:
bool isMatch(string s, string p)
{
vector<vector<int>> dp(s.length(), vector<int> (p.length(), -1));
return matchingUtil(s, p, s.length() - 1, p.length() - 1, dp);
}
int matchingUtil(string& s, string& t, int i1, int i2, vector<v... | ALGO | 0.999984 | 5.744272 |
e59a4ae4-6f44-4a69-8cd1-921a5c17238a | aroradev314/competitive_programming | practice_old/guessinggreatest.cpp | // Source: https://usaco.guide/general/io
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << "? 1 " << n << endl;
int second_max; cin >> second_max;
bool first_half;
if (n == 2) {
cout << "! " << 3 - second_max << endl;
return 0;
}
else if (second_max == 1) first_half = fals... | ALGO | 0.999946 | 3.470623 |
e557ec5e-0043-4496-8496-0936d2dbe41b | Udit11112003/C---programs | ooplabtest2.cpp | // 2.write a program using template to find out the largest element amoung the array
#include <iostream>
using namespace std;
#define N 10
template <class T>
T find_max(T t[], int NO_OF_TERMS)
{
T temp_max = t[0];
for (int i = 0; i < NO_OF_TERMS; i++)
{
if (temp_max < t[i])
{
tem... | ALGO | 0.999825 | 4.082581 |
a8683f9b-516f-4318-8762-796f1e425297 | NarpatAanjana/Daily-GFG-problem | january2023/Type it!.cpp | class Solution {
public:
int minOperation(string s) {
if(s.size() <= 3)
return s.size();
int ans = INT_MAX;
string str = "";
for(int i=0; i<s.size(); i++){
str = str + s[i];
string temp = s.substr(i+1, str.size());
if(temp == str){
... | ALGO | 0.99987 | 5.501762 |
fe18017a-e355-4af2-b5d3-435dc932af56 | xuanhe95/JavaPractice | Algorithmic Toolbox/Assignment/week5_dynamic_programming1/1_money_change_again/change_dp.cpp | #include <iostream>
int get_change(int m) {
//write your code here
return m / 4;
}
int main() {
int m;
std::cin >> m;
std::cout << get_change(m) << '\n';
}
| ALGO | 0.999533 | 3.722515 |
eafa03b9-8de2-4c6e-92e6-35b1e32d9973 | AadityaShukla01/Interview-Preparation | 2794-maximum-number-of-moves-in-a-grid/2794-maximum-number-of-moves-in-a-grid.cpp | class Solution {
public:
int ch[2001][2001];
int sol(int r, int c, int n, int m, vector<vector<int>>& g)
{
if(ch[r][c] != -1)
return ch[r][c];
int ans = 0;
int dx[] = {-1, 0, 1};
int dy[] = {1, 1, 1};
for(int i=0; i<3; i++)
{
int nr ... | ALGO | 0.999997 | 6.151814 |
6d0b13b5-2f62-4ada-ae46-1a03eb2f47c7 | lvyuedong/ccgShaders | sourcecode/for_Maya2009/crystalcg_base/ccg_texture_bump.cpp | #include <math.h>
#include "shader.h"
#pragma warning(disable : 4267)
/*------------------------------------------ ccg_bump_map -------------------*/
struct ccg_bump_map {
miVector u;
miVector v;
miVector coord;
miVector step;
miScalar factor;
miBoolean torus_u;
miBoolean torus_v;
miBoolean alpha;
miTag te... | ALGO | 0.99218 | 4.380545 |
31dc80c6-d01e-417c-9ed0-83822bc10677 | A-kriti/Leetcode | Remove loop in Linked List/code.cpp | void removeLoop(Node* head)
{
// code here
// just remove the loop without losing any nodes
if (head == NULL) return;
Node* slow=head;
Node* fast=head;
while(fast!=NULL && fast->next!=NULL){
slow=slow->next;
fast=fast->next->ne... | ALGO | 0.999791 | 4.776986 |
bc5a060b-0411-4ceb-a268-abc2f3400cd3 | chenyang1999/MyComputerCollegeCourses | ACM算法/acm-challenge-workbook-master/src/poj2139.cpp | /*
* POJ 2139: Six Degrees of Cowvin Bacon
* 题意:图中多条权为1的双向边,求到其他所有点的最短路的平均值最小的点。
* 类型:最短路
* 算法:用Floyd求到两两之间最短路,枚举和最小的点。
*/
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int d[310][310];
int tmp[310];
void floyd(int n) {
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= n; ... | ALGO | 0.999773 | 4.244628 |
275f54e7-5e6b-4cfe-8e27-ffc06b7402db | MaheswariDhanisetti/Leetcode | 0079-word-search/0079-word-search.cpp | class Solution {
public:
vector<vector<int>>dir = {{-1,0},{1,0},{0,1},{0,-1}} ;
bool f(vector<vector<char>>&board,int r,int c,int idx,string &word){
if(idx>=word.size())return true ;
if(r>=board.size() || c>=board[r].size() || board[r][c]!=word[idx])return false ;
char ch = b... | ALGO | 0.999914 | 6.208109 |
fb06200f-41cb-4b0c-aa88-a04dd562fb6b | ishandutta2007/codeforces | aid/normal/611/D.cpp | #include <iostream>
#include <string>
using namespace std;
const int MAXN = 5005, MOD = 1000 * 1000 * 1000 + 7;
int z[MAXN][MAXN], dp[MAXN][MAXN];
string s;
void add(int &a, int b) {
a += b;
if(a >= MOD)
a -= MOD;
}
bool cmp(int i, int j, int k) {
if(z[i][j] >= k - j + 1)
return false;
... | ALGO | 0.999991 | 4.235226 |
e30ef96b-2421-4b90-bbb4-c15f87828d0d | avikodak/Programs | Programs/src/CrackTheInterview/Numbers/SumOfDigits.cpp | /*
* SumOfDigits.cpp
*
* Created on: Dec 12, 2012
* Author: AVINASH
*/
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
int SumOfDigits(int userInput);
//Tested
int SumOfDigits(int userInput){
int sumOfDigits;
for(;userInput;sumOfDigits+=userInput%10,userInput/=10);
return ... | ALGO | 0.966902 | 4.572926 |
7244ac60-6e84-451c-9878-b1a9eb271ad2 | Macw07/Macw07 | Algorithm/Z-CyberCinerary/P1807-最长路TLE.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n, m, ans;
int vis[1505];
bool flag = false;
struct node{
int v;
int w;
};
vector<node> G[1505];
void dfs(int index, int sum){
if (index == n){
flag = true;
ans = max(ans, sum);
return ;
}
... | ALGO | 0.999934 | 4.447446 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.