uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
90cd34be-c8f6-4525-883a-f0f1839e1ddb | chhluo/PAT | 1154 Vertex Coloring.cpp | #include <iostream>
#include <set>
#include <vector>
using namespace std;
#define MAXN 10010
int N,M,K,color[MAXN];
vector <int> G[MAXN];
int judge(int color[]) {
set <int> st;
for(int i = 0; i < N; i ++) {
st.insert(color[i]);
for(unsigned int j = 0; j < G[i].size(); j ++)
if(color[i] == color[G[i][j]])
r... | ALGO | 0.999874 | 4.54194 |
84caf476-50b4-4980-8849-dcbed1844972 | Anurag-Mishra2006/DSA-in-cpp | sliding_Window_and_two_Pointer/PROBLEMs/firstNegativeOptimise.cpp | // First negative number in every window of size of k
// arr [] = {2,-3,4,4,-7,-1,4,-2,6} k = 3;
// ans = {-3,-3,-7,-7,-1, 2} --> n-k+1
// Optimise way
// sliding window
#include <bits/stdc++.h>
using namespace std;
int main() {
int i ;
vector<int>arr = {2,3,4,4,-7,-1,4,-2,6};
vector<int>ans;
int k ... | ALGO | 0.999927 | 4.108589 |
aac35129-29ec-4264-99be-0ea8bfc490d5 | ritikporwal710/LeetCode-Solutions | 0451-sort-characters-by-frequency/0451-sort-characters-by-frequency.cpp | class Solution {
public:
string frequencySort(string s) {
int n = s.size(),i=0;
unordered_map<char,int> mp;
for(auto x: s){
mp[x]++;
}
vector<pair<int,char>> v;
for(auto x: mp){
v.push_back({x.second, x.first});
}
sort(v.begin(... | ALGO | 0.999978 | 6.040454 |
ef95bed4-85d3-4596-af49-6d51ee8513c6 | lining1111/hyperlpr | Prj-iOS/lpr/lpr/Source/src/Pipeline.cpp | //
// Created by 庾金科 on 23/10/2017.
//
#include "Pipeline.h"
namespace pr {
std::string str_code[]={"京", "沪", "津", "渝", "冀", "晋", "蒙", "辽", "吉", "黑", "苏", "浙", "皖", "闽", "赣", "鲁", "豫", "鄂", "湘", "粤", "桂", "琼", "川", "贵", "云", "藏", "陕", "甘", "青", "宁", "新", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B"... | DATA | 0.954937 | 3.865452 |
d8272bf8-6979-4626-ac90-aab49276ffc6 | CuongDo203/DSA | duyetCay1.cpp | #include <bits/stdc++.h>
using namespace std;
int search(int in[], int x, int n){
for(int i = 0; i < n; i++){
if(in[i] == x) return i;
}
return -1;
}
void postOrder(int in[], int pre[], int n){
int root = search(in, pre[0], n);
if(root != 0) postOrder(in, pre+1, root);
if(root != n-1) postOrder(in + root + 1,... | ALGO | 0.999974 | 3.912386 |
0187ba72-d52e-4cbf-8c4e-ddcb4eb48df7 | yeeking/ai-enhanced-audio-book | src/JUCE/modules/juce_graphics/geometry/juce_PathStrokeType.cpp | namespace juce
{
PathStrokeType::PathStrokeType (float strokeThickness) noexcept
: thickness (strokeThickness), jointStyle (mitered), endStyle (butt)
{
}
PathStrokeType::PathStrokeType (float strokeThickness, JointStyle joint, EndCapStyle end) noexcept
: thickness (strokeThickness), jointStyle (joint), endSty... | TOOL | 0.860211 | 7.163887 |
73347f32-8893-4a43-a08b-494c9e62ece1 | jfcarocota/green-engine | src/dynamics/b2_pulley_joint.cpp | #include "box2d/b2_body.h"
#include "box2d/b2_pulley_joint.h"
#include "box2d/b2_time_step.h"
// Pulley:
// length1 = norm(p1 - s1)
// length2 = norm(p2 - s2)
// C0 = (length1 + ratio * length2)_initial
// C = C0 - (length1 + ratio * length2)
// u1 = (p1 - s1) / norm(p1 - s1)
// u2 = (p2 - s2) / norm(p2 - s2)
// Cdot ... | ALGO | 0.994969 | 7.162111 |
4ac853c5-8feb-4ff7-97b1-a960c8b876a2 | vandanavcode/Solidity | libevmasm/PathGasMeter.cpp | /** @file PathGasMeter.cpp
* @author Christian <<EMAIL>>
* @date 2015
*/
#include <libevmasm/PathGasMeter.h>
#include <libevmasm/KnownState.h>
#include <libevmasm/SemanticInformation.h>
using namespace std;
using namespace solidity;
using namespace solidity::evmasm;
PathGasMeter::PathGasMeter(AssemblyItems const&... | ALGO | 0.974262 | 6.563203 |
2b9e64cf-c005-465f-acbe-260d58f91dbc | ysonggit/leetcode | three_sum_closet.cpp | #include "utils.h"
using namespace std;
int threeSumClosest(vector<int> &num, int target) {
if(num.size()==0) return 0;
sort(num.begin(), num.end());
// minimize value of target - (num1 + num2 + num3)
int min_diff = INT_MAX;
int best_sum = 0;
for(int i=0; i<num.size(); i++){
int num1... | ALGO | 0.99999 | 5.472711 |
827a8a4e-a092-4844-8d5f-1cc92e4c8d3d | raincross7/code-similarity | codes/train_code/problem270/problem270_335.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int main() {
int x,data[101] = {0},top;
while(cin >> x) {
data[x]++;
}
top = *max_element(data,data+101);
for(int i=1;i<101;i++) {
if(data[i] == top)
cout << i << endl;
}
} | ALGO | 0.999906 | 3.610003 |
1a840550-f9a5-441c-b4eb-ba45e943a450 | kritika0598/codes | codeforces/FloodFill.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
lli N;
cin>>N;
vector<lli> v;
vector<lli> v1;
map<lli,lli> m;
map<lli,lli> :: iterator itr;
lli x;
lli k=0;
for(lli i=0;i<N;i++)
{
cin>>x;
if(... | ALGO | 0.999879 | 3.723588 |
2a5120e6-34ea-46ad-97fc-6d56dbb09a22 | XiotSamuel/Arduino | SDL_ESP32_BC24_GETIP-master/Parsing.cpp | #include <Arduino.h>
#include "WiFiServer.h"
#include "WiFiClient.h"
#include "WebServer.h"
//#define DEBUG_ESP_HTTP_SERVER
#ifdef DEBUG_ESP_PORT
#define DEBUG_OUTPUT DEBUG_ESP_PORT
#else
#define DEBUG_OUTPUT Serial
#endif
static char* readBytesWithTimeout(WiFiClient& client, size_t maxLength, size_t& dataLength, int... | WEB | 0.890658 | 3.173266 |
945ebc54-c1c0-4219-a5bb-019d69aa934f | ofernandopro/competitive-programming | progCompUFMG/1404.cpp | #include <iostream>
using namespace std;
int N, M;
int tabuleiro[20][20];
bool visitados[20][20];
bool isValida(int x, int y, int a, int b) {
return (x < N && y < M && x >= 0 && y >= 0 && !visitados[a][b] && tabuleiro[x][y] == 0 && tabuleiro[a][b] == 2);
}
int getMaiorNum(int x, int y) {
int maiorNum = 0;
if ... | ALGO | 0.99995 | 4.640085 |
4c851cf6-ca55-4dcf-99cd-9d3cf30a16b4 | RyanSchnar/Codeforces-Solutions | 1266B-DiceTower.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define REP(i, a, b) for (int i = a; i < b; ++i)
#define PUB push_back
#define POB pop_back
#define vi vector<int>
#define mi map<int, int>
typedef unsigned long long ll;
void init_code()
{
#ifnde... | ALGO | 0.999827 | 4.278235 |
55e01f2d-22f9-400f-95ec-3d4b5db6df2c | ritsuxis/kyoupro | abc101-120/abc119c.cpp | #include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; //... | ALGO | 0.999787 | 4.229902 |
521affa4-3c73-46f5-b729-60b9e2acbd6c | Harshjs-Gupta/DSA | Array/IntersectionOperation/efficientMethod.cpp | // write a program to mergeing intersection
#include <iostream>
using namespace std;
struct Array
{
int A[5];
int B[5];
int C[10];
int lengthA;
int lengthB;
};
void Intersection(struct Array *arr)
{
int i = 0;
int j = 0;
int k = 0;
while (i < arr->lengthA && j < arr->lengthB)
{... | ALGO | 0.995257 | 4.725573 |
9616768b-50f8-45f6-ad2b-b4e6497a99b9 | minhazul73/Cpp-CP-Codes | D_Prime_Function.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(s, n) for(int i = s; i < n; i++)
#define rrep(e, n) for(int i = n - 1; i >= e; i--)
#define vi vector<int>
#define pb push_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define asort(a) sort(a, a + n)
#define vsort(v) sort(all(v))
... | ALGO | 0.998129 | 5.160192 |
ddcb1472-211a-4c7b-877c-9622617aa5c0 | LeeKwang-min/Baekjoon-Algorithm | 2021CodingTestClass/연습/브루트포스/14225.cpp | /*
ۼ : ̻
Ͻ : 2021.03.10
: κм - 14225
Ǯ : κм 鼭 chk 迭 ε true ٲְ
Ž chk[i] false ְ Ѵ.
( : 1 ~ 2000001) (200 -> nִ = 20, arr[n] ִ = 100000)
*/
#include<iostream>
using namespace std;
int n;
int arr[21];
bool chk[2000001];
void go(int i, int sum) {
if (i == n) {
chk[sum] = true;
return;
}
go(i... | ALGO | 0.999987 | 4.157444 |
eaf35f1d-d1a7-4b4a-accd-2051ea0031f0 | yyhaos/Competitions | zby_solo/The 2017 ACM-ICPC Asia Beijing Regional Contest/f2.cpp | //Problem Web:
#include<bits/stdc++.h>
using namespace std;
char a[105][105];
int b[105][105];
string s;
int n,m;
signed main ()
{
#ifdef yyhao
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif
while(cin>>n){
// cout<<n<<endl;
memset(b,0,sizeof b);
memset(a,0,sizeof a);
for(int i... | ALGO | 0.999949 | 3.063064 |
f54edad0-b7a1-4e31-830f-55a663fe1561 | NeitherPNorG/cpp_primer5 | ch03/ex45.cpp | /*
* c++ primer ch03 ex45
*
range for:
0 1 2 3
4 5 6 7
8 9 10 11
for with subscripts:
0 1 2 3
4 5 6 7
8 9 10 11
for with pointers:
0 1 2 3
4 5 6 7
8 9 10 11
*/
#include <iostream>
using std::cout;
using std::endl;
//===================================================================
int main()
{
int ia[3][4];
size_t ... | TOOL | 0.897719 | 3.753599 |
110d81f1-9069-41f7-9953-6a43f0c20c43 | muhammadhasan01/cp | Online Judge/Codeforces/Contests/DIV2/DIV2-851/B.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
if (n % 2 == 0) {
cout << n / 2 << ' ' << n / 2 << '\n';
return;
}
auto getSumDigits = [&](int x) -> int {
int ret = 0;
while (x > 0) {
ret += x % 10;
x /= 10;
... | ALGO | 0.99999 | 5.656395 |
0dc27c9a-e131-4e3a-9c95-f5904a973ca5 | Lokonco/Cpp-Projects | Cho-Han/Cho-Han.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
void startGame(int& bankRoll);
string toLower(string s);
int main() {
string input;
int bankRoll = 10000;
srand(time(0));
cout << "\t\t\t------Welcome to Cho-Han------\n"
"Rules are simple, The dealer will shake 2 d... | ALGO | 0.952655 | 5.260402 |
4adec449-46fb-4964-ba23-dcf479cdd3be | FarukIb/My-Competitve-Programming-Solutions | CSES/two_sets/main.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
void print_set(set<int> a) {
cout << a.size() << endl;
for (int b : a)
cout <<b <<" ";
cout << endl;
}
int main() {
ios_base::sync_with_stdio... | ALGO | 0.999543 | 3.661176 |
50a00f1f-1786-4dbc-85cd-67cef4206b9f | princekalra/DSA_Practice2022 | Jump Game IV.cpp | //Jump Game IV.cpp
class Solution {
public:
int minJumps(vector<int>& arr) {
int n = arr.size();
unordered_map<int,vector<int> >mp;
vector<bool>visited(n,false);
for(int i=0;i<n;i++){
mp[arr[i]].push_back(i);
}
queue<int>q;
int steps=0;
q.... | ALGO | 0.99999 | 5.422538 |
e3c2f1eb-380a-43ac-8d05-c46c60ac4fcc | prathmesh0/MISSION_POP | A-Z/Recursion Patternwise/Trying out all Combos( Hard)/sudokusolver.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isValid(vector < vector < char >> & board, int row, int col, char c) {
for (int i = 0; i < 9; i++) {
if (board[i][col] == c)
return false;
if (board[row][i] == c)
return false;
if (board[3 * (row / 3) + i / 3][3 * (col / 3) +... | ALGO | 0.999358 | 6.148834 |
ce0ac812-850d-4abf-b7b1-0a51452140d1 | sachinsaw924/Leetcode | BitManipulation/3133. Minimum Array End.cpp |
// only passed some test cases 656/765
// time complexity O(n)
// it is working for reasonably for very small values
class Solution {
public:
typedef long long ll;
long long minEnd(int n, int x) {
int count = 1;
ll k = x;
int lastElement = 0 ;
while(count<=n)
{
... | ALGO | 0.999996 | 5.937141 |
cd3fa470-9af3-4574-a97c-767cbf69ad55 | gopoma/competitive-programming | events/contests/2023/Codeforces/div4/886/1250F.cpp | #pragma GCC optimize(3,"Ofast","inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define MACRO(code) do {code} while (false)
#define DBG(x) MACRO(cerr << #x << " ... | ALGO | 0.999918 | 5.269912 |
4d2cd4ea-e356-403c-b2db-7e75b0f11bf1 | MattHarrington/advent-of-code-2021 | day01/tests/testlib.cpp | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>
#include "lib.hpp"
const auto sample_input{ read_input("day01_sample_input.txt") };
const auto puzzle_input{ read_input("day01_input.txt") };
TEST_CASE("Sample input should contain 10 values")
{
CHECK(sample_input.size() == 10);
}
TEST_CAS... | ALGO | 0.858932 | 6.850335 |
59098e2a-05a9-4e0a-804a-15a40064cce5 | sebjinK/Data-Structures-Algorithms | Practice/practice1-25.cpp | #include <iostream>
using namespace std;
int main()
{
//pointers point to the numeric position of a label
int x = 5; //the label would point to the label's address (ex. 0x83675)
int* y = &x; //the ampersand points to the address of the pointer
cout << x; //prints 5 - normal cout statement
cout... | TOOL | 0.903732 | 3.647783 |
6c8f1912-b31d-409f-83f7-198be0e582e5 | fan-ziqi/rl_sar | src/rl_sar/library/thirdparty/Lite3_MotionSDK/lib/eigen3/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.992288 | 3.666278 |
241700c7-ae11-4a3e-a2b7-8b10db92f3ef | martineastwood/usine_hollyhock_modules | distributions/mtrand.cpp | // mtrand.cpp, see include file mtrand.h for information
#include "mtrand.h"
// non-inline function definitions and static member definitions cannot
// reside in header file because of the risk of multiple declarations
// initialization of static private members
unsigned long MTRand_int32::state[n] = {0x0UL};
int MTR... | TOOL | 0.998337 | 5.872167 |
b39b0c88-f8f1-44c3-9e3b-65367cc154dd | feedsmee/Competitive-programming | Library/DataStructures/Mo.cpp | // example problem : https://codeforces.com/problemset/problem/221/D
#include <bits/stdc++.h>
using namespace std;
const int N = 100009;
int n, q, st[N], nd[N], idx[N], a[N], comp[N];
int freq[N], an[N];
int ans;
void add(int x) {
if (freq[x] == comp[x]) --ans;
++freq[x];
if (freq[x] == comp[x]) ++ans;
}
void re... | ALGO | 0.999933 | 4.001317 |
a6ac3393-59f4-4309-852c-1df867b02766 | anoobzg/qi | src/tbb/src/examples/parallel_for/tachyon/src/apigeom.cpp | /*
* api.cpp - This file contains all of the API calls that are defined for
* external driver code to use.
*/
#include "machine.h"
#include "types.h"
#include "api.h"
#include "macros.h"
#include "vector.h"
#define MyVNorm(a) VNorm ((vector *) a)
void rt_polycylinder(void * tex, vector * points, int nu... | TOOL | 0.94853 | 4.233689 |
3cfc7161-837b-41d0-9933-eb22f475f3cd | jikongabc/test-jikong | ABC366bu_F.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#define inf 0x3f3f3f3f
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<int, int> PII;
const int... | ALGO | 0.999964 | 4.095237 |
a9fd726c-f9e3-42be-83c4-d7476f635552 | jakecastillo/CENG-EE-collection | EE205 (Object Oriented Programing) [C++]/Lab5/project/src/a3-main.cpp | #include <iostream>
#include <cassert>
#include "InsertionSortVector.hpp"
#include "BubbleSortVector.hpp"
int main() {
InsertionSortVector<int> v1;
v1.push_back(3);
v1.push_back(2);
v1.push_back(1);
v1.sort();
std::cout << "Insertion Sort:" << std::endl;
for (int i = 0; i < v1.size(); ++... | TEST | 0.980972 | 6.151649 |
1f36ee70-5c13-4a7d-85b4-cfa8aa5369c9 | BoloYoung/AngryBirds | AngryTry/Box2D/Dynamics/Contacts/b2Contact.cpp | #include "b2Contact.h"
#include "b2CircleContact.h"
#include "b2PolygonAndCircleContact.h"
#include "b2PolygonContact.h"
#include "b2ContactSolver.h"
#include "b2Collision.h"
#include "b2TimeOfImpact.h"
#include "b2Shape.h"
#include "b2BlockAllocator.h"
#include "b2Body.h"
#include "b2Fixture.h"
#include "b2World.h"
... | ALGO | 0.985938 | 7.658119 |
f6e091cc-64ca-4deb-84bf-b2b245f365ec | Sahil010302/Security | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
32b0d502-075e-46d2-904a-e37e45821072 | Andrea-09/PED0319-AMRA-00366519 | PED0319/Laboratorio 04/HW-02.cpp | #include <iostream> //Entrada y salida en consola
using namespace std;
//Prototipo de funcion
int fib(int number);
//Inicio
int main() {
int number , aux=0;
cout << "Ingrese el numero de terminos de la : ";
cin >> number;
cout << "\nSerie Fibonacci : ";
while(aux < number) {
cout << " " << fib(au... | ALGO | 0.999434 | 4.243114 |
7d787b68-f331-4651-b4b4-77df6022ef3d | swastiksompura/module-3- | c++/3.cpp | // 3. POP vs OOP Comparison Program ?
#include <iostream>
using namespace std;
int main() {
float length, width, area;
cout << "Enter length: ";
cin >> length;
cout << "Enter width: ";
cin >> width;
area = length * width;
cout << "Area of rectangle (POP): " << area << endl;
return 0... | TOOL | 0.862697 | 3.118627 |
07f80818-41ba-46a6-b563-fea47f3bd4b4 | wjwarner24/s24-project-4-wjwarner24 | src/utilities/flags/flags.cpp | #include "utilities/flags/flags.hpp"
void print_usage() {
std::cout <<
"Usage: cpu-sim [options] filename\n"
"\n"
"Options\n"
" -h, --help:\n"
" Print this help message and exit.\n"
"\n"
" -m, --metrics:\n"
" If set, outputs general me... | TOOL | 0.876664 | 6.200902 |
86b90cfd-4b9a-4f0c-8617-cb8d844a8d7e | Junaid7200/University-Labs | Data Structures/Stacks/.history/LabEvalPractice_20240418214737.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int data) {
this -> data = data;
this -> next = NULL;
}
void setData(int data) { this -> data = data; }
void setNext(Node* node) { this -> next = node; }
int getData() { return this -> data; }
Node... | ALGO | 0.994376 | 4.687342 |
87680156-4696-4197-ba55-558109c926c2 | kaziabdullahfuad/Codeforces-Grind | contest/round 986 (div-2)/aanother.cpp | #include<iostream>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
using namespace std;
#define ll long long
#define endl "\n"
#define debug(x) cout<<#x<<":"<<x<<endl;
#define all(x) (x).begin(),(x).end()... | ALGO | 0.999708 | 3.686348 |
88c71a0c-a556-4ed5-ac20-8f782a88a5f1 | antaku66/programing_contest | src/UnionFind.cpp | #include <bits/stdc++.h>
using namespace std;
namespace {
struct UnionFind {
UnionFind(int n) : parants_(n, -1), sizes_(n, 1) {}
int GetRoot(int x) {
if (parants_[x] == -1) {
return x;
} else {
return parants_[x] = GetRoot(parants_[x]); // 経路圧縮
}
}
bool IsSame(int x, int y) { return... | ALGO | 0.999318 | 4.258472 |
59953ba8-542e-4f15-8aa0-075d3aa62987 | lxb1226/leetcode_cpp | src/question846.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
class Solution {
public:
bool isNStraightHand(vector<int>& hand, int groupSize) {
unordered_map<int,int> map;
priority_queue<int, vector<int>, greater<int>> q;
for(auto c : hand){
... | ALGO | 0.999825 | 5.47158 |
0c49dd3b-2029-4e42-ba7c-56c153abbd36 | Neroysq/Neroysq-SPOJ | Codes/MKTHNUM.cpp | #include <stdio.h>
#include <stdlib.h>
const int nmax = 100000;
struct tps
{
tps *l, *r;
int s;
}*st[nmax + 18], TMP, *null = &TMP;
int n, m, idt;
int a[nmax + 18], ind[nmax + 18], p[nmax + 18], fp[nmax + 18];
int cmpor(const void *i, const void *j)
{
return a[*(int *)i] - a[*(int *)j];
}
tps *newp(tps ... | ALGO | 0.999992 | 4.157938 |
e3b36d07-29b8-436f-bd80-f30fe759a7b4 | arjun-raj-kuppala/HIP-Common-1 | samples/0_Intro/bit_extract/bit_extract.cpp | #include <stdio.h>
#include <iostream>
#include "hip/hip_runtime.h"
#define CHECK(cmd) \
{ \
hipError_t error = cmd; ... | ALGO | 0.945706 | 5.424078 |
90aac658-5178-47f4-bd50-973a6ab6d3de | dvaitam/codeforces | 1000-1999/1000-1099/1090-1099/1097/solH.cpp | #include <bits/stdc++.h>
using namespace std;
using ull = uint64_t;
using ll = int64_t;
using ld = long double;
const int D = 22;
const int M = 62;
const int B = 62;
const int N = 30228;
int n, d, m;
ll MASK;
int gen[D];
int b[N];
ll rot(ll x, int y) {
return ((x >> y) + (x << (m - y))) & MASK;
}
struct LBord... | ALGO | 0.999978 | 4.741861 |
a1887d8f-248a-480e-a30e-e7bf756845d2 | mpiffari/SERL_Robotics_Project | ArrowFinder/src/libraries/Eigen_library/doc/examples/class_FixedBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived, 2, 2>
topLeft2x2Corner(MatrixBase<Derived>& m)
{
return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);
}
template<typename Derived>
const Eigen::Block<const Derived, 2, 2>
topLeft2... | TOOL | 0.918407 | 6.64346 |
d7d93911-2e7a-4582-93c7-a2ade6fc5eb1 | kiyoony/acmicpc.net | 알약.cpp | //#include <stdio.h>
//long long int arr[31] = { 1,1,2 };
//int main()
//{
// int i = 0, j;
//
// for (i = 3; i < 31; i++)
// {
// for (j = 0; j < i; j++)
// {
// arr[i] = (arr[i] + (arr[j] * arr[i - j - 1]));
// }
// }
// while(1)
// {
// int n;
// scanf("%d", &n);
// if (!n)break;
// printf("%lld\n", arr[n])... | ALGO | 0.999879 | 3.8289 |
27489353-04f3-4df1-86cc-efed560f258f | Mohit-kushwaha/chessengine | stockfish_15_win_x64_avx2/stockfish_15_src/src/timeman.cpp | #include <algorithm>
#include <cfloat>
#include <cmath>
#include "search.h"
#include "timeman.h"
#include "uci.h"
namespace Stockfish {
TimeManagement Time; // Our global time management object
/// TimeManagement::init() is called at the beginning of the search and calculates
/// the bounds of time allowed for the ... | ALGO | 0.995191 | 7.29153 |
f1183c86-b68e-477a-b1c6-7cc9a3fd43d1 | agusbarrena/Homework-1 | ejercicio_4/codigo.cpp | #include <iostream>
#include "funciones.h"
bool miProcesoAMedir(const char* str1, const char* str2){
if(*str1 != *str2){
return false;
}
if(*str1 == '\0' && *str2 == '\0'){
return true;
}
return miProcesoAMedir(str1+1, str2+1);
}
/*Usé const char* en lugar de std::string porque ... | ALGO | 0.997122 | 4.242091 |
1d59d7a8-9a9b-44d6-acc7-bf4cb24f362f | aditya9710/LeetCodeProblems | 1011. Capacity To Ship Packages Within D Days/Code.cpp | class Solution {
int findDays(vector<int>& weights, int cap) {
int days = 1;
int load = 0;
for(int i = 0; i < weights.size(); ++i) {
if(weights[i] + load > cap) {
days += 1;
load = weights[i];
}
else load += weights[i];
}
return days;
}
public:
i... | ALGO | 0.999985 | 5.898069 |
dbe134a4-c093-46e5-8c7d-9841b88d18b8 | neerajsandal/Data-Structures-of-Cpp | Linked List/1. Single/1. Create LL.cpp | #include<iostream>
using namespace std;
struct node{
int data;
struct node* next;
};
struct node *head=NULL;
void Create()
{
char ch='y';
while(ch=='y'){
if(head==NULL)
{
head=new node;
cin>>head->data;
head->next=NULL;
}
else
{
node *temp=head,*temp1;
... | ALGO | 0.997538 | 3.562881 |
bee0ed3e-fede-458a-8391-827990013397 | Masahiro-Obuchi/Atcoder | ARC/ARC057/ARC057B.cpp | #include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
int to;
int weight;
Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;
... | ALGO | 0.999922 | 4.030594 |
1f65c857-3357-4a03-b19c-c07b3b738159 | r4pidstart/problems | by_category/graph/2152.cpp | // https://www.acmicpc.net/problem/2152
// 2021-08-08 23:59:47 36ms
#include<bits/stdc++.h>
using namespace std;
vector<vector<int> > graph, scc, sccgraph;
vector<int> finished, visited, sccidx, scc_memo;
stack<int> stk;
int targanDFS(int now)
{
static int visit_cnt=0, scccnt=0;
if(visited[now]) return visite... | ALGO | 0.999923 | 4.383078 |
981905f1-27ff-44a3-a1ba-f2007bc7283d | WizardPenguin/competative-programming | 819 div2/1726C.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> p... | ALGO | 0.998364 | 4.584478 |
ba89227a-eac1-464d-a4e7-72c64736401f | adibakhan-14/Algorithim-Leetcode.cpp | insertation.cpp | // C++ program for insertion sort
#include <bits/stdc++.h>
using namespace std;
/* Function to sort an array using insertion sort*/
void insertionSort(int arr[], int n)
{
int i, key, j;
for (i = 1; i < n; i++)
{
key = arr[i];
j = i - 1;
/* Move elements of arr[0..i-1], that are
greater than key, to one pos... | ALGO | 0.999992 | 6.006937 |
d8a6ebeb-1bcb-4665-a247-7ff1e86bdaba | Mayureshdindorkar/datastructures | string_opearations.cpp | #include<iostream>
using namespace std;
class str
{ private:char s1[50],s2[50],s3[50];
public:int i,j,k,h,q;
void strlen(char *s1)
{
for(i=0;s1[i]!='\0';i++);
cout<<" Length of string is :"<<i;
}
void strconcat(char *s1,char *s2)
{
for(i=0;s1[i]!='\0';i++)
{... | ALGO | 0.995754 | 3.467236 |
500058b0-5985-4f57-a1ce-0c2183c9ce39 | liuxueyang/cpp | codeforces/problemset/1278b.cpp | // Date: Tue Aug 15 20:59:55 2023
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include ... | ALGO | 0.999955 | 4.473667 |
405f8320-c028-4df5-be3e-0ff90b8b3984 | KnowHow866/DSA | HW6_MusicRegonize/Hw6.cpp | #include <iostream>
#include <cstdlib>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <algorithm>
#include <stack>
#include "DP.h"
using namespace std;
int main()
{
int pitchNum, noteNum;
DP tool;
cin>> pitchNum;
vector<double> pitch;
pitch.resize(pitchNum);
for(int i = 0;i < ... | ALGO | 0.999691 | 3.256461 |
6cf9f53b-d94c-4ba1-a3cc-fed5927508da | sontheteacher/Competitive-Programming | CSES_pset/graph/building_rds.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
using namespace std;
int n, m;
unordered_map<int, vector<int>> graph;
unordered_set<int> unvisited_nodes;
vector<int> representatives;
void bfs() {
while (!unvisited_nodes.empty()) {
queue<int> q;
... | ALGO | 0.999985 | 4.972452 |
6133700e-99f4-4da3-8e60-8c96aef3b2fb | rohitkhilnani/cpp-And-Me | merge-sort/testMergeSort.cpp | /*
This program tests merge sort
*/
#include<iostream>
#include<vector>
#include "mergesort.h" // My implementation of merge sort
// Displays vector
void printVector(std::vector<int> A){
for(auto x: A){
std::cout<<x<<" ";
}
std::cout<<std::endl;
}
// Tests merge sort on vector A
void testMergeSort(std::vec... | ALGO | 0.990874 | 5.865837 |
3e996155-8a91-4606-b6b4-74e61ec8ccdc | NP95/EDA | FM_Partitioning/Algorithm/FMEngine.cpp | #include "FMEngine.h"
#include <algorithm>
#include <random>
#include <chrono>
#include <iostream>
#include <unordered_set>
namespace fm {
FMEngine::FMEngine(Netlist& netlist, double balanceFactor)
: netlist_(netlist)
, partitionState_(netlist.getCells().size(), balanceFactor)
, gainBucket_(getMaxPossible... | ALGO | 0.999638 | 6.341799 |
a4637251-af50-4d21-9a48-1b703512b3bf | peterclemenko/Forque3D-FPSTutorial | Engine/lib/opcode/Ice/IceIndexedTriangle.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains a handy indexed triangle class.
* \file IceIndexedTriangle.cpp
* \author Pierre Terdiman
* \date J... | ALGO | 0.977401 | 7.721071 |
8177b8a3-6920-4220-bf0c-1d423da97b5b | chunag24/project_euler | fib1.cpp | /*************************************************************************
> File Name: fib1.cpp
> Author:
> Mail:
> Created Time: Thu 11 Mar 14:09:18 2021
************************************************************************/
#include<iostream>
using namespace std;
long long num[50] = {1, 1};
int main(){
... | ALGO | 0.997316 | 3.529369 |
1f62a598-dc09-4d85-92ec-036e12d7ed97 | uniqss/leetcodecpp | 0216/216_CombinationSumIII2.cpp | #include "../inc.h"
// 这是一个 javascript 写法翻译过来的
class Solution {
vector<vector<int>> ret;
vector<int> curr;
public:
vector<vector<int>> combinationSum3(int k, int n) {
backtrace(1, 0, k, n);
return ret;
}
void backtrace(int idx, int sum, int k, int n) {
if (sum >= n || i... | ALGO | 0.999861 | 6.047753 |
483ad24f-b795-40ea-9ee3-9795414faa4d | SrjAdhikari/DSA-With-CPP | 08_Recursion/Recursion_Level-3/05_Uppercase_To_Lowercase.cpp | #include <iostream>
#include <string>
using namespace std;
// Function to convert all uppercase letters in a string to lowercase using recursion
void upperToLower(string& str, int index) {
// Base case: When index is less than 0, stop recursion
if (index < 0) {
return;
}
// Convert the charact... | ALGO | 0.981319 | 6.279931 |
c449b7be-da28-443f-b6e4-93c6201d7ae5 | TravisGurlik/aoc-solutions | 2020/Day 05/part1.cpp | /*
* Day 5: Binary Boarding (https://adventofcode.com/2020/day/5)
* It's a set of binary searches. Not much else to add.
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
string inputVal;
ifstream input;
input.open("input.txt");
if(!input.is_open()) {
... | ALGO | 0.993162 | 6.235372 |
1ea07a40-1225-40c4-8a79-014bdb1bd37b | cbasdev/HighPerformanceComputing | matrix/matrix_sec.cpp | #include <iostream>
#include <time.h>
#include <ctime>
#include <unistd.h>
using namespace std;
void generateMatrix(int **matrix, int rows, int cols)
{
srand(time(NULL));
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
matrix[i][j] = rand() % 3 + 1;
}... | ALGO | 0.99971 | 3.505611 |
f07b8d03-cfb6-43f2-961e-f9e2cf6f0dd3 | zyli5313/CareerCup | ch3/3-1.cpp | // Time complexity O(n). Space complexity O(1)
#include "iostream"
using namespace std;
const int MAXSTKNUM = 1000;
template<typename T>
class Stack<T>
{
private:
T arr[];
int idxTop;
public:
Stack()
{
arr = new T[MAXSTKNUM];
idxTop = -1;
}
~Stack()
{
while... | ALGO | 0.995069 | 4.207758 |
af0ea046-0288-4569-9801-97737b94f10e | JaejunHan/Algorithm | c++/March/22/18290.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int n, m, k, maximum = -INFINITY;
bool validPosition(int i, int j, vector<vector<bool>>& visited) {
if (visited[i][j]) return false;
if (i-1>=0 && visited[i-1][j]) return false;
if (j-1>=0 &... | ALGO | 0.999922 | 4.298812 |
2bc09406-f195-4fb5-91e3-eddb1aaf6ba9 | ishandutta2007/codeforces | monogon/normal/547/D.cpp |
#include <bits/stdc++.h>
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
... | ALGO | 0.999955 | 4.74484 |
bea67aff-deb1-4dd9-bbb8-446ea7d12e92 | seclab-fudan/SyzDirect | source/llvm-project-new/flang/lib/Decimal/decimal-to-binary.cpp | #include "big-radix-floating-point.h"
#include "flang/Common/bit-population-count.h"
#include "flang/Common/leading-zero-bit-count.h"
#include "flang/Decimal/binary-floating-point.h"
#include "flang/Decimal/decimal.h"
#include <cinttypes>
#include <cstring>
#include <ctype.h>
namespace Fortran::decimal {
template <in... | ALGO | 0.976735 | 7.052701 |
f9f1c37f-b4a1-4044-847b-509b6d906871 | ntxq/PS-Baekjoon | 2000~2999/2231.cpp | #include <iostream>
int getDigitSum(int x) {
int sum = x;
while (x > 0) {
sum += x % 10;
x /= 10;
}
return sum;
}
int main() {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
int x;
std::cin >> x;
for (int i = 1; i <= x; ++i) {
int sum = getD... | ALGO | 0.999964 | 5.638935 |
53c174eb-950b-4b36-8ff7-48784a8fe979 | Fraunhofer-AISEC/guarantee-llvm | clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp | #include "IncludeSorter.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
namespace clang {
namespace tidy {
namespace utils {
namespace {
StringRef RemoveFirstSuffix(StringRef Str, ArrayRef<const char *> Suffixes) {
for (StringRef Suffix : Suffixes) {
if (Str.endswith(Suffix)) {
ret... | TOOL | 0.982108 | 7.914926 |
6378baf4-a307-400e-8df1-cef82d6bb621 | KatenKyoukotsu/Cpp_practice | День_1/prac7.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[])
{
string str = "+++++++Hello, World0----------";
int count_plus = count(str.begin(), str.end(), '+');
int count_minus = count(str.begin(), str.end(), '-');
int count_zero = 0;
for (in... | ALGO | 0.99832 | 4.096862 |
62a190d5-a41a-4620-be34-ebb178f43015 | rocxsoft/iCrypto | cryptopp560/blumshub.cpp | // blumshub.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "blumshub.h"
NAMESPACE_BEGIN(CryptoPP)
PublicBlumBlumShub::PublicBlumBlumShub(const Integer &n, const Integer &seed)
: modn(n),
maxBits(BitPrecision(n.BitCount())-1)
{
current = modn.Square(modn.Square(seed));
bitsLe... | ALGO | 0.999278 | 6.774301 |
22c0a8d2-fb58-437f-988e-e687518ff69b | Alpha00790/CodeForces | 116Apractice.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a[1000],b[1000],ans,i,k,maxx=0;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d%d",&a[i],&b[i]);
}
k=a[0];
for(i=0; i<n; i++)
{
ans=b[i]-a[i]+k;
cout<<b[i] - a[i]<<" "<<"K = "<<k<<endl;
k=an... | ALGO | 0.999651 | 3.080941 |
47a06fa6-9b2d-4aaa-a594-a3fac6a4385b | ChuanSWT/Codeforces_codes | D_Scarecrow.cpp | #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <set>
#include <tuple>
#include <cmath>
#include <queue>
#include <iomanip>
#include <numeric>
#define int long long
#define gird grid
using namespace std;
void compete_solutio... | ALGO | 0.999749 | 3.314763 |
2ef6cb10-d56e-4caa-9360-31c9180c6d6a | heduenas/codeforces | cf320/b.cpp | #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
#include <set>
#include <list>
#include <sstream>
#include <time.h>
#include <stdlib.h>
#include <ctype... | ALGO | 0.999861 | 3.825309 |
a24c9d54-73b8-49a2-91c2-9b02356f1956 | Kronoxin/CherryMac | Ejercicio31b.cpp | ////
//// Ejercicio31.cpp
//// Ejercicio1
////
//
//
//#include <string>
//#include <iostream>
//#include <vector>
//#include "Matriz.h"
//
//
////Solución con vector
//
////void monedas_minimas(std::vector<int> &monedas, int precio, std::vector<int> &solucion,std::vector<int>cantidades){
////
//// for (int i = ... | ALGO | 0.999464 | 3.818677 |
07630ad7-2a48-4a82-9176-179b851be500 | Shirish111/LeetCode | ReverseInteger/a.cpp | // Reverse Integer
// Given a 32-bit signed integer, reverse digits of an integer.
// Example 1:
// Input: 123
// Output: 321
// Example 2:
// Input: -123
// Output: -321
// Example 3:
// Input: 120
// Output: 21
// Note:
// Assume we are dealing with an environment which could only store integers
// within the 32... | ALGO | 0.999634 | 5.271957 |
827572f1-51f8-4835-9c41-03804a754787 | tirzak/data-structures-and-algo | binaryT.cpp | #include <iostream>
#include <vector>
struct Node {
int item;
struct Node *left, *right;
};
class Tree{
public:
Tree();
~Tree();
void insert(int item);
int search(int item);
void printTree();
private:
void insertHelp(struct Node* node,int item);
int searchHelp(struct Node* node,... | ALGO | 0.999953 | 4.794911 |
56a05ab5-28f8-48da-8209-47e5303a4211 | trinhminhtriet/leetcode | solutions/2600-2699/2644.find-the-maximum-divisibility-score/Solution.cpp | class Solution {
public:
int maxDivScore(vector<int>& nums, vector<int>& divisors) {
int ans = divisors[0];
int mx = 0;
for (int div : divisors) {
int cnt = 0;
for (int x : nums) {
cnt += x % div == 0;
}
if (mx < cnt) {
... | ALGO | 0.999988 | 6.422069 |
35791a91-db30-46ac-bacd-88455179097b | afifabroory/CompetitiveProgramming | CodeChef/SUBMIN/solution.cpp | #include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
solve();
return 0;
}
// O(n*n)
void solve() {
unsigned short n;
cin >> n;
unsigned int ai[n];
for (unsigned i = 0; i < n; i++) {
unsigned int tmp;
cin ... | ALGO | 0.999947 | 4.493907 |
340c962d-b378-4dcc-9556-2f98988e14ba | Shubham84095/CPP | A_Odd_One_Out.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4.2")
#define incSort(V) sort(V.begin(), V.end())
#define decSort(V) sort(V.begin(), V.end(), greater<int>())
using namespace std;
typedef long long ll;
//const int M = 1e9 + 7;
//const int N = 1e7 + 10;
void Solution()
{
int a , b, c;
... | ALGO | 0.999958 | 5.273011 |
cd19f461-eda0-46a3-a593-cc912fe98448 | hemanth1999k/Competitive-Programming | Codeforces/doubt.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// freopen("input.txt","r",stdin);
ifstream ii("input.txt");
string s;
int i;
ii>>s>>i;
cout<<i<<endl;
cout<<s<<" A "<<i<<endl;
return 0;
//code
int t;
cin>>t;
while(t--){
string s;
cin>>s;
cout<<s<<endl;
int n = s.length();
... | ALGO | 0.998051 | 3.627129 |
c5cc1033-4d4a-4ef7-a43d-644ef443750a | wikibook/77algo | editorial/final/cpp/answer_C02.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int N, A[109];
int Answer = 0;
int main() {
// 입력
cin >> N;
for (int i = 1; i <= N; i++) cin >> A[i];
// 답을 구한다(완전 탐색)
for (int i = 1; i <= N; i++) {
for (int j = i + 1; j <= N; j++) Answer = max(Answer, A[i] + A[j]);
}
// 출력
cout << Answer << ... | ALGO | 0.99995 | 4.366961 |
ab10f9b9-6c05-419a-8293-34d05e5ef396 | ishandutta2007/codeforces | rfpermen/normal/448/A.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O2")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define rep(i,n,N) for(int i=n;i<=N;i++)
#define rap(... | ALGO | 0.999791 | 3.202189 |
646ce363-5a8f-45c4-8b2a-437ae738a0e0 | Sanchronyx/Zero-Judge | c813_Summing_Digits.cpp | #include <iostream>
using namespace std;
void gn_function(int num){
int sum{0};
while (num > 0){
sum += num % 10;
num /= 10;
if (num == 0 && sum > 9) {
num = sum;
sum = 0;
}
}
cout << sum << endl;
}
int main(void){
int num{0};
while (cin ... | ALGO | 0.999943 | 5.660985 |
6e1e0bdc-72a1-4658-a5c0-88b159267ed3 | Ritika-Kumari-16/LeetCode | 0443-string-compression/0443-string-compression.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int n = chars.size();
int idx = 0;
for(int i = 0 ; i < n ;i++){
char ch = chars[i];
int count = 0;
while(i<n && chars[i]==ch){
count++;
i++;
}
... | ALGO | 0.999991 | 6.502356 |
6fdd3f16-8052-4eb2-b612-88218ae07f89 | RohannMogalii/TCS-NQT-Coding-Sheet | 05]. Strings/02_Count_number_of_vowels_consonants_spaces_in_String.cpp | /*
Example 1:
Input: string str=”Take u forward is Awesome”
Output:
Vowels: 10
Consonants: 11
White spaces: 4
Example 2:
Input: string str=”India won the cricket match”
Output:
Vowels: 8
Consonants: 15
White spaces: 4
*/
// ---------------------------------------------------------------------------
// Method 1
//... | ALGO | 0.999529 | 5.493378 |
c3256063-6722-436c-8edc-870f5a056922 | akashpatelknit/LeetCode | 1105-filling-bookcase-shelves/1105-filling-bookcase-shelves.cpp | class Solution {
public:
int f(int ind,int shelfWidth,int maxht,int maxwd, vector<vector<int>>& books,vector<vector<int>>&dp){
if(ind==books.size()) return maxht;
if(dp[ind][shelfWidth]!=-1) return dp[ind][shelfWidth];
int curwd=books[ind][0];
int curht=books[ind][1];
if(curw... | ALGO | 0.999919 | 6.145888 |
b6ae22e0-520d-4409-b1e1-21c350db8cc2 | ElsaQf/CppDevelopInterview | 18_01.cpp | //面试题18:删除链表的节点
//题目一:在O(1)时间内删除链表节点
//方法:
//1.已知删除节点非尾节点,则将删除节点的值置为下一个节点的值index->next->val,无需遍历
//2.已知删除节点是尾节点,需要遍历,找到前一个节点
#include <iostream>
using namespace std;
struct ListNode{
int val;
ListNode *next;
};
void createLinkList(ListNode *head, int n){
ListNode *p;
ListNode *temp;
p = head;
for(int i = 0... | ALGO | 0.999953 | 4.676559 |
5a7db050-a89e-4d38-9e83-c211673dd5a1 | TuringKi/llvm-project-12-wasi | libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp | // <vector>
// void resize(size_type sz, const value_type& x);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> v(100);
v.resize(50, 1);
assert(v.size()... | TEST | 0.859394 | 6.374469 |
d1ff90ef-b373-4cbd-9e2f-a420fe76f33f | SegmentationFaultUtadeo/DS-A-Problemas | C++/Problemas/UVaOnlineJudge/13130Cacho/13130Cacho.cpp | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef short int si;
int main(){
si T; cin >> T;
while (T--){
si a_i; cin >> a_i;
bool escala = true;
for (int i = 0; i < 4; ++i){
si a_i_1; cin >> a_i_1;
if (a_i + 1 != a_i_1) escala = false;
... | ALGO | 0.99972 | 3.654351 |
49ad7662-6a31-43fd-a5a3-f96dda2d8995 | Huuuhi/LeetCode | 二叉树/98.验证二叉搜索树.cpp | //
// Created by GooYu on 2024/7/9.
//
#include "header.h"
#include "TreeNode.h"
using namespace std;
/**
* 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)... | ALGO | 0.999801 | 6.781931 |
279a4596-aef9-40a1-be9e-31382d8fedd0 | deepin-community/trilinos | packages/muelu/test/perf_tests_kokkos/KokkosKernels.cpp | #include <Kokkos_Core.hpp>
#include <Kokkos_ArithTraits.hpp>
#include <KokkosSparse_CrsMatrix.hpp>
#include <Kokkos_StaticCrsGraph.hpp>
#include <impl/Kokkos_Timer.hpp>
template<class scalar_type, class local_ordinal_type, class device_type>
class LWGraph_kokkos {
private:
typedef Kokkos::StaticCrsGraph<local_ordina... | ALGO | 0.992635 | 5.550982 |
3f1050d9-1dc6-4ca3-bfe8-e8de996df56e | the-stranded-alien/LeetCode | 0001_0100/075_Sort_Colors.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define F first
#define S second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define si set <int>
#define vi vector <int>
#define vs vector <string>
#define... | ALGO | 0.999987 | 5.035923 |
d55df6c8-f22a-4c6e-adc9-431ee6d6f9f2 | paul1999/buildhooktest | src/amun/processor/tracking/ballflyfilter.cpp | #include "ballflyfilter.h"
#include <cmath>
#include <numeric>
#include <iostream>
#include <Eigen/Core>
#include <Eigen/SVD>
#include <QDebug>
static const float floorDamping = 0.55; // robocup 2016: 0.67
static const int MAX_FRAMES_PER_FLIGHT = 200; // 60Hz, 3 seconds in the air
static const float ACCEPT_DIST = 0.35... | ALGO | 0.996102 | 5.38378 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.