uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8163290a-1400-4537-8103-a60c1ca18dcd | iains/clang-cxx20-modules | libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/compare.pass.cpp | // <string>
// template<> struct char_traits<wchar_t>
// static int compare(const char_type* s1, const char_type* s2, size_t n);
// constexpr in C++17
#include <string>
#include <cassert>
#include "test_macros.h"
#if TEST_STD_VER > 14
constexpr bool test_constexpr()
{
return std::char_traits<wchar_t>::compare(... | TEST | 0.877336 | 5.97248 |
009b6f6d-a5e3-45ab-84a4-60381b0446fd | mainul3195/codes | Others/I_Game_on_Array.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n;
cin >> n;
int a[n];
long long sum = 0;
for (int i = 0; i < n; i++)
{
cin >> a[i];
sum += a[i];
}
if (n == 1)
{
if (a[0] == 1)
cout << "Bob\n";
else
cout << "Al... | ALGO | 0.999945 | 4.557716 |
dd109c6c-8f49-438c-8f41-190071cae3f1 | EternalProg/Algorithms | LeetCode/1457. Pseudo-Palindromic Paths in a Binary Tree.cpp |
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), ... | ALGO | 0.999939 | 5.936847 |
1e02035f-44c6-4df9-9d6c-288fafffdaaa | nybzmr/CP | Rebuild/Basics/13_bitwise_operations_and_bitmasks/Reverse_bits.cpp | // Author: Nayaab Zameer
#include <bits/stdc++.h>
using namespace std;
#define pi (3.141592653589)
#define mod 1000000007
#define pb push_back
#define is insert
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min... | ALGO | 0.999461 | 4.125764 |
08afc0f5-5732-433d-96f1-c3fd37df6812 | 22jinwoO/CodingTest | 프로그래머스/0/181871. 문자열이 몇 번 등장하는지 세기/문자열이 몇 번 등장하는지 세기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(string myString, string pat) {
int answer = 0;
// 첫글자 같으면 같은지 확인
for(int i = 0; i < myString.size(); i++)
{
int sameValue = 0;
if(myString[i] == pat[0])
{
for (int j = 0; j < pat.size();... | ALGO | 0.999768 | 5.35626 |
43b4739c-9984-4524-baca-87c966a6e53f | Ronit-02/Leetcode-questions | 50-powx-n/50-powx-n.cpp | class Solution {
public:
double power(double x, long int n){
if(n < 0){
return (1/power(x, n*-1));
}
if(n == 0)
return 1;
if(n % 2 == 0){
double a = power(x, n/2);
return a*a;
}
else{
... | ALGO | 0.999818 | 5.587764 |
65eeac91-ed05-4c9d-9dc3-6e216a09bae8 | koybasimuhittin/cses-solutions | cpp/advanced-techniques/reachability_queries.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define int long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int MOD = 1e9 + 7;
const int N = 5e4 + 5;
int n, m, q, scc_index[N], scc_... | ALGO | 0.999974 | 4.531658 |
fd8e14b1-9132-4ca0-b577-32a0158d7c62 | mabarrera4/UVa-Online-Judge-Solutions | 245.cpp | /*
* 245. Uncompress
* status: Accepted
* TOPIC: binary heaps, heaps with updates, simulation, stl set, stl map
*/
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#... | ALGO | 0.999684 | 4.133667 |
32a1b5bd-c734-4b9a-a9d6-d9c8db783564 | Eduu84/mundoteam | src/wallet/txassembler.cpp | #include <wallet/txassembler.h>
#include <consensus/tx_check.h>
#include <consensus/validation.h>
#include <policy/policy.h>
#include <util/check.h>
#include <util/fees.h>
#include <util/rbf.h>
#include <util/translation.h>
#include <wallet/fees.h>
#include <wallet/reserve.h>
Optional<AssembledTx> TxAssembler::Assemb... | TOOL | 0.962857 | 7.700904 |
8269de1d-0834-47e3-b401-aab5c7e35706 | LumaKernel/lib-cpp | src/graph/BiedgeConnectedComponent.cpp | // @import header
// #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// @@
// @name Biedge Component Decomposition Library
// @title 二辺連結成分分解
// @snippet biedge
// @alias bridge twoedge nihen
// !! require Lowlink !!
// NOTE : 二辺連結成分分解
// Biedge(built-lowlink)
// Biedge(graph)
// NOTE : B... | ALGO | 0.99966 | 5.242781 |
6ebc4971-e721-4940-8bd9-ac1fa961935f | AlekseiTiunin/C-Primer-Plus | Chapter 3/3_5.cpp | // population.cpp
#include <iostream>
int main()
{
using std::cout;
using std::cin;
using std::endl;
long long population_world, population_russia;
cout << "Enter the world's population: ";
cin >> population_world;
cout << "Enter the population of the Russia: ";
cin >> population_rus... | TOOL | 0.943386 | 4.117077 |
71649849-197c-4205-8c9d-85d6e7fbbe5e | Danzai-Senpai/C-_RestartFromBase | Curso Completo de Linguagem C , C++ e Orientação a Objetos/studyModule/015_functions.cpp | #include<iostream>
using namespace std;
void myFunction(string fname = "Leon", int age = 26);
int myReturn(int x, int y);
void myFunction(int &x, int &y);
void myFunction(int myNumbers[5]);
//Global Variable
string global;
int main() {
//Local Variable
string local;
cout << "\n";
myFunction();... | TOOL | 0.948598 | 3.906386 |
325a389f-686d-4879-81dd-24f0093f289e | RichieDatalyst/Semester-Work | PF/PF-1/Q1(a) Array.cpp | #include <iostream>
using namespace std;
void Digit_Frequency(int Numbers[],int N,int F[]){
int i=0,x=0,y=0;
while(i<N){
i++;
if(Numbers[i]>=-10||Numbers[i]<=10){
while(x<N){
x++;
if(Numbers[i]==Numbers[x]){
y++;
... | ALGO | 0.99925 | 4.059368 |
58778dfd-c284-4579-b590-9c5c65858b7e | YohananBoy/Algoritmos-2024 | While/Simulados/0101.cpp | #include <iostream>
#include <math.h>
using namespace std;
int quantidadeDeDigitosDeUmInteiro(int n)
{
int i, r = 0;
if (n == 0)
{
return 1; // Se o nmero o zero, h apenas um dgito.
}
else while (n != 0)
{ //Caso contrrio, verificamos por quantas vezes
n = n / 1... | ALGO | 0.998642 | 4.457339 |
47db6ee8-16e5-43c3-94ea-df0b1fa6c913 | Hamza-ALyemeni/recursive-functions-cpp | sequance_length.cpp | #include<iostream>
using namespace std;
void three2_plus_sequance(int n)
{
int static counter = 0;
++counter;
if (n == 1)
{
cout<<counter<<" ";
return;
}
if (n % 2 == 0){
three2_plus_sequance(n / 2);
}
else{
three2_plus_sequance(3 * n + 1);
}
}
... | ALGO | 0.999958 | 4.265682 |
0a487a1f-b5b9-42a6-b65f-dfd9550ba82c | raamkashyap/InterviewBit | Strings/StringandItsFrequency.cpp | string Solution::solve(string A) {
int count[26];
memset(count,0,sizeof(count));
for(auto c : A){
count[c-'a']++;
}
string res ="";
for(int i=0;i<A.size();i++){
if(count[A[i]-'a'] > 0){
res += A[i];
res += to_string(count[A[i]-'a']);
count[A... | ALGO | 0.999997 | 4.820408 |
7c05c93f-49c5-48ac-b8f9-a4f64a633046 | Shreeya2004/c- | palindrome.cpp | #include<iostream>
using namespace std;
int main(){
int rem,res,n,f;
cout<<"enter n";
cin>>n;
f=n;
while(n!=0){
rem=n%10;
res=res*10+rem;
n=n/10;
}
if(f==res){
cout<<"is a palindrome";
}
else{
cout<<"is not a palindrome";
}
return 0;
}
| ALGO | 0.999917 | 3.814695 |
4697d538-890f-49a7-9484-dc9621155ac7 | danknessdra/codeforces | 1200/1850G.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void fast() {
cin.tie(0);
cout.tie(0);
}
int main() {
int t;
cin>>t;
while (t--) {
int n;
long long pairs = 0;
cin >> n;
unordered_map<long long, long long> up, down, side, side2;
for (int i ... | ALGO | 0.999761 | 4.506879 |
8a0e2c4f-c11d-4379-902f-9f11a24de8be | aaronmarayaa/Cpp | Recursive.cpp | #include <iostream>
using namespace std;
int factorial(int n){
if(n == 1){
return 1;
} else {
return n * factorial(n - 1);
}
}
int main(){
cout << factorial(10);
} | ALGO | 0.996494 | 3.953776 |
423b438e-111c-4ef3-be73-6f9d0100082d | oculo0204/pr_lang_study | CppStudy/C_CPP_Algorithm/Project1/Project1/circle_class_example.cpp | #include <iostream>
using namespace std;
class Circle
{
public:
double radius; // ʵ
Circle() // Լ
{
radius = 1;
}
Circle(double newRadius) // Լ ̸ Ŭ ƾ ϴ°?
{
radius = newRadius;
}
double getArea() {
return radius * radius * 3.141592;
}
};
int main() {
Circle circle1(1.0);
Circle circle2(25); //ݿøǴ �... | TOOL | 0.927796 | 5.193243 |
a0d0cbbf-4ddc-4dd5-9d4d-84d952f83ce0 | ajkrish95/CompetitiveProgramming | euler 21.cpp | #include<iostream>
#include<math.h>
using namespace std;
long long int a[2000001],b[100000],c[2000000];
long long int func (long long int i,long long int q,long long int p)
{
long long int y,w=0;
while(q%p==0)
{
q=q/p;
++w;
}
y=pow(p,w+1);
y=y-1;
y=y/(p-1);
c[i]=c[i]*y;
return q;
}
int main()
{
long long in... | ALGO | 0.999902 | 3.107483 |
82f112a8-b745-4037-979c-b149cb549e52 | MingyuKwon/LeetCode | 0034-find-first-and-last-position-of-element-in-sorted-array/0034-find-first-and-last-position-of-element-in-sorted-array.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
int start = -1;
int end = -1;
int left = 0;
int right = nums.size()-1;
int mid = left + (right - left)/2;
while(left <= right)
{
mid = left + (right - left)... | ALGO | 0.999951 | 6.576535 |
f901c3d5-d37f-4a59-be63-689856f1ef6b | mrvau/XPSC | Week-07/A_Little_Nikita.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t--) {
int n, m;
cin >> n >> m;
if(n < m) {
cout << "No" << endl;
} else {
int diff = n - m;
if(diff == 0 || diff % 2 == 0) {
cout << "Yes... | ALGO | 0.999985 | 4.621222 |
c973604a-606d-4d63-aabf-e945539d7631 | mendigali/itp | Week 3/301.cpp | #include <iostream> // library for cin and cout
using namespace std; // std:: by default
int main() { // main function
double x, y, z; // initialize 3 double variables
cin >> x >> y >> z; // input 3 variables
if (x < y && y < z) { // check if x < y < z is true
cout << "YES"; // if true output YES
... | ALGO | 0.999932 | 4.306469 |
ed4dd84b-19b1-4b60-a5e4-106fea4c8786 | venkysio/programs-prod | algorithms/Sorting/Medium/RadixSort/VSDRadixSort.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int max(int arr[],int n){
int maxele=arr[0];
for(int i=0;i<n;i++){
if (arr[i]>maxele){
maxele=arr[i];
}
}
return maxele;
}
void countingSort(int arr[],int n,int decimalplace){
int count[10];
int output[... | ALGO | 0.999824 | 5.185088 |
c10a3cea-8f03-4355-a763-e6fa9460504c | lite-os/frameworks_av | media/libstagefright/codecs/amrnb/common/src/lsp_lsf.cpp | /*
Pathname: ./audio/gsm-amr/c/src/lsp_lsf.c
Functions: Lsp_lsf
Lsf_lsp
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template.
Description: Deleted variables listed in the Local Stores Needed/Modified
... | ALGO | 0.999111 | 6.377015 |
46832cd8-7e31-45fd-a9c7-1aec3ae5973c | rituburman/hacktoberfest2020 | INTERVIEWBIT/Binary-Search/CountElementOccurence.cpp | // https://www.interviewbit.com/problems/count-element-occurence/
int binarySearch(const vector<int> &A, int start, int end, int key, bool searchFirst){
int result = -1;
int mid;
while(start <= end){
mid = start + (end-start)/2;
if(A[mid] == key){
result = mid;
if(se... | ALGO | 0.999946 | 5.799244 |
3bc5f62d-14bc-4738-9f6e-92d3526e13fe | 23f2002007/leetcode | solution/1600-1699/1624.Largest Substring Between Two Equal Characters/Solution.cpp | class Solution {
public:
int maxLengthBetweenEqualCharacters(string s) {
vector<int> d(26, -1);
int ans = -1;
for (int i = 0; i < s.size(); ++i) {
int j = s[i] - 'a';
if (d[j] == -1) {
d[j] = i;
} else {
ans = max(ans, i - d... | ALGO | 0.999895 | 5.514 |
8e84b92b-b6e6-46f8-9446-cce01f3b4947 | JamesQAQ/Coding-Practices | LeetCode/Easy/0922. Sort Array By Parity II/2023-12-24_Accepted.cpp | class Solution {
public:
vector<int> sortArrayByParityII(vector<int>& nums) {
int odd_ptr = 1;
int even_ptr = 0;
for (int i = 0; i < nums.size(); i++) {
if (i % 2 == 0 && nums[i] % 2 != 0) {
swap(nums[odd_ptr], nums[i--]);
odd_ptr += 2;
} else if (i % 2 != 0 && nums[i] % 2 == 0... | ALGO | 0.999985 | 5.8287 |
1540d307-ed8e-48cd-9e35-8983ab2a3e10 | ishandutta2007/codeforces | mohammedehab2002/normal/1131/F.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> v[150005];
int par[150005];
int find(int x)
{
if (par[x]!=x)
par[x]=find(par[x]);
return par[x];
}
int main()
{
int n;
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
v[i].push_back(i);
par[i]=i;
}
while (--n)
{
int x,y;
scanf("%d%d",&x,&... | ALGO | 0.999985 | 4.076357 |
7069bda5-77d9-4654-8c8f-eb2c6cad4bf1 | lordofthebombs/cpsc-453-a1 | 453-skeleton/453-skeleton/thirdparty/vivid-2.2.1/src/interpolation.cpp | #include "vivid/interpolation.h"
#include "vivid/conversion.h"
#include "vivid/color.h"
#include "vivid/utility.h"
#include "vivid/stream.h"
#include <iostream>
namespace vivid {
////////////////////////////////////////////////////////////////////////////////
rgb_t lerp( const rgb_t& rgb1, const rgb_t& rgb2, const f... | ALGO | 0.948993 | 6.460529 |
32ed9b75-7de9-4343-98b4-2c2817067189 | partho-das/CompetitiveProgrmming | CP_CODE/Codeforces/Educational Codeforces Round 79 (Rated for Div. 2)/b.cpp | #include <bits/stdc++.h>
using namespace std;
//____________________________________________________________________________________________________________________________________
#define PI 2*acos(0.0)
#define pf printf
#define sf scanf
#define ff first
#define ss second
#define mp make_pair
#define pb push... | ALGO | 0.999943 | 3.29246 |
1e5c68f6-de9e-423b-ae07-0658dac1cf25 | AmruthaSri852/Leetcode101 | SummerChallenge/15.cpp | //15. 3Sum
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums)
{
int n=nums.size();
vector<vector<int>>ans;
sort(nums.begin(), nums.end());
for(int i=0; i<n-2; i++)
{
int src=0-nums[i];
int left=i+1, right=n-1;
w... | ALGO | 0.999976 | 5.552125 |
7d85a863-fcbb-4188-ae74-338cf6495f5a | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/permutation-sequence-Solution.getPermutation/177912_Exec_Code_Overflow.cpp | tt_cmap12_validate( FT_Byte* table,
FT_Validator valid )
{
FT_Byte* p;
FT_ULong length;
FT_ULong num_groups;
if ( table + 16 > valid->limit )
FT_INVALID_TOO_SHORT;
p = table + 4;
length = TT_NEXT_ULONG( p );
p = table + 12;
p ... | ALGO | 0.973565 | 4.848298 |
be45fbd5-af03-4030-a6f8-4b6c3bdb085b | ROCm/flang | flang-classic/llvm-classic/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp | #include "llvm/IR/ProfileSummary.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/ProfileData/ProfileCommon.h"
#include "llvm/ProfileData/SampleProf.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
cl::opt<bool> UseContextLessSummary(
"profile-summary-contextless", cl::Hidden,
cl::desc(... | TOOL | 0.904576 | 7.813462 |
d5ef73eb-6d47-4084-bb7f-8f0329f3af23 | riscv-android-src/platform-prebuilts-ndk | r20/sources/cxx-stl/llvm-libc++/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp | // UNSUPPORTED: libcpp-no-exceptions
// Test asan vector annotations with a class that throws in a CTOR.
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "asan_testing.h"
class X {
public:
X(const X &x) { Init(x.a); }
X(char arg) { Init(arg); }
X() { Init(42); }
X &operator=(const X &x)... | TEST | 0.97831 | 6.668961 |
d7daa9d0-6ef8-4056-b064-0541d4dcacbc | Andwerpz/Competitive-Programming-Practice | - cpp -/shoeshuffling.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//Codeforces - 1691B
//just give each person a shoe of the same size they originally had.
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t-- > 0){
int n;
cin >> n;
... | ALGO | 0.999931 | 4.461549 |
7bef8d0f-c691-4f11-9631-61e57643478a | ishandutta2007/codeforces | potassium/normal/1404/A.cpp | #pragma GCC optimize ("O3", "unroll-loops")
//#pragma GCC target ("avx2")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(x) (x... | ALGO | 0.99999 | 4.012206 |
3785d11c-4676-4f2e-8e66-25e74887b9ee | ksh24865/smart-park | sensor-network/ToIoTwithLoRaWAN/src/arduino-rfm/Encrypt.cpp |
/*
*****************************************************************************************
* INCLUDE FILES
*****************************************************************************************
*/
#include "Encrypt.h"
#include "AES-128.h"
#include "Struct.h"
#include <Arduino.h>
/*
*****************************... | ALGO | 0.878094 | 5.269385 |
56678878-8fb9-4eda-a139-1a09572f3f3f | kmjp/procon | atcoder/abc301-350/abc326/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#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 FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999759 | 3.714727 |
ddf24e37-6b3b-40a7-a12b-096a13753861 | jaiminb2512/DSA-LoveBabbar-Adventures | Lecture_131 Buy and Sell Stock [Part 2]/122. Best Time to Buy and Sell Stock II with Tabulation.cpp | class Solution {
public:
int solve(vector<int>& prices){
int n = prices.size();
vector<vector<int> > dp(n+1, vector<int>(2,0));
for(int index = n-1; index >= 0; index--){
for(int buy = 0; buy <= 1; buy++){
int profit = 0;
... | ALGO | 0.99994 | 5.814465 |
fa112bcb-2122-40ee-88b7-41803d496789 | usamike25/leetcode | 3.longest-substring-without-repeating-characters.cpp | /*
* @lc app=leetcode id=3 lang=cpp
*
* [3] Longest Substring Without Repeating Characters
*/
// @lc code=start
class Solution
{
public:
int lengthOfLongestSubstring(string s)
{
if (s.empty())
{
return 0;
}
unordered_set<char> mySet; // Change set<int> to unorde... | ALGO | 0.999731 | 6.485806 |
89bf0b41-2925-431a-8b4d-e38d37f33ecd | lee-younggwan/Algorithm | 프로그래머스/Level 1/완주하지 못한 선수.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
string solution(vector<string> participant, vector<string> completion) {
string answer = "";
sort(participant.begin(), participant.end());
sort(completion.begin(), completion.end());
f... | ALGO | 0.999605 | 5.08614 |
8c3d5497-818f-4c27-8ead-6c58499a0c8d | alexandraback/datacollection | solutions_5688567749672960_0/C++/tyamgin/main.cpp | #define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:500000000")
#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <numeric>
#include <sstream>
#include <fstream>
#include <ctype.h>
#include <stdio.h>
#include <bitset>
#... | ALGO | 0.997837 | 3.899144 |
3e60027c-1670-4c18-b0e5-a91c7395c8e6 | taejuk/algorithm | chapter8/NUMB3RS.cpp | #include <iostream>
#include <memory.h>
int N = 5;
double pos[5] = {0,0,0,0,0};
int roadCounts[5] = {0,0,0,0,0};
int road[5][5] = {
{0,1,1,1,0},
{1,0,0,0,1},
{1,0,0,0,0},
{1,0,0,0,0},
{0,1,0,0,0}};
// 어떻게 하면 메모이제이션을 적용할 수 있을까?
void calculate(int current, int days, double currentPos) {
if(days =... | ALGO | 0.99984 | 3.354273 |
3e626d76-5d56-4296-b725-a1b133585085 | PandarinDev/aoc2024 | day05/day05_part2.cpp | #include <unordered_map>
#include <unordered_set>
#include <vector>
#include <stdexcept>
#include <iostream>
#include <algorithm>
#include <common.h>
using Edges = std::unordered_map<std::size_t, std::unordered_set<std::size_t>>;
int main() {
const auto input = aoc::read_file("day05/input.txt");
// Firs... | ALGO | 0.998387 | 6.662609 |
a276d1b3-7a7b-44cc-b81c-7207aff3c627 | shirik534/junk | spbau/c++/stl4/exc/main.cpp | #include <algorithm>
#include <vector>
#include <iostream>
#include <stack>
#include <cassert>
template <class Type>
struct nth
{
const size_t n;
size_t counter;
nth(size_t step)
: n(step)
, counter(0)
{}
bool operator()(Type const &it)
{
return ((++counter % n) == 0);
}
};
template <class InputIterato... | ALGO | 0.996263 | 3.995174 |
1d4975c6-61c8-41a7-9299-8c846b930a63 | AmirFaruk75/Codeforces2 | Function.cpp | #include<bits/stdc++.h>
using namespace std;
long long int SOD(long long n)
{
long long int sum=0;
while(n)
{
sum+=n%10;
n=n/10;
}
return sum;
}
int main()
{
ios_base::sync_with_stdio(false);
long long i,k,n;
cin>>k;
for(long long int i=19;;i++)
{
if(SOD(i... | ALGO | 0.999217 | 4.019083 |
c27bd5b1-e9d9-47c5-bdba-f86b40c76e5d | Darkborderman/Online-judge | ZOJ/b558.cpp | #include<iostream>
using namespace std;
int main()
{
int a[500]={0},input,i;
a[0]=1;
for(i=1;i<=499;i++)
{
a[i]=a[i-1]+i;
}
while(cin>>input)
{
cout<<a[input-1]<<endl;
}
return 0;
}
| ALGO | 0.99983 | 3.558932 |
8e99059e-8809-49ce-8ab9-ceebbc3b1340 | Ambar-07/DSA-practice | loops/while5.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int i=2;
while(i<=128)
{
cout<<i<<endl;
i *= 2;
}
}
| ALGO | 0.996354 | 3.043069 |
32b49b36-c893-4c66-b9f3-b0a8e5c61c4c | nikhilrana015/Leetcode-Daily-Challenge | July-2023/22-July-Knight probability in chess board.cpp | class Solution {
public:
int dx[8] = {-2,-2,-1,1,-1,1,2,2};
int dy[8] = {-1,1,-2,-2,2,2,-1,1};
bool isValid(int row, int col, int n)
{
if(row<0 or col<0 or row>=n or col>=n)
return false;
return true;
}
double helper(int n, int k, int row, int col, vector<vector<v... | ALGO | 0.999925 | 4.614946 |
312552c2-5e8c-4cff-9b7a-f39af19b7142 | raijin-asr/Sajilo-Object-Detector | dlib-master/dlib/test/cca.cpp | #include <dlib/statistics.h>
#include <dlib/sparse_vector.h>
#include <dlib/timing.h>
#include <map>
#include "tester.h"
namespace
{
using namespace test;
using namespace dlib;
using namespace std;
logger dlog("test.cca");
dlib::rand rnd;
// ----------------------------------------------------... | TEST | 0.893872 | 6.823686 |
4181ba9f-f0d1-4f1d-aa53-78bce9686dc3 | nickstevensMU/HawkScan | droneProjectFinal/public/assets/py/opencv-python-4.5.4.60/opencv/modules/features2d/src/evaluation.cpp | /
#include "precomp.hpp"
#include <limits>
using namespace cv;
template<typename _Tp> static int solveQuadratic(_Tp a, _Tp b, _Tp c, _Tp& x1, _Tp& x2)
{
if( a == 0 )
{
if( b == 0 )
{
x1 = x2 = 0;
return c == 0;
}
x1 = x2 = -c/b;
return 1;
}
... | ALGO | 0.99975 | 5.624839 |
43bd754e-07ea-466e-9634-4455aa6f8f9a | talhahakeem/Programming-Fundamental | Class & Lab C++/PF Class Tasks/table_by_do_while.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Enter the number whose table you want to print:";
cin >> a;
cout << "Enter the number as far as you want to print:";
cin >> b;
int i = 1;
do
{
cout << a << "*" << i << "=" << a * i << endl;
i++;
... | ALGO | 0.997214 | 3.823462 |
5c60a672-18f9-4644-9341-6a262853bde2 | iluque95/ESIN | test.cpp | #include <iostream>
using namespace std;
long quadrat(int n)
{
// Pre: n >= 0
// Post: Retorna n^2
long res;
if (n <= 1)
res = 1;
else if (n % 2 == 0)
res = 4 * quadrat(n / 2);
else
res = 4 * quadrat(n / 2) + 2 * n - 1;
return res;
}
int main()
{
for (auto i = ... | ALGO | 0.994036 | 5.121964 |
8766a33a-0e35-4ec1-929b-64eff1564fc3 | ishandutta2007/codeforces | chen_zexing/normal/1417/C.cpp | #include <stdio.h>
#include<iostream>
#include<string>
#include <algorithm>
#include <string.h>
#define LL long long
#define MAX 100005
using namespace std;
int a[300005],d[300005],r[300005],mx[300005],ans[300005],num[300005];
bool cmp(int a,int b){
return mx[a]<mx[b]||mx[a]==mx[b]&&a<b;
}
int main() {
int T;
... | ALGO | 0.999985 | 4.014028 |
15486933-30f0-44ef-a40d-3c3a19be41aa | Manan-Joshi750/Code_Through_DSA_CPP | Recursion/reverseStack_usingRecursion.cpp | #include <iostream>
#include <stack>
using namespace std;
void insertAtBottom(stack<int> &s, int element) {
if(s.empty()) {
s.push(element);
return;
}
int num = s.top();
s.pop();
insertAtBottom(s, element);
s.push(num);
}
void reverseStack(stack<int> &stack) {
if(... | ALGO | 0.999875 | 6.00098 |
b09585a9-3162-4482-bbbd-b46e6b2a9dcf | chaitanyaram1204/Leetcode-Problems | 2155-find-missing-observations/2155-find-missing-observations.cpp | class Solution {
public:
vector<int> missingRolls(vector<int>& rolls, int mean, int n) {
long long int sum = 0;
sum = accumulate(rolls.begin(),rolls.end(),sum);
int m = rolls.size();
int remaining = mean * (n + m);
remaining -= sum;
vector<int>temp;
if(remaini... | ALGO | 0.999255 | 4.970616 |
cd45551e-c652-4e76-87b4-05ad26e43ed2 | kanupriyaanand/VR_escape_room_project | Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.947374 | 6.926379 |
a57df62c-4b29-4795-8b15-d5d7d8ce60f1 | YuJinSong412/zk-RealEstate | depends/hashes/Poseidon.cpp |
#include <cstdint>
#include <cstring>
#include <vector>
#include <string>
#include <Poseidon.hpp>
#include <PoseidonConstants.hpp>
using namespace std;
namespace Hashes {
BigInteger Poseidon::hash( const vector<BigInteger> & inputs , BigInteger __FIELD_PRIME ){
FIELD_PRIME = __FIELD_PRIME ;
... | ALGO | 0.999401 | 6.074547 |
e2005015-7c75-4add-9069-e5e334e5f5c4 | pranonrahman/Competitive-Programming-Codes | Problem Solutions/Gym/101806Z/18735253_AC_31ms_20kB.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
int i;
cin >> n;
int arr[n+5];
for(i=0;i<n;i++) cin >> arr[i];
int a=0,b=2;
int mx=0;
while(b<n)
{
if((arr[b-2]>=arr[b-1] and arr[b-1]>=arr[b]) or (arr[b]>=arr[b-1] and arr[b-1]>=arr[b-2]) )
{
... | ALGO | 0.999952 | 4.380899 |
bdf97bef-399b-45b7-ac3c-601a3b934498 | akshaty10/Week2-C--CPP | Lecture 14-Cipherschools.cpp | //conversion-2
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node*next;
Node(int n){
data = n;
next = NULL;
}
};
Node* makeLL(){
int data;
cin>>data;
Node* h = NULL;
Node*temp = NULL;
while(data!= -1){
Node*newNode =new Node(data);
if(h == NULL){
h = newNode;
... | ALGO | 0.999473 | 4.066862 |
914b74c3-bcc0-4c74-984e-96df35b62349 | farmpiggie/competitive-programming | codeforces/1971/b.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
int t; cin >> t;
while (t--) {
string s; cin >> s;
int n = (int) s.length();
bool works = false;
for (int i = 1; i < n; i++) {
if (s[0] != s[i]) {
swap(s[0], s[i]);
works = true;
break;
}
}
if (w... | ALGO | 0.999968 | 4.614087 |
abac6582-e05d-404e-b41f-898b6494737b | HG-IMMORTALS/SDE-SHEET | SDE-SHEET-main/176_Maximum Sum Increasing Subsequence.cpp | // Time Complexity -> O(n*n)
// space Complexity -> O(n*n) + O(n) recursion stack space
#include <bits/stdc++.h>
int helper(int idx, int prev, int n, vector<int>& rack, vector<vector<int>>& dp)
{
if(idx == n)
return 0;
if(dp[idx][prev + 1] != -1)
return dp[idx][prev+1];
int notTake = helper(idx+1, prev, n,... | ALGO | 0.99996 | 5.741933 |
1a346bc2-4034-467b-bf64-a6f415dbe0b8 | aryangupta02092002/MarchChallenge2023 | GFG/BinaryMatrixHavingMaximumNumberOf1s.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution {
public:
//TC : O(N*N)
vector<int> findMaxRow(vector<vector<int>> mat, int N) {
//code here
int mx1s = 0, idx = 0;
fo... | ALGO | 0.999465 | 6.01346 |
83f22589-8fb7-4e89-b92e-5762bc41c727 | aanu2021/Leetcode-Solutions | 2370-longest-ideal-subsequence/2370-longest-ideal-subsequence.cpp | class Solution {
public:
int longestIdealString(string s, int k) {
int n = s.length();
vector<int>freq(26, -1);
for(int i=0;i<n;i++){
char ch = s[i];
int currValue = (int)(ch-'a');
int prevMax = 0;
for(int j=0;j<26;j++){
if(freq... | ALGO | 0.999961 | 6.044833 |
226148d9-26b7-4d27-ae0a-4251a973ab63 | litlpoet/eigenutils | thirdparties/eigen3/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.990676 | 5.890235 |
19e6c8a2-cae5-46f8-9ebc-9f2fd87a2661 | deepakasu67/leetcode | Old Leetcode/18.Permutation in String.cpp | #include<iostream>
#include<string>
#include<vector>
#include<array>
#include<algorithm>
using namespace std;
class Solution {
public:
Solution()
{
ios::sync_with_stdio(0);
cin.tie(0);
}
bool isAnagram(array<int, 26> subStringCount, array<int, 26> patternsCount, string pattern)
{
... | ALGO | 0.999976 | 5.409989 |
b503db32-8438-4c6c-8210-a87921e0003c | schnrj/LeetCode_Problems | 2691-count-vowel-strings-in-ranges/count-vowel-strings-in-ranges.cpp | class Solution {
public:
vector<int> vowelStrings(vector<string>& words, vector<vector<int>>& queries) {
vector<int> prefix(words.size(), 0);
int count = 0;
for (int i = 0; i < words.size(); i++) {
char first = words[i][0], last = words[i].back();
if ((first == 'a' |... | ALGO | 0.999944 | 6.650398 |
adb5ea07-fa5d-43c0-ab16-9199f95ba948 | Trevorchenmsu/LeetCode-Solutions | leetcode/editor/en/[827]Making A Large Island.cpp | //You are given an n x n binary matrix grid. You are allowed to change at most o
//ne 0 to be 1.
//
// Return the size of the largest island in grid after applying this operation.
//
//
// An island is a 4-directionally connected group of 1s.
//
//
// Example 1:
//
//
//Input: grid = [[1,0],[0,1]]
//Output: 3
//E... | ALGO | 0.999934 | 6.833727 |
9c59b0eb-5c81-4ca7-a1f9-1e1556c98b23 | teja-surya-p/Competitive-coding-practice | day 1/2.cpp | # include <iostream>
using namespace std;
int factorial(int k)
{
int x=1;
int i;
for(i=1;i<=k;i++)
{
x=x*i;
}
return x;
}
int ncr(int x, int y)
{
int k;
k = (factorial(x)/(factorial(y) * factorial(x-y)));
return k;
}
void find_pacsac(int k)
{
int i;
if(k==1)
{
... | ALGO | 0.99997 | 4.170818 |
b69b573d-f36a-4acd-a10c-78d0f2facea8 | park9n/playground | sw-expert-academy/hash/main.cpp | #include <stdio.h>
#include <string.h>
#include <memory.h>
#include "main.h"
Hash tb[MAX_TABLE];
unsigned long hash(const char *str) {
unsigned long hash = 5381;
int c;
while (c = *str++) {
hash = (((hash << 5) + hash) + c) % MAX_TABLE;
}
return hash % MAX_TABLE;
}
int add(const char *... | ALGO | 0.993736 | 4.079547 |
c160c425-a05c-4a7f-9aca-2e95085b5484 | AnselGitAccount/USERMESO-2.0-mdpd | src/compute.cpp | #include "lmptype.h"
#include "mpi.h"
#include "stdlib.h"
#include "string.h"
#include "ctype.h"
#include "compute.h"
#include "atom.h"
#include "domain.h"
#include "comm.h"
#include "group.h"
#include "atom_masks.h"
#include "memory.h"
#include "error.h"
#include "force.h"
using namespace LAMMPS_NS;
#define DELTA 4
... | TOOL | 0.967661 | 4.279122 |
5bd95f5e-1bcc-4dad-b751-2eb519e981c1 | jahirsadik/data-structures-practice-2-1 | InfixToPostfixConversion.cpp | #include<bits/stdc++.h>
using namespace std;
int precedence(char ch) {
if(ch == '^') return 4;
if(ch == '*' || ch == '/') return 3;
if(ch == '+' || ch == '-') return 2;
if(ch == '(') return 1;
return -1;
}
bool isOperand(char ch){
if(ch >= 'a' && ch <= 'z') return true;
if(ch >= 'A' && ch <= 'Z') return... | ALGO | 0.999857 | 4.660394 |
9648d67f-abc7-4b38-8e54-7e62286b0e0f | ishandutta2007/codeforces | shadowlight/normal/920/E.cpp | #include <bits/stdc++.h>
#define ll long long
#define TASKNAME ""
using namespace std;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 7;
const double EPS = 1e-8;
vector <bool> used;
vector <vector <int> > gr;
int sz = 0;
set <int> q;
void dfs(int v) {
if (used[v]) return;
// cout << v << "\n";
// for (... | ALGO | 0.999989 | 4.506149 |
7b590796-4d7d-42c6-91e1-e2e77cfed0d7 | wywhpsmaq/h | GESP/2024037级/13.cpp | int count_triple(int n) {
int cnt = 0;
for (int a = 1; a <= n; a++)
for (int b = a; a + b <= n; b++)
for (int c = b; a + b + c <= n; c++)
if (a * a + b * b == c * c) cnt++;
return cnt;
} | ALGO | 0.999881 | 4.635317 |
2324fe4d-7bb5-4f24-a419-a4632c937f75 | HMD-CVA/Code | tac duong/main.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream f1("tacduong.inp");
ofstream f2("tacduong.out");
ll n,m,u,v;
ll x,y,z,p,q,r;
ll a[1000][1000];
ll visit[10000];
void doc()
{
f1>>n>>m;
for(ll i=1;i<=m;i++)
{
f1>>u>>v;
a[u][v]=1;
a[v][u]=1;
}
}
void dfs(... | ALGO | 0.99988 | 4.043617 |
b1df1233-f70f-46cf-9323-069d9b7c417e | squaresLab/BatFix | results/transcoder/translations/java/WILDCARD_CHARACTER_MATCHING.cpp | bool match ( const std :: string & first , const std :: string & second ) {
if ( first . size ( ) == 0 && second . size ( ) == 0 ) return true ;
if ( first . size ( ) > 1 && first [ 0 ] == '*' && second . size ( ) == 0 ) return false ;
if ( ( first . size ( ) > 1 && first [ 0 ] == '?' ) || ( first . size ( ) != 0... | ALGO | 0.997964 | 4.227513 |
c9abb392-ca97-432f-aa0d-503b0f1691c1 | avantol/FT8-GO_Great-Outdoors | boost/libs/program_options/src/parsers.cpp | #include <boost/config.hpp>
#define BOOST_PROGRAM_OPTIONS_SOURCE
#include <boost/program_options/config.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/positional_options.hpp>
#include <boost/program_options/detail/cmdline.hpp>
... | CONFIG | 0.923011 | 7.372321 |
0c3832a2-aa04-4487-9bf3-6877bc48a449 | GitJjy/LeetCode-Critical-Problems | 221_Maximal_Square.cpp | /*
这道题答案处理得特别巧妙,用“前缀”定义子问题。设dp[i][j]为以matrix[i][j]为右下角元素的所有正方形的最大
边长,则有如下递推公式:
dp[i][j] = matrix[i][j] - '0', if i==0 || j==0 || matrix[i][j] == '0'
dp[i][j] = min(min(dp[i][j-1], dp[i-1][j]), dp[i-1][j-1]) + 1, else
同时注意到,每次更新dp[i][j]时最多只用了当前位置的左边、上边和左上角的邻接元素,因此空间上也可以优化为
O(n),此时需注意对左上角元素的保存。代码如下:
*/
int ... | ALGO | 0.999923 | 5.511904 |
ce168973-1bf8-4359-b3b8-f1b8c6a3e9f6 | PtCu/practice | reference/source/bookcodes/ch1/uva11300.cpp | // UVa11300 Spreading The Wealth
// Rujia Liu
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn = 1000000 + 10;
long long A[maxn], C[maxn], tot, M;
int main() {
int n;
while(scanf("%d", &n) == 1) { // ݴscanfcin
tot = 0;
for(int i = 1; i <= n; i++) { scanf("%lld", &A[i]); tot += A[i]... | ALGO | 0.999735 | 3.817744 |
f62c2fa7-551d-4991-a811-387579b5ace0 | yyuan-luo/Parallel-Programming | week-7-homework/sequential_implementation.cpp | #include "dgemm.h"
#include <cstdio>
#include <cstdlib>
void dgemm(float alpha, const float *a, const float *b, float beta, float *c) {
for (int i = 0; i < MATRIX_SIZE; i++) {
for (int j = 0; j < MATRIX_SIZE; j++) {
c[i * MATRIX_SIZE + j] *= beta;
for (int k = 0; k < MATRIX_SIZE; k+... | ALGO | 0.997535 | 4.824602 |
3ea708b6-cc52-4d1d-b0fa-d8ff1c365f92 | ks0727/AtCoder-Archive | PCC/C2/2.5/AOJ_f.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using P = pair<ll,int>;
using T = tuple<ll,int,int>;
struct UnionFind{
int n;
vector<int> par,rank;
UnionFind(int n):n(n),par(n,-1),rank(n,0){
rep(i,n) par[i] = i;
}
int root(int x){
... | ALGO | 0.999843 | 4.356834 |
f8fe328d-956d-45aa-bcc2-8cd404a46650 | AnshKetchum/programming-for-glory | USACO/Training Page/ Chapter 2/Section 2.4/Cow Tours/tours 2.cpp | /*****
ID: INSERT_ID_HERE
LANG: C++
PROG: cowtour
**/
#include <bits/stdc++.h>
using namespace std;
#define INF 100000000.0
#define MAXN 200
typedef pair<int,int> pii;
bool connections[MAXN][MAXN],visited[MAXN];
double distances[MAXN][MAXN],diameters[MAXN],fieldDiams[MAXN];
double ans = INF;
int n,groups[MAXN];
pii po... | ALGO | 0.99979 | 4.364269 |
21e8f9ed-ce53-4c1b-84f1-e3bc854f41cb | HaripriyaGnanasekaran/field | SF_SolvePikar.cpp | #include "SF_SolvePikar.h"
#include <iostream>
SF_SolvePikar::SF_SolvePikar(Boolean compute_,SF_ReactionList* ReactionQ_, SF_MoleculeList* MolQ_, SF_SegmentList* SegQ_, Lattice* Lat_, Input* MyInput_)
: SF_Solve(compute_,ReactionQ_,MolQ_,SegQ_,Lat_,MyInput_) {
use_vector_iterations = false; LM_BFGS=false; pseudo... | ALGO | 0.999815 | 4.08357 |
f899f109-587a-40bf-b780-b298b12912dc | serna37/sandbox | archive20240121/27.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
int main() {
int N;
cin >> N;
auto digitsum = []<class T>(T a, int N = 10) -> T {
T ans = 0;
while (a != 0) {
ans += a % N;
a /= N;
}
return ans;
};
int ans = INF;
fo... | ALGO | 0.999942 | 4.410076 |
de8191b3-13b1-4bea-90b2-7e080fae5cd6 | gbowne1/random_c_cpp_programs | cpp_programs/righttriangle.cpp | // File: righttriangle.cpp
// Author: Gregory K. Bowne
// Date: 20 Oct 2023
// Time: 23:39:08
// Brief: This program calculates the right triangle triganometry and to help determine angles.
// This also useful in a metalworking or machining environment
#include <iostream>
#include <string>
#include <cma... | TOOL | 0.988351 | 4.776447 |
34b85a44-3437-4364-8aab-e99453b43b61 | ImportMengjie/Leetcode | 137.只出现一次的数字-ii.cpp | /*
* @lc app=leetcode.cn id=137 lang=cpp
*
* [137] 只出现一次的数字 II
*
* https://leetcode-cn.com/problems/single-number-ii/description/
*
* algorithms
* Medium (66.20%)
* Likes: 315
* Dislikes: 0
* Total Accepted: 28K
* Total Submissions: 42K
* Testcase Example: '[2,2,3,2]'
*
* 给定一个非空整数数组,除了某个元素只出现一次以外,... | ALGO | 0.999299 | 6.013803 |
543b1464-cb26-4fd8-a3ff-24ded3e92556 | linneszyx/CP-Problems | 1013-fibonacci-number/fibonacci-number.cpp | class Solution {
public:
int fib(int n) {
if(n==0) return 0;
if(n==1) return 1;
return fib(n-1)+fib(n-2);
}
}; | ALGO | 0.999984 | 5.992885 |
e28e1f3d-7106-43f8-9db7-297e725cda43 | zpfbuaa/JobduInCPlusPlus | JobduInCPlusPlus/1120 全排列.cpp | #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cmath>
#define MAX_SIZE 7
using namespace std;
char str[MAX_SIZE];
char ans[MAX_SIZE];
bool used[MAX_SIZE];
int len;
void prem(int x){
if(x == len){
ans[x]='\0';
printf("%s\n",ans);
return;
}
... | ALGO | 0.999966 | 3.386642 |
f3e6477b-1c84-4101-b6f7-06845822cf7a | sahiltambe18/DSA_F | 347-top-k-frequent-elements/top-k-frequent-elements.cpp | class Solution {
struct custom {
bool operator()(const pair<int, int>& a, const pair<int, int>& b) const {
// Compare the first elements of the pairs
// If they are equal, compare the second elements
if (a.first == b.first) {
return a.second < b.second;
}
... | ALGO | 0.999996 | 5.849864 |
14dd5344-bd67-48d6-83a6-61307faf204d | kyejin0412/algorithm | boj/10156_과자.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int price = 0, num = 0, allowance = 0;
cin >> price >> num >> allowance;
if (price * num - allowance <= 0)
{
cout << 0 << "\n";
}
else
{
cout << price * num - allowance << "\n";
}
return 0;
} | ALGO | 0.994485 | 3.346279 |
7146fad2-ff21-4f68-be99-8b6ae5c0c468 | ishandutta2007/codeforces | emthrm/normal/1140/C.cpp | #include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#inc... | ALGO | 0.999975 | 3.916139 |
235f585e-09da-4114-b8aa-f85c7c11a479 | Seidy-u/Atcorder | abc148/e.cpp | #include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
using namespace std;
int main(){
long long n;
cin >> n;
long long ans = 0;
if(n%2==1){
cout << "... | ALGO | 0.999744 | 3.871693 |
c436f818-3981-4057-9f6c-325ade2617e1 | Upasana1216/DSA30 | array_questions/mergeIntervals.cpp |
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
// An Interval
struct Interval
{
int s, e;
};
// Function used in sort
bool mycomp(Interval a, Interval b)
{
return a.s < b.s;
}
void mergeIntervals(Interval arr[], int n)
{
// Sort Intervals in increasing order of
// start time
sort(arr, arr+n,... | ALGO | 0.999787 | 5.639691 |
bdb9ba5b-d795-4e25-a36d-d6bbb7472065 | kroening/fastsynth | src/fastsynth/local_synth_encoding.cpp | #include <fastsynth/local_synth_encoding.h>
#include <util/expr_initializer.h>
#include <util/prefix.h>
#include <util/suffix.h>
#include <algorithm>
#include <iterator>
local_synth_encodingt::local_synth_encodingt(
const namespacet &ns,
const solutiont &solution_template,
const synth_encodingt::constraintst &... | ALGO | 0.999276 | 7.605767 |
a07d6ca0-6d5e-4261-a2c4-6e83a5e17d72 | little-czy/codeup | 6.1/B.cpp | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
int n, k, stu_num, tmp_cou, hash_stu;
string stu_name;
vector<int> course[2505];
map<int, string> stu;
int Hash(const char *name)
{
return (name[0] - 'A' + 10) * 36 * 36 * 36 + (name[1] - 'A' + 10) * ... | ALGO | 0.99951 | 3.473464 |
cb753792-7b76-4e01-a8ed-750588bf4dce | GaurishIIITNR/CP-Problems-Solutions | D_-_Knapsack_1.cpp | // हर हर महादेव
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll> wgt, val;
vector<vector<ll>> dp(101, vector<ll>(100002, -1));
ll f(ll n, ll w)
{
// Base
if (n == -1)
{
if (w >= 0)
{
return 0;
}
return INT_MIN;
}
if (w < 0)... | ALGO | 0.999992 | 4.404849 |
1ca8bdb9-f0ec-4896-b75b-a9fa5669bfad | aadityab7/Practice | 118. Pascal's Triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> ans;
//first row
ans.push_back({1});
for(int i = 2; i <= numRows; i++){
vector<int> temp(i);
//we need elements = i
//first elem... | ALGO | 0.999991 | 6.12689 |
7cf4b47f-fb5e-44c9-bb07-882638708bc6 | xmyqsh/leetcode2016 | maximum-sum-circular-subarray.cpp | class Solution {
public:
int maxSubarraySumCircular(vector<int>& A) {
int minSum = INT_MAX, minHere = 0, total = 0;
int maxSum = INT_MIN, maxHere = 0;
for (auto a : A) {
total += a;
minHere = min(minHere + a, a);
minSum = min(minSum, minHere);
... | ALGO | 0.999831 | 6.058099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.