uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
82906d0f-be02-41d6-abc4-78a4c471a87e | josuerom/Competitive-Programming | Training/UVa/CP3/Introduction/Easy Problems/Easy/12554 - A Special ... Song.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
vector<string> s(n), song;
song.push_back("Happy");
song.push_back("birthday");
song.push_back("to");
song.push_back("you");
for(int i=0; i<n; i++){
cin>>s[i];
}
for(int a=0, cont=0, i=0; a<(ceil(double(... | ALGO | 0.999712 | 3.072133 |
e61e7b5c-5701-4281-9082-2e248c4c0da5 | devmourya44/DSA-Practice | 515-find-largest-value-in-each-tree-row/find-largest-value-in-each-tree-row.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999993 | 6.027912 |
c8292e2c-047d-42c4-ac75-f57acda7e15a | ishandutta2007/codeforces | autumnkite/normal/1153/A.cpp | #include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
int read(){
register int x = 0;
register char f = 1, ch = getchar();
for (; !isdigit(ch); ch = getchar()) if (ch == '-') f ^= 1;
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ '0');
return f ? x : -x;
}
#define N 105
i... | ALGO | 0.999949 | 3.361444 |
094801ce-fd0d-4770-8b60-7771f9bb4cdb | ishandutta2007/codeforces | tlewpdus/normal/1043/D.cpp | #include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;
int n, m;
int perm[10][100100];
int loc[10][100100];
int key[10];
int main() {
... | ALGO | 0.999985 | 3.135074 |
fcf28de1-7905-46fb-aef1-64e760df56a4 | ChoiJangSeop/codenet-c-cpp-codeql-test | cpp/s692759644.cpp | #include <bits/stdc++.h>
using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define ex 1e18
#define dbl... | ALGO | 0.997391 | 3.338043 |
af18a826-d5de-451e-a62a-6a0b29e3e2b6 | kuldeep-97/DSA_CPP | 01_C++/L12_Conversion/Decimal_Octal.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the Decimal No: ";
cin>>n;
int rem,i=1,ans=0;
while(n>0)
{
//Remainder
rem = n % 8;
//diveid
n = n / 8;
//conver ans
ans = rem * i + ans;
i = i * 10;
}
cout<<ans;
} | ALGO | 0.999119 | 3.891855 |
d8e0b428-8c8e-4ad2-a1f1-20861f963851 | Kevin-TD/cis547-lab | cis547vm/lab7/src/ChaoticIteration.cpp | #include "DivZeroAnalysis.h"
#include "Utils.h"
#include <list>
#include <fstream>
#include <iostream>
// make clean ; cmake .. ; make ; cd ../test ; clang -emit-llvm -S -fno-discard-value-names -Xclang -disable-O0-optnone -c test03.c -o test03.ll ; opt -load ../build/DivZeroPass.so -DivZero test03.ll ; cd ../build
... | ALGO | 0.984466 | 5.239838 |
ff08fc8e-fc93-465d-b480-d2adb53f6f32 | ishandutta2007/codeforces | danya090699/normal/878/B.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
main()
{
//freopen("input.txt", "r", stdin);
int n, k, m, an;
cin>>n>>k>>m;
an=n*m;
int ar[n];
for(int a=0; a<n; a++) cin>>ar[a];
int yk=0;
vector <pair <int, int> > sp;
while(yk<n)
{
int cu=ar[yk], q=0;
... | ALGO | 0.999978 | 3.413109 |
b3d981b2-c9a2-4a68-b05a-f6d4fcdea9d5 | mailtoharutyunyan/LeetCode-Solutions | solutions/0128. Longest Consecutive Sequence/0128.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
int ans = 0;
unordered_set<int> seen{nums.begin(), nums.end()};
for (int num : nums) {
// Num is the start of a sequence
if (seen.count(num - 1))
continue;
int length = 1;
while (seen.count(++num))
... | ALGO | 0.999869 | 6.368289 |
790c5e64-6c9a-46e1-b3c4-a39d2f146d1e | manikanta2901/ubuntu | .history/imp/cpp/DataStructures/heap/functions_20200624194654.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> pattern = {30,50,25,100,10,2,5};
make_heap(pattern.begin(),pattern.end()); // to convert into a heap
cout << "The Elements of the Heap is : ";
for(vector<int> :: iterator it = pattern.begin(); it != pattern.end(); it++){
... | ALGO | 0.999149 | 3.462549 |
c434c46f-b931-441d-b52d-543a89d3f42e | VasoyaViraj/CodeForces-Problems | cypher.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<int> initial;
for(int i = 0; i < n; i++){
int temp;
cin >> temp;
initial.push_back(temp);
}
vector<stri... | ALGO | 0.999345 | 5.027186 |
5bf6a5e3-22fe-4f22-a547-acebdc822ca8 | visheshmadan678/DSA- | 342-power-of-four/power-of-four.cpp | class Solution {
public:
bool isPowerOfFour(int n) {
if(n==1)return true;
if(n<=0)return false;
double x = log(n)/log(4);
return floor(x)==x && ceil(x)==x;
}
}; | ALGO | 0.999562 | 5.689767 |
6b8e2c16-e302-4866-9970-fdde4f33d3cb | GauravKr57/Complete-DSA | 1_Mathematics/06_LCM.cpp | #include<bits/stdc++.h>
using namespace std;
//me NAIVE
int lcm(int a, int b){
int res;
int temp= max(a,b);
for(int i=temp;i<=a*b;i++){
if((i%a == 0) && (i%b==0)){
res=i;
break;
}
}
return res;
}
//Efficient (LCMxHCF =product of numbers)
int main(){
co... | ALGO | 0.999903 | 4.300185 |
88d9cf27-05e0-4953-8781-8bb9e8dc46c4 | puneetkumarbajaj/pictoria | 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 |
2ab26da9-cef9-42dc-a1ee-d84e4a5d3eb8 | rayhantmt/Texting-App-Flutter-project | 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 |
49b1ac87-23d5-4db9-b273-0bc166e33ccb | OurLokmanHossen/Competitive_Programming | A_Ambitious_Kid.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int a[n];
for(int i =0; i<n ; i++)
{
cin >> a[i];
}
sort(a, a+n);
// int ans = INT_MAX;
int ans = a[n-1];
for(int i = 0; i<n ; i++)
{
ans = min(ans, abs(a[i]));
... | ALGO | 0.999631 | 3.887751 |
e96cabbd-f6cc-495a-9b03-5dcc9d9c5bdf | bfeng/CryptoGRU | third_party/cryptoTools/thirdparty/linux/boost/libs/geometry/doc/index/src/examples/rtree/quick_start.cpp | //[rtree_quickstart
//[rtree_quickstart_include
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
// to store queries results
#include <vector>
// just for output
#include <iostream>
#include <boost/fo... | ALGO | 0.999054 | 6.698542 |
90eda752-5d01-4efb-aee2-f95d224963f3 | Bl4ck-h00d/DSA_Notes | Scheduling/variation-1.cpp | /**
* N meetings in 1 room
*
* Given schedules of some meetings, return how many max meetings can occur in given 1 room.
*
* Note- We "dont" have to find how many meeting rooms are required (it is fixed at 1) rather find how many meetings can happen in given 1 room
*
* Intuition-> Jo meetings jaldi khatam ho ... | ALGO | 0.999974 | 5.381538 |
197232bb-ae17-4c72-bf0e-fc36419ad5c7 | Akhilesh52/c-program | Week-1 program.cpp | #include <stdio.h>
void calculate_notes(int amount) {
int denominations[] = {2000, 500, 200, 100, 50, 20, 10, 5, 2, 1};
int count[10] = {0};
int total_notes = 0;
for (int i = 0; i < 10; i++) {
if (amount >= denominations[i]) {
count[i] = amount / denominations[i];
total_... | ALGO | 0.999034 | 4.45611 |
85a24995-5460-43c1-a0a1-9c66454cb5d2 | sampritipanda/IOI_Repository | Codeforces/Practice/101367I.cpp | #include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
const int K = 30;
double A[3001];
int N, T;
double dp[3001][31];
double solve(int i, int t) {
if(i == N + 1) return 0;
if(t == K) return 0;
if(dp[i][t] != -1) return dp[i][t];
double ans = 1e18;
double p = 1.0, sum = 0.0, sum... | ALGO | 0.999862 | 4.069416 |
790f4e3c-e4b3-4ae2-bf91-3db59e35598a | acise03/CP | programmingFiles/files/DMOPC '19 Contest 6 P3 - Grade 11 Math.cpp | #include <bits/stdc++.h>
using namespace std;
vector<long long> indexes;
bool visited[500000];
long long nextt[500000];
long long getNext(long long value)
{
if (visited[nextt[value]])
nextt[value] = getNext(nextt[value]);
return nextt[value];
}
int main()
{
long long _S_, M;
string S;
cin >... | ALGO | 0.999971 | 4.146168 |
90cd4df1-b5cc-48c4-9f94-60afef3b68c3 | AryanSharma47/leetcode-solutions | 2807.InsertGCDinLL.cpp | //Simple Approach
class Solution {
public:
ListNode* insertGreatestCommonDivisors(ListNode* head) {
if(head == NULL || head->next == NULL)
return head;
ListNode *temp=head;
while(temp->next != NULL)
{
int a = temp->val;
int b=temp->next->val;
... | ALGO | 0.999935 | 5.244044 |
82242654-3759-4a13-b2c4-7083e274b8b6 | Minipoloalex/comp_prog | codeforces/contests/2121_div3/C/C.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m;
cin >> n >> m;
vector<vector<int>> mat(n, vector<int>(m));
int mx = 0;
int r = 0, c = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> mat[i][j];
if (mat[i][j] > mx) {
... | ALGO | 0.999986 | 5.383281 |
908d0423-ce6e-445d-a7e6-49403a58039d | ldcduc/leetcode-training | cpp/sum-of-root-to-leaf-binary-numbers.cpp | /* Problem url: https://leetcode.com/problems/sum-of-root-to-leaf-binary-numbers
* Code by: ldcduc
* */
/* Begin of Solution */
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* ... | ALGO | 0.999991 | 6.771947 |
12049b05-7a83-4f57-a23f-a337f6b01e2b | wvu-navLab/gnss-ins-zupt | GNSS_INS_ZUPT/3rdparty/GPSTk/core/lib/GNSSCore/GGHeightTropModel.cpp | //============================================================================
//
//This software developed by Applied Research Laboratories at the University of
//Texas at Austin, under contract to an agency or agencies within the U.S.
//Department of Defense. The U.S. Government retains all rights to use,
//duplicat... | ALGO | 0.985423 | 6.697143 |
35b30fe1-d98a-4214-9a11-b04bd7edd7a1 | Ayandip244/CodeSprint2.0 | 85.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cout<<"n = "; cin>>n;
cin.ignore();
vector<vector<int>> adj(n);
for(int i=0;i<n;i++){
string l;
getline(cin,l);
stringstream ss(l);
int x;
while(ss>>x) adj[i].push_back(x);
}
vector<bool> vis(n);
queue<int> q;
vector<i... | ALGO | 0.999826 | 4.216702 |
5962791f-b35c-46d0-af84-1a10bcab74bb | alexandraback/datacollection | solutions_5769900270288896_0/C++/spencer/noisy-small.cpp | #include <bits/stdc++.h>
using namespace std;
int unhappiness(int R, int C, int mask)
{
vector<vector<bool>> building;
building.resize(R);
for (int r = 0; r < R; r++) building[r].resize(C);
for (int i = 0; i < R * C; i++)
{
building[i/C][i%C] = mask % 2;
mask >>= 1;
}
int ... | ALGO | 0.999764 | 4.975073 |
54179141-a92a-46b7-83ee-4d927057e163 | AlyaariHazem/projects-c- | lab 6 3.cpp | #include <iostream>
using namespace std;
main()
{
int x=1,sum,f;
for(x=2;x<=15;x+=2)
{
cout<<x<<" "<<endl;
}
} | ALGO | 0.927082 | 3.455088 |
28cb7460-aed7-4bb7-8921-4e6e28e89175 | joshualass/CP | Solutions/Contests/AC/ABC359/F359.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD = 1e9 + 7;
priority_queue<array<ll,2>, vector<array<ll,2>>, greater<array<ll,2>>> in;
priority_queue<array<ll,2>, vector<array<ll,2>>, greater<array<ll,2>>> out;
array<ll,2> a[200000];
ll res = 0;
void add(ll i) {
... | ALGO | 0.999939 | 3.841708 |
cc0086bc-37f7-45ab-be79-8034ee1b3fd1 | nguyentuss/Competitive-Programming | CP/OnlineJudge/VNOJ/bill.cpp | #include <bits/stdc++.h>
using namespace std;
long long x , y;
int vnd[5] = {0 , 200 , 300 , 500 , 700};
long long kwh[5] = {0 ,100 , 9900 , 990000 , 19000000};
long long changevnd(int a) {
long long tmp = 0 , ans = 0;
for (int i = 1 ; i <= 4 ; i++) {
if (tmp + kwh[i] <= a) {
ans += kwh[i]*vnd[i];
tmp += ... | ALGO | 0.999862 | 3.474284 |
43eeba18-64b2-4e47-be1c-67f0684313e3 | liguigui/kamyu104-LeetCode | C++/linked-list-cycle.cpp | // Time: O(n)
// Space: O(1)
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode *slow = head, *fast = head;
while (fast && ... | ALGO | 0.999866 | 5.521051 |
6aa35d5b-9174-4abe-a0dc-d2f1d4aca1c9 | hjiang13/LLMs-in-IR | POJ-104/80/409.cpp | #include <iostream>
using namespace std;
int main()
{
int s1[12] = {
31,28,31,30,31,30,31,31,30,31,30,31}
;
int s2[12] = {
31,29,31,30,31,30,31,31,30,31,30,31}
;
int y1, y2, m1, m2, d1, d2, flag, sum=0, i;
cin >> y1 >> m1 >> d1;
cin >> y2 >> m2 >> d2;
for(i=y1+1; i<y2; i++)
{
if((i % 4 == 0 && i % 100 != 0) || (i % 400... | ALGO | 0.999977 | 4.029629 |
190fe04d-3009-4404-a415-4e5d3996f889 | krishna4040/DSA | gfg_practice/LinkedList/countNode.cpp | # include "bits/stdc++.h"
using namespace std;
// Given a linked list of size N. The task is to complete the function countNodesinLoop() that checks whether a given Linked List contains a loop or not and if the loop is present then return the count of nodes in a loop or else return 0. C is the position of the node to ... | ALGO | 0.999833 | 3.769072 |
2555506b-58c2-4cad-9064-e51d6adeea34 | scarsty/lammps_m | src/USER-SMD/compute_smd_tlsph_stress.cpp | #include "string.h"
#include "compute_smd_tlsph_stress.h"
#include "atom.h"
#include "update.h"
#include "modify.h"
#include "comm.h"
#include "force.h"
#include "memory.h"
#include "error.h"
#include "pair.h"
#include <Eigen/Eigen>
using namespace Eigen;
using namespace LAMMPS_NS;
/*
* deviator of a tensor
*/
stati... | ALGO | 0.996237 | 6.069672 |
2f6e95c6-917f-413c-8b46-4e3fb03c32c2 | bigyapti/Vatshala_Devi | Camera.cpp | #include "Camera.h"
#include "calc.h"
#include "essential.h"
#include "2D.h"
void Camera::update(Vec4 cameraPosition, Vec4 targetPosition) {
position = cameraPosition;
target = targetPosition;
look = normalize(targetPosition - cameraPosition);
right = normalize(look * Vec4{ 0, 0, 1 }); // these are making the vect... | TOOL | 0.960923 | 4.655951 |
aa81b8d8-955e-4d71-b4c2-7b3bd62c4c98 | JRicaurte1985/CS-235-Data-Structures-Cplusplus | naturalMergesort.cpp | /***********************************************************************
* Program:
* Assignment 18 MergeSort
* Brother Ercanbrack, CS235
* Author:
* Jose Ricaurte
* Summary:
* Natural Mergesort implemented with the STL list. We read numbers from a
* file, store them in a list. We call mergesort on the list... | ALGO | 0.999579 | 4.852633 |
5e9ac1c5-68a6-4afa-9611-ababc10e2e91 | swathiramesh24/Hackerrank_GeeksforGeeks_2025_cpp | g_count_digits.cpp | /*
Given a natural number n. You have to find the number of digits in it and return it.
Examples:
Input: n = 5534
Output: 4
Explanation: 5534 has 4 digits
*/
//solution
nt countDigits(int n) {
int count=0;
while(n>0)
{
count += 1;
n=n/10;
}
return count;
}
| ALGO | 0.999318 | 6.598737 |
c528e977-caf8-4468-a122-af4aad480c89 | chikatlarakesh/Leetcode-Progress | 2106-find-greatest-common-divisor-of-array/find-greatest-common-divisor-of-array.cpp | class Solution {
public:
int GCD(int a,int b)
{
int c=a%b;
if(c==0) return b;
else return GCD(b,c);
}
int findGCD(vector<int>& nums) {
int maxVal=*max_element(nums.begin(),nums.end());
int minVal=*min_element(nums.begin(),nums.end());
return GCD(maxVal,min... | ALGO | 0.999961 | 5.841532 |
8e5ba6bb-ccf0-424d-8721-7bbc3b28ba42 | memade/llvm-project | libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/unique_copy.pass.cpp | // <algorithm>
// template<InputIterator InIter, class OutIter>
// requires OutputIterator<OutIter, RvalueOf<InIter::value_type>::type>
// && EqualityComparable<InIter::value_type>
// && HasAssign<InIter::value_type, InIter::reference>
// && Constructible<InIter::value_type, InIter::reference... | TEST | 0.94992 | 7.043945 |
9b89076c-83c5-437a-8046-7f6aabaa26e6 | Feodor2/Mypal68 | gfx/layers/BSPTree.cpp | #include "BSPTree.h"
#include "mozilla/gfx/Polygon.h"
namespace mozilla {
namespace layers {
void BSPTree::BuildDrawOrder(BSPTreeNode* aNode,
nsTArray<LayerPolygon>& aLayers) const {
const gfx::Point4D& normal = aNode->First().GetNormal();
BSPTreeNode* front = aNode->front;
BSPTree... | ALGO | 0.993942 | 7.110074 |
d10bf20c-65ba-4703-9de9-68555ceaf28e | lyunDev/SR_Project | HyEngine/Source/LinearMath.cpp | #include "StandardEngineFramework.h"
#include "..\Include\LinearMath.h"
// Caution !!!
// ܰ踦 ľ
// ӽ
using namespace LinearMath;
Vector3 Vector3::Rand()
{
Vector3 v = Vector3(MathUtil::RandF(0, 1), MathUtil::RandF(0, 1), MathUtil::RandF(0, 1));
return v.Normalized();
}
const std::string Vector3::Print() const
{... | TOOL | 0.917214 | 5.087691 |
c70d9b69-70b0-4dcf-848b-5c70719b96ff | Shikhar21121999/ds-algo-busted | gasoline_intro.cpp | // template
#include <bits/stdc++.h>
# define C continue
# define R return
# define D double
# define I insert
# define ll long long
# define ld long double
# define ull unsigned long long
# define ui unsigned int
# define pb push_back
# define pf push_front
# define vi vector < int >
# define vc vector < cha... | ALGO | 0.999848 | 3.744746 |
c10da09b-b413-4350-89ac-16377a9d8e91 | Jahangirhussen/Code_Force | Div 2 CodeForce/148A-Insomnia cure.cpp | /**
My Name :JAHANGIR HUSSEN
Country :Bangladesh
Gmail :<EMAIL>
Github Link :https://github.com/Jahangirhussen
WebSite Name :Code Force
Problem Name :A. Insomnia cure
Problem Number :148A
Difficulty :Div 2
Problem Link :https://codeforces.com/problemset/problem/200/B
STATUS ... | ALGO | 0.999739 | 3.314104 |
dcbc3f1e-b698-4529-a8f7-c916eb669b1a | csh-apprentice/Time_Based_SL | tools/phonon/dynmat.cpp |
#include "dynmat.h"
#include "global.h"
#include "input.h"
#include "interpolate.h"
#include "memory.h"
#include "version.h"
#include "zheevd.h"
#include <cmath>
#include <cstdlib>
#include <cstring>
/* ----------------------------------------------------------------------------
* Class DynMat stores the Dynamic M... | ALGO | 0.973114 | 3.848412 |
d87d514d-37ad-42d7-9a04-0a1c4a917d74 | tesion99/LeetCode | cpp/59_generateMatrix.cpp | /*
给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。
示例:
输入: 3
输出:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/spiral-matrix-ii
*/
// 顺时针一圈后,后续重复递归处理流程
class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>> res(n, vect... | ALGO | 0.999835 | 6.230497 |
ca03871d-d830-44df-8a2e-d2f5d7667ec3 | saeid-ebrahimi/Cpp | 07.Functions_and_recursion/19.recursive_factorial.cpp |
#include "stdafx.h"
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
//void test_program();
int read_data();
bool is_int_num(string in_data);
int rec_fact(int n);
int main()
{
//test_program();
int num = read_data();
int result = rec_fact(num);
if (res... | ALGO | 0.999836 | 5.185132 |
994b63d3-987d-495b-ac3e-0f7e6a85396d | HardikNegi9/CodeForces | 1000/A_Helmets_in_Night_Light.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n, k;
cin >> n >> k;
vector<pair<long long, long long>> a(n + 1);
a[n] = {k, n + 1};
for(int i = 0; i < n; i++){
cin >> a[i].second;... | ALGO | 0.999967 | 3.295699 |
c1846dd4-d855-4453-92db-091cd9a90fb6 | anik-ewu/C-O-N-T-E-S-T | Long Contest/DP1/SSS.cpp | #include<bits/stdc++.h>
using namespace std;
int mn;
string s,p;
string ss,ff;
int dp[1001][1001];
int cal(int l, int r){
if(l>=r)return 0;
if(dp[l][r]!=-1)return dp[l][r];
if(s[l]==s[r]) return dp[l][r]=cal(l+1,r-1);
int a=1+cal(l+1,r);
int b=1+cal(l,r-1);
return dp[l][r]=min(a,b);
}
void pat... | ALGO | 0.999989 | 3.949079 |
15137b11-a1b1-416e-8673-e1d121902f75 | HANS-2002/CSES-solutions | Introductory Problems/Number_Spiral.cpp | #include <bits/stdc++.h>
#define int long long int
using namespace std;
signed main()
{
int t;
cin >> t;
while (t--)
{
int r, c;
cin >> r >> c;
int k1 = max(r, c);
int k2 = (k1 - 1) * (k1 - 1);
int ans;
if (k1 & 1)
{
if (r == k1)
... | ALGO | 0.999188 | 4.638206 |
6e178739-59db-4301-b977-9624287c84e9 | slk000/newbie | acm/bjfuoj/src/1021.cpp | //AC
#include <cstdio>
#include <algorithm>
using namespace std;
int main (){
int T;
scanf("%d", &T);
while (T--) {
int sum;
scanf("%d", &sum);;
int numbers[sum];
for (int i = 0; i < sum; i++) {
scanf("%d", &numbers[i]);
}
sort(numbers, numbers+sum);
printf("%d\n", (sum&1)?numbers[sum/2]:numbers[sum... | ALGO | 0.999383 | 4.164458 |
0521dd67-1fd7-4539-be2c-503dae27ba43 | mishra-ji20/Leetcode | 0712-minimum-ascii-delete-sum-for-two-strings/0712-minimum-ascii-delete-sum-for-two-strings.cpp | class Solution {
public:
int minimumDeleteSum(string s1, string s2) {
vector<vector<int>>dp(s1.size()+1,vector<int>(s2.size()+1,0));
for(int i=1;i<=s1.size();i++)
{
dp[i][0]=dp[i-1][0]+s1[i-1];
}
for(int i=1;i<=s2.size();i++)
{
dp[0][i]=dp[0][i... | ALGO | 0.999988 | 6.053937 |
52ff9a39-88f6-4c8e-bca1-06ca18731ea4 | FITCommunity/Programiranje-1 | Ispiti/NPP - 2014×2015/2018-09-10/Grupa B - Zadatak 01.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x;
cout << "Unesite realan broj x: ";
cin >> x;
char izbor;
while (cout << "Izaberte funkciju s - sin, c - cos: ", cin >> izbor, izbor != 's' && izbor != 'c')
cout << "Odabrali ste nepostojucu funkciju" << endl;
... | ALGO | 0.985062 | 3.78512 |
72b24e88-d138-4939-a836-a31042938031 | cwhuang1937/CP | contest/practice/dp/CODEFORCES 1033C Permutation Game/main.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n;
const int maxn = 1e5 + 10;
cin >> n;
int idx[maxn];
int arr[maxn];
bool ans[maxn] = {false};
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
idx... | ALGO | 0.999978 | 4.151873 |
964c2bc0-4732-4d54-9f87-f2ced7072b1e | harsh-solanki21/SI21-CP-MERN | CP (GFG, Leetcode, CodeChef, CSES, etc.)/chefAndQuesries.cpp | #include<bits/stdc++.h>
using namespace std;
bool sleepCycle(vector<int> v, int h) {
for(int i=0; i<v.size(); i++) {
if(h-v[i] <= 0)
return true;
else
h = 2*(h-v[i]);
}
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NUL... | ALGO | 0.998281 | 4.133472 |
94fa10f6-e50f-4c52-867a-226771126eda | hajimeIppo-cmd/cp-codes | Misc/2022 신촌지역 대학생 프로그래밍 대회 동아리 연합 여름 대회 (SUAPC 2022 Summer) Open Contest/J.cpp | #include <bits/stdc++.h>
#include <cassert>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fr first
#define sc second
#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#defin... | ALGO | 0.999924 | 4.427955 |
fbf4d834-8aab-41ef-b6e7-970254a0a8db | HarshCasper/NeoAlgo | C-Plus-Plus/dp/golomb_sequence.cpp | /* C++ program to print the n'th term in the Golomb sequence
Golomb sequence is a non-decreasing integer sequence where n'th
term is equal to the number of times n appears in the sequence */
#include <bits/stdc++.h>
using namespace std;
int golomb_sequence(int n)
{
// Create a dp array, with value initialized as... | ALGO | 0.999948 | 6.333661 |
ef7db37c-c364-46d9-bcb1-895651140532 | jprzywoski/pgaie | Extras/smart_sweepers/CMinesweeper.cpp | #include "CMinesweeper.h"
// -----------------------------------constructor-------------------------
//
// -----------------------------------------------------------------------
CMinesweeper::CMinesweeper()
: m_dRotation(RandFloat() * CParams::dTwoPi), m_lTrack(0.16), m_rTrack(0.16), m_dFitness(0),
m_dScale... | ALGO | 0.998693 | 5.558724 |
76da697d-d4b1-43fe-8b54-584927b25e36 | raincross7/code-similarity | codes/train_code/problem461/problem461_101.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
int main(void)
{
int n;
cin >> n;
vec<int> a(n), b(n, 1);
rep(i, n) cin >> a[i];
sort(a.begin(), a.end());
rep(i, n) {
int p = a[n - 1... | ALGO | 0.999988 | 3.759801 |
87a5453d-b1c8-4519-a913-0260f46db74e | debarghamitraroy/Competitive-Programming | CodeForces/58A. Chat room.cpp | #include <iostream>
using namespace std;
void solve();
int main() {
solve();
return 0;
}
void solve() {
string str;
cin >> str;
int n = str.length();
string temp = "hello";
int i = 0, count = 0;
for (int j = 0; j < n; j++) {
if (str[j] == temp[i]) {
i++;
... | ALGO | 0.999918 | 3.670939 |
56a1c131-622b-4416-aed5-2ed7de5a09ac | CamelliaDPG/Camellia | src/Formulations/SpaceTimeCompressibleFormulation.cpp | //
// SpaceTimeCompressibleFormulation.cpp
// Camellia
//
// Created by Nate Roberts on 10/29/14.
//
//
#include "SpaceTimeCompressibleFormulation.h"
#include "MeshFactory.h"
#include "PenaltyConstraints.h"
#include "PoissonFormulation.h"
#include "PreviousSolutionFunction.h"
#include "CompressibleProblems.h"
#incl... | ALGO | 0.998299 | 4.886595 |
b7801f93-7ed7-4a39-8613-f28f91e7aa9b | yadavankit671/LEETCODE | C++/409.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int longestPalindrome(string s) {
int len = s.length();
if(len == 0) return 0;
if(len==1) return 1;
vector<int> characters(256,0);
for(int i=0;i<s.length();i++) characters[s[i]]++;
int length=0;
... | ALGO | 0.999956 | 4.883866 |
2edc18b1-c736-43eb-b885-0ba20bd9b4ca | sin22766/POSN-TOI_related | PreTOI16/ThisSummer/TASK_101.cpp | #include<bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int path[1005][1005];
int dp[1005][1005];
int main() {
pii mover[4] = {{1, 0},
{0, 1},
{0, -1},
{-1, 0}};
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++... | ALGO | 0.999838 | 3.585587 |
130e7b94-0d95-4fe6-88e9-4884a19f27f2 | Poseidon0819/cocos2d_html5_solocards | frameworks/cocos2d-x/cocos/2d/CCTextFieldTTF.cpp | #include "2d/CCTextFieldTTF.h"
#include "base/CCDirector.h"
#include "platform/CCFileUtils.h"
#include "base/ccUTF8.h"
#include "2d/CCSprite.h"
NS_CC_BEGIN
#define CURSOR_TIME_SHOW_HIDE 0.5f
#define CURSOR_DEFAULT_CHAR '|'
#define PASSWORD_STYLE_TEXT_DEFAULT "\xe2\x80\xa2"
static std::size_t _calcCharCount(const cha... | TOOL | 0.904495 | 6.935902 |
92b46463-e359-4893-8550-8658e8b4627e | nekotyan2d/mirea | algosi/1/9.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Node {
int l, r;
long long sum;
int mn, mx;
int even, odd;
Node *left, *right;
Node(int l, int r): l(l), r(r), sum(0), mn(INT_MAX), mx(INT_MIN), even(0), odd(0), left(nullptr), right(nullptr) {}
};
vector<i... | ALGO | 0.999363 | 5.779186 |
2ca8a20f-ed95-4e0a-8588-9f77cd14fd01 | Weiguo-Jiang/Kattis-Solutions | luhnchecksum.cpp | #include <iostream>
#include <string>
using namespace std;
int digitSum(int n) {
int sum = 0;
while (n != 0) {
sum += (n % 10);
n /= 10;
}
return sum;
}
int main() {
int T;
cin >> T;
for (int i = 0; i < T; i++) {
int sum = 0;
string s;
cin >> s;
for (int j = s.size()-2; j >= 0; j -= 2) {
sum +... | ALGO | 0.997208 | 4.706331 |
284154c6-132e-4db9-af26-7cd9e4666862 | titicodes/Attendance-System | 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.998693 | 6.797273 |
ba3a38f4-214f-425a-9580-ff64f9030b21 | rohanvmenon/AI-Chess | src/stockfish-windows-x86-64-avx2/stockfish/src/score.cpp | #include "score.h"
#include <cassert>
#include <cmath>
#include <cstdlib>
#include "uci.h"
namespace Stockfish {
Score::Score(Value v, const Position& pos) {
assert(-VALUE_INFINITE < v && v < VALUE_INFINITE);
if (!is_decisive(v))
{
score = InternalUnits{UCIEngine::to_cp(v, pos)};
}
else... | ALGO | 0.964794 | 6.314356 |
e0d31b8b-9844-4561-be1b-e2ddb0bcf036 | daRoyalCacti/Small_Cpp_Projects | compile_time_arrays/main.cpp | #include <iostream>
#include <array>
//https://ngathanasiou.wordpress.com/2015/02/19/compile-time-integer-sequences/
// a sequence container -------------------------
template<int ...>
struct ints
{
};
// integer sequence -----------------------------
template<int N, int... Is>
struct int_seq : int_seq<N - 1, N, Is.... | ALGO | 0.987638 | 5.135559 |
a795b391-c451-456e-88c0-4cd0e5135cf5 | Chirag-creator17/450-dsa-questions | graphs/surrounded-region.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define f(i, a, n) for (int i = a; i < n; i++)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define se(a) a.begin(), a.end()
void change(vector<vector<char>> &A, int x, int y)
{
A[x][y] = '*';
int dy[] = {-1, ... | ALGO | 0.999984 | 3.834377 |
e032f129-9698-42d3-ab47-4d7d6fa93eaa | WenqiJiang/SIGMOD-2022-submission-Fanns | PE_optimization/BRAM_behavior_test/src/host.cpp | #include "host.hpp"
#define BANK_NAME(n) n | XCL_MEM_TOPOLOGY
/* for U280 specifically */
const int bank[40] = {
/* 0 ~ 31 HBM */
BANK_NAME(0), BANK_NAME(1), BANK_NAME(2), BANK_NAME(3), BANK_NAME(4),
BANK_NAME(5), BANK_NAME(6), BANK_NAME(7), BANK_NAME(8), BANK_NAME(9),
BANK_NAME(10), BANK_NAME(... | ALGO | 0.975162 | 4.451683 |
6df99182-db35-4972-901f-c8f7dd4c23b1 | ashotpetrossian/Algorithms | Algorithms/Numbers/GCD_EuclidianAlgorithm.cpp | /**
Given two non-negative integers a and b, we have to find their GCD (greatest common divisor), i.e. the largest number which is a divisor of both a and b.
It's commonly denoted by gcd(a, b).
*/
// recursive implementation
int gcd(int a, int b)
{
return b == 0 ? a : gcd(b, a % b);
}
// iterative
int gcd(int a, ... | ALGO | 0.999924 | 6.432826 |
0633c68c-e32c-4aaa-8fb9-8f209e998d21 | ioqoo/PS | Samsung Academy/day2/2749.cpp | #include <bits/stdc++.h>
#define MOD 1000000LL
#define ll long long
using namespace std;
ll n;
vector<ll> matmul(ll A11, ll A12, ll A21, ll A22, ll B11, ll B12, ll B21, ll B22){
ll C11 = ((A11*B11)%MOD + (A12*B21)%MOD)%MOD;
ll C12 = ((A11*B12)%MOD + (A12*B22)%MOD)%MOD;
ll C21 = ((A21*B11)%MOD + (A22*B21)... | ALGO | 0.999987 | 4.721712 |
45d3ae06-1cf0-4872-af0a-7f3b956f159f | d0ugherty/code-wars | cpp/spin-words.cpp | #include <string>
#include <iostream>
#include <sstream>
#include <vector>
std::string spinWords(const std::string &str) {
std::vector<std::string> splitCopy = splitString(str, ' ');
std::string result;
int vectorSize = splitCopy.size();
int wordCount = 0;
for(std::string token : splitCopy) {
... | ALGO | 0.999825 | 6.375158 |
285e6e07-7a4c-479f-a21b-1a6783a5e7c4 | andersonandrei/uga-sdtm | report1/eigen_library/test/eigen2/eigen2_determinant.cpp | #include "main.h"
#include <Eigen/LU>
template<typename MatrixType> void determinant(const MatrixType& m)
{
/* this test covers the following files:
Determinant.h
*/
int size = m.rows();
MatrixType m1(size, size), m2(size, size);
m1.setRandom();
m2.setRandom();
typedef typename MatrixType::Scalar S... | TEST | 0.932324 | 6.899129 |
3cd562de-1572-4f83-9ba4-55acc4c431eb | LuneExplorer/THU-DSA-2024Fall | lab1/solution_2.cpp | #include <cstdio>
int matrix[2010][2010];
int rowsum[2010][2010];
int main() {
int n, m, q;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
scanf("%d", &matrix[i][j]);
}
}
for (int i = 1; i <= n; ++i) {
rowsum[i][0] = 0;
... | ALGO | 0.99962 | 3.529556 |
a19d1d81-50ae-4985-b566-5c525260f23f | neerjatiwari/DSA-Assignment-1 | Q3.cpp.cpp |
class Solution {
public:
int threeSumClosest(vector<int>& nums, int target) {
int n=nums.size();
int Res;
int diff=INT_MAX;
if(n<3) return {};
sort(nums.begin(),nums.end());
for(int i=0;i<n;i++)
{
int j=i+1;
int k=n-1;
while(j<k)... | ALGO | 0.999997 | 6.106578 |
42331f79-0d74-48b9-98a4-eb1d8bcf0c32 | alexanderkjeldaas/boost-mirror | libs/graph/example/prim-telephone.cpp | int
main()
{
using namespace boost;
GraphvizGraph g_dot;
read_graphviz("figs/telephone-network.dot", g_dot);
typedef adjacency_list < vecS, vecS, undirectedS, no_property,
property < edge_weight_t, int > > Graph;
Graph g(num_vertices(g_dot));
property_map < GraphvizGraph, edge_attribute_t >::type
e... | ALGO | 0.998073 | 4.425797 |
4ae9cec2-8ee5-4e23-9492-47f3859c102d | PakinDioxide/Submission | programming.in.th/00XX/0000.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << a + b;
}
| ALGO | 0.99422 | 3.702254 |
0023e2e9-066c-4991-a12e-da47b2b18bd3 | lucasbennertz/library-manager | 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 |
a773fdf7-b380-4b85-89d0-97d6621b15f1 | AeonFlor/Algorithm | Algorithm/2019_Study_100JUNE/1874_v2.cpp | #include <iostream>
#include <stack>
#include <cstring>
#include <queue>
using namespace std;
int main(void)
{
stack<int> seq;
queue<int> ans;
int x,n,i=0,c=0;
string res;
cin>>n;
for(int j=0; j<n; j++)
{
cin>>x;
ans.push(x);
}
while(!ans.empty())
{
if(seq.empty())
{
seq.push(++i);
res += '... | ALGO | 0.999999 | 4.090668 |
5672935c-8982-43d5-b57a-08da79a2f725 | YadlaMani/neetcode.io-solutions | Graphs/Max-Area-Of-Island.cpp | class Solution {
public:
int find(vector<vector<int>>&grid,int i,int j,int n,int m){
if(i<0 || i>=n || j<0 || j>=m || grid[i][j]!=1){
return 0;//if out of bound or water return 0
}
grid[i][j]=0;//make sure to mark the land so we don't count it again
//now count one island... | ALGO | 0.999981 | 6.388509 |
2e92ae10-88fa-4a81-9e05-b97fb3febedd | mastermanas805/codelibrary | Implementation/Cobb/code.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pii pair<int,int>
int bitcount(int x){ int count = 0; while(x) { count++; x >>= 1; } return count; }
int32_t main(){
int t;
cin>>t;
while(t--)
{
... | ALGO | 0.99944 | 3.538003 |
5f60f7ba-636b-439d-b3a3-2f3b5b17d589 | OIRDAOtmane/Project-tree | ArbreBI.cpp | #include <iostream>
#include <cstdlib>
#include "ArbreBI.h"
using namespace std;
Arbre::Arbre(){
root = NULL;
}
Arbre::Noeud* Arbre::CreerFeuille(int cle){
Noeud* n = new Noeud;
n->cle = cle;
n->gauche = NULL;
n->droite = NULL;
return n;
}
void Arbre::AjouterNoeud (int cle){
AjouterNo... | ALGO | 0.998787 | 3.447314 |
08f22b53-ee26-4bbf-95ff-a477228ad506 | hjiang13/LLMs-in-IR | POJ-104/44/828.cpp | #include <iostream>
using namespace std;
int reverse(int a)
{
int i;
for(i=0; (int)pow(10,i)<=a; i++);
int word;
word=i;
int sum;
sum=0;
for(i=0; i<word; i++)
{
sum+=(a%10)*((int)pow(10,word-i-1));
a/=10;
}
return sum;
}
int main()
{
int num[6],a;
cin >> "%d\n%d\n%d\n%d\n%d\n%d",&num[0],&num[1],&num[2],&num[3],&num[4],... | ALGO | 0.999853 | 3.279845 |
d884b5ae-47e9-4374-9a13-9f340e696751 | NUC-NCE/algorithm-codes | codes - ac/HDU/5922/14657484_AC_0ms_1360kB.cpp | #include<bits/stdc++.h>
typedef unsigned long long ll;
using namespace std;
ll n;
ll sum;
int main()
{
int t;
scanf("%d",&t);
int cas=1;
while(t--)
{
scanf("%lld",&n);
sum=n*(n+1)/2-1;
printf("Case #%d: %lld\n",cas,sum);
cas++;
}
return 0;
} | ALGO | 0.998611 | 4.765872 |
a956454e-fbdf-4b53-b972-73b7272bb67c | MohamedNejjar/DSA | recursion/countDigts.cpp | #include<bits/stdc++.h>
using namespace std ;
int countN( int n ) {
if( n<1){
return 0;
}
int small = countN(n/10);
return small+1;
}
int main ( ){
int n ;
cin >> n ;
int result = countN( n) ;
cout << result ;
return 0 ;... | ALGO | 0.999834 | 4.471857 |
17e064f0-a3ea-4f08-8415-ff7fea07ed68 | voletisailaja/Codechef-Solved-Problems | DISCNT.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int a;
cin>>a;
cout<<100-a<<endl;
}
return 0;
}
| ALGO | 0.998133 | 3.597441 |
8fb8d14c-785f-4e9b-a063-e216a4d9d8d9 | VeerRavi97/interview-prep | LLD/Elevator/elevator.cpp | import java.util.PriorityQueue;
public
class Elevator
{
int currentFloor;
Direction direction;
PriorityQueue<Request> upQueue;
PriorityQueue<Request> downQueue;
public
Elevator(int currentFloor)
{
this.currentFloor = currentFloor;
this.direction = Direction.IDLE;
// ... | ALGO | 0.989334 | 3.816322 |
97e3c58c-b0c6-451b-a7f3-65a3fc33a314 | AnneMayor/algorithmstudy | 15650_n과m2.cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m;
vector<int> num;
bool isVisited[10];
void solve(int cnt) {
if(num.size() > 1) {
for(int i = 0 ; i < num.size()-1; i++) {
if(num[i] > num[i+1]) {
return;
}
}
}
if(cnt == m... | ALGO | 0.999992 | 3.974935 |
9ae9d7a2-4f49-4a8b-8b14-a9bc92bf88da | tejus0/TLE-Eliminators | R-900/Chemistry.cpp | #include <bits/stdc++.h>
using namespace std;
bool odd(int num) { return ((num & 1) == 1); }
bool even(int num) { return ((num & 1) == 0); }
int main()
{
int test;
cin >> test;
while (test--)
{
int n, k;
cin >> n >> k;
string s;
cin >> s;
map<char, int> mp;
... | ALGO | 0.99998 | 4.796687 |
35c88022-cf1e-4e22-87b5-62b01bd02d43 | zaddone/RouteServer | RunTool/RunTool.cpp | // RunTool.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include "serverHandle.h"
//#pragma comment( linker, "/subsystem:\"windows\" /entry:\"wmainCRTStartup\"" )
BOOL CheckProcessName(LPVOID lpParamter,TCHAR * ProName, DWORD h){
TCHAR * pro = (TCHAR *)lpParamter;
size_t le = wcslen(ProName);
_wcslwr_s(ProName,le+1);
TCHAR... | TOOL | 0.858166 | 3.570164 |
086d0799-fe4b-445d-a809-987a80d3c4f3 | jimgao1/competitive-programming | UVA/uva_247.cpp |
#include <bits/stdc++.h>
using namespace std;
unordered_map<string, int> names;
unordered_set<string> occ;
int N, M, ca = 0;
bool fir = false, conn[30][30], visited[30];
vector<int> adjList[31];
string dict[30];
void dfs(int src, int cur){
conn[src][cur] = true;
for (int i : adjList[cur])
if (!c... | ALGO | 0.999812 | 4.778855 |
bd43c21c-4e71-4d0e-80a1-a1fc358d8167 | Anurag9458/Leetcode | 387-first-unique-character-in-a-string/first-unique-character-in-a-string.cpp | class Solution {
public:
int firstUniqChar(string s) {
int ans=-1;
map<char,int>mp;
for(char c:s){
mp[c]++;
}
for(int i=0;i<s.size();i++){
if(mp[s[i]]==1){
return i;
}
}
return -1;
}
}; | ALGO | 0.999886 | 5.905326 |
5fe4d4dc-32c4-4f53-b9a1-5068bd631f63 | Tonyginto/algebraic-project | AAF/AALT/DecompositionManagerTests.cpp | /*
MPEI Algebraic Abstractions Library,
2007-2011,
Moscow Power Engineering Institute
This file contains tests of the following classes:
*/
#include "./CppUnitLite/TestHarness.h"
#include "./AAF/AAL/DecompositionManager.h"
#include "./AAF/AAL/Integer.h"
#include <vector>
using namespace AAL;
TEST(... | TEST | 0.860639 | 4.931657 |
e404b071-dafe-4232-bd71-11438c5ef761 | tr0j4n034/SPOJ | ADAGAME.cpp | /*
O(T * MAX(N) * MAX(STEPS)) solution using dynamic programming
Just follow the statement:
If it is Ada's turn, maximize current answer by next iteration;
Else minimize current answer by next iteration;
And at the end, if the result is bigger than original value Ada wins, else she loses.
*/
#include <iostream>
... | ALGO | 0.99998 | 6.550584 |
7db4e3a4-6dd3-45c1-8190-a32587a5c601 | sahilskumar/Implementation | Basic/InterviewBit/Two Pointer/Remove Duplicate from Sorted Array.cpp | /*
Given a sorted array, remove the duplicates in place such that each element can appear atmost twice and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
O(n) with no extra space
Discuss : dont remove individual element, Push all to right then er... | ALGO | 0.999449 | 5.745152 |
51dc087e-9ce4-4953-9cf4-9d4abfc7e904 | DikshantBadawadagi/DSA | courseSchedule.cpp | class Solution {
private:
bool dfs(int i, vector<int>& vis, vector<int>& pathVis, vector<vector<int>>& adj) {
vis[i] = 1;
pathVis[i] = 1;
for (auto neigh : adj[i]) {
if (!vis[neigh]) {
if (dfs(neigh, vis, pathVis, adj)) return true;
} else if (pathVis... | ALGO | 0.999969 | 6.240231 |
2d9cc9e1-87ad-46e3-bda9-51a45038d842 | bhargavi290504/Leetcode | 0041-first-missing-positive/0041-first-missing-positive.cpp | class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
unordered_set<int>ans (nums.begin(), nums.end());
int cnt = 1;
while (ans.find(cnt) != ans.end()) {
cnt++;
}
return cnt;
}
}; | ALGO | 0.999889 | 5.002026 |
ecb7297d-91e1-48bc-9f92-fa6953c8a62d | EvAn-HuAngBiu/Leetcode | LeetCode-CPP/31.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
void nextPermutation(vector<int>& nums) {
int size = nums.size();
if (!size) {
return;
}
int i = size - 1;
while (i > 0 && nums[i] <= nums[i... | ALGO | 0.999993 | 4.788268 |
9c572ee0-79eb-4866-8e7f-f6a799289bcb | PaulParizacaMozo/Compiladores | Compiladores/Practica02/code.cpp | #include <iostream>
#include <vector>
using namespace std;
string nInicial = "q0";
vector<string>nFinal{"q1",};
vector<char>alfabeto{'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','0','1','2','3','4','5','6','7','8','9',};
struct Regla{
string nActual;
char simbo... | ALGO | 0.999844 | 4.164594 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.