uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f6d747d0-dad3-4d53-849d-64d6b5266a32 | EASINTUHA/Codechef-My-All-Solution | Minimum_number_of_coins.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x)... | ALGO | 0.999889 | 4.551587 |
513ffbf8-3461-46cf-a5ef-a388ebe6b366 | abhiXsliet/Solved-DSA-Problems | Pratice Problems Topic Wise/Arrays/single-number-ii.cpp | // https://leetcode.com/problems/single-number-ii/
#include <bits/stdc++.h>
using namespace std;
class Solution {
private:
// TC = O( N * N )
int solve_brute(vector<int>& nums) {
int n = nums.size();
for (int i = 0; i < n; i++) {
bool isUnique = 1;
for (int j = 0; j < ... | ALGO | 0.999727 | 5.801456 |
54e463ca-4258-466d-9b13-c4394ab24c5c | Lesords/ACM | codeforces/contests/Div3/Codeforces Round #661 (Div. 3)/1399E1 Weights Division (easy version).cpp | #include<iostream>//ac
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define INF 0x3f3f3f3f
#define fi first
#define se second
using namespace std;
//⣺dfsÿĴȻ̰ıֵ
const int MAXN = 1e5+5;
struct node{
int v,nu... | ALGO | 0.999982 | 3.783683 |
888e74a2-4c79-4712-9f3a-5dff9819fd60 | Zrini2005/IPMP | week2/linklists/sort.cpp | //merge sort nly
class Solution {
public:
ListNode* getmid(ListNode* head) {
ListNode* slow = head;
ListNode* fast = head->next;
while (fast != NULL && fast->next != NULL) {
slow = slow->next;
fast = fast->next->next;
}
return slow;
}
ListNode... | ALGO | 0.999988 | 5.630809 |
036c758f-2491-42f5-9a32-22f62c700805 | ZakByeol/BaekJun | 단계별문제/단계별문제_12_브루트포스/12_1_2798_블랙잭.cpp | #include <cstdio>
int main()
{
unsigned int NUM_CARD, MAX_SUMVALUE,RESULT_VALUE = 0; // 변수 초기하 필수!
scanf("%d %d", &NUM_CARD, &MAX_SUMVALUE);
// CARD_NUMBER 라는 정수 배열을 선언
int CARD_INDEX[NUM_CARD];
// CARD_NUMBER에 해당하는 인덱스에 카드 숫자 할당
for (int i = 0; i < NUM_CARD; ++i) {
scanf("%d", &CARD_... | ALGO | 0.999949 | 4.548249 |
7e1f6597-1651-4356-a529-6829c9a4e789 | ChoongGhee/DataStructure_Study | Ex1103_HashTable/Ex1103_HashTable.cpp | #include <iostream>
#include <string> // std::string
using namespace std;
template<typename K, typename V>
class HashTable
{
public:
struct Item
{
K key = K();
V value = V();
};
HashTable(const int& cap = 8)
{
capacity_ = cap;
table_ = new Item[capacity_];
}
~HashTable()
{
delete[] table_;
}
vo... | ALGO | 0.996292 | 5.332149 |
b4071365-8b59-4651-9f8c-b5731fc238dd | ishandutta2007/codeforces | aropan/normal/1370/C.cpp | #include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
#define dbg(x)... | ALGO | 0.999914 | 4.027667 |
ec4da3af-2bcc-4898-851b-1aaf75f6d303 | sormo/box | box2d/Box2D/Collision/b2DynamicTree.cpp | #include <Box2D/Collision/b2DynamicTree.h>
#include <string.h>
b2DynamicTree::b2DynamicTree()
{
m_root = b2_nullNode;
m_nodeCapacity = 16;
m_nodeCount = 0;
m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode));
memset(m_nodes, 0, m_nodeCapacity * sizeof(b2TreeNode));
// Build a linked list for th... | ALGO | 0.996964 | 7.784336 |
204aef83-2656-4966-b920-2ccb81965d31 | IshrakAbedin/MinHasher | src/main.cpp | #include <iostream>
#include "MinHasher.hpp"
int main()
{
using dtype = int;
MinHasher<dtype>::datalist_t setList{
{1, 0, 0, 1, 0},
{0, 0, 1, 0, 0},
{0, 1, 0, 1, 1},
{1, 0, 1, 1, 0}
};
MinHasher<dtype>::hashfunclist_t hashFunctions{
[](dtype x) { return (x + 1) % 5; },
[](dtype x) { return (3 * x + ... | ALGO | 0.98221 | 5.868246 |
6a87c8f9-e1df-40d2-9ecb-dd9e306c2866 | singi/vbox | src/VBox/Additions/3D/mesa/mesa-17.3.9/src/intel/compiler/brw_fs_live_variables.cpp | #include "brw_cfg.h"
#include "brw_fs_live_variables.h"
using namespace brw;
#define MAX_INSTRUCTION (1 << 30)
/** @file brw_fs_live_variables.cpp
*
* Support for calculating liveness information about virtual GRFs.
*
* This produces a live interval for each whole virtual GRF. We could
* choose to expose per-c... | ALGO | 0.904193 | 7.721983 |
5cc56aa9-2bf7-49dc-99d2-b809ae94eac4 | sainiu692/c-_file | loops/basics/sumOfNumbers.cpp | #include <iostream>
using namespace std;
int main()
{
int num;
int i = 0; // loop variable
int sum = 0;
cout << "enter number: ";
cin >> num;
while (i <= num) // condition
{
sum = sum + i;
i++; // updating loop variable
}
cout << "sum of numbers: " << sum << endl;
... | ALGO | 0.999078 | 3.271474 |
993425fa-997d-4d00-8d26-e67f9169f414 | SatyaKanth-6627/ProblemSolving_Practicse-jan-5-25 | LeetcodeProblems/https:/leetcode.com/problems/shifting-letters-ii/description/?envType=daily-question&envId=2025-01-05.cpp | // problem link
// https://leetcode.com/problems/shifting-letters-ii/description/?envType=daily-question&envId=2025-01-05
// Source Code
class Solution {
public:
string shiftingLetters(string s, vector<vector<int>>& shifts) {
vector<int> arr(s.length(), 0);
for(int i = 0;i < shifts.size();i++){
... | ALGO | 0.999904 | 5.762328 |
df4f3fa0-2232-4edf-a539-051fb681ffbd | msgdgzmn/C-Sample-Games | PACMAN.cpp | #include <iostream>
#include <stdio.h>
#include <windows.h>
#include <string>
#include <vector>
using namespace std;
char tmp_map[18][32];
char map[18][32] =
{
"+#############################+",
"| |",
"| |",
"|## ########### ## #########|",
"| | ... | ALGO | 0.995465 | 3.151727 |
16cff6b2-996a-49b1-9729-2c30236d74de | mukuldeep/cs | cp/CodeChef/cdcf_MAXTOPO_weighted_tree.cpp | //
// Created by me on 13-3-2021.
//
#include <bits/stdc++.h>
#define ll long long
#define t9p7 1000000007
using namespace std;
ll fac[500005]={0},inv_fac[500005]={0};
ll gcdExtended(ll a, ll b, ll* x, ll* y)
{
if (a == 0)
{
*x = 0, *y = 1;
return b;
}
ll x1, y1;
ll gcd = gcdExtende... | ALGO | 0.999953 | 4.405359 |
6bc14485-afa1-46b5-981f-bb4584fe391c | showmanlee/HowCanISolveThisQuestion | BOJ/9000/9214.cpp | // 첫 번째 항
// https://www.acmicpc.net/problem/9214
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
string func(string s) {
if (s.length() % 2 == 1) {
return s;
}
string ss;
for (int i = 0; i < s.length(); i += 2) {
for (int j = 0; j < s[i] - '... | ALGO | 0.999345 | 5.903697 |
62bf8fc7-6f3b-4699-9996-075f3ce2a028 | bobazrh/Bobaz-RH | dep/src/g3dlite/AABox.cpp | /**
@file AABox.cpp
@maintainer Morgan McGuire, <EMAIL>
@created 2004-01-10
@edited 2006-01-11
*/
#include "G3D/platform.h"
# if defined(_MSC_VER) && (_MSC_VER <= 1200)
// VC6 std:: has signed/unsigned problems
# pragma warning (disable : 4018)
# endif
#include <assert.h>
#include "G3D/AA... | TOOL | 0.927584 | 7.723303 |
1966e495-229d-41ad-abd4-b4fa5d2f5a8a | SaifulJnU/LeetCode300 | 0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
//implementation from striver
int s=0;
int e=nums.size()-2;
int mid;
while(s<=e)
{
mid=s+(e-s)/2;
if(nums[mid] == nums[mid^1]) //previ... | ALGO | 0.999927 | 5.859159 |
2c09a027-bff6-424a-9d7d-b4bf4467b507 | AkashGupta21BCE10306/DSA_Streak | day89.cpp | class Solution
{
public:
int mod=1e9+7;
int padovanSequence(int n)
{
//code here
if(n<=2){
return 1;
}
vector<int>p(n+1,0);
p[0]=p[1]=p[2]=1;
for(int i=3; i<=n;i++){
p[i]=(p[i-2]+p[i-3])%mod;
}
return p[n];
}
... | ALGO | 0.999984 | 5.117464 |
4497c574-a7f2-4264-9522-0532c75b9383 | lee20h/TIL | Problem Solving/BOJ/2920. 음계.cpp | #include <iostream>
using namespace std;
int main() {
int b[8];
int a=0, d=0;
cin >> b[0];
for (int i=1; i<8; i++) {
cin >> b[i];
if(b[i-1] < b[i]) a++;
else if (b[i-1] > b[i]) d++;
}
if(a==7) cout <<"ascending";
else if (d==7) cout << "descending";
else cout << "mixed";
}
| ALGO | 0.99994 | 3.566508 |
171f5ad1-3a12-432e-a059-c492001fad76 | harjotscs/cpp-programmes | friend operator.cpp | #include<iostream>
using namespace std;
class k{
private:
int x,y,z;
public:
h(int a,int b,int c)
{
x=a;
y=b;
z=c;
}
int o()
{
cout<<x<<endl;
cout<<y<<endl;
cout<<z<<endl;
}
friend int operator++(k &);
friend int operator--(k &);
friend int operator++(k &,int);
friend int oper... | ALGO | 0.996137 | 3.556767 |
78a7be4b-0461-4257-9ba5-cb9ccc547eb2 | khanhtran219/DSA | kytukhonglap.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
string s;
getline(cin >> ws,s);
int a[1000]={0};
for(int i = 0; i < s.length(); i++){
a[(int)s[i]]++;
}
for(int i = 0; i < s.length(); i++){
if(a[(int)s[i]] == 1) cout <<s[i];
}
cout <<endl;
}
return 0;
}
| ALGO | 0.999864 | 3.525223 |
a8c91dee-6fd7-4e0a-9b91-5142f1783280 | dkg2005/DSA-LOGIC-BUILDS | STACK/stack.cpp | // IMPLEMENTATION THROUGH STL, ARRAY, LINKED LIST
#include<iostream>
// #include<stack>
using namespace std;
class Stack{
public:
int * arr;
int top ;
int size ;
Stack(int size){
this->size = size;
arr = new int[size];
top = -1;
}
// PUSH FUNCTION
void push(... | ALGO | 0.995563 | 4.534204 |
94f5d06f-849c-40c3-9c31-6f6c41559d30 | ltf0501/NoName | Contest/2014 ECNA/F.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr pair<int, int> kDirs[4] = {{-1, 0}, {0, 1}, {0, -1}, {1, 0}};
constexpr int kN = 101, kInf = 0x3f3f3f3f;
vector<pair<int, int>> g0[kN][kN], g1[kN][kN];
int dist0[kN][kN], dist1[kN][kN], order[kN][kN], timer, n, m;
bool possible;
tuple<int, int, int, int, char> a... | ALGO | 0.999835 | 5.050563 |
251f474a-8b8b-4676-92bd-657f0ab998dd | eat-swap/LeetCodeDaily | cpp/2202/220213.cpp | #include <vector>
#include <cstdio>
/**
* 78. Subsets
* Given an integer array nums of unique elements, return all possible subsets (the power set).
* The solution set must not contain duplicate subsets. Return the solution in any order.
*/
class Solution {
public:
static std::vector<std::vector<int>> subsets(co... | ALGO | 0.998739 | 6.277032 |
5e5609f2-1f56-45fa-b2db-036f7eee94b4 | Rajhitu/OOPS | LAB8_OPERATOR_OVERLOADING/q4_distance_friend.cpp | //Q3.distance(>)operator
#include <bits/stdc++.h>
using namespace std;
class db_025
{
int feet_025;
int inches_025;
public:
void input()
{
cin >> feet_025 >> inches_025;
}
void display()
{
cout << feet_025 << "''" << inches_025 << "'\n";
}
friend bool operator >(d... | ALGO | 0.980688 | 3.446033 |
a3752582-9252-4249-b3cc-65c437d36b13 | beeonlune/school-programs | Алгоритмы обработки массивов/Сколько равно X/main.cpp | #include <iostream>
using namespace std;
int main()
{
int A[10000];
int n, x, k=0, i;
cin>>n;
for (i=0; i<n; i++)
{
cin>>A[i];
}
cin>>x;
for (i=0; i<n; i++)
{
if (A[i]==x) k=k+1;
}
cout<<k<<endl;
}
| ALGO | 0.999668 | 4.408904 |
18dabb05-e541-4ec5-ae17-de6cee21b38c | IbrahimGaberOfficial/Algorithms-Solutions | 06_Topological_Sort/topSort.cpp | #include <bits\stdc++.h>
using namespace std;
class Solution {
private:
vector<int> topSort(vector<vector<int>> &graph, queue<int> &nodes,
vector<int> &indegree) {
vector<int> ordering;
// loop on queeue and decresase indegree of nighbour
while (nodes.size() != 0) {
... | ALGO | 0.999986 | 5.752261 |
78840af1-940a-4ffe-81a1-a354032dee86 | mushfiqurgalib/dbms | kdtree.cpp | #include<bits/stdc++.h>
using namespace std;
int k=2;
typedef unsigned int udef;
struct Node
{
vector<int>point;
Node *left,*right;
};
struct Node *newnode(int arr[])
{
struct Node *temp=new Node;
for(int i=0;i<k;i++)
temp->point.push_back(arr[i]);
temp->left=NULL;
temp->right... | ALGO | 0.999635 | 3.836175 |
4cd8b8f5-6cc2-4fb6-899f-a45e56cd8e24 | manikanta2901/ubuntu | .history/random/trees/QuerySum_20200729143725.cpp | #include<iostream>
using namespace std;
#define n 10000
int n,arr[n],t[4 * n];
int main(){
cout << "Enter the size \n";
cin >> n;
cout << "Enter the elements of the array\n";
for(int i = 0; i < nj)
return 0;
} | ALGO | 0.994434 | 3.096119 |
6b74fe1c-2f91-445e-9575-c8ece0878b55 | YB73/DSA-QUES | 2232-minimize-result-by-adding-parentheses-to-expression/2232-minimize-result-by-adding-parentheses-to-expression.cpp | class Solution {
public:
// 12345678 + 12345678
// 1234567(8+1)2345678
// 1234567(8+12)345678
// find the index of plus sign
int findPlus(string s,int n)
{
for(int i=0;i<n;i++)
{
if(s[i]=='+')
return i;
}
return -1;
}
... | ALGO | 0.999962 | 5.26085 |
20486b58-5723-40a5-9e16-5fe09e3e423a | totiecaceres/NumericalMethodsFindingRoots | NewtonRapson.cpp | #include<iostream>
#include<cmath>
using namespace std;
double func(int n, double x)
{ double y;
if(n==1){y=pow(x,5)-21*pow(x,2)-8*pow(x,3)-4*pow(x,4)-28*x+60;}
else if(n==2){y=pow(x,3)-pow(x,2)+exp(x);}
else if(n==3){y=x*exp(-x);}
else if(n==4){y=sin(x)+3*cos(x)-2;}
else if(n==5){y=pow(x,4)+2*p... | ALGO | 0.999932 | 3.699038 |
2432b003-64f8-468e-860c-1177563b283d | VaporumCoin/VaporumCoin-daemon | src/coins.cpp | #include "coins.h"
#include "memusage.h"
#include "random.h"
#include "version.h"
#include "policy/fees.h"
#include "komodo_defs.h"
#include "importcoin.h"
#include <assert.h>
/**
* calculate number of bytes for the bitmask, and its number of non-zero bytes
* each bit in the bitmask represents the availability of ... | TOOL | 0.943097 | 5.952651 |
0f4e023a-1631-4142-b500-99ace93c1af1 | DebabrataMitra2002/DSA | DSA_C++/Palindromic_Substrings.cpp | #include<bits/stdc++.h>
using namespace std;
int longestPalSubstr(string str)
{
int hi,low;
int n = str.length();
int count1=0, count2=0;
for(int i = 0; i < n ; i++)
{
//for even palindrome :
hi=i;
low=i-1;
while(low>=0 && hi<n && str[low]==str[hi])
{
count2++;
... | ALGO | 0.999548 | 5.300582 |
a898b65b-0161-4aa5-b6f1-57a38a0760d0 | JJungs-lee/problem-solving | LeetCode/153. Find Minimum in Rotated Sorted Array.cpp | // [2,3,4,5,6,0,1]
// ^ ^
// [6,0,1,2,3,4,5] answer must be in left part
// ^ < ^
// [0,1,2,3,4,5,6] answer must be in left part
// ^ < ^
// [1,2,3,4,5,6,0]
// ^ ^
class Solution {
public:
int findMin(vector<int>& nums) {
int l = 0;
int r = nums.size() - 1;
while (l < r... | ALGO | 0.999996 | 5.747968 |
b8bb4adb-7986-4daf-9dba-2eac21a09f87 | dwight/amino | examples/for_each.cpp | #include <iostream>
#include <amino/foreach.h>
#include <amino/thread.h>
#include <amino/ftask.h>
#include <amino/tp_exec.h>
#include <sys/time.h>
#include <unistd.h>
using namespace amino;
// global variable for sum result
int result = 0;
void
sum (int n)
{
result += n;
}
const static int NUM = 100;
int
m... | ALGO | 0.994671 | 5.003561 |
162d1dc5-81f2-4bf8-97e3-5d074a91bf18 | crystax/android-vendor-boost-1-62-0 | libs/intrusive/example/doc_entity.cpp | using namespace boost::intrusive;
//A class that can be inserted in an intrusive list
class entity : public list_base_hook<>
{
public:
virtual ~entity();
//...
};
//"some_entity" derives from "entity"
class some_entity : public entity
{/**/};
//Definition of the intrusive list
struct entity_list : list<en... | TOOL | 0.905921 | 5.08235 |
69367c93-758f-456e-897a-82799702b64f | Sanyukkie/AngryBirds | libs/Box2D/include/Box2D/Dynamics/b2ContactManager.cpp | #include <Box2D/Dynamics/b2ContactManager.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Dynamics/Contacts/b2Contact.h>
b2ContactFilter b2_defaultFilter;
b2ContactListener b2_defaultListener;
b2ContactManager::b2ContactManager()... | ALGO | 0.979201 | 6.955931 |
a7555bfd-7ce8-4bbd-b2a2-fd853bd3d3ca | ionan/uva-oj | code/10919_Prerequisites.cpp | /*
Freddie the frosh has chosen to take k courses. To meet the degree requirements, he
must take courses from each of several categories. Can you assure Freddie that he
will graduate, based on his course selection?
INPUT
Input consists of several test cases. For each case, the first line of input contains
1 ≤... | ALGO | 0.999441 | 4.342409 |
78e0f2b3-1e80-481a-986e-35f1a077b04c | AlexeyVolchenkov/pracTaskMas_TaskList | angryballs.cpp | #include <iostream>
#include <cmath>
using namespace std;
const float g = 9.8;
struct Ball {
double m;
double v = 0;
double h;
};
void init(Ball* ball, double m, double h){
ball->m = m;
ball->h = h;
ball->v = 0;
}
void show(Ball* ball) {
cout << "h = " << round(ball->h) << endl;
cout << "v = " << round(ball-... | ALGO | 0.998712 | 4.0784 |
8dccda17-28fc-4096-b1ec-4d04050c31ae | PiperBetle/MyCode | P3623 APIO2008 免费道路.cpp | #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#define int long long
using std::cin;using std::cout;
struct edge{int u,v;bool flag;};
std::vector<edge>a,b,ans;
inline int find(int x){return f[x]==x?x:f[x]=find(f[x]);}
int f[1000007];bool b[1000007];
signed mai... | ALGO | 0.999983 | 3.898497 |
7043eae3-063b-4b22-9a41-f5ec488641b7 | AscendNTNU/AirSim | Source/AirLib/src/common/common_utils/FileSystem.cpp | // in header only mode, control library is not available
#ifndef AIRLIB_HEADER_ONLY
#include "common/common_utils/FileSystem.hpp"
#include "common/common_utils/Utils.hpp"
#include <codecvt>
#include <fstream>
#include <cstdio>
#include <string>
#if defined _WIN32 || defined _WIN64
#include "common/common_utils/Wind... | TOOL | 0.921817 | 6.926151 |
c479c559-c866-4718-91c7-744b8de8c259 | GunnarGunnarsson/bark-rideshare | thirdparty/linux/miracl/miracl_osmt/source/curve/pairing/peks.cpp | /*
Boneh, Di Crescenzo, Ostrovsky & Persiano
Public Key Encryption with keyword Search
See http://eprint.iacr.org/2003/195.pdf
Section 3.1
(From reading the protocol to a working implementation - 10 minutes!)
Compile with modules as specified below
For MR_PAIRING_CP curve
cl /O2 /GX peks.cpp... | ALGO | 0.985317 | 4.424041 |
001c1d2b-c27e-48da-aef0-997d4cd9794f | hanabzu/BOJ-algorithm-study | Class_04/BOJ_16953_AtoB/main.cpp | /* hanabzu */
/* BOJ_16954 A→B */
#include <iostream>
#include <queue>
using namespace std;
long long A, B, u, v[2], t = 2, q_count = 1;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> A >> B;
queue<int> q;
q.push(A);
while (!q.empty()) {
u = q.front();
q.pop();
... | ALGO | 0.999953 | 3.750229 |
b769b671-37a5-461c-a5bc-fbff61ab4b94 | moinologics/CSES-Cpp-solutions | Introductory Problems/PalindromeReorder.cpp | #include <iostream>
#include <map>
using namespace std;
typedef long long ll;
int main()
{
int oddCount=0;
char oddchar;
map<char,int> m; //map is like "array of pairs"
string s;
cin>>s;
for(char c : s)
{
m[c] = (m.count(c)==0) ? 1 : (m[c]+1);
}
for(auto p : m)
{
... | ALGO | 0.999996 | 4.437294 |
ae628392-fb76-49c2-b519-403ecbeffebc | Bungmint/competitiveprogramming | contest/USACO/Dec 2016 Platinum/B.cpp | // Problem: Problem 2. Team Building
// Contest: USACO - USACO 2016 December Contest, Platinum
// URL: http://www.usaco.org/index.php?page=viewproblem2&cpid=673
// Memory Limit: 256 MB
// Time Limit: 4000 ms
//
// Powered by CP Editor (https://cpeditor.org)
using namespace std;
using ll = long long;
using vi = vecto... | ALGO | 0.999972 | 3.814075 |
2a07f70d-13c5-4c6f-b3f8-9b613e94edd6 | sarthaknarang060402/CPP-DSA-CodingNinjas | Backtracking/Subset Sum.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll subsetSum(ll arr[], ll n, ll i, ll sum, ll count)
{
if (i == n)
{
if (sum == 0)
count++;
return count;
}
count = subsetSum(arr, n, i + 1, sum - arr[i], count);
count = subsetSum(arr, n, i + 1, sum, cou... | ALGO | 0.999298 | 4.383848 |
1ab82bbb-ec12-474c-8682-23c36111ca4f | jiangzhongshi/bichon | src/prism/cgal/polyhedron_self_intersect.cpp | #include "polyhedron_self_intersect.hpp"
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_mesh_processing/self_intersections.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/box_intersection_d.h>
#include <igl/vertex_triangle_adjacency.h>
#include <prism/common.hpp>
#include <iost... | ALGO | 0.995929 | 6.00821 |
55bb718f-6a3a-4237-9dc4-102a5d6928f0 | mintrax/mintrax | src/core_read.cpp | #include "core_io.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "serialize.h"
#include "streams.h"
#include <univalue.h>
#include "util.h"
#include "utilstrencodings.h"
#include "version.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/... | TOOL | 0.860613 | 6.963654 |
2a02ba7e-e5fd-42cf-95be-8f80f7083bec | lucastarche/entrenamientou | CSES - CSES Problem Set/Additional Problems I/CSES-distinct-values-splits.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define per(i, a, b) for (int i = (int)(b) - 1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vii = vector<pii>... | ALGO | 0.999981 | 4.702604 |
b2ce2e29-41bd-4b1e-a26d-ef6e99685a7c | anoshak/EPI-Linked-Lists | EPI-Linked List/Q7_Delete_node.cpp | /*
* Q7_Delete_node.cpp
*
* Created on: Nov 8, 2015
* Author: Anoshak
*/
#include "common_utils.h"
class Solution {
public:
void deleteNode(ListNode* node) {
node->val = node->next->val;
ListNode* temp = node->next;
node->next = node->next->next;
free(temp);
}
};
| ALGO | 0.998462 | 5.355436 |
e69506c8-8db2-4a36-93e7-204ee95a8a5e | ahmadel1/LeetCode | 1905-count-sub-islands/1905-count-sub-islands.cpp | class Solution {
public:
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, -1, 1};
bool validate(int x, int y, int rows, int cols, vector<vector<int>>& grid2, vector<vector<int>>& visited){
return (x >= 0 && x < cols && y >= 0 && y < rows && grid2[y][x] && !visited[y][x]);
}
void findIslands(ve... | ALGO | 0.999911 | 6.116934 |
4f909e06-d88c-415c-afc8-8a52ba76fe6c | pengcuo/armnn-android | boost/boost_1_64_0/libs/graph/example/bellman-example.cpp | using namespace boost;
template < typename Graph, typename ParentMap >
struct edge_writer
{
edge_writer(const Graph & g, const ParentMap & p)
: m_g(g), m_parent(p)
{
}
template < typename Edge >
void operator() (std::ostream & out, const Edge & e) const
{
out << "[label=\"" << get(edge_weight, m_... | ALGO | 0.99914 | 5.759479 |
242cecfe-2335-4c25-a3fa-69c53c35f7f9 | PorUna-byte/DSAAAIC | Trie/Trie/main.cpp | #include "Trie.hpp"
int main(int argc, const char * argv[]) {
Trie trie;
// Input keys (use only 'a' through 'z'
// and lower case)
string keys[] = { "the", "a", "there",
"answer", "any", "by",
"bye", "their", "hero", "heroplane" };
int n = sizeof(keys) / sizeof(keys[0]);
// Con... | ALGO | 0.999463 | 5.830816 |
e5d298d5-04bd-4878-b799-97941388bf1b | Nagisa12321/CPP-Primer | code/ch16/template0.cpp | #include "primer.h"
using namespace std;
int compare(const string &v1, const string &v2) {
cout << "compare string" << endl;
if (v1 < v2) return -1;
else if (v2 < v1) return 1;
else return 0;
}
int compare(const double &v1, const double &v2) {
cout << "compare double" << endl;
if (v1 < v2) ret... | ALGO | 0.991409 | 4.555087 |
2aa54f26-a53c-4414-9580-c27d558d2212 | Faraz-mobin17/codingninjas-solutions | Trees/Binary_Tree/diamter.cpp | #include <iostream>
#include "BinaryTreeNode.h"
using namespace std;
int height(Node *root)
{
if (root == nullptr)
{
return 0;
}
int leftHeight = height(root->left);
int rightHeight = height(root->right);
return (1 + max(leftHeight, rightHeight));
}
int diameter(Node *root)
{
if (roo... | ALGO | 0.999906 | 6.499007 |
6665d1e9-f016-4146-8e23-7fa1a83592fb | mohiuddin007/DS-Basic | assignment_module32/ques9.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
};
Node* newNode(int data)
{
Node* temp = new Node;
temp->data = data;
temp->left = temp->right = NULL;
return (temp);
}
bool is_unival(Node* root){
if (!root) {
return true;
}
... | ALGO | 0.99998 | 4.930017 |
77eb2bca-6a13-415e-8167-34cd0bb0458d | rushil180101/dsa-course-1-learning | Algorithm/moore_voting_majority_element.cpp | #include <bits/stdc++.h>
using namespace std;
// Moore voting algorithm
int find_majority_element(int arr[], int n)
{
int e = arr[0];
int c = 1;
for (int i=1; i<n; i++)
{
if (arr[i] == e)
{
c++;
}
else
{
c--;
if (c == 0)
... | ALGO | 0.999941 | 4.933883 |
90f252ec-3f91-4f7d-a652-4a6e5c5f24a3 | AymenChla/competitive-programming-training | Codeforces Round #431 (Div. 2)/B/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n;
cin >> n;
long long a[n];
for(int i=0 ; i < n ; i++)
cin >> a[i];
int i=0;
if(n==3){
if(a[2] - a[1] == a[1] - a[0])
cout << "no" << endl;
e... | ALGO | 0.999993 | 3.661046 |
13db032c-a827-4816-b418-5d83a1e101a4 | KumarOjas/Codeforcees-solution-archive. | Hopscotch.cpp | #include <cstdio>
int main () {
long a(0), x(0), y(0);
scanf("%ld %ld %ld", &a, &x, &y);
long output(-1);
if(y > 0 && y < a)
{
if(-a < 2*x && 2*x < a)
{
output = 1;
}
}
else if((y/a)%2 == 0 && y > (y/a)*a && -a < x && x < 0){output = 3 * (y/a) / 2;}
else if((y/a)%2 == 0... | ALGO | 0.999887 | 3.461751 |
8e6b2fb8-e1ef-497f-8e7d-79d4c734cc9b | lijiankou/ml | thirdparty/Eigen/doc/examples/Tutorial_BlockOperations_print_block.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(4,4);
m << 1, 2, 3, 4,
5, 6, 7, 8,
9,10,11,12,
13,14,15,16;
cout << "Block in the middle" << endl;
cout << m.block<2,2>(1,1) << endl << endl;
for (int i = 1; i <= 3; ++i)
{
cout << "B... | ALGO | 0.993043 | 3.6853 |
f033a144-60c7-4404-99fd-cd1ca89964f5 | dipu-bd/OJ-Codes | UVA Codes/Volume 001/146 - ID Codes/146 - ID Codes_v1.cpp | // C header files
#include <stdio.h>
// C++ header files
#include <iostream>
#include <algorithm>
// default namespace
using namespace std;
int main()
{
string s;
while(!cin.eof())
{
cin >> s;
if(s == "#") return 0;
if(next_permutation(s.begin(), s.end()))
cout << s << e... | ALGO | 0.999943 | 3.956055 |
72387268-4088-4475-9289-35bc73326ea7 | SsalHub/baekjoon | solved/2751/main.cpp | #include <stdio.h>
void mergeSort(int*, int, int, int);
void merge(int*, int, int, int);
int main() {
int* arr;
int n, left, mid, right;
scanf("%d", &n);
arr = new int[n];
for(int i=0; i<n; i++) {
int input;
scanf("%d", &input);
arr[i] = input;
}
left = 0;
r... | ALGO | 0.999917 | 4.631156 |
b3b20c6e-5447-4c32-99d0-5f6ae0b1fc12 | Siimmu1/CPP | Loeng 10/slaid04a.cpp | #include <iostream>
#include <unordered_map>
int main() {
int n;
std::cin >> n;
std::unordered_map<int, int> s;
for (int i = 0; i < n; ++i) {
int x;
std::cin >> x;
++s[x];
}
int m;
std::cin >> m;
for (int j = 0; j < m; ++j) {
int x;
std::cin >> x;
std::cout << s[x] << std::endl;
}
}
| ALGO | 0.999805 | 4.44891 |
fc8bbdd7-a85a-4e0f-a184-3aff9f5e24ee | MishkatIT/codeforces-atcoder-submissions | codeforces/1214/1214C Bad Sequence.cpp | /*
author : MishkatIT
created : Tuesday 2023-12-26-18.39.48
*/
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(_) cout << #_ << " is " << _ << '\n';
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1e... | ALGO | 0.999919 | 5.018259 |
6cdd90aa-d53f-4718-bb43-05e8e8e2e910 | slitvinov/lammps-sph-multiphase | src/REPLICA/neb.cpp | #include "lmptype.h"
#include "mpi.h"
#include "math.h"
#include "stdlib.h"
#include "string.h"
#include "neb.h"
#include "universe.h"
#include "atom.h"
#include "update.h"
#include "domain.h"
#include "comm.h"
#include "min.h"
#include "modify.h"
#include "fix.h"
#include "fix_neb.h"
#include "output.h"
#include "ther... | ALGO | 0.999573 | 6.198811 |
98e2dbeb-119a-4373-99cd-22f83c1ee542 | DISASTER-RUMBLING/CODE | 算法/Leetcode/Leetcode 2079. 给植物浇水.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<queue>
#include<vector>
using namespace std;
class Solution {
public:
int wateringPlants(vector<int>& plants, int capacity) {
int res = 0;
queue<int> que;
for (int i = 0; i < plants.size(); i++) {
que.push(plants[i]);
}
... | ALGO | 0.99997 | 5.508329 |
f0cbefa0-dbd1-4550-9f7a-ac490ea3d688 | bmat-official/bmat | src/ripple/app/tx/impl/SetTrust.cpp |
#include <ripple/app/tx/impl/SetTrust.h>
#include <ripple/basics/Log.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/Quality.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/st.h>
#include <ripple/ledger/View.h>
namespace ripple {
NotTEC
SetTrust::preflight (PreflightContext const... | TOOL | 0.874923 | 7.537934 |
90e0066c-d2db-4ac1-85b0-ae4dd4631c02 | TWANG006/Programming_Exercise | LeetCode/129.sum-root-to-leaf-numbers.cpp | /*
* @lc app=leetcode id=129 lang=cpp
*
* [129] Sum Root to Leaf Numbers
*
* https://leetcode.com/problems/sum-root-to-leaf-numbers/description/
*
* algorithms
* Medium (49.16%)
* Likes: 1629
* Dislikes: 43
* Total Accepted: 284.2K
* Total Submissions: 577.3K
* Testcase Example: '[1,2,3]'
*
* Give... | ALGO | 0.999996 | 7.103666 |
a3976d16-a321-4b5d-a5e1-261963840316 | wangcy6/weekly_read | code_reading/oceanbase-master/src/share/config/ob_server_config.cpp | #define USING_LOG_PREFIX SHARE_CONFIG
#include <string>
#include <sstream>
#include "share/config/ob_server_config.h"
#include "common/ob_common_utility.h"
#include "lib/mysqlclient/ob_isql_client.h"
#include "lib/utility/utility.h"
#include "common/ob_record_header.h"
#include "common/ob_zone.h"
#include "share/ob_dm... | CONFIG | 0.870652 | 6.130558 |
0bd16c60-346a-457a-8849-e2c0b9034286 | zhaofuq/PotreeConverter | libs/laszip/src/integercompressor.cpp | #include "integercompressor.hpp"
#define COMPRESS_ONLY_K
#undef COMPRESS_ONLY_K
#define CREATE_HISTOGRAMS
#undef CREATE_HISTOGRAMS
#include <stdlib.h>
#include <assert.h>
#ifdef CREATE_HISTOGRAMS
#include <math.h>
#endif
IntegerCompressor::IntegerCompressor(ArithmeticEncoder* enc, U32 bits, U32 contexts, U32 bits_... | ALGO | 0.996705 | 5.161495 |
cb5017bd-cf02-4949-86ed-7608d4160d50 | ishandutta2007/codeforces | laurie/normal/1656/E.cpp | //#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
... | ALGO | 0.999829 | 4.056375 |
bdc5ddf7-1d74-4912-bc86-b756a6bae8d4 | thavananh/Giai_Bai_Tap_UpCoder_Colab | LuuCodeRacHaha/LTHDT_HonSo1.cpp | #include <iostream>
using namespace std;
int ucln(int a, int b)
{
while (a != 0 && b != 0)
{
if (a > b)
{
a = a % b;
}
else
{
b = b % a;
}
}
if (a > 0)
{
return a;
}
return b;
}
class PhanSo
{
int tu, mau;
... | ALGO | 0.990634 | 4.505696 |
3b604e0a-0050-471e-a8c9-1e623a39df6a | divyanshub024/day_night_switch | example/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.998905 | 6.785645 |
720bc208-e946-4299-a8df-ec562d0b97ab | CESGA-Quantum-Spain/cunqasimulator | examples/mpi_example.cpp | #include <iostream>
#include <vector>
#include <complex>
#include <chrono>
#include "mpi_executor.hpp"
#include "utils/utils_cunqasim.hpp"
#include "utils/types_cunqasim.hpp"
int main() {
int N_QUBITS = 32;
try {
auto start_executor = std::chrono::high_resolution_clock::now();
MPIExecutor mpi... | ALGO | 0.985593 | 3.579145 |
db0ec733-ab36-4968-9642-769556abd3cf | shagx/Marlin-2.0.x | Marlin/src/lcd/menu/menu.cpp | #include "../../inc/MarlinConfigPre.h"
#if HAS_LCD_MENU
#include "menu.h"
#include "../../module/planner.h"
#include "../../module/motion.h"
#include "../../module/printcounter.h"
#include "../../gcode/queue.h"
#if HAS_BUZZER
#include "../../libs/buzzer.h"
#endif
#if ENABLED(EEPROM_SETTINGS)
#include "../../mod... | TOOL | 0.856045 | 6.214414 |
a6a7b59b-2d5b-4155-b721-f0fef65e5bfd | yasmineecosta/maratonas | MFP2024/A.cpp | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define MAX 10000
#define ll long long
#define lli long long int
using namespace std;
int main() {
lli N, p, time = 0;
cin >> N >> p;
lli runners[N];
for(int i=0; i<N; i++){
cin >> runners[i];
}
lli temp... | ALGO | 0.999949 | 3.016536 |
b69e674b-0ce0-4114-9942-15e9163c6bea | ishandutta2007/codeforces | ainta/normal/853/D.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
int n, D[310], TD[310], S, w[301000], res = 2e9;
int main(){
int i, j;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&w[i]);
}
for(i=0;i<=300;i++)TD[i]=D[i]=2e9;
D[0]=0;
for(i=1;i<=n;i++){
for(j=0;j<=300;j++){
... | ALGO | 0.999801 | 3.591113 |
d584148e-2ecf-44b3-b376-d37aba3c64a0 | Tongyuang/EdgeTile | EdgeTileServer/libs/opencv/3rdparty/carotene/src/scharr.cpp | #include <vector>
#include "common.hpp"
namespace CAROTENE_NS {
bool isScharr3x3Supported(const Size2D &size, BORDER_MODE border, s32 dx, s32 dy, Margin borderMargin)
{
return (dx == 0 && dy == 1 &&
isSeparableFilter3x3Supported(size, border, 3, 1, borderMargin)) ||
(dx == 1 && dy =... | ALGO | 0.9759 | 4.749222 |
8634e8b0-8497-45e4-b450-88db1a6ddf25 | scslab/cowl | content/svg/content/src/SVGPathSegUtils.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#include "mozilla/ArrayUtils.h" // MOZ_ARRAY_LENGTH
#include "SVGPathSegUtils.h"
#include "gfx2DGlue.h"
#include "nsSVGPathDataParser.h"
#include "nsTextFormatter.h"
using namespace mozilla;
using namespace mozilla::gfx;
static const f... | TOOL | 0.92906 | 5.090853 |
12f2a915-552e-4948-bb30-90531ea9d930 | DungTMDCCN214/DSA-PTIT | bfs_tren_do_thi_co_huong.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> k[1005];
bool check[1005];
void BFS(int s){
queue<int> q;
q.push(s);
check[s] = 1;
while(q.size()){
int u = q.front();
q.pop();
cout << u << " ";
for(int i:k[u])
{
if(check[i]==0){
q.push(i);
check[i] = 1;
}
}
}
}
int main() ... | ALGO | 0.999834 | 4.852702 |
63bb524c-0416-4c05-8985-38c9be130995 | nazibur175/C- | B_Two_Out_of_Three.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define test int t; cin>>t; while(t--)
void solve(){
test{
int n;
cin>>n;
int a[n];
map<int,int>m;
for(int i=0;i<n;i++){
cin>>a[i];
m[a[i]]++;
... | ALGO | 0.999798 | 4.132256 |
41cd5982-357b-41a1-8aae-cd516e0386b4 | whocares-abt/BAM | Chaining.cpp | #include "Chaining.h"
void Chaining::createAccount(std::string id, int count) {
Account new_account;
new_account.balance = count; new_account.id = id;
int hash_val = hash(id);
bankStorage2d[hash_val].push_back(new_account);
num_of_accounts++;
if (num_of_accounts > 0.4*capacity){resize(3*capacit... | TOOL | 0.914108 | 4.300456 |
daddcd4c-3ae6-43c6-8471-b116348afcbd | mvcast77/Page-Rank | csr_utility.cpp | #include <cstdlib>
#include <iostream>
#include <vector>
#include <utility>
#include <typeinfo>
#include "csr_utility.h"
//template struct CSR<int>;
template struct CSR<double>;
template std::vector<double> operator*(const CSR<double>*, const std::vector<double>&);
template std::vector<int> operator*(const CSR<int>*, ... | TOOL | 0.965735 | 3.376012 |
c4faecb6-2415-419e-8aa1-87b277c00ea0 | cangfengzhs/minidb | src/skip_list_test.cpp | //
// Created by cangfeng on 2019/12/1.
//
#include "skiplist.h"
#include <iostream>
using namespace std;
int func(const std::shared_ptr<int>& a,const std::shared_ptr<int>& b){
if(a<b)return -1;
if(a==b)return 0;
if(a>b)return 1;
}
int main(){
minidb::SkipList<std::shared_ptr<int>> skiplist(func);
... | ALGO | 0.988988 | 4.013173 |
f05265de-6eed-4299-b867-66894ce0dced | MaryamSiddiq/FlutterProject | chap7_animations/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.998443 | 6.76073 |
b06752e3-b04a-4c5d-8f66-af5d1448f19e | AllanPugachev/Theme4 | Theme4_Zadaniye3.cpp | #include <iostream>
#include <conio.h>
#include <clocale>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
using namespace std;
int sumcif(int x);
int main()
{
setlocale(LC_ALL, "Russian_Russia.1251");
int a;
cin >> a;
cout << sumcif(a);
_getch();
}
int sumcif(int x)
{
if (x == 0)
return 0;
return (x %... | ALGO | 0.99893 | 3.875382 |
405514f9-45f7-4b94-af1f-d392fc8f7f38 | miiitomi/atcoder | miiitomi/20241010/4.cpp | // https://atcoder.jp/contests/abc096/tasks/abc096_d
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
const ll INF = 2e+18;
const ll MOD = 998244353;
bool is_prime(int x) {
for (int y = 2; y*y <= x; y++) {
if (... | ALGO | 0.998587 | 4.612439 |
2f0b9216-61ce-4d92-8c3f-3f51512d4e08 | maheshjainckd/Hacktoberfest2022-for-everyone | CPP/CodeForces Solutions/team composition.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
for(int i=0;i<t;i++){;
int a,b;
cin>>a>>b;
int res= min(min(a,b),(a+b)/4);
cout<<res<<endl;
}
return 0;
} | ALGO | 0.999816 | 4.149996 |
08808fcb-5a36-4025-9e9c-1b362d56ec08 | YupengSu/HiBao | Taurus_workspace/ai_sample/third_party/src/opencv/modules/calib3d/src/polynom_solver.cpp | #include "precomp.hpp"
#include "polynom_solver.h"
#include <math.h>
#include <iostream>
int solve_deg2(double a, double b, double c, double & x1, double & x2)
{
double delta = b * b - 4 * a * c;
if (delta < 0) return 0;
double inv_2a = 0.5 / a;
if (delta == 0) {
x1 = -b * inv_2a;
x2 = x1;
retu... | ALGO | 0.999821 | 5.130913 |
6ec2e759-74c0-4691-8b1c-02b829cbb62a | sifat-hossain-niloy/LLMs-Performance-in-ICPC-Problems | Solution-Codes/2016/O1-Preview/H.cpp | #include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
struct Point {
double x, y;
Point(double x=0, double y=0): x(x), y(y) {}
Point operator-(const Point& p) const { return Point(x - p.x, y - p.y); }
Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
Point ... | ALGO | 0.999911 | 4.962499 |
5a6c6e47-1aad-44d9-baf5-38251c207298 | chuanqixu/Study | computer-science/Stanford-CS106X-Programming-Abstractions-in-CPP-2019-Fall/CodeStepByStep/10 exhaustive search/printAllBinary.cpp | #include <iostream>
#include <string>
using namespace std;
void printAllBinaryHelper(int digits, string prev) {
if (digits <= 0) {
cout << prev << endl;
return;
}
printAllBinaryHelper(digits - 1, prev + "0");
printAllBinaryHelper(digits - 1, prev + "1");
}
void printAllBinary(int dig... | ALGO | 0.999639 | 6.207859 |
ee7b6cde-b178-4768-89f6-956ffc6f96de | siddharthachandra/gcrf | caffe_deeplab2_lightweight/src/caffe/layers/softmax_layer.cpp | #include <algorithm>
#include <vector>
#include "caffe/layers/softmax_layer.hpp"
#include "caffe/util/math_functions.hpp"
namespace caffe {
template <typename Dtype>
void SoftmaxLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
softmax_axis_ =
bottom[0]->Canon... | DATA | 0.903632 | 7.647714 |
9b39e691-5ba3-47ec-9cd7-ab0997c982ca | DenizBraven/Codeforces | 139A - Petr and Book.cpp | #include <iostream>
using namespace std;
int main()
{
int n, y[8] = {0};
cin >> n;
for (int d = 1; d <= 7; ++d)
{
cin >> y[d];
y[d] += y[d-1];
}
n = (n - 1) % y[7] + 1;
for (int d = 1; d <= 7; ++d)
{
if (y[d] >= n)
{
cout << d << endl;
... | ALGO | 0.999897 | 3.113031 |
47abae46-feab-4ce2-8fc5-a28d2fa9d5da | eshohag/leetcode | lcci/17.23.Max Black Square/Solution.cpp | class Solution {
public:
vector<int> findSquare(vector<vector<int>>& matrix) {
int n = matrix.size();
int down[n][n];
int right[n][n];
memset(down, 0, sizeof(down));
memset(right, 0, sizeof(right));
for (int i = n - 1; i >= 0; --i) {
for (int j = n - 1; j ... | ALGO | 0.999934 | 5.190601 |
63052f84-a25c-4882-a05c-12729175f13a | random-aosp-stuff/android_frameworks_av | media/module/codecs/amrwb/dec/src/homing_amr_wb_dec.cpp | /*
------------------------------------------------------------------------------
Filename: homing_amr_wb_dec.cpp
Date: 4/25/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.998094 | 5.770398 |
06ba6037-160b-4777-9f22-fec2e66e3a40 | khoon68/coding-test-practice | baaarkingDog/0x07_덱/10866_2.cpp | #include <bits/stdc++.h>
using namespace std;
deque<int> DQ;
int n, x;
string cmd;
int main() {
cin >> n;
while(n--) {
cin >> cmd;
if(cmd == "push_front") {
cin >> x;
DQ.push_front(x);
} else if (cmd == "push_back") {
cin >> x;
DQ.push_back(x);
} else if (cmd == "pop_front") {
if(!DQ.e... | ALGO | 0.998862 | 4.717545 |
172651a7-8571-4720-b696-fa1df4e738fe | zakariaCHOUKRI/CPP-CP | 2024/acpc 2021/K.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int dp[5005][5005][2];
int n, arr[5005];
const int mod = 1e9 + 7;
int solve(int idx, int remainingSumForValid, bool takeThisOneAsLargest) { // we use the rule Ri < sum(Rj), j != i
if (idx == n) {
return (remainingSumForValid == 0) &... | ALGO | 0.999946 | 4.286992 |
dea86bdb-47ac-4ecf-a98c-be4d61ea0214 | copydev/CodeForces | Round611/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(ll i = 0;i<n;++i)
struct Tree
{
ll pos;
ll leftfree;
ll rightfree;
};
struct compareleft
{
bool operator()(Tree &t1, Tree &t2){
return t1.leftfree > t2.leftfree;
}
};
struct compareright
{
bool operator()(Tree &t1, Tre... | ALGO | 0.999996 | 3.548478 |
050985e7-2c24-41fe-83c3-0b82406c9d36 | rajeevt09/AlgorithmsCode | graphs/detect_cycle.cpp | #include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
bool canFinish(int numCourses, vector<pair<int, int>>& prerequisites) {
return hasCycle(numCourses,prerequisites);
}
bool dfs(int vertex,vector<vector<int>> &adj,vector<int> &visited)
{
visited[vert... | ALGO | 0.999678 | 5.782769 |
3e584580-423f-4572-84d3-82a65a114460 | AyaNasserEzat/session2_ui | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.