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.io.*; import java.util.*; public class Solution{ public static void main(String arg[])throws IOException { BufferedReader io =new BufferedReader(new InputStreamReader(System.in)); String[] input1 = io.readLine().trim().split(" "); int n = Integer.parseInt(input1[0]); ...
Java
b2031a328d72b464f965b4789fd35b93
7dc8e6db88e87ac93e90c6d7a13e1a25
1,500
PASSED
import java.util.*; public class Solution { private static boolean isSorted(int[] arr) { for (int i = 0; i< arr.length - 1; i++) { if (arr[i] > arr[i+1]) return false; } return true; } private static void reverse(int[] arr, int from, int to) { int i, t; ...
Java
b2031a328d72b464f965b4789fd35b93
d3fde4d3d4bb4798b3a880ed786f97ed
1,500
PASSED
import java.util.*; public class cf311div2B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int w=sc.nextInt(); int arr[]=new int[2*n]; for(int i=0;i<2*n;i++) arr[i]=sc.nextInt(); Arrays.sort(arr); int min1=arr[2*n-1]; int min2=arr[2*n-1]; for(int i=0;i<=n-1;i++) {if(ar...
Java
b2031a328d72b464f965b4789fd35b93
41e455be1d92aa1cccfeb9339f0c0930
1,500
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.InputS...
Java
b2031a328d72b464f965b4789fd35b93
5b7529e867c47f4adb4966e01d75d681
1,500
PASSED
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { int n, w; List<Integer> as = new ArrayList<>(); Scanner scanner = new Scanner(System.in); n = scanner.nextInt(); ...
Java
b2031a328d72b464f965b4789fd35b93
8743bab11426d38a0a336c75e4593b37
1,500
PASSED
/* ID: davidzh8 PROG: subset LANG: JAVA */ import java.io.*; import java.util.*; import java.lang.*; public class pashatea { //Start Stub static long startTime = System.nanoTime(); //Globals Go Here //Globals End public static void main(String[] args) throws IOException { boolean debug =...
Java
b2031a328d72b464f965b4789fd35b93
1d8bced5feb17a53afc93b5a7ef83308
1,500
PASSED
import java.util.*; public class HelloWorld { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { String[] data = scanner.nextLine().split(" "); String[] arr = scanner.nextLine().split(" "); int n = Integer.parseInt(data[0]); ...
Java
b2031a328d72b464f965b4789fd35b93
c03849b8d0a9cbc45360c4c73acfbba2
1,500
PASSED
import java.util.*; public class Lecture3_Pasha_and_Tea { private static int[] A; private static int n; private static double chk(double lim) { if (Double.compare(lim, A[0]) > 0 || Double.compare(lim * 2, A[n]) > 0) return 0; return (lim * n * 3); } public static void ...
Java
b2031a328d72b464f965b4789fd35b93
ccaf010057a011820531e6a79206f313
1,500
PASSED
import java.util.*; public class Lecture03_Pasha_and_Tea { private static int[] A; private static int n; public static void main(String[] args) { Scanner in = new Scanner(System.in); n = in.nextInt(); int w = in.nextInt(); A = new int[2*n]; for(int i = 0; i < 2...
Java
b2031a328d72b464f965b4789fd35b93
c67ef8b7b127b2a6df2514ec378fc627
1,500
PASSED
import java.io.*; import java.util.*; public class Main { static class PairComparator implements Comparator<Pair> { @Override public int compare(Pair x, Pair y) { if (x.val < y.val) return -1; if (x.val > y.val) return 1; if (x.val == y.val) { if (x.ind < y.ind) return -1; if (x.ind...
Java
b2031a328d72b464f965b4789fd35b93
af1bf04af650440aa13806e6a1aeeaeb
1,500
PASSED
#include<stdio.h> #include<string.h> #include<math.h> #define MAXN 100005 int next[MAXN],exkmp[MAXN]; char str[MAXN]; int sum[MAXN]; int m; int a[MAXN],b[MAXN]; int min(int x,int y) { return x<y?x:y; } int main(){ scanf("%s",str); int n=strlen(str),i,k; for (i=1,k=0; i<n; ++i){ int p=0; if (k+next[k]-1>=i) p=m...
C
3fb70a77e4de4851ed93f988140df221
b9a3f7e4859967f89ecf1d2897096def
2,000
PASSED
/* * 432D: Prefixes and Suffixes * TOPIC: suffix automata * status: */ #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define L(k) ((k) & ((~(k))+1ULL)) #define BIT(k) (1ULL<<(k)) #define MASK(k) (BIT(k)-1ULL) #define TST(u,k) ((u)&BIT(k)) #define SET(u,k) ((u)|=BIT(k)) #define A 26 ...
C
3fb70a77e4de4851ed93f988140df221
b4719d5807e71c70a69d7ee90a17117f
2,000
PASSED
import java.io.*; import java.util.*; // press Ctrl+Shift+L for all shortcut key (Eclipse only !) public class Solution { static MyScanner sc; static PrintWriter pw; public static void main(String[] args) { sc=new MyScanner(); pw=new PrintWriter(System.out); int i; String inp=sc.nextLine(); int lps[]=new ...
Java
3fb70a77e4de4851ed93f988140df221
17edbe8109ce43a5cbc0b1bba2d0c694
2,000
PASSED
////package CodeForce; import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Z1 { static int[] A; static int[] S; static long[] sum; public static int mod=1000000007; static int[][] dp; static boolean[][] isPalin; static int max1=5000...
Java
3fb70a77e4de4851ed93f988140df221
49dd7896f326803ea724c6cacbaca1f5
2,000
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class Solution { public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); String s = br.readLine(); in...
Java
3fb70a77e4de4851ed93f988140df221
883718802577b1896b2c82eb49865847
2,000
PASSED
import java.io.*; import java.math.*; import java.util.*; import static java.util.Arrays.fill; import static java.lang.Math.*; import static java.util.Arrays.sort; import static java.util.Collections.sort; public class D432 { public static int mod = 1000000007; public static long INF = (1L << 60); static FastS...
Java
3fb70a77e4de4851ed93f988140df221
5002c28174f3f8907402857e21c9c51d
2,000
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.sql.Array; import java.util.*; import java.util.stream.Stream; public class AtCoder implements Runnable { static final int MOD = (int) 1e9 + 7; static final Reader in = new Read...
Java
3fb70a77e4de4851ed93f988140df221
a67eaceb83528f7a7156b59b25393f96
2,000
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.sql.Array; import java.util.*; import java.util.stream.Stream; public class AtCoder implements Runnable { static final int MOD = (int) 1e9 + 7; static final Reader in = new Read...
Java
3fb70a77e4de4851ed93f988140df221
a7bea952ff49b1607fd6c7349df503ed
2,000
PASSED
import static java.lang.Math.* ; import static java.util.Arrays.* ; import java.util.*; import java.io.*; public class Main { TreeMap<Character , Integer> [] next ; int [] link , len , cnt ; int idx , last ; void addLetter(char c) { int curr = ++idx, p = last; len[curr] = len[p] + 1;...
Java
3fb70a77e4de4851ed93f988140df221
6e2332a0f77ebbb6e699ed09d09cd3e1
2,000
PASSED
import static java.lang.Math.*; import static java.util.Arrays.* ; import java.util.*; import java.io.*; public class B { int [] ans ; void KMP (char [] s) { int n = s.length; int [] pi = new int [n + 1] ; ans = new int [n + 1] ; for(int i = 1 , j = 0 ; i < n ; i++) ...
Java
3fb70a77e4de4851ed93f988140df221
2af47f1a9ea64ebf8acb626377942b9b
2,000
PASSED
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; const int MaxN = 1005; int n,m,a,b,mp[MaxN][MaxN],mx[MaxN][MaxN],mx2[MaxN][MaxN]; LL sum[MaxN][MaxN]; int q[MaxN],id[MaxN],f,r; struct Node { LL w; int x,y; }p[MaxN*MaxN]; int pCnt; bool cmp(const Node &p1,co...
C++
3395e1d40b1384dec8e5718fd787c992
30e8fd8402821981d632b983b0a27f17
2,500
PASSED
// 10 monthes remaining for red =D #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <queue> #define pb(a) push_back(a) #define mp(a,b) make_pair(a,b) using namespace std; typedef long long LL; const int N = 1005; int ...
C++
3395e1d40b1384dec8e5718fd787c992
2560fab406030df2b55931500f88d7da
2,500
PASSED
#include <algorithm> #include <cstdio> #include <list> #include <vector> #include <utility> using namespace std; typedef long long ll; #define rep1(i,n) for(int i=1;i<=(n);i++) #define MAX 1024 int n, m, a, b, min1[MAX][MAX], min2[MAX][MAX], h[MAX][MAX]; bool built[MAX][MAX]; ll sum[MAX][MAX]; int main() { scanf( ...
C++
3395e1d40b1384dec8e5718fd787c992
d8a2a1e69e41a8372797336995ddd5c6
2,500
PASSED
#include <stdio.h> #include <stack> #include <vector> #include <algorithm> using namespace std; #define min(x,y) (x<y?x:y) int a,b,n,m; int t[1002][1002]; long long s[1002][1002]; int g[1002][1002]; bool f[1002][1002]; struct elem { int xm,m; long long s,xs; elem(int xm_, long long xs_, int m_, long long s_){xm=x...
C++
3395e1d40b1384dec8e5718fd787c992
5a86c308c3a9367752c10efceed05a28
2,500
PASSED
#include <stdio.h> #include <stack> #include <vector> #include <algorithm> using namespace std; #define min(x,y) (x<y?x:y) int a,b,n,m; int t[1002][1002]; long long s[1002][1002]; int g[1002][1002]; bool f[1002][1002]; struct elem { int xm,m; long long s,xs; elem(int xm_, long long xs_, int m_, long long s_){xm=x...
C++
3395e1d40b1384dec8e5718fd787c992
edb31aa54503f19f0a1753e63d2443d4
2,500
PASSED
#include <stdio.h> #include <stack> #include <vector> #include <algorithm> using namespace std; #define min(x,y) (x<y?x:y) int a,b,n,m; int t[1002][1002]; long long s[1002][1002]; int g[1002][1002]; bool f[1002][1002]; struct elem { int xm,m; long long s,xs; elem(int xm_, long long xs_, int m_, long long s_){xm=x...
C++
3395e1d40b1384dec8e5718fd787c992
33a3a6ed0a9c11cca51eb46035a6077a
2,500
PASSED
#include <stdio.h> #include <stack> #include <vector> #include <algorithm> using namespace std; #define min(x,y) (x<y?x:y) int a,b,n,m; int t[1002][1002]; long long s[1002][1002]; int g[1002][1002]; bool f[1002][1002]; struct elem { int xm,m; long long s,xs; elem(int xm_, long long xs_, int m_, long long s_){xm=x...
C++
3395e1d40b1384dec8e5718fd787c992
5e646faa9795fb63b006f46f74c917e2
2,500
PASSED
#include <stdio.h> #include <stack> #include <vector> #include <algorithm> using namespace std; #define min(x,y) (x<y?x:y) int a,b,n,m; int t[1002][1002]; long long s[1002][1002]; int g[1002][1002]; long long r[1002][1002]; int f[1002][1002]; struct elem { int xm,m; long long s,xs; elem(int xm_, long long xs_, in...
C++
3395e1d40b1384dec8e5718fd787c992
8bafb93d9d06c51121a60e0abd944576
2,500
PASSED
#include<iostream> #include<stdio.h> #include<algorithm> #include<set> using namespace std ; typedef pair<int,int> P ; #define MAXN 1002 int n,m,a,b,c[MAXN][MAXN] ; int sz ; pair<long long,P> val[MAXN*MAXN] ; int row_min[MAXN][MAXN],tab_min[MAXN][MAXN] ; long long sum[MAXN][MAXN] ; long long get_sum(int x1,int y1,int ...
C++
3395e1d40b1384dec8e5718fd787c992
22395be5fc0770ae8ff8b049f8de73e8
2,500
PASSED
//The more knowledge you have, the happier you will be. //code by This_poet #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<cctype> #include<deque> #include<queue> #include<vector> #include<string> #include<map> #include<set> #include<cstdlib> #include<ctime> #include<...
C++
3395e1d40b1384dec8e5718fd787c992
dafe754cf67f98c2595b84884e4628f6
2,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef unsigned long long ull; int n,m,a[200010],b[200010]; ull A,B,C,buf[20],s[200010],ss[200010],ans; vector<int> v1[200010],v2[200010]; int main() { scanf("%d%d%llu%llu%llu",&n,&m,&A,&B,&C); for(int i=1,x,y;i<=m;i++) { scanf("%d%d",&x,&y); v1[x].push_back(y); v1...
C++
a79566533d656ce25b2f777c756bff01
3a915f124feed4aa94b7aa1250a09719
2,700
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef complex<ld> cd; typedef pair<int, int> pi; typedef pair<ll,ll> pl; typedef pair<ld,ld> pd; typedef vector<int...
C++
a79566533d656ce25b2f777c756bff01
191ebc25d839e5811722fc40ba5bd6b3
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define F first #define S second #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 trav(a, x) for(auto& a : x) #define allin(a , x) for(auto a : x) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typede...
C++
a79566533d656ce25b2f777c756bff01
a0761eb1a42533f7dce1318c0f820059
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define int ull typedef unsigned long long ull; const int MAXN=2E5+10; int n,m,du[MAXN]; unsigned char vis[MAXN]; vector<int> g[MAXN],v[2][MAXN]; pair<int,int> E[MAXN]; ull sum1[MAXN],sum2[MAXN],Ans,A,B,C,n2,Ans1,Ans2,Ans3,s[MAXN],ss[MAXN]; inline bool judge(const int ...
C++
a79566533d656ce25b2f777c756bff01
cb111a338fcd2f447c8daa6343c40e5c
2,700
PASSED
/* DHUOJ solution #368240 @ 2018-11-03 20:03:47.507 */ #include <bits/stdc++.h> #define rep(i,x,y) for(register int i=x;i<=y;++i) using namespace std; typedef unsigned long long ull; typedef long long ll; const int N=2e5+20; ull a,b,c,n,m; ull u[N],v[N],ans; ull s1[N],s2[N],s3[N]; vector<int> g[N],f[N]; template<type...
C++
a79566533d656ce25b2f777c756bff01
1cdcc3d538f08f736cf9e9996fbc2901
2,700
PASSED
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ull n, m; cin >> n >> m; ull A, B, C; cin >> A >> B >> C; vector<vector<int>> adj; adj.resize(n); for (ull i = 0; i < m; i++) { int u,...
C++
a79566533d656ce25b2f777c756bff01
ae7e286f26e3f1d403e97421b60c26b1
2,700
PASSED
#include<bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned ll #define db double #define pint pair<int,int> #define mk make_pair #define pb push_back #define eb emplace_back #define ins insert #define fi first #define se second #define Rep(x,y,z) for(int x=y;x<=z;x++) #define Red(x,y,z) for...
C++
a79566533d656ce25b2f777c756bff01
04b13da24479c54112ead4e7eeda01b1
2,700
PASSED
#include<bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned ll #define db double #define pint pair<int,int> #define mk make_pair #define pb push_back #define eb emplace_back #define ins insert #define fi first #define se second #define Rep(x,y,z) for(int x=y;x<=z;x++) #define Red(x,y,z) for...
C++
a79566533d656ce25b2f777c756bff01
7a9290d853acf24fe4cea81ec9b58b86
2,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; const int Maxn = 200005; int n, m; ull ea[Maxn], eb[Maxn]; ull N; ull A, B, C; vector <int> neigh[Maxn]; ull res; ull Count(ull l, ull r) { return r - l + ull(1); } ull Sum(ull l, ull r) { return (l + r) * Count(l, r) / ull(2); } ull ...
C++
a79566533d656ce25b2f777c756bff01
bce9af1a355022942774dee5b3693767
2,700
PASSED
#include <cstdio> #include <algorithm> #include <vector> using namespace std; const int N = 200001; vector<int> map[N]; int countrange(int idx, int l, int r) { return lower_bound(map[idx].begin(), map[idx].end(), r) - lower_bound(map[idx].begin(), map[idx].end(), l); } typedef unsigned long long ull; ull sum(...
C++
a79566533d656ce25b2f777c756bff01
a4d765a4a6cc0ea5adda615641fa3f1b
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int N=1e5+5; int main(){ int n;scanf("%d",&n); int a[N],Min=0,i; for(i=1;i<=n;i++){ scanf("%d",&a[i]); if(a[i]>=0)a[i]=-a[i]-1; if(Min==0)Min=i; else{ if(a[Min]>a[i])Min=i; } }if(n%2)a[Min]=-a[Min]-1; for(i=1;i<=n;i++){ printf("%d ",a[i]); } }
C++
b0561fee6236f0720f737ca41e20e382
55f4e392e83654af58059cc51988a7c5
1,500
PASSED
#include <iostream> using namespace std; int abs(int x) { if(x<0) return -x; else return x; } int main() { int n,j,ne=0,no=0,me=0,mo=0,c1=0; cin>>n; int a[n+1],b[n+1]; b[0]=0; a[0]=0; for(j=1;j<=n;j++) { cin>>a[j]; if(!a[j]) a[j]=-1; if(a[j]<0) ...
C++
b0561fee6236f0720f737ca41e20e382
5958e5e07c59fa24f11f8b040edcb627
1,500
PASSED
/*Intern lgaa aage aurr mehnat krna h */ #include <bits/stdc++.h> #define ll long long int #define si1(a) scanf("%d",&a) #define si2(a,b) scanf("%d%d",&a,&b) #define si3(a,b,c) scanf("%d%d%d",&a,&b,&c) #define sil1(a) scanf("%lld",&a) #define sil2(a,b) scanf("%lld%lld",&a,&b) #define sil3(a,b,c) scanf("%lld%lld%lld",&a...
C++
b0561fee6236f0720f737ca41e20e382
47d016de92c860d70cf6561ae42fbded
1,500
PASSED
#include<bits/stdc++.h> using namespace std; struct node{ int id; int num; }a[110000]; bool cmp1(node x,node y) { return x.num<y.num; } bool cmp2(node x,node y) { return x.id<y.id; } int main() { int n; int x,i,j; int l1=0; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&x); a[i].id=i; a[i].num=x; i...
C++
b0561fee6236f0720f737ca41e20e382
8fd75338421e0873ea4a7d2b0844f0db
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define N 100005 struct node{ int v,pos; }a[N]; int n; bool cmp1(node x,node y){ return x.v<y.v; } bool cmp2(node x,node y){ return x.pos<y.pos; } signed main(){ scanf("%lld",&n); int x=0,y=0,xx=0,z; for(int i=1;i<=n;i++){ scanf("%lld",&a[i].v);...
C++
b0561fee6236f0720f737ca41e20e382
d9f7345041e410552d304694a577c5d7
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define N 100005 struct node{ int v,pos; }a[N]; int n; bool cmp1(node x,node y){ return x.v<y.v; } bool cmp2(node x,node y){ return x.pos<y.pos; } signed main(){ scanf("%lld",&n); int x=0,y=0,xx=0,z; for(int i=1;i<=n;i++){ scanf("%lld",&a[i].v);...
C++
b0561fee6236f0720f737ca41e20e382
4211394567012f9ac26317a28315d932
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long #define s(args...); { scan(args); } #define sd(args...); ll args; s(args); #define sda(a,n); ll n; cin>>n ; ll a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]; #define sa(a,n) ll a[n]; for...
C++
b0561fee6236f0720f737ca41e20e382
16613780b4b5f84847bd839b341497d0
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long #define s(args...); { scan(args); } #define sd(args...); ll args; s(args); #define sda(a,n); ll n; cin>>n ; ll a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]; #define sa(a,n) ll a[n]; for...
C++
b0561fee6236f0720f737ca41e20e382
a1de7eb8414894a241a5df75a189e790
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long int n,i,count=0; cin>>n; vector <pair<long int,long int>> pos,neg,ans; for(i=0;i<n;i++){ long int a; cin>>a; if(a>=0) neg.push_back({-a-1,i}); else neg.push_back({a,i}); } sort(neg....
C++
b0561fee6236f0720f737ca41e20e382
5789c2431d0e4d65a98b3f6eccb302a8
1,500
PASSED
#include <bits/stdc++.h> using namespace std; main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> v(n); for (int i=0;i<n;i++) cin >> v[i]; if (n != 3 || (v[0] != -3 || v[1] != -3 || v[2] != 2)){ for (int i=0;i<n;i++){ if (v[i] >= 0) v[i]...
C++
b0561fee6236f0720f737ca41e20e382
f403d73a2e3253363606119411679edf
1,500
PASSED
#include<bits/stdc++.h> #define ll long long #define w(t) int t; cin>>t; while(t--) #define f(N) long N; cin>>N; long a[N]; for(int i=0;i<N;i++){cin>>a[i];} using namespace std; int main() { w(t) { int n,k,s=0; cin>>n>>k; int a[n],b[n]; for(int i=0;i<n;i++) { cin>>a[i]; ...
C++
7c2337c1575b4a62e062fc9990c0b098
571e83d61396e7eedfc2550d0215236b
800
PASSED
#include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define vi vector<int> #define mii map<int,int>...
C++
7c2337c1575b4a62e062fc9990c0b098
5703275ee8c1226bbf47e07cf3de6bd0
800
PASSED
// https://codeforces.com/contest/1353/problem/A #include <bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n,k; cin>>n>>k; vector<int>a(n),b(n); for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n;i++)cin>>b[i]; sort(a.begin(),a.end());...
C++
7c2337c1575b4a62e062fc9990c0b098
cce42da4fd67ddd1e03efe0555400a51
800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll t; cin>>t; while(t--) { ll n,k; cin>>n>>k; ll a[n]; ll b[n]; ll i; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) cin>>b[i]; sort(a,a+n); sort(b,b+n); ll pa=0; ll pb=n-1; ll sum=0; ll temp=0; for(...
C++
7c2337c1575b4a62e062fc9990c0b098
eb8bb256a5825da8bef9178d2fad5c19
800
PASSED
#include<bits/stdc++.h> using namespace std; // fun(int arr[],int b[],int n) // { // } int main() { int T; cin >> T; while(T--) { int n,k; cin >> n >> k; int a[n],b[n]; for(int i=0;i<n;i++) { cin >> a[i]; } for(int i=0;i<n;i++) { cin >> b[i]; } int sum1=0; for(int i=0;i<n;i+...
C++
7c2337c1575b4a62e062fc9990c0b098
fbd0cb51e99582d432ea5bec4cf96d5f
800
PASSED
#include<bits/stdc++.h> using namespace std; // fun(int arr[],int b[],int n) // { // } int main() { int T; cin >> T; while(T--) { int n,k; cin >> n >> k; int a[n],b[n]; for(int i=0;i<n;i++) { cin >> a[i]; } for(int i=0;i<n;i++) { cin >> b[i]; } int sum1=0; for(int i=0;i<n;i+...
C++
7c2337c1575b4a62e062fc9990c0b098
113e2289428cfe98ca85f0ba060bf477
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; int a[30],b[30],i,j,k,n,x; cin>>t; for(i=0;i<t;i++) { cin>>n>>k; int suma=0,sumb=0; for(j=0;j<n;j++) { cin>>a[j]; suma+=a[j]; } for(j=0;j<n;j++) { ...
C++
7c2337c1575b4a62e062fc9990c0b098
4f36e812787c0bbe7fdfb4c1fe1062c3
800
PASSED
#include <bits/stdc++.h> #include <vector> #include <algorithm> using namespace std; bool f(int x,int y){ return x>y; } int main(){ int t; cin>>t; for(int i=0;i<t;i++){ int n,k; vector<int> A={}; vector<int> B={}; cin>>n>>k; for(int i=0;i<n;i++){ ...
C++
7c2337c1575b4a62e062fc9990c0b098
4bf7a2016d24586ef81061c41bc1759e
800
PASSED
#include <iostream> #include <algorithm> using namespace std; typedef long long ll; int main() { #ifdef ks freopen("a.in", "r", stdin); #endif ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while(t--){ int n, k; cin >> n>> k; int a[n+1], b[n+1]; ...
C++
7c2337c1575b4a62e062fc9990c0b098
d7e11d96664fd7f1c29ebcb7bfc28f9a
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t, n, k; cin>>t; while(t--){ cin>>n>>k; vector <int> a(n); vector <int> b(n); for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++) cin>>b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end(), greater<int>()...
C++
7c2337c1575b4a62e062fc9990c0b098
a11a51bdb67d71155108a0b03a184206
800
PASSED
#include<bits/stdc++.h> #define pa pair<int,int> #define all(a) begin(a),end(a) using namespace std; int n,x; map<int,int> ma; vector<pa> v; long long Ran(){ long long a=rand(); long long b=rand(); return a*(RAND_MAX+1ll)+b; } int query(int a,int b,int c){ cout<<"? "<<a<<' '<<b<<' '<<c<<'\n'; return cin>>x,x; } vo...
C++
f413f65186ec202bc75809985fba1222
c4af72817e0b7ccea8711316c7e01c49
3,000
PASSED
#include <iostream> #include <fstream> #include <cmath> #include <unordered_map> #include <random> #include <ctime> #define maxn 200005 int height, n; void readInput(){ std::cin >> height; n = (1<<height) - 1; } int freq[300000]; void randomQuery(){ for(int i=0, node; i<420; i++){ int a, b, c; ...
C++
f413f65186ec202bc75809985fba1222
c8f6216e21a54bfc047f8f1a20debbd4
3,000
PASSED
// C++ includes used for precompiling -*- C++ -*- // Copyright (C) 2003-2014 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free So...
C++
f413f65186ec202bc75809985fba1222
d9e0a1d78aa6d46b175f6a72301a6a62
3,000
PASSED
#include <bits/stdc++.h> using namespace std; #ifdef Adrian #include "debug.h" #else #define debug(...) 9999 #endif typedef long long ll; typedef long double ld; typedef complex<ll> point; #define F first #define S second #define ii pair<ll,ll> template<typename G1, typename G2 = G1, typename G3 = G1> struct triple{...
C++
f413f65186ec202bc75809985fba1222
38ae23bbfd673f5a85fced9376746e0c
3,000
PASSED
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } void ran() { srand(chrono::steady_clock::now().time_since_epoch().count()); } long long get_rand() { long long a = rand(); long long b = rand(); return a * (RAND_MAX + 1ll) + b; } void usaco() {...
C++
f413f65186ec202bc75809985fba1222
0320d420db6db907bb5beabcc31fb314
3,000
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <random> #include <assert.h> #include <vector> #include <set> using namespace std; #define int long long #define maxn (1<<20) int c[maxn]; vector<int> idx; struct query { int u, v, w; bool operator< (const query& o) const { if(u ...
C++
f413f65186ec202bc75809985fba1222
7d4c3516b18f0114a584a10d07e6dca0
3,000
PASSED
#include <bits/stdc++.h> int main() { using namespace std; ios_base::sync_with_stdio(false), cin.tie(nullptr); int H; cin >> H; const int N = (1 << H) - 1; auto query = [&](array<int, 3> a) -> int { if (a[0] == a[1]) return a[0]; if (a[1] == a[2]) return a[1]; if (a[0] == a[2]) return a[0]; cout <<...
C++
f413f65186ec202bc75809985fba1222
36da15b0e2567146100f3b4337d26841
3,000
PASSED
#include <bits/stdc++.h> #define gc() std::getchar() #define pc(i) std::putchar(i) #define enter '\n' #define space ' ' #define RE cout << "Passing [" << __FUNCTION__ << "] on " << __LINE__ << enter #define DEBUG(...) for(auto &i: __VA_ARGS__) cout << i << " "; cout << enter using std::make_pair; template <typename T...
C++
f413f65186ec202bc75809985fba1222
69569731a3e4a717cc5021fb4e4d52f5
3,000
PASSED
#include<bits/stdc++.h> using namespace std; mt19937 rnd(time(0)); int main(){ int n,h; scanf("%d",&h); n = 1<<h; n--; map<int,int> mapa; vector<pair<int,int> > frec(n+1); int x; int c1,c2,c3,u,v,w; srand(time(NULL)); for(int i = 0; i < 420; i++){ u = 1LL*rnd()%n+1; v = 1LL*rnd()%n+1; w = 1LL*rnd()%n+1; ...
C++
f413f65186ec202bc75809985fba1222
960c3c16f639eca401fe11c13038453a
3,000
PASSED
#include <iostream> #include <fstream> #include <cmath> #include <unordered_map> #include <random> #include <ctime> #define maxn 200005 int height, n; void readInput(){ std::cin >> height; n = (1<<height) - 1; } int freq[300000]; void randomQuery(){ for(int i=0, node; i<420; i++){ int a, b, ...
C++
f413f65186ec202bc75809985fba1222
2395bd6fbcfea391253b68af21ee8d9e
3,000
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long int64; typedef unsigned long long uint64; typedef pair<int, int> pii; typedef pair<int64, int64> pll; const int INF = (int)(1e9 + 1337); const int64 LINF = (int6...
C++
288874bf65b7b314a978422ba4d360e7
5fa26d5bdc757f62df9f5d02b16bf403
2,900
PASSED
#include<iostream> #include<string> #include<algorithm> #include<cstdlib> #include<cstdio> #include<set> #include<map> #include<vector> #include<cstring> #include<stack> #include<queue> #define INF 2147483640 #define eps 1e-9 #define MAXN 0x3f #define N 100005 using namespace std; int n,m,k,x,y,q,s[6*N],ch[6*N][2],f[N]...
C++
288874bf65b7b314a978422ba4d360e7
5d738ed22adcc07f78011f006524bc5b
2,900
PASSED
#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<stack> using namespace std; const int MAXN=100005; const int BLOCK=325; struct DSU { int n,fa[MAXN],ra[MAXN],cnt; stack<pair<int*,int> >stk; void Init(int _n) { n=cnt=_n; ...
C++
288874bf65b7b314a978422ba4d360e7
eb32f770960bf334553656afe1c82ff3
2,900
PASSED
#include <bits/stdc++.h> using namespace std; const int kMaxN = 2e5; struct DSU { int n, fa[kMaxN], rk[kMaxN], cnt; stack<pair<int*, int> >stk; void Init(int n) { this -> n = this->cnt = n; for(int i = 1; i <= n; i++) fa[i] = i, rk[i] = 0; while(!stk.empty()) ...
C++
288874bf65b7b314a978422ba4d360e7
7f1f035d19df06a8f3dce8bebf0c6432
2,900
PASSED
#include<bits/stdc++.h> #define ll long long #define ull unsigned ll #define uint unsigned #define pii pair<int,int> #define pll pair<ll,ll> #define IT iterator #define PB push_back #define fi first #define se second #define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++) #define Rep(i,j,k) for (int i=(int)(j);i>=(int)...
C++
288874bf65b7b314a978422ba4d360e7
cb001bfe8936ecec05c4cbbb9984d300
2,900
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10; const int L=21; int n, len, m, q; vector<int> e[maxn]; int c[maxn<<2], fa[L][maxn], bits[maxn<<2], used[L][maxn]; set<int> s1, s2; int tmp[maxn]; inline int read() { int x=0,ch; while (ch=getchar(),!isdigit(ch)); while (isdigit(ch)) x=(x...
C++
288874bf65b7b314a978422ba4d360e7
457bc5f9902f68aeb629ed73aeb5137a
2,900
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10; const int L=21; int n, len, m, q; vector<int> e[maxn]; int c[maxn<<2], fa[L][maxn], bits[maxn<<2], used[L][maxn]; set<int> s1, s2; int tmp[maxn]; inline int read() { int x=0,ch; while (ch=getchar(),!isdigit(ch)); while (isdigit(ch)) x=(x...
C++
288874bf65b7b314a978422ba4d360e7
91d57113d55c943587b01b2159760698
2,900
PASSED
#include <bits/stdc++.h> using namespace std; #define PII pair<int, int> const int CHUNK = 400; class DSU { public: DSU(int n) { dad = vector<int> (n, 0); sz = vector<int> (n, 0); for(int i = 0; i < n; ++i) { dad[i] = i; sz[i] = 1; } memory = fal...
C++
288874bf65b7b314a978422ba4d360e7
a2115a85b4658192b0ada41e3e36c8f2
2,900
PASSED
//in the name of allah #include<vector> #include<iostream> #include<map> #include<bitset> #include<algorithm> #include<set> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<deque> #include<ctime> #include<cstdlib> #include<cassert> using namespace std; typedef pair<int , int> ii; typedef pai...
C++
288874bf65b7b314a978422ba4d360e7
93679bd91cd134c8e8a9921f66d09049
2,900
PASSED
#include <bits/stdc++.h> using namespace std; const int SQRT = 420; const int maxn = 100009; bool edge[maxn][6]; struct Q { int l, r; int ind; } q[maxn]; bool comp(Q a, Q b) { if (a.l / SQRT == b.l / SQRT) return a.r < b.r; return a.l < b.l; } int dsu_par[maxn], dsu_par1[maxn]; int dsu_timer[maxn];...
C++
288874bf65b7b314a978422ba4d360e7
546f870f65c24eae7a27438e596a116b
2,900
PASSED
// Problem : E. K-periodic Garland // Contest : Codeforces - Codeforces Round #642 (Div. 3) // URL : https://codeforces.com/contest/1353/problem/E // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include<bits/stdc++.h> #define int long long #define pii p...
C++
8b28309055f13837eb1f51422fb91029
4ac1e1911823882ea8a0022abcec65a0
1,900
PASSED
// Problem : E. K-periodic Garland // Contest : Codeforces - Codeforces Round #642 (Div. 3) // URL : https://codeforces.com/contest/1353/problem/E // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include<bits/stdc++.h> #define int long long #define pii p...
C++
8b28309055f13837eb1f51422fb91029
b5dc6d0975237c09b403f9d40e6b2a23
1,900
PASSED
// Problem : E. K-periodic Garland // Contest : Codeforces - Codeforces Round #642 (Div. 3) // URL : https://codeforces.com/contest/1353/problem/E // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) // Long solution but understandable #include<bits/stdc++.h...
C++
8b28309055f13837eb1f51422fb91029
5597d6f743d9be8c392b2d998898b97e
1,900
PASSED
#include<bits/stdc++.h> using namespace std; int dp[1000005][2]; int n,k; char s[1000005]; int pre[1000005]; int main() { int t;cin>>t; while(t--) { cin>>n>>k;cin>>(s+1); for(int i=1;i<=n;i++) { if(s[i]=='1') { pre[i]=pre[i-1]+1; } else { pre[i]=pre[i-1]; } dp[i][0]=0x3f3f3f3f;dp[i...
C++
8b28309055f13837eb1f51422fb91029
a45b95c8a51777f1a73aad8cd3cfd4d1
1,900
PASSED
#include<bits/stdc++.h> using namespace std; char s[1000006]; int n,k,duan; int t; int cnt; int sum;int ans=0x3f3f3f3f; int main() { cin>>t; while(t--) { cin>>n>>k;cin>>s+1;sum=0;ans=0x3f3f3f3f; for(int i=1;i<=n;i++) { if(s[i]=='1')sum++; } for(int j=1;j<=k;j++) { int cnt=0; for(int i=j;i<=n;i+=...
C++
8b28309055f13837eb1f51422fb91029
dc495a83ecdea9b5e53c6c673ffffc5b
1,900
PASSED
#include<bits/stdc++.h> #define endl '\n' #define null NULL #define ls p<<1 #define rs p<<1|1 #define fi first #define se second #define mp make_pair #define pb push_back #define ll long long #define int long long #define vi vector<int> #define mii map<int,int> #define pii pair<int,int> #define ull unsigned long long #...
C++
8b28309055f13837eb1f51422fb91029
e75cd4c94179085ae60001cbb4cd9974
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define eb emplace_back #define ii pair<int, int> #define OK (cerr << "OK" << endl) #define debug(x) cerr << #x " = " << (x) << endl #define ff first #define ss second #define int long long #define tt tuple<int, int, int, int> #define all(x) x.begin(), x.end() #define Mat...
C++
8b28309055f13837eb1f51422fb91029
a6526ce2665ea6365fb698b9d8894bc0
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector< ll > vi; typedef vector< vi > vvi; typedef pair< ll,ll > pl; #define pb push_back #define fori(i,a,b) for(i=a;i<b;i++) #define ford(i,a,b) for(i=a;i>b;i--) #define getv(a) fori(i,0,a.size()) cin>>a[i]; #define putv(a) for(auto x : a...
C++
8b28309055f13837eb1f51422fb91029
1afdac15fe8629112734f594f95fc0ce
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector< ll > vi; typedef vector< vi > vvi; typedef pair< ll,ll > pl; #define pb push_back #define fori(i,a,b) for(i=a;i<b;i++) #define ford(i,a,b) for(i=a;i>b;i--) #define getv(a) fori(i,0,a.size()) cin>>a[i]; #define putv(a) for(auto x : a...
C++
8b28309055f13837eb1f51422fb91029
aa31bf0e92a694c3d67d565911ff16a7
1,900
PASSED
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <map> #include <unordered_map> #include <set> #include <queue> #include <memory> #include <functional> #include <stdarg.h> #include <vector> #include <math.h> #include <assert.h> #include <stack> #include <climits> using namespace std...
C++
8b28309055f13837eb1f51422fb91029
7bfe831b5e37435c8f0472695d85d7fb
1,900
PASSED
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <cmath> using namespace std; typedef int ll; typedef pair<ll,ll> pll; #define For(i,a,b) for(ll i = (a); i < (b); i++) #define Dow(i,a,b) for(ll i = (a); i >= (b); i--) #define pb push_back #define mp make_pair #de...
C++
6daeb2165d4173e3d66266596789dc56
03a453572f43e54e81b7938cf9b6ae64
2,200
PASSED
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <cmath> using namespace std; typedef int ll; typedef pair<ll,ll> pll; #define For(i,a,b) for(ll i = (a); i < (b); i++) #define Dow(i,a,b) for(ll i = (a); i >= (b); i--) #define pb push_back #define mp make_pair #de...
C++
6daeb2165d4173e3d66266596789dc56
3d9fd42bf8074ed8c12337e528dabd80
2,200
PASSED
//enot.1.10 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <algorithm> #include <cmath> #include <vector> #include <map> #include <set> #include <cassert> #include <ctime> #define fs first #define sc second #define pb push_back #define mp make_pair #define sz(a) (...
C++
6daeb2165d4173e3d66266596789dc56
fc8105fda3670989934d4159bd0c7af0
2,200
PASSED
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <cmath> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; #define For(i,a,b) for(ll i = (a); i < (b); i++) #define Dow(i,a,b) for(ll i = (a); i >= (b); i--) #define pb push_back #define mp make_pa...
C++
6daeb2165d4173e3d66266596789dc56
5e37ea551f3ded9b13a637702bbd3873
2,200
PASSED
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <cmath> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; #define For(i,a,b) for(ll i = (a); i < (b); i++) #define Dow(i,a,b) for(ll i = (a); i >= (b); i--) #define pb push_back #define mp make_pa...
C++
6daeb2165d4173e3d66266596789dc56
7625c0441cf68476c4edee3794a9be18
2,200
PASSED
#include <iostream> #include <fstream> #include <cstring> #include <string> #include <cstdlib> #include <cstdio> #include <algorithm> #include <cmath> #include <bitset> #include <ctime> #include <map> #include <queue> #include <set> using namespace std; const int maxn=100000+15; struct Node { int t,s,f,num; long lon...
C++
6daeb2165d4173e3d66266596789dc56
08e56b5fdf3e7836c2c6becf70043c00
2,200
PASSED
#include<cstring> #include<cstdlib> #include<algorithm> #include<iostream> #include<set> #include<vector> #include<cstdio> #define inf 1000000000000000ll using namespace std; typedef long long ll; struct node{int f[2],t,cur;}a[100005]; int cmpt(int i,int j){return a[i].t<a[j].t;} struct cmp{int operator()(int i,int j){...
C++
6daeb2165d4173e3d66266596789dc56
343570277c5c8646c32c716ae771111c
2,200
PASSED
#include <algorithm> #include <cstring> #include <cstdlib> #include <cstdio> #include <vector> #define N 100010 #define mk(x,y) make_pair(x,y) #define fi first #define se second #define int64 long long #define For(i,x,y) for (i=x;i<=y;i++) using namespace std; struct ww { int s,f,id; int64 t; } a[N]; int i,j,k,n,m,no...
C++
6daeb2165d4173e3d66266596789dc56
d91f2568bc0d6d54ccf3094081eb1a14
2,200
PASSED
#include <set> #include <cstdio> #include <vector> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; typedef pair<int, int> PI; typedef vector<int>::iterator Vi; typedef set<int>::iterator Si; const int N = int(2e5 + 5); int T[N], n, m, total, ord[N]; int u[N], v[N], t[N]; LL ans[N];...
C++
6daeb2165d4173e3d66266596789dc56
f1e96b826d224f35956b6eb53c6a4bf6
2,200
PASSED
/* * @Author: 逸闲 * @Date: 2016-06-30 20:45:42 * @Last Modified by: 逸闲 * @Last Modified time: 2016-07-01 11:41:51 */ #include "cstdio" #include "cstdlib" #include "iostream" #include "algorithm" #include "cstring" #include "queue" #include "set" using namespace std; #define INF 0x3F3F3F3F #define MAX_SIZE 100005 ...
C++
6daeb2165d4173e3d66266596789dc56
c2ed9fd469ff3282c344c36e0c9df432
2,200
PASSED