source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<iostream> #include<algorithm> #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, t, l = 0, r = 0, time = 0, books = 0; cin>>n>>t; int a[n], b[n]; for(int i=0; i<n; ++i) { cin>>a[i]; } while(r < n) { time += a[r++]; if(time <= t) ...
C++
ef32a8f37968629673547db574261a9d
1c97845721dece622511174b06f0f164
1,400
PASSED
#include<bits/stdc++.h> using namespace std; long long mod(long long a, long long b) { return (a%b+b)%b; } int main() { int n,t; cin >> n >> t; int arr[n]; int sum[n]; int summ = 0; bool zero = true; for(int i=0; i<n; i++) { cin >> arr[i]; summ+= arr[i]; sum[i] ...
C++
ef32a8f37968629673547db574261a9d
161de8672e98cde8752b3985f311b9da
1,400
PASSED
#include <iostream> using namespace std; int maximum(int a,int b) { if(a>=b) { return a; } else { return b; } } int main() { int n; long long int t; cin>>n>>t; int a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } int ans=0,left=0,sum=0; for(int right=0;right<n;right++) { sum+=a[right]; while(sum>t)...
C++
ef32a8f37968629673547db574261a9d
adf768e883320ba834aebc531bed0f69
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,t,counter=0,ptr1=0,ptr2=1,sum=0,num = -1; cin>>n>>t; short arr[n]; for (int i=0;i<n;i++) cin>>arr[i]; if (n == 1 && arr[0]<= t) cout<<1; else if (n == 1 && arr[0]> t) cout<<0; else { s...
C++
ef32a8f37968629673547db574261a9d
a030ee87479c4fec8ffe4f9a0e65b5c6
1,400
PASSED
#include<bits/stdc++.h> #define fi first #define se second #define ll long long #define pii pair<int, int> #define pb push_back using namespace std; const ll mod=998244353; const int N=3e5+2; int n, m, cnt[N], visit[N]; ll gt[N], inv[N], dp[N][41]; pii a[N]; vector<pii> v; ll Pow(ll x, ll y) { if(y==0) return 1; ...
C++
b1965a547c31d32ffa97f0ee26b138bb
b18c1496c52dadf9c9144fa7dcb7139a
2,600
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define ar array #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_u...
C++
b1965a547c31d32ffa97f0ee26b138bb
bb1636aa6581df6b9ffd54f56e5326a3
2,600
PASSED
#include<bits/stdc++.h> using namespace std; #define rep(i , l , r) for (int i = (l); i < (r); ++i) typedef long long LL; const int N = 3e5 + 5; const int mod = 998244353; int n , m , ans; int l[N] , r[N] , a[N] , b[N] , delta[N] , fac[N] , ifac[N] , c[N] , sum[45][N]; template <typename T> inline void chkmax(T ...
C++
b1965a547c31d32ffa97f0ee26b138bb
aef0a30be6705e0efc0131dc88e8cb6e
2,600
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const int maxn = 3e5+5, M = 998244353; void madd(int& a, int b) { a += b; if (a >= M) a -= M; } int msub(int a, int b) { madd(a,M-b); return a; } int mult(int a, int b) { return (1LL*a*b) % M; } int modexp(int a, int b) { int r...
C++
b1965a547c31d32ffa97f0ee26b138bb
afd112a3132a8831b7e56a991640b1cd
2,600
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const int maxn = 3e5+5, M = 998244353; void madd(int& a, int b) { a += b; if (a >= M) a -= M; } int msub(int a, int b) { madd(a,M-b); return a; } int mult(int a, int b) { return (1LL*a*b) % M; } int modexp(int a, int b) { int r...
C++
b1965a547c31d32ffa97f0ee26b138bb
9b21fda0af54a34fbf72323452ccb7d8
2,600
PASSED
#include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <cmath> #include <ctime> #define gc getchar() #define ll long long #define il inline using namespace std; const int N = 3e5 + 5; const int mod = 998244353; int fac[N], ifac[N], inv[N], vis[N], s[N]; int f[N][41], l[N], r[N]; int d...
C++
b1965a547c31d32ffa97f0ee26b138bb
3df9e482dc387e8265fa53599dd74711
2,600
PASSED
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl "\n" #define ll long long #define sz(s) (int)(s.size()) #define INF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(),v.end() #define watch(x) cout<<(#x)<<" = "<<x<<endl const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };...
C++
b1965a547c31d32ffa97f0ee26b138bb
754b8be15fc97c96dbdcb6fb5c4cf37d
2,600
PASSED
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl "\n" #define ll long long #define sz(s) (int)(s.size()) #define INF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(),v.end() #define watch(x) cout<<(#x)<<" = "<<x<<endl const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };...
C++
b1965a547c31d32ffa97f0ee26b138bb
1e05bbc40e4b97d255cbcedeb92eb0e9
2,600
PASSED
#include <bits/stdc++.h> using namespace std; #ifdef Adrian #include "debug.h" #else #define debug(...) 9999 #endif typedef long long ll; typedef long double ld; //typedef complex<ll> point; #define F first #define S second #define ii pair<ll,ll> template<typename G1, typename G2 = G1, typename G3 = G1> struct tripl...
C++
b1965a547c31d32ffa97f0ee26b138bb
0578f16c54d2b2b98efef4c8faea5d8b
2,600
PASSED
#include <algorithm> #include <array> #include <cassert> #include <iostream> #include <vector> using namespace std; template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; } template<typename T, size_t size...
C++
b1965a547c31d32ffa97f0ee26b138bb
186d3e3680a315cfb5ef546aef4dfedf
2,600
PASSED
#include <stdio.h> #include <vector> #include <algorithm> using namespace std; const int MAXN = 200005; vector <int> v[MAXN]; int n, dp[MAXN][2], m; void dfs(int x) { if (v[x].size() == 0) { m++; dp[x][0] = dp[x][1] = 1; return; } dp[x][0] = n; for (auto &y : v[x]) { dfs(y); dp[x][0] = min(dp[x][0], dp[y]...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
3e710c0520226265572ab43088ca4e69
2,200
PASSED
#include<iostream> #include<algorithm> #include<queue> #include<string> #include<vector> #include<map> #include<list> #include<set> #include<cstring> #include<ctime> #include<cmath> #include<limits> #include<iterator> #include<functional> #include<unordered_map> #include<stack> #include<bitset> #define all(v) v.begin(...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
56489dde3ae5d4b54a8dbae96e3ebf9a
2,200
PASSED
#include "bits/stdc++.h" #define MAXN 200009 #define INF 1000000007 #define mp(x,y) make_pair(x,y) #define all(v) v.begin(),v.end() #define pb(x) push_back(x) #define wr cout<<"----------------"<<endl; #define ppb() pop_back() #define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++) #define ff firs...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
f29e3ae1d453889edf1717b9ffd5b22d
2,200
PASSED
#include <iostream> #include <fstream> #include <vector> #include <string> #include <algorithm> #include <set> #include <map> #include <cmath> #include <cstring> #include <ctime> #include <unordered_map> #include <iomanip> #include <complex> #include <cassert> using namespace std; #define fi first #define se second #d...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
82523777b30cc6aec3cc3f26c3aca5e6
2,200
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <iomanip> #include <set> #include <queue> #include <cmath> #include <unordered_set> #include <string> using namespace std; int dp[200000][2]; int sz[200000]; int n; int INF = 1 << 30; vector<int> g[200000]; void solve(int v, int ver, int h, int par) ...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
597eb3b61905e0fccb508c1e91f3c823
2,200
PASSED
/* * E. Demiurges Play Again.cxx * * Copyright 2019 Usuario <Usuario@USUARIO-PC> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
b4fb8df7c9fbe23800738e3b638fc458
2,200
PASSED
// ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95 // ~/sudo apt-get Accpeted #include <iostream> #include <stdio.h> #include <memory.h> #include <limits.h> #include <math.h> #include <string.h> #include <string> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <stack> using namesp...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
cd34b9bb84e5526aa56ff2788cf711d2
2,200
PASSED
#include <bits/stdc++.h> using namespace std; int const N = 2e5+100 , INF = 1e9+100; int n; int mn[N] , mx[N] , lf[N] , h[N]; vector <int> g[N]; void dfs(int v=0 , int p=-1){ if(v && g[v].size()==1){ lf[v] = mn[v] = mx[v] = 1; return; } if(h[v]%2) mn[v] = INF; for(int u : g[v]){ if(u == p) continue; h[u...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
8322663738e0cce151eca40fe6679285
2,200
PASSED
#include <cstring> #include <cstdio> #include <algorithm> using namespace std; const int MAXN = 2e5 + 5; const int Inf = 1e9 + 7; int f[MAXN], g[MAXN], n, m; int tot, Next[MAXN * 2], Last[MAXN], Go[MAXN * 2]; void link(int u, int v) { Next[++ tot] = Last[u], Last[u] = tot, Go[tot] = v; } void dfs(int now, int pre...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
b1be310ace559523d3fdeedc9a5723d4
2,200
PASSED
/////////////////////////////////////////////////////////////// //__________________________________________________________// // \\\\\\\\\\\---------------------------------------------// // // __ __ // // // \\\\\\\\ |. \ / .| ///////// // // //...
C++
4a55e76aa512b8ce0f3f84bc6da3f86f
52b90798c544dd6cfa14e96932842ce1
2,200
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<utility> #include<vector> #include<stack> #include<queue> #include<set> #include<map> #define st first #define nd second #define mp make_pair #define pb push_back #define ceil (lo)ceil using namespace std; typedef long long lo; const int m...
C++
886029b385c099b3050b7bc6978e433b
b0665508afcaa1cef07beee044040a0b
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long int n,m,k,l,a,b; cin>>n>>m>>k>>l; a=k+l; b=a/m; if(b*m!=a || b==0) b+=1; if(b*m > n) cout<<"-1"<<endl; else cout<<b<<endl; }
C++
886029b385c099b3050b7bc6978e433b
125f63bbe1e73b53af1e6a240121ba65
1,400
PASSED
#include <bits/stdc++.h> typedef unsigned long long ll; using namespace std; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll x = ((c + d-1) / b+1); if (x * b > a)cout << -1; else cout << x; }
C++
886029b385c099b3050b7bc6978e433b
ec0a9299c219fe69ecf29e73d7fc66b3
1,400
PASSED
#include"bits/stdc++.h" using namespace std; typedef long long ll ; int main() { ll n,m,k,l; cin>>n>>m>>k>>l; ll dita_hobe , total,per=0 ; dita_hobe = k + l ; per = dita_hobe/m; if(dita_hobe%m!=0) per++; total = per * m ; if(total<=n) cout<<per<<endl; else cout<<"-1"<<endl; }
C++
886029b385c099b3050b7bc6978e433b
11ff045e018586077e747b750fdd3c78
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef unsigned long long int ull; typedef vector<ll> vl; typedef vector<vl> vvl; typedef pair<ll,ll> pp; #define sz(v) ((v).size()) #define vc(r) vector< r > #define mk(a,b) make_pair(a,b) #define pb push_back #define al...
C++
886029b385c099b3050b7bc6978e433b
b68d256ed7572068bc32bb42206353bb
1,400
PASSED
//besmellah #include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); long long n, m, k, l; cin >> n >> m >> k >> l; if (m * ((k + l + m - 1) / m) > n) cout << -1; else cout << (k + l + m - 1) / m; }
C++
886029b385c099b3050b7bc6978e433b
c5fb8b93abce68382715ad490e98a5e1
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); long long n,k,m,l,ans=0; cin>>n>>k>>m>>l; ans=ceil(1.0*((l*1.0+m*1.0)/k*1.0)); if(n==1000000000000000000&&k==1&&m==1&&l==999999999999999999){ cout<<1000000000000000000<<endl; return 0; } i...
C++
886029b385c099b3050b7bc6978e433b
1c89914a6f6ee5aead2648c766fa6aec
1,400
PASSED
#include<bits/stdc++.h> #include<time.h> #include<stdlib.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse4") #define pb push_back #define mp make_pair #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pll pair<ll,ll> #define vll ve...
C++
886029b385c099b3050b7bc6978e433b
160a92f73e0ed0af800e67a16212a099
1,400
PASSED
#include<iostream> #include<stdlib.h> #include<math.h> #include<algorithm> #include<vector> #include<map> #include<string.h> using namespace std; int main(){ int n,m,i,j,s1=1,s2=1,d=0; cin>>n>>m; if(n==1 && m==1){ cout<<0<<endl; cout<<1<<" "<<1<<endl; cout<<1<<" "<<1<<endl; exit(0); } if(n==1 && m==2){...
C++
a98622d5b6d6d139df90b6fee3baa544
57e82af61c0a181a99700c5b09e784de
2,000
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define inf (ll)3000000000000000 #define maxn 100010 #define MOD 1000000007 #define fre freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #define pb push_back #define pll pair<ll,ll> #define vi vector<ll> #define vvi vector<vector...
C++
a98622d5b6d6d139df90b6fee3baa544
1d093a58cb4f68c6a2c770ba295bad91
2,000
PASSED
#include <bits/stdc++.h> using namespace std ; int main(){ int n , m ; scanf("%d%d",&n,&m) ; if(n==1&&m>2) printf("1\n1 %d 1 1\n",m) ; else if(m==1&&n>2) printf("1\n%d 1 1 1\n",n) ; else if(n%2&&m%2&&n!=1&&m!=1) printf("1\n%d 1 1 1\n",n) ; else printf("0\n") ; if(m%2&&n>2&&n%2==0){ for(int i=1 ; i<=n ; ++i) p...
C++
a98622d5b6d6d139df90b6fee3baa544
c8a39555e298c5e4d2ca8c0ab4902c18
2,000
PASSED
#include <bits/stdc++.h> /* _ _ _____ __ __ ____ ______ ______ ___ ______ /'\_/`\ /\ __`\ /\ \/\ \ /\ _`\ /\__ _\ /\ _ \ /'___\ /\ _ \ /\ \ \ \ \/\ \ \ \ \ \ \ \ \,\L\_ \/_/\ \/ \ \ \L\ \ /\ \__/ \ \ \L\ \ \ \ \__\ \ \ \ \ \ \ \ ...
C++
a98622d5b6d6d139df90b6fee3baa544
da6150d3f2ca7ca946ed639c3e2d157d
2,000
PASSED
#include <bits/stdc++.h> #define sz(v) ((int)(v).size()) #define all(v) ((v).begin()),((v).end()) #define allr(v) ((v).rbegin()),((v).rend()) #define pb push_back #define mp make_pair #define mt make_tuple #define clr(v,d) memset( v, d ,sizeof(v)) #define vi vect...
C++
a98622d5b6d6d139df90b6fee3baa544
71c8639b1790f080a1f33fed6a52d358
2,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define fi first #define se second #define pb push_back main() { //freopen("inp.txt","r",stdin); int n,m; scanf("%d %d",&n,&m); if((n%2==0 && m!=1) || (n==2 && m==1)) { printf("0\n"); printf("1 1\n"); for...
C++
a98622d5b6d6d139df90b6fee3baa544
55cd200cfca417908bf387edea363bd7
2,000
PASSED
#include<bits/stdc++.h> #include <iostream> #include<stdio.h> #include<sstream> #include<string> #include<stdio.h> #include<vector> #include<map> #include<queue> #include<bitset> #include<math.h> #include<list> #include<limits.h> #include<algorithm> #define pb push_back #define mp make_pair #define mod (1000000000 + 7)...
C++
a98622d5b6d6d139df90b6fee3baa544
00593e8ee1f09e32b8e5b258800cc0da
2,000
PASSED
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public cl...
Java
a98622d5b6d6d139df90b6fee3baa544
b8391e612164eb525881bb9487e3ac12
2,000
PASSED
import java.util.Scanner; public class d43 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); int y = in.nextInt(); if (x == 1 && y !=2) { System.out.printf("1\n1 %d 1 1\n", y); for (int i = 1; i <= y; i++) { System.out.printf("1 %d\n", i); } ...
Java
a98622d5b6d6d139df90b6fee3baa544
1c947a3009ec7a1f2500a71cb1f4ecb1
2,000
PASSED
import java.util.Scanner; public class P43D { public P43D() { Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int m = sc.nextInt(); sc.close(); if (n == 1){ if (m == 2){ System.out.println(0); System.out.println(1 + ...
Java
a98622d5b6d6d139df90b6fee3baa544
87b705868183f22f6f3092b48feb071f
2,000
PASSED
#include <iostream> #include <cstdio> #include <map> #include <vector> using namespace std; const int NMAX = 100001; int n, a[NMAX], aint[NMAX*4]; map<int,long long> myMap; int Min[18][NMAX], Exp[NMAX]; int gcd(int a, int b) { if (!b) return a; return gcd(b, a % b); } void preprocesare(){ for(int i=1...
C++
ae7c90b00cc8393fc4db14a6aad32957
b11e509ddb79c6e3de2c1dbcb7ac55d0
2,000
PASSED
#include <iostream> #include <set> #include <map> #include <vector> #include <cmath> #include <cstring> #include <sstream> #include <cstdio> #include <cstdlib> #include <ctime> #include <algorithm> #include <queue> #include <utility> #include <fstream> using namespace std; const long double pi=3.14159265358979323846264...
C++
ae7c90b00cc8393fc4db14a6aad32957
3bdc02394c23723f31245049e256d745
2,000
PASSED
#include<cstdio> #include<algorithm> #include<map> #include<ctime> #define N 100010 #define POW 18 #define ll long long using namespace std; int n,a[N],q; //int LOG2[N],g[N][20]; map<int,ll> mp; int c[N],d[N],tot; int t1[N],t2[N]; int gcd(int a,int b){ return b==0?a:gcd(b,a%b); } /* int calc(int l,int r){ int t=LOG...
C++
ae7c90b00cc8393fc4db14a6aad32957
54abaad2967f0cb8ee0210af708aa019
2,000
PASSED
#include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <algorithm> #include <string> #include <cstring> #include <map> #include <vector> using namespace std; int next[100005][34],NEXT[100005][34],a[100005],n,i,LG,j,X,Q,A,p,L,now,NOW,R,k; int f[200005][20]; map <long long,long long> mp; int m...
C++
ae7c90b00cc8393fc4db14a6aad32957
2b2a933105891bc8f41e44b00b1ddfc7
2,000
PASSED
#include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <bitset> #include <cctype> #include <cstdio> #include <string> #include <vector> #include <cassert> #include <cstdlib> #include <cstring> #include <iomanip> #include <sstream> #inc...
C++
ae7c90b00cc8393fc4db14a6aad32957
f8e67141bc0fa136798905e0f7685a4f
2,000
PASSED
#include <iostream> #include <iomanip> #include <ctime> #include <set> #include <vector> #include <map> #include <cmath> using namespace std; // TEMPLATE {{{ #ifndef LOCAL #define OJ 1 #else #define OJ 0 #endif #define endl '\n' #define TIMESTAMP merr << "Execution time: " << fixed << setprecision(3) << (double)cloc...
C++
ae7c90b00cc8393fc4db14a6aad32957
2142aa2151902c288e7e84e943f22969
2,000
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 100010; int a[N], P[N][18]; int n, Q; map<int, long long> M; int get(int l, int r) { int g = 0; for (int i = 17; i >= 0; i--) { if ((r - l) >= (1 << i)) { g = __gcd(g, P[r][i]); r -= (1 << i); } } g = __gcd(g, a[l]); return g; } int main() {...
C++
ae7c90b00cc8393fc4db14a6aad32957
d9e9e5d49fa6abd8ce9862561bb9d0a3
2,000
PASSED
#include<iostream> #include<cstring> #include<stdio.h> #include<assert.h> #include<algorithm> #include<cmath> #include<vector> #include<queue> #include<stack> #include<map> #include<set> #define mp make_pair #define pb push_back #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define F first #defi...
C++
ae7c90b00cc8393fc4db14a6aad32957
9f63fedd1460fb54eb6e1729d7a44a06
2,000
PASSED
#include<iostream> #include<cstring> #include<stdio.h> #include<assert.h> #include<algorithm> #include<cmath> #include<vector> #include<queue> #include<stack> #include<map> #include<set> #define mp make_pair #define pb push_back #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define F first #defi...
C++
ae7c90b00cc8393fc4db14a6aad32957
dbfc40fe8704fbae016cdf5e85f94621
2,000
PASSED
#include<iostream> #include<cstring> #include<stdio.h> #include<assert.h> #include<algorithm> #include<cmath> #include<vector> #include<queue> #include<stack> #include<map> #include<set> #define mp make_pair #define pb push_back #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define F first #defi...
C++
ae7c90b00cc8393fc4db14a6aad32957
3ef638f068f05a0ff3c1f5ed8acfc48e
2,000
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int t,n; cin>>t; while(t--) { cin>>n; vector<vector<int>>A(2*n-1,vector<int>(3)); long long apples=0, oranges=0; for(int i=0; i<2*n-1; i++) cin>>A[i][0]>>A[i][1],A[i][2]=i...
C++
41dce27e55f7c83ad5cc5862e5165cb4
d59aff5e01aa5755b9dae9bf0ba0829c
2,500
PASSED
#include<stdio.h> #include<algorithm> #include<iostream> #include<string.h> #include<math.h> #include<map> using namespace std; #define mann 100005 #define INF 0x3f3f3f3f typedef long long LL; struct node { int a,b; int pos; } c[2*mann]; bool cmp(node x,node y) { return x.a<y.a; } int main() { int t,n; ...
C++
41dce27e55f7c83ad5cc5862e5165cb4
9ce4839494e4739a1167ddb965b2ba9d
2,500
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin>>t ; while(t--) { long long n ; scanf("%lld" , &n); vector< pair<long long , pair<long long , long long> > >vp ; long long apple = 0 , orange = 0 ; for(long long i = 0 ; i < 2*n-1 ; ++i)...
C++
41dce27e55f7c83ad5cc5862e5165cb4
b1674652b9543c0f7e0a5308c48794cb
2,500
PASSED
#include <bits/stdc++.h> #define int long long int #define F first #define S second using namespace std ; const int N = 3e5 + 1000 ; int tt , n ; pair <pair<int , int> , int> p[N] ; int32_t main(){ cin >> tt ; while(tt--){ cin >> n ; for(int i = 0 ; i < n + n - 1; i++){ cin >> p[i].F.F >> p[i].F.S ; p[...
C++
41dce27e55f7c83ad5cc5862e5165cb4
296d47a6041294432c942f949c86c45a
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define A first.first #define O first.second #define I second const int N = 200200; pair<pair<int, int>, int> p[N]; int main() { int T, n, i; long long sum, tmp; cin >> T; while (T--) { scanf("%d", &n); sum = tmp = 0; for (i = 1; i < n * 2; ++i) { scanf("...
C++
41dce27e55f7c83ad5cc5862e5165cb4
49ef21840873a078e702b62c3816674a
2,500
PASSED
#include <bits/stdc++.h> typedef long long ll ; using namespace std; int main(int argc, char *argv[]) { int t ; cin >> t ; while(t--){ int n ; cin >> n ; n = 2 * n - 1; vector< pair < pair<int , int > , int > > v; for(int i = 0 ; i < n ; i ++) { int ...
C++
41dce27e55f7c83ad5cc5862e5165cb4
323695398723eac2b591752666683e1d
2,500
PASSED
/* ربي يعبد */ #include <bits/stdc++.h> using namespace std; #define all(v) ((v).begin()), ((v).end()) #define s(n) scanf("%d", &n) #define sc(n) scanf("%c", &n) #define sl(n) scanf("%lld", &n) #define sf(n) scanf("%lf", &n) #define ss(n) scanf("%s", n) #define INF (int)1e9 + 9 #define EPS 1e-9 #define bitcount __built...
C++
41dce27e55f7c83ad5cc5862e5165cb4
c21ebf6ff5bdee1594f90cfe2320cd36
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int MN=1e6+100; int ora[MN]; int ap[MN]; pair<int,int> p[MN]; int main() { ios::sync_with_stdio(0); int t; cin>>t; for(int tes=0;tes<t;tes++){ int n; cin>>n; for(int i=0;i<2*n-1;i++){ cin>>ap[i]>>ora[i]; ...
C++
41dce27e55f7c83ad5cc5862e5165cb4
89b365a89c2386f9be6e86b3037b2a35
2,500
PASSED
#include<iostream> #include<vector> #include<cstring> #include<map> #include<bitset> #include<assert.h> #include<algorithm> #include<iomanip> #include<cmath> #include<set> #include<queue> #include<random> #include<utility> #include<chrono> #define long long long using namespace std; mt19937 rng(chrono::steady_clock::no...
C++
41dce27e55f7c83ad5cc5862e5165cb4
e7099e224c8522b9826bfdce444c86f0
2,500
PASSED
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define f first #define s second #define ll long long #define forn(i, a, b) for(int i = (a); i <= (b); ++i) #define forev(i, b, a) for(int i = (b); i >= (a); --i) #define VAR(v, i) __typeof( i) v=(i) #define forit(i, c) for(VAR(i, (c).begin()); i != (c...
C++
41dce27e55f7c83ad5cc5862e5165cb4
96fc6ce36117d5232d67721722a15847
2,500
PASSED
#include <iostream> #include <cstring> #include <stdlib.h> /* srand, rand */ #include <time.h> using namespace std; class Password{ public: int n; int k; string newPassword; Password(); Password(int, int); void operator= (const Password&); bool verRep(const char) const; }; Password::Password()...
C++
39f5e934bf293053246bd3faa8061c3b
6266cf47eae6d4322d554b096e247066
800
PASSED
#include <iostream> #include<cmath> #include<limits> #include<vector> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<cstdlib> #include<ctime> using namespace std; char alphabetsArray[27]; void initializer(); int main() { int numberOfCharacter,numberOfDistinctCharacter,temp,pr...
C++
39f5e934bf293053246bd3faa8061c3b
b08b878cf628a6c3a97136e608941da9
800
PASSED
#include<iostream> using namespace std; int main(){ int n,k; cin>>n>>k; string str=""; for(int i=97;i<=(k+96);i++){ str+=(char)i; } n-=k; if(n>0){ int temp=str[k-1]!='a'? 97:98; for(int i=0;i<n;i++){ str+=(char)temp; temp=temp<(k+96)? ++temp:97; } } cout<<str; }
C++
39f5e934bf293053246bd3faa8061c3b
8f95040f48f973ed9424e127df98a48b
800
PASSED
#include<iostream> using namespace std; int main(){ int n,k; cin>>n>>k; string str=""; for(int i=0;i<n;i++) str+=(char)97+(i%k); cout<<str; }
C++
39f5e934bf293053246bd3faa8061c3b
95075d69b6070cce701058799fdf9405
800
PASSED
#include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); typedef long long int ll; int main() { //srand(time(NULL)); fast; ll n; ll k; cin>>n>>k; int left = n-k; char str = 'a'; int i = 1; while(k>0 && n>0){ cout<<str; ...
C++
39f5e934bf293053246bd3faa8061c3b
36716449aebc6874ebf0cf0b634007d1
800
PASSED
#include <iostream> #include <vector> #include <deque> #include <string> using namespace std; int main() { string s="abcdefghijklmnopqrstuvwxyz"; int x,y; cin>>x>>y; int h=0; for(int i=0;i<x;i++) { if(i==y) { for(int j=0;j<x-i;j++) { if(h==i...
C++
39f5e934bf293053246bd3faa8061c3b
6aade326d843d51bd6233e0c8381fab3
800
PASSED
#include <bits\stdc++.h> int64_t n,i,x,s,a[6]; using namespace std; int main(){ cin>>n>>i; for(;n--;) putchar(char('a'+n%i)); }
C++
39f5e934bf293053246bd3faa8061c3b
62a3fb93d0af50b7e396c3c74459fd61
800
PASSED
#include <bits\stdc++.h> int64_t n,i; int main(){ std::cin>>n>>i; for(;n--;)putchar('a'+n%i); }
C++
39f5e934bf293053246bd3faa8061c3b
ac39c26097407f9a9f2512c3c855ac7b
800
PASSED
#include <bits\stdc++.h> int64_t n,i,x,s,a[6]; using namespace std; int main(){ cin>>n>>i; for(;n--;)putchar('a'+n%i); }
C++
39f5e934bf293053246bd3faa8061c3b
53ce1c35c2db4707238185fe3eb37001
800
PASSED
#include <bits\stdc++.h> int n,i; int main(){ std::cin>>n>>i; for(;n--;)putchar('a'+n%i); }
C++
39f5e934bf293053246bd3faa8061c3b
329d707a7deede641f3e6a907650c588
800
PASSED
if ENV['USER'] != 'watashi' $stdin = open('input.txt') $> = open('output.txt', 'w') end class RNG def initialize(x, a, b, c) @x = x @f = ->(x){(x * a + b) % c} end def next @x = @f[@x] end end n = gets.to_i r = RNG.new(*gets.split.map(&:to_i)) a = Array.new(n){ x, y = gets.split [y.to_i, ...
Ruby
349b116f40dcf3884d4c8208a513ee23
ff0a20c45aff59504c9721d50c7ad389
1,600
PASSED
if ENV['USER'] != 'watashi' $stdin = open('input.txt') $> = open('output.txt', 'w') end class RNG def initialize(x, a, b, c) @x = x @f = ->(x){(x * a + b) % c} end def next @x = @f[@x] end end n = gets.to_i r = RNG.new(*gets.split.map(&:to_i)) a = Array.new(n){ x, y = gets.split [y.to_i, ...
Ruby
349b116f40dcf3884d4c8208a513ee23
bbd9022f1b09bab71c6969deffa11df6
1,600
PASSED
import sys sys.stdin = open("input.txt","r") sys.stdout = open("output.txt","w") N = int(raw_input()) x, a, b, c = map(int,raw_input().split()) teams = [] for i in xrange(N): team = raw_input().split() team[1] = int(team[1]) teams.append((team[1], team[0])) teams = sorted(teams)[::-1] baskets = [] for...
Python
349b116f40dcf3884d4c8208a513ee23
310388e97a25f4cf25057e29b57fce65
1,600
PASSED
import sys sys.stdin=file('input.txt','r') sys.stdout=file('output.txt','w') R=lambda:map(int,raw_input().split()) K=lambda x:int(x[1]) n=input() x,a,b,c=R() t=sorted([raw_input().split() for _ in xrange(n)],reverse=True,key=K) w=[t[n/4*i:n/4*(i+1)] for i in xrange(4)] g=[[] for _ in xrange(n/4)] for i in xrange(n): ...
Python
349b116f40dcf3884d4c8208a513ee23
12542c81143e93ea527f716dbf02a2f7
1,600
PASSED
import sys sys.stdin = open('input.txt') sys.stdout = open('output.txt', 'w') def nums(): return map(int, sys.stdin.readline().rstrip().split()) n = nums()[0] m = n / 4 gx, a, b, c = nums() teams = [] def gen(): global gx gx = (gx * a + b) % c return gx for i in xrange(n): name, r = raw_input().spl...
Python
349b116f40dcf3884d4c8208a513ee23
8351b7325e617701851e965975671411
1,600
PASSED
import sys sys.stdin=open("input.txt",'r') sys.stdout=open("output.txt",'w') n=input() x,a,b,c=map(int,raw_input().split()) def r(): global x,a,b,c y=(x*a+b)%c x=y return x L=[] for i in range(n): s=raw_input().split() L.append((int(s[1]),s[0])) seeds=[[],[],[],[]] L.sort(reverse=True) for i in ...
Python
349b116f40dcf3884d4c8208a513ee23
8e0f931ceae7434ed2211fbf72a69ccf
1,600
PASSED
import sys sys.stdin = open('input.txt', 'r') sys.stdout = open('output.txt', 'w') n = input() / 4 x, a, b, c = map(int, raw_input().split()) t = [k for v, k in sorted((-int(v), k) for k, v in [raw_input().split() for _ in range(n * 4)])] g = [[] for _ in range(4)] for i, k in enumerate(t): g[i / n] += [k] r = [[] for...
Python
349b116f40dcf3884d4c8208a513ee23
82bb1414b97fbb48f7a93d56295cefa6
1,600
PASSED
input = open("input.txt", "r") output = open("output.txt", "w") N = int(input.readline()) X, A, B, C = map(int, input.readline().split()) teams = [] def random(): global X X = (A * X + B) % C return X for i in xrange(N): name, rating = input.readline().split() teams.append((name, int(rating))) t...
Python
349b116f40dcf3884d4c8208a513ee23
ed81da8e5f982a6d7425d093f436fe8a
1,600
PASSED
import sys class Random: def __init__(self, x, a, b, c): self.x = x self.a = a self.b = b self.c = c def next(self): self.x = (self.x * self.a + self.b) % self.c return self.x fi = open('input.txt', 'r') fo = open('output.txt', 'w') #fi = sys.stdin #fo = sys.stdout n = int(fi.readline()) x, a, b, c = ...
Python
349b116f40dcf3884d4c8208a513ee23
7aca4f2ab42a51b8cf8e22c1ff018444
1,600
PASSED
def rd(f): l = f.readline() while (l.split() == []): l = f.readline() return l F = open("input.txt") l = rd(F).split() n = int(l[0]) buckets = [] (x, a, b, c) = tuple(map(int, rd(F).split())) t = [] for i in xrange(n): z = rd(F).split() t.append((-int(z[1]), z[0])); t.sort() for i in xrange(...
Python
349b116f40dcf3884d4c8208a513ee23
8b71ab987b9511e43b16c62443c92c51
1,600
PASSED
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#pragma GCC optimize ("O3") //#pragma GCC optimize ("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC optimize ("trapv") //#pragma GCC optimize ("sse, ssse, sse2, avx") #define f first #define s s...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
49bbba994cc59420847380ed303d29a1
2,300
PASSED
#include <cstdio> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int MAXN = 1e6; const int MAXK = 10; int N, M, K; vector<pii> adj[MAXN]; vector<pii> radj[MAXN]; ll mask[MAXK][MAXK]; int ncond[MAXK][MAXK]; ll gmask, ans; bool getv(ll x, int i, int ...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
ec2a0c78235948572f55efacf92cc164
2,300
PASSED
//Original Code: //#include <self/utility> //#include <self/debug> //#include <self/rand> //using namespace std; //const int IT=80; //int n,m,k; //vector <pair<int,int> > vec[200005]; //int tmp[200005]; // //struct Hash //{ // typedef int T; // ll c[10][10]; // inline bool checkPrime(T x) // { // for(T i=2;i*i<=x;i++)...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
432bb7bcc4efc8fcd5a5312a12099d34
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> ii; #define pb push_back #define all(x) (x).begin(), (x).end() #define sqr(x) ((x) * (x)) #define X first #define Y second #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR (i, 0, n) #define TRACE(x) cout <...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
3b16db6a942f66743f50118d2ec55afa
2,300
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2e5+5; int n,m,k,i,j,l,eu[N],ev[N],u,v,w,d1[N],d2[N],ans; vector<int>e[N]; bool b[99][99],bb[99]; void dfs(int d){ if(d==k+1){++ans;return;} for(int i=1,v;i<=d;++i)if(v=i+d*(d-1)/2,!b[v][v]){ for(j=1;j<v;++j)if(bb[j] && b[v][j])break; if(j==v)bb[v]=1,dfs(d+...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
afa01a299290ba1239b03a4f418621ed
2,300
PASSED
// ==================================== // author: M_sea // website: https://m-sea-blog.com/ // ==================================== #include <bits/stdc++.h> #define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout) #define debug(...) fprintf(stderr,__VA_ARGS__) using namespace std; typedef long long ...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
852f0d484052babd87c6fd82970cdd3b
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair <int,int> pii; bool Cmp(const pii& p1, const pii& p2) { return p1.second < p2.second; } int Hash(int x, int y, int k) { return (x - 1) * k + y; } vector <int> C; vector <bool> Valid1; vector <vector <bool>> Valid2; bool Check(int k) { for(int ...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
68ac5ddc20e040a9bf5e7b9c1fbaa937
2,300
PASSED
#include <bits/stdc++.h> const int N = 2e5; const int K = 10; const int BASE = 998244353; const int MOD = 1e9 + 9; int n, m, k, ans, goal; int p[N | 1], s[K | 1][K | 1]; std::vector < std::pair < int, int > > e[N | 1]; inline int read() { register int x = 0; register char ch = getchar(); while (!isdigit(ch)) c...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
28b9c8ebfbd342a0ea7533360b2271b7
2,300
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,k,chu[200010],id[200010][10],mp[200010]; int hah[10][10][10][10],haha[10][10]; int st[10],ans,vis[200010]; vector<int> g[10]; vector<pair<int,int> > f1[200010]; bool cmp(pair<int,int> a,pair<int,int> b) { return a.second<b.second; } bool pd() { for(int i=1;i<=k;...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
00f06c342455eb183c884c7d04ec2d4a
2,300
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,k,chu[200010]; int hah[10][10][10][10],haha[10][10]; int st[10],ans,vis[200010]; vector<int> g[10]; vector<pair<int,int> > f1[200010]; bool cmp(pair<int,int> a,pair<int,int> b) { return a.second<b.second; } bool pd() { for(int i=1;i<=k;i++) { for(int j=1;j<=k...
C++
7c0c80d86aa2a5904f8b95b5d8c31f44
db4372a73e0b043364b0c27ededb93a2
2,300
PASSED
#include <iostream> #include <vector> #include <map> #include <string> #include <algorithm> #include <iterator> #include <numeric> #define ll long long using namespace std; int main() { int t; cin >> t; while (t--) { int n, m, a, b, c, d, A[2] = {}; cin >> n >> m; A[0] = m % 2; for (int i = 0; i < n; i++) ...
C++
f46f6fa28d0a7023da3bad0d222ce393
bbe066ac99abd7c801bd0499a47c0df2
900
PASSED
#include <iostream> using namespace std; int main() { int t; cin >> t; while(t --) { int n, m; cin >> n >> m; int flag = 0; while(n --) { int arr[2][2]{0}; for(int i=0;i<=1;i++) { for(int j=0;j<=1;j++) cin >> arr[i][j]; } ...
C++
f46f6fa28d0a7023da3bad0d222ce393
b450c0d3329c15568c8c841abb6109eb
900
PASSED
#include <iostream> #include <string.h> #include<algorithm> #include <math.h> using namespace std; int main() { static long long no; cin>>no; while(no--) { long long n,m,a[1000],b[1000],c[1000],d[1000],flag=0,stor=1; cin>>n>>m; for(int i=1;i<=n;i++) cin>>a[i]>>b[i]>>c[i]...
C++
f46f6fa28d0a7023da3bad0d222ce393
021196f995553173d8b7bfa6f325388c
900
PASSED
//https://codeforces.com/contest/1426/problem/B #include <iostream> using namespace std; const int mx = 105; struct tiles { int left_up, right_up, left_bottom, right_bottom; }; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; tiles tile[mx]; bool ok = 0; for (int i = 0; i < n; i++) ...
C++
f46f6fa28d0a7023da3bad0d222ce393
483a3be5e760f23b06714ec9e379c5ba
900
PASSED
#include <iostream> using namespace std; int i,t,a,b,c,d,j,n,m,k; int main() { cin>>t; for (i=1;i<=t;i++) { cin>>n>>m; k=0; for (j=1;j<=n;j++) { cin>>a>>b>>c>>d; if (b==c) k=1; } if (m%2==1) cout<<"NO"<<endl; else if (k==0) cou...
C++
f46f6fa28d0a7023da3bad0d222ce393
0c33059f06058430568920f9ceeeffdc
900
PASSED
#include <cstdio> #include <cstdlib> #include <string> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> #include <map> #include <vector> #include <queue> using namespace std; int main() { int t; scanf("%d", &t); for(int i = 1; i <= t; ++i) { int n, m, check = 0; scanf("%d%d", &n, &m...
C++
f46f6fa28d0a7023da3bad0d222ce393
1fe44ac871c9816e8058738c6184bc6d
900
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <set> #include <map> #include <cmath> #include <stack> #include <sstream> #include <queue> #include <climits> #include <unordered_map> #define ll long long #define all(v) v.begin(),v.end() using namespace std; bool check(vector<vec...
C++
f46f6fa28d0a7023da3bad0d222ce393
ad4b809a4eda44028557f9e8e16cc024
900
PASSED
#include<iostream> #include<vector> //#include<stdio.h> using namespace std; bool sim(vector<vector<int> > a) { bool res = true; for (int j = 0; j < a.size() && res; j++) for (int q = 0; q < a.size(); q++) if (res) res = (a[q][j] == a[j][q]); else break; return res; } int main() { int t; cin >> t; while (t...
C++
f46f6fa28d0a7023da3bad0d222ce393
7028d6e6cdea7024963564b647b002d0
900
PASSED