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> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; int n; for(int i=0;i<nt;i++){ cin>>n; vector <int> s(n), f(n),d(n); ...
C++
2fee6c39d4e55f903837ef81e818eb07
cd37a3a423fa16407cfd62c723d0bf7e
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin long long nt; cin>>nt; long long n; for(int i=0;i<nt;i++){ cin>>n; vector <long long>...
C++
2fee6c39d4e55f903837ef81e818eb07
e49bfc05f4a1b1aebe628d9c451d1ef5
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; int n; for(int i=0;i<nt;i++){ cin>>n; vector <int> s(n), f(n),d(n); ...
C++
2fee6c39d4e55f903837ef81e818eb07
e340bd5ec0f004b42505751288345331
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; int n; for(int i=0;i<nt;i++){ cin>>n; vector <int> s(n), f(n),d(n); ...
C++
2fee6c39d4e55f903837ef81e818eb07
83e926b385a5962b32f3988d5cc2cb0d
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; int n; for(int i=0;i<nt;i++){ cin>>n; int s[n],f[n],d[n]; fo...
C++
2fee6c39d4e55f903837ef81e818eb07
546406eb6ba79be47b86175363c98b9f
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; for(int i=0;i<nt;i++){ int n; cin>>n; int s[n],f[n],d[n]; ...
C++
2fee6c39d4e55f903837ef81e818eb07
08595ed34f1b698372db1c59acb5a3cf
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt=0; cin>>nt; int n=0; for(int i=0;i<nt;i++){ cin>>n; int s[n],f[n],d[n]; ...
C++
2fee6c39d4e55f903837ef81e818eb07
1eea2e08ffab4b4fd2fd58df2f8932d3
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; int n; for(int i=0;i<nt;i++){ cin>>n; int s[n],f[n],d[n]; fo...
C++
2fee6c39d4e55f903837ef81e818eb07
a3256e563794715e47cae00cb2ad9469
800
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define ld long double #define pb push_back #define mp make_pair #define vpii vector<pair<int, int>> #define pii pair<int, int> #define pll pair<long long, long long> #define vi vector<int> #define all(x) x.begin(), x.end() ...
C++
8e9ba5a2472984cd14b99790a157acd5
b824533c70af5608724ad75b0467fed8
1,500
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; long long T, n, k, a[200005], dp[1005], rlt; int main () { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> T; while (T --) { cin >> n >> k; memset(dp, 0, sizeof...
C++
8e9ba5a2472984cd14b99790a157acd5
12ed207c6252148576279265407b78dd
1,500
PASSED
#include<bits/stdc++.h> using namespace std; using LL = long long; using PI = pair<int, int>; const int N = 1000005; #define endl '\n' vector<int> b[1005]; int a[N]; int main() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T; c...
C++
8e9ba5a2472984cd14b99790a157acd5
5e7a223d425b3be0dcd54c8417d91197
1,500
PASSED
#include <bits/stdc++.h> using namespace std; using LL = long long; #define FOR(i,a,b) for (int i = a; i < b; i ++) #define endl '\n' const int MX = 200005; int n, k; LL a[MX]; int sz[1005], val[1005]; int main(){ #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout...
C++
8e9ba5a2472984cd14b99790a157acd5
4aa2562afbd28091459f1a874a57ac89
1,500
PASSED
#include <bits/stdc++.h> using namespace std; long long n, k, a[200005], cnt[1005]; int main(){ int T; cin >> T; while(T --){ long long rlt = 0, s = 0; cin >> n >> k; for(int i = 0; i < n; i ++) cin >> a[i]; for(int i = 0; i <= k; i ++) cnt[i] = 0; for(int i = 0; i < n; i ++){ rlt += a[i...
C++
8e9ba5a2472984cd14b99790a157acd5
dd7096e2fa769c6452451cb1a7a019f8
1,500
PASSED
#include <bits/stdc++.h> using namespace std; long long a[1000005], use[1005]; int main(){ // freopen("in.txt","r", stdin); int T, n, k; scanf("%d", &T); while( T -- ){ cin >> n >> k; long long s = 0; for(int i = 0; i < n; i ++){ cin >> a[i]; s += a[i] / k; a[i] %= k; } sort(a, ...
C++
8e9ba5a2472984cd14b99790a157acd5
3abcad3e7b9ddbd5879370681acc55f9
1,500
PASSED
#include <bits/stdc++.h> using namespace std; long long gas[200005]; int main() { long long k, a; long long T, n; cin >> T; while (T --) { cin >> n >> k; memset (gas, 0, sizeof(gas)); long long re = 0, sum = 0; for (long long i = 0; i < n; i ++) { cin >> a; sum += a / k; gas[a...
C++
8e9ba5a2472984cd14b99790a157acd5
3a570576f4025749c479b6b1c2d1469d
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int cnt[1005]; int main() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif long long rlt; int tc, n, a, k, tp, t; cin >> tc; int st, en; while (tc --) { memset(cnt, 0, sizeof cnt); cin >> n >> k; rlt = 0; for (int i = 0; i < n; i +...
C++
8e9ba5a2472984cd14b99790a157acd5
64a7ee7baa25d6f733a970dfc3b47b8c
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long // Uncomment them for optimisations //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") #define popcount(x) __builtin_popcount(x) #define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME #define range(...) GET_MACRO(__VA_ARGS__, r4, r3, r2, ...
C++
8e9ba5a2472984cd14b99790a157acd5
21b68cd900abc06ec8d6ceecc52a40f2
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long // Uncomment them for optimisations //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") #define popcount(x) __builtin_popcount(x) #define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME #define range(...) GET_MACRO(__VA_ARGS__, r4, r3, r2, ...
C++
8e9ba5a2472984cd14b99790a157acd5
abbe7170f39a58b7ee3d331e041f5772
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0);cin.tie(0) #define pb push_back #define int long long #define pii pair<int,int> int max(int a,int b){if(a<b)return b;else return a;} int min(int a,int b){if(a>b)return b;else return a;} // #define x first // #define y ...
C++
9f285a42ebb0581f1cda7beba7b938c7
36227f7f75080733a777b67cab9ead2e
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0);cin.tie(0) #define pb push_back #define int long long #define pii pair<int,int> int max(int a,int b){if(a<b)return b;else return a;} int min(int a,int b){if(a>b)return b;else return a;} // #define x first // #define y...
C++
9f285a42ebb0581f1cda7beba7b938c7
35693f8ac0b969cbeb82ef570288936c
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0);cin.tie(0) #define pb push_back #define int long long #define pii pair<int,int> int max(int a,int b){if(a<b)return b;else return a;} int min(int a,int b){if(a>b)return b;else return a;} // #define x first // #define y...
C++
9f285a42ebb0581f1cda7beba7b938c7
864d6738868bd186ab5c11f85d32b077
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0);cin.tie(0) #define pb push_back #define int long long #define pii pair<int,int> int max(int a,int b){if(a<b)return b;else return a;} int min(int a,int b){if(a>b)return b;else return a;} // #define x first // #define y...
C++
9f285a42ebb0581f1cda7beba7b938c7
9952042750846cb81d364c0053129c77
2,000
PASSED
#include <stdio.h> #include <vector> #include <stack> #include <functional> #include <numeric> #include <complex> #include <queue> #include <map> #include <unordered_map> #include <list> #include <set> #include <unordered_set> #include <assert.h> #include <cstring> #include <sstream> #include <string> #...
C++
9f285a42ebb0581f1cda7beba7b938c7
35d7c11ee3ae85f6e3571ffb69ef0218
2,000
PASSED
#include <stdio.h> #include <vector> #include <stack> #include <functional> #include <numeric> #include <complex> #include <queue> #include <map> #include <unordered_map> #include <list> #include <set> #include <unordered_set> #include <assert.h> #include <cstring> #include <sstream> #include <string> #...
C++
9f285a42ebb0581f1cda7beba7b938c7
d841de6f519b7f3c18da7aca9e634a36
2,000
PASSED
#include <stdio.h> #include <vector> #include <stack> #include <functional> #include <numeric> #include <complex> #include <queue> #include <map> #include <unordered_map> #include <list> #include <set> #include <unordered_set> #include <assert.h> #include <cstring> #include <sstream> #include <string> #...
C++
9f285a42ebb0581f1cda7beba7b938c7
b7a5d0106e97898f22e36521894db0ff
2,000
PASSED
#include <stdio.h> #include <vector> #include <stack> #include <functional> #include <numeric> #include <complex> #include <queue> #include <map> #include <unordered_map> #include <list> #include <set> #include <unordered_set> #include <assert.h> #include <cstring> #include <sstream> #include <string> #...
C++
9f285a42ebb0581f1cda7beba7b938c7
7d8d6c70eb610c8138db3dfe98cf1692
2,000
PASSED
#include <stdio.h> #include <vector> #include <stack> #include <functional> #include <numeric> #include <complex> #include <queue> #include <map> #include <unordered_map> #include <list> #include <set> #include <unordered_set> #include <assert.h> #include <cstring> #include <sstream> #include <string> #...
C++
9f285a42ebb0581f1cda7beba7b938c7
f983481f566fd19d5f68157b2bbe12d6
2,000
PASSED
#include <stdio.h> #include <vector> #include <stack> #include <functional> #include <numeric> #include <complex> #include <queue> #include <map> #include <unordered_map> #include <list> #include <set> #include <unordered_set> #include <assert.h> #include <cstring> #include <sstream> #include <string> #...
C++
9f285a42ebb0581f1cda7beba7b938c7
350060f70beb58cd4046deb18d2b8ade
2,000
PASSED
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = Integer.parseInt(br.readLine()); while(t-->0){ ArrayList<Lon...
Java
84c60293d487e2c2ecee38a2fcf63b10
3a0942b1b7eb1e9f05aa849e0f77746c
1,500
PASSED
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = Integer.parseInt(br.readLine()); while(t-->0){ int top = (...
Java
84c60293d487e2c2ecee38a2fcf63b10
aff4e6dc2ff79ab5579b47c25710e22a
1,500
PASSED
import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class Main { public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while (n-- > 0) { new Main().solve(sc); ...
Java
84c60293d487e2c2ecee38a2fcf63b10
8708d6949c672c3572ce7376cc7ed5ff
1,500
PASSED
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) { new MainClass().execute(); } } class MainClass extends PrintWriter { MainClass() { super(System.out, true); } boolean cases = true; // Solution void solveIt(int testCa...
Java
84c60293d487e2c2ecee38a2fcf63b10
7e6fd822b31e5750cbac3e4f55e3f4c9
1,500
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class Main { static final PrintWriter out =new PrintWriter(System.out); static final FastReader sc = new FastReader(); //I invented a new word!Plagiarism! //Did you hear about the mathematician who’s afraid of negative numbers?He’l...
Java
84c60293d487e2c2ecee38a2fcf63b10
d7ef88384e6235aecca4e201ab611b2c
1,500
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class Main { static long mod = (int)1e9+7; // static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); ...
Java
84c60293d487e2c2ecee38a2fcf63b10
a6e518b0be16f7f7380a5c86f2d5d2b7
1,500
PASSED
import java.io.*; import java.util.*; import static java.util.Collections.swap; public class Solver { public static void main(String[] args) throws IOException { int t = nextInt(); for (int i = 0; i < t; i++) { long a = nextInt(); long b = nextInt(); ...
Java
84c60293d487e2c2ecee38a2fcf63b10
7114aec772bef394b1d90fe3482d0044
1,500
PASSED
import java.util.*; import java.io.*; public class Main{ static Scanner sc = new Scanner (System.in); static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); static StreamTokenizer st =new StreamTokenizer(bf); static PrintWriter pw = new PrintWriter(new OutputStreamWrite...
Java
84c60293d487e2c2ecee38a2fcf63b10
1e034fdacb64458586448207aeed1437
1,500
PASSED
import java.io.*; import java.util.*; public class Main { static int N = 100010; static HashMap<Integer, Integer> map, cnt = new HashMap<>(); public static void main(String[] args) throws IOException { FastScanner f = new FastScanner(); PrintWriter w = new PrintWriter(System.out...
Java
84c60293d487e2c2ecee38a2fcf63b10
59bdfd59c673738777d907fd10569ca9
1,500
PASSED
import java.io.*; import java.util.*; public class dd { static int N = 100010; static HashMap<Integer, Integer> map, cnt = new HashMap<>(); public static void main(String[] args) throws IOException { FastScanner f = new FastScanner(); PrintWriter w = new PrintWriter(System.out);...
Java
84c60293d487e2c2ecee38a2fcf63b10
166f3e6b7cc8c3a2113b349846d22d44
1,500
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; void fast(){ cin.tie(0); ios_base::sync_with_stdio(false); } int main() { fast(); ll t; cin >> t; while (t--) { ll n,c=0; cin >> n; ll arr[n]; char tr[n]; for (int i =...
C++
485d5984e34a479f2c074a305ae999ae
681852a2c0c0aa9827f68c6cddc8aba0
800
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; void fast(){ cin.tie(0); ios_base::sync_with_stdio(false); } int main() { fast(); ll t; cin >> t; while (t--) { ll n,c=0; cin >> n; ll arr[n]; char tr[n]; for (int i =...
C++
485d5984e34a479f2c074a305ae999ae
00fe8b34e63b588c2d5793b2300adcac
800
PASSED
#include <iostream> #include <string> #define ll long long using namespace std; int main() { ll t; cin >> t; while (t--) { ll n,c=0,num; cin >> n; ll arr[n]; char tr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; ...
C++
485d5984e34a479f2c074a305ae999ae
fd95bc8ff87bd067e721f82db9057b1f
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } string s; cin >> s; vector<char> f(55, ' ')...
C++
485d5984e34a479f2c074a305ae999ae
b68f6662658fef65a2c73c6c456def16
800
PASSED
#include<iostream> using namespace std; int main() { int n; int t; int a[51]; char b[51]; cin >> n; int f = 1; for (int i = 1; i <= n; i++) { cin >> t; char x1, x2; for (int i = 1; i <= t; i++) { cin >> a[i]; } for (int i = 1; i <= t; i++) { cin >> b[i]; } for (int i = 1; i <= t; i++) ...
C++
485d5984e34a479f2c074a305ae999ae
4d1bd5ce4e9f80609fba3aef363779f3
800
PASSED
#include <iostream> #include <cstring> using namespace std; int T, n; int a[1005]; char ch[1005], s[1005]; int ans = 1; int main() { cin >> T; while (T --> 0) { ans = 1; memset(a, 0, sizeof(a)); memset(ch, 0, sizeof(ch)); cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; for (int i = 1; i <= n; ++i) ...
C++
485d5984e34a479f2c074a305ae999ae
2271746a79ac7e184560b0b05ead56aa
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,n; cin>>t; while(t--) { cin>>n; int a[n]; map<int,char>mp; map<int,char>::iterator it; string s; int f=0; for(int i=0;i<n;i++){ cin>>a[i]; mp[a[i]]='0'; ...
C++
485d5984e34a479f2c074a305ae999ae
e4850e108c3e54b8495ab4ad5c329417
800
PASSED
#define _CRT_SECURE_NO_WARNINGS 1 #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 50; #define ll long long //typedef long long ll; int a[N]; char b[N]; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int T; cin >> T; while (T--) { int n; int flag = 1; cin >> n; memset...
C++
485d5984e34a479f2c074a305ae999ae
8a139271e42fa8463677013094ab639e
800
PASSED
#include <stdio.h> #include <string.h> char s[100]; int a[100]; // void trans(int num,char let,int a[],char s[],int flag) // { // } int main () { int t,n; int flag; int num; char let; scanf("%d",&t); for (int i = 0; i < t; i++) { scanf("%d",&n); for (int j = 0; j < n; j++...
C++
485d5984e34a479f2c074a305ae999ae
c4fd040f97778520b5ba3a36eb6e889f
800
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n,i,res; cin>>n; int flag[55]={0}; vector<char>arr(55); vector<int>v(n); for(i=0;i<n;i++) { cin>>v[i]; } stri...
C++
485d5984e34a479f2c074a305ae999ae
3bda324402331622551d1ea39c1d6ab8
800
PASSED
#include<bits/stdc++.h> // #define int long long using namespace std; void testcase(){ int n;cin>>n; vector<int>a(n); for(int i=0;i<n;i++)cin>>a[i]; vector<int>w(n); for(int i=0;i<n;i++)w[a[i]]=i; int l=w[0],r=w[0]; auto sum1=[](int from,int to,int val){ retu...
C++
d55660b8091bca2211fa1ad56402aebd
cbe3214473024d17fd15dfb7f2525616
2,000
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // #define int long long using namespace std; using namespace __gnu_pbds; void testcase(){ int n;cin>>n; vector<int>a(n); for(int i=0;i<n;i++)cin>>a[i]; vector<int>w(n); for(int i=0;i<n;i++)w[a[i]]=i; int l=w...
C++
d55660b8091bca2211fa1ad56402aebd
46ccf0522097449059b56cdd2918aa43
2,000
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; long long int calc(int gl,int gr,int constraint) { long long int output = 0; int diff = gl+gr-constraint; int minimum = min(gl,gr); int maximum = max(gl,gr); if (diff < 0) output = (gl+1)*(gr+1); else if (diff <...
C++
d55660b8091bca2211fa1ad56402aebd
114e8bb91d9ef34d77b3c0800d7bb531
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define N 200005 void go() { int n; cin >> n; int p[N]; for (int i = 1; i <= n; i++) { int x; cin >> x; p[x] = i; } int l = p[0], r = p[0]; int64_t ans = 1; for (int i = 2; i <= n; i++) { if (i &...
C++
d55660b8091bca2211fa1ad56402aebd
3408b73ad340d8a6e9807bf84ab80514
2,000
PASSED
#include <bits/stdc++.h> #define int long long #define ll long long #define pb push_back using namespace std; const int N=(int)(2e5+5); ll ans; int n,a[N],pos[N]; int cc(int x) { if(x<=0) return 0; return x*(x+1)/2; } int cal(int l,int r) { // int res=0; // for(int i=l;i<=r;i++) res+=i; // return r...
C++
d55660b8091bca2211fa1ad56402aebd
cdf2d8ba7f5b29d6924e08d1bac20105
2,000
PASSED
// // Created by FreeSin2000 on 2022/10/22. // #include <bits/stdc++.h> using namespace std; typedef long long ll; ll calc(int s1, int s2, int num) { if(s1 > s2) swap(s1, s2); ll res = 0; if(s2 <= num) { if(s1 + s2 > num) { res = 1ll * (num + 2) * (num + 1) / 2 ...
C++
d55660b8091bca2211fa1ad56402aebd
ab67fe75889815f04b810f87b10cec35
2,000
PASSED
#include <bits/stdc++.h> using namespace std; namespace fastIO{ #define BUF_SIZE 100000 #define OUT_SIZE 100000 //fread->read bool IOerror=0; //inline char nc(){char ch=getchar();if(ch==-1)IOerror=1;return ch;} inline char nc(){ static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE; if(p1==...
C++
d55660b8091bca2211fa1ad56402aebd
82f3c82f8cf4aabb480ff66c746efbc3
2,000
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 2e5 + 5; int n; int a[N], p[N]; int main() { ios::sync_with_stdio (false), cin.tie (0); int tt; cin >> tt; while (tt--) { ll ans = 0; cin >> n; for (int i = 0; i < n; i++) { ...
C++
d55660b8091bca2211fa1ad56402aebd
2e29bf23bfce190c16d4c47f86c170fb
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[200010],b[200010]; bool vis[200010]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int _; cin>>_; while(_--){ memset(vis,false,sizeof(vis)); int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; ...
C++
d55660b8091bca2211fa1ad56402aebd
6f3b4e81ab5669581d8a063a4505d89f
2,000
PASSED
#include <bits/stdc++.h> #define ll long long #define pii pair<ll, ll> #define st first #define nd second #define file "test" #define all(v) (v).begin(), (v).end() #define pb push_back #define rall(v) (v).rbegin(), (v).rend() #define sz(a) (int)a.size() #define ld long double using namespace std; const lo...
C++
d55660b8091bca2211fa1ad56402aebd
7a7357f0204eb04c170a8b1b71bff39a
2,000
PASSED
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> using namespace std; typedef int in; #define int long long #define double long double #define f first #define s second #define pb push_back #define pp push #define ceil(x,y) (x/y)+(x%y!=...
C++
27be78f2739b681b25c331c60fc2b22b
8e89dbd01b1957e1202c660cf54cbea1
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 1e6+5; ll re(){ char c=getchar();ll all = 0,pd = 1; for(;!isdigit(c);c=getchar()) if( c== '-') pd = -1; while(isdigit(c)) all = all *10 + c -'0',c=getchar(); return all *pd; } ll a,b,c,d,cnt; ll ans[N]; ll res[N]; ll tot = ...
C++
27be78f2739b681b25c331c60fc2b22b
6bc5c62c67f0e32aaf2128d9d48845fa
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define inf 0x3f3f3f3f #define mod7 1000000007 #define mod9 998244353 #define m_p(a,b) make_pair(a, b) #define mem(a,b) memset((a),(b),sizeof(a)) #define io ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) typedef long long ll; typedef pair <...
C++
27be78f2739b681b25c331c60fc2b22b
883418f76602b938426b8229dee1624b
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define inf 0x3f3f3f3f #define mod7 1000000007 #define mod9 998244353 #define m_p(a,b) make_pair(a, b) #define mem(a,b) memset((a),(b),sizeof(a)) #define io ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) typedef long long ll; typedef pair <...
C++
27be78f2739b681b25c331c60fc2b22b
0cf874bf6c2932d4101bcbe3e720b9f7
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define inf 0x3f3f3f3f #define mod7 1000000007 #define mod9 998244353 #define m_p(a,b) make_pair(a, b) #define mem(a,b) memset((a),(b),sizeof(a)) #define io ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) typedef long long ll; typedef pair <...
C++
27be78f2739b681b25c331c60fc2b22b
8209d6b2cb50fe1214ca3d2a4072488e
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll Mod = 1000000007; const int maxn = 1000000 + 10; #define INF 0x3f3f3f3f #define eps 10e-10 // Miller_Rabin 算法进行素数测试 //速度快,而且可以判断 <2^63的数 const int S = 20;//随机算法判定次数,S越大,判错概率越小 //计算 (a*b)%c. a,b都是long ...
C++
27be78f2739b681b25c331c60fc2b22b
86e5ed33d97fcdf6b9ec93345789ce06
1,900
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=2e5+5,mod=1e9+7; vector<pair<int,int>> p; map<int,int> h; int n; int a,b,c,d; int dfs(int x,int pos){ int t1=x,t2=a*b/x; int xx = (a+t1)/t1*t1,yy = (b+t2)/t2*t2; if(pos>=n) { if(xx<=c&&yy<=d){ cou...
C++
27be78f2739b681b25c331c60fc2b22b
bbaf5b33f3a119a1b48b29754041a735
1,900
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=2e5+5,mod=1e9+7; vector<pair<int,int>> p; map<int,int> h; int n; int a,b,c,d; int dfs(int x,int pos){ int t1=x,t2=a*b/x; int xx = (a+t1)/t1*t1,yy = (b+t2)/t2*t2; if(xx>c) return 0; if(pos>=n) { ...
C++
27be78f2739b681b25c331c60fc2b22b
f2581a8d146938e5ec0a3c432ae60bd0
1,900
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=2e5+5,mod=1e9+7; vector<pair<int,int>> p; map<int,int> h; int n; int a,b,c,d; int dfs(int x,int pos){ if(pos>=n) { int t1=x,t2=a*b/x; int xx = (a+t1)/t1*t1,yy = (b+t2)/t2*t2; if(xx<=c&&yy<=d){ ...
C++
27be78f2739b681b25c331c60fc2b22b
6c80863396e6f3e658909ec670287141
1,900
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=2e5+5,mod=1e9+7; vector<pair<int,int>> p; map<int,int> h; int n; int a,b,c,d; int dfs(int x,int pos){ if(pos>=n) { int t1=x; int t2=a*b/x; int xx = (a+t1)/t1*t1; int yy = (b+t2)/t2*t2; ...
C++
27be78f2739b681b25c331c60fc2b22b
679e3cb35dca469c622caa328b2aaff4
1,900
PASSED
#include <algorithm> #include <iostream> #include <string> #include <queue> #include <cmath> #include <cstring> #include <cstdio> #include <thread> #include <vector> #include <map> #include <array> #include <set> #include <queue> #include <list> #include <sstream> #include <iomanip> #include <stack> #i...
C++
96f0df1c8e014229e5ef773789aa2205
6833325cce3867cff887884506870e65
1,200
PASSED
#include<bits/stdc++.h> int a[200010],b[200010]; int j,tot; using namespace std; int main() { for(int i=1;i<=200005;i++) { //tot++; j=i; while(j%2==0) { a[i]++; j/=2; } }//quan'bu int _; cin>>_; while(_--) { int n,d,sum=0,ans=0,flag =0,count =0; cin>>n; memset(b,0,...
C++
96f0df1c8e014229e5ef773789aa2205
6a6f84611d46aeb0ad5a6e322cefd414
1,200
PASSED
#include <iostream> #include <string> #include <cmath> #include <algorithm> #include<bits/stdc++.h> using namespace std; int a[200005]={0}; int j; int main() { /*for(int i=2;i<=200001;i+=2) { int now = i,ans=0; while(now%2==0) { ans++; now/=2; } a[i] = ans; }//quan'bu*/ int _...
C++
96f0df1c8e014229e5ef773789aa2205
06bb998355cc10f2fe7fd9a4d04e771b
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int t,n,i,j,ans,tot,x,bj; int a[200010]; int main() { scanf("%d",&t); while(t>0) { t--; tot=0; ans=0; bj=0; memset(a,0,sizeof(a)); scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&x); while(x%2==0) { tot++; x=x>>1; ...
C++
96f0df1c8e014229e5ef773789aa2205
61ebda8bab2f5719cfd21bfcc4d622f7
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int t,n,i,j,ans,tot,x,bj; int a[200010]; int main() { scanf("%d",&t); while(t>0) { t--; tot=0; ans=0; bj=0; memset(a,0,sizeof(a)); scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&x); while(x%2==0) { tot++; x=x>>1; ...
C++
96f0df1c8e014229e5ef773789aa2205
a11d7c3101ba80cc264a72c94edbc1d8
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int t,n,i,j,ans,tot,bob,x,bj; int a[200010]; int main() { scanf("%d",&t); while(t>0) { t--; bob=0; tot=0; ans=0; bj=0; memset(a,0,sizeof(a)); scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&x); while(x%2==0) { tot++;...
C++
96f0df1c8e014229e5ef773789aa2205
4d1bd06f100d537f5623607d5e1af342
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main () { int t; cin >> t; for (int i = 0; i < t; i++) { long long sum = 0, ans = 0; int n; cin >> n; int a[n+1]; int q[n+1]; for (int j = 1; j <= n; j++) { ...
C++
96f0df1c8e014229e5ef773789aa2205
68c683f7e249d4e0bff55c8068b75045
1,200
PASSED
#include<bits/stdc++.h> using namespace std; long long t,n,a[200005],q[200005],x[32],pd,te; int main() { cin>>t; while(t--) { long long sum=0,ans=0; cin>>n; for(int i=1;i<=n;i++) { q[i]=0; cin>>a[i]; while(a[i]%2==0) { a[i]/=2; sum++; } } //sum%=n; //cout<<...
C++
96f0df1c8e014229e5ef773789aa2205
c8eaa31da91b506d5b4f0c34c67d2ae7
1,200
PASSED
#include<bits/stdc++.h> using namespace std; long long t,n,a[200005],q[200005],x[32],pd,te; int main() { cin>>t; while(t--) { long long sum=0,ans=0; cin>>n; for(int i=1;i<=n;i++) { q[i]=0; cin>>a[i]; while(a[i]%2==0) { a[i]/=2; sum++; } } //sum%=n; //cout<<...
C++
96f0df1c8e014229e5ef773789aa2205
0e32408dfd9f6b91d9a682ada7872ec0
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int case_cnt, case_len; int element; scanf("%d", &case_cnt); for(int i = 0; i < case_cnt; i++) { scanf("%d", &case_len); int cnt = case_len; std::vector<int> v(case_len); int ops = 0; ...
C++
96f0df1c8e014229e5ef773789aa2205
3796333e9beb1b1e4cd6b93055b42182
1,200
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2e5+10; int solve() { int len; cin>>len; char c; cin>>c; string s; int flag_pos=-1;//遇到c就变成c相应的位置 cin>>s; int answer=0; s+=s;//一个变俩,这样就不用循环了 for(int x=0;x<len*2;x++)//遍历字符串,找到是这个灯的元素 { if(c=='g')...
C++
9d3ee1b292a2402bb2204ab85dcab587
fbd06d06a6f209d981ff4cc9e6ee5e35
1,000
PASSED
#include <bits\stdc++.h> typedef int int_32; #define int long long using namespace std; int_32 main(void) { int t; cin >> t; while (t--) { //信息维护,制造两个变量存储信息,一个flag表示是否找到需要的字符,找到后flag成为存储位置信息的容器 //另一个变量ans,负责更新答案 int n; char a; string s; cin >> n >> a >> s; //a为绿色,无需判断 if (a == 'g') { ...
C++
9d3ee1b292a2402bb2204ab85dcab587
9eba3169adfe490cdea7e46b53dc84cf
1,000
PASSED
#include <bits\stdc++.h> typedef int int_32; #define int long long using namespace std; int_32 main(void) { int t; cin >> t; while (t--) { //信息维护,制造两个变量存储信息,一个flag表示是否找到需要的字符,找到后flag成为存储位置信息的容器 //另一个变量ans,负责更新答案 int n; char a; string s; cin >> n >> a >> s; //a为绿色,无需判断 if (a == 'g') { ...
C++
9d3ee1b292a2402bb2204ab85dcab587
56d3948793c5fc69d0cbf6d94304749e
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(void) { int t; cin >> t; while (t--) { int n; char c; string s; cin >> n >> c >> s; s += s; int cnt = 0, maxv = 0, flag = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == c) flag = 1; if (s[i] == 'g')flag = 0, maxv = max(max...
C++
9d3ee1b292a2402bb2204ab85dcab587
19cb62777f40abdedd3c0f16e54717e9
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int co =0 , con =0; float a[n]; for(int m =0;m<n;m++){ char l; int x ; string s1; cin >> x >> l; cin >> s1; string s = s1 +s1 +s1; int ns = x*2; ...
C++
9d3ee1b292a2402bb2204ab85dcab587
a734d1911f74097f1ab3e992fd3d315a
1,000
PASSED
#include "bits/stdc++.h" //#include <functional> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds; #define PI 2 * acos(0) #define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #ifndef ONLINE_JUDGE #define debug(x) cerr << #x << "...
C++
9d3ee1b292a2402bb2204ab85dcab587
517da9dae160d80439156b2e1e07fb1b
1,000
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int t=1; cin>>t; while(t--) { int n; char c; cin>>n>>c; vector<int> g,d; string s; cin>>s; for(int i=0;i<s.size();i++) { if(s[i]=='g') g.push_back(i+1...
C++
9d3ee1b292a2402bb2204ab85dcab587
8b054ba17642a99943ad281a7093351a
1,000
PASSED
//define _CRT_SECURE_NO_WARNINGS //B #include<bits/stdc++.h> #define LL long long using namespace std; LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; } char s; int ans[400010] = { 0 },n; string qwq,qaq; void solve() { memset(ans, 0, sizeof(ans)); cin >> n >> s; cin >> qaq; qwq = qaq + qaq; int minn = 0; for ...
C++
9d3ee1b292a2402bb2204ab85dcab587
0ac3a17be44b24712dc7efb5134477e9
1,000
PASSED
#include<iostream> #include<cstdio> #include<cstdlib> #include<cmath> #include<queue> #include<vector> #include<map> #include<stack> #include<utility> #include<cstring> #include<string> #include<algorithm> using namespace std; typedef long long ll; const ll MAX = 2e5 + 10; const ll mod = 1e9 + 7; void solve() { vecto...
C++
9d3ee1b292a2402bb2204ab85dcab587
e92e9eb5f00ad3c007cdb7bfdfa6544c
1,000
PASSED
#include <iostream> #include <algorithm> #include <cmath> #include <cstring> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; //char getY(string s,int i,int n) //{ // int k; // if(i>0)k = i-1; // else k = n-1; // if(s[k]!='y')return s[k]; // else...
C++
9d3ee1b292a2402bb2204ab85dcab587
600d71d01a0feaef17e5f90c3f870f83
1,000
PASSED
#include <iostream> #include <cstring> using namespace std; typedef long long LL; void solve() { LL N, Q; cin >> N >> Q; LL sum[2], n[2]; memset(sum, 0, sizeof(sum)); memset(n, 0, sizeof(n)); for (int i = 0; i < N; i++) { LL x; cin >> x; sum[x % 2] += x; n[x % 2] ++; } while (Q--) ...
C++
d15cffca07768f8ce6fab7e13a6e7976
d0128cb5dfc1cbe3b8be7e39acca0f98
800
PASSED
#include <iostream> #include <cstring> using namespace std; typedef long long LL; void solve() { int N, Q; cin >> N >> Q; LL sum[2] ,n[2] ; memset(sum, 0, sizeof(sum)); memset(n, 0, sizeof(n)); for (int i = 0; i < N; i++) { LL x; cin >> x; sum[x % 2] += x; n[x % 2] ++; } while (Q--) ...
C++
d15cffca07768f8ce6fab7e13a6e7976
d2ed054f7ded092e0cdc51e8478d4c54
800
PASSED
#include <bits/stdc++.h> using namespace std; void proverka() { int n, q, cc = 0, cn = 0; long long int sum = 0; cin >> n >> q; int a[n]; for(int i = 0;i < n;i++){ cin >> a[i]; sum+=a[i]; if(a[i] % 2 == 0) cc++; else cn++; ...
C++
d15cffca07768f8ce6fab7e13a6e7976
1746c9d0eb3020936e41912adc56b938
800
PASSED
#include <bits/stdc++.h> using namespace std; void proverka() { int n, q, cc = 0, cn = 0; long long int sum = 0; cin >> n >> q; int a[n]; for(int i = 0;i < n;i++){ cin >> a[i]; sum+=a[i]; if(a[i] % 2 == 0) cc++; else cn++; ...
C++
d15cffca07768f8ce6fab7e13a6e7976
f2298b2fd341ecad01721b3b994dd36c
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { unsigned long long n, q; cin >> n >> q; unsigned long long int x; unsigned long long int sum = 0; unsigned int evencount = 0; for (long long i = 0; i < n; i++) { cin >> x; ...
C++
d15cffca07768f8ce6fab7e13a6e7976
8fc0e6e466cfb2004842b4d316cfc32e
800
PASSED
#include<iostream> using namespace std; #define ll long long void code(ll n,ll Judge,ll *M) { ll X = 0; ll even = 0; ll odd = 0; for (ll i = 0; i < n; i++) { if (M[i] % 2 == 0) { even++; } else if (M[i] % 2 == 1) { odd++; } X = X + M[i]; } for (ll j=0;j<Judge;j++) { ...
C++
d15cffca07768f8ce6fab7e13a6e7976
fca6bcf7233f74b5816fd4a30f26708e
800
PASSED
#include <iostream> #include <vector> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin>>t; while(t--) { int evenCount=0, oddCount=0; ll sum = 0; int n,q; cin>>n>>q; for(int ...
C++
d15cffca07768f8ce6fab7e13a6e7976
ebb61b95cf4d282b2389cc6df1538d1d
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int t; cin >> t; while(t--) { int a, b; long long sum = 0; cin >> a >> b; int cc[2] = { 0,0 }; for (int j = 0; j < a; j++) { int x; cin >> x; sum += x; cc[x & 1]++;//先是偶再是奇. } f...
C++
d15cffca07768f8ce6fab7e13a6e7976
9b4d11e538b430664a5fd24519f5693c
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int t; cin >> t; for (int i = 0; i < t; i++) { int a, b; long long sum = 0; cin >> a >> b; int cc[2] = { 0,0 }; for (int j = 0; j < a; j++) { int x; cin >> x; sum += x; cc[x & 1]++;//...
C++
d15cffca07768f8ce6fab7e13a6e7976
97832404a50330f45d928f262cddfa7c
800
PASSED
#include<iostream> #include<cstdio> using namespace std; int main(){ long long a[100005]; int t,n,m; int x,y; int ji,ou; long long sum; int i,j,k; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d %d",&n,&m); ji=ou=0; sum=0; for(j=0;j<n;j++){ scanf("%lld",&a[j]); sum+=a[j]; if(a[j]%2==1)ji++; els...
C++
d15cffca07768f8ce6fab7e13a6e7976
65e809f78ffaccfb14b433317205664b
800
PASSED
// LUOGU_RID: 90330520 #include<bits/stdc++.h> using namespace std; #define int long long const int N=2e5+5; int a[N],b[N]; signed main(){ int t;cin>>t; while(t--){ int n,ans=0;cin>>n; for(int i=1;i<=n;++i) cin>>a[i],b[i]=a[i]-a[i-1]; for(int i=2;i<=n;++i){ ...
C++
f54c1448a279e59f96847a158f993101
094c4f4cc1913bd6fe2471dd771ea2f3
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll int inline ll read(){ register ll s=0,k=1;register char ch=getchar(); while(!isdigit(ch)){if(ch=='-') k=-1;ch=getchar();}; while(isdigit(ch)){s=(s<<3)+(s<<1)+ch-'0';ch=getchar();}; return s*k; } const int N=2e5+7; long long cf[N]; int a[N]; int mai...
C++
f54c1448a279e59f96847a158f993101
b5b8e1e3b23640789208fddef42ab13e
1,700
PASSED