Skip to content

Instantly share code, notes, and snippets.

#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
bool pedra[maxn][maxn], visitado[maxn][maxn];
int n, m, sc, sl, rc, rl;
void dfs(int c, int l){
visitado[c][l] = 1;
for(int d=1; d<=3; d++){
// note que temos que checar se o vértice está dentro do lago,
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int a, b;
cin >> a >> b;
int ans = 0;
set<ll> quadrado, cubo;
for(int i=1; i<=10000; i++){
quadrado.insert(i*i);
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
int n, q, a[maxn];
struct no{
ll seg, pref, suf, sum;
no(){
seg = pref = suf = sum = 0;
}
int merge(int a, int b){
return a + b;
}
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
string mat[maxn][maxn];
int vl[maxn], vc[maxn];
map<string, int> m;
set<string> s;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n, M;
#include<bits/stdc++.h>
using namespace std;
int freq[26];
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n;
cin >> n;
int soma = 0;
for(int i=1; i<=n; i++){
int num;
#include<bits/stdc++.h>
using namespace std;
int freq[26];
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n;
cin >> n;
string s;
getline(cin, s);// Note que usamos getline(cin, s) duas vezes, isso deve-se ao fato
getline(cin, s);// de, na entrada, após lermos o inteiro n, existe um '\n', que foi lido
#include <cstdio>
#include <algorithm>
#include <vector>
constexpr int maxn = 1e5+10;
struct DSU {
int pai[maxn], peso[maxn];
DSU() { for(int i = 0; i < maxn; i++) pai[i] = i, peso[i] = 1; }
int find(int x) { return pai[x] == x ? x : pai[x] = find(pai[x]); }
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
vector<int> grafo[maxn];
vector<pair<int,int>> arestas;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n, m;
cin >> n >> m;
for(int i=1; i<=m; i++){
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
vector<int> grafo[maxn];
vector<pair<int,int>> arestas;
set<pair<int,int>> usadas;
bool mark[maxn];
void dfs(int u){
mark[u] = 1;
for(int i=0; i<grafo[u].size(); i++){