uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c51f4537-0d60-4c44-a93b-a77a6b6f7242 | zhangchunbao515/leetcode | leetcode-08/LC055.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
int right = 0;
for (int i = 0; i < nums.size() && i <= right; i++)
right = max(right, nums[i] + i);
if (right >= nums.size() - 1) return true;
return false;
}
}; | ALGO | 0.999974 | 6.167269 |
6139db03-915c-481b-bdd9-f0fa12a33f41 | K1M-MinW00/Study | Data Structure/07. Sorting/17-2.cpp | // Q. 데이터를 입력받아서 insert sort 를 수행한 결과를 파일 및 화면에 출력하라.
// 각 레코드는 (key , name , grade) 의 필드로 구성된다.
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define FALSE 0
#define TRUE 1
#define MAX_VERTICES 10
typedef struct element
{
int key;
char name[10];
int grade;
};
void insert(... | ALGO | 0.99503 | 4.352849 |
96f288d4-8e3d-430c-a4dd-ac475b49f95e | tomoakiii/atcoder2 | Archive/abc187/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll INF = 0x0F0F0F0F0F0F0F0F;
int main(){
int A, B;
cin >> A >> B;
int sa=0, sb=0;
rep(i, 3){
sa+=A%10;
sb+=B%10;
A/=10;
B/=10;
}
cout <<... | ALGO | 0.999584 | 3.843233 |
51514fa5-4785-4c7f-963c-dbc8fa19fed4 | devangshrivastava/projectEuler | prob7.cpp | #include <iostream>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <stack>
#include <algorithm>
#include <cmath>
#include <math.h>
using namespace std;
bool isprime(long long n){
long long a = sqrt(n);
for(long long i=2; i<=a; i++){
if(n%i == 0){
return fals... | ALGO | 0.999961 | 4.162563 |
ddcb7ed1-4d1c-49e6-96e6-4b0f9c5f2c12 | yftsai/uva-online-judge | problem_set_volumes/volume_11/1193.cpp | // #greedy
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
constexpr double eps = pow(0.1, 64);
struct island
{
int32_t x;
uint32_t y;
double dx;
bool operator<(const island &i) const;
};
bool island::operator<(const island &i) const
{
if (x != i.... | ALGO | 0.999853 | 4.764183 |
14ec7de5-b692-45ec-a692-52f71d10f014 | sarvex/leetcode-bash | solution/0300-0399/0368.Largest Divisible Subset/Solution.cpp | class Solution {
public:
vector<int> largestDivisibleSubset(vector<int>& nums) {
sort(nums.begin(), nums.end());
int n = nums.size();
int f[n];
int k = 0;
for (int i = 0; i < n; ++i) {
f[i] = 1;
for (int j = 0; j < i; ++j) {
if (nums[i]... | ALGO | 0.999993 | 5.534947 |
005f69bb-23db-41a2-9a59-f496c35ff4a7 | SwapnilSaha59/Important-Programs-on-CP | Count and Say.cpp | /*
Count and Say
=============
The count-and-say sequence is a sequence of digit strings defined by the recursive formula:
countAndSay(1) = "1"
countAndSay(n) is the way you would "say" the digit string from countAndSay(n-1), which is then converted into a different digit string.
To determine how you "say" a digit st... | ALGO | 0.999953 | 7.679311 |
5912e50b-e67e-4788-944e-2e23ba82646d | jordan9587/MSU_STARX_SYSTEMINTEGRATION_2021 | Arduino/libraries/emgToolbox/MaximumFractalLength.cpp | /**
* \file MaximumFractalLength.cpp
*
* \author Jordan Hybki (@jh9587)
*
* Pseudocode referenced from MATLAB EMG Feature Extraction Toolbox:
* https://www.mathworks.com/matlabcentral/fileexchange/71514-emg-feature-extraction-toolbox
*
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "emg... | ALGO | 0.991691 | 3.427808 |
26f80022-6bd6-4893-b6b8-1cf61581afd6 | mostfamhmd/Walkie-Talkie | 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 |
ba91f21f-d7c9-4646-a00e-c755035c30dc | baioc/paradigms | C++/stack/stack.cpp | #include "array_stack.hpp"
#include <iostream>
using structures::Stack;
template <typename T>
void hanoi(int size, Stack<T>& from,
Stack<T>& to, Stack<T>& aux)
{
if (size > 1) {
hanoi(size - 1, from, aux, to);
hanoi(1, from, to, aux);
hanoi(size - 1, aux, to, from);
} else if (size == 1) {
to.pu... | ALGO | 0.98291 | 5.927558 |
192b67d2-fe5a-4021-8bae-a7dccad4f550 | RGTechno/LeetCode | reverse-integer/reverse-integer.cpp | class Solution {
public:
int reverse(int x) {
long long int temp = x;
long long int rev=0;
while(temp){
long long int k = temp%10;
rev=rev*10+k;
if(rev>INT_MAX or rev<INT_MIN) return 0;
temp=temp/10;
}
... | ALGO | 0.999964 | 5.73842 |
81d62911-8868-4724-9817-46860a7e0b53 | violetDelia/test_and_practice | c/Leecode/852. 山脉数组的峰顶索引.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
class Solution
{
public:
int peakIndexInMountainArray(vector<int> &arr)
{
int n = arr.size();
int left = 0, right = n - 1, ans = 0;
while (left <= right)
{
int mid = (left + right) / 2;
... | ALGO | 0.999851 | 5.337967 |
045fa7a7-397a-4079-8214-ffcc0b1d556d | Ctrl-Zack/university-first-year | Data Structure/praktikum_2/duplicate_bst.cpp | #include<bits/stdc++.h>
using namespace std;
typedef struct node_t {
int value;
int numberof;
struct node_t *_left, *_right;
} Node;
typedef struct btree_t {
Node *_root;
unsigned int _size;
} BTree;
void tree_init(BTree *tr);
Node *create_new_node(int value);
Node *tree_search(Node *root, int ta... | ALGO | 0.999649 | 5.430963 |
9614fcfc-5b7a-48f3-98ed-ccaf312665b1 | WenzeJin/LeetCodeAnswer | 53.最大子数组和.cpp | /*
* @lc app=leetcode.cn id=53 lang=cpp
*
* [53] 最大子数组和
*/
// @lc code=start
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int maxSubArray(vector<int>& nums) {
vector<int> dp(nums.size());
// dp[i] is the max sum of any sub array ending with nums[i]
... | ALGO | 0.999909 | 6.256792 |
aa3f2f85-3366-4033-9988-e9ca90b81686 | ishandutta2007/codeforces | roundgod/normal/1641/A.cpp | #include<bits/stdc++.h>
#define MAXN 200005
#define INF 1000000000
#define MOD 998244353
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int t,n,x;
multiset<int> s;
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&x);
s.clear();
for(int i=1;i<=n;i+... | ALGO | 0.999865 | 4.30036 |
4f44e85c-4830-4acc-9002-06dd2aaf1de5 | Rajeevan2002/DSA | Stack and Queue/twostacks.cpp | void twoStacks :: push1(int x)
{
if(top1<top2-1)
{
top1++;
arr[top1]=x;
}
}
//Function to push an integer into the stack2.
void twoStacks ::push2(int x)
{
if(top1<top2-1)
{
top2--;
arr[top2]=x;
}
}
//Function to remove an element from top of the stack1.
in... | ALGO | 0.998052 | 4.271947 |
853d6c4a-0bea-4191-9973-d1e3e989ee7f | ekluthra/RayCasting | src/viewing_ray.cpp | #include "viewing_ray.h"
void viewing_ray(
const Camera & camera,
const int i,
const int j,
const int width,
const int height,
Ray & ray)
{
////////////////////////////////////////////////////////////////////////////
ray.origin = camera.e;
ray.direction[0] = (camera.width / width) * (j + 0.5) - (cam... | ALGO | 0.988859 | 5.00033 |
532eb2e6-e1c3-4f0c-ab04-3b7abd08b3a2 | aashish-kundu/cppdsa | cppbasicone shot striver day 1 to day 3/16th.cpp | #include <iostream>
using namespace std;
// I used the &( to pass real value r address of string)
void dosomething( string &a) {
// update the vlaue of real string a and take the real value here for updation
// I want to print AAshish
a[0] = 'A';
a[1] = 'A';
// print the passed value and ... | TOOL | 0.954473 | 3.861777 |
fd9ed084-827d-4289-bdd4-8a2ff38f9a9c | SCIInstitute/ShapeWorks | Libs/Project/ProjectUtils.cpp | #include "ProjectUtils.h"
#include <Logging.h>
#include <Mesh/MeshUtils.h>
#include <Project.h>
#include <StringUtils.h>
namespace shapeworks {
using StringList = ProjectUtils::StringList;
using StringMap = ProjectUtils::StringMap;
using namespace project::prefixes;
static const StringList input_prefixes{SEGMENTAT... | TOOL | 0.858472 | 3.968276 |
6fe01d44-9c25-48f6-8025-94306642f9c3 | galontong/game-programming | Tebak Angka Acak/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
void printNyawa(int i)
{
int j;
for(j = 1; j<=i; j++)
{
printf("\x03");
}
printf("\n\n");
}
int main()
{
int jawaban,panjang,nyawa = 3,tebakan;
bool bonus = true;
srand(time(NULL));
do
{
... | ALGO | 0.963102 | 3.279341 |
6e3b1a23-b897-404d-8ea9-d72ce417708f | LoaiYoub/Stockfish | src/material.cpp | #include <cassert>
#include <cstring> // For std::memset
#include "material.h"
#include "thread.h"
using namespace std;
namespace Stockfish {
namespace {
#define S(mg, eg) make_score(mg, eg)
// Polynomial material imbalance parameters
// One Score parameter for each pair (our piece, another of our pieces)... | ALGO | 0.997086 | 6.799293 |
c2cdd68f-8ddb-4a26-99d2-cd3d4368ac84 | tinatiansjz/algorithm-learning-2019 | HDU/1728_DFS.cpp | //HDU-1728 逃离迷宫
//2018/10/21 20:38
//DFS
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int maxn = 100;
char pic[maxn][maxn];
int visited[maxn][maxn][10][4];
int m, n, k, x1, y1, x2, y2;
// 0 1 2 3
//(-1, 0) (0, 1) (1, 0) (0, -1)
int knext[4][2] = {{-1, 0}, {0, 1... | ALGO | 0.999835 | 3.263234 |
88f5f8ba-b057-4bd3-a66b-184c1fd4308d | semihstp/Semih | Ornekler/Burhanettin_Yılmaz/This_Kullanarak_2_Sporcunun_Yag_Oranlarını_Karsılastırma/main.cpp | #include <iostream>
using namespace std;
class Sporcu {
public:
Sporcu(double tk , double tyk);
double YagOrani();
int karsilastir (Sporcu sporcu);
private:
double ToplamKilo;
double ToplamYagKutle;
};
Sporcu::Sporcu(double tk, double tyk) {
ToplamKilo=tk;
ToplamYagKutle=tyk;
}
double ... | ALGO | 0.994732 | 4.29963 |
cae95d2a-799c-4380-89b9-7dc3824ec476 | QWERx29/My-Codes-and-Docs_OLD | Study/02/09.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int a,b,c;
double p,s;
cin>>a>>b>>c;
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
printf("%.3lf\n",s);
return 0;
}
| ALGO | 0.999816 | 3.696711 |
3f9c2800-f21d-494f-a8f5-34d4d282641e | Amitkumar-007/face_recognition | opencv-master/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp | #include <iostream> // Console I/O
#include <sstream> // String to number conversion
#include <opencv2/core.hpp> // Basic OpenCV structures
#include <opencv2/core/utility.hpp>
#include <opencv2/imgproc.hpp>// Image processing methods for the CPU
#include <opencv2/imgcodecs.hpp... | TOOL | 0.957094 | 5.459361 |
4beca3a8-49f6-4656-8d7c-0540d58eb9c7 | InwooLeeme/Algorithm | Boj/16920.cpp | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds... | ALGO | 0.99992 | 3.690526 |
e268e1fa-6929-4b64-9f31-320279907b6b | macstepien/SelfDrivingCarEngineerNDUdacity | p7_path_planning/src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = m * n;
cout << "-- Matrix m*n: --" << endl << result << endl << endl;
result = m.array() * ... | ALGO | 0.996342 | 4.306757 |
9cafc782-d2ff-4723-94d4-0cdcc1998e2d | abhi6753/vs-code | Assignment 8/pattern_2.cpp | //Print this pattern
//Question me bs 5 row ko print krne ko bola hai lekin hum genral program likh rhe taki sb input pe work kare
/*
*
* *
* * *
* * * *
* * * * *
*/
#include<iostream>
using namespace std;
int main()
{
int row;
cout<<"Enter numb... | ALGO | 0.997386 | 3.89166 |
96fa35f8-ce30-493e-88a0-34b07d9f0ba1 | sjj118/OI-Code | BZOJ/3065/code.cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#define rg register
#define rep(i,x,y) for(rg int i=(x);i<=(y);++i)
#define per(i,x,y) for(rg int i=(x);i>=(y);--i)
using namespace std;
const int N=70000+10;
int n,q,a[N],b[N],c[N];
#define ls son[k][0]
#define rs son[k][1]
const int P=3e7;
struct SGT{
int tot1,to... | ALGO | 0.999978 | 3.72804 |
5e71eeb3-1f4c-4a21-946f-8f69e49a0631 | Divyanshu-012/LeetcodeCommits | 2488-divide-intervals-into-minimum-number-of-groups/2488-divide-intervals-into-minimum-number-of-groups.cpp | class Solution {
public:
int minGroups(vector<vector<int>>& intervals) {
// step 1
sort(intervals.begin(), intervals.end());
// step 2
priority_queue<int, vector<int>, greater<int>> pq;
// step 3
for(auto interval : intervals ){
int start = interval[0]... | ALGO | 0.999998 | 5.993764 |
79fd4be0-95ac-4218-b3b7-fb0f23610410 | loewner/udacity-sdce | CarND-Path-Planning-Project-P7/Eigen-3.3/lapack/svd.cpp | #include "lapack_common.h"
#include <Eigen/SVD>
// computes the singular values/vectors a general M-by-N matrix A using divide-and-conquer
EIGEN_LAPACK_FUNC(gesdd,(char *jobz, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork,
... | ALGO | 0.999271 | 5.526819 |
8a66bc4a-f0bf-4bd0-9c8c-1d44c4c0ccb1 | AlvinGabrielyan/Implementations | Random_Problems/LRU.cpp | /*(LRU)-ն քեշի փոխարինման քաղաքականություն է, որն ապահովում է, որ քեշը պահպանի վերջին օգտագործված տվյալները,
իսկ ամենաքիչ օգտագործվածները ջնջվեն, երբ այն հասնի իր ծավալին:*/
#include <iostream>
#include <unordered_map>
using namespace std;
class LRUCache {
private:
struct Node {
int key;
int val... | ALGO | 0.998305 | 6.153042 |
1ee302dc-5eff-4c40-ba8e-635858224ac0 | RaphaelNicaise/Programacion1 | TP3/tp3p1.cpp | /* Hacer un programa en C++, que diga si un número es par o impar. */
#include <iostream>
using namespace std;
int main() {
int num;
cout <<"ingresar numero: ";cin >> num;
if (num % 2 == 0){
cout << num << " es par.";
} else {
cout << num << " es impar.";
}
return 0;
} | ALGO | 0.975533 | 3.642679 |
42c4e94e-408d-49be-bacd-e913074c1771 | harihassan/Cryptography- | 29.sha.cpp | #include <stdio.h>
#include <stdint.h>
#define STATE_WIDTH 5
#define STATE_HEIGHT 5
#define LANE_SIZE 64
#define STATE_SIZE (STATE_WIDTH * STATE_HEIGHT)
#define CAPACITY_LANES 1024
#define ROUND_COUNT 24
typedef struct {
uint64_t state[STATE_SIZE];
} SHA3State;
// Function prototypes
void keccakPermutation(SHA3S... | ALGO | 0.999811 | 7.289304 |
7535679a-9c36-4883-a840-914533763bc1 | mrgick/labs | 2_курс/технологии_программирования/2/2-6.cpp | #include "stdio.h"
#include <cmath>
int main(){
double a, b, c, x1, x2, D;
printf("Enter 3 coefficients separated by spaces or enters.\n");
scanf("%lf %lf %lf", &a, &b, &c);
if (a == 0){
x1 = b/(-c);
printf("x = %lf\n", x1);
return 0;
}
D = b*b-4*a*c;
if (D < 0) {
printf("There are no ... | ALGO | 0.998747 | 3.697747 |
86daeed8-52c8-415b-913f-b3f31c711386 | hztttt/Synergistic_Optimization | lammps_DeepSPIN/src/MEAM/pair_meam.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Greg Wagner (SNL)
------------------------------------------------------------------------- */
#include "pair_meam.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#includ... | ALGO | 0.980539 | 7.017325 |
d1bbeffb-5ed6-4d67-b228-052fb487b8c4 | ymd-h/cpprb | test/segmenttree_bench.cpp | #include <algorithm>
#include <iostream>
#include <iterator>
#include <chrono>
#include <vector>
#include <SegmentTree.hh>
#include <ReplayBuffer.hh>
using PER = ymd::CppPrioritizedSampler<float>;
using MPPER = ymd::CppThreadSafePrioritizedSampler<float>;
auto bench = [](auto&& F, auto n, auto fmt=""){
auto t1 = s... | TEST | 0.874324 | 5.095795 |
2cc8c18b-289b-4e3f-a355-b5b8b8470a92 | anupaperera112/DSA-in-class-lab | lab 10/graph_lab.cpp | #include <iostream>
#include<list>
using namespace std;
struct Node{
// A node will 2 entities
//1. data type int called label
//2. a int type list called neighbours
int label;
list <int> neighbours;
};
struct Graph{
//graph will have an array of type "node" with length specified by n
int... | ALGO | 0.999079 | 4.917926 |
4f0456f5-6cf2-4d8c-a006-914883e04378 | M-Salameh/codeforces-problems | B - Limited Increasing Sunsequence.cpp | #include <bits/stdc++.h>
///#define int long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define endl '\n'
#define mod %M
using namespace std;
const int M = 1e9+7;
int tc=1;
int n,k;
int dp[1000001];
int solve_rec(int sum)
{
///TLE!!!
if (sum > n) return 0;
if (sum == n) retur... | ALGO | 0.99999 | 4.59737 |
44de23f9-026b-4bb0-af07-a793588e5818 | sinian666/codes_102_3 | cpp_副本50/chapter_heap/my_heap.cpp | /**
* File: my_heap.cpp
* Created Time: 2023-02-04
* Author: LoneRanger (<EMAIL>), what-is-me (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 大顶堆 */
class MaxHeap {
private:
// 使用动态数组,这样无需考虑扩容问题
vector<int> maxHeap;
/* 获取左子节点索引 */
int left(int i) {
return 2 * i + 1;
}
/* 获取右子节点索... | ALGO | 0.999696 | 5.474622 |
25493015-03f2-4aeb-aaaf-19714ba6b0d9 | dtkien205/DSA-PTIT | Stack/DSA07010.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int main()
{
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
stack<string> st;
for (int i = s.size() - 1; i >= 0; i--) {
if (isalpha(s[i]))
st.push(string(1, s... | ALGO | 0.999972 | 5.195313 |
6305fadf-fa4f-4a0f-b32e-75fbe46acc14 | BithumbCoin/BithumbCoin | contracts/libc++/upstream/test/std/containers/sequences/list/list.ops/sort.pass.cpp | // <list>
// void sort();
#include <list>
#include <cassert>
#include "min_allocator.h"
int main()
{
{
int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
c1.sort();
assert(c1 == std::list<i... | TEST | 0.962156 | 4.924873 |
3d34aa44-798b-498d-bd55-4aceac77e6ba | ajaysharma12799/DSA-Specialization-Coursera | Algorithmic ToolBox/week 4/binarysearch.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
// void printArray(vector<int> v) {
// cout<<"\n Returned Index : ";
// for(auto itr = v.begin(); itr != v.end(); itr++) {
// cout<<*itr<<" ";
// }
// }
// void binarySearch(vector<int> elementArray, int searchElement... | ALGO | 0.9998 | 5.65998 |
c017ab9a-d115-428e-ad52-8fc5aec218ad | dudugi/NewForTortoise | QL/Common/cryptopp-CRYPTOPP_7_0_0/md5.cpp | // md5.cpp - modified by Wei Dai from Colin Plumb's public domain md5.c
// any modifications are placed in the public domain
#include "pch.h"
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#include "md5.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
namespace Weak1 {
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGE... | ALGO | 0.972551 | 6.331478 |
8a00797f-932a-4fbd-88fa-4592069eafa7 | 3agwa/CompetitiveProgramming | Hackerrank/HACKR circle-city.cpp | /*
using circle equation (x*x + y*y = r*r)
then, y = sqrt(r*r - x*x)
we iterate over all Xs (till sqrt(D)) and find the corresponding Ys
if found, increment the counter by 4 as this points exists in all quadrants with different signs
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long lon... | ALGO | 0.999613 | 4.585956 |
e2218838-775b-4a00-8f24-5d92bf951ab3 | leegw1211/algorithm | 2월1주차/baekjoon-13977-이항 계수와 쿼리.cpp | #include <iostream>
#include <cstring>
#define p 1000000007
using namespace std;
int dptable[4000001];
int dptable2[4000001];
int fac(int n) {
return dptable[n];
}
int pow(int a, int n) {
int ans = 1;
while(n) {
if (n&1) ans = static_cast<long long>(ans) * a % p;
a = static_cast<long long>(a) * a % p;
n >>=... | ALGO | 0.999913 | 3.846839 |
ae74bd62-2a27-4886-b08e-08951f662cb9 | parmarraj8866/Logic-Exam-Que | code10.cpp | #include <iostream>
using namespace std;
int issumcal(int num)
{
int sum = 0;
while (num > 0)
{
sum += num % 10;
num /= 10;
}
return sum;
}
bool ismagicnum(int num)
{
while (num >= 10)
{
num = issumcal(num);
}
return (num == 1);
}
int main()
{
int num,... | ALGO | 0.999679 | 4.660561 |
1470bac7-2924-49b2-bcb6-17b88e6701c6 | deepanshu-j/Leetcode | 383-ransom-note/383-ransom-note.cpp | class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
vector<int> freq(26, 0);
for(auto &ch: magazine)
freq[ch - 'a']++;
for(char &ch: ransomNote){
freq[ch-'a']--;
}
for(int i=0;i<26;++i)
... | ALGO | 0.999953 | 6.119784 |
c2012a11-2f66-4481-949d-aaab2e6e9d73 | alcohol-study/2024-programmers | programmers/algorithm/level2/Hong0329/할인 행사.cpp | //
// Created by hong jun chung on 7/4/24.
//
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int solution(vector<string> want, vector<int> number, vector<string> discount) {
int answer = 0;
unordered_map<string, int> wantMap;
for(int i = 0; i < number.size(); i++)
... | ALGO | 0.998728 | 5.185467 |
9eb0ceb5-0486-44de-9ba7-8fa1613f478a | S-K-Siva/leetcode_problem-solving | July/19Jul24/1380_potd.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> luckyNumbers (vector<vector<int>>& matrix) {
// vector<int> result;
// int row = matrix.size();
// int col = matrix[0].size();
// for(int i = 0;i<row;i++){
// int minimum_element = *min_ele... | ALGO | 0.999713 | 5.631095 |
1627b342-651a-4df1-853a-55ad3f34e5a0 | Shubhamrawat5/LeetCode | 62. Unique Paths.cpp | class Solution {
public:
int dp[100][100]; //using dynamic programming array
int calPaths(int m,int n,int r,int c)
{
if(dp[r][c]) return dp[r][c]; //if this path is already covered before so return previous stored value
if(r==m-1 || c==n-1) return 1; //we've reached to end of row or... | ALGO | 0.99987 | 6.539624 |
e194a688-311b-4cfa-b528-1cf30965b323 | TanujRathore/Strivers-SDE-Sheet-Challenge | Day-12/Rotate Linked List/codestudio.cpp | /**
* Definition for singly-linked list.
* class Node {
* public:
* int data;
* Node *next;
* Node() : data(0), next(nullptr) {}
* Node(int x) : data(x), next(nullptr) {}
* Node(int x, Node *next) : data(x), next(next) {}
* };
*/
Node *rotate(Node *head, int k) {
// Write your code h... | ALGO | 0.999986 | 5.547883 |
59810c7a-1734-42d9-876d-451fd783afba | akashc1612/Codeforces_ras | word_capitalisation.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
string a;
cin>>a;
a[0]=toupper(a[0]);
cout<<a;
}
int main(){
cin.tie(0);
int t=1;
while(t--)
solve();
return 0;
} | ALGO | 0.996499 | 4.182066 |
c2bbc257-9343-4f01-bace-efe303e4e5b4 | kennyfs/competitive-programming | ojdl/110-1/7138.cpp | #include <iostream>
#include <vector>
#include <stack>
#define Hirasawa_Yui_My_Wife ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb emplace_back
using namespace std;
const int N=6e5+10;
int n,m,cnt,scctot,scc[N];
vector<int> G[N],R[N],ord;
stack<int> out;
bool vis[N];
void add(int a,int b){
G[a^1].pb(b);
G... | ALGO | 0.999958 | 3.52198 |
530ce1c6-ce02-4215-b01a-438ec4c7ae73 | adarsh-verma1/My-DSA-CP-Learning | Concepts/14.KMP_Algorithm.cpp | #include<bits/stdc++.h>
#include<algorithm>
#include<unistd.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vc vector<char>
#define vf vector<float>
#define vs vector<string>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define vvc vector<vc>
#define pii pair<int,in... | ALGO | 0.999773 | 4.842113 |
9e010867-b904-43e2-8231-a6e939fc83d7 | thechosenone124/474-Quarter-Project | fbx_convert_prog/line.cpp | #include "line.h"
#include <iostream>
#include "GLSL.h"
using namespace std;
bool Line::init()
{
//first the shaders:
GLint rc;
// Create shader handles
GLuint VS = glCreateShader(GL_VERTEX_SHADER);
GLuint FS = glCreateShader(GL_FRAGMENT_SHADER);
// Read shader sources
std::string vShaderString = string("#ve... | ALGO | 0.943336 | 4.427874 |
ccd40da5-15b7-4964-9c7e-edb6f9879135 | cvora23/CodingInterviewQ | ArraysAndStrings/src/SortArrayAccordingOrderDefinedByAnotherArray.cpp | /*
* SortArrayAccordingOrderDefinedByAnotherArray.cpp
*
* Created on: Nov 4, 2014
* Author: cvora
*/
/*
* Sort an array according to the order defined by another array
* Given two arrays A1[] and A2[], sort A1 in such a way that the
* relative order among the elements will be same as those are in A2.
* ... | ALGO | 0.999997 | 6.046653 |
99a83050-ed18-4fe9-91b3-1a0d931617dc | stack-of-tasks/pinocchio | src/algorithm/compute-all-terms.cpp | #include "pinocchio/algorithm/compute-all-terms.hpp"
namespace pinocchio
{
namespace impl
{
template PINOCCHIO_EXPLICIT_INSTANTIATION_DEFINITION_DLLAPI void computeAllTerms<
context::Scalar,
context::Options,
JointCollectionDefaultTpl,
Eigen::Ref<const context::VectorXs>,
Eigen::R... | ALGO | 0.98859 | 5.320541 |
c74a7471-3c45-4e76-97fd-3bcf38bfbcfa | TONYBRYANT1/C_plus_plus | C++ code/2.Second step/4.Classes and objects/7.Polymorphism/3.Polymorphic case one Calculator class/Polymorphic case one Calculator class.cpp | //多态案例一:计算器类
//案例描述:
//分别利用普通写法和多态技术,设计实现两个操作数进行运算的计算器类
//多态的优点:
//1.代码组织结构清晰
//2.可读性强
//3.利于前期和后期的扩展以及维护
//C++开发提倡利用多态设计程序架构,因为多态优点有很多
#include<bits/stdc++.h>
using namespace std;
// //普通写法:
// class Calculator
// {
// public:
// int GetResult(string oper)
// {
// if(oper == "+")
// {
// ... | TOOL | 0.968552 | 3.846063 |
9ea5d0b4-4bd6-4cdf-9b54-dd9e4224c8c4 | piyushS3V3N/Competitive_Coding | Assignment2/miniwindowsubstring.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
string Minimum_window(string s , string t){
int m[256]={0};
int ans = INT_MAX;
int start = 0;
int count = 0 ;
for (int i=0 ; i < t.length() ; i++)
{
if(m[t[i]] == 0 )
count++;
m[t[i]]++;
}
int i = 0 ,j = 0;
while(j < s.length()){... | ALGO | 0.999896 | 5.206307 |
1420f202-32ae-418d-bc8c-016a8583dd22 | manniefesto/neptune-2-firmware | Marlin/src/libs/vector_3.cpp | #include "../inc/MarlinConfig.h"
#if ABL_PLANAR || ENABLED(AUTO_BED_LEVELING_UBL)
#include "vector_3.h"
#include <math.h>
/**
* vector_3
*/
vector_3 vector_3::cross(const vector_3 &left, const vector_3 &right) {
return vector_3(left.y * right.z - left.z * right.y, // YZ cross
left.z * right... | TOOL | 0.866535 | 7.164061 |
2458fe6a-50e9-4c87-9460-583c819725fa | ZidaneRare/klinik_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
5d303147-1cbe-4b83-8717-8526010615cc | HimanshuSingour/DSA---Graphs-Algorithum | FloodFill_Algorithum_DFS.cpp | #include<bits/stdc++.h>
using namespace std;
bool isValid(vector<vector<char>> & image , int i , int j , int color){
int n = image.size();
int m = image[0].size();
if(i >= 0 && i < n && j >= 0 && j < m && image[i][j] == color){
return true;
}
return false;
}
vector<vector<char>> floodFill(vector<vect... | ALGO | 0.999603 | 4.879842 |
a3682eae-7f58-4e6c-a3d0-d2c0768e46a5 | DhruvTotala/Leetcode | 75-sort-colors/sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int n = nums.size();
int cnt0 = 0;
int cnt1 = 0;
int cnt2 = 0;
for(int i = 0; i < n; i++) {
if(nums[i] == 0) cnt0++;
else if(nums[i] == 1) cnt1++;
else cnt2++;
}
... | ALGO | 0.999918 | 5.827632 |
be42fcd8-4c0c-4855-ac92-662798f2e497 | jetmuffin/algorithm | hdu/2039.cpp | /*
** feched by JetMuffin's crawler
** author: chen9434 (JetMuffin)
** http://acm.hdu.edu.cn/viewcode.php?rid=10917944
*/
#include <stdio.h>
int main()
{
int n;
double a,b,c;
while(scanf("%d",&n)!=EOF)
{
while(n--)
{
scanf("%lf %lf %lf",&a,&b,&c);
if((a+b>c) && (... | ALGO | 0.998246 | 3.690045 |
51b622e8-004e-4b15-bb2c-2ef330cd62d6 | vilmahelander/ChatGPT_Combined_Experiements | C++/GPT-4/Greedy/Hard/Runtime and Memory/135. Candy/1.cpp | #include <vector>
using namespace std;
class Solution {
public:
int candy(vector<int>& ratings) {
int n = ratings.size();
vector<int> candies(n, 1);
for (int i = 1; i < n; ++i) {
if (ratings[i] > ratings[i - 1]) {
candies[i] = candies[i - 1] + 1;
}
... | ALGO | 0.999999 | 6.403846 |
c7de873a-a645-48d1-a4ae-c03f3e0468fe | vikashmalakar275/Data_Structure_and_Algorithm | takeUforward/Strivers_A2Z_DSA_Course/Strings_Basic_and_Medium/Remove_outermost_Paranthesis.cpp | /*
Given a string S of valid parentheses “(“ and “)”, the task is to print the string obtained by removing the outermost parentheses of every primitive substring from S.
A valid parentheses substring S is primitive if it is non-empty, and cannot be split into two or more non-empty substrings which are also a valid par... | ALGO | 0.999337 | 5.770046 |
a4332925-6b9a-47a5-b4a5-412d59ea8a1c | danielhmendoza01/Helios | drafts/Trials/read2.cpp | #include <iostream>
#include <fstream>
#include <zlib.h>
using namespace std;
int main() {
long num = 154846614134800524;
int num2 = 20046090;
cout << num-num2 << endl;
return 0;
}
| ALGO | 0.998783 | 3.140545 |
462a3561-82c6-413c-b1ee-cf03759f661d | YadavDhirendra/Data-Structures-and-ALgorithms-Problems | program52.cpp | //rotate the 2D array by 90 deg.
#include<bits/stdc++.h>
using namespace std;
void rotate(int a[][100],int m,int n)
{
int ans[100][100], k=n-1;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
ans[i][j]=a[j][k];
}
k--;
}
//re-initialising array
... | ALGO | 0.999841 | 3.652191 |
a4cfad07-ac07-4661-8c5e-e1c5287f5041 | guruswarupa/visualdsa | public/sorting-algorithms/cyclesort/code.cpp | #include <iostream>
// Function to sort array using Cycle Sort
void cycleSort(int arr[], int n) {
for (int cycleStart = 0; cycleStart < n - 1; cycleStart++) {
int item = arr[cycleStart];
int position = cycleStart;
// Find item's correct position
for (int i = cycleStart + 1; i < n; ... | ALGO | 0.999838 | 5.784109 |
a7b7bd42-a1e9-4d46-a6d8-37c4a7ea5b81 | codesmith17/CODECHEF | codechef_SPEEDTEST.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
float a, x, b, y;
cin >> a >> x >> b >> y;
float al = a / x, bo = b / y;
if (al > bo)
cout << "Alice" << endl;
if (bo > al)
cout <... | ALGO | 0.999924 | 3.657906 |
f87bc3fc-36b5-4640-acc5-33cdcc97b92f | renhaofan/Source-Archive | OpenCV/opencv-3.4.5/samples/cpp/peopledetect.cpp | #include <opencv2/objdetect.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <iostream>
#include <iomanip>
using namespace cv;
using namespace std;
class Detector
{
enum Mode { Default, Daimler } m;
HOGDescriptor hog, hog_d;
public:
Detector() : m(... | ALGO | 0.969569 | 7.252405 |
862ab0cf-a807-4ef3-a226-1ceb69951804 | josimi/uvasolutions | problem10050.cpp | // problem 10050
// Jonathon Simister
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
int ntests;
int a[4000];
int ndays;
int nparties;
int h;
scanf("%d", &ntests);
while(ntests--) {
memset(a, 0, sizeof(a));
scanf("%d", &ndays);
scanf("%d", &nparties);
for(int p = 0;p < npar... | ALGO | 0.999426 | 3.515907 |
96cb836a-9c4b-4206-8a82-0484ba90725a | HinaPE/HinaPE-Houdini | HinaPE/3rd_party/eigen-3.4.0/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.998607 | 6.004565 |
ea04c41d-b465-4db8-aa7f-a100693e56ca | sarvex/leetcode-shakespeare | solution/0000-0099/0083.Remove Duplicates from Sorted List/Solution.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* deleteDupli... | ALGO | 0.999925 | 5.970021 |
6c5c6993-0735-46c5-a771-9eb5f47e35be | AbdelrahmanAlsayed/competitive-programming | B - Memo and Momo/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
long long a,b,k;
cin>>a>>b>>k;
if(a % k == 0 && b % k ==0)
cout<<"Both";
else if(a % k == 0 && b % k !=0)
cout<<"Memo";
else if(a % k != 0 && b % k ==0)
cout<<"Momo";
else
cout<<"No One";
} | ALGO | 0.999932 | 4.129937 |
2eb9f863-e978-4f80-b97c-f700a16e2733 | Soroar-Mia/xpsc-code | week 8/day 4/A. Division.cpp | ///*******Bismillahir Rahmanir Rahim********
///*** Read in the name of Allah, who created you ****
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
if(1900 <= n)
{
cout<<"Division 1"<... | ALGO | 0.998877 | 3.62663 |
72a12a78-422f-419e-b813-0b292a191048 | Hanyeojun/BaekJoon | 15232.cpp | #include <iostream>
int main() {
int r, c;
std::cin >> r >> c;
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
std::cout << '*';
}
std::cout << '\n';
}
} | ALGO | 0.999845 | 4.909014 |
e2444942-0854-45dd-b6f8-e56019f36c78 | ashib11/Sub_Zero_ | C_To_Become_Max.cpp | #include <iostream>
#include <vector>
using namespace std;
bool canAchieveMax(const vector<int>& a, int n, int k, int max_val) {
int op_count = 0;
for (int i = 0; i < n - 1; ++i) {
if (a[i] > max_val) {
max_val = a[i];
} else {
int diff = max_val - a[i];
op_c... | ALGO | 0.999982 | 5.479534 |
87ed036c-bf81-4a7a-b573-2e0cbf5c06e1 | ravibhushankumarsonu/Competitive-Programming | HackerRank/Algorithms/Strings/The_Love-Letter_Mystery.cpp | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
string str;
cin >> str;
int len = (int)str.size(), ans = 0;
for (int i = 0, j = len - 1; i < j; i++, j--)
{
ans += abs((int)str[i] - (int)str[j]);
}
cout <<... | ALGO | 0.999805 | 4.710245 |
dc1c2a1f-c9cc-492f-9d25-158ddddd33f0 | neandrey/stroustrup | Ch_05/exercise/4_ctok_error/ctok_error.cpp | //cels_to_kelvin_error
#include "std_lib_facilities.h"
double ctok(double c){
if(c < -273.15)
error("Температура не может быть нижа 0K");
double k = c + 273.15; //int
return k; //int
}
int main(){
double c = 0;
cin >> c; //d
double k = ctok(c); //"c"
cout << k << endl;
re... | ALGO | 0.958355 | 3.571014 |
264fc356-872e-41b2-990b-5a502f9f59d8 | GGanj/LeetCode | 0.230315NcwuAcmTest/棋盘搜索.cpp | #include <iostream>
using namespace std;
#define rowSize 10
#define colSize 9
bool search(char (board) [rowSize][colSize], pair<int, int> bPosition, const pair<int, int> rPosition) {
if(bPosition.first == rPosition.first && bPosition.second == rPosition.second) {
return true;
}
if(bPosition.first... | ALGO | 0.999835 | 4.637397 |
0cc40bb4-dc2d-48c8-adb8-efb37cfeefa6 | Furkad/University | vvp/vvp7/vvp7.4.cpp | #include <iostream>
#include <locale.h>
int main()
{
float v1, v2, s, res, t;
setlocale(LC_ALL, "Russian");
std::cout << "Введите скорость первого и второго автомобиля, а так же расстояние между ними: ";
std::cin >> v1 >> v2 >> s;
std::cout << "Введите время поездки: ";
std::cin >> t;
res = (v1 + v2) * t + s;
... | ALGO | 0.99784 | 3.639877 |
1f3447db-cc73-4cc3-903b-5ec61241fa57 | omi-sha/Leetcode_sols | remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.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* deleteDupli... | ALGO | 0.999953 | 5.665418 |
a583a713-71bf-409f-9fef-9cfad8e8f1ba | sarvex/leetcode-crystal | solution/0100-0199/0137.Single Number II/Solution.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int a = 0, b = 0;
for (int c : nums) {
int aa = (~a & b & c) | (a & ~b & ~c);
int bb = ~a & (b ^ c);
a = aa;
b = bb;
}
return b;
}
}; | ALGO | 0.999983 | 5.690276 |
5a405978-d63f-416a-b0ab-d47b6aae7a95 | ishandutta2007/codeforces | pikel_rik/normal/1370/D.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) (x).begin(), (x).end()
using namespace __gnu_pbds;
using namespace std;
using ull = unsigned long long;
using ll = long long;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_up... | ALGO | 0.999988 | 4.861721 |
362df335-c4a9-47c2-acfe-04899cfc4b6f | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc097/A/3631629.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
int a, b, c, d;
cin >> a >> b >> c >> d;
if(d >= ((max(a, c) - min(a, c))))
cout << "Yes" << endl;
else if((d >= ((max(a, b) - min(a, b)))) &&
(d >= ((max(b, c) - min(b, c)))))
cout << "Yes" << ... | ALGO | 0.999938 | 3.320062 |
2bda56a9-e200-4c89-b3fe-ce8ea06fa290 | chen-assert/algorithm-code-library | Test1/ICPCshenyang-I.cpp | #include<stdio.h>
#include <stdlib.h>
#include<algorithm>
#include<limits.h>
#include<time.h>
#include<iostream>
#include<functional>
#include<vector>
#include<queue>
#include<string.h>
#include<stack>
//#include"segment tree.h"
//#include<regex>
//#include<windows.h>
using namespace std;
#define range(i, s, e) for (i... | ALGO | 0.999459 | 3.074744 |
662711bf-ada0-4fd8-be06-3169b479aedc | ArshakHakobyan/test | 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 |
7378a990-44c3-491f-9f8c-7f5d4df2e31e | ivary43/competitive | DIV_3_631/q5.cpp | #include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,n) for(long long i=a;i<=n;i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n-1)
#define SYNC ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define ll long long int
#define vi vector<int>
const int N = 200005;
int main() {
... | ALGO | 0.997885 | 3.485032 |
dbc27614-4c4a-4c26-96ec-84f7ab370eb3 | briandrawert/SPH-BVF | src/USER-OMP/pair_tip4p_cut_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include <cmath>
#include "pair_tip4p_cut_omp.h"
#include "atom.h"
#include "domain.h"
#include "comm.h"
#include "for... | ALGO | 0.99927 | 6.536776 |
cb613a35-4473-4827-b1e6-002fd2f6ce8f | mohammedNahal/azkar-app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
0fc74a17-6968-40db-81db-e71344d427a7 | panyan7/CP | Codeforces/Div2/390/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<long long,long long>
using cd = complex<double>;
const double PI = acos(-1);
void fft(vector<cd>& a, bool invert) {
int n = a.size();
if (n == 1)
return;
vector<cd> a0(n / 2), a1(n / 2);
... | ALGO | 0.999854 | 4.452868 |
d852e657-0b2c-4024-8206-76df61809872 | OdiSeU/BaekJoon | Baekjoon_C++/Baekjoon_C++/1934.cpp | #include <iostream>
using namespace std;
int GCD(int a, int b) {
int c;
while (b > 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
long LCM(int a, int b) {
return a / GCD(a, b) * b;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
int T, a, b;
cin >> T;
while (T--) {
cin >> a ... | ALGO | 0.999989 | 5.850001 |
89fd4e96-c4d9-4d63-bfb8-096ab13434af | tamofplease/atcoder_abc | abc274/a/main.cpp | using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n) for (int i = 1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define ll int64_t
using P = pair<int, int>;
const int MOD = 1000000007;
int main() {
double a,... | ALGO | 0.999194 | 3.883407 |
0633dee0-783a-425b-9b14-ff7accc56907 | andrew-canada/competitive-programming | codeforces/problems/1600/dp+bruteforce/1537e1-eraseAndExtend/1537e1-sol.cpp | #include "bits/stdc++.h"
using namespace std;
string get(string s, int k)
{
while ((int)s.size() < k)
{
s = s + s;
}
while ((int)s.size() > k)
s.pop_back();
return s;
}
int main()
{
int n, k;
string s;
cin >> n >> k;
cin >> s;
string pref = "";
pref += s[0];... | ALGO | 0.999916 | 4.329833 |
e8f40afd-19b2-4fda-98cb-08c25e0992a4 | NianShaoSix/studycode | bite_study/基础算法/枚举/luoguP2327扫雷.cpp | #include <iostream>
using namespace std;
int n;
const int N = 1e4 + 10;
int a[N],b[N];
int check(int x){
a[1] = x;
for(int i = 2;i <= n+1;i++){
a[i] = b[i-1] - a[i-1] - a[i-2];
if(a[i] < 0||a[i] > 1) return 0;
}
if(a[n+1]==0) return 1;
else return 0;
}
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
c... | ALGO | 0.999948 | 3.697756 |
51115b88-17b7-4905-98c6-1ca3f5e088b1 | scottie/lex | src/cryptopp/zdeflate.cpp | // zdeflate.cpp - written and placed in the public domain by Wei Dai
// Many of the algorithms and tables used here came from the deflate implementation
// by Jean-loup Gailly, which was included in Crypto++ 4.0 and earlier. I completely
// rewrote it in order to fix a bug that I could not figure out. This code
// is ... | ALGO | 0.998507 | 6.604997 |
44694c95-a07e-45e8-a51e-8917a262958d | adityamk43/CodeBank | DSA Self Paced/DisjointSets/LectureProblems/DisjoinSetsPathCompression.cpp | /**
* @file DisjoinSetsPathCompression.cpp
* @author ADITYA BHARDWAJ
* @brief
*
* The second optimization to naive method is Path Compression. The idea is to flatten the tree when find() is called. When find() is called for an element x, root of the tree is returned. The find() operation traverses up from x to fin... | ALGO | 0.999876 | 4.984143 |
ca9008fd-e82c-471f-8cb1-c37906aa36fd | stopmin/Algorithmic-Problem-Solving-Strategies | pykido/graph/DFS | BFS/programmers/프로그래머스_pccp_2번_석유시추.cpp | // 1. 석유 지도를 탐색하며 석유를 찾는다.
// 2. 석유를 찾았다면 bfs를 통해 석유덩어리의 크기를 파악하고 해당 석유 덩어리를 캘 수 있는 모든 column값을 set에 저장한다.
// 3. bfs 탐색이 끝났다면 열 위치 중에서 어느 위치에서 시추하는 것이 가장 많은 석유를 캘 수 있을지 찾기
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
using namespace std;
struct Coordinate {
int row; // ... | ALGO | 0.999787 | 5.959698 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.