uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
871ea82a-2d19-4ca5-8e56-57808eee9f89 | 7chii/aulasACeC | ABC5.cpp | #include <iostream>
using namespace std;
//formatacao 1
int main(){
float HT, VH, PD, TD, SB, SL;
cout<<"entre com a quant. de horas trabalhadas: \n";cin>>HT;
cout<<"entre com o valor da hora de trabalho: \n";cin>>VH;
cout<<"entre com o valor do percentual de desconto: \n";cin>>PD;
SB = HT*VH;
... | ALGO | 0.964784 | 3.54124 |
25dfdfd5-5807-4857-9fd3-4cf5609071ca | LostKnowledge33/practice | 프로그래머스/lv2/42747. H-Index/H-Index.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> citations) {
int answer = 0;
sort(citations.begin(), citations.end());
int n = citations.size();
if(citations[0] >= n) return n;
for(int h = n; h >= 0; h--)
{
for(... | ALGO | 0.99994 | 6.07481 |
c8b4ad44-2ab8-48bc-9264-c5b00e797fbb | ishandutta2007/codeforces | shadowatyy/normal/1110/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c)... | ALGO | 0.999951 | 4.222496 |
3aeaf676-ad5f-4a50-b956-6701095b87b3 | vignesh2004vasu/100-Days-Daily-Coding-Challenge | GeeksForGeeks/DAY_56_Reverse_Coding.cpp | You will be given an integer n, your task is to return the sum of all natural number less than or equal to n.
As the answer could be very large, return answer modulo 109+7.
Example 1:
Input:
n = 6
Output:
21
Explanation:
1+2+3+4+5+6 = 21
Example 2:
Input:
n = 4
Output:
10
Explanation:
1+2+3+4 = 10
Answer:
class So... | ALGO | 0.999991 | 6.506271 |
e4041808-158a-48d2-9d1b-376bdf350c39 | stepantubanov/bigmath | bigmath/builtin_square.cpp | #include <immintrin.h>
#include <string.h>
#include "internal.h"
#ifdef BIGMATH_BUILTIN_INT128
namespace bigmath {
namespace internal {
void square_nat(place_t* _res, const place_t* _nat, u64 _nat_size) {
auto res = reinterpret_cast<u64*>(_res);
auto nat = reinterpret_cast<const u64*>(_nat);
u32 nat_size = _... | ALGO | 0.999202 | 6.638677 |
24094ea6-bba8-42ba-a9c9-c30932dcc8ba | Sankhya0/logicDetector | backend/CDataset/coinChange/coinChange_15.cpp | /*
dp[amount] = dp[amount-coins[i]] + 1;
*/
class Solution {
public:
int coinChange(vector<int>& nums, int amount) {
long long int n=nums.size();
sort(nums.begin(),nums.end());
//dp[i] -> min no of coins required to make amount 'i'
vector<long long int> dp(amount+1,INT_MAX);
... | ALGO | 0.999987 | 5.681618 |
e384b9a7-f302-44fe-bb46-d081e74746e6 | joaquindon/Tetrix | Teatrix_sfml/Grid.cpp | #pragma once
#include <SFML/System/Vector2.hpp>
#include <array>
#include <vector>
#include <optional>
#include <algorithm> // Para std::any_of
using Position = sf::Vector2i; // Usamos el tipo vector de SFML
class Tablero {
private:
// Tipos fuertemente tipados para mejor seguridad
enum class FormaPieza { I... | ALGO | 0.922481 | 7.172356 |
5680e5af-4665-4612-b52f-825999e4a8e6 | lzh23333/My_Programs | 数算OJ/凸多边形/凸多边形.cpp | #include <iostream>
#include <vector>
using namespace std;
struct Position{
double x;
double y;
bool is_2;
Position(){ is_2 = false; }
};
//ṹ
bool whether_2(Position* head, Position* middle, Position* next){
double x1,y1,x2,y2;
x1 = middle->x - head->x;
y1 = middle->y - head->y;
x2 = next->x - middle->x;
y2 =... | ALGO | 0.999805 | 3.343327 |
8e001eb1-67ca-44ec-8e89-bcb947f84662 | RajThakur777/Leetcode-POTD | 2329-maximum-product-after-k-increments/2329-maximum-product-after-k-increments.cpp | class Solution {
public:
int MOD = 1e9 + 7;
int maximumProduct(vector<int>& nums, int k) {
int n = nums.size();
priority_queue < int, vector < int > , greater < int >> pq;
for(int i=0; i<n; i++){
pq.push(nums[i]);
}
while(k--){
int val = pq.top... | ALGO | 0.999988 | 5.64287 |
a8a8e230-3d58-492c-b764-6e45e8214184 | masum035/Compiler-Design | Lexical Analyzer using c++/Simple_Lexical_analyzer.cpp | //id-201914044 Abdullah Al Masum
//incomplete - may be i will not complete it😅
#include "symbol_table.h"
void print_ch_arr(char str[])
{
int n = strlen(str);
for (int i = 0; i < n; i++)
{
cout << str[i];
}
cout << endl;
}
bool SymbolTable ::Check_Skip(char ch)
{
if (ch == ')' || ch == ... | TOOL | 0.88206 | 3.544195 |
183a2a31-5b90-4f9b-9a11-68fa2bdb8794 | Tsukumo3/Atcoder | ABC/047/cpp/F.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
int h1;
int h2;
cin >> h1 >> h2;
int ans;
ans = h1 - h2;
cout << ans << endl;
return 0;
} | ALGO | 0.999204 | 3.026366 |
79f6a059-5b42-49a9-ba01-e79e25ccde7a | cyscgzx33/UdacityRobotics | kalman_filter/kalman_filter_1d.cpp | #include <iostream>
#include <math.h>
#include <tuple>
using namespace std;
double new_mean, new_var;
tuple<double, double> measurement_update(double mean1, double var1, double mean2, double var2)
{
new_mean = (var2 * mean1 + var1 * mean2) / (var1 + var2);
new_var = 1 / (1 / var1 + 1 / var2);
return make... | ALGO | 0.999511 | 6.087244 |
7f3c4930-f69e-463a-8db6-12351ded61e9 | ishandutta2007/codeforces | krk/normal/46/D.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int l, b, f, n;
vector <pair <pair <int, int>, int > > parked;
int newPlace(int l, int id)
{
int i, ans = -1;
for (i = 0; i < parked.size()-1; i++)
if (parked[i].first.second + b + l + f <= parked[i+1].first.first) {
... | ALGO | 0.999907 | 3.533057 |
0457d8fd-6715-4554-b17a-cf48fcc0c5ba | Satishprasad018/DSA_SOLUTION | FUNCTIONS/1. print_digits_of_number.cpp | //good example of while loop , for loop se logic samaz me nahi aata
#include <iostream>
using namespace std;
void printdigit(int n)
{
while(n!=0)
{
int rem = n%10 ;
cout<<rem<<" " ;
n=n/10 ;
}
}
int main()
{
int n;
cin >> n;
printdigit(n);
}
| ALGO | 0.99987 | 4.279671 |
ff71887f-5fb4-4456-a84a-649f69e0af90 | surasnayak/C-C--Programs | personalp/simplefib.cpp | #include <bits/stdc++.h>
using namespace std ;
int fib(int n)
{
if (n == 1 || n == 0)
{
return 1;
}
else
{
return fib(n-1) + fib(n-2);
}
}
int main()
{
int n;
cin >> n;
printf("%d\n",fib(n));
}
| ALGO | 0.999977 | 4.724231 |
1885aada-234a-4b01-86f8-fbcf08116835 | mickael-al/GeometrieAlgorithmique | GeomAlgo/ThirdParty/Bullet3/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp | #include "btDefaultCollisionConfiguration.h"
#include "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCom... | TOOL | 0.925757 | 6.524833 |
39a5571e-c233-49a0-9ca2-08cd37c583ce | singhkumaryash/DSA_StriversA2Z | 03_Arrays/02_Medium/Q01_twoSum.cpp | // Two Sum : Check if a pair with given sum exists in Array
// Problem Statement : Given an array of integers arr[] and an integer target.
// 1st variant: Return YES if there exist two numbers such that their sum is equal
// to the target. Otherwise, return NO.
// 2nd variant: Return indices of the two numbers such t... | ALGO | 0.999866 | 6.495606 |
1c6a953f-1fc2-4c4e-82bc-d658ac9b7aa9 | svetlanasieber/Programming-Basics-with-Cpp | 32_CinemaTicket.cpp | #include <iostream>
using namespace std;
int main()
{
string day;
cin >> day;
if (day == "Saturday" || day =="Sunday")
{
cout << 16 << endl;
}
else if (day == "Wednesday" || day == "Thursday")
{
cout << 14 << endl;
}
else
{
cout << 12 << endl;
}
return 0;
}
| ALGO | 0.999761 | 4.490226 |
156351f4-ddd4-4282-b74a-07271458e678 | alreadySagor/XPSC-Batch-4 | Week_11/Day_1/D_Two_TVs.cpp | /**
* author: SAGOR AHMED
* created: M A Y , 2024
**/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<int, int> mp;
for (int i = 1; i <= n; i++) {
int l, r;
cin >> l >> r;
mp[l]++;
... | ALGO | 0.999992 | 4.630215 |
c38eb6b8-966f-4e70-b392-d7b053e8c406 | ishandutta2007/codeforces | atomicenergy/normal/1450/H1.cpp |
using namespace std;
#define visual
#ifdef visual
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <assert.h>
#include <functional>
#include <math.h>
#include <string>
#include <ctime>
#endif
#ifndef visual
#include <bits/stdc++.h>
... | ALGO | 0.999977 | 4.477742 |
29914b54-f76b-4552-ad55-2009d5875d0f | sanidhya17N/LeetCode_Solutions | 0088-merge-sorted-array/0088-merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int k=m+n-1;
int i=m-1;
int j=n-1;
while(i>=0 && j>=0){
if(nums1[i]<=nums2[j]){
nums1[k]=nums2[j];
j--,k--;
}else{
nums1... | ALGO | 0.999985 | 5.321942 |
4d932ee0-e12b-45ed-a2eb-26fe00b052ca | itmc-ptit/itmc-cpp-class-2024 | N24DCCN161/buoi4/bai4.cpp | #include<iostream>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
if (a>b&&a>b&&a>c&&a>d){
cout<<"MAX:"<<a<<endl;
}else if (b>a&&b>c&&b>d){
cout<<"MAX:"<<b<<endl;
}else if (c>a&&c>b&&c>d){
cout<<"MAX:"<<c<<endl;
}else{
cout<<"MAX:"<<d;
}
re... | ALGO | 0.999742 | 3.809237 |
56facdcc-0ec7-4d37-a54a-b98f97c87cda | parasguglani1/competitive_coding | Codeforces/790 Div4/B_Equal_Candies.cpp | #include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#define ff first
#define ss second
#define int long long
using ll = long long;
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define PI 3.1415926535897932384626
#define ps(... | ALGO | 0.999835 | 4.262009 |
4ea1c4f1-59a7-4c54-a9af-808cbf832305 | divyanshgaba/Competitive-Coding | What Are the Odds/main.cpp | #include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
int arr[5... | ALGO | 0.999991 | 4.010009 |
49ecb378-1e88-4e51-93fa-834e6399f674 | UsefHussein/CP | SPOJ/QUEUEEZ/43730276_AC_330ms_11264kB.cpp |
#include<bits/stdc++.h>
#define enl "\n"
typedef long long ll;
typedef double dd;
using namespace std;
#define all(x) x.begin(), x.end()
const ll r = 1e5 + 10;
void fffffffast()
{
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
void fffffffile() {
//freopen("input.txt", "r", stdin)... | ALGO | 0.999848 | 4.073301 |
26769955-6277-43fe-adfa-e70310055589 | stdstring/leetcode | Algorithms/Tasks.0001.0500/0094.BinaryTreeInorderTraversal/solution.cpp | #include <vector>
#include "TreeNode.h"
#include "TreeNodeUtils.h"
#include "gtest/gtest.h"
using CommonLib::TreeNode;
namespace
{
class Solution
{
public:
std::vector<int> inorderTraversal(TreeNode* root) const
{
std::vector<int> dest;
inorderTraversal(root, dest);
return dest;
... | TEST | 0.999593 | 7.249528 |
34ae4121-66a6-43e6-90d9-c8ecf0265e3b | MahmoudZaytoni/learning | other/new.cpp | #include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
using namespace std;
// Returns the slope between points p1 and p2.
// If p1 and p2 have the same x-coordinate, returns INT_MAX.
double slope(vector<int>& p1, vector<int>& p2) {
if (p1[0] == p2[0]) return INT_MAX;
return ... | ALGO | 0.999958 | 5.738935 |
d35c3801-00a1-46ad-ac4c-0a33239896f7 | leducphuclong/code | Competitive Programming/codeforces/training/A_Phone_Desktop.cpp | /*If you don't think twice, you have to code twice.*/
// Include
#include <bits/stdc++.h>
// #include <conio.h>
// Namespace
using namespace std;
// Define
#define nln '\n'
// Typedef and Struct
typedef int64_t ll;
// Constant
// Declare global variables.
vector<pair<ll, ll>> dir4 = {{0, 1}, {0, -1}, {1, 0}, {-1,... | ALGO | 0.999374 | 4.663565 |
e89dee01-a9d3-4e72-bd32-6e1f76cd9201 | ThereIsATonyInMyGitRepo/It-s-a-kata-world- | 7kyu/anagram-detection.cpp | kata: https://www.codewars.com/kata/anagram-detection
cod:
bool isAnagram(std::string test, std::string original)
{
int v1[27];
int v2[27];
memset(v1,0,sizeof(v1));
memset(v2,0,sizeof(v2));
if(test.length() != original.length())
return false;
for(std::string::iterator it=test.be... | ALGO | 0.999023 | 6.190869 |
c8247c66-1fd3-4670-97e8-06c7291ffacd | shelltdf/osgall | prebuild/eigen-eigen-5a0156e40feb/doc/examples/TutorialInplaceLU.cpp | #include <iostream>
struct init {
init() { std::cout << "[" << "init" << "]" << std::endl; }
};
init init_obj;
// [init]
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A(2,2);
A << 2, -1, 1, 3;
cout << "Here is the input matrix A before decompositi... | ALGO | 0.999655 | 3.804785 |
d480035c-f6d6-4d26-8f42-b9828f93c93b | abufarhad/Codeforces-Problems-Solution | 339A(A. Helpful Maths).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int l,i,c,j=0,len=0; string a;
int b[100];
cin>>a;
l=a.size();
for(i=0;i<l;i++){
if((a[i]=='1')||(a[i]=='2')||(a[i]=='3')){
c=atoi(&a[i]);
b[j]=c;
j++; len++;
}}
sort(b,b+len);
f... | ALGO | 0.999952 | 3.596461 |
cf311e29-e4c2-458b-9c2c-a8ed6510ffb7 | Md-Noman-Biswas/Codeforces_problems | Modulo.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
set<int> st;
int n;
int q = 10;
while(q--){
cin >> n;
int temp = n % 42;
st.insert(temp);
}
cout << st.size() << "\n";
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
... | ALGO | 0.995894 | 4.322297 |
f64b2dbd-dc05-40dd-bc99-4aa5004234cf | alisherov-cs/cpp | codewars/negative/negative.cpp | #include <iostream>
int makeNegative(int num) {
if (num < 1) {
return num;
}
return num * -1;
}
int main() {
int result = makeNegative(1);
std::cout << "res: " << result;
}
| ALGO | 0.997894 | 5.254862 |
5e67c535-01d3-4737-8291-e1e18fa59145 | muhammadhasanfarouk/Pyramid-XO-5-5-XO-Connect-4 | xo_5x5_board.cpp | #include <bits/stdc++.h>
#include "BoardGame_Classes.hpp"
using namespace std;
xo_5x5_board::xo_5x5_board(){
n_rows = n_cols = 5;
board = new char*[n_rows];
for (int i = 0; i < n_rows; i++) {
board [i] = new char[n_cols];
for (int j = 0; j < n_cols; j++)
board[i][j] = 0;
}
}
bool xo... | ALGO | 0.996983 | 4.913932 |
7880f161-42a2-4309-b6c4-bf1b46e73cc3 | jmmochko/prog_comp | Problems_jose/curso_2025/contest2/G.cpp | #include <bits/stdc++.h>
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fore(a,b,c) for(int a=b; a<c; ++a)
#define dfore(a,b,c) for(int a=b; a>=c; --a)
#define SZ(a) ((int)a.size())
#define fst first
#define snd second
#define show(a) cout<<a<<"\n"
#define showAll(a) for(auto i:... | ALGO | 0.999997 | 4.127447 |
09bd2c53-c282-4689-839d-4c1d92bc34db | PickledChair/AdsPractice | chapter8/code8_6/code8_6.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
// 連結リストの各ノードを表す構造体
struct Node {
Node *prev, *next;
string name; // ノードに付随している値
Node(string name_ = "") :
prev(NULL), next(NULL), name(name_) {}
};
// 番兵を表すノードをグローバル領域に置いておく
Node* nil;
// 初期化
void init() {
nil = new N... | ALGO | 0.998781 | 5.366024 |
c358bb8d-709b-4b0b-b9db-7e8691c68f69 | drew138/competitive-programming | codeforces/round_818_div2/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi; // int vec
typedef vector<vi> vvi; // int vec vec
typedef vector<pii> vpi; // int int pair vec
const double pi = 3.1415926535897932384626433832795;
const int maxn = 1e5 + 5... | ALGO | 0.999955 | 3.810087 |
e02c5963-4d43-4c6f-a6d9-fdecea5b94e4 | TheOneForce/Stepik | 363-YandexIntroToCPP/1_3 - Integers/5.cpp | /*
The last digit
Given a natural number, print its last digit.
Input data format
The input is given a natural number N that does not exceed 10000.
Output Format
Print one integer - the answer to the problem.
*/
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << n % 10;
re... | ALGO | 0.991201 | 5.208961 |
197d2449-ad6c-48bc-86da-0d4570b85ae9 | giuliapunzi/stPaths_assessment | create-circle.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
string outname;
int N,M;
vector<int> edge_added;
vector<int> degree;
vector<vector<int>> G;
// script to create a file containing a random sparse graph of size (both nodes and edges) given in input
void create_circle(){... | ALGO | 0.990135 | 4.796267 |
b042a4ec-6f14-4676-ba8f-8a5da20de62a | bechovang/hsgtin | BT lúc ôn HSGTP 1 tháng cuối/CO CHAU/Chuyen Le Hong Phong/BAI2/main.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define faster ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int long long
using namespace std;
vector <vector<int>>dp(100000,vector<int>(300000));
int a[100005];
signed main()
{
faster;
freopen("BAI2.INP","r",stdin);
freopen("BAI2.OUT","w",stdout);... | ALGO | 0.999797 | 3.03767 |
723a1931-b08e-4afa-a20a-1cd4c5724213 | andrew-canada/competitive-programming | aops/lect7/p3/7-3-sol-tree.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_N = 200000;
ll lis[MAX_N];
ll solve(int left_idx, int right_idx)
{ // inclusive endpoints
if (left_idx == right_idx)
{ // base case
return lis[left_idx];
}
ll answer = 0;
int mid_idx = (left_idx + right_idx)... | ALGO | 0.999967 | 4.451301 |
d4536b63-d18d-4417-ba8b-849941dc8cb9 | Aaditya8C/CP_DSA | Algos/floyd.cpp | // floyd-warshall algorithm for all-pairs shortest path
// dist[i][j] is the shortest distance from i to j
void floydWarshall(vector<vector<int>> &dist, int n)
{
for (int k = 0; k < n; k++) // try every intermediate node k
for (int i = 0; i < n; i++) // for every source node i
for (i... | ALGO | 0.999718 | 4.090999 |
f176790c-1bfa-40df-9c87-ebc63a1a9757 | bitweb-project/bitweb | src/test/fuzz/crypto_diff_fuzz_chacha20.cpp | #include <crypto/chacha20.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <cstdint>
#include <vector>
/*
From https://cr.yp.to/chacha.html
chacha-merged.c version 20080118
D. J. Bernstein
Public domain.
*/
typedef unsigned int u32;
typedef unsigned char u... | TEST | 0.912975 | 5.360809 |
7814f59e-2742-4b1f-b5df-a1146efdd5b0 | AleEMP/AED | 3.2 Deque/deque.cpp | #include <iostream>
using namespace std;
struct deque {
int tam_map = 5;
int tam_arr = 5;
int** mapa;
int** map_ini;
int** map_end;
int* ini;
int* fin;
deque() {
mapa = new int* [tam_map];
ini = 0;
fin = 0;
}
void push_front(int val) {
if (fin) {
if (ini != *map_ini) {
ini--;
*ini = val;
... | ALGO | 0.99626 | 4.085265 |
2e986b07-dc35-4598-8782-b584c0298562 | lizejian/CodingInterview | 22_链表中倒数第k个节点.cpp | // 面试题22:链表中倒数第k个结点
// 题目:输入一个链表,输出该链表中倒数第k个结点。为了符合大多数人的习惯,
// 本题从1开始计数,即链表的尾结点是倒数第1个结点。例如一个链表有6个结点,
// 从头结点开始它们的值依次是1、2、3、4、5、6。这个链表的倒数第3个结点是
// 值为4的结点。
/*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};*/
class Solution {
public:
ListNode* ... | ALGO | 0.999692 | 4.518164 |
4d159d7a-c7bd-43bc-ba0b-72fa88dcad44 | Hunmbal/Id-Card-Detection | EndSemester-OOP/Util.cpp | #include "Util.h"
#include <string>
tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI();
bool Util::state = true;
CNIC Util::cnic;
Mat Util::image = imread("D:\\Visual Studio\\EndSemester-OOP\\EndSemester-OOP\\Resources\\paper.jpg");
Mat Util::temp = imread("D:\\Visual Studio\\EndSemester-OOP\\EndSemester-OOP... | TOOL | 0.863581 | 3.358454 |
52cffb41-3266-4488-9871-a4f77bd58af6 | adii-jadhav/SCNN | tools/lane_evaluation/src/counter.cpp | /*************************************************************************
> File Name: counter.cpp
> Author: Xingang Pan, Jun Li
> Mail: <EMAIL>
> Created Time: Thu Jul 14 20:23:08 2016
************************************************************************/
#include "counter.hpp"
double Counter::get_precision... | ALGO | 0.918215 | 5.388351 |
49912609-962e-4c33-b8e4-cc35b3e2cd1b | ishandutta2007/codeforces | sunset/normal/908/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;
template <typ... | ALGO | 0.999991 | 3.803392 |
3758cad7-2da5-49dc-b019-fa10b9aab82a | RajShashwat/Programming-in-C-plus-plus | Basic/area.cpp | #include<iostream>
using namespace std;
class Box
{
public:
int length;
int breath;
int height;
Box(int l,int b, int h)
{
length=l;
breath=b;
height=h;
}
int calVolume(void)
{
return length*breath*height;
}
};
int main()
{
Box b1(5,9,6);
int V... | TOOL | 0.947702 | 3.657337 |
64d388a9-f6be-497b-8f1c-b66170e01340 | Schr0Smi1ey/Codeforces | Problem Solving/900/Implementation/A_Wet_Shark_and_Odd_and_Even.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl "\n"
#define int long long int
const int INF = 1e18;
signed main()
{
fastio;
int n,x;cin >> n;
vector<int> odd,even;
int ans = 0,temp = INT_MAX;
for(int i=0;i<n;i++){
... | ALGO | 0.999974 | 4.138565 |
20676c0f-72ed-475f-80dd-0e7957095f73 | AbdulWasay25/PF-LAB-TASKS | Lab 10 practice/Task 3.cpp | #include <stdio.h>
#include <string.h>
#define MAX_BOOKS 100
struct Book {
char title[100];
char author[100];
char ISBN[20];
int publicationYear;
int isAvailable;
};
void addBook(struct Book library[], int *bookCount) {
if (*bookCount >= MAX_BOOKS) {
printf("Library is full. Cannot add... | TOOL | 0.99552 | 7.344774 |
22ce492c-3a5c-42ac-ab4b-c1657b05bfb8 | phantomwolf/leetcode-problems | Leetcode/0821-ShortestDistanceToACharacter/cpp/main.cpp | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
class Solution {
public:
vector<int> shortestToChar(string S, char C) {
unsigned int length = S.size();
vector<int> R(length);
int prevC = 0;
// Handle left-most C
while (S[prevC] != C) {
... | ALGO | 0.999839 | 5.050384 |
4e5b234b-91fc-40c1-99d9-2f7638ba231f | neutrino2306/C-Exercises | 100-67.cpp | #include <stdio.h>
int main(){
int a,b,c,d,s[1000]={0};
scanf("%d%d%d%d",&a,&b,&c,&d);
for(int i=0;i<=5;i++){
for(int j=0;i+j<=5;j++){
for(int k=0;k+i+j<=5;k++){
for(int l=0;l+k+i+j<=5;l++){
s[a*i+b*j+c*k+l*d]++;
// printf("%d %d %d %d\n",i,j,k,l);
}
}
}
}
for(int i=999;i>0;i--){
if(s... | ALGO | 0.999808 | 3.060962 |
c99ff2e3-b69a-4527-a3a1-3da4f3cb3b90 | vandreas19/POJ_sol | 1699/7758675_AC_47MS_164K.cpp | #define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<cstdio>
#include<cstring>
#include<algorithm>
const int SEG_NUM_MAX=10,SEG_LEN_MAX=20;
int segmentNum;
char segments[SEG_NUM_MAX][SEG_LEN_MAX+1];
int lengthIncrement[SEG_NUM_MAX][SEG_NUM_MAX];
bool match(char* left,char* right){
while(true){
if(*left=='\0'... | ALGO | 0.999927 | 3.682159 |
22b68b84-02c7-4ea4-b0b2-07ca26ae4bbd | side-projects-all/works | Leetcodes/arr_and_string/q_1656.cpp | /*
There is a stream of n (idKey, value) pairs arriving in an arbitrary order, where idKey is an integer between 1 and n and value is a string. No two pairs have the same id.
Design a stream that returns the values in increasing order of their IDs by returning a chunk (list) of values after each insertion. The concate... | ALGO | 0.99959 | 6.517463 |
d52be459-a7ad-427e-a8f9-59e03de6d254 | Soumajith/myCodes | C++ 3.0/testc.cpp | #include <bits/stdc++.h>
#include <string>
using namespace std;
int Binaryto(int m)
{
int j;
int i = 0;
int sum = 0;
while (m > 0)
{
j = m % 10;
sum += j * pow(2, i);
m = m / 10;
i += 1;
}
return sum;
}
int main(){
int t;
cin>>t;
while(t--){
int n;
cin... | ALGO | 0.998541 | 4.317553 |
aed5de51-4fdb-4975-b41e-6202d64b749b | t2e0j0a4/CPP | 18_Inline_Functions_C++.cpp | #include <iostream>
using namespace std;
// Usage of inline functions
/*
Inline functions are usage when we have a minimal number of lines of code (atmost 5) and Recursive are allowed for inline functions .
*/
inline int add(int a , int b , int c){
return a+b+c;
}
// static variables don't change their value... | ALGO | 0.988354 | 5.48701 |
6d023857-b883-49a7-b6fd-2cba902359b1 | RaulitoGC/competitive-programming | algorithms/string/longest-common-substring.cpp | #include <bits/stdc++.h>
using namespace std;
#define test() cerr<<"Hello Family"<<"\n"
#define sz(array) (int)array.size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define popb pop_back
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define ... | ALGO | 0.999948 | 4.816311 |
ff30beaa-757b-4b32-a599-371fbf8eab52 | jadikerjadiker/matching-game-helper | TestingImageSearch/opencv-3.1.0/samples/cpp/tutorial_code/ShapeDescriptors/pointPolygonTest_demo.cpp | /**
* @function pointPolygonTest_demo.cpp
* @brief Demo code to use the pointPolygonTest function...fairly easy
* @author OpenCV team
*/
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;... | TEST | 0.923706 | 6.12452 |
1bf2f480-6c13-41b4-b0ae-561a82bc5321 | Weiguo-Jiang/Kattis-Solutions | licensetolaunch.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v;
int min = 1000000001;
for (int i = 0; i < n; i++) {
int k;
cin >> k;
if (k < min) {
min = k;
}
v.push_back(k);
}
for (int i = 0; i < n; i++) {
if (v[i] == min) {
cout << i << endl;
retu... | ALGO | 0.999514 | 4.62278 |
f8c5b068-da13-483c-a256-5675a3454858 | kashyaparka/LC-Journey | 1696-jump-game-vi/1696-jump-game-vi.cpp | class Solution {
public:
int maxResult(vector<int>& nums, int k)
{
deque<int> q;
int n=nums.size();
vector<int> dp(n);
dp[n-1]=nums[n-1];
q.push_back(n-1);
for(int i=n-2;i>=0;i--){
if(q.front()-i>k) q.pop_front();
dp[i]=nums[i]+dp[q.front(... | ALGO | 0.999946 | 5.551001 |
bf304404-cd1d-4e45-bfe9-333bd1aac1eb | M4573R/competitive-programming-archive | codeforces/round-284/div-2/lecture.cpp | #include <iostream>
#include <map>
#include <string>
using namespace std;
inline
void use_io_optimizations()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main()
{
use_io_optimizations();
unsigned int lecture_size;
unsigned int dictionary_size;
cin >> lecture_size >> dictionar... | ALGO | 0.999888 | 4.738616 |
4795c099-6814-4ea1-9f29-1552936273cf | negi153/competitive_programming | data-structure-and-algorithm/week-2-basic-programming-2/1-pattern-continues/1-pyramid.cpp | #include <iostream>
using namespace std;
// pyramid
// *
// * *
// * * *
// * * * *
// * * * * *
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n - i; j++)
cout << " "; // print spaces
for (int j = 1; j <= i; j++)
cout << "* "; // print starts wi... | ALGO | 0.999853 | 4.417395 |
c4f10bfb-fedd-4d91-9d41-3d75d05c2ffb | Kihwan-Ryoo/ros_manipulator_hit_the_ball | ball_track_alvar/src/Line.cpp | #include "ball_track_alvar/Line.h"
using namespace std;
namespace alvar {
using namespace std;
Line::Line(float params[4])
{
c.x = params[2];
c.y = params[3];
s.x = params[0];
s.y = params[1];
}
void FitLines(vector<Line>& lines)
{
}
int FitLines(vector<Line> &lines,
const vector<int>& corners,
const ve... | ALGO | 0.994155 | 4.628951 |
15f0b3b3-41ba-4445-abb1-d295d4e7e87b | rafaelcalai/Book_CPP_in_one_hour_a_day | chapter19/exercise2.cpp | #include<set>
#include<iostream>
struct MyDictionary{
std::string word;
std::string description;
std::string displayAs;
MyDictionary(const std::string& wordIn, const std::string& descriptionIn)
{
word = wordIn;
description = descriptionIn;
displayAs = (word + ": " + descrip... | TOOL | 0.918384 | 5.380426 |
ea7674b5-026e-490a-be1a-e49389b124bf | 8bit-nyk/HSLAM | Thirdparty/opencv-3.4.6/opencv_contrib-3.4.6/modules/xobjdetect/src/feature_evaluator.cpp | #include "precomp.hpp"
namespace cv {
namespace xobjdetect {
float calcNormFactor( const Mat& sum, const Mat& sqSum )
{
CV_DbgAssert( sum.cols > 3 && sqSum.rows > 3 );
Rect normrect( 1, 1, sum.cols - 3, sum.rows - 3 );
size_t p0, p1, p2, p3;
CV_SUM_OFFSETS( p0, p1, p2, p3, normrect, sum.step1() )
... | ALGO | 0.924461 | 6.215175 |
a9b3a6f2-008f-4cbd-be82-9774f0aaa2bb | HeQSun/tetraDecoder | src_snp_inerval_finder/split_string.cpp | #include <string>
#include <stdio.h>
#include <vector>
using namespace std;
vector<string> split_string(const string& str, const char& ch)
{
string next;
vector<string> result;
// For each character in the string
for (string::const_iterator it = str.begin(); it != str.end(); it++) {
// If we'... | ALGO | 0.962311 | 4.263006 |
97ec15b6-92b5-45b0-9b2b-4339f2752ba1 | Adnann07/C-codes | p4.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for(int r=1;r<=n;r++)
{
for(int c=1;c<=n;c++)
{
if(c<=n-r)
{
cout<<" ";
}
else
{
cout<<"* ";
}
}
... | ALGO | 0.999919 | 3.83795 |
6c899513-65f6-45de-8e5f-bbcea94a514a | TheDevilChild/DSA_Sheet | Arrays/Q24.cpp |
#include <bits/stdc++.h>
using namespace std;
class Solution{
//We would push all the numbers into a set and then we would traverse the array and check if the
//number previous to the current number is present or not.If present don't do anything but if not
//that means this is the number from where a cont... | ALGO | 0.999603 | 4.620295 |
359819cf-f212-4f29-b411-86c4ca47f9d3 | SahilKasare/Leetcode-Solutions | 2275-largest-combination-with-bitwise-and-greater-than-zero/2275-largest-combination-with-bitwise-and-greater-than-zero.cpp | class Solution {
public:
int largestCombination(vector<int>& candidates) {
int max_count = 0;
for (int bit = 0; bit < 32; ++bit) {
int count = 0;
for (int num : candidates) {
if (num & (1 << bit)) {
count++;
}
}... | ALGO | 0.998223 | 6.401793 |
fb2f4daf-7d55-4333-904a-6d381d5f32fd | HafijulHoque/Samsung-R-D-BD-coding-round-prep | rock_climibling/version1.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
int n, m;
vector<vector<int>> a;
// Function to check if the destination (cell with 3) is reachable with given step size l
bool canReach(int l) {
vector<vector<int>> v(n, vector<int>(m, 0));
queue<pair<int, int>> q;
q.push({... | ALGO | 0.999994 | 5.799081 |
222bb284-ded4-4a76-826b-a78d3cf21b4b | LIHPC-Computational-Geometry/gmds | modules/aero/src/NodeNeighbourhoodOnFront_3D.cpp | //
// Created by rochec on 21/12/2022.
//
/*------------------------------------------------------------------------*/
#include <gmds/ig/Mesh.h>
#include <gmds/aero/NodeNeighbourhoodOnFront_3D.h>
#include <gmds/aero/Utils.h>
/*------------------------------------------------------------------------*/
using namespace g... | ALGO | 0.999368 | 5.913374 |
b3730b54-46a0-44c5-a3ba-302b35514adf | JovemPedr0/OOP | URI/1014.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
double nKmPercorrido;
double nCombustivelGasto;
cin >> nKmPercorrido >> nCombustivelGasto;
cout << fixed << setprecision (3) << nKmPercorrido / nCombustivelGasto << " km/l" << endl;
return 0;
} | ALGO | 0.939558 | 4.63699 |
56d46c7f-293a-4cc7-b2d8-83ec578033ba | HONGYANGGAN/leetcode | solution/1400-1499/1402.Reducing Dishes/Solution.cpp | class Solution {
public:
int maxSatisfaction(vector<int>& satisfaction) {
sort(rbegin(satisfaction), rend(satisfaction));
int ans = 0, s = 0;
for (int x : satisfaction) {
s += x;
if (s <= 0) {
break;
}
ans += s;
}
... | ALGO | 0.999992 | 5.930721 |
2d6866db-7ee0-48a1-8918-92fd2896654c | raincross7/code-similarity | codes/train_code/problem030/problem030_185.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
int main()
{
ll n, a, b;
cin >> n >> a ... | ALGO | 0.99985 | 3.126868 |
0963fb68-4b32-4de8-a02b-17891dd1f447 | dlwogns/PS | ~2024/1781.cpp | #include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
struct cmp{
bool operator()(pair<int,int>a, pair<int,int>b){
if(a.first == b.first){
return a.second < b.second;
}
return a.first > b.first;
}
};
struct cmp2{
bool operator()(int a, int b){
... | ALGO | 0.99989 | 3.99801 |
11abe5f4-a97d-4272-a5d4-2321e554dad2 | dahiya-code/CSES-Sols | 1638 - Grid Paths.cpp | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define modulo 1000000007
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r" , stdin);
freopen("output.txt", "w", stdout);
#endif
int t=1;
// cin>>t;
while(t-... | ALGO | 0.999755 | 3.99778 |
6fbf8665-79da-4729-ace4-8bdf7131842d | HPC-Fortran2CPP/Fortran2Cpp | data/deepseek_coder_base_6.7B/readable_format_HPEC/cpp/file139.cpp | To translate the given Fortran code to C++, we need to understand the structure and functionality of the original Fortran code and then implement similar behavior using C++ constructs. The Fortran code uses OpenMP for parallel sections, which is a feature that is not directly available in C++ in the same way. However, ... | ALGO | 0.996375 | 6.334604 |
5b0b0b7a-b708-4292-b588-52a3a80bcb8c | quokka-astro/quokka | src/problems/RadForce/test_radiation_force.cpp | #ifdef HAVE_PYTHON
#include "util/matplotlibcpp.h"
#endif
#include "radiation/radiation_system.hpp"
#include <cstdint>
#include <fmt/format.h>
#include <string>
#include "AMReX.H"
#include "AMReX_BC_TYPES.H"
#include "AMReX_BLassert.H"
#include "AMReX_Box.H"
#include "AMReX_REAL.H"
#include "QuokkaSimulation.hpp"
#in... | ALGO | 0.99302 | 5.980766 |
5ec5dc52-f4ed-4297-b014-9f3b348c603d | durgirajesh/Leetcode | Check if Word Equals Summation of Two Words.cpp | class Solution {
public:
bool isSumEqual(string firstWord, string secondWord, string targetWord) {
int i=0,j=0,num1=0,num2=0;
while(i<firstWord.length()){
num1=num1*10+(firstWord[i]-97);
i++;
}
while(j<secondWord.length()){
num2=num2*10 + ... | ALGO | 0.999921 | 6.657485 |
0a5e53e8-28b5-4a25-a6b3-9679764c2535 | zhixiongruan/MPC-Project | src/Eigen-3.3/bench/geometry.cpp |
#include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace std;
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 8
#endif
typedef SCALAR Scalar;
typedef NumTraits<Scalar>::Real RealScalar;
typedef Matrix<RealScalar,Dynamic,Dynamic> A;
type... | ALGO | 0.941071 | 5.941502 |
530ee36a-1ff1-4be6-8b8e-48532bf89b92 | eTakazawa/procon-archive | atcoder.jp/abc021/abc021_b/Main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void) {
int n,a,b;
cin >> n >> a >> b;
set<int> st;
st.insert(a);
st.insert(b);
int k;
cin >> k;
for(int i=0;i<k;i++){
int p;cin >> p;
if(st.find(p) != st.end()){
cout << "NO" << endl;
return 0;
}
st.insert(p);
}
cout... | ALGO | 0.999907 | 3.897013 |
9c005789-5f1d-40b9-a814-4b39d36356cc | Pavankundrapu/leetcode_submissions | 206-reverse-linked-list/reverse-linked-list.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* reverse(Lis... | ALGO | 0.999731 | 5.663667 |
d51a6274-b64c-4005-990e-ac8e20bd55ed | kojilbj/webserv | src/conf/ConfParse.cpp | #include "ConfParse.hpp"
using namespace Wbsv;
std::vector<std::string> ConfParse::confTokenizer(std::ifstream& confFile)
{
std::vector<std::string> line;
std::vector<std::string> tokensTmp;
std::vector<std::string> tokens;
std::vector<std::string> tmp;
line = ConfParseUtil::split(confFile, '\n');
for (std::ve... | TOOL | 0.912455 | 4.695349 |
099645ab-570b-4cd4-824a-506cdae2ee7e | khalidfarooq/Leetcode-Journey | maximal-square/maximal-square.cpp | class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int row = matrix.size(), col = row > 0 ? matrix[0].size() : 0;
int maxSqLen = 0;
for(int i=0; i<row; i++){
for(int j=0; j<col; j++){
if(matrix[i][j] == '1'){
int cu... | ALGO | 0.999894 | 6.238829 |
8165185d-1e46-4596-8bd9-719c82238060 | ishandutta2007/codeforces | c8kbf/normal/1527/B1.cpp |
/*
template by c8kbf
*/
// macOS doesn't have <bits/stdc++.h> (shame)
#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <map>
#include <... | ALGO | 0.99995 | 3.802532 |
1ead5621-deba-46b4-b1fc-1312d9170d34 | AlexFeng123/code | algorithm/sort.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<chrono>
//debug
template<typename it>
void print_stl(const it &begin, const it &end)
{
std::for_each(begin, end,[](const auto& item){ std::cout<<" "<< item;});
std::cout<<std::endl;
}
//select sort
template<typename T>
void sele... | ALGO | 0.999725 | 5.152108 |
8932d5a4-e529-4cc8-925b-12ce7ac74f02 | TeamNyx/frameworks_av | media/libstagefright/codecs/aacdec/get_tns.cpp | /*
Pathname: get_tns.c
Date: 10/25/2000
------------------------------------------------------------------------------
REVISION HISTORY
Description: Modified from original shareware code
Description: Modified to pass variables by reference to eliminate use
of global variables.
Descripti... | TOOL | 0.968434 | 6.470543 |
d3e20b92-8c86-4ef3-826a-92a5824402e4 | mnkhmtv/I2O_assignments | ProgTask_2/src/InteriorPoint.cpp | #include "InteriorPoint.h"
#include <cmath>
#include <iostream>
InteriorPoint::InteriorPoint(double alpha, double epsilon)
: alpha(alpha), epsilon(epsilon) {}
void InteriorPoint::readProblem(Matrix &startingPoint, Matrix &C, Matrix &A,
Matrix &b) {
this->C = C;
this->A = A;
t... | ALGO | 0.999987 | 5.384053 |
1433b451-1805-43bc-8023-a357b0bb882f | moinulshaon/UVa-Problems | vol 120/12070__completed/12070.cpp | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <iostream>
#include <queue>
#include <climits>
using namespace std;
typedef long long LL;
#define PB push_back
#define FRO freopen("in.txt","r",stdin);
#define CLR(a... | ALGO | 0.999755 | 3.60536 |
93bbf074-73fe-4630-a07c-82f109697dd7 | Quypham14/Code_nam_3 | KBDS008_ptit.cpp | // #include <bits/stdc++.h>
// using namespace std;
// #define mod 1000000007
// int t;
// long n;
// int event_number(long n, int start, vector<long> &number)
// {
// if (n == 0)
// return 1;
// int way = 0;
// for (long i = start; i < number.size(); i++)
// if (n >= number[i])
// ... | ALGO | 0.99976 | 5.469901 |
2b755ce7-e357-4f3d-8217-68fa4685aeff | aospa-spl/android_external_skia | src/core/SkQuadClipper.cpp | #include "src/core/SkGeometry.h"
#include "src/core/SkQuadClipper.h"
#include <utility>
SkQuadClipper::SkQuadClipper() {
fClip.setEmpty();
}
void SkQuadClipper::setClip(const SkIRect& clip) {
// conver to scalars, since that's where we'll see the points
fClip.set(clip);
}
///////////////////////////////... | ALGO | 0.997819 | 6.902565 |
b75493a4-f992-4b2a-89ed-3ed75dfc4dc5 | zengxw21/connect-4 | ConnectFour/Batch/Windows/Sourcecode/main.cpp | #ifdef ONLINE_JUDGE
#include <cstring>
#include <cstdio>
#include "Point.h"
#include "Strategy.h"
void send(const char *msg) {
size_t len = strlen(msg);
printf("%c%c%c%c%s", (unsigned char)(len >> 24), (unsigned char)(len >> 16), (unsigned char)(len >> 8), (unsigned char)(len), msg);
fflush(stdout);
}
in... | ALGO | 0.99662 | 3.021007 |
aaa319ef-d83d-4b0b-965b-dde12155fe79 | thuang86714/LeetCodeCpp2024ver | Daily Challenge_2073. Time Needed to Buy Tickets.cpp | #include <queue>
#include <vector>
class Solution {
public:
int timeRequiredToBuy(std::vector<int>& tickets, int k) {
//TC O(sum(tickets)), SC O(n)
std::queue<std::pair<int, int>> ticketQueue;
for(int i = 0; i < tickets.size(); i++){
ticketQueue.push({tickets[i], i});
}
... | ALGO | 0.999951 | 6.200804 |
a91d6026-a091-4eef-9783-ef1797e9857f | Garzzza7/zadania | Algos/BFS.cpp | #include <iostream>
#include <queue>
#include <vector>
void
iterative_bfs(const int vertex, const std::vector<std::vector<int>> &adj) {
std::vector<bool> visited(adj.size(), false);
std::queue<int> que;
que.push(vertex);
while (!que.empty()) {
const int current = que.front();
std::cout << current << ... | ALGO | 0.999977 | 5.021406 |
4fd447c2-e57d-4fb0-9e8f-9ab0a205b0ef | inferenceengine/shadernn | core/3rdparty/eigen-3.4.0/bench/dense_solvers.cpp | #include <iostream>
#include "BenchTimer.h"
#include <Eigen/Dense>
#include <map>
#include <vector>
#include <string>
#include <sstream>
using namespace Eigen;
std::map<std::string,Array<float,1,8,DontAlign|RowMajor> > results;
std::vector<std::string> labels;
std::vector<Array2i> sizes;
template<typename Solver,type... | TOOL | 0.999101 | 6.326138 |
b3e88fde-3e0a-4968-beda-02c884b1a31d | hjhj97/ProblemSolving | Codeforces/190113-#532(Div2)/E.cpp | #include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stdlib.h>
#include<stack>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
/**********************... | ALGO | 0.999943 | 3.512598 |
a712f3ca-6b25-438b-80d8-350ead8c16fd | Bojanovski/Project-Iceberg | Source/Makina/BinnedCollisionSpace.cpp | #include "BinnedCollisionSpace.h"
#include "Exceptions.h"
#include "RigidBody.h"
#define AABB_Front 0x001;
#define AABB_Back 0x002;
#define AABB_Right 0x004;
#define AABB_Left 0x008;
#define AABB_Bottom 0x010;
#define AABB_Up 0x020;
using namespace Makina;
using namespace Physics_Makina;
using namespace std;
... | ALGO | 0.978445 | 7.320147 |
e64f8d55-d43b-47e4-819e-9cdd189908fc | esix/competitive-programming | _snippets/graphs/Bron-Kerbosch.cpp | // /e-olymp/~contest-9151/I
#include <set>
void print_set(const string& set_name, const set<int> &s, bool must_add_one = false) {
#ifdef _DEBUG
cout << set_name << ": { ";
for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
cout << (*it + int(must_add_one)) << ' ';
}
cout << '}' << endl;
#e... | ALGO | 0.999481 | 4.276042 |
fefc329f-7819-48f5-a637-96e9fb47b32d | larryzhou1111/Leetcode-1 | HighFreq/Median/4. MedianofTwoSortedArray.cpp | //////
// Sol1: Find kth smallest using minHeap
// Time: O(m + n)
class Solution {
bool isEven(int a) {
return a % 2 == 0;
}
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int m = nums1.size();
int n = nums2.size();
priority_queue<int, vector<... | ALGO | 0.999985 | 6.006025 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.