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; const int N = 88888, K = 4, Mod = 777777777; int n, q, M[K][K], P[N * 4][K][K]; void Set(int i, int val, int id = 1, int l = 0, int r = n) { for (int i = 1; i < K; i++) for (int j = 1; j < K; j++) P[id][i][j] = 0; if (r - l < 2) { if (...
C++
c99e67aa06313df68b1ea660243d23a9
6d36ea5dab3ead6b27c94f4740f2fac5
2,400
PASSED
/************************************************************** Problem: ???? User: (team ina) xiaodongc(little_Bear_c) Language: C++ Result: Accepted Time:0 ms Memory:0 kb length:0 kb score: inf ****************************************************************/ //CLOCKS_PER_SEC /* A po...
C++
c99e67aa06313df68b1ea660243d23a9
5a1407f555596ef8ba6e1b9cc0f57a15
2,400
PASSED
#include <bits/stdc++.h> // In Need Of GOD // ASHKAN using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define mp make_pair #define F first #define S second #define err(q) cout << #q << " = " << q << endl; const int N = 1e5 + 50, B = 5, MOD = 777777777; ll seg[4 * N][B][B], n, ...
C++
c99e67aa06313df68b1ea660243d23a9
55318d7503a2dc769e8e2cee20fdec03
2,400
PASSED
#include<bits/stdc++.h> using namespace std; const int mxn=(1e5); int n,q; int w[4][4]; struct node{ int s[4][4]; }; node t[mxn*4]; int mod=777777777; node merge(node &a,node b) { node ans; memset(ans.s,0,sizeof ans.s); for(int i=1;i<=3;++i) for(int j=1;j<=3;++j) for(int k=1;k<=3;++k...
C++
c99e67aa06313df68b1ea660243d23a9
90ae2b75368db1b0732d753b4e957b72
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define M 111111 #define lft (id << 1) #define rgt (id << 1 | 1) const int mod = 777777777; int n, Q; int T[M << 2][4][4], f[4][4]; void setv(int id, int v) { for (int i = 1; i <= 3; i++) for (int j = 1; j <= 3; j++) T[id][i][j] = 0; if (!v) { for (int i = 1; i <...
C++
c99e67aa06313df68b1ea660243d23a9
82e3fa868080f1669e9b69acb706655e
2,400
PASSED
#include<iostream> #include<vector> using namespace std; const int n_max=100006; int N,M,K,i,u,v,S,T,l,r,q; int Dis[n_max]; bool Vol[n_max]; vector <int> g[n_max]; void dfs(int u){ if(Dis[T]<=q)return; int i; if(Vol[u]) Dis[u]=0; for(i=0;i<g[u].size();i++) if(Dis[g[u][i]]>Dis[u]+1){...
C++
1b336422bb45642d01cc098d953884a6
604c0cc61f5ed8ee31baa3ff635fcb0f
2,000
PASSED
#include<iostream> #include<vector> using namespace std; const int n_max=100006; int N,M,K,i,u,v,S,T,l,r,q; int Dis[n_max]; bool Vol[n_max]; vector <int> g[n_max]; void dfs(int u){ if(Dis[T]<=q)return; int i; if(Vol[u]) Dis[u]=0; for(i=0;i<g[u].size();i++) if(Dis[g[u][i]]>Dis[u]+1){...
C++
1b336422bb45642d01cc098d953884a6
6e7f8f168440ceeac21739c8e9f24473
2,000
PASSED
#include<iostream> #include<stdio.h> #include<cmath> #include<algorithm> #include<vector> #include<set> #include<queue> #include<stack> #include<map> using namespace std ; #define MAXN 100007 int n , m , k ; bool a[ MAXN ] ; int s , t ; int pr[ MAXN ] ; pair < int , int > d[ MAXN ] ; vector < int > v[ MAXN ] ; in...
C++
1b336422bb45642d01cc098d953884a6
20d8ebc39a2af7174b61341a338d68cf
2,000
PASSED
#include <cstdio> #include <queue> #include <cstring> using namespace std; typedef pair<int ,int >P; priority_queue<P,vector<P>,greater<P> > que; const int maxn=1e5+5; const int maxm=4e5+5; const int inf=0x7fffffff; int n,m,k,s,e; bool g[maxn]; int cap[maxn]; int first[maxn]; int nxt[maxm]; int to[maxm]; void add...
C++
1b336422bb45642d01cc098d953884a6
121eb6a15f7c98b527797aa2f63df75a
2,000
PASSED
#include <iostream> #include <vector> #include <queue> using namespace std; const int dim1 = 1e5; const int dim2 = 2 * 1e5 + 3; const int oo = 3 * 1e5; int s, t; /// start , tinta int n, m, k; /// Folosesc si eu notatii din eng, sunt mai scurte. :) vector<int> E[ dim2 ]; /// Graful int loc[ dim2 ]; int d[ dim2 ]; ...
C++
1b336422bb45642d01cc098d953884a6
9f26a46592864510b561b31031414e89
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int maxx = 2e5 + 20, inf = 1e9 + 2; int start, dest, n, m, l, r, k, mark[maxx], a[maxx], d[maxx], src[maxx]; bool vis2[maxx], vis[maxx]; vector <int> adj[maxx], ad2[maxx]; queue <int> q; void dfs(int root) { vis2[root] = true; for(int x:ad2[root]) if (!vis2[x]...
C++
1b336422bb45642d01cc098d953884a6
a98d97f4a1ae89f0d50c9fc4d65a4885
2,000
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; //#define int long long const int maxn = 1e5 + 10; vector<int> g[maxn]; int mark[maxn]; int dist[maxn]; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n,m,k; cin >> n >> m >> k; int u,v; int ct; for (int i = 0;i <...
C++
1b336422bb45642d01cc098d953884a6
b9fd382249db009f0b8caed8fd1a432a
2,000
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; //#define int long long const int maxn = 1e5 + 10; vector<int> g[maxn]; int mark[maxn]; int dist[maxn]; int32_t main(){ int n,m,k; cin >> n >> m >> k; int u,v; int ct; for (int i = 0;i < k;i++){ cin >> ct; mark[ct] = 1; } ...
C++
1b336422bb45642d01cc098d953884a6
91902afdfa875f70194cda4fb31d3746
2,000
PASSED
#include<iostream> #include <algorithm> #include <cmath> #include <iterator> #include <cstring> #include <cstdio> #include <iomanip> #include <sstream> #include <map> #include <unordered_map> #include <vector> #include <bitset> #include <cctype> #include <set> #include <stack> #include <queue> #include <fstream> #incl...
C++
1b336422bb45642d01cc098d953884a6
db3f7d2c97682d77f435fcab6e7eacf8
2,000
PASSED
#include<iostream> #include <algorithm> #include <cmath> #include <iterator> #include <cstring> #include <cstdio> #include <iomanip> #include <sstream> #include <map> #include <unordered_map> #include <vector> #include <bitset> #include <cctype> #include <set> #include <stack> #include <queue> #include <fstream> #incl...
C++
1b336422bb45642d01cc098d953884a6
89164c3dc08a8d01ea2f6565b3eb03d0
2,000
PASSED
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 2001; const int MAXK = 2001; const int MOD = 1e9 + 7; int n, k; char s[MAXN]; int dp[MAXN][MAXK]; int col_sum[MAXK]; int main(void) { scanf("%d%d", &n, &k); scanf("%s", s); for(int pos = n; pos >= 0; --pos) { for(...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
4ed4f0ed292a6ca5e1de69c473ba5023
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define LL long long #define F first #define S second #define fo(i, n) for(int i = 1; i <= n; ++i) #define whatis(X) cout << #X << " is " << X << endl; const int N = 100001; const int mod = (int)(1e9 + 7); int n, K; string s; LL...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
7c9591d30cd6adb8a41c21a454304de7
2,500
PASSED
#include <bits/stdc++.h>/*{{{*/ using namespace std;typedef long long ll;typedef long double ld;void run();int main(){ios::sync_with_stdio(0);run();}/*}}}*/ ll const lots=1000000007ll; ll dp[2001][2001]; ll n,m; string s; ll sult[2001][2001]; ll sof[2001]; ll sum(ll n){ return n*(n+1)/2ll; } void run(){ cin>>n...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
bea0cdcb8723427dc3edb57d13c8c74c
2,500
PASSED
#include <iostream> #include <stdio.h> #include <vector> #include <algorithm> #include <math.h> #include <cassert> #include <map> #include <string> #include <set> #define MOD 1000000007LL using namespace std; char s[2005]; long long dp[2005][5005]; long long sum[2005][5005]; int n, k; int main() { scanf("%d%d%s"...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
0f3c66c1ea4867ce99172702c107f96e
2,500
PASSED
#include <cstdio> #include <algorithm> #include <cstring> typedef long long ll; const int N = 2000 + 5; const int mod = 1000000007; char s[N]; ll d[N][N], sum[N]; int n, K; int main() { scanf("%d%d", &n, &K); scanf("%s", s + 1); d[0][0] = sum[0] = 1; for (int i = 1; i <= n; ++i) { for (int...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
e2cd3cdf5acee2313c16ea8234b6a766
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define TR(i,v) for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i) #define DEBUG(x) cout << #x << " = "; cout << x << endl; #define SIZE(p) (int)(p).size() #define MP(a, b) make_pair((a), (b)) #define ALL(p) (p).begin(), (p).end() #define rep(i, n) for(int (...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
3f190db60a3b04d3a95de38930c674cd
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define TR(i,v) for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i) #define DEBUG(x) cout << #x << " = " << (x) << endl; #define SIZE(p) (int)(p).size() #define MP(a, b) make_pair((a), (b)) #define ALL(p) (p).begin(), (p).end() #d...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
8e0c747d23eccc56d425e2803ddb4a74
2,500
PASSED
#include<stdio.h> #include<iostream> #include<string.h> #include<algorithm> #include<vector> #include<set> using namespace std; #define N 2505 #define mod 1000000007 #define ll __int64 ll n,k; ll dp[N][N];//dp[i][j]表示i位置产生的j对(1-i-1都是相同的) char s[N]; ll num[N], sum[N]; ll work(){ if(k==0)return num[1]; dp[0][0] =...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
ef8e26faaaf889120f132d2e6868f94c
2,500
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #include<queue> #include<set> #include<cstring> #include<vector> #include<bitset> #include<iterator> #include<list> #include<map> #include<cstdlib> #include<ctime> #include<utility> using namespace std; #define L p->ch[0] #define ...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
e2b88efeb50280773e3a53632b54af5c
2,500
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #include<queue> #include<set> #include<cstring> #include<vector> #include<bitset> #include<iterator> #include<list> #include<map> #include<cstdlib> #include<ctime> #include<utility> using namespace std; #define L p->ch[0] #define ...
C++
6acc6ab9e60eceebb85f41dc0aea9cf4
95bf811a450a39e2ab31ce770df7c480
2,500
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); ll t, n; cin >> t; while (t--) { cin >> n; vector<ll> data(n); vector<ll> prefix(n); vector<ll> suffix(n); int totalSum = 0; bool notPossible = false; for...
C++
6e5b4d43e64645cf26d5eac31437b1a9
d0651359474bbbb035a18eb296fdcf3a
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int n; cin >> n; long long a[n]; bool Haha = true; long long s = 0; for (int j = 0; j < n; j++) { cin >> a[j]; } ...
C++
6e5b4d43e64645cf26d5eac31437b1a9
99bde481d0e3227a404113d59289dc71
1,300
PASSED
// Problem : B. Just Eat It! // Contest : Codeforces - Codeforces Round #613 (Div. 2) // URL : https://codeforces.com/problemset/problem/1285/B // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) // #pragma GCC optimize("Ofast") // #pragma GCC target("avx,av...
C++
6e5b4d43e64645cf26d5eac31437b1a9
03d12747bc3c14fdf9cb9e4bf34e2421
1,300
PASSED
#include<iostream> #include<iomanip> #include<cmath> #include<cstdlib> #include<vector> #include<set> #include<stack> #include<string> #include<fstream> #include<map> #include<utility> #include<cctype> #include<algorithm> #include<cstdio> using namespace std; typedef long long ll; int main() { ll t; cin>>t;...
C++
6e5b4d43e64645cf26d5eac31437b1a9
989ef6b3f67af143db69408a48e14f6a
1,300
PASSED
#include<bits/stdc++.h> #define ll long long #define pb push_back #define pii pair<int,int> #define vi vector<int> #define vii vector<pii> #define mi map<int,int> #define mii map<pii,int> #define all(a) (a).begin(),(a).end() #define FF first #d...
C++
6e5b4d43e64645cf26d5eac31437b1a9
cd4f71651a1aade280ee6dc0ddc354ce
1,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = (9999999999LL); const int MAX_N = 1e5; ll a[MAX_N]; bool solve(int n) { ll sum = 0; for (int i = 0; i < n; i++) { sum += a[i]; if (sum <= 0) return 0; } sum = 0; for (int i = n - 1; i >= 0 ; i--) { ...
C++
6e5b4d43e64645cf26d5eac31437b1a9
c6e18d86aef4948b916107af26ac518a
1,300
PASSED
//prefix suffix array sum #include<bits/stdc++.h> #define FAST ios_base::sync_with_stdio(0);cin.tie(0) #define binary(n, len) cout << bitset<len>(n) << '\n' #define PI acos(-1.0) #define eps 1e-67 #define pf printf #define sf scanf #define sz size() #define rr read #define ww write #define clr(arr) memset((arr),0,(siz...
C++
6e5b4d43e64645cf26d5eac31437b1a9
9f5d7d37a64caf7a808fb36d9956280d
1,300
PASSED
#include<bits/stdc++.h> #define FAST ios_base::sync_with_stdio(0);cin.tie(0) #define binary(n, len) cout << bitset<len>(n) << '\n' #define PI acos(-1.0) #define eps 1e-67 #define pf printf #define sf scanf #define sz size() #define rr read #define ww write #define clr(arr) memset((arr),0,(sizeof(arr))) #define rep(i,a,...
C++
6e5b4d43e64645cf26d5eac31437b1a9
d9798cb39e7b2544d62fc4b6f0e4886d
1,300
PASSED
#include<iostream> #include<bits/stdc++.h> #define ll long long #define fori(a,n) for(long long i=a;i<n;i++) #define forj(a,n) for(long long j=a;j<n;j++) #define fio ios_base::sync_with_stdio(false); cin.tie(NULL); using namespace std; int main(){ fio; long long int t; cin>>t; while(t--){ long long int n; ...
C++
6e5b4d43e64645cf26d5eac31437b1a9
4a83cff034f511d22d8dacbd16cca5f8
1,300
PASSED
import java.util.*; public class CF363D2C { public static void main(String args[])throws Exception { Scanner sc=new Scanner(System.in); char ch[]=sc.next().toCharArray(); int len=ch.length; int ar[]=new int[len]; int k=0; int j=0;//it points to the location from w...
Java
31d803d886c47fe681bdcfbe6c74f090
328e580333e785c936f2af574be80638
1,400
PASSED
import java.util.Scanner; /** * * @author elshamey */ public class Examples { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner scan = new Scanner(System.in); //aabbaabbaabbaabbaabbaabbccccc...
Java
31d803d886c47fe681bdcfbe6c74f090
b6386d094522c7a940a23c965e3d4b15
1,400
PASSED
import java.util.*; public class practice { public static void main(String[] args) { Scanner scn=new Scanner(System.in); char a ,b='@',c='/',d='>'; String s=scn.next(); for(int i=0;i<s.length();i++){ a=s.charAt(i); if(!((a==b&&b==c)||(a==b&&c==d))){ System.out.print(a); d=c; c=b; ...
Java
31d803d886c47fe681bdcfbe6c74f090
f3ab875c70e095e1e63d009efcd85f4a
1,400
PASSED
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class TestClass //implements Runnable { int x,y; public TestClass(int x,int y) { this.x=x; this.y=y; } public static void main(String args[]) throws Exception {/* ...
Java
31d803d886c47fe681bdcfbe6c74f090
222d516aa6211992e6c4ce0e19a6598b
1,400
PASSED
import java.util.*; import java.lang.*; import java.math.*; public class main { public static void woof(String str) { char [] star = str.toCharArray(); StringBuilder f = new StringBuilder(); int en; for (int i = 0; i < str.length(); i++) { en= f.length(); ...
Java
31d803d886c47fe681bdcfbe6c74f090
29bbf1806a01c12daf99841621dd89b1
1,400
PASSED
import java.io.*; import java.util.*; public class fixing_typos { public boolean lastThreeSame(String ss, int i, String ans) { if ((ss.charAt(i)==(ans.charAt(i-1)))&&(ss.charAt(i-2)==( ss.charAt(i-1)))) return(true); else return(false); } public boolean twinSame(String ss, int i) { if ((ss.charAt(...
Java
31d803d886c47fe681bdcfbe6c74f090
ad24bf7621060c8ef40fb5284d9e751b
1,400
PASSED
import java.util.ArrayList; import java.util.Scanner; public class FixingTypos { static int getnum(char ch) { String str = "abcdefghijklmnopqrstuvwxyz"; return str.indexOf(ch); } public static void main(String[] args) { Scanner s = new Scanner(System.in); String str = s.next(); char ch[] = str.toCharArr...
Java
31d803d886c47fe681bdcfbe6c74f090
9275b6062e623e5be2f2c42170b7a925
1,400
PASSED
import java.util.Scanner; public class Fixingtypos2 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); String str = s.next(); char ch[] = str.toCharArray(); StringBuilder sb = new StringBuilder(); char cc = ch[0]; sb.append(ch[0]); int t...
Java
31d803d886c47fe681bdcfbe6c74f090
b92010f374ba773a5caba0f5f39f6845
1,400
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; public class Main { public String fix(String word) { if (word.length() < 3) { return word; } StringBuilder res = new StringBuilder(word.length()); Li...
Java
31d803d886c47fe681bdcfbe6c74f090
0ebc486d18d0bd7e39e66ac2c6e64312
1,400
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author a.bogdanov */ public class FixTypos { public static void main(String[] args) throws IOException { ...
Java
31d803d886c47fe681bdcfbe6c74f090
a7a39176e25e2389f5b04fd04bfb96ce
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i=(a); i<(b); i++) #define per(i, a, b) for(int i=(b)-1; i>=(a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a) cout << #a...
C++
5068d7f424bc46b6ec43f69b295bc4a8
94f49fd301f09d8b6c1f8fc3090c671f
3,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i=(a); i<(b); i++) #define per(i, a, b) for(int i=(b)-1; i>=(a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a) cout << #a...
C++
5068d7f424bc46b6ec43f69b295bc4a8
08cc444b4f284f238cea486019442cab
3,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i=(a); i<(b); i++) #define per(i, a, b) for(int i=(b)-1; i>=(a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a) cout << #a...
C++
5068d7f424bc46b6ec43f69b295bc4a8
c0b97ab74c259408e2e71d83303e6819
3,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i=(a); i<(b); i++) #define per(i, a, b) for(int i=(b)-1; i>=(a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a) cout << #a...
C++
5068d7f424bc46b6ec43f69b295bc4a8
60517cf3bdb7a8a0c4b6a8a4a581bc1f
3,200
PASSED
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <cmath> #define pi acos(-1.0) using namespace std; const int maxn=20010; typedef double db; struct cp { db x,y; cp() {} cp(db a,db b) {x=a,y=b;} cp operator + (const cp &a) const {return cp(x+a.x,y+a.y);} cp operator - (const cp...
C++
5068d7f424bc46b6ec43f69b295bc4a8
366b376473a8bad73269ccd555d55d5a
3,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef double db; const db pi = acos(-1), inf = 1e9; const int Mn = 105, T = 20050; const int N = 1 << 15 | 10; namespace { inline void read(int &x) { x = 0; char c = getchar(); for(; !isdigit(c); c = getchar()); for(; isdigit(c); c = getchar()) x = x * 10 +...
C++
5068d7f424bc46b6ec43f69b295bc4a8
8167dd2642aa0ebda76122bcc139d5ae
3,200
PASSED
#pragma GCC optimize(2) #include <bits/stdc++.h> using namespace std; typedef double db; const db pi = acos(-1), inf = 1e9; const int Mn = 105, T = 20050; const int N = 1 << 15 | 10; namespace { inline void read(int &x) { x = 0; char c = getchar(); for(; !isdigit(c); c = getchar()); for(; isdigit(c); c = ge...
C++
5068d7f424bc46b6ec43f69b295bc4a8
6ce1009f2f688c6fa222f4118f849bc3
3,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef double db; const db pi = acos(-1), inf = 1e9; const int Mn = 105, T = 20050; const int N = 1 << 15 | 10; namespace { inline void read(int &x) { x = 0; char c = getchar(); for(; !isdigit(c); c = getchar()); for(; isdigit(c); c = getchar()) x = x * 10 +...
C++
5068d7f424bc46b6ec43f69b295bc4a8
ce3a513a71e4d9dcb2e284d9e31020dd
3,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; inline int read() { int x = 0, f = 1; char c = getchar(); while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();} while (isdigit(c)) {x = x * 10 + c - '0', c = getchar();} return x * f; } const db pi = acos(-1); struct Comp...
C++
5068d7f424bc46b6ec43f69b295bc4a8
ffe3cca79d8f6b617fb8aec2364ac703
3,200
PASSED
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; struct Complex{ double r, i; Complex(){} Complex(double r, double i): r(r), i(i) {} }; typedef Complex E; inline E operator + (const E &a,const E &b){return E(a.r+b.r,a.i+b.i);} inline E operator - (const ...
C++
5068d7f424bc46b6ec43f69b295bc4a8
e49b5df3d27e47da66f9a994d376c6df
3,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Locale; import java.util.StringTokenizer; public class Main { public static void main(String[] args)...
Java
14570079152bbf6c439bfceef9816f7e
37da96b044ad6fcc2f87b37b5ff4b692
1,400
PASSED
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
14570079152bbf6c439bfceef9816f7e
943112566a2f2364db95e26d78d0c90b
1,400
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Out...
Java
14570079152bbf6c439bfceef9816f7e
1e918cb8e3932698a3bc4798929955da
1,400
PASSED
import java.io.PrintStream; import java.util.Scanner; /** * Created by Poison. */ public class Football { private static int teamsCount; private static int winsCount; private static final String SPACE = " "; private static final char ENDL = '\n'; public static void main(String[] args) { ...
Java
14570079152bbf6c439bfceef9816f7e
6bd6751c2a2eba3bb545342c9cfe6b6c
1,400
PASSED
import java.io.IOException; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the to...
Java
14570079152bbf6c439bfceef9816f7e
bfc51239ca9715fc6e0c7d215fd01cfe
1,400
PASSED
import java.io.*; import java.util.*; public class Main implements Runnable { public void _main() throws IOException { int n = nextInt(); int k = nextInt(); if (k > (n - 1) / 2) { out.println(-1); return; } out.println(n * k); for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) { int a...
Java
14570079152bbf6c439bfceef9816f7e
57e50d633c492568307e160e53269d5f
1,400
PASSED
import java.io.*; import java.util.*; public class GPL implements Runnable { public static void main(String[] args) { new Thread(new GPL()).run(); } BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws IOException { while (in == null || !in....
Java
14570079152bbf6c439bfceef9816f7e
5bfa5c6445232d684b0ed33d648c29a3
1,400
PASSED
//package rcc.warmup; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class A { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), K =...
Java
14570079152bbf6c439bfceef9816f7e
9db1561215a4519d7a71147cbc68a307
1,400
PASSED
import java.io.*; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList;...
Java
14570079152bbf6c439bfceef9816f7e
d16c328f1b1ffbfb2a5a25dab0bb0499
1,400
PASSED
//package main; import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { FastScanner scan; PrintWriter out; BufferedReader in; static BigInteger fact(BigInteger b) { BigInteger p =BigInteger.ONE; for (BigInteger i = BigInteger.ONE; i.compareTo(b.add(Big...
Java
14570079152bbf6c439bfceef9816f7e
2bed15c1ea2643e27dcdaf4bc566591b
1,400
PASSED
#!/bin/python3 t = int(input()) while t > 0: n = int(input()) array = list(map(int, input().split())) if n == 1: # 1 is 00000001 in binary , and 2 is 00000010 # for future reference 1 bitwise AND 2 is false # that's a fancy way to say array[0] == 1 if array[0] & 1: ...
Python
3fe51d644621962fe41c32a2d90c7f94
e7b30d6bee837673d8ee0380a69e7e02
800
PASSED
for _ in range(int(input())): arr = [list(map(int, input().split())) for i in "aa"][1] ok = False for i in range(len(arr)): if arr[i] % 2 == 0: print(*(1, i + 1), sep='\n') ok = True break if not ok: if len(arr) % 2 == 0: print('{}\n{}'.f...
Python
3fe51d644621962fe41c32a2d90c7f94
a54bfc467707fdd81940bff1fd0cf896
800
PASSED
for i in range(int(input())): t=int(input()) l=[int(x) for x in input().split()] n=[] ans=0 s="" count1=0 for j in range(t): ...
Python
3fe51d644621962fe41c32a2d90c7f94
71eee98de2577d67064dadfdf1161c60
800
PASSED
def main(): n = int(input()) nums = [int(s)&1 for s in input().split()] ans = [] for i, num in enumerate(nums): if num == 0: print(1) print(i+1) return ans.append(i+1) if len(ans) == 2: print(2) print(' '.join([str(a) fo...
Python
3fe51d644621962fe41c32a2d90c7f94
fab01af89b4a8690ade71de4a2ce95dc
800
PASSED
t = int(input()) output = [] for sample in range(t): n = int(input()) a = input().split(" ") for i in range(n): a[i] = int(a[i]) if a[0] % 2 == 0: output.append((1, [1])) else: if n == 1: output.append((-1, [])) else: if a[1] % 2 == 0: ...
Python
3fe51d644621962fe41c32a2d90c7f94
b934a37d3c46afba87d9a56ad8a0ea89
800
PASSED
t=int(input()) while t: n=int(input()) l=list(map(int,input().split())) ind=-1 flag=False for i in range(n): if l[i]%2==0: flag=True ind=i break if flag: print("1") print(ind+1) else: if n>1: print("2") ...
Python
3fe51d644621962fe41c32a2d90c7f94
0cfba483d7541512e107a4de5313d155
800
PASSED
""" """ def int_as_array(num): return list(map(int, [y for y in str(num)])) def array_as_int(arr): return int(''.join(map(str, arr))) def read_int(): return int(input()) def read_int_array(): return list(map(int, input().split(' '))) def int_array_to_string(arr, sep=' '): return sep.join(map(str, arr)) def ...
Python
3fe51d644621962fe41c32a2d90c7f94
db7cfe048986d347ca6bae88d1c049a6
800
PASSED
t=int(input()) while(t!=0): a=int(input()) b=list(map(int,input().split(" "))) d=[] c=0 for i in range(0,a): for j in range(i,a): if(sum(b[i:j+1])%2==0): c=abs(i-j)+1 d.append([i,j]) break else: continue ...
Python
3fe51d644621962fe41c32a2d90c7f94
980be1dca8a411bb188a5618b3e0bc4d
800
PASSED
t=int(input()) while(t!=0): a=int(input()) b=list(map(int,input().split(" "))) d=[] c=0 for i in range(0,a): for j in range(i,a): if(sum(b[i:j+1])%2==0): c=abs(i-j)+1 d.append([i,j]) break else: continue ...
Python
3fe51d644621962fe41c32a2d90c7f94
58f79f2b80401323f9b4c9640358f57c
800
PASSED
t=int(input()) while(t!=0): n=int(input()) b=list(map(int,input().split(" "))) d=[] c=0 for i in range(0,n): for j in range(i,n): if(sum(b[i:j+1])%2==0): c=abs(i-j)+1 d.append([i,j]) break else: continue ...
Python
3fe51d644621962fe41c32a2d90c7f94
f5199554287d9566d1ba6770b3eec49c
800
PASSED
#include <cstdio> #include <cassert> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <climits> #include <cctype> #include <utility> #include <queue> #include <cmath> #include <complex> using namespace std; typedef ...
C++
42b652e236257b72cd9e96b5038b4435
cb7d5b815046cc8d591f6cd57ba81b03
2,900
PASSED
#include <bits/stdc++.h> #define FOR(i, l, r) for (int i = int(l); i < int(r); i++) #define FORE(i, l, r) for (int i = int(l); i <= int(r); i++) #define STRUCT5(NAME, v1, v2, v3, v4, v5, name) typedef struct NAME \ { \ int v1, v2, v3, v4, v5; \ NAME(int v1 = 0, int v2 = 0, int v3 = 0, ...
C++
42b652e236257b72cd9e96b5038b4435
aa6c038c882569c7d88a10b226e497a1
2,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct dat{ ll x, y, z; dat(ll x = 0, ll y = 0, ll z = 0):x(x), y(y), z(z){} }; #define N 101000 dat A[N]; #define inf 3000000000000000000ll ll mn[10], mx[10], st[10], en[10], g[10], st1[10], en1[10]; ll f[N][4]; ll X, Y, Z; bool doit(ll x) { ...
C++
42b652e236257b72cd9e96b5038b4435
5dccb37add8627c1ddd081971909416f
2,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct dat{ ll x, y, z; dat(ll x = 0, ll y = 0, ll z = 0):x(x), y(y), z(z){} }; #define N 101000 dat A[N]; #define inf 3000000000000000000ll ll mn[10], mx[10], st[10], en[10], g[10], st1[10], en1[10]; ll f[N][4]; ll X, Y, Z; bool doit(ll x) { ...
C++
42b652e236257b72cd9e96b5038b4435
5d31ef2a05260891c946d65f912a2b4c
2,900
PASSED
#include<cstdio> #include<cmath> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> using namespace std; int n; long long x[100000+10],y[100000+10],z[100000+10]; long long inf=(1e18)+10ll; long long ansx,ansy,ansz; bool check1(long long a1,long long a2,long long b1,long long b2,long long c1,long...
C++
42b652e236257b72cd9e96b5038b4435
cb534706380fbadab11b998f9d0c2ad5
2,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; #define maxn 100010 const LL INF = (1e18)+514; int n = 0; LL M = 0; LL d[maxn][3]; inline LL Abs(LL x) { if(x < 0) return -x; else return x; } inline LL Dist(LL x,LL y,LL z) { LL max_dist = 0,tmp = 0; for(int i = 1;i <= n;++ i) { tmp = Abs(x-d[i]...
C++
42b652e236257b72cd9e96b5038b4435
7b845231957304263aa06ba3a474088b
2,900
PASSED
#include <cstdio> #include <algorithm> using namespace std; long long d1[120000],d2[120000],d3[120000],d4[120000],x[120000],y[120000],z[120000]; long long l,r,mid,l1,r1,l2,r2,l3,r3,l4,r4,tl1,tr1,tl2,tr2,tl3,tr3,tl4,tr4,xx,yy,zz,kx,ky,kz,lx,ly,lz; int h,i,n,t; inline long long ceil_2(long long x) { if (x<0) return x...
C++
42b652e236257b72cd9e96b5038b4435
8ee2f117deab56ee40b21f43e838a428
2,900
PASSED
#include <bits/stdc++.h> #define fi(a,b,c) for(int a=b; a<=c; a++) #define fd(a,b,c) for(int a=b; a>=c; a--) #define fii(a,b,c) for(int a=b; a<c; a++) #define pb push_back #define mp make_pair #define ft first #define sc second #define reset(a,b) memset(a,b, sizeof a) using namespace std; typedef int64_t ll; typedef...
C++
42b652e236257b72cd9e96b5038b4435
3351f419dd81a1ffdebd9b35ca1d51de
2,900
PASSED
# include<stdio.h> # include<string.h> # include<vector> # include<algorithm> using namespace std; const int maxn=100010; typedef long long LL; LL INF=3*(1e+18)+6; int n; LL px[maxn],py[maxn],pz[maxn]; LL ansA,ansB,ansC; bool check(LL r){ LL A,B,C; LL lA=-INF,rA=INF,lB=-INF,rB=INF,lC=-INF,rC=INF,lS=-INF,rS=I...
C++
42b652e236257b72cd9e96b5038b4435
537bea1f836e6fd0cc650f554dc6901b
2,900
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=100000+10; struct point { ll x,y,z; }a[maxn]; ll mx1,mx2,mx3,mx4,mx5,mx6,mx7,mx8,ans; int n,m1,m2,m3,m4,m5,m6,m7,m8; inline ll Abs(ll x) { if(x<0) return -x; else return x; } inline ll max(ll x,ll y) { if(x<y) return y; else retu...
C++
42b652e236257b72cd9e96b5038b4435
fd7dcd481209f925e1778eb0a9f71178
2,900
PASSED
#include<algorithm> #include<iomanip> #include<iostream> #include<sstream> #include<cstring> #include<cstdlib> #include<climits> #include<fstream> #include<cctype> #include<cstdio> #include<string> #include<vector> #include<queue> #include<stack> #include<cmath> #include<map> #include<set> using namespace std; #defin...
C++
f80dc7b12479551b857408f4c29c276b
ad0026456d380395a3fe2b6ff1700633
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; LL p[100002]; LL Q=1e9 + 9; LL find_set(LL x) { if (x == p[x]){ return x; } return p[x] = find_set(p[x]); } int main() { LL n, m; cin>>n>>m; for (LL i=1;i<=n;i++){ p[i] = i; } LL ans = 1; for (LL i=0;...
C++
f80dc7b12479551b857408f4c29c276b
9f8cf8275af47e17de8ecd751b025c12
2,300
PASSED
#include <iostream> #include <fstream> #include <sstream> #include <iomanip> #include <string> #include <algorithm> #include <cmath> #include <time.h> #include <vector> #include <stack> #include <map> #include <set> #include <queue> #include <assert.h> #include <cstdio> #include <deque> using namespace std; typedef l...
C++
f80dc7b12479551b857408f4c29c276b
4316c7b49dbc12e0f70abfcf5bacef98
2,300
PASSED
#include <cstdio> #include <cstring> #include <cmath> #include <vector> #include <algorithm> #include <iostream> #include <set> using namespace std; const int N = 100100; const int mod = 1000000009; int f[N]; int find(int x){ return x == f[x] ? x : f[x] = find(f[x]); } bool Union(int x, int y){ int fx = find(x), fy = ...
C++
f80dc7b12479551b857408f4c29c276b
8ccffb9d498879bd4892e570b801330b
2,300
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=100005; const int mod=1000000009; int n,m; int pa[maxn]; int findset(int x) { return x==pa[x]?x:pa[x]=findset(pa[x]); } bool Union(int x,int y) { int fx=findset(x),fy=findset(y); if(fx==fy)return false; pa[fx]=fy; return true; } int main() { while(cin...
C++
f80dc7b12479551b857408f4c29c276b
67ad2261518673cc6e14c6af06115e5e
2,300
PASSED
#include <bits/stdc++.h> using namespace std; const int mod = 1000000009; const int maxn = 1e5 + 5; int n, m; struct UF { int pa[maxn]; int n; void init(int n) { for(int i = 0; i < n; ++i) pa[i] = i; } int find(int u) { return (u == pa[u] ? u : pa[u] = find(pa[u])); } void ...
C++
f80dc7b12479551b857408f4c29c276b
d0fc9f8bd082ed59db1a0397d9b82a72
2,300
PASSED
#include <iostream> #include <stdlib.h> using namespace std; int N, M; int dsu[100000], dsu_cnt; void init_dsu(int N) { for (int i = 0; i < N; i++) dsu[i] = i; dsu_cnt = N; } int get_dsu(int v) { if (dsu[v] == v) return v; return (dsu[v] = get_dsu(dsu[v])); } int add_dsu(int v1, int v2) { ...
C++
f80dc7b12479551b857408f4c29c276b
8588a27fa25c3c2a1e0bc0ba2794a405
2,300
PASSED
#include <iostream> #include <stdlib.h> using namespace std; int N, M; int dsu[100000], dsu_cnt; void init_dsu(int N) { for (int i = 0; i < N; i++) dsu[i] = i; dsu_cnt = N; } int get_dsu(int v) { if (dsu[v] == v) return v; return (dsu[v] = get_dsu(dsu[v])); } int add_dsu(int v1, int v2) { ...
C++
f80dc7b12479551b857408f4c29c276b
00ca60deda89bf3fe9818b7b215af3cc
2,300
PASSED
#define _CRT_SECURE_NO_WARNINGS #pragma comment (linker, "/STACK:16777216") #include <iostream> #include <algorithm> #include <numeric> #include <vector> #include <queue> #include <list> #include <stack> #include <string> #include <fstream> #include <math.h> #include <limits> #include <set> #include <map> #include <sst...
C++
f80dc7b12479551b857408f4c29c276b
b181cac37088651bbe4b56d01fc02f8e
2,300
PASSED
#define _CRT_SECURE_NO_WARNINGS #pragma comment (linker, "/STACK:16777216") #include <iostream> #include <algorithm> #include <numeric> #include <vector> #include <queue> #include <list> #include <stack> #include <string> #include <fstream> #include <math.h> #include <limits> #include <set> #include <map> #include <sst...
C++
f80dc7b12479551b857408f4c29c276b
c23a39e0d89666567e78b5cff485cf5f
2,300
PASSED
#include <bits/stdc++.h> using namespace std; const int N=1<<20|5, mod=998244353; inline int fp(int a, int b){ int tot=1; for(; b; a=1ll*a*a%mod, b>>=1) if(b&1) tot=1ll*tot*a%mod; return tot; } const int G=3, invG=fp(G, mod-2), lim=1<<20, inv_lim=fp(lim, mod-2); int trs[N], n, m, Q, cnt[N], s1[N], s2[N], fac[N], ...
C++
b61ec1b0599c8be430b4424a08beacfb
38bc094b2213bdf9c925de8dd5a463e8
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int N=1<<20|5, mod=998244353; inline int fp(int a, int b){ int tot=1; for(; b; a=1ll*a*a%mod, b>>=1) if(b&1) tot=1ll*tot*a%mod; return tot; } const int G=3, invG=fp(G, mod-2), lim=1<<20, inv_lim=fp(lim, mod-2); int trs[N], n, m, Q, cnt[N], s1[N], s2[N], fac[N], ...
C++
b61ec1b0599c8be430b4424a08beacfb
ec1f65f311fa479b95680af1cbf4a6b0
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int mod=998244353; const int G=3; const int lim=1<<20,lg=20; int n,m,cnt[lim+10],s1[lim+10],s2[lim+10],f[lim+10],g[lim+10],res[lim+10],invlim,fac[lim+10],invfac[lim+10],rev[lim+10]; int ksm(int x,int y){ int rt=1; for(;y;x=(1ll*x*x)%mod,y>>=1)if(y&1)rt=(1ll*rt*x)%mod...
C++
b61ec1b0599c8be430b4424a08beacfb
d253379617a3a9c3415135bfa99eec4d
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=3e5+10; const int P=998244353,G=3; int rev[maxn<<3]; int kuai(int a,int b) { int res=1; while(b) { if(b%2==1)res=1ll*res*a%P; a=1ll*a*a%P; b=b/2; } return res; } void NTT(int *a,int n,int opt) { for(int i=1;i<n;i++) if(i<rev[i])swap(a[i]...
C++
b61ec1b0599c8be430b4424a08beacfb
d923e35d551fb51fb20ed7930db83bf9
2,500
PASSED
#include <iostream> #include <cstdio> using namespace std; const int maxn = 3e5 + 50,maxm = 5.3e5 + 50,mod = 998244353,g = 3; int n,m,Q,cnt1,cnt2,a[maxn],b[10],q[maxn],ans[maxn],cnt[maxn],fact[maxn],inv[maxn],rev[maxm],F[maxm],G[maxm]; int read(){ int x = 0; char c = getchar(); while(c < '0' || c > '9') c = getchar(...
C++
b61ec1b0599c8be430b4424a08beacfb
42df20546cc875b57729038a32ce94cb
2,500
PASSED
#include<ctype.h> #include<algorithm> #include<iostream> #include<iomanip> #include<cmath> #include<cstring> #include<cstdio> #include<cstdlib> #include<queue> #include<stack> #include<ctime> #include<set> #include<map> #include<bitset> #include<vector> #include<climits> #include<complex> //#define double long double /...
C++
b61ec1b0599c8be430b4424a08beacfb
a78a64de1555898c3070486c8cfdc447
2,500
PASSED