uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
931d09d2-139f-4e0b-b445-97155e80a6ab | mr2rm/solutions | legacy/UVa/189.cpp | #include <iostream>
#include <string>
using namespace std;
string str, s;
int res;
bool IsDig (int in)
{
return (str[in] >= '0' && str[in] <= '9');
}
bool IsChar (int in)
{
return ((str[in] >= 'a' && str[in] <= 'z') || (str[in] >= 'A' && str[in] <= 'Z'));
}
bool IsIden (int in)
{
return (str[in] == '_' || IsChar(... | ALGO | 0.971131 | 3.678317 |
b5a2731d-6ba1-420b-841f-916d0c1e8578 | LoveWX/kickstart | 2021RoundF/a.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int ncase;
cin>>ncase;
for(int icase=1;icase<=ncase;++icase)
{
int N;
string str;
cin>>N>>str;
vector<int> vi;
vi.reserve(str.size());
for(int i=0;i<str.size();++i)
... | ALGO | 0.999922 | 4.150891 |
e5bf0d0c-5869-442f-af1f-a9766d96a44d | brown0394/algorithm_practice | hideAndSeek2.cpp | #include <iostream>
#include <queue>
int main() {
int start, target;
scanf("%d %d", &start, &target);
if (start == target) printf("0\n1\n");
else if (start > target) printf("%d\n1\n", start - target);
else {
int count = 0;
int found = 0, possibleWays = 0;
std::queue<std::pair<int, int>> q;
std::vector<in... | ALGO | 0.99994 | 3.910748 |
5f7d9c9b-2377-4a40-89d4-24ce5b4dfc42 | dgaydukov/projecteuler | tasks/4.cpp | /*
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
*/
#include <iostream>
#include <ctime>
#include <math.h>
int reverseNumber(int num)
{
int rev = 0;
... | ALGO | 0.999697 | 6.293639 |
866850cd-e8c5-4479-a355-d88a97dbfc05 | bogdandanciu/KinetiX | benchmark/3rd_party/amrex/Src/Base/AMReX_MPMD.cpp | #include <AMReX_MPMD.H>
#include <AMReX_ParallelDescriptor.H>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <vector>
#ifdef AMREX_USE_MPI
namespace amrex::MPMD {
namespace {
bool initialized = false;
bool mpi_initialized_by_us = false;
MPI_Comm app_comm = MPI_CO... | TOOL | 0.98759 | 4.800333 |
b9205393-842b-4a72-b3c6-33bb197e30e0 | alexandraback/datacollection | solutions_5669245564223488_0/C++/sssawwe/codejam1.cpp | #include <iostream>
#include <math.h>
#include <string.h>
#include <algorithm>
using namespace std;
static const unsigned int table[] = {1, 1, 2, 6, 24, 120, 720,
5040, 40320, 362880, 3628800, 39916800, 479001600};
bool check(string a[],int m){
char c[27];
for(int i=1;i<27;i++)c[i]=96+i;
char d;
for(int i=0;i... | ALGO | 0.999861 | 4.041126 |
ffd01c60-3009-4c42-b0df-3cd9521837c9 | mensong/uchardet-charset-detection | src/nsLanguageDetector.cpp | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#include <math.h>
#include "nsLanguageDetector.h"
nsDetectState nsLanguageDetector::HandleData(const int* codePoints, PRUint32 cpLen)
{
int order;
for (PRUint32 i = 0; i < cpLen; i++)
{
order = GetOrderFromCodePoint(codePoints[i]... | ALGO | 0.981258 | 6.799962 |
243287ee-d4e8-44f2-9f72-15e51f615ddc | c8ef/Bustub | src/optimizer/merge_filter_nlj.cpp | #include <algorithm>
#include <memory>
#include "catalog/column.h"
#include "catalog/schema.h"
#include "common/exception.h"
#include "common/macros.h"
#include "execution/expressions/column_value_expression.h"
#include "execution/expressions/constant_value_expression.h"
#include "execution/plans/abstract_plan.h"
#incl... | TOOL | 0.984256 | 6.801146 |
0b474ccc-5eef-4480-9dda-060f18c22f92 | Ziklon/algorithms | tc/testprograms/MagicalGirlLevelTwoDivTwo.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999785 | 4.407436 |
90910231-76b9-4470-bd73-27e322a0e726 | yeominstall/algo | PS/player.cpp | /**
* oncoder 15. july 1
*/
#include <string>
#include <vector>
using namespace std;
//핵심 소스코드의 설명을 주석으로 작성하면 평가에 큰 도움이 됩니다.
class Solution{
public:
vector<string> solution(int numPlayers, string deck){
vector<string> players;
string tmp;
for (int i = 0; i < numPlayers; i++) {
... | ALGO | 0.998797 | 4.978889 |
e28bc11a-7bd8-43bd-8462-ffa1a8cd6d49 | AnkitShingne/Cpp_mini_programs | switch_statement.cpp | #include <iostream>
using namespace std;
string getDayOfWeek(int dayNum){
string dayName;
switch(dayNum){
case 0:
dayName = "Sonntag";
break;
case 1:
dayName = "Montag";
break;
case 2:
dayName = "Dienstag";
break;... | TOOL | 0.98414 | 3.870467 |
08486007-5837-41e6-9193-a7e53d76ee69 | jainrishabh98/CP | cc-VILLINE.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main ()
{
ll n,m,c,x,y,p;
cin>>n>>m>>c;
ll s1=0,s2=0;
for(int i=1;i<=n;i++)
{
cin>>x>>y>>p;
if(y-m*x-c < 0)
s1 += p;
else
s2 += p;
}
cout<<max(s1,s2);
} | ALGO | 0.999906 | 3.669596 |
fdfa52fb-25ec-4f3e-8603-058bd1d50493 | T4t4KAU/cskaoyan | data_structure/graph/kruscal.cpp | #include <iostream>
using namespace std;
const int N = 5;
int nodes[N];
// 查找
int find(int x) {
if (nodes[x] != x) {
nodes[x] = find(nodes[x]);
}
return nodes[x];
}
struct Edge {
int x, y, w;
bool operator<(const Edge &e) const {
return this->w < e.w;
}
};
Edge edges[2*N] =... | ALGO | 0.999972 | 4.42737 |
77d8227f-9239-4ae5-b73e-8509a7a34806 | linux4life798/llvm-project-ci-test | llvm/lib/Transforms/Utils/SymbolRewriter.cpp | #include "llvm/Transforms/Utils/SymbolRewriter.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm... | TOOL | 0.925401 | 7.579959 |
a69bf87b-55e7-4772-bd4a-6cab51f85726 | ArseniyKholod/stce_ss24_ex12 | thirdParty/eigen-3.4.0/doc/examples/tut_matrix_coefficient_accessors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << "Here is the matrix m:\n" << m << std::endl;
VectorXd v(2);
v(0) = 4;
v(1) = v(0) - 1;
std::cout << "Here is the vector v:\n... | ALGO | 0.998573 | 3.664171 |
a546260b-901a-4205-8998-183d74908f85 | OzzieIsaacs/winmerge-qt | ext/boost_1_70_0/libs/compute/perf/perf_stl_inner_product.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
std::vector<... | TEST | 0.991191 | 4.648493 |
701854a6-dd6f-4527-a4c9-0453ad347b50 | ttrknvv/1k2s | ОАиП/Lab_8/zad2.cpp | #include <iostream>
using namespace std;
unsigned short S(unsigned short x);
int main() {
setlocale(LC_ALL, "rus");
unsigned short x;
cout << "Введите x: ";
cin >> x;
cout << "Вывод S(x): ";
cout << S(x);
return 0;
}
unsigned short S(unsigned short x) {
if (x > 100) { return x + 10; }
else { return S(S(x +... | ALGO | 0.999385 | 3.892066 |
fb2e981b-c43c-4bdb-934f-949b154b046d | ZhouZiyuIan/OI-Code | OI Documents/Public Code/2025.5sx/七年级17班刘腾/sleep.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+5;
int n,t,x[N],f[N];
signed main(){
freopen("sleep.in","r",stdin);
freopen("sleep.out","w",stdout)
scanf("%lld%lld",&n,&t);
for(int i=1;i<=n;i++){
scanf("%lld",&x[i]);
f[i]=f[i-1]+x[i];
}
if(t%f[n]==0){
printf("%lld\n0",n);
... | ALGO | 0.999917 | 3.056 |
255cfa8d-03d9-4db8-881e-d18836c72a93 | tasneem-hakeem/RoadEx | 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.998733 | 6.76775 |
aaf61578-114c-4bc7-83c2-52468d47d017 | yl8908/ROCm-composable_kernel | example/16_gemm_multi_d_multi_reduces/gemm_max_xdl_int4.cpp | #include "gemm_reduce_xdl_common.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_gemm_multiple_d_multiple_r_xdl_cshuffle.hpp"
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
using ADataType = INT4;
using ADataK... | ALGO | 0.862044 | 5.080616 |
1e3e0ea5-662c-44f0-9568-427861e50376 | JossAlvarado/DMI_Practica14_200687 | 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.998764 | 6.762122 |
c084b632-00b4-47f3-b549-6fa1a05b8484 | kristi141/c-plus-plus-progects | Строки и символьные типы данных/cout elem by num.cpp | /*RU
Условие:
Дано число. Выведите символ, соответствующий данному числу в ASCII таблице.
ASCII таблица – таблица, в которой некоторым распространённым печатным и
непечатным символам сопоставлены числовые коды.
Входные данные:
На вход даётся натуральное число a (32 < a < 256)
Выходные данные:
В выходной файл должен ... | ALGO | 0.979687 | 3.909528 |
ca126ead-76f2-458c-9acd-1e493ac3a6e5 | DreamyWanderer/Parallel_Computing-CNN_Parellelization-HCMUS | Source/mini-dnn-cpp-master/third_party/eigen/unsupported/doc/examples/MatrixExponential.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix exponential ... | ALGO | 0.999781 | 3.697111 |
3cc20349-73b5-4454-aebb-7c548e9ba665 | phzls/MBL_Floquet | Floquet/main.cpp | #include <iostream>
#include <ctime>
#include <string>
#include "constants.h"
#include "parameters.h"
#include "tasks_models.h"
#include "randomc.h"
using namespace std;
CRandomMersenne RanGen_mersenne(time(NULL));
TasksModels tasks_models; // Record all the tasks and methods
int main() {
AllPara parameters;
/... | ALGO | 0.998722 | 4.657339 |
e0b21d43-ff99-4edd-a028-c19bfd0c8adb | ihsansaif313/cpp | two_matrix_multiplication_function.cpp | #include <iostream>
using namespace std;
const int ROW = 2;
const int COLUMN = 2;
void multiply(int a[ROW][COLUMN], int b[ROW][COLUMN], int mult[ROW][COLUMN])
{
for (int i = 0; i < ROW; ++i)
{
for (int j = 0; j < COLUMN; ++j)
{
mult[i][j] = 0;
for (int k = 0; k < ROW; +... | ALGO | 0.999739 | 4.345501 |
aa43bf60-2d3e-4195-a02b-25e79967fdce | jasveen18/CP-krle-placement-lag-jayegi | 450 DSA Questions/01 Arrays/5RearrangeNumbersAlternating.cpp | // Approach 1 - Sort the array and then arrange
// Note: Loses the initial sequence of array
// Time Complexity - O(N * Log N)
// Space Complexity - O(1)
void rearrangeArr(int arr[], int n) {
// Sort the array
sort(arr, arr + n);
// Get the count of element
int countPos = 0, countNeg = 0;
for (int i = 0; i < n; i... | ALGO | 0.999985 | 5.191764 |
499532c0-92c8-4e28-b299-ab6a82b08fd1 | pooja-169/Leetcode-Solution | 0229-majority-element-ii/0229-majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int n = nums.size();
int m = n / 3;
unordered_map<int, int> freq;
vector<int> result;
for (int num : nums) {
freq[num]++;
}
for (auto& pair : freq) {
if (pair.se... | ALGO | 0.999913 | 6.184942 |
adbce783-36c3-401a-8dee-e7bc31b07855 | Chillee/CompProgramming | ACMPractice/11.10/F/main.cpp | #include <bits/stdc++.h>
using namespace std;
int T, N;
vector<pair<int, string>> cur;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> T;
for (int t = 0; t < T; t++) {
cur.clear();
cin >> N;
map<string, int> cnt;
for (int i = 0; i < N; i++) {
str... | ALGO | 0.998982 | 4.21599 |
bf6ed01f-efbf-4796-b0ff-e96fadacb781 | zhaoxiaohui/LeetCode | Wildcard Matching.cpp | /**
* Description:
* Author: zhaoxiaohui
* Site: zhaoxiaohui.sinaapp.com
* Date: 2014
*/
class Solution {
public:
bool isMatch(const char *s, const char *p) {
//return isMatchCir((char *)s, (char *)p);
return isMatchRe((char *)s, (char *)p);
}
bool isMatchRe(char *s, char *p){
... | ALGO | 0.999945 | 4.098131 |
dd09cdf5-416f-473f-b1c6-f4ffd5f9c15d | Upadhyayayush30/LeetCode-Solutions | 169-majority-element/majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int n = nums.size();
int ctr=0;
int elem=0;
for(int i=0;i<n;i++){
if(ctr==0){
elem=nums[i];
ctr=1;
}
else if(elem==nums[i]){
ctr++;
... | ALGO | 0.999856 | 5.648087 |
92a87f22-5927-4473-beb4-406c46dd5bf1 | Gongsta/competitive-programming | codeforces/harbourspace2021-2022/D.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
string s,t;
// Okay, so you need to go from right to left... to try again
bool solve(int i, int j) {
// cout << i << " " << j << endl;
if (j == t.length() && i <=s.length()) return(s.length() - i) % 2 == 0;
if (i >= s.length()) return ... | ALGO | 0.999972 | 4.510705 |
7075804d-7b2c-4bfd-9f5b-c6b548034e5d | PelleJuul/yaybahar | source/Yaybahar.cpp | #include <stdio.h>
#include <cmath>
#include <vector>
#include "../pal/pal.h"
#include "BowedString.h"
#include "Spring.h"
#include "Connection.h"
#include "RadialPlate.h"
#include "RectMembrane.h"
// pal build Yaybahar.cpp BowedString.cpp Connection.cpp LineDomain.cpp RadialDomain.cpp Spring.cpp Domain2d.cpp RectMemb... | ALGO | 0.95321 | 5.128003 |
0d28059b-c2a8-4a6a-9503-e3bf0953e9b7 | MDNROnik/DSA-Solves | 1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.cpp | class Solution {
public:
int findTheCity(int n, vector<vector<int>>& edges, int thr) {
vector<vector<pair<int,int>>>v(n);
int m=edges.size();
for(int i=0;i<m;i++){
int from = edges[i][0];
int to = edges[i][1];
int weight = edges[i][2];
v[from].... | ALGO | 0.999998 | 5.959332 |
cccd0880-af0c-4425-a10b-e82854026adb | MdAminourIslam/Algorithm-Design-and-Analysis | Floyd Warsahll.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 1e9 // Representing infinity for unreachable nodes
void floydWarshall(int n, vector<vector<int>>& graph) {
vector<vector<int>> dist = graph; // Initialize distance matrix with graph weights
// Floyd-Warshall algorithm
for(int k = 0; k < n; ++k) { ... | ALGO | 0.999992 | 5.083652 |
36844d33-a231-4a97-a1d1-099fbb049bc4 | Piyush-123456/Dynamic-Programming | Perfect Square.cpp | class Solution {
public:
int solve(int n) {
if (n == 0) {
return 1;
}
if (n < 0) {
return 0;
}
int i = 1;
int end = sqrt(n);
int ans = INT_MAX;
while (i <= end) {
int perfectsq = i * i;
int perfectsqrec ... | ALGO | 0.999968 | 5.808048 |
98e2593e-ebd2-4405-aa6a-e74048b883ee | SebasNadu/42_cpp_module09 | ex02/src/main.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | TEST | 0.987719 | 5.860314 |
07187f22-160e-4074-92f3-b02c3d142f0d | sakshamagarwalm2/DSA_Py_Cpp | DSA.cpp/07 Queue/03_Oueue_Stack.cpp | //manking a queue using stack
#include<bits/stdc++.h>
using namespace std;
//creating a class queue
class Queue{
stack<int> s1, s2;
public:
void enqueue(int x){
s1.push(x);
}
int pop(){
if(s1.empty() and s2.empty()){
cout<<"Queue is empty\n";
return -1;
... | ALGO | 0.998623 | 4.648282 |
ffabb523-8a00-43bd-90db-bab044a9e081 | hmwang2002/Algorithm-Learning | leetcode/leetcode-98.cpp | #include <bits/stdc++.h>
#include "datastructure.h"
using namespace std;
class Solution
{
public:
// 官解的这个效率还不如我自己写的,但是简洁确实简洁
// bool helper(TreeNode *root, long lower, long upper)
// {
// if (root == nullptr)
// return true;
// if (root->val <= lower || root->val >= upper)
... | ALGO | 0.999998 | 6.06355 |
93889571-cdb8-4faf-980d-420898c6a747 | PranitChawla/ACM-ICPC-Regionals-Codes | deadlysin.cpp | #include <iostream>
using namespace std;
long long int chocolatesleft (long long int x,long long int y)
{
// if (x<=0||y<=0||x==y)
// return (x+y);
// else
// {
// if (x<y)
// return chocolatesleft(x,y-x);
// else
// return chocolatesleft(x-y,y);
// }
// while (1)
// {
// if (x<=0||y<=0||x==y)
... | ALGO | 0.999925 | 5.083166 |
f8d997dc-e1e7-438c-a0c6-7a3a4dc24aa8 | fwdzh/cp_code | Codeforces/2053/D.cpp | // Author: Zhangwuji
// Date: 2025-01-24
// Time: 01:27:55
// #define YUANSHEN
#if defined(YUANSHEN)
#include "C:/cp_code/template/debug.hpp"
#else
#include <bits/stdc++.h>
using namespace std;
#define dbg(...) 42
#endif
template <typename T1, typename T2>
void cmin(T1& x, const T2& y)
{
x = x < y ? x : y;
}
templ... | ALGO | 0.999939 | 4.566969 |
7cb08446-ed88-4e4d-9753-dbd292862139 | Nakib-Arman/CSE318---ArtificialIntelligence | 3.ChainReaction/.history/main_20250610112350.cpp | #include <bits/stdc++.h>
using namespace std;
#define DEPTH 2
class Cell {
int orb_num;
int critical_mass;
char color;
public:
Cell() {
this->orb_num = 0;
this->color = 'W';
this->critical_mass = 4;
}
// Cell(int orb_num, char color) {
// this->orb_num = orb_... | ALGO | 0.999347 | 4.582916 |
f8015e50-4a33-4b57-9c0b-ce3e22123699 | minho511/cpp_algorithm_sol | 코딩 테스트 준 - 기초/브루트 포스/1748.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, t;
int result = 0;
cin >> n;
t = (int)log10(n);
cout << t << endl;
for(int i = 0; i<=t; i++){
result += (i)*(pow(10, i-1))*9;
}
result += (n-pow(10, t)+1)*(t+1);
cout << result<<'\n';
} | ALGO | 0.999825 | 4.116956 |
a95831d6-3460-4da3-b30c-71bed4988bc5 | wrisov/Leetcode_problems | 117-populating-next-right-pointers-in-each-node-ii/populating-next-right-pointers-in-each-node-ii.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.999825 | 5.715009 |
12e3b5ab-aa43-4230-afe2-f0368f07f356 | HugoMontanes/VoronoiGeneticGeneration | libraries/opencv/sources/3rdparty/openexr/Imath/ImathRandom.cpp | //-----------------------------------------------------------------------------
//
// Routines that generate pseudo-random numbers compatible
// with the standard erand48(), nrand48(), etc. functions.
//
//-----------------------------------------------------------------------------
#include "ImathRandom.h"
#include "... | ALGO | 0.992209 | 5.479693 |
a85ab14e-988b-4366-9c40-7bfe1535739f | sandeshkhadase/Leetcode-Solutions | Leetcode Solutions/solution/0300-0399/0348.Design Tic-Tac-Toe/Solution.cpp | class TicTacToe {
private:
int n;
vector<vector<int>> cnt;
public:
TicTacToe(int n)
: n(n)
, cnt(2, vector<int>((n << 1) + 2, 0)) {
}
int move(int row, int col, int player) {
vector<int>& cur = cnt[player - 1];
++cur[row];
++cur[n + col];
if (row == ... | ALGO | 0.999964 | 6.519902 |
637b9107-c1d0-4c48-a4ec-aa11dc0d64d7 | ragib04/DSA | 0033-search-in-rotated-sorted-array/0033-search-in-rotated-sorted-array.cpp | class Solution {
public:
int search(vector<int>& arr, int k) {
int n = arr.size();
int low = 0, high = n - 1;
while (low <= high) {
int mid = (low + high) / 2;
if (arr[mid] == k) return mid;
if (arr[low] <= arr[mid]) {
if (arr[low] <= k && k <= arr[mid]) {
... | ALGO | 0.999969 | 5.835408 |
37c4c47f-f569-4d48-8b98-99beaab36a3d | Nakib-Arman/CSE318---ArtificialIntelligence | 3.ChainReaction/.history/main_20250610090805.cpp | #include <bits/stdc++.h>
using namespace std;
#define DEPTH 5
class Cell {
int orb_num;
int critical_mass;
char color;
public:
Cell() {
this->orb_num = 0;
this->color = 'W';
this->critical_mass = 4;
}
// Cell(int orb_num, char color) {
// this->orb_num = orb_... | ALGO | 0.998349 | 4.708044 |
94bf782b-0528-4913-ae51-951d19d46a53 | w-mancong/digipen_portfolio | Year 2/Trimester 1/CSD2180 - OS/Assignment3/testcases/t3.cpp | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include "new-coro-lib.h"
/* prototype for thread routine */
void *print_message_function ( void *ptr );
/* struct to hold data to be passed to a thread
this shows how multiple data items can be passed to a thread */
typedef struct str_thdata
{
int thread... | TOOL | 0.87613 | 5.223717 |
15dd5106-659c-4a39-96d0-7468415c3f4f | Maple-Yorkin/DataStructure | LeetCode/2296.cpp | #include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
class TextEditor
{
public:
stack<char> right;
string tempstr = "";
struct Node
{
Node *prev;
char c;
Node(char ch = '\0', Node *p = nullptr) : c(ch), prev(p) {}
} *list, head;
int length;
... | ALGO | 0.994064 | 3.868078 |
21b103fd-8d69-4758-80c4-c70f5bbe1c2f | kmjp/procon | codeforce/951-1000/952/g4.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.999471 | 3.759153 |
a3fe1590-7e90-41aa-8474-5ae8191af48e | qpwoeirut/competitive-programming | Codeforces/Contest/Div2/1195/1195c/1195c.cpp | /*
* 1195c.cpp
*
* Created on: Jul 17, 2019
* Author: Stanley
*/
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
int main() {
int N;
cin >> N;
LL h[2][100001];
for (int i=0; i<N; i++) {
cin >> h[0][i];
}
for (int i=0; i<N; i++) {
cin >> h[1][i];
}
LL mh[2... | ALGO | 0.999959 | 3.640629 |
0673f241-48a6-4e07-8b77-1956640ea98b | Nabzs/S2_Prog | TDS/src/TD7/graph.cpp | #include "graph.hpp"
#include <stack>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <iostream>
namespace Graph {
void WeightedGraph::add_vertex(int const id) {
if (adjacency_list.find(id) == adjacency_list.end()) {
adjacency_list[id] = {};
}
... | ALGO | 0.999153 | 5.439275 |
b558b15b-3a1d-427a-bb50-de25767ede2f | pedro-ricardo/couenne | Ipopt/src/Algorithm/Inexact/IpInexactTSymScalingMethod.cpp | #include "IpoptConfig.h"
#include "IpInexactTSymScalingMethod.hpp"
#include "IpTripletHelper.hpp"
namespace Ipopt
{
#if COIN_IPOPT_VERBOSITY > 0
static const Index dbg_verbosity = 0;
#endif
bool InexactTSymScalingMethod::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
return tr... | TOOL | 0.973968 | 7.114157 |
5a602e1f-bb5a-40b1-80d4-e7b0acc1ca46 | praisebak/algorithm-study | algorithm_code/cpp/sort_b10989.cpp | #include <iostream>
using namespace std;
int num[10000001];
int numFreq[10000001];
void countingSort()
{
}
int main()
{
int n = 0;
cin >> n;
for(int i=1;i<=n;i++)
{
cin >> num[i];
numFreq[num[i]]++;
}
}
| ALGO | 0.999901 | 4.329596 |
7c32f40f-24b0-47e7-b8e5-105d4025844f | oonchulip97/robotics_software_engineer_nanodegree_udacity | path_planning/minkowski_sum/src/minkowski_sum.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include "../lib/matplotlibcpp.h"
#include <math.h>
using namespace std;
namespace plt = matplotlibcpp;
// Print 2D vectors coordinate values
void print2DVector(vector<vector<double> > vec)
{
for (int i = 0; i < vec.size(); ++i) {
cout << "(";
... | ALGO | 0.999558 | 5.576288 |
71f904d7-42d4-4a98-80af-7f783ce3dc8c | mchong6/neural | test.cpp | #include <vector>
#include <time.h>
#include <stdlib.h>
#include <iostream>
std::vector<std::vector<int> > multiply(std::vector<std::vector<int> >A, std::vector<std::vector<int> > B)
{
std::vector<std::vector<int>> C;
for (int i = 0; i < A.size(); i++)
{
std::vector<int>column;
for(int j = 0; j < B[0].size(); j... | ALGO | 0.999515 | 3.530955 |
b147379e-d758-4a3d-8cc9-ac9a9d53538d | jric2002/algorithms | codeforces/low_difficulty/difficulty_900/9.game_with_sticks_[451A]/game_with-sticks.cpp | #include <iostream>
#include <algorithm>
/* Author: José Rodolfo (jric2002) */
using namespace std;
/* Declaration */
int main() {
int n, m;
cin >> n >> m;
if ((min(n, m) % 2) == 0) {
cout << "Malvika" << endl;
}
else {
cout << "Akshat" << endl;
}
return 0;
}
/* Definition */ | ALGO | 0.999829 | 3.471123 |
6c1cde29-7e37-4618-b34c-a4438a91174a | Temka300/University-Codes | 1-1. Fundimentals of Programming/homework/biy daalt/3/5.cpp | #include <iostream>
bool is_perfect(int n) {
if (n < 6) {
return false;
}
int sum = 1;
for (int i = 2; i <= n / 2; i++) {
if (n % i == 0) {
sum += i;
}
}
return sum == n;
}
int main() {
std::cout << "Dugaar oruulna uu: ";
int n;
std::cin >> n;
int numbers[n];
... | ALGO | 0.997847 | 4.30512 |
d1feba6b-f672-43f0-9853-e495761bb3e3 | Rushiiiikutex/Data-Structures-Algorithms | LinkedList/doubly_linked_list.cpp | #include <iostream>
using namespace std;
struct DNode {
int data;
DNode* prev;
DNode* next;
DNode(int val) : data(val), prev(nullptr), next(nullptr) {}
};
class DoublyLinkedList {
public:
DNode* head;
DoublyLinkedList() : head(nullptr) {}
void insertAtEnd(int val) {
DNode* newNod... | ALGO | 0.999597 | 6.185154 |
6a8e11fa-7380-4bde-86e1-5f4afc61a116 | aBeeHivee/llms_code_generation_comparision | llm_generated_code/ChatGPT/CPP/Level2/Q15.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int main() {
vector<string> nameTags = {"Alice", "Bob", "Alice", "Charlie", "Bob", "Alice"};
unordered_map<string, int> nameCount;
for (const string& name : nameTags) {
nameCount[name]++;
}
for (const auto... | ALGO | 0.99829 | 5.785897 |
bd456dce-f945-4074-a548-86eac4ac1fb7 | ThiagoFBastos/programacao-competitiva | cses/Counting Grids.cpp | #include "bits/stdc++.h"
using namespace std;
const int mod = 1e9 + 7;
long long exp(long long n, long long p) {
long long a = 1;
for(; p > 0; p >>= 1) {
if(p & 1) a = a * n % mod;
n = n * n % mod;
}
return a;
}
signed main() {
ios_base :: sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
... | ALGO | 0.999948 | 4.662522 |
0e0d49cc-2ca8-4106-a18d-e2940598cafc | raincross7/code-similarity | codes/train_code/problem262/problem262_111.cpp | #include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // in... | ALGO | 0.999995 | 3.651136 |
32a8c031-7c7c-4e33-b91e-f33a3e1fa53c | bhushanzade02/CPP-CODES | 07_LEETCODE/01_LEETCODE_QUESTIONS/27_136. Single Number.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int ans =0;
for(auto n: nums)
{
ans^=n;
}
return ans ;
}
}; | ALGO | 0.999934 | 5.504084 |
bca93a5b-5a91-4664-97a0-4c682b50199f | wwyf/somecode | Cpp-Primer-master/ch10/ex10_16.cpp | //
// @author @Yue Wang @pezy
// @date 02.12.2014
//
// Exercise 10.16:
// Write your own version of the biggies function using lambdas.
//
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
// from ex 10.9
void elimdups(std::vector<std::string> &vs)
{
std::sort(vs.begin(), vs.end());
... | ALGO | 0.99412 | 6.16148 |
7d9d2a82-041b-4c5a-9c70-0afca4e9783c | ipatriciahonorato/modulo4 | .ccls-cache/@home@runner@CoordinatedLumpyExtensions/exercicio 4.cpp | /*
4 - Faça duas funções que recebem um vetor com 4 posições que contém o valor da distância de um pequeno robô até cada um dos seus 4 lados.
A primeira função deve retornar a direção de maior distância ("Direita", "Esquerda", "Frente", "Tras") e a segunda função deve retornar esta maior distância.
*/
#include <iostre... | ALGO | 0.999882 | 4.346213 |
f4bde7d7-a06c-4759-974f-f4fc610e1fe4 | jnalanko/syotti | src/test_FM_index.cpp | #include "FM_index.hh"
#include "stdlib_printing.hh"
#include "util.hh"
#include "throwing_streams.hh"
#include <gtest/gtest.h>
#include <cassert>
TEST(FM_index_test, serialization){
vector<string> seqs;
seqs.push_back("ABBABCABACBACB");
seqs.push_back("AABAB");
seqs.push_back("BACBACBA");
FM_inde... | TEST | 0.900352 | 6.190325 |
8bb39ae9-6344-4040-aff2-33fbf2a8f2c8 | tangodown1934/Algorithm-judge | 20150723/안전 영역.cpp | #pragma warning(disable:4996)
#include <stdio.h>
/*
߿ 2
1. pop ϱ empty Ȯ ϰ pop
2. 迭
*/
#define SIZE 111111
int res[SIZE];
int map[111][111];
int tempMap[111][111];
int visited[111][111];
int N, HEIGH;
int pX[] = { 0, -1, 0, +1 };
int pY[] = { -1, 0, +1, 0 };
typedef struct q
{
int x[SIZE];
int y[SIZE];
int... | ALGO | 0.99978 | 3.91996 |
8ac7d4f8-d603-41d3-ace1-72700dc98c29 | wuyafei/leetcode | leetcode/mergeTwoLists.cpp | #include"util.h"
using namespace std;
/*
Merge two sorted linked lists and return it as a new list.
The new list should be made by splicing together the nodes of the first two lists.
*/
//ListNode* mergeTwoLists(ListNode* l1, ListNode* l2){
// if (!l1)
// return l2;
// if (!l2)
// return l1;
// ListNode *p1, *p2;
//... | ALGO | 0.999658 | 5.403466 |
935ccfe6-d0f7-467d-bdf6-b3e82f567577 | LauraRosaMedina/Prueba1 | tests/syntax-tests/source/Cpp/test.cpp | #include <bits/stdc++.h> // includes most of the useful libraries
#include "mainwindow.h"
using namespace std;
/* This C program was submitted to help bat
* with its syntax highlighting tests
*/
bool test_function(int x, int y)
{
return (x == y || x + y == x * y);
}
MainWindow::MainWindow(QWidget *parent)
... | ALGO | 0.99996 | 3.703489 |
a5bb771b-7bf0-4ae4-bb27-7fc610e248eb | TravHaran/premium_algo_100_cpp | matrix/lonely_pixel_I/solution.cpp | #include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
class Solution {
public:
int findLonelyPixel(vector<vector<char>>& picture) {
// iterate through matrix
// have a set where we store the rows where we encounter pixel
// have a set where we store the co... | ALGO | 0.998482 | 5.806874 |
7f89173a-78e5-4fa5-8110-38eb93b229cd | selena02/Algoritmi-Fundamentali | Tema 3 obligatorie/problema 3 obligatorie/main.cpp | //O(VE^2)
#include <iostream>
#include <fstream>
#include <vector>
#include <climits>
#include <queue>
using namespace std;
ifstream fin("harta.in");
ofstream fout("harta.out");
vector<vector<int>> LA;
int capacitate[201][201];
vector<int> tata;
int n,s,t;
bool bfs()
{
vector<bool> viz(2*n+1);
queue<int> q;
... | ALGO | 0.999936 | 3.489436 |
894c7d00-ef9e-4480-b69d-25c0c572142d | ishandutta2007/codeforces | kevin114514/normal/573/E.cpp | #include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (in... | ALGO | 0.999951 | 3.612992 |
f6bfc1ce-d001-4c99-b229-aa78ce8957b6 | Joseescalon/Informatica-2020 | Lab5.cpp | #include <iostream>
#include<math.h>
using namespace std;
function int* copiar(int* valores, int cantidad){
int* arreglo = (int*)malloc(cantidad*sizeof(int));
for(int i = 0; i < cantidad; i++){
arreglo[i] = nuevo_arreglo[i];
}
return arreglo;
}
function int*primos(const int maximo){
i... | ALGO | 0.999869 | 3.714805 |
6f456f66-775b-4ff1-ac39-64ccfedf4d37 | T0peerakarn/competitive-programming | AtCoder/abc212_E.cpp | #include <bits/stdc++.h>
using namespace std;
#define mod 998244353
long long dp[5050][5050];
vector<int> g[5050];
int main()
{
int n, m, k;
scanf(" %d %d %d",&n,&m,&k);
while(m--)
{
int u, v;
scanf(" %d %d",&u,&v);
g[u].push_back(v), g[v].push_back(u);
}
long long prv... | ALGO | 0.999975 | 4.890104 |
05c9786e-2fdf-4aff-b3ad-09cbb6f29366 | yousuf-cse-bd/RandomCodes | TicTacToeDynamic.cpp | /**
* @file TicTacToeDynamic.cpp
* @author Md. Yousuf Ali (<EMAIL>)
* @brief Game Project: Tic Tac Toe dynamically using 2D character type array
* @version 0.1
* @date 2022-09-04
* @since ThursDay; 09:09 AM
* @copyright Copyright (c) 2022
* Dept. of CSE, Varendra University, Rajshahi, Bangladesh
*/
#include <... | ALGO | 0.969354 | 4.419489 |
cf899cd8-4a0b-44ea-a19e-63502826fc65 | xiangbingquan/code | Codeforce/Round 904 Div2/A_Treasure_Chest.cpp | #include<bits/stdc++.h>
using namespace std;
void solve()
{
int x,y,k;
cin>>x>>y>>k;
if(x>=y)
{
cout<<x<<'\n';
}
else
{
if(x+k>=y)
{
cout<<y<<'\n';
}
else
{
cout<<y+y-(x+k)<<'\n';
}
}
}
int main()
{
i... | ALGO | 0.999745 | 3.784545 |
3d95358a-5aa8-4527-9942-4651b60b6f9d | google-code-export/assaultcuber | source/src/worldocull.cpp | // worldocull.cpp: occlusion map and occlusion test
#include "cube.h"
#define NUMRAYS 512
float rdist[NUMRAYS];
bool ocull = true;
float odist = 256;
void toggleocull() { ocull = !ocull; }
COMMAND(toggleocull, "");
// constructs occlusion map: cast rays in all directions on the 2d plane and record distance.
// do... | ALGO | 0.998448 | 7.681443 |
8121222c-f991-46d1-833b-02e35024af85 | gpzero/android_frameworks_base | media/libstagefright/codecs/amrwb/src/oversamp_12k8_to_16k.cpp | /*
------------------------------------------------------------------------------
Filename: oversamp_12k8_to_16k.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
----------------------------------------------------------------... | ALGO | 0.998753 | 6.131341 |
12b2e310-4bbb-4bb7-b20f-f520299103e8 | akhilkammila/leetcode-screenshotter | editorial_code/1-999/732. My Calendar III/cpp-2.cpp | class MyCalendarThree {
private:
map<int, int> starts;
int res;
public:
MyCalendarThree() {
starts[0] = 0, starts[1e9 + 1] = 0;
res = 0;
}
void split(int x) { starts[x] = (--starts.upper_bound(x))->second; }
int book(int start, int end) {
split(start), split(end);
... | ALGO | 0.999973 | 5.542698 |
5e24533c-cb7f-4282-8c69-11f0db7d388b | rajeevt09/AlgorithmsCode | trees/postorder.cpp | #include <iostream>
#include <stack>
using namespace std;
struct Node {
int val;
Node* left;
Node* right;
Node(int v):val(v),left(nullptr), right(nullptr) {}
};
class NodeNew
{
public:
Node *m_pnode = nullptr;
char m_c;
NodeNew(Node *p,char c):m_pnode(p),m_c(c){};
~NodeNew(){};
};
/*
... | ALGO | 0.999965 | 5.204187 |
0f5e2b3d-bad1-42e9-ad76-0d0f2658fc59 | AkshaySumbare/C-DSA- | C++Programming/Complete C++ DSA/lecture43-PillarsofOOPs/Polymorphism.cpp | #include <iostream>
using namespace std;
//*************************Polymorphism*******************
/*
meaning-> existing many forms
eg. father and his relations
Types-> Compile time Polymorphism
Run-Time Polymorphism
*/
// ***********1) Compile time Polymorphism ->********** in this we have ide... | ALGO | 0.983589 | 3.570982 |
19b1d1f9-8f2d-4f86-9ee0-41a47c31acb0 | azpeteryang/leetcode | Design/631.Design-Excel-Sum-Formula/631.Design Excel Sum Formula.cpp | class Excel {
vector<vector<int>>Table;
unordered_map<string,vector<string>>Map;
public:
Excel(int H, char W)
{
Table = vector<vector<int>>(H+1,vector<int>(W-'A'+1,0));
}
void set(int r, char c, int v)
{
if (Map.find(to_string(r)+c)!=Map.end())
Map.era... | ALGO | 0.996249 | 4.703142 |
1d70f0a3-8d4b-41fe-8d3b-13d9df8d2a60 | ReadnThink/algorithm | cpp/그래프_DFS_BFS/트리/인접리스트_출력.cpp | #include <iostream>
#include <vector>
using namespace std;
const int V = 10;
vector<int> adj[V];
bool visited[V];
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
adj[0].push_back(1); adj[0].push_back(2); adj[0].push_back(3);
adj[1].push_back(0); adj[1].push_back(2);
adj[2].push_bac... | ALGO | 0.996013 | 3.65897 |
d39eb82b-2816-4121-b811-0608235bd94a | guohuhu/LibRtspClient | librtspclient/libRtspAccess/live/liveMedia/RTSPServerSupportingHTTPStreaming.cpp | #include "RTSPServerSupportingHTTPStreaming.hh"
#include "RTSPCommon.hh"
#ifndef _WIN32_WCE
#include <sys/stat.h>
#endif
#include <time.h>
RTSPServerSupportingHTTPStreaming*
RTSPServerSupportingHTTPStreaming::createNew(UsageEnvironment& env, Port rtspPort,
UserAuthenticationDatabase* authDatabase, unsigned r... | WEB | 0.850181 | 6.671555 |
429720e2-e08f-42cb-baee-a923c45678bd | thegabbythemaster/Lab-5 | Lab 5/TaskB/main.cpp | #include <iostream>
using namespace std; //function for comparing and printing if dividible
bool isPrime(int n){
if(n<2){
return false;
}
bool hold = true;
for (int i=2; i<n; i++){
if(n% i==0) {
hold = false;
}
}
return hold;
}
int main() {
int n;
bool answer;
cout <<"enter a number: " << ... | ALGO | 0.998355 | 3.533471 |
ee27f467-87fc-49b3-9e6a-07061494eda6 | sarvex/leetcode-java | lcof/面试题32 - II. 从上到下打印二叉树 II/Solution.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<vector<int>> levelOrder(TreeNode* root) {
vector<vector<int>> ans;
if (!... | ALGO | 0.999991 | 6.354012 |
ef2f26da-3603-4573-8df8-e564d02c66ac | bsc-mem/Mess-Paraver | libs/boost_1_79_0/tools/bcp/scan_licence.cpp | #include "licence_info.hpp"
#include "bcp_imp.hpp"
#include "fileview.hpp"
#include <fstream>
#include <iostream>
const int boost_license_lines = 3;
static const std::string boost_license_text[boost_license_lines] = {
"Distributed under the Boost Software License, Version 1.0. (See",
"accompanying file LICENSE_1_0... | TOOL | 0.959085 | 6.782909 |
9bfbd9c5-74ca-4d82-983d-4757af8d67a8 | GeneLiuXe/PIKACHU-CODE | ACM-Templates/07_计算几何/04_点与凸包的切线.cpp | // ---
// 题意:\\
// 给定一个 $n$ 个点的凸包,再给出 $m$ 个光照点,每个光照点的照射范围为 $360$ 度,问最少选取几个光照点可以照亮整个凸包,要求输出方案,保证不会出现一个光照点位于凸包的延长线上,共 $200$ 组数据。$(1\leq n,m\leq 1000)$\\
// \\
// 思路:\\
// 其实这题思路比较明显,就是先求出每个光照点所能照射到的一段连续范围,然后问题就变成了给定一个长度为 $n$ 的环形区域,以及 $m$ 段区间,要求选取最少的区间覆盖整个区域。\\
// \\
// 首先求每个光照点对应的一段连续区域,比赛时的思路是极角排序,然后选择最两边的边。这样的复杂度是 $O(n... | ALGO | 0.999993 | 3.817355 |
1c746dcf-de34-4b7f-8c30-608c60ac4f8d | AntimaTiwari07/LeetCode | 0297-serialize-and-deserialize-binary-tree/0297-serialize-and-deserialize-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Codec {
public:
void traverse(TreeNode* root,string &inorder,string & preorder){
if(root==NULL)return ;
... | ALGO | 0.999732 | 6.455016 |
c2130b6f-37d8-4ade-9d35-7752c53395f7 | nadinnah/flutter-dice-roller | 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.998809 | 6.763549 |
d9262789-0a88-4cce-9084-0c8f025b23e6 | Junichi-MARUYAMA-1984/algorithm_and_data_structure | chapter5-5-8.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
template<class T> void chmin(T& a, T b) {
if (a > b) {
a = b;
}
}
const int INF = 1 << 29; // 十分大きな値。ここでは2^29
int main() {
// 入力
string S, T;
cin >> S >> T;
// DPテーブル定義
vector<vector<int>> dp(S.size() + ... | ALGO | 0.99995 | 5.209488 |
5015767f-2ee6-479b-80a2-041677e49993 | Sobhyz/CodeForces-ProblemSolving | NightAtTheMusem.cpp | #include <iostream>
using namespace std;
int ans=0;
string s;
int main()
{
cin>>s;
char curr='a';
for(int i=0;s[i];i++)
{
ans+=min(abs(s[i]-curr),26-abs(s[i]-curr));
curr=s[i];
}
cout<<ans;
} | ALGO | 0.999822 | 3.231315 |
a72d9445-c265-437c-8408-092e6c6ac02b | Asad-Bin/Solved-problems | lightoj/loj 1157 - LCS Revisited.cpp | // . . . Bismillahir Rahmanir Rahim . . .
# Editorial:
First of all, we need to check how dp table for finding lcs works. If we understand that,
then we can calculate number of occurance of some particular length of lcs in range [0, i] from a and [0, j] from b.
now if a[i] == b[j]: dp[i][j] increases by 1 from dp[i... | ALGO | 0.99998 | 5.470818 |
df047a95-8401-44be-afd5-41d54b0c6db4 | magnusjungersen/life_tracker | life_tracker/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.998204 | 6.771107 |
46bec9c7-e530-41f2-8f5c-54a1d086e2f9 | Abrshfantsh/Login | 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.998757 | 6.771107 |
a0e13e96-92c9-4af5-883e-9af9926b2ccd | ToymanShikhar/dsa-bootcamp | 2021/13nov/Leetcode/828.count-unique-characters-of-all-substrings-of-a-given-string.cpp | #include <bits/stdc++.h>
using namespace std;
/*
* @lc app=leetcode id=828 lang=cpp
*
* [828] Count Unique Characters of All Substrings of a Given String
*/
// @lc code=start
class Solution {
public:
int uniqueLetterString(string s) {
int n = s.length();
int last[26][2];
memset(last... | ALGO | 0.999762 | 6.707023 |
ed2ffe89-63d4-45b1-a637-71ba4afa6e83 | jadielam/hackerrank | c++/learning/09-attribute_parser.cpp | #include <stack>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include "../utils/string.cpp"
#include "../utils/debug.cpp"
using namespace std;
struct Tag {
string name;
map<string, Tag> child_tags;
map<string, string> attributes;
};
struct Query {
vector... | ALGO | 0.996076 | 4.447239 |
e3187423-e067-4899-9d5c-f1bbbf641a5c | Wsh7Ash/LEETCODE | cpp/c501-1000/823.cpp | class Solution {
public:
int numFactoredBinaryTrees(vector<int>& arr) {
const int MOD = 1e9 + 7;
sort(arr.begin(), arr.end());
unordered_map<int, long> dp;
for(int num : arr){
dp[num] = 1;
}
for(int i = 0; i < arr.s... | ALGO | 0.99996 | 6.445034 |
a2d1f24e-079b-4f67-8fdd-5b4509b57063 | hyeon0121/programmers_problem | 전화번호목록.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
bool solution(vector<string> phone_book) {
bool answer = true;
sort(phone_book.begin(), phone_book.end());
for (int i = 0; i < phone_book.size()-1; i++) {
string number = phone_book[i];
if (numbe... | ALGO | 0.99896 | 5.058682 |
410b2556-78e5-4797-97b2-6367cfdb46d1 | rtajan/pyaf | src/cpp/Module/Synchronizer/Synchronizer_frame/Synchronizer_frame_DVBS2_fast.cpp | #include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include "Module/Synchronizer/Synchronizer_frame/Synchronizer_frame_DVBS2_fast.hpp"
// _USE_MATH_DEFINES does not seem to work on MSVC...
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
using namespace aff3ct::module;
... | ALGO | 0.994855 | 6.482131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.