uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c68f90cd-4f23-40a1-8c18-0e332561e70a | anasouamira/Algorithms | Problem solving with c++/Problem solving Level 2/Problem37.cpp | /*
Problem 37 |=================================================
Write a program to fill array with max size 100 with random numbers from
1 to 100, copy it to another array using AddArrayElement, and print it.
Input
10
Output:
Array 1 elements:
1 47 51 18 85 62 51 61 82 4
Array 2 elements after copy:
1 47 51 18 ... | ALGO | 0.984358 | 4.677478 |
53c88451-6626-40f5-a02e-1d5037c19da5 | theProtagonist09/DSA | C++/arrays/rotateMatrixBy90Degree/rotateMatrixBy90Degree.cpp | /*Problem Statement: Given a square matrix, your task is to rotate the matrix
90 degrees clockwise.*/
#include<bits/stdc++.h>
using namespace std;
vector < vector < int >> rotate(vector < vector < int >>& matrix){
int n=matrix.size();
vector < vector < int >> dupli(n,vector<int>(n,0));
for(int i=0;i<n... | ALGO | 0.999972 | 5.283765 |
5130b60e-e662-4423-97ef-75c919a84520 | Kashyap-Nirmal/GeeksforGeeks-Solutions | findingPairGivenDiff_v0.cpp | /*
Find pair given difference.
https://practice.geeksforgeeks.org/problems/find-pair-given-difference/0
Submitted
08-01-2021
*/
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t,l,n,iter,iter2,t1;
cin>>t;
int flag[t... | ALGO | 0.999764 | 4.665408 |
295f9537-9dee-4d68-bc73-a005708d16a4 | Kobzol/talks | 2019/avast-cpp/code/example3.cpp | #include <thread>
#include <vector>
#include <cstring>
#define REPETITIONS 1200 * 1024 * 1024UL
void thread_fn(int tid, int64_t* data, int count)
{
for (size_t i = 0; i < REPETITIONS; i++)
{
for (int c = 0; c < count; c++)
{
data[tid * 8 + count]++;
}
}
}
int main(int ... | TOOL | 0.973274 | 4.352199 |
e54ea820-de16-4747-863e-6189fdf98488 | IguchiShunpei/TL2 | DirectXTex/DirectXTexMipmaps.cpp | #include "DirectXTexP.h"
#include "filters.h"
using namespace DirectX;
using namespace DirectX::Internal;
using Microsoft::WRL::ComPtr;
namespace
{
constexpr bool ispow2(_In_ size_t x) noexcept
{
return ((x != 0) && !(x & (x - 1)));
}
size_t CountMips(_In_ size_t width, _In_ size_t height) n... | TOOL | 0.884631 | 5.762655 |
5150f0d0-a846-4ac0-87aa-243dfde6b84d | MRT4R1KUL1SL4M/CPP | MODULE-07/array_of_object.cpp | #include <bits/stdc++.h>
using namespace std;
class Student
{
public:
string name;
int roll;
int marks;
};
int main()
{
int n;
cin >> n;
Student a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i].name >> a[i].roll >> a[i].marks;
}
for (int i = 0; i < n; i++)... | ALGO | 0.992588 | 3.660701 |
0c8a82c9-54f0-416e-a9d7-74f17b12ce26 | ParasAnxi/DSA-Practice | Lec014 Binary Pivot , search , Power/SquareRoot.cpp | class Solution {
public:
long long bS(int x){
int s = 0;
int e = x;
int ans = -1;
long long int mid = s+(e-s)/2;
while(s<=e){
long long int square = mid*mid;
if(square==x){
return mid;
}
else if(square<x... | ALGO | 0.999987 | 5.445028 |
fa2ed8ed-4c9a-4d0f-98b0-41b451e8f7b9 | F-0728/atcoder | ABC/B/393B.cpp | #include <atcoder/all>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <chrono>
#include <bitset>
using namespace std;
using namespace atcoder;
// using mint = modint1000000007;
using mint = modint998244353;
using ll = long long;
using ld = long double;
const ll inf = 1 <... | ALGO | 0.999801 | 4.921391 |
96290d37-903d-4261-a29b-411bf0daf86c | akshaydubey05/Leetcode_Solutions | 1387-find-elements-in-a-contaminated-binary-tree/find-elements-in-a-contaminated-binary-tree.cpp | class FindElements {
public:
FindElements(TreeNode* root) { dfs(root, 0); }
bool find(int target) { return seen.count(target) > 0; }
private:
unordered_set<int> seen;
void dfs(TreeNode* currentNode, int currentValue) {
if (!currentNode) return;
// visit current node by adding its valu... | ALGO | 0.999832 | 5.956763 |
fba6516f-1af9-4933-a65a-2fe9dbba2b3d | itsSandeep2023/My-LeetCode-Solutions | 0890-lemonade-change/0890-lemonade-change.cpp | class Solution {
public:
bool lemonadeChange(vector<int>& bills) {
ios::sync_with_stdio(false);
int fcnt{0};
int tcnt{0};
for(const auto& b : bills)
{
if(b==5)
fcnt++;
else if(b==10)
{
if(fc... | ALGO | 0.999085 | 6.123347 |
451d253d-2d4d-4fcf-9bd3-f6751cca9526 | WingmanD/InfinityEngine | Engine/Source/Math/Math.cpp | #include "Math.h"
float Line::DistanceToPoint(const Vector3& point) const
{
const Vector3 line = End - Start;
return line.Cross(Start - point).Length() / line.Length();
}
Vector3 Line::ClosestPoint(const Vector3& point) const
{
const Vector3 a = point - Start;
const Vector3 b = End - Start;
r... | ALGO | 0.93997 | 6.688457 |
3a4a983d-0061-4837-adc3-aced530e0de8 | openkylin/inkscape | src/3rdparty/adaptagrams/libvpsc/tests/satisfy_inc.cpp | #include <libvpsc/rectangle.h>
#include <libvpsc/variable.h>
#include <libvpsc/constraint.h>
#include <libvpsc/solve_VPSC.h>
#include <algorithm>
#include <cstdio>
#include <ctime>
#include <cmath>
#include <cassert>
using namespace std;
using namespace vpsc;
static inline double getRand(const int range) {
return (d... | TEST | 0.996359 | 4.262486 |
14a78b96-4f1f-43fa-a75c-fb40874e3b4e | sakshieng/DSA-Sheet | InterviewPrep/intuit.cpp | // https://maang.in/mocks/attempts/6477?problem_id=100
// solved 2 questions which are good
#include<bits/stdc++.h>
//sakshi codes here
using namespace std;
#define Sakshi ios_base::sync_with_stdio(false);
#define Pro cin.tie(NULL);
int main(){
int t;cin>>t;while (t--)
{
Sakshi ... | ALGO | 0.999756 | 4.0787 |
c9f4d5a5-0876-478e-b6b2-dd57310d0cc8 | timid-zy/competitive-programming | 18-Dec-2024/Final Prices With a Special Discount in a Shop.cpp | class Solution {
public:
vector<int> finalPrices(vector<int>& prices) {
vector<int> stk;
for (int i = size(prices)-1; i >= 0; i--) {
while (size(stk) > 0 && stk[size(stk)-1] > prices[i]) stk.pop_back();
int ov = prices[i];
if (size(stk) > 0) {
pric... | ALGO | 0.999987 | 6.184656 |
21487bcf-4a12-4462-b8b5-f5045d5ea767 | linpenghong/Training_Base | Learn_Eigen3/2016/Basic_Linear_Solving.cpp | #include <iostream>
#include <Eigen/Dense>
#include "Typedef.h"
using namespace Eigen;
using namespace std;
int main()
{
mat33 A;
vec3 b;
A << 1, 2, 3,
4, 5, 6,
7, 8, 10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b ... | ALGO | 0.999256 | 3.563438 |
bfc05808-8d5a-4644-be63-e49ce9d9d191 | Nerez83/ProjectEuler | Euler11.cpp | #include <iostream>
int intFromArray(int array[], int row, int column, int columnWidth, int arrayLength)
{
int position = (row - 1) * columnWidth + column - 1;
if (position < arrayLength)
{
return array[position];
}
std::cout << "intFromArray(): Invalid coordinates" << std::endl;
return... | ALGO | 0.999125 | 3.524638 |
3d8eb22c-d66c-4c93-a6c0-1a80b5ebf183 | Praveen-0315/DSA | 1.Recursion/8_Exponent.cpp | #include <iostream>
using namespace std;
// Using Recursion
int expo(int m, int n){
if(m==0) return 0;
if(n==0) return 1;
else return expo(m, n-1)*m;
}
// Using Iteration
int Iexpo(int m, int n){
int e = 1;
for(int i=1;i<=n;i++)
e *= m;
return e;
}
int main(){
cout<<Iexpo(4,3)<<en... | ALGO | 0.999995 | 5.066539 |
3e65d9dd-af92-417c-be41-17a039016a86 | barskhianfannie/Graphing_Calculator | src/shunting.cpp | #include "shunting.hpp"
#include "number.hpp"
#include "oper.hpp"
#include "left_p.hpp"
#include "right_p.hpp"
#include "queue.h"
#include "stack.h"
#include "function.hpp"
#include <iostream>
#include <string>
#include "types.h"
using namespace std;
Shunting_Yard::Shunting_Yard()
{
}
Shunting_Yard::Shunting_Yar... | ALGO | 0.916424 | 3.438052 |
e8114d1f-4e81-4281-a534-ed9f0e5ceafd | dl8sd11/online-judge | tioj/2003.cpp | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"#%d: %s = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);... | ALGO | 0.999974 | 3.714585 |
581bbe61-fac4-4916-befb-6ccffccdd7db | vermakriti/Leetcode | Binary Tree/Lowest Common Ancestor/Lowest Common Ancestor of a Binary Tree II/program.cpp | /*
Given the root of a binary tree, return the lowest common ancestor (LCA) of two given nodes, p and q. If either node p or q does not exist in the tree, return null. All values of the nodes in the tree are unique.
According to the definition of LCA on Wikipedia: "The lowest common ancestor of two nodes p and q in a ... | ALGO | 0.999989 | 6.724419 |
ee97a805-3762-4714-8bc3-34cc449b2d99 | r-chiba/competitive_programming | atcoder/abc/110/d.cpp | // {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using n... | ALGO | 0.999978 | 3.702017 |
2c29935b-1ede-4623-a1c7-76ae453a52c0 | TITANBGG/C-3 | C-3-main/Untitled4.cpp | #include <stdio.h>
#include <stdlib.h>
int maliyet(int kat)
{
if (kat == 0)
return 1000;
return maliyet(kat-1)*1.1+100;
}
int main()
{
int kat,sonuc;
printf("Kac kat cikilacak:");
scanf("%d",&kat);
sonuc=maliyet(kat);
printf("%d kat icin toplam maliyet = %d",kat,sonuc);
return 0;
} | ALGO | 0.995398 | 3.196649 |
877a4787-2f1c-4267-b80b-1325fb4e0ba8 | jyok0120/algorithm_selfStudy | basic_algorithm/퀵정렬_quickSort.cpp | #include <iostream>
using namespace std;
void quickSort(int* data, int start, int last)
{
if(start>=last)
{
return; // only one element. no need to sort
}
int pivot = start;
int big = start +1;
int small = last;
int tmp;
while(big <= small)
{
while(big <= last && ... | ALGO | 0.999992 | 4.436578 |
422c2006-a5ec-4c8e-a8ec-95030080b813 | alxbnct/blender | extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp | ///This file was written by Erwin Coumans
///Separating axis rest based on work from Pierre Terdiman, see
///And contact clipping based on work from Simon Hobbs
#include "btConvexPolyhedron.h"
#include "LinearMath/btHashMap.h"
btConvexPolyhedron::btConvexPolyhedron()
{
}
btConvexPolyhedron::~btConvexPolyhedron()
{
}
... | ALGO | 0.997495 | 6.739945 |
c73f46ed-1b3e-4391-a9be-6ac52bfd3511 | ishandutta2007/codeforces | podurem/normal/705/A.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <cassert>
#... | ALGO | 0.999957 | 3.354207 |
53ee0757-76ac-49f2-a809-b5792a8d8da2 | DrKend/Week-1-Introduction | Program12_IfThisThenThat/Program12_IfThisThenThat/Program12_IfThisThenThat.cpp | #include <iostream>
using namespace std;
int main()
{
int rain = 1;
int snow = 2;
int weatherAnswer;
int tempAnswer;
cout << "If it is raining input 1, if it is snowing input 2" << endl;
cin >> weatherAnswer;
cout << "What is the temperature in celsius?" << endl;
cin >> tempAnswer;
... | TOOL | 0.98604 | 4.377328 |
93b1ed4f-0714-4f84-82f4-82147df2f488 | ishandutta2007/codeforces | jiangly/normal/1176/A.cpp | // remote judge
#include<bits/stdc++.h>
using namespace std;
int main(){
int q;
scanf("%d",&q);
for(int i=0;i<q;++i){
long long n;
scanf("%lld",&n);
int ans=0;
for(;n%2==0;n/=2)
++ans;
for(;n%3==0;n/=3)
ans+=2;
for(;n%5==0;n/=5)
... | ALGO | 0.999875 | 3.971135 |
6cc299c1-14b4-4f66-810f-01a6a75c7415 | comeon010/ios-toolchain-based-on-clang-for-linux | iphonesdk-utils/libhelper/pathutil.cpp | #include <string>
#include <dirent.h>
#include <stdio.h>
#include "helper.h"
//for stat()
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <iostream>
using namespace std;
vector<string> fillpath(void)
{
vector<string> pathdir;
... | TOOL | 0.979614 | 3.684244 |
833deed7-dd20-4461-81a1-478cc6b66504 | Moyu0730/CP-Question-Record | CSES/1636. Coin Combinations II.cpp | /* Question : CSES 1636. Coin Combinations II */
#include<bits/stdc++.h>
using namespace std;
#define opt ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mem(x, value) memset(x, value, sizeof(x));
#define pii pair<int, int>
#define pdd pair<double, double>
#define f first
#define s second
const au... | ALGO | 0.999993 | 4.312828 |
8f508674-57f8-48a2-ad34-7de7e9d38de8 | RamAgrawal01/DSA | Strings/lec84_85.cpp/lec84Pointer.cpp | #include<iostream>
using namespace std;
//pointers stores the address of other variable
int main(){
// int a = 5;
// int *ptr = &a;
// cout<<"printing ptr: "<<ptr<<endl;
// cout<<"priting *ptr: "<<*ptr<<endl;
// cout<<"printing &ptr: "<<&ptr;
int a = 5;
int *ptr = &a;
cout<<"Value of ... | ALGO | 0.973564 | 3.424953 |
b2d5a5dd-6f16-42c2-b42a-40be664265f5 | aishwaryan23/Complete-DSA-Cpp | sorting/mergeSortArray.cpp | #include<iostream>
#include<vector>
using namespace std;
void merge(vector<int>& A, int m, vector<int>& B, int n) {
int idx=n+m-1,i=m-1,j=n-1;
while(i>=0&&j>=0){
if(A[i]>=B[j]){
A[idx--]=A[i--];
}
else{
A[idx--]=B[j--];
}
}
while(j>=0){
A[i... | ALGO | 0.999938 | 4.466211 |
866f1b7a-d3a9-4509-a269-ba28bb81d783 | TMBOC/Robust-GNSS-Estimation-using-FG-GMM-TD | 3rdparty/RobustGNSS/gtsam/gtsam/3rdparty/GeographicLib/src/NormalGravity.cpp | #include <GeographicLib/NormalGravity.hpp>
namespace GeographicLib {
using namespace std;
NormalGravity::NormalGravity(real a, real GM, real omega, real f, real J2)
: _a(a)
, _GM(GM)
, _omega(omega)
, _f(f)
, _J2(J2)
, _omega2(Math::sq(_omega))
, _aomega2(Math::sq(_omega * _a))
{
... | ALGO | 0.999782 | 3.807632 |
3bca5b6f-9682-457e-87e7-77ffb99ef543 | jayshri-developer/DataStructures_and_Algorithms | Daily Problem/article/recursion/Subset Sum problem.cpp | // Approach 1 (RECURSION)
//GFG link: https://www.geeksforgeeks.org/subset-sum-problem/
// TC: O(2^N)
#include <bits/stdc++.h>
using namespace std;
int totalNodes=0;
void isSubsetSum(int n, vector<int> arr, int K, vector<int> &ds, int idx)
{
totalNodes++;
if(K == 0)
{
for(auto it: ds)
{
... | ALGO | 0.999942 | 6.132629 |
fab2ba0b-88ee-410e-b412-201cf8db673f | sarvex/leetcode-ruby | solution/0200-0299/0275.H-Index II/Solution.cpp | class Solution {
public:
int hIndex(vector<int>& citations) {
int n = citations.size();
int left = 0, right = n;
while (left < right) {
int mid = (left + right + 1) >> 1;
if (citations[n - mid] >= mid)
left = mid;
else
right... | ALGO | 0.999963 | 6.498641 |
91313d8c-3064-401a-86ed-c4a111e7945a | pengcheng12/ComputerGraphic | hw3/ext/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) { std::printf("r... | ALGO | 0.999174 | 4.84963 |
6beeac31-4731-45b7-a169-4d37e74efbfa | Skartik29/CPP | DataStructures/BinarySearchTree.cpp | #include "BinarySearchTree.h"
#include <stack>
#include <queue>
Node::Node(int d)
{
data = d;
left = NULL;
right = NULL;
}
Node::Node(const Node &from)
{
data = from.GetData();
left = NULL;
right = NULL;
}
Node::~Node()
{
data = -1;
}
BST::BST()
{
root = NULL;
}
void BST::cpy_node(const... | ALGO | 0.999399 | 4.194468 |
e3bd324c-ea67-4b1d-a4a6-13e86f9e3559 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2134_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int a, b, x, y, p, q;
cin >> a >> b >> x >> y >> p >> q;
int dw = x + p, dh = max(y, q);
if (a >= dw && b >= dh) {
cout << "YES\n";
return 0;
} else if (b >= dw && a >= dh) {
cout << "YES\n";
return 0;
}
... | ALGO | 0.999945 | 3.274403 |
87fd6c61-881a-47c0-b158-41f1d9d211d4 | sounishnath003/CPP-for-beginner | #Preparation/Placement-Overview/PrepInsta/bianry-bits-flip.cpp | #include<bits/stdc++.h>
using namespace std ;
#define fo(i, n) for(int i = 0; i < n; i++)
#define foo(i, k, n) for(int i = k; i < n; i++)
#define deb(x) {cout << #x << " " << x << endl ;}
#define IOS ios::sync_with_stdio(false), cin.tie(0) ;
#define MOD = 1e9+7 ;
const int N = 1e6+7 ;
int go(int &n) {
int x = log2... | ALGO | 0.999949 | 4.714086 |
4091e1c3-c53f-4a79-a12c-4cfd1e10cc3f | Sandip-Kanzariya/GFG-LeetCode | Difficulty: Basic/Identical Linked Lists/identical-linked-lists.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
bool areIdentical(struct Node *head1, struct Node *head2);
int main() ... | ALGO | 0.999676 | 5.317729 |
b2d3ffc7-5ce5-41b6-8c1e-2df0eaa297b9 | alexandraback/datacollection | solutions_5753053697277952_0/C++/shubhamvijay/1.cpp | //Shubham Vijayvargiya
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
#define sz(a) (int)(a.size())
#define set(a,b) ... | ALGO | 0.999913 | 3.509212 |
15a9c9ba-fd78-4a8a-82fa-5ddf6f97be53 | cgkantidis/project_euler | PE068-Magic 5-gon ring/PE068.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <array>
#include <sstream>
using triplet = std::array<int, 3>;
using solution = std::array<triplet, 5>;
/**
* Return true if the given arrangement is a valid solution, else false.
*/
bool is_valid_solution(std::array<int, 10> const &nums) {
// be... | ALGO | 0.999478 | 5.67951 |
692f885c-17e7-40e2-a70c-5ca961b27c6e | acc-cosc-1337-fall-2024/course-AydanGuzman | src/homework/05_functions/func.cpp | //add include statements
#include "func.h"
#include <string>
//add function code here
double get_gc_content(const std::string& dna)
{
double count_gc = 0;
double gc_content = 0;
for (char get_gc : dna)
{
if (get_gc == 'C' || get_gc == 'G')
{
count_gc++;
}
}
... | TOOL | 0.934374 | 6.021264 |
dd0bc928-f631-4d4b-9a76-c808b05b529b | SarbajitPbappy/CSES_II | Additional Problems/Intersection Points.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 1e5+1;
const int maxX = 1e6+5;
const int SIZE = 2*maxX;
struct Operation {
int type, y, a, b;
};
int N, ds[SIZE];
vector<Operation> ops;
void update(int idx, int val){
for(int i = idx; i < SIZE; i += -i&i)
ds[i] += ... | ALGO | 0.999498 | 3.827113 |
64be2bfc-6efb-4c45-8dc4-29f01fcb8434 | baofuhann/FISCO_BCOS_FL | deps/src/mysqlclient/extra/yassl/taocrypt/src/aestables.cpp | /* based on Wei Dai's aestables.cpp from CryptoPP */
#include "runtime.hpp"
#include "aes.hpp"
namespace TaoCrypt {
const word32 AES::rcon_[] = {
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000,
0x1B000000, 0x36000000,
/* for 128-bit blocks, Rijndael ne... | ALGO | 0.882057 | 4.374345 |
20636fdd-347a-4e17-8921-f968a219443c | ishandutta2007/codeforces | social_zhao/normal/1152/D.cpp | #include<bits/stdc++.h>
using namespace std;
int get() {
int x = 0, f = 1; char c = getchar();
while(!isdigit(c)) { if(c == '-') f = -1; c = getchar(); }
while(isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); }
return x * f;
}
const int N = 1005, P = 1e9 + 7;
int n, ans;
int C[N][N];
int main() {
n = get();
... | ALGO | 0.999965 | 4.269013 |
18a68737-4e37-4dee-940b-939cb2c34d34 | palilo815/ps | baekjoon/2000/2749.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000
void multiply(ll F[2][2], ll M[2][2])
{
ll x = F[0][0] * M[0][0] + F[0][1] * M[1][0];
ll y = F[0][0] * M[0][1] + F[0][1] * M[1][1];
ll z = F[1][0] * M[0][0] + F[1][1] * M[1][0];
ll w = F[1][0] * M[0][1] + F[1][1] * M... | ALGO | 0.999985 | 4.576495 |
1fc036c9-4775-4405-abbe-1dba4f4aef38 | interop-alliance/jsonld-cpp-core | jsonld-cpp-core/IriUtils.cpp | #include <vector>
#include "IriUtils.h"
#include "uri.hpp"
#ifndef _WIN32
#pragma clang diagnostic push
#pragma GCC diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic pop
#pragma GCC diagnostic pop
#endif // !_WIN32
namespace {
std::vector<std::string> split(std::st... | TOOL | 0.982456 | 7.220273 |
333c85d1-7ca6-4b5f-a359-54ad96c24b4f | OsmarSantana369/Programacion | Parcial 1/Clase/Programa 12/Programa_12.cpp | //Programa 12
//Programa que dice si un nmero entero es par o impar
#include<iostream>
using namespace std;
main()
{
setlocale(LC_ALL, "spanish");
int numero;
cout<<"\t\tPrograma que dice si un nmero entero es par o impar\n\n";
cout<<"Introduzca un nmero entero:\n";
cin>>numero;
cout<<"\n\n";... | ALGO | 0.999 | 3.658788 |
0492f554-f64d-4886-a41a-2ae19adf9067 | ishandutta2007/codeforces | hitman623/normal/991/E.cpp | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define all(a) (a).begin(),(a).end()
#define x first
#d... | ALGO | 0.999981 | 4.382515 |
1a8c177e-ceaa-465b-bf52-a7dec3d98e94 | RoGgu/CodingTest | 백준 알고리즘/15655. N과 M (6).cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int N, M;
vector<int> v;
void Dfs(int idx, vector<int>& path)
{
if (path.size() == M) // M 조건 수 만족하면 현재 담겨져 있는 수 들 출력
{
for (int i = 0; i < path.size(); i++)
{
... | ALGO | 0.99998 | 5.133972 |
d7e1827a-4a3c-41a8-88cc-82ca7f1d4174 | erickwill/Stanford-CS106B-Solutions | Boggle/boggle.cpp | /* File: boggle.cpp
* ----------------
* Your name here!
*/
#include "genlib.h"
#include "simpio.h"
#include "lexicon.h"
#include <iostream>
#include "extgraph.h"
#include "grid.h"
#include "random.h"
#include "gboggle.h"
#include "vector.h"
struct pointT
{
int row;
int col;
};
const int MIN_WORD_LENGTH ... | TOOL | 0.941186 | 5.568134 |
3f5fa100-8f42-43ed-9b95-1849dc5f9cb6 | landturtler/2020_Algorithm | cpp/19238/plz.cpp | #include<iostream>
#include<algorithm>
#include <queue>
#include <tuple>
#define MAX 21
#define INF 98765
using namespace std;
struct person {
int sx, sy;
int dx, dy;
};
person customer[MAX * MAX];
int N, M;
long oil;
bool road[MAX][MAX];
pair <int, int> taxi;
bool success[MAX]; //해당 손님을 탑승 완료했는지
pair<int, int> d[... | ALGO | 0.999805 | 4.423419 |
ed9bb8fe-0962-49d3-8269-3c66d71b227d | Togy/prydevserv_backup | dep/g3dlite/source/SplineBase.cpp | #include "G3D/platform.h"
#include "G3D/Spline.h"
namespace G3D {
float SplineBase::getFinalInterval() const {
if (! cyclic) {
return 0;
} else if (finalInterval <= 0) {
int N = time.size();
if (N >= 2) {
return (time[1] - time[0] + time[N - 1] - time[N - 2]) * 0.5f;
... | ALGO | 0.997371 | 7.842754 |
a2df675d-0982-4d0d-b851-42e9e44b7516 | zofvbeaf/algorithm-practices | pat/pat1007.cpp | #include <iostream>
#include<string.h> //memset
using namespace std;
int main(){
int sum,i,k,n,m,s,t,si,flag,start;
cin>>n;
cin>>k;
si = k;
s = k;
t = k;
sum = k;
m = k;
start = k;
flag = 0;
if(k>=0) flag =1;
for(i = 1; i < n; i++){
cin>>k;
if(k>=0) flag ... | ALGO | 0.999956 | 3.186197 |
d987b1b3-8351-4e0b-86ac-4fb7247677e0 | ivo-hr/cuarto-GDV | EDA/exene22/exEneRunner/ejerc1_22.cpp | /*
Nombre y Apellidos: [Tu nombre completo]
DNI: [Tu DNI]
Puesto de laboratorio: [Tu puesto]
Explicacin:
- Esta funcin adelanta un segmento de la lista k posiciones
- Lo que he conseguido hacer: [Explica aqu lo que implementaste]
- Lo que no he conseguido hacer: [Explica aqu cualquier limitacin]
*/
#include <iostream... | ALGO | 0.999247 | 3.433307 |
74ec5df6-6e48-43b8-865f-bab133d16221 | vovinov/MOS_1023 | old/lab3.3.2.cpp |
#include <iostream>
#include <Windows.h>
#include <conio.h>
#include <thread>
#include <string.h>
#include <cstring>
CRITICAL_SECTION cs;
int a=0;
HANDLE Event = NULL;
void vivod(int sch) {
WaitForSingleObject(Event, INFINITE);
EnterCriticalSection(&cs);
for (int i = 0; i < 5; i++) {
a += sch;
std... | TOOL | 0.879074 | 3.981488 |
5706b298-6aa8-49ec-a28c-b49526dcd045 | lazybones1/Algorithms | 백준알고리즘/단계별로 풀어보기/1. 입출력과 사칙연산/P_Number_2588.cpp | #include <iostream>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
cout << A*(B%10) << endl;
cout << A*((B/10)%10) << endl;
cout << A*(B/100) << endl;
cout << A*B << endl;
return 0;
}
| ALGO | 0.999456 | 3.170314 |
3b8c8f73-df87-48f9-93b3-893e440b2010 | krist7599555/cpp-algorithm | bit_string_lcs.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#define input() (*std::istream_iterator<int>(cin))
#define rep(i,k,n) for(int i=(k);i!=int(n);++i)
#define loop(i,n) for(int i = n; i--;)
#define all(x) (x).begin(),(x).end()
#define sz(x) (x).size()
using namespace std;
template < int N = 4, typename T =... | ALGO | 0.99998 | 4.243487 |
62c903ad-2b0c-4397-947d-5a01af419315 | Teomesa/Practicas_info_2 | Lab3/Lab3/Funciones.cpp | #include <iostream>
#include <fstream>
#include <cstring>
#include <bitset>
#include <algorithm>
using namespace std;
void leer_archivo(char* rutaArchivo, char* contenido, unsigned long long longitud)
{
fstream archivo(rutaArchivo, ios_base::in | ios_base::binary); // Abrimos el archivo en modo lectura
archiv... | ALGO | 0.991514 | 3.169956 |
291c3531-3128-4e1c-abae-e7020e15b569 | Shahid-Fahad/Online-Judge-Solution | Codeforces+Others/Drunk.cpp | ///Bismillahir Rahmanir Rahim
//ShzFahad
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define case_(tc) cout <... | ALGO | 0.999943 | 4.081473 |
98b40aed-aeea-4f85-8cd7-a5d7ec4360f2 | bolverk/huji-rich | source/ANN/bd_pr_search.cpp | #include "bd_tree.h" // bd-tree declarations
#include "kd_pr_search.h" // kd priority search declarations
//----------------------------------------------------------------------
// Approximate priority searching for bd-trees.
// See the file kd_pr_search.cc for general information on the
// approximate neare... | ALGO | 0.999953 | 6.372151 |
c8fa7e7e-84b8-41a3-bd4b-f8062d646618 | raincross7/code-similarity | codes/train_code/problem249/problem249_139.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> V(N);
for (int i=0; i<N; i++) {
cin >> V[i];
}
sort(V.begin(),V.end());
double a = V[0];
for (int i=0; i<N; i++) {
a = (a + V[i])/2.0;
}
cout << a;
return 0;
} | ALGO | 0.999738 | 4.422225 |
40517c2f-06b9-4ff0-bdf6-d0e89480dbc3 | gatechatl/MP-EST | TripleDistant/src/IndexCombination.cpp | #include "IndexCombination.h"
using namespace stdcomb;
void CIdxComb::Init( unsigned int SetSize, unsigned int CombSize )
{
// Assign CombSize
////////////////////////
if( CombSize == 0 )
CombSize = 1;
m_ArrSize = CombSize;
m_LastIdx = CombSize - 1;
// Assign SetSize
////////////////////////
if( SetSize ... | ALGO | 0.975464 | 4.77605 |
f7cce2f3-58d0-41d5-b9b0-a2c7ebb96891 | Nafyaz/my-codes | UVA/11353.cpp | #include<bits/stdc++.h>
using namespace std;
#define N 2000009
bool flag[N];
vector<int> primes;
void linsieve()
{
int i, j;
for(i = 2; i < N; i++)
{
if(!flag[i])
primes.push_back(i);
for(j = 0; j < primes.size() && i * primes[j] < N; j++)
{
flag[i * primes[... | ALGO | 0.999742 | 3.711322 |
319d0136-ad19-49f0-a9af-a50870f231cb | roilatzres/Divided-Differences-for-anharmonic-oscillator | include/json-develop/tests/thirdparty/Fuzzer/test/AbsNegAndConstant64Test.cpp | // abs(x) < 0 and y == Const puzzle, 64-bit variant.
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <cstddef>
#include <cstdio>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (Size < 16) return 0;
int64_t x;
uint64_t y;
memcpy(&x, Data, sizeof(x));
memcpy(&y, ... | ALGO | 0.98752 | 5.085598 |
69acc91b-98cf-4e0f-ade7-ee550056f3b9 | ankushgarg1998/Competitive_Coding | practice-websites/data-structures-and-algos/Sorting/quick_sort.cpp | #include <iostream>
#define loop(i, a, b) for(int i=a; i<b; i++)
using namespace std;
int party(int *a, int l, int r) {
int p = a[r-1];
int less = l-1;
loop(i, l, r-1) {
if(a[i] < p) {
++less;
swap(a[i], a[less]);
}
}
++less;
swap(a[less], a[r-1]);
r... | ALGO | 0.999982 | 4.801773 |
1e894a83-cd58-4a6c-8dc7-53d9a5e079c3 | lucasxia01/Competitive-Programming-Problems | Codeforces/CF 586/CF 586/A.cpp | #include <vector>
#include <stack>
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <functional>
#include <set>
#include <cstring>
#include <queue>
#include <stdlib.h>
#include <time.h>
#include <complex>
#include <iterator>
#include <regex>
#include ... | ALGO | 0.999867 | 3.14182 |
9c2178dd-57b3-4c05-8707-3263bc5555f7 | ramosjuanr/frameworks_av | media/libheadtracking/StillnessDetector.cpp | #include "StillnessDetector.h"
namespace android {
namespace media {
StillnessDetector::StillnessDetector(const Options& options)
: mOptions(options), mCosHalfRotationalThreshold(cos(mOptions.rotationalThreshold / 2)) {}
void StillnessDetector::reset() {
mFifo.clear();
mWindowFull = false;
mSuppressi... | TOOL | 0.900241 | 7.474539 |
df8514ee-af80-4951-8d09-6018c980b1db | Steve-s2024/Competitive-Programming-root-folder | Codeforces root folder2/Simple Repetition.cpp | #include<iostream>
#include<unordered_map>
#include<unordered_set>
#include<algorithm>
#include<vector>
#include<cmath>
#include<deque>
#include<limits>
using namespace std;
void solve() {
int x, k;
cin >> x >> k;
if (k == 1 && x == 1) cout << "NO" << endl;
else if (k == 1) {
bool flag = true;... | ALGO | 0.999214 | 5.125539 |
912c93ff-d9c9-4814-ad44-936c4a83015b | JamesHMcKay/Mass_builder | examples/Scalar.cpp | /*
Mass Builder
James McKay
May 2017
-- Scalar.cpp --
example routine to access self energies
*/
#include "data.hpp"
#include "compute_amp.hpp"
#include "self_energy.hpp"
#ifndef PI
#define PI 4.0L*atan(1.0L)
#endif
using namespace std;
namespace extra_TSIL_interface
{
#include TSIL_PATH
TSIL_COMPLE... | ALGO | 0.995211 | 4.825056 |
d931ddac-7539-48db-8020-d2f360f2d3bd | ShadowShell/QuestDrake | Game_Code/Code/GameSDK/GameDll/WeaponStrafeOffset.cpp | #include "StdAfx.h"
#include "WeaponStrafeOffset.h"
#include "Weapon.h"
#include "Utility/Hermite.h"
#include "WeaponFPAiming.h"
#include "WeaponOffset.h"
namespace
{
float SignedPow(float linearVal, float curvePower)
{
return pow_tpl(fabs_tpl(linearVal), curvePower) * fsgnnz(linearVal);
}
}
CStrafeOffset::CSt... | ALGO | 0.919147 | 6.569514 |
cca502d5-ff63-4bb4-b7cc-b9b0a06e27e2 | SR-Akash/Problem-Solving | HackerRank/Static.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=i;j<n;j++)
{
cout<<" ";
}
for(int k=1;k<=i;k++)
{
cout<<"#";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999808 | 3.258555 |
cc6940f7-a6cb-4e61-8a4c-4be5427fee80 | Duy-Phuong/CTDL | hash table/1512432/1512432_BT3/DoubleHashingMethod.cpp | #include "DoubleHashingMethod.h"
//hàm băm thứ 2
int HashFunc2(int key, int M) {
return abs( (M - 2) - key % (M - 2));
}
/*tìm khóa key trong bảng băm theo pp băm kép*/
int FindDoubleTable(int* table, int M, int key) {
int i = HashFunc(key, M); //băm lần 1
int j = HashFunc2(key, M); //lấy băm kép
while (table[i]... | ALGO | 0.999368 | 4.385867 |
b254b84f-685d-4204-b0ad-c5781c1461cb | NVIDIA-Omniverse/PhysX | physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp | #include "GuBV4.h"
using namespace physx;
using namespace Gu;
using namespace aos;
#include "GuBV4_BoxOverlap_Internal.h"
#include "GuBV4_BoxBoxOverlapTest.h"
#define USE_GU_TRI_TRI_OVERLAP_FUNCTION
#ifdef USE_GU_TRI_TRI_OVERLAP_FUNCTION
#include "GuIntersectionTriangleTriangle.h"
#endif
#include "GuDistanceTriangle... | ALGO | 0.995077 | 7.084077 |
50caf7ee-bb7f-48dc-a31a-b1226fb6ba9e | FishWoWater/ARCSim-For-SMPL | dependencies/eigen/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
cout << "m =" << endl << m << endl;
Vector3d v(1,2,3);
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.998133 | 3.387763 |
251b3ee8-bb93-4316-b834-8fb4e6517040 | yanhuanwang/codekata | wikioi2/1142.cpp | //#include <iostream>
//#include <cstdlib>
//#include <cstdio>
//#include <cstring>
//#include <algorithm>
//#include <map>
//using namespace std;
//int f[1000][1000], s, l = 1, i, j, k = 1;
//struct node {
// int id;
// int a, b, c, sum;
//};
//bool cmp(node a, node b) {
// if (a.sum == b.sum) {
// if (a.a == b.a) {
... | ALGO | 0.999755 | 3.893721 |
9917410b-eca4-4ba4-aebf-13bd681f1bbe | jiguang123/Big-Data-Learning-Note | 07_数据结构与算法/Cracking-the-Coding-Interview/p17-8.cpp | // 17.8 Find the consecutive subarray with maximum sum in an array.
// O(n) online algorithm.
#include <cstdio>
#include <vector>
using namespace std;
int maximumSum(vector<int> &v)
{
int n = (int)v.size();
if (n == 0) {
return 0;
}
int val = v[0];
int i;
for (i = 1; i < n; ++i) {
val = val > v[i] ? va... | ALGO | 0.999675 | 5.037746 |
8e9ee3e3-84ef-454e-97e2-666e52c5a410 | RCMast3r/ece-6122 | final_project/src/ogl_utils/quaternion_utils.cpp | #include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/euler_angles.hpp>
#include <glm/gtx/norm.hpp>
using namespace glm;
#include "quaternion_utils.hpp"
// Returns a quaternion such that q*start = dest
quat RotationBetweenVectors(vec3 start, vec3 dest){
start = normalize(start);
dest... | TOOL | 0.972714 | 6.762732 |
b1e35736-f700-456d-a859-43065bb4d783 | niazrahman13/Problem-Solving | Elections in Chefland - CodeChef.cpp | #include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
int main() {
optimize();
int t;
cin>>t;
for(int i = 0 ; i < t ; i++){
int x,y,total = 0;
cin>>x>>y;
while(x){
int z;
... | ALGO | 0.999778 | 3.627298 |
44699cc1-9be7-41c8-b6ca-15fa13fbe4b8 | maheshkumarsingh/PBC | CppAdvanceLearning/BasicScaler/Coding_Logic/betweenTwoSets.cpp | #include<bits/stdc++.h>
using namespace std;
int getTotalX(const vector<int> &a,const vector<int> &b) {
int count =0;
for(int x = a[0];x<=b[b.size()-1];x++)
{
bool flagFirst = true, flagSecond = true;
for(int j=0;j<a.size();j++)
if((x % a[j])!=0) flagFirst = false;
... | ALGO | 0.998963 | 4.546114 |
4ffedfd4-1c82-4540-b166-85d3d6b95d4d | ishandutta2007/codeforces | icecuber/normal/1117/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
string t;
int n;
cin >> t;
n = t.size();
string a,b,c;
cout << "? ";
for (int i = 0; i < n; i++)
cout << char(i%26+'a');
cout << endl;
cin >> a;
assert(a != "0");
cout << ... | ALGO | 0.999952 | 3.103047 |
920cbf7d-a714-48b6-a584-3bdddef8e8a9 | Park-HyeJin/DensityDependentDiffusion | FE/singlerun.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "diffusion.h"
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <limits>
#include <fenv.h>
using namespace std;
int main (int argc, char** argv)
{
if(argc!=4 && argc!=5)
{
cout << "Usage: " << a... | ALGO | 0.999958 | 5.040017 |
e759af9e-3dee-4f75-8331-25225f7bf5bc | dezhonger/muban | 图论/无向图割点.cpp | // https://www.luogu.com.cn/problem/P3388
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tu... | ALGO | 0.999956 | 4.457185 |
2b683768-9959-4b5b-99c3-acb772987346 | joy-mollick/Codeforces-B-C-D-Problem-Solutions | Codeforces-285C - Building Permutation.cpp | // https://codeforces.com/problemset/problem/285/C
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int n;
cin>>n;
int arr[n];
ll sum=0;
for(int i=0;i<n;i++)
{
cin>>arr[i];
... | ALGO | 0.999853 | 4.212083 |
f1e45a98-5f34-42c8-9e64-9c8eadd94f3e | deepakVerma66/DSA-C-- | August DSA Grind 2025/Linked List/DAY 1/ArrayToLinkedList.cpp | #include<iostream>
#include<vector>
using namespace std;
class Node{
public:
int data;
Node* next;
public:
Node(int data1,Node*next1){
data = data1;
next = next1;
}
Node(int data1){
data = data1;
next = nullptr;
}
};
Node* convertArr2LL(vector<int> &arr)... | ALGO | 0.999965 | 5.314761 |
730b2427-07aa-4ebd-a967-29ed34bdff2c | adityanjr/code-DS-ALGO | CodeForces/Complete/500-599/538A-CuttingBanner-OLD.cpp | #include <iostream>
#include <vector>
#include <map>
int main(){
const std::string target = "CODEFORCES";
std::string source; getline(std::cin, source);
std::map<char, std::vector<int> > pos;
for(int p = 0; p < source.size(); p++){
char current = source[p];
if(pos.count(current)){pos... | ALGO | 0.999968 | 3.496057 |
9b3bc3fb-2cc3-4845-93ac-298efdfe5340 | bvquoc/laptrinh24h_cpp-course | sl/sl180.cpp | #include <bits/stdc++.h>
using namespace std;
signed main(void) {
int n;
cin >> n;
long long res = (long long) n * (n - 1) / 2; // result
cout << res;
return 0;
} | ALGO | 0.999488 | 5.139506 |
f29434ba-f49b-491d-bc77-7f30f801208c | Tahaasim502/Starting-out-with-C-Tony-Gaddis-solved-by-Taha-Asim- | C++ Exercises/Arrays/Monkey_Bussiness.cpp | #include<iostream>
using namespace std;
int main()
{
const int row = 3, column = 5;
int array[row][column], food, total = 0, avg, maxvalue, minvalue, rindex = 0, rmindex = 0, cindex = 0, cmindex = 0;
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
cout << "Enter the food eaten by " << i + ... | ALGO | 0.999091 | 3.335108 |
fd4a58b5-f41a-45b7-8ea0-8299845de3cb | Elegalaxy/Leetcode-Record | solutions/1306. Jump Game III.cpp | class Solution {
public:
bool canReach(vector<int>& arr, int start) {
int n = arr.size();
vector<bool> vec(n, false);
queue<int> q;
q.push(start);
while(!q.empty()){
int t = q.front();
q.pop();
if(arr[t] == 0)... | ALGO | 0.999997 | 5.642279 |
c893587d-5fe6-4d9d-b406-b9dd4cf48baf | loltochess/convolutional_code | src/convolutional_code.cpp | #include "convolutional_code.h"
using namespace std;
// 편의상 layer와 node를 구분합니다. 처음 보면 헷갈릴수도 있습니다..
// node == state 이고, layer == hamming distance == 경로의 가중치(node 와 node 사이)
// 즉 node에는 state(도착지) 정보가 담겨있고, layer에는 weight(가중치) 정보가 담겨있고,
// 이것을 기준으로 다익스트라 알고리즘을 실행하는 것입니다.(각 layer마다)
// 도식화하면 다음과 같습니다
/*
(no... | ALGO | 0.999968 | 4.84882 |
205fcad0-6dd3-4ac1-8473-675c704eceb7 | zhangruichang/CodeJam | GCJ2009R1CProA/main.cpp | /*
Author: richard
Contact: <EMAIL>
*/
#include<set>
#include<map>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<ctime>
#include<cstdio>
#include<string>
#include<vector>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<fstream>
#include<iostream>
#include<algorithm>
#include <un... | ALGO | 0.999814 | 4.221188 |
cd3aba8d-49b6-4fae-9ee7-15a4cf769a0f | wissem18/LeetCode-Solutions | 2491-divide-players-into-teams-of-equal-skill/2491-divide-players-into-teams-of-equal-skill.cpp | class Solution {
public:
long long dividePlayers(vector<int> &skill) {
int sum = 0;
int n = skill.size();
for (int i = 0; i < n; ++i) {
sum += skill[i];
}
if (sum % (n / 2))
return -1;
sort(skill.begin(), skill.end());
int target = (2 * sum) / n;
long long ans = 0;
fo... | ALGO | 0.999973 | 5.206788 |
e2806ff0-bc98-4989-923a-6adf6e4b9570 | NQBH/advanced_STEM_beyond | combinatorics/resource/TMD/shortest_path/Code/problem15/problem15.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <limits>
#include <string>
#include <map>
#include <algorithm>
#include <functional> // For std::greater
// Use long long to avoid overflow with long paths.
using ll = long long;
// Use type aliases for better readability.
using Edge = std::pair<int, int>... | ALGO | 0.999905 | 6.970825 |
343b8a82-9871-4f79-a20b-3037453675f4 | Booooooooooo/wyb---ACM | 简单数据结构/E.cpp |
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int n,c;
long long f;
typedef struct {
long long sat;
int mon;
double p;
}d;
d cow[100005];
bool operator < (d a,d b)
{
if(a.sat<b.sat)
return 1;
else if(a.sat==b.sat)
return a.mon<b.mon;
//return a.sat<b.sat;
}
... | ALGO | 0.999871 | 3.166232 |
ff5f36f8-7bfa-43bf-be9b-bd43425ade80 | Willgunadi93/GunadiWill_CSC_44188 | Lab/Lab032817/GameOfCraps_V1/main.cpp | /*
* File: main.cpp
* Author: Dr. Mark E. Lehr
* Created on March 28th, 2017, 11:42 AM
* Purpose: Simulate a Craps Game
*/
//System Libraries
#include <iostream> //Input - Output Library
#include <ctime> //Time for rand
#include <cstdlib> //Srand to set the seed
using namespace std; //Name-space under ... | ALGO | 0.999509 | 5.489387 |
bc57458a-68ae-4586-903d-94c8cbe748a1 | Fafa-EL/Looping-C- | pengulangan (do while).cpp | #include <iostream>
using namespace std;
int main() {
char ulangin = 'y';
int counter = 0;
do {
cout<<"Apa mau diulang?"<<endl;
cout<<"jawab (y/t): ";
cin>>ulangin;
counter++;
}while (ulangin=='y');
cout<<"\n\n-------"<<endl;
cout<<"perulangan ... | TOOL | 0.859818 | 3.298055 |
04f03d2b-c280-48f6-a7bb-aff082edd483 | Nitin1130/Data-Structures-ProblemsCplusplus | RatChasesCheese.cpp | #include<iostream>
using namespace std;
//int cnt=0;
bool rat(char maze[][10],int sol[][10],int i,int j,int m,int n)
{
if(i==m && j==n){
//cnt++;
sol[m][n]=1;
for(i=0;i<=m;i++){
for(j=0;j<=n;j++){
cout<<sol[i][j]<<" ";
}
cout<<endl;
... | ALGO | 0.999995 | 4.121233 |
2678a59a-ca08-4ca8-96fa-e339676cf005 | pritamchaudhary/DSA-Supreme-2.O | Week 7 Recursion/Assignment/numberOfDiceRollsWithTargetSum.cpp | // leetcode 1155. Number of Dice Rolls With Target Sum
// You have n dice, and each die has k faces numbered from 1 to k.
// Given three integers n, k, and target, return the number of possible ways (out of the kn total ways) to roll the dice, so the sum of the face-up numbers equals target. Since the answer may be t... | ALGO | 0.999965 | 5.698071 |
bc982c73-8545-45b0-8068-84f760e0f349 | DaeYoung96/algorithm | backjoon/11068-Palindrome/main.cpp | // 백준 11068
// 회문인 수
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
bool palindrom(int num){
vector<int> v;
int tmp;
bool flag;
for(int i=2; i<=64; i++){
tmp = num;
while(tmp!=0){
v.push_back(tmp%i);
tmp/=i;
}
for(int j=0; j<v.size(); j++){
if(v[j] != v[v.size()-j-1])... | ALGO | 0.996716 | 4.294396 |
f7f476a3-ed3f-4dba-8fcf-7e4f72d1a3ee | SHOVON944/Codeforces | 800/A. Neko Finds Grapes.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int box, key;
cin >> box>>key;
int box_num[box], key_num[key];
int boxEven =0;
int boxOdd =0;
int keyEven =0;
int keyOdd =0;
for(int i=0; i<box; i++){
cin >> box_num[i];
if(box_num[i]%2==0) boxEven++;
else... | ALGO | 0.999924 | 3.565835 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.