source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define all(x) (x).begin(), (x).end() typedef int64_t lld; typedef pair<int, int> pii; template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> p){ return out << '(' << p.ff << ", " << p.ss <...
C++
50a48290983203dd52a611386f5c0905
752bccbe6d189c6e6e8f51423c259ac6
2,500
PASSED
#include<bits/stdc++.h> #define pb push_back using namespace std; using vi = vector<int>; int n, c = 0; vi x, y; vector<pair<int, int>> b; int main() { cin >> n; for(int t, i = 0; i < n; i++) { cin >> t, t -= i; auto it = upper_bound(x.begin(), x.end(), t); int p = it-x.begin(); if(it==x.end()) x.pb(t); els...
C++
50a48290983203dd52a611386f5c0905
ff1cee535494880d97b1963f64a89c8e
2,500
PASSED
#include <bits/stdc++.h> using namespace std; class SegmentTree { public: SegmentTree(int count) { n = count; data.assign(2 * n, 0); } void update(int idx, int value) { idx += n; data[idx] = value; while (idx > 1) { idx /= 2; data[idx] = std...
C++
50a48290983203dd52a611386f5c0905
52d496c0b3cbaedf0fc77b0ac80d3e45
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define fr(i,j,k) for(int i=j;i<k;i++) #define f(n) fr(i,0,n) #define f1(n) fr(i,1,n+1) #define pb push_back #define F first #define S second #define all(x) x.begin(), x.end() const int mod = 1e9 + 7; const int maxn = 200005; int n, a[maxn]; void go() {...
C++
50a48290983203dd52a611386f5c0905
97a435c7ad2936c3164857ad5d42ca1f
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn = 5e5 + 100; int a[maxn]; int tree[4*maxn]; void update(int node, int l, int r, int pos, int val) { if(l > r || l > pos || r < pos) return; if( l == r && l == pos) { tree[node] = max(tree[node], val); return; } i...
C++
50a48290983203dd52a611386f5c0905
72dd0a44661a08353dfa8d08b9f80448
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define inf 0x3f3f3f3f const int maxn = 2e6+100; int dp[maxn][2],a[maxn],b[maxn]; struct BIT{ #define lowbit(i) (i&-i) int S[maxn]={},n=0; void init(int x){ this->n=x; for(int i=0;i<=n;i++)S[i]=0; } void del(int x){ ...
C++
50a48290983203dd52a611386f5c0905
cced465ef63941a4cced20a2d532e872
2,500
PASSED
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int maxn = 200010,inf = 0x7fffffff; int n,a[maxn],b[maxn],cnt,ans = inf,f[maxn],g[maxn],c1[maxn],c2[maxn]; void add1(int x,int v) { while (x <= cnt) { c1[x] = max(c1[x],v); x += x & (-x); ...
C++
50a48290983203dd52a611386f5c0905
d9adcd4a1d4b57e5d89a08c9eb30c70c
2,500
PASSED
// FUCKED UP FUCKED UP FUCKED UP FUCKED UP FUCKED UP #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math") #define F first #define S second #define pb push_back #define SZ(x) (ll)(x.size()) #define all(x) x.begin(),x.end() #define MP make_pair typedef long...
C++
50a48290983203dd52a611386f5c0905
0cb024d1c7dcf8390b21819165679a7a
2,500
PASSED
// >>> TEMPLATES #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; #define int ll #define double ld #define rep(i,n) for (int i = 0; i < (int)(n); i++) #define rep1(i,n) for (int i = 1; i <= (...
C++
50a48290983203dd52a611386f5c0905
06e0c6a27ad876a06e289389ad115307
2,500
PASSED
#ifndef BZ #pragma GCC optimize "-O3" #endif #include <bits/stdc++.h> #define FASTIO #ifdef FASTIO #define scanf abacaba #define printf abacaba #endif typedef long long ll; typedef long long llong; typedef long double ld; typedef unsigned long long ull; using namespace std; /* ll pw(ll a, ll b) { ll ans = 1; whi...
C++
50a48290983203dd52a611386f5c0905
e7b79fc70221fb42904988f43ffaff3f
2,500
PASSED
#include <iostream> using namespace std; const int mx = 105; int a[mx]; int main() { int t; cin >> t; while (t--) { int n, m; int sum = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } if (sum == m) { cout << "YES" << endl; } else { cout << "NO" << endl;...
C++
941adee47c2a28588ebe7dfe16e0c91a
d119a8b65d804741cdf400275ddac0c9
800
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <string> #include <iomanip> #include <set> #include <stack> #include <math.h> using namespace std; #define ll long long int main() { int t = 1; cin >> t; while (t--) { int n, x, m; cin >> n >> m; ll sum = 0; for (int i = 0; i...
C++
941adee47c2a28588ebe7dfe16e0c91a
2be094629336d896118463d1b3046dd1
800
PASSED
#include<iostream> #include<algorithm> using namespace std; int arr[105]; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; int sum = 0; for (int i = 1; i <= n; i++) { cin >> arr[i]; sum += arr[i]; } if (sum == m) cout << "YES" << endl; else cout << "NO" << endl; } retu...
C++
941adee47c2a28588ebe7dfe16e0c91a
d369657cb31dba502b378d05ee38bb03
800
PASSED
#include <stdio.h> #include <stdlib.h> #pragma warning (disable :4996) int main() { int t = 0; scanf("%d", &t); for (int l = 1; l <= t; l++) { int n = 0; double sum = 0, arr[100] = { 0 }, m = 0; scanf("%d%lf", &n, &m); for (int h = 0; h < n; h++) { scanf("%lf", &arr[h]); } /*for (int h = 0; h < n...
C++
941adee47c2a28588ebe7dfe16e0c91a
4579db27b58c57339a724e9cd384eca2
800
PASSED
#include <algorithm> #include <cmath> #include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { int t; cin >> t; for (int q = 0; q < t; ++q){ int n, m; cin >> n >> m; int s = 0; for (int i = 0; i < n; ++i) { int x; cin >> x; s += x; } if (s == m) cout << "YES"; ...
C++
941adee47c2a28588ebe7dfe16e0c91a
9fdb85d3c2d0f4d27128bfb0747b42fc
800
PASSED
#include <array> #include <algorithm> #include <iostream> #include <fstream> #include <sstream> #include <functional> #include <iomanip> #include <numeric> #include <cstring> #include <cassert> #include <cstdio> #include <string> #include <vector> #include <bitset> #include <queue> #include <stack> #include <cmath> #in...
C++
941adee47c2a28588ebe7dfe16e0c91a
1854327d593e79d163b769a4e77ece2f
800
PASSED
#include <iostream> using namespace std; int main() { int t,n,m,i,sum; cin>>t; while(t) {t--;cin>>n>>m;sum=0; while(n) {n--;cin>>i;sum+=i;}if (sum==m) cout<<"YES"<<endl;else cout<<"NO"<<endl;} return 0; }
C++
941adee47c2a28588ebe7dfe16e0c91a
973449305b114d7836d5c291899c7c0e
800
PASSED
#include<iostream> using namespace std; int main(){ int t; cin>>t; while(t--){ long long n,m; cin>>n>>m; long long x,s=0; for(int i=0;i<n;i++){ cin>>x; s=s+x; } if(s==m){ cout<<"YES"<<endl; } else{ ...
C++
941adee47c2a28588ebe7dfe16e0c91a
7803c2f1b8f8a506e53658316cef0940
800
PASSED
#include <iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m, a[101],i; long long s = 0; cin >> n >> m; for (i = 1; i <= n; i++) { cin >> a[i]; s = s + a[i]; } if (s == m) cout << "YES" << endl; else cout << "NO" << endl; } }
C++
941adee47c2a28588ebe7dfe16e0c91a
007eaaa080078293478dbed5f8be27a3
800
PASSED
#include<iostream> #include<vector> int main() { int testcase{}; std::cin>>testcase; for(int i{0}; i < testcase; i++) { int size{},m{}; std::cin>>size>>m; int sum{0}; for(int j{0}; j < size; j++) { int input{}; std:...
C++
941adee47c2a28588ebe7dfe16e0c91a
0d036c5dc46fb7a07d7e06f9f2009181
800
PASSED
#include<iostream> #include<vector> #include<stdlib.h> #include<time.h> #include<math.h> #include<string.h> #include<algorithm> int main(void){ int n,m; int w; int max=-1; int size=0; int LitTime=0; int OffTime=0; std::vector <int> LitTimeTill; //a_iの時間までに点灯している時間 Cumulative sum std::vector <int> OffTimeTill;...
C++
085b03a45fec13b759c3bd334888caf5
567468f5b65bd8d8a6d82680e015741b
1,500
PASSED
#include<bits/stdc++.h> using namespace std; int a[100100]; int qz[100100]; int hz[100100]; int main(){ int n,m; scanf("%d%d",&n,&m); a[0]=0; a[n+1]=m; for(int i=1;i<=n;i++)scanf("%d",&a[i]); int tmp=0; for(int i=0;i<=n;i+=2){ qz[i]=tmp; tmp+=a[i+1]-a[i]; qz[i+1]=tmp; } if(n%2)qz[n+1]=tmp; tmp=0; if(n%...
C++
085b03a45fec13b759c3bd334888caf5
aede96038995ea2c86df04bfc2cb73b8
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; scanf("%d %d",&n,&m); int a[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); int left[n],right[n],rightlit[n],rightoff[n]; for(int i=0;i<n;i++){ if(i==0){ left[i]=a[i]; } else if(i%2==0&&i!=0){ l...
C++
085b03a45fec13b759c3bd334888caf5
41368c232d07b46ba90a20b63bcdec1a
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; scanf("%d %d",&n,&m); int a[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); int left[n],rightlit[n],rightoff[n]; for(int i=0;i<n;i++){ if(i==0){ left[i]=a[i]; } else if(i%2==0&&i!=0){ left[i]=le...
C++
085b03a45fec13b759c3bd334888caf5
adbfd68491051e6035351d375d6da87c
1,500
PASSED
// _oo0oo_ // o8888888o // 88" . "88 // (| -_- |) // 0\ = /0 // ___/`---'\___ // .' \| |// '. // / \||| : |||// \ // / _||||| -:- |||||- \ ...
C++
085b03a45fec13b759c3bd334888caf5
daeb777971c4a8234b72282e41741df4
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define loop(i,n) for(int i=1;i<n;i++) int main() { // your code goes here int n,m,i=0,min=m+1,val=0 ; long long isum=0,fsum=0,test=0 ; cin >>n >>m ; int a[n+2][3], stat[n+1] ; //loop(i,1000000) check[i]=0 ; loop(i,n+1) { cin >> a[i][0] ; if(i%2==0) ...
C++
085b03a45fec13b759c3bd334888caf5
3d6ca83aed2403d0e8b353fde7bfe727
1,500
PASSED
#include<iostream> #include<vector> using namespace std; struct self{ int left; int right; int len; long long afterlen; }; int main() { int n,m; cin>>n>>m; vector<self> v; int *p=new int[n+2]; p[0]=0; for(int i=1;i<=n;i++) cin>>p[i]; p[n+1]=m; long long cur_total=...
C++
085b03a45fec13b759c3bd334888caf5
c0bb382cae22fd8c22f90c90b014d128
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define maxn 100020 #define rep(i,l,r) for(register int i = l ; i <= r ; i++) #define repd(i,r,l) for(register int i = r ; i >= l ; i--) #define inf 1e8 typedef long long ll; inline int read(){ register int num = 0; register char ch = getchar(); while ( ch > '9' || ch <...
C++
085b03a45fec13b759c3bd334888caf5
80ccabdc5592e1b034b8a6c085e362c1
1,500
PASSED
/* ID: m.estek1 PROG: test LANG: C++ */ //In the name of Allah #include <bits/stdc++.h> using namespace std; ofstream fout("test.out"); ifstream fin("test.in"); #define int long long #define ll long long #define ld long double #define pb push_back #define pf push_front #define F first #define S second #define TL ios:...
C++
085b03a45fec13b759c3bd334888caf5
99df16bfbb8366957617670e75c5e210
1,500
PASSED
#include<algorithm> #include<clocale> #include<cmath> #include<complex> #include<csetjmp> #include<csignal> #include<cstdarg> #include<cstddef> #include<cstdio> #include<cstdlib> #include<cstring> #include<ctime> #include<deque> #include<iostream> #include<istream> #include<map> #include<math.h> #include<ostream> #incl...
C++
085b03a45fec13b759c3bd334888caf5
d6026e9ad0f6732631fdbe509b04b042
1,500
PASSED
#include<bits/stdc++.h> #define INF 0x3f3f3f3f #define par pair< long long int, long long int> #define st first #define nd second #define mp(x,y) make_pair(x,y) #define sti pair<string,int> # define PI 3.141592653589793238462643383279502884L using namespace std; bool func(par a, par b){ int prodvect = a...
C++
e7ffe7a54e2403805bde98d98fa0be3a
d3aaf85c89d89ef2641c696d34dcedae
2,300
PASSED
t = int(input()) for _ in range(t): n = int(input()) s = input() ans = True for i in range(n // 2): if abs(ord(s[i]) - ord(s[n - i - 1])) not in (0, 2): ans = False break print('YES' if ans else 'NO')
Python
cc4cdcd162a83189c7b31a68412f3fe7
2c58295b4ddf76282ecc882f5292e6c3
1,000
PASSED
t = int(input()) a = [input() for i in range(2 * t)] for i in range(t): n = int(a[2 * i]) s = a[2 * i + 1] f = 0 for i in range(n // 2): res = abs(ord(s[i]) - ord(s[n - i - 1])) if res != 0 and res != 2: f = 1 if f == 1: print("NO") else: print("YE...
Python
cc4cdcd162a83189c7b31a68412f3fe7
fcd5b4e748921d3bf1148b9dff7df56c
1,000
PASSED
t = int(input().strip()) for _ in range(t): ans = "YES" n = int(input().strip()) s = input().strip() for i in range(int(len(s)/2)): if abs(ord(s[i])-ord(s[-i-1])) > 2 or abs(ord(s[i])-ord(s[-i-1])) == 1: ans = "NO" break print(ans)
Python
cc4cdcd162a83189c7b31a68412f3fe7
2204cea1d25672922e87d86a2962ebc1
1,000
PASSED
t = int(input()) for i in range(t): n = int(input()) a = input() ans = 0 for j in range(n): if abs(ord(a[j]) - ord(a[n-j-1])) > 2 or ord(a[j]) % 2 != ord(a[n-j-1]) % 2: ans += 1 if ans: print('NO') else: print('YES')
Python
cc4cdcd162a83189c7b31a68412f3fe7
145a4602a8b1c3329ebd5ab53bf3cb3a
1,000
PASSED
for _ in range(int(input().strip())): n = int(input().strip()) s = input().strip() i = 0 j = n-1 ans = 'YES' if s == s[::-1]: print(ans) else: while i < j: if abs(ord(s[i]) - ord(s[j])) != 2 and abs(ord(s[i]) - ord(s[j])) != 0: ans = 'NO' break i += 1 j -= 1 print(ans)
Python
cc4cdcd162a83189c7b31a68412f3fe7
7026d649334639121961ec399b966b5c
1,000
PASSED
def ehPalindromoTwist(word, size): metade = size // 2 i = 0 ehPalindromoTwist = True while i < metade and ehPalindromoTwist: if word[i] != word[size - i - 1]: numAscii1 = ord(word[i]) numAscii2 = ord(word[size - i - 1]) c1 = { numAscii1 - 1, numAscii1, nu...
Python
cc4cdcd162a83189c7b31a68412f3fe7
e5e0820911e33434204acf40adc519c0
1,000
PASSED
def check(s, n) : for i in range (n // 2) : if abs(ord(s[i]) - ord(s[n - 1 - i])) == 2 or abs(ord(s[i]) - ord(s[n - 1 - i])) == 0 : continue else : print('NO') return print('YES') return for _ in range( int(input()) ) : ...
Python
cc4cdcd162a83189c7b31a68412f3fe7
4090fff396551b0e43737203e77d4828
1,000
PASSED
from sys import stdin def is_last(c): if c == 'a' or c == 'z': return True return False def sol(s): for i in range(len(s) // 2): if s[i] == s[len(s) - i - 1]: continue if is_last(s[i]) and is_last(s[len(s) - i - 1]): return "NO" if abs(ord(s[i]) ...
Python
cc4cdcd162a83189c7b31a68412f3fe7
722440684fcb87305a74dafbe0d39910
1,000
PASSED
n=int(input()) alp ="abcdefghijklmnopqrstuvwxyz" for i in range(n): x=int(input()) s=input() mid=int(len(s)/2) #print(s) if s[:mid]==s[mid+1:]: print("YES") else: a=0 for j in range(mid): if abs(ord(s[j])-ord(s[-j-1]))==2 or abs(ord(s[j])-ord(s[-j-1]))==0: ...
Python
cc4cdcd162a83189c7b31a68412f3fe7
4b40b9395a5aa95a1005cf514c6d61a7
1,000
PASSED
## 1027A for _ in range(int(input())): a=int(input()) s=list(input()) i=0 ans=0 while i<(a//2): if ord(s[a-i-1])-2 == ord(s[i]) or ord(s[i]) == ord(s[a-i-1])+2 or ord(s[i]) == ord(s[a-i-1]): pass else: ans=1 break i+=1 if i>a//2: break if ans==0: print('YES') else: print("NO")
Python
cc4cdcd162a83189c7b31a68412f3fe7
6917ccf66b7f7e387c3a9ea14fbad14a
1,000
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 2e5+8; int n, v[N], vi[N], lvl[N], ans; std::vector<int> g[N]; void bfs(int x){ queue<int> q; q.push(x); vi[x] = 1; while (!q.empty()){ x = q.front(); //cout << x << " <<" << endl; q.pop(); for (int i = 0 ; i < (int)g[x].size(); i++){ int y =...
C++
16c4160d1436206412ce51315cb6140b
6bf7c223fbfd0e7804a8dc5ba27193aa
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int t,n,a[200001],ans,s,s1,k,sigrme[200001]; int main() { cin >> t; for (int j=1; j<=t; j++){ cin >> n; for (int i=1; i<=n; i++) cin >> a[i]; k=1; for (int i=2; i<=n; i++){ if (a[i]>a[i-1]) sigrme[i]=sigrme[k]+1; else{ k++; sigrme[i]=sigrme[k]+1; ...
C++
16c4160d1436206412ce51315cb6140b
5fb07e2facf1f61ca73db4b975f19041
1,600
PASSED
#include<bits/stdc++.h> #define maxn 200100 using namespace std; int n,a[maxn]; void solve() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int now=1; int ans=0; int cnt=0; for(int i=2;i<=n;i++) { if(a[i]>a[i-1]) cnt++; else { now--; if(now==0) now=cnt,cnt=0,ans++; cnt++; } //print...
C++
16c4160d1436206412ce51315cb6140b
c59eee37b2ea769c167257f43f817d07
1,600
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ri register int #define rll register long long #define fp(i,a,b) for(int i=a;i<=b;++i) #define IOS std::ios::sync_with_stdio(false) #define L(a) a<<1 #define R(a) a<<1|1 #define P pai...
C++
16c4160d1436206412ce51315cb6140b
449654835466887e815846b648cc4956
1,600
PASSED
#include <bits/stdc++.h> #define debug freopen("r.txt","r",stdin) #define mp make_pair #define ri register int #define pb push_back using namespace std; typedef long long ll; typedef double lf; typedef pair<ll, ll> pii; const int maxn = 1e6+10; const ll INF = 1e18; const int mod = 1e9+7; const double eps=1e-6; const do...
C++
16c4160d1436206412ce51315cb6140b
4921ca6202749f977cc7291df44fa19c
1,600
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 0x3f3f3f3f #define m(a) memset(a,0,sizeof(a)) int a[200005]; int f[200005]; vector<int>q; int main(){ int t;cin>>t; while(t--){ int n;cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } queue<int>...
C++
16c4160d1436206412ce51315cb6140b
34b4322269f100a6394491d361a8c6fa
1,600
PASSED
#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<cmath> #include<stack> #include<queue> using namespace std; typedef long long ll; typedef pair<int,int> P; const int maxn = 200010; int T,n,ans; int a[maxn], pos[maxn], cnt, cur, now; int head = 1,tail = 0; int q[maxn]; ll read(){ ll...
C++
16c4160d1436206412ce51315cb6140b
9685455cce753dcfeb16db8f27d49f90
1,600
PASSED
#include<bits/stdc++.h> using namespace std; void solve(){ int n;cin>>n; int as=0; int las=0x3f3f3f3f; int res1=1,res2=0; int x;cin>>x; if(n==1){ cout<<0<<endl; return; } cin>>x; las=x; res2=1;++as; for(int i=3;i<=n;++i){ cin>>x; if(x>las) ++res2; else{ if(res1>1) --res1,++res2; else{ res...
C++
16c4160d1436206412ce51315cb6140b
377385131327f1b8f6844edcc63f7a90
1,600
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; int T,n,a[200001],cnt[200001]; int main() { cin>>T; while(T--) { cin>>n; cin>>a[1]; memset(cnt,0,sizeof(cnt)); cnt[1]=1; int ans=1,now=0,sum=0; //a[1]=0x7fffffff; for(register int i=2;i<=n;++i) { scanf("%d",&a[i]); if(a[i]<a[i-1]...
C++
16c4160d1436206412ce51315cb6140b
563b5dc7e5face660ee4738480fb5645
1,600
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; int T,n,a[200001],cnt[200001]; int main() { cin>>T; while(T--) { cin>>n; cin>>a[1]; memset(cnt,0,sizeof(cnt)); cnt[1]=1; int ans=1,now=0,sum=0; //a[1]=0x7fffffff; for(register int i=2;i<=n;++i) { scanf("%d",&a[i]); if(a[i]<a[i-1]...
C++
16c4160d1436206412ce51315cb6140b
c477b50884ba2f4ab844000e72ddcf34
1,600
PASSED
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-->0) { int n =scan.nextInt(); String str= scan.next(); System.out.println(count(str,'a')); } scan.close(); ...
Java
324b7957b46dfe4948074c781159b7e7
c7d29130a691a4de39244c20a04b38e0
1,500
PASSED
import java.util.*; import java.io.*; public class Main { final static int maxn = 1000; static Scanner reader = new Scanner(System.in); static int n; static int val[][]; static int lens[]; static String s; static int cnt_dp(int let, int pos) { if(lens[let] == 1) re...
Java
324b7957b46dfe4948074c781159b7e7
87ca6cc994feeb7a15aac0064f7dd353
1,500
PASSED
import java.io.*; import java.math.BigInteger; import java.util.*; /** * @author Tran Anh Tai * @template for CP codes */ public class ProbD { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputR...
Java
324b7957b46dfe4948074c781159b7e7
da4804696e78c86639fb61267657267d
1,500
PASSED
import java.io.*; import java.math.*; import java.util.*; public class Main implements Runnable { class Pair implements Comparable<Pair>{ public int node; public int count; Pair(int nd, int c){ node=nd; count=c; } public int compareTo(Pair that) { return that.count - this.count; } } i...
Java
324b7957b46dfe4948074c781159b7e7
1445e65ba737c234fa280472a3a47664
1,500
PASSED
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Q417July { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t!=0){ t--; int n = sc.nextInt...
Java
324b7957b46dfe4948074c781159b7e7
764fcf3268aadb87855b0407883e3575
1,500
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class scratch_25 { static class Reader { static BufferedReader reader; static StringTokenizer tokenizer; /** * call this method to...
Java
324b7957b46dfe4948074c781159b7e7
3a461460176264565e45e74389ad8e09
1,500
PASSED
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); String str=sc.next(); int res=Integer.MAX_VALUE...
Java
324b7957b46dfe4948074c781159b7e7
c167887adf104d6e2a2cad8c3b6eb1bc
1,500
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { Input...
Java
324b7957b46dfe4948074c781159b7e7
04c3773e3e4c3943e7a3985269f7b6d4
1,500
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { Input...
Java
324b7957b46dfe4948074c781159b7e7
14801bf036363719f726e9e2552b30e1
1,500
PASSED
import java.util.Scanner; public class D{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); // input.nextLine(); while(t-- != 0){ int n = input.nextInt(); input.nextLine(); String s = input.nextLine(); System.out.println(solve(s, 'a', 0)); ...
Java
324b7957b46dfe4948074c781159b7e7
500c3971f4e33585d02d88ee3f193eff
1,500
PASSED
#include <bits/stdc++.h> #define ln '\n' #define all(dat) dat.begin(), dat.end() #define loop(i, to) for (int i = 0; i < to; ++i) #define cont(i, to) for (int i = 1; i <= to; ++i) #define circ(i, fr, to) for (int i = fr; i <= to; ++i) #define foreach(i, dat) for (__typeo...
C++
c04d3cdd086181350e24f66195343280
7cc0bb3264bbc67dab9f7ed6881450ac
2,100
PASSED
#include <bits/stdc++.h> #define sz(v) ((int)(v).size()) #define all(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; const int N = 1e6 + 5; int n, r, c, a[N], nxt[N][21]; string s[N]; int get_idx(int cur) { int res = cur; for (int i = 20; ...
C++
c04d3cdd086181350e24f66195343280
256ff171170fa92eb8fb54d6008bac73
2,100
PASSED
#pragma GCC optimize ("Ofast") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include "bits/stdc++.h" using namespace std; #define ll long long #define pb push_back #define all(_obj) _obj.begin(),_obj.end() #define F first #define S second #define INF 1e18 #define pll pair<ll, ll> #def...
C++
c04d3cdd086181350e24f66195343280
ecc7503892abd477949d8ad40c3927c6
2,100
PASSED
#include <bits/stdc++.h> #define ll long long #define sz(x) ((int) (x).size()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vi vector<int> #define pii pair<int, int> #define rep(i, a, b) for(int i = (a); i < (b); i++) using namespace std; // solve for c = 1 using two-pointers. // ...
C++
c04d3cdd086181350e24f66195343280
83b6214a07b580fcc23e94d4aac7bf15
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define for_(i, s, e) for (int i = s; i < e; i++) #define for__(i, s, e) for (ll i = s; i < e; i++) #define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str() typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; #de...
C++
c04d3cdd086181350e24f66195343280
2242115326b27bad7583d34081767a5d
2,100
PASSED
#include<queue> #include <cmath> #include <complex> #include<map> #include <string> #include<iostream> #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); using namespace std; typedef pair<do...
C++
c04d3cdd086181350e24f66195343280
2573ab8e3a143462802da2492a8077d0
2,100
PASSED
#include<queue> #include <cmath> #include <complex> #include<map> #include <string> #include<iostream> #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); using namespace std; typedef pair<do...
C++
c04d3cdd086181350e24f66195343280
1be3a64f851842f17eb855049d37dee1
2,100
PASSED
#include <bits/stdc++.h> using namespace std; void read(int &x){ char ch=getchar();x=0; for (;ch==' '||ch=='\n';ch=getchar()); for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar()); } void reads(string &s){ char ch=getchar();s=""; for (;ch==' '||ch=='\n';ch=getchar()); for (;ch!=' '&&ch!='\n';s+=c...
C++
c04d3cdd086181350e24f66195343280
365b4844275f56874fcf235dd6ea4d02
2,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef vector<int> vi; //HDU 627235 //USACO bc083db //timus 251103FD #define all(x) (x).begin(), (x).end() #define f first #define s second #define pb push_back #define mp make_pair #define Forn(i, n) for(int i=1; i<=(n); i++...
C++
c04d3cdd086181350e24f66195343280
8f3d8e06893b0f4a8f317f010ffc44a3
2,100
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1E6 + 5; int n, r, c, cur = -1, nxt[N]; bool chk[N]; pair<int, int> ans = {0, 0}; vector<int> ve, adj[N]; string s[N]; void DFS(int u) { chk[u] = true; ve.push_back(u); ans = max(ans, {ve[max(0, (int)ve.size() - r - 1)] - u, u}); for (int &v...
C++
c04d3cdd086181350e24f66195343280
88bceac9bf8cd61bd275aea4fb234b2f
2,100
PASSED
#include <stdio.h> #include <vector> using namespace std; #define pb push_back const int N=100050; const int M=20*N; const int inf=1e9+69; int min(int a, int b){ return a>b?b:a;} int x[M],ls[M],rs[M],clock,root[N]; void Set(int p, int &c, int ss, int se, int qi, int val) { c=++clock,ls[c]=ls[p],rs[c]=rs[p],x[c]=min(x[...
C++
951437dba30c662838b6832b194b5efe
cb81a83604555be0bd44baa4cbc0a3d5
2,300
PASSED
#include<bits/stdc++.h> #define LL long long using namespace std; int read(){ char ch=getchar(); int w=1,c=0; for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1; for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48); return w*c; } const int M=1e5+10; vector<int> v[M]; int s[M*40],L[M*40],R[M*40],w[M]; int d[M]; int...
C++
951437dba30c662838b6832b194b5efe
4e552cf3e3e780a1872dbba990b1d957
2,300
PASSED
#include<bits/stdc++.h> #define LL long long using namespace std; int read(){ char ch=getchar(); int w=1,c=0; for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1; for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48); return w*c; } const int M=1e5+50; vector<int> v[M]; int s[M*40],L[M*40],R[M*40],w[M]; int d[M]; int...
C++
951437dba30c662838b6832b194b5efe
f9ae305e262015b7c6ce3951c8a13007
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define M 200005 int n, m, t_root, cnt, last_ans; int a[M], dep[M], ls[M*50], rs[M*50]; int rt[M*50], dat[M*50]; vector<int> G[M]; inline void add_edge(int u, int v) { G[u].push_back(v); G[v].push_back(u); } inline int read() { int x = 0, f = 1; char ch = getchar()...
C++
951437dba30c662838b6832b194b5efe
5da603d44996feca36de3ab2c2f0bc08
2,300
PASSED
//Zory-2018 #include<cmath> #include<ctime> #include<cstdio> #include<cstring> #include<cstdlib> #include<map> #include<set> #include<queue> #include<deque> #include<stack> #include<bitset> #include<vector> #include<algorithm> #include<iostream> using namespace std; #ifdef DEBUG const int LOCAL=1; #else const int LOCAL...
C++
951437dba30c662838b6832b194b5efe
b3935ad667b52395ed21b527ba6b2e04
2,300
PASSED
#include<cstdio> #include<iostream> #include<cstring> using namespace std; #define N 100200 #define M 200100 #define INF 0x7f7f7f7f struct node{ int to,next; }q[M]; int head[N],ss,a[N],Rt,root[N],n,dep[N],tree[N*400],ls[N*400],rs[N*400],cc; void addedge(int x,int y) { q[++ss]=(node){y,head[x]};head[x]=ss; q[++ss]=(n...
C++
951437dba30c662838b6832b194b5efe
bd4bfaa797e451549a0093605dbd794e
2,300
PASSED
#include<bits/stdc++.h> #define LL long long int #define FIO ios::sync_with_stdio(false) #define FRD freopen("input.txt","r",stdin) #define lowbit(x) (x&-(x)) #define INF 2e9 #define ms(x) memset(x,0,sizeof x) #define pb(x) push_back(x) #define lson l,mid,now<<1 #define rson mid+1,r,now<<1|1 #define UNIQUE(x) unique(x....
C++
951437dba30c662838b6832b194b5efe
62caf77c9aa5e1535cd376e0b49d65ea
2,300
PASSED
#include<bits/stdc++.h> #define LL long long int #define FIO ios::sync_with_stdio(false) #define FRD freopen("input.txt","r",stdin) #define lowbit(x) (x&-(x)) #define INF 2e9 #define ms(x) memset(x,0,sizeof x) #define pb(x) push_back(x) #define lson l,mid,now<<1 #define rson mid+1,r,now<<1|1 #define UNIQUE(x) unique(x....
C++
951437dba30c662838b6832b194b5efe
ad2cee16ab3ce2c2d44db9c70fe922dd
2,300
PASSED
#include<bits/stdc++.h> #define LL long long int #define FIO ios::sync_with_stdio(false) #define FRD freopen("input.txt","r",stdin) #define lowbit(x) (x&-(x)) #define INF 2e9 #define ms(x) memset(x,0,sizeof x) #define pb(x) push_back(x) #define lson l,mid,now<<1 #define rson mid+1,r,now<<1|1 #define UNIQUE(x) unique(x....
C++
951437dba30c662838b6832b194b5efe
154128321a3af64dd25db84b104dbac9
2,300
PASSED
#include<bits/stdc++.h> #define LL long long int #define FIO ios::sync_with_stdio(false) #define FRD freopen("input.txt","r",stdin) #define lowbit(x) (x&-(x)) #define INF 2e9 #define ms(x) memset(x,0,sizeof x) #define pb(x) push_back(x) #define lson l,mid,now<<1 #define rson mid+1,r,now<<1|1 #define UNIQUE(x) unique(x....
C++
951437dba30c662838b6832b194b5efe
a818f0f2eb5c31bd667c3df78c50d5a5
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define int long long int #define ld long double #define pb push_back #define MOD 10...
C++
d4d41e75c68ce5e94c92e1b9876891bf
cf8d25cca110a784a83a63326a21e132
null
PASSED
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define int long long int #define ld long double #define pb push_back #define MOD 10...
C++
d4d41e75c68ce5e94c92e1b9876891bf
ccf1877befbb794afb9a5cd19a3f0081
null
PASSED
#include<bits/stdc++.h> using namespace std; #define tezi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define pb push_back #define rep(i,a,b) for(int i=a;i<b;i++) #define all(c) c.begin(),c.end() #define ll long long #define ull unsigned long long #define traverse(c,it) for(auto it=c.begin();it!=c.en...
C++
d4d41e75c68ce5e94c92e1b9876891bf
5b963cad59ebe3b63e6a75714cbdda18
null
PASSED
#include <iostream> #include<math.h> #include<algorithm> #define lol int t;cin>>t;while(t--) #define ll long long int using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); lol { ll d,k,p,c=0,q=0; cin>>d>>k;p=k;c++; while(1) { if(p<q&&(((p*p)+(...
C++
d4d41e75c68ce5e94c92e1b9876891bf
601a4087fb122eea4a5cf701b1131114
null
PASSED
#include <bits/stdc++.h> #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif using namespace std; using ll = long long; struct Edge { ll to; ll cost; }; using Graph = vector<vector<Edge>>; using P = pair<ll, ll>; #define mp make_pair #define REP(i, n) for (int i = 0; i < (n);...
C++
d4d41e75c68ce5e94c92e1b9876891bf
884725c11823e4c794db7c55b8fa5817
null
PASSED
#include <bits/stdc++.h> #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif using namespace std; using ll = long long; struct Edge { ll to; ll cost; }; using Graph = vector<vector<Edge>>; using P = pair<ll, ll>; #define mp make_pair #define REP(i, n) for (int i = 0; i < (n);...
C++
d4d41e75c68ce5e94c92e1b9876891bf
c7e8b5a46b78f9db7b1916bb2616bd58
null
PASSED
#include <bits/stdc++.h> #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif using namespace std; using ll = long long; struct Edge { ll to; ll cost; }; using Graph = vector<vector<Edge>>; using P = pair<ll, ll>; #define mp make_pair #define REP(i, n) for (int i = 0; i < (n);...
C++
d4d41e75c68ce5e94c92e1b9876891bf
15585e7722daa487ba1b7386a7ed57dd
null
PASSED
#include <iostream> #include <bits/stdc++.h> #define mod 1000000007 #define point complex<long double> #define pi acos(-1) #define pb push_back typedef long long ll; typedef long double ld; using namespace std; void Fastio() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { Fastio(...
C++
d4d41e75c68ce5e94c92e1b9876891bf
199059afee1e981519f7c2952fd9ffc1
null
PASSED
#include<bits/stdc++.h> #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define ull unsigned long long #define Toggle(n,i) (n^((ll)1<<i)) #define Check(n,i) (n&((ll)1<<i)) #define Set(n,i) (n|((ll)1<<i)) #define Reset(n,i) (n&(~((ll)1<<i))) #define fo(a,x,y) for(int i=(x);i<=(y);++i){...
C++
d4d41e75c68ce5e94c92e1b9876891bf
ae253b8818b08280a20ad92d44da7ec6
null
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { long long int d,k,p=0,c=0,a=0; cin>>d>>k; d=d*d; while(1) { if(a%2==0) p=p+k; else c=c+k; a++; if(p*p+c*c>d) break; } if(a%2==0) cout<<"Ashish\n"; else c...
C++
d4d41e75c68ce5e94c92e1b9876891bf
e686ba6a5ea86661c2eebf07c079e7d1
null
PASSED
#include <bits/stdc++.h> #define all(v) v.begin() , v.end() using namespace std; typedef long long ll; string s, t; int n; int main() { cin >> n; stringstream ss; for(int i = 0; i < n; ++i) { cin >> s; ss << "<3" << s; } s = ss.str()+"<3"; cin >> t; int j = 0; for(...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
a24c0738a34b84f973e086f65ed8f9e9
1,500
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<map> #include<string> using namespace std; #define M 100000 + 10 string str[M]; string tem[M]; bool mark[330]; int main() { int n ; string s,t; while(scanf("%d",&n) != EOF) { for(int i = 1 ;i <= n; ++ i) cin>>str[i]; ...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
87381f4ad44eb14ac8d55d8e34db9e44
1,500
PASSED
#include <cstdio> #include <cmath> #include <cstdlib> #include <memory.h> #include <iostream> #include <algorithm> #include <map> #include <utility> #include <tuple> #include <stack> #include <queue> #include <vector> using namespace std ; typedef long long ll ; const int MAXN = 100005; int n ; string word[MAXN]...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
95f8c3a91938f68fe702fef4f7b29621
1,500
PASSED
#include <iostream> #include <vector> #define long long long #define sz(A) (int(A.size())) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; string patt = "<3"; for (int i = 0; i < n; i++) { string s; cin >> s; patt += s; ...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
2880a9f267918e3b6afd4acbee55b280
1,500
PASSED
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_DEPRECATE #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <cfloat> #include <ctime> #include <cassert> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include ...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
b37d8ab283882fd91c526aa91b6f3c63
1,500
PASSED
#ifndef ONLINE_JUDGE #include "/Users/roman/Dev/SharedCpp/DebugOutput.h" // #include "/Users/roman/Dev/SharedCpp/Hash.h" // #include "/Users/roman/Dev/SharedCpp/KMP.h" // #include "/Users/roman/Dev/SharedCpp/ConvexHull.h" // #include "/Users/roman/Dev/SharedCpp/FFT.h" // #include "/Users/roman/Dev/SharedCpp/MinCostMaxF...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
0301ce6f0d4bd5789509214b623d3f52
1,500
PASSED
#include <iostream> #include <algorithm> #include <list> #include <map> #include <vector> #include <set> #include <bitset> #include <iostream> #define FOR(i, n) for(long i = 0; i < (n); ++i) #define FORU(i, j, k) for(long i = (j); i <= (k); ++i) #define FORD(i, j, k) for(long i = (j); i >= (k); --i) using namespace s...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
ed7a4dc94af3c0489a70f3e5050fde87
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> ii; typedef vector<int> vi; typedef vector<ii> vii; const int MOD=1000000007; const int INF= int(1e9); int main() { ios_base::sync_with_stdio(false); int n; cin>>n; string original="<3"; for(int i=0;i...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
a88339054f46143a46c845fc55253b97
1,500
PASSED
#include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; string text = "<3"; for (int i = 0; i < n; i++) { string t; cin >> t; text += t+"<3"; } string str; cin >> str; int p = 0; string t = ""; for (int i = 0; i < st...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
ceca7447c55ed42a7776f9347f49c7a6
1,500
PASSED