uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
fda1e848-6a49-4b3c-ac05-374a0d690dc2 | Ritikpcl/Comp-Prog | C_Inhabitant_of_the_Deep_Sea.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
void initCode() {
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve(){
ll n,k;
cin>>n>>... | ALGO | 0.999969 | 4.649738 |
a858490b-0cfd-42df-9902-48d1de1e7763 | lanshi17/leetcode | editor/cn/serialize-and-deserialize-binary-tree.cpp | /*
* @lc app=leetcode.cn id=297 lang=cpp
* @lcpr version=30202
*
* [297] 二叉树的序列化与反序列化
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Codec... | ALGO | 0.999571 | 6.581922 |
7f682256-6019-4299-92ad-1e50f6334b92 | Yusuke-Kuribayashi/Tutorial-20T | kuribayashi_space/answer/mbed/trapezoid_kadai_2.cpp | /*********************
1,スイッチを押すと,台形制御を用いてモータが25回転する.
2,もう一回スイッチを押すと1と同じ動作だが,タイヤの向きが逆になる
mbed研修の課題5-1
**********************/
/**********************************************************************
Include Libraries
**********************************************************************/
#include "mbed.h"
#include "dc_m... | ALGO | 0.981969 | 4.591586 |
ef5154ea-7d96-4dfc-86ea-5e03a7b0549c | Soumya-Kushwaha/LeetCode | 0242-valid-anagram/0242-valid-anagram.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
if (s.length() != t.length())
return false;
int count[26] = {0};
for (int i=0; i<s.length(); i++){
count[s[i]-'a']++;
count[t[i]-'a']--;
}
for (int i=0; i<26; i++)
... | ALGO | 0.999988 | 6.376482 |
acdc1e04-296c-430c-bc79-45f1b6bab8b8 | Tommygithubaccount123/leetcode | 0509-fibonacci-number/0509-fibonacci-number.cpp | class Solution {
public:
vector<int> dp = {0,1};
int fib(int n) {
if (n < dp.size()){
return dp[n];
}
dp.push_back(fib(n-1) + fib(n-2));
return dp[n];
}
}; | ALGO | 0.999983 | 5.925306 |
5dc33a28-2984-4db2-9441-180bbd3d13b7 | diohabara/competitive_programming | ac/prev/abc052_b.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
using namespace std;
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
cin >> s;
int max = 0, tmp =... | ALGO | 0.999618 | 3.939645 |
80d1a2d2-0f6a-46b9-9038-d3931b94a671 | shakilahamedriaz/cps | Previous batch all modules/module 1/Class 17 Practice Problems of loop/Opposite_Task.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while( t-- )
{
int n;
cin >> n;
if(n > 10)
{
cout<< n - 10 << " " << 10 << "\n";
}
else
{
cout<< 0 << " " << n << "\n";
}
}
} | ALGO | 0.999889 | 3.875469 |
7c7865c1-cad9-487f-a8dd-0996e8ecca4b | ishandutta2007/codeforces | hyperbolic/normal/1720/A.cpp | #include <stdio.h>
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
long long int a,b,c,d;
scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
if(a*d==b*c) printf("0\n");
else if(a==0) printf("1\n");
else if(c==0) printf("1\n");
else if((a*d)%(b*c)==0) printf("1\n");
else if((b*c)%(a*d)==0) printf("1\n");
else ... | ALGO | 0.999904 | 3.930586 |
6e2beea1-a66b-468d-af8d-3a6b1a41909a | starfishda/Algorithm | BOJ/Math/BOJ - 9613 (GCD 합).cpp | #include<iostream>
#include<algorithm>
using namespace std;
int gcd(int a, int b) {
while (b != 0) {
int r = a % b;
a = b;
b = r;
}
return a;
}
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
int n;
long long int sum = 0;
cin >> n;
int *arr = new int[n];
for (int j = 0; j < n; j++)... | ALGO | 0.999928 | 4.332031 |
d4fc91f7-d699-42ce-b40e-5f83becd9a35 | anustark/Cplusplus-Programs | balancing brackets.cpp | //balancing parenthesis.
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
int a=0,b=0,c=0;
char str[100];
cout<<"Enter any string conatining only brackets : ";
cin.get(str,100);
int l=strlen(str);
for(int i=0;i<l;i++)
{
if(str[i]=='{')
a++;
else if(str[i]=='}')
... | ALGO | 0.996822 | 4.377712 |
63208796-d147-4042-8198-2bee203099e1 | ishandutta2007/codeforces | ikatanic/normal/806/D.cpp | #include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
typedef long long llint;
const int MAX = 2020;
const llint i... | ALGO | 0.999935 | 3.380942 |
bef9c2c8-e96e-460f-b5c0-a8c9d59b1710 | developerhimanshu/gfg | 8Hashing/8CountUnionElements.cpp | #include <iostream>
#include <unordered_set>
using namespace std;
int unionnum(int a[], int b[], int m, int n)
{
unordered_set<int>s;
for(int i=0; i<m; i++)
s.insert(a[i]);
for(int i=0; i<n; i++)
s.insert(b[i]);
for(auto x:s)
cout<<x<<" ";
return s.size();
}
int main()
{... | ALGO | 0.999132 | 3.80619 |
d0da6bab-fdac-4a39-9aeb-aaa0dab395c4 | haoliumilan/Agumon | frameworks/cocos2d-x/cocos/vr/CCVRDistortion.cpp | #include "vr/CCVRDistortion.h"
#include <math.h>
NS_CC_BEGIN
Distortion::Distortion()
{
_coefficients[0] = 0.441f;
_coefficients[1] = 0.156f;
}
void Distortion::setCoefficients(float *coefficients)
{
for (int i = 0; i < s_numberOfCoefficients; i++)
{
_coefficients[i] = coefficients[i];
}
... | TOOL | 0.910601 | 5.845209 |
08d72214-ac80-472f-96eb-8dfaf77fb419 | small-Qing/data-structure | 作业2/进制转换.cpp | #include<fstream>
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
//#include"stdafx.h"
using namespace std;
#define OVERFLOW -2
#define TRUE 1
#define FALSE 0
#define INFEASIBLE -1
#define ERROR 0
#define mod 2
/*************ջ**************/
typedef struct stack{
int *base,*top;
int size;
}qstack;
/*64λϣint4... | ALGO | 0.999895 | 3.156713 |
b2575685-359a-4531-9541-d9575e1d7585 | CoderJava/dipantau-desktop | 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.99887 | 6.783439 |
dec91f0e-3e61-4074-8dca-13752df81e8b | x1rh/ACAutomaton | leetcode/0033(搜索旋转排序数组)/0033(搜索旋转排序数组).cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
for(int i=0; i<nums.size(); ++i){
if(nums[i] == target){
return i;
}
}
return -1;
}
}; | ALGO | 0.999855 | 6.077305 |
360376b0-9999-49a0-988b-4fdbab6e0ef5 | xLoSyAsHx/algorithms | graphs/framework/framework.cpp | // framework.cpp : Defines the functions for the static library.
//
#include "framework.h"
#include "framework_impl.h"
std::deque<int> alg_topological_sort(Graph& G)
{
std::deque<int> v_topo_order;
std::vector<bool> v_visited(G.numV(), false);
int curIdx = (int)G.numV();
for (auto it = G.begin(); it ... | ALGO | 0.997379 | 5.986483 |
ac1d3014-03ec-4e06-969e-13d73f7c9764 | chandreyeeshome/CPP | ASSIGNMENT_6/Q6.cpp | //ASSIGNMENT 6 Q)6)
//Create a base class Shape with a virtual function area(). Create derived classes Circle
//and Rectangle from Shape, each overriding the area() function to calculate its specific
//area. Write a program to create objects of both Circle and Rectangle classes, call the
//area() function for each, an... | TOOL | 0.981238 | 4.302215 |
c04c3107-0a48-4613-8a39-3fe2b1c3d732 | roy7077/POTD-gfg | Binary representation of next number.cpp | // Time complexity - O(N)
// Space complexity- O(1)
class Solution {
public:
string binaryNextNumber(string s) {
for(int i=s.length();i>=0;i--)
{
if(s[i]=='0')
{
s[i]='1';
for(int j=0;j<s.length();j++)
{
... | ALGO | 0.999968 | 5.662222 |
4c250072-1c6c-49c2-806e-826a41bcc7e9 | donbasta/leetcode-submissions | Medium/729.cpp | class MyCalendar {
public:
set<pair<int, int>> events;
MyCalendar() {
}
bool book(int start, int end) {
auto ptr = events.lower_bound(make_pair(end, -1));
if (ptr == events.begin()) {
events.emplace(start, end);
return true;
}
--ptr;... | ALGO | 0.999728 | 6.198688 |
bdb45af3-b97e-4dde-a5b2-610ead77dc76 | gogogoeen/DS-implementation | Heap/heap.cpp | #include <iostream>
#include <vector>
using namespace std;
// Heap is a data structure with finding the maximum element with O(1) time
// Use a vector to realize implement heap
class heap {
public:
heap(){};
~heap(){};
void push(int key) {
heapstore.push_back(key);
swim(heapstore.size() - ... | ALGO | 0.998731 | 4.150577 |
9598121b-137b-46b7-8e32-32ef32ff3434 | EE109/L12C-Bubbles | .ccls-cache/@home@runner@L12CBubbles/main.cpp | /*********************************************
* Alabama A&M University - EE109 - Spring 2023
* Lesson 12 sample code: Arrays and Sorting
* By: Prof J Zehnpfennig, PE
* Created: 16 Februrary 2023
* Last Updated: 16 Februrary 2023
* Happy President's Day!
*********************************************/
... | ALGO | 0.999965 | 5.392987 |
26577227-30c6-4be6-bcb5-0e61751a152b | jintengtao/ardupilot | libraries/AP_Common/tests/test_sorting.cpp | #include <AP_gtest.h>
/*
tests for AP_Common/sorting.cpp
*/
#include <AP_Common/AP_Common.h>
#include <AP_Common/sorting.h>
#include <stdlib.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUX
typedef int (*compare_fn_t)(const void*, const void*);
static int comp16(const uint16_t *v... | TEST | 0.884986 | 7.416938 |
da20fa77-cbd2-4507-9b78-6606e9382551 | taemt94/Udacity_Self-Driving_Car_Engineer_Project | 5_Control_and_Trajectory_Tracking_for_Autonomous_Vehicles/project/pid_controller/eigen-3.3.7/doc/examples/tut_matrix_coefficient_accessors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << "Here is the matrix m:\n" << m << std::endl;
VectorXd v(2);
v(0) = 4;
v(1) = v(0) - 1;
std::cout << "Here is the vector v:\n... | ALGO | 0.998633 | 3.671318 |
464a6d43-562b-4d94-bcc5-a80e60786ccc | blackrangersoftware/BRS-TAXmoney-core | src/wallet/message_store.cpp | #include "message_store.h"
#include <boost/archive/portable_binary_iarchive.hpp>
#include <boost/format.hpp>
#include <boost/algorithm/string.hpp>
#include <fstream>
#include <sstream>
#include "file_io_utils.h"
#include "storages/http_abstract_invoke.h"
#include "wallet_errors.h"
#include "serialization/binary_utils.h... | TOOL | 0.863099 | 6.976689 |
3b5f2fa5-32d9-43cc-a79f-6214e5eaff33 | KyAnh1126/semaphore_application | producer_consumer.cpp | #include<stdlib.h>
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
#include<unistd.h>
#define THREAD_NUM 8
#define BUF_SZ 10
int buffer[BUF_SZ];
int count = 0;
pthread_mutex_t mutex;
sem_t sem_full; //if value <= 0, producer should not produce (buffer is full) and have to wait for consumer to consume som... | ALGO | 0.982284 | 4.611972 |
f2a3d479-dc30-4d9b-ac08-52f2597838c3 | Jackarain/avhttp | boost/libs/sort/example/wstringsample.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/string_sort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
using std::wstring;
using namespace boost::sort::spread... | ALGO | 0.998553 | 4.643817 |
6c493ff3-3091-447d-830e-6a2c91a4b622 | larcane97/coding_test_for_jobs | c++/message.cpp | #include <queue>
#include <vector>
#include <iostream>
using namespace std;
const int INF = 987654321;
vector<pair<int, int>>adj[30001];
void solve() {
int n, m, start;
cin >> n >> m >> start;
for (int i = 0; i < m; i++) {
int a, b, c;
cin >> a >> b >> c;
adj[a].push_back({ b,c });
}
vector<int>distance(n+1... | ALGO | 0.999895 | 3.942065 |
283c2f48-650d-4b85-ae03-b56c6d7186da | S-dev-coder/Striver-s_SDE_Sheet | Recursion/Q9.Sudoko_Solver.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isValid(vector < vector < char >> & board, int row, int col, char c) {
for (int i = 0; i < 9; i++) {
if (board[i][col] == c)
return false;
if (board[row][i] == c)
return false;
if (board[3 * (row / 3) + i / 3][3 * (col / 3) +... | ALGO | 0.999757 | 6.111763 |
5da89013-1860-4425-ba16-d22bcf7c9c24 | moof2k/golf | code/lib/bullet/Demos/ContinuousConvexCollision/ContinuousConvexCollisionDemo.cpp | /*
Continuous Convex Collision Demo demonstrates an efficient continuous collision detection algorithm.
Both linear and angular velocities are supported. Convex Objects are sampled using Supporting Vertex.
Motion using Exponential Map.
Future ideas: Comparison with Screwing Motion.
Also comparision with Algebraic... | ALGO | 0.997516 | 6.851807 |
165e7810-89d7-4a26-b41b-54e58d9079f2 | tinebp/vortex_pnnl | hw/syn/xilinx/test3/src/host.cpp | #include "cmdlineparser.h"
#include <iostream>
#include <cstring>
#include <unordered_map>
// XRT includes
#include "experimental/xrt_bo.h"
#include "experimental/xrt_ip.h"
#include "experimental/xrt_device.h"
#include "experimental/xrt_kernel.h"
#include "experimental/xrt_xclbin.h"
#define MMIO_CTL_ADDR 0x00
#defi... | TOOL | 0.902621 | 5.895247 |
f21052da-37bf-47ce-b9f5-42843d25e868 | ryutorion/LearningDirectX11OnWindows10 | 014_DiffuseReflection/014_DiffuseReflection.cpp | // 014_DiffuseReflection.cpp
#include <Windows.h>
#include <tchar.h>
#include <iostream>
#include <cstdlib>
#include <d3d11_3.h>
#include <dxgi1_4.h>
#include <d3dcompiler.h>
#include <DirectXMath.h>
#include <wrl/client.h>
#include "UsingConsole.h"
using namespace std;
using namespace Microsoft::WRL;
using namespace ... | TOOL | 0.852384 | 5.459472 |
e1c84a2a-efc9-4c22-a697-cb8ea7cd10a4 | geekcodershivam/My.HackerBlock.Solution | READ_THE_PAGES.cpp | #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;
bool isValid(ll arr[],ll n,ll mid,ll m){
ll sum=0;
ll count=1;
for(ll i=0;i<n;i++){
if(sum+arr[i]>mid){
count++;
if(count>m)
return false;
sum=arr[i];
}
else{
su... | ALGO | 0.999993 | 4.091705 |
e24f0950-deee-49f3-ad22-45e9ee954d8b | JuanPabl0CS/Programacion_II | Capitulo3/D75 C4.cpp | #include <iomanip>
#include <iostream>
int main()
{
float f { 123456789.0f };
std::cout « std::setprecision(9);
std: :cout « f « '\n';
return 0;
} | TOOL | 0.985997 | 3.810702 |
afd94a74-6d51-48d8-a1c0-dc003f906867 | b191832Anand/DAA | happyno.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n>1){
int num=n;
int sum=0;
while(num>0)
{
int l=num%10;
sum=sum+pow(l,2);
num=num/10;
}
n=sum;
co... | ALGO | 0.999953 | 3.98761 |
1ac24930-a271-4da0-83a2-a943392efe95 | KonstantinVyunov/Netology_Home_Work | Multithreaded.Async.Programming/5_Packaging_Application/Task_1/main.cpp | #include <iostream>
#include <map>
#include <algorithm>
#include <vector>
int main() {
std::string s{ "Hello world!!" };
std::cout << "[IN]: " << s << std::endl;
std::map<char, int> m;
for (auto s : s)
++m[s];
std::vector<std::pair<char, int>>vec;
for (auto x : m)
vec.push_back(... | ALGO | 0.953438 | 4.004912 |
2148949d-b2fa-4324-8c19-6811e26ace7e | Awadesh365/DSA | Learning stuffs/Two Pointers/CF Edu/Step 2/C_Number_of_Segments_with_Small_Sum.cpp | /* Awadesh Nautiyal */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
// For debugging
/*-------------------------------------------------*/
#ifndef ONLINE_JUDGE
#define debug(x) \
cerr << #x << " "; \
_print(x); \
... | ALGO | 0.999963 | 3.839648 |
f5a8bf2c-1553-4976-aa38-28bda07c87ef | HarshNarwariya/DSA | GeekForGeeks/Binary Search.cpp | // Given a sorted array of size N and an integer K, find the position at which K is present in the array using binary search.
class Solution {
public:
int binarysearch(int arr[], int n, int k) {
int l = 0, r = n - 1;
while (l <= r) {
int mid = l + (r - l) / 2;
if (arr[mid]... | ALGO | 0.999926 | 6.048665 |
93a810d7-762d-493a-8c6a-564eb87246be | LenkasetSong/blender | extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp | #include "btGjkConvexCast.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "btGjkPairDetector.h"
#include "btPointCollector.h"
#include "LinearMath/btTransformUtil.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define MAX_ITERATIONS 64
#else
#define MAX_ITERATIONS 32
#endif
btGjkConvexCast::btGjkConvexCast(... | ALGO | 0.998253 | 6.411278 |
bcdea914-0c85-4324-b67a-5a0f0df6e462 | rakib151p/CodeForces_Solution | B. Honest Coach.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int tc;
cin>>tc;
while(tc--)
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
sort(arr,arr+n);
int ans=abs(arr[0]-arr[1]);
for(int i=1;i<n;i++)
... | ALGO | 0.999525 | 4.588282 |
f99e4c93-3c0d-48e9-a28b-db3144a72138 | muhammadhasan01/cp | Practice CP ITB/Practice05/Elevator.cpp | #include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define inf INT_MAX
#define MOD 1000000007
#define MEM(a,b) memset(a,(b),sizeof(a))
#define forn(i,n) for(int i=0;i<int(n);i++)
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
ll F,S,G,U,D, ans =... | ALGO | 0.999966 | 3.279214 |
4ac33dae-4a32-4eaa-90e9-80516829ca56 | pr3300/DSA-Busted-Series | Lecture003 If-Else, While loop & Lots of Patterns/pattern2.cpp | #include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
int i = 1;
while(i<=n) {
int j = 1;
while(j<=n) {
cout << i;
j = j + 1;
}
cout<<endl;
i = i+1;
}
} | ALGO | 0.999907 | 3.778801 |
b9481ab9-4859-4a80-a1d9-042add7b0ec4 | naonao-cola/MyQt | qt5ch20/OpenCV_3.4.3-Source/modules/calib3d/src/epnp.cpp | #include <iostream>
#include "precomp.hpp"
#include "epnp.h"
namespace cv
{
epnp::epnp(const Mat& cameraMatrix, const Mat& opoints, const Mat& ipoints)
{
if (cameraMatrix.depth() == CV_32F)
init_camera_parameters<float>(cameraMatrix);
else
init_camera_parameters<double>(cameraMatrix);
number_of_corre... | ALGO | 0.999597 | 5.71637 |
abb8ac10-3cb7-4b6d-b03c-cc7b6619ba91 | abhitry/LearnADS | assignment_8/s1_q2.cpp | #include<iostream>
using namespace std;
class Matrix
{
public:
int **mat;
int n;
Matrix()
{
cout<<"enter number of vertices= ";
cin>>n;
mat=new int *[n];
for(int i=0;i<n;i++)
{
mat[i]=new int [n];
}
}
void create()
{
int... | ALGO | 0.998816 | 3.569015 |
e4df1374-3b31-4882-85bb-48b38ca55d9f | integraldx/snippets | algorithms/dijkstra.cpp | #include <algorithm>
#include <queue>
void dijkstra(int start)
{
nodes[start].calcWeight = 0;
priority_queue<pair<int, int>, vector<pair<int, int>>, cmp> pQueue;
pQueue.push({start, 0});
while(!pQueue.empty())
{
int current = pQueue.top().first;
int weight = pQueue.top().second;
... | ALGO | 0.999872 | 4.684052 |
4c97db73-22fc-4494-b0c7-2c950e6ed154 | askbk/kattis | boatparts/boatparts.cpp | #include <iostream>
#include <set>
#include <string>
int main(int argc, char const *argv[]) {
using namespace std;
set<string> replacedParts;
int N, P;
string input;
cin >> P >> N;
for (size_t day = 1; day <= N; day++) {
cin >> input;
replacedParts.insert(input);
if (re... | ALGO | 0.999783 | 4.468614 |
000624f9-dc7c-4d3b-8c79-9cef53fbe2a3 | Kalwinzi/Assessment- | TestDeletion.cpp | int main() {
BST tree;
insert(tree.root, 10);
insert(tree.root, 5);
insert(tree.root, 15);
tree.root = deleteNode(tree.root, 10);
inorder(tree.root);
return 0;
} | ALGO | 0.999561 | 4.642602 |
7c8e2183-d070-431a-b40b-cdca5c675f0c | PrateekRohilla/DSA-Fundamentals | string/validPalindrome.cpp | //https://leetcode.com/problems/valid-palindrome/
#include<iostream>
#include<string>
using namespace std;
bool validChar(char ch){
if((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9'))
return 1;
return 0;
}
char toLowercase(char ch){
if((ch >= 'a' && ch <= 'z... | ALGO | 0.998768 | 5.929253 |
ea0edc94-c23d-4bb3-8b87-2c01e01cf138 | nolan0801/Competitive-Programming | FreeContest/134/C.cpp | /*
Author : vidut_206_CNH
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define gcd(a,b) (__gcd(a,b))
#define lcm(a,b) (a/gcd(a,b)*b)
#define sz(x) (int)(x.size())
#define fast_cin() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#... | ALGO | 0.999741 | 4.835323 |
bac8fc9a-3782-4404-80c3-f21cddc5eed6 | atsb/gbQuake4 | src/tools/radiant/CSG.CPP | #include "precompiled.h"
#pragma hdrstop
#include "qe3.h"
const float PLANE_EPSILON = 0.0001f;
/*
=============
CSG_MakeHollow
=============
*/
void CSG_MakeHollow (void)
{
brush_t *b, *front, *back, *next;
face_t *f;
face_t split;
idVec3 move;
int i;
for (b = selected_brushes.next ; b != &selected_brus... | ALGO | 0.978829 | 4.213863 |
42cbca31-276c-4efc-b6cc-315bf45a0009 | kashika0112/DataStructuresProblems | Arrays/(E) Subarrays_Recursive.cpp | // Subarrays_Recursive.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
# include <vector>
using namespace std;
// Recursive function to print all possible subarrays
// for given array
void printSubArrays(vector<int> arr, int start, int end)
{
//... | ALGO | 0.983294 | 5.477534 |
9dcf5b84-c458-4b72-a003-be409eebd3a1 | wazenmai/Leetcode | Medium/1305_all_elements_in_two_binary_search_trees/solution1.cpp | /**
* Title: All Elements in Two Binary Search Trees (Leetcode Medium)
* Author: Bronwin Chen <<EMAIL>>
* Date: 26, Jan, 2022
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr)... | ALGO | 0.999995 | 6.003972 |
2e590da2-3718-4e03-a11b-c68492e21668 | shahnursicherheit/codeforces | B. Increase Decrease Copy.cpp | #include <bits/stdc++.h>
using namespace std ;
int main()
{
long t ;
cin >> t ;
while ( t-- )
{
long long n ;
cin >> n ;
long long target[n], destination[n+1], temp = 0, count = 0 ;
for ( int i = 0 ; i < n ; i++ )
{
cin >> target[i] ;
}
... | ALGO | 0.999961 | 3.625843 |
c4057af4-81c0-4c7f-8d92-6ae03a3b1293 | Koki-Yamaguchi/competitive-programming | codeforces/1529/a/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; (i) < (int) (n); (i) ++)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define dump(x) cerr << #x << " = " << x << '\n';
using ll = long long;
template<typename T, typename U> ostream& operator << (ostream& ... | ALGO | 0.998985 | 4.932332 |
71ee1c07-c5c6-4ef0-a7a4-1315378a0afe | rnrgll/codetree-TILs | 240926/특이한 출력/special-print.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int n;
cin >> n;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
cout << "(" << i << ", " << j << ")";
if((i+j)%4==0) cout << endl;
else cout << " ";
}
}
return 0;
} | ALGO | 0.994232 | 4.01952 |
829c6db2-9483-466d-92fe-1d847e41f66b | Phong13/cartwheel-3d | ode-0.9/ode/src/plane.cpp | /*
standard ODE geometry primitives: public API and pairwise collision functions.
the rule is that only the low level primitive collision functions should set
dContactGeom::g1 and dContactGeom::g2.
*/
#include <ode/common.h>
#include <ode/collision.h>
#include <ode/matrix.h>
#include <ode/rotation.h>
#include <ode/... | TOOL | 0.898997 | 6.918492 |
b0cdf804-c3ea-445d-ad86-d0a478b9caf2 | andyyang200/CP | Competitive Programming/Contests/CodeForces/Contests/Rounds/300s/Codeforces Round 308/Table/table.cpp | //Andrew Yang
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>... | ALGO | 0.994386 | 3.431941 |
fba69edf-c44d-4b22-963c-9393a2171322 | OstenHun/Algorithm_cpp | 250802/단어 정렬/sorting-words.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int n;
string word[100];
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> word[i];
}
sort(word, word+n);
for (int i = 0; i < n; i++) {
cout << word[i] << '\n';
}
return 0;
} | ALGO | 0.999926 | 5.05881 |
3230b3b7-8be4-48c6-936f-700b6fb830ce | joshlueth/Advent-of-Code | 2024/Day 7/Day7.cpp | #include "Day7.h"
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#include <algorithm>
int main()
{
std::string fileName {"input.txt"};
std::ifstream inputFile {fileName};
if (!inputFile)
{
std::cerr << "Input file " << fileName <... | ALGO | 0.995635 | 4.964953 |
913cf6b3-db8d-4acd-abc2-661915c4a717 | spatrickdoyle/Mandroids-Navigation | main.cpp | #include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <math.h>
#include <eigen3/Eigen/Dense>
#include <stdio.h>
#include <unistd.h>
#include <cstring>
#include <thread>
using namespace cv;
using namespace std;
double SafeAcos(double);
double SafeAsin(double);
vecto... | TOOL | 0.979857 | 3.891242 |
774f49e5-f73c-421d-a570-86c5e6309b71 | 24Pranav/Leetcode_practice | leetcode-main/leetcode-main/2707-extra-characters-in-a-string/2707-extra-characters-in-a-string.cpp | class Solution {
public:
set<string> words;
int dp[51];
int fun(int i,string &s)
{
if(i>=s.size())
return 0;
if(dp[i]!=-1)
return dp[i];
string tmp="";
int ans=s.size();
for(int j=i;j<s.size();j++)
{
tmp+=s[j];
... | ALGO | 0.999952 | 5.93326 |
77cd6ec6-fa56-4b99-bd85-55d9729e757a | gyenchev/openaplr-diplomna | openalpr/src/openalpr/detection/detector.cpp | #include "detector.h"
using namespace cv;
using namespace std;
namespace alpr
{
Detector::Detector(Config* config, PreWarp* prewarp) : detector_mask(config, prewarp)
{
this->config = config;
// Load the mask specified in the config if it exists
if (config->detection_mask_image.length() > 0 && fileEx... | TOOL | 0.914423 | 6.646317 |
694fb6a6-7c8b-4f62-836b-cef638333559 | Balaraju9/gfg | Difficulty: Medium/Reverse a Stack/reverse-a-stack.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
stack<int> fun(stack<int> st1,stack<int> st2){
if(st1.empty()){
return st2;
}
st2.push(st1.top());
... | ALGO | 0.999832 | 6.27774 |
cccae65c-cf9a-47e9-97d5-203c0a803fdd | strang3-r/Data-Structure | Odd_Even.cpp | // Odd_Even.cpp
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
using namespace std;
#define ff first
#define ss second
#define endl "\n"
#define ll long long
#define ld long double
#define l... | ALGO | 0.999925 | 4.821288 |
b6513eca-7e6d-4a97-b498-546df91c44c7 | Juliana127/CFBCursoss | curso_c++/aula089/aula089-7.cpp | #include <iostream>
#include <list>
using namespace std;
bool par(const int& value) {
return ((value%2)==0)/*0 para par, 1 para impar*/;
}
int main() {
//list<int>lst1 = {0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9};
list<int>lst1 = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
//lst1.remove(0);
lst1.remove... | ALGO | 0.997586 | 4.106071 |
91cf3f23-1d57-44a6-b458-f7c67712aa6c | CrimsonTheLegoBuilder/MyBaekjoonSolve | Cpp/boj_solve/boj1151_3D_convexhull.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
typedef long double ld;
const ld TOL = 1e-9;
int N, x1, y_1, z1, x2, y2, z2;
bool z(ld x) { return std::abs(x) < TOL; }
struct Pos {
ld x, y;
bool operator < (const Pos& p) const {
return z(p.x - x) ? y < p.y : x < p.x;
}
};
std::vector<P... | ALGO | 0.999024 | 3.957491 |
e6d54d2a-8fb3-4b3b-a356-c03ca8ec3f27 | sudhirskp/ds-in-c | 7thSemTraning/Graph/fordFulkerson.cpp | #include<iostream>
#include <vector>
#include <queue>
#include <stack>
#include <limits.h>
using namespace std;
typedef pair<int, int> pii;
class Graph {
struct Edge {
int v;
int flow;
int cap; // capacity
int rev; // index of the reverse edge in the adjacency list
};
int ... | ALGO | 0.999967 | 5.815772 |
99bc95cf-13d6-44ae-8c0c-7ba86d389e21 | Sector7CSD/s7cal | src/utils.cpp | //
// Created by chris on 24.05.25.
//
#include "utils.h"
std::string Utils::stripAnsiEscapeCodes(const std::string &input)
{
static const std::regex ansi_regex(R"(\x1B\[[0-9;]*[A-Za-z])");
return std::regex_replace(input, ansi_regex, "");
}
std::vector<std::string> Utils::mergeColumnsWithPadding(const std::... | TOOL | 0.901358 | 5.971791 |
2d3714a6-6d8f-44e8-99fa-e744fc785d51 | s-ryuri/BOJ | 2206.cpp | #include <iostream>
#include <queue>
#include <string>
using namespace std;
string board[1002];
int dx[4] = { 0,0,-1,1 };
int dy[4] = { -1,1,0,0 };
//int dx[4] = { -1, 0, 1, 0 };
//int dy[4] = { 0, 1, 0, -1 };
//int dx[] = { 0, 0, 1, -1 };
//int dy[] = { 1, -1, 0, 0 };
int check[1002][1002][2] = { 0, }; //x,y,z의 거리를 ... | ALGO | 0.999962 | 4.727871 |
a69b0c18-5b38-42b5-9014-eeb08971a2f2 | cantaloupe137/homework | 程設練習/陣列/4. 是否有元素不小於n.cpp | //求一大小為n的整數陣列中,是否有任一元素之值不小於n?
#include<iostream>
using namespace std;
int main() {
int n;
bool find = false;
cin >> n;
int* arr = new int[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = 0; i < n; i++) {
if (n <= arr[i]) {
find = true;
break;
}
}
if (find) cout << "yes" << endl;
... | ALGO | 0.999755 | 3.72091 |
c0fae1a0-0c13-4ed3-a74d-a96013628161 | caz2114/robotic_laundry | ros_ws/src/opencv-3.2.0/apps/createsamples/utility.cpp | #include <cstring>
#include <ctime>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef _WIN32
#include <direct.h>
#endif /* _WIN32 */
#include "utility.hpp"
#include "opencv2/core.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/imgcodecs/imgcodecs_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2... | TOOL | 0.989982 | 4.720349 |
4a85e30a-befd-420d-96a6-fcce77ca43a5 | fryzito/ACM-problems-solved | UVA/UVA_11342.cpp | #include <cstdio>
#include <set>
#include <ctime>
#include <iostream>
using namespace std;
#define dbg(x)cout<<#x<<"="<<x<<endl
#define S(x)scanf("%d\n",&x)
#define P(x)printf("%d\n",x)
struct T{
int a,b,c;
T(){a=-1;b=-1;c=-1;}
};
bool visited[50001];
T R[50001];
int A[250];
int main(){
int n;S(n);
int k;
for... | ALGO | 0.999471 | 3.148703 |
15a710ab-4aef-46b6-a00e-3b38da750c8d | Mayza-BR/Curso-LogicaDeProgramacao | Exercícios em C/Lista 8 - Exercícios/Exercício 1B.cpp | //EX 1.B
#include <stdio.h>
#include <string.h>
#define MAX 20
typedef struct {
char nome[50];
float notas[4];
float media;
} Aluno;
Aluno alunos[MAX];
int total = 0;
void cadastrar() {
for (int i = 0; i < MAX; i++) {
printf("Digite o nome do aluno: ");
scanf(" %[^"]s", alunos[i].nom... | TOOL | 0.92627 | 4.670876 |
f398b0a3-466b-4f9d-ac26-f4fee02ad43d | jonibd/cpp-programming | problem19.cpp | #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
int t,v,dis;
cin>>t>>v;
dis = (t*v);
double tl = (dis/12.0);
cout<<fixed<<setprecision(3)<<tl<<endl;
return 0;
}
| ALGO | 0.993542 | 3.499621 |
f270cc42-a0d3-48d7-86c7-dbd8d04b41fd | BhaswatiRoy/Datastructures-Algorithms | Datastructures/Linked List/Rotate Linked List.cpp | class Solution {
public:
ListNode* rotateRight(ListNode* head, int k)
{
if(head==NULL || head->next==NULL || k==0)
{
return head;
}
ListNode* temp=head;
int sz=1;
while(temp->next!=NULL)
{
sz++;
temp=temp->next;
... | ALGO | 0.999966 | 5.746347 |
2b11838c-60f4-4da6-9a97-ce6009ab8bd7 | gafeol/competitive-programming | Contests/MAC326/23/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(st... | ALGO | 0.999978 | 3.236412 |
3bd98bed-7f71-4054-b2fd-2c0c5beade01 | ivanrafli14/CP-Archives | OSN 2008.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int cnt = 1;
int index=0;
while(cnt <= n){
index+=cnt;
cout << index << endl;
cnt++;
}
}
| ALGO | 0.999606 | 3.954592 |
a60fe3cd-55fd-4f57-a947-264976ea7058 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00145/poker/poker.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int n;
bool poker[100];
int addsingle(char b) {
if (b == 'A')
return 0;
if (b == 'T')
return 9;
if (b == 'J')
return 10;
if (b == 'Q')
return 11;
if (b == 'K')
return 12;
return b - '1';
}
void add... | ALGO | 0.999137 | 4.02721 |
0e5b9696-8c9d-4720-9f06-b8489ced2082 | mohdzaid123/Leetcode | 0091-decode-ways/0091-decode-ways.cpp | class Solution {
public:
int t[101];
int solve(int i,string &s,int &n){
if(t[i]!=-1){
return t[i];
}
if(i==n){
return t[i]=1; //one valid
}
if(s[i]=='0'){
return t[i]=0; //not possible
}
int result=sol... | ALGO | 0.999813 | 6.061727 |
312cb27e-8bec-40c6-bc2b-532d9f0ff5db | vany152/FilesHash | console/src/boost_1_78_0/libs/graph/test/dijkstra_cc.cpp | #include <boost/config.hpp>
#include <boost/concept_archetype.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/dijkstra_shortest_paths_no_color_map.hpp>
#include <boost/graph/graph_archetypes.hpp>
typedef boost::default_constructible_archetype<
boost::sgi_assignable_archetype<> >
d... | TEST | 0.974236 | 4.78237 |
12e86273-34a4-4faf-8c6f-6f3d7eff906e | ishandutta2007/codeforces | dancho/normal/547/A.cpp | #include <cstdio>
#include <cstring>
long long gcdex (long long a, long long b, long long & x, long long & y) {
if (a == 0) {
x = 0; y = 1;
return b;
}
long long x1, y1;
long long d = gcdex(b%a, a, x1, y1);
x = y1 - (b / a) * x1;
y = x1;
return d;
}
int m;
long long h1, a1, x1... | ALGO | 0.999989 | 3.498533 |
af6890d8-434b-47a7-8200-5e3dcab7e322 | silverpoetry/ProjectCF | Libraries/Adafruit_VL53L0X/1.0.5/Adafruit_VL53L0X/src/core/src/vl53l0x_api_calibration.cpp | #include "../../vl53l0x_api.h"
#include "../../vl53l0x_api_core.h"
#include "../../vl53l0x_api_calibration.h"
#ifndef __KERNEL__
#include <stdlib.h>
#endif
#define LOG_FUNCTION_START(fmt, ...) \
_LOG_FUNCTION_START(TRACE_MODULE_API, fmt, ##__VA_ARGS__)
#define LOG_FUNCTION_END(status, ...) \
_LOG_FUNCTION_END(TRACE... | TOOL | 0.980929 | 5.850217 |
529c1b0f-5df5-4064-8774-0edd9c31e8f5 | bhartik021/6Companies30Days | Company-3-[Adobe]/581. Shortest Unsorted Continuous Subarray.cpp | class Solution {
public:
int findUnsortedSubarray(vector<int>& nums) {
int n = nums.size();
if(n <= 1) return 0;
vector<int> sorted = nums;
sort(sorted.begin(), sorted.end());
int start = -1, end = -1;
for(int i = 0; i < n; ++i){
if(nums[i] != sor... | ALGO | 0.999925 | 6.028455 |
1630535f-c24f-4789-b800-6995e57f4b6a | hitesh19426/Leetcode | 1137-n-th-tribonacci-number/1137-n-th-tribonacci-number.cpp | class Solution {
public:
int dp[38];
Solution(){
dp[0] = 0, dp[1] = 1, dp[2] = 1;
for(int i=3; i<38; i++){
// cout << dp[i-3] << " " << dp[i-2] << " " << dp[i-1] << endl;
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
}
}
int tribonacci(int n) {
re... | ALGO | 0.999887 | 5.278169 |
94b73187-b7fd-4918-bcf5-a875c0b78317 | 1SergiuF/12th-grade-computer-science | Excelenta/HLD/heavy_light_decomposition.cpp | // Heavy-Light Decompozition (HLD)
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream fin("heavypath.in");
ofstream fout("heavypath.out");
const int NMAX = 100001;
int n, q;
int val[NMAX], level[NMAX], father[NMAX];
int tree[4 * NMAX]; // arborele de intervale - retine toate... | ALGO | 0.999963 | 4.348592 |
f1730cc3-27fb-4170-b6b2-af286924ab11 | RahulScripted/CodeChef | Practice-CPP-CodeChef/Strings/AddingTheLength.cpp | // Create a program to calculate and display the total length of two specified words: Naruto and Sasuke.
#include <iostream>
using namespace std;
int main() {
string name1 = "Naruto";
string name2 = "Sasuke";
cout<<name1.length() + name2.length();
}
// Output: 12 | TOOL | 0.995511 | 4.253585 |
afe83779-211d-4fed-a395-4d9193ce961b | 7oSkaaa/CP-Templates | MO_Tree.cpp | #include <bits/stdc++.h>
using namespace std;
#define fixed(n) fixed << setprecision(n)
#define ceil(n, m) (((n) + (m) - 1) / (m))
#define add_mod(a, b, m) (((a % m) + (b % m)) % m)
#define sub_mod(a, b, m) (((a % m) - (b % m) + m) % m)
#define mul_mod(a, b, m) (((a % m) * (b % m)) % m)
#define all(vec) vec.begin(), ... | ALGO | 0.999924 | 4.820106 |
ed48bebf-e538-4cc6-99d7-9d0fc97d48e5 | ArsenyPogosov/olympiad_programs | codeforces/Сервал и подвешенное дерево.cpp | //source:
//status: coding
#include <bits/stdc++.h>
using namespace std;
//#define f_io
#pragma region switch_io
#ifdef f_io:
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
#endif
#pragma endregion
int n;
vector<list<int>> Graph;
vector<int> reg, dp;
const int INF = 100000... | ALGO | 0.99916 | 4.029317 |
3863f2f4-8e04-4959-820f-569efbc2d9b0 | ishandutta2007/codeforces | zscoder/normal/993/D.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long ... | ALGO | 0.999987 | 3.399523 |
20391c04-1d7c-49c9-a135-b492a28b5c21 | Vortexx2/DSA-questions | leetcode/easy/938-range-sum/rec.cpp | /**
* @file rec.cpp
* @author Vortexx2
* @brief Problem 938 - Range Sum of BST
* @date 03-09-2021
*
* Runtime - 116 ms
* Memory Usage - 64.8 MB
*/
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr),... | ALGO | 0.999992 | 6.753839 |
8832c60e-9bd0-44a7-b130-c4c27414f30e | vikashpatel07/KIET_PPP | 229-majority-element-ii/229-majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
vector<int>res;
int count1=0,count2=0,cand1=-1,cand2=-1;
for(int i=0;i<nums.size();i++){
if(nums[i]==cand1)count1++;
else if(nums[i]==cand2)count2++;
else if(count1==0){
... | ALGO | 0.99998 | 5.522262 |
4e2d6cab-84ea-44d6-9027-a0716f295a2a | mukailee/Silver-farm-care-service-Seoul-Hardware-Hackathon-2020- | simple-mbed-cloud-client/mbed-cloud-client/source/ConnectorClient.cpp | // fixup the compilation on ARMCC for PRId32
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include "include/ConnectorClient.h"
#include "include/CloudClientStorage.h"
#include "include/CertificateParser.h"
#ifndef MBED_CLIENT_DISABLE_EST_FEATURE
#include "include/EstClient.h"
#endif // !MBED_CLIENT_DISABLE_EST_... | TOOL | 0.896473 | 4.583525 |
1e8a61ce-7c4d-4120-a475-f7baa2f96480 | Exaynts/Small_Programs | Heapsort.cpp | #include <iostream>
#include <vector>
using namespace std;
void print(vector <int>&A, int n) {
for (int i = 0; i < n; i++) {
cout << A[i] << " ";
}
cout << endl;
}
// Выстраивание элементов массива в виде сортирующего дерева
void Tree(vector <int> &A, int n, int k) {
// Для i = 2*i + 1
int ... | ALGO | 0.999982 | 4.300076 |
89111e80-e53a-436a-a992-f86899277d05 | srestrep74/DSA | two_pointers/#4.Merge_Strings_Alternately.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI acos(-1)
#define mp make_pair
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fornr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define um unordered_map
using pii = pa... | ALGO | 0.999955 | 4.45899 |
ee25de1c-4a17-434e-a393-adf3b51d4308 | Sameer-Pattnaik/leetcode | 2150-kth-smallest-product-of-two-sorted-arrays/2150-kth-smallest-product-of-two-sorted-arrays.cpp | static long long floor_div(long long x, long long y) {
long long d = x / y;
if ((x ^ y) < 0 && x % y) --d;
return d;
}
static long long ceil_div(long long x, long long y) {
long long d = x / y;
if ((x ^ y) >= 0 && x % y) ++d;
return d;
}
class Solution {
public:
long long kthSmallestProduc... | ALGO | 0.999971 | 5.015735 |
028b9ad6-f9b4-4d20-8563-170b72aa9108 | boxuLibrary/drt-vio-init | thirdparty/eigen/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.999398 | 3.093769 |
0390b7ea-835d-4c8d-ac0f-ac69fadafee8 | pepstack/skia-build-msvc | src/core/SkMaskBlurFilter.cpp | #include "SkMaskBlurFilter.h"
#include <cmath>
#include "SkMakeUnique.h"
#include "SkSafeMath.h"
static const double kPi = 3.14159265358979323846264338327950288;
static uint64_t weight_from_diameter(uint32_t d) {
uint64_t d2 = d * d;
uint64_t d3 = d2 * d;
if ((d&1) == 0) {
// d * d * (d + 1);
... | TOOL | 0.931849 | 7.342 |
bd151df9-cd34-4a9c-9ead-a2d07f6dcdf1 | ShadowCore/ShadowCore | 3.3.5/dep/g3dlite/source/PrecomputedRandom.cpp | #include "G3D/PrecomputedRandom.h"
#include "G3D/System.h"
namespace G3D {
PrecomputedRandom::PrecomputedRandom(int dataSize, uint32 seed) :
Random((void*)NULL),
m_hemiUniform(NULL),
m_sphereBits(NULL),
m_modMask(dataSize - 1),
m_freeData(true) {
alwaysAssertM(isPow2(dataSize), "dataSize must be a power of... | ALGO | 0.953012 | 6.501557 |
557ed0e3-4557-4b91-a524-5667b57a4bc5 | musafci/lightoj | dimik/Small-to-Large.cpp | // Problem: https://lightoj.com/problem/dimik-small-to-large
// Solution #01:
#include <iostream>
using namespace std;
int main() {
int t, n1, n2, n3, temp;
cin >> t;
for (int i = 1; i <= t; i++)
{
cin >> n1 >> n2 >> n3;
if (n1 > n2) {
temp = n1;
n1 = n2;
... | ALGO | 0.999968 | 5.784075 |
8e143a3b-bb20-48a9-a4d5-d339f54c67ba | Dodi029/ObjectOrientedLanguage_SchoolWork2022 | CHAP10/10-1.cpp | // 제네릭 myswap() 함수 만들기
#include <iostream>
using namespace std;
class Circle{
int radius;
public:
Circle(int radius=1){
this->radius=radius;
}
int getRadius(){
return radius;
}
};
template <class T>
void myswap(T & a, T & b){
T tmp;
tmp=a;
a=b;
b=tmp;
}
int main(){... | ALGO | 0.99363 | 5.468634 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.