Dataset Viewer
Auto-converted to Parquet Duplicate
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> #include <chrono> using namespace std::chrono; using namespace std; #define f0r(a, b) for (a = 0; a < b; a++) #define f1r(a, b, c) for (a = b; a < c; a++) #define ms(arr, v) memset(arr, v, sizeof(arr)) #define pb push_back #define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(...
C++
5f4009d4065f5ad39e662095f8f5c068
3a1d3fab20424f3fadea46e0ac60f0c6
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin >> n; string a, b; cin >> a >> b; vector<ll> y(n+1, 0), z(n+1, 0), c(n+1, 0); for(int i = 0; i < n; i++){ y[i+1] = a[i]-'a'; z[i+1] = b[i]-'a'; } //for(auto x: y) cout << x << en...
C++
5f4009d4065f5ad39e662095f8f5c068
c00b86edac30b6fd03f640b13bf69325
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5...
C++
5f4009d4065f5ad39e662095f8f5c068
047cb5e12a9d84db1da85c36553d63fd
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5...
C++
5f4009d4065f5ad39e662095f8f5c068
54ae05aa4558eded91b5a90e2f816176
1,900
PASSED
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize ("O3") using namespace std; #define ll long long #define ld long double #define rep(i, a, b) for(ll i = a; i < b; i++) #defi...
C++
5f4009d4065f5ad39e662095f8f5c068
37bbee59272059e75c609b47195cf500
1,900
PASSED
#include <iostream> #include<vector> #include<string> #include<cassert> using namespace std; vector<int> get(const string &s) { vector<int> res(s.size() + 1); for (int i = 0; i < int(s.size()); ++i) { res[i + 1] = s[i] - 'a'; } return res; } int main() { int k; string s, t; cin >> k >> s >> t; vector<int>...
C++
5f4009d4065f5ad39e662095f8f5c068
3f4df57f5a769276a2ff68d8f6c680aa
1,900
PASSED
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn = 200000 + 10; char a[27] = { "abcdefghijklmnopqrstuvwxyz" }; int s1[maxn], s2[maxn],s3[maxn]; int main() { int n,i; cin >> n; getchar(); for ( i = 0; i < n; i++) { scanf("%c", &s1[i]); } getchar(); for ( i = 0; i < n;...
C++
5f4009d4065f5ad39e662095f8f5c068
cc25f57272be050adc9b9ba753264c70
1,900
PASSED
#include <iostream> #include <string> #include <cmath> #include <vector> #include <algorithm> #include <set> #include <cassert> #define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define lim 200001 #define ll long long #define endl "\n" using namespace std; void no() { cout << "Impossible" << endl; exi...
C++
5f4009d4065f5ad39e662095f8f5c068
fd495564f33309717896c8248b594a89
1,900
PASSED
#include<iostream> #include <cstdio> using namespace std; const int maxn=200005; int n; char a[maxn],b[maxn]; int ans[maxn]; int main() { int x,y; scanf("%d", &n); scanf("%s", a); scanf("%s", b); for(int i = n-1; i>=0; i--){ x = b[i] - 'a'; y = a[i] - 'a'; if(x - y < 0){ ...
C++
5f4009d4065f5ad39e662095f8f5c068
53c81ed18c8137399953ad633a9bfb1f
1,900
PASSED
#include<bits/stdc++.h> #define FOR(i,l,r) for(int (i)=l;(i)<=(r);(i)++) #define pb push_back #define fi first #define se second using namespace std; typedef long long ll; const int maxn=2e5+233; int k; char s[maxn],t[maxn]; int a[maxn]; int main() { ios_base::sync_with_stdio(false); cin>>k; cin>>s+1; cin>>t+1; f...
C++
5f4009d4065f5ad39e662095f8f5c068
4d15b9e99c1b4eb4dac95fe4225db13a
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef int ll; #define pb push_back #define pf push_front #define mp make_pair #define bns binary_search #define Lb lower_bound #define Ub upper_bound #define inf INT_MAX #define vll vector<ll> #define vvll vector<vll> #define vd vector<double> #define pii pair<ll,ll> #defi...
C++
f34cff4302e047b1e3bfc2c79aa57be3
b3e47b9ab4ee5dff6a13b838be812eb5
1,500
PASSED
#include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; main() { int q; cin >> q; while(q--) { int n; cin >> n; char a[2][n]; char id[2][n]; for(int i = 0; i < 2; i++) { for(int j = 0; j < n; j++) { cin >> id[i][j]; if((id[i][j] - '0') >= 3) { a...
C++
f34cff4302e047b1e3bfc2c79aa57be3
588cf629508106c8ef69784cf3e4bdbc
1,500
PASSED
#include<bits/stdc++.h> #include<math.h> #define lld long long int #define mx 10000 using namespace std; int main() { lld t,n,i,f,cnt,cnt2; string c,d; cin>>t; while(t--) { cin>>n; cin>>c; cin>>d; i=n-1; f=0; cnt=0; cnt2=0; for(i=0;i<n;...
C++
f34cff4302e047b1e3bfc2c79aa57be3
2d9204bf0aa0ad6097f6e2d4a742d7ba
1,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef string st; #define f first #define s second #define pb push_back #define pf push_front #define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define MP make_pair #define mem(a , v) memset(a , v , ...
C++
f34cff4302e047b1e3bfc2c79aa57be3
5c9a72b69a5b630bc181b91796e7aef8
1,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef string st; #define f first #define s second #define pb push_back #define pf push_front #define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define MP make_pair #define mem(a , v) memset(a , v , ...
C++
f34cff4302e047b1e3bfc2c79aa57be3
ede0c765fa3fb945f2ceb1dd5c69cab9
1,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; const int maxn=2e5+100; char ch[4][maxn]; int a[4][maxn]; int main() { int t; cin>>t; while(t--){ int n; cin>>n; cin>>ch[1]; cin>>ch[2]; for(int i=0;i<n;i++){ a[0][i...
C++
f34cff4302e047b1e3bfc2c79aa57be3
9dadbfe53abaaff4b13cadbc981a6d6f
1,500
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int count=0; int n; cin>>n; string s[2]; cin>>s[0]>>s[1]; int a[n][2]; for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { ...
C++
f34cff4302e047b1e3bfc2c79aa57be3
3f092326ee143cff905903f02e9e19bf
1,500
PASSED
#include<bits/stdc++.h> #define N 200010 #define pb push_back using namespace std; int T,n,a[N],b[N],dp[N][2]; int main() { scanf("%d",&T); while(T--) { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%1d",&a[i]); for(int i=1;i<=n;i++) scanf("%1d",&b[i]); ...
C++
f34cff4302e047b1e3bfc2c79aa57be3
9d728b8a3500d059336428f113587abf
1,500
PASSED
#include<bits/stdc++.h> #define N 200010 using namespace std; int T,n,t,a[2][N],dp[N][2]; int main() { scanf("%d",&T); while(T--) { scanf("%d",&n); for(int i=0;i<=1;i++) for(int j=1;j<=n;j++) { scanf("%1d",&t); a[i][j]=t>2; ...
C++
f34cff4302e047b1e3bfc2c79aa57be3
5659b83c22e922772a0b6df0ae62e17c
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define el '\n' typedef long long ll; template<typename so> void read(so &x) { x=0; char c;ll dem = 0; for (c=getchar();c<'0'||c>'9';c=getchar()) { dem++;if (dem==100) return; } for (;c>='0'&&c<='9';c=getchar()) { x = x*10+c-'...
C++
f34cff4302e047b1e3bfc2c79aa57be3
00ea3a9e379d9dfc313edd87c493a52c
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) typedef long long ll; typedef double dd; #define pb push_back #define mp make_pair #define endl "\n" ll const M = 1000000007; dd const pi = acos(-1); ll const inf = 2e18; ll const N = 200001; int main...
C++
c63b62ad5b8d0b274599b60442766e17
d682ce4729989dc8d5cdd16467bcc3ad
1,700
PASSED
#include<bits/stdc++.h> // DEEP using namespace std; #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define fwd(i,a,n) for(int i=a;i<=n;i++) #define bak(i,a,n) for(int i=a;i>=n;i--) #define all(v) v.begin(),v.end() #define pb push_back typedef long long ll; typedef unsigned long l...
C++
c63b62ad5b8d0b274599b60442766e17
ec31a3964e33f494434fc695016d6d20
1,700
PASSED
//NAME-DEEPESH BHATT //Institute-IIT Dhanbad //MOTTO-THINK FIRST,CODE LATER #include <bits/stdc++.h> using namespace std; typedef int ll; ll MOD = 1000000007 ; #define endl '\n' #define pb push_back #define mp make_pair //Check for signed int overflow // use __builtin_popcount(num) to calculate no.of setbits in num ...
C++
c63b62ad5b8d0b274599b60442766e17
409adc7bb7719eaed766bb9d7860a52f
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define PI 3.14159265 #define pb push_back #define en cout<<'\n' #define vec vector<ll> #define vecs vector<string> #define pii pair<ll,ll> #define VP vector< pii > #define setbits(x) __builtin_popcountll(x) #define zrobits(x) ud __builtin_ctzll(x) #...
C++
c63b62ad5b8d0b274599b60442766e17
7303fe18ce8cbf8ca308820004b75b90
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define PI 3.14159265 #define pb push_back #define en cout<<'\n' #define vec vector<ll> #define vecs vector<string> #define pii pair<ll,ll> #define VP vector< pii > #define setbits(x) __builtin_popcountll(x) #define zrobits(x) ud __builtin_ctzll(x) #...
C++
c63b62ad5b8d0b274599b60442766e17
651762e171832aefbeec6478d4cdd53c
1,700
PASSED
/* Dejwo to ziomal ®© */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector <int> vi; typedef pair <int, int> pi; typedef vector<pair<int,int>> vpi; #define pb push_back #define FOR0(n) for(int i = 0; i < n; i++) #define FOR0j(n) for(int j = 0; j < n; j++) #define FOR1(n) for(int i = 1...
C++
c63b62ad5b8d0b274599b60442766e17
6eb030ee0b66fb77e207ce3c28daad0a
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long const ll mod=998244353; ll power(ll r,ll x){ if(x==0){ return 1; } ll y= power(r,x/2); y*=y; y%=mod; if(x%2){ y*=r; } y%=mod; return y; } ll inv(ll r) { return power(r , mod - 2); } int main(){ i...
C++
c63b62ad5b8d0b274599b60442766e17
eb3474418525bab00c8a0c22b81aad00
1,700
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef double db; typedef vector<long long> vl; typedef pair<long long , long long > pl; const int N=1e6+1; #define po pop_back #define pb push_ba...
C++
c63b62ad5b8d0b274599b60442766e17
50259f0e5e11e0123ffbc47bc6e9c821
1,700
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr static int mod = 1e9 + 7; constexpr static int inf = (1 << 30) - 1; constexpr static ll infll = (1LL << 61) - 1; int program_init = (ios_base::sync_with_stdio(false), cin.tie(nullptr), cout << fixed << setprecision(15), 0); #pragma GCC target...
C++
c63b62ad5b8d0b274599b60442766e17
b854693762d21787756d56f28025662b
1,700
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr static int mod = 1e9 + 7; constexpr static int inf = (1 << 30) - 1; constexpr static ll infll = (1LL << 61) - 1; int program_init = (ios_base::sync_with_stdio(false), cin.tie(nullptr), cout << fixed << setprecision(15), 0); #pragma GCC target...
C++
c63b62ad5b8d0b274599b60442766e17
46923b7f2becaae9946157e4c045651b
1,700
PASSED
import java.io.*; import java.util.*; public class Comments implements Runnable { static class Circle { double x; double y; double r; Circle(double x, double y, double r) { this.x = x; this.y = y; this.r = r; } public Circle swap...
Java
9829e1913e64072aadc9df5cddb63573
cc4bd913258499eede67360abafe1602
2,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collections; import static java.lang.Math.*; import static java.util.Arrays.asList; import static java.util.Comparator.comparing; public class Main { public static void main(String[] args) throws IOExcept...
Java
9829e1913e64072aadc9df5cddb63573
d1919199d00f776e7cdd2c7f77f34624
2,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Math.max; import static java.lang.Math.sqrt; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
9829e1913e64072aadc9df5cddb63573
dbd3f672d8f9851cf7469f9698e769c6
2,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Math.max; import static java.lang.Math.sqrt; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
9829e1913e64072aadc9df5cddb63573
5cd110d142ab60cd92a26e09b8f93dc2
2,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Math.max; import static java.lang.Math.sqrt; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
9829e1913e64072aadc9df5cddb63573
3d7e2291665226311f7c4ab643a866fd
2,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collections; import static java.lang.Math.*; import static java.util.Arrays.asList; import static java.util.Comparator.comparing; public class Main { public static void main(String[] args) throws IOExcept...
Java
9829e1913e64072aadc9df5cddb63573
d8a3e42fa33516709cdc634c5586356c
2,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Math.max; import static java.lang.Math.sqrt; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
9829e1913e64072aadc9df5cddb63573
32bb9539cbdb45e1a19c7cadf06da816
2,600
PASSED
import java.text.DecimalFormat; import java.util.Scanner; public class Main2 { class circle{ double x,y; double r; } circle[] circ = new circle[3]; public double dis(double x, double y, circle c){ return Math.sqrt((x-c.x)*(x-c.x) + (y-c.y)*(y-c.y)); } public double cost(double x, double y){ double...
Java
9829e1913e64072aadc9df5cddb63573
484b157955d6d903d36c67350d8c076e
2,600
PASSED
import java.util.*; public class Main { static Point[] cs; static double[] rs; static double fit(Point p) { double[] asist = new double[3]; for (int i = 0; i < 3; i++) { asist[i] = ang(p, cs[i], rs[i]); } return (asist[0] - asist[1]) * (asist[0] - asist[1]) + (a...
Java
9829e1913e64072aadc9df5cddb63573
d5fe5b35f07924a21fb3e39562986e95
2,600
PASSED
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; import static java.lang.Math.*; import static java.lang.String.format; public class CF002C { private static class Point { double x; double y; public Point(double x, double y) { this.x = x; ...
Java
9829e1913e64072aadc9df5cddb63573
20ab5f78ebd014335ad2354169ecd1ae
2,600
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll g[1000004]; ll prod[1000004]; vector<int> v[10]; int main(void) { ios::sync_with_stdio(0); cin.tie(NULL); for(int i = 1 ; i <= int(1e6) ; i++){ if(i < 10) g[i] = i, prod[i] = i; else{ ll r = i % 10; prod[i] = r == 0 ?...
C++
7a647a5f10cdcd2b54a1927107edea4f
52daf949eed70e8ae701d1fb100d0c9d
1,300
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long ll ch[1000001][10]; int main() { ll i,j,n,q,l,r,k; vector<int> pd(1000001,0); vector<int> chck(1000001,0); vector<int> pcnt(10,0); for(i=0;i<=9;i++) { ch[0][i]=0; } for(i=1;i<=9;i++) { pd[i]=i; ...
C++
7a647a5f10cdcd2b54a1927107edea4f
36fed65c4768df3a9bc6ae0547b5bcb6
1,300
PASSED
#include<iostream> #include<cstdio> #define what_is(n) cerr<<#n<<" is "<<n<<endl; #define big 1000100 using namespace std; long long check[big]; long long gen[10][big]={{0}}; long long g(long long n) { long long dum = n,fis = 1; if(check[dum]!=0) return check[dum]; while(dum>1) { if(dum...
C++
7a647a5f10cdcd2b54a1927107edea4f
36b139b4141846e90e87e949a6cc5088
1,300
PASSED
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair using namespace std; ll ctr=0; map<ll,ll>m; ll dp[10][1000005]={0}; ll dfs(ll n) { if(n<10) { return n; } ll r,p=1,x=n; if(m[x]==0) { while(n!=0) { r=n%10; if(r!=0) p=p*r; n=n/10; } ll b=dfs(p); m[x...
C++
7a647a5f10cdcd2b54a1927107edea4f
2535e32f213abdaa9e9cb3f92478cb57
1,300
PASSED
#include <iostream> using namespace std; int ans[1123456]; int sum[10][1123456]; int func(int n) { if (ans[n]) { return ans[n]; } if (n < 10) { return n; } int a = 1, i; while (n > 0) { a *= n % 10 ? n % 10 : 1; n /= 10; } return ans[n] = func(a); } in...
C++
7a647a5f10cdcd2b54a1927107edea4f
6d711cd6047324036a940eb6575f067b
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int f(int n) { int ans = 1; while(n != 0) { if(n % 10 != 0) ans *= n % 10; n /= 10; } return ans; } const int N = 1e6 + 10; int dp2[N]; int g(int n) { if(n < 10) return n; if(dp2[n] != -1) return dp2[n]; return dp2[n] = g(f(n)); } int dp[N][10]; int solve(int...
C++
7a647a5f10cdcd2b54a1927107edea4f
5c7693aa2c56cc5e24661aca9f888dee
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int f(int n) { int ans = 1; while(n != 0) { if(n % 10 != 0) ans *= n % 10; n /= 10; } return ans; } const int N = 1e6 + 10; int dp2[N]; int g(int n) { if(n < 10) return n; if(dp2[n] != -1) return dp2[n]; return dp2[n] = g(f(n)); } int dp[N][10]; int solve(int...
C++
7a647a5f10cdcd2b54a1927107edea4f
1637f32e9dd97b780a68900bfa33f380
1,300
PASSED
#pragma GCC optimize("unroll-loops") #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; int f(int n) { int ans = 1; while(n != 0) { if(n % 10 != 0) ans *= n % 10; n /= 10; } return ans; } const int N = 1e6 + 10; int dp2[N]; int g(int n) { if(n < 10) return n; if(dp2[n] != -1) ...
C++
7a647a5f10cdcd2b54a1927107edea4f
82dd0787fffb91d16d2832fa87c0776c
1,300
PASSED
#include<iostream> #include<math.h> #include<string> #include<algorithm> using namespace std; #define rep0(n) for(int i=0;i<n;i++) #define rep(n) for(int i=1;i<=n;i++) double const pi = 3.1415926535; int printint(int n) { cout << n << endl; return 0; } int prints(string s) { cout << s << endl; return 0; } int ...
C++
7a647a5f10cdcd2b54a1927107edea4f
d8b301be60b2e875246063de5e440fab
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int arr[1010000][10]; int pro(int x) { int i = x; int pro; while (1) { pro = 1; while (i != 0) { if (i % 10) pro = pro * (i % 10); i = i / 10; } if (pro < 10) break; ...
C++
7a647a5f10cdcd2b54a1927107edea4f
9ddaa28847db9404320d61c83bdd25ac
1,300
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Main { static Scanner cin = new Scanner(System.in); public static void main(String[] args) throws IOException { int n = cin.nextInt...
Java
138f7db4a858fb1efe817ee6491f83d9
84792a1f6cf6addd589537653223c652
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { int n = Reader.nextInt(); int A = Reader.nextInt(); int B = Reader.nextInt(...
Java
138f7db4a858fb1efe817ee6491f83d9
2a98c8133da46b66c1bbe9f8cda58568
1,600
PASSED
/* So, lets start coding _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / ...
C++
138f7db4a858fb1efe817ee6491f83d9
3740f6b15e797a8d5da0c053e7182cba
1,600
PASSED
#include<bits\stdc++.h> #define int long long #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define infi INT_MAX #define inf 1LL<<60; using namespace std; main() { fast int tc; tc=1; while(tc--) { int a,b,c,i,w1=0,w2=0; cin>>a>>b>>c; int ok=0; ve...
C++
138f7db4a858fb1efe817ee6491f83d9
33fcecc09f2f5160a713633e957228ad
1,600
PASSED
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; const long long N=1000000; long long n,a,b; long long ans[N+10]; void exgcd(long long a,long long b,long long &d,long long &x,long long &y) { if (!b) { d=a; x=1; y=0; } else { ...
C++
138f7db4a858fb1efe817ee6491f83d9
464dc409faeb829e5c60b79690545e7a
1,600
PASSED
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; const long long N=1000000; long long n,a,b; long long ans[N+10]; void exgcd(long long a,long long b,long long &d,long long &x,long long &y) { if (!b) { d=a; x=1; y=0; } else { exgcd(...
C++
138f7db4a858fb1efe817ee6491f83d9
15f7845aad44e6740aef1e01dd223526
1,600
PASSED
#include<iostream> #include<cstdio> #include<map> #include<math.h> #include<queue> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; const int maxn=1e6+10; int T,ans[maxn]; int main (){ int n,a,b,ans1=-1,ans2=-1,k=1; cin>>n>>a>>b; for(int i=0;i<=n;i++){ if(n-a*i<0) bre...
C++
138f7db4a858fb1efe817ee6491f83d9
022d602e48638be3706e4554c7a49ba0
1,600
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; #define endl '\n' int main() { ios::sync_with_stdio(0); cin.tie(0); ll N,A,B; cin >> N >> A >> B; for (ll l = 0; l <= N; ++l) { if (N - l*B < 0) continue; if ((N - l*B) % A) continue; ll k = (N - l...
C++
138f7db4a858fb1efe817ee6491f83d9
a6175b6f0373589bad0420c5c635197c
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n,a,b; cin >> n >> a >> b; int na=ceil(1.0*n/a),nb=0; while(true){ if(na*a+nb*b==n)break; if(na==0&&nb*b>n){ cout << -1; return 0; } if(na*a+nb*b>n)na--; else if(na*a+nb*b<n)nb++;...
C++
138f7db4a858fb1efe817ee6491f83d9
44148855ac0b06ee31c3b001efdbed4a
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n,a,b; cin>>n>>a>>b; ll x=a; vector<ll>v; for(ll i=1;n>0;i+=x,n=n-x) { if((n)%b==0)x=b; for(ll j=0;j<x;j++) ...
C++
138f7db4a858fb1efe817ee6491f83d9
2f6f15de0d1532d674e1860b6826c70c
1,600
PASSED
#include<cstdio> #include<vector> #include<algorithm> using namespace std; #define getcx getchar inline void in(long long int &n) { n=0; int ch = getcx(); int sign = 1; while(ch < '0' || ch > '9') { if(ch == '-') sign=-1; ch = getcx(); } while(ch >= '0' && ch <= '9') { n = (n << 3) + (n << 1) + ch - ...
C++
4e1fc2fcc83b007c943a8ea26eea6320
13cf2332aa1d4fbd278230c42314dace
1,900
PASSED
#include<cstdio> #include<vector> #include<algorithm> using namespace std; #define getcx getchar inline void in(long long int &n) { n=0; int ch = getcx(); int sign = 1; while(ch < '0' || ch > '9') { if(ch == '-') sign=-1; ch = getcx(); } while(ch >= '0' && ch <= '9') { n = (n << 3) + (n << 1) + ch - ...
C++
4e1fc2fcc83b007c943a8ea26eea6320
675e08f79e51cafb8db768e29c453c40
1,900
PASSED
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; #include <stdint.h> #include <string.h> #define N 100005 int64_t dp[N + N]; int64_t head[N]; int64_t tdata[N]; int64_t data[N + N]; int Read(int n, int m) { for (int i=1; i<=n; ++i) { scanf("%I64d", &head[i]); } for (int i=1; i<=m; ++...
C++
4e1fc2fcc83b007c943a8ea26eea6320
11fddf3ba7e21b377c6aaa5e243a8239
1,900
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <numeric> #include <functional> #define rep(i, n) for(int i = 0; i < (n); i++...
C++
4e1fc2fcc83b007c943a8ea26eea6320
3fa66c05727e865765d39fef4dc0f6ac
1,900
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #define ll long long using namespace std; ll hp[100005]; ll cur_hp[100005]; ll disk[100005]; ll cur_t[100005]; ll n,m; bool calc(ll t) { ll a,b,c,d,e,cur,dp; cur=0; //cout<<"Current time="<<t<<endl; for(a=0;a<n;a++){ cur_hp[a]=hp[a]; cur_t[a...
C++
4e1fc2fcc83b007c943a8ea26eea6320
5d51bfb0d24256e1b574649f97d88955
1,900
PASSED
/************************************************************************* > File Name: e.cpp > Author: Nature > Mail: 564374850@qq.com > Created Time: Thu 23 Oct 2014 11:57:41 PM CST ************************************************************************/ #include <cstdio> #include <cstring> #include...
C++
4e1fc2fcc83b007c943a8ea26eea6320
035545c3666a3dc23b945a8b6889fe46
1,900
PASSED
/************************************************************************* > File Name: e.cpp > Author: Nature > Mail: 564374850@qq.com > Created Time: Thu 23 Oct 2014 11:57:41 PM CST ************************************************************************/ #include <cstdio> #include <cstring> #include...
C++
4e1fc2fcc83b007c943a8ea26eea6320
a0222ad572a9498b6f9b42d3363caa1c
1,900
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <cmath> using namespace std; const int MAXN = 1000 * 100 + 100; int n, m; long long p[MAXN], h[MAXN]; long long time(int l, int r, long long x) { return min(abs(x - p[l]) + p[r] - p[l], abs(x - p[r]) + p[r] - p[l]); } bool can(long long t) { ...
C++
4e1fc2fcc83b007c943a8ea26eea6320
44cec22babef8b1e8562017a5732480d
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define gc getchar vector<ll> h; vector<ll> p; int n,m; bool go(ll t) { int a = 0, b = 0; while(a<n && b<m) { while(a<n && abs(h[a]-p[b])>t) a++; if(a==n) break; if(h[a]<=p[b]) { while(b<m && p[b]<=h[a]+t) b++;//nothing lost in i...
C++
4e1fc2fcc83b007c943a8ea26eea6320
f549cbf70d26afdced43c661629f8800
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define gc getchar vector<ll> h; vector<ll> p; int n,m; bool go(ll t) { int a = 0, b = 0; while(a<n && b<m) { while(a<n && abs(h[a]-p[b])>t) a++; if(a==n) break; if(h[a]<=p[b]) { while(b<m && p[b]<=h[a]+t) b++;//nothing lost in i...
C++
4e1fc2fcc83b007c943a8ea26eea6320
c74c3fc0645c317afc6eb40358846b00
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define FOR(i, x, y) for(int i = x; i < y; ++i) #define int long long main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<pair<int, int>> marb(n); vector<int> dp(n); FOR(i, 0, n){ cin >> marb[i].first >> marb[i].second; } sort(marb.begin(...
C++
334d2bcb32d88a7037bcf262f49938cf
039bfbda30636148a2608c77e757fd87
1,800
PASSED
#include <iostream> #include <cstring> #include <algorithm> #include <cstdio> using namespace std; typedef long long ll; const ll inf = 1e15; const int maxn = 3005; struct Node { int x, c; bool operator <(const Node &a) const { return x < a.x; } } node[maxn]; ll sum[maxn], dp[maxn]; int main() { int n; scanf(...
C++
334d2bcb32d88a7037bcf262f49938cf
167ba0c80f2011a23679e7643035efbd
1,800
PASSED
/*بسم الله الرحمن الرحيم*/ #include <bits/stdc++.h> using namespace std; #define pi 3.1415926536 typedef long long ll; typedef long double ld; const ll MAX=1000001; // Dir Array ! int dx[8]= {1,0,0,-1,1,-1,1,-1}; int dy[8]= {0,1,-1,0,1,-1,-1,1}; ll n; ll dp[3009][3009]; pair<ll,ll>num[3009]; int SOL(int ind,int last){ ...
C++
334d2bcb32d88a7037bcf262f49938cf
9db2ef6ed054ea404ec36cbeff7a7af1
1,800
PASSED
/*In The Name Of The God*/ #include <bits/stdc++.h> using namespace std; /* #define cin fin #define cout fout ifstream cin("input.txt"); ofstream cout("output.txt"); */ #define pi 3.14159265358979323846 #define inf (ll)9e18 #define Fight_Club cin.tie(0);cout.tie(0);std::ios::sync_with_stdio(false); typedef long long l...
C++
334d2bcb32d88a7037bcf262f49938cf
a84899021a3b6ddb3d6d060fc180e29a
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define eb emplace_back #define ll long long #define pii pair < int, int > #define fr first #define sc second #define mk make_pair #define sz(s) (int)s.size() #define all(s) s.begin(), s.end() #define ok puts("ok"); #define whatis(x) cerr << #x << " =...
C++
334d2bcb32d88a7037bcf262f49938cf
9400ed5d3e49b45a2578a279e1a9d5e0
1,800
PASSED
/* I found myself in Wonderland Get back on my feet again.. */ #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<vector> #include<stack> #include<queue> #include<deque> #include<set> #include<map> #include<string> #include<utility> #include<iomanip> #include<fstream> #include<lis...
C++
334d2bcb32d88a7037bcf262f49938cf
37ca6e304802eaba20512195f584b1f4
1,800
PASSED
#include <iostream> #include <algorithm> #define inf 1000000000000000 #define Nmax 3005 using namespace std; long long n, dp[Nmax], x, s, cost[Nmax][Nmax], sum[Nmax]; pair<int,int>p[Nmax]; int lg(int i, int j) { return p[i].first - p[j].first; } int main() { cin >> n; for(int i = 1; i <= n; i++) ...
C++
334d2bcb32d88a7037bcf262f49938cf
fbbd0ecb354b4e6f94012b4e08520a22
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define loop(i,n) for(i=1;i<=n;++i) #define lop(i,n) for(i=0;i<n;++i) #define pb(i) push_back(i) #define ff first #define ss second #define vi vector<int> #define vll vector<ll> #define mod 1000000007 ll bin_exp(ll a,ll n,ll m) { ll res=1; ...
C++
334d2bcb32d88a7037bcf262f49938cf
96a3290cc0cc7bfac122ec50199475d8
1,800
PASSED
#include<bits/stdc++.h> #pragma GCC diagnostic error "-std=c++14" #pragma GCC target("avx") #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-ftree-pre") #pragma G...
C++
334d2bcb32d88a7037bcf262f49938cf
eb9038f94e39a96cd13d17f301466071
1,800
PASSED
#include <stdio.h> #include <climits> #include <algorithm> #include <iostream> typedef long long LL; using namespace std; struct node { LL x,c; }mar[3010]; LL dp[3010][3010] = {0}; bool cmp(node a,node b){return a.x<b.x;} int main() { int n; scanf("%d",&n); for(int i = 0;i<n;i++) scanf("%I64d%I64d",&mar[i].x,&mar[i...
C++
334d2bcb32d88a7037bcf262f49938cf
9ce4597d5fdb238ced6a9edb1d8132b9
1,800
PASSED
#include<bits/stdc++.h> #define ll long long int using namespace std; int main(){ ll n,a[200005],s,ans=0; cin>>n>>s; for(int i=1;i<=n;i++)cin>>a[i]; sort(a+1,a+n+1); ll m=(n+1)/2; if(a[m]<s){ for(int i=m;i<=n;i++)if(a[i]<s)ans+=s-a[i]; } else{ for(int i=m;i>0;i--)if(a[i]>...
C++
0df33cd53575471b1cc20702bf777059
958a4099fb3f7a65fbe8e578d990ae5e
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here long long int i,j,k,n,r,sum=0; cin>>n>>r; vector<long long int> vec(n); for(i=0;i<n;i++){ cin>>vec[i]; } sort(vec.begin(),vec.end()); j=vec.size()/2; // k=find(vec.begin(),vec.end(),r)-vec.begin(); for(i=0;i<j;i++){ if(vec[i...
C++
0df33cd53575471b1cc20702bf777059
721ecd4834ddf670fab2a06f7056056d
1,300
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=200010; int a[maxn],n,m; int main() { scanf("%d%d",&n,&m); for (int i=1; i<=n; i++) scanf("%d",&a[i]); sort(a+1,a+n+1); long long ans1=0,ans2=0,ans3=9999999999999999; if (m>a[(n/2)+1]) for (int i=n/2+1; i<=n; i++) if (m>a[i]) ans1+=fabs(a[i]-m);...
C++
0df33cd53575471b1cc20702bf777059
282c1b0785df17c7bc507859f52ac8aa
1,300
PASSED
/*{لَا تَدْرِي لَعَلَّ اللَّهَ يُحْدِثُ بَعْدَ ذَٰلِكَ أَمْرًا}*/ /*XD include MOAE XD*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define MOAE \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ll get_Median(ll n, ...
C++
0df33cd53575471b1cc20702bf777059
de02a0d1fa1f52870a3a8ce0bcab8bb1
1,300
PASSED
/*{لَا تَدْرِي لَعَلَّ اللَّهَ يُحْدِثُ بَعْدَ ذَٰلِكَ أَمْرًا}*/ /*XD include MOAE XD*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define MOAE \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ll get_Median(ll n, ...
C++
0df33cd53575471b1cc20702bf777059
2fbd1a23e56bba58a8151dfcf3f0b5c1
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define fo(i,n) for(i=0;i<(n);++i) #define pb push_back #define mp make_pair #define f first #define s second #define endl '\n' #define PI 3.1415926535897932384626433832795 #define all(x) x.begin(), x.end() #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie...
C++
0df33cd53575471b1cc20702bf777059
a97575fcbd9a6c95655474d280ef99e2
1,300
PASSED
#include <bits/stdc++.h> #include <algorithm> using namespace std; int main(int argc, char** argv) { int n = 0, s = 0; unsigned int *array = NULL; cin >> n >> s; array = new unsigned int[n]; for(int i = 0; i < n; i++) cin >> array[i]; sort(array, array + n); int median = array[n/2]; long long result = ...
C++
0df33cd53575471b1cc20702bf777059
10d0d125049f99810e5432fa5cd1a579
1,300
PASSED
#include <bits/stdc++.h> #include <algorithm> using namespace std; int main(int argc, char** argv) { int n = 0, s = 0; unsigned int *array = NULL; cin >> n >> s; array = new unsigned int[n]; for(int i = 0; i < n; i++) cin >> array[i]; sort(array, array + n); int median = array[n/2]; long long result = ...
C++
0df33cd53575471b1cc20702bf777059
2bdeafaa29fd0a3d5f3bc15b76c87b4c
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int i,j,n; long long s,ar[200000],sum=0; cin>>n>>s; for(i=0;i<n;i++) {cin>>ar[i]; } sort(ar,ar+n); j=n/2; if(ar[j]<s) { while(ar[j]<s&&j<n) {sum+=s-ar[j]; j++; } } else {while(ar[j]>s&&j>=0) {sum+=ar[j]-s...
C++
0df33cd53575471b1cc20702bf777059
a2259afd9980bbfa5be9cd3838b987e6
1,300
PASSED
#include<cstdio> #include<iostream> #include<cmath> #include<algorithm> #include<cstring> using namespace std; long long a[200005],b[200005],c[200005]; int main() { long long n,m,i,j; cin>>n>>m; for(i=0;i<n;i++) cin>>a[i]; sort(a,a+n); long long sum1=0,sum2=0; for(i=0;i<n/2;i++) { if(...
C++
0df33cd53575471b1cc20702bf777059
ac4d07ac7340074a175fd27060bca22d
1,300
PASSED
using System; namespace _69A { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int x=0,y=0,z=0; for(int i = 0; i < n; i++) { string str = Console.ReadLine(); string[] toen = ...
C#
8ea24f3339b2ec67a769243dc68a47b2
4c4b16b4229b8ed982251da8c247da15
1,000
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace firstuva { class Program { /// <summary> /// /// </summary> /// <param name="args"></param> static void Main(string[] args) { ...
C#
8ea24f3339b2ec67a769243dc68a47b2
ab1513e50720c7eb4d8b312cb8ad43cd
1,000
PASSED
using System; class YoungPhysicist { static void Main() { int n, sumx, sumy, sumz; sumx = sumy = sumz = 0; n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] coo = Console.ReadLine().Split(); sumx += int.Parse(coo[0]); ...
C#
8ea24f3339b2ec67a769243dc68a47b2
d60095314e1e1c1b3a8a8c906fa18da2
1,000
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CodeForces { public class Test { public static void Main() { int noOfForces = Convert.ToInt32(Console.ReadLine()); int n = noOfForces; ...
C#
8ea24f3339b2ec67a769243dc68a47b2
af022b498d88c629dfa77fd200a8d885
1,000
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace ProblemN { public class Program { public static void Main(string[] args) { List<int> v = new List<int>() { 0, 0, 0}; int n = int.Parse(Console.ReadLine()?.Trim()); for(int i = 0; i < n; i...
C#
8ea24f3339b2ec67a769243dc68a47b2
4b952a2750e8e4ad3db10ea3341b5254
1,000
PASSED
using System; using System.Collections.Generic; namespace YoungPhysycist { class Program { static void Main(string[] args) { int n = Convert.ToInt32(Console.ReadLine()); List<(int x, int y, int z)> vecs = new List<(int x, int y, int z)>(); while (n > 0) ...
C#
8ea24f3339b2ec67a769243dc68a47b2
7fd2f3154c9e9e3d37209561e0274ecb
1,000
PASSED
using System; namespace CF_YoungPhysicist { class Program { static void Main(string[] args) { int vectorcount = Int32.Parse(Console.ReadLine()); int x = 0; int y = 0; int z = 0; string[] input; for(int i = 0; i < vectorcount; ++i) { ...
C#
8ea24f3339b2ec67a769243dc68a47b2
bedd868dada07e17e2d5f3718c9e719e
1,000
PASSED
using System; namespace CF_YoungPhysicist { class Program { static void Main(string[] args) { int vectorcount = Int32.Parse(Console.ReadLine()); int x = 0; int y = 0; int z = 0; string[] input; for(int i = 0; i < vectorcount; ++i) { ...
C#
8ea24f3339b2ec67a769243dc68a47b2
4db3ac10379de316489c6b81b1c2f316
1,000
PASSED
using System; namespace CF_YoungPhysicist { class Program { static void Main(string[] args) { int vectorcount = Int32.Parse(Console.ReadLine()); int[] sum = new int[3] { 0, 0, 0 }; string[] input; for(int i = 0; i < vectorcount; ++i) { input =...
C#
8ea24f3339b2ec67a769243dc68a47b2
07677bdcf63010022e3990b70c5cf1eb
1,000
PASSED
using System; namespace CF_YoungPhysicist { class Program { static void Main(string[] args) { int vectorcount = Int32.Parse(Console.ReadLine()); int x = 0; int y = 0; int z = 0; string[] input; for(int i = 0; i < vectorcount; ++i) { ...
C#
8ea24f3339b2ec67a769243dc68a47b2
ab60e5dd047dd595b92cbfe209aa510d
1,000
PASSED
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
7