uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
52f8410c-7feb-484a-bf99-10adca3fac59 | xiezy0/palisade-extend | src/core/unittest/UnitTestNbTheory.cpp | // @file
// @author TPOC: <EMAIL>
//
// @copyright Copyright (c) 2019, New Jersey Institute of Technology (NJIT)
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source co... | TEST | 0.902234 | 6.114877 |
6de2b5f0-c752-457c-b926-0c200c411f4b | salimmia/Workstation | Problem Solving/Code_Template/Codes/STL Synatax and other Basics/Bit Operation set reset .cpp | //Maybe 0 indexed
int Set(int N, int pos)
{
return N = N | (1 << pos);
}
int Reset(int N, int pos)
{
return N = N & ~(1 << pos);
}
bool isSet(int N, int pos)
{
return (bool)(N & (1 << pos));
}
| ALGO | 0.965602 | 3.5894 |
25dd2014-7e68-4c66-9b02-c02497cfafbb | MdImranHosen1/String_Algorithm | String Hashing.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int>pi;
typedef pair<long long, long long>pl;
#define F first
#define S second
#define pb push_back
#define al... | ALGO | 0.99966 | 4.405782 |
13ea44cc-0c85-4f69-aaa4-3d0fe82dc1cf | RazerRom/frameworks_av | media/libstagefright/codecs/amrnb/enc/src/q_gain_c.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/q_gain_c.c
Functions: q_gain_code
Date: 02/05/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV codin... | ALGO | 0.999575 | 5.243058 |
e964cc2b-2c87-454d-ba04-4236eee8a298 | tonitakekawa/CocosProjectTest | cocos2d/cocos/base/ZipUtils.cpp | // FIXME: hack, must be included before ziputils
#ifdef MINIZIP_FROM_SYSTEM
#include <minizip/unzip.h>
#else // from our embedded sources
#include "unzip.h"
#endif
#include "base/ZipUtils.h"
#include <zlib.h>
#include <assert.h>
#include <stdlib.h>
#include "base/CCData.h"
#include "base/ccMacros.h"
#include "platfo... | TOOL | 0.908084 | 6.619042 |
4806ac2e-098b-439b-9523-086d2bafe480 | Krishnam2411/contests | NITS Hacks 7.0 Prelims/A_Byteshima_and_Bytesaki.cpp | // TEAM TRASHCODERS
#include <iostream>
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
void solve(ll n, ll m, ll r, ... | ALGO | 0.999132 | 3.926755 |
a5367b64-4358-4a28-95f0-d91513ee6ae1 | jegensomme/Algorithms-and-Data-Structures | LinkedList.cpp | #include <iostream>
#include <chrono>
#include <ctime>
#include <windows.h>
using namespace std;
struct l_item
{
int elem;
l_item *Pred, *Next;
};
class DL_list
{
public:
void Create(int N)
{
l_item *Curr = 0, *Next = 0;
for (int i = 0; i < N; i++)
{
Curr = new l_item;
Curr->Next = Next;
if (... | TOOL | 0.973422 | 4.249737 |
7039eb67-46a4-4293-896f-4ed0c959b938 | MainakRepositor/500-CPP | 111.cpp | // C++ program to find minimum
// element in a sorted and rotated array
#include <bits/stdc++.h>
using namespace std;
int findMin(int arr[], int low, int high)
{
// This condition is needed to
// handle the case when array is not
// rotated at all
if (high < low) return arr[0];
// If there is only one element le... | ALGO | 0.999982 | 5.532038 |
639a284b-a163-4d39-ba71-4a8fcd155c8c | XyeHyin/vscode | exercise/prac0407/万绿丛中一点红.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int main()
{
int M, N, TOL;
cin >> M >> N >> TOL;
ll a[N][M];
map<ll, int> mp;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < M; j++)
... | ALGO | 0.999356 | 3.90487 |
9b4c23fe-deb5-4028-8fe8-a4a1fd8bdb45 | betterscientificsoftware/Trust-Tools | march-madness/include/eigen/unsupported/doc/examples/FFT.cpp | // To use the simple FFT implementation
// g++ -o demofft -I.. -Wall -O3 FFT.cpp
// To use the FFTW implementation
// g++ -o demofft -I.. -DUSE_FFTW -Wall -O3 FFT.cpp -lfftw3 -lfftw3f -lfftw3l
#ifdef USE_FFTW
#include <fftw3.h>
#endif
#include <vector>
#include <complex>
#include <algorithm>
#include <iterator>... | ALGO | 0.993388 | 6.129515 |
d7e3dfcc-b892-45c6-8020-8a0cf842a848 | trilinos/Trilinos | packages/teko/src/Epetra/Teko_BlockingEpetra.cpp | #include "Teko_BlockingEpetra.hpp"
#include "Epetra_IntVector.h"
#include "Epetra_LocalMap.h"
using Teuchos::RCP;
using Teuchos::rcp;
namespace Teko {
namespace Epetra {
namespace Blocking {
/** Build maps to make other conversions. This function builds a map
* using a vector of global ids local to this processor.... | TOOL | 0.956629 | 4.240681 |
9baead51-a852-430c-abf0-72779b29fc9e | ishandutta2007/codeforces | flukehn/normal/1735/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
using ll=long long;
#ifndef flukehn
#define dbg(...) 0
#define debug(...) 0
#endif
int main(){
#ifdef flukehn
freopen("A.in","r",stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
int t;
cin>>t;
while(t--){
... | ALGO | 0.999483 | 3.992905 |
05272b5f-17cc-4921-a807-19c4cc7dd781 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3904_61.cpp | #include <bits/stdc++.h>
int n, m, k;
int kex[101][101] = {0};
int main() {
scanf("%d%d%d", &n, &m, &k);
int i;
int x, y;
int have = 0;
for (i = 0; i < k; i++) {
scanf("%d%d", &x, &y);
if (x <= 5 || x >= n - 4 || y <= 5 || y >= m - 4) have = 1;
}
if (have)
printf("YES");
else
printf("NO"... | ALGO | 0.999902 | 3.877028 |
1e1898fe-b064-4dfd-9855-c824f96979d8 | VitamintK/AlgorithmProblems | codeforces/round457/c.cpp | #include <bits/stdc++.h>
#include <string>
#define ll long long
#define ull unsigned long long
using namespace std;
int main(){
std::ios::sync_with_stdio(false);
ll n, m;
cin >> n >> m;
int prime;
vector<int> sieve(110000);
for(int i = 2; i < 110000; i++){
if(sieve[i] == 0){
if(i >= n-1){
prime = i;
... | ALGO | 0.99975 | 3.11596 |
2d1956cb-653c-45e1-8f0d-ab5f240b7d3d | Mappo1562/progcomp | listado2 - busqueda binaria y ordenamiento/B [Sort of Sorting]/solucion.cpp | #include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
using namespace std;
int comparar(string a, string b){
if (a.substr(0,2)<=b.substr(0,2))
return 1;
return 0;
}
void merge(vector<string>& arr, int inicio, int centro, int final){
int n1 = centro-inicio+1, n2 = final-centro... | ALGO | 0.999867 | 4.339771 |
71a3de52-3816-454c-b685-0f798af2092d | raincross7/code-similarity | codes/train_code/problem366/problem366_108.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C, K;
cin >> A >> B >> C >> K;
if (K <= A) return cout << K << "\n", 0;
if (K <= A + B) return cout << A << "\n", 0;
cout << A - (K - A - B) << "\n";
} | ALGO | 0.999942 | 3.374187 |
d7422e16-052a-486c-828a-0fae64e9ea5f | Kritika30032002/kritika_leetcode | 141-linked-list-cycle/141-linked-list-cycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
// Time Complexity : O(N)
// Space Complexity : O(1)
class Solution {
public:
bool hasCycle(ListNode *head) {
// if head is NULL then return false;
... | ALGO | 0.999878 | 5.297253 |
325a1bcb-2a73-477a-b85c-80582a55d805 | ishandutta2007/codeforces | ashishgup/normal/1388/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N = 1e5 + 5;
int n, m;
bool flag = 1;
int p[N], h[N], sum[N], happy[N], sad[N];
vector<int> g[N];
void dfs(int u, int par)
{
sum[u] = p[u];
int sadChildren ... | ALGO | 0.999986 | 4.201676 |
f8e03d5f-23c9-418c-9202-e49601f20a89 | gangotrinvents/C-and-C-plus-plus | largest kth element using heap.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int n,temp;
cin>>n;
vector<int> v;
for (int i = 0; i < n; ++i)
{
cin>>temp;
v.push_back(temp);
}
int k;
cin>>k;
make_heap(v.begin(),v.end());
for (int i = 0; i < k-1; ++i)
{
pop_heap(v.begin(),v.end());
v.pop_bac... | ALGO | 0.999917 | 3.265573 |
7b413749-fc0d-4859-8a14-4892bb798b81 | NazninKohra1997/C-plus-plus | hackos compare the triplets.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[3];
int b[3];
int Alice=0;
int Bob=0;
int i,j;
for(i=0;i<3;i++){
cin>>a[i];
}
for(j=0;j<3;j++){
cin>>b[j];
}
for(int k=0;k<3;k++){
if(a[k]>b[k]){
Ali... | ALGO | 0.999984 | 3.467494 |
5f6735eb-3448-4da7-84fe-c58b2511c79e | Vasile27/problems_and_theory | Mutimap/Mutimap/Mutimap.cpp | // Mutimap.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include<map>
using namespace std;
void work()
{
multimap<int, string> lookup;
lookup.insert(make_pair(30, "Mike"));
lookup.insert(make_pair(30, "John"));
lookup.insert(make_pair(... | TOOL | 0.978248 | 4.759162 |
f67ab37a-74ab-4a99-b532-a48531f030a6 | ishandutta2007/codeforces | gom/normal/1666/E.cpp | #include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 1
#define TEST if(test)
using name... | ALGO | 0.999989 | 3.675267 |
5c8ee9f5-3eac-4ef3-9496-8c5bfa44f1ee | Neha-Shaik/Competetive-Programming | CodeChef CC/Div 3/Starters9/BlackCellsInAChessboard.cpp | #include<bits/stdc++.h>
using namespace std;
using ll=long long int;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
// Code here
int n;
cin>>n;
int blackcells;
blackcells=n*n/... | ALGO | 0.998571 | 3.235751 |
68daaa81-b13a-4aeb-8106-13584862708d | trprice/cmake_tutorial | src/MathFunctions/mysqrt.cpp | #include <math.h>
double mysqrt (double dInput)
{
#if defined (HAVE_LOG) && defined (HAVE_EXP)
printf ("Using exp and log\n");
return 2 * (exp (log(x)*0.5));
#else
return sqrt (dInput);
#endif
}
| ALGO | 0.997914 | 3.759912 |
1a634fbd-2c57-4b81-ba7f-2d4b9b0204ca | kripken/ammo.js | bullet/Demos/UserCollisionAlgorithm/UserCollisionAlgorithm.cpp | #include "btBulletDynamicsCommon.h"
#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
#include "UserCollisionAlgorithm.h"
#include "GL_ShapeDrawer.h"
#include "GlutStuff.h"
//The user defined collision algorithm
#include "BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h"
GLDebugDrawe... | ALGO | 0.975921 | 5.907214 |
1f6f30e2-ff69-4142-865c-74e509c5043e | keqhe/leetcode | google_list/leetcode247.cpp |
class Solution {
public:
vector<string> helper(int curr, int n) {
if (curr == 0)
return {""};//return {""} not {}, error-prone
if (curr == 1)
return {"0","1","8"};
vector<string> leftover = helper(curr-2, n);
vector<string> res;
for (auto s : leftover... | ALGO | 0.999658 | 6.910898 |
8024e9d0-d549-4ae1-b3ba-5f637e4d4a92 | akash19jain/COMPETITIVE-PROGRAMMING | LEETCODE/30_DAY_LEETCODE_CHALLENGE/4_MOVE_ZEROES.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums)
{
int n=nums.size();
int count=0;
int front=0;
for(int i=0;i<n;i++)
{
if(nums[i]==0)
count++;
else
{
nums[front]=nums[i];
front... | ALGO | 0.999945 | 6.445806 |
d85795e8-495e-4778-bc30-b6d3b18c8461 | enderstream/DoitAlgorithm | 038_1456_거의 소수 구하기/main.cpp | #include <iostream>
#include <vector>
#include <cmath>
#ifdef BOJ // 백준 채점환경
constexpr bool local = false;
#else // 로컬
constexpr bool local = true;
#endif
#define FAST_IO \
std::ios::sync_with_stdio(false); \
std::cin.tie(nullptr); \
std::cout.tie(nullptr);
#define debug ... | ALGO | 0.999784 | 4.926533 |
028427d2-d84f-4233-9516-69108977a6af | kashishvaish/LeetCodeSolutions | PalindromeNumber.cpp | class Solution {
public:
bool isPalindrome(int x) {
// Time: O(log(n))
// Space: O(1)
int copy = x;
long rev = 0;
while(copy > 0) {
rev = rev*10 + copy%10;
copy /= 10;
}
return x == rev;
}
};
// Approach:
// Reverse the number -->... | ALGO | 0.999905 | 6.195546 |
cc61c301-9487-4fcd-93c2-ac6dfbe15da6 | Hou-Xiaoxuan/AlgorithmCompetition | algorithm_contest_2021/Atcoder/01_23_AtCoder Beginner Contest 189/D.cpp | #ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define m_p make_pair
#define x first
#define y second
using namespace std;
using LL=long long;
using ULL=unsigned long long;
using P=pair<int,int>;
const int inf=0x3f3f3... | ALGO | 0.999356 | 3.765095 |
2951062d-b041-4a0c-acc1-1da41edf0cb1 | Yang890912/Leetcode | LeetCode/Medium/0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999729 | 6.561362 |
c1a7bc98-c6d7-4516-87f3-82dacf7536a1 | saravanan-2003/Leetcode | C/2163-kth-distinct-string-in-an-array/kth-distinct-string-in-an-array.cpp | class Solution {
public:
string kthDistinct(vector<string>& arr, int k) {
vector<string>v;
int flag;
for(int i=0;i<arr.size();i++){
flag=1;
for(int j=0;j<arr.size();j++){
if(i!=j && arr[i]==arr[j]){
flag=0;
brea... | ALGO | 0.999892 | 5.533539 |
69cb8618-3a2a-4de5-9000-def2f793e712 | bansal1999/LeetCode_Solutions | 455-assign-cookies/455-assign-cookies.cpp | class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(g.begin(), g.end());
sort(s.begin(), s.end());
int cnt =0;
for(int i =0; cnt< g.size() && i < s.size(); i++)
{
if(g[cnt] <= s[i])
cnt++;
}
... | ALGO | 0.999884 | 5.806563 |
bae6698b-326a-4667-9b5b-31cab8757406 | seunghyukcho/algorithm-problems-solved | baekjoon/2523.cpp | #include <iostream>
using namespace std;
int n;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 1; i <= n; i++)
{
for(int j = 0; j < i; j++)
cout << '*';
cout << '\n';
}
for(int i = n - 1; i >= 1; i--)
{
for(int j = 0; j < i; j++)
cout << '*';
cout << '\n';
}
} | ALGO | 0.999973 | 3.948604 |
78bd84cc-95b5-41a2-9af4-21b27caa1278 | GSGFs7/algorithm | acwing/3508. 最长公共子串.cpp | #include <iostream>
#include <unordered_set>
#include <cstring>
using namespace std;
typedef unsigned long long ULL;
const int N = 20010, P = 131;
int n, m;
char str[N];
ULL p[N], h[N];
/// 得到子串的hash值
ULL get(int l, int r)
{
return h[r] - h[l - 1] * p[r - l + 1];
// 用h与p(标准值)的差值进行hash
}
bool check(int mid... | ALGO | 0.999912 | 3.743175 |
33449b70-3cdd-43ea-8dd8-86c227da1c69 | George-Codr/llvm | libc/src/stdbit/stdc_count_ones_uc.cpp | #include "src/stdbit/stdc_count_ones_uc.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(unsigned, stdc_count_ones_uc, (unsigned char value)) {
return static_cast<unsigned>(cpp::popcount(value));
}
}... | TOOL | 0.88367 | 6.863495 |
19acfdc0-834b-4059-a109-9cfaa9e44918 | cc123-xiaoix/Unilever-Acne | face detector/opencv-master/samples/cpp/tutorial_code/video/optical_flow/optical_flow_dense.cpp | #include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/video.hpp>
using namespace cv;
using namespace std;
int main()
{
VideoCapture capture(samples::findFile("vtest.avi"));
if (!capture.isOpened()){
... | ALGO | 0.989028 | 4.525755 |
3704e26c-4c01-4fa0-ab37-1bfdbb598c41 | RabadanLab/MITKats | Modules/DiffusionImaging/DiffusionCore/src/Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.cpp | #include "mitkPartialVolumeAnalysisClusteringCalculator.h"
#include "mitkImageAccessByItk.h"
#include "mitkImageToItk.h"
#include "itkScalarImageToHistogramGenerator.h"
#include "itkListSample.h"
#define _USE_MATH_DEFINES
#include <math.h>
#define PVA_PI M_PI
namespace mitk
{
PartialVolumeAnalysisClusteringCalcu... | ALGO | 0.998887 | 6.026156 |
f55f503b-c0ad-4a76-a9d0-3db81ff5bd0a | iamdeepakdass/GFG-Practice | Medium/Heap Sort/heap-sort.cpp | //{ Driver Code Starts
// C++ program for implementation of Heap Sort
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// The functions should be written in a way that array become sorted
// in increasing order when heapSort() is called.
class Solution
{
public:
//Heapify function to maint... | ALGO | 0.999918 | 5.993554 |
4c67167a-9914-484b-b8e2-03e0eb84df73 | Dhaval572/very-normal-programming | Reverse_the_number.cpp | // Reverse the number
#include <iostream>
using namespace std;
int reverseTheNumber(int num)
{
int digit, reverse = 0;
while(num != 0)
{
digit = num % 10; // Gives last digit
reverse = reverse * 10 + digit;
num /= 10;
}
return reverse;
}
int main()
{
cout << reverseThe... | ALGO | 0.999134 | 5.225526 |
4d485d55-01d3-48a7-9f37-9f187cbb4889 | Tanmaybhujade/GFG_Problem_of_the_Day | Help_a_Thief.cpp | class Solution {
public:
int maxCoins(int A[], int B[], int T, int N) {
vector<pair<int, int>> ar;
for(int i = 0; i < N; i++) ar.push_back({B[i], A[i]});
sort(ar.begin(), ar.end());
int ans = 0;
for(int i = N - 1; i >= 0; i--) {
int cur = min(T, ar[i].s... | ALGO | 0.999867 | 4.662596 |
9fb42339-71a2-48ea-bc2e-5e774cdab210 | marbjorn/Operation-System-Labs | OS_lab5/server.cpp | #include <iostream>
#include <conio.h>
#include <fstream>
#include <time.h>
#include <algorithm>
#include <process.h>
#include <windows.h>
#include "employee.h"
int empCount;
employee* emps;
HANDLE* hReadyEvents;
CRITICAL_SECTION empsCS;
bool *empIsModifying;
const char pipeName[30] = "\\\\.\\pipe\\pipe_name";
void s... | TOOL | 0.982343 | 3.617579 |
1ca80c6e-223e-4d57-a1d0-0e5af2186c88 | paul-rahul/Graph-Algorithms | dfs.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int>v[100];
bool fat[100];
void dfs(int s)
{
fat[s]=true;
for(int i=0;i<v[s].size();i++)
{
if(fat[v[s][i]]==false)
{
dfs(v[s][i]);
}
}
}
void initialise()
{
for(int i=0;i<100;i++)
{
fat[i]=false;
}
}
int main()
{
ios::sync_with_stdio(0), cin.tie... | ALGO | 0.999451 | 4.993671 |
64883a20-70b4-446e-a164-7f610043e233 | iRath96/focal-guiding | mitsuba/src/medium/heterogeneous.cpp | #include <mitsuba/render/scene.h>
#include <mitsuba/render/volume.h>
#include <mitsuba/core/statistics.h>
#include <boost/algorithm/string.hpp>
MTS_NAMESPACE_BEGIN
/**
* \brief When the following line is uncommented, the medium implementation
* stops integrating density when it is determined that the segment has a
... | ALGO | 0.98715 | 7.273353 |
06b2e036-1637-4bb6-a4e7-5da68a1ef90e | Mneach/Leetcode-Solution | 1434-decrypt-string-from-alphabet-to-integer-mapping/1434-decrypt-string-from-alphabet-to-integer-mapping.cpp | class Solution {
public:
string freqAlphabets(string s) {
string decoded;
int i = 0, n = s.length();
while (i < n) {
if (i + 2 < n && s[i + 2] == '#') {
// Handle two-digit codes (10-26) represented with '#'
int charCode = (s[i] - '0') * 10 + (s[i... | ALGO | 0.999788 | 6.164246 |
33d968b6-d649-4526-ac6d-e1d914f0eb67 | manjotsuri-20/Project-Mapmyworld | rtabmap_ros/src/nodelets/obstacles_detection_old.cpp | #include <ros/ros.h>
#include <pluginlib/class_list_macros.h>
#include <nodelet/nodelet.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl_conversions/pcl_conversions.h>
#include <tf/transform_listener.h>
#include <sensor_msgs/PointCloud2.h>
#include <rtabmap_ros/MsgConversion.h>
#include "... | DATA | 0.877165 | 6.173143 |
da25b819-99ec-405e-82bf-36a35ae18665 | Soumyojyotisaha/DAA-codes | daa/Knapsack_recursion.cpp | #include<iostream>
using namespace std;
int cap=4;
int wt[]={3,2,2};
double val[]={1.8,1,1};
int n=3;
int find(int ind,int cap)
{
if(ind==0)
{
if(wt[0]<=cap)
return val[0];
return 0;
}
int notinc=0+find(ind-1,cap);
int inc=INT_MIN;
if(wt[ind]<=cap)
inc=val[ind]+find(ind-1,cap-wt[ind]);
retur... | ALGO | 0.999596 | 3.235364 |
879b49be-feac-42d4-9cfa-7afba3bbc7b4 | Iwaide/AtCoder | abc220/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
int K;
string A, B;
cin >> K >> A >> B;
long long KA = 0 , KB = 0;
int tmp = K;
while(A.size() > 0) {
int tmp = stoi(A.substr(0, 1))... | ALGO | 0.999545 | 3.788706 |
8835583e-0967-4ac0-af07-bc9f159c1aa6 | Moyu0730/CP-Question-Record | CSES/1735. Range Updates and Sums.cpp | /* Question : CSES 1735. Range Updates and Sums */
#include<bits/stdc++.h>
using namespace std;
/* Pragma */
#pragma GCC optimize("Ofast")
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
/* Self Define */
#define IO... | ALGO | 0.999595 | 5.024634 |
faadc71b-a47e-471c-a475-6b01882558c8 | fizzydavid/FizzyDavid-s-templates | template/palindromic_tree(palindromic_partition).cpp | //by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
... | ALGO | 0.999907 | 3.255357 |
2c82148c-897b-4693-a41d-61d935248f41 | Shivsharma779/Leetcode_solutions | 166. Fraction to Recurring Decimal/piyush_solution.cpp | class Solution {
public:
//https://leetcode.com/problems/fraction-to-recurring-decimal/discuss/51160/C%2B%2B-unordered_map
string fractionToDecimal(int num, int den) {
unordered_map<int,int> mp;
string res="" , decimals = "";
if(num==0)
return "0";
... | ALGO | 0.999945 | 6.233564 |
2d04aa7b-ce08-4c55-a4f0-23ef00a05f01 | manthan0x23/codeforces-problems | tws/pq/t.cpp | #include <bits/stdc++.h>
#include <cstring>
// manthan's code
using namespace std;
#define tc \
int t; \
cin >> t; ... | ALGO | 0.999992 | 4.289974 |
5cda5096-e0a0-4a38-abc6-cc5f42bcf2d4 | delicm/cses | Introductory/Permutations/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n==1)
{
cout << 1;
}
else if(n<=3)
{
cout << "NO SOLUTION";
}
else
{
for(int i = 1 ; 2*i<= n; i++)
{
cout << 2*i << " ";
}
for(int i = 0; 2*i+1<=n; i++)
{
... | ALGO | 0.999973 | 3.662739 |
773041cf-da46-496e-b25d-5df80299a8b4 | HiYellowC/ACM | 二维bit/aa.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 1010
#define MOD 1000000007
using namespace std;
int r, c;
int maxn, q;
struct QQ {
int x1, x2;
int y1, y2;
int v;
};
QQ Q[15];
bool cmp(QQ x, QQ y) {
return x.v < y.v;
}
struct Treex {
int treey[MAXN * 3];
bool flagy[M... | ALGO | 0.998558 | 3.993128 |
698f6716-4ab3-45a7-87cc-1a9086dde516 | Nur-Alam39/online-judges-problem-solutions | CodeChef/Ciel and A-B Problem.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
scanf("%d%d",&a,&b);
c=abs(a-b);
if(c%10==9)
c--;
else
c++;
printf("%d\n",c);
return 0;
}
| ALGO | 0.999793 | 3.2581 |
bfe8e58f-6355-4853-ad8e-ecde65d4bb00 | Shivam-1400/LeetCode | 2415-reverse-odd-levels-of-binary-tree/2415-reverse-odd-levels-of-binary-tree.cpp | class Solution {
public:
TreeNode* reverseOddLevels(TreeNode* root)
{
unordered_map<int,vector<int>>mp; //odd level --> all values
queue<TreeNode*>q;
q.push(root);
int level=0;
int size;
while(!q.empty())
{
size=q.size();
... | ALGO | 0.99999 | 5.673437 |
84b863c3-be88-4d7c-ac2e-650671e6344a | prashantpandey9/create-your-own-what-you-want | c++/heapSort.cpp | #include<iostream>
using namespace std;
void swap(int *a,int *b)
{
int t=*a;
*a=*b;
*b=t;
}
void insertion(int A[],int i)
{
int temp;
temp=A[i];
while(i>1&&temp>A[i/2])
{
A[i]=A[i/2];
i=i/2;
}
A[i]=temp;
}
void heapSort(int A[],int n)
{
int i,j,x,temp;
x=A[n];
swap(&A[n],&A[1]);
i=1;
... | ALGO | 0.999966 | 3.966528 |
871d7069-c0ef-47b4-a04e-30587856e377 | ForhanShahriarFahim/Problem-Solving | Split_N.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
//********************************************************************************************************************... | ALGO | 0.999784 | 5.096894 |
ff3817ca-399e-40d4-8a75-1d8e354af27c | 2013612/CP-algorithm | AtCoder/abc393/abc393D.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n;
string s;
vector<long long> v, pre;
long long ans = 1e18;
int main() {
scanf("%d", &n);
cin >> s;
pre.push_back(0);
for (int i = 0; i < n; i++) {
if (s[i] == '1') {
v.push_back(i);
pre.push_back(pre.back() + i);
}
... | ALGO | 0.999988 | 3.982665 |
17f14eee-6aa7-4cb3-a5ab-65c09d49c380 | WYCTSTF/solution | codeforces/contest/1764/d/d.cpp | #include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cmath>
#include <deque>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <complex>
#include <sstream>
#include <utility>
#include <climits>
#include <cstring>
#include <fstream>
#include <functional... | ALGO | 0.987209 | 3.529213 |
cf195e28-d390-49c2-94d0-25a4f8a9438d | rarietta/Spacetime-Optimization-of-Articulated-Character-Motion | ADOL-C/ADOL-C/examples/additional_examples/detexam/detexam.cpp | /****************************************************************************/
/* INCLUDES */
#include <adolc/adolc.h>
#include "../clock/myclock.h"
/****************************************************************************/
/* ... | ALGO | 0.99996 | 3.859226 |
3a9e3c83-d08f-407d-b152-08fb15494d44 | tnakai11/Atcoder-practice | ABC/ABC183/f.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i,n) for(int i=n; i>-1; --i)
#define all(a) (a).begin(),(a).end()
#define fill(a,n,x) rep(i,(n)){ (a)[i]=(x)... | ALGO | 0.999959 | 4.705638 |
4fb82e55-e865-4bc0-91ce-eb1c4e66d132 | prajjwal2512/DSA | Recursion Problems/checksotedarray.cpp | // //------>>>>> check
// #include<iostream>
// using namespace std;
// bool isshorted(int arr[],int size){
// if(size==0 || size==1){
// return true;
// }
// if(arr[0]>arr[1]){
// return false;
// }
// else{
// bool remainingpart=isshorted(arr+1,size-1); // har jagah bool hi use... | ALGO | 0.999227 | 4.230493 |
5a71561a-a715-40ca-8bdb-9f775080fe71 | tazawa2002/RBM_MNIST | rbm.cpp | #include "rbm.h"
// コンストラクタ
RBM::RBM(int v_num, int h_num){
train_type = TrainType::sampling;
gradient_type = GradientType::nomal;
animete_type = AnimeteType::none;
sampling_num = 100;
paramInit(v_num, h_num); // 変数のリサイズ
std::random_device rd;
gen = std::mt19937(rd()); // 乱数生成器の初期化
dis... | ALGO | 0.998351 | 4.411942 |
f146c386-899c-42b7-a3f1-2a9836901b78 | javics2002/MotorEngine | Dependencies/Bullet/Src/src/BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp | #include "btLemkeAlgorithm.h"
#undef BT_DEBUG_OSTREAM
#ifdef BT_DEBUG_OSTREAM
using namespace std;
#endif //BT_DEBUG_OSTREAM
btScalar btMachEps()
{
static bool calculated = false;
static btScalar machEps = btScalar(1.);
if (!calculated)
{
do
{
machEps /= btScalar(2.0);
// If next epsilon yields 1, then... | ALGO | 0.999993 | 3.789785 |
1a2d8932-d1df-466f-b7fd-0e6a3a9a2dba | Aysha-khanom/CPP | codeforces/Easy Problem.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n,cnt=0;
cin >> n;
for(int b=1; b<=n-1; b++)
{
int a = n-b;
if((a+b) == n)
cnt++;
}
cout << cnt << endl;
}
}
| ALGO | 0.999902 | 4.224446 |
01b3bceb-7f37-4e80-ae41-be341efc3e54 | Sam10907/NSYSU-CSE-DS-Homework | NSYSU CSE Data Structure Homework/hw6-b052010007.cpp | //Author:R B052010007
//Date:Nov. 17,2019
//Purpose:ϥΤGjMXX{_ƦƦr
#include <iostream>
#include <vector>
using namespace std;
class TreeNode{ //إ߾`I
friend class Tree;
public:
TreeNode(int d,TreeNode *l=0,TreeNode *r=0){
data=d;
left=l;
right=r;
}
private:
int data;
TreeNode *left;
TreeNode *righ... | ALGO | 0.999964 | 3.94751 |
247450e5-6680-45a4-9367-8b7a5278f8ce | autosquid/ANIMAL | src/maths/SQuaternion.cpp | //////////////////////////////////////////////////////
// file: SQuaternion.cpp @ 2008-1-24 by Zhang Xiang
// defines of the class SQuaternion
// SQuaternion is a class ...
//////////////////////////////////////////////////////
// INCLUDES //////////////////////////////////////////
#include "SQuaternion.h"
#include "S... | ALGO | 0.907559 | 5.612256 |
f84a449d-a414-46f8-9474-f0bdbb65c2cd | cppnuts-yt/CppNuts | Interview Questions/Binary Tree Interview Questions/Diameter of a binary tree.cpp | #include <iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(rig... | ALGO | 0.999752 | 6.493401 |
9e5e36ad-79a6-4707-b58b-4bac36d106c7 | Ramavatar98/keyhunt-automation | secp256k1/IntMod.cpp | #include "Int.h"
#include <emmintrin.h>
#include <string.h>
#define MAX(x,y) (((x)>(y))?(x):(y))
#define MIN(x,y) (((x)<(y))?(x):(y))
static Int _P; // Field characteristic
static Int _R; // Montgomery multiplication R
static Int _R2; // Montgomery multiplication R2
static Int _R3; ... | ALGO | 0.998133 | 3.908246 |
e17b8d55-966d-47be-883e-10c882d69ec0 | 23ksw10/LeetCode | algorithm/139_Word_Break/solution.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
class Solution {
public:
unordered_map<string, bool>m;
bool wordBreak(string s, vector<string>& wordDict) {
if (m.find(s) != m.end())return m[s];
for (auto w : wordDict) {
if (s.find(w) == 0) {
if (w == ... | ALGO | 0.99916 | 5.435229 |
0545cd96-e989-44d9-bf1a-97ecd5777e80 | burakcoskun/programming_contests | codeforces/global_3/A/soln.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
ll a, b, c, res;
int main() {
cin >> a >> b >> c;
res = 2 * c + min(a, b) * 2;
if (a != b)
++res;
cout << res << endl;
return 0;
}
| ALGO | 0.99952 | 3.758085 |
4e16c9a9-f663-4057-bb2d-212560c182cb | intfloat/AlgoSolutions | usaco/2013Mar/PokerHands.cpp | #include <stdio.h>
#include <vector>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;
typedef pair<int, int> point;
int main() {
freopen("poker.in", "r", stdin);
freopen("poker.out", "w", stdout);
int N;
scanf("%d", &N);
vector<point> arr;
vector<int> val(N + 2);
v... | ALGO | 0.999665 | 3.643365 |
34f1c848-0345-47e1-a9ea-9c7b65646739 | YannisLamp/psim | main.cpp | #include <iostream>
#include <string>
#include <ctime>
#include <math.h>
#include "exp_rand.h"
#include "process.h"
#include "dl_node.h"
#include "process_queue.h"
#include "priority_queue.h"
#include "sem_queue.h"
using namespace std;
int main(int argc, char* argv[]) {
// Checking parameter number
if (argc ... | ALGO | 0.999481 | 3.987473 |
9d8dfaf1-1a5e-4c33-9128-6f814aebc80a | vuccix/Image-Editor | effects/src/canny.cpp | #include "../effects.h"
#include "../../utils/sobel.h"
#include <cmath>
GRAYSCALE Effects::cannyEdge(RGB_IMAGE& img) {
const int rows = static_cast<int>(img.size());
const int cols = static_cast<int>(img[0].size());
// apply Gaussian blur
Effects::blur5x5(img);
GRAYSCALE gray = grayscale(img);
... | ALGO | 0.967952 | 6.274139 |
df8292ed-7611-4b5f-8ba2-2ce3f069b0e7 | CalonWibu/supercat | tugas cpp bu ires, Dylan/latihan percabangan dan tugas rumahnya/latihan 7 percabangan/main.cpp | #include <iostream>
#include <conio.h>
#include <stdio.h>
using namespace std;
int main() {
int x, y, a, z;
cout << "masukkan nilai x = ";
cin >> x;
cout << "masukkan nilai y = ";
cin >> y;
cout << "operasi yang dapat di lakukan \n1. penjumlahan\n2. pembagian\n3. pengurangan\n4. perkalian\nmasukan pilihan operas... | TOOL | 0.945995 | 3.289361 |
2f75741b-d0c8-4d02-b26c-3a7b5cb72a5e | ishandutta2007/codeforces | ashishgup/normal/1036/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N=1e3+5;
struct point
{
int x, y;
};
int n, ans=0;
point a[N], b[N];
map<pair<int, int>, int> m;
int get(int x1, int y1, int x2, int y2)
{
return __gcd(ab... | ALGO | 0.999808 | 4.112069 |
0b4f1a23-bb13-484b-909b-77ce408e1c21 | nirowu/leetcode-master | 0042-trapping-rain-water/0042-trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& height) {
int ans = 0;
int left = 0, right = height.size()-1;
int left_max = INT_MIN, right_max = INT_MIN;
while(left <= right) {
if (height[left] <= height[right]) {
left_max = max(height[left], left_max);
... | ALGO | 0.999985 | 6.806027 |
8a5d7ff5-7c9a-4da3-91cc-2e741caf92a8 | MarcusSilva3298/Programming-Language-Course | Lista Function/Lista funções 2 (passagem por referência)/quest_3/quest_3.cpp | #include <iostream>
using namespace std;
void div(int x, int y, int &q, int &r){
q=x/y;
r=x%y;
}
int main(){
int x, y, q, r;
cout << "X e Y: ";
cin >> x >> y;
div(x, y, q, r);
cout << "\nQuociente: " << q << "\nResto: " << r;
return 0;
}
| ALGO | 0.987886 | 4.778855 |
997893ea-6728-4ec8-93fc-4fb0df8501ba | Lifelover-yyq/LeetCode-Trip | Hard/32. 最长有效括号.cpp | /*
题目:
给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。
思路:
1、很容易想到用栈来处理,遇到左括号push,遇到右括号跟栈top比较,如果是'(',则+2并pop,不等则下一个,过程中不断比较更新max值。见解法1。
2、结果发现这样只能得到所有有效的括号数量,如果它们不连续就会出错,比如"()(()"这个就会输出4而不是2。
3、解析里同样有使用栈的解法,不过不是对括号字符进行操作,而是对其下标进行操作,计算方法很巧妙,见解法2。
4、还有一种方法用L R两个计数器,不需使用额外空间,可以说更nb了。见解法3。
*/
//解法1 理解错题意的版本
class Solution {
p... | ALGO | 0.999873 | 5.107729 |
f35b2af5-c8e7-4538-ac96-c8c2bbfb4214 | cabbagecabbagecabbage/Competitive-Programming | DMOJ Solutions/brapleshmafia.cpp | // #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// #include <ext/pb_ds/tree_policy.hpp>
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ost;
#define int long long //MLE, ... | ALGO | 0.999952 | 4.127729 |
29d4d41e-17e6-40db-9024-9b2896e6bfee | victorj44/851_project | benchmarks/bm2.cpp | /* **************************************
* benchmark 2 - # of probes for reads, depending on the load
* 10^6 elements in hash maps
* 10^8 gets per hash map
* - linear hashing w/ tabulation
* - linear hashing w/ mult.hash.
* - quadr hashing w/ tabulation
* - quadr hashing w/ mult.hash.
* - hopscotch w/ tabulati... | TEST | 0.909655 | 4.845379 |
45dfc487-fae1-4544-9ca8-0b96eb6e6648 | CrealityOfficial/fmesh | fmesh/generate/polyfiller.cpp | #include "polyfiller.h"
#include "fmesh/generate/earpolygon.h"
#include "fmesh/generate/triangularization.h"
#include "fmesh/common/dvecutil.h"
#include "fmesh/clipper/circurlar.h"
#include "fmesh/contour/contour.h"
#include "fmesh/contour/polytree.h"
#include <algorithm>
namespace fmesh
{
Patch* fillSimplePolyTree(S... | ALGO | 0.911811 | 4.077196 |
5f79d0a5-7422-4749-a06d-ad3cef906b61 | T0peerakarn/competitive-programming | spoj/PIGBANK.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 10005;
int dp[N];
bool visit[N];
void solve()
{
for(int i=1 ; i<=10000 ; i++)
{
dp[i] = 1e18;
visit[i] = false;
}
dp[0] = 0;
visit[0] = true;
int e, f, n;
scanf(" %d %d %d",&e,&f,&n);
while(n--)
{
... | ALGO | 0.999514 | 4.007148 |
ad325268-bd1e-44d3-97bd-a3a28ae4f200 | KeyviDev/keyvi-server | src/3rdparty/brpc/src/brpc/cluster_recover_policy.cpp | #include <vector>
#include <gflags/gflags.h>
#include "brpc/cluster_recover_policy.h"
#include "butil/scoped_lock.h"
#include "butil/synchronization/lock.h"
#include "brpc/server_id.h"
#include "brpc/socket.h"
#include "butil/fast_rand.h"
#include "butil/time.h"
#include "butil/string_splitter.h"
namespace brpc {
DEF... | WEB | 0.903583 | 7.198224 |
f7ae6d7c-2d25-4c91-be44-c96c93770057 | ishandutta2007/codeforces | ksun48/normal/1067/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 998244353;
LL powmod(LL a, LL n){
if(n == 0) return 1;
if(n % 2) return (a*powmod(a,n-1)) % MOD;
LL c = powmod(a, n/2);
return (c*c) % MOD;
}
LL inv(LL a){
return powmod(a, MOD-2);
}
LL fact[110000];
LL invfact[1100... | ALGO | 0.9998 | 4.776469 |
3ac42737-82bd-448c-9d5a-bd001ada9080 | timingenbrand/GECC | GECC/GECC_Performance/snm_functions.cpp | #include <iostream>
#include <math.h>
#include "snm_functions.h"
#include "snm_variables.h"
#include <random>
using namespace std;
void SetUp(unsigned long long int* x){
// init values
breaksim = 0;
currentTime = 0;
noutput = 0;
reactions = 0;
progress_count = 0;
switchcount = 0;
f = ... | ALGO | 0.999709 | 3.41024 |
55f8b268-52df-4ebd-b081-8141636982f2 | rstancioiu/Uva-online-judge | Volume107/10784 - Diagonal/10784.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int c=1;
while(cin>>n && n!=0)
{
n<<=1;
long long k = sqrt(n);
for(int i=0;;++i)
{
long long a =k+i;
if(a*(a-3)>=n)
{
cout<<"Case "<<c++<<": "<<a<<"\n";
break;
}
}
}
r... | ALGO | 0.999937 | 3.690504 |
a56f94ac-f809-4424-80d6-535edbeefbec | vbonnici/grafe-sim | analysis/data/p02256/s854142092.cpp | #include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;
#define MAX 256
int f(int x, int y){
if (y != 0){
f(y, x%y);
}
else{
return x;
}
}
int main(void){
int a, b;
scanf("%d%d", &a, &b);
if (a < b){
int c = a;
a = b;
b = c;
}
printf("%d\n", f(a, b));
retu... | ALGO | 0.999862 | 3.097923 |
9077b940-042e-4954-a11e-7279efb9dac7 | chenxiaohui/leetcode | leetcode/BestTimetoBuyandSellStockII.cpp | /*
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). However, you may not engage in multiple transactions at the same time ... | ALGO | 0.998093 | 6.304331 |
07c391af-16f6-4d8e-b180-7b3ea7db7d6f | spatstat/s2 | src/Rcpp_s2point.cpp | #include "Rcpp_datatypes.h"
#include "s2/s2.h"
#include "s2/s2polyline.h"
#include <Rcpp.h>
using namespace Rcpp;
// Find break points to split polyline with vertices `points` in n pieces of
// equal length (incl. start and end vertex). Only used with two points in our
// code.
std::vector<S2Point> s2point_interpolat... | ALGO | 0.998792 | 6.150266 |
482d1cbf-e075-4e67-81d8-46a8af566dcd | Muhammad-Abu-Yusuf-Nayeem/Data-Structures | lab-3 problem-1.cpp | #include<bits/stdc++.h>
using namespace std;
int top=-1,maxx=4;
char arr[5];
void push(char x)
{
if(maxx==top) printf("Overflow !!!");
else{
top+=1;
arr[top]=x;
}
}
void pop()
{
if(top==-1) printf("Underflow !!!");
else{
top-=1;
}
}
void display()
{
if(top==-1) printf("\nEmpty stake\n");
else{
int ... | ALGO | 0.998986 | 3.765507 |
eb345979-83f1-477b-a67f-6e6390bfd0b4 | imankit1/leetcode | 0290-word-pattern/0290-word-pattern.cpp | class Solution {
public:
bool wordPattern(string pattern, string s) {
vector<string>temp;
string flag="";
for(int i=0;i<s.size();i++){
if(s[i]==' '){
temp.push_back(flag);
flag="";
}
else{
flag+=s[i];
... | ALGO | 0.999703 | 6.20672 |
faef2f17-acc8-4f38-87e6-f0485f94d07c | h-hg/data-structure-and-algorithm | leetcode/315-count-of-smaller-numbers-after-self/insertion-sort.cpp | #include <vector>
using namespace std;
class Solution {
public:
vector<int> countSmaller(vector<int>& nums) {
vector<int> ans(nums.size(), 0);
for(int n = nums.size() - 1, i = n - 1; i >= 0; --i) {
int nStep = 0;
// move and swap
for(int j = i; j < n && nums[j] > nums[j + 1]; ++j) {
... | ALGO | 0.999999 | 5.612495 |
3d77f609-6a32-4c9f-a90f-f2be02edf8d1 | shifucun/pdfium | core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | #include "../../../include/fpdfapi/fpdf_render.h"
#include "../../../include/fpdfapi/fpdf_pageobj.h"
#include "../../../include/fxge/fx_ge.h"
#include "../fpdf_page/pageint.h"
#include "render_int.h"
#define SHADING_STEPS 256
static void _DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bitmap,
... | TOOL | 0.8843 | 5.986053 |
8522e212-14f8-4033-807f-148bbeec3371 | hei-jung/algorithm-cpp | boj/boj_2573.cpp | #include <iostream>
#include <queue>
#include <cstring> //memset
using namespace std;
int N, M;
int graph[300][300] = {0};
bool visited[300][300];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
void init()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int max(int a, int b)
{
... | ALGO | 0.999904 | 5.006423 |
e2d54a96-6904-4b4f-8084-033b0e76c2e4 | its-kumar-yash/Trie-Problems | PhoneDirectory.cpp | //Given a list of contacts contact[] of length n where each contact is a string which exist in a phone directory and a query string s. The task is to implement a search query for the phone directory. Run a search query for each prefix p of the query string s (i.e. from index 1 to |s|) that prints all the distinct cont... | ALGO | 0.99962 | 5.389428 |
aa5a0cbc-a63b-461f-ba24-70bc9ea5ed14 | Ashwik/Leet-Code-Solutions | 62-unique-paths/unique-paths.cpp | class Solution {
public:
int uniquePaths(int m, int n) {
vector<int> grid(n,1);
for(int i=1;i<m;i++){
for(int j=1;j<n;j++){
grid[j] += grid[j-1];
}
}
return grid[n-1];
}
}; | ALGO | 0.999948 | 6.530578 |
73e5086c-bcde-4e0d-975e-f6bb4ed2e35d | BurningTiles/CodeChef | Other/CodeChef College Chapter - CC1636/f.cpp | /**
* Author : DefineSenTinaL
* Created : 2020-10-11 13:52:24
* Program : DECIMAL TO BINARY
**/
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
while(n--){
int x, ans[8], i=0;
cin >> x;
do{
ans[i++] = x%2;
x/=2;
} while(x);
while(i>0 && i--) cout << ans[i];
cout << en... | ALGO | 0.999938 | 5.050479 |
9f226a09-4aa6-48d5-8e39-205a08549211 | BrianGlasheen/glowing-engine | glow/ext/JoltPhysics-5.3.0/Jolt/Physics/LargeIslandSplitter.cpp | #include <Jolt/Jolt.h>
#include <Jolt/Physics/LargeIslandSplitter.h>
#include <Jolt/Physics/IslandBuilder.h>
#include <Jolt/Physics/Constraints/CalculateSolverSteps.h>
#include <Jolt/Physics/Constraints/Constraint.h>
#include <Jolt/Physics/Constraints/ContactConstraintManager.h>
#include <Jolt/Physics/Body/BodyManager... | ALGO | 0.992024 | 6.595716 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.