source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include <bits/stdc++.h> #define r(i,n) for(int i=0;i<n;i++) #define N return puts("NO"); #define I int s(){I n;std::string s,t;std::cin>>n>>s>>t;I c[26][26]{};r(i,n)c[s[i]-97][t[n-1-i]-97]++;if(n&1){ I o=0;r(i,26)r(j,26)if(c[i][j]+(i!=j)*c[j][i]&1){if(i!=j||o)N o=1;}}else r(i,26)r(j,26)if(c[i][j]+(i!=j)*c[j][i]&1)N re...
C++
2d011ba7eaa16642d77dade98966b54a
45a649c1effcea60ca0fe9341e0a5555
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define r(i,n) for(int i=0;i<n;i++) #define N return puts("NO"); #define I int s(){I n;string s,t;cin>>n>>s>>t;I c[26][26]{};r(i,n)c[s[i]-97][t[n-1-i]-97]++;if(n&1){ I o=0;r(i,26)r(j,26)if(c[i][j]+(i!=j)*c[j][i]&1){if(i!=j||o)N o=1;}}else r(i,26)r(j,26)if(c[i][j]+(i!=j)*c[j...
C++
2d011ba7eaa16642d77dade98966b54a
b6d3c48e57af71c499bd5c655f57ba1c
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define F if #define r(i,n) for(int i=0;i<n;i++) #define N return puts("NO"),0; #define I int s(){I n;string s,t;cin>>n>>s>>t;I c[26][26]{};r(i,n)c[s[i]-97][t[n-1-i]-97]++;F(n&1){ I o=0;r(i,26)r(j,26)F(c[i][j]+(i!=j)*c[j][i]&1){F(i!=j||o)N o=1;}}else r(i,26)r(j,26)F(c[i][j]...
C++
2d011ba7eaa16642d77dade98966b54a
35a03784f0c3ec3940c0ae6e6ea6c591
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define r(i,n) for(int i=0;i<n;i++) #define N return puts("NO"),0; #define I int s(){I n;string s,t;cin>>n>>s>>t;I c[26][26]{};r(i,n)c[s[i]-97][t[n-1-i]-97]++;if(n&1){ I o=0;r(i,26)r(j,26)if(c[i][j]+(i!=j)*c[j][i]&1){if(i!=j||o)N o=1;}}else r(i,26)r(j,26)if(c[i][j]+(i!=j)*c...
C++
2d011ba7eaa16642d77dade98966b54a
faf39a40baeac2d469fb9ff04a778339
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define N return puts("NO"),0; #define I int s(){I n;string s,t;cin>>n>>s>>t;I c[26][26]{};for(I i=0;i<n;i++)c[s[i]-97][t[n-1-i]-97]++;if(n&1){ I o=0;for(I i=0;i<26;i++)for(I j=i;j<26;j++)if(c[i][j]+(i!=j)*c[j][i]&1){if(i!=j||o)N o=1;}}else for(I i=0;i<26;i++)for(I j=i;j<26...
C++
2d011ba7eaa16642d77dade98966b54a
b746592703f980af99954538a7781a52
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define N return puts("NO"),0; #define I int s(){ I n;string s,t;cin>>n>>s>>t; I c[26][26]{}; for(I i=0;i<n;i++) c[s[i]-97][t[n-1-i]-97]++; if(n&1){ I o=0; for(I i=0;i<26;i++)for(I j=i;j<26;j++) if(c[i][j]+(i!=j)*c[j][i]&1){ if(i!=j||o)N o=1; } }el...
C++
2d011ba7eaa16642d77dade98966b54a
c0d68c9e75047560d8dca261e17f3376
2,200
PASSED
//#include<neverevergiveup> #include<bits/stdc++.h>// using namespace std; typedef long long ll; signed main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t;cin>>t; while(t--){string s,s5;cin>>s;s5=s;ll arr1[s.length()],arr2[s.length()];string s1;ll arr[10]={0}; sort(s5.begin(),s5.end());if(s5==s){cout...
C++
906b319e41f716e734cf04b34678aa58
932494a02a3ea8442cc28bfaa56e6fc5
1,200
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; //Speed #define Code ios_base::sync_with_stdio(false); #define By cin.tie(NULL); #define Asquare cout.tie(NULL); //Aliases using ll= long long; using lld= long double; using ull= unsigned long long; //Constants const lld pi= 3....
C++
906b319e41f716e734cf04b34678aa58
f1d7f33b56d731d007d8fe7dec81b1f5
1,200
PASSED
#include <iostream> #include <sstream> #include <string> #include <vector> #include <algorithm> #include <functional> #include <map> #include <bitset> #include <set> #include <deque> #include <queue> #include <stack> #include <unordered_map> #include <fstream> #include <unordered_set> #include <numeric> ...
C++
906b319e41f716e734cf04b34678aa58
8e5f79db1674e3dff8ba58ea10f80b3b
1,200
PASSED
#include <iostream> #include <sstream> #include <string> #include <vector> #include <algorithm> #include <functional> #include <map> #include <bitset> #include <set> #include <deque> #include <queue> #include <stack> #include <unordered_map> #include <fstream> #include <unordered_set> #include <numeric> ...
C++
906b319e41f716e734cf04b34678aa58
449b072106ba8b60a425b66a5d131608
1,200
PASSED
#include<iostream> #include<string.h> #include<math.h> using namespace std; char a[200001]={}; void solve(){ int l; gets(a); l=strlen(a); int b[11]={}; char mmin='9'; for(int i=l-1;i>0;i--) { mmin=min(a[i],mmin); if(a[i-1]>mmin) { if(a[i-1]!='9')a[i-1]++; } b[a[i]-'0']++; } b...
C++
906b319e41f716e734cf04b34678aa58
e1a81037f206a93cd3d6a63cf311feaf
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ string s; cin>>s; int n=s.length(); map<char,int> m; for(int i=0;i<n;i++){ char str=s[i]; m[str]++; } char a[n]; char ...
C++
906b319e41f716e734cf04b34678aa58
9d5a41a07fd271fcc750bfd13c7b9212
1,200
PASSED
#include<bits/stdc++.h> #define ll long long #define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define l__l ll t;cin>>t;while(t--) #define ss stringstream #define en end() #define bg begin() #define in push_back #define sz size() using namespace std; int main() {IOS l__l{ string s;cin>>s...
C++
906b319e41f716e734cf04b34678aa58
dddff6b070102374f9317732e8f50b44
1,200
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define ll long long #define ld long double #define mp make_pair #define pb ...
C++
906b319e41f716e734cf04b34678aa58
8a43364ca9dc0c6e5d8e63ba168e75e5
1,200
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define ll long long #define ld long double #define mp make_pair #define pb ...
C++
906b319e41f716e734cf04b34678aa58
9ab345f5862658e0ce64d1ec9e19be0d
1,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> PII; const int N = 2e5 + 10; int t; PII num[N]; int main () { cin >> t; while(t --) { string a; cin >> a; int n = a.size(); for(int i = 0; i < a.size(); i ++) { num[i].first = a[i] - '0'; num[i].second = i...
C++
906b319e41f716e734cf04b34678aa58
6d775414e213f23f0f8b6a7c16068c9c
1,200
PASSED
// LUOGU_RID: 90273013 #include <bits/stdc++.h> #define rep(i,l,r) for (int i = l; i <= r; i++) #define per(i,r,l) for (int i = r; i >= l; i--) #define fi first #define se second #define prt std::cout #define gin std::cin #define edl std::endl namespace wxy{ const int N = 5050; int n,k,f[N][1<<8],p[N]...
C++
e2124e1cc44869a5fd87121a1bc58506
09672aaa0f3c9d736d06b6fb16be39c4
2,700
PASSED
#include <bits/stdc++.h> #define rep(i,l,r) for (int i = l; i <= r; i++) #define per(i,r,l) for (int i = r; i >= l; i--) #define fi first #define se second #define prt std::cout #define gin std::cin #define edl std::endl namespace wxy{ const int N = 5050; int n,k,f[N][1<<8],p[N]; int g[N][N]; in...
C++
e2124e1cc44869a5fd87121a1bc58506
8956b0b457a6df9dc7f03dd208c85a6d
2,700
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T> struct fenwick_tree { using U = T; public: fenwick_tree() : _n(0) {} fenwick_tree(int n) : _n(n), data(n) {} void add(int p, T x) { assert(0 <= p && p < _n); p++; while (p <=...
C++
e2124e1cc44869a5fd87121a1bc58506
382f10b99efd40fa04578a512328a860
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int N=5010; int n,k,p[N],q[N],sum[N][N]; int dp[N][10][(1<<8)]; int cost[N][(1<<8)][10]; int popcnt[(1<<8)]; bool flag1,flag2; //i=j-k+popcnt //j=i+k-popcnt signed main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>k; for(int i=1;i<=n;i++)...
C++
e2124e1cc44869a5fd87121a1bc58506
7d86beca4263ddadd88a7617270a57c1
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int N=5010; int n,k,p[N],q[N],sum[N][N]; int dp[N][10][(1<<8)]; int cost[N][(1<<8)][10]; int popcnt[(1<<8)]; bool flag1,flag2; //i=j-k+popcnt //j=i+k-popcnt signed main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>k; for(int i=1;i<=n;i++)...
C++
e2124e1cc44869a5fd87121a1bc58506
392200d20d84f36e1a7f12ed834be473
2,700
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn = 5005; int n, k, p[maxn], pos[maxn], dp[maxn][(1 << 8) + 5], val[maxn][maxn], ex[maxn][(1 << 8) + 5][10], pc[(1 << 8) + 5]; struct BIT { int val[maxn]; inline void Init() { for(int i = 1; i <= n; ++ i) val[i] = 0; } inline void Add(int x) {...
C++
e2124e1cc44869a5fd87121a1bc58506
f582b53b862abd8759ba3ff8e368a4db
2,700
PASSED
// LUOGU_RID: 93676515 #include <stdio.h> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef pair <int, int> pii; #define ci const int template <class T> inline void chmax(T &x, const T &y) { if(x < y) x = y; } template <class T> inline void chmin(T &x, const T ...
C++
e2124e1cc44869a5fd87121a1bc58506
012f07fda06d6acc34eb1253f90c3938
2,700
PASSED
#include <stdio.h> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef pair <int, int> pii; #define ci const int template <class T> inline void chmax(T &x, const T &y) { if(x < y) x = y; } template <class T> inline void chmin(T &x, const T &y) { if(x > y) x = y; ...
C++
e2124e1cc44869a5fd87121a1bc58506
7863f1684e3e94807b3c752d931a8eb1
2,700
PASSED
#include <stdio.h> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef pair <int, int> pii; #define ci const int template <class T> inline void chmax(T &x, const T &y) { if(x < y) x = y; } template <class T> inline void chmin(T &x, const T &y) { if(x > y) x = y; ...
C++
e2124e1cc44869a5fd87121a1bc58506
b2775ab47bb4eabe9f7e90c421819548
2,700
PASSED
// LUOGU_RID: 90664700 #include<cstdio> #define TY int #define MAXN 5002 #define MAXM 8 #define debug if( 1 &&putchar('>')) #define FOR(i,a,b) for(TY i=(a);i<=(b);++i) #define fOR(i,a,b) for(TY i=(a);i<(b);++i) #define ROF(i,a,b) for(TY i=(a);i>=(b);--i) #define rOF(i,a,b) for(TY i=(a);i>(b);--i) using namespa...
C++
e2124e1cc44869a5fd87121a1bc58506
340b871b477176ab4f2b0c5c2b439b38
2,700
PASSED
#include <bits/stdc++.h> #define For(i,x,y) for(int i=(x);i<=(y);++i) #define Rof(i,x,y) for(int i=(x);i>=(y);--i) #define ll long long #define int long long using namespace std; const int N=5e5+5; const int M=1e6+5; vector<int> D[M]; void init(){ For(i,1,M-5) for(int j=i;j<=M-5;j+=i) D[j].push_back(i); ...
C++
a8b4291435590be202d618b6f005b071
3607ad25e9f89b50c84d7ba4eed089eb
2,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #define ll long long using namespace std; const int N=5e5+10,M=1e6; vector<int>divs[M+10],pos[M+10]; int v[N],lmax[N],lmin[N],rmax[N],rmin[N],sta[N],vis[M+10]; int main() { for(int i=1;i<=M;i++) for(int j=i;j<=M...
C++
a8b4291435590be202d618b6f005b071
79c993f2a26e1970b49346541dec8372
2,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #define ll long long using namespace std; const int N=5e5+10,M=1e6; vector<int>divs[M+10],pos[M+10]; int v[N],lmax[N],lmin[N],rmax[N],rmin[N],sta[N],vis[M+10]; int main() { for(int i=1;i<=M;i++) for(int j=i;j<=M...
C++
a8b4291435590be202d618b6f005b071
9af2b4de997ac0cfef00f0dbcb487013
2,700
PASSED
#include <bits/stdc++.h> using namespace std; using LL = long long; const int A = 1e6 + 10; vector<int> divs[A], pos[A]; vector<int> ind(A, 0); // O(N). void getIntervals(vector<int>& lefts, vector<int>& rights, vector<int>& a, bool smaller){ int n = a.size(); stack<int> stk; for(int i = 0; ...
C++
a8b4291435590be202d618b6f005b071
6c15def55979adce2d904222cdeafa4e
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 13; const int A = 1e6 + 13; vector<int> divs[A]; int a[N]; int gr_lf[N], gr_rg[N]; int less_lf[N], less_rg[N]; vector<int> pos[A]; int ind[A]; void solve() { int n; cin >> n; for(int i = 0; i < n; i++) { ...
C++
a8b4291435590be202d618b6f005b071
7ea1a51c98da55532673d30a112c3781
2,700
PASSED
#include<bits/stdc++.h> using namespace std; //#define int long long //#define db long double #define fi first #define se second #define pb push_back int rd() { int x=0,w=1; char ch=getchar(); while(!isdigit(ch)&&ch!='-') ch=getchar(); if(ch=='-') ch=getchar(),w=-1; while(isdigit(ch)) x=x*10+(ch-48)...
C++
a8b4291435590be202d618b6f005b071
cc3ec8b164deb08d456fc99475be937d
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define MV 1000000 vector< tuple<int, int, int> > min_borders[MV + 10]; vector<int> uoc[MV + 10]; int tp[MV + 10]; vector<int> a; vector<int> maxl, maxr, minl, minr; void init() { for (int i = 1; i <= MV; i++) for (int j = 1; j * i <= MV; j++) ...
C++
a8b4291435590be202d618b6f005b071
328567080598abb2f5c6cb35a001d152
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define MV 1000000 vector< tuple<int, int, int> > min_borders[MV + 10]; vector<int> uoc[MV + 10]; int tp[MV + 10]; vector<int> a; vector<int> maxl, maxr, minl, minr; void init() { for (int i = 1; i <= MV; i++) for (int j = 1; j * i <= MV; j++) ...
C++
a8b4291435590be202d618b6f005b071
6915282bcadb40b25f67ee139b2c1bca
2,700
PASSED
#include <stdio.h> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define pc putchar #define pb push_back #define rep(i, l, r) for(int i = l, i##end = r; i <= i##end; ++ i) #define per(i, r, l) for(int i = r, i##end = l; i >= i##end; -- i) char inputbuf[1 << 23], *p1 = inputbuf, *p2 = i...
C++
a8b4291435590be202d618b6f005b071
8a8ef84b68065ff83f6ccff67f49cd75
2,700
PASSED
// LUOGU_RID: 93675328 #include <stdio.h> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef pair <int, int> pii; #define ci const int template <class T> inline void chmax(T &x, const T &y) { if(x < y) x = y; } template <class T> inline void chmin(T &x, const T ...
C++
a8b4291435590be202d618b6f005b071
3b7f6c29a67c4238efa05c803e5e0219
2,700
PASSED
import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; public class B { public static void main(String[] args) { InputStream in = System.in; OutputStream out = System.out; Scanner go = new Scanner(in); PrintWriter o = new P...
Java
aae82b2687786818996e4e94c5505d8e
662a29f5a1c6d6975a31399a65782666
1,100
PASSED
import java.math.BigInteger; import java.util.*; import java.io.*; public class cf1656B { public static void main(String[] args) { FastReader in = new FastReader(); // PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int i = 0; i < t; i++) { ...
Java
aae82b2687786818996e4e94c5505d8e
9a60d8339b2806e390b5cd9e4a6028e4
1,100
PASSED
import java.math.BigInteger; import java.util.*; import java.io.*; public class cf1656B { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int i = 0; i < t; i++) { ...
Java
aae82b2687786818996e4e94c5505d8e
05ac3f2819f17843bc4f2a99037fc0da
1,100
PASSED
import java.io.*; import java.util.*; //https://codeforces.com/problemset/problem/1656/B public class SubtractOperation { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(Sy...
Java
aae82b2687786818996e4e94c5505d8e
c881dfa52d94a725d1285db0a430cb74
1,100
PASSED
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int tt=0; tt<t; tt++){ int n=in.nextInt(); int k=in.nextInt(); int[] a=new int[n]; M...
Java
aae82b2687786818996e4e94c5505d8e
318a5f7bab566c4014369a07e1194f78
1,100
PASSED
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int tt=0; tt<t; tt++){ int n=in.nextInt(); int k=in.nextInt(); int[] a=new int[n]; M...
Java
aae82b2687786818996e4e94c5505d8e
eebf03ad8212a571c5320e84244f2df0
1,100
PASSED
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int tt=0; tt<t; tt++){ int n=in.nextInt(); int k=in.nextInt(); int[] a=new int[n]; H...
Java
aae82b2687786818996e4e94c5505d8e
1a6abcd5d555068f1bb12cd8c2b00e77
1,100
PASSED
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int tt=0; tt<t; tt++){ int n=in.nextInt(); int k=in.nextInt(); int[] a=new int[n]; S...
Java
aae82b2687786818996e4e94c5505d8e
91e112683d7729fcb7b28c519f3ecf52
1,100
PASSED
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int tt=0; tt<t; tt++){ int n=in.nextInt(); int k=in.nextInt(); int[] a=new int[n]; S...
Java
aae82b2687786818996e4e94c5505d8e
63e31aed821042d600cb30f9d471c3ec
1,100
PASSED
import java.util.HashMap; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int tt=0; tt<t; tt++){ int n=in.nextInt(); int k=in.nextInt(); i...
Java
aae82b2687786818996e4e94c5505d8e
887bd1f4e1f554c205cabd120f157ce3
1,100
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
2cbf2b28c6e98c1f8f680d25af45ad88
800
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
508499e0c6d6542e2c45dedfb0f9990c
800
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
7d23a0a413c9b3f088a9c8cfa121c31a
800
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
5bdbe3dfa61d0e01b8ea7cb0ffb37ffa
800
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
90e22ae1c55522aebdef420d1e2e9756
800
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
32306d105460d31e93d685bdaa878e7f
800
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
251b53e56ff5ca67319c50325feb2789
800
PASSED
/** * author: magnus_hegdahl * created: 25.03.2022 23:11 * problem: A. Good Pairs * url: https://codeforces.com/contest/1656/problem/A */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namesp...
C++
7af4eee2e9f60283c4d99200769c77ec
1312acce0b8fae049ae0b24a061c1313
800
PASSED
// <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impyster { namespace internal { template<class T> using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>; template<class T> struct unref_tuple { using...
C++
7af4eee2e9f60283c4d99200769c77ec
40547f988d3eea206d5b142dde4f54c0
800
PASSED
#include<bits/stdc++.h> using namespace std; int main () { long long n, m ,r , i,j, s, t, x, S, P, p; cin >> t; while ( t --) { cin >> n; map < long long, long long > A; long long a[n + 2]; for ( i = 1; i <= n; i ++) { cin >> a[i]; A[a[i]] = i; } sort ( a + 1 , a + n + 1); ...
C++
7af4eee2e9f60283c4d99200769c77ec
35a7ddf3c762e8c21d0d186b17e8fe7d
800
PASSED
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define MOD 1000000007 using ll = long ...
C++
8063c96cf62727f1b98e476e43679da2
5ba38345c9b467c9b61c8d24b805ff67
1,900
PASSED
// #include <bits/stdc++.h> // {{{ // C #include <cctype> #include <cfloat> #include <ciso646> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <cwchar> // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iom...
C++
8063c96cf62727f1b98e476e43679da2
336f21b99b2e111341eb4507d4c3f42e
1,900
PASSED
//region #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef pair<int, int> pi; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; #define fastio ios_base::sync_with_stdio(0);cin.tie(NULL); #define endl "\n" #define pb push_back #define all(X) (...
C++
8063c96cf62727f1b98e476e43679da2
94b11e514f420f7746aed9eca430422a
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ins insert #define pb push_back #define lb lower_bound #define ub upper_bound #define mst(x) memset(x,0,sizeof(x)) #define mcpy(src,dst) memcpy(dst, src, sizeof(dst)) #define lcase(s) transform(s.begin(), s.end(), s.begin(), ::tolower) ...
C++
8063c96cf62727f1b98e476e43679da2
56bd8076c951b0efbc0608cf8fd6dc81
1,900
PASSED
#include <iostream> #include <vector> #include <random> using namespace std; bool online_judge = #ifdef ONLINE_JUDGE 1; #else 0; #endif struct { using X = int; template <typename T = X> T operator()() const...
C++
8063c96cf62727f1b98e476e43679da2
b9429443465e42333356069e7a05956d
1,900
PASSED
#include <iostream> #include <vector> using namespace std; bool online_judge = #ifdef ONLINE_JUDGE 1; #else 0; #endif struct { using X = int; template <typename T = X> T operator()() const { T t; cin >> t; r...
C++
8063c96cf62727f1b98e476e43679da2
ad30f4c4552bf4ff1d2bac336caec3bf
1,900
PASSED
#include <iostream> #include <vector> using namespace std; bool online_judge = #ifdef ONLINE_JUDGE 1; #else 0; #endif struct { using X = int; template <typename T = X> T operator()() const { T t; cin >> t; r...
C++
8063c96cf62727f1b98e476e43679da2
e98ead26cde2a282eb6228ae2eb2962e
1,900
PASSED
#include <iostream> #include <vector> #include <random> using namespace std; bool online_judge = #ifdef ONLINE_JUDGE 1; #else 0; #endif struct { using X = int; template <typename T = X> T operator()() const...
C++
8063c96cf62727f1b98e476e43679da2
ce835bb4352aaa05ba87f7169daa154d
1,900
PASSED
#include <iostream> #include <vector> #include <random> using namespace std; bool online_judge = #ifdef ONLINE_JUDGE 1; #else 0; #endif struct { using X = int; template <typename T = X> T operator()() const...
C++
8063c96cf62727f1b98e476e43679da2
f0a3d199ce7328d36643c5b9d976429d
1,900
PASSED
#include <iostream> #include <vector> #include <random> using namespace std; bool online_judge = #ifdef ONLINE_JUDGE 1; #else 0; #endif struct { using X = int; template <typename T = X> T operator()() const...
C++
8063c96cf62727f1b98e476e43679da2
2edd4b00cdd691044009cbdb440dbb07
1,900
PASSED
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define loop(n) for(int i=0;i<(n);i++) #define lp(x,s,e) for(int x=(s);x<(e);x++) #define lpe(x,s,e) for(int x=(s);x<=(e);x++) #define endl '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); //freo...
C++
c7e4f544ec8b4972291542e66aff5df5
cce868b237b291883fe70f1e17dcb5f5
1,200
PASSED
#include<bits/stdc++.h> #include<string> #define ll long long #define rr "\n" #define an a , a+n #define pu push_back #define sc second #define fr first #define in insert #define go goto #define cant continue #define p(x,y) cout<<fixed<<setprecision(y)<<x<<"\n"; #define all(v) v.begin(), v.end() #define A...
C++
c7e4f544ec8b4972291542e66aff5df5
fb45534faa7724f3435ececfcb2f761a
1,200
PASSED
#include <iostream> #include "deque" #include "algorithm" #include "cmath" #include "set" #include "vector" using namespace std; int main() { int t;cin>>t; while(t--){ int n,count=0;cin>>n; set<long long> a; for(int i=0;i<n;i++){ long long x;cin>>x; a.insert(x); ...
C++
c7e4f544ec8b4972291542e66aff5df5
4653d84e13fbca5d22c478dd09fd94dc
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int n; map<int,bool> vis; int main() { int caso_teste; cin>>caso_teste; while(caso_teste--) { vis.clear(); int a; bool if1=0,xl=0; cin>>n; for(int i=1; i<=n; ++i) { cin>>a; if1|=(a==1); xl|=vis[a-1],xl|=vis[a+1]; vis[a]=1; } puts((if1 &&...
C++
c7e4f544ec8b4972291542e66aff5df5
7d13e4f5e83353090568527846007ee0
1,200
PASSED
/* ███╗ ███╗ ██████╗ ███████╗███████╗ ████╗ ████║██╔═══██╗██╔════╝╚══███╔╝ ██╔████╔██║██║ ██║█████╗ ███╔╝ ██║╚██╔╝██║██║ ██║██╔══╝ ███╔╝ ██║ ╚═╝ ██║╚██████╔╝███████╗███████╗ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝ */ #include <bits/stdc++.h> using namespace std; #define MOEZ ios_base::sync_with_stdio(0);cin.t...
C++
c7e4f544ec8b4972291542e66aff5df5
ecb94151e005405e48d5f5dea371f612
1,200
PASSED
#include<iostream> #include<algorithm> #include<queue> #include <cstring> #include<vector> using namespace std; const int N = 100100; int arr[N]; int main() { int t; cin >> t; while (t--) { int n; cin >> n; bool s = true; for (int i = 1; i <= n; i++) { cin >> arr[i]; if (arr[i] == 1) { ...
C++
c7e4f544ec8b4972291542e66aff5df5
2688dbab1763976479265f11db41f6c2
1,200
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2e5+10; int a[N]; int main() { int t,n; cin>>t; while(t--) { bool f1=0,f2=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; if(a[i]==1) f1=1; } sort(a+1,a+1+n); for...
C++
c7e4f544ec8b4972291542e66aff5df5
2ce03d1a96cb9aba23ad56bf70329af2
1,200
PASSED
/* TAHMID RAHMAN DAMIAN FOREVER MATH LOVER NEVER GIVE UP */ #include<bits/stdc++.h> using namespace std; #define pi acos(-1.0) #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define ll long long #define pb push_back #define fi first #define se second #define in insert #define...
C++
c7e4f544ec8b4972291542e66aff5df5
a2c43b7372f74b98d565b07e99f74dbc
1,200
PASSED
/* TAHMID RAHMAN DAMIAN FOREVER MATH LOVER NEVER GIVE UP */ #include<bits/stdc++.h> using namespace std; #define pi acos(-1.0) #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define ll long long #define pb push_back #define fi first #define se second #define in insert #define...
C++
c7e4f544ec8b4972291542e66aff5df5
680c4afb63fcff47b2ac4d657aab7a52
1,200
PASSED
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<iostream> #include<string.h> #include<map> #include<algorithm> #include<iomanip> #include<fstream> #include<queue> #include<math.h> #include<set> #include<stack> #include <sstream> #include <time.h> #define ull unsigned long long #define ll long long usin...
C++
c7e4f544ec8b4972291542e66aff5df5
dd1df8243a961775ecae892c4bbba0d2
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" int n=1; vector<vector<int>> g; vector<int> val(n,1),visited(n,1); void find(int node,int childval) { int nchildval=childval*(g[node].size()-1)+val[node]; visited[node]=0; for(auto childnode:g[node]) {...
C++
fa24700412a8532b5b92c1e72d8a2e2d
b4c3a32fbe247b3b0ba474dc18787068
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" int n=1; vector<vector<int>> g; vector<int> val(n,1),visited(n,1); void find(int node,int childval) { int nchildval=childval*(g[node].size()-1)+val[node]; visited[node]=0; for(auto childnode:g[node]) {...
C++
fa24700412a8532b5b92c1e72d8a2e2d
6926d2c5cd436ddd91a2a73dea83367b
2,200
PASSED
// LUOGU_RID: 95277473 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = N << 4; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[N + 50], ob[N + 50]; #de...
C++
fa24700412a8532b5b92c1e72d8a2e2d
7687cc899c846f2f751f0519f9c76dba
2,200
PASSED
// LUOGU_RID: 95277253 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = N << 4; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[N + 50], ob[N + 50]; #de...
C++
fa24700412a8532b5b92c1e72d8a2e2d
a352fe67576d333c48f0863f566d9bbc
2,200
PASSED
// LUOGU_RID: 95277146 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[N + 50], ob[N + 50]; #define gc (it ...
C++
fa24700412a8532b5b92c1e72d8a2e2d
68feea8028ef79b62f047ee86ecfdbd0
2,200
PASSED
// LUOGU_RID: 95276886 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[N + 50], ob[N + 50]; #define gc (it ...
C++
fa24700412a8532b5b92c1e72d8a2e2d
db065049e33fe720a16532ca197bad5d
2,200
PASSED
// LUOGU_RID: 95276729 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = N << 4; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[N + 50], ob[N + 50]; #de...
C++
fa24700412a8532b5b92c1e72d8a2e2d
56b83002d54d59f9a9c8991c7aee66fa
2,200
PASSED
// LUOGU_RID: 95276627 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = N << 4; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[N + 50], ob[N + 50]; #de...
C++
fa24700412a8532b5b92c1e72d8a2e2d
4204386180da0d4acfa1383d03ceecac
2,200
PASSED
// LUOGU_RID: 95276468 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = N << 4; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[N + 50], ob[N + 50]; #de...
C++
fa24700412a8532b5b92c1e72d8a2e2d
43cc608038c760fb164efeb2d2f82811
2,200
PASSED
// LUOGU_RID: 95276312 #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = N << 4; int t, n, cnt, qu[N], dep[N], lst[N], res[N], head[N]; struct Edge { int to, nxt; } e[N << 1]; namespace fast_io { int it, ed, ot, t; char stk[20], bf[M + 50], ob[M + 50]; #de...
C++
fa24700412a8532b5b92c1e72d8a2e2d
3187b1967b855857592511f0b8ee62f8
2,200
PASSED
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define cd complex<double> #define p_q priority_queue using namespace std; int main(){ AquA; int t; cin >> t; while(t--){ int n; ci...
C++
425a32606726f820c1256085ad2b86ef
5c12e2c770ed019bd5bf917148f11ac3
2,600
PASSED
// This Code was made by Chinese_zjc_. #include <bits/stdc++.h> // #define debug int T, n; long long a[200005]; template <class T> T check(T t) { T res = a[1] * a[n] + t * (a[1] + a[n]); for (int i = 2; i < n; ++i) res += std::min(a[1] * a[i] + t * (a[1] + a[i]), a[i] * a[n] + t * (a[i] + a[n]...
C++
425a32606726f820c1256085ad2b86ef
a7785358f421082ad1543998fcd7dfc5
2,600
PASSED
#include <bits/stdc++.h> //#pragma GCC optimize("Ofast","-funroll-loops") //#pragma GCC target("sse4.1","sse4.2","ssse3","sse3","sse2","sse","avx2","avx","popcnt","tune=native") using namespace std; typedef long long i64; typedef unsigned long long u64; typedef unsigned int u32; typedef pair<int, int> pii; const in...
C++
425a32606726f820c1256085ad2b86ef
175d3eda059341ae9a041d8cfad70074
2,600
PASSED
#include<bits/stdc++.h> #define N 200100 #define M 5000010 using namespace std; int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9') f=(ch=='-')?-1:1,ch=getchar(); while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); return x*f; } int a[N],n,b[N]; long long check(int x) { lon...
C++
425a32606726f820c1256085ad2b86ef
d4fa0820fc13f68d74320ec655b87e11
2,600
PASSED
#include<bits/stdc++.h> #define N 200100 #define M 5000010 using namespace std; int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9') f=(ch=='-')?-1:1,ch=getchar(); while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); return x*f; } int a[N],n,b[N]; long long check(int x) { lon...
C++
425a32606726f820c1256085ad2b86ef
d06e2aea5c6284a7bebed9fcd9374781
2,600
PASSED
// LUOGU_RID: 93194492 #include<bits/stdc++.h> #define N 200100 #define M 5000010 using namespace std; int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9') f=(ch=='-')?-1:1,ch=getchar(); while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); return x*f; } int a[N],n,b[N]; long long check(int x) ...
C++
425a32606726f820c1256085ad2b86ef
27eac47e753cd417bf218b6ea7a4710d
2,600
PASSED
#include<bits/stdc++.h> #define N 200100 #define M 5000010 using namespace std; int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9') f=(ch=='-')?-1:1,ch=getchar(); while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); return x*f; } int a[N],n,b[N]; long long check(int x) { lon...
C++
425a32606726f820c1256085ad2b86ef
87a860ce5558ae48322f53615e4efd50
2,600
PASSED
#include<bits/stdc++.h> using namespace std; const int INF=1e8; const long long inf=1e18; const int N=2e5+10; int T,n; int a[N]; void solve(){ int smin=INF,smax=-INF; long long sum=0; for (int i=1;i<=n;i++){ smin=min(smin,a[i]); smax=max(smax,a[i]); sum+=a[i]; } if ((1ll*(n-2)*smin+sum>0)||(1ll*(n-2)*smax+s...
C++
425a32606726f820c1256085ad2b86ef
308d5b8ab9413b8f2eae55fd3fba94c5
2,600
PASSED
#include <bits/stdc++.h> using namespace std; char buf[1<<23],*p1=buf,*p2=buf,obuf[1<<23],*O=obuf; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) int read() { int x=0,f=1;char ch=getchar(); while (!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();} while (isdigit(ch)) x=x*10+(ch...
C++
425a32606726f820c1256085ad2b86ef
eaefb68f459cf8b3d70c43a7c5ea934b
2,600
PASSED
#include <bits/stdc++.h> using namespace std; char buf[1<<23],*p1=buf,*p2=buf,obuf[1<<23],*O=obuf; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) int read() { int x=0,f=1;char ch=getchar(); while (!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();} while (isdigit(ch)) x=x*10+(ch...
C++
425a32606726f820c1256085ad2b86ef
658acf9fecd7571b7cab84184163bcdb
2,600
PASSED
#include <algorithm> #include <iostream> #include <map> #include <set> #include <stack> #include <string> #include <vector> #include <chrono> const int MAX_PRIME = 10000; std::vector<int> known_primes; long currentcycles() { auto tg = std::chrono::system_clock::now().time_since_epoch(); return std::chrono::du...
C++
f596e0bcefde8227e8a7b9d923da828a
359ec8be5ef629b249739328f7cbc8f1
3,200
PASSED
#include <algorithm> #include <iostream> #include <map> #include <set> #include <stack> #include <string> #include <vector> const int MAX_PRIME = 10000; std::vector<int> known_primes; struct NumberInfo { __int128 number; std::map<__int128, int> primes; __int128 ostatok; }; struct OstatokInfo { __int...
C++
f596e0bcefde8227e8a7b9d923da828a
caabe2a1fbf4d86ea4967074e3cdecb3
3,200
PASSED
#include <algorithm> #include <iostream> #include <map> #include <set> #include <stack> #include <string> #include <vector> const int MAX_PRIME = 2; std::vector<int> known_primes; struct NumberInfo { __int128 number; std::map<__int128, int> primes; __int128 ostatok; }; struct OstatokInfo { __int128 ...
C++
f596e0bcefde8227e8a7b9d923da828a
69576a1195878deaf84cfb6e00a939fb
3,200
PASSED
#include <bits/stdc++.h> //typedef long long ll; typedef __int128_t ll; #define endl '\n' using namespace std; const int N=1010; const ll mod=1000000007; const int L=20; const ll inv2=(mod+1)/2; ll a[N]; ll b[N]; ll G[N][N]; bool usedA[N],usedB[N]; void print(ll x){ vector<int>v; while (x){ ...
C++
f596e0bcefde8227e8a7b9d923da828a
f7f07559b3a833fe1b7fb3e78cd29967
3,200
PASSED