uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
68b7c92b-150c-4ca8-9717-95d356299760 | AmmarKOfficial/Cpp_Masterclass | Day 76 (Bitwise Operation)/main.cpp | // & Bitwise AND Operator
// | Bitwise OR Operator
// ^ Bitwise XOR Operator
// ~ Bitwise Complement Operator
// << Bitwise Shift Left Operator
// >> Bitwise Shift Right Operator
#include <iostream>
using namespace std;
int main() {
// declare variables
int a = 12, b = 25; // 12 = 00001100 (In Binary... | ALGO | 0.997015 | 4.282112 |
e63d356d-9156-4cd5-bd67-e7f808073d68 | Corentin1501/ProjetSI | assimp-5.2.5/code/AssetLib/IFC/IFCBoolean.cpp | /** @file IFCBoolean.cpp
* @brief Implements a subset of Ifc boolean operations
*/
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "AssetLib/IFC/IFCUtil.h"
#include "Common/PolyTools.h"
#include "PostProcessing/ProcessHelper.h"
#include <iterator>
#include <tuple>
namespace Assimp {
namespace IFC {
// ----------... | ALGO | 0.991954 | 7.266501 |
f3b9bc00-f72f-4a24-9341-d891ac383050 | Prince-Choudhury/LeetCode-Daily-Challenge | 2690-house-robber-iv/2690-house-robber-iv.cpp | class Solution {
public:
bool calc(vector<int>& nums, int k,int mid)
{
int i=0,n=nums.size();
while(i<n)
{
if(nums[i]<=mid)k--, i+=2;
else i++;
if(k == 0) return true;
}
return k == 0;
}
int minCapabili... | ALGO | 0.999979 | 5.734873 |
7590abde-e1bd-440d-97ca-12fade314d88 | lchakma201232/cp_codes | D_Shocking_Arrangement.cpp | #include <bits/stdc++.h>
#if 0
#define HOME
#endif
#ifndef ONLINE_JUDGE
#define dbgA2(A, n, m) {cout<<"-->"<<#A<<"=\n";for(int i = 0; i < n; i++){for(int j = 0; j < m; j++){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<"-->"<<#A<<"=(";for(int i = 0; i < n; i++)cout<<A[i]<<" ";cout<<")\n";... | ALGO | 0.999436 | 3.768218 |
f59d6c8f-52ae-4573-b81a-0fcc445b3da6 | ShreyaKumari13/Cpp_Basic_Programs | find square root of a number.cpp | //C++ program to find Square Root of a Number
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n,root;
cout<<"Enter the number:";
cin>>n;
root = pow(n,0.5);
cout<<"The square root of the number is:"<<root;
return 0;
} | ALGO | 0.999409 | 3.335517 |
5e7c72bb-c25a-4cdd-9dcf-9a47af8c6986 | iamtasir/Competitive-programming | 2020/May/rahatcode.cpp | #include<bits/stdc++.h>
using namespace std;
int fl[200];
vector<string> ans;
int main()
{
int n;
string s,temp;
char c;
cin>>s;
temp=s;
c=s[s.size()-1];
cin>>n;
int index;
int f=0;
char lc;
bool ache=false;
for(int i=0;i<n;i++)
{
cin>>s;
if(c==s[... | ALGO | 0.999839 | 3.273731 |
6df3e22d-ca8e-4f11-b667-bbf688c0de02 | mikica1986vee/Godot_VideoModeStuff | drivers/convex_decomp/b2Triangle.cpp | #include "b2Triangle.h"
namespace b2ConvexDecomp {
//Constructor automatically fixes orientation to ccw
b2Triangle::b2Triangle(float32 x1, float32 y1, float32 x2, float32 y2, float32 x3, float32 y3){
x = new float32[3];
y = new float32[3];
float32 dx1 = x2-x1;
float32 dx2 = x3-x1;
float32 dy1 = y2-y1;
float32 d... | ALGO | 0.960764 | 5.571321 |
30e97de3-cb1f-4c4c-ae29-7b017919947c | AntiO2/LeetCode | leetcode_cpp/hash-table/2085_count-common-words-with-one-occurrence.cpp | /**
* @author Anti
* @date 2024-01-12
* @see https://leetcode.cn/problems/count-common-words-with-one-occurrence
*/
#include "fmt/core.h"
#include "gtest/gtest.h"
#include "logger.h"
class Solution {
public:
int countWords(std::vector<std::string>& words1, std::vector<std::string>& words2) {
std::unordered... | ALGO | 0.999199 | 6.341339 |
e1e5f748-4668-4e5b-a0f3-18079180e42c | farhanmahmud21/CountingApp_Demo | 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 |
1d941acc-f506-4903-8731-be10fd32af93 | BrainStone/AdventOfCode | 2024/solutions/day10.cpp | #include <unordered_set>
#include "../registry.hpp"
#include "../util.hpp"
int calculate_trail_scores(std::istream& input,
const std::function<int(const letter_grid&, const point&)>& point_rater) {
int sum = 0;
letter_grid grid;
input >> grid;
for (point pos = grid.find('0'); grid.is_v... | ALGO | 0.998657 | 6.808414 |
660f5636-4de8-423f-b0a8-c981cbe34abc | N1237846/DetectingOnlineCodeSimilarity | Dissertation_N1237846/C++/type01SampleCPP/Clone_33.cpp | // Vectors are the dynamic arrays which have the ability to resize itself automatically when an element is inserted or deleted. The size of the arrays cannot be altered at run time but vectors overcomes this disadvantage of the arrays.
// Let's have a quick introduction of the vectors
#include <iostream>
#include <vect... | ALGO | 0.976223 | 3.6106 |
485e5082-ed59-4737-b760-18f0a60c8867 | clingfei/HashMap_Starter | hashmap.cpp | /*
* Assignment 2: HashMap template implementation (STARTER CODE)
* TODO: write a comment here.
*/
#include "hashmap.h"
template <typename K, typename M, typename H>
HashMap<K, M, H>::HashMap() :
HashMap{kDefaultBuckets} { }
template <typename K, typename M, typename H>
HashMap<K, M, H>::HashMap(size_t buc... | TOOL | 0.890409 | 5.42782 |
6f09e1c0-b4f5-479c-a3a5-7e341a6a2d67 | hu2di/c-hust | CTDL/Bài tập tuần 2.cpp | #include<iostream>
#include<conio.h>
using namespace std;
float nhap_mt(float *A,int m,int n,char c);
float cong_mt(float *A,float *B,int m,int n);
float tru_mt(float *A,float *B,int m,int n);
float nhan_mt(float *A,float *B,int m,int n);
int main(){
float *A=NULL,*B=NULL;
int m,n;
cout<<" _____________ \n | Bai t... | ALGO | 0.986095 | 3.263007 |
494adfc1-a5e3-4fca-8c70-b98efb15522b | lyh-source/Multi-scale-Anisotropic-Rough-Surface-MARS-Algorithm | include/igl/flip_edge.cpp | #include "flip_edge.h"
template <
typename DerivedF,
typename DerivedE,
typename DeriveduE,
typename DerivedEMAP,
typename uE2EType>
IGL_INLINE void igl::flip_edge(
Eigen::PlainObjectBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedE> & E,
Eigen::PlainObjectBase<DeriveduE> & uE,
Eigen::PlainObjectBa... | ALGO | 0.987441 | 7.127908 |
3137db5b-cb0e-471e-8ea5-6ec791337c1f | msorvig/qt5-qtbase-nacl | tools/configure/environment.cpp | #include "environment.h"
#include <qdebug.h>
#include <qstringlist.h>
#include <qmap.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qstandardpaths.h>
#include <process.h>
#include <errno.h>
#include <iostream>
//#define CONFIGURE_DEBUG_EXECUTE
//#define CONFIGURE_DEBUG_CP_DIR
using namespa... | TOOL | 0.93709 | 4.792697 |
ee3d9307-962f-49ca-8dbd-31944f29e8ed | agshubhs/LeetCodeSolution | 2486-append-characters-to-string-to-make-subsequence/2486-append-characters-to-string-to-make-subsequence.cpp | class Solution {
public:
int appendCharacters(string s, string t) {
int ans = 0;
int t_l = t.length();
int s_l = s.length();
int i = 0;
int j = 0;
while(j<t_l && i < s_l){
if(s[i]==t[j]){
j++;
}
i++;
}
... | ALGO | 0.999959 | 6.056172 |
1087385e-7a48-4fac-b2b8-9af91b741a70 | asad-shuvo/ACM | Online Judge/UVA/12583 - Memory Overflow.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("input.txt","rt",stdin);
char str[1000];
int n,m,i,j,ln,k,l,sum,arr[10000],test,p=0;
scanf("%d",&test);
while(test--){
sum=0;
k=0;
p++;
scanf("%d%d",&n,&m);
scanf("%s",str);
ln=strlen(str... | ALGO | 0.999867 | 3.699876 |
9d2d184a-fe29-4cff-a78b-8c7b53616741 | ishandutta2007/codeforces | cldp/normal/368/C.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const int MAXN = 100100;
const int MAXM = 1100;
const int INF = 2000000000;
int x[MAXN], y[MAXN], z[MAXN];
bool check(int xx, int yy, int zz) {
if (xx == yy && x... | ALGO | 0.999948 | 3.711469 |
b11ecdbe-a24f-409a-a620-363ed4960cbb | woshiZS/PAT-only | A1016.cpp | #include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
struct record
{
char name[21];
int mon, day, hour, min;
int state;
record operator=(const record& a)
{
strcpy(name, a.name);
mon = a.mon;
day = a.day;
hour = a.hour;
min = a.min;
state = a.state;
return *th... | ALGO | 0.972649 | 3.442445 |
aae34985-db4f-4f74-b21f-b3c5be1de9d9 | Krish203018/cpp | assignment7.cpp/minimum_number.cpp | #include<iostream>
using namespace std;
void printminimum(string s)
{
int curr=0;
int last=0;
int j;
for (int i = 0; i < s.length(); i++)
{
int nextD=0;
switch (s[i])
{
case 'I':
j=i+1;
while (s[j]=='D'&&j<s.length())
{
nextD++;
... | ALGO | 0.999854 | 4.129176 |
2ad0e243-a355-4a85-bd1d-7809106f962a | AleGastelum/Estudio | Algorithms/LeetCode/Cpp/array/11/mySolutions/01.cpp | // 11. Container with most water
// Brute Force approach, it works but does not pass all tests due to time limit exceeded
#include <vector>
#include <algorithm>
class Solution {
public:
int maxArea(std::vector<int>& heights) {
int distanceFromPoints = 0;
int shortestPoint = 0;
int area = 0... | ALGO | 0.999902 | 6.733654 |
03e91379-e476-449c-a72d-195febde94df | GizeleAlves/App-Save-My-Cash | app_save_my_cash/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.998367 | 6.76073 |
a5496318-9ccc-47d0-b747-ec213152af04 | DoanTrungHuy/exercises-and-solutions-to-algorithmic-problems | Review Again/Minimizing Coins/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll N, X;
const ll MN = 1e6 + 100;
ll a[MN];
// DP[i][j]: DP[i][j + a[i]] + 1, DP[i + 1][j]
int main() {
cin >> N >> X;
for (ll i = 0; i < N; ++i) {
cin >> a[i];
}
int dp[N + 10][X + 10];
for (ll i... | ALGO | 0.99998 | 4.334481 |
92404515-36cc-452e-abcb-66c8e51e2f47 | alvans11188/Operaciones_con_Arreglos | 1arregloDesordenadoInsercion.cpp | #include <iostream>
using namespace std;
int main(){
int i,dato;
const int max = 10;
int x[max] = {2,-4,7,2,3,4,5,6,9,10};
cout << "Arreglo original"<<endl;
for (i=0;i<max;i++){
cout << x[i] << " ";
}
cout << endl;
int n=0;
for (i=0;i<max;i++){
if (x[i]==0){
n=n+1;
}
}
cout << n << endl;
n=9-n... | ALGO | 0.987475 | 3.428385 |
bd3eef1f-6740-414d-804c-cc11ea990841 | parkgang/coding-test | src/baekjoon/silver/11866-요세푸스 문제 0/main.cpp | #include <iostream>
#include <queue>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N, K;
cin >> N >> K;
queue<int> queue;
for (int i = 1; i <= N; ++i) {
queue.push(i);
}
cout << "<";
while (!queue.empty()) {
for (int i = 0; i < K - 1; ++i) {
... | ALGO | 0.999927 | 4.107155 |
89ac95b5-6f11-43c2-a15a-54090451e7d1 | CoderS2020/Cpp-Algo-DS | Hashing/countNoofSubarrayswithsum0.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
map<int,int> m;
int prefsum[n]={0};
prefsum[0]=v[0];
m[prefsum[0]]++;
for(int i=1;i<n;i++){
prefsum[i]=prefsum[i-1]+v[i];
m[pre... | ALGO | 0.999989 | 3.544553 |
86918177-e638-4dae-a183-949a23d7c752 | Fallid/Pemrograman-Mobile | Modul5/modul_5_prak/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.997843 | 6.76073 |
c11bd451-4191-4729-b085-4ccf2ac2419c | johnpuri/Towson_COSC_471 | eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
m << 1,-2,
-3,4;
cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
<< " == " << m.colwise().lpNorm<1>().maxCoeff() << endl;
cout << "infty-norm(m... | ALGO | 0.999754 | 4.076589 |
dc7eec7b-fc28-4c06-bd17-e45173c8a6ac | weekend27/leetcode | evaluateReversePolishNotation/evaluateReversePolishNotation.cpp | // Source : https://leetcode.com/problems/evaluate-reverse-polish-notation/
// Author : weekend27
// Date : 2015-12-20
/**********************************************************************************
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each ... | ALGO | 0.999931 | 6.606536 |
4baa78d6-db47-436f-ba3a-ae60f36f7488 | HyeonGiMin/CodingTest | Programers/LV2/49994.cpp | //방문 길이
//https://school.programmers.co.kr/learn/courses/30/lessons/49994
//reference: https://ansohxxn.github.io/programmers/104/
#include <string>
#include <map>
using namespace std;
int solution(string dirs) {
int answer = 0;
//출발점 {5,5}
//간선으로 해야함!!
map<pair<pair<int, int>, pair<int, int... | ALGO | 0.99983 | 4.848 |
f5ec5cf9-345b-43bc-b492-315309525e92 | Aadarshg087/competitive-programming | Codeforces/Educational Round 166 (Div. 2)/A.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
// ------------------------ Macros -------------------------
#define ll long long int
#define endl "\n"
#define debug(x) \
cout << #x << ": "; \
_print(x); \
cout << endl;
// ---------------------- Debug Functions ---------... | ALGO | 0.99976 | 5.343253 |
f1b3aec1-200b-4077-816a-b654b5034545 | yoga220802/KULI | SEASON 1/Praktikum Daspro/TugasBesar/functions.cpp | #include <map>
#include <vector>
#include <iostream>
using namespace std;
pair<string, pair<string, bool>> userValidation(vector<map<string, string>> userData, string username, string password) {
string name = "kosong", message;
bool found = false;
int i = 0;
for (i; i < userData.size(); i++) {
... | TOOL | 0.976703 | 3.951031 |
591fb646-951a-4acd-93c9-140999203f54 | ahmed-el-amine/ITI | C++/Lab2/Complex/main.cpp | #include <iostream>
using namespace std;
class Complex {
int real = 0;
int imaginary = 0;
public:
Complex(int realData, int imgData) {
this->real = realData;
this->imaginary = imgData;
}
void setReal(int realData) {
this->real = realData;
}
int getReal() {
... | ALGO | 0.885302 | 4.846184 |
83e2ea94-013f-4ca2-989c-b02161c44e57 | dabiaoluo/skp2blend-blender | extern/bullet2/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp | #include "btCapsuleShape.h"
#include "LinearMath/btQuaternion.h"
btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape()
{
m_collisionMargin = radius;
m_shapeType = CAPSULE_SHAPE_PROXYTYPE;
m_upAxis = 1;
m_implicitShapeDimensions.setValue(radius, 0.5f * height, radius);
}
btVec... | TOOL | 0.886079 | 7.482481 |
bb610693-ce85-42a0-a952-fdd0a57336bb | GANGESHOTTEOK/gukbbap | STACK/4949/AN/BOJ4949.cpp | #include <bits/stdc++.h>
using namespace std;
int T;
string sentence;
int isVPS(string s) {
stack<int> ps;
for(int i=0; i<s.size(); i++) {
if(s[i]!='(' && s[i]!='[' && s[i]!=']' && s[i]!=')') continue;
if(s[i]=='(') ps.push(1);
else if(s[i]=='[') ps.push(0);
else {
if... | ALGO | 0.999627 | 4.425832 |
2a1b0024-3ccf-4b87-b86b-649a1d16dadd | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9430_5.cpp | #include <bits/stdc++.h>
int syllable() {
int a;
int res = 0;
while ((a = getchar()) != '\n') {
if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u') res++;
}
return res;
}
int main() {
if (syllable() != 5) {
printf("NO\n");
return 0;
}
if (syllable() != 7) {
printf("NO\n");
... | ALGO | 0.999396 | 3.391202 |
606a17ff-adbe-4629-8441-23ea9a3dda92 | ishandutta2007/codeforces | lackadaisical_lad/normal/1515/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 998244353;
ll binpow(ll a, ll p, int mod = MOD) {
ll res = 1;
while (p) {
if (p & 1) {
(res *= a) %= mod;
}
p >>= 1;
(a *= a) %= mod;
}
return res;
... | ALGO | 0.999977 | 4.618562 |
83131fb8-3762-431f-a233-fd2ab4e45419 | Vamsi-Krishna8/GraphQuestions | Keys and Rooms.cpp | class Solution {
public:
void dfs(vector<vector<int>>& rooms, vector<int>& vis, int node) {
vis[node] = 1;
for (auto x : rooms[node]) {
if (!vis[x]) {
dfs(rooms, vis, x);
}
}
}
bool canVisitAllRooms(vector<vector<int>>& rooms) {
vector<... | ALGO | 0.999639 | 6.458995 |
409ae876-cac5-4fc2-baa3-605f8159606a | Nats306/EjerciciosCpp | Ejercicio11_Mirror.cpp | #include <iostream>
using namespace std;
struct TreeNode {
int valor;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : valor(x), left(nullptr), right(nullptr) {}
};
//Funcion recursiva
bool isMirror(TreeNode* left, TreeNode* right) {
//Caso base: si ambos nodos son nulos, son espejo
if (left... | ALGO | 0.999971 | 6.494561 |
5e15f93a-1e73-4678-8e3b-c0f525501a58 | debsourav33/CodeForces-Problem-Solutions | 1023A - Single Wildcard Pattern Matching.cpp | #include<bits/stdc++.h>
using namespace std;
main(){
string pat,text;
int p, t, cnt, flag=0, crossed=0;
cin>>p>>t;
cin>>pat>>text;
if(p>t+1){
cout<<"NO"<<endl;
return 0;
}
if(p<t || p==t+1){
for(int i=0;i<p;i++){
if(pat[i]=='*')
flag=1;... | ALGO | 0.999968 | 3.293725 |
78d36772-a2b1-497e-aa9f-f3e95459ff1a | zhangwj0101/codestudy | algorithm/HDU-ACM/ambition0109/34571.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: ambition0109
////Nickname: Ambition
////Run ID:
////Submit time: 2010-07-17 16:34:56
////Compiler: Visual C++
////... | ALGO | 0.999446 | 3.679902 |
26f87e17-7869-410c-ae7d-5a22c1d5b6b1 | mahimalmuntashir/CodeForces | 200-299/232A-Cycles.cpp | #include <cstdio>
int main(){
const long N = 107;
long g[N][N] = {0};
long cycles; scanf("%ld", &cycles);
long n(0);
for(long p = 0; p < N; p++){
if(cycles <= 0){break;}
n = p;
for(long q = 0; q < p; q++){
if(cycles < q){break;}
g[p][q] = g[q][p] =... | ALGO | 0.999579 | 3.143304 |
3ceddc3a-a51e-46ec-9377-df8e8728c8cc | Seyamalam/Codeforces | 601-800/767c-garland.cpp | #include <cstdio>
#include <vector>
long dfs(long node, long target, const std::vector<std::vector<long> > &h, const std::vector<long> &t, std::vector<long> &cuts){
if(cuts.size() >= 2){return 0;}
long subsum = t[node];
for(long p = 0; p < h[node].size(); p++){
long u = h[node][p];
subsum... | ALGO | 0.999957 | 4.014205 |
39a2be0b-bf09-4a96-8f41-c7bc4b72fc6f | Livinfly/AlgorithmPromble_Code | 集训20210710/D7-摸鱼日/模拟赛/路桥中学_罗杰/wsxkp/wsxkp - new.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long LL;
LL n;
void work()
{
n --;
if(n <= 2)
{
cout << n + 1 << endl;
return;
}
LL ans = 2, s = 3, rate = 3;
while(s + rate * 3 + rate <= n)
{
s = s + rate * 3 + rate;
rate = rate * 3;
... | ALGO | 0.999981 | 3.458781 |
3c2057d4-6859-4be2-8fea-d2326e5b5ee1 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_83_8.cpp | #include <stdio.h>
int a,b;
int main(){
scanf("%d %d",&a,&b);
if(a*b%2==0){
printf("Even");
}else{
printf("Odd");
}
return 0;
} | ALGO | 0.999967 | 3.539228 |
8f02c75b-b2d7-455a-ba46-e2f7be87d39f | fudoge/Problem_Solving | 0528-swapping-nodes-in-a-linked-list/0528-swapping-nodes-in-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* swapNodes(L... | ALGO | 0.999998 | 5.703603 |
441072ea-073f-471f-bf94-3327b51792ee | tranthanhcuong1464hg123aqwlgm/TranThanhCuong_monC | Chapter13/Program challeges 13-9.cpp | #include <iostream>
using namespace std;
class Population {
private:
double population;
double births;
double deaths;
public:
// Constructor with input validation
Population(double pop, double b, double d) {
if (pop >= 1 && b >= 0 && d >= 0) {
population = pop;
birt... | ALGO | 0.96728 | 6.765511 |
8abd1d67-589d-427c-a3fc-97bab7c7180b | AsjidAle/DSA | Insertion Sort/Link List/main.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int val;
struct Node* next;
Node(int x)
{
val = x;
next = NULL;
}
};
class LinkedlistIS
{
public:
Node* head;
Node* sorted;
void push(int val)
{
// Allocate node
Node* newnode = new Node(val);
// Link the old list of the
// new no... | ALGO | 0.999949 | 5.185324 |
3c2f6119-f6d1-42d9-b4af-b194bbb5adba | skyto0927/Programming-Contest | AtCoder_PastProblems/ABC_100/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;
int main() {
int A,B; cin >> A >> B;
if(A>... | ALGO | 0.997799 | 3.312237 |
4421299b-318f-403b-874c-4ae1e9a3eada | sultanul-kawser/first-ripo | B_Steps.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, m;
cin >> n >> m;
long long x, y;
cin >> x >> y;
long long k;
cin >> k;
long long stepCnt = 0;
for(int i = 0; i < k; i++){
long long a, b;
... | ALGO | 0.99996 | 3.668278 |
96442fb1-f098-4f7e-a93b-042b3dcc9a54 | PhoengZ/AlgorithmDesign | clique.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int target;
int predict(vector<int>&b, vector<bool>&sel,int node){
int total = 0;
for (int i = node;i<target;i++){
if (!sel[i])total+=b[i];
}return total;
}
void f(vector<int>&b, vector<bool>&sel, vector<int>&sol, ve... | ALGO | 0.999904 | 4.125792 |
ee1a7427-8f61-461f-bcc0-747c174ed808 | faisalOmarBadaam/Problem-Solving-Level-3 | ProblemSolvingLevel3/Problem 3/Problem 3.cpp |
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int randomNumber(int from, int to) {
return rand() % (to - from + 1) + from;
}
void printArray(int arr[100][100], int lenthR, int lenthC)
{
for (int i = 0; i < lenthR; i++)
{
for (int j = 0; j < lenthC; j++)
{
cout << setw(3) << ar... | ALGO | 0.995718 | 3.530914 |
0afa9299-4d4f-46cb-8012-f704f1f51797 | zhouge94/Cute_Six_ROS_Balance | navigation/costmap_2d/src/array_parser.cpp | #include <cstdio> // for EOF
#include <string>
#include <sstream>
#include <vector>
namespace costmap_2d
{
/** @brief Parse a vector of vector of floats from a string.
* @param input
* @param error_return
* Syntax is [[1.0, 2.0], [3.3, 4.4, 5.5], ...] */
std::vector<std::vector<float> > parseVVF(const std::string... | TOOL | 0.953256 | 5.081814 |
fa678e66-1f7c-488c-8934-72e9a3714e96 | Yash-Adhiya/Algorithms | 1004-max-consecutive-ones-iii/1004-max-consecutive-ones-iii.cpp | class Solution {
public:
int longestOnes(vector<int>& nums, int k) {
int count = 0;
int n = nums.size();
int ans = INT_MIN;
int i = 0;
int j = 0;
int zc = 0;
while(j<n){
if(nums[j]==0){
zc++;
}
while(zc>k){
... | ALGO | 0.999977 | 6.166453 |
095c0ee3-2e64-4fab-b44b-7e0d38c4abfa | anfeespi/myRepository | Competitive Programming/Palindromic.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=1; i<=t; i++){
bool pal = false;
string n;
cin>>n;
cout<<"Case "<<i<<": ";
if(n.size()==1) cout<<"Yes";
else{
int pos1 = 0;
int pos2 = n.size()-1;
... | ALGO | 0.999704 | 5.359755 |
20ef5f11-9cac-4d50-9f80-61c76800c4ed | p-slash/lyspeq | core/fiducial_cosmology.cpp | #include "core/fiducial_cosmology.hpp"
#include "core/global_numbers.hpp"
#include "mathtools/interpolation.hpp"
#include "mathtools/interpolation_2d.hpp"
#include "io/io_helper_functions.hpp"
#include "io/logger.hpp"
#include <cmath>
#include <numeric> // std::accumulate
#include <algorithm> // std::for_each & transf... | ALGO | 0.956898 | 5.879546 |
23db6a51-871f-4a62-ad08-d04a164bd3d0 | jiangyinzuo/algorithm | src/graph_theory/tree/count_edge/cf1401d2.cpp | //
// Created by Jiang Yinzuo on 2020/10/31.
//
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const int N = 2e6 + 1;
ll mod = 1e9 + 7;
ll n, m, k;
vector<int> adj[N];
ll sz[N];
void dfs(int id, int p) {
sz[id] = 1;
for (auto c:adj[id]) {
if (c =... | ALGO | 0.999903 | 4.754345 |
8c988b31-fdbb-4e9a-9607-f9944e9ff8da | Duchieu123-cell/Data_Structures_and_Algorithms | lab(HK223)/lab6/lab6.cpp | #include <iostream>
#include <time.h>
#include <windows.h>
#include <math.h>
using namespace std;
#define ARRAY_SIZE 500000
#define INC_SORT 0
#define DEC_SORT 1
#define MAX_HEAP 0
#define MIN_HEAP 1
class Heap
{
public:
int* arr;
int count;
int capacity;
int heap_type;
public:
int getCount() { return... | ALGO | 0.999848 | 4.228375 |
d226503e-9d14-48f3-a7d4-f0411177321f | kingarthur11/leetcode | lcci/10.11.Peaks and Valleys/Solution.cpp | class Solution {
public:
void wiggleSort(vector<int>& nums) {
sort(nums.begin(), nums.end());
int n = nums.size();
for (int i = 0; i < n - 1; i += 2) {
swap(nums[i], nums[i + 1]);
}
}
}; | ALGO | 0.999996 | 5.853279 |
6eb50a36-76ee-4c0e-8de0-08ed8eef4c8c | Bhandariji-Suraj/LeetCode-100 | 0703-kth-largest-element-in-a-stream/0703-kth-largest-element-in-a-stream.cpp | class KthLargest {
public:
KthLargest(int k, vector<int>& nums) {
this->k = k;
for (int num : nums) {
heap.push(num);
if (heap.size() > k) {
heap.pop();
}
}
}
int add(int val) {
heap.push(val);
if (heap... | ALGO | 0.999971 | 6.344003 |
cd5e869a-9c97-42df-93fb-0a851759f41e | DucL0c/DSA_PTIT | src/DSA02035hoanvicacchuso.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
int k,a[10];
bool check[10];
vector<string> v;
long long M = 10e9;
void in(){
long long miN = 10e9, maX = -10e9;
for(int i=0;i<n;i++){
long long sum=0;
for(int j=1;j<=k;j++){
sum = sum*10 + v[i][a[j]-1]-'0';
//cou... | ALGO | 0.998589 | 3.911623 |
319b073e-5ad4-4742-ba44-a9f44e8e84fe | Itsrajeev123/hashmap | playerswithzerooronelose.cpp | class Solution {
public:
vector<vector<int>> findWinners(vector<vector<int>>& matches) {
unordered_map<int,int>map;
vector<vector<int>> ans(2);
for(int i=0;i<matches.size();i++){
for(int j=0;j<2;j++){
if(map.find(matches[i][j]) == map.end())
map[... | ALGO | 0.999802 | 5.572979 |
d9ba614d-8273-428f-8561-1df0603104af | nhonNguyenAbc/Nhom17 | TopologicalSort/HEHE topological sort/Source.cpp | #include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
#define SIZE 50
struct SUCCESSOR
{
int SUC;
SUCCESSOR* next;
};
struct NODE
{
int COUNT;
SUCCESSOR* TOP;
};
int main() {
SUCCESSOR* P;
int QLINK[SIZE] = { 0 };
NODE A[SIZE];
int n, edges;
// T1
cout << "Nhap so dinh va so canh:\n";... | ALGO | 0.999983 | 3.763124 |
33b7f202-783f-42a9-a079-dab840e1f560 | HnpawsPham/CP-PROBLEMS | J4F/GIRLS.CPP | #include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
int n, m, k;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m>>k;
int a[n + 1];
for(int i = 1; i <= n; i++) cin>>a[i];
sort(a + 1, a + n + 1);
ll p[n + 1] = {0};
for(int i =... | ALGO | 0.999974 | 3.792445 |
19948eef-5396-4fb0-8d00-8a27d750de63 | AyaseCore/Noggit3 | Noggit3libs/Boost/libs/msm/doc/PDF/examples/ParsingDigits.cpp | #define FUSION_MAX_VECTOR_SIZE 20
#include <boost/msm/back/state_machine.hpp>
#include "char_event_dispatcher.hpp"
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/front/functor_row.hpp>
#include <boost/timer.hpp>
namespace msm = boost::msm;
namespace mpl = boost::mpl;
using namespace msm::front;
... | ALGO | 0.875253 | 4.750244 |
5791172e-1b72-4e2c-beef-826b1a172900 | RajaBabu15/DSA_Learning | RudolfandtheTicket.cpp | #include<bits/stdc++.h>
using namespace std;
void solve() {
int n, m, k; cin >> n >> m >> k;
vector<int> l(n); for (auto &ele : l) cin >> ele; sort(l.begin(), l.end());
vector<int> r(m); for (auto &ele : r) cin >> ele; sort(r.begin(), r.end());
int ans = 0;
for (int i = 0; i < n; i++) for (int j = 0; j < m; j++)... | ALGO | 0.99997 | 3.878637 |
51b06c7e-813a-440f-9acb-eb1da896d8d4 | softweight/My_OJ | Leetcode/DP_I/Day6/1567.cpp |
class Solution {
public:
int getMaxLen(vector<int>& nums) {
int maxSize = 0;
int currSize = 0;
int neg = 0;
for(auto x : nums) {
if(x > 0){
currSize++;
neg = neg>0?neg+1:0;
}else if(x < 0){
int tmp = currSize;
... | ALGO | 0.999977 | 5.841223 |
3de7e741-9c77-4b01-ad28-55bccb0a296c | zhuangh/OJ | z_template/graph/mincut.cpp |
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <list>
#include <iterator>
#include <string>
#include <stack>
#include <map>
#include <limits.h>
using namespace std;
class design{
bool BFS(int s, int t, map<int,int>& parent);
void DFS(int s, vecto... | ALGO | 0.999469 | 4.187545 |
ad780812-a41d-4a60-8cd6-8b70be219541 | yubinbai/pcuva-problems | UVa 10131 - Is Bigger Smarter/sol.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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.999958 | 4.301513 |
14f6788a-7ab5-441e-b9e6-2b01467ffead | UdaySharmaGitHub/DSA-CPP | 05_Subarray/Traversal_of_All_Subarray.cpp | // iterate /traverse all the subarray
#include"bits/stdc++.h"
using namespace std;
void TraversalSubArray(int a[],int n){
for(int i=0;i<n;i++){
cur=0;
for(int j=1;j<n;j++){
cur+=a[j];
cout<<cur<<endl;
}
}
}
int main(){
int n,cur=0;
cout<<"enter the size of the array :";
cin>>n;
int a[n];
for... | ALGO | 0.999678 | 3.513039 |
5e02bb4d-2427-43be-95b2-0ec477982bde | Mindjolt2406/Competitive-Programming | Codeforces/69/D.cpp | #include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==I... | ALGO | 0.998762 | 3.934511 |
3760ce82-e0b4-4f0a-8499-19d44e32f3b7 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1885_4.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
template <typename T>
ostream &operator+(ostream &out, const vector<T> &vec) {
for (const auto &x : vec) {
out << x << " ";
}
out << "\n";
return out;
}
template <typename T>
ostream &operator*(ostream &out, const vector<T> &vec) {
fo... | ALGO | 0.99944 | 4.995609 |
a5075a79-7320-4045-922a-92c1804c7912 | tariktunahanakan/age-gender-detection | opencv/modules/dnn/src/onnx/onnx_graph_simplifier.cpp | #include "../precomp.hpp"
#include "../graph_simplifier.hpp"
#include "onnx_graph_simplifier.hpp"
#include <opencv2/core/utils/logger.hpp>
#include <queue>
namespace cv { namespace dnn {
CV__DNN_INLINE_NS_BEGIN
extern bool DNN_DIAGNOSTICS_RUN;
// This wrapper can behave differently for fake input nodes and real gr... | TOOL | 0.937199 | 7.391795 |
0dc4a6f9-afa7-46ee-85dc-07fba56d7973 | miguelarauj1o/URI | src/UOJ_1547 - (705123) Accepted.cpp | #include <iostream>
using namespace std;
int main()
{
int n, q, s, x;
int ctr = 0, ctr_f, tmp, res = 10000000;
cin >> n;
for(int i = 0; i < n; ++i)
{
cin >> q >> s;
res = 10000000;
ctr_f = 0;
ctr = 0;
for(int j = 0; j < q; ++j)
{
cin >> x;
ctr++;
tmp = s - x;
if(tmp < 0)
tmp... | ALGO | 0.999181 | 3.087294 |
872a211d-ef54-48db-b549-e29dcb8cd636 | qk1512/Tasmota_ESP32 | lib/lib_div/ams/crc.cpp | #include "crc.h"
uint16_t AMS_crc16_x25(const uint8_t* p, int len)
{
uint16_t crc = UINT16_MAX;
while(len--)
for (uint16_t i = 0, d = 0xff & *p++; i < 8; i++, d >>= 1)
crc = ((crc & 1) ^ (d & 1)) ? (crc >> 1) ^ 0x8408 : (crc >> 1);
return (~crc << 8) | (~crc >> 8 & 0xff);
}
uint16_t AMS_crc16 (const uint8_t... | ALGO | 0.947767 | 4.602733 |
5d7cef7d-848a-42cd-9fd6-5208c7397e73 | YuchanJung/ps | binary-search/LIS/[백준]14003. 가장 긴 증가하는 부분 수열 5/14003.cpp | // new version
#include <bits/stdc++.h>
#define INF 2000000000
using namespace std;
int n, x, r;
int arr[1000001], pre[1000001];
vector<int> v = {-INF};
vector<int> res;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> arr[i];
for ... | ALGO | 1 | 4.227461 |
e659a37d-b6a5-48d1-9211-cfcbf5eccd14 | kenanb/mopr | src/edit/appEnvironment.cpp | #include "appEnvironment.h"
#include "common.h"
#include "defs.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include "pxr/base/arch/fileSystem.h"
#include "pxr/base/arch/systemInfo.h"
#pragma GCC diagnostic pop
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <libge... | TOOL | 0.858814 | 6.085174 |
ce7154d3-0e28-4d0f-95bb-4120fe01715c | thien0709/Spoj | condition/tuyetDoi.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
cout << "|a| = " << abs(a) << endl;
cout << "|b| = " << abs(b) << endl;
cout << "|c| = " << abs(c) << endl;
return 0;
} | ALGO | 0.998956 | 3.991707 |
1cb3e454-a670-4f1f-90a8-c39c238074aa | Saransh29/DSA | array/palindrome.cpp | #include<iostream>
using namespace std;
int length(char n[]){
int count=0;
for(int i=0;n[i]!='\0';i++){
count++;
}
return count;
}
bool palindrome(char n[]){
for(int i=0;i<=length(n)/2;i++)
{
if(n[i]!=n[length(n)-i-1])
{
return false;
}
}
... | ALGO | 0.999951 | 3.90704 |
28fe0e47-f7b1-474f-baf0-792484feaeab | Durgesh4993/LeatCodeSolutionInCpp | Flatten Binary Tree to Linked List.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:
void flatten(TreeNode* root) {
if (root == NULL) {
return;
}
... | ALGO | 0.99997 | 6.022088 |
ae45d771-67fb-44f4-9ed8-25c9a655b323 | remrtehno/cpp-course-draft | Section20/FunctionTemplates/main.cpp | // Section 20
// Function templates
#include <iostream>
#include <string>
template <typename T>
T min(T a, T b) {
return (a < b) ? a : b;
}
template <typename T1, typename T2>
void func(T1 a, T2 b) {
std::cout << a << " " << b << std::endl;
}
struct Person {
std::string name;
int age;
bool operat... | ALGO | 0.959497 | 4.993117 |
46a9f412-4c3a-4e7a-ae9d-ce5f2775ce7c | ishandutta2007/codeforces | oleh1421/normal/1157/C2.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int a[1000001];
int maxl(int l,int r){
for (int i=l+1;i<=r;i++){
if (a[i]<=a[i-1]) return (i-l);
}
return (r-l+1);
}
int maxr(int l,int r){
for (int i=r-1;i>=l;i--){
if (a[i]<=a[i+1]) return r-i;
}
return (r-l+1)... | ALGO | 0.999993 | 3.080927 |
0c73e358-317e-4079-a97d-ff4cb35b5475 | Thrinaria/Codebase | boost_1_34_1/boost_1_34_1/libs/numeric/ublas/bench1/bench13.cpp | #include "bench1.hpp"
template<class T, int N>
struct bench_c_matrix_prod {
typedef T value_type;
void operator () (int runs) const {
try {
static typename c_matrix_traits<T, N, N>::type m1, m2, m3;
initialize_c_matrix<T, N, N> () (m1);
initialize_c_matrix<T, N, N> ... | TOOL | 0.972025 | 5.331476 |
35c667a7-3123-4bd6-b57b-78e216b282c1 | anishacharya/Cracking-Coding-Interviews | Leetcode/isBalaced_BST.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
Complexity: O(n)
*/
class Solution {
public:
int ht(TreeNode* root)
{
if(root==NULL)
return 0;
... | ALGO | 0.999869 | 6.538338 |
f2e33cef-7a37-40db-af33-c5d55c683ad6 | taehokangithub/advc | advc_2023/solutions/day19/rules_system_parser.cpp | #include <assert.h>
#include <iostream>
#include "../../utils/input_utils.h"
#include "rules_system.h"
using namespace std;
namespace advc_2023::day19
{
static utils::Axis get_part_axis(const char c)
{
switch (c)
{
case 'x': return utils::Axis::X;
case 'm': return utils::Axis:... | TOOL | 0.96366 | 5.542764 |
3104228f-b148-40cb-865d-d5f635d7ab39 | parthgoyal123/GeeksForGeeks | Bit Magic/3. Element_that_occurs_once.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1000000007
#define loop(i,a,b) for(int i=a; i<b; i++)
#define lloop(i,a,b) for (long long i=a; i<b; i++)
template <typename T>
void printArray(T arr[], int n){
loop(i,0,n){
cout << arr[i] << " ";
} cout << endl;
}
int mai... | ALGO | 0.999948 | 4.080472 |
1a96a32a-8f72-489f-9682-f9b6b3b75000 | AnkitSaroj29/C-Projects | practical_08.cpp | #include <iostream>
#include <string>
#include <sstream>
int main() {
std::string sentence;
// Accept a sentence from the user
std::cout << "Enter a sentence: ";
std::getline(std::cin, sentence);
// Create a string stream from the sentence
std::stringstream ss(sentence);
std::string word;... | TOOL | 0.977732 | 6.102027 |
36c2badf-4e4c-45e6-bad3-6397d53f2068 | harshitsuthar77731/Data-Structure | 21. Merge Two Sorted Lists.cpp | class Solution {
public:
ListNode* mergeTwoLists(ListNode* list1, ListNode* list2) {
if(!list1)
return list2;
if(!list2)
return list1;
// we are trying to make list1 smaller if list2 is smaller than list1 than we will switch them
ListNode* head = list... | ALGO | 0.999807 | 5.720398 |
cd8ceb62-80ee-4420-affa-82fc962673fa | HermanChen/Rockchip_4.2_release_libstagefright | 4.2_jb_release/libstagefright/codecs/amrnb/common/src/log2.cpp | /*
Filename: /audio/gsm_amr/c/src/log2.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. Moved Log2_norm
function to its own file.
Description: Changed l_shl.c to l_shl.h in Include section.
Desc... | ALGO | 0.996133 | 6.583379 |
662867f1-41ef-4dc5-85f8-f7cada3b4472 | VaniLSatc/Lab4 | 4.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
// Функция для подсчета баллов по методу Борда
string bordaWinner(vector<vector<string>>& votes, vector<string>& candidates) {
map<string, int> scores; // В этом контейнере будет накапливаться количество очков для канди... | ALGO | 0.999991 | 6.344508 |
29ab4fb7-ba16-43d9-8de0-2805ec9aaad8 | nishatfatima25/LeetCode-Problem-Solving | Medium/3201_Find_the_Maximum_Length_of_Valid_Subsequence_I.cpp | // LeetCode Problem : 3201. Find the Maximum Length of Valid Subsequence I
// Link : https://leetcode.com/problems/find-the-maximum-length-of-valid-subsequence-i/description/
class Solution {
public:
int maximumLength(vector<int>& nums) {
int even = 0 , odd = 0;
int count = 0;
bool ans = nu... | ALGO | 0.999934 | 5.639912 |
d172bae1-fb77-4b03-a2cc-82682da992a2 | miiitomi/atcoder | other/codeforces/edu153/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve() {
ll M, K, a1, ak;
cin >> M >> K >> a1 >> ak;
M -= K * min(M/K, ak);
ll s = min(M%K, a1);
M -= s;
a1 -= s;
if (M == 0) {
cout << 0 << endl;
return;
}
ll m = min(M, K*(a1/K));
M -... | ALGO | 0.999804 | 3.727139 |
dc844e65-bf57-429e-b93c-527cbb170068 | hjiang13/LLMs-in-IR | processed_data/DecompiledResuts_Human_x_164_O1/GPT4o_Human_x_164_O1_decompiled/CPP_19.cpp | ```cpp
#include <string>
#include <map>
#include <tuple>
void sort_numbers(std::string& result, const std::string& input) {
using Pair = std::pair<std::string, int>;
std::map<std::string, int> my_map;
Pair pairs[10];
pairs[0] = Pair("one", 4);
pairs[1] = Pair("two", 3);
pairs[2] = Pair("three"... | ALGO | 0.999662 | 6.458118 |
e8258b58-14ab-4e31-947e-466bc82d9c7c | sarahkhan6525/dsa-questions | Basics/Arrays/Check_if_sorted.cpp | #include<bits/stdc++.h>
using namespace std;
bool isSorted(int n, int arr[]){
for(int i=0;i<n;i++){
if(arr[i]>=arr[i-1]){
return true;
}
return false;
}
return false;
}
int main(){
int arr[100];
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
... | ALGO | 0.999902 | 4.734921 |
ddca7844-d1dc-485d-936f-bd978865587c | Norman5k/parallel_tasks | decision_22.cpp | #include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <omp.h>
#include <sys/time.h>
struct timeval tv1,tv2,dtv;
struct timezone tz;
void time_start() { gettimeofday(&tv1, &tz); }
long time_stop()
{ gettimeofday(&tv2, &tz);
dtv.tv_sec= tv2.tv_sec -tv1.tv_sec;
dtv.tv_usec=tv2.tv_usec-tv1... | ALGO | 0.999678 | 3.168541 |
e1a5c19f-dbf5-4744-9de6-2143eb80fc63 | alxgunin/AaDS-2 | 6contest/taskP.cpp | // dp[i][mask] -- number of ways to get
// to the i-th column with bitmask mask
#include <algorithm>
#include <iostream>
#include <vector>
typedef long long Ll;
const Ll kMod = 1e9 + 7;
int Prev(int mask, int first, int sz) {
int res = first;
for (int i = 0; i + 1 < sz; ++i) {
int mask_bit1 = static_cast<int... | ALGO | 0.999991 | 5.114974 |
be336ece-ef9f-423f-984e-e76886e60312 | leonardofmoura/Programming | Project 1 - Playwords/procdic.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
//if word has a colon deletes it
string colon_elim(string word) {
if (word.back() == ';') {
word.erase(word.length()-1);
return word;
}
else {
return word;
}
}
string space_eli... | TOOL | 0.869834 | 5.061598 |
7057ee94-3c89-462a-b369-f2b8d1ccdc86 | frelwx/homework | luogu/increase/1439.cpp | #include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 1e5 + 100;
int n, a[maxn], b[maxn], dp[maxn], c[maxn];
bool cmp(int x, int y){
return c[x] > c[y];
}
int main()
{
cin >> n;
for(int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
dp[i] = 1e9;
}
for(int i = 1; i <= n... | ALGO | 0.999965 | 3.56483 |
31826313-4652-4828-babb-2d10e35e70ea | lifeofsoumya/LeetCode | 0947-most-stones-removed-with-same-row-or-column/0947-most-stones-removed-with-same-row-or-column.cpp | class Solution {
public:
int removeStones(vector<vector<int>>& stones) {
for (int i = 0; i < stones.size(); ++i)
uni(stones[i][0], ~stones[i][1]);
return stones.size() - islands;
}
unordered_map<int, int> f;
int islands = 0;
int find(int x) {
if (!f.count(x)) f[... | ALGO | 0.999243 | 5.71824 |
538092be-20b3-476c-8064-b62861600e30 | eari100/Algorithms_Workbook | cpp/Baekjoon/implementation/Q11559.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
/**
* @source: https://www.acmicpc.net/problem/11559 (Puyo Puyo)
* @classification: implementation
* @문제 푼 날짜 (자력으로 풂?): 25.07.27 (X, down 로직 애매해서 다른 소스 참고)
**/
int main()
{
queue<vector<int>> removes;
queue<vector<int>> remove_one;
... | ALGO | 0.9996 | 4.776092 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.