source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
import sys import os def changeStdioToFile(): path = os.path.dirname(os.path.abspath(__file__)) sys.stdin = open(f'{path}/input.txt', 'r') sys.stdout = open(f'{path}/output.txt', 'w') #changeStdioToFile() t = 1 for _ in range(t): n = int(input()) orders = input() rooms = ['0'] * 10 for c in orders: ...
Python
a6cbf01d72d607ca95fe16df4fb16693
213190aa1eece061bc85aa04201b3ecf
800
PASSED
#include<bits/stdc++.h> #define int long long int using namespace std; signed main() { int t; cin>>t; while(t--) { int n; cin>>n; int ar[n+1],dp[n+1]; for(int i=1;i<n+1;i++) { cin>>ar[i]; dp[i]=1; } int ans=1; ...
C++
0197047cab6d83a189a5c1eabf5b1dd3
f8959964b507f83b4929fcffb4bb0508
1,400
PASSED
// // main.cpp // 2 // // Created by RISHAV SINGH MEHTA on 12/05/20. // Copyright © 2020 RISHAV SINGH MEHTA. All rights reserved. // #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <string> #include <math.h> #define ll long long using namespace std; vector<ll int> ...
C++
0197047cab6d83a189a5c1eabf5b1dd3
f2926480854561400358e989f793a5e5
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define rip ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); vector <long long> ans(100100),vect(100100); long long n,max1=1; long long fin(long long index) { if(ans[index]!=-1) return ans[index]-1; else { long long val=0,val2=1; ...
C++
0197047cab6d83a189a5c1eabf5b1dd3
3bd9be9927bdcb263980e7e86e16a74c
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define E "\n" #define int long long #define f(i,l,n) for(int i=l;i<n;i++) const int N=1e6+5; int solve() { int n; cin >> n ; vector<int> a(n+1); for(int i=1;i<=n;i++) cin >> a[i]; int ans=1; int dp[n+1]={0}; f(i,1,n+1) { dp[i]=1; for(int j=1;j*j<=i;j++) ...
C++
0197047cab6d83a189a5c1eabf5b1dd3
58217c51e01fab37cf096cf716f57504
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 100000000 #define MAXN 100005 void solve() { int n; cin>>n; int a[n],dp[n+10]; memset(dp,0,sizeof(dp)); for(int i=1;i<=n;i++){ cin>>a[i]; } int ans=1; for(int i=1;i<=n;i++){ dp[i]=max(1LL,dp[i]); for(int j...
C++
0197047cab6d83a189a5c1eabf5b1dd3
d13b71da43400dc22fa75fa45b3d4ea6
1,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> using namespace std; #define ll long long #define pb push_back #define F first #defi...
C++
0197047cab6d83a189a5c1eabf5b1dd3
f7a8ef052eaf8e7110dd0bbced40b057
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int a[n+1],b[n+1]={0},i,j,x,y,k; for(i=1;i<=n;i++) { cin>>a[i]; b[i]=1; } for(i=n/2;i>0;i--) { k=i; ...
C++
0197047cab6d83a189a5c1eabf5b1dd3
f7baf4dc9622ca07dd925ad417ad698a
1,400
PASSED
#include <bits/stdc++.h> #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) #define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--) template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }...
C++
0197047cab6d83a189a5c1eabf5b1dd3
8d3286c68c28ef33fce3b7037fd3e7d9
1,400
PASSED
#include<bits/stdc++.h> using namespace std; long long ans=1; void dfs(long long x,long long cnt,long long arr[],long long n) { ans=max(ans,1LL*cnt); for(long i=x+x;i<=n;i+=x) { if(arr[x]<arr[i]) dfs(i,cnt+1,arr,n); else dfs(i,1,arr,n); } } int main() { ...
C++
0197047cab6d83a189a5c1eabf5b1dd3
4e1f31326fddc684b598f9f34ba2fa9d
1,400
PASSED
#include <iostream> #include <set> #include <map> #include <vector> #include <stack> #include <queue> #include <cmath> using namespace std; #define ll long long #define vi vector<int> #define ull unsigned long long #define vull vector<ull> #define vll vector<ll> #define pii pair<int, int> #define pll pair<ll, ll> #...
C++
0197047cab6d83a189a5c1eabf5b1dd3
c8b84d096bb29cfb5c0779edf0641340
1,400
PASSED
#include <iostream> using namespace std; const int MX=1e5+1; double a[MX];long long p[MX],k[MX]; main(){ long long n,in;cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n;i++) cin>>in,a[i]-=in; for(int i=2;i<=n;i++) cin>>p[i]>>k[i]; for(int i=n;i>=2;i--) a[i]<0?a[p[i]]+=a[i]*k[i]:a[p[i]]+=a[i]; cout<<(a[...
C++
159f163dd6da4668f01a66ddf746eb93
fc3092e2efaeaaf6b84b3b59aac6a059
2,300
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; const int MX = 1e5 + 1; double a[MX]; int p[MX], k[MX]; void GG () { cout << "NO"; exit(0); } int m(int a, int b) { if(b > 1e18 / -a) GG (); return a * b; } main () { int n, in; cin >> n; for(int i = 1; i <= n; i ++) cin >> a[i]; for(int i = 1; i ...
C++
159f163dd6da4668f01a66ddf746eb93
ad3c37b85ef53232157e32ff47f2f23b
2,300
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; const int MX = 1e5 + 1; double a[MX]; int p[MX], k[MX]; main () { int n, in; cin >> n; for(int i = 1; i <= n; i ++) cin >> a[i]; for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in; for(int i = 2; i <= n; i ++) cin >> p[i] >> k[i]; for(int i = n; i...
C++
159f163dd6da4668f01a66ddf746eb93
354fd11ccb821439a89df9a70d55b291
2,300
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long struct vl{ int x,y,z; bool operator<(const vl& t)const{ if(x==t.x)return y<t.y; return x<t.x; } }; const int INF = 1e18; const int mod = 1e9+7; const int MAXN = 1e6+69; int q=1,m,n,x,y,z,k,l; vector<int> a[MAXN]; string s; vector...
C++
159f163dd6da4668f01a66ddf746eb93
d554f558910f3d4431eb0d9733520a09
2,300
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/priority_queue.hpp> //#pragma GCC optimize("O3") //#pragma GCC target("sse4") //#pragma GCC target("avx2") #define deb(x) cout << #x << " = " << x << "\n" #define all(x) (x).begin(), (x).end() #de...
C++
159f163dd6da4668f01a66ddf746eb93
3b042954ddf71e4a3bf3f45a20308bb3
2,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll oo = 1e18; const int N = 100005; vector<pair<int, int>> g[N]; int n; ll b[N], a[N]; ll dfs(int u) { ll me = b[u] - a[u]; for(auto [v, k] : g[u]) { ll tmp = dfs(v); if(tmp < 0) { if(-tmp > oo / k) { printf("NO\n"); exit(...
C++
159f163dd6da4668f01a66ddf746eb93
73d90418e190ffc9bd6114a47b07c3e1
2,300
PASSED
#include "bits/stdc++.h" using namespace std; using LL = long long; constexpr int N = 1e5 + 5; constexpr LL INF = 2e17; LL have[N], need[N]; int x[N], k[N]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 1; i <= n; i++) cin >> have[i]; for (int i = 1;...
C++
159f163dd6da4668f01a66ddf746eb93
6ea0e7769a24a05e9ba4a1f399d7be34
2,300
PASSED
///Bismillahir Rahmanir Rahim #include "bits/stdc++.h" #define ll long long #define int ll #define fi first #define si ...
C++
159f163dd6da4668f01a66ddf746eb93
99beebad1f8ddf40594e4abb9c0f99f0
2,300
PASSED
#include <bits/stdc++.h> using namespace std; long long a[1000001]; bool ok=1; long long b[1000001]; long long k[1000001]; vector<int> adj[1000000]; long long need[1000000]; void dfs(int v) { need[v]=b[v]-a[v]; for (auto u:adj[v]) { dfs(u); if (need[u]>0) { if (1000000000...
C++
159f163dd6da4668f01a66ddf746eb93
4d164c847ca45ea1ed5a14a942d01f29
2,300
PASSED
#include<stdio.h> #include<vector> #include<algorithm> #include <iostream> #include <cmath> #include <complex> #include<queue> #include <string> #include<bits/stdc++.h> #define pi 3.141592654 #define forr(i,a,b) for(int i=a;i<=b;i++) #define F first #define S second #define input ios_base::sync_with_stdio(0);cin.tie(0)...
C++
159f163dd6da4668f01a66ddf746eb93
b83d124f0f244ec90a82496b061baa9d
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[ 2000000 ]; ll b; int main() { ios_base::sync_with_stdio(false), cin.tie( nullptr ), cout.tie( nullptr ); const auto read_int = [] () { int x; cin >> x; return x; }; int n = read_int(); for( int i = 0; i < n; i++ ) a[ i ]...
C++
93f6404a23bd2ff867d63db9ddf868ff
92e8fbe8d938c54f93fbe815f6ec0c4c
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[ 2000000 ]; int main() { const auto read_int = [] () { int c = getchar(); while ( !isdigit(c) ) c = getchar(); int x = c - '0', y = x << 1; for( c = getchar(); isdigit(c); c = getcha...
C++
93f6404a23bd2ff867d63db9ddf868ff
e6e480320036d43ad23de5edc28a2ba8
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false), cin.tie( nullptr ), cout.tie( nullptr ); const auto read_int = [] () { int x; cin >> x; return x; }; int n = read_int(); vector< int > a; map< int, int > b; ll c = 0; for( int i ...
C++
93f6404a23bd2ff867d63db9ddf868ff
2676684699e7d02366e14a8b5787e13b
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[ 2000000 ], n; ll b; int main() { ios_base::sync_with_stdio(false), cin.tie( nullptr ), cout.tie( nullptr ), cin >> n; for( int i = 0; i < n; i++ ) cin >> a[ i ]; sort( a, a + n ), reverse( a, a + n ); for( int i = 0...
C++
93f6404a23bd2ff867d63db9ddf868ff
b2ed0722f9ecd488f6ca766058fb0c0e
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false), cin.tie( nullptr ), cout.tie( nullptr ); const auto read_int = [] () { int x; cin >> x; return x; }; int n = read_int(); vector< int > a; ll c = 0; for( int i = 0; i < n; i++ ) ...
C++
93f6404a23bd2ff867d63db9ddf868ff
fccfe85e4497b253e516edb31007d33b
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[ 2000000 ]; ll b; int main() { ios_base::sync_with_stdio(false), cin.tie( nullptr ), cout.tie( nullptr ); const auto read_int = [] () { int x; cin >> x; return x; }; int n = read_int(); for( int i = 0; i < n; i++ ) a[ i ]...
C++
93f6404a23bd2ff867d63db9ddf868ff
edfecf015e1512c29aec297fd9d544d5
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int read_int() { register int c = getchar(); while ( !isdigit(c) ) c = getchar(); register int x = c - '0', y = x << 1; for( c = getchar(); isdigit(c); c = getchar() ) x = c - '0', x += y, x += y << 2, y = x << 1; ...
C++
93f6404a23bd2ff867d63db9ddf868ff
87ebc984c8f8c66568b92e338ebb708b
1,400
PASSED
/* #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") #pragma comment(linker, "/stack:200000000") */ #include <bits/stdc++.h> #define pb push_back #define pf push_front #define ff first #define ss second #define pi acos(-1.0) #define lb lower_bound #define ub upp...
C++
93f6404a23bd2ff867d63db9ddf868ff
8c13323e2383872b4fbf3a1c65b21dfd
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef signed long long sll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL); ll n; cin >> n; vector <ll> v(n,0); for (int i = 0; i < n; ++i) cin >> v[i]; sort(v.rbegin(), v.rend()); ll s...
C++
93f6404a23bd2ff867d63db9ddf868ff
18c7bba62c951d5573daac865584bf69
1,400
PASSED
#include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define int long long int #define mod 1000000007 #define f0(n) for(int i=0;i<n;i++) #define vi vector<int> #define vs vector<string> #define mp make_pair #define pb push_back #define rt return #define sumof(arr) accu...
C++
93f6404a23bd2ff867d63db9ddf868ff
0e861d6f1dfe5edceb3658d10f941bbf
1,400
PASSED
n, m = map(int, raw_input().split()) a = map(int, raw_input().split()) b = {} for ai in a: b[ai] = [] amt = 0 for i in xrange(1, len(a)): amt += abs(a[i] - a[i-1]) if a[i] - a[i-1]: b[a[i]] += [a[i-1]] b[a[i-1]] += [a[i]] diff = 0 for bi in b: if b[bi]: center = sorted(b[bi])[len...
Python
871674fbb434121f41539c9f094432ac
8866d123964e9059df0bcee37ee346f7
1,800
PASSED
n, m = map(int, raw_input().split()) a = map(int, raw_input().split()) b = {} for ai in a: b[ai] = [] amt = 0 for i in xrange(1, len(a)): amt += abs(a[i] - a[i-1]) if a[i] - a[i-1]: b[a[i]] += [a[i-1]] b[a[i-1]] += [a[i]] diff = 0 for bi in b: if b[bi]: center = sorted(b[bi])[len...
Python
871674fbb434121f41539c9f094432ac
7865de64d639fd341efbaf86a09772f8
1,800
PASSED
r=raw_input;r() L=map(list,7**6*[[]]) a=map(int,r().split()) for i,j in zip(a,a[1:]): if i!=j:L[i]+=[j];L[j]+=[i] z=b=0 Q=lambda l,i:sum(abs(i-v)for v in l) for i,l in enumerate(L): if l:t=Q(l,i);z+=t;b=min(b,Q(l,sorted(l)[len(l)/2])-t) print z/2+b
Python
871674fbb434121f41539c9f094432ac
42e5b57c0e81d43be83ac500b7deb464
1,800
PASSED
r=raw_input;r() L=map(list,7**6*[[]]) a=map(int,r().split()) for i,j in zip(a,a[1:]): if i!=j:L[i]+=[j];L[j]+=[i] z=b=0 Q=lambda l,i:sum(abs(i-v)for v in l) for i,l in enumerate(L): if l:t=Q(l,i);z+=t;b=min(b,Q(l,sorted(l)[len(l)/2])-t) print z/2+b
Python
871674fbb434121f41539c9f094432ac
6cf87621480efa90d92a9729967e476b
1,800
PASSED
r=raw_input;r() L=map(list,7**6*[[]]) a=map(int,r().split()) for i,j in zip(a,a[1:]): if i!=j:L[i]+=[j];L[j]+=[i] z=b=0 Q=lambda l,i:sum(abs(i-v)for v in l) for i,l in enumerate(L): if l:t=Q(l,i);z+=t;b=min(b,Q(l,sorted(l)[len(l)/2])-t) print z/2+b
Python
871674fbb434121f41539c9f094432ac
a634075cc82593d0e5c5b92e45ff4287
1,800
PASSED
def main(): n, m = map(int, raw_input().split()) a = map(int, raw_input().split()) total = [[] for i in xrange(n + 1)] s = 0 for i in xrange(1, m): if a[i] != a[i - 1]: s += abs(a[i] - a[i - 1]) total[a[i]].append(a[i - 1]) total[a[i - 1]].append(a[i]) maxDec = 0 for i in xrange(1, n + 1): if not to...
Python
871674fbb434121f41539c9f094432ac
2e0f3b33c9f3ff07c1ae21d2c1e4e080
1,800
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Codeforces { class Program { public static readonly int MOD = Convert.ToInt32(1e9 + 7); public static readonly int oo = Convert.ToInt32(1e9); public static ...
C#
871674fbb434121f41539c9f094432ac
548272c42a7f84186b8a5cd4b66fd767
1,800
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Codeforces { class Program { public static readonly int MOD = Convert.ToInt32(1e9 + 7); public static readonly int oo = Convert.ToInt32(1e9); public static ...
C#
871674fbb434121f41539c9f094432ac
2c8da2a31624fd8aa3747544bcb8cae1
1,800
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Codeforces { class Program { public static readonly int MOD = Convert.ToInt32(1e9 + 7); public static readonly int oo = Convert.ToInt32(1e9); public static ...
C#
871674fbb434121f41539c9f094432ac
a7b2efb2838daf801116692e45f4f3db
1,800
PASSED
#if DEBUG using System.Reflection; using System.Threading.Tasks; #endif using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Numerics; using System.Globalization; namespace _433c_ { class Program { static string _inputFilename = "input.t...
C#
871674fbb434121f41539c9f094432ac
63aa97f90b09f3af1172adab354b9afa
1,800
PASSED
#include <bits/stdc++.h> #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define pb push_back #define show(x) cout << (#x) << " : " << x << endl; #define ll long long #define ld long double #define mp make_pair #define ff first #define ss seco...
C++
f5f163198fbde6a5c15c50733cfd9176
1115eccc25b318875c196ec419db51fe
1,500
PASSED
#include<cstdio> #include<cstdlib> #include<map> #include<set> #include<string> #include<cstring> #include<sstream> #include<iostream> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<vector> #define fi first #define se second #define ll long long #define PI acos(-1.0) #define pb push_back #...
C++
f5f163198fbde6a5c15c50733cfd9176
6b079ad677991365bce4859348afa6b2
1,500
PASSED
#include<cstdio> #include<cstdlib> #include<map> #include<set> #include<string> #include<cstring> #include<sstream> #include<iostream> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<vector> #define fi first #define se second #define ll long long #define PI acos(-1.0) #define pb push_back #...
C++
f5f163198fbde6a5c15c50733cfd9176
41f907cf96e235dba98e026d8bd4463c
1,500
PASSED
#include<cstdio> #include<cstring> #include<map> #include<stack> #include<algorithm> #define ll long long int #define MAX 300010 using namespace std; map<ll,ll>mp; char str[MAX]; int main() { ll i,n,len,m,k; ll counts,ans,sum; scanf("%lld",&n); getchar(); m=0; ans=0; while(n--) { ...
C++
f5f163198fbde6a5c15c50733cfd9176
369609a857766c9988ef10d2698648a2
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define ll long long int #define ld long double #define vi vector<ll> #define vii vector<pair<ll,ll> > #define pll pair<ll,ll> #define f(i,a,b) for(ll i=a;i<b;i++) #define rev(i,a,b) for(ll i=a;i>=b;i--) #...
C++
f5f163198fbde6a5c15c50733cfd9176
8d118a9b4714c11cab36f06ce4d71c41
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define MAXN 300500 long long aperte[MAXN]; long long chiuse[MAXN]; int main(){ // freopen("input.txt","r",stdin); int N; cin >> N; while( N-- ){ string str; cin >> str; long long open = 0; long long close = 0; if( str.back() == '(' && str.front() == ')' ) cont...
C++
f5f163198fbde6a5c15c50733cfd9176
ab81c6ea13a0ac0e79f0dc4c250d3067
1,500
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <utility> using namespace std; unsigned long long Open[300100], Close[300100]; int main() { ios::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; // vector<pair<int, int>> v; char ch; cin.get(ch); unsigned long ...
C++
f5f163198fbde6a5c15c50733cfd9176
ce8b43eb206b1ade5933b598b6360921
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define IO ios_base::sync_with_stdio(0);cin.tie(0); int main() { IO; int n; cin >> n; map <int, int> m; long long res = 0; map <int, int> me; for (int i = 0; i < n; ++i) { int mn = 1e9 + 7; int bal = 0; string s; cin >> s; for (auto e...
C++
f5f163198fbde6a5c15c50733cfd9176
cd3212ed231338e24815c7b3a4283520
1,500
PASSED
#pragma GCC optimize("O2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<double,double> pdd; typedef pair<ld,ld> pld; typ...
C++
f5f163198fbde6a5c15c50733cfd9176
4793cfa192797e1010d12de08fc45e8d
1,500
PASSED
// In The Name Of Allah // // Mohammad Hosseini #include <bits/stdc++.h> #define ss second #define ff first #define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define ret(n) return cout << n, 0 #define...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
e4bea2afd76269700bc9fd275ae67361
2,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int lli; const int LOG = 20; const int MAXN = 500010; class FenwickTree { public: void update(int i, int v) { for( ; i < MAXN ; i += i & -i) BIT[i] += v; } int query(int i) { int ans = 0; for( ; i > 0 ; i -= i & -i) ans +=...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
6ba68de3fd40f50b54abaf68753509dc
2,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 200005, Q = 500005; int n, q, trans[2 * N][26], fail[2 * N], dep[2 * N], tot = 1, lst = 1, sz, root[2 * N], pos[N], l[Q], r[Q], k[Q]; ll ans[Q]; vector<int> qry[2 * N], g[2 * N]; char in[N]; int extend(int p, int c) { if (trans[p][c])...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
747254f00df33c58f2ea005d76c11cad
2,800
PASSED
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <bits/stdc++.h> using namespace std; #define long long long const long MOD = 1e9+7, LINF = 1e18 + 1e16; const int INF = 1e9+1; const double EPS = 1e-10; const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
b234e6ba6e523075640e4b04272286f7
2,800
PASSED
/*================================================================ * Copyright (C) 2019 Sangfor Ltd. All rights reserved. * * 文件名称:E.cpp * 创 建 者: badcw * 创建日期: 10/22/19 * ================================================================*/ #include <bits/stdc++.h> #define ll long long using namespace std; const...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
c2c4e6584b764b29776b0e391e791500
2,800
PASSED
/*================================================================ * Copyright (C) 2019 Sangfor Ltd. All rights reserved. * * 文件名称:E.cpp * 创 建 者: badcw * 创建日期: 10/22/19 * ================================================================*/ #include <bits/stdc++.h> #define ll long long using namespace std; const...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
7df76910fe4327575d00b43c6d04c392
2,800
PASSED
/*================================================================ * * 创 建 者: badcw * 创建日期: 2020/6/20 1:41 * ================================================================*/ #include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 2e5 + 50; const int mod = 1e9 + 7; ll qp(ll a, ll n, ...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
6d1fbd755e76b4812f7c30fa9deef57b
2,800
PASSED
/*================================================================ * Copyright (C) 2019 Sangfor Ltd. All rights reserved. * * 文件名称:E.cpp * 创 建 者: badcw * 创建日期: 10/22/19 * ================================================================*/ #include <bits/stdc++.h> #define ll long long using namespace std; const...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
4bb5f80a14e2122e225db23504b4c96b
2,800
PASSED
#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <numeric> #include <functional> #include <unordered_map> #include <queue> #include <set> #include <r...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
56b0cded3a8450c99a2be10423e967b4
2,800
PASSED
#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <numeric> #include <functional> #include <unordered_map> #include <queue> #include <set> #include <r...
C++
1ce1fdce039eb779382fb4ae0d4bbe35
953822fd40dd105f46862b13e0fbc617
2,800
PASSED
#include<stdio.h> #include<algorithm> using namespace std; #define N 100005 struct node { int l,r; }tree[4*N]; int val[20][N]; int num[20][N]; __int64 sum[20][N]; int b[N]; __int64 VAL,SUM; struct s { int count1,count2; __int64 sum1,sum2; }s[N]; bool cmp(int a,int b) { if (a<b) return 1; return 0; } void bu...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
8b2cf4243c3b3ed5e01076b572b81690
2,000
PASSED
#include "stdio.h" #include "set" #define MAXN 100100 #define ABS(a) ((a)<0 ? -(a) : (a)) int n, len; int a[MAXN]; struct CMyCmp { bool operator ()( int i, int j ) const { return (a[i] > a[j] ) || ( a[i] == a[j] && i < j ); } }; typedef std::set< int, CMyCmp > CSet; void process( long long & an...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
96413777720499a2b6c3d5b5b6d1cf43
2,000
PASSED
#include <cassert> #include <iostream> #include <cstdlib> #include <cstdio> #include <cmath> #include <set> #include <vector> #include <string> #include <string.h> #include <algorithm> using namespace std; #define FOR(i,a,b) for (int i = (a); (i) <= (b); ++(i)) #define mp make_pair #define inf 2000000000 #define pb p...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
242413ea533daf6c1fec50e783e6f28c
2,000
PASSED
#include <stdlib.h> #include <time.h> #include <vector> #include <math.h> #include <algorithm> #include <sstream> #include <iostream> #include <fstream> #include <string> #include <string.h> #include <map> #include <stack> #include <queue> #include <utility> #include <set> using namespace std; const int M=100000+10; ...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
4cf61f8b5d7da5cd911a1ec5368381d3
2,000
PASSED
# include <iostream> # include <cstdio> # include <vector> #include <string> #include <algorithm> #include <queue> #include <set> using namespace std; #define ll long long const int MN = 1000 * 100 + 10; int n, len, k; int arr[MN]; multiset <int> curr, wait; multiset <int> :: iterator it; ll solve() { curr.c...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
b98b453bfc92bbccaa2013289db06aad
2,000
PASSED
#pragma comment(linker, "/STACK:25600000") #define _CRT_NO_WARNINGS #include <iostream> #include <cstdlib> #include <cstdio> #include <cmath> #include <ctime> #include <string> #include <vector> #include <list> #include <algorithm> #include <cstring> #include <map> #include <queue> #include <set> #include <cassert> usi...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
deb489d2bd58921885aab85f12aec6ad
2,000
PASSED
#include <cstdio> #include <cmath> #include <cstdlib> #include <cstring> #include <vector> #include <queue> #include <string> #include <set> #include <map> #include <algorithm> #include <sstream> #include <iostream> #include <numeric> using namespace std; int nextInt() { int x; scanf("%d", &x); return x; }...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
d7e39b42ca15df73cbac665848412600
2,000
PASSED
#include<cstdio> #include<set> typedef __int64 LL; #define MAXN 100010 #define MAX(a,b) ((a)>(b)?(a):(b)) using namespace std; LL a[MAXN]; struct SET { int limit; LL big,small; multiset<LL>high; multiset<LL,greater<LL> >low; void Init(int x) { limit=x; big=small=0; high.c...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
e4dc7bfcbb1128259acf2cd9b3c2906a
2,000
PASSED
#define _CRT_SECURE_NO_DEPRECATE #include <iostream> #include <cmath> #include <cstdio> #include <set> using namespace std; #define inf 1000000000 #define ll long long #define eps 1e-9 #define L(s) (int)((s).size()) int a[111111]; int k, n, m; multiset<int> opt_pos, opt_neg, oth_pos, oth_neg; ll sum_pos, sum_neg, rest_...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
f3f6bc553dbf65cd86ab02b47292a65c
2,000
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _SECURE_SCL 0 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include <iostream> #include <queue> #include <deque> #include <stack> #include <list> ...
C++
e9316c4d29bac2c4d1f7cffeb3eca800
ca752707de6c237a4225cd648d242fa9
2,000
PASSED
// KALAM # include <bits/stdc++.h> using namespace std; const int N = 100000 + 77; int n , m , l = 0 , r = 1e9 + 1 , ts = 1 , inf = 1e9; bool t[N]; int main(){ scanf("%d %d" , & m , & n);inf = m;r = m + 1; for(int i = 1;i <= n;i ++){ printf("%d\n" , inf);fflush(stdout); int p;scanf("%d" , & p); if(p == 0){retu...
C++
f06dff83491772f8879e45b90b61dc88
097522bc0e1b554c2744a51873721edc
1,800
PASSED
# include <bits/stdc++.h> # define y1 aasjdladljskdj using namespace std; typedef long long ll; typedef long double ld; typedef pair < int, int > pii; typedef unsigned long long ull; const int N = int(2e5) + 5; const int inf = (int)1e9 + 9; int m, n; int p[N]; int guess(int x){ cout << x << endl; cin >> x; ...
C++
f06dff83491772f8879e45b90b61dc88
c441a9b74debf8bfe9cbb2d7511b972d
1,800
PASSED
#include<bits/stdc++.h> #define fls fflush(stdout) using namespace std; int a[35]; int main () { int m,n,tmp; scanf("%d%d",&m,&n); for(int i=1;i<=n;i++) { printf("1\n"); fls; scanf("%d",&tmp); if(!tmp) return 0; if(tmp==1) a[i]=1; if(tmp==-1) a[i]=-1; } in...
C++
f06dff83491772f8879e45b90b61dc88
122b1b4af1e7da5d71105154e56670a8
1,800
PASSED
//This Code was made by Chinese_zjc_. #include <iostream> #include <fstream> #include <iomanip> #include <algorithm> #include <vector> #include <bitset> #include <cmath> #include <queue> #include <stack> #include <list> #include <string> #include <cstring> #include <cstdio> #include <cstdlib> #include <cctype> #include...
C++
f06dff83491772f8879e45b90b61dc88
6e02cad502edf7d69e7994cb596de0b2
1,800
PASSED
#include<iostream> #include<cstdio> using namespace std; int a[31]; int main() { int n,m,i;scanf("%d%d",&m,&n); for(i=0;i<n;i++){printf("1\n");fflush(stdout);scanf("%d",&a[i]);} int l=1,r=m,mid,x; for(i=0;l<=r;i++){ mid=(l+r)>>1;printf("%d\n",mid);fflush(stdout);scanf("%d",&x); if(x*a[i%n]==0){printf("%d\n",m...
C++
f06dff83491772f8879e45b90b61dc88
1180427c3ab596e3d75c062e7920b5f8
1,800
PASSED
#include <iostream> #include <cstdio> #include <algorithm> int a[60]; int n, m; using namespace std; int main() { cin >> n >> m; for (int i = 0; i < m; ++i) { cout << n << endl; fflush(stdout); cin >> a[i]; if (a[i] == 0) return 0; } int l = 1, r = n, mid...
C++
f06dff83491772f8879e45b90b61dc88
f93183a12d4985737dced97c34ce6585
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int const N = 1e3 + 5; int m, n; int type[N]; int main() { // freopen("inp.txt", "r", stdin); cin >> m >> n; fflush(stdout); for (int i = 0; i < n; i++) { cout << 1 << endl; fflush(stdout); cin >> type[i]; fflush(stdout); ...
C++
f06dff83491772f8879e45b90b61dc88
dd9ff9af1d2e82291c26e16e1374a739
1,800
PASSED
/** *Makacha **/ #include <bits/stdc++.h> using namespace std; template <typename T> inline void read (T &x) { bool b = 0; char c; while (!isdigit (c = getchar()) && c != '-'); if (c == '-') c = getchar(), b = 1; x = c - 48; while (isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - 48; if (b) x = -x; } template...
C++
f06dff83491772f8879e45b90b61dc88
c33a1b212e288340349386380c8aaf8c
1,800
PASSED
#include <iostream> #include <cstdio> using namespace std; inline char gc(){ static char buf[100000],*p1=buf,*p2=buf; return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++; } #define gc getchar inline int read(){ int x=0;char ch=gc();bool positive=1; for(;!isdigit(ch);ch=gc())if(ch==...
C++
f06dff83491772f8879e45b90b61dc88
303886e8b2a12ecbbe083d41bc7c35be
1,800
PASSED
#include "bits/stdc++.h" #define ll long long #define rep2(i,a,b) for(int i=a;i<=b;++i) #define rep(i,n) for(int i=0;i<n;i++) #define pii pair<int,int> #define tii tuple<int,int,int> #define pq priority_queue<int> #define pqg priority_queue<int,vector<int>,greater<int>> #define pb push_back #define edge(v,a,b) v[a].pb(...
C++
f06dff83491772f8879e45b90b61dc88
4a1113cebe6ac8fb9a1b2dd5daad271b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define in(a,x,y) (a>=x && a<=y) #define out(a,x,y) (!in(a,x,y)) #define sz(a) ((int)a.size()) #define repv(i,a) for(int i=0;i<sz(a);i++) #define revv(i,a) for(int i=sz(a)-1;i>=0;i--) #define rep(i,a,b) for(int i=a;i<=b;i++) #define rev(i,a,b) for(int i=a;i>=b;i--) #define...
C++
930365b084022708eb871f3ca2f269e4
7a55142c38eb2f6f4032d627b3f320aa
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <set> #include <map> #include <stack> #include <vector> #include <string> #include <queue> #include <cstdlib> #include <cmath> #include <algorithm> using namespace std; typedef pair<int, int> pii; typedef long long ull; typedef long long ll; typedef vect...
C++
930365b084022708eb871f3ca2f269e4
f43e80a2aa7fb87f09dbb587b0736074
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <set> #include <map> #include <stack> #include <vector> #include <string> #include <queue> #include <cstdlib> #include <cmath> #include <algorithm> using namespace std; typedef pair<int, int> pii; typedef long long ull; typedef long long ll; typedef vect...
C++
930365b084022708eb871f3ca2f269e4
e4b0f0cb1736af7f9754454bdcb98adb
1,700
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) #define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--) #define fore(i, l, r) for (int i = int(l); i < int(r); i++) #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m)) #define all(a) (a).begin(), (a).end() #define s...
C++
930365b084022708eb871f3ca2f269e4
5092498136e8fab736d1a4df729e3850
1,700
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) #define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--) #define fore(i, l, r) for (int i = int(l); i < int(r); i++) #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m)) #define all(a) (a).begin(), (a).end() #define s...
C++
930365b084022708eb871f3ca2f269e4
87f0beaac4bffdbfdec3c448aa06379e
1,700
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) #define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--) #define fore(i, l, r) for (int i = int(l); i < int(r); i++) #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m)) #define all(a) (a).begin(), (a).end() #define s...
C++
930365b084022708eb871f3ca2f269e4
29f0657c27fd73cea77879ad39b6010c
1,700
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) #define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--) #define fore(i, l, r) for (int i = int(l); i < int(r); i++) #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m)) #define all(a) (a).begin(), (a).end() #define s...
C++
930365b084022708eb871f3ca2f269e4
4897e5914f6709751af88e730b12e323
1,700
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) #define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--) #define fore(i, l, r) for (int i = int(l); i < int(r); i++) #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m)) #define all(a) (a).begin(), (a).end() #define s...
C++
930365b084022708eb871f3ca2f269e4
343e2232e01afe380859d5290c548ec8
1,700
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) #define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--) #define fore(i, l, r) for (int i = int(l); i < int(r); i++) #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m)) #define all(a) (a).begin(), (a).end() #define s...
C++
930365b084022708eb871f3ca2f269e4
e24af854d58df3893e84b221fd14a34c
1,700
PASSED
#include<bits/stdc++.h> using namespace std; int n; string s[50001]; bool cmd(string a , string b) { return (a+b < b+a); } int main() { cin>>n; for(int i = 0 ; i < n ; i ++) cin>>s[i]; sort(s , s+n , cmd); for(int i = 0 ; i < n ; i ++) cout<<s[i]; }
C++
930365b084022708eb871f3ca2f269e4
8a6bdee5a5deee9e39c6f15a92a0623c
1,700
PASSED
#include<bits/stdc++.h> using namespace std; vector<int>v; int A[100005]; int main(){ memset(A,-1,sizeof(A)); int q;cin>>q; for(int i=0;i<q;i++){ int x,y;scanf("%d%d",&x,&y); int res=0; for(int j=1;j*j<=x;j++){ if(x%j)continue; if(A[j]==-1||i-A[j]>y)res++; if((A[x/j]==-1||i-A...
C++
ae10ebd2c99515472fd7ee6646af17b5
aac93d49ddd5834d32afec14c07ad717
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<map> #include<cmath> #include<vector> #include<algorithm> #include<iomanip> #include<cmath> #include<stack> #include<math.h> #include<set> #include<string> #include<cstring> #include<queue> #include<complex> #include<assert.h> #include<math.h> #include<memo...
C++
ae10ebd2c99515472fd7ee6646af17b5
57856c1f71ff636ba637f4e5568dfbf5
1,900
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e5; vector<int> mem[N + 1]; vector<int> last(N + 1, -1e9); vector<int> &get_dividers(int n) { if (!mem[n].empty()) { return mem[n]; } for (int i = 1; i * i <= n; i++) if (n % i == 0) { mem[n].push_back(i); ...
C++
ae10ebd2c99515472fd7ee6646af17b5
59fee3abf7f39679a97952b1319b1045
1,900
PASSED
#include <iostream> using namespace std; int n , x , d[100008] , y ; int sol(int i , int y){ int j; int ans=0; for (j=1 ; j*j<x ; j++){ if (x%j==0){ if (d[j]<i-y) ans++; d[j]=i; if (d[x/j]<i-y) ans++; d[x/j]=i; } }...
C++
ae10ebd2c99515472fd7ee6646af17b5
c96cb99c10bfc9c25ab54b110e569fcd
1,900
PASSED
#include <iostream> using namespace std; int n , x , d[100010] , y ; int sol(int i , int y){ int j; int ans=0; for (j=1 ; j*j<x ; j++){ if (x%j==0){ if (d[j]<i-y) ans++; d[j]=i; if (d[x/j]<i-y) ans++; d[x/j]=i; } }...
C++
ae10ebd2c99515472fd7ee6646af17b5
7ae30e693fbc053be7ca1ce336c6ad56
1,900
PASSED
#include <iostream> using namespace std; int n , x[100010] , d[100010] , y ; int sol(int i , int y){ int j; int ans=0; for (j=1 ; j*j<x[i] ; j++){ if (x[i]%j==0){ if (d[j]<i-y) ans++; d[j]=i; if (d[x[i]/j]<i-y) ans++; d[x[i]/j]=i...
C++
ae10ebd2c99515472fd7ee6646af17b5
5a8d33b8bb90bbed42e205a4501f0cd2
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define oo 1000000000 typedef long long int ll; map<int, int>mp; const int N = 100005; int n;vector<int>v; int x[N], y[N]; vector<int> findDiv(int a){ vector<int>s; for(int i=1;i*i<=a;i++){ if(!(a%i)){ if(a/i != i) s.push_bac...
C++
ae10ebd2c99515472fd7ee6646af17b5
670fc02ee2de212c065c5660bc00c123
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0); #define sfi(x) scanf("%d" , &x) #define sfi2(x, y) scanf("%d%d" , &x,&y) #define sfl2(x, y) scanf("%I64d%I64d" , &x,&y) #define sfl(x) scanf("%I64d" , &x) #define sfl3(x, y, z) scanf("%I64d%I64d%...
C++
ae10ebd2c99515472fd7ee6646af17b5
e45ef6abf447cb330167d5e53fcdc075
1,900
PASSED
#include <iostream> #include <stdio.h> #include <cmath> #include <algorithm> #include <memory.h> using namespace std; int n,x,y; int last[100001]; int main() { scanf("%d",&n); memset(last,-1,sizeof(last)); for(int i=0; i<n; i++) { scanf("%d%d",&x,&y); int z = max(0,i-y); int cnt = 0; for(int j=1; j*j<...
C++
ae10ebd2c99515472fd7ee6646af17b5
4c38af8705e9fb2f66616bc4099c2669
1,900
PASSED
#include <cstring> #include <cmath> #include <algorithm> #include <iostream> #include <vector> using namespace std; #define pb push_back vector<int > G[111111]; vector<int > pos[111111]; int main(){ #ifndef ONLINE_JUDGE freopen("G:/in.txt","r",stdin); //freopen("G:/myout.txt","w",stdout); #endif int n; cin>>n; for...
C++
ae10ebd2c99515472fd7ee6646af17b5
ea4957d2232252046e705fa9ce13e9d7
1,900
PASSED