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 <string> #include <deque> #include <algorithm> #include <functional> #include <map> #include <bitset> #include <iomanip> #include <list> #include <set> #include <deque> #include <unordered_map> #include <unordered_set> #include <numeric> using namespace std; #define FOR(i,...
C++
b3038ba22e3442c142a99f485dd55308
652ab67be57e540325689c63db537f9a
2,800
PASSED
#include<cstdio> #include<cstring> #include<queue> #include<vector> #include<iostream> #include<cstdio> #include<map> #include<string> //#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const int SIGMA_SIZE = 26; const int MAXNODE = 1000010; // 结点总数 struct AhoCorasickAutomata { int ch[MA...
C++
b3038ba22e3442c142a99f485dd55308
0dbf57d60812a1b1b54b25c02ffd53ad
2,800
PASSED
#ifdef NALP_PROJECT #pragma hdrstop #endif #define _CRT_SECURE_NO_DEPRECATE #pragma comment(linker, "/STACK:64000000") #include <cstdio> #include <cstdlib> #include <ctime> #include <cctype> #include <cmath> #include <algorithm> #include <utility> #include <set> #include <map> #include <vector> #include <string> #in...
C++
b3038ba22e3442c142a99f485dd55308
4e14ed52580fd78152d5a65982a0072e
2,800
PASSED
#include<ctype.h> #include<stdio.h> #include<algorithm> #include<vector> using namespace std; void SWARE(bool f) {if(!f)for(;;)puts("Welcome to Rock'n Roll Night!!");} #define NMAX 100000 #define QMAX 100000 const int LMAX=1000000+1000000+NMAX+QMAX;//2200000 #define BMAX 8388608 int qL,qR,qX,qA; int N,Q; int L; vecto...
C++
b3038ba22e3442c142a99f485dd55308
19825a4ac4305a1711350fd5b29d8cfd
2,800
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <numeric> #include <string> #include <cstring> #include <set> #include <map> #include <vector> #include <queue> #include <iostream> #include <iterator> #include <cmath> #include <cstdio> #include <cstdlib> #include <sstream> using namespace std; #define RE...
C++
b3038ba22e3442c142a99f485dd55308
6b477c2e2b15adf784e5204d30bf8d85
2,800
PASSED
#include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cmath> #include <iomanip> #include <deque> #include <vector> #include <queue> #include <string> #include <cstring> #include <map> #include <stack> #include <set> #include <sstream> #define IOS ios_base::sync_with_stdio(0); cin.tie(0...
C++
de57b6b1aa2b6ec4686d1348988c0c63
9d43b682b8d39c89b6fbec9f00ed29ba
1,500
PASSED
#include <bits/stdc++.h> #define ll long long int #define loop(a,n) for(ll i=a;i<n;i++) #define pb push_back using namespace std; const ll mod = 1e9+7; bool prime(ll s) { if (s <= 1) return false; if (s <= 3) return true; if (s%2 == 0 || s%3 == 0) return false; for (ll i=5; i*i<=s; i=i+6) if (s%...
C++
de57b6b1aa2b6ec4686d1348988c0c63
e804df504dd3fb3d671dddd565d9c86a
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin>>t; while(t--) { int n,i,num=1,x; cin>>n; string s; cin>>s; vector <int> arr(n); stac...
C++
de57b6b1aa2b6ec4686d1348988c0c63
9dec908f1f8607f332c10abd02fcdf1a
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int ans[200005]; char c1[200005]; int main(int argc, char const *argv[]) { int t,n; scanf("%d",&t); while(t--) { scanf("%d",&n); scanf("%s",&c1); memset(ans,0,sizeof(ans)); queue<int>q0,q1; int len = strlen(c1); for (int i = 0,t; i < len; ++i) { t = (...
C++
de57b6b1aa2b6ec4686d1348988c0c63
86a28087a2166a09c495aa4b01e7054f
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef double db; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<db,db> pdb; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<ll> vl; typedef vector<db> vd; typedef vector<string> vs; typedef ve...
C++
de57b6b1aa2b6ec4686d1348988c0c63
ae7e4b96eff38b5e8d3e287fa45f7726
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int ans[200010]; int main() { int T; cin>>T; while (T--) { int n; cin>>n; for (int i=0;i<n;++i) ans[i]=0; string s; cin>>s; int k=0; queue<int>q0, q1; for (int i=0;i<n;++i)...
C++
de57b6b1aa2b6ec4686d1348988c0c63
155dc237d99de02440d24cebf5379cf2
1,500
PASSED
#include<bits/stdc++.h> using namespace std; inline void read(int &x){ x=0;int f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();} x=x*f; } const int N=4e5+10; int cnt,bel[N],tot; queue<int>q[2]; int main(){ int t;read(t); whi...
C++
de57b6b1aa2b6ec4686d1348988c0c63
e0cf41cfa8a047ba88dc820556b3533e
1,500
PASSED
#include<bits/stdc++.h> using namespace std; inline void read(int &x){ x=0;int f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();} x=x*f; } const int N=4e5+10; int cnt,bel[N],tot; queue<int>q[2]; int main(){ int t;read(t); whi...
C++
de57b6b1aa2b6ec4686d1348988c0c63
3748e47a27a3df91682c62b40e7da65b
1,500
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 200010; int T, n; char s[maxn]; vector<int> rec[2]; int ans, bel[maxn], avail[2]; int bs(int arr[], int e, int left, int right) { int mid = (left + right) / 2; return left >= right ? right : e <= arr...
C++
de57b6b1aa2b6ec4686d1348988c0c63
174c49242c9c5e8e720280478ae6d047
1,500
PASSED
#include<cstdio> #include<queue> #include<cstring> #include<iostream> using namespace std; queue<int> q1,q0; int b[200005]; int main(){ int n,t; string s; scanf("%d",&t); while(t--) { while(!q0.empty()) q0.pop(); while(!q1.empty()) q1.pop(); int cnt=0; scanf("%d",&n); cin>>s; for(int j=0;j<n;j++) { ...
C++
de57b6b1aa2b6ec4686d1348988c0c63
187bda9ed78c506435a7fedb66dff6a9
1,500
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> using namespace std; #define M 1009 int dx[4] = {0,0,1,-1}; int dy[4] = {1,-1,0,0}; int mk[M][M]; bool vis[M][M]; char mp[M][M]; int num[M]; int n,m,k; int sum; int dfs(int a,int b,int clck) { vis[a][b] =...
C++
cfdcfe449868ed50516f0895bf6a66e1
d8efc79e2acce9916383d52dc626fb6b
1,700
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<map> #include<algorithm> #include<queue> #define mem(a,b) memset(a,b,sizeof(a)); #define ll long long using namespace std; const int INF=0x3f3f3f3f; const int Max1=1e6+10; int d[4][2]= {{-1,0},{0,-1},{1,0},{0,1}}; int dd[8][2]= {{-2,-1},{-1,-2},{1,-2},{2,-1...
C++
cfdcfe449868ed50516f0895bf6a66e1
76a4ddbd6aa95ebffa9203e11dbda55f
1,700
PASSED
#include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <set> #include <map> #define memset(a,n) memset(a,n,sizeof(a)) using namespace std; typedef long long LL; const int MAXX = 1e3+10; char c[MAXX][MAXX]; int vis[MAXX][MAXX]; int v[MAXX][MAXX]; int no[MAXX*MAXX]; int cn...
C++
cfdcfe449868ed50516f0895bf6a66e1
931e2b0ec966de0ea62b63ef66ad8d84
1,700
PASSED
#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<cstdlib> #include<cmath> #include<stack> #include<queue> #include <vector> #include <utility> #define PI acos(-1) #define mem(a, b) memset(a, b, sizeof(a)) int dir8[8][2] = {{1, -2}, {2, -1}, {2, 1}, {1, 2}, {-2, -1}, {-1, -2}, {-2, 1}, ...
C++
cfdcfe449868ed50516f0895bf6a66e1
e180731381f862f12189d400fcc29ab1
1,700
PASSED
//E #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<queue> #include<stack> #include<deque> #include<map> #include<iostream> using namespace std; typedef long long LL; const double pi=acos(-1.0); const double e=exp(1); //const int MAXN =2e5+10; const int N =332748118; ...
C++
cfdcfe449868ed50516f0895bf6a66e1
7a57bad0c60e8ffa64a6915be9dcbfdd
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int LL; const int N = 1010; const int M = 1000010; int a[M]; int blockNum; int pointNum; int edgeNum; char mp[N][N]; int tag[N][N]; int dir[4][2]={{1,0},{0,1},{-1,0},{0,-1} }; int cal(int x, int y){ int i,tx,ty,cnt=0; for(i=0;i<4;i++){ tx ...
C++
cfdcfe449868ed50516f0895bf6a66e1
b9bc86a489a12e8fe387902bce837080
1,700
PASSED
#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<cstdlib> #include<cmath> #include<stack> #include<queue> #define PI 3.1415926535 #include<functional> #include<vector> #define MAXN 1005 #include <iostream> #include <cstring> #include <cstdio> #include <queue> using namespace std; //co...
C++
cfdcfe449868ed50516f0895bf6a66e1
524ef6adf3145c31a2603e39133b8d50
1,700
PASSED
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<queue> using namespace std; #define MAXN 0x3f3f3f3f typedef long long ll; char mapp[1055][1055]; ll sign[1055][1055]; ll m,n,T,x,y,sum[1000005],num=0; struct node { ll x,y; } nod; ll dx[4]= {-1,0,0,1}; ll dy[4]= {0,-1,1,0}; queue<no...
C++
cfdcfe449868ed50516f0895bf6a66e1
158ba00b26d6c8648b60dcc619d32455
1,700
PASSED
#include <iostream> #include <queue> #include <cstring> #include <cstdio> using namespace std; struct node { int x; int y; } ans,ans1; char a[1001][1001]; int x0[5]= {1,-1,0,0}; int y0[5]= {0,0,1,-1}; int vis[1001][1001]; int ANS; int n,m; int num[1001*1001]; int x1,y1,i,cnt; void bfs(int x,int y) { ANS=0; ...
C++
cfdcfe449868ed50516f0895bf6a66e1
69cd89740f4ee0723380ab5d66822461
1,700
PASSED
#include <iostream> #include <string> #include <cstring> #include <exception> #include <algorithm> #include <cmath> #include <queue> #include <set> #include <cstdio> using namespace std; typedef long long ll; int n,m,k; char a[1010][1010]; int e=1; int dir[4][2]={0,1,0,-1,1,0,-1,0}; int gg[1010][1010]={0}; int vis[101...
C++
cfdcfe449868ed50516f0895bf6a66e1
a7513e25bffc4dc81816ba5ae43adc66
1,700
PASSED
lever = input().split("^") leftWeight = 0 for d in range(len(lever[0])): if lever[0][d] != "=": leftWeight += int(lever[0][d])*(len(lever[0])-d) rightWeight = 0 for d in range(len(lever[1])): if lever[1][d] != "=": rightWeight += int(lever[1][d])*(d+1) if leftWeight > rightWeight: print("left") if right...
Python
19f2c21b18e84f50e251b1dfd557d32f
d36fa9385ce03251c358eb8d5febc507
900
PASSED
x=input() ind=x.index("^") w1=x[0:ind] w2=x[ind+1:] left=0 right=0 for i in range (0,ind): if (x[i]== "="): left+=0 else: left+=(int(x[i]))*(ind-i) for j in range (ind+1,len(x)): if (x[j]=="="): right+=0 else: right+=(int(x[j]))*(j-ind) if (left>right): print ("le...
Python
19f2c21b18e84f50e251b1dfd557d32f
3a00330efae92bfeae30058c799ad49b
900
PASSED
reg=input(); a=reg.index("^"); sum=0; for i in range(0,len(reg)): if (reg[i:i+1]!="^" and reg[i:i+1]!="="): sum+=(a-i)*int(reg[i:i+1]); if sum==0: print("balance"); else: if sum>0: print ("left"); else: print("right");
Python
19f2c21b18e84f50e251b1dfd557d32f
ff8964f06971a38c1a40d7e4038694db
900
PASSED
S = input() digits = [1, 2, 3, 4, 5, 6, 7, 8, 9] answer = '' mid = S.find('^') digits_sum1, digits_sum2 = 0, 0 for i in range(mid): if S[i].isdigit(): digits_sum1 += int(S[i]) * (mid - i) for i in range(mid, len(S)): if S[i].isdigit(): digits_sum2 += int(S[i]) * abs(mid - i) if digits_sum...
Python
19f2c21b18e84f50e251b1dfd557d32f
3e253b1af9e643c35b616ddba1616a4f
900
PASSED
a=input() p=a.index('^') c=sum((i-p)*int(y) for i,y in enumerate(a) if y.isdigit()) print([['balance','right'][c>0],'left'][c<0])
Python
19f2c21b18e84f50e251b1dfd557d32f
ed8f1ee83762f50b880e39cbfbf08e52
900
PASSED
s=input() sum=0 mid=s.index('^') for i in range(len(s)): if s[i]=='=' or s[i]=='^': continue else: sum+=int(s[i])*(i-mid) if sum>0: print('right') elif sum<0: print('left') else: print('balance')
Python
19f2c21b18e84f50e251b1dfd557d32f
e00dc0b6b8ca3faee4a5a7e7b6ed3e7b
900
PASSED
a=gets.chomp.split('') s=0 len=a.length for i in 0..len-1 if a[i]=='^' break end end for j in 0..len-1 if a[j]!='=' s+=a[j].to_i*(i-j) end end puts s>0? "left" : s==0? "balance" : "right"
Ruby
19f2c21b18e84f50e251b1dfd557d32f
6db06e23cdcded63e7b7f0c26a7deefc
900
PASSED
s = gets.chomp mid = s.index "^" left = 0 right = 0 (0...mid).each do |i| left += (mid - i) * s[i].to_i if s[i] != '=' end ((mid + 1)...s.length).each do |i| right += (i - mid) * s[i].to_i if s[i] != '=' end ans = right <=> left case ans when 0 puts "balance" when 1 puts "right" else puts "left" end...
Ruby
19f2c21b18e84f50e251b1dfd557d32f
c49733d190f43706248913df28a1b5ff
900
PASSED
class Weights attr_accessor :string, :balance def initialize(value) raise "Node value shouldn't be nil or empty" if value.nil? @string = value end def balance left, right = @string.split("^") left = left.reverse left_weight = weigh(left) right_weight = weigh(right) if left_weig...
Ruby
19f2c21b18e84f50e251b1dfd557d32f
650416a4a40c6b73991a668087d0b67e
900
PASSED
left,right = gets.split("^") left.reverse! sum_arr = [] i = 1 sum = 0 left.each_char do |l| sum += l.to_i * i if l != '=' i += 1 end sum_arr << sum i = 1 sum = 0 right.each_char do |r| sum += r.to_i * i if r != '=' i += 1 end sum_arr << sum # puts "#{sum_arr}" if sum_arr[0] == sum_arr[1] ans = "balance" elsif s...
Ruby
19f2c21b18e84f50e251b1dfd557d32f
7ba5167c7d4d9476225cfed6ce492e14
900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); int T; cin >> T; while (T--) { int x,y,xx,yy; cin >> x >> y >> xx >> yy; int xd = abs(x-xx); int yd = abs(y-yy); int other = xd != 0 && yd != 0 ? 2 : 0; cout << (xd + yd + other) << '\n'; } ...
C++
6a333044e2ed8f9f4fa44bc16b994418
ceb2f020dc47f7f5a7c45be80890d96f
800
PASSED
#include <bits/stdc++.h> using namespace std; struct show { #ifdef pRePrOcEsSoR_MaCro template<typename V, typename T> static void d(V name,T begin,T end){cout<<"DEBUG: "<<name<<" = [";while(begin!=end) {cout<<(*begin);++begin;if(begin!=end)cout<<", ";}cout<<"]\n";} template<typename V, typename T> static void d...
C++
6a333044e2ed8f9f4fa44bc16b994418
a5accd7851ff080f0073e6d864fbf396
800
PASSED
#include <bits/stdc++.h> using namespace std; struct show { #ifdef pRePrOcEsSoR_MaCro template<typename V, typename T> static void d(V name,T begin,T end){cout<<"DEBUG: "<<name<<" = [";while(begin!=end) {cout<<(*begin);++begin;if(begin!=end)cout<<", ";}cout<<"]\n";} template<typename V, typename T> static void dm(V na...
C++
6a333044e2ed8f9f4fa44bc16b994418
0f9eb110f7d24ea09221fef6ac675af3
800
PASSED
#include <bits/stdc++.h> using namespace std; struct show { #ifdef pRePrOcEsSoR_MaCro template<typename V, typename T> static void d(V name,T begin,T end){cout<<"DEBUG: "<<name<<" = [";while(begin!=end) {cout<<(*begin);++begin;if(begin!=end)cout<<", ";}cout<<"]\n";} template<typename V, typename T> static void d...
C++
6a333044e2ed8f9f4fa44bc16b994418
5de3186f6c3eb52dd4beffaa5231175b
800
PASSED
#include <bits/stdc++.h> using namespace std; struct show { #ifdef pRePrOcEsSoR_MaCro template<typename V, typename T> static void d(V name,T begin,T end){cout<<"DEBUG: "<<name<<" = [";while(begin!=end) {cout<<(*begin);++begin;if(begin!=end)cout<<", ";}cout<<"]\n";} template<typename V, typename T> static void dm(V n...
C++
6a333044e2ed8f9f4fa44bc16b994418
ed2593c362d66221e3e9145f99ae9101
800
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); ll t; ll x1, y1, x2, y2; cin >> t; while (t--) { cin >> x1 >> y1 >> x2 >> y2; ll ans = abs(x2 - x1) + abs(y2 - y1); if (y2 != y1 && x1 != x2) { ans += 2; } cout << ans << endl; ...
C++
6a333044e2ed8f9f4fa44bc16b994418
1d4dcb0a16f541a8aef92aee735c7cf2
800
PASSED
/*Ве№И P6823*/ //#include<bits/stdc++.h> //#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); //using namespace std; //typedef long long ll; //const int maxn=1e5+5; //int num[maxn]; //int main() //{ // IOS // int n,m; // cin >> n >> m; // int l,r,op; // for(int i=1; i <= n; i++) num[i]=i...
C++
6a333044e2ed8f9f4fa44bc16b994418
28fe5dc19b43fe2f995085d23d823a8a
800
PASSED
//~ while (clock()<=69*CLOCKS_PER_SEC) //~ #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") //~ #pragma GCC target ("avx2") //~ #pragma GCC optimize("Ofast") //~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //~ #pragma GCC optimize("unroll-loops") #include <bits/st...
C++
6a333044e2ed8f9f4fa44bc16b994418
8960b715c59c3d4863c9142728b2c674
800
PASSED
//~ while (clock()<=69*CLOCKS_PER_SEC) //~ #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") //~ #pragma GCC target ("avx2") //~ #pragma GCC optimize("Ofast") //~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //~ #pragma GCC optimize("unroll-loops") #include <bits/...
C++
6a333044e2ed8f9f4fa44bc16b994418
a5ef58203ab928216121f0e6d8b41d56
800
PASSED
//~ while (clock()<=69*CLOCKS_PER_SEC) //~ #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") //~ #pragma GCC target ("avx2") //~ #pragma GCC optimize("Ofast") //~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //~ #pragma GCC optimize("unroll-loops") #include <bits/s...
C++
6a333044e2ed8f9f4fa44bc16b994418
ceb98acc4f6f4da54fddc3892b640109
800
PASSED
#include<bits/stdc++.h> #define int long long #define pb push_back #define ppb pop_back #define si set <int> #define endl '\n' #define fr first #define sc second #define mii map<int ,int > #define msi ...
C++
422cbf106fac3216d58bdc8411c0bf9f
3fc5311b396b85573c33bef63ff689c9
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int m; long int n; cin>>n>>m; long int a[m]; for(int i=0;i<m;i++) cin>>a[i]; int q=0; sort(a,a + m); if(a[0]==1 || a[m-1]==n) { cout<<"NO"; q=1; } else { int c=a[1]-a[0]; for(...
C++
422cbf106fac3216d58bdc8411c0bf9f
fa5d08754f416f70b0f644965706af4f
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; int c[b]; for(int i=0;i<b;++i) cin>>c[i]; sort(c,c+b); if(c[0]==1||c[b-1]==a) cout<<"NO"; else { int e=c[0]-1,f,g=0,h=0; for(int i=1;i<b;++i) { if(c[i]-c[i-1]...
C++
422cbf106fac3216d58bdc8411c0bf9f
1035d6d35e0436e830ae996ea5fdc19b
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; int c[b]; for(int i=0;i<b;++i) cin>>c[i]; sort(c,c+b); if(c[0]==1||c[b-1]==a) cout<<"NO"; else { int e=c[0]-1,f,g=0,z=0; for(int i=1;i<b;++i) { if(c[i]-c[i-1]...
C++
422cbf106fac3216d58bdc8411c0bf9f
e72e76f721bb2a221de093eeb62ef6d7
1,100
PASSED
#include <iostream> #include <string.h> #include <bits/stdc++.h> using namespace std; int main() { int n,d; cin>>n; cin>>d; int arr[d]; for(int i=0;i<d;i++){ int temp; cin>>temp; arr[i] = temp; } char ans[3]; strcpy(ans, "YES"); int s = sizeof(arr)/sizeof(a...
C++
422cbf106fac3216d58bdc8411c0bf9f
4ca0b63a1aad56febd31894a6e43ae2c
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define lli long long #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL) #define modulo 1000000007 int main() { lli i,j,k,n,m; cin>>n>>m; map<lli,lli> d; lli a[m]; for(i =0;i<m;i++) { ...
C++
422cbf106fac3216d58bdc8411c0bf9f
446beaece255d0367b67436033eccae5
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define lli long long #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL) #define modulo 1000000007 int main() { lli i,j,k,n,m; cin>>n>>m; map<lli,lli> d; lli a[m]; for(i =0;i<m;i++) { ...
C++
422cbf106fac3216d58bdc8411c0bf9f
beeea62556ac86531ecbd3c760b57f51
1,100
PASSED
#include <bits/stdc++.h> #include<algorithm> #define ll long long int using namespace std; int main() { ll n,m; cin>>n>>m; ll a[m]; for (int i = 0; i < m; ++i) { cin>>a[i]; } sort(a,a+m); ll count=0; if(m==1) { if(a[0]==1||a[m-1]==n) count++; else if(a[0]==n) count++; } else if(m<=3)...
C++
422cbf106fac3216d58bdc8411c0bf9f
1399d86bf43cdf973a0787f9e351dc5c
1,100
PASSED
#include <bits/stdc++.h> #define tc long long t; scanf("%lld",&t); while(t--) #define f(ii,jj,nn) for(int ii=jj;ii<nn;ii++) #define sl(x) scanf("%lld",&x) #define sll(x,y) scanf("%lld %lld",&x,&y) #define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z) #define pl(x) printf("%lld\n",x) #define pf(x) printf("x\n") #define m...
C++
422cbf106fac3216d58bdc8411c0bf9f
02e7b8ef1b809c4c07991b91536b548f
1,100
PASSED
#include <bits/stdc++.h> using namespace std; long long n, ans, mi, ma, c, x, y, f[500000], m, cur, t[500000]; vector <long long> v; int main () { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; for(int i = 0;i < m;i++){ cin >> t[i]; } sort(t,t+m); cur = 1; //cout << endl; for(int i = 1...
C++
422cbf106fac3216d58bdc8411c0bf9f
bd4b85c1f26630fa684583480a1fddaf
1,100
PASSED
#include <bits/stdc++.h> #include <iostream> using namespace std; #define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl; #define Get(x,y) scanf("%I64d%I64d",&x,&y); #define is_bit(x,y) (x%(1<<(y+1))>=(1<<y)) #define f_(i,a,b) for(int i=a;i>=b;i--) #define Gett(x,y) scanf("%d%d",&x,&y); #define f(i,a,b) for(int i=a;i<...
C++
0f18382d450be90edf1fd1a3770b232b
b7e4f1016d4d80984be456e692808173
1,600
PASSED
#include<iostream> #include<math.h> using namespace std; int main(){ int i = 0, t, n, r, a, b, m = 0, k, j = 0; cin>>t; while(t--){ cin>>n>>k; int arr[n][n]; for(i = 0; i < n; i++){ for(j = 0; j < n; j++) arr[i][j] = 0; } i = 0; j = 0; m...
C++
0f18382d450be90edf1fd1a3770b232b
6d5a77a4a90782a883ee9f7008fa077a
1,600
PASSED
#include <bits/stdc++.h> const int MAXN=305; int T,n,k,i,j,x,y; bool a[MAXN][MAXN]; inline void read(int &x) { short negative=1; x=0; char c=getchar(); while(c<'0' || c>'9') { if(c=='-') negative=-1; c=getchar(); } while(c>='0' && c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar(); x...
C++
0f18382d450be90edf1fd1a3770b232b
9ea37835331709dc789663baef2830a8
1,600
PASSED
// Problem : D. Grid-00100 // Contest : Codeforces - Codeforces Round #654 (Div. 2) // URL : https://codeforces.com/contest/1371/problem/D // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) // writer: w33z8kqrqk8zzzx33 #include <bits/stdc++.h> using namespa...
C++
0f18382d450be90edf1fd1a3770b232b
7c5a591e3392a56d22dd3059df18b573
1,600
PASSED
# include <bits/stdc++.h> # define rr const int N=310,INF=0x3f3f3f3f; int n,k; int ans[N][N]; int H[N*5],L[N*5]; inline int read(void){ int res,f=1; char c; while((c=getchar())<'0'||c>'9') if(c=='-')f=-1; res=c-48; while((c=getchar())>='0'&&c<='9') res=res*10+c-48; return res*f; } int main(void){ int T=read(...
C++
0f18382d450be90edf1fd1a3770b232b
d7048b8c35084a56fa53e645f54f9174
1,600
PASSED
#include <bits/stdc++.h> #define For(i,a,b) for ( int i=(a);i<=(b);i++ ) #define Dow(i,b,a) for ( int i=(b);i>=(a);i-- ) #define GO(i,x) for ( int i=head[x];i;i=e[i].nex ) #define mem(x,s) memset(x,s,sizeof(x)) #define cpy(x,s) memcpy(x,s,sizeof(x)) #define YES return puts("YES"),0 #define NO return puts("NO"),0 #defin...
C++
0f18382d450be90edf1fd1a3770b232b
7fa23d65c8fbca4f6954b7d9faad0006
1,600
PASSED
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define r_rep(i,a,b) for(int i=a;i>b;i--) #define pb(x) push_back(x) #define endl '\n' const int MAXN = 300 + 10; using namespace std; typedef long long ll; int n, k, ans; int a[MAXN][MAXN]; void process(){ cin >> n >> k; if(k == 0 || k % n == 0) ...
C++
0f18382d450be90edf1fd1a3770b232b
6e63358cd4bd51e3bc5f61f2ea28f3a8
1,600
PASSED
#include<iostream> using namespace std; int grid[300][300]; int n,k; int findans(){ //cout<<k%n<<endl; if(k%n==0)return 0; else return 2; } void show(){ for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cout<<grid[i][j]; } cout<<"\n"; } } void print(){ int left=k%n; int prediv=k-left; int div=prediv/n-1; fo...
C++
0f18382d450be90edf1fd1a3770b232b
f997e47384ceca7e07b8851b22fe9229
1,600
PASSED
// User: el_heffeh // Date: 7/1/20 #include <bits/stdc++.h> using namespace std; int n, k, q, r; void solve() { cin >> n >> k; q = k / n, r = k % n; cout << (r == 0 ? 0 : 2) << endl; vector<string> s(n, string(n, '0')); for (int i = 0; i < n; ++i) { for (int j = i; j < i + q + (i < r); ++j) { s[i][j % n] ...
C++
0f18382d450be90edf1fd1a3770b232b
c1c9719b055aafa3edd28be3722da790
1,600
PASSED
#include<iostream> #include<cstring> using namespace std; int t; int n,q; bool a[305][305]={0}; int ans; int main(){ int i,j,k; cin>>t; for(i=0;i<t;i++){ memset(a,0,sizeof(a)); cin>>n>>q; int times=0; j=0; for(j=1;j<=n;j++){ for(k=j;k<=j+n-1;k++){ ...
C++
0f18382d450be90edf1fd1a3770b232b
9b632b8c83e2015b5f60f1a41a236550
1,600
PASSED
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; /* Once a legend said : "Tries matlab string manipulation...for other info, go to page number 352 of the book." */ public class Main implements Runnable { public boolean required(char[] s) { ...
Java
dfe0f5da0cb90706f33365009d9baf5b
b637fe5b47e35e5a80801fa6c9b3a393
2,100
PASSED
import java.io.*; import java.util.*; import java.lang.*; public class SolD{ public static void main(String[] args){ Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n = sc.nextInt(); long k = sc.nextLong(); String s = sc.next(); char[] ch...
Java
dfe0f5da0cb90706f33365009d9baf5b
6b37738be245a56e323df45f98438457
2,100
PASSED
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { static class Task { int NN = 200005; int MOD = 1000000007; int INF = 2000000000; long INFINITY = 2000000000000000000L; public void solve(InputReader in, PrintWriter out) { int n = in.nextInt(); int k = in.nex...
Java
dfe0f5da0cb90706f33365009d9baf5b
362d0bc5b304ac79766de46c0c7bc3eb
2,100
PASSED
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import java.util.TreeSet; public class Solve5 { public static void...
Java
dfe0f5da0cb90706f33365009d9baf5b
09be004dcd59f0d73aa36019a708b0f6
2,100
PASSED
import java.io.*; import java.util.*; public class CF1333D extends PrintWriter { CF1333D() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1333D o = new CF1333D(); o.main(); o.flush(); } static class V { V next; int i; V(int i) { this.i = i; } } ...
Java
dfe0f5da0cb90706f33365009d9baf5b
c4259b6ee1bc4be94b704d2a4a6d3fa5
2,100
PASSED
// upsolve with kaiboy import java.io.*; import java.util.*; public class CF1333D extends PrintWriter { CF1333D() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1333D o = new CF1333D(); o.main(); o.flush(); } void main() { int n = sc.nextInt(); int k = s...
Java
dfe0f5da0cb90706f33365009d9baf5b
a6f6eccf1683975e547ebf673a6addc4
2,100
PASSED
import java.io.IOException; import java.io.InputStream; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); StringBuilder sb = new StringBuilder(); int i, j; int n = in.nextInt(); ...
Java
dfe0f5da0cb90706f33365009d9baf5b
d6cf617e6df1e73af6534c814dc12307
2,100
PASSED
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1333d { public static void main(String[] args) throws IOException { int n = rni(), k = ni(), cnt = 0; char[] s = rcha(); long maxk = 0; for (int i = 0; i < n; ++i...
Java
dfe0f5da0cb90706f33365009d9baf5b
ed95e064cc4a42df5086b2438e680d66
2,100
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.util.InputMismatchException; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.BufferedOutputStream; import java.util.StringTokenizer; impo...
Java
dfe0f5da0cb90706f33365009d9baf5b
2e4c257c537bfd70c2505ae30bddfcf4
2,100
PASSED
import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class D { static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); int k = in.nextInt(); String str = in....
Java
dfe0f5da0cb90706f33365009d9baf5b
0d323c011191a97dab8c81955f1a3a7c
2,100
PASSED
/*mohammadreza motabar*/ #include<bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define pb push_back typedef pair<int,int> pii; const ll MAX_N = 1e5+10,INF = 1e9; int n,m,a[MAX_N],l[MAX_N],r[MAX_N],sq,cnt[MAX_N],ans,so[MAX_N],an[MAX_N]; bool cmp(int x,int y){ if(l[x]/sq<l[y]...
C++
5c92ede00232d6a22385be29ecd06ddd
451d2f5d920624eeb38975b54211af6b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define ll int #define pb push_back #define mp make_pair #define mod 1000000007 #define MAX 10000001 #define all(x) x.begin(),x.end() ll fpow(ll n, ll k, ll p = mod) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n ; n = n * n ;} return r;} ll inv(ll a, ll p = mod) {retur...
C++
5c92ede00232d6a22385be29ecd06ddd
d653e1869f806adc3e5ddd8dc60fa90c
1,800
PASSED
#include<bits/stdc++.h> #define MAXN 100010 using namespace std; int freq[MAXN+1],arr[MAXN+1],sol[MAXN+1],block; pair<pair<int,int>,int> pr[MAXN+1]; bool comp(pair<pair<int,int>,int> &q1,pair<pair<int,int>,int> &q2){ if((q1.first.first/block)!=(q2.first.first/block)) return q1.first.first/block<q2.first.first/block;...
C++
5c92ede00232d6a22385be29ecd06ddd
bcd2a37efdd17908d231282e4ec3f3c5
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define F first #define S second typedef long long ll; const int maxn=1e5+3; int a[maxn],cnt[maxn],ps[maxn][600],l,r,ans; vector<int >vec; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m,i=1,j; cin>>n>>m; while(i<=n){ cin>>a[i]; if(a[i]<=1e5+1...
C++
5c92ede00232d6a22385be29ecd06ddd
ca2296fe84c094595f2def906fc7ed63
1,800
PASSED
#include<bits/stdc++.h> #define MAX 100007 using namespace std; struct str { int l,r,pos; }; int s,co=0,in[MAX],mp[MAX],res[MAX]; vector<str>v; bool operator<(str a,str b) { if(a.l/s==b.l/s) return a.r<b.r; return (a.l/s<b.l/s); } void add(int i) { int x=in[i]; if(x==-1) return; ...
C++
5c92ede00232d6a22385be29ecd06ddd
16452fb4cf221ce3c7f8acb82564f99a
1,800
PASSED
#include<bits/stdc++.h> #define MAX 100007 using namespace std; struct str { int l,r,pos; }; int s,co=0,in[MAX],res[MAX]; unordered_map<int,int>mp; vector<str>v; bool operator<(str a,str b) { if(a.l/s==b.l/s) return a.r<b.r; return (a.l/s<b.l/s); } void add(int i) { int x=in[i]; if(x==-1...
C++
5c92ede00232d6a22385be29ecd06ddd
19a80e5d22d50e0456f22b642b5e9693
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int blk_sz = 300; const int MAXN = 1e5 + 7; struct Query { int l, r, idx; bool operator < (Query a) { if (l / blk_sz == a.l / blk_sz) { return r < a.r; } return (l / blk_sz) < (a.l / blk_sz); } }; vector<Query> queries; int a[MAXN], ans[M...
C++
5c92ede00232d6a22385be29ecd06ddd
ae799d5bc94a60ff36bafe0a88957f8b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; const ll N=1e5+7; const ll MOD=1e9; const ll INF=1e9+5;//INF*INF< ll64_MAX #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); struct node{ int ans=0,l,r,i; }; int n,m; node seg[4*N]; node merge(node a,node b){ node c; c.ans=a...
C++
5c92ede00232d6a22385be29ecd06ddd
5d648e909b6168a218f36d7836f7a673
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; const ll N=1e5+7; const ll MOD=1e9; const ll INF=1e9+5;//INF*INF< ll64_MAX #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); struct node{ ll a,i,ans; }; void pre(){ } void solve(ll kk){ int n,m; cin>>n>>m; vector<int> a(n...
C++
5c92ede00232d6a22385be29ecd06ddd
40dd17198ae48d6dedd28735c5ea1ab5
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; const ll N=1e5+7; const ll MOD=1e9; const ll INF=1e9+5;//INF*INF< ll64_MAX #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); struct node{ int ans=0,l,r,i; }; int n,m; node seg[4*N]; node merge(node a,node b){ node c; c.ans=a...
C++
5c92ede00232d6a22385be29ecd06ddd
3912d379892985b7d2b1de585173f67e
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; const int N=2e5+5; ll tree[N<<2],lazy[N<<2]; P wea[N],arm[N]; int b[N]; struct node { int x,y,z; bool operator <(const node b)const { return x<b.x; } }mon[N]; void build(int l,int r,int rt) { lazy[rt...
C++
f60147619b289898930a97d3ed14afab
2147a2d13102b7de292b1d6c22609ccf
2,000
PASSED
#include <iostream> #include <stdio.h> #include <cstring> #include <math.h> #include <algorithm> #include <vector> #include <climits> using namespace std; #define FAST_IO ios::sync_with_stdio(false) constexpr int maxn = 200005; typedef pair<int,int> pii; long long tree[maxn<<2], tag[maxn<<2]; int n,m,p; vector<pii> w...
C++
f60147619b289898930a97d3ed14afab
02865376a9781b003f32625f212c1a28
2,000
PASSED
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const ll INF = 2e9 + 10; struct node { int s, e, m; ll mn, mx, sum; bool lset; ll add_val, set_val; node *l, *r; node(int _s, int _e, int A[] = NULL) ...
C++
f60147619b289898930a97d3ed14afab
d6d64eedbae6749eec38457036631580
2,000
PASSED
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const ll INF = 2e9 + 10; struct node { int s, e, m; ll mn, mx, sum; bool lset; ll add_val, set_val; node *l, *r; node(int _s, int _e, int A[] = NULL) ...
C++
f60147619b289898930a97d3ed14afab
7cf6264e5f7f5a22397e979edccaaeb1
2,000
PASSED
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const ll INF = 2e9 + 10; struct node { int s, e, m; ll mn, mx, sum; bool lset; ll add_val, set_val; node *l, *r; node(int _s, int _e, int A[] = NULL) ...
C++
f60147619b289898930a97d3ed14afab
981eaed358e71ba66d0b77c6c6c9b521
2,000
PASSED
#include <cstdio> #include <cctype> #include <cstring> #include <algorithm> using namespace std; #define File(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) typedef long long ll; template<typename T> inline void gi(T &x){ char ch; x = 0; int f = 1; while(isspace(ch = getchar())); if(ch == '-') ch = g...
C++
f60147619b289898930a97d3ed14afab
d75345e3ffb74ef5c193d37061004232
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define all(v) (v).begin(), (v).end() #define sz(v) (int)(v).size() typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int N = (int)1e6 + 6; const ll INF = (ll)1e18; ll sum[4 * N]; ll mx[4 * N]; void inc(int v, int tl, int tr, int pos,...
C++
f60147619b289898930a97d3ed14afab
9c5fdb195bf43b9c5d77db885cbd3d48
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define all(v) (v).begin(), (v).end() #define sz(v) (int)(v).size() typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int N = (int)1e6 + 6; const ll INF = (ll)1e18; ll sum[4 * N]; ll mx[4 * N]; void inc(int v, int tl, int tr, int pos,...
C++
f60147619b289898930a97d3ed14afab
d1123b28efb0a86a5e1de30fc6409d27
2,000
PASSED
#include <iostream> #include <algorithm> using namespace std; const int LIM = 1000000; const int INF = 1000000000; struct S { int x, y, cost; bool operator < (const S &other) const { return x < other.x; } }; int n, m, p; int ans; int money[1000005]; pair <int, int> a[200005], b[200005]; S c[200005]; int ...
C++
f60147619b289898930a97d3ed14afab
2e79d81b45b4fd44e2a5f0ffcbc9ff1c
2,000
PASSED
#include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template...
C++
f60147619b289898930a97d3ed14afab
70c9458783cbe2c0a81cdf86064a07e6
2,000
PASSED
#include<bits/stdc++.h> #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define fi first #define sc second #define pb push_back #define tcT template<class T> #define trav(v,x) for(auto &v: x) #define lb lower_bound #define ub upper_bound #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define ...
C++
9a7e6c494ff7d161c92632569a6ecbef
73ae1075dbbdfd74eb94c3067af30225
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define int long long int #define double long double #define ff first #define ss seco...
C++
9a7e6c494ff7d161c92632569a6ecbef
ac26bd54053bc31109a47c882308fd7f
2,000
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> #define fi first #define se second #define pb push_back #define E '\n' using namespace std; const long long MOD = 1e9 + 7; int n, m; pair<int, int> rob[2020]; pair<int, int> cop[2020]; vector<pair<int, int>> vec; int suf[4000009]; int main() { ios::sync_with_...
C++
9a7e6c494ff7d161c92632569a6ecbef
9d39c65a26bb2319df87a91064bae8d5
2,000
PASSED
#pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") %:pragma GCC optimize("Ofast") %:pragma GCC optimize("inline") %:pragma GCC optimize("-fgcse") %:pragma GCC optimize("-fgcse-lm") %:pragma GCC optimize("-fipa-sra") %:pragma GCC optimize("-ftree-pre") %:pragma GCC optimize("-ftree-vrp") %:pra...
C++
9a7e6c494ff7d161c92632569a6ecbef
5bf7bba02ccbe5e077a53b19be7083ed
2,000
PASSED
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #define X first #define Y second #define mp make_pair using namespace std; void print(vector<int> a) // печать вектора в консоль { for(int i=0; i<a.size(); i++) cout<<a[i]<<" "; } int mul_mod(long long a, long ...
C++
9a7e6c494ff7d161c92632569a6ecbef
041713d0ee60a23d1b0ba1e22fe13593
2,000
PASSED