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
input() temp = list(map(int, input().split())) s = 0 mx = 0 for i in range(len(temp)): mx = max(mx, temp[i]) if mx <= i + 1: s += 1 else: continue print(s)
Python
291601d6cdafa4113c1154f0dda3470d
7c3a79accd1f321d849acdacb223dc74
1,000
PASSED
# read n n = int(input()) # read array substrs = input().split() array = [int(x) for x in substrs] days = 0 max_page = array[0] i = 1 while True: if i == max_page: days += 1 if i == len(array): break max_page = array[i] else: max_page = max(max_page, array[i]) i ...
Python
291601d6cdafa4113c1154f0dda3470d
7938a62f02a7a33f97cddab44fbdca58
1,000
PASSED
# read n n = int(input()) # read array and make list of ints line = input().split() array = [int(x) for x in line] # day counter days = 0 # latest page with needed mystery last_page = 0 # update last_page to max every new page for i in range(n): last_page = max(array[i], last_page) # if last_page is current pag...
Python
291601d6cdafa4113c1154f0dda3470d
9ea208b17d037e2182ff483c8fe71a83
1,000
PASSED
n = int(input()) arr = list(map(int, input().strip().split())) pages = 1 i=1 while (i!=n): if(arr[i-1]==i): maximum = max(arr[0:(arr[i-1])]) if(maximum<=i): pages += 1 i = i+1 print(pages)
Python
291601d6cdafa4113c1154f0dda3470d
6f81401d2609a4bbdf2b1d71e1c0425f
1,000
PASSED
N = gets.to_i A = gets.split.map &:to_i ans = 0 am = nil (1..N).each{ |i| a = A[i-1] if !am am = a ans += 1 end am = a if a > am if am <= i am = nil next end } p ans
Ruby
291601d6cdafa4113c1154f0dda3470d
038a21915924c4693c7a6175ebbe550d
1,000
PASSED
require 'set' #if File.exists?("input") # $stdin = File.open("input") # $stdout = File.open("output","w") #end n = gets.to_i arr = gets.chomp.split(" ").map(&:to_i) i=0 ans=0 mySet = Set.new while(i<n) ans+=1; loop do mySet.add(arr[i]) if(mySet.include?(i+1)) mySet.delete(i+1) end i+=1 ...
Ruby
291601d6cdafa4113c1154f0dda3470d
84eeee52c3aea3fe1b890cab4083d0f4
1,000
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <queue> using namespace std; struct bian { int from, to; }eg[300010 << 1]; int front[300010], num; void lian(int x, int y) { eg[++ num].to = y; eg[num].from = front[x]; front[x] = num; } vector<int>v; int vis[300010], col[300010],...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
3486941881ec042317da4ba23a195a9c
2,400
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <queue> using namespace std; struct bian { int from, to; }eg[300010 << 1]; int front[300010], num; void lian(int x, int y) { eg[++ num].to = y; eg[num].from = front[x]; front[x] = num; } vector<int>v; int vis[300010], col[300010],...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
f4f96cde3ae9976bfb473ac9542fced5
2,400
PASSED
#include <iostream> #include <stack> #include <math.h> #include <set> #include <stdio.h> #include <algorithm> #include <assert.h> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; #define endl "\n" #define mp make_pair #define int long long #define pii pair<int , int> inline int ...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
7caae17cdc8c7f6ef4af2aff1e03804d
2,400
PASSED
#include <iostream> #include <stack> #include <math.h> #include <set> #include <stdio.h> #include <algorithm> #include <assert.h> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; #define endl "\n" #define mp make_pair #define int long long #define pii pair<int , int> inline int ...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
0a6578e7c10af33d0a3c08092e935e66
2,400
PASSED
#include <iostream> #include <stack> #include <math.h> #include <set> #include <stdio.h> #include <algorithm> #include <assert.h> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; #define endl "\n" #define mp make_pair //#define int long long #define pii pair<int , int> inline in...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
6d282029bb10d4835f087438a1c1be1d
2,400
PASSED
#include <iostream> #include <stack> #include <math.h> #include <set> #include <stdio.h> #include <algorithm> #include <assert.h> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; #define endl "\n" #define mp make_pair //#define int long long #define pii pair<int , int> inline in...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
d685679df531f4f29501be7ad391ba16
2,400
PASSED
//#include <bits/stdc++.h> #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<string> #include<vector> #include<stack> #include<bitset> #include<cstdlib> #include<cmath> #include<set> #include<list> #include<deque> #include<map> #include<queue> using namespace...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
0c4a4ae2aa028202566f7199b2583a41
2,400
PASSED
#pragma comment(linker, "/STACK:268435456") #include<iostream> #include<cstdio> #include<string> #include<vector> #include<set> #include<map> #include<queue> #include<deque> #include<stack> #include<bitset> #include<iomanip> #include<memory.h> #include<algorithm> #include<cstring> #include<ctime> #include<cmath> ...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
17028c349decfede685db6eb482b9616
2,400
PASSED
#include <bits/stdc++.h> using namespace std; int n, m, K; set<int> g[303030]; set<int> unused; set<pair<int, int>> bad; void dfs(int curr) { vector<int> nexts; for (int next : unused) if (!bad.count(make_pair(curr, next))) { nexts.push_back(next); } for (int next : nexts) { unused.erase(next); } for (int n...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
119f462b5a6cf3d7fc07b30b5914e11c
2,400
PASSED
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> parent, size; UnionFind(int n) : parent(n), size(n, 1) { for (int i = 0; i < n; i++) parent[i] = i; } int operator[](int x) { return parent[x] == x ? x : (parent[x] = operator[](parent[x])); } bool merge(int x, int y) { if ((x = operato...
C++
5fde461bbb54302cfa5e8d5d3e29b9db
ef3c96966dbc6ac3e6d1bc8d26e03fef
2,400
PASSED
#![allow(dead_code)] #![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io; use std::ops; use std::str::FromStr; #[derive(Clone, Debug, Default)] struct ProblemState { } impl Problem { fn solve(&mut self) { let mut a: u64 = self.scan(); let mut b: u64 = self.scan(); ...
Rust
0f960d19e576b7421a7c7a7166a884ea
e73f2eafa75df07fb6be0dc24a9de665
1,300
PASSED
#![allow(unused_parens)] #![allow(unused_imports)] #![allow(non_upper_case_globals)] #![allow(non_snake_case)] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(dead_code)] #[allow(unused_macros)] macro_rules! invec { ( $ t : ty ) => {{ let mut s = String::new(); match std::io::stdin().rea...
Rust
0f960d19e576b7421a7c7a7166a884ea
45c0be6aba38fb57fae12d109cbc8672
1,300
PASSED
#![allow(unused_imports)] #![allow(dead_code)] use std::io::Read; struct State { a: i64, b: i64, n: i64, m: i64 } fn solve(st: &mut State) { let mut a = st.a; let mut b = st.b; if a < b { std::mem::swap(&mut a, &mut b); } if b < st.m { print!("No\n"); ...
Rust
0f960d19e576b7421a7c7a7166a884ea
b8ec3d5559d401cf9b31a547e06ccc0b
1,300
PASSED
// ____ _ _ _ _ // | _ \ _ _ ___| |_ ___ _ __ | |_ ___ _ __ ___ _ __ | | __ _| |_ ___ // | |_) | | | / __| __| / __| '_ \ | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \ // | _ <| |_| \__ \ |_ | (__| |_) | | || __/ | | | | | |_) | | (_| | || __/ // |_| \...
Rust
0f960d19e576b7421a7c7a7166a884ea
e35076bcbecfbec61d2a13a9965d274e
1,300
PASSED
use std::cmp; use std::io; struct Scanner { buffer: Vec<String>, } impl Scanner { fn next<T: std::str::FromStr>(&mut self) -> T { if self.buffer.is_empty() { let mut input = String::new(); io::stdin().read_line(&mut input).ok(); self.buffer = input ....
Rust
0f960d19e576b7421a7c7a7166a884ea
86f7f431b0877a2611dec9af44409276
1,300
PASSED
// First Rust Submission use std::io; fn mnm(x: u64, y: u64) -> u64 { if x < y { return x; } else { return y; } } fn main() { let mut line = String::new(); io::stdin().read_line(&mut line).unwrap(); let case: u32 = line.trim().parse().unwrap(); for test in 0..case { ...
Rust
0f960d19e576b7421a7c7a7166a884ea
8e40939d9a4979bb1816ae36f1d0df0b
1,300
PASSED
use std::io::{self, BufRead}; use std::cmp::min; fn main() { let stdin = io::stdin(); let mut lines = stdin.lock().lines(); let t: usize = lines.next().unwrap().unwrap().parse().unwrap(); for _ in 0..t { let xs: Vec<u64> = lines.next().unwrap().unwrap().split(' ').map(|x| x.parse().unwrap()).collect(); ...
Rust
0f960d19e576b7421a7c7a7166a884ea
5e4b8efc3ab9ec36ef83d553b7d37118
1,300
PASSED
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s = String::new(); ...
Rust
0f960d19e576b7421a7c7a7166a884ea
31079b8014ab56663761d04a17ba5dd0
1,300
PASSED
#![allow(dead_code, unused_imports)] use std::fmt::Debug; use std::str::FromStr; fn read_stdin() -> String { let mut s = String::new(); std::io::stdin() .read_line(&mut s) .expect("cannot read stdin"); s.trim().to_string() } fn read<T>() -> T where T: std::str::FromStr, <T as std:...
Rust
0f960d19e576b7421a7c7a7166a884ea
592549e40364f129683eb172e04836eb
1,300
PASSED
#![allow(unused_imports, unused_macros)] use kyoproio::*; use std::{ collections::*, io::{self, prelude::*}, iter, mem::{replace, swap}, }; fn main() -> io::Result<()> { std::thread::Builder::new() .stack_size(64 * 1024 * 1024) .spawn(|| { let stdin = io::stdin(); ...
Rust
0f960d19e576b7421a7c7a7166a884ea
74ef90adc4a632fe7bc788f1da3dd829
1,300
PASSED
raw_input() seq = raw_input() print len(seq)*2 - len(seq.lstrip('<')) - len(seq.rstrip('>'))
Python
6b4242ae9a52d36548dda79d93fe0aef
c00ea4c25f25ae761d8752505f7874fa
1,000
PASSED
#include <stdio.h> #include <string.h> int main() { char s[200111]; int n; scanf("%d", &n); scanf("%s", s); int i = 0, len = strlen(s); int num = 0; while (s[i] == '<') { i++; num++; } i = len - 1; while (s[i] == '>') { i--; num++; } printf("%d", num); return 0; }
C
6b4242ae9a52d36548dda79d93fe0aef
059315d67770b2596c5d2b0e834024ea
1,000
PASSED
#include <stdio.h> #include <string.h> int main() { int n; char str[200000]; scanf("%d", &n); scanf("%s", &str); int count = 0; int i = 0; while (str[i] == '<') { count++; i++; } i = n - 1; while (str[i] == '>') { count++; i--; } printf("%d", count); return 0; }
C
6b4242ae9a52d36548dda79d93fe0aef
cddd7267c9f585334b83623e19618527
1,000
PASSED
#include <stdio.h> #define N 200000 int main() { static char s[N + 1]; int n, i, j; scanf("%d%s", &n, s); for (i = 0; i < n && s[i] == '<'; i++) ; for (j = n - 1; j >= 0 && s[j] == '>'; j--) ; printf("%d\n", i + (n - 1 - j)); return 0; }
C
6b4242ae9a52d36548dda79d93fe0aef
4009b260bab0f958636ce2ef59270121
1,000
PASSED
#include <stdio.h> int main(void) { long long int n,i,count=0; scanf("%lld",&n); char s[n]; scanf("%s",s); for(i=0;i<n;i++) { if(s[i]=='<'){ count++;} else break; } for(i=n-1;i>=0;i--) { if(s[i]=='>') {count++;} else break; } printf("%lld\n",count); return 0; }
C
6b4242ae9a52d36548dda79d93fe0aef
4f452d518424db6167ac6f9887a444a8
1,000
PASSED
#include<stdio.h> #include<string.h> int main() { int i,n,a=0,b=0; char ch[200005],m; scanf("%d",&n); m=getchar(); gets(ch); for(i=0; i<n; i++) { if(ch[i]=='<') a++; else break; } for(i=n-1; i>=0; i--) { if(ch[i]=='>') ...
C
6b4242ae9a52d36548dda79d93fe0aef
b04f0a5ae9debf245ca0aebb7f07c34e
1,000
PASSED
#include<stdio.h> #include<stdlib.h> int main() { int n, i, j; scanf("%d", &n); char a[n+1]; scanf("%s", a); i=0; j=n-1; while(a[i]=='<') i++; while(a[j]=='>') j--; j = n-1-j; printf("%d", i+j); return 0; }
C
6b4242ae9a52d36548dda79d93fe0aef
142abfe0e493c491c931e6d9797ecd6c
1,000
PASSED
#include<stdio.h> int main() { int n; scanf("%d",&n); char s[200002]; scanf("%s",s); int i=0,count=0; if(s[0]=='<') { while(s[i]=='<'){count++;i++;} } i=n-1; if(s[n-1]=='>') { while(s[i]=='>'){count++;i--;} } printf("%d\n",count); return 0; }
C
6b4242ae9a52d36548dda79d93fe0aef
a09e8b194d23ec8dd8f6e69d64218c90
1,000
PASSED
#include <stdio.h> #include <stdlib.h> int main() { int l , i = 1 , k ,ans; //int ans = 0 , portion = 0; scanf("%d",&l); char arr[l + 1]; //while (i <= l && scanf(" %c", &arr[i++]) == 1); scanf("%s",arr); for( i = 0 ; i < (l-1) ; i++ ) { if(arr[i] == '>' && arr[i+1] == '<') ...
C
6b4242ae9a52d36548dda79d93fe0aef
6ebea0aaf806773cfab672e4c457216e
1,000
PASSED
#include <stdio.h> int main() { int n, m=0, i, j; char s[200005]; scanf("%d", &n); scanf("%s",s); for (i=0; i<n; i++) { if (s[i]=='<') { m++; } else { break; } } for (i=n-1; i>=0; i--) { if (s[i]=='>') { m++; } else { break; } } printf("%d", m); return 0; }
C
6b4242ae9a52d36548dda79d93fe0aef
9e0f607e4c07466e80fb63328b3263da
1,000
PASSED
#include <bits/stdc++.h> using namespace std; struct Graph { int N, M; struct Edge { int source, target, id; char color; }; vector<vector<Edge>> adjacency_list; vector<int> degrees; Graph(const int N) : N(N), M(0), adjacency_list(N), degrees(N) {} void add_edge(const int a, const int b, const...
C++
4c384fa05772f6df6b3dd89e4f5b6509
06e0bcff506cc7197599b359fb537f8b
2,600
PASSED
#include <bits/stdc++.h> using namespace std; struct Graph { int N, M; struct Edge { int source, target, id; char color; }; vector<vector<Edge>> adjacency_list; vector<int> degrees; Graph(const int N) : N(N), M(0), adjacency_list(N), degrees(N) {} void add_edge(const int a, const int b, const...
C++
4c384fa05772f6df6b3dd89e4f5b6509
d126d329266c092d575a3034311757dc
2,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i)) #define rof(i,a,b) for(int (i...
C++
4c384fa05772f6df6b3dd89e4f5b6509
7a7ac1148bdc060e17da96fa67aa9d21
2,600
PASSED
#include <bits/stdc++.h> using namespace std; struct Graph { int N, M; struct Edge { int source, target, id; char color; }; vector<vector<Edge>> adjacency_list; vector<int> degrees; Graph(const int N) : N(N), M(0), adjacency_list(N), degrees(N) {} void add_edge(const int a, const int b, const...
C++
4c384fa05772f6df6b3dd89e4f5b6509
976ff783a2cc4582dd92ff4a30d021f0
2,600
PASSED
#include <bits/stdc++.h> using namespace std; struct Graph { int N, M; struct Edge { int source, target, id; char color; }; vector<vector<Edge>> adjacency_list; vector<int> degrees; Graph(const int N) : N(N), M(0), adjacency_list(N), degrees(N) {} void add_edge(const int a, const int b, const...
C++
4c384fa05772f6df6b3dd89e4f5b6509
e89ad31038a9086911002df8e0488e29
2,600
PASSED
#include <bits/stdc++.h> using namespace std; struct Graph { int N, M; struct Edge { int source, target, id; char color; }; vector<vector<Edge>> adjacency_list; vector<int> degrees; Graph(const int N) : N(N), M(0), adjacency_list(N), degrees(N) {} void add_edge(const int a, const int b, const...
C++
4c384fa05772f6df6b3dd89e4f5b6509
468d2f65478daaebaada8556f8cd168d
2,600
PASSED
#include <cstdio> #define N 400010 int n,num=1,tot,h[N],a[N],vis[N<<1],in[N]; struct node{int to,next;}mp[N<<1]; inline void ins(int x,int y){ mp[++num].to=y;mp[num].next=h[x];h[x]=num;in[x]++; mp[++num].to=x;mp[num].next=h[y];h[y]=num;in[y]++; } void dfs(int x){ for(int &i=h[x];i;i=mp[i].next){ int y=mp[i].to;if(...
C++
4c384fa05772f6df6b3dd89e4f5b6509
3489519b97c3d00dbd8fc15d37668722
2,600
PASSED
#include <vector> #include <list> #include <map> #include <set> #include "queue" #include <deque> #include <stack> #include <numeric> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <complex> #include <iostream> #include <iomanip> #include <...
C++
4c384fa05772f6df6b3dd89e4f5b6509
e15e6c9dbb76217ad6f9942349a8f5f0
2,600
PASSED
/* tanishqg5325 */ #pragma GCC optimize ("Ofast") #include <bits/stdc++.h> #define pb push_back #define X first #define Y second #define all(v) (v).begin(),(v).end() using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int N = 200000; set<int> ...
C++
4c384fa05772f6df6b3dd89e4f5b6509
f3f291a04303ef792336a3f6a2bd41e5
2,600
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <queue> #define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n)) #define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n)) #define FILLA(a, x) memset((a), (x), sizeof (a)) #define COPYA(a, b) memcpy((b), (a), sizeof (a)) using namespace std; t...
C++
4c384fa05772f6df6b3dd89e4f5b6509
e64b9d0358d8cb502499bd443e0fb423
2,600
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; n = pow(2, n); vector<int> tree(2 * n); auto upd = [&](int p, int value){ bool orr = 1; for (tree[p += n] = value; p > 1; p >>= 1){ if (or...
C++
40d1ea98aa69865143d44432aed4dd7e
809246851d3cc75ff0d688afa1c30053
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; // INT VS LL struct segtree{ vector<int> tree; // change to int? int n; segtree(int _n){ this->n = _n; tree.resize(2 * n); } segtree(vector<int>& a){ this->n = (int)a.size(); tree.resize(2 * n); // building the tree: for (int i = ...
C++
40d1ea98aa69865143d44432aed4dd7e
64ad2493f5baef211ff221c1cc5e1e2b
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct segtree{ vector<int> tree; // change to int? int n; segtree(int _n){ this->n = _n; tree.resize(2 * n); } int qry(){ // change to int? return tree[1]; } void upd(int ind, int val){ // change to int? tree[ind += ...
C++
40d1ea98aa69865143d44432aed4dd7e
c85901ca98d7a8053024863f771c4f78
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; // INT VS LL struct segtree{ vector<int> tree; // change to int? int n; segtree(vector<int>& a){ this->n = (int)a.size(); tree.resize(2 * n); // building the tree: for (int i = 0; i < n; ++i){ tree[i + n] = a[i]; } int cnt = 2; ...
C++
40d1ea98aa69865143d44432aed4dd7e
b5b325e2fafe7146301b2d356494bcdd
1,700
PASSED
#include<iostream> #include<algorithm> #include<cmath> using namespace std; #define maxl 131075 //>2^17 long long a[maxl]; struct node { long long value; node *lc; node *rc; node() { value = 0; lc = rc = NULL; } }; node* build(long long L, long long R) { node* u = new node(); if (R - 1 - L == 0) u->valu...
C++
40d1ea98aa69865143d44432aed4dd7e
14e23d27f188eae89db65d2619b9e6bf
1,700
PASSED
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <queue> #include <set> #include <iomanip> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<bool> vb; typedef vector<ull> vul; t...
C++
40d1ea98aa69865143d44432aed4dd7e
ce353df00f571c9542fdf929e7c18e28
1,700
PASSED
/** 题目:CF339D 描述: 给出一个序列。每次更改其中一个值然后询问序列的f(), 序列的f()定义为: 每相邻两个元素按位或得到长度减半的序列, 在对每相邻两个元素按位异或得到长度再次减半的序列 更替的进行按位或/异或, 直至序列长度为1,输出这个数即可。 op维护当前节点的操作符号,g维护当前区间价值。 **/ #include<iostream> #include<cstdio> using namespace std; const int maxnum=1<<18; int arr[maxnum]; int...
C++
40d1ea98aa69865143d44432aed4dd7e
5b848e30be956b0bed5d6f53003dce93
1,700
PASSED
#include<iostream> #include<stdio.h> using namespace std; const int maxx = 1<<18; int num[maxx]; int ans[maxx<<2]; void build(int l,int r,int rt,int op) { if(l==r) { ans[rt]=num[l]; return; } int mid=(l+r)>>1; build(l,mid,rt<<1,1-op); build(mid+1,r,rt<<1|1,1-op); if(op==1) an...
C++
40d1ea98aa69865143d44432aed4dd7e
fe7cb1e2a685e5f0eac9c77ec9821625
1,700
PASSED
#include<iostream> #include<cstdio> using namespace std; const int maxnum=1<<18; int arr[maxnum]; int tree[maxnum<<2]; void Build(int rt,int l,int r,int op) { if(l==r) { tree[rt]=arr[l]; return; } else { int mid=(l+r)>>1; Build(rt<<1,l,mid,1-op); Build(rt<<1|1...
C++
40d1ea98aa69865143d44432aed4dd7e
b9453f735f9ebb4cbd77543badfa39fe
1,700
PASSED
#include <iostream> #include <vector> #include <cmath> class Tree { public: Tree(int n); int query(int p, int b); private: std::vector<int> vec; }; int main() { int n, m; std::cin >> n >> m; Tree tree = Tree(n); std::vector<int> vec(m); for (int i = 0; i < m; ++i) { int p, b;...
C++
40d1ea98aa69865143d44432aed4dd7e
3203f644211a84e1c075d3c2a897f710
1,700
PASSED
/* ID:donnghi2 PROG: LANG:C++ */ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <sstream> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <...
C++
2d1609b434262d30f6bd030d41a71bd5
49d1bc880cf3da3c490f70fd2f00ace2
1,200
PASSED
#include<bits/stdc++.h> using namespace std; string s1,s2; int sum1,sum2,total; int main() { cin>>s1>>s2; for(int i=0;i<s1.length();i++) { if(s1[i]!=s2[i]){ if(s1[i]=='4') { sum1++; } else if(s1[i]=='7') { sum2++; } } }...
C++
2d1609b434262d30f6bd030d41a71bd5
b786cb44740a6de9a1bce2238a29d6a4
1,200
PASSED
//#include<fstream> #include<string> #include<vector> #include<algorithm> #include<iostream> //#inclide<> using namespace std; int main() { /* ifstream cin("input.txt"); ofstream cout("output.txt"); */ string a,b; getline(cin,a); getline(cin,b); vector<int> v(a.size()); int i; ...
C++
2d1609b434262d30f6bd030d41a71bd5
c7480adfacd7300f9ebc65faaf3d83ad
1,200
PASSED
//#include<fstream> #include<string> #include<vector> #include<algorithm> #include<iostream> //#inclide<> using namespace std; int main() { /* ifstream cin("input.txt"); ofstream cout("output.txt"); */ string a,b; getline(cin,a); getline(cin,b); vector<int> v(a.size()); int i; ...
C++
2d1609b434262d30f6bd030d41a71bd5
5c9c0ea3cc36c694b456e767554e4784
1,200
PASSED
#include <iostream> #include <algorithm> using namespace std; char s1[100005]; char s2[100005]; int main() { while(cin>>s1>>s2) { int a=0,b=0,i; for(i=0;s1[i]!='\0';i++) { if(s1[i]!=s2[i]) { if(s1[i]=='4') a++; else ...
C++
2d1609b434262d30f6bd030d41a71bd5
f82b41349cfa696f9e9197ad7e191cde
1,200
PASSED
#ifdef ONLINE_JUDGE #include <iostream> using namespace std; #else #include <fstream> using namespace std; ifstream cin( "C.in" ); ofstream cout( "C.out" ); #endif #include <algorithm> #include <string> #include <vector> int main() { int __, __4, __7; vector < int > s, f; string A, B; cin >> A >> B; for ( ...
C++
2d1609b434262d30f6bd030d41a71bd5
1b9e50b2f615f37191185fe010229257
1,200
PASSED
#include<stdio.h> #include<string.h> #define MAXSIZE 100000 char a[MAXSIZE+5],b[MAXSIZE+5]; int ABS(int aa) { if(aa>=0) return aa; else return -aa; } int main() { gets(a); gets(b); int na=0,nb=0,n=0; for(int i=0;i<strlen(a);i++) { if(a[i]=='4') na++; if(b[i]=='4')...
C++
2d1609b434262d30f6bd030d41a71bd5
459ed5be2cdef4a3490b4a9c61380771
1,200
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <iostream> using namespace std; #define print(x) cout<<x<<endl #define input(x) cin>>x #define SIZE 100240 #define elif else if char a[SIZE],b[SIZE]; int main() { input(a>>b); int ans=0; int diffa=0,diffb=0; for(int i=0;a[i];i...
C++
2d1609b434262d30f6bd030d41a71bd5
49588623eecd19c918bced8ad97af1de
1,200
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <math.h> #include <queue> #include <map> #include <string> #include <string.h> #include <sstream> using namespace std; int res,i,j,n,four,seven,total; string a,b; bool ok; int main(){ cin>>a>>b; n = a.size(); for(i = 0; i < n; ++i){ if(a[i]=...
C++
2d1609b434262d30f6bd030d41a71bd5
22956d223aa332db52b03c2075006307
1,200
PASSED
# include <bits/stdc++.h> using namespace std ; string str1 ,str2 ; int main(){ int p =0 ,q=0 ,a=0 ,b=0; cin>> str1 >>str2 ; for(int i=0 ;i<str1.size() ;i++){ if (str1[i] != str2[i]){ p++ ; } if(str1[i] - 48 == 7) a++; if(str2[i] - 48 == 7) ...
C++
2d1609b434262d30f6bd030d41a71bd5
5aeaec2a2594e7e226be97d5f968d0b5
1,200
PASSED
from math import sqrt h, l = map(int, input().split()) print((l * l - h * h) / (2 * h))
Python
2cd5807e3f9685d4eff88f2283904f0d
aaf31816c1b7efb05e590ad2ecde2230
1,000
PASSED
h,l = map(int,input().split()) print(((l**2)-(h**2))/(2*h))
Python
2cd5807e3f9685d4eff88f2283904f0d
8b2574e170feb7ab1e5458889384a28b
1,000
PASSED
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools # import time,random,resource sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI():...
Python
2cd5807e3f9685d4eff88f2283904f0d
6bded4fba0a9fdbe223f84b428d46e32
1,000
PASSED
import math x=input().split() h=int(x[0]) l=int(x[1]) print(0.5*(l*l-h*h)/h)
Python
2cd5807e3f9685d4eff88f2283904f0d
1bb455386998c00d9f3d3e2e7a1f6288
1,000
PASSED
h,l = gets.split.map(&:to_f) p (l**2-h**2)/2.0/h
Ruby
2cd5807e3f9685d4eff88f2283904f0d
49c94291083c9396bc717e78b36fc4b1
1,000
PASSED
h,l = gets.split.map(&:to_i) puts (l*l-h*h)/(2.0*h)
Ruby
2cd5807e3f9685d4eff88f2283904f0d
6bac9226649ca68d6991ae0236c221f4
1,000
PASSED
h,l = gets.chomp.split.map(&:to_i) depth = 1.0 * (l*l - h*h) / (2*h) printf("%.6f\n", depth)
Ruby
2cd5807e3f9685d4eff88f2283904f0d
8726c24c3168e194010efa5d4e78646d
1,000
PASSED
# filename: 1199B-waterlily # problem definition: geometry, math, *1000 # import libraries import math # input string HL_raw = raw_input() # fake input # HL_raw = "3 5" # needed precision of 10^6 # initialize HL = HL_raw.split() H = float(HL[0]); L = float(HL[1]) # 1 <= H,L <= 10^6 # check angle # print(math.at...
Python
2cd5807e3f9685d4eff88f2283904f0d
c604ad52ab33c687467ca1015a133663
1,000
PASSED
h,l = map(int, raw_input().split()) print (l**2-h**2)/(2*h*1.0)
Python
2cd5807e3f9685d4eff88f2283904f0d
42bd47d8e7f35efaac5ba2a003d9b8fe
1,000
PASSED
from sys import stdin,stdout I = lambda : map(int,stdin.readline().split()) h,l = map(float,I()) print ((l**2) - (h**2))/(2*h)
Python
2cd5807e3f9685d4eff88f2283904f0d
01da3edad8f25a26fe6b428921eabcb1
1,000
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; impo...
Java
bec2349631158b7dbfedcaededf65cc2
952097d378cb4a9d9e70f643b1fd82d6
1,600
PASSED
import java.io.*; //PrintWriter import java.math.*; //BigInteger, BigDecimal import java.util.*; //StringTokenizer, ArrayList public class Ed_2016_R14_B { FastReader in; PrintWriter out; public static void main(String[] args) { new Ed_2016_R14_B().run(); } void run() { in = new FastReader(Syste...
Java
bec2349631158b7dbfedcaededf65cc2
ba345b8202d522c5399fa265c379a381
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class S_palindrome { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); int x = 0; String s1...
Java
bec2349631158b7dbfedcaededf65cc2
48553cf2fe4c48f680b55ec66554c698
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class S_palindrome { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); int x = 0; String s1 ...
Java
bec2349631158b7dbfedcaededf65cc2
7e2ed850a826f86db6624543cbf8b413
1,600
PASSED
import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.IOException; import java.math.BigInteger; import java.util.*; import java.util.stream.Stream; /** * * @author Pradyumn Agrawal coderbond007 */ public class Codeforces{ public...
Java
bec2349631158b7dbfedcaededf65cc2
6b3a39b3589414b3ac901a86f87ea621
1,600
PASSED
import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.IOException; import java.math.BigInteger; import java.util.*; import java.util.stream.Stream; /** * * @author Pradyumn Agrawal coderbond007 */ public class Codeforces{ public...
Java
bec2349631158b7dbfedcaededf65cc2
ed47e273ad7821f972c873a138079933
1,600
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /* JAVA JAVA JAVA JAVAJAV...
Java
bec2349631158b7dbfedcaededf65cc2
31db7c26bcd7a9cd42e83d6e2b72dd31
1,600
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /* JAVA JAVA JAVA JAVAJAV...
Java
bec2349631158b7dbfedcaededf65cc2
973fec00c416336900a4ba34705f5e30
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Stack; import java.util.StringTokenizer; ...
Java
bec2349631158b7dbfedcaededf65cc2
cd95471a6d15933b4713a24668e3abe8
1,600
PASSED
//package main; import java.io.*; import java.util.*; import java.math.*; public final class Main { BufferedReader br; StringTokenizer stk; public static void main(String[] args) throws Exception { new Main().run(); } { stk = null; br = new BufferedReader(new Inpu...
Java
bec2349631158b7dbfedcaededf65cc2
0c7fbc2c0611ed4e2c466eaa7e9313a5
1,600
PASSED
#include <bits/stdc++.h> using namespace std; struct vec { int id; int x, y; long long lng; inline vec operator +(const vec& foo) { vec res; res.x = x + foo.x; res.y = y + foo.y; res.id = 0; return res; } inline vec operator -(const vec& foo) { vec res; res.x = x - foo.x; res.y = y - foo.y; ...
C++
a37a92db3626b46c7af79e3eb991983a
0470f651bb3b42f709b9ce80fbe19b9d
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " " << x << endl #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define REP(i, n) FOR(i, 0, n) #define _ << " " << typedef long long llint; const int MAXN = 1e5 + 10; const llint LIMIT = 2.25e12; int n; llint X, Y; llint c[MAXN]...
C++
a37a92db3626b46c7af79e3eb991983a
f271f75a66361a27512b7b3dadd76915
2,300
PASSED
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define int long long typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define all(x) x.begin(), x.end() #define rall(x) x.rbeg...
C++
a37a92db3626b46c7af79e3eb991983a
81e3157d422cb648300ea0e0fdbb5bee
2,300
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cstring> #include <string> #include <string.h> #include <cmath> #include <iostream> #include <cmath> #include <algorithm> #include <set> #include <vector> #include <map> #include <iomanip> #include <stdlib.h> #include <queue> #include <list> #include <stack> #...
C++
a37a92db3626b46c7af79e3eb991983a
df9d74ef7b0e3c04ed9e07001770d694
2,300
PASSED
#include <iostream> #include <fstream> #include <sstream> #include <cstdlib> #include <cstdio> #include <cmath> #include <string> #include <cstring> #include <algorithm> #include <queue> #include <stack> #include <vector> #include <set> #include <map> #include <list> #include <iomanip> #include <cctype> #include <casse...
C++
a37a92db3626b46c7af79e3eb991983a
47f2529ceacf6540b2372246d8e4e2a4
2,300
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define eb emplace_back #define ll long long #define pll pair<ll,ll> #define ff first #define ss second //#define endl "\n" const ll maxn=5e5+50; const ll mod =1e9+7 ; const ll base=1e6; bool kt=false; pair<long double,long double> a[maxn]; long...
C++
a37a92db3626b46c7af79e3eb991983a
08ad92382472804da06f9d015c3be2b1
2,300
PASSED
#include "bits/stdc++.h" #define x first #define y second #define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) using namespace std; typedef long long ll; typedef pair <ll, ll> pll; pll add(pll a, pll b) { return {a.x + b.x, a.y + b.y}; } pll sub(pll a, pll b) { return {a.x - b.x, a.y - b.y}; } ll mag(pll a...
C++
a37a92db3626b46c7af79e3eb991983a
3d4c906cd9bac9ce50de8020b645436e
2,300
PASSED
#include <iostream> #include <vector> #include <queue> #include <cassert> #define bitset int #define char node using namespace std; long long MAX_LEN = (long long) 1e12; struct vec { long long x, y; vec(long long _x, long long _y) : x(_x), y(_y) { } vec operator+(const vec& a) { return vec(x + a.x, y ...
C++
a37a92db3626b46c7af79e3eb991983a
511cb015841943c724f499459b2fb7b9
2,300
PASSED
#include <iostream> #include <vector> #include <queue> #include <cassert> using namespace std; long long MAX_LEN = (long long) 1e12; struct vec { long long x, y; vec(long long _x, long long _y) : x(_x), y(_y) { } vec operator+(const vec& a) { return vec(x + a.x, y + a.y); } vec operator-(const vec...
C++
a37a92db3626b46c7af79e3eb991983a
7077fef4608ed1f788ad8b439b505ba5
2,300
PASSED
#include <iostream> #include <vector> #include <queue> #include <cassert> #define bitset int using namespace std; long long MAX_LEN = (long long) 1e12; struct vec { long long x, y; vec(long long _x, long long _y) : x(_x), y(_y) { } vec operator+(const vec& a) { return vec(x + a.x, y + a.y); } vec...
C++
a37a92db3626b46c7af79e3eb991983a
e136898c139f34fba170a714eaef66d2
2,300
PASSED
// Sakhiya07 - Yagnik Sakhiya #include <bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() #define mp make_pair #define bp __builtin_popcountll #define MOD 1000000007 const int N = 300005; #d...
C++
9d3ab9c33b69c4f8e60454d369704b30
2d8e383ed8606f5c88836510efcc3318
1,900
PASSED
#include <iostream> #include <fstream> #include <vector> #include <algorithm> using namespace std; class CBankHacking { public: int n; vector<int> protect; vector<vector<int>> edges; int max1,cm1,cm2; int ans; void solve(istream &in,ostream &out) { in >> n; protect.resize(n)...
C++
9d3ab9c33b69c4f8e60454d369704b30
17b401bb4e57222e21cc50b7d0c2946f
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef int ll; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; #define Max 1000001 #define inf INT_MAX #define llinf LONG_LONG_MAX #define f(i,n) for(i=0;i<n;i++) #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL) #define p...
C++
9d3ab9c33b69c4f8e60454d369704b30
c04a2ae3a6b21f2878f0db6a2b519075
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; #define Max 1000001 #define inf INT_MAX #define llinf LONG_LONG_MAX #define f(i,n) for(i=0;i<n;i++) #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)...
C++
9d3ab9c33b69c4f8e60454d369704b30
fbc45be660dcb4fc1f4c1c91404bc50e
1,900
PASSED