uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
737e7112-b842-44cb-bea3-7fd42cabcda7 | Vinicius-Reis-da-Silva/problemas-resolvidos-de-maratonas | 1114 - Senha Fixa - URI Online Judge.cpp | #include<iostream>
using namespace std;
int main()
{
setlocale(LC_ALL,"Portuguese");
int senha=2002 , tentar=0;
while(tentar != senha){
cin >> tentar;
if(tentar == senha){
cout << "Acesso Permitido\n";
}else{
cout << "Senha Invalida\n";
}
}
return 0;
... | TOOL | 0.970233 | 3.408818 |
9a8bb193-8539-4642-811a-816da15911b2 | brycemiller2/godot | thirdparty/basis_universal/encoder/basisu_ssim.cpp | #ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
namespace basisu
{
float gauss(int x, int y, float sigma_sqr)
{
float pow = expf(-((x * x + y * y) / (2.0f * sigma_sqr)));
float g = (1.0f / (sqrtf((float)(2.0f * M_PI * sigma_sqr)))) * pow;
return g;
}
// size_x/y should be odd
void compute_gaussia... | ALGO | 0.994448 | 6.309251 |
471f2e2c-be3b-496a-9f46-0e79dc35a4e7 | eth4n22/ChronoCapsuleFinal | 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 |
b9993c90-eae0-479a-91f7-54ad59b0183a | log1cs/hotpot | laptrinhnangcao/sapxepten.cpp | #include<iostream>
#include<cstring>
std::string chuanhoa(std::string a)
{
a = " " + a;
for (int i = 1; i < a.size(); i++)
{
a[i] = std::tolower(a[i]);
}
std::cout << a << std::endl;
for (int i = 1; i < a.size(); i++)
{
if (a[i - 1] == ' ' && a[i] != ' ')
{
... | TOOL | 0.996072 | 3.81912 |
16cc8798-18c3-4752-9d9f-1e18dfdb25cc | ishandutta2007/codeforces | njwrz/normal/1203/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pb push_back()
#define all(a) a.begin(),a.end()
using namespace std;
void voi(){
int n,a[405];
scanf("%d",&n);n=(n<<2);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
sort(a+1,a+n+1);
if(a[1]==a[2]&&a[n-1]==a[n]){
int t=a... | ALGO | 0.999898 | 3.298656 |
602c7fe4-f063-4aae-b19c-46dcb533d157 | TrungKien15/ProjectDSA | Đồ án/24120267_24120079/DataGeneration/DataGenerator.cpp | #include <iostream>
#include <fstream>
#include <cmath>
#include <time.h>
using namespace std;
template <class T>
void HoanVi(T &a, T &b)
{
T x = a;
a = b;
b = x;
}
//-------------------------------------------------
// Hàm phát sinh mảng dữ liệu ngẫu nhiên
void GenerateRandomData(int a[], int n)
{
srand((unsign... | TOOL | 0.935183 | 3.699663 |
a1ff7eb5-9524-4d3c-bae7-3c3f239185ce | AlexandruValeanu/Competitive-Programming | Mindcoding/Palarb.cpp | #include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
using namespace std;
typedef unsigned long long ull;
const ull BASE = 666013;
const int Nmax = 1e5 + 2;
vector <int> G[Nmax];
ull h1[Nmax], h2[Nmax];
char ch[Nmax];
int depth[Nmax];
int N, T;
string str;
void DFS( int nod, int tata, ull B... | ALGO | 0.999511 | 4.175374 |
d795a8c5-07c6-420f-a419-aec7b8759637 | Gyanthakur/GFG_POTD | august_2023/potd_01_08_2023.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
return 0;
}
class Solution {
public:
void dfs(int V, vector<int> adj[], vector<int> &res, unordered_set<int> &visited) {
res.push_back(V);
visited.insert(V);
for (int i = 0; i < adj[V].size(); i++) {
if (visited.find... | ALGO | 0.999823 | 5.296418 |
3d6df365-ec08-49f1-909c-4577e4b39071 | elkcl/tinkoff | lesson11-geometry1/B11.cpp | #pragma GCC optimize("O3")
#include <iostream>
#include <vector>
#include <random>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vc = vector<char>;
struct ... | ALGO | 0.999664 | 4.183238 |
adfb030e-c0dd-4ddb-930a-9d588a2122f6 | ishandutta2007/codeforces | arterm/normal/1531/E1.cpp | #include "bits/stdc++.h"
using namespace std;
const int M = 1'100;
int a[M];
int b[M];
int x[M];
int n = 16;
string s;
void restore(int l, int r) {
if (r - l <= 1)
return;
int m = (l + r) >> 1;
restore(l, m);
restore(m, r);
int i = l;
int j = m;
int k = l;
while (i < m && j < r) {
if (s.b... | ALGO | 0.999932 | 3.505894 |
37b40715-4b6d-4a30-8b93-98364cfea6d5 | dog-god/iptv | Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp | #include "compiler/ArrayBoundsClamper.h"
#include "compiler/BuiltInFunctionEmulator.h"
#include "compiler/DetectRecursion.h"
#include "compiler/ForLoopUnroll.h"
#include "compiler/Initialize.h"
#include "compiler/InitializeParseContext.h"
#include "compiler/MapLongVariableNames.h"
#include "compiler/ParseHelper.h"
#inc... | TOOL | 0.926596 | 6.199524 |
1a292223-0c58-403a-96f2-6abd6df3e36b | yplusplus/aabbyy | 20140217/j.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 222;
const int M = 222;
int n, m;
#define MP make_pair
typedef pair<int, int> pii;
void get_point(pii &p) {
scanf("%d%d", &p.first, &p.second);
}
int sign(int x) {
return x > 0 ? 1 : (x < 0 ? - 1: 0);
}
pii operator - (const pii &a, const pii &b) {
... | ALGO | 0.999113 | 3.969852 |
d5e53fbe-eb24-48e2-8401-92aa0e522dee | asb-514/Programming-questions | removal-game.cpp | #if ONPC
#define _GLIBCXX_DEBUG
// #include "bits/stdc++.h"
#else
#include <bits/stdc++.h>
#endif
#define sz(a) ((int)((a).size()))
#define char unsigned char
#define pi 3.141592653589793238
using namespace std;
// mt19937 rnd(239);
// mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
typedef long... | ALGO | 0.999838 | 4.010965 |
c3147465-d812-44c8-af64-67891dfb2ac1 | sudebzkrtt1/agac | main.cpp | #include <iostream>
#include "Trie.h"
#include <fstream>
#include <sstream>
/**
* Main application entry point for the Trie-based dictionary search program.
* It loads words from a dictionary file into a Trie structure, then processes commands from an input file
* to search words and prefixes, outputting results to... | TOOL | 0.920024 | 6.264801 |
c5de2fba-9822-456b-bd3e-5ba713a90177 | oonchulip97/path_planning | src/Eigen-3.3/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.998531 | 3.818773 |
643017cd-e6ac-4f44-bd37-884b35cd42f1 | copskim/LeetCode | GitHubCPPS/69Sqrt(x).cpp | class Solution {
public:
int mySqrt(int x) {
const int xmax = 46341;
int lb = 0;
int rb = xmax;
while ((rb - lb) > 1) {
int mid = (lb + rb) / 2;
if (x > mid * mid) lb = mid;
else if (x < mid * mid) rb = mid;
else return mid;
}
... | ALGO | 0.999824 | 5.675478 |
dc72fae4-15d9-45df-b2e7-89893bd9b187 | SirMouthAlot/SpriteLib3.0-v2.0 | SpriteLib3.0-v2.0/SpriteLib3.0-v2.0/include/Box2D/Collision/b2CollidePolygon.cpp | #include "Box2D/Collision/b2Collision.h"
#include "Box2D/Collision/Shapes/b2PolygonShape.h"
// Find the max separation between poly1 and poly2 using edge normals from poly1.
static float32 b2FindMaxSeparation(int32* edgeIndex,
const b2PolygonShape* poly1, const b2Transform& xf1,
const b2PolygonShape*... | ALGO | 0.99976 | 6.833144 |
ad78dff1-324f-47f8-a014-9100d4055e24 | lsiddiqsunny/programming-contest | Interview Bit/Array/Google Add One To Number.cpp | vector<int> Solution::plusOne(vector<int> &A) {
vector<int>B,ans;
int carry=1;
for(int i=A.size()-1;i>=0;i--){
if(A[i]==9 and carry==1){
B.push_back(0);
carry=1;
}
else if(carry==1){
B.push_back(A[i]+1);
carry=0;
}
else ... | ALGO | 0.999833 | 4.989711 |
cd9f338f-8f56-464e-842b-e4f0dc7029b9 | powder2005/etohari | vnoi/fcc2018_fccup18.cpp | #include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using pld = pair < ld, ld >;
using point = pair < ld, ld > ;... | ALGO | 0.99992 | 3.851099 |
e0e37738-6588-4e3a-aba1-90712fdd186f | KratosMultiphysics/KratosLegacyApplications | ThermoMechanicalApplication/custom_elements/heat_contact_3d.cpp | // System includes
// External includes
// Project includes
#include "includes/define.h"
#include "custom_elements/heat_contact_3d.h"
#include "utilities/math_utils.h"
#include "thermo_mechanical_application.h"
#include "includes/convection_diffusion_settings.h"
namespace Kratos
{
//*********************************... | ALGO | 0.998764 | 4.734659 |
52e219c6-23e4-4eb0-9c01-02316100ad47 | AYUSH-002/LEETCODE | 0104-maximum-depth-of-binary-tree/0104-maximum-depth-of-binary-tree.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.999726 | 6.144885 |
eac6c924-8c9e-4710-b41d-f5cea040a4eb | Ismail-Upal/CP-Trash | Solved Problem/Subarray_Sums_I.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double
#define endl "\n"
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mx=2e5+12;
int a[mx];
ll sum[mx];
int main()
{
optimize();
int n,x;cin>>n>>x;
for(int i=1;i<=n;i++){
cin>>a[i];
... | ALGO | 0.999933 | 4.101759 |
5b1cc801-12f1-40a9-918d-7b1bb5580927 | aditya-sengupta/simea | lib/boost_1_70_0/libs/graph/example/bfs-example2.cpp | #include <iostream>
using namespace boost;
template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor {
typedef typename property_traits < TimeMap >::value_type T;
public:
bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { }
template < typename Vertex, typename Graph >
void... | ALGO | 0.999774 | 6.128194 |
fa1b2ec6-fcb4-4884-84e2-e163a7bebffb | bakaxgenesis/frameworks_av | media/module/codecs/m4v_h263/dec/src/datapart_decode.cpp | #include "mp4dec_lib.h"
#include "vlc_decode.h"
#include "bitstream.h"
#include "scaling.h"
#include "mbtype_mode.h"
#include "idct.h"
#define OSCL_DISABLE_WARNING_CONDITIONAL_IS_CONSTANT
/* ======================================================================== */
/* Function : DecodeFrameDataPartMode() ... | ALGO | 0.91682 | 5.404089 |
290466aa-61c6-4cea-855b-da34a85fd2a0 | alexjordan/otawa | elm/src/util_BitVector.cpp | #include <elm/util/BitVector.h>
#include <elm/int.h>
namespace elm {
/**
* Class for building the bit counter array.
* @ingroup utility
*/
class BitCounter {
public:
char counts[256];
inline BitCounter(void) {
for(int i = 0; i < 256; i++) {
counts[i] = 0;
for(int j = 1; j < 256; j <<= 1)
if(i & j)
... | TOOL | 0.874821 | 6.271135 |
e8407f68-c7c1-45ef-aa20-6692868fde99 | ishandutta2007/codeforces | ae04071/normal/743/A.cpp | #include <stdio.h>
int n, a, b;
char str[200000];
int main()
{
scanf("%d %d %d", &n, &a, &b);
scanf("%s", str);
if (str[a - 1] == str[b - 1])printf("0\n");
else printf("1\n");
return 0;
} | ALGO | 0.999895 | 3.376532 |
403fd854-cf4f-46cf-9dbc-8c3f546ad6db | Cyrus2D/agent2d-data-extractor | src/bhv_set_play_indirect_free_kick.cpp | // -*-c++-*-
/////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "bhv_set_play_indirect_free_kick.h"
#include "strategy.h"
#include "bhv_set_play.h"
#include "bhv_prepare_set_play_kick.h"
#include "bhv_go_to_static_ball.h"
#include "bhv_cha... | ALGO | 0.967011 | 5.71017 |
3a9219e7-7db1-4ed8-ac79-336d42f7c1a5 | 4245877/Julia | libraries/opencv/opencv-4.11.0/sources/samples/cpp/flann_search_dataset.cpp | // flann_search_dataset.cpp
// Naive program to search a query picture in a dataset illustrating usage of FLANN
#include <iostream>
#include <vector>
#include "opencv2/core.hpp"
#include "opencv2/core/utils/filesystem.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/flann.hpp"
u... | ALGO | 0.994949 | 5.985428 |
593b99c3-8b87-40ea-a4a9-da52785cd181 | TrMTan/Code-CPP-PTIT | c++ tren lop/c++/507.cpp | #include<bits/stdc++.h>
using namespace std;
long long ucln(long long a, long long b){
while(b != 0){
long long r = a % b;
a = b;
b = r;
}
return a;
}
struct PhanSo{
long long tu, mau;
};
void nhap(PhanSo &p){
cin >> p.tu >> p.mau;
}
void rutgon(PhanSo &p){
long long... | ALGO | 0.999595 | 4.841858 |
60653d5f-d9b0-44b0-94ac-7d7d0b80cac5 | caoahn/CodePtitCplus | pt thua so nto.cpp | #include<bits/stdc++.h>
using namespace std ;
int main() {
int t ;
cin >> t ;
while(t--) {
int n ;
cin >> n ;
for(int i=2;i<= sqrt(n) ; i++) {
if( n % i == 0) {
int cnt = 0 ;
while(n % i == 0) {
++cnt ;
n /= i ;
}
cou... | ALGO | 0.999725 | 4.266314 |
a6f09c62-63f5-40ca-9984-d01b817aac14 | shivvamm04/C-by-luv | disktra.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
const int INF = 1e5+10;
vector<pair<int, int>> g[N];
vector<int> dist(N,INF);
vector<bool> vis(N,false);
void dijkstra(int source){
set<pair<int,int>> st;
st.insert({0,source});
dist[source] = 0;
while(st.size()>0){
auto n... | ALGO | 0.99999 | 3.87628 |
88145c7a-3c3d-4282-ab7c-9b054086cd85 | AdarshNandanwar/DSA-and-Competitive-Programming | CodingNinjas/Graphs 1/has_path.cpp | // Code : Has Path
// Send Feedback
// Given an undirected graph G(V, E) and two vertices v1 and v2(as integers), check if there exists any path between them or not. Print true or false.
// V is the number of vertices present in graph G and vertices are numbered from 0 to V-1.
// E is the number of edges present in gra... | ALGO | 0.999946 | 5.40803 |
72594d06-1e4b-444d-9cbb-7a3c2e8a4872 | HorizonTEL/Algorithms-OJ | C++版本/P1793 求解迷宫问题.cpp | #include<bits/stdc++.h>
#include<string>
using namespace std;
string mi[8];
int temp[8][8] = {0}; // ŷ,
void find_road(int x, int y){
mi[x][y] = 'K';
if(x == 7 && y == 7)
return;
//
if(x < 7 && mi[x+1][y] == 'O'){
temp[x+1][y] = 3;
find_road(x+1, y);
}
//
else if(y < 7 && mi[x][y+1] == 'O'){
temp[... | ALGO | 0.999226 | 3.925471 |
cc887448-227f-4c1f-a92c-9238d5687bfc | niqqq25/Balls-and-Magnets | Circle/Utilities.cpp | #include "Utilities.h"
void Random::RandSeedInit()
{
srand(time(NULL));
}
int Random::RandNumberGen(int minNumber, int maxNumber)
{
int generatedNum = (rand() % (maxNumber - minNumber + 1)) + minNumber;
return generatedNum;
}
float Formulas::Distance(int x1, int x2, int y1, int y2)
{
float d = sqrt((float)((x1 ... | TOOL | 0.920689 | 5.047067 |
2a20580b-2dc1-4e23-a7e1-456642880f93 | raincross7/code-similarity | codes/train_code/problem002/problem002_236.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> times(5);
vector<int> dist(5);
int t = 0;
int tmp = 0;
int i = 0;
while(cin >> tmp) {
times[i] = tmp;
int count = 0;
while(!(tmp % 10 == 0)) {
tmp ++;
count ++... | ALGO | 0.999302 | 3.027897 |
49bbaa9e-e057-4148-9ea0-6997b1b9fc78 | piwpiw200/Codeforces_sheet1 | Problem_J.cpp | #include<iostream>
using namespace std;
int main(){
int A, B;
cin>>A>>B;
if(A%B==0 || B%A==0){
cout<<"Multiples"<<endl;
}
else{
cout<<"No Multiples"<<endl;
}
return 0;
}
| ALGO | 0.999913 | 4.010738 |
b617a436-0d82-48ee-8d71-d7a7c7293497 | Rhoban/IKWalk | IKWalk.cpp | #include "IKWalk.hpp"
#include "CubicSpline.hpp"
namespace Rhoban {
bool IKWalk::walk(
const IKWalkParameters& params,
double dt,
double& phase,
IKWalkOutputs& outputs)
{
//Init Humanoid Model
Leph::HumanoidModel model(
params.distHipToKnee,
params.distKneeToAnkle,
... | ALGO | 0.997871 | 5.789679 |
244856bf-fccd-40eb-8175-68733c61efdf | manish-kumar1/LeetCode-Problems | JUSPAY/Maximum_Weight_Node.cpp | /*
Q. Maximum Weight Node
Given a maze with N cells. Each cell may have multiple entry points but not more than one exit (i.e entry/exit points are unidirectional doors like valves).
You are given an array Edge[] of N integers, where Edge[i] contains the cell index that can be reached from cell i in one step. Edge[i] ... | ALGO | 0.999959 | 4.656133 |
00750676-06e0-4b8c-a353-09c28f30fc6d | ble3p/design_pattern | Behavioral/cor.cpp | /*
参与者:
Handler 定义一个处理请求的接口
ConcreteHandler 处理它所负责的请求,可访问它的后继者
Client 向链上的具体处理这对象提交请求
协作:
当客户提交一个请求时,请求沿链传递直至有一个ConcreteHandler对象负责处理它
*/
// 每一个可以提供帮助的类继承自帮助类,如果能提供帮助就直接提供帮助,不能提供帮助就上升到父类去找链的下一位
//===================================================类定义==============... | TOOL | 0.989317 | 5.271848 |
1796de1b-1b1c-4048-b93b-408cd89de1ea | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_valid_5_3.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
string enemy, gregor;
cin >> enemy;
cin >> gregor;
int ans = 0;
for (int i = 0; i < n; i++) {
if (gregor[i] == '0')
continue;
else if (enemy[i] == '0')
... | ALGO | 0.999924 | 4.013373 |
50d79e88-06c2-423f-9abb-c8bdff2e3719 | koba-e964/contest | yukicoder/408.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include ... | ALGO | 0.999931 | 4.591345 |
b808cabf-5a8a-47c9-85f2-a7dce0727362 | Anshit-Sony/DSA_CPP | c++ basics_part2/Stack and Queue/infixToPrefix.cpp | #include<bits/stdc++.h>
using namespace std;
int priority(char x){
if(x=='^') return 3;
else if(x=='*' || x== '/') return 2;
else if(x== '+' || x=='-') return 1;
else return 0;
}
int main(){
stack<char> stk;
string Infixexp="(A+B)*C-D+F";
string prefixExp="";
int n=Infixexp.size();
... | ALGO | 0.999982 | 4.586581 |
0ccb15f3-8450-4371-8ebb-c2bc73ef48c4 | IvyLH03/algo-contest-archive | contest-algo-archive/p258s1.cpp | #include<cstdio>
#include<cmath>
using namespace std;
int a[9];
bool b[9],c[16],d[16];
int tot=0;
int search(int);
int print();
int main()
{
search(1);
return 0;
}
int search(int t)
{
int i;
for(i=1;i<=8;i++)
{
if((!b[i])&&(!c[i+t])&&(!d[i-t+7]))
{
a[t]=i;b[i]=1;c[i+t]=1;d[i-t+7]=1;
if(t==8)print();
e... | ALGO | 0.999669 | 3.44072 |
56cf0eff-c042-4942-a87b-9a17d5fceda0 | RomarioBasm/Leetcode | 1510-stone-game-iv/1510-stone-game-iv.cpp | class Solution {
public:
bool winnerSquareGame(int n) {
vector<bool> dp(n + 1);
for(int i = 1; i <= n; i++){
for(int j = 1; j * j <= i; j++){
if(!dp[i - j * j]){
dp[i] = true;
break;
}
}
}
... | ALGO | 0.999909 | 6.279753 |
88de18a3-6800-45bc-8181-402627caafac | Md-Minhajul-Islam/Codeforces | _Random/C_Corners.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define yes cout << "YES\n"
#define no cout << "NO\n"
#ifndef ON... | ALGO | 0.999873 | 4.201922 |
35646567-5806-4496-a748-dbb0be483b83 | judangs/algorithm | 프로그래머스/3/12927. 야근 지수/야근 지수.cpp | #include <string>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
long long solution(int n, vector<int> works) {
long long answer = 0;
priority_queue<int> pq(works.begin(), works.end());
for(int i=0; i<n; i++) {
int current = pq.top();
if(current > 0) {
... | ALGO | 0.999447 | 4.244148 |
6380186d-8912-4686-90e2-53a711f22d8b | Kchanana2025/Coding-ninjas-Codes | Priority Queues/Assignment/check_max_heap_1.cpp | // O(n)
// O(1)
bool isMaxHeap(int arr[], int n)
{
// Write your code here
for (int i = 0; i < n; i++)
{
int leftChildIndex = 2 * i + 1;
int rightChildIndex = 2 * i + 2;
if (leftChildIndex < n && rightChildIndex < n &&
(!(arr[leftChildIndex] < arr[i] && arr[rightChildInd... | ALGO | 0.989285 | 5.209836 |
26aebef2-d93a-4946-b929-eafbeccdb515 | Alaxe/noi2-ranking | 2020/solutions/C/GTA-Varna/range.cpp | #include<bits/stdc++.h>
#define endl '\n'
using namespace std;
unsigned long long a[100003];
int n, m, x, y, j;
int main ()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i ++)
{
cin >> j;
a[j] ++;
}
for(int i = 0; i <= 100000; i ++)
... | ALGO | 0.999907 | 4.002562 |
4bc58a3d-3bef-4a93-85d1-028fb34d50c1 | blackbird2003/acm_cpp | abc254_d.cpp | //
// Created by vv123 on 2022/6/4.
//
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 10;
int n, k;
vector<int> v[N];
bool issquare[N];
signed main() {
for (int i = 1; i <= 20; i++) issquare[i * i] = true;
for (int n = 1; n <= 20; n++) {
int ans = 0;
for ... | ALGO | 0.992868 | 3.753751 |
b0b1d935-93d2-46fa-a285-00185e7a2685 | purple-jwl/atcoder | src/ABC/144/C.cpp | #include <bits/stdc++.h>
#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define un... | ALGO | 0.999844 | 4.415828 |
70f14f6c-48a1-4c10-9f5a-bf268c1035ff | vinayaksahu/cpp-java-dsa | C++/7.Recursion/binarySearch.cpp | #include <iostream>
using namespace std;
void print (int *arr, int s, int e) {
for (int i = s; i < e; i++) {
cout << arr[i] << " ";
} cout <<endl;
}
bool binarySearch(int arr[], int s, int e, int key) {
print (arr, s, e);
//base case - not found
if (s > e)
return false;
... | ALGO | 0.999953 | 5.115444 |
7be65399-77ed-4c90-bd37-95a32f5f73d1 | trangnmnguyen/Data-Structure-and-Algorithm | Binary Search/Sort Substring.cpp | #include <iostream>
#include <cstdio>
using namespace std;
string s;
string dif_substring[100];
int n;
int count_subs;
string dif_substring_clone[100];
void Substring() {
string temp;
n = (int)s.length();
for(int i = 0; i < n; i++) {
temp = "";
for(int j = i; j < n; j++) {
... | ALGO | 0.999981 | 3.722251 |
c19997fe-7a40-4d2f-a70e-99fd12be1d2d | LJNing2610/AcWing- | 779. 最长公共字符串后缀.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
while(cin>>n,n){
string s,b;
cin>>s;
int sb=s.size();
for(int i=1;i<n;i++){
cin>>b;
int dasb=0;
for(int j=0;j<b.size()&&j<s.size();j++){
if(b[b.size()-1-j]==s[s.size()-1-j]){
dasb++;
}else{
break;
}
}
sb=... | ALGO | 0.999987 | 3.194942 |
eb049b8f-c1f2-4992-a085-3144e001cb42 | ChanHoHan/baekjoon | Implementation/gear.cpp | #include <iostream>
#include <string>
int A[9];
int B[9];
int C[9];
int D[9];
int state[3];
std::string a, b, c, d;
void make_gear()
{
int *x;
std::string y;
int val, index;
for(int i = 0 ; i < 4 ; i++)
{
if (i == 0)
{
x = A;
y = a;
}
else if (i == 1)
{
x = B;
y = b;
}
else if (i == 2)
... | ALGO | 0.99983 | 4.463327 |
e8669346-9798-4797-becb-99c4b3ca2c9c | rakibunateed/Problem-Solving | D_Asterisks.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
for (ll i = 0; i < n; i++) {
cout << "#";
}
cout << '\n';
for (ll i = 2; i <= n - 1; i++) {
cout << "#";
for (ll j = 2; j <= n - 1; j++) cout << ".";
... | ALGO | 0.99989 | 3.079152 |
42ad6428-550c-495d-b844-8c92e797462d | ishandutta2007/codeforces | fanache99/normal/899/C.cpp | //#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <climits>
#include <bitset>
using namespac... | ALGO | 0.99994 | 3.126924 |
a7c4d96a-6878-41d5-9fb8-722a8105a212 | MrYuxiangZhu/LeetCode | 031. 删除有序数组中的重复项.cpp | // 删除有序数组中的重复项.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
class Solution
{
public:
int removeDuplicates(std::vector<int>& nums)
{
if (nums.size() <= 1) return nums.size();
int slow = 0;
int fast = 1;
... | ALGO | 0.999435 | 6.021527 |
d37220bc-fdb1-426a-8604-e8396e7200ba | KalkiEshwarD/LeetCode | Medium/LongestSubstringWithoutRepeatingCharacters.cpp | #include <iostream>
#include <string>
#include <set>
using namespace std;
string findLongestSubstringWithoutRepeatingCharacters(string str) {
// Maintain a charset to hold all the characters that are part of the substring
set<char> charSet;
// Maintain a max length of the string found
// Maintain the... | ALGO | 0.999971 | 5.896871 |
71c781ca-4cf4-4161-8e9a-9c911a432e56 | ishandutta2007/codeforces | cheissmart/normal/1363/B.cpp | #include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
using namespace std;
typede... | ALGO | 0.99995 | 4.505941 |
b1a7a1f7-8ec7-47ca-b70d-6ed2338c6b73 | ShanksSU/codewars | 6kyu/Primorial Of a Number/main.cpp | /*
https://www.codewars.com/kata/5a99a03e4a6b34bb3c000124/cpp
*/
unsigned long long numPrimorial(unsigned short int number) {
int n = 1;
for (int i = 2; i <= 1000; i++) {
if (number == 0) break;
for (int j = 2; j <= i; j++) {
if (i % j == 0 && i != j) break;
if (j == ... | ALGO | 0.999958 | 5.654788 |
f146442b-799f-49bf-93cc-9736bee7f6db | samheather/3DVision | OpenCV/opencv-2.4.8/modules/ml/src/svm.cpp | #include "precomp.hpp"
using namespace cv;
#define CV_SVM_MIN_CACHE_SIZE (40 << 20) /* 40Mb */
#include <stdarg.h>
#include <ctype.h>
#if 1
typedef float Qfloat;
#define QFLOAT_TYPE CV_32F
#else
typedef double Qfloat;
#define QFLOAT_TYPE CV_64F
#endif
// Param Grid
bool CvParamGrid::check() const
{
bool ok =... | ALGO | 0.99507 | 4.003221 |
bad27f5b-af00-42cc-a07d-32720148950b | orenov/usaco | silver/graph_traversal/strong_components.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstdio>
#include <map>
#include <set>
// https://codeforces.com/problemset/problem/920/E
void dfs(int pos, std::vector<std::set<int>>& g, std::set<int>& unreachable, std::vector<bool>& visited) {
visited[pos] = true;
std::v... | ALGO | 0.999874 | 4.746438 |
40001e77-556e-4f65-bfd9-2b1eb7048b0a | manabuide/competitive-programming | atcoder/abc/101/b.cpp | #include <bits/stdc++.h>
using namespace std;
int s(int n) {
int total = 0;
while(n) {
total += n % 10;
n /= 10;
}
return total;
}
int main() {
int n;
cin >> n;
if(n % s(n) == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0... | ALGO | 0.999951 | 4.795412 |
7f4f8a99-4c02-41ef-b839-a3df13a153e5 | HabibaBaraka/LeetCode | repeated DNA.cpp | class Solution {
public:
vector<string> findRepeatedDnaSequences(string s) {
unordered_map<string,int>mp;
vector<string>DNA;
for(int i=0;i<s.size();i++)
{
string st=s.substr(i,10);
mp[st]++;
if(mp[st]==2)DNA.push_back(st);
}
... | ALGO | 0.99863 | 4.738491 |
e94769a1-c409-46b3-b71a-0844acc05f6f | B3TA-BLOCKER/Object-Oriented-Programming-in-Cpp | Friend Functions/More_on_Friend_Functions.cpp | #include<iostream>
using namespace std;
class Y;
class X{
int data;
public:
void setdata(int value){
data = value;
}
friend void add(X,Y); /* to execute it properly we need to give
FORWARD DECLARATION of the class Y; */
};
class Y{
... | TOOL | 0.907807 | 4.495803 |
b64aa710-d8ea-439f-8f4d-1cab24a5625a | dogmania/Algorithm | 프로그래머스/1/12932. 자연수 뒤집어 배열로 만들기/자연수 뒤집어 배열로 만들기.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(long long n) {
vector<int> answer;
string a = to_string(n);
int temp = 0;
for (long long i = a.length() - 1; i >= 0; i--) {
temp = a[i] - '0';
answer.push_back(temp);
}
return answer;
} | ALGO | 0.999655 | 5.569005 |
ba6175ca-5faf-4b4e-b7f4-c6f6bb318c20 | avijitgupta/contrail-avrotest | boost_1_49_0/libs/graph/example/boykov_kolmogorov-eg.cpp | #include <boost/config.hpp>
#include <iostream>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/boykov_kolmogorov_max_flow.hpp>
#include <boost/graph/read_dimacs.hpp>
#include <boost/graph/graph_utility.hpp>
// Use a DIMACS network flow file as stdin.
// boykov_kolmogorov-eg < max_flo... | ALGO | 0.998853 | 5.993138 |
9b7260c9-29f2-49e7-a078-e6dacc4352d4 | aokblast/LeetCode_Problem_Solving | Hard/987_Vertical_Order_Traversal_of_a_Binary_Tree.cpp | //
//Runtime 3
//Memory 12.2
/**
* 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,... | ALGO | 0.999994 | 6.159825 |
6a0d8202-38de-45f5-8e35-322129be18f4 | saba-javed524/lottery-app | 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.998859 | 6.785645 |
fd631ddb-2a75-4141-85e9-5c623c8aa199 | lucaspvc/FACULDADE | AEDS1/Prática/08-Lista1/Exercício 6/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]){
float paisA, paisB, taxaA, taxaB;
int ano;
ano = 0;
paisA = 90000000;
paisB = 200000000;
taxaA = 0.03;
taxaB = 0.015;
while (paisB > paisA){
paisA = (paisA*taxaA) + paisA;
paisB = (pai... | ALGO | 0.999555 | 4.108383 |
3b2c7c9e-b878-41a6-9f99-d676dc258708 | mir183/CodeForces | 272Vanya and Lanterns/m.cpp | #include <iostream>
#include<vector>
using namespace std;
#define ll long long int
#define ld long double
#define endl '\n'
#define fasterio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
int main() {
fasterio;
// Your code he... | ALGO | 0.996164 | 3.696546 |
b3f87b68-97d0-44fe-b846-239a1af616c1 | ElConroXD/ElCodigo-v | SEC6.cpp | #include <bits/stdc++.h>
using namespace std;
main(){
int a, c=1;cin>>a;
while(a--)
c*=2,cout<<c<<" ";
} | ALGO | 0.999546 | 3.358741 |
be588406-21e5-41d6-b282-31ae49fe8808 | WaleAdenuga/file_compressor | src/compressor/decompressor.cpp | #include "decompressor.h"
#include <iostream>
#include <fstream>
#include <sstream>
namespace Decompressor {
void HuffDecompressor::decompress (const std::filesystem::path& inputFilePath) {
// Read the data from the compressed file
// Layout of input file looks like this:
/**
... | ALGO | 0.859168 | 4.867188 |
904030b1-4e9f-4c79-b3f3-84c4cb300571 | clemkoh/csc417-fluid-simulator | extern/libigl/include/igl/is_vertex_manifold.cpp | template <typename DerivedF,typename DerivedB>
IGL_INLINE bool igl::is_vertex_manifold(
const Eigen::PlainObjectBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedB>& B)
{
using namespace std;
using namespace Eigen;
assert(F.cols() == 3 && "F must contain triangles");
typedef typename DerivedF::Scalar Index;
... | ALGO | 0.93372 | 6.418508 |
fdf7d03c-e8ad-4efb-b028-63a175fd00b9 | XP-online/leetcode | 二叉树专栏/二叉树的后续遍历/code(迭代实现).cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, Tree... | ALGO | 0.999986 | 5.972336 |
bb18d302-4f5d-4651-a891-9d0b9c908706 | younglionwell/coding-interview-guide | src/ch2_linked_list/11_reverse_nodes_in_k_group.cpp | /*
* LeetCode:https://leetcode.com/problems/reverse-nodes-in-k-group/
*【题目】
* 将单链表的每 K 个节点之间逆序:给定一个单链表的头结点 head,一个整数 k。实现让每 k 个节点之间逆序,
* 如果最后不够 k 个节点,则不调整最后几个节点。如:
* head: 1->2->3->4->5->6->7->8, k = 3 调整后为 3->2->1->6->5->4->7->8
*【要求】
* 如果链表长度为 N ,则时间复杂度为 O(N),空间复杂度为 O(1)。
*【解题思路】
* 利用依次遍历节点,每 k 个节点调用改自 04_r... | ALGO | 0.999982 | 5.357397 |
440b6bac-b515-499a-8277-d428c6ec7966 | kk77777/LeetCode-Solutions | q572_alt.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.999636 | 5.818217 |
9c17bc2a-c8db-44c9-8add-18edc1abb17b | ishandutta2007/codeforces | dingdingsb/normal/700/E.cpp | #include<bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define pc putchar
#define chkmx(a,b) (a)=max((a),(b))
#define chkmn(a,b) (a)=min((a),(b))
#define fi first
#define se second
using namespace std;
template<class T>
void read(T&x){x=0;char c=getchar();bool f=... | ALGO | 0.999992 | 4.136985 |
e12e32b4-ff85-4ef1-9f91-6722a2a336c0 | williamrshen/dmoj-solutions | solutions/ccc/ccc10j5.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <array>
#include <cstring>
using namespace std;
#define speed cin.sync_with_stdio(0); cin.tie(0);
#define int long long
#define pb push_back
#define pi pair<int, int>
signed main() {
speed
int sr, sc, er, ... | ALGO | 0.999912 | 4.077607 |
f26e7b8b-1e34-4db3-83e9-098690e99897 | zju3dv/MagLoc-AR | 3rd_party/eigen/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.989471 | 3.669638 |
0729af61-f1cd-4dd3-894a-8cb334d71b44 | ishandutta2007/codeforces | tearinfree/normal/947/B.cpp | #include <cstdio>
#include <algorithm>
#include <utility>
#include <queue>
#include <vector>
using namespace std;
typedef long long lli;
typedef pair<int,lli> pil;
int n;
lli va[100001],ta[100001];
int main() {
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%lld",va+i);
for(int i=1;i<=n;i++) scanf("%lld",ta+i),ta[i... | ALGO | 0.999973 | 3.29345 |
6c94215c-33f3-4ef9-b669-3e7957807244 | Shell-Wataru/AtCoder | AGC/AGC053/B.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>
#include <list>
using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
// https://ei1333.... | ALGO | 0.999987 | 4.484871 |
809f7874-087b-4480-a452-166374f29cde | mush902/gem5_alpha | src/systemc/tests/systemc/misc/cae_test/general/control/case/fsm/fsm.cpp | /*****************************************************************************
fsm.cpp --
Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-30
*****************************************************************************/
/*****************************************************************************
M... | ALGO | 0.984494 | 4.104457 |
8159b582-e526-4c9f-949c-0bf53446cae8 | ArjunSinghShekhawat/DSA-CPP | Week-3/tempCodeRunnerFile.cpp | #include <iostream>
using namespace std;
int max(int arr[][3])
{
int maxi = INT32_MIN;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (arr[i][j] > maxi)
{
maxi = arr[i][j];
}
}
}
return maxi;
}
int main()
{
... | ALGO | 0.990408 | 4.312355 |
64fffadf-4f4e-475a-8baf-b286952132ae | 113bommy/LogicalErrorFixCodeT5 | LogicalErrorFix_metric/CodeT5_LineNumber_cpp_source/Problem_145_source_697.cpp | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int INF = INT_MAX;
const long long LLINF = 1000000000000000000LL;
const long long MAX = 200005;
const long long MOD = 998244353;
struct DSU {
int N;
int parent[MAX], member[MAX];
DSU(int n) {
N = n;
for (int i = 0; i < N; i++) ... | ALGO | 0.999937 | 5.338518 |
4dd215c5-720d-4033-babd-fcdbe759d86a | buithog/DSA_PTIT | code thuc hanh/bieuthuctang giam.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
int dem =0;
while(t--){
string s;
cin>>s;
dem ++;
stack<int> st;
cout<<"Test "<<dem<<": ";
for(int i=0;i<=s.size();i++){
if(s[i] == 'I' || i == s.size()){
cout<<i+1;
while(!st.empty()){
cout<<st.top();
st.pop();... | ALGO | 0.987359 | 4.181553 |
f24a2d37-a14d-47cb-a194-281c5b491b94 | vassbar/Codeforces | 121A.cpp | #include <cstdio>
#include <iostream>
#include <vector>
std::vector<long long> findNext(std::vector<long long> luckyVec){
bool done(0);
for(int p = 0; p < luckyVec.size(); p++){
if(luckyVec[p] == 4){luckyVec[p] = 7; done = 1; break;}
else{luckyVec[p] = 4;}
}
if(!done){luckyVec.push_bac... | ALGO | 0.99984 | 4.343623 |
4956bdac-69e2-41a9-b58d-29fc064c22ee | leeeyupeng/leeeyupeng.github.io | project/algorithm/poj/src/2492.bugs.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <string.h>
#include <stdio.h>
using namespace std;
#define MAXVN 2010
class Solution{
public:
bool isbipartitegraph(int n,char matrix[MAXVN][MAXVN]){
char visit[MAXVN];
memset(visit,0,sizeof(char)... | ALGO | 0.999847 | 4.25385 |
3222e34a-4f10-4251-b89d-3c5907bfe1e1 | rsazid99/lightoj | loj1113.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <utility>
#include <bitset>
#include <list>
#include <algorithm>
#include <complex>... | ALGO | 0.999506 | 3.835557 |
55a6bde2-e311-40c2-89fc-d249a1239c94 | suee97/algorithm | algorithm/CPP/13460.cpp | // 포기
#include <bits/stdc++.h>
using namespace std;
int n, m;
char board[12][12];
int minMoveCount = 0;
int moveCount = 0;
pair<char, int> goal = {'N', -1};
pair<int, int> R_pos;
pair<int, int> B_pos;
void initBoard() {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
board[i][j] =... | ALGO | 0.999911 | 4.630688 |
52a43b8f-4428-43c6-888f-ab4f19f87732 | ishandutta2007/codeforces | benq/normal/1034/A.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef long long ll;
typedef long double ld;
typedef complex... | ALGO | 0.999969 | 3.615757 |
9ec64f9f-3f04-43d0-90da-f88d33cdac4b | ashwinchidambaram/COMSC-110 | myBillions.cpp | //Objective: Calculate ho many weeks it takes to become a somethingaire
//Name: Ashwin Chidambaram
//Course: COMSC-110-1021
//Compiler: TDM MinGW
//Editor: MS NotePad
//libraries
#include <iostream>
#include <string>
using namespace std;
//Programmer defined data types
//NONE
//Special compiler dependent definitio... | ALGO | 0.993256 | 3.437212 |
92916c28-dc33-4924-af81-57264eb95448 | himanshuantal5640/Cpp | DSA/setmatrixzero.cpp | #include<bits/stdc++.h>
using namespace std;
// Brute force approach:-
// void markrows(vector<vector<int>> &matrix, int n,int m ,int i){
// for(int j =0;j<m;j++){
// if(matrix[i][j] != 0){
// matrix[i][j] = -1;
// }
// }
// }
// void markcol(vector<vector<int>> &matrix, int n, int m... | ALGO | 0.999698 | 5.641647 |
45983797-699f-4dbd-8f3a-2e8ddd6b96d8 | Ayush-Kmr/Leet-Code | 1457-pseudo-palindromic-paths-in-a-binary-tree/1457-pseudo-palindromic-paths-in-a-binary-tree.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.999842 | 5.95581 |
605a0eac-6345-4de4-b996-c08522a3239f | Naushad-ansarintiw/DSA_REPO | Graph/Breadth_First_search(BFS).cpp | // S.C O(n)
// T.C O(n) + O(2*E) 2*E: is total degree of graph
class Solution {
public:
// Functions to return the Breadth First Traversal of given graph structure;
vector<int> bfsOfGraph(int V, vector<int> adj[]){
int vis[n] = {0};
vis[0] = 1;
queue<int> q;
... | ALGO | 0.999963 | 5.523943 |
98a4fdbd-6f96-4873-a735-10faaec0ea70 | chhavipaliwal/leetcode | 3657-check-if-grid-can-be-cut-into-sections/check-if-grid-can-be-cut-into-sections.cpp | template<typename T1, typename T2> bool cmax(T1 &x, const T2 &y) { if (x < y) { x = y; return 1; } return 0; }
class Solution {
public:
bool check(vector<pair<int, int>> arr){
sort(arr.begin(),arr.end());
int prev = -1;
int cnt = 0;
for(int i=0; i<arr.size(); i++){
int l... | ALGO | 0.999879 | 5.526233 |
9ead4d64-7da1-4597-ab7b-f79e59b3bc34 | ShrutiRani7029/SHEET_PLACEMENT | subset_sum_equal_to_target.cpp | #include <bits/stdc++.h>
/*
///Memorization
bool fun(int ind, int target, vector<int>& arr,vector<vector<int>>&dp){
if(target==0)return true;
if(ind==0)return arr[0]==target;
if(dp[ind][target]!=-1)return dp[ind][target];
bool not_take=fun(ind-1,target,arr,dp);
bool take=false;
if(arr[ind]<=target)ta... | ALGO | 0.999982 | 5.317035 |
5aeadd49-8b24-4751-a8c9-2454c1e18973 | HanYouyang/Computer | 数据结构与算法/PATCode/Others/algorithm-practising-master/codeup/1818_greatestCommondivisor.cpp |
#include <cstdio>
int gcd(int a, int b)
{
if(b == 0) return a;
else return gcd(b, a % b);
}
int main()
{
int a, b;
while(~scanf("%d%d", &a, &b)){
if(a > b) printf("%d\n", gcd(a, b));
else printf("%d\n", gcd(b, a));
}
return 0;
}
| ALGO | 0.999856 | 3.826989 |
af6f647e-6dec-480e-a292-51788481bda7 | gihwanJang/Algorithm | cpp/Baekjoon18870/Baekjoon18870.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main(int argc, char const *argv[]){
int n;
scanf("%d", &n);
int nums[n];
for(int i = 0; i < n; ++i)
scanf("%d", &nums[i]);
vector<int> sortNums(nums, nums + n);
sort(sortNums.begin(), s... | ALGO | 0.999985 | 3.735327 |
ee9d4b7d-721e-48ef-ab21-6b95212555cc | Bibbeep/kattis-solutions | Tarifa.cpp | #include <iostream>
using namespace std;
int main()
{
int x;
cin >> x;
int n;
cin >> n;
int p[n];
int remaining_x = 0;
for ( int i = 0; i < n; i++)
{
cin >> p[i];
remaining_x += x;
}
for ( int i = 0; i < n; i++)
{
remaining_x -= p[i];
}
... | ALGO | 0.999681 | 3.118098 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.