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
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _699B { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int n = int.Parse(input[0]), m = int.Pa...
C#
12a768b502ddb07798830c9728fba5c4
c959fc99db25a9321b7c772fdbacadfb
1,400
PASSED
using System; using System.Globalization; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.Threading; namespace Codeforces { class Program : ProgramBase { private const long commonMod = 1000000007; static void Main(...
C#
12a768b502ddb07798830c9728fba5c4
8921d5ee78ad37deddf5e06ccb45055a
1,400
PASSED
#include<cstdio> #include<algorithm> using namespace std; const int maxn=150010; struct{ int a,next; }s[maxn]; int bg[maxn]; int ed[maxn]; int fz[maxn]; void init(int n){ for(int i=0;i<=n;i++) bg[i]=ed[i]=i; fill(fz,fz+2+n,-1); } int find(int a){ if(bg[a]==a) return a; return bg[a]=find(bg[a]); } int main(){ in...
C++
2c665f95370058bc7fdec405db7d155d
d574c82a694c43d51ee0d7cea1a05648
1,700
PASSED
//#define __popcnt __builtin_popcount #define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" void file(){ #ifndef ONLINE_JUDGE freopen("a_input.txt", "r", stdin); freopen("a_output.txt", "w", stdout); #endif } void fast() { std::ios_base::sync_with_stdio(0...
C++
2c665f95370058bc7fdec405db7d155d
c76fb7017c740c8b2e51fb2cdc485073
1,700
PASSED
//#define __popcnt __builtin_popcount #define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" void file(){ #ifndef ONLINE_JUDGE freopen("a_input.txt", "r", stdin); freopen("a_output.txt", "w", stdout); #endif } void fast() { std::ios_base::sync_with_stdio(0...
C++
2c665f95370058bc7fdec405db7d155d
11b7d385daf5bfee1ddaea830683b3dc
1,700
PASSED
#include <bits/stdc++.h> #include<ext/rope> #define INF 0x3f3f3f3f using namespace __gnu_cxx; using namespace std; const int maxn = 150000+5; int n,pre[maxn]; int t[maxn]; int Find(int x){ return pre[x]==x?x:pre[x]=Find(pre[x]); } rope<int>ans[maxn];int flag=0; int main(){ scanf("%d",&n); for(int i=01;i<=n;...
C++
2c665f95370058bc7fdec405db7d155d
e71c3b0c3fc28ccfdb5951833e48e915
1,700
PASSED
#include <bits/stdc++.h> #define re return #define ll long long #define ull unsigned ll #define ld long double #define f first #define s second #define pi acos(-1) #define oo (ll)1e9+5 #define OO 1e18 #define EPS 1e-6 #define Endl '\n' #define FX(n) fixed<<setprecision(n) #define mm(o,k) memset(o,k,sizeof o) #define IO...
C++
2c665f95370058bc7fdec405db7d155d
4797a3e3a8840fdd2448d13802ace491
1,700
PASSED
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define ins insert #define sz(x) (long long)x.size() typedef long long ll; typedef long double ld; const int N = 1e5 + 5; const ld pi = 3.141592653; const ll MOD = 1e9 + 7; const ll mod = 998244353; const ll INF = __LONG_LONG_MAX__; using...
C++
2c665f95370058bc7fdec405db7d155d
04a0b0cdd58dff5b7d7e8f7c43463f49
1,700
PASSED
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define ins insert #define sz(x) (long long)x.size() typedef long long ll; typedef long double ld; const int N = 1e5 + 5; const ld pi = 3.141592653; const ll MOD = 1e9 + 7; const ll mod = 998244353; const ll INF = __LONG_LONG_MAX__; using...
C++
2c665f95370058bc7fdec405db7d155d
84bea58ca6daa4bff622c3f2d82969fd
1,700
PASSED
#include <bits/stdc++.h> using namespace std; long long int mod = 1e9+7; typedef long long int lli; typedef pair<lli,lli> pii; typedef vector<int> vi; typedef vector<lli> vlli; typedef vector<bool> vb; long long int max(long long int a,long long int b){ if(a>b) return a; else return b; } long long int min(l...
C++
2c665f95370058bc7fdec405db7d155d
06b712d47d21ef25688601f430292034
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define mod 1000000007 unordered_map<int,vector<int>>nodes; unordered_map<int,int>visited; int parent[1000000]={0}; int Size[1000000]={0}; set<int>can[1000000]; void bfs1(int s){ if(visited[s])return ; visited[s...
C++
2c665f95370058bc7fdec405db7d155d
3a1c495fe7deca7527bf964bb0fbde9a
1,700
PASSED
#include <bits/stdc++.h> #define mod int(1e9+7) #define INF 1e18 #define int long long using namespace std; const int N=2e5; vector<int>a[N],p(N); int last; int find(int u) { // cout <<u<<endl; if (p[u]==u)return u; else return p[u]=find(p[u]); } signed main() { ios_base::sync_with_stdio(false); cin.ti...
C++
2c665f95370058bc7fdec405db7d155d
720827f371525d55e4a693f437f93a9e
1,700
PASSED
#include<iostream> #include<map> #include<iterator> #include<string> using namespace std; int main() { int n,flag; string x; cin>>n; map<string,int>a; map<string,int>::iterator it; for(int i=0;i<n;i++) { cin>>x; if(i==0) { a.insert(pair<s...
C++
24098df9c12d9704391949c9ff529c98
eb3146d2606f12e1bf00f99affe76142
1,300
PASSED
#include <iostream> #include <cmath> #include <string> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <utility> #include <fstream> #include <cstdlib> #include <vector> #include <fstream> #include <queue> #include <stack> #include <map> using namespace std; #define fast() ios_base::sync...
C++
24098df9c12d9704391949c9ff529c98
42af742225138cbcf8360ceb290d817c
1,300
PASSED
#include <iostream> #include <cmath> #include <string> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <utility> #include <fstream> #include <cstdlib> #include <vector> #include <fstream> #include <queue> #include <stack> #include <map> using namespace std; #define fast() ios_base::sync...
C++
24098df9c12d9704391949c9ff529c98
752ae9f460f5df731b5028b9e50670ce
1,300
PASSED
#include<iostream> #include<string> #include<map> using namespace std; int main(){ map<string,int> user; long long n; cin >> n; for(int i=0; i<n; i++){ string input; cin >> input; if (user.count(input)==0){ cout << "OK\n"; user[input]=0; } else{ user[input]++; string output = input+to_string(...
C++
24098df9c12d9704391949c9ff529c98
090a2dd92c8ecdabf1951597a63954e7
1,300
PASSED
#include <iostream> #include <vector> #include <map> #include <string> int main() { int n; std::cin >> n; std::map<std::string, int> named_listed; while(n--) { std::cin.get(); char* s = new char[33]; scanf("%s", s); s[33] = '\0'; std::string str(s); i...
C++
24098df9c12d9704391949c9ff529c98
11e44c8adacbb35e2228dde71d719451
1,300
PASSED
#include <iostream> #include <string> #include <map> using namespace std; int main() { int n; cin >> n; map<string, int> database; string s; while (n--) { cin >> s; if (database.count(s) == 0) { cout << "OK" << endl; database[s] = 1; } else { cout << s << database[s] << endl; database[s...
C++
24098df9c12d9704391949c9ff529c98
7016605e7b512bea950092fd9bffec29
1,300
PASSED
#include <iostream> #include <string> #include <map> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); map<string, int> MAP; int n, i, temp = 1, T, j; string str, STR_T; cin >> n; for (i = 0; i < n; ++i) { cin >> str; if (MAP.find(str) == MAP.end()) { MAP[st...
C++
24098df9c12d9704391949c9ff529c98
b3b868f2895be71c277ffb70c03cbdc9
1,300
PASSED
#include<iostream> #include<string> using namespace std ; struct node { int t ; string s ; }; int main() { int n ; cin>>n ; string st ; int array_size = 0 ; node *ar = new node[n] ; string *a = new string[n] ; int i ; for(int j = 0 ; j < n ; j++) { cin>>st ; for(i = 0 ; i < array_size ; i++) { ...
C++
24098df9c12d9704391949c9ff529c98
f6e5f85a42014cd6d67dcc970f2d9fb5
1,300
PASSED
#include<iostream> #include<string> using namespace std ; struct node { int t ; string s ; }; int main() { int n ; cin>>n ; string st ; int sz = 0 ; node *ar = new node[n] ; string *a = new string[n] ; int i ; for(int j = 0 ; j < n ; j++) { cin>>st ; for(i = 0 ; i < sz ; i++) { if(ar[i]....
C++
24098df9c12d9704391949c9ff529c98
71d576558cdecec38b823623024a7904
1,300
PASSED
#include <iostream> #include<string> #include<map> using namespace std; int main() { int n; string str; cin>>n; map <string, int> user; while(n--){ cin>>str; if(user.count(str)==0){ cout<<"OK"<<endl; user[str]=1; } else{ cout<<str<...
C++
24098df9c12d9704391949c9ff529c98
50b7aa9e8535759d53c06c3402c99a45
1,300
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; #define int long long #define dingyi int mid = l + r >> 1, ls = p << 1, rs = p << 1 | 1 inline int read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); ...
C++
99482882707d194d397dff105307b7b0
a9482f0984e97445c477036e17833996
2,400
PASSED
#include<bits/stdc++.h> #define N 100010 #define M 200010 #define inf 0x3f3f3f3f using namespace std; typedef long long ll; const ll mod=1e9+7; struct node{ int per,to; }e[M]; int t,n,q,tot,cnt; ll head[N],fa[N],dep[N],son[N],sz[N],id[N],tag[N],bf[N],val[N]; ll dfn[N],top[N],st[N<<2],add[N<<2]; struct ios { inline...
C++
99482882707d194d397dff105307b7b0
06542d6761a2fc4968de146044213eb9
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define N 100010 #define ll long long int n, q; ll arr[N]; int ord[N], ford[N], son[N], deep[N], cnt, root; int rmq[N << 1], F[N <<1], P[N], tot; vector <int> vec[N]; struct ST { int mm[N << 1]; int dp[N << 1][20]; inline void init(int n) { mm[0] = -1; for (in...
C++
99482882707d194d397dff105307b7b0
a91af9a29cadfb3aea444668636e82d9
2,400
PASSED
#include <bits/stdc++.h> using namespace std; using ll=long long; const int N=1e5+5; struct STtree{ int ch[N][2],fa[N],rev[N]; bool not_root(int x){ // if parent(x) has a child x (solid), x is not the root of a virtual tree return ch[fa[x]][ch[fa[x]][1]==x]==x; } void update_rev(int x){ ...
C++
99482882707d194d397dff105307b7b0
99d4916715b7a1d935d8178a7eea10e8
2,400
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; #define int long long struct STtree{ static inline int ch[100005][2],fa[100005],rev[100005]; bool not_root(int x){ // if parent(x) has a child x (solid), x is not the root of a virtual tree return ch[fa[x]][ch...
C++
99482882707d194d397dff105307b7b0
c5c5be18e0b0ff34efe3575559348ca2
2,400
PASSED
#include <bits/stdc++.h> using namespace std; using ll=long long; const int N=1e5+5; struct STtree{ int ch[N][2],fa[N],rev[N]; bool not_root(int x){ // if parent(x) has a child x (solid), x is not the root of a virtual tree return ch[fa[x]][ch[fa[x]][1]==x]==x; } void update_rev(int x){ ...
C++
99482882707d194d397dff105307b7b0
fe9c244f56cd1eea64f67965d7fc25f3
2,400
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; #define int long long struct STtree{ int ch[100005][2],fa[100005],rev[100005]; bool not_root(int x){ // if parent(x) has a child x (solid), x is not the root of a virtual tree return ch[fa[x]][ch[fa[x]][1]==x]...
C++
99482882707d194d397dff105307b7b0
8e8a6491933fa74518a95bcb1e132807
2,400
PASSED
#include <bits/stdc++.h> using namespace std; using ll=long long; const int N=1e5+5; struct STtree{ int ch[N][2],fa[N],rev[N]; bool not_root(int x){ // if parent(x) has a child x (solid), x is not the root of a virtual tree return ch[fa[x]][ch[fa[x]][1]==x]==x; } void update_rev(int x){ ...
C++
99482882707d194d397dff105307b7b0
6d13858f40ee93e57725e2e3f277c663
2,400
PASSED
#include <iostream> #include <sstream> #include <algorithm> #include <cstdio> #include <cmath> #include <set> #include <map> #include <queue> #include <string> #include <cstring> #include <bitset> #include <functional> #include <random> #define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i) #define PER(_i,_a,_n) for(int _i=_...
C++
99482882707d194d397dff105307b7b0
beb714a96428a88da5993bb1fcae6ec3
2,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 100 * 1000 + 20, LG = 20; int n, q, a[N], h[N], st[N], en[N], par[N][LG], timee, root; ll seg[N << 2], lazy[N << 2]; vector<int> adj[N]; void shift(int id, int st, int mid, int en) { lazy[id << 1] += lazy[id]; lazy[id <<...
C++
99482882707d194d397dff105307b7b0
731436cd52396706a96c5f736ee4635b
2,400
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <limits> #include <cstring> #include <stack> #include <list> #include <cmath> using namespace std; #define MAXN 100005 int type[MAXN], t1m = MAXN, t0m = 0; vector<int> link[MAXN]; bool dfs(int n) { bool isok = true; if (type[n] =...
C++
b54ced81e152a28c19e0068cf6a754f6
a17951174de4fbf4ef2316e546fd0104
1,300
PASSED
#include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N = 1e5+7; int n,m; #define inf 0x3f3f3f3f int main() { int a,b; scanf("%d%d",&n,&m); int mn = n,mx = 1; for(int i = 0;i < m;i++){ scanf("%d%d",&a,&b); if(a > b) swap(a,b); if(mn <= a || mx >= b)...
C++
b54ced81e152a28c19e0068cf6a754f6
639cfda3d7c69420573c8bf4854eeb59
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n,m,x,y,a,b; cin>>n>>m; y=n,x=2; for(int i=0;i<m;i++) { cin>>a>>b; if(a>b)swap(a,b); y=min(b,y); x=max(a+1,x); } cout<<max(y-x+1,0)<<"\n"; return 0; }
C++
b54ced81e152a28c19e0068cf6a754f6
df66d2df29b8b47e5ce00c4167341dfa
1,300
PASSED
#include<stdio.h> #include<stdlib.h> #define MAX 100000 int main() { long long int n,m,i,u,v,a1=0,b1=0,c1=0,p,q,j,temp,max_a=0,min_b=1000000; scanf("%I64d %I64d",&n,&m); long long int a[MAX],b[MAX]; if(m==0) { printf("%I64d\n",n-1); return 0; } a1=0; b1=0; for(i=0;...
C++
b54ced81e152a28c19e0068cf6a754f6
54af22e14b364b1f9869e5658807857d
1,300
PASSED
#include<stdio.h> #include<stdlib.h> int main() { long long int n,m,i,u,v,c1=0,p,q,max_a=0,min_b=1000000; scanf("%I64d %I64d",&n,&m); if(m==0) { printf("%I64d\n",n-1); return 0; } for(i=0;i<m;i++) { scanf("%I64d %I64d",&u,&v); if(u<=v) { ...
C++
b54ced81e152a28c19e0068cf6a754f6
6d77ec8bdc50598fbb26903b22b80a8d
1,300
PASSED
#include <algorithm> #include <cstdio> #include <utility> using namespace std; const int MAXN = 1e5; bool d2[MAXN + 1], d1[MAXN + 1]; int main() { int n, m; scanf("%d %d", &n, &m); if (m == 0) { printf("%d", n - 1); return 0; } int max_d2 = 0; int min_d1 = MAXN; for (i...
C++
b54ced81e152a28c19e0068cf6a754f6
2b0767009a22c8d3c48bfca0fe4234ed
1,300
PASSED
#include <bits/stdc++.h> using namespace std ; #define ll long long #define pb push_back map < int , bool > arr ; vector < int > v [ 100010] ; bool vis [100010 ] ; int a [1000010] [ 2] ; int dp [ 100010] ; bool cycle ( int src , int parent ) { // cout << src << "\n" ; if ( parent == -1 |...
C++
b54ced81e152a28c19e0068cf6a754f6
a978987842d5b1479aafe23b14233746
1,300
PASSED
#include<bits/stdc++.h> #define inf 0x3f3f3f3f const int maxn=100000; using namespace std; int n,m,a,b,ans,lmax,rmin,rmax,flag,l[maxn+10],r[maxn+10]; int main() { while(scanf("%d%d",&n,&m)!=EOF){ if(m==0) { printf("%d\n",n-1); continue; } ans=0,lmax=0,rm...
C++
b54ced81e152a28c19e0068cf6a754f6
733a605025fd536a2fac3a40960a0d2c
1,300
PASSED
#include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> using namespace std; int main(){ int n , m; cin >> n >> m; if(m == 0){ cout << n - 1 << endl; return 0; } int max_0 = -1 , min_1 = 100001; for(int i = 0 , x , y ; i < m ; i++){ cin >> x >> y; if(x > y) swap(x , y); max_0 = m...
C++
b54ced81e152a28c19e0068cf6a754f6
4695453f7ba5d0f338117e97e461c2c4
1,300
PASSED
/*! * file main.cpp * author Rotile_H * date 2016/05/11 * Dare for More */ #include <stdio.h> #include <iostream> #include <string.h> #include <string> #include <vector> #include <map> #include <algorithm> #include <memory.h> using namespace std; #define inf 0x3f3f3f3f typedef pair<int,int> plr; const int maxn =...
C++
b54ced81e152a28c19e0068cf6a754f6
d36f62f60e2807846325c240440e54f5
1,300
PASSED
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Text; class Program { private static void SolveA() { var n = RL(); var a = new int[n]; var b = new int[n]; for (int i = 0; i < n; i++) { ...
C#
88686e870bd3bfbf45a9b6b19e5ec68a
057bafd119d9b95a4c204519b71beade
900
PASSED
import java.io.InputStream import java.math.BigDecimal import java.math.BigInteger fun main(args: Array<String>) = input.run { val n = nextInt() var prev = 5000 var unrated = false repeat(n) { val a = nextInt() val b = nextInt() if (a != b) { println("rated") ...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
9ae89d9a4c3eb431af32e64359f74393
900
PASSED
import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.util.StringTokenizer fun main(args: Array<String>) { val sc = FastScanner(System.`in`) val n = sc.nextInt() var min = 1e9.toInt() var unrated = false for (i in 1..n) { val before = sc.n...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
1b4202ab21718d7f8b5323a4e8bd8cb4
900
PASSED
import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.util.StringTokenizer fun main(args: Array<String>) { val sc = FastScanner(System.`in`) val n = sc.nextInt() val ratings = Array(n) { Rating(sc.nextInt(), sc.nextInt()) } println( when { ...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
258547901d9061e3c1eaf49473c2a6fe
900
PASSED
import java.util.Scanner; import java.util.Arrays; import java.util.*; import java.math.*; import java.io.*; fun main(args: Array<String>) { var s = Scanner(System.`in`) var participant = s.nextInt(); var rated= 0 ; var notrated= 0 ; var before = IntArray(participant); var after = IntArray(participant); for(i...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
7aff256ea9481afc8a092e90960d0daa
900
PASSED
import java.util.* fun main(args: Array<String>) { var sc = Scanner(System.`in`) var n = sc.nextInt() var before = 10000 var unrated = false for ( i in 1 .. n){ val a = sc.nextInt() val b = sc.nextInt() if (a!=b){ println("rated") return } ...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
e8ae79b7a07bb6dc6bc7c9de73f8d2ce
900
PASSED
import java.io.BufferedReader import java.io.InputStreamReader fun main() { val br = BufferedReader(InputStreamReader(System.`in`)) val n = br.readLine().toInt() val ratings = List(n){ br.readLine().split(" ").map { it.toInt() } }.map { it.first() to it.last() } val existChange = ratings.dr...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
47edd9176f09df344380c34e339c0f95
900
PASSED
fun main() { val numParticipants = readLine()!!.toInt() val participantRatings = mutableListOf<Int>() repeat(numParticipants) { val (oldRating, newRating) = readLine()!!.split(' ').map { it.toInt() } if (oldRating != newRating) { println("rated") return } ...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
9e434b2a593434025dece44d90d835c9
900
PASSED
fun main(args: Array<String>) { var n = readLine()!!.toInt() var state = 0 //maybe var min = Int.MAX_VALUE while(n > 0) { n-- val (i1, i2) = readLine()!!.split(" ").map(String::toInt) if(i1 != i2) { state = 1 //rated break } else if(i1>min) { ...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
4aed3a127473dd638b46368cd76941b1
900
PASSED
import java.io.* import java.util.* fun main(args: Array<String>) { val input: InputReader val output: PrintWriter if (false) { input = InputReader(FileInputStream("input.txt")) output = PrintWriter(FileOutputStream("output.txt")) } else { input = InputReader(System.`in`) output = PrintWriter(S...
Kotlin
88686e870bd3bfbf45a9b6b19e5ec68a
d2320eed6f81db302bf44786041ca5fd
900
PASSED
#include<bits/stdc++.h> #define debug(x) cout<<#x<<" : "<<x<<endl; #define foreach(it,v) for(__typeof(v.begin()) it = v.begin(); it != v.end(); ++it) #define file() {freopen("data_in.txt", "r", stdin); freopen("data_out.txt", "w", stdout);} #define quick { ios::sync_with_stdio(false); cin.tie(0); } #define pii pair<in...
C++
c943742fb0720af18058ff0da8a33974
95a02af16b088908afbe591cdf7cb831
2,300
PASSED
#pragma GCC optimize(4) #include <bits/stdc++.h> using namespace std; #define Mod 998244353 #define int long long struct Node{ int cnt; int sum; Node(){cnt=0,sum=0;} Node(int cnt,int sum){ this->cnt=cnt; this->sum=sum; } }f[20][1024]; int k; int len; int pw[20]; int bit[20]; bool Valid(int x){ int num=0...
C++
c943742fb0720af18058ff0da8a33974
87d52a1356a037f945815d5f7e036ec3
2,300
PASSED
/** *        ┏┓    ┏┓ *        ┏┛┗━━━━━━━┛┗━━━┓ *        ┃       ┃   *        ┃   ━    ┃ *        ┃ >   < ┃ *        ┃       ┃ *        ┃... ⌒ ...  ┃ *        ┃       ┃ *        ┗━┓   ┏━┛ *          ┃   ┃ Code is far away from bug with the animal protecting           *          ┃   ┃ 神兽保佑,代码无bug *        ...
C++
c943742fb0720af18058ff0da8a33974
7ad2910c9dba72544ca83e10f2c7f90f
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define N 25 #define STT 1<<10 #define MOD 998244353 #define ll long long #define set(a,v) memset(a,v,sizeof(a)) int n,a[N],pw[N],c[STT];ll L,R; struct node { int x,y; node(int _x=0,int _y=0) {x=_x;y=_y;} }dp[N][STT]; node dfs(int u,bool lim,bool ld,int stt) { if(ld) stt...
C++
c943742fb0720af18058ff0da8a33974
3a710ed7ce992898fa8457be17d2da6a
2,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=998244353; ll r,l,k,n; int dig[20]; ll p[20]; struct sc { int x,y; } dp[20][1<<19][2]; int get(int a) { int cnt=0; for(ll i=1; i<=a; i<<=1) if(a&i)cnt++; return cnt; } sc dfs(int pos,int state,bool led,int limit) { ...
C++
c943742fb0720af18058ff0da8a33974
fd9a2d8174b187a4d106b081411c8d1b
2,300
PASSED
# include <bits/stdc++.h> # define rr register # define int long long const int N=20,MOD=998244353ll; struct Node{ int tot; int sum; }; int f[N][(1<<12)][12][2][2]; int tot[N][(1<<12)][12][2][2]; int a[N],len; int Pow[N]; int L,R; int k; inline void make(int x){ len=0; while(x){ a[++len]=x%10; x/=10; } retur...
C++
c943742fb0720af18058ff0da8a33974
d93917048fa73523e0394a32413b0128
2,300
PASSED
#include <bits/stdc++.h> #define REP(i, a, b) for(int i(a); i <= (b); ++i) typedef long long ll; #define int ll const int P(998244353); inline void inc(int &x, int y) { if ((x += y) >= P) x -= P; } int k, a[22], pw10[22]; int f[22][1033][2][2], g[22][1033][2][2]; int dfs(int p, int s, bool lim, bool lead) { int &an...
C++
c943742fb0720af18058ff0da8a33974
3c323008a96f1cd6f04605b7def99bc2
2,300
PASSED
#include <bits/stdc++.h> #define modp 998244353 using namespace std; long long L,R; int k; int f[27][2][1027],g[27][2][1027],s[27],bit[1027]; long long num[27]; void pre() { memset(f,0,sizeof(f)); memset(g,0,sizeof(g)); memset(s,0,sizeof(s)); memset(bit,0,sizeof(bit)); bit[1]=1; for (int i=2;i<1...
C++
c943742fb0720af18058ff0da8a33974
ee8f2606183a21cca086fe46912edcb9
2,300
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; pair<ll, ll> dp[19][1 << 10][2]; int vis[19][1 << 10][2], id = 1; ll pw[19]; const int mod = 998244353; ll l, r, k; string s; pair<ll, ll> solve(int ind, int mask, bool f) { if (__builtin_popcount(mask) > k) return make_pair(0, 0); if (ind == -1) ...
C++
c943742fb0720af18058ff0da8a33974
d70ece33e7edeb87b7959790d16557b7
2,300
PASSED
#include <bits/stdc++.h> #define ll long long #define pll pair<ll,ll> #define ppl pair<ll,pair<int,int> > #define fr first #define sc second #define PI acos(-1) #define mp make_pair const ll mod = 998244353 ; using namespace std; pll dp[20][2][2][1<<10][2]; int k; bool vis[20][2][2][1<<10][2]; int s1[20],s2[20]; ll p...
C++
c943742fb0720af18058ff0da8a33974
ff76a39eacc121e3ef017e05d3ac1eef
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<bool> vb; #define pb push_back #define mp make_pair #define f first #define s second #define in insert #define FOR(i,a,b) for (int i = a; i < b; i++) #define all(x) (x).begin(), (x).end...
C++
91541d10c5ae52be8da33412359bd019
34d341d8b5f0ed1f3f761de1ed717537
1,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<bool> vb; #define pb push_back #define mp make_pair #define f first #define s second #define in insert #define FOR(i,a,b) for (int i = a; i < b; i++) #define all(x) (x).begin(), (x).end...
C++
91541d10c5ae52be8da33412359bd019
bc28d2395d2214cf74e5662c845d5659
1,100
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; struct song { int s,e; int incr; }; song s[100005]; int compare(const void *a,const void *b) { song *pa=(song *)a; song *pb=(song *)b; if(pa->incr<pb->incr) return 1; else return -1...
C++
91541d10c5ae52be8da33412359bd019
646c82422a0a728a4778b01d434737f4
1,100
PASSED
#include <bits/stdc++.h> #define ll long long #define MX 10005 using namespace std; vector <ll> vt; int main() { ios_base :: sync_with_stdio(false), cin.tie(NULL); //freopen("in.txt","r",stdin); //map <char, double > mp; ll n,m,x,y, sum = 0,res = 0, cnt = 0,ttl = 0; cin >> n >> m; res = sum =...
C++
91541d10c5ae52be8da33412359bd019
3cef93bed0c5015dd9a59a09f94a923f
1,100
PASSED
#include <bits/stdc++.h> #define ll long long #define MX 10005 using namespace std; vector <ll> vt; int main() { ios_base :: sync_with_stdio(false), cin.tie(NULL); //freopen("in.txt","r",stdin); //map <char, double > mp; ll n,m,x,y, sum = 0,res = 0, cnt = 0,ttl = 0; cin >> n >> m; for (int i...
C++
91541d10c5ae52be8da33412359bd019
88f799992ea2b48e80321954ee1c7d16
1,100
PASSED
///*Bismillahir Rahmanir Rahim***/// ///**Author Thasin Sheikh**/// /*while(a) { if(a%2==0) dvi.push_back(0); else dvi.push_back(1); a/=2; } reverse(dvi.begin(),dvi.end());*/ #include<bits/stdc++.h> using namespace std; #define MAX 35000 #define makefast__ io...
C++
91541d10c5ae52be8da33412359bd019
4f903f7346630db4f98374b54bbd09b0
1,100
PASSED
#include<bits/stdc++.h> #define For(i,l,r) for(int i=l;i<=r;++i) #define MAXN 100001 using namespace std; long long as,bs; int n,m,song[MAXN]; bool cmp(int a,int b) { return a>b; } int main() { int tx,ty,tn; scanf("%d %d",&n,&m); tn=n; For(i,1,n) { scanf("%d %d",&tx,&ty); if(tx==...
C++
91541d10c5ae52be8da33412359bd019
82db8d9199016a4e85cc1e36ffedc747
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define llu unsigned long long int #define scll(x) scanf("%lld",&x) #define scld(x) scanf("%lf",&x) #define scull(x) scanf("%llu",&x) #define scch(x) scanf("%c",&ch) #define scstr(x) scanf("%s",x) #define Pi acos(-1.0) #define ...
C++
91541d10c5ae52be8da33412359bd019
94273c86cbdf24d53c15df1ce004481f
1,100
PASSED
#include<bits/stdc++.h> using namespace std; long long a,b,c,man,mix,x,y,z,ans,ans1,l,r,d[200000]; // vector<int> v; // string s,s1,s2; // deque<int> dq; map<char, int> mp,mp1; bool o; pair<long long, long long> p[1000000]; int main(){ cin>>a>>b; for(int i = 0; i < a; i++){ cin>>p[i].first>>p[i].second...
C++
91541d10c5ae52be8da33412359bd019
f13e543143553e319a6206124a8ab70b
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define fr(i,a,b) for(int i = (int) a; i < (int) b; i++) // for from i=a to b and i++ #define rfr(i,a,b) for(int i = (int)(a); i >= (int)(b); i--) // for from i=a to b and i-- #define rep(i, v) for(int i=0;i<sz(v);++i) // for from i=0 to end of ...
C++
91541d10c5ae52be8da33412359bd019
a6be41baf6a172592eda5ec8a1c9d80d
1,100
PASSED
from bisect import bisect_left sum = [0]*200005 srt = [] n,t = map(int,input().split()) a = list(map(int,input().split())) tree = [0]*200005 def get(x): ans = 0 while x: ans += tree[x] x -= x&-x return ans def update(x): while x <= 200002: tree[x] += 1 x += x&-x fo...
Python
42c4adc1c4a10cc619c05a842e186e60
24edfecbe9cde18099ac499f2c67d8b9
1,800
PASSED
r = input n,t = map(int,r().split()) arr = [int(x) for x in r().split()] N = -40**14-20**14 presum =[0] #Function def update(Bit,x): while(x<=n): Bit[x]+=1 x+=(x&-x) def get(Bit,x): res = 0 while(x>0): res+=Bit[x] x-=(x&-x) return res # for i in arr: presum.append(pre...
Python
42c4adc1c4a10cc619c05a842e186e60
daca0050111c9951a2c161b85a1c55e3
1,800
PASSED
import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writabl...
Python
42c4adc1c4a10cc619c05a842e186e60
7da3ed469ddd93e6c32eb1fa01ffc157
1,800
PASSED
def sort_list(list1, list2): zipped_pairs = zip(list2, list1) z = [x for _, x in sorted(zipped_pairs)] return z class SegmentTree: def __init__(self, data, default=0, func=lambda a,b:a+b): """initialize the segment tree with data""" self._default = default self._...
Python
42c4adc1c4a10cc619c05a842e186e60
7c2d719e982ba614ed186dd5c0fdca35
1,800
PASSED
import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.wri...
Python
42c4adc1c4a10cc619c05a842e186e60
bc1568c201afca11c107d6b1b218aeb9
1,800
PASSED
# https://codeforces.com/contest/1042/problem/D # 解説AC # sr - sl < t # sl > sr - t # index - sr -t 以下の数 from itertools import accumulate class binary_index_tree(object): def __init__(self, n): self.bit = [0]*n self.n = n def add(self, ind, num): # index is one_indexed while(ind...
Python
42c4adc1c4a10cc619c05a842e186e60
1bd4110103bf606dba770ae775296173
1,800
PASSED
from collections import defaultdict import bisect n,t=map(int,input().split()) di=list(map(int,input().split())) ai=[di[0]] for i in range(1,n): ai.append(ai[-1]+di[i]) mapp=defaultdict(int) ais=list(sorted(ai)) ind=0 for i in range(n): if not mapp[ais[i]]: mapp[ais[i]]=ind ind+=1 li=[-1]*n for ...
Python
42c4adc1c4a10cc619c05a842e186e60
bda89612fdcf858a38d6d3e360e29f5f
1,800
PASSED
import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Locale; import java.util.Scanner; // 1042D - Fail (use fenwick trees) public class PetyaAndArray { static long T; static long[] A; static long[] SUM; public static void main(String[] args) { Loca...
Java
42c4adc1c4a10cc619c05a842e186e60
6dd6d5afa422be982d66b1e780347172
1,800
PASSED
import java.util.*; import java.io.*; public class _1042_D { public static void main(String[] args) throws IOException { int N = readInt(); long T = readLong(); long arr[] = new long[N+1]; long BIT[] = new long[N+2]; long tot = 0; PriorityQueue<Long > pq = new PriorityQueue<>(Collections.reverseOrder());...
Java
42c4adc1c4a10cc619c05a842e186e60
bca16ca4881d90029ad5d1375fe1eef7
1,800
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 D { static int mod = 1000000007; static InputReader in = new InputReader(System.in); static Prin...
Java
42c4adc1c4a10cc619c05a842e186e60
f925b02fca012fbfc742de82c6758645
1,800
PASSED
//In The Name Of God ( Of programming ) #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll Maxn = 1e5 + 7; const ll Max = 1e3 + 7; const ll Mod = 1e9 + 7; const ll Inf = 1e9 + 7; #define pb push_back #define mp make_pair #define F first #define S second #define P_l...
C++
a17bac596b1f060209534cbffdf0f40e
807c0b00ef4973ba439fe00ca09ee861
1,600
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <set> #include <map> #include <queue> #include <string> #include <cstring> #include <cmath> #include <algorithm> #include <iomanip> #include <sstream> using namespace std; const int inf = 0x3f3f3f3f; char s1[100100], s2[5][100100]; int num[5]; int main...
C++
a17bac596b1f060209534cbffdf0f40e
57757504557e88e03e9d657037307b00
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int type[2505]; int rymic(string s1,string s2,string s3,string s4,int k) { int i,j,cnt,check; if(k==0) { return 0; } cnt=0; check=0; for(j=s1.length()-1;j>=0;j--) { if(s1[j]=='a' or s1[j]=='e' or s1[j]=='i' or s1[j]=='o' or s1[j]=='u...
C++
a17bac596b1f060209534cbffdf0f40e
ddac3a05ee4f0481ce3ab4a19df1ccc3
1,600
PASSED
#include<cstdio> #include<cstring> #include<string> #include <iostream> #include <algorithm> using namespace std; char a[10010]; char s[5][10010]; int main() { int n,k; scanf("%d %d",&n,&k); int num[5]={0}; int flag=1; for(int i=1;i<=n;i++) { int f12=1,f13=1,f14=1,f23=1,f24=1,f34=1; ...
C++
a17bac596b1f060209534cbffdf0f40e
b5bb5e3590f3a3acf35501786230f3ea
1,600
PASSED
//* AuThOr GaRyMr *// #include<bits/stdc++.h> #define rb(a,b,c) for(int a=b;a<=c;++a) #define rl(a,b,c) for(int a=b;a>=c;--a) #define niv vector<int> #define LL long long #define IT iterator #define PB(a) push_back(a) #define II(a,b) make_pair(a,b) #define FIR first #define SEC second #define FREO freopen("check.out","...
C++
a17bac596b1f060209534cbffdf0f40e
1209d15a0a1a5023463f62da960f3fd1
1,600
PASSED
//* AuThOr GaRyMr *// #include<bits/stdc++.h> #define rb(a,b,c) for(int a=b;a<=c;++a) #define rl(a,b,c) for(int a=b;a>=c;--a) #define niv vector<int> #define LL long long #define IT iterator #define PB(a) push_back(a) #define II(a,b) make_pair(a,b) #define FIR first #define SEC second #define FREO freopen("check.out","...
C++
a17bac596b1f060209534cbffdf0f40e
7d9785841f0aafabf6987ac9b9ea7179
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int n , k; string s[4]; void find( string& x , string& y ) { int sl = x.length(); int kk = k; for ( int i=sl-1 ; i>=0 ; i-- ) { if ( x[i] == 'a' || x[i] == 'i' || x[i] == 'e' || x[i] == 'o' || x[i] == 'u' ) { kk--; if ( kk == 0 ) { y = x.substr( i )...
C++
a17bac596b1f060209534cbffdf0f40e
304513291ae0254fc1618c94ecc71c65
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int n,k;bool aaaa,abab,abba; string s[5];bool aabb,ok=true; inline bool isyuan(char c){return (c=='a'||c=='o'||c=='e'||c=='i'||c=='u');} void change(string &t) { string r=""; int cnt=0; for(int i=t.size()-1;i>=0;i--) { r+=t[i]; if(isyuan(t[i]))cnt++; if(cnt==k)brea...
C++
a17bac596b1f060209534cbffdf0f40e
ffe57d8e7b554939dafe4770ee3ec31a
1,600
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1e5+5; string s[N];bool abab=true; int n,k;bool aabb=true,abba=true; inline bool isvowel(char c){return (c=='a'||c=='o'||c=='e'||c=='i'||c=='u');} int main() { abba=true; cin>>n>>k;n*=4; for(int i=0;i<n;i++) { cin>>s[i]; int cnt=0,j; for(j=s[i].size()-1...
C++
a17bac596b1f060209534cbffdf0f40e
b109f034fce79a50af13019448832cb9
1,600
PASSED
#include <bits/stdc++.h> #define N 100010 using namespace std; string s[N]; int n,k; string check() { bool aaaa=true,aabb=true,abab=true,abba=true; int i; for(i=0;i<n;i+=4) { if(s[i]!=s[i+1]||s[i]!=s[i+2]||s[i]!=s[i+3]) { aaaa=false; } if(s[i]!=s[i+1]||s[i+2]!=s[i+3]) { aabb=false; } if(s[i]!=s[...
C++
a17bac596b1f060209534cbffdf0f40e
ae7ef0a9699a8b4862107184c6685dab
1,600
PASSED
#include <bits\stdc++.h> using namespace std; const long long int MaxN=1e5+1; int p[MaxN+1]; int M[MaxN]; void Fill() { p[1]=0; for (int i=2; i<MaxN+1;i++) p[i]=1; for (int i=2; i*i<=MaxN;i++){ for (int j=2; j<MaxN/i+1;j++){ if (i*j<MaxN+1) p[i*j]=0; } } int j=0; for (int i=1;i<MaxN;i++) { if...
C++
eea7860e6bbbe5f399b9123ebd663e3e
ca192de9ef66f54025f4a75f19b3baf5
1,400
PASSED
#include<bits/stdc++.h> using namespace std; const int n=100010; int c[n]; int main(){ int num,i,j,s=0,ans=1; cin>>num; int a[num]; memset(c,0,sizeof(c)); for(i=0;i<num;i++){ cin>>a[i]; c[a[i]]++; } for(i=2;i<n;i++){ s=0; //cout<<"k"; for(j=i;j<n;j+...
C++
eea7860e6bbbe5f399b9123ebd663e3e
82238f4e04242f9e08739d9d1e282979
1,400
PASSED
#include <iostream>//A #include<cstdio> #include <cstring> #include<algorithm> #define MAX 100000 using namespace std; int mark[100000+5]; int main() { int n; while(scanf("%d",&n)!=EOF) { int maxn=-1; int x; memset(mark,0,sizeof(mark)); for(int i=0;i<n;i++) { scanf("%d"...
C++
eea7860e6bbbe5f399b9123ebd663e3e
d73e73537d8bc7750fb53ad551b7cdf8
1,400
PASSED
#include <cstdio> #include <cmath> #include <cstring> #include <algorithm> using namespace std; int n, a[100005], ans, MAX, cnt[100005]; int main() { MAX = -1; scanf("%d", &n); memset(cnt, 0, sizeof(cnt)); for(int i = 1; i <= n; i++) { scanf(" %d", &a[i]); cnt[a[i]]++; MAX = max(MAX, a[i]); } ans = 1; fo...
C++
eea7860e6bbbe5f399b9123ebd663e3e
f1f91a42fc9d0a2620a1709ce849206a
1,400
PASSED
//#include <iostream> //#include <string> //#include <vector> //#include <queue> //#include <cmath> //#include <algorithm> //#include <cstdio> //using namespace std; // //#define MOD 1000000007 // //int v[1000007] = { 0 }; //int ans = 0; // //int make(int a, int b) //{ // if (b % a == 0) // return a; // else // { // ...
C++
eea7860e6bbbe5f399b9123ebd663e3e
4ac1ac50ce507576d812ef09f0bf98e5
1,400
PASSED
#include <iostream> #include <cmath> #include <cstring> #include <string> #include <map> #include <stack> #include <queue> #include <algorithm> #include <vector> #include <functional> using namespace std; #define LL long long int #define INF 0x3f3f3f3f3f3f3f3f #define MOD 1000000007 const int MAXN = 1e05 + 7; int v...
C++
eea7860e6bbbe5f399b9123ebd663e3e
39afe911130097318a9f5af60e0c47ce
1,400
PASSED
/// David Mateus Batista <david.batista3010@gmail.com> /// Computer Science - Federal University of Itajuba - Brazil #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define INF 0x3F3F3F3F ...
C++
eea7860e6bbbe5f399b9123ebd663e3e
8233d22e30b712c1f3c98fcea5a61843
1,400
PASSED
#include <bits/stdc++.h> #include<string.h> #define MAX 1000005 #define MOD 1000000007 #define MA 1200000 #define PI 3.14159265358979323846264338327950 //const int MAXA=1e15+1; typedef long long int ll; const int INF=1e6; using namespace std; const int maxn=1e5+5; const int N=1e7; const int big= 30001; bool isprime[m...
C++
eea7860e6bbbe5f399b9123ebd663e3e
73c7df7084a1accf2b0c410f7f5a280c
1,400
PASSED