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
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); for (int j = 0; j < time; j++) { int a = sc.nextInt(); int[] x = new int[a]; for (int i = 0; i < ...
Java
159b9c743d6d8792548645b9f7be2753
f0417f0a77eba1b6f9ead98f93c8469e
800
PASSED
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); long[] a=new long[n]; for(int i=0;i<n;i++){ a[i]=sc.nextLong(); } Arra...
Java
159b9c743d6d8792548645b9f7be2753
ac9dc5c4048e9aaf38484438cff2af1e
800
PASSED
import java.util.*; public class EzzatAndTwoSubsequences { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { int num = sc.nextInt(); double largest = -Double.MAX_VALUE; ...
Java
159b9c743d6d8792548645b9f7be2753
aefa11cae66cd9e00bd238dad837214c
800
PASSED
import java.math.BigDecimal; import java.util.Arrays; import java.util.Scanner; public class Two_Subsequence { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long t=sc.nextInt(); while(t-->0) { long n=sc.nextLong(); long a[]=new long[(int) n]; for(...
Java
159b9c743d6d8792548645b9f7be2753
d197838843a55be500a56fb4ba03154a
800
PASSED
//package codeforces.vp.vp_div_2_737.P_1557_A; import java.io.*; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws FileNotFoundException { FastScan sc = new FastScan(System.in); //Fast...
Java
159b9c743d6d8792548645b9f7be2753
da6cc47ccd4409ac374365305c048da4
800
PASSED
// import java.util.Arrays; import java.util.*; import java.io.*; public class codeforces_738A { public static void main(String[]args){ FastScanner fs = new FastScanner(System.in); int test = fs.nextInt(); while(test-- > 0){ int n = fs.nextInt(); double[]ar =...
Java
159b9c743d6d8792548645b9f7be2753
2964b4a42a197cdc74b78431305e6111
800
PASSED
import java.util.Arrays; import java.util.Scanner; public class codeforces_738A { public static void main(String[]args){ // FastScanner fs = new FastScanner(System.in); Scanner fs = new Scanner(System.in); int test = fs.nextInt(); while(test-- > 0){ int n = fs.nex...
Java
159b9c743d6d8792548645b9f7be2753
7338c10315c07abcb2ff0b130f16e566
800
PASSED
// JAVA program to find sum of all divisors // of a natural number import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; import java.util.StringTokenizer; im...
Java
159b9c743d6d8792548645b9f7be2753
fb79658095eff5ba62cbf2daf2e63356
800
PASSED
#include<bits/stdc++.h> using namespace std; bool cmp(pair < int,int > x,pair < int,int > y) { return x.first < y.first; } int main() { int t; cin >> t; while(t--) { int n, k; cin >> n >> k; vector < pair < int, int > > vp; for(int i = 1; i <= n; ++...
C++
255d6fca1379ae40b03e761802f36664
f9c0005c2c80222fced06837fd2c5dd8
1,100
PASSED
#include<bits/stdc++.h> using namespace std; bool cmp(pair < int,int > x,pair < int,int > y) { return x.first < y.first; } int main() { int t; cin >> t; while(t--) { int n, k; cin >> n >> k; vector < pair < int, int > > vp; for(int i = 1; i <= n; ++...
C++
255d6fca1379ae40b03e761802f36664
45379a0a8aaccd3d9f3b5e852b1a8b1e
1,100
PASSED
#include<bits/stdc++.h> using namespace std; bool cmp(pair < int,int > x,pair < int,int > y) { return x.first < y.first; } int main() { int t; cin >> t; while(t--) { int n, k; cin >> n >> k; vector < pair < int, int > > vp; for(int i = 1; i <= n; ++...
C++
255d6fca1379ae40b03e761802f36664
4e365087179880a005f9752ff331b806
1,100
PASSED
/// ______ __________ _____ _____ _____ /// /// \\\ ||__|| \\\ ||| ||| || || |||\\\ ///||| /// /// \\\ ||__|| \\\ |||_____||| || || ||| \\\ /// ||| /// ///______\\\ ||__|| \\\ |||_____||| || || ||| \\\ //...
C++
255d6fca1379ae40b03e761802f36664
0cb3f5e32f1478d85012469a9f31c0b1
1,100
PASSED
/// ______ __________ _____ _____ _____ /// /// \\\ ||__|| \\\ ||| ||| || || |||\\\ ///||| /// /// \\\ ||__|| \\\ |||_____||| || || ||| \\\ /// ||| /// ///______\\\ ||__|| \\\ |||_____||| || || ||| \\\ //...
C++
255d6fca1379ae40b03e761802f36664
2eabe7c680cb9a21269ffcb7e49cd200
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef set<ll> si; typedef deque<ll> dq; typedef vector<int> vi; typedef pair<ll, ll> pi; typedef string str; #define endl "\n" #define all(x) x.begin(),x.end() #define pb push_back #define pf push_front #define ff first #define ss seco...
C++
255d6fca1379ae40b03e761802f36664
880b7b57fb1db98af2b9d95523edae81
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define all(vec) vec.begin(), vec.end() #define rall(vec) vec.rbegin(), vec.rend() #define ll long long int #define sz(x) int(x.size()) #define newl cout << "\n"; #define For(i, n) for (ll i=0;i<n;i++) #define c...
C++
255d6fca1379ae40b03e761802f36664
c5bdd1aa93000644a503b8f55916d6c5
1,100
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 3e5 + 5; ll n, a[N], k, b[N]; void solve() { ll cnt = 1; vector<ll> vec; cin >> n >> k; for(int i = 1; i <= n; i++) { cin >> a[i]; vec.push_back(a[i]); } sort(vec.begin(), vec.end()); for(int i = 1; i <= n; i++) { ...
C++
255d6fca1379ae40b03e761802f36664
c17a9416a27502ed2df6c620b6c4caaf
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define fastIO ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0); #define Endl '\n' #define itn int #define ll long long #define LSB __builtin_ctzll #define MSB 63-__builtin_clzll #define BITS __builtin_popcountll #define mem(a, v) mem...
C++
255d6fca1379ae40b03e761802f36664
54758aaa721c3b7be45fd23a7f5a64fa
1,100
PASSED
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long int #define ull unsigned long long #define lld long double #define fastttt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #ifndef ONLINE_JUDGE #define debug(x) cerr << #x<<" "; _print(x); cerr << ...
C++
255d6fca1379ae40b03e761802f36664
0c0ec15a9aaf90e3f2ee04a62fed3865
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define mem(a, b) memset(a, b, sizeof a) // others #define endl '\n' typedef unsigned long long ull; typedef pair<int, int> pii; template<class T> void minn(T& a, T b) {if (a > b) a = b;} template<class T> void maxx(T& a, T b)...
C++
ede7de5979a00d81f774ffdf27cea017
4eb0d011d68f28ef54e75ed196e2fdeb
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define mem(a, b) memset(a, b, sizeof a) // others #define endl '\n' typedef unsigned long long ull; typedef pair<int, int> pii; template<class T> void minn(T& a, T b) {if (a > b) a = b;} template<class T> void maxx(T& a, T b)...
C++
ede7de5979a00d81f774ffdf27cea017
0982cfddea086a8c0a1f6e1ad6576328
2,200
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int MAXN=6e5+10; int n,m,h,ll,rr,a[MAXN],ncnt,cnt,cntt[MAXN],pre[MAXN],tmpp,acnt,ans[MAXN]; pair<int,int> laz[5000000],dpp[5000000],tmp; map<int,int> book; vector<pair<int,int> > t[MAXN]; bool bookk[MAXN]; void push_down(int node) //下放懒标 ...
C++
ede7de5979a00d81f774ffdf27cea017
42afbe1872b110ba295a54df3c1030c1
2,200
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int MAXN=6e5+10; int n,m,h,ll,rr,a[MAXN],ncnt,cnt,dp[MAXN],pre[MAXN],tmpp,acnt,ans[MAXN]; pair<int,int> laz[5000000],dpp[5000000],tmp; map<int,int> book; vector<pair<int,int> > t[MAXN]; bool bookk[MAXN]; void push_down(int node) //下放懒标 {...
C++
ede7de5979a00d81f774ffdf27cea017
2c191d7a502b4e5413bf4a837431ba02
2,200
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int MAXN=6e5+10; int n,m,h,ll,rr,a[MAXN],ncnt,cnt,dp[MAXN],pre[MAXN],tmpp,acnt,ans[MAXN]; pair<int,int> laz[5000000],maxn[5000000],tmp; map<int,int> book; vector<pair<int,int> > t[MAXN]; bool bookk[MAXN]; pair<int,int> maxx(pair<int,int> ...
C++
ede7de5979a00d81f774ffdf27cea017
d47c585e0f49309b7c1dc4414eaabc53
2,200
PASSED
#include<bits/stdc++.h> //#define int long long #define pii pair<int,int> #define fi first #define se second /*#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma")*/ using namespace std; using ll...
C++
ede7de5979a00d81f774ffdf27cea017
ba5c8be5b48c634c963206e648de574a
2,200
PASSED
#include<bits/stdc++.h> //#define int long long #define pii pair<int,int> #define fi first #define se second /*#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma")*/ using namespace std; using ll...
C++
ede7de5979a00d81f774ffdf27cea017
280aaaadf4f2ac7240ac7f34bb0fa016
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long const int areTests = 0, N = 6e5 + 2; struct node { int val, lazy, row; node(int x = 0): val(x), lazy(0), row(-1) {} } tree[N << 2]; node merge(node &lch, node &rch) { node ans = node(); if(lch.val <= rch.val) { ans.val = rch.val; ans.row = r...
C++
ede7de5979a00d81f774ffdf27cea017
8ba648d9c9b0f192f93b0202180db4cb
2,200
PASSED
#include <bits/stdc++.h> #define int long long #define mem(a,b) memset(a,b,sizeof(a)) #define fre(z) freopen(z".in","r",stdin),freopen(z".out","w",stdout) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> Pair; const double eps=1e-8; const int inf=2139062143; #if...
C++
ede7de5979a00d81f774ffdf27cea017
ffaa2a661bede308a6623b8b08a82860
2,200
PASSED
#include<iostream> #include<algorithm> #include<cstring> #define x first #define y second using namespace std; using i64=long long; typedef pair<int,int>PII; const int N=3e5+10; struct Node { int l,r; PII w; int lazy; }tr[N*8]; void push_up(int u) { tr[u].w=max(tr[u<<1].w,tr[u<<1|1].w); } voi...
C++
ede7de5979a00d81f774ffdf27cea017
113e0412b7319a9e278ce82a840a4add
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; using namespace std; int ban[10][10],tmp[10][10]; int T,X,Y;string op; int R(int l,int r){return rand()%(r-l+1)+l;} map<string,pii> dlt; void gVis(pii pos,vector<pii> &Vec){ for(int i=1;i<=8;++i) if(i != pos.fir...
C++
ebe8f3323a901a27d14482b75be35fb9
5f43fea2f9c3321656a5aeaa4d734513
2,800
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++
ebe8f3323a901a27d14482b75be35fb9
3b79c368b98ce24db9c5bd9849631821
2,800
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define maxn 300005 #define uint unsigned int #define int long long #define mid (l+r>>1) #define ls (now<<1) #define rs (now<<1|1) #define pc putchar #define gc getchar //#define endl '\n' #define all(x) x.begin(),x.end() inline int read(){...
C++
ebe8f3323a901a27d14482b75be35fb9
aa40f2c3674b5db209eeeb60a000239c
2,800
PASSED
#include<bits/stdc++.h> using namespace std; inline int get() { string s;cin>>s; if(s.find("Up")!=s.npos)return 1; if(s.find("Down")!=s.npos)return -1; if(s.find("Done")!=s.npos) return 99; return 0; } inline void solve() { int x=8,y=1;bool f=1; cout<<x<<' '<<y<<endl;int a=get();if(a==99)return;...
C++
ebe8f3323a901a27d14482b75be35fb9
e1656999b9897d19a331c27b88fe2dca
2,800
PASSED
#include <map> #include <cstdio> #include <string> #include <cstring> #include <iostream> const int maxn = 10; int mp[maxn][maxn]; int tmp[maxn][maxn]; const int n = 8; std::map<std::string, int> dirx; std::map<std::string, int> diry; std::string ds[] = {"Right", "Left", "Up", "Down", "Down-Right", "Down-Left", "U...
C++
ebe8f3323a901a27d14482b75be35fb9
e1a154c54ebc3e701e6c92a229a603a3
2,800
PASSED
#include<iostream> #include<cstdio> #include<cstdlib> #include<cmath> #include<cstring> #include<string> #include<algorithm> #include<queue> #include<vector> #include<set> #include<map> using std::cin;using std::cerr; using std::max;using std::min; using std::string; #define ll long long #define db doubl...
C++
ebe8f3323a901a27d14482b75be35fb9
6c62b63b505cf1cb78c6dd69641cff64
2,800
PASSED
#include<iostream> #define ll long long using namespace std; int main(){ ll t,i,j,k,a,b; string sr; scanf("%lld",&t); while(t--){ printf("1 1\n"),a=b=1; while(cin>>sr){ if(sr=="Done") break; else{ if(a%2==1){ if(b<=7) b++; else a++; } else{ if(b>=2) b--; e...
C++
ebe8f3323a901a27d14482b75be35fb9
af0834229d1e1260ae2cb30a8304ae0f
2,800
PASSED
#include <iostream> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <map> #include <set> #include <iomanip> #include <queue> #include <time.h> #include <bitset> #include <unordered_map> using namespace std; #define ll long long #define ull unsigned long long #defi...
C++
ebe8f3323a901a27d14482b75be35fb9
7c56011d8ee7db412d1707e1dbcc4456
2,800
PASSED
#include <iostream> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <map> #include <set> #include <iomanip> #include <queue> #include <time.h> #include <bitset> #include <unordered_map> using namespace std; #define ll long long #define ull unsigned long long #defi...
C++
ebe8f3323a901a27d14482b75be35fb9
94846848bea61738c6d485bf012c6e47
2,800
PASSED
#include<bits/stdc++.h> using namespace std;main(){int t;cin>>t;string s;while(t--){for(int x=1;x<=2;x++)for(int y=1;y<=8;y++)for(int z=1;z<=8;z++){cout<<y<<' '<<(y%2*2-1)*z+!(y%2)*9<<endl;cin>>s;if(s=="Done")goto nxt;}nxt:;}}
C++
ebe8f3323a901a27d14482b75be35fb9
c0d542ae09591eef539e64912ff8347c
2,800
PASSED
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class PekoraAndTrampolines { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new In...
Java
ac12faea4962613651afdc0b29537ef5
46208c86bd52eea7eed1cf7d923cc651
1,700
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-...
Java
ac12faea4962613651afdc0b29537ef5
b91d558362c6a716badc2bbde9d1c0ee
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6+6; ll a[N]; void solve(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } ll ans = 0; set<int>s; s.insert(n+12); for(int i=1;i<=n;i++){ if(a[i]!=1)s.insert(i); }...
C++
ac12faea4962613651afdc0b29537ef5
04e4f1f84a60e5f39cac8bbe5e598708
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define eb emplace_back #define nl "\n" #define NL "\n" #define lp(j,n) for(int i=j;i<n;i++) #define F first #define S second #define GCD __gcd #define all(a) a.begin(), a.end() #define TESTS int T;cin>>T;while(T--) int ...
C++
ac12faea4962613651afdc0b29537ef5
3f89ce57078150498a7dd51f0eee2c13
1,700
PASSED
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define endl '\n' #define ll long long #define pi pair<int, int> #define f first #define s second const int mxn = 5001; int n; int a[mxn], f[mxn]; void answer(){ cin >> n; for(int i = 1; i <= n; i++) cin >> a[i], f[i]...
C++
ac12faea4962613651afdc0b29537ef5
b06d4d11c18786eeef7d4b70620aa7ad
1,700
PASSED
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define all(x) (x).begin(), (x).end() #define mem0(x) memset(x, 0, sizeof (x)) #define mem1(x) memset(x, -1,...
C++
ac12faea4962613651afdc0b29537ef5
bbfaf3a44ce27fe34870edda87ebdf25
1,700
PASSED
#include <bits/stdc++.h> #include <assert.h> using namespace std; typedef long long ll; #define fs first #define sc second ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); } const int MAXN = 5005; int n; ll arr[MAXN]; ll lazy[MAXN]; int SOLVE() ...
C++
ac12faea4962613651afdc0b29537ef5
1b7ef4d66a3de1dafe76ac1c196bbde0
1,700
PASSED
#include <bits/stdc++.h> #include <assert.h> using namespace std; typedef long long ll; #define fs first #define sc second ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); } const int MAXN = 5005; int n; ll arr[MAXN]; ll lazy[MAXN]; int SOLVE() ...
C++
ac12faea4962613651afdc0b29537ef5
15696787bb0c6ba65849f8c6d6b46880
1,700
PASSED
// Problem: C. Pekora and Trampoline // Contest: Codeforces - Codeforces Global Round 13 // URL: https://codeforces.com/contest/1491/problem/C // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> using namespace std; typedef long long ll;...
C++
ac12faea4962613651afdc0b29537ef5
bf8d656ea4ceba59e8adf8a7635dae37
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { int t; cin>>t; while(t--) { int n; cin>>n; vector<ll> arr(n); for(int i=0;i<n;i++) cin>>arr[i]; vector<ll> c(n, 0); for(int i=0;i<n;i++) { ...
C++
ac12faea4962613651afdc0b29537ef5
8b8891661d0c4378839b2fa7167c9a6c
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vvl; #define endl "\n" #define pb push...
C++
a4e605859608d0c730ecbbee9ffc92d7
4b86a0bf67ef37d7a2657d854c0d8da0
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vvl; #define endl "\n" #define pb push...
C++
a4e605859608d0c730ecbbee9ffc92d7
9f025795c982c64a517e6e9f1b1f6902
1,800
PASSED
#include<bits/stdc++.h> #define unless(x) if (!(x)) #define pb push_back #define eb emplace_back /* #define f first */ /* #define s second */ #define lb lower_bound #define ub upper_bound #define ins insert #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define mem(x, y) memset(x, y, sizeof(x))...
C++
a4e605859608d0c730ecbbee9ffc92d7
509cac1b61c7e92b9ba05798609ee5ac
1,800
PASSED
#include<bits/stdc++.h> #define unless(x) if (!(x)) #define pb push_back #define eb emplace_back /* #define f first */ /* #define s second */ #define lb lower_bound #define ub upper_bound #define ins insert #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define mem(x, y) memset(x, y...
C++
a4e605859608d0c730ecbbee9ffc92d7
4aa0b4a2e59ca62d21a75e382e103fb5
1,800
PASSED
#include<bits/stdc++.h> #define unless(x) if (!(x)) #define pb push_back #define eb emplace_back /* #define f first */ /* #define s second */ #define lb lower_bound #define ub upper_bound #define ins insert #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define mem(x, y) memset(x, y...
C++
a4e605859608d0c730ecbbee9ffc92d7
0cc3ba5a5a465f5cf771e6b94f980bb6
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int q, u, v, ku[35], kv[35]; int main(){ cin>>q; for (int z=1; z<=q; z++){ cin>>u>>v; int dpu=0; int dpv=0; bool kt=true; for (int i=31; i>=0; i--){ ku[i]=(u>>i)&1; dpu+=ku[i]; ...
C++
a4e605859608d0c730ecbbee9ffc92d7
48e10ff440fe48aaeb2eecdcdcfee323
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int q, u, v, ku[35], kv[35]; int main(){ cin>>q; for (int z=1; z<=q; z++){ cin>>u>>v; int dpu=0; int dpv=0; bool kt=true; for (int i=31; i>=0; i--){ ku[i]=(u>>i)&1; dpu+=ku[i]; ...
C++
a4e605859608d0c730ecbbee9ffc92d7
abc34bc9a95b86220cee1470fec1e8e3
1,800
PASSED
#include <bits/stdc++.h> #define in read() #define fi first #define se second #define pb push_back #define vec vector<int> #define mp make_pair #define pii pair<int,int> #define pli pair<ll,int> #define pll pair<ll,ll> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef...
C++
a4e605859608d0c730ecbbee9ffc92d7
99f3fb5e7b4e2fcb712a345e453379d7
1,800
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vl> vll; typedef vector<vector<int>> vii; typedef pair<int,int> pii; typedef pair<ll,ll> pll; template <...
C++
a4e605859608d0c730ecbbee9ffc92d7
e106c6ffcc7ece338be18580f361cb54
1,800
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vl> vll; typedef vector<vector<int>> vii; typedef pair<int,int> pii; typedef pair<ll,ll> pll; template <cl...
C++
a4e605859608d0c730ecbbee9ffc92d7
13444935ce533d86aec43bec2a0e6f3f
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n,q,t,x,l,m1=0; cin>>n>>q; int arr[n+1]; for(int i=0;i<n;i++){ cin>>arr[i]; } for(int i =0;i<n;i++){ if(arr[i]==1){ m1++; } } for(int i =0;i<q;...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
ba0725f0b77f735ca49f4c5ea800cbfc
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,q; cin>>n>>q; int arr[n+1]; int m1=0; for(int i=1;i<=n;i++){ cin>>arr[i]; if(arr[i]==1){ m1++; } } while(q--){ int t,x; cin>>t>...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
eb311e8e285150008cc94181ebe63056
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; int arr[n]; int one = 0, zero = 0; for(int i = 0; i < n; ++i) { cin >> arr[i]; if (arr[i] == 1) { one++; } } for (int i = 0; i < q; ++i) ...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
fe3c1251678835604b7f34927ba6d25d
800
PASSED
#include <iostream> using namespace std; int main() { int n, q; cin >> n >> q; int a[100000]; int count = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; count += a[i]; } for (int i = 0; i < q; ++i) { int t, k; cin >> t >> k; if (t == 1) { ...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
0950d5e5b3a720fd05ec3756148a9f55
800
PASSED
#include <iostream> using namespace std; int main() { int n, q, t, o = 0, x, k; cin >> n >> q; int a[n]; for (int i = 0; i < n; i ++){ cin >> a[i]; } for(int y = 0; y < n; y ++){ o += a[y]; } for (int i = 0; i < q; i ++){ cin >>...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
790f30e8788c36d9f09e9d308e81e765
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n, m; cin >> n >> m; vector<int> a; int cnt1=0, cnt0=0; for (int i=0; i<n; i++){ int x; cin >> x; a.push_back(x); if (x==1) cnt1++; else cnt0++; } for (int j=0; j<m; j++){ int t, l; ...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
b51a655c1f80e1f3b3209739ef0dec54
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n, m; cin >> n >> m; vector<int> a; int cnt1=0, cnt0=0; for (int i=0; i<n; i++){ int x; cin >> x; a.push_back(x); if (x==1) cnt1++; else cnt0++; } for (int j=0; j<m; j++){ int t, l; ...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
4eb2afa6ebffeb2991e8513f289add1c
800
PASSED
#include <iostream> #include <vector> using namespace std; int main() { int n,q,t,k,f=0; cin >> n >> q; vector<int> sete(n); vector<int> ans(n); for (int i=0;i<n;++i) { cin >> sete[i]; if (sete[i] == 1) { f += 1; } } for (int i=0;i<q;++i) { cin >> t >> k; if (t == 1) { ...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
60829e035412c79426d6fadac778f4c4
800
PASSED
#include <iostream> #include <vector> using namespace std; int main() { int n,q,t,k,f=0; cin >> n >> q; vector<int> sete(n); vector<int> ans(n); for (int i=0;i<n;++i) { cin >> sete[i]; if (sete[i] == 1) { f += 1; } } for (int i=0;i<q;++i) { cin >> t >> k; if (t == 1) { ...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
65efe422181cc5fb63c20bf851149cf5
800
PASSED
#include <iostream> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); // cin.tie(0); cout.tie(0); size_t n, q; cin >> n >> q; int ocnt = 0, lcnt = 0; vector<int> vec(n, 0); for (auto& el : vec){ cin >> el; (el == 0) ? ocnt++ : lcnt++; } for (size_...
C++
ccf7aba6ca9bbf39a5ec8a20ec018825
b392fbb4b0440090f6c72f0710012d25
800
PASSED
import os , sys,time, collections , math , pprint , itertools as it , operator as op , bisect as bs ,functools as fn maxx , localsys , mod = float('inf'), 0 , int(1e9 + 7) nCr = lambda n, r: reduce(mul, range(n - r + 1, n + 1), 1) // factorial(r) ceil = lambda n , x: (n+x -1 )//x osi, oso = '/home/priyanshu/Docum...
Python
7f502f2fd150a2ded948826960d123cd
22cd544adf02bb97ee02689e0a5db6bb
1,200
PASSED
import os , sys,time, collections , math , pprint , itertools as it , operator as op , bisect as bs ,functools as fn maxx , localsys , mod = float('inf'), 0 , int(1e9 + 7) nCr = lambda n, r: reduce(mul, range(n - r + 1, n + 1), 1) // factorial(r) ceil = lambda n , x: (n+x -1 )//x osi, oso = '/home/priyanshu/Docum...
Python
7f502f2fd150a2ded948826960d123cd
e9afde2ba35ee1fb6ae95ea9496c2677
1,200
PASSED
t = int(input()) for _ in range(t): n,u,v = map(int,input().split()) arr = list(map(int,input().split())) ans = 10000*(u+v) # if t>15 and _ == 146: # print('testcase : ',u,v,'-',arr) for i in range(n-1): if arr[i]==arr[i+1]: ans ...
Python
7f502f2fd150a2ded948826960d123cd
26b6175c72061dd7d25c729d7a4cdb61
1,200
PASSED
a = int(input()) for x in range(a): b,c,d = map(int,input().split()) e = list(map(int,input().split())) h = 0 ans = 999999999999 for y in range(b-1): if abs(e[y+1] - e[y]) > 1: ans = 0 if abs(e[y+1] - e[y]) > 0: ans = min(ans,min(c,d)) if(ab...
Python
7f502f2fd150a2ded948826960d123cd
fb2c286d1f896cd3a245403e51eefd60
1,200
PASSED
for _ in range(int(input())): n,u,v = map(int,input().split()) a = list(map(int,input().split())) ans = 10**10 for i in range(1,n): if abs(a[i]-a[i-1]) == 1: ans = min(u,v,ans) elif a[i]==a[i-1]: ans = min (ans,v+u,v*2) else: ans = 0 ...
Python
7f502f2fd150a2ded948826960d123cd
12434a0f5ecb2080eff49a1ef3d05500
1,200
PASSED
for _ in range(int(input())): n,u,v = map(int,input().split()) a = list(map(int,input().split())) ans = 10000*(u+v) for i in range(1,n): if abs(a[i]-a[i-1]) == 1: ans = min(u,v,ans) elif a[i]==a[i-1]: ans = min (ans,v+u,v*2) else: ans...
Python
7f502f2fd150a2ded948826960d123cd
471aab749072155eb4de36624c5fdc43
1,200
PASSED
t = int(input()) for i in range(t): n, x, y = map(int, input().split()) d = list(map(int, input().split())) k = d[0] pr = 0 if d.count(k) == n: print(min(x + y, 2 * y)) continue else: for i in range(1, n): if abs(d[i] - d[i - 1]) > 1: ...
Python
7f502f2fd150a2ded948826960d123cd
66744cbc6b3c3d88def8c8eb3754df52
1,200
PASSED
t = int(input()) for i in range(t): n, x, y = map(int, input().split()) d = list(map(int, input().split())) k = d[0] pr = 0 if d.count(k) == n: print(min(x + y, 2 * y)) continue else: for i in range(1, n): if abs(d[i] - d[i - 1]) > 1: ...
Python
7f502f2fd150a2ded948826960d123cd
568f1b8bced084858fdf41bf72631658
1,200
PASSED
# Problem: B. Minimal Cost # Contest: Codeforces - Codeforces Global Round 13 # URL: https://codeforces.com/contest/1491/problem/B # Memory Limit: 256 MB # Time Limit: 2000 ms # Powered by CP Editor (https://github.com/cpeditor/cpeditor) from sys import stdin def get_ints(): return list(map(int, stdin.readli...
Python
7f502f2fd150a2ded948826960d123cd
57604336bd428d7e42b774b9436a00ff
1,200
PASSED
for _ in range(int(input())): n,u,v=map(int,input().split()) lis=list(map(int,input().split())) ans=2**63 for i in range(1,n): if abs(lis[i]-lis[i-1])>1:ans=0 elif abs(lis[i]-lis[i-1])==1:ans=min(ans,min(u,v)) else:ans=min(ans,v+min(u,v)) print(ans)
Python
7f502f2fd150a2ded948826960d123cd
b3647ff0ffc20bfdac272f83b874d142
1,200
PASSED
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";} template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while(*sdbg!=',') cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, a...); } template<class T...
C++
3e2c5147fda43caf4d603eba21c159b4
979b5f1eb8151fc5baa5b630a27cec62
2,700
PASSED
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";} template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while(*sdbg!=',') cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, a...); } template<class T...
C++
3e2c5147fda43caf4d603eba21c159b4
0671f72fed56ae781c34ccaae955aa32
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define f1r(i, a, b) for (int i = a; i < b; ++i) #define f0r(i, a) f1r(i, 0, a) #define each(t, a) for (auto& t : a) #define mp make_pair #define f first #define s second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define all...
C++
3e2c5147fda43caf4d603eba21c159b4
33a6677a7442ba44e2d6ca1c216aed1f
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 2e3 + 5; int pos[maxn], tot, n, lg; int query(vector<int> a, vector<int> b) { tot++; printf("? %d %d\n", a.size(), b.size()); for(int i = 0; i < a.size(); i++) printf("%d ", a[i]); puts(""); fflush(stdout); f...
C++
3e2c5147fda43caf4d603eba21c159b4
586fe645192fd875aa5ca3941911de6f
2,700
PASSED
#include<bits/stdc++.h> #define fi first #define se second #define all(x) (x).begin() , (x).end() #define rall(x) (x).rbegin() , (x).rend() #define pb push_back #define len(x) (int)(x).size() typedef long long ll; typedef long double ld; using namespace std; const int N =2e5 + 10; //map < int , int > w...
C++
3e2c5147fda43caf4d603eba21c159b4
f0d53a9e888ce95557e78aa8338c8b7a
2,700
PASSED
#include<bits/stdc++.h> #define rd(x) x=read() using namespace std; int T; int n; inline int read() { int x=0,f=1;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=getchar(); return x*f; } int main() { rd(T); while(T--) { ...
C++
3e2c5147fda43caf4d603eba21c159b4
0b495df234415a798d24b11669f62315
2,700
PASSED
#include <bits/stdc++.h> #define rd(x) x=read() using namespace std; const int N = 2005; int T, n, F; inline int read() { int x=0,f=1;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=getchar(); return x*f; } int main() { rd(T);...
C++
3e2c5147fda43caf4d603eba21c159b4
6dc8b09369a9b0ee3155f2d4b714d4ba
2,700
PASSED
#include <bits/stdc++.h> #define rd(x) x=read() using namespace std; const int N = 2005; int T, n, F; inline int read() { int x=0,f=1;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=getchar(); return x*f; } int main() { rd(T);...
C++
3e2c5147fda43caf4d603eba21c159b4
190680140a8d1547c6596424a62f30ba
2,700
PASSED
#include <bits/stdc++.h> #define rd(x) x=read() using namespace std; const int N = 2005; int T, n, F; inline int read() { int x=0,f=1;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=getchar(); return x*f; } int main() { rd(T);...
C++
3e2c5147fda43caf4d603eba21c159b4
4f00de920d93ce5ca4ca0e87bd59e5c1
2,700
PASSED
#include <bits/stdc++.h> #define rd(x) x=read() using namespace std; const int N = 2005; int T, n, F; inline int read() { int x=0,f=1;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=getchar(); return x*f; } int main() { rd(T);...
C++
3e2c5147fda43caf4d603eba21c159b4
3ee5a6a4259393a531dceef5769bdd55
2,700
PASSED
#include<bits/stdc++.h> #define long long long using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N=1e6,inf=1e9,mod=1e9+7; vector<int>ad[N+2],nm[N+2]; int f[N+2],fib[N+2],vs[N+2],sub[N+2]; void reckon(int nd,int pr) { sub[nd]=1; int sz=ad[nd].size(); ...
C++
ad5b878298adea8742c36e2e119780f9
01689d9e986beefc9947cee5d3f3db01
2,400
PASSED
#include<bits/stdc++.h> #define long long long using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N=1e6,inf=1e9,mod=1e9+7; set<int>ad[N+2]; int f[N+2],ln[N+2],fib[N+2],vs[N+2],sub[N+2],pt,an[N+2]; void no() { cout<<"NO"<<endl,exit(0); } void reckon(int n...
C++
ad5b878298adea8742c36e2e119780f9
71981757dc46c852abe4c22d8cd61ceb
2,400
PASSED
#include<bits/stdc++.h> #define long long long using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N=1e6,inf=1e9,mod=1e9+7; set<int>ad[N+2]; int f[N+2],ln[N+2],fib[N+2],vs[N+2],sub[N+2],pt,an[N+2]; void no() { cout<<"NO"<<endl,exit(0); } void reckon(int n...
C++
ad5b878298adea8742c36e2e119780f9
cf92faca33025e76917601911c09480b
2,400
PASSED
#include<bits/stdc++.h> #define long long long using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N=1e6,inf=1e9,mod=1e9+7; set<int>ad[N+2]; int f[N+2],ln[N+2],fib[N+2],vs[N+2],sub[N+2],pt,an[N+2]; void no() { cout<<"NO"<<endl,exit(0); } void reckon(int n...
C++
ad5b878298adea8742c36e2e119780f9
e666a7b586907a12f934599dedbd7260
2,400
PASSED
#include<bits/stdc++.h> #define long long long using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N=1e6,inf=1e9,mod=1e9+7; set<int>ad[N+2]; int f[N+2],ln[N+2],fib[N+2],vs[N+2],sub[N+2],pt,an[N+2]; void no() { cout<<"NO"<<endl,exit(0); } void reckon(int n...
C++
ad5b878298adea8742c36e2e119780f9
a4fc4136ee253b52f00313a30f95d083
2,400
PASSED
#include<bits/stdc++.h> #define long long long using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N=1e6,inf=1e9,mod=1e9+7; set<int>ad[N+2]; int f[N+2],ln[N+2],fib[N+2],vs[N+2],sub[N+2],pt,an[N+2]; void no() { cout<<"NO"<<endl,exit(0); } void reckon(int n...
C++
ad5b878298adea8742c36e2e119780f9
926d49e2618f57ae36628e555b455256
2,400
PASSED
#include<bits/stdc++.h> using namespace std; int m,fib[50],fp[200005],fa[200005],to[200005]; int n,cnt=1,h[200005],sz[200005],v[200005],tmp; bool ava[400005]; struct edge{ int to,nxt; }e[400005]; void add(int x,int y){ e[++cnt].to=y; e[cnt].nxt=h[x]; h[x]=cnt; } void dfs(int x,int prt,int f){ sz[x]=1...
C++
ad5b878298adea8742c36e2e119780f9
1fd5121959f6228c53c0a87b8defe067
2,400
PASSED
#include<bits/stdc++.h> using namespace std; int m,fib[50],fp[200005],fa[200005],to[200005]; int n,cnt=1,h[200005],sz[200005],v[200005]; bool ava[400005]; vector<int>tmp; struct edge{ int to,nxt; }e[400005]; void add(int x,int y){ e[++cnt].to=y; e[cnt].nxt=h[x]; h[x]=cnt; } void dfs(int x,int prt,int ...
C++
ad5b878298adea8742c36e2e119780f9
8c10a23f3b0b7034dbc3ad763d1ae83e
2,400
PASSED
#include<bits/stdc++.h> using namespace std; int m,fib[50],fp[200005],fa[200005],to[200005]; int n,cnt=1,h[200005],sz[200005],v[200005]; bool ava[400005]; vector<int>tmp; struct edge{ int to,nxt; }e[400005]; void add(int x,int y){ e[++cnt].to=y; e[cnt].nxt=h[x]; h[x]=cnt; } void dfs(int x,int prt,int ...
C++
ad5b878298adea8742c36e2e119780f9
6c58060428c7e8619d95071d4af51539
2,400
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, siz[N]; vector<int> fib; vector<pair<int, bool> > G[N]; void NO() { cout << "NO\n"; exit(0); } void GetSize(int u, int fa) { siz[u] = 1; for(pair<int, bool> e : G[u]) { if(e.second) continue; int v = e.f...
C++
ad5b878298adea8742c36e2e119780f9
398b8a1a88200c1969e65ec218361e5b
2,400
PASSED
#include <cstdio> #include <algorithm> #include <iostream> #include <vector> #include <cassert> #include <cstdlib> using namespace std; typedef long long LL; const int CN=5e5+5; int N,per[CN]; bool vis[CN]; int siz[CN],tot; vector<pair<int,int> >ans; void add(int x,int y){ ans.push_back(make_pair(x,y)); ...
C++
e4dc319588cc8eca6a5c3d824e504c22
f4b4a0c030b05434ae0df407f17b5162
2,800
PASSED
#include <bits/stdc++.h> #pragma GCC optimize("O3") #define endl '\n' using namespace std; const int maxn = 2e5 + 3; int n; int p[maxn]; void read() { cin >> n; for (int i = 1; i <= n; i++) cin >> p[i]; } vector <vector <int> > cycles; bool used[maxn]; vector <pair <int, int> > op; bool...
C++
e4dc319588cc8eca6a5c3d824e504c22
df764204041dda7770dbb8087614786a
2,800
PASSED