uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
85b1f306-b232-46ec-b501-2c7cb296ef6f | SP0N9E/Study4Job | LeetCode/92.反转链表-ii.cpp | /*
* @lc app=leetcode.cn id=92 lang=cpp
*
* [92] 反转链表 II
*
* https://leetcode-cn.com/problems/reverse-linked-list-ii/description/
*
* algorithms
* Medium (50.47%)
* Likes: 416
* Dislikes: 0
* Total Accepted: 58.8K
* Total Submissions: 116.3K
* Testcase Example: '[1,2,3,4,5]\n2\n4'
*
* 反转从位置 m 到 n ... | ALGO | 0.999961 | 6.041371 |
dc5fb011-abda-4536-a155-5de20bd03a93 | imHaris8278/Leetcode | 2463-minimum-recolors-to-get-k-consecutive-black-blocks/minimum-recolors-to-get-k-consecutive-black-blocks.cpp | class Solution
{
public:
int minimumRecolors(string blocks, int k)
{
queue<char> blockQueue;
int numWhites = 0;
while (blockQueue.size() < k)
{
char currentChar = blocks[blockQueue.size()];
if (currentChar == 'W')
{
nu... | ALGO | 0.999905 | 5.86166 |
2a6251df-8905-4e0c-98ff-fbd711b7918f | Xylphy/School-Activities | DAA/Final Examinations [LATE]/Red-Black Trees Part 2_1/main.cpp | #include "tree.h"
#include <iostream>
using namespace std;
int main() {
BSTree* tree = new BSTree();
char op;
int num;
do {
cout << "Operation: ";
cin >> op;
switch (op) {
case 'i':
cin >> num;
tree->insert(num);
break;... | TOOL | 0.928673 | 4.752787 |
605b5a03-0dad-41da-a6b4-20b019f6c4cb | FechitaDiandra/OOP2023-2024 | Lab5ex1/Number.cpp | #define _CRT_SECURE_NO_WARNINGS
#include "Number.h"
#include <cstring>
#include <cstdlib>
#include <iostream>
using namespace std;
Number::Number(const char* value, int base)
{
if (value[0] == '-')
{
this->value = (char*)malloc(strlen(value) * sizeof(char));
strcpy(this->value, value+1);
negativ = true;
}
e... | ALGO | 0.948829 | 4.036119 |
1cfb7a1c-94e2-4f72-9d65-bc56055be114 | amreenabbas/Leet-Code-Solutions | 26. Remove Duplicates from Sorted Array.cpp | Question Link : https://leetcode.com/problems/remove-duplicates-from-sorted-array/
//Solution by Amreen
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int i,n=nums.size(),j=1;
if(n==0)
return 0;
for(i=1;i<n;i++)
{
if(nums[i] != nums[i-1])... | ALGO | 0.999955 | 6.015541 |
ce80bfff-5b97-4dd5-84e8-3576f1a01f7d | blissfullpeace/CP | ValeraAndX.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
int n;
cin >> n;
char a[n][n];
char cmp2;
for(int i = 0; i < n;++i)
for(int j = 0; j < n;++j){
cin >> a[i][j];
if(i == j || j == n - i - 1)continue;
else cmp2 = a[i][j];
}
if(cmp2 == a[0][0... | ALGO | 0.999975 | 3.582899 |
f68892c6-b24f-432d-a188-6d4603777d87 | floraison-io/FloraisonRender | include/bullet3/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableContactConstraint.cpp | #include "btReducedDeformableContactConstraint.h"
#include <iostream>
// ================= static constraints ===================
btReducedDeformableStaticConstraint::btReducedDeformableStaticConstraint(
btReducedDeformableBody* rsb,
btSoftBody::Node* node,
const btVector3& ri,
const btVector3& x0,
const btVec... | ALGO | 0.999335 | 5.150236 |
de65d6c0-b43e-46b4-a454-8aa7d8d3fcdf | Eagle780/Objektinis | galutinis_balas.cpp | #include "header.h"
#include "timeris.h"
int main()
{
int dydis = 100;
string failas = "studentai" + to_string(dydis) + ".txt";
int ndDydis = 5;
double laikas = 0;
int k = 0;
string pas;
cinEx();
vector<Studentas> A;
deque<Studentas> B;
list<Studentas> C;
vector<Studentas... | TOOL | 0.881605 | 3.582142 |
2decf6ba-7eaf-403c-9036-cf47917e0511 | solo2002/CarND-MPC-Project | src/Eigen-3.3/demos/opengl/quaternion_demo.cpp | #include "quaternion_demo.h"
#include "icosphere.h"
#include <Eigen/Geometry>
#include <Eigen/QR>
#include <Eigen/LU>
#include <iostream>
#include <QEvent>
#include <QMouseEvent>
#include <QInputDialog>
#include <QGridLayout>
#include <QButtonGroup>
#include <QRadioButton>
#include <QDockWidget>
#include <QPushButton... | ALGO | 0.858081 | 5.849781 |
4ab1bfe4-92f0-4759-aa1b-8cdce1a09a04 | Charul2304/Leetcode_DSA | 441-arranging-coins/arranging-coins.cpp | class Solution {
public:
long long staircount(long long n){
long long ans=(n*(n+1))/2;
return ans;
}
int arrangeCoins(int n) {
long long low=1;
long long high=n;
int res=0;
while(low<=high){
long long mid=(low+high)/2;
if(staircount(mid... | ALGO | 0.999958 | 6.283323 |
e474436f-f6ab-4d41-a8b8-0c44b56fc39f | Helbrass/openjdk-fontfix | openjdk7/hotspot/src/share/vm/compiler/methodLiveness.cpp | #include "precompiled.hpp"
#include "ci/ciMethod.hpp"
#include "ci/ciMethodBlocks.hpp"
#include "ci/ciStreams.hpp"
#include "compiler/methodLiveness.hpp"
#include "interpreter/bytecode.hpp"
#include "interpreter/bytecodes.hpp"
#include "memory/allocation.inline.hpp"
#include "utilities/bitMap.inline.hpp"
// The Method... | ALGO | 0.976832 | 7.659151 |
db302cfb-8261-48c5-b04a-bbf14da00ae8 | Blaze-DSP/SRI | src/systemc/tests/systemc/misc/v1.0/dash8/pulse.cpp | /*****************************************************************************
pulse.cpp -- Implementation of the pulse generator.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*****************************************************... | TOOL | 0.90776 | 6.270356 |
e288fc9b-6a2d-4f3b-9bf6-ab94248db0bd | Sumit993905/RECURSION-C-PLUS-PLUS | power.cpp | #include<iostream>
using namespace std;
int power(int n){
//Base case
if(n==0)
return 1;
int smallerProblem = power(n-1);
int biggerProblem = 2 * smallerProblem;
return biggerProblem;
}
int main(){
int n;
cout<<"Enter the Value of n : ";
cin>>n;
int ans = power(n)... | ALGO | 0.999718 | 5.429967 |
b31d2d90-d911-4eae-9414-095df44cedf2 | ishandutta2007/codeforces | baba/normal/723/F.cpp | //Tanuj Khattar
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> II;
typedef vector< II > VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef long long int LL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define AL... | ALGO | 0.999984 | 3.337475 |
6115683f-f6fb-4da9-824a-1de8b22e0976 | Rahul-Palahwat/LeetCode_Problems | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlin... | /**
* // This is the MountainArray's API interface.
* // You should not implement it, or speculate about its implementation
* class MountainArray {
* public:
* int get(int index);
* int length();
* };
*/
class Solution {
public:
int findInMountainArray(int target, MountainArray &m) {
int ... | ALGO | 0.999965 | 6.202459 |
94fcd4cb-7616-4794-a04c-76c3f8386851 | ishandutta2007/codeforces | aryanc403/normal/1061/A.cpp | /*
Warn - Don't change next line else you will get WA verdict. Online Judge is configured to give WA if next line is not present.
Author - Aryan Choudhary (@aryanc403)
const short DEBUG { 0 };
#define debug(x) if (DEBUG) cout << #x << " = " << x << '\n'
*/
#pragma warning(disable:4996)
#pragma comment(linker... | ALGO | 0.999866 | 3.726209 |
f68a25e0-e5c9-432f-8c73-48633b3f8c98 | liuxiaocs7/AlgorithmLearn | LeetCode_C++/0051.n皇后.cpp | /*
* @lc app=leetcode.cn id=51 lang=cpp
*
* [51] N皇后
*/
// @lc code=start
class Solution {
int N;
vector<bool> col, dg, udg;
vector<vector<string>> ans;
vector<string> path;
public:
vector<vector<string>> solveNQueens(int n) {
N = n;
col = vector<bool>(n);
dg = udg = vec... | ALGO | 0.99958 | 6.064122 |
d01f62dc-6df7-4aa8-a31c-6d62fc761833 | nmnhatUIT03/IT003.CNCL_OOP | BaiTapLyThuyet/Tuan01/Bai02/Bai02.cpp | #include <iostream>
using namespace std;
struct PhanSo
{
int tuSo;
int mauSo;
};
PhanSo p1, p2;
void nhap(PhanSo& p) {
cout << "Nhap vao tu so: ";
cin >> p.tuSo;
cout << "Nhap vao mau so: ";
cin >> p.mauSo;
}
void rutGon(PhanSo& p) {
int a = p.tuSo;
int b = p.mauSo;
while (a != b) {
if (a > b) {
a -=... | ALGO | 0.999614 | 4.087974 |
ebae59bf-364b-44f5-b17e-f6d2afd9152b | EagleEyeKestrel/Leetcode | 701-800/719. 找出第 k 小的距离对/template的副本.cpp | class Solution {
public:
int f(vector<int> &nums, int mid) {
int l = 0, n = nums.size(), res = 0;
for(int r = 0; r < n; r++) {
while(l < r && nums[l] < nums[r] - mid) l++;
res += r - l;
}
return res;
}
int smallestDistancePair(vector<int>& nums, int k)... | ALGO | 0.999988 | 5.76293 |
49163133-90b3-4678-b127-77b653259855 | AAKASH707/LinuxRepo1 | C++/forloop.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
for(int i=a;i<=b;i++)
{
if(1<=i && i<= 9)
{
switch(i)
{
case 1: cout<<"one\n"; break;
case 2: cout<<"two\n"; break;
case 3: cout<<"three\n"... | ALGO | 0.999788 | 3.112246 |
07758879-4f0e-41ee-89c5-724b97b0df30 | jccarvalhosa/maratona | codeforces/round182/playlist.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int f[100011];
int main() {
int n, m, i, c, t, v;
cin>>n>>m;
cin>>c>>t;
f[0] = c*t;
for(i=1;i<n;i++) {
cin>>c>>t;
f[i] = f[i-1] + c*t;
}
for(i=0;i<m;i++) {
cin>>v;
cout << 1+(lower_bound(f, f+n, v)-f) << endl;
}
return 0;... | ALGO | 0.999966 | 3.273286 |
87046512-95e5-43b1-a1e8-6d7ea025ff9b | cstrick1980/SStat | Domode.cpp | /*-----------------------------------------------------------+
| DOMODE - Computes the first mode in an array. |
| CREATED: 19 Jun 93 |
| CALLED : stats.c |
| |
| 24 ... | ALGO | 0.999978 | 4.195078 |
58f22747-46dc-45d2-aa2d-115e01b88250 | bothemrun/CAP-Complete-Algorithmic-Programming | Leetcode_All_Solved/1485.cpp | /**
* Definition for a Node.
* struct Node {
* int val;
* Node *left;
* Node *right;
* Node *random;
* Node() : val(0), left(nullptr), right(nullptr), random(nullptr) {}
* Node(int x) : val(x), left(nullptr), right(nullptr), random(nullptr) {}
* Node(int x, Node *left, Node *right, ... | ALGO | 0.999368 | 5.551376 |
1220d931-f3b3-42ce-90ef-4f8bdcc62a90 | DinhHuyKhanh/Codeforces | Vigenere.cpp | #include <bits/stdc++.h>
/**
* @author: huykhanh
* @create: 22/2/2022
**/
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef deque<int> dq;
typedef unsigned long long ull;
#define ins(x) insert(x);
#define endl '\n'
#define tup tuple<int,int,int>
#define read(... | ALGO | 0.999987 | 4.503577 |
b0283dc4-66af-429e-aca8-aa826bb0bbc0 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2242_13.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
out << "[";
for (auto vi : v) out << vi << ", ";
out << "]\n";
return out;
}
int n;
string s;
vector<int> d;
string solution() {
int i = 0;
while (0 <= i && i < n) {
if (d[i] == -1... | ALGO | 0.999919 | 4.072228 |
778e58fd-502b-404c-9aad-8d6f56c50013 | Aditya007it/Practice-SDE-sheet | Practice SDE sheet/Day-12/Find_Four_Elements_That_Sums_To_A_Given_Value.cpp |
// Submitted on Jun 17, 2022, 12:45:32 PM
#include <bits/stdc++.h>
vector<vector<int>> twosum(vector<int> &nums, int target, int start)
{
vector<vector<int>> res;
int left = start;
int right = nums.size() - 1;
vector<int> ans;
while (left < right)
{
if (left != start && nums[left] == ... | ALGO | 0.99999 | 5.827832 |
f4632063-d9aa-4642-87c1-d66d556d1ae1 | Sumithkumar1/datasructrec- | data structre .c++/infix to prefix.cpp | // CPP program to convert infix to prefix
#include <bits/stdc++.h>
using namespace std;
bool isOperator(char c)
{
return (!isalpha(c) && !isdigit(c));
}
int getPriority(char C)
{
if (C == '-' || C == '+')
return 1;
else if (C == '*' || C == '/')
return 2;
else if (C == '^')
return 3;
return 0;
}
string in... | ALGO | 0.99985 | 5.695247 |
fdf12be2-93cb-4410-8ebc-ab193c5539b8 | tianww10086/Data-Structures---C-language | 顺序表的基本操作/main.cpp | #include"SqList.h"
int main() {
Sqlist L;
int x;
ListMenu();
scanf_s("%d", &x);
while (x != 0) {
switch (x) {
case 1:
if (InitList(&L)) {
printf("ʼ\n");
}
else {
printf("ʼʧ\n");
}
break;
case 2:
if (DestroyList(&L)) {
printf("ɾɹ\n");
}
else {
printf("ɾʧ\n");
}
b... | TOOL | 0.988391 | 3.227764 |
11412a66-da67-4bbe-8b3e-43ef3cc17e91 | SoftwareKiller/leetcode | 23-merge-k-sorted-lists/merge-k-sorted-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeKLists... | ALGO | 0.999828 | 6.190226 |
86acb303-ef1f-4d4e-a520-71b817ee30ec | boatinw99/CompetitiveProgramming | GoforSSWT 2/topo.cpp | #include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+9;
queue<int> q,ans ;
vector<int>path[N];
vector<int>::iterator it;
int dag[N];
main()
{
int n,m,i,j,x,u,v ;
scanf("%d %d",&n,&m);
while(m--)
{
scanf("%d %d",&u,&v);
path[u].push_back(v);
dag[v]++;
}
for(i=1;... | ALGO | 0.999995 | 4.154414 |
b2462857-6f5f-489f-aa51-e221e79c7a6b | krantirk/-self-driving-car | project_11_path_planning/src/Eigen-3.3/unsupported/doc/examples/MatrixExponential.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix exponential ... | ALGO | 0.999585 | 3.706936 |
2f2e8cfd-d723-457a-9570-81c14be34646 | wenjiesun1024/Leetcode | Cpp/601~1250 HardOnly/940. Distinct Subsequences II.cpp | class Solution {
public:
using ll = long long;
static const ll mod = 1e9 + 7;
int distinctSubseqII(string S) {
ll sum = 1;
int cnt[26] = {0};
for (auto c : S) {
ll old = sum;
sum = ((2*sum - cnt[c-'a']) % mod + mod) % mod;
cnt[c-'a'] = ol... | ALGO | 0.999997 | 6.202446 |
2612b6ab-b991-493e-97c1-2165f85ac4b7 | Darshanpakhale26/90daysofLeetcode | 22makeTheStringGreat.cpp | // Make The String Great
#include <iostream>
#include <stack>
#include <string>
using namespace std;
string makeGood(string s) {
stack<char> stack;
for(char c : s) {
if(!stack.empty() && abs(stack.top() - c) == 32) { // if stack is not empty and difference between top of stack and current character i... | ALGO | 0.999935 | 6.423893 |
aef2a30e-b4fc-497d-993e-701edee77e0a | kmjp/procon | yuki/0001-1000/201-300/248.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(... | ALGO | 0.999522 | 3.631001 |
08492e27-6513-4a61-a284-e4d512237774 | jun-pac/PS | 240720/4set/F.cpp |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define cediv(a,b) ((a)%(b)==0?((a)/(b)):((a)/(b))+1)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back... | ALGO | 0.997675 | 4.206179 |
9982af20-c80f-4915-a350-11869738c4fd | ishandutta2007/codeforces | eddy1021/normal/620/D.cpp | // eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF 1023456789ll
#define INF16 10000000... | ALGO | 0.999978 | 3.502175 |
c3f425dd-14ac-491f-bf54-8e859c276ece | spsujoy007/Phitron-CPP | Semister 2/Data Stucture/practice/Queries.cpp | // #include <bits/stdc++.h>
// using namespace std;
// class Node
// {
// public:
// int val;
// Node *next;
// Node(int val)
// {
// this->val = val;
// this->next = NULL;
// }
// };
// void addNodes(Node *&head, Node *&tail, int value)
// {
// Node *addNode = new Node(value);
/... | ALGO | 0.999761 | 5.547217 |
6183826b-0b02-4dd6-9dda-8ab392b36804 | edcoelho/metodos-numericos-2 | src/differentiation/CentralDerivative.cpp | #include "differentiation/CentralDerivative.hpp"
#include <stdexcept>
#include <cmath>
namespace metII {
double CentralDerivative::first_derivative (const double x, const double h) const {
double result;
std::function<double(double)> f = this->get_f();
switch (this->get_error_order()) {
... | ALGO | 0.998918 | 6.603209 |
55c96478-2a37-4d38-b9b0-7c3a3a74b929 | makio93/competitive-atcoder | abc174/abc174_d/main1-2.cpp | // 解説AC2
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#def... | ALGO | 0.999819 | 4.316737 |
37d8c3e9-bc1f-4efb-b8b7-6a19793428e4 | jsh15932/Programmers_Solve | LEVEL3/야근 지수.cpp | #include<bits/stdc++.h>
using namespace std;
long long solution(int n, vector<int> works) {
long long answer = 0;
priority_queue<int> pq;
for(int i = 0; i < works.size(); i++) {
pq.push(works[i]);
}
while(n--) {
if(pq.empty()) {
break;
}
... | ALGO | 0.999972 | 4.829494 |
7c77446d-d233-4872-b274-bd7982269f29 | HeinerOV97/IE0217 | Tareas Previas/Sesion_7/IteratorsForward.cpp | #include <iostream>
#include <forward_list>
using namespace std;
int main() {
//Se inicializa un forward list, el cual puede leer y escribir valores mientras itera hacia adelante
forward_list<int> nums{1, 2, 3, 4};
/*Se iniciliza el iterador apuntando al valor inicial de la forward list*/
forward_list<int>::iter... | ALGO | 0.999269 | 4.028479 |
c4e42eae-5a40-4a0c-bea9-fcb2d3071d4f | KunalG0312/top100codes | palindromeOfString.cpp | #include<iostream>
using namespace std;
//palindrome of a string
int main(){
string s;
cin>>s;
bool flag = false;
int len = s.length();
for(int i = 0; i<len; i++){
if(s[i] != s[len-i-1]){
flag = true;
break;
}
}
if(flag){
cout<<"Not a ... | ALGO | 0.999592 | 4.556257 |
f1ad2d1f-99d4-45f1-9c5d-77d264657de2 | Mugdha67/Codeforces | A. Orac and Factors.cpp | #include<bits/stdc++.h>
using namespace std;
// #define for0(i,n) for(i=0;i<n;i++)
// #define for(i,n) for(i=1;i<=n;i++)
// #define forn(i,n) for(i=n;i>=1;i--)
// #define forn0(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define pi acos(-1)
#define YE... | ALGO | 0.999756 | 4.200937 |
93c7e7c0-66b2-497a-ace3-e85926578513 | alexr9513/Option-Pricing | BlackScholesMCPricer.cpp | #pragma once
#include "BlackScholesMCPricer.h"
#include "AsianOption.h"
#include "MT.h"
#include <cmath>
#include <stdexcept>
BlackScholesMCPricer::BlackScholesMCPricer(Option* option, double initialPrice, double interestRate, double volatility)
: _option(option), _initialPrice(initialPrice), _interestRate(interes... | ALGO | 0.974463 | 7.53966 |
1f155ed3-713c-474c-9099-2f8bbf27be69 | Vaibhav10sept/DSA | NEETCODE 175/rec-edit-distance.cpp | #include <bits/stdc++.h>
using namespace std;
int rec(int i, int j, string str1, string str2, vector<vector<int>> &memo) {
//base case
if (i < 0) { //str1 is exhausted. we need to insert the chars that are there in str2
return j + 1;
}
if (j < 0) { //str2 is exhausted. we need to remove/delete chars that are the... | ALGO | 0.999991 | 5.584637 |
1a274316-07e9-40f0-bdbf-1e1a27eb7fc7 | quanzz123/code-lthdt | soure code/class_phuong_trinh_b2.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class PTB2
{
private:
int a,b,c;
public:
PTB2()
{
a=0;
b=0;
c=0;
}
PTB2(int a,int b,int c)
{
this->a=a;
this->b=b;
this->c=c;... | ALGO | 0.999392 | 4.211798 |
b0b8b4eb-7979-47ce-8d2f-92cbd4f9ae7b | GiTRoCcIGiT/2024_4a_2 | 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.998784 | 6.761023 |
7393a044-12a4-452c-a550-9c2bb622bc9b | Sabari-Nathan001/LeetCode | 0238-product-of-array-except-self/0238-product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int length = nums.size();
vector<int> products(length);
int prefixProduct = 1;
for (int i = 0; i < length; i++) {
products[i] = prefixProduct;
prefixProduct *= nums[i];
}
... | ALGO | 0.999969 | 6.588038 |
36736f18-7e97-45d4-b898-3fbf12414830 | camil0palacios/Competitive-programming | solutions/uva/12553/solution.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<string> v(n);
for(auto &i : v) cin >> i;
bool once = 0;
int i = 0, j = 0;
vector<string> b = {"Happy", "birthday", "to", "you",
"Happy", "birthday", "to", "you",
"Happy", "birthday", "to", "Rujia",
... | ALGO | 0.999864 | 3.675435 |
0e31b859-1260-406b-bc0b-a712467ae10c | pronad1/Problem_Solving_Part1 | optimal_currency_exchange.cpp | //Author : PROSENJIT MONDOL
#include<bits/stdc++.h>
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
using namespace std;
const int inf = 3e5;
using ll=unsigned long long ;
ll mod = 10e9 + 7;
//-------------------------------... | ALGO | 0.999947 | 3.694445 |
afc74259-135e-4a6a-9560-fa949787dda5 | cio194/b_plus_tree_disk | b_plus_tree.cpp | #include "b_plus_tree.h"
namespace bplus {
BPlusTree::BPlusTree(const std::string &path,
bool (*key_less)(const char *, const char *),
bool (*key_equal)(const char *, const char *),
int key_size, int entry_size) : KeyLess(key_less),
... | ALGO | 0.996903 | 4.066983 |
4518cf64-7c90-414b-96c9-d3150a7a7884 | ggabimoran/LookbackOptionPricer | LookbackOption/lookbackoption_stat/interface.cpp | #include "interface.h"
#include <fstream>
namespace lookback {
std::vector<double> compute_greeks(const LookbackOption& option, const Matrix& normSimuls) {
std::vector<double> greeks = std::vector<double>(5);
greeks[0] = Greeks::delta(option, normSimuls);
greeks[1] = Greeks::gamma(option, normSimuls);
greeks[... | ALGO | 0.971934 | 7.001579 |
e93dd096-a394-47d9-9cd2-5b3d0eb36bf1 | ishandutta2007/codeforces | kevinyang/normal/1722/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
bool good(int x, int y){
if(1<=x&&x<=n&&y>=1&&m>=y)return true;
return false;
}
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int t;
cin >> t;
while(t--){
cin >> n >> m;
vector<vector<char>>mp(n+1,vector<char>(m+1));
for... | ALGO | 0.999942 | 4.568761 |
1034501a-2954-4609-838a-1e9fecce9d33 | fei0319/competitive-programming | code/codeforces/1706C.cpp | // Problem: C. Qpwoeirut And The City
// Contest: Codeforces - Codeforces Round #809 (Div. 2)
// URL: https://codeforces.com/contest/1706/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#... | ALGO | 0.999551 | 4.523763 |
6433abeb-e3a8-47d4-892e-97a12e7d3df7 | GlodonOpenSrc/Qt5.5.1_Glodon | qtwebengine/src/3rdparty/chromium/third_party/icu/source/i18n/sortkey.cpp | //===============================================================================
//
// File sortkey.cpp
//
//
//
// Created by: Helena Shih
//
// Modification History:
//
// Date Name Description
//
// 6/20/97 helena Java class name change.
// 6/23/97 helena Added comments t... | TOOL | 0.987851 | 6.212571 |
71926c57-6bf9-44fe-97e6-de404b54f639 | JKSunny/OpenJK | code/qcommon/cm_trace.cpp | #include "cm_local.h"
/*
===============================================================================
POSITION TESTING
===============================================================================
*/
/*
================
CM_TestBoxInBrush
================
*/
void CM_TestBoxInBrush( traceWork_t *tw, cbrush_t *br... | ALGO | 0.996866 | 5.346382 |
1a49426c-0a70-45c0-8345-5de3b21ebd05 | bingai/RTA_2016 | G1_vision/workspace_detection_node/src/workspace_detection_utilities.cpp | #include <workspace_detection_node/workspace_detection_utilities.hpp>
#include <namaris/utilities/pointcloud.hpp>
#include <namaris/utilities/map.hpp>
#include <namaris/algorithms/region_growing_normal_variation/region_growing_normal_variation.hpp>
#include <sisyphus/box_detection.hpp>
#include <sisyphus/box_fitting.... | ALGO | 0.982341 | 4.687674 |
7e1ea009-6149-433e-990e-077df753a0f8 | IshyWishy17/Competitive-Coding | CSES/Dynamic Programming/grid_paths.cpp | #include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
void solve() {
int n;
cin >> n;
vector<vector<int>> dp(n, vector<int>(n, 0));
vector<string> grid(n);
for (int i = 0; i < n; i++) cin >> grid[i];
if (grid[0][0] == '.') dp[0][0] = 1;
... | ALGO | 0.999887 | 4.500702 |
0bdd269d-f314-4cdf-b429-11d59018b484 | Manh1802/bai-tap-tong-hop-tranvanmanh-n22dcdk050 | chuong6/Program/c6_program5.cpp | #include <iostream>
#include <iomanip>
using namespace std;
// Hàm để tính khoảng cách mà một vật rơi
double fallingDistance(int thoiGian) {
const double g = 9.8; // Gia tốc do trọng lực (m/s^2)
double khoangCach = 0.5 * g * thoiGian * thoiGian; // Công thức tính khoảng cách
return khoangCach;
}
int main(... | ALGO | 0.996038 | 5.038086 |
53a17eea-0add-4d1c-880e-85efc8fea355 | omnirom-mt6589/android_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/cbsearch.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/cbsearch.c
Functions: D_plsf_3
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
(1) Removed "count.h" and "basic_op... | ALGO | 0.999987 | 6.068127 |
2888dae2-1792-4e39-baca-bc943cb78873 | srishkee/codepath_cybersecurity | Supercomputer3.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
std::vector<int> fenwickTree;
// Fenwick Tree!
void updateFenwickTree(int pos, int val)
{
pos++;
while (pos < fenwickTree.size())
{
fenwickTree.at(pos) += val;
pos += pos & (-pos); // 2's complement
}
}
// Goes from 0->pos
int ... | ALGO | 0.999527 | 4.678372 |
051fa336-baf5-4a96-87a4-7de46ba13319 | educatedpolarbear/Rep4 | KiTuLap.cpp | // Designed by Nguyen Thanh Chau
// a.k.a Linh's servant - Ken
// En Taro Adun! - TemplarAssasin a.k.a Zeratul
// ##### #####
// ### #### #### ###
// ## ### ### ##
// ## #### ##
// ## ... | ALGO | 0.999855 | 3.692332 |
809d6245-ffef-4b6a-9eff-e4199f0faa4a | ahmedbougacha/dagger | lib/CodeGen/ScheduleDAG.cpp | #include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/Support/CommandLine.h"
#inc... | ALGO | 0.999289 | 7.553196 |
a340ea3c-d32f-45fc-b05a-bf22cbb1d8f4 | MadhuRanjani19/OOPS- | multiplication of given four numbers..cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
double num1, num2, num3, num4;
cout << "Enter the first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
cout << "Enter the third number: ";
cin >> num3;
cout << "Enter the fourth number: ";... | ALGO | 0.998535 | 3.908305 |
27dc7c13-8a32-43e8-87df-856adbc26821 | hypnorose/spoj_legacy | FR_08_06.cpp | #include <bits/stdc++.h>
using namespace std;
// Computes and prints totien of all numbers
// smaller than or equal to n.
long long phi[1<<20];
void computeTotient(int n)
{
// Create and initialize an array to store
// phi or totient values
for (int i=1; i<=n; i++)
phi[i] = i; // indicates not... | ALGO | 0.999732 | 4.637159 |
adc52658-7f6d-44f3-944d-8b13ac81614e | anmol210202/dsaHabits | 0128-longest-consecutive-sequence/solution_2023-09-25_18-23-56.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
unordered_set<int> s(nums.begin(),nums.end());
int a=0;
for(auto &e:s){
int c=0;
if(s.find(e-1)==s.end()){
c=1;
while(s.find(e+c)!=s.end()) c++;
a=max(... | ALGO | 0.999951 | 5.589412 |
cf55972c-aaa0-49b8-860e-fff80dd9d17a | aponom84/lpam-clustering | related_methods/network-community-benchmark-master/comm_algs/GCECommunityFinder/find_communities.cpp | #include <iostream>
#include <map>
#include <algorithm>
#include "graph_representation.hpp"
#include "graph_loading.hpp"
#include "cliques.hpp"
#include "Seed.h"
#include "Community_Finder.h"
#include <string.h>
using namespace std;
//global graph
SimpleIntGraph theGlobalGraph;
//This vector is a map of each node to t... | ALGO | 0.999125 | 5.465681 |
d892feb9-1929-44a1-954b-34ac9f4c6ed0 | KirichenkoPolina/Labs_PSTU | №1 (22.10)/combination.cpp | #include <iostream> //для ввода-вывода
#include <set> //множества
using namespace std;
set<int> BildNumber(const int& a, const int& b, const int& c) { //функция, которая добавляет в множество все возможные перестановки
set<int> number;
for (auto x : { a, b, c }) {
for (auto x1 : { a, b, c }) {
for (auto x2 : ... | ALGO | 0.994354 | 4.299127 |
4feba362-a468-40a0-a3cd-9f39aed04d4e | TRDizer/CSC417_rigid-body-collision | extern/libigl/include/igl/ceil.cpp | template < typename DerivedX, typename DerivedY>
IGL_INLINE void igl::ceil(
const Eigen::PlainObjectBase<DerivedX>& X,
Eigen::PlainObjectBase<DerivedY>& Y)
{
using namespace std;
//Y = DerivedY::Zero(m,n);
//#pragma omp parallel for
//for(int i = 0;i<m;i++)
//{
// for(int j = 0;j<n;j++)
// {
// Y... | ALGO | 0.983751 | 5.363898 |
e4a9f9eb-8e66-4046-886a-d26a0f2bb3ee | 1wooseok/data-structure | Ex0502_Josephus/Ex0502_Josephus.cpp | #include "../shared/Queue.h"
#include <iostream>
using namespace std;
int main()
{
int n = 7, k = 3; // set n and k to the desired values
Queue<int> q(n + 1);
q.SetDebugFlag(false);
// 처음에 n명 추가 (1, 2, ..., n)
for (int i = 1; i <= n; i++)
q.Enqueue(i);
q.Print();
{
while (q.Size() != 1)
{
for (int... | ALGO | 0.999514 | 4.439362 |
f60c5dd6-3618-441f-9ee6-a3155021b684 | thegamer1907/Code_Analysis | DP/2213.cpp | #include<bits/stdc++.h>
using namespace std;
#include <ext/rope>
using namespace __gnu_cxx;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<... | ALGO | 0.999956 | 4.378047 |
6a54f7d1-70cf-448f-9c0a-a2f3bc5e2bf3 | ProgramExecuter/GeeksForGeeks | Medium/Next_Greater_Element.cpp | #include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Function to return Next larger elements
vector<long long> nextLargerElement(vector<long long> arr, int n)
{
// Your code here
stack<int> s;
s.push(0);
long long currMax = arr[0];
vector<long long> res(n, -1);
for (int i = 1; i < n; ++... | ALGO | 0.999733 | 5.995973 |
56231a70-a1c2-48a3-b7e4-24c8297c25d6 | hsh9865/for_study | test/test.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
const int max= 4;
/*
코드 목적 : 한배열의 방을 받고 랜덤하게 배치를하고 길이 어떻게 뚫려있을지 랜덤하게 할당한다
0 : 고립되어있는 방
1 : 옆으로만 뚫려있는방
2 : 옆과 아래로만 뚫려있는 방
3 : 옆과 위로만 뚫려있는 방
*/
int main(){
srand(time(NULL));
int map_list[max][max];
for(int i = 0; i<max... | ALGO | 0.999809 | 3.192381 |
d0a6f49a-ce81-43f9-8f68-246c9a13792e | dependon/durian-ocr | 3rdparty/opencv-4.5.4/3rdparty/carotene/src/sub.cpp | #include "common.hpp"
#include "vtransform.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
template <typename T, typename WT>
struct SubWrap
{
typedef T type;
void operator() (const typename internal::VecTraits<T>::vec128 & v_src0,
const typename internal::VecTraits<T>::v... | ALGO | 0.993613 | 6.165411 |
88f5ad09-7993-4926-9a2c-5d772e2427c4 | sachincool/DS | Sorting/Shell Sort.cpp | #include<iostream>
using namespace std;
int main()
{
int size=10;
int array[size];
cout<<"\nHow many numbers do want to enter : ";
cin>>size;
cout<<"\nEnter the numbers : ";
for (int i = 0; i < size; i++)
{
cin>>array[i];
}
// Sorting
for (int i = size/2; i>0 ; i=i/2)
{
for (int j = i; j <size ; j++... | ALGO | 0.99982 | 3.668446 |
d5181d9a-858d-4484-a2ad-f8c041a5dc9e | ShapeShiftOS-LTS/android_frameworks_av | media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp | /*-------------------------------------------------------------------------*/
#include "BIQUAD.h"
#include "BQ_1I_D16F16Css_TRC_WRA_01_Private.h"
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BQ_1I_D16F16... | ALGO | 0.996433 | 5.340972 |
b01150bc-5eae-4653-8704-35c5d3f622c1 | jarpit2003/Practice-dsa | 0007-reverse-integer/0007-reverse-integer.cpp | class Solution {
public:
int reverse(int x) {
int revnum = 0;
while(x!=0)
{
int lr = x%10;
if(revnum>INT_MAX/10||revnum<INT_MIN/10)
{
return 0;
}
revnum =(revnum*10)+lr;
x = x/10;
}
... | ALGO | 0.999939 | 5.831535 |
a5c20681-14fb-4084-9b5e-959ac318c80b | santushtisharma10/Competitive_Programming | Codeforces_Questions/Problem-C/#642_Board_Moves.cpp | //Codeforces Round #642 (Div. 3)-> problem: (C) Board Moves
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int t;
cin>>t;
while(t--)
{
long long int n;
cin>>n;
long long int ans = 0;
for(int i = n; i >=3; i -= 2) {
an... | ALGO | 0.999579 | 4.367849 |
7615cf1c-2784-49bb-8e73-e97facd671a1 | AMANKUMAR1020/Data-Stucture-and-Algorithm | leetcode/2305_Fair_Distribution_of_Cookies.cpp | class Solution {
public:
int distributeCookies(vector<int>& cookies, int k) {
int ans = INT_MAX;
dfs(cookies, 0, k, vector<int>(k), ans);
return ans;
}
private:
void dfs(const vector<int>& cookies, int s, int k, vector<int>&& children,
int& ans) {
if (s == cookies.size()) {
ans... | ALGO | 0.999962 | 5.482746 |
14542b31-f69c-43e2-a64b-1b37fffb05f0 | Dhruv-Jain31/dsa-basics | 1.arrays/5.reverse_array.cpp | #include <iostream>
using namespace std;
void reverseArray(int *arr, int n){
int s = 0, e = n - 1;
int temp;
while (s < e){
temp = arr[s];
arr[s] = arr[e];
arr[e] = temp; // or swap(arr[s], arr[e]);
s = s+1;
e = e-1;
}
}
int main(){
int arr[] = {10,20,30,45... | ALGO | 0.999411 | 5.107596 |
ef09f60b-b0ad-4653-880c-ec9e68876a3f | EdwinChacko75/chess-engine | backend/src/evaluate.cpp | #include "../include/evaluate.h"
using namespace PieceValues;
int evaluate(const PlayerBitboard& allies, const PlayerBitboard& opponents) {
int alliedPawns = countBits(allies.pawns);
int opposingPawns = countBits(opponents.pawns);
bool isEndgame = (alliedPawns + opposingPawns) < 8;
int pieceValue = pawnValue * ... | ALGO | 0.999506 | 5.431568 |
656be69f-c080-4533-a3d5-4c3e8662b117 | yuhuan12/yuhuan | source/module_hsolver/diago_elpa.cpp | #include "diago_elpa.h"
#include "module_base/global_variable.h"
#include "module_base/lapack_connector.h"
#include "module_base/timer.h"
#include "module_base/tool_quit.h"
extern "C"
{
#include "module_base/blacs_connector.h"
#include "module_base/scalapack_connector.h"
}
#include "genelpa/elpa_solver.h"
typedef ham... | ALGO | 0.99221 | 3.762412 |
699f59bf-5cb2-419e-8f33-cff4552feb94 | Yush1nk1m/cppctl | ch02/practices/1436.cpp | #include <bits/stdc++.h>
using namespace std;
inline bool isValid(int number);
int main() {
int N;
cin >> N;
int i = 665;
while (N)
if (isValid(++i))
N--;
cout << i;
return 0;
}
inline bool isValid(int number) {
string nstr = to_string(number);
... | ALGO | 0.997764 | 4.422101 |
677a0feb-cdd2-463a-97ff-3123765f69ca | Shehzadchouhan/physics-experiments | cpp/exp 4/main.cpp | #include <iostream>
#include <limits> // Include this header for std::numeric_limits
using namespace std;
int n;
double e = 1.6e-19;
// strating function
void printWelcomeMessage()
{
std::cout << "******************************************************" << std::endl;
std::cout << "* ... | ALGO | 0.926024 | 4.278661 |
c6efa46b-9cfe-45fd-adc1-e2bf4420a1df | Marodriguezfu/Gvoice | lib/windows/openFramework/libs/openFrameworks/math/ofMatrix4x4.cpp |
#include "ofMatrix4x4.h"
#include "ofConstants.h"
#include <limits>
#include <stdlib.h>
#include <iomanip>
using namespace std;
#if (_MSC_VER)
#undef min
// see: http://stackoverflow.com/questions/1904635/warning-c4003-and-errors-c2589-and-c2059-on-x-stdnumericlimitsintmax
#endif
inline bool equivalent(double lhs... | ALGO | 0.989801 | 6.461686 |
26b705b2-463f-4be4-bfa4-710170cce015 | NSergeevich87/C-All-Projects | GB_C++/1_Basics_C++/8_13_05_24/task_6.cpp | /** Метеостанция
Для удобства работы сотрудников международной метеостанции каждый день нужно распечатывать различные
таблицы соответствия градусов по шкалам Цельсия и Фаренгейта. Напишите программу, которая принимает на вход
три целых числа в градусах Цельсия: нижняя граница температуры, верхняя граница температуры ... | ALGO | 0.991848 | 4.040268 |
6fa37136-a8d5-4d7e-a095-7bd762b4ba64 | Rachana-shaik19/cpp | Containers/Sequential/Forward_list.cpp | #include<iostream>
#include<forward_list>
using namespace std;
int main()
{
forward_list<int> single_list = {1, 2, 3};
for(auto i = 0; i < 5 ; i++ )
{
single_list.push_front(i);
}
int count = 0;
for(int i : single_list)
{
count++;
cout << i << " ";
}
cout << "... | TOOL | 0.939414 | 3.434992 |
fd01cf8c-a9de-4692-b43f-d79aff28e05a | LyTuan/C-H-2016 | Tuan 6 _ De Qui/InXauNhiPhanDoDaiN.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int N=3;
void binary(int A[],int i){
int v;
for(v=0; v<2; v++){
A[i]=v;
if(i<N-1){
binary(A,i+1);
}else{
int j;
for(j=0; j<N; j++){
cout<<A[j];
}
cout<<endl;
}
}
}
int main(){
int A[100];
binary(A,0);
return 0;
}
| ALGO | 0.999824 | 3.447202 |
c24b2491-330c-4054-aad9-bf865b35d200 | kenanwastaken/ptrbase | src/Helpers/Math/Math.cpp | #include "Math.h"
double Math::CropAngle180(double angle)
{
while (angle <= -180.0) angle += 360.0;
while (angle > 180.0) angle -= 360.0;
return angle;
}
| TOOL | 0.961787 | 6.052773 |
32b2c471-6360-451b-9661-406a3d1d9fc4 | mcerwenetz/OOP_Bohli_HS_Mannheim | Uebungsblaetter/UB4_A1/main.cpp | /*
* main.c
*
* Created on: 06.05.2019
* Author: swt
*/
#include "Max.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
int len=5;
int* integerarry= new int[len]{1,2,3,4,5};
int integer_ergebnis;
integer_ergebnis= max(integerarry,len);
char* chararray = new char[len]{'a','b'... | TOOL | 0.889481 | 4.101879 |
ef0aca1c-b3cb-4382-9650-56047fa58382 | G33k1973/CodingGames | sudoko.cpp | #include<bits/stdc++.h>
using namespace std;
unordered_set<int> rows[9], cols[9];
using ip = pair<int, int>;
vector<ip> points;
bool issafe(int i, int j, int x, vector<vector<char>>& A) {
if (rows[i].count(x) > 0 || cols[j].count(x) > 0)return false;
int rs = i / 3, cs = j / 3;
unordered_set<char> h;
h.insert(x + '... | ALGO | 0.999885 | 5.86211 |
ce810f23-42e8-4f01-acb2-87cb2454ce17 | aman-harness/ai-gp | mycode/OJ/spoj/KPPOLY.cpp | /*
Problem: 1431. Projections Of A Polygon
Judge: spoj
Author: Alchemist
Data: 2011/7/20
Category: MATH
Difficulty: ***
*/
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <memory.h>
#include <assert.h>
#include <algorithm>
#include <functional>
#i... | ALGO | 0.999914 | 4.067562 |
88843abf-46cd-46ae-82f0-2fcffcad7b9c | ishandutta2007/codeforces | dreamoon_love_aa/normal/22/B.cpp | #include<stdio.h>
#include<algorithm>
using namespace std;
char Map[32][32];
int dp[32][32];
main(){
int n,m,i,j,ii,jj,an=0;
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)scanf("%s",Map[i]+1);
for(i=1;i<=n;i++)
for(j=1;j<=m;j++){
if(Map[i][j]=='0')dp[i][j]=dp[i-1][j]+... | ALGO | 0.999895 | 3.33478 |
e61daa5f-041b-420b-a109-26b2d897b887 | archana01072003/Coding | two_sum.cpp | #include <bits/stdc++.h>
using namespace std;
bool twoSum(vector<int>v, int k)
{
for(int i = 0; i<v.size()-1; i++)
{
for(int j = i+1; j<v.size(); j++)
{
if(v[i] + v[j] == k)
return true;
}
}
return false;
}
int main() {
int n;
cin >> n;
vector<... | ALGO | 0.99991 | 5.79592 |
34a97e82-75c3-4a8c-ae1c-4f45f72709b8 | priyankjairaj100/Codeforces-Solutions | contest/872/a/31337462_wrong_answer_2.cpp | #include <bits/stdc++.h>
using namespace std;
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
int x,y; cin>>x>>y;
int a[x],b[y];
for (int i = 0; i < x; ++i)
{
cin>>a[i];
}
for (int i = 0; i < y; ++i)
{
cin>>b[i];
}
qsort(a,x,sizeof(int),compare);
qsort(b,y,... | ALGO | 0.999653 | 3.056747 |
5a9f5037-5977-4b5a-9841-6331d98eb4ed | 8prashant/leetcode | 2477-minimum-fuel-cost-to-report-to-the-capital/2477-minimum-fuel-cost-to-report-to-the-capital.cpp | class Solution {
public:
long long int ans=0;
vector<long long int> dfs(long long int a,vector<vector<long long int>> &graph,vector<long long int> &vis,int &space){
long long int car=0,seats=0;
vis[a]=1;
for(auto x:graph[a]){
if(vis[x]==-1){
vector<long long i... | ALGO | 0.999908 | 5.564412 |
17e86163-5cbf-4bbe-82af-847b603a2d00 | mayanksinha963/DSA | input/practice/bit/merge_sort_1.cpp | #include<iostream>
using namespace std;
void merge (int arr[], int n, int low, int mid, int high)
{
int *new_arr = new int [n];
//int new_arr[n];
int i = low;
int j= mid+1;
int k = low;
while (i <= mid && j<= high)
{
if (arr[i] <= arr[j])
{
new_arr[k] = arr[i];
... | ALGO | 0.999944 | 5.211107 |
2665c90d-5e2d-45a0-a4a0-96fc9c9fa848 | prabudh12/Competitive-Programming | Sorting/QuickSortusingLomuto.cpp | #include <bits/stdc++.h>
using namespace std;
int iPartition(int arr[], int l, int h)
{
int pivot=arr[h];
int i=l-1;
for(int j=l;j<=h-1;j++){
if(arr[j]<pivot){
i++;
swap(arr[i],arr[j]);
}
}
swap(arr[i+1],arr[h]);
return i+1;
}
void qSort(int arr[],int... | ALGO | 0.999937 | 5.031453 |
250c114a-123b-4b9d-9449-1b2c323f8ffb | VanditManiar/ModernCpp | Examples/Cpp-11/lambda.cpp | /*
Author : Vandit Maniar
Easy-Way-Of-Exploring-Cpp/ModernCpp
C++ 11 Example : Lambda Function
*/
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool isMax(int a, int b)
{
return a > b;
}
void printVector(auto v)
{
for(auto x : v)
cout << x << endl;
}
int ma... | ALGO | 0.999643 | 5.671874 |
48e9465c-bc5e-4b40-a3eb-2de9b539c420 | hxzinh/VOI | COMPANYQUERY/main.cpp | #include <bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define pii pair<int, int>
#define mp make_pair
#define fi first
#define se second
#define ALL(v) (v).begin(), (v).end()
#define popcount(x) __builtin_popcount(x)
#define setp(x) setprecision(x)
#define MASK(x) (1LL << (x))
#define BIT(x, i) ((x) >> (... | ALGO | 0.998441 | 3.530114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.