uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8bac4b1b-68ff-4cc2-8941-b2d96bb55068 | D0MI-1/Leetcode | 1704. Determine if String Halves Are Alike/solution.cpp | #include <string>
class Solution {
public:
bool halvesAreAlike(std::string s) {
int length = s.size();
int half = length / 2;
std::string firstHalf = s.substr(0, half);
std::string secondHalf = s.substr(half);
int vowelFH = 0;
int vowelSH = 0;
for(int i = ... | ALGO | 0.999821 | 6.21277 |
3184b719-441f-49d5-b955-4585e735c3a8 | maspypy/library | test/2_library_checker/data_structure/range_kth_smallest_wavelet.test.cpp | #define PROBLEM "https://judge.yosupo.jp/problem/range_kth_smallest"
#include "my_template.hpp"
#include "other/io.hpp"
#include "ds/wavelet_matrix/wavelet_matrix.hpp"
void solve() {
LL(N, Q);
VEC(int, A, N);
Wavelet_Matrix<int, false> WM(A);
FOR(Q) {
LL(l, r, k);
print(WM.kth(l, r, k));
}
}
signed ... | ALGO | 0.999779 | 4.620371 |
3c4da28f-6a88-4a1a-87a2-5824952e600c | wisdompeak/LeetCode | Two_Pointers/1775.Equal-Sum-Arrays-With-Minimum-Number-of-Operations/1775.Equal-Sum-Arrays-With-Minimum-Number-of-Operations.cpp | class Solution {
public:
int minOperations(vector<int>& nums1, vector<int>& nums2)
{
int sum1 = accumulate(nums1.begin(), nums1.end(), 0);
int sum2 = accumulate(nums2.begin(), nums2.end(), 0);
if (sum1 < sum2)
return minOperations(nums2, nums1);
int diff = s... | ALGO | 0.999987 | 5.404913 |
6f2bda16-a375-42dc-9946-cb3325dd92ec | Charles-Chao-Chen/H-Matrix-Inverse | tests/solve.cpp | #include <iostream>
#include <vector>
#include <stdio.h>
#include "hmat.hpp"
#include "iterativeSolver.hpp"
#include "helperFun.hpp"
// form the sparse matrix for the laplacian operation using
// five point finite difference scheme
Eigen::MatrixXd Laplacian(int nx, int ny);
// output vector object (for debugging pu... | ALGO | 0.999887 | 4.638183 |
510ff07b-8e5b-47f4-b687-a179a2e32ef3 | Resident-Deep-Foundation/foundationdb | fdbserver/Ratekeeper.actor.cpp | #include "fdbclient/ClientKnobs.h"
#include "fdbserver/DataDistribution.actor.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/Ratekeeper.h"
#include "fdbserver/TagThrottler.h"
#include "fdbserver/WaitFailure.h"
#include "fdbserver/QuietDatabase.h"
#include "flow/OwningResource.h"
#include "flow/actorcompiler.h" //... | TOOL | 0.906934 | 5.035443 |
a562842e-7dc6-43a3-ad6e-c85c91ebe50a | MengLiuPurdue/graph_lib | graph_lib/lib/graph_check.cpp | #ifdef GRAPH_CHECK_HPP
#include <unordered_set>
#include <iostream>
#include <vector>
#include "include/graph_check.hpp"
using namespace std;
#define TRUE 0
#define FALSE 1
template<typename vtype, typename itype>
bool check_symmetric(vtype *ei, vtype *ej, itype m, vtype n)
{
vector< unordered_set<vtype> > grap... | ALGO | 0.965501 | 5.337444 |
8ac40ad8-cbbf-4247-962c-bfae58e6962d | Nedib1/LabBFU-cpp | Labs/1sem/lab_6/lab_6.2/mainlab6z2.cpp | #include <iostream>
int pervone(int num) {
while (num >= 10) {
num /= 10;
}
return num;
}
int sumdigits(int num) {
int sum = 0;
while (num > 0) {
sum += num % 10;
num /= 10;
}
return sum;
}
void sort(int a[], int n) {
for (int i = 0; i < n - 1; i++) {
... | ALGO | 0.999981 | 5.744937 |
bbf5b398-3267-4fba-afcd-73ed0fc0c121 | INFORMSJoC/2023.0089 | src/source_code/circle_packing/main.cpp | #include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "cg_user.h"
#include "Common.h"
int main (int argc, char *argv[])
{
int i ;
int runs;
double Results[100];
double f_best, f_avg, f_worst, sigma, AvgTime ;
srand(time(NULL));
N = atoi(argv[1]);
Input_File_Name = ar... | ALGO | 0.999936 | 4.62951 |
db8ac48c-34ca-483f-b4c4-2bc1e2115305 | Karelito00/problems | Codeforces/835A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long s,v1,v2,t1,t2;
cin>>s>>v1>>v2>>t1>>t2;
if((s*v1) + (2*t1) < (s*v2) + (2*t2))
cout<<"First";
else if((s*v1) + (2*t1) > (s*v2) + (2*t2))
cout<<"Second";... | ALGO | 0.999788 | 3.507251 |
25cbaef0-f408-498d-8bbe-cc4ec0e849bb | waterdorm/bailian | 2744/2744+.cpp | #include <stdio.h>
#include <string.h>
int t, n;
char str[100][101];
void strrev(char* str)
{
int i,len;char c;
len=strlen(str);
for(i=0;i<len/2;i++)
{
c=str[i];
str[i]=str[len-1-i];
str[len-1-i]=c;
}
str[len]='\0';
}
int searchMaxSubString(char* source) {
int subStrLen = strlen(source), sourceStrLen = strlen(sourc... | ALGO | 0.999853 | 3.920658 |
2daa58b9-a931-4cdc-b70f-26fcd5e51b2a | pathan13913/Codeforces | 1760A__Medium_Number.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+3);
cout<<arr[1]<<endl;
}
return 0;
} | ALGO | 0.99992 | 3.650619 |
37125a28-a75e-40da-a674-e457973bc14b | saitej09/objviewer | streamFunctions.cpp |
std::string trimline(string& str)
{
std::size_t first = str.find_first_not_of(' ');
std::size_t last = str.find_last_not_of(' ');
return str.substr(first, (last-first+1));
}
std::vector<string> splitline(string input, char delimiter)
{
vector<string> output;
size_t start = 0;
size_t end ... | TOOL | 0.972353 | 5.213909 |
de81c433-a5b6-45a0-a20c-681d54f1c35b | binazersy/gnolleater | cpp/tetris/tetris.cpp | #include <SFML/Graphics.hpp>
#include <time.h>
using namespace sf;
const int M = 20;
const int N = 10;
int field[M][N] = {0, };
struct Point
{
int x, y;
} a[4], b[4];
int colorNum = 0;
/*
0 1
2 3
4 5
6 7
*/
int figures[7][4] =
{
1, 3, 5, 7,
2, 4, 5, 7,
3, 5, 4, 6,
3, 5, 4, 7... | ALGO | 0.989644 | 5.176568 |
9a56bc21-2f52-4a0f-8482-365ed4531b31 | raincross7/code-similarity | codes/train_code/problem183/problem183_341.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MAX = 1100000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
... | ALGO | 0.999992 | 4.38174 |
5e34633f-2411-4f68-a6f8-876b0db51f17 | wujunyan1/LearnOpenCV | LearnOpenCV/assimpCode/PostProcessing/ComputeUVMappingProcess.cpp | /** @file GenUVCoords step */
#include "ComputeUVMappingProcess.h"
#include "ProcessHelper.h"
#include <assimp/Exceptional.h>
using namespace Assimp;
namespace {
const static aiVector3D base_axis_y(0.0,1.0,0.0);
const static aiVector3D base_axis_x(1.0,0.0,0.0);
const static aiVector3D base_axis_z(0.0,0.... | ALGO | 0.972262 | 7.537304 |
a43528dc-43a5-4306-95d9-7e6277ec090e | girishb007/CMPE_283_HyperVisor-VM-Prototype | snapshot/snapshot.cpp | #include <fstream>
#include <vector>
void dump_vector(const std::vector<int>& v, const std::string& filename) {
std::ofstream out(filename);
if (out.is_open()) {
for (auto it = v.begin(); it != v.end(); ++it) {
out << *it << "\n";
}
out.close();
}
}
std::vector<int> ret... | TOOL | 0.91693 | 5.833249 |
a3c953d1-efce-4fad-b087-237b1042a762 | freeDevelope/Android_Things_Iot_HyperLPR4Android | hyperlpr_android/src/main/cpp/src/PlateDetection.cpp | //
// Created by 庾金科 on 20/09/2017.
//
#include "../include/PlateDetection.h"
#include "util.h"
namespace pr{
PlateDetection::PlateDetection(std::string filename_cascade){
cascade.load(filename_cascade);
};
void PlateDetection::plateDetectionRough(cv::Mat InputImage,std::vector<pr::PlateInfo> ... | TOOL | 0.920834 | 4.738852 |
406e5b52-549a-49f6-b68b-8bdd48932117 | Ujjwal-0/Competitive-Codes | 144-A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input1.txt", "r", stdin);
freopen("output1.txt", "w", stdout);
#endif
int n;
cin >> n;
if (n % 2 == 0) {
for (int i = 1; i <= n; i++) {
if (i % 2 == 0) {
cout << i - 1 << " ";
}
else {
cout << i + 1 << " ";
... | ALGO | 0.999964 | 4.41179 |
24188747-55b1-42f8-b0e5-85dd7e3d1d54 | stearsail/Quizzer | ragbot_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998636 | 6.76073 |
dab38179-ee9f-4f03-9f32-911b6fcd98d9 | ishandutta2007/codeforces | neko_nyaaaaaaaaaaaaaaaaa/normal/1516/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n, k, t;
cin >> t;
while (t--) {
cin >> n >> k;
vector<int> a(n, 0);
for (int i = 0 ; i < n ; i++) {
cin >> a[i];
}
for (int j = 0 ; j < k ; j++) {
for (int i = 0 ; i < n ; i++) {
if (a[i] > 0) {
a[i]--;
a[n... | ALGO | 0.999958 | 3.47565 |
0d1ec724-8478-4211-b885-8093dbb47c91 | sakiib/competitive-programming-code-library | DS & Algo Implementation/Data Structure/Interval Handling/Football Set of Segments.cpp | #include <bits/stdc++.h>
using namespace std;
#define Fast_IO ios_base::sync_with_stdio(0); cin.tie(0);
#define ff first
#define ss second
#define mp make_pair
typedef long long int LL;
const int inf = 2e9;
int n , k , q;
set < pair <int,int> > S;
/**
S contains only the free segments
initially free : ( k + 1 , n... | ALGO | 0.999687 | 3.800106 |
411d1500-404c-4273-b907-c00e21f3716d | ABHINAB-CHHETRI/DataStructure-Cpp | stringconcat.cpp | #include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
class solution
{
private:
string str;
public:
solution(string str)
{
this->str = str;
}
~solution() {}
void show()
{
cout << this->str << endl;
}
solution operator+(solution soln)
{
... | TOOL | 0.931158 | 3.751913 |
ba1bf080-caef-4096-a402-3aaacb1f842c | SuyashJoshi179/ProgramsForProblems | codeforces/Edu 119/A.cpp | #include <bits/stdc++.h>
#include <random>
#include <fstream>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<double, double> pd;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll... | ALGO | 0.999825 | 5.505288 |
346ab83e-c8d4-4e40-88cb-3c76133ee00b | Apoorv070/Leetcode_DSA_sheet_by_FRAZ | Arrays/Medium/next_permutation.cpp | //https://leetcode.com/problems/next-permutation/
class Solution {
public:
void nextPermutation(vector<int>& nums) {
int leni = nums.size();
int j;
int idx1 = 0,idx2 = 0 ;
for(j = leni-1 ; j>0 ; j--){
if(nums[j]>nums[j-1]){
idx1 = j-1;
brea... | ALGO | 0.999955 | 5.508468 |
a596f1d5-58a7-4b4c-ac01-a840e4fbaada | tusharmishra069/DSA-Questions | 3656-minimum-number-of-operations-to-make-elements-in-array-distinct/3656-minimum-number-of-operations-to-make-elements-in-array-distinct.cpp | class Solution {
public:
int minimumOperations(vector<int>& nums) {
unordered_set<int> seen;
for (int i = nums.size() - 1; i >= 0; --i)
if (!seen.insert(nums[i]).second)
return (i + 1 + 2) / 3;
return 0;
}
}; | ALGO | 0.999888 | 6.149567 |
3673c772-837c-47d1-9768-425749c2789f | sarvex/leetcode-rect | solution/0100-0199/0151.Reverse Words in a String/Solution.cpp | class Solution {
public:
string reverseWords(string s) {
int i = 0;
int j = 0;
int n = s.size();
while (i < n) {
while (i < n && s[i] == ' ') {
++i;
}
if (i < n) {
if (j != 0) {
s[j++] = ' ';
... | ALGO | 0.999997 | 6.193157 |
7892c94f-b24c-4493-bf52-fd6d913626e8 | conlacda/algo-practice | atcoder/Educational DP Contest/O - Matching.cpp | // https://atcoder.jp/contests/dp/tasks/dp_o
#pragma GCC optimize("O3") // optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
typedef long long ll; // double long double
const ll mod = 1000000007;
#define int long long // __int128
const int INF = std::numeric_limits<int>::max(); // INT32_MAX DBL_MAX
using namesp... | ALGO | 0.999979 | 4.815711 |
68e76a02-4612-43fe-946e-bbcf9c7f88af | chungers/lab616 | third_party/cpp/boost_1_46_1/libs/icl/example/party_/party.cpp | #include <iostream>
#include <boost/icl/interval_map.hpp>
#include "../toytime.hpp"
using namespace std;
using namespace boost::icl;
/**
Party.cpp demonstrates the possibilities of an interval map (interval_map or
split_interval_map). An interval_map maps intervals to a given content. In
this case the co... | ALGO | 0.991958 | 6.800165 |
3e65164e-1cc4-42a5-96f8-f088f3f9ba72 | m090009/CarND-MPC | src/Eigen-3.3/bench/spmv.cpp |
//g++-4.4 -DNOMTL -Wl,-rpath /usr/local/lib/oski -L /usr/local/lib/oski/ -l oski -l oski_util -l oski_util_Tid -DOSKI -I ~/Coding/LinearAlgebra/mtl4/ spmv.cpp -I .. -O2 -DNDEBUG -lrt -lm -l oski_mat_CSC_Tid -loskilt && ./a.out r200000 c200000 n100 t1 p1
#define SCALAR double
#include <iostream>
#include <algor... | ALGO | 0.948801 | 4.293816 |
1db1bef0-c3c4-40e3-9760-519022892fce | sinkyoungdeok/Algorithm | boj_code/2500/2506.cpp | #include <iostream>
using namespace std;
int main()
{
int n = 0;
cin >> n;
int jumsu = 0;
int sum = 0;
for (int i = 0; i < n; i++)
{
int num = 0;
cin >> num;
if (num == 1)
{
jumsu++;
sum = sum + jumsu;
}
else
{
jumsu = 0;
}
}
cout << sum << endl;
return 0;
}
| ALGO | 0.999935 | 3.435304 |
e3e694ec-e5c2-4067-8e0e-fb243d74e516 | riAnriAn0/EdD_1 | C/codigos/ponteiro/q26.cpp | #include <stdio.h>
#include <math.h>
void baskara(float A, float B, float C, float delta, float *X1, float *X2)
{
*X1 = (((-1 * B) + sqrt(delta)) / (2 * A));
*X2 = (((-1 * B) - sqrt(delta)) / (2 * A));
}
int raizes(float A, float B, float C, float *X1, float *X2)
{
if (A == 0)
{
return -1;
... | ALGO | 0.999203 | 3.985367 |
bcf2d580-a50b-43e0-99d3-328d3cb4147f | ishandutta2007/codeforces | aropan/normal/30/A.cpp | #include <cstdio>
#include <cmath>
#define abs(x) (x < 0? -x : x)
using namespace std;
int a, b, n;
int x;
int main()
{
/*
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
//*/
scanf("%d %d %d", &a, &b, &n);
for (int i = -1000; i <= 1000; i++)
{
int x = a;
for (int j = 0... | ALGO | 0.999991 | 3.743568 |
a0e23e22-cebe-4fbf-bf5f-697bdd557e9d | Yosuamuliawan19/algorithm-bank | Codeforces/674/dpgreedy/o.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
ll tc, n, m;
ll arr[110][110];
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> tc;
while (tc--){
cin >>... | ALGO | 0.999774 | 3.364282 |
e43f141d-2b6a-42fa-8867-a0fb01504f03 | ToymanShikhar/dsa-bootcamp | 2021/24nov/Leetcode/123.best-time-to-buy-and-sell-stock-iii.cpp | #include <bits/stdc++.h>
using namespace std;
/*
* @lc app=leetcode id=123 lang=cpp
*
* [123] Best Time to Buy and Sell Stock III
*/
// @lc code=start
class Solution {
public:
int find(vector<int>& prices, int curr, bool canBuy, int tranCount, int dp[100001][2][3]) {
if (curr >= prices.size() or tr... | ALGO | 0.999573 | 6.161052 |
bea355fe-30cf-4862-85ca-702c99e9b99e | brown0394/algorithm_practice | leetcode/29.cpp | class Solution {
public:
int divide(int dividend, int divisor) {
if (divisor == 1) {
return dividend;
}
else if (divisor == -1) {
if (dividend == -2147483648) return 2147483647;
return -dividend;
}
int sign = 1;
long long divid = di... | ALGO | 0.999894 | 5.949837 |
5e8dc14c-4965-4723-bb31-0b3a06103101 | ashekhawat6198/DSA | BINARY_SEARCH_TREE.CPP | #include <iostream>
using namespace std;
#include <queue>
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
// 1. IMPLEMENTATION
Node *insertIntoBST(Node *root, int data)
{
if (... | ALGO | 0.999984 | 4.229253 |
d3b6ee96-391a-4d4f-afe2-4fee7c8cb1a0 | J-Gann/alltrans | benchmarks/benchmarks_source/8_level/p02400/s422905434.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
double x, s, d;
double pai = 3.141592653589;
cin >> x;
s = pai * x * x;
d = 2 * pai * x;
printf("%.5lf %.5lf\n", s, d);
return 0;
} | ALGO | 0.986645 | 3.78858 |
33b1eccd-4869-4f63-8ef3-b6c88b4605cd | xuzx1210/LeetCode | 81. Search in Rotated Sorted Array II.cpp | class Solution
{
public:
bool search(vector<int> &nums, int target)
{
int left = 0, right = nums.size() - 1;
while (left <= right)
{
const int middle = (left + right) >> 1;
if (nums[middle] == target)
return true;
if (nums[left] == nums... | ALGO | 0.999933 | 5.988335 |
e807874f-8ad5-4c88-a5fd-1415e8d32b51 | joshualass/CP | Solutions/Contests/Special/CollegeComps/UTPC/Mar24/dog.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD = 1e9 + 7;
ll binexp(ll base, ll power) {
ll ans = 1;
while(power != 0) {
if(power & 1) {
ans = ans*base%MOD;
}
base = base*base%MOD;
power >>= 1;
}
retur... | ALGO | 0.999917 | 5.096524 |
9f062469-981a-468c-95c6-db948aee31e9 | A0nik03/DSA-Problems | Medium/DP/largest_div_subset.cpp | // 368. Largest Divisible Subset
/*
Given a set of distinct positive integers nums, return the largest subset answer such that every pair (answer[i], answer[j]) of elements in this subset satisfies:
answer[i] % answer[j] == 0, or
answer[j] % answer[i] == 0
If there are multiple solutions, return any of them.
*/
#inc... | ALGO | 0.999962 | 5.675061 |
dee08c34-d86e-4390-9a4e-cde54a044872 | huzaifak08/MultiPlatform_Drawer_Routing-Flutter | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
b078fb37-18d3-4dfc-8255-673a3c9041f3 | NeotokyoRevamp/neo | mp/src/game/server/h_ai.cpp | #include "cbase.h"
#include "game.h"
#include "vstdlib/random.h"
#include "movevars_shared.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define NUM_LATERAL_CHECKS 13 // how many checks are made on each side of a NPC looking for lateral cover
#define NUM_LATERAL_LOS_CH... | ALGO | 0.978673 | 5.986316 |
dc45fe28-dd84-47a1-9a05-dcc5d97dfd14 | GMRun100/C-Project | Thread/Thread010_mutex/main01.cpp | //ѧϰ֮߳ͬmutex
//2020.05.30 GM
#include<process.h>
#include<windows.h>
#include<stdio.h>
void _cdecl SellThread1(void* param);
void _cdecl SellThread2(void* param);
//100Ʊ
int tickets = 100;
HANDLE hMutex = INVALID_HANDLE_VALUE;
//Ŀͨٽķ0Ʊ
int main01()
{
//1.
hMutex = CreateMutex(NULL, FALSE, L"Ʊ");
printf("Ʊ\n")... | TOOL | 0.953621 | 3.783262 |
d56e535f-d2b0-4508-ac3a-e176b6518025 | KeTroN17032098/IOCP_Exercise | Exercise/AbstractCIocp/Project2/rsa.cpp | #include"rsa.h"
// This should totally be in the math library.
long long gcd(long long a, long long b)
{
long long c;
while (a != 0) {
c = a; a = b % a; b = c;
}
return b;
}
long long ExtEuclid(long long a, long long b)
{
long long x = 0, y = 1, u = 1, v = 0, gcd = b, m, n, q, r;
whil... | ALGO | 0.998981 | 4.687263 |
4d9abe5a-ef15-4ff8-8775-fe79590120a2 | jaimemin/programmers | 서울에서 김서방 찾기.cpp | #include <string>
#include <vector>
using namespace std;
string solution(vector<string> seoul) {
for (int i = 0; i < seoul.size(); i++)
{
if (seoul[i] == "Kim")
{
string result = "輭 " + to_string(i) + " ִ";
return result;
}
}
} | ALGO | 0.999315 | 4.828529 |
9945f800-158c-4d00-bc48-fe4a36e41a2c | Truonghdhdjsjs/baitap | 108 video/remake44.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,demchan=0,demle=0;
cin>>n;
int a[n];
for (int i = 0; i < n; i++)
{
/* code */
cin>>a[i];
}
for (int i = 0; i < n; i++)
{
/* code */
if(a[i]%2==0)
{
demchan++;
cou... | ALGO | 0.999734 | 3.077881 |
99d9d568-7fc8-419a-888b-1bd49070e8a6 | Shoyeb45/DataStructureAndAlgorithm | LeetCodeQuestions/1170-shortest-common-supersequence/shortest-common-supersequence.cpp | #define NFS ios_base::sync_with_stdio(false); cin.tie(NULL);
class Solution {
public:
string shortestCommonSupersequence(string s1, string s2) {
NFS
int n = s1.size(), m = s2.size();
// Dp table
vector<vector<int>> dp(n + 1, vector<int> (m + 1, 0));
// Dp assumption: dp[i... | ALGO | 0.999966 | 5.490188 |
7f392c4e-2d5e-4b8c-9322-7807e9523813 | ryo-manba/AtCoder | ABC/ABC270/e/main.cpp | // #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define rep1(n) for (int rep1_i = 0; rep1_i < n; rep1_i++)
#define rep2(i, n) for (int i = 0; i < n; i++)
#define rep3(i, m, n) for (int i = m; i <= n; i++)
#define overload3(... | ALGO | 0.999971 | 3.378935 |
a8bc5ee4-7a3e-43d8-9441-2a0aa9bc3e24 | jamorton/blix | deps/skia/src/core/SkLineClipper.cpp | #include "SkLineClipper.h"
template <typename T> T pin_unsorted(T value, T limit0, T limit1) {
if (limit1 < limit0) {
SkTSwap(limit0, limit1);
}
// now the limits are sorted
SkASSERT(limit0 <= limit1);
if (value < limit0) {
value = limit0;
} else if (value > limit1) {
v... | ALGO | 0.9993 | 6.011109 |
819235e8-ca4e-4b2d-8964-718e8defa145 | ishandutta2007/codeforces | huangxiaohua/normal/1464/A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int i,j,k,t,n,res,x,y,used[100500],tmp,son[100500];
vector<int> v[100500];
void dfs(int a,int b){
used[a]=1;
int i;
for(i=0;i<v[a].size();i++){
if(used[v[a][i]]){continue;}
dfs(v[a][i],b);
}
}
int main(){
scanf("%d",&t);
while(t--){
scanf... | ALGO | 0.999946 | 3.96506 |
1bf41fc0-7f7d-4f58-9031-42b06da27d5c | AdityaOjhalang/DSA-Self-Study | Vectors/largetele.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v = {88, 2, 5, 9990, 300000000};
int largest = 0;
for (int i = 0; i < v.size(); i++)
{
if (v[i] > largest)
largest = v[i];
}
cout << largest << "\n";
} | ALGO | 0.993576 | 3.760147 |
69ac3840-3bcb-4cff-904c-3b9dd52d6846 | CoderSwarup/CppBasicsToAdvanced | 12 Arrays/7) 2D _Array/2_2D_array_I_O.cpp/3_I_O_column_wise.cpp | #include <iostream>
using namespace std;
int main(){
int array[2][3];
//input
for(int col=0;col<3;col++)
{
for(int row=0;row<2;row++)
{
cin >> array[row][col];
}
}
cout << "printing by column"<<endl;
for(int col=0;col<3;col++)
{
for(int row=0;row<2;row++)
{
cout << array[row][col]<<" ";
}
... | ALGO | 0.992478 | 3.012013 |
5d011adb-378e-4677-88ed-fe9569b5d2f7 | leios76/coding-test | c/acmicpc_net/2404/s-01753/verify/main.cpp | #include <iostream>
#include <vector>
#include <queue>
#define INF 987654321
#define MAX_V 20001
#define MAX_E 300001
using namespace std;
int start_node_num, V, E;
typedef struct NODE {
int end;
int val;
};
// 각 노드의 엣지를 저장하는 벡터
// 0번 인덱스는 버린다.
vector<NODE> EDGE_arr[MAX_E];
// 출발 노드에서부터의 거리를 저장하는 배열
int dis... | ALGO | 0.999949 | 4.071692 |
d9dafc10-f290-4588-a8da-f348e5af4a1e | nordcap/cpp | Введение в программирование (Яндекс)/Цикл for и массивы/1.7.7.cpp | /*
* Выведите значение наименьшего нечетного элемента списка, а если в списке нет нечетных элементов - выведите число 0.
Формат входных данных
В первой строке вводится количество элементов в массиве. Во второй строке вводятся элементы массива.
Формат выходных данных
Выведите ответ на задачу.
Sample Input 1:
5
0 1 2... | ALGO | 0.999986 | 5.201853 |
a5eb417e-99eb-4437-95f9-6bc09db80844 | jovialf/Algoritma-II | UTS_0616103011.cpp | #include <iostream>
using namespace std;
int main(){
int jmlMhs;
cin >> jmlMhs;
int nim[jmlMhs];
int kelas[jmlMhs];
int nilai[jmlMhs];
for(int i=0; i<jmlMhs; i++){
cin >> nim[i];
}
for(int j=0; j<jmlMhs; j++){
cin >> kelas[j];
}
for(int k=0; k<jmlMhs; k++){
cin >> nilai[k];
}
int key =... | ALGO | 0.999038 | 3.592559 |
8386265a-8482-4e16-9cb4-1ad11466167a | toshantarora/DataStructurePr | c++language/doWhileLoop.cpp | #include <iostream>
using namespace std;
int main()
{
int N;
cout << "Enter the Number: ";
cin >> N;
int i = 1;
do{
cout << i << endl;
i++;
}
while(i <= N);
}
// Initialization of the looping control variable (if any)
// do{
// Body of the loop
// Statements(s)
//... | ALGO | 0.997846 | 3.817722 |
066cf3ce-247b-48c9-87d4-722fde48206e | beingsanthosh/Leetcode | 1603-running-sum-of-1d-array/running-sum-of-1d-array.cpp | class Solution {
public:
vector<int> runningSum(vector<int>& arr) {
int s=0;
int n=arr.size();
vector<int>vet(n,0);
for(int i=0;i<arr.size();i++)
{
s+=arr[i];
vet[i]=s;
}
return vet;
}
}; | ALGO | 0.999761 | 5.860329 |
5817a5f5-fbfb-44e8-95df-d381cad9e4db | LianizarHS/Layout_124210065 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
5465fca4-689f-435d-8883-29e661686b8b | AakashN2k03/Companywise-DSA | JUSPAY/Unique Paths II.cpp | // CODE360: Unique Paths II
// Pattern - DP on Grids
int MOD=1e9+7;
int fn(int i,int j,vector< vector< int> > &mat,vector< vector< int> > &dp)
{
if(i>=0 && j>=0 && mat[i][j]==-1) return 0;
if(i==0 && j==0) return 1;
if(i<0 || j<0) return 0;
if(dp[i][j]!=-1) return dp[i][j];
int up=fn(i-1,j,mat,... | ALGO | 0.999977 | 5.83639 |
3aa76073-cd70-4915-9860-20797a37d84a | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5265_4.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 5;
int x[N][N];
int y[N][N];
void query(vector<int> v) {
int sz = v.size();
printf("%d\n", sz);
for (int i = 0; i < sz; i++) {
if (i) printf(" ");
printf("%d", v[i]);
}
puts("");
fflush(stdout);
}
int main() {
vector<int> a, b;
i... | ALGO | 0.999274 | 3.274847 |
46824190-0dba-4154-9557-097034e01b6c | golu242/Programming | codechef's solution/BOBBANK.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--)
{
int w,x,y,z;
cin>>w>>x>>y>>z;
cout<<w+((x-y)*z)<<endl;
}
return 0;
}
| ALGO | 0.999674 | 3.669219 |
58579a6c-b9d0-4515-9e82-9d4b7cd96782 | Aty-0/S2DE | Libs/boost_1_76_0/libs/geometry/doc/src/examples/algorithms/unique.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[unique
//` Shows how to make a so-called minimal set of a polygon by removing duplicate points
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/b... | ALGO | 0.914368 | 5.848797 |
8236b16d-4775-49b6-8cd8-07aa4d8cf400 | nirvana369/UVA-problem-solved | 10197.cpp | /*
Hoang Linh
*/
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <map>
#include <queue>
#include <iostream>
#define fi "10197.inp"
#define fo "10197.out"
/**/
using namespace std;
/**/
char a[1000],b[1000],s[1000],pro[7][100],... | ALGO | 0.988528 | 3.189735 |
c2efb9cd-c150-4bf3-a82f-917a34022920 | YinWenAtBIT/LeetCode | Count of Smaller Numbers After Self/version_1.cpp | class FenwickTree {
vector<int> sum_array;
int n;
inline int lowbit(int x) {
return x & -x;
}
public:
FenwickTree(int n) :n(n), sum_array(n + 1, 0) {}
void add(int x, int val) {
while (x <= n) {
sum_array[x] += val;
x += lowbit(... | ALGO | 0.99999 | 5.845696 |
14092622-6521-4f87-94c4-49d49b7c9c02 | ishandutta2007/codeforces | monogon/normal/1016/A.cpp | #include <iostream>
using namespace std;
long long n, m, a, r;
int main() {
cin >> n >> m;
for(int i = 0; i < n; i++) {
cin >> a;
cout << ((a + r) / m) << " ";
r = (a + r) % m;
}
} | ALGO | 0.99996 | 3.209328 |
6facdae1-910c-4eb9-9da6-6ce301b4cbbc | Pathak2101/Leetcode_solution | Alien Dictionary - GFG/alien-dictionary.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:
string findOrder(string dict[], int N, int K) {
//code here
unordered_map<int,vector<int>>adj;
vector<int>in... | ALGO | 0.999948 | 5.622533 |
1606d628-dfd0-42cd-a46b-561fc9501cd4 | tanveer-98/DSA_solved_questions | RandomlySolved/to check if the given unweighted undirected graph is Tree or not .cpp | #include<bits/stdc++.h>
using namespace std;
int visited[100001];
vector<int> lst[100001];
void dfs(int node)
{
visited[node]=1;
for(int child:lst[node])
{
if(!visited[child])
dfs(child);
}
}
int main()
{
int n,m,u,v;
cin>>n>>m;
for(int i=1;i<=m;i++)
{
cin>>u>... | ALGO | 0.999963 | 4.738742 |
5960292a-0de8-44a1-9651-84e68a180897 | pl728/competitive-programming | main/A_The_Monster.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rev(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define v vector
using ll = long long;
using namespace std;
template <typename... T>
void see(T &...args) { ((cin >> args), ...); }
con... | ALGO | 0.999705 | 3.897855 |
0d30ecf0-a568-49af-992d-9f30bd60a870 | eshaagarwa/GFG-POTD | Hard/Making A Large Island/making-a-large-island.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
int dx[4] = {0, -1, 1, 0};
int dy[4] = {-1, 0, 0, 1};
int dfs(vector<vector<int>>& grid, int i, int j, int& id, int& n){
grid[i][j] = id;
int ... | ALGO | 0.99996 | 6.616533 |
0a48fa43-58c6-4a18-969d-1c29f6f34212 | kkpan11/apple-llvm-project | clang-tools-extra/clangd/DecisionForest.cpp | #include "Features.inc"
#if !CLANGD_DECISION_FOREST
#include "Quality.h"
#include <cstdlib>
namespace clang {
namespace clangd {
DecisionForestScores
evaluateDecisionForest(const SymbolQualitySignals &Quality,
const SymbolRelevanceSignals &Relevance, float Base) {
llvm::errs() << "Clangd was ... | ALGO | 0.888398 | 7.057827 |
b25c5676-5b16-4f13-b8db-54caf041df78 | PabloVLS/Estrutura-Dados | fila/1548FilaRecreio.cpp | #include<stdio.h>
struct Node {
int value;
Node* next;
Node() {
next = NULL;
}
Node(int _value) {
value = _value;
next = NULL;
}
};
struct Queue {
Node* first;
Node* last;
Queue() {
first = NULL;
last = NULL;
}
bool empty() {
... | ALGO | 0.999602 | 3.550304 |
a7fc1256-9a82-4fc4-9251-5b6b38423ac5 | AhanaDatta59/Codeforces | village.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
//ahana 2
int t;
if (!(cin >> t)) return 0;
while (t--) {
int n;
cin >> n;
vector<long long> g(n);
for (int i = 0; i < n; ++i) cin >> g[i];
sort(... | ALGO | 0.99964 | 4.824522 |
2d413d88-9403-46a8-8c5a-19cce6d0e863 | Pantelis-K/hpc-exercises | exercise4-3/main.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
#define F77NAME(x) x##_
extern "C"{
void F77NAME(dgemm) (
const char& transa, const char& transb,
const int& m, const int& n, const int& k,
const double& alpha,
const double* A, const int& lda,
... | ALGO | 0.999518 | 4.483427 |
b52b876b-2f39-4369-953a-3d81e916de7d | WilliamMarioAlan/Algorithms | LC/46.permute.cpp |
#include <iostream>
#include <vector>
using namespace std;
class Solution {
vector<int> ans;
vector<vector<int>> ret;
vector<bool> isUsed;
public:
void backtracking (vector<int>& nums,int n) {
if (ans.size() == n) {
ret.push_back(ans);
return ;
}
for (in... | ALGO | 0.999997 | 6.343387 |
98d53975-4e02-4693-a87e-4ebcb083da8e | ellynhan/challenge100-codingtest-study | hall_of_fame/jaewon/cutLog.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
int main(void) {
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, goal;
cin >> n >> goal;
vector<int> trees;
int maxHeight = 1;
for(int i=0; i<n; i++){
... | ALGO | 0.999998 | 4.57593 |
ce1a968b-d69b-4079-ae79-7bfef5d00ded | hoangtien2k3/Data-Structure-And-Algorithm | LinkedList/SingleLinkedList/SingleLinkedList_Anh_Stack/dao_nguoc_tu.cpp |
#include<bits/stdc++.h>
using namespace std;
struct Node {
string data;
Node *next;
};
bool empty(Node *top) {
return top == NULL;
}
Node *makeNode(string x) {
Node *temp = new Node;
temp->data = x;
temp->next = NULL;
return temp;
}
void push(Node* &top, string x) {
Node *temp = ma... | ALGO | 0.999775 | 4.501792 |
6af73fb7-ff38-482d-ab85-05a0a81df490 | imec-csa/gem5 | src/systemc/tests/systemc/misc/synth/blast/blast3/blast3.cpp | /*****************************************************************************
blast3.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************... | TOOL | 0.973663 | 4.177979 |
30b536e6-edbd-4558-99c4-7a89df7b57ad | Gaurav3009/LeetCode | Count the Zeros - GFG/count-the-zeros.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:
int countZeroes(int arr[], int n) {
int start = 0, end = n - 1, mid, ans = -1;
while(start <= end) {
mid = ... | ALGO | 0.999711 | 6.659219 |
29482b1c-ae94-4a11-aff0-ffc89c431108 | ditya17/coding_ninjas | conditionals_and_loops/sum_of_even_and_odd.cpp | #include<iostream>
using namespace std;
int main() {
// Write your code here
int N;
cin>>N;
int a=0,b=0;
while (N>0){
int c = N%10;
N = N/10;
if (c%2==0){
a = a +c;
}
else if (c%2!=0){
b = b +c;
}
}
cout<<a<<" ... | ALGO | 0.999617 | 4.141458 |
34114fdb-8dc0-48a7-89c7-1fa640ac61eb | Johniel/contests | atcoder/agc024/A/main.cpp | // atcoder/agc024/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ... | ALGO | 0.999223 | 4.181044 |
62f9e267-2c3e-4313-bdcb-4f7b092857f9 | ikaushiksharma/CPP-CODES | Recursion & Backtracking/ptimespower-recursion.cpp | #include <bits/stdc++.h>
using namespace std;
int powertillp(int n, int p){
if (p==0)
{
return 1;
}
int prevpower=powertillp(n, p-1);
return n*prevpower;
}
int main(){
int n, p;
cin>>n>>p;
cout<<powertillp(n,p);
return 0;
} | ALGO | 0.999978 | 4.216477 |
5e30b02e-6ab2-44b5-bb01-2615dd0d6b74 | Sean0628/competitive_programming | atcoder/abc/abc080/b.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(arg) cout << (arg) << endl
using ll = long long;
using P = pair<int, int>;
using mint = modint1000000007;
void chmax(ll& a, ll b) { a = max(a, b); }
void chmin(ll& a,... | ALGO | 0.999932 | 4.742739 |
2569e7c1-ffd4-456e-9f3a-ab9eb09d3bb0 | Harmanviv/ProgrammersAlgorithmStudy | PGProblemSolving/Greedy/단속카메라_42884.cpp | /// MARK: 단속카메라 Lv3 42884 : Greedy Problem
// MARK: - 단속카메라 복습 문제풀이
#if 0
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<vector<int>> routes) {
int answer = 1;
sort(routes.begin(), routes.end(), [](vector<int> &a, vector<int> &b) {
return a[1] < b[1];
});
... | ALGO | 0.999764 | 5.338624 |
90f00594-5869-43ce-887d-0a5f58c0bcda | hamzeedev/cbb | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
e3b26b29-de7a-4c5d-ad36-20378ef1c1ea | raincross7/code-similarity | codes/train_code/problem162/problem162_76.cpp | #include <iostream>
using std::cout;
using std::endl;
using std::cin;
int main()
{
int a, b;
while (cin >> a >> b) {
if (a > b) {
cout << "a > b" << endl;
} else if (a < b) {
cout << "a < b" << endl;
} else {
cout << "a == b" << endl;
}
... | ALGO | 0.995546 | 3.618527 |
aef50298-05ce-4bce-8eb8-8dede645326f | durgaprasadbvdp/DSA | 2.MATHEMATICS/15.cpp | /*15.Computing power.
You will be given two numbers x and y. Write a program to calculate x power y.
INPUT : x=2, y=3
OUTPUT : 8
*/
#include<bits/stdc++.h>
using namespace std;
int pow(int x,int y)
{
int res=1;
for(int i=0;i<y;i++)
{
res=res*x;
}
return res;
}
int main()
{
int x,y;
cout<<"Enter the number... | ALGO | 0.99969 | 5.048922 |
756cd42a-4250-481b-a9c4-5bb72182d2d6 | rutura/The-C-20-Masterclass-Source-Code | 35.LogicalOperatorsAndThreeWayComparison/35.6DefaultedEqualityOperator/main.cpp | #include <iostream>
class Item {
public :
Item() = default;
Item(int i) : Item(i,i,i){}
Item ( int a_param, int b_param, int c_param) : a(a_param), b(b_param), c(c_param){}
//Equality, default : member wise comparison for equality
bool operator==(const Item& right_operand) const = default;
p... | TOOL | 0.940772 | 4.700358 |
60c214cc-a65f-4988-b205-7db6a8e8fe42 | kamilszymczak1/my_solutions | cf/contests/1400/c.cpp | #include <iostream>
#include <vector>
using namespace std;
void TestCase() {
string s; cin >> s;
int x; cin >> x;
int n = s.size();
vector<bool>ans(n, 1);
for(int i = 0; i < n; i++) {
if(s[i] == '0') {
if(i + x < n) {
ans[i + x] = 0;
}
if... | ALGO | 0.999926 | 4.088609 |
dd014f32-d922-470f-a3ce-16da3eba9125 | nhattanho/LeetcodePractices | stringArray/3_LongestSubWithoutRepeat.cpp | /*Time Complexity O(n), Space O(n)*/
class Solution {
public:
int lengthOfLongestSubstring(string s) {
int len = s.length();
string ans = "";
int count = 0, max1 = 0;
for(int i = 0; i < len; i++){
size_t pos = ans.find(s[i]);
if(pos == string::npos){
... | ALGO | 0.999515 | 5.380584 |
5e667cfc-342d-4bc8-8e42-7dd7af2cfb01 | ishandutta2007/codeforces | yousef_salama/normal/215/B.cpp | #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
#include <limits>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <sstream>
using namespace std;
int n, ... | ALGO | 0.99992 | 3.745808 |
d8f4dcd8-9aed-42fb-b8e6-5d9e685b8c00 | Abhishekkumar2021/Coding | DisjointIntervals.cpp | #include <bits/stdc++.h>
using namespace std;
class DisjointIntervals
{
public:
vector<vector<int>> intervals;
DisjointIntervals()
{
// Intialise your data structure here.
}
void addInteger(int val)
{
// Add new integer to the data structure.
if (intervals.empty... | ALGO | 0.99995 | 5.362854 |
5ea93c16-1212-4ee2-b6d3-19cf06fde87e | microsoft/Frigatebird | libraries/AP_Math/quaternion.cpp | #pragma GCC optimize("O3")
#include "AP_Math.h"
// return the rotation matrix equivalent for this quaternion
void Quaternion::rotation_matrix(Matrix3f &m) const
{
float q3q3 = q3 * q3;
float q3q4 = q3 * q4;
float q2q2 = q2 * q2;
float q2q3 = q2 * q3;
float q2q4 = q2 * q4;
float q1q2 = q1 * q2;... | ALGO | 0.992315 | 6.167052 |
c24c277a-7e11-43dc-a3f5-8c1f4a1100fc | dimaS0611/study | MM/lab1/lab1.cpp | #include <iostream>
#include <fstream>
#include <math.h>
const int K = 64;
const int A0 = 8195;
const int B = A0;
const int N = 1000;
unsigned const int M = pow(2, 31);
double tableElements[K];
unsigned int startValue = A0;
double multiplicativeMethod() {
//Ai' = (Ai-1' * B)modM; Ai = Ai'/M
startValue *= B;
... | ALGO | 0.999392 | 4.358589 |
f6733920-13c7-471c-b354-335da7b1ca18 | hkalra0001/CompetitiveCodeVault | CodeChef/START119D/Cookie_Day.cpp | #include <bits/stdc++.h>
using namespace std;
// macros
#define endl '\n'
#define pb push_back
// function macros
#define all(x) x.begin(),x.end()
void solve(int tt)
{
// your code goes here
int number;
int children;
cin>>number;
cin>>children;
vector<int>cookies;
for (int i=0;i<number;i++)
{
... | ALGO | 0.99996 | 3.777691 |
dc9458b8-3531-4c0c-a299-c2e2ca0b1a1e | Pranay-Kamble/GFG-DSA-Course | Bit Magic/twooddoccurring.cpp | #include <iostream>
/*
-----------Naive Approach---------------------
void twoodd(const int arr[] ,const int &size){ //Time Complexity = O(size*size) , Quadratic
for (int i{}; i < size; ++i){
int count {};
for (int j{}; j < size ; ++j){
if(arr[i] == arr[j])
++count;
... | ALGO | 0.999883 | 4.84936 |
9a11b8dc-6303-4cea-955b-6e5df7d5f5db | ishandutta2007/codeforces | nok0/normal/1579/D.cpp | #line 1 "/Users/nok0/Documents/Programming/nok0/cfmulti.hpp"
#include <bits/stdc++.h>
using namespace std;
#pragma region Macros
// rep macro
#define foa(v, a) for(auto &v : a)
#define REPname(a, b, c, d, e, ...) e
#define REP(...) REPname(__VA_ARGS__, REP3, REP2, REP1, REP0)(__VA_ARGS__)
#define REP0(x) for(int i = 0... | ALGO | 0.999647 | 3.609073 |
598db601-9509-4e38-ab05-df7a6703409c | CWJihad/CPP-10-Problems | C++ Problems/min_max_num.cpp | #include <iostream>
using namespace std;
// Function to find the highest number
int max()
{
int num1, num2;
cout << "For the highest number" << endl;
cout << "Enter the first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
if (num1 > num2)
{
return nu... | ALGO | 0.998731 | 4.60179 |
6309cb8e-58d0-49b8-9ad9-29296d1a1276 | ashishkumary/cpp | parenthesis_balance.cpp | #include <bits/stdc++.h>
using namespace std;
void Bal(string expr)
{
stack<char> s;
char x;
for (int i = 0; i < expr.length(); i++)
{
if (expr[i] == '(' || expr[i] == '[' || expr[i] == '{')
{
s.push(expr[i]);
continue;
}
if (s.empty())
{
cout << "exp is not Balanced";
break;
... | ALGO | 0.996587 | 4.676262 |
05ac14f4-254e-4b09-87a1-3e06ea1faf65 | iamshivakhatri/ML_basics | opencv-4.9.0/modules/calib3d/src/quadsubpix.cpp | #include "precomp.hpp"
#include <limits>
#include <utility>
#include <algorithm>
#include <math.h>
namespace cv {
inline bool is_smaller(const std::pair<int, float>& p1, const std::pair<int, float>& p2)
{
return p1.second < p2.second;
}
static void orderContours(const std::vector<std::vector<Point> >& contours... | ALGO | 0.999701 | 6.562594 |
77020691-04cd-4de6-84f9-0dde309bfe56 | Locheir/DSA_IN_CPP | IMPORTANT_QUESTIONS/76_activity_selection.cpp | #include <iostream>
#include <vector>
using namespace std;
int maxActivitiesPossible(vector<int> start, vector<int> end) {
int count = 1;
int currEnd = end[0];
cout << "Selecting Activity A0" << endl;
for(int i=1; i<start.size(); i++) {
if(start[i] >= currEnd) {
count++;
... | ALGO | 0.998655 | 5.2144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.