uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6f053259-64e6-4fdd-a008-e628b877f022 | robinrb7/DSA-cpp | Difficulty: Hard/Phone directory/phone-directory.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:
class TrieNode{
public:
char data;
TrieNode* children[26];
bool isTerminal;
TrieNode(char ch){
data = ch;
for(int... | ALGO | 0.999346 | 5.799372 |
d45a2674-f84a-40b4-8fd4-b3d184399ad2 | ishandutta2007/codeforces | pyqe/normal/160/A.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long long n,i,z=0,m=0;
cin>>n;
long long a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
z+=a[i];
}
sort(a,a+n);
for(i=n-1;i>=0;i--)
{
m+=a[i];
if(m>z/2)
{
break;
}
}
cout<<n-i<<endl;
} | ALGO | 0.999928 | 3.437936 |
aad0f300-8005-438a-bef4-fa4ceed610f4 | thunil/tempoGAN | source/vortexsheet.cpp | #include "vortexsheet.h"
#include "solvana.h"
using namespace std;
namespace Manta {
// *****************************************************************************
// VorticityChannel class members
// *****************************************************************************
// VortexSheet Mesh class members
... | ALGO | 0.866238 | 5.182951 |
a631daee-66b4-413e-9a69-e3d5c1dbdaba | Margaret05/OSA | Sorting/Sort/Sort.cpp | #include "Header.h"
int main()
{
int sizes[] = {100, 1000, 10000, 100000}; // Розмір масиву 100 мільйонів
int* arr = new int;
void (*sort_functions[])(int[], int) = {
insertion_sort, bubble_sort, quick_sort,
merge_sort, count_sort, timsort
};
cout << "\nTable for sorting t... | ALGO | 0.997625 | 5.270785 |
e9f32d75-8175-42ac-b8e4-66536977ea67 | RidhikaJoshi/A2Z_DSA_Sheet | String/Valid_Palindrome.cpp | /*
A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string s, return true if it is a palindrome, or false otherwise.
*/
#include ... | ALGO | 0.994429 | 6.25256 |
4664e909-0edd-472f-9c22-a9ce7d48ae85 | sommerlukas/llvm-offload-jetson | polly/lib/Transform/MaximalStaticExpansion.cpp | #include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
#include "polly/Support/ISLTools.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/InitializePasses.h"
#includ... | ALGO | 0.952585 | 7.833901 |
1045fab0-0c83-40f1-ae41-e1d8c54b0080 | Tamosaitiss/CppObjektinis2 | v0.1/Vektoriu_versija/studentai.cpp | #include "vektoriai.h"
//Pilnai atkurtos funkcijos iš `v0.4`
vector<int> generuotiAtsitiktiniusPazymius(int kiekis) {
vector<int> pazymiai;
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<int> dist(1, 10);
for (int i = 0; i < kiekis; i++) {
pazymiai.push_back(dist(gen));
... | TOOL | 0.969624 | 5.544047 |
91fcc6d0-2c53-4868-b76e-5ec8258bc0a0 | haikalrfli11/Leetcode | 0565-array-nesting/0565-array-nesting.cpp | class Solution {
public:
int arrayNesting(vector<int>& nums) {
int m = nums.size();
vector<int> tree[m+1];
int maks = 0;
for(int i = 0; i < nums.size(); i++) {
vector<int> result;
int res = 0;
int temp = i;
while(tree[temp].empty() ) {
tree[temp].push_back(nums[temp]);
re... | ALGO | 0.999954 | 6.046884 |
dca9d30c-826b-4864-9020-7725f93c4eea | osumi-kyopuro/icpc | acabc119b.cpp | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {
int n;
double sum=0;
cin >> n;
vector<double>x(n);
vector<string>u(n);
for (int i = 0; i < n; i++) {
cin >> x[i];
cin >> u[i];
if (u[i] == "BTC") {
x[i]= 380000 * x[i];
}
sum += ... | ALGO | 0.993232 | 4.440281 |
2fbcd2ad-ad86-4d9c-b8f6-25835badbd88 | rupav/cp | competitive_coding/contests/tags/trees/diameter_dp.cpp | /// find the diameter of a binary tree, given root node
#include<bits/stdc++.h>
using namespace std;
struct Node{
int val;
Node* lc;
Node* rc;
Node(int val): val(val), lc(nullptr), rc(nullptr){}
};
using pii = pair<int, int>;
int dia = 0;
/// returns pair<a, b> a is max distance with root as the star... | ALGO | 0.997932 | 4.392414 |
2560ad67-bace-41d9-865e-61e247f8566f | VenusCh001/bloodSweatTears | recursion_1/array_sum_ele.cpp | #include<iostream>
using namespace std;
int summation(int *arr,int idx,int n){
if(idx==n-1 ){
return arr[idx];
}
return arr[idx]+summation(arr,idx+1,n);
}
int main(){
int arr[]={1,2,3,4,5};
cout<<summation(arr,0,5);
return 0;
}
| ALGO | 0.99975 | 4.501738 |
4155f222-4b89-4900-bd27-b34f75debed5 | DeffreusTheda/Competitive-Programming | TLX/Pemrograman Kompetitif Dasar/02. A. Penjumlahan Pecahan.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 POP pop_back
#define IN(a) insert(a)
#define ER(a) erase(a)
#define CNT(a) count(a)
#define MP make_pair
#define uf uint_fast64_t
#define FOR(i,a,b) for (int... | ALGO | 0.999772 | 3.985664 |
10c50329-2d9c-4629-8638-4e1f5bd77ded | PratikRMarabille/DSA | sum_of_subarray.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int sum=0;
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
sum+=arr[j];
cout<<sum<<endl;
}
}
return 0;
} | ALGO | 0.99992 | 3.130236 |
bf3bc8a1-1462-4053-ac39-a2b2c816acc5 | AbiramiSBN/Blackbox.ai | C++Libs/kidLogic.cpp | // kidLogic.cpp - Uses MITIE
#include <mitie/nlp.h>
#include <iostream>
int main() {
mitie::ner ner("MITIE-models/english/ner_model.dat");
std::string sentence = "MITIE is a C++ NLP library.";
mitie::named_entity_detection::raw_text rawText;
rawText.set_text(sentence);
auto entities = ner.extract_e... | TOOL | 0.906056 | 5.245173 |
c2920b3e-bef1-4345-b134-7fd95e1c5500 | vircle/gossip | src/base58.cpp | #include "base58.h"
#include "bech32.h"
#include "hash.h"
#include "script/script.h"
#include "support/cleanse.h"
#include "uint256.h"
#include "utilstrencodings.h"
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <algorithm>
#include <assert.h>
#include <string.h>
/**... | TOOL | 0.884606 | 7.689929 |
db9e3691-5535-4625-99c3-f4ad9ea31cfd | Silence7/leetcode | cpp/94.二叉树的中序遍历.cpp | /*
* @lc app=leetcode.cn id=94 lang=cpp
*
* [94] 二叉树的中序遍历
*
* https://leetcode.cn/problems/binary-tree-inorder-traversal/description/
*
* algorithms
* Easy (76.10%)
* Likes: 1615
* Dislikes: 0
* Total Accepted: 1M
* Total Submissions: 1.3M
* Testcase Example: '[1,null,2,3]'
*
* 给定一个二叉树的根节点 root ,返... | ALGO | 0.999994 | 7.062521 |
fe5e4a13-5ba5-4187-baa5-406f2f1fcf90 | monpeco/Cpp-Data-Structures | gq02fire.cpp | #include <iostream>
using namespace std;
int main () {
int dog, fire, wood = 0, empty = 9, principally = 218;
int strive[9] = {302, 303, 290, 79, 215, 196, 361, 497, 474};
for ( fire = 0; fire < empty; fire++ ) {
if(strive[fire] < principally){
int dog = strive[wood];
... | ALGO | 0.997894 | 3.007544 |
b134e2ee-e6f1-4a0f-91c0-526552cdcea1 | RohanGodha/code-daily-repo | triplet-sum and zero-sum/triplet-sum-method2-function.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int tripSum(int arr[],int n,int key)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
for(int k=0;k<n;k++)
{
if((arr[i]+arr[j]+arr[k])==key)
{
... | ALGO | 0.999903 | 4.600216 |
8ed631ac-6a8e-4483-92bf-28fa04201376 | hello-world0421/Algorithm-Code-Repository | code_learning/洛谷/刷题/P1091.cpp | #include <bits/stdc++.h>
void solve() {
int n; std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
auto process = [&](std::vector<int>& dp) {
std::vector<int> ends;
for (int i = 0; i < n; i++) {
auto it = std::lower_bound(ends... | ALGO | 0.999952 | 4.383677 |
7546f8c5-5a70-4bb5-96ab-64a7a011b1fa | mozaic-jp/sport-programming | AtCoder/ABC/150/b/main.cpp | #include <iostream>
#include <fstream>
#include <algorithm> // for next_permutation
#include <vector>
#include <queue>
#include <bits/stl_numeric.h>
#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
static const ll MOD ... | ALGO | 0.999869 | 3.979374 |
b5d68c5e-f1e2-4610-92ec-7b3afba68790 | lvvz/ai-labs | lab3/main.cpp | #include <iostream>
#include <vector>
#include "hopfield_NN.h"
#include <iomanip>
#include <time.h>
#include <fstream>
using namespace std;
#pragma pack(push)
#pragma pack(1)
struct bmp_header
{
uint16_t bm;
uint32_t file_size;
uint32_t reserved;
uint32_t data_offset;
uint32_t header_size;
uint32_t width;
uint... | DATA | 0.96435 | 3.792962 |
f64c26b8-ddb0-4c13-a7f1-1631e8a624e7 | iains/LLVM-8-Branch | libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp | // <algorithm>
// template<ForwardIterator Iter>
// requires OutputIterator<Iter, Iter::reference>
// && EqualityComparable<Iter::value_type>
// constexpr Iter // constexpr after C++17
// unique(Iter first, Iter last);
#include <algorithm>
#include <cassert>
#include <memory>
#include "test_macr... | TEST | 0.962802 | 6.748702 |
9e7bdfb8-29ff-47ee-a052-982b780f5803 | KSH-code/Problem-Solving | 2493.cpp | #include <iostream>
#include <queue>
using namespace std;
int main()
{
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
int N; cin >>N;
int arr[N+1];
for (int i=1;i<=N; i++) cin >> arr[i];
priority_queue<pair<int, int>> remains;
arr[0] = 1e9;
int result[N+1];
... | ALGO | 0.999989 | 4.231575 |
ea0b9f43-4c69-4810-b395-5ba3f14735d6 | TechAoba/OJ-code | 洛谷/P1273 有线电视网.cpp | #include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#define res register int
#define Max(a,b) (a>b?a:b)
using namespace std;
const int MAXN = 3005, FINF = -0x3f3f3f3f;
int N, M, earn[MAXN], dp[MAXN][MAXN], num[MAXN]={0};
inline int read() {
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9') {if(c=... | ALGO | 0.999983 | 3.479025 |
6d40b449-eac0-4a2a-b394-eea7c232e604 | Anower77/XPSC | Week-4/Day-1/N.cpp | #include "bits/stdc++.h"
#define ll long long
using namespace std;
const ll N = 1e5+5;
int main()
{
int t; cin>>t;
while(t--)
{
int n; cin>>n;
cout<<n<<" "<<(n-1)<<'\n';
}
return 0;
}
| ALGO | 0.996839 | 4.396297 |
24a4cef0-481f-4b21-9c05-4d4f9169d46f | stcsteven/sodus | Training Ground/Codeforce/Problem Set A/1257A - Rivalling Students.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int tcase;
cin >> tcase;
while(tcase--){
int n,x,a,b;
cin >> n >> x >> a >> b;
int dist = abs(a-b);
if(dist==(n-1)) cout << n-1 << endl;
else cout << dist+x << endl;
}
return 0;
} | ALGO | 0.999384 | 3.808203 |
7e356ceb-5e95-467f-a092-08f68274b31d | vikashmalakar275/Data_Structure_and_Algorithm | prepinsta_100_codes/Sum_of_digits_of_a_number.cpp | /*
Program to Find the Sum of Digits of a Number in C++
Here we will discuss how to find the sum of digits of a number in C++ programming language.
We will use loops along with two arithmetic operators:
1. Modulo Operator : '%'
2. Division Operator: '/'
Eg: number = 12345
Sum of digit of number = 1 + 2 + 3 + 4 + 5
S... | ALGO | 0.999958 | 5.526652 |
89bbd57b-dfe8-422d-8284-80f065feaac1 | munh-orgil/leetcode | 2024/04. apr/(20) 1992. Find All Groups of Farmland.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
Solution() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
vector<vector<int>> findFarmland(vector<vector<int>>& land) {
int n = land.size();
int m = land[0].size();
v... | ALGO | 0.999644 | 4.236331 |
9dda3916-4954-412e-905c-ee4fc065198f | vivekkadamvk/CNLAB | Assignments/ass2.cpp | /*CODE BY VK*/
#include <iostream>
using namespace std;
int main(){
int a[7],b[7];
int d1,d2,d3,d4,c1,c2,c3;
cout<<"*********CODE BY VK*********"<<endl<<endl;
cout<<"Welcome to the Error Detection System using Hamming Code\n"<<endl;
cout<<"Bit count starts from Right to Left as per Binary System\n"<<endl;
cout<<"Ent... | ALGO | 0.999896 | 4.445242 |
c096612b-e4b6-44c1-bd15-8e7431723008 | tangjz/Three-Investigators | 2017-06-03/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define M 1000000007
#define all(a) a.begin(), a.end()
int Test = 2000000;
char s[55];
ll a[50];
ll C[55][55];
int n, k, m;
ll randll(){
ll res = 0;
for(int i = 0; i < 4; +... | ALGO | 0.999534 | 3.510179 |
3c59f636-f1f5-4e85-a98d-41ccba2eb476 | ishandutta2007/codeforces | golovanov399/normal/1275/B.cpp | #include <bits/stdc++.h>
#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define random_shuffle(...) shuffle(__VA_ARGS__, rng)
#define rand() rng()
#ifdef OLBOEB
#define return std::cerr << __FUNCTION__ << "\n"; return
#endif /... | ALGO | 0.999684 | 4.044015 |
ba6c7d1e-fcc1-400c-9abe-d8dfd547d114 | miaosp/frameworks_native | opengl/libagl/matrix.cpp | #include <stdlib.h>
#include <stdio.h>
#include "context.h"
#include "fp.h"
#include "state.h"
#include "matrix.h"
#include "vertex.h"
#include "light.h"
#if defined(__arm__) && defined(__thumb__)
#warning "matrix.cpp should not be compiled in thumb on ARM."
#endif
#define I(_i, _j) ((_j)+ 4*(_i))
namespace android... | TOOL | 0.913504 | 6.352928 |
71ff1127-6dd9-4275-bbf1-69471be5561b | brenimcode/CompetitiveProgramingSolving | matematica_computacional/somaDeTresQuadrados.cpp | #include <bits/stdc++.h>
#define DEBUG(x) cout << #x << " >>>> " << x << endl;
#define _ \
ios_base::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
int main()
{
int m;
cin >> m;
if (m < 0)
{
cout << "NO" << endl;
return 0;
}
if (m == 0)... | ALGO | 0.999972 | 4.693713 |
1340aa5e-352a-4d7f-aa06-59f6df98be00 | hjiang13/LLMs-in-IR | POJ-104/37/1163.cpp | #include <iostream>
using namespace std;
int main() {
int n,i,k,m,t,l,q,p;
char a[100001],c[27];
char zm[]={
'0','a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z'}
;
cin >> "%d",&n);
for(i=0; i<n; i++){
cin >> "%s",a);
int b[27]={
0}
;
t=0;
l=0;
p=0;
for(k=0; a[k]... | ALGO | 0.999867 | 3.251759 |
16345b1c-d0ca-4a02-8a35-af877983df4a | sriharisundar/GPUspectralsolver | eigen/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.998259 | 4.015535 |
8fbec7e2-3e4e-4cb9-9172-647dec67bc35 | michalber/ANC-Headphones-repository- | modules/juce_gui_basics/layout/juce_FlexBox.cpp | namespace juce
{
struct FlexBoxLayoutCalculation
{
using Coord = double;
FlexBoxLayoutCalculation (FlexBox& fb, Coord w, Coord h)
: owner (fb), parentWidth (w), parentHeight (h), numItems (owner.items.size()),
isRowDirection (fb.flexDirection == FlexBox::Direction::row
||... | TOOL | 0.98051 | 7.43171 |
70dd72de-ed04-44ab-b16d-2b6efe484320 | martinmarklund/TNCG015-GI | Global_Illumination/Sphere.cpp | #include "Sphere.h"
bool Sphere::rayIntersection(Ray& ray) {
Direction rayDirection = glm::normalize(ray.getEnd() - ray.getStart());
glm::vec3 L = glm::vec3(ray.getStart() - _center);
float a = glm::dot(rayDirection, rayDirection);
float b = 2.0f * glm::dot(rayDirection, L);
float c = glm::dot(L, L) - (_radius *... | ALGO | 0.965021 | 4.470919 |
f2639ad4-e990-4aaf-9ca1-0c989fce4daa | awishnick/sidescroller | lib/boost_1_49_0/libs/bimap/example/tutorial_range.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is misleading and unsettling, there are no
// po... | TOOL | 0.912165 | 4.419955 |
2f771335-e41b-4ce3-bfc7-0217dd1460f4 | Messi-Q/IR-Fuzz | sFuzz/rlp/main.cpp | /** @file main.cpp
* @author Gav Wood <<EMAIL>>
* @date 2014
* RLP tool.
*/
#include <clocale>
#include <fstream>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <boost/program_options/options_description.hpp>
#include <json_spi... | TOOL | 0.916783 | 5.416508 |
ca6acb67-51d4-449f-bddf-562c7633eebe | HieuGM/DSA_PTIT | DSA02003.cpp | #include<bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int, int>
#define FULL(a) a.begin(), a.end()
#define FOR(i, a, b) for(int i=a; i<=b; ++i)
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define HieuGM signed main
#pragma GCC optimize("Ofast,03,unroll-... | ALGO | 0.999468 | 5.286966 |
eb300bd6-ef98-4a65-a346-1687be23ec66 | TommyWu-fdgkhdkgh/DataStructure_and_Algorithm | graph/finding_cycles/my_undirected_graph.cpp | #include <bits/stdc++.h>
using namespace std;
/*void BFS(vector<int> &g[], vector<bool> &visited, int index) {
}*/
bool isCyclic(vector<int> g[], int V) {
vector<bool> visited = vector<bool>(V, false);
vector<int> parents = vector<int>(V, -1);
queue<int> q;
for(int i = 0;i < V;i++) {
if(visited[i] == ... | ALGO | 0.999915 | 4.772136 |
15f6aca1-c1b6-4271-83a8-56f9533ed400 | kzoacn/ICPC | Template/平面最近点对.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
typedef long long LL;
int n;
int a[maxn];
LL sum[maxn];
struct P{
LL x,y;
P(LL x=0,LL y=0):x(x),y(y){}
}p[maxn];
LL sqr(LL x){return x*x;}
bool byY(P a,P b){return a.y<b.y;}
LL dis2(P a,P b){return sqr(a.x-b.x)+sqr(a.y-b.y);}
LL solve(int l,int r){
L... | ALGO | 0.999455 | 3.40203 |
5806f755-b65c-42cf-a418-deed3463391e | rathour08/Array-questions-solution | Sort an array of 0s, 1s and 2s - GFG/sort-an-array-of-0s-1s-and-2s.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
void sort012(int arr[], int n)
{
int nextzero=0;
int nexttwo=n-1;
int i=0;
while(i<=nexttwo){
if(arr[i]==0){
swap(arr[nextzero],arr[... | ALGO | 0.999726 | 6.245154 |
20ba823f-9f84-4b41-b7ee-6a03fa5a5bbf | sidjha57/Coding | Characteristic_Polynomial_Verification.cpp | //template
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<strin... | ALGO | 0.999832 | 4.73223 |
6d18d87d-bc1e-4b53-8ef9-c5a6fd18687c | hieupm123/again | code/C++/CSES-Solutions/Additional Problems/Network Breakdown (1677)/catkl.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct UF {
vi e;
UF(int n) : e(n, -1) {}
... | ALGO | 0.999979 | 3.764671 |
d57d9d3c-9dff-46ef-b2bf-12a645d18567 | sarthaknarain2x/DSA-Practice | Beginner's SDE Sheet/introduction to linked list.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
// Default constructor
Node()
{
data = 0;
next = NULL;
}
// Parameterised Constructor
Node(int data)
{
this->dat... | ALGO | 0.999602 | 6.362232 |
576b9ad0-2b2e-4ba4-9a09-264e25febf2c | josepaul02/DSA | Heaps/klargestheap.cpp | /*
Question:
Given an integer array nums and an integer k, return the kth largest element in the array.
Note that it is the kth largest element in the sorted order, not the kth distinct element.
Can you solve it without sorting?
Example 1:
Input: nums = [3,2,1,5,6,4], k = 2
Output: 5
Approach:
Using max heap.
The ... | ALGO | 0.999996 | 5.989785 |
0eabb762-9d46-4cad-9716-b3148f2b8d0e | missyoubae/Data-Structures-and-Algorithms | lab 2/insert a new node at the end of a Singly Linked example 2.cpp | // Write a C++ program to insert a new node at the end of a Singly Linked
// List [Consider all edge cases].
#include <iostream>
#include <conio.h>
using namespace std;
struct node{
int data;
node *next;
node(int x){
data = x;
next = NULL;
}
};
void insert_at_end(node **head, int n){... | ALGO | 0.992272 | 5.076964 |
a7faf739-7919-43f1-b0d6-527629533369 | Kartik-Mathur/CPP-28OctBatch | L5-CPPArrays/SwitchCase.cpp | #include <iostream>
using namespace std;
int main() {
char ch;
cin >> ch;
switch (ch) {
case 'N':
case 'n':
cout << "North\n";
break;
case 'E':
case 'e':
cout << "East\n";
break;
case 'W':
case 'w':
cout << "West\n";
break;
case 'S':
case 's':
cout << "South\n";
break;
default:
cout << "... | ALGO | 0.993427 | 3.820457 |
72f9a3c6-457e-4abc-87ed-0f0d32382bdb | noisrucer/Algorithm | Array/#1002. Find Common Characters.cpp | class Solution {
public:
vector<string> commonChars(vector<string>& A) {
vector<int>cnt(26,INT_MAX);
for(auto i:A){
vector<int>temp(26,0);
for(auto sub: i) temp[sub-'a']++;
for(int i=0; i<26; i++) cnt[i]=min(cnt[i],temp[i]);
}
vector<string>res;
... | ALGO | 0.999953 | 5.790817 |
be971b30-66a8-466e-8622-b9689c3af9cd | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1195_4.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long m, h1, h2, a1, a2, x1, x2, y1, y2;
cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2;
bool ok = 0;
long long t1 = 0;
long long p1 = 0;
long long t2 = 0;
long long p2 = 0;
for (int i = 0; i < 1000000; i++) {
h1 *= x1;
h1 ... | ALGO | 0.999909 | 3.534363 |
056af5de-80ef-4636-8090-39f87f86af10 | fyzel527/UnrealEngine-4.24Toon | Engine/Source/ThirdParty/ICU/icu4c-64_1/source/test/intltest/punyref.cpp | /**********************************************************/
/* Implementation (would normally go in its own .c file): */
#include <string.h>
#include "unicode/utypes.h"
#if !UCONFIG_NO_IDNA
#include "punyref.h"
/*** Bootstring parameters for Punycode ***/
enum { base = 36, tmin = 1, tmax = 26, skew = 38, damp = ... | TOOL | 0.989055 | 6.852651 |
9eb14ed1-dd20-4500-970e-acdb21afb0d1 | t0whid/Solved-Problem | Codeforces/148A. Insomnia cure.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int k, l, m, n, d, sum=0;
cin>>k>>l>>m>>n>>d;
set<int>s;
while(1)
{
sum+=k;
if(sum>d) break;
s.insert(sum);
}
sum=0;
while(1)
{
sum+=l;
if(sum>d) break;
s.insert(sum);
}
sum=0;
while(1)
{
sum+=m;
if(sum>d) break;
s.insert(sum);... | ALGO | 0.99969 | 3.138294 |
d64c5ed2-1a8e-4d4b-b2a9-972cee6359ea | Bossppp/Comprog | Expression_strEz/01_Expr_21.cpp | #include <iostream>
using namespace std;
int main() {
int h1,m1,s1,h2,m2,s2;
cin >> h1 >> m1 >> s1;
cin >> h2 >> m2 >> s2;
int t1 = h1*3600 + m1*60 + s1; //ให้ทุกอย่างอยู่ในหน่วย second
int t2 = h2*3600 + m2*60 + s2;
int ds,dm,dh;
ds = (t2 - t1+24*3600)%24*3600; //ผลออกมายังอยู่ในหน่วย sec... | ALGO | 0.999603 | 3.803781 |
b5c26f23-e6bb-4544-9d38-121a63db7b6f | akashrwt8/DSA_IN_CPP | BASICS/EvenOdd.cpp | #include <iostream>
#include <stdbool.h>
using namespace std;
bool isEvenOdd(int n) {
if (n & 1) {
return false;
}
return true;
}
bool isEven(int n) {
if ((n ^ 1) == (n - 1)) {
return false;
}
if ((n ^ 1) == (n + 1))
{
return true;
}
}
int main() {
int n;
... | ALGO | 0.999762 | 4.777946 |
f2c4c548-9b3e-46ea-81f1-4a49868f8810 | alvinnardo/licode | leetcode/650.cpp | #include "../template/head.h"
#include <bits/stdc++.h>
int minSteps(int n) {
// 题解:DP,从质因数转移过来
// 时间 O(n√n),空间 O(n)
vector<int> dp(n + 1);
for (int i = 2; i <= n; i++) {
dp[i] = INT_MAX;
// 对所有因子进行遍历
for (int j = 1; j * j <= i; j++) {
if (i % j == 0) {
... | ALGO | 0.999976 | 4.801636 |
d6cb2a9a-a8ad-41b9-8d17-7ca9517167ac | keshavop/leetcode | old/1-two-sum/1-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> ans;
unordered_map<int, int> a;
for (int i = 0; i < nums.size(); i++)
{
if (a.find(target - nums[i]) != a.end())
{
ans.push_back(a[target - nums[i]]);
... | ALGO | 0.999852 | 6.347078 |
b4bebfe1-084e-4bf9-9d5e-f69c38a73e74 | SarbajitPbappy/CF2 | 1794A-PrefixAndSuffixArray.cpp | #include <iostream>
#include <algorithm>
int main(){
std::ios_base::sync_with_stdio(false);
long t; std::cin >> t;
while(t--){
long n; std::cin >> n;
std::string x(""), y("");
for(long p = 0; p < 2 * n - 2; p++){
std::string cur; std::cin >> cur;
if(cur.size... | ALGO | 0.999517 | 4.025033 |
8de67d97-7659-4225-ac2f-0467b037858a | rishabg30/Data-Structures-and-Algorithms | trees_problems/binary_search_trees_problems/finding_common_nodes_in_two_bst.cpp | #include <bits/stdc++.h>
using namespace std;
void printArray_1D(vector<int> &arr)
{
for (auto it : arr)
{
cout << it << " ";
}
cout << endl;
}
class TreeNode
{
public:
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int val)
{
this->val = val;
left = right... | ALGO | 0.999961 | 4.561736 |
10fb376b-0fe4-4242-bd66-2b319332a0fe | Josephzcy/my_compile_platform | third_party/opencv-src-4.1.0/3rdparty/carotene/src/add_weighted.cpp | #include "common.hpp"
#include "vtransform.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
using namespace internal;
template <typename T> struct TypeTraits;
template <> struct TypeTraits< u8> { typedef u16 wide; typedef u8 unsign; typedef uint8x16_t vec128; };
template <> struc... | TOOL | 0.968424 | 6.62867 |
54e6a827-2607-4fcc-8029-f06688451fb2 | vivian-hong/bst | pretty_print.cpp | /* Pretty Printing for a Node
* Code in this file was borrowed from leetcode.com:
* http://leetcode.com/2010/09/how-to-pretty-print-binary-tree.html
* Thanks to http://leetcode.com/members/admin/ for the code!
* (please ignore formatting and line lengths)
*/
#include <fstream>
#include <iostream>
#include <deque>... | ALGO | 0.893476 | 6.107955 |
531be1ef-150f-41cb-aac8-daea3b49d77d | nikolanan/CppBasics | isTherePrimeNumber/isTherePrimeNumber.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isPrime(const vector<int>& arr,const int & n) {
for (int i = 0; i < n; i++) {
if (arr[i] < 2) {
}
else if (arr[i] == 3 || arr[i] == 2) {
return true;
}
else {
bool statement ... | ALGO | 0.999334 | 4.808266 |
26df0db8-af12-4aa4-aac6-414649079504 | blackbox47/UVA-Problem-Solution-Using-C-or-C-Plus-Plus | 12015 - Google is Feeling Lucky1.cpp | #include<stdio.h>
#include<algorithm>
#include<string>
#include<string.h>
#include<iostream>
using namespace std;
int cp(void const *p,void const *q);
typedef struct
{
string name;
int value;
}data;
data websites[15],temp[15];
int main(void)
{
int i,j,var,tem,test,qq;
scanf("%d", &test);
for(qq=... | ALGO | 0.99946 | 3.274521 |
0d861637-e652-47b9-9185-7c19fb94480f | keshav-1303/CP_to_study | Persistent Segment Tree 1.cpp | // Calculate how many distinct values are there in a given range
// Persistent Segment Tree implementation
// Actually used in Codeforces - The Bakery
int n, k, a[MAX], last[MAX], nxt[MAX];
int idx=1;
int Tree[64*MAX], L[64*MAX], R[64*MAX], root[2*MAX], rt[MAX];
int pos[MAX];
void build(int node, int l, int r)
{
if(... | ALGO | 0.99992 | 3.504081 |
7783e613-2a65-4e81-8e3a-b3d4d51bf69a | CatalinFrancu/nerdvana | problems/cses/1672-shortest-routes-ii/floyd-warshall.cpp | // Floyd-Warshall algorithm. Pay attention to multiple edges.
#include <stdio.h>
const int MAX_NODES = 500;
const long long INFINITY = 1'000'000'000'000LL;
long long d[MAX_NODES + 1][MAX_NODES + 1];
int n, num_queries;
void init_distances() {
for (int u = 1; u <= n; u++) {
for (int v = 1; v <= n; v++) {
... | ALGO | 0.999529 | 5.167166 |
e40963d5-1dee-4c2b-8156-efbf1db2254f | microcai/boost | libs/math/src/tr1/cyl_bessel_jl.cpp | extern "C" long double BOOST_MATH_TR1_DECL boost_cyl_bessel_jl BOOST_PREVENT_MACRO_SUBSTITUTION(long double nu, long double x) BOOST_MATH_C99_THROW_SPEC
{
return c_policies::cyl_bessel_j BOOST_PREVENT_MACRO_SUBSTITUTION(nu, x);
}
| TOOL | 0.975274 | 3.014922 |
eb454835-920d-4d5c-a5fe-259d11e9821d | futurewei-cloud/chogori-opengauss | src/gausskernel/storage/mot/jit_exec/jit_tvm_blocks.cpp | /*
* ATTENTION: Be sure to include jit_tvm_query.h before anything else because of libintl.h
* (jit_tvm_blocks.h includes jit_tvm_query.h before anything else).
* See jit_tvm_query.h for more details.
*/
#include "jit_tvm_blocks.h"
#include "jit_tvm_funcs.h"
#include "jit_tvm_util.h"
#include "jit_util.h"
#include ... | TOOL | 0.903761 | 6.801795 |
a34880f8-adc4-479c-abdd-80278df154e6 | 256bitguy/DSA_practice | assignment6/q10.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int sum=0,i=-1,ni=n;
while(ni%10){
ni/=10;
i++;
}
while(n%10){
sum+=(pow(10,i)*(n%10));
n=n/10;
i--;
}
cout<<sum<<"\n";
return 0;
} | ALGO | 0.999875 | 3.834049 |
309d06a4-27a8-450f-8c1c-6ab014b1ced5 | zhushaoben/training | 2020-2021第一学期训练/Codeforces Round #669/C. Chocolate Bunny.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e4+5;
int p[N];
int main(){
int n,pre=1,a,b;scanf("%d",&n);
for(int i=2;i<=n;i++){
printf("? %d %d\n",pre,i),fflush(stdout);
scanf("%d",&a);
printf("? %d %d\n",i,pre),fflush(stdout);
scanf("%d",&b);
if(a>b)p[pre]=a,pre=i;
else p[i]=b;
}
p[pre]=n;... | ALGO | 0.999972 | 3.207232 |
bc6b7984-3a8e-4374-84f5-dd19628b51ec | vishalchovatiya/PI | LINKED LIST/Merge 2 Sorted Doubly LL.cpp | #include <iostream>
#include <string.h>
#include <list>
#include <map>
#include <stack>
#include <set>
#include <queue>
using namespace std;
/*
# Algo :-
- Handle Corner cases and Prev link of every nodes
# Time Complexity:- O(NLog N)
*/
class List
{
class Node
{
public:
int data;
Node *Pre... | ALGO | 0.999953 | 5.074502 |
ca8ffc10-8365-4068-b7e1-ca052f3c1afa | Davshiv20/SEM-5 | SEM 5/Computer Networks/da3.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void hamming(int sender[],int receiver[],int n)//hamming code
{
int paritybitS1 = sender[0] xor sender[1] xor sender[3] xor sender[4] xor sender[6];
int paritybitS2 = sender[0] xor sender[2] xor sender[3] xor sender[5] xor sender[6];
... | ALGO | 0.999929 | 4.251112 |
414df4a6-fa6e-40f7-9be5-56cb2ce747ee | glerium/acm-life | codeforces/1954-div-2/B.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define rep(i,x,y) for(int i=x;i<=y;i++)
using namespace std;
typedef long long ll;
constexpr int maxn = 2e5+10;
constexpr ll mod = 998244353;
void solve() {
int n; cin>>n;
int a[n+5]; rep(i,1,n) cin>>a[i];
auto allsame = [&]() {
rep(i,2,n) if(a[i] != a[1])... | ALGO | 0.999462 | 4.992431 |
c548f8c1-b0fc-454a-a2ec-bfc0548fd0ad | yuruhi/library | Geometry/Geometric.cpp | #pragma once
#include "./Vec2.hpp"
#include "./Line.hpp"
#include "./Circle.hpp"
#include "./Rect.hpp"
#include "./Triangle.hpp"
#include "./Polygon.hpp"
#include "./Geometric.hpp"
#include <vector>
#include <optional>
#include <algorithm>
#include <cmath>
namespace Geometric {
constexpr int sgn(LD a) {
return a <... | ALGO | 0.998893 | 6.047078 |
37df47c1-697e-44a5-83ca-018f06abc303 | chidvi123/GFG-POTD | 2025/June/26_GameWithString.cpp | // ? Problem: Game With String
// ?? https://www.geeksforgeeks.org/problems/game-with-string/0
// ?? Date: 26-June-2025
// ?? Approach 1: Using heaps // TIME VOMPLEXITY O(26*26) // WORKS FINE FOR K IS LARGE
// ?? Approach 2: NO HEAP JUST USING ARRAYS //TIME COMPLEXITY =O(26*K) // IF K IS LARGER IT MAY TAKE MORE TIME
... | ALGO | 0.999976 | 5.843674 |
5f9f1c4b-045c-445c-9e0b-fb81f2f71537 | CLDP/ACM-ICPC | Regional-2012/Europe-Northwestern-Subregional-BAPC/J.cpp | #include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
long long f[55];
int main() {
int n, t;
cin >> t;
while (t--) {
cin >> n;
vector<int> v(n);
vector<i... | ALGO | 0.999873 | 3.950722 |
1fe09839-5125-4d7d-a585-271608bfd754 | gauravkumar1999/CS141-1 | lab4_q5.cpp | //load the lib
#include<iostream>
using namespace std;
//start the main fn
int main(){
//displaying the operation
cout <<endl<<"The triangle ABC contains angles 'a', 'b', and 'c' respectively. Define 'a' and 'b' to get the third angle 'c'."<<endl;
//defining 'a' and 'b'
float... | TOOL | 0.966522 | 3.452649 |
ca04eabd-60bf-4374-b3b9-62da0afce2f2 | ishandutta2007/codeforces | krk/normal/1401/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Maxn = 300000;
const int Maxm = 2097152;
int n, q;
int a[Maxn];
int lst[Maxm];
ll sum[Maxm];
int L[Maxm], R[Maxm];
vector <int> s[20];
void Union(int v)
{
sum[v] = sum[L[v]] + sum[R[v]];
}
void Down(int v, int lvl)
{
if (s[lvl].e... | ALGO | 0.999864 | 3.952876 |
9d502ece-8a59-4cd1-ac27-bdb1dd8341cc | GeeKY03/cppcodesolutions | gfdhgfd.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long int> vlli;
#define pb push_back
#define endl '\n'
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define FastIO ios_base::sync_with_stdio... | ALGO | 0.999992 | 5.174104 |
829f32e1-1139-404c-bc7c-05cfcaa11c33 | RobbiAdiansyah/tugas_praktikum_c | pertemuan ke 7/tugas 2 p7.cpp | #include <stdio.h>
int main() {
// Deklarasi array
int A[11];
int count = 0; // Counter untuk menghitung jumlah nilai genap yang disimpan
// Data dari dokumen
int data[] = {12, 15, 7, 10, 5, 2, 17, 25, 9, 20, 25};
// Menyimpan nilai genap ke dalam array A
for (int i = 0; i < 11; i++) {
... | ALGO | 0.998482 | 5.4294 |
1492643c-3536-421c-957a-8ff5c00f5f82 | LqhResearch/Basic-Programming-And-Algorithms | Chapter 03/Bai3_100.cpp | #include<stdio.h>
/*
Tim day con toan duong dai nhat
*/
//Xuat mang so nguyen
void OutArray(int arr[], int n) {
printf("\n===Xuat mang===\n");
for(int i=0; i<n; i++)
printf("%5d", arr[i]);
}
//Nhap mang so nguyen
void InpArray(int arr[], int &n) {
do{
printf("Nhap so phan tu = ");
scanf("%d", &n);
if(n<=... | ALGO | 0.999864 | 3.713867 |
cadaf3a9-a1b3-4e6c-9ab6-ee31be95eab4 | jsethi7133/Mathematics-using-Programming | matrix_a.cpp | //matrix addition and subtraction
#include<iostream.h>
void main()
{
int a[3][3],b[3][3];
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
cin>>a[i][j];
for(int i1=0;i1<3;i1++)
for(int j1=0;j1<3;j1++)
cin>>b[i1][j1];
for(int i2=0;i2<3;i2++)
for(int j2=0;j2<3;j2++)
cout<<(a[i2][j2]+b[i2][j2])<<endl;
for(int i3=0;i3... | ALGO | 0.99963 | 3.626339 |
8827726b-3826-4755-9bd3-5c1001a3a6dd | orihehe/BOJ | _etc/15135번_Equal Numbers.cpp | /*
BOJ 15135 - Equal Numbers
https://www.acmicpc.net/problem/15135
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <unordered_set>
using namespace std;
/* 🐣🐥 */
bool be[1000001];
int use[1000001];
vector<int> besu, arr;
int ans[1000001];
int main() {
int n, x;
scanf("%d", &n... | ALGO | 0.999976 | 3.731808 |
45b8ab70-79be-4b02-b4ca-ef1cde529d29 | turingcompl33t/cpp-playground | algorithm/non-modifying-sequence/count.cpp | // count.cpp
//
// Demo of std::count(), std::count_if()
//
// Build
// cl /EHsc /nologo /std:c++17 /W4 /I %CPP_WORKSPACE%\_Deps\Catch2 count.cpp
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include <deque>
#include <numeric>
#include <algorithm>
struct SomeType
{
int m_a;
int m_b;
SomeType(int a, in... | TEST | 0.934527 | 6.992402 |
f983e3be-1aa5-46c6-b92e-ea521197f7df | hiro1729/yukicoder | 00/0056/0056.cpp | #include <iostream>
using namespace std;
int main() {
int d, p;
cin >> d >> p;
cout << d * (100 + p) / 100 << '\n';
} | ALGO | 0.988238 | 3.26443 |
1374c1a3-6dbd-44b9-a75f-1c1e49470b67 | samyragiovana/AED1 | Lista II, pilha/5.cpp | #include <iostream>
#include <windows.h>
#include <stack>
using namespace std;
/*5- Implemente uma função chamada TPilha, que receba um vetor de inteiros com 15 elementos.
Para cada um deles, faça o que se pede:
• se o número for par, insira-o na pilha;
• se o número lido for ímpar, retire um número da pilha;
• Ao fin... | ALGO | 0.962749 | 4.609364 |
7a03d714-ef0f-49ca-a57b-1d954f5929e7 | cxlove/ACM_ICPC | Online_judge/HDU/hdoj_3094_2.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#define N 10005
#define LL long long
#define inf 1<<29
#define eps 1e-7
using namespace std;
vector<int>v[100005];
int sg[100005];
int get_sg(int u,int pre){
//if(sg[u]!=-1)
// return sg[u];
... | ALGO | 0.999941 | 4.144535 |
0903d04b-93ed-4078-a6e0-292182f83471 | tingfengluoyu/2024xdoj | oj692.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int A = 0;
int B = 0;
int a3 = 0;
int a4 = 0;
int a5 = 0;
int max = 0;
scanf("%d %d", &A, &B);
if (A < B) {
for (int i = A; i <= B; i++) {
if (i % 3 == 0) {
a3 += 1;
}
if (i % 4 == 0) {
a4 += 1;
}
if (i % 5 == 0 && i % 2 !... | ALGO | 0.999957 | 3.068513 |
f3706d45-5d3f-47b1-b112-6642ad76939b | dpvasani/30-Days-Of-DSA | Day 11/Quick Sort.cpp | class Solution
{
public:
//Function to sort an array using quick sort algorithm.
void quickSort(int arr[], int start, int end)
{
if(start>=end){
return;
}
int pivot = end;
int i = start -1;
int j = start;
while(j<pivot){
if(arr[j]<... | ALGO | 0.999969 | 5.791286 |
a6d62d1b-e4c4-4b63-886e-3e61058b9e03 | sanjosh/smallprogs | basic/misc/hacker_rank/hackerrank/angry_children.cpp |
/*
https://www.hackerrank.com/challenges/angry-children-2
*/
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cassert>
using namespace std;
std::priority_queue<long> q; // largest at top
void solve(long arr[], int N, int K) {
std::sort(arr, a... | ALGO | 0.999908 | 3.786265 |
233eed04-83b4-4f68-9251-7758da9f7142 | Been98/Study | Study/baekjoon/bj_123더하기3_.cpp | #include <iostream>
#define MOD 1000000009
#define MAX_N 1000000
using namespace std;
int N, T;
long long dp[MAX_N + 1];
int main()
{
dp[0] = 1;
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
dp[4] = 7;
for(int i =5; i <= MAX_N; i++){
dp[i] = (dp[i-1] + dp[i-2] + dp[i-3]) % MOD;
}
cin >> ... | ALGO | 0.999977 | 4.506149 |
abd25cdf-2e9e-4520-9233-faf7ce45b625 | Randowlh/Project_ACM_2021 | code/competition/pta_3.15/1.cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
#define bug puts("here\n")
typedef long long ll;
void work()
{
ll n;
cin >> n;
int tmp;
vector<int> v;
ll cnt = 0;
for (int i = 0; i < n; i++)
{
cin >> tmp;
if (tmp < 0)
cnt++;
v.pus... | ALGO | 0.999941 | 4.242005 |
88904788-53f2-4349-be09-64d2b9ba060a | Dfkuaid/My_Files | cpp/Practice/AtCoder/abc226/d.cpp | #define LOCAL
#include <bits/stdc++.h>
#define ll long long
#define mp(a, b) make_pair(a, b)
using namespace std;
const int N = 100010;
const int INF = 0x3fffffff;
template <typename T> inline void read(T &x) {
x = 0; int f = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
... | ALGO | 0.999876 | 4.543112 |
353902ec-6002-4fb0-8072-8d5e1f10744c | LoopholesInTheHeart/C-language-program-design-advanced-course-problem | C10-1.cpp | /*
单词计数
题目描述
编写一个程序,从键盘输入一个个单词,每接收到一个单词后,
输出该单词曾经出现过的次数,接收到“QUIT”单词后程序直接退出。
建议使用multiset或者map来解决该问题
输入描述
一行一个单词,"QUIT"结束
输出描述
每行输出为相应单词统计结果
样例输入
c++
map
set
map
vector
set
multiset
c++
QUIT
样例输出
0
0
0
1
0
1
0
1
*/
#include <iostream>
#include <string>
#include <map>
#include <utility>
#include <algorithm>
using n... | ALGO | 0.992699 | 4.251291 |
ac4881db-5ffc-48fb-9f76-370aeac92174 | Amylo-jh/baekjoon | 5000s/5622.cpp | #include <iostream>
#include <string>
using namespace std;
int char_decision(char ch1)
{
switch (ch1)
{
case 'A':
case 'B':
case 'C':
return 2;
case 'D':
case 'E':
case 'F':
return 3;
case 'G':
case 'H':
case 'I':
return 4;
case 'J':
case 'K'... | ALGO | 0.999307 | 3.614345 |
857ec351-d3a2-452d-bb4b-fbcd509cd404 | ReadnThink/algorithm | cpp/비트마스킹/집합_map.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
using namespace std;
int N,num;
string s;
map<int,int> mp;
void input(){
cin >> N;
for(int i = 0; i < N; i++){
cin >> s;
if(s != "all" && s != "empty"){
cin >> num;
}
if(s == "add"){
// c... | ALGO | 0.970822 | 4.504491 |
f03270bc-dc10-41cb-9133-0a732fe5c699 | deepakasu67/leetcode | weekley Contest/Feb-19-2022/6013. Merge Nodes in Between Zeros.cpp | //
// Created by Deepak Sahu on 2/19/22.
//
#include <iostream>
#include "LinkedList.h"
using namespace std;
class Solution {
public:
ListNode* mergeNodes(ListNode* head)
{
if(head == nullptr || head->next == nullptr)
return nullptr;
ListNode* tmpNode = head->next;
int sum =... | ALGO | 0.999508 | 4.73262 |
e0f979aa-ac54-48d9-8231-6ab9397c299b | ishandutta2007/codeforces | ynsm/normal/1110/D.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const int N = (int)1e6 + 123, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;
int n, m, cnt[N], dp[3][3][... | ALGO | 0.999957 | 3.654774 |
57ef3f7e-e655-4ac7-aff9-8258c2d4d373 | odetv/KULIAH | SEMESTER-1/ALGORITMA DAN PEMROGRAMAN/TUGAS 9/Tugas9_2115101014_I Gede Gelgel Abdiutama_CPP File/Permasalahan Tugas Ke-9.cpp | #include <cstdio>
int matrikA[4][4];
int matrikB[4][4];
int matrikC[4][4];
int jmlbaris, jmlkolom;
int main()
{
printf("PROGRAM PENJUMLAHAN MATRIK\n\n\n");
printf("Masukkan Ukuran Kolom Matrik: ");
scanf("%i", &jmlkolom);
printf("Masukkan Ukuran Baris Matrik: ");
scanf("%i", &jmlbaris);
printf("\nINPUT MATRIK... | ALGO | 0.996262 | 3.923954 |
e4291b1a-88db-42c4-9b34-0014b831135e | mstrthealias/AGPred | src/util.cpp | #include "util.h"
#include <set>
#include <tuple>
#include <xtensor/xindex_view.hpp>
#include <xtensor/xview.hpp>
#include <xtensor/xmanipulation.hpp>
#include <xtensor/xio.hpp>
const std::set<std::tuple<const int, const int, const int>> HOLIDAYS = {
std::make_tuple<>(2021, 1, 1),
std::make_tuple<>(2021, 1, 18),
s... | TOOL | 0.968294 | 6.219959 |
1a1a8d52-4406-4294-b8ad-f2c7784b88d1 | ishandutta2007/codeforces | adamant/normal/737/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define double long double
const int inf = 2e12 + 42;
signed main() {
//freopen("input.txt", "r", stdin);
ios::sync_with_stdio(0);
cin.tie(0);
int n, k, s, t;
cin >> n >> k >> s >> t;
int c[n], v[n];
for(int i = 0; i < n; ... | ALGO | 0.999965 | 3.633606 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.