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<iostream> #include<vector> //#include<stdio.h> using namespace std; bool sim(vector<vector<int> > a) { bool res = true; for (int j = 0; j < a.size() && res; j++) for (int q = 0; q < a.size(); q++) if (res) res = (a[q][j] == a[j][q]); else break; return res; } int main() { int t; cin >> t; while (t...
C++
f46f6fa28d0a7023da3bad0d222ce393
8bba2a5d2904f8bc2c97e4e7437e43f6
900
PASSED
#include<iostream> using namespace std; int main(){ int i,j,k,x,t,n,m,a[2][2]; cin>>t; for(i=0;i<t;i++){ char *b="NO"; cin>>n>>m; for(x=0;x<n;x++){ for(j=0;j<2;j++) { for(k=0;k<2;k++) cin>>a[j][k]; // cout<<"input"; } // cout<<"ff"; ...
C++
f46f6fa28d0a7023da3bad0d222ce393
4f5fd5e8941121512cf32e272b3c384a
900
PASSED
#include <iostream> #include <algorithm> using namespace std; #define N 100000 struct del{ int x, y; }; bool comp(del l, del r) { if(l.y*r.x == l.x*r.y) return l.y < r.y; return l.y*r.x < l.x*r.y; } del v[N]; int main() { int n; int x0,y0; while(cin>>n>>x0>>y0) { for(int i=0;i<n;++i) { ...
C++
8d2845c33645ac45d4d37f9493b0c380
e1a3abdd8aac36ae3e258022f0b2ad62
1,400
PASSED
#include <iostream> #include <set> #include <map> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main(int argc, char const *argv[]) { set<pair<int, int> > s; int n, x, y, r, c; cin >> n >> x >> y; while(n--) { cin >> r >> c; r -= x; c -= y; ...
C++
8d2845c33645ac45d4d37f9493b0c380
8e966dc7ec06a6b8398d2970c71ac28d
1,400
PASSED
#include <iostream> #include <set> #include <map> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main(int argc, char const *argv[]) { set<pair<int, int> > s; int n, x, y, r, c; cin >> n >> x >> y; while(n--) { cin >> r >> c; r -= x; c -= y; ...
C++
8d2845c33645ac45d4d37f9493b0c380
cea92c5153ec05cfdc92be792418a98a
1,400
PASSED
#include <iostream> #include <set> #include <map> #include <cmath> using namespace std; const int maxn = 999999; int main(int argc, char const *argv[]) { double n, cx, cy, x, y; set<double> slopes; cin >> n >> cx >> cy; while (n--) { pair<int, int> p; cin >> p.first >> p.second; ...
C++
8d2845c33645ac45d4d37f9493b0c380
e50cd0bc36d7c21bbf04b017042d710f
1,400
PASSED
#include <iostream> using namespace std; void pash(int* x, int* y){ int b=1, t1=0, t2=0; if(*x<0){ *x=-*x; t1=-1; } if(*y<0){ *y=-*y; t2=-1; } if(*x!=0&&*y!=0){ for(int k=1; k<=*x && k<=*y; k++){ if(*x%k==0&&*y%k==0) b=k; ...
C++
8d2845c33645ac45d4d37f9493b0c380
3c81c495579a9aea7aaa620c83f6a794
1,400
PASSED
#include<bits/stdc++.h> using namespace std; const int maxN = 100 * 1000 + 5; main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, x, y; cin >> n >> x >> y; vector< pair<int, int> > v; for(int i = 0; i < n; i ++) { int a, b; cin >> a >> b; int dy = y - b; int dx = x - a; in...
C++
8d2845c33645ac45d4d37f9493b0c380
9be76764ffc50b365b1704f5ca3fd4ed
1,400
PASSED
#include <iostream> using namespace std; double a[101000][3]; int main() { int n,x0,y0,m=1; cin>>n>>x0>>y0; for(int i=0;i<n;i++) { int x2,y2; cin>>x2>>y2; a[i][0]=x2-x0; a[i][1]=y2-y0; /* if(a[i][0]==0) ...
C++
8d2845c33645ac45d4d37f9493b0c380
1f64d8ca28b8fd364c803df91ea415a5
1,400
PASSED
#include<bits/stdc++.h> #include <iostream> #include<cstdio> #include<string> #include<cstring> #include<vector> #include<algorithm> #include<set> #include<math.h> #include<map> #include<stack> #include<sstream> #include<queue> #include<list> #include<iomanip> #include<bitset> #include<limits.h> #define INF -1 #define...
C++
8d2845c33645ac45d4d37f9493b0c380
e437e8c07bf271742a5401b63131d941
1,400
PASSED
#include <bits/stdc++.h> #define fo(i,x,y) for (int i = x; i < y; i++) #define fd(i,x,y) for(int i = x; i>= y; i--) #define ll long long #define clr(A,x) memset(A, x, sizeof A) #define pb push_back #define mod 1000000007 #define debug(x) cout <<#x << " = " << x << endl using namespace std; string toString(int h) { ...
C++
8d2845c33645ac45d4d37f9493b0c380
6a78cd628419a3e2554e168206c81bf7
1,400
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<cstdlib> using namespace std; const double eps=0.0000000001; int main() { int i,ff,j,n,x0,y0; int x[1200],y[1200]; double angle[1200]; while (cin>>n>>x0>>y0) { memset(angle,0,sizeof angle); ...
C++
8d2845c33645ac45d4d37f9493b0c380
586e8f6005882d45a6d634baa0fcba51
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int n, m, num; vector<int> a, gi; vector<pair<int, int> > d; int bpow(ll x, ll p, ll mod) { ll res = 1; while (p) { if (p % 2) { res = (res * x) % mod; --p; } else { x = (x * x) % mod;...
C++
8e8437c62ea72f01f7e921e99dca931f
ed8ede21f2b6afd4042ebd014aedbffa
2,600
PASSED
#include <iostream> #include <cstdio> #include <cctype> #include <algorithm> #include <cstring> #include <string> #include <cmath> #include <vector> #include <set> #include <stack> #include <sstream> #include <queue> #include <map> #include <functional> #include <bitset> using namespace std; #define pb push_back #defi...
C++
8e8437c62ea72f01f7e921e99dca931f
c2cf23ca698efdc52d38d8875af8f2ab
2,600
PASSED
#include<bits/stdc++.h> #define FOR(i,a,b) for(int i = (a);i<=(b);i++) #define ROF(i,a,b) for(int i = (a);i>=(b);i--) #define MST(a,x) memset(a,x,sizeof(a)) #define ll long long #define PB push_back #define PH push #define MP make_pair #define FT first #define SD second #define N 500005 #define M 10005 #define INF 1000...
C++
8e8437c62ea72f01f7e921e99dca931f
8043ef86566d11c50a0eb82c498ab037
2,600
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<algorithm> #include<queue> #include<stack> #include<map> #include<ctime> #define up(i,x,y) for(int i = x;i <= y;i ++) #define down(i,x,y) for(int i = x;i >= y;i --) #define mem(a,b) memset((a),(b),sizeof(a)) #define mod(x) ...
C++
8e8437c62ea72f01f7e921e99dca931f
9d4e79dae86566b88a49de7d944a6732
2,600
PASSED
#include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<iostream> #include<vector> #include<map> using namespace std; const int maxn=1000005; int n,m,G; int a[maxn],x[maxn],y[maxn],z[maxn],t[maxn]; inline int ra(){return (rand()<<15^rand())&(~0u>>1);} inline int gcd(int a,int b){return b?gcd(b...
C++
8e8437c62ea72f01f7e921e99dca931f
8d615a6b68ca99a73da146ffdb7bf8aa
2,600
PASSED
#include<cstring> #include<iostream> #include<algorithm> #include<cstdio> #include<queue> #include<cmath> #include<map> #define rep(i,l,r) for (int i=l;i<=r;i++) #define down(i,l,r) for (int i=l;i>=r;i--) #define clr(x,y) memset(x,y,sizeof(x)) #define ll long long #define maxn 200500 #define eps 1e-10 #define inf 21474...
C++
8e8437c62ea72f01f7e921e99dca931f
1b89d12bc07994578be98af1cc52f93f
2,600
PASSED
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> using namespace std; typedef long long ll; int a,t,p; ll l,r; int pw(int a,ll b,int p) { int s=1,q=a%p; while (b) { if (b%2) s=(ll(s)*q)%p; b/=2; if (b) q=(l...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
1475894a008272eace795195d6a884e4
2,600
PASSED
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cctype> #include <cmath> #include <queue> #include <stack> #include <set...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
59a3255078f9ebede70c54c5d1d8d71c
2,600
PASSED
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cctype> #include <cmath> #include <queue> #include <stack> #include <set...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
93d072c6e4724631043b72dd49cca209
2,600
PASSED
#include <iostream> using namespace std; #define endl '\n' typedef long long ll; int pw(int a,ll b,int p) { int s=1,q=a%p; while (b) { if (b%2) s=(ll(s)*q)%p; b/=2; if (b) q=(ll(q)*q)%p; } return s; } int divide(int a,int b,int p) { if (b<0) b+=p; int t=pw(b,p-2,p); ll res=ll(a)*t; res%=p; retur...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
017d624952b1e46e6675388bed7a8b0a
2,600
PASSED
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> using namespace std; typedef long long ll; int pw(int a,ll b,int p) { int s=1,q=a%p; while (b) { if (b%2) s=(ll(s)*q)%p; b/=2; if (b) q=(ll(q)*q)%p; } retu...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
7c4fff22c7d538ecf9a709631fa97729
2,600
PASSED
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cctype> #include <cmath> #include <queue> #include <stack> #include <set...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
eeb93f107b0a48dcb7f4583f92777881
2,600
PASSED
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cctype> #include <cmath> #include <queue> #include <stack> #include <set...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
299f8254344b035627402f11f7762e42
2,600
PASSED
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cctype> #include <cmath> #include <queue> #include <stack> #include <set...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
58f7901be2d168591b8cbf1fb6f418e0
2,600
PASSED
#include <algorithm> #include <cstring> #include <cstdlib> #include <cstdio> #define int64 long long #define For(i,x,y) for (i=x;i<=y;i++) using namespace std; int i,j,n,m,T; int64 k,l,r,p,Gcd,an; inline int64 pow(int64 x,int64 y,int64 mo) { x%=mo; if (!y) return 1; if (!x) return 0; int64 an=1; for (;y;y>>=1) { ...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
86ba9d4b4ddf781787ed3cb455f02773
2,600
PASSED
/*..................... Author : PTY Time : 12/11/26 .....................*/ #include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <iostream> #include <sstream> #include <set> #include <queue> #include <stack> #includ...
C++
1c0dbbcfbf5e9ded42e86660272dc8e3
c04f6790beb9562a1360e7a698cd089b
2,600
PASSED
#include <bits/stdc++.h> #define ii pair <int, int> #define x first #define y second #define db(x) cerr << #x << " = " << x << endl; #define _ << " _ " << using namespace std; inline void read(int &x){register int c = getchar();x = 0; int neg = 0;for (;((c<48 || c>57) && c != '-') ;c = getchar());if(c=='-') {neg=1;c=...
C++
6b6231465a34d1585c356280802b2a88
03ee08bec4bce48fef107165712d692c
2,400
PASSED
#include <bits/stdc++.h> using namespace std; int S[202020]; int N; int basis[20]; vector<int> B; int X = 0; void printAns(int n) { if(!n) { printf("%d ", X); return; } printAns(n - 1); X ^= B[n - 1]; printAns(n - 1); } int main() { scanf("%d", &N); for(int i = 1; i <= N; i++) scanf("%d", &S[i]); for(int x =...
C++
6b6231465a34d1585c356280802b2a88
e19c3688399a82be0068b205c010fdb6
2,400
PASSED
/*{{{*/ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<string> #include<iostream> #include<sstream> #include<set> #include<map> #include<queue> #include<bitset> #include<vector> #include<limits.h> #include<assert.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).be...
C++
6b6231465a34d1585c356280802b2a88
94248581ade6c01dcdb20fd8bb660415
2,400
PASSED
#include <bits/stdc++.h> using namespace std; void add(int d, vector <int>& basis, vector <int>& choice) { int dd = d; for (int x : basis) d = min(d, d ^ x); if (d == 0) return; basis.push_back(d); choice.push_back(dd); for (int i = basis.size() - 1; i > 0; --i) { if (b...
C++
6b6231465a34d1585c356280802b2a88
08a4e9b9262f66e26a800a98b0af5a7e
2,400
PASSED
#ifdef stderr_path #define LOCAL #define _GLIBCXX_DEBUG #endif #pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <complex> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #in...
C++
6b6231465a34d1585c356280802b2a88
9c1a15b95ccd8518d921409d408e472d
2,400
PASSED
#ifdef stderr_path #define LOCAL #define _GLIBCXX_DEBUG #endif #pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <complex> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #in...
C++
6b6231465a34d1585c356280802b2a88
293a39d1ca0bbec1609aa6bb01264622
2,400
PASSED
#ifdef stderr_path #define LOCAL #define _GLIBCXX_DEBUG #endif #pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <complex> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #in...
C++
6b6231465a34d1585c356280802b2a88
33fb0143a89e2dfcfb0ce86a22e577f6
2,400
PASSED
#ifdef stderr_path #define LOCAL #define _GLIBCXX_DEBUG #endif #pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <complex> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #in...
C++
6b6231465a34d1585c356280802b2a88
62cf04967c62ba4272ff98ae363fe56d
2,400
PASSED
#include <cstdio> #include <algorithm> #include <set> #include <queue> #include <map> #include <vector> #include <cstdlib> using namespace std; typedef long long ll; #define all(V) V.begin(), V.end() void solve(int n, vector<int>&ret) { if (n == 1) { ret.push_back(0); ret.push_back(1); } else { solve(...
C++
6b6231465a34d1585c356280802b2a88
e33d8e0529758287d32c318dd13441df
2,400
PASSED
// Solution from : https://codeforces.com/blog/entry/66943 #include <bits/stdc++.h> using namespace std; vector<int> basis, vec; // basis is a set of integers of size x so that // each subset of this basis when xored creates // numbers 0.1.2....2^x-1 // notice the add(z) calling from main() void add(int val) { i...
C++
6b6231465a34d1585c356280802b2a88
048972dc5b93b300dd8190707bc6a2f7
2,400
PASSED
#include <bits/stdc++.h> #ifdef tester #include "stuff/prettyprint.hpp" #endif using namespace std; #define iosx ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20) #define hell 1000000007LL #define INF 100000000000000000LL #define hmap unordered_map #define hset unordered_set #define PQ priority_queue ...
C++
2a4c24341231cabad6021697f15d953a
98fb24715a7f9894c11a5266d1b93a43
1,600
PASSED
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define sc(a) scanf("%d", &a)...
C++
2a4c24341231cabad6021697f15d953a
f3d572ea51a41fd77fa595ca86d7e198
1,600
PASSED
#include <bits/stdc++.h> // PLEASE using namespace std; typedef long long ll; typedef pair <int, int> pp; #define MAXN 300005 #define MAXM 1005 #define MAXP 22 #define INF 2000100000 #define A first #define B second #define MP make_pair #define PB push_back int N; int c[MAXN], d[MAXN]; int main() { cin >> N; ...
C++
2a4c24341231cabad6021697f15d953a
9a20a30596d7f8e5db669a16353df000
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define INT_MAX 1000000000 int main() { int t = 1; while(t--) { int n; cin>>n; vector<pair<int,int> >p(n); for(int i=0;i<n;i++) { cin>>p[i].first>>p[i].second; } int st = -INT_MAX, en = INT_MAX; while(st<en) { int mid =...
C++
2a4c24341231cabad6021697f15d953a
7c0c719633998fbec0edc394ef03f7b5
1,600
PASSED
/* _ _ ___ __ _ _ _ _ _ _ ___| | |/ _ \__ __/ _| | || | ___| |__ | | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ | |_| | __/ | | |_| |\ V V /| _| |__ _\__ \ | | | \__, |\___|_|_|\___/ \_/\_/ |_| |_| |_| |___/_| |_| |___/ */ #include <bit...
C++
2a4c24341231cabad6021697f15d953a
8534d76ded129f6e126f04692d49aab2
1,600
PASSED
/* _ _ ___ __ _ _ _ _ _ _ ___| | |/ _ \__ __/ _| | || | ___| |__ | | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ | |_| | __/ | | |_| |\ V V /| _| |__ _\__ \ | | | \__, |\___|_|_|\___/ \_/\_/ |_| |_| |_| |___/_| |_| |___/ */ #include <bit...
C++
2a4c24341231cabad6021697f15d953a
2da3d5218141aae040c1f696b6a27f20
1,600
PASSED
#include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <string> #include <cmath> #include <queue> #include <vector> #include <map> #include <set> using namespace std; #define INF 0x3f3f3f3f #define N 200010 typedef long long LL; int n, c[N], d[N]; int main() { cin >> n; int flag...
C++
2a4c24341231cabad6021697f15d953a
b0f2325dbcb1c44bca08e14846dd42e3
1,600
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <algorithm> using namespace std; const int N = 200001; int d[N], rat[N]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d%d", &rat[i], &d[i]); } long long l = -100000...
C++
2a4c24341231cabad6021697f15d953a
4893b94d59efe20fe28c912170240c4b
1,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef int ll; #define int long long #define ff first #define ss second #define d lld typedef pair<int,int>Pair; vector<int>ra,di; const int maxn=3e7+55; ll main() { // freopen("Task.in","r",stdin);freopen("Task.out","w",stdout); int n; cin>>n; int tot=0; for(int...
C++
2a4c24341231cabad6021697f15d953a
2da1dc24f2ecdb2fd00bbf1e83bbf1c7
1,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef int ll; #define int long long #define ff first #define ss second #define d lld typedef pair<int,int>Pair; vector<int>ra,di; const int maxn=3e7+55; ll main() { // freopen("Task.in","r",stdin);freopen("Task.out","w",stdout); int n; cin>>n; bool ck=1; int tot...
C++
2a4c24341231cabad6021697f15d953a
5ea2883f4bdd5037ad515f30f0e5fa91
1,600
PASSED
import java.util.*; import java.awt.geom.*; public class Main{ public static void main(String[] args){ Scanner ir=new Scanner(System.in); int n=ir.nextInt(); double X=ir.nextDouble(),Y=ir.nextDouble(); double[] x=new double[n],y=new double[n]; double ma=0.0,mi=1e18; for(int i=0;i<n;i++){ x[i]=ir.nextDo...
Java
1d547a38250c7780ddcf10674417d5ff
7b6dcbcc2b2a45a606180c60f4d908e5
1,900
PASSED
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; import java.awt.geom.*; import java.text.De...
Java
1d547a38250c7780ddcf10674417d5ff
f859550592c79ac32da1cc863f464b07
1,900
PASSED
import java.io.FileInputStream import java.io.IOException import java.io.InputStream import java.util.* open class DirectedGraph<T>(private val vertices: Set<T>, private val edges: MutableMap<T, MutableSet<T>>) { /** * used in cycle detection */ private val grey = HashSet<T>() private val black ...
Kotlin
12218097cf5c826d83ab11e5b049999f
5e9879e58802bd672274cf30d339ff50
1,600
PASSED
import java.util.* import kotlin.collections.ArrayList fun main(args: Array<String>) { val reader = Scanner(System.`in`) val n = reader.nextInt() val names = ArrayList<String>() for (i in 0..n) { names.add(reader.nextLine()) } val result = solve(names) ...
Kotlin
12218097cf5c826d83ab11e5b049999f
671185c83e6fae14509853906af0f975
1,600
PASSED
import java.util.* import kotlin.collections.ArrayList fun main(args: Array<String>) = with(Scanner(System.`in`)) { val n = nextInt() val names = mutableListOf<String>() nextLine() repeat(n) { names += nextLine() } System.out.println(solve(names)) } fun solve(names: List<String>): St...
Kotlin
12218097cf5c826d83ab11e5b049999f
411212a82199992945b51e889b75ded4
1,600
PASSED
#include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <vector> #include <deque> using namespace std; int n; string v[105]; bool vis[256]; vector<unsigned char> tsorted; vector<unsigned char> tgraph[256], graph[256]; void dfs(unsigned char c){ vis[c] = 1; for (unsigned i=0; i<gr...
C++
12218097cf5c826d83ab11e5b049999f
c099295dabccb8f9381046ba46c52d5c
1,600
PASSED
#include <cstdio> #include <iostream> #include <algorithm> #include <list> #include <climits> #include <map> using namespace std; struct node { char letter; list<node*> connections; node(char letter) { this->letter = letter; } string to_string(int level[]) { string result; for(node* n : connections) ...
C++
12218097cf5c826d83ab11e5b049999f
2cf5f973f79f0fbf685984106b635227
1,600
PASSED
#include <bits/stdc++.h> using namespace std; vector< vector<int> > g(30), gt(30); bool vis[30]; void dfs(int v, vector< vector<int> > &gr, vector<int> &ord){ vis[v]=true; for(auto &to: gr[v]){ if(!vis[to]) dfs(to, g, ord); } ord.push_back(v); } int col[30]; bool iscicle(int v){ ...
C++
12218097cf5c826d83ab11e5b049999f
28adf0f939e0ed96b55f2aecf45ab483
1,600
PASSED
#include <iostream> #include <fstream> #include <vector> #include <string> #include <map> #include <set> #include <algorithm> #include <iomanip> #include <deque> #include <list> #include <stack> #define REDIRECT_IO 0 using namespace std; typedef map<char, vector<char> > graph_t; bool mutateGraphWithWords(graph_t& g...
C++
12218097cf5c826d83ab11e5b049999f
f559c32d7b5d48769835ca6a05deaa81
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int vis1[30]={0}; string ans; vector<char> parent[30]; int arr[30]; int dep[30]; int tim=0; int fl=0; void dfs(char x) { if(fl==1) return; tim++; arr[x-97]=tim; vis1[x-97]=1; for(int i=0;i<parent[x-97].size();i++) { if(vis1[parent[x-97][i]-97]==0) { ...
C++
12218097cf5c826d83ab11e5b049999f
d8a9321466be3f9801c61d6d1a92b60f
1,600
PASSED
#include <bits/stdc++.h> #define MAX 111 using namespace std; int n; int adj[30][30]; int v[30]; char s[MAX][MAX]; bool flag = true; vector<char> ans; vector<int> q; void dfs_visit(int u){ v[u] = 1; for(int i = 0; i < 30; i++) if(adj[u][i]){ if(v[i] == 0) dfs_visit(i); else if(v[i] == 1) flag ...
C++
12218097cf5c826d83ab11e5b049999f
a547378731d55a330489ff0d2909ec93
1,600
PASSED
#include<iostream> #include<cstdio> #include<map> #include<vector> #include<map> #include<list> #include<cstring> #include<algorithm> #include<cmath> #include<set> #define FOREACH(it,c) for(auto it=(c).begin();it!=(c).end();++it) #define all(s) s.begin(),s.end() #define pb push_back #define mp make_pair #define sd...
C++
12218097cf5c826d83ab11e5b049999f
298be837418a539c1a9d0ce36637d55e
1,600
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <algorithm> #include <vector> #include <string.h> #include <limits.h> #include <cfloat> #include <stack> #include <queue> #include <list> #include <set> #include <map> #include <bitset> #include <cassert> #include <unordered_map> #includ...
C++
b64f1667a8fd29d1de81414259a626c9
918855536f789619b7b412dbb6fde929
1,900
PASSED
#include<bits/stdc++.h> using namespace std; double dp[60][60][60]; int main(){ int n,p; scanf("%d",&n); int i,a[10002],sum=0; for(i=1;i<=n;i++){ scanf("%d",&a[i]); sum+=a[i]; } scanf("%d",&p); if(sum<=p){ printf("%d\n",n ); return 0; } dp[0][0][0]=1; for(i=1;i<=n;i++) { for(int j=0;...
C++
b64f1667a8fd29d1de81414259a626c9
7ab416cef5e2c3396b1e27c2035206b5
1,900
PASSED
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #includ...
C++
b64f1667a8fd29d1de81414259a626c9
cca61cfe3a68a9bb424edb5a580b984d
1,900
PASSED
#pragma comment(linker, "/STACK:10000000000") #pragma GCC optimize("O3") #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <stdio.h> #include <iostream> #include <sstream> #include <iomanip> #include <math.h> #include <map> #include <chrono> #include <set> #include <stack> #include <vector> #include <time.h>...
C++
b64f1667a8fd29d1de81414259a626c9
a3693401f6a7e85c6d797a0a1a72881e
1,900
PASSED
#pragma comment(linker, "/STACK:10000000000") #pragma GCC optimize("O3") #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <stdio.h> #include <iostream> #include <sstream> #include <iomanip> #include <math.h> #include <map> #include <chrono> #include <set> #include <stack> #include <vector> #include <time.h>...
C++
b64f1667a8fd29d1de81414259a626c9
2a8372a4f3d8ac4c931f690331e0faa0
1,900
PASSED
/*Bismillahir Rahmanir Rahim*///{ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9; struct Dbg { static constexpr auto &os = cout; // replace by cerr in interactive. template<...
C++
b64f1667a8fd29d1de81414259a626c9
59e7022e575794ddd241e99108a1199e
1,900
PASSED
import java.util.*; public class D { static final int MAX = 50; static int [] a; static int n; static int p; static double [][] c; static { c = new double[MAX + 1][MAX + 1]; c[0][0] = 1; for (int i = 1; i <= MAX; ++i){ c[i][0] = 1; for (int j = 1; j <= i; ++j){ c[i][j] = c[i - 1][j] + c[i - 1][j ...
Java
b64f1667a8fd29d1de81414259a626c9
245d3387f5edc1f4eb249a133a9f7079
1,900
PASSED
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.math.BigDecimal; import java.util.Scanner; /** * * @author psergiol */ public class Main { /** * @param args the command line arguments */ public static Bi...
Java
b64f1667a8fd29d1de81414259a626c9
d03a1d9d9c8ab3b4d14df72292eecfa6
1,900
PASSED
import java.math.BigDecimal; import java.math.BigInteger; import java.util.Scanner; public class Main { public static int arr[] = new int[51]; public static int n, p, x, cnt; public static BigDecimal fact[] = new BigDecimal[51]; public static double mem[][][][] = new double[2][51][51][51]; public...
Java
b64f1667a8fd29d1de81414259a626c9
491a2e1f3c4a1dfaaeba2922fe9b773c
1,900
PASSED
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchEx...
Java
b64f1667a8fd29d1de81414259a626c9
40aea1beaca839f58fab7a299ab92ea1
1,900
PASSED
import java.util.Arrays; import java.util.Scanner; public class Main { private static Scanner scanner = new Scanner(System.in); private static int OO = (int) 1e9 + 9, r; private static int[] dx = {0, 0, 1, -1}; private static int[] dy = {1, -1, 0, 0}; private static int[] arr = new int[32]; pu...
Java
befd3b1b4afe19ff619c0b34ed1a4966
b4eacd3d555ac0105257a01d4be86b7c
1,200
PASSED
import java.util.*; public class Prob87{ public static long compute(Vector<Integer> v , int count,int k){ if(count == 0){ int min = v.elementAt(0); int temp = min; min =min * (int)Math.pow((double)-1,k); if(min != temp){ v.add(min); ...
Java
befd3b1b4afe19ff619c0b34ed1a4966
8ce56cdf8fe21f5b3315ae26d5fed12c
1,200
PASSED
import java.util.Arrays; import java.util.Scanner; public class practice{ static Scanner sc = new Scanner(System.in); public static int[] read(int n) { int[] arr= new int[n]; for(int i=0;i<n;++i) { arr[i]=sc.nextInt(); } return arr; } public static int function(int n,int k,int[] arr) { int ans=0...
Java
befd3b1b4afe19ff619c0b34ed1a4966
d8970969ad11caa70beaf2962b7bb437
1,200
PASSED
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); ...
Java
befd3b1b4afe19ff619c0b34ed1a4966
9b9a19cad54174f5ddee354311aa1332
1,200
PASSED
import java.util.*; public class romaAndChangingSigns1 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int a[]=new int[n]; long sum=0; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); } Arrays.sort(a); for(int i=0;i<n;i++) { i...
Java
befd3b1b4afe19ff619c0b34ed1a4966
a68e2c857c47dc15e2bd367913a60676
1,200
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; int n,k,d; const int maxn = 10e5+10; vector<pair<int,int> > edge[maxn]; bool visited[maxn]; vector<int> police; vector<int> ans; queue<int> q; int dist[maxn]; int par[maxn]; void bfs() { while(!q.empty()) { int s = q.front(); ...
C++
2ac69434cc4a1c78b537d365b895a27e
097a3a94e4283505363b2796bd61c09e
2,100
PASSED
#include<bits/stdc++.h> #include <ext/numeric> using namespace std; #define sc(a) scanf("%d",&a) #define sc2(a,b) scanf("%d%d",&a,&b) #define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c) #define sc4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d) #define scd(a) scanf("%lf",&a) #define scd2(a,b) scanf("%lf%lf",&a,&b) #define scd3(a,b,c) ...
C++
2ac69434cc4a1c78b537d365b895a27e
fd7960d183105ba5310f36acfb8ee0e7
2,100
PASSED
#include<bits/stdc++.h> #include <ext/numeric> using namespace std; #define sc(a) scanf("%d",&a) #define sc2(a,b) scanf("%d%d",&a,&b) #define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c) #define sc4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d) #define scd(a) scanf("%lf",&a) #define scd2(a,b) scanf("%lf%lf",&a,&b) #define scd3(a,b,c) ...
C++
2ac69434cc4a1c78b537d365b895a27e
68b3037649e7a96c269aa0c30a1492db
2,100
PASSED
/*My Template*/ #include<bits/stdc++.h> #define Inf 1LL<<61 #define NInf 1LL<<63 #define ll long long #define NewLine cout<<endl #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define REP(i,a,b)for(int i=a;i<b;i++) #define RREP(i,a,b)for(int i=a;i>b;i--) #define R(i,b) REP(i,0,b) #define r(b)REP(_,0,...
C++
2ac69434cc4a1c78b537d365b895a27e
e746ffc665f89306379181d2ffc40f1d
2,100
PASSED
/*My Template*/ #include<bits/stdc++.h> #define Inf 1LL<<61 #define NInf 1LL<<63 #define ll long long #define NewLine cout<<endl #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define REP(i,a,b)for(int i=a;i<b;i++) #define RREP(i,a,b)for(int i=a;i>b;i--) #define R(i,b) REP(i,0,b) #define r(b)REP(_,0,...
C++
2ac69434cc4a1c78b537d365b895a27e
b9f8407218be1464f640b0402c6dfdb0
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 3e5 + 5; struct Edge { int v, id; }; vector<Edge> edge[N]; int n, k, d; int vis[N]; int cut[N]; queue<pii> que; void BFS() { while (!que.empty()) { pii u = que.front(); que.pop(); ...
C++
2ac69434cc4a1c78b537d365b895a27e
83a81375226c632e48ac280da92f9a0c
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 3e5 + 5; struct Edge { int v, id; }; vector<Edge> edge[N]; int n, k, d; int tot; int vis[N]; int dis[N]; queue<int> que; void BFS() { while (!que.empty()) { int u = que.front(); que.po...
C++
2ac69434cc4a1c78b537d365b895a27e
bdcca6cea9bb6cb31102dbe765cd6d6f
2,100
PASSED
// // main.cpp // nik codeforces problems // // Created by PREEYADARSHEE DEV on 15/06/18. // Copyright © 2018 PREEYADARSHEE DEV. All rights reserved. // // train hard win easy :D // by the way nik is love // nik is motivation // going off the grid for some time // #include<bits/stdc++.h> #define mp make_pair #defin...
C++
2ac69434cc4a1c78b537d365b895a27e
ca485471fefec27f8dc809936c3b70ea
2,100
PASSED
//#include "stdc++.h" #include<bits/stdc++.h> #include<iostream> #pragma warning(disable:4996) #pragma comment(linker, "/STACK:336777216") using namespace std; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //typedef tuple<int, int, int> t3; typedef long long ll; typedef unsigned long long ull; ...
C++
2ac69434cc4a1c78b537d365b895a27e
dc07a8362ffa25158241d736c12b5983
2,100
PASSED
#include <bits/stdc++.h> #define pfor(i, n) for (int i = 0; i < (n); i++) #define ppfor(i, n) for (int i = 1; i <= (n); i++) #define rfor(i, n) for (int i = (n) - 1; i >= 0; i--) #define rrfor(i, n) for (int i = (n); i > 0; i--) #define mp make_pair #define lowb lower_bound #define upb upper_bound #define bins binary_s...
C++
2ac69434cc4a1c78b537d365b895a27e
55d0360d668783d36764a130154abdfd
2,100
PASSED
import sys from itertools import chain readline = sys.stdin.readline MOD = 998244353 def compress(L): L2 = list(set(L)) L2.sort() C = {v : k for k, v in enumerate(L2)} return L2, C N = int(readline()) LR = [tuple(map(int, readline().split())) for _ in range(N)] LR = [(a-1, b) for a, b in LR] LR2 = LR...
Python
075249e446f34d1e88245ea3a1ab0768
19a3ecddd1f87157670832731596526c
2,700
PASSED
@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE") import java.io.PrintWriter import java.util.StringTokenizer import kotlin.math.* import kotlin.random.* import kotlin.collections.sort as _sort import kotlin.collections.sortDescending as _sortDescending import kotlin.io.println ...
Kotlin
075249e446f34d1e88245ea3a1ab0768
7725aec21c328744ebaeb3689975cd3c
2,700
PASSED
@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE") import java.io.PrintWriter import java.util.StringTokenizer import kotlin.math.* import kotlin.random.* import kotlin.collections.sort as _sort import kotlin.collections.sortDescending as _sortDescending import kotlin.io.println ...
Kotlin
075249e446f34d1e88245ea3a1ab0768
d3ad567da2e904126938134836993cb1
2,700
PASSED
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class ACMIND { static FastReader scan; static PrintWriter pw; static long MOD = 998244353; static long INF = 1_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(Strin...
Java
075249e446f34d1e88245ea3a1ab0768
87cc8bcc4ee6ad33a3c4c5211ece3cf1
2,700
PASSED
import java.util.*; import java.math.*; import java.io.*; public class f { class DSU { int[] p; public DSU(int n) { p = new int[n]; for(int i = 0 ; i < n ; i++) p[i] = i; } int find(int x) { return x == p[x] ? x : (p[x] = find(p[x])); } boolean union(int u, int v) { int p1 = find(u), p2 = find(v); ...
Java
075249e446f34d1e88245ea3a1ab0768
b6c5d793c2e2b77012c6b60282e6acd4
2,700
PASSED
import java.util.*; import java.math.*; import java.io.*; public class f { class DSU { int[] p; public DSU(int n) { p = new int[n]; for(int i = 0 ; i < n ; i++) p[i] = i; } int find(int x) { return x == p[x] ? x : (p[x] = find(p[x])); } boolean union(int u, int v) { int p1 = find(u), p2 = find(...
Java
075249e446f34d1e88245ea3a1ab0768
358406266e9b84ecb9d199f4dab0f5d5
2,700
PASSED
import java.util.*; import java.math.*; import java.io.*; public class f { long modinv(long x) { return modpow(x, mod - 2); } long modpow(long b, long e) { if(e == 0) return 1; long r = modpow(b, e >> 1); if((e & 1) == 0) return mult(r, r); return mult(b, mult(r, r)); } long add(long a, long b) { return a ...
Java
075249e446f34d1e88245ea3a1ab0768
f9ef73dab0034a620a972344721da821
2,700
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; import java.util.ArrayList; import java.util.Map; import java.io.OutputStreamWriter; import java.io.OutputStream; import java.util.Collection; import java.io.IOException; import java.u...
Java
075249e446f34d1e88245ea3a1ab0768
566f60fe721bc405103e4abd9373ce39
2,700
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; import java.util.ArrayList; import java.util.Map; import java.io.OutputStreamWriter; import java.io.OutputStream; import java.util.Collection; import java.io.IOException; import java.u...
Java
075249e446f34d1e88245ea3a1ab0768
706624e0d3240497ecc0dd720f6e0c7e
2,700
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.Random; import java.util.ArrayList; import java.io.UncheckedIOException; import java.util.List; import java.io.Closeable; import java.io...
Java
075249e446f34d1e88245ea3a1ab0768
b184e1edc499e50ab94acdd4a0497e87
2,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; char grid[8][8]; int dx[] = {-2,2,-2,2}; int dy[] = {2,-2,-2,2}; void fill1(int x, int y) { for (int i = 0; i < 4; i++) { int nx = x + dx[i]; int ny = y + dy[i]; if (nx < 0 || y < 0 || x >= 8 || y >= 8) continue; i...
C++
4f3bec9c36d0ac2fdb8041469133458c
689a645e3dc06bc88f1e5425d69001d6
1,500
PASSED
#include <bits/stdc++.h>` #define slld(longvalue) scanf("%lld", &longvalue) #define plld(longvalue) printf("%lld\n", longvalue) #define slf(longvalue) scanf("%lf", &longvalue) #define plf(longvalue) printf("%lf\n", longvalue) #define sc(letter) scanf("%c", &letter) #define pc(letter) printf("%c", letter) #define ss(...
C++
4f3bec9c36d0ac2fdb8041469133458c
93f7f2e28b18248d99878e879b4f3e8f
1,500
PASSED
#include<cstdio> #include<cstdlib> #include<iostream> #include<vector> #include<queue> #include<bitset> #include<string> #include<stack> #include<set> #include<map> #include<cstring> #include<complex> #include<cmath> #include<iomanip> #include<numeric> #include<algorithm> #include<list> #include<functional> #include<ca...
C++
4f3bec9c36d0ac2fdb8041469133458c
be5169d6dd0ea086e92f88eecb73c12e
1,500
PASSED
#include <cstdio> #include <cstdlib> #include <cmath> #include <algorithm> #include <iostream> #include <cstring> #include <vector> #include <set> #include <map> #include <cassert> #include <ctime> #include <string> using namespace std; #ifdef _WIN32 #define LLD "%I64d" #else #define LLD "%lld" #endif typedef long d...
C++
4f3bec9c36d0ac2fdb8041469133458c
b2d2bea25855e6465dee456bcecfb4fa
1,500
PASSED
#include<bits/stdc++.h> using namespace std; char f[10][10]; void solve() { //char ch=getchar(); int x1=0,y1=0; int x2=0,y2=0; for(int i=1;i<=8;i++){ for(int j=1;j<=8;j++){ cin>>f[i][j]; if(f[i][j]=='K'){ if(x1==0&&y1==0){ x1=i; y1=j; } else { x2=i; y2=j; } } } } i...
C++
4f3bec9c36d0ac2fdb8041469133458c
0898cafa29a120ec12410b069b0ae0d4
1,500
PASSED