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 TaskC { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String name = scanner.nextLine(); String text = scanner.nextLine(); // ищем позицию на которой заканчивается первое совпадение int textLen = text.length(); int nameLen = ...
Java
724fa4b1d35b8765048857fa8f2f6802
3aca7ae9ad4280c66edd0c3309068e44
1,400
PASSED
import java.util.Scanner ; public class Main { public static void main(String[] args){ Scanner cin = new Scanner(System.in) ; System.out.println(new Solve(cin.nextLine() , cin.nextLine() ).run()) ; } } class Solve{ private String word ; private String text ; public Solve(String word , String...
Java
724fa4b1d35b8765048857fa8f2f6802
f8b4ed5f52342bcbdc1ef7082399a383
1,400
PASSED
import java.io.*; import java.util.StringTokenizer; public final class ProblemC { private static Scanner in; private static Output out; public static void solve() throws Exception { String n = in.nextLine(); String t = in.nextLine(); int end = -1; int l = 0; for...
Java
724fa4b1d35b8765048857fa8f2f6802
a0e452d5a93e126ecabb74958ff57f6a
1,400
PASSED
import java.io.*; import java.util.Scanner; public class Solution{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); String s = scanner.next(); String t = scanner.next(); char[] c = s.toCharArray(); char[] d = t.toCharArray(); int i=0; int j=0; int cl = c.length; ...
Java
724fa4b1d35b8765048857fa8f2f6802
2b7234674e102b7322a03e5cbff999a1
1,400
PASSED
import java.io.IOException; import java.util.Scanner; public class Kval2C { public static void main(String[] args) throws IOException{ Scanner scanner = new Scanner(System.in); String s = scanner.next(); String t = scanner.next(); char[] sMass = s.toCharArray(); char[] tMa...
Java
724fa4b1d35b8765048857fa8f2f6802
7f9a570ef12af8629747388c18fb1326
1,400
PASSED
import java.util.Scanner; /** * Created by Hedin on 14-Mar-15. */ public class SolveQual3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); char[] t = sc.next().toCharArray(); sc.close(); int count = 0; ...
Java
724fa4b1d35b8765048857fa8f2f6802
f24b13631d1f567fe3b7955d6bb51462
1,400
PASSED
#include<iostream> #include<vector> #include<map> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<stack> #include<queue> #include<set> #define BUG puts("no bug") #define sci(x) scanf("%d",&x) #define scl(x) scanf("%lld",&x) #define REP(a,b,c) for(int a=b;a<=c;a++) #define PER(a,b,c) for...
C++
6c165390c7f9fee059ef197ef40ae64f
6356ebf8989e2d3556654912385d9ae4
1,800
PASSED
#include <bits/stdc++.h> using namespace std; struct task { long long hard; long long time; bool operator < (const task&el) const { return ((time < el.time) || (time == el.time && hard < el.hard)); } }; void solve() { long long n, t, a, b; cin>>n>>t>>a>>b; vector < task > pr(n + 1); pr[0].hard = pr[0].time...
C++
6c165390c7f9fee059ef197ef40ae64f
aa57efd02b09b60581e97b3ceb457a7f
1,800
PASSED
#include<bits/stdc++.h> using namespace std; //# //# # //# # //# # //# # # //# # ### //# #define ll long long #define pb push_back #define ff first #define ss second #define FAST cin.tie(0); ios_base::sync_with_stdio (false) #define pii pair<int,int> #define TEN6 1000000 #define TEN5 100000 #define TEN4 100...
C++
6c165390c7f9fee059ef197ef40ae64f
21f771011e95694759c18d4e31dbbd06
1,800
PASSED
#include <bits/stdc++.h> #define Fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define ll long long #define f(i, n) for (int i = 0; i < n; i++) #define rf for (int i = n; i >= 0; i--) #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define mp make_pair #def...
C++
6c165390c7f9fee059ef197ef40ae64f
b052706199edcdc9d6ce18c256f5e27d
1,800
PASSED
#include <bits/stdc++.h> #define Fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define ll long long #define f(i, n) for (int i = 0; i < n; i++) #define rf for (int i = n; i >= 0; i--) #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define mp make_pair #def...
C++
6c165390c7f9fee059ef197ef40ae64f
20cdc1894efaac79b19a18f62ad6761c
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll ; typedef pair<ll,ll> pii; int main() { int test; cin>>test; while(test--){ ll n,t,e,h; cin>>n>>t>>e>>h; vector<pii> pref; vector<int> a(n); ll eProb = 0,eHard = 0; for(ll i=0;i...
C++
6c165390c7f9fee059ef197ef40ae64f
7a328d929bc56a9e424838c64867aa0f
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll ; typedef pair<ll,ll> pii; int main() { int test; cin>>test; while(test--){ ll n,t,e,h; cin>>n>>t>>e>>h; vector<pii> pref; vector<int> a(n); ll eProb = 0,eHard = 0; for(ll i=0;i...
C++
6c165390c7f9fee059ef197ef40ae64f
d20545d8a3e88ccd9e819a50c2299dde
1,800
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { int cntTest; cin >> cntTest; for (int test = 0; test < cntTest; test++) { ll n, t, a, b; cin >> n >> t >> a >> b; vector<pair<ll, ll>> v; vector<int> hard(n); in...
C++
6c165390c7f9fee059ef197ef40ae64f
7245f0b377445e67a5981eea2cbe1494
1,800
PASSED
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <map> #include <set> #include <vector> #include <stack> #include <utility> #include <algorithm> #include <queue> using namespace std; struct A { long long t; long long which; long long con; }all1[200005],all2[200005]; long long which[20000...
C++
6c165390c7f9fee059ef197ef40ae64f
3491af5479d58fdca902ea9bd977442f
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long const int M=2e5+2; int t,n,T,a,b; pair<int,int> p[M]; int32_t main() { ios::sync_with_stdio(false); cin>>t; while(t--) { int seasys=0,shards=0; cin>>n>>T>>a>>b; for (int i=1;i<=n;i++) { cin>>p[i].second; if(p[i].secon...
C++
6c165390c7f9fee059ef197ef40ae64f
a22fe109df0e0211a487b8a876b47771
1,800
PASSED
// ================================= // author: memset0 // date: 2019.07.30 23:55:06 // website: https://memset0.cn/ // ================================= #include <bits/stdc++.h> #define ll long long #define rep(i, l, r) for (int i = (l), i##ed = (r); i <= i##ed; ++i) #define for_each(i, a) for (size_t i = 0, i##...
C++
529d3ec4abb5950927d1c4d387afbaea
ec1537dab1db954096ad65a64fddbcb0
2,300
PASSED
#pragma GCC optimize(2) #include <cstdio> #include <iostream> #include <cstring> using namespace std; #define N 50 int n; int f[N + 2][N + 2][N + 2][N + 2]; char s[N + 2][N + 2]; inline void in(int &x) { x = 0; char c = getchar(); bool f = 1; while(c < '0' or c > '9') { if(c == '-') f = 0; c = getchar(); } ...
C++
529d3ec4abb5950927d1c4d387afbaea
2ea484cecf98034b85a37c7c227094e4
2,300
PASSED
#include<bits/stdc++.h> using namespace std; #define si(x) scanf("%d",&x) #define sl(x) scanf("%lld",&x) #define ss(s) scanf("%s",s) #define pri(x) printf("%d\n",x); #define prl(x) printf("%lld\n",x); #define prs(s) printf("%s\n",s); using ll=long long; #define pb push_back #define mp make_pair #define fo(i,n) for(...
C++
529d3ec4abb5950927d1c4d387afbaea
7f7f5ce611974e6d3bc307192b55d9a0
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 5; inline int readint() { char c = getchar(); int ret = 0; while (!isdigit(c)) c = getchar(); while (isdigit(c)) { ret = ret * 10 + c - '0'; c = getchar(); } return ret; } char s[55][55]; int dp[55][55][55][55]; int dfs(in...
C++
529d3ec4abb5950927d1c4d387afbaea
3c644e512202b06045c657cbc35cfd03
2,300
PASSED
// luogu-judger-enable-o2 #include <map> #include <set> #include <list> #include <queue> #include <stack> #include <ctime> #include <cmath> #include <vector> #include <bitset> #include <cctype> #include <cstdio> #include <string> #include <cstdlib> #include <cstring> #include <climits> #include <iostream> #include <alg...
C++
529d3ec4abb5950927d1c4d387afbaea
473f87b784821c380d3e862f48dada9a
2,300
PASSED
#include <cstdio> #include <vector> #include <set> #include <map> #include <algorithm> #include <string> using namespace std; const int M = 53; int n; char s[M][M]; int dp[M][M][M][M]; void testcase() { scanf("%d", &n); for(int i = 0; i < n; i++) { scanf("%s", s[i]); } for (int i = n-1; i >= 0; i--) for (int...
C++
529d3ec4abb5950927d1c4d387afbaea
bf5898f1da5b2b38f6359f07dc7ff714
2,300
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; const ll mod = 998244353; int s1[55][55][55],s2[55][55][55]; int dp[55][55][55][55]; string ss[55]; int s[55][55]; /*int border[10050005]; int p[100005],sz[100005]; int prefix_function(string s); void init(); int fd(int x); void un(int x,int y); ...
C++
529d3ec4abb5950927d1c4d387afbaea
7827dc83015b0a92c6aa16ca812dd57a
2,300
PASSED
#define DEBUG 0 #include <bits/stdc++.h> using namespace std; #if DEBUG // basic debugging macros int __i__,__j__; #define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl #define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl #define printVar(n) cout<<#n<<": "<<n<<endl #define printA...
C++
529d3ec4abb5950927d1c4d387afbaea
1c0c0615e46bc7b61b436a0f966362c9
2,300
PASSED
#include<bits/stdc++.h> using namespace std; inline void write(int x) { static const int maxlen = 100; static char s[maxlen]; if (x < 0) { putchar('-'); x = -x;} if (!x) { putchar('0'); return; } int len = 0; for (; x; x /= 10) s[len++] = x % 10 + '0'; for (int i = len - 1; i >= 0; --i) putcha...
C++
529d3ec4abb5950927d1c4d387afbaea
1e8da7c7d01109c31532cfcd7c6b4b6d
2,300
PASSED
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int n,f[55][55][55][55]; char mp[55][55]; void cmin(int &a,int b){ a=min(a,b); } int main(){ ios::sync_with_stdio(false); int i,sx,sy,tx,ty,sz; cin>>n; for(i=1;i<=n;i++) cin>>mp[i]+1; for(sz=1;sz<=n*n;sz++) ...
C++
529d3ec4abb5950927d1c4d387afbaea
d23e5d5920419aad2f485c99863c02da
2,300
PASSED
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void process()throws IOException { int n=ni(),arr[]=new int[n+1]; for(int i=1;i<=n;i++) arr[i]=ni(); int q=ni(),query_no_2[]=new int[q+1],query_no_1[]=new int[n+1]; for(int i=1;i<=q;i++...
Java
7b788c660fb8ca703af0030f4c84ce96
01da3e49b62a1f3ff314ded5f49f112d
1,600
PASSED
import java.util.*; import java.io.*; import java.math.*; public class B { public static void process()throws IOException { int n = ni(), arr[] = new int[n+1], latest_query[] = new int[n+1]; for(int i = 1; i<=n; i++) arr[i] = ni(); int q = ni(), query[] = new int[q+2]; // query[] hold...
Java
7b788c660fb8ca703af0030f4c84ce96
dee0b1932d837a2ab622e2ae78cdd6f5
1,600
PASSED
import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.DataInputStream; import java.io.Flushable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.InputMismatchException; /** * Built using CHelper plug-in * Actual solution is at the top */ ...
Java
7b788c660fb8ca703af0030f4c84ce96
a3e0466bc1b14e2da21f0ba32999807b
1,600
PASSED
import java.io.*; import java.util.*; public class A { static FastReader f = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { int n = f.nextInt(); Pair[] pairs = new Pair[n]; for(int i=0;i<n;i++) { pairs[i]...
Java
7b788c660fb8ca703af0030f4c84ce96
1aa7b6132b7e12b88b2f34f28fa97e26
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); long long ans,d,n,i,j,k,l;cin>>n; long long a[n+2],b[n+2]={0},c[n+2]={0}; for(i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(i=1;i<=n;i++) b[i]=b[i-1]+(i-1)*(a[i]-a[i-1]); // for(i=1;i<=n;i++) cout<<b...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
72d4f484cc2a02b9d53400bc26783e5c
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); long long ans,d,n,i,j,k,l;cin>>n; long long a[n+2],b[n+2]={0},c[n+2]={0}; for(i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(i=1;i<=n;i++) b[i]=b[i-1]+(i-1)*(a[i]-a[i-1]); for(i=n,j=1;i>=1;i--,j++) c...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
e08a7b913fb6ac47e3e54eed75be3a18
1,400
PASSED
#include<bits/stdc++.h> using namespace std; bool compare(const pair<int,int>&a,const pair<int,int>&b){ return(a.second<b.second); } int main(){ int n;cin>>n; vector<pair<int,int>>v; int x=0; for(int i=0;i<n;i++){ cin>>x; v.push_back(make_pair(x,0)); } sort(v.begin(),v.end()); // int sum; /...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
85f4ab264e4e79d81cacd24d244c1294
1,400
PASSED
#include <bits/stdc++.h> using namespace std; long long abef[300001]; long long aaft[300001]; int main(void){ int n; cin>>n; int *a=new int[n]; for(int i=0;i<n;i++)cin>>a[i]; sort(a,a+n); for(int i=1;i<n;i++){long long k=(long long)(i)*(long long)(a[i]-a[i-1]);abef[i]+=abef[i-1]+k;} for(int i=n-2;i>=0;i--){aaft...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
47621273864f70cb74c02e5bd2e5a17e
1,400
PASSED
#include <bits/stdc++.h> using namespace std; // Prioridade typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; #define F first #define S second #define PB push_back #define MP make_pair #define REP(i,a,b) for(int i = a; i < (int)(b); i++) #defi...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
8ed634fb533a49ee6ebe661986138222
1,400
PASSED
#include<bits/stdc++.h> using namespace std; const long long M=1e6+1,MOD=1e9+7; typedef long long ll; ll a[M],b[M]; ll arr[M]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; vector<ll>pos,neg; map<ll,int>mp; ll c=0; for(int i=1;i<=n;i++) { cin>>arr[i]; ...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
f6f3b9e411210e9234f3cfc180107f58
1,400
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <map> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> ans; for (int i = 0; i < n; i++) { int x; cin >> x; ans.emplace_back(x, i + 1); } sort(ans.begin(), ans.end()); if (...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
113bea5c525bb9dea21da96d899e2b01
1,400
PASSED
#include <map> #include <set> #include <list> #include <cmath> #include <deque> #include <stack> #include <queue> #include <array> #include <bitset> #include <cstdio> #include <string> #include <vector> #include <random> #include <chrono> #include <utility> #include <numeric> #include <cstdlib> #include <cstring> #incl...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
8bee3275c8694dc8a8a96900f9fd7b3d
1,400
PASSED
#include <iostream> #include <set> #include <utility> #include <vector> #include <algorithm> using namespace std; #define ll long long const int N = int(3e5) + 10; int n; vector<ll> vec; set<ll> st; int main(){ cin >> n; vec.reserve(n); for(int i = 1, t; i <= n; ++i){ cin >> t; ...
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
31990f99c2eac0a246a6598c9a02f9ec
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin>>n; int a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } sort(a,a+n); cout<<a[(n-1)/2]; return 0; }
C++
fa9cc3ba103ed1f940c9e80a7ea75f72
334aa8723a547802683636003d60824f
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ftype; typedef complex<ftype> point; #define inf 1e18 struct LiChao_max { struct line { long long a, b; line() { a = 0; b = 0; } line(long long _a, long long _b) { a = _a; b = _b; } int64_t eval(long long x) { return...
C++
c0c046b68775c80cd6ea22b577166225
0824eac0d07db06ad4d5fce004ae3905
2,400
PASSED
#include <bits/stdc++.h> using namespace std; struct LiChaoTree { typedef long long ftype; typedef complex<ftype> point; #define MX 1e18 #define MAX_QUERY 1e9 #define MIN_QUERY 0 #define x real #define y imag ftype dot(point a, point b) { return (conj(a) * b).x(); } ftype f(point a, ...
C++
c0c046b68775c80cd6ea22b577166225
bd91126dde98c25bab1260f20a40b2cc
2,400
PASSED
#include <bits/stdc++.h> using namespace std; struct LiChaoTree { typedef long long ftype; typedef complex<ftype> point; #define MX 1e18 #define MAX_QUERY 1e9 #define MIN_QUERY 0 #define x real #define y imag ftype dot(point a, point b) { return (conj(a) * b).x(); } ftype f(point a, ...
C++
c0c046b68775c80cd6ea22b577166225
ba496ebb4cd771bcf545f2d42bb2a031
2,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ftype; typedef complex<ftype> point; #define inf 1e18 struct LiChao_min { struct line { long long a, b; line() { a = 0; b = 0; } line(long long _a, long long _b) { a = _a; b = _b; } int64_t eval(long long x) { return...
C++
c0c046b68775c80cd6ea22b577166225
defb5c03a07a09bcc0d147b9355977dc
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long struct trio { int x, y, a; trio(){}; trio(int x, int y, int a): x(x), y(y), a(a){}; }; bool cmp(trio a, trio b) { return a.y > b.y; } double cross(pair<int, int> a, pair<int, int> b) { double k1, k2, b1, b2; k1 = a.first; b1 = a.second; k2...
C++
c0c046b68775c80cd6ea22b577166225
1ae1de8bbf821beea459a45dc7bb5fad
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define vi vector<ll > #define vvi vector<vi > #define all(x) x.begin(), x.end() #define top(z, i) z[z.size() - 1 - i] #define eps 1e-8 struct line { ll a, k; line() {} line(ll a, ll k) : a(a), k(k) {} }; long double inter(li...
C++
c0c046b68775c80cd6ea22b577166225
eb8c3ef79465171cfebdb31063abd315
2,400
PASSED
#include <iostream> #include <algorithm> #include <vector> #pragma GCC optimization("Ofast") #pragma GCC optimization("unroll-loops") using namespace std; using ll = long long; constexpr ll inf = 1e18; constexpr int maxx = 1e9 + 57; struct rect { ll x, y, a; rect() : x(0), y(0), a(0) {}; rect(ll x, ll y, ll a) :...
C++
c0c046b68775c80cd6ea22b577166225
d1a980f4ed0288b010fd831f430d4cfb
2,400
PASSED
#include <iostream> #include <iomanip> #include <cctype> #include <string> #include <vector> #include <cmath> #include <set> #include <queue> #include <iterator> #include <cstdlib> #include <algorithm> #include <map> #include <stack> #include <fstream> #include <bitset> #include <unordered_map> using namespace std; #...
C++
c0c046b68775c80cd6ea22b577166225
b1b3548457da814b0baf74a8c2ccb8c0
2,400
PASSED
//#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define rr resize #define fs first #define sd second #define sz size() #define mp make_pair #define pb push_back #define all(x) (x).begin...
C++
c0c046b68775c80cd6ea22b577166225
983fa65dba87c7fe7808133b5f909df5
2,400
PASSED
//Author: Artem Romanov #include <bits/stdc++.h> //#define TASK "file" #define F first #define S second #define ALL(x) (x).begin(), (x).end() using namespace std; typedef long long i64; typedef long double dbl; const dbl PI = acos(-1.0L); const dbl EPS = 1e-12L; mt19937 rng((uint32_t) chrono::steady_clock::now().time...
C++
c0c046b68775c80cd6ea22b577166225
825ffe7ee3b8ee6bb11dfe63305d9251
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define mst(a,b) memset((a),(b),sizeof(a)) #define pi acos(-1) const int INF = 0x3f3f3f3f; const double eps = 1e-6; const int MAXN = 1e5 + 10; const int MAXM = 1e6 + 10; int A[5][5],B[5][5]; int vis[5][5]; int main() { #ifdef local freopen("data.t...
C++
1241a1aae502b7e4f136da9cf11ffc3d
205180aa548ae256335e4c4d7abc1683
1,800
PASSED
#include <iostream> #include <cstring> #include <vector> #include <algorithm> #include <stdio.h> #define files freopen("input.txt", "r", stdin); using namespace std; vector< pair<int, int> > q; vector<int> Alice; vector<int> Bob; long long int k; int f(int a, int b) { if ((a == 1) && (b == 3) || (a == 2) && (b =...
C++
1241a1aae502b7e4f136da9cf11ffc3d
f683747afa34c410b911d097ad6d4bfb
1,800
PASSED
#include <bits/stdc++.h> #define ll long long #define fr first #define sc second #define ii pair<ll,ll > #define mp make_pair #define All(v) v.begin(),v.end() #define mod 1000000007 #define pi 3.14159265358979323 #define EPS 1e-9 #define MOD 1000000007 using namespace std; ll k; int a,b,A[5][5],B[5][5]; map<pair<int,in...
C++
1241a1aae502b7e4f136da9cf11ffc3d
362e2176f6e842fcee8c3b5600aabdd0
1,800
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <unordered_map> #define ll long long using namespace std; unordered_map<int,int> M; int op_a[4][4]; int op_b[4][4]; int win[100][2]; int cnt = 0; int main() { M.clear(); ll k; int a,b; ll win_a = 0; ll win_b = 0; ...
C++
1241a1aae502b7e4f136da9cf11ffc3d
8a2af091090e29044216ee1dbe8fb73a
1,800
PASSED
#include <iostream> using namespace std; int a[4][4]; int b[4][4]; int rep[4][4]; pair<long long, long long> am[100]; int main() { int A,B; long long k; cin >> k >> A >> B; for(int i = 1; i <= 3; i++) { for(int j = 1; j <= 3; j++) cin >> a[i][j]; } for(int i = 1; i <= 3...
C++
1241a1aae502b7e4f136da9cf11ffc3d
8660726edf5cf41f69f3f48aeadd8d14
1,800
PASSED
#include <bits/stdc++.h> using namespace std; unsigned long long k; unsigned long long A,B,a[5][5],b[5][5],fix[5][5],fi[5][5],AA,BB,sta,stb,s,modulo,ans,an,bolo1,bolo2,x,AAA,BBB; pair<long long,long long>v[100]; void go1(unsigned long long A,unsigned long long B) { if (fix[A][B]) return ; if (k-1==ans) return ; s+...
C++
1241a1aae502b7e4f136da9cf11ffc3d
05be7e373318b9a6e02e374703693628
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define fast ios_base::sync_with_stdio(false) bool comp(pair<int, pair<int, int> > &p1, pair<int, pair<int, int> > &p2) { return p1.first < p2.first; } bool comp_(int &a, int &b) { return a > b; } ll ans1 = 0, ans2 = 0, first[3][3], second[3][3...
C++
1241a1aae502b7e4f136da9cf11ffc3d
437cbe1d2a299579a0b5692c8e41528a
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define R cin>> #define Z class #define ll long long #define ln cout<<'\n' #define in(a) insert(a) #define pb(a) push_back(a) #define pd(a) printf("%.10f\n",a) #define mem(a) memset(a,0,sizeof(a)) #define all(c) (c).begin(),(c).end() #define...
C++
1241a1aae502b7e4f136da9cf11ffc3d
f58bc2c121db67ce1ce159cc74abd7b6
1,800
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; int p1[4][4]; int p2[4][4]; bool visited[4][4] = {0} ; pair<long long, long long> score, state; template <typename T,typename U> std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & ...
C++
1241a1aae502b7e4f136da9cf11ffc3d
305721848a36a3e14d5e0726578dbd9e
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 7; ll n, ans1, ans2; int i_, j_; int a[maxn][maxn], b[maxn][maxn]; pair<int,int> t; map<pair<int,int>, char> mp; vector<pair<int,int> > vec; int main() { cin>>n>>i_>>j_; for(int i=1;i<=3;++i) for(int j=1;j<=3;++j) ...
C++
1241a1aae502b7e4f136da9cf11ffc3d
c501a69fa81b4d8a0331fd017f7f203c
1,800
PASSED
#include <iostream> #include <vector> #include <cmath> #include <fstream> #include <string> #include <algorithm> #include <cstdlib> #include <queue> using namespace std; int main() { int n; cin >> n; vector <int> ivec(2*n); int s = 0; for (int a = 0; a < 2 * n; a++) { cin >> ivec[a]; s += ivec[a]; } sor...
C++
99dd93970b66c886297082d28a46c022
7abe1a52b57d5d76cbe328f484853d7c
800
PASSED
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { // freopen("input.txt", "r", stdin); int n; long long sum = 0; scanf("%d", &n); vector<int>mas(n*2); for (int i = 0; i < n * 2; i++) { scanf("%d", &mas[i]); sum += mas[i]; } long long needNum = sum / n; for (int i ...
C++
99dd93970b66c886297082d28a46c022
ab4a1023f9bca3a5ce8f9c5155589194
800
PASSED
#include <iostream> using namespace std; int main(){ int n, i, j, a, b, c; int x[2010]; int y[2000][2]; a = 0; c = 0; cin >> n; for(i = 0; i < 2 * n; i++){ cin >> x[i]; a = a + x[i]; } b = a / n; for(i = 0; i < 2 * n; i++){ for(j = i + 1; j <= 2 * n; j++){ if(b - x[i] == x[j]){ cout << x[i...
C++
99dd93970b66c886297082d28a46c022
9a39eadfd43b4e7fa940b9c3a314ab94
800
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <queue> #include <string> using namespace std; typedef long long ll; const int INF = 1000000000; const int N = 11000; int legs[N]; int n; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); cin >...
C++
99dd93970b66c886297082d28a46c022
e0cc3794cd40dd587cde04a1c74a1a1e
800
PASSED
#include <iostream> #include <fstream> #include <vector> #include <string> #include <map> #include <set> #include <queue> #include <algorithm> using namespace std; const int N = 1010; int main() { #ifdef MY_DEBUG freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif int n = 0; cin...
C++
99dd93970b66c886297082d28a46c022
ff256d0875a1ccefee9eb9b30ced1613
800
PASSED
#include <iostream> #include <algorithm> int main() { int *a, n; std::cin >> n; a = new int[n * 2]; for (int i = 0; i < 2 * n; i++) std::cin >> a[i]; std::sort(a, a + n * 2); for (int i = 0; i < n; i++) std::cout << a[i] << " " << a[2 * n - 1 - i] << "\n"; }
C++
99dd93970b66c886297082d28a46c022
f668064d375eecf7982716d492dd110d
800
PASSED
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { int n, sum = 0; cin >> n; int a[2000]; for (int i = 0; i < 2 * n; i++) { cin >> a[i]; sum += a[i]; } int h = sum / n; sort(a + 0, a + 2 * n); for (int i = 0; i < n; i++) { cout << a[i] << " " <...
C++
99dd93970b66c886297082d28a46c022
581a74c6da3dd6690f5bda4f8949ea95
800
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<map> using namespace std; typedef long long ll; int main() { ll n; cin >> n; vector<int>a(n * 2); for(int i = 0; i < n * 2; i++) cin >> a[i]; sort(a.begin(), a.end()); for(int i = 0; i < n; i++) cout << a[i] << " " << a[n * 2 ...
C++
99dd93970b66c886297082d28a46c022
cbb1a163151857e266aa21a7bd01d49b
800
PASSED
#include <stdio.h> #include <math.h> #include <algorithm> #include <string> #include <vector> #include <map> #include <queue> #include <time.h> using namespace std; #define ll long long int #define mp make_pair //#define s second //#define f first const int mod=1e9+7; int a[111111]; int main(){ #pragma comment(linker...
C++
99dd93970b66c886297082d28a46c022
f444e2cefed131ba09b2bab1e5890aa2
800
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <set> #include <queue> #include <string> using namespace std; typedef long long LL; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; vector<int> mass; for (int i = 0; i < 2 * n; i++) { int l; cin >> l; mass.push...
C++
99dd93970b66c886297082d28a46c022
4abab5f3e6773cff9e3e80f9a0e312dd
800
PASSED
from math import * groups = raw_input() data = raw_input() str_points = data.split(" ") points = [int(x) for x in str_points] taxi1 = 0 taxi2 = 0 taxi3 = 0 taxi4 = 0 for i in range(len(points)): if points[i] == 1: taxi1 += 1 if points[i] == 2: taxi2 += 1 if points[i] == 3: taxi3 +...
Python
371100da1b044ad500ac4e1c09fa8dcb
f3baff5c6020d58cca87c95d9a1cb94d
1,100
PASSED
import string import math n=int(raw_input()) a=raw_input() a=a.split() num={} num[1]=0 num[2]=0 num[3]=0 num[4]=0 i=0 while i<len(a): a[i]=int(a[i]) num[a[i]]=num[a[i]]+1 i=i+1 K=num[4]+num[2]/2 num[2]=num[2]%2 if num[3] >= num[1]: K = K + num[3] + num[2] if num[3] < num[1] and (num[1]-num[3])/2...
Python
371100da1b044ad500ac4e1c09fa8dcb
18b92d06e6281874b9b9024b12634c55
1,100
PASSED
input() s=map(int,raw_input().split()) a,b,c,d=[s.count(i) for i in range(1,5)] print d+c+b/2+(max(0,a-c)+3+b%2*2)/4
Python
371100da1b044ad500ac4e1c09fa8dcb
cc1474e30668de689d0da00d86dba087
1,100
PASSED
# http://codeforces.com/problemset/problem/158/B # B. Taxi n = input() si = map(int, raw_input().split()) si.sort() count1 = 0 count2 = 0 count3 = 0 res = 0 for i in si: if( i == 1): count1 += 1 elif( i == 2 and not count2): count2 += 1 elif( i == 2 and count2): res += 1 count2 -= 1 elif( i == 3): if( c...
Python
371100da1b044ad500ac4e1c09fa8dcb
f44d004be00872ce9a7797c9931712ac
1,100
PASSED
n = input() ls = [] temp = str.split(raw_input(),' ') for i in range(n): ls.append(int(temp[i])) a = ls.count(1) b = ls.count(2) c = ls.count(3) d = ls.count(4) sum = 0 sum += d d = 0 if a<=c and c!=0: sum += c c = 0 a = 0 if a>c and c!=0: sum += c a = a-c if b>0: sum += b/2 if ...
Python
371100da1b044ad500ac4e1c09fa8dcb
7ef6167a480aa995a0aba0484c6d0c82
1,100
PASSED
def giveb(num, k): l = [] while num > 0: if num%k not in [0,1]: return 'notvalid' else: l.append(str(num%k)) num = num//k return ''.join(l[::-1]) for _ in range(int(input())): n, k = map(int, input().split()) l = list(map(int, input().split())) ...
Python
b132bf94af4352c4a690316eb610ebe1
29be1ad0f126e5a3e6d36c2f864393f5
1,400
PASSED
# your code goes here for _ in range(int(input())): n,k=map(int, input().split()) a=list(map(int, input().split())) a.sort() s=set() f=0 for i in range(n): j=66 while a[i]>0: while j>=0 and a[i]<k**j: j-=1 if a[i]>=k**j: if j in s: f=1 break a[i]-=k**j s.add(...
Python
b132bf94af4352c4a690316eb610ebe1
163d4d23da8879e07d2fd7ddd4790d94
1,400
PASSED
R=lambda:map(int,input().split()) t,=R() for _ in[0]*t: n,k=R();a=*R(),;r=0 while any(a):a,b=zip(*(divmod(x,k)for x in a));r|=sum(b)>1 print('YNEOS'[r::2])
Python
b132bf94af4352c4a690316eb610ebe1
f1139be794045f435021b889535d3d61
1,400
PASSED
R=lambda:map(int,input().split()) t,=R() for _ in[0]*t: n,k=R();a=*R(),;r='YES' while any(a): if[x%k for x in a if x%k]>[1]:r='NO' a=[x//k for x in a] print(r)
Python
b132bf94af4352c4a690316eb610ebe1
d600f26e352965e9cf1134de9d6257fb
1,400
PASSED
R=lambda:map(int,input().split()) t,=R() for _ in[0]*t: n,k=R();a=*R(),;r=0 while any(a):r|=[x%k for x in a if x%k]>[1];a=[x//k for x in a] print('YNEOS'[r::2])
Python
b132bf94af4352c4a690316eb610ebe1
f0843bc55bab4035aa81567a87237e6c
1,400
PASSED
R=lambda:map(int,input().split()) t,=R() for _ in[0]*t: n,k=R();a=*R(),;r=0;s=1 while s:z=sum(a);a=[x//k for x in a];r|=s>k*z+1;s=z print('YNEOS'[r::2])
Python
b132bf94af4352c4a690316eb610ebe1
2e6d8192716ed193ec4b5d646e0326b6
1,400
PASSED
R=lambda:map(int,input().split()) t,=R() for _ in[0]*t: n,k=R();a=*R(),;r=0 while any(a):r|=sum(x%k for x in a)>1;a=[x//k for x in a] print('YNEOS'[r::2])
Python
b132bf94af4352c4a690316eb610ebe1
95177a6dc6e27d44094bdf98472b88d9
1,400
PASSED
import math T=int(input()) for i in range(T): n,k=map(int,input().split()) l=list(map(int,input().split())) l.sort() j=0 d={} b=0 while(j<n): if l[j]==0: j+=1 continue c=int(math.log(l[j],k)) if l[j]-k**(c+1)>=0: c+=1 if l[j]-k**c<0: c-=1 l[j]-=k**c if c in d: print("NO") b=1 bre...
Python
b132bf94af4352c4a690316eb610ebe1
393ddab04f9461dcdc5550c968d20f81
1,400
PASSED
t = int(input()) def in_base(n, k): l = list() kk = 1 if n==0: l.append(0) while n>=1: l.append(n % k) n//=k return l for _ in range(t): n, k = list(map(int, input().split())) a = list(map(int, input().split())) bases = list() yes = True for i in ...
Python
b132bf94af4352c4a690316eb610ebe1
b65a929ed5a1c87fab1aba563766f1e9
1,400
PASSED
from math import ceil, log def solve(): N, K = map(int, input().split()) L = list(map(int, input().split())) m = ceil(log(max(L), K)) if max(L) != 0 else 0 while m >= 0: larger = list(filter(lambda x: x >= K**m, L)) if len(larger) >= 2: print("NO") return ...
Python
b132bf94af4352c4a690316eb610ebe1
5effedfd3e93c40d461463a6fa416e4c
1,400
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<vector> using namespace std; typedef long long LL; int n; LL a[300007],sum[300007],even[1<<20+1],odd[1<<20+1]; int main(){ LL cnt; while(scanf("%d",&n) != EOF){ cnt = 0; memset(sum,0,sizeof(sum)); memset(even,0,sizeof(even)); ...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
8751a14999445f3516d4cc07a7c76613
1,600
PASSED
#include <bits/stdc++.h> #define make_struct(a...) {a} #define fast_io ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0); #define y1 CNik typedef long long ll; using namespace std; const int MAX = 5e5 + 5; const int inf = 1e9; const long long INF = 1e18; const long long MOD = 1e9 + 7; template <typename T> v...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
84f69e41d708d6e3b98536c6198aa16a
1,600
PASSED
#include <bits/stdc++.h> #define make_struct(a...) {a} #define fast_io ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0); #define y1 CNik typedef long long ll; using namespace std; const int MAX = 5e5 + 5; const int inf = 1e9; const long long INF = 1e18; const long long MOD = 1e8; template <typename T> void ...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
d09a441569f101957cb1da0cc9f82f64
1,600
PASSED
/* ,]@@@@@@@@@@@\] *@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@* /@@@@@@@@@@@@@@@@@@@\` *@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@* =/@@@@@@@/[ ,[\@@@@@@@` *[[[[[[[[[[@@@@@/[[[[[[[[[[ @@@@@* =@@@@@@` *\@@@@@\ @@@@@^ @@@@@* ...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
bc201ebdbb942cabab671a29f14b1be3
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define in ({ll x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;}) #define inchar ({char c=getchar();while(c==' '||c=='\n') c=getchar();c;}) #define ll long long #define FOR(i,a,b) for(auto i=a;i<=b;i++) #de...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
aa30766a09bd8ad1603065ff32840332
1,600
PASSED
#include <bits/stdc++.h> using namespace std; long long cnt[3000000][2]={0}; int main(){ long long n=0,ans=0; cnt[0][1]=1; cin>>n; long long total=0; for(int i=0;i<n;i++){ long long x=0; cin>>x; total^=x; ans+=(cnt[total][i%2]++); } cout<<ans; return 0; }
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
8c02e8e777c508ebb95661dd4f9cb69b
1,600
PASSED
#include <bits/stdc++.h> using namespace std; long long cnt[3000000][2]={0}; int main(){ long long n=0,ans=0; long long z[2]={0,1}; //cnt[0][1]=1; cin>>n; long long total=0; for(int i=0;i<n;i++){ long long x=0; cin>>x; total^=x; if(!total)z[i%2]++; else ans+=(cnt[total][i%2]++); } z[0]--; z[1]--; ans+=...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
bee81490d8a17243e117955d8e318500
1,600
PASSED
#include <bits/stdc++.h> #include <iostream> #include <algorithm> #include <map> #include <cmath> #include <cstdio> #include <cstring> #include <vector> #define ms(s, n) memset(s, n, sizeof(s)) #define rep(i, a, b) for (int i = (a); i < (b); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i += 2) #define repd(i, ...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
23d293695e8ed7a2941ff209414fccc7
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define MAX 1025*1025 int n; ll e[MAX]; ll o[MAX]={1}; ll ans=0; int main() { cin>>n; int x=1; ll s=0; ll a; for(int i=0;i<n;i++) { cin>>a; s^=a; if(x) { ans+=e[s]; e[s]++; } else { ans+=o[s]; o[s]+...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
310e2add1a83087a49b27577f55f2a96
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int ll dp[2000000][2]; int main() { ll n; cin>>n; memset(dp,0,sizeof(dp)); ll a[n+1]; for(int i=1;i<=n;i++) { cin>>a[i]; } ll sum=0; ll ans=0; for(int i=1;i<=n;i++) { sum^=a[i]; i...
C++
e9cf26e61ebff8ad8d3b857c429d3aa9
0b1152037c013189f2f804b7472ec21e
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define con continue #define bk break #define LL long long #define db double #define pt cout<<'\n' #define ms(a, b) memset((a), (b), sizeof(a)) #define mp make_pair #define endl '\n' int inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps ...
C++
01ac609133428a0074e8506786096e02
47eb9080604f3ea5e32cbbbee8960f1d
1,800
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ff(i,s,e) for(int i=(s);i<(int)(e);i++) #define fr(i,s,e) for(int i=(e);i-->(int)(s);) #define FF(i,s,e) for(int i=(s);i<=(int)(e);i++) #define Fr(i,s,e) for(int i=(e);i>=(int)(s);i--) #define gcd(a,b) __gcd...
C++
01ac609133428a0074e8506786096e02
25130192ef2536a0a3a1b730f5a03238
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long long LL; typedef pair<int,int> ii; typedef vector<ii> vii; typedef vector<int> vi; #ifdef DEBUG #define cek(x) cout<<x #else #define cek(x) if(false){} #endif // DEBUG #define fi first #define se second #define INF 1000000000 #d...
C++
01ac609133428a0074e8506786096e02
66f31a1a8046f6acc64202a8832e5e46
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define f first #define s second #define mod 1000000007 typedef pair<int,int> ii; typedef pair<int,pair<int,int> > iii; int minprime[10000005]; vector<int> op[2]; int mp[2][10000005]; int a[100005]; int b[100005]; void pre(...
C++
01ac609133428a0074e8506786096e02
84f901be24c93ee8a6140083d23dee8d
1,800
PASSED
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define f first #define s second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define pi acos(-1.0) #define EPS 1e-9 #define mem(n,x) memset(n,x,sizeof(n)) typedef long long ll; using namespace std; int a[100005],b[100005]; in...
C++
01ac609133428a0074e8506786096e02
a524eb28098dff3e52b4ff8372508cee
1,800
PASSED