source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
import java.util.Arrays; import java.util.Scanner; public class C { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int l = n*100; int a[] = new int[n]; int m = 0 ; for(int i = 0 ; i < n...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
34a0a38d5fc58665659e70fd45f1cedd
1,400
PASSED
import java.io.*; import java.util.*; public class C { FastScanner in; PrintWriter out; int i = 0, j = 0; void solve() { /**************START**************/ int n = in.nextInt(); int k = in.nextInt(); int totalPoints = 0; int[] needed = new int[n]; int cur; for (i = 0; i < n; i++) { cur = in....
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
27082417b1b536f6bc779947294fee38
1,400
PASSED
import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; import static java.lang.Math.min; public class C { static Scanner in = new Scanner(System.in); static PrintStream out = System.out; public static void main(String[] args) { int n = in.nextInt(); int k = in.next...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
e420b33287e73b68eeaf2f08176ca7e8
1,400
PASSED
import java.util.*; public class Main { private static Scanner in; static class Rate implements Comparable<Rate> { int rate, rateMod; public Rate() { } public Rate(int R) { rate = R; rateMod = R % 10; } public int compareTo(Rate arg0) { if (rateMod != arg0.rateMod) return rateMod - arg0...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
fe6ef1af3c7607643c2b932c02d4a92f
1,400
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.Random; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; im...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
c8f26b79b0e68536409b6fa3890e2aa3
1,400
PASSED
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; public class ACMSolution { public static void main(String[] args) throws IOException { //Scanner in = new Scanner(Paths.get("input....
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
dc13dbd3f27f7e68c0a834fc0604837d
1,400
PASSED
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
dfc7b40eb0d79c68197bc02c5aeadcbf
1,400
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class P581C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] n_k_str = br.readLine().split(" "); ...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
cd3dfa52601dbf27745a23608be14909
1,400
PASSED
import java.util.*; import java.awt.Point; import java.io.*; import java.math.BigInteger; public class CodeForces { FastScanner in; PrintWriter out; class skil implements Comparable { int skil; int x; skil (int a, int b) { skil = a; x = b; } publ...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
efee5c54ca4b199fb247f23574f307d5
1,400
PASSED
#include <bits/stdc++.h> // #include <stdc++.h> typedef long long ll; using namespace std; #define PI 3.141592653589793238 typedef pair<ll,ll> pll; typedef map<ll,ll> mll; typedef vector<ll> vll; typedef set<ll> sll; typedef pair<double,double> pdd; #define fi first #define se second #define mp make_pair #define pb p...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
bdd42b6a5ee706b9ef8d8636ebba015c
2,100
PASSED
//Tanuj Khattar #include<bits/stdc++.h> using namespace std; typedef pair<int,int> II; typedef vector< II > VII; typedef vector<int> VI; typedef vector< VI > VVI; typedef long long int LL; #define PB push_back #define MP make_pair #define F first #define S second #define SZ(a) (int)(a.size()) #define AL...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
522c5124238c85b983a31ea89ff4a628
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define db(x) cerr << #x << " = " << x << endl; #define INF 0x3f3f3f3f3f3f3f3f #define fi first #define se second #define vi vector<int> #define vll vector<ll> #define all(x) x.begin(), x.end() #define pii pair<int, int> #define pll pair<ll, ll> #define...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
09593b073bab7a06a1da34ad0a6a56bc
2,100
PASSED
#include <bits/stdc++.h> /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> using namespace __gnu_pbds; */ using namespace std; #if DEBUG && !ONLINE_JUDGE #include "debug.h" #else #define debug(...) #endif typedef long long ll; ...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
28b1adf95d53c5eb2ead694ac7511d71
2,100
PASSED
#include <bits/stdc++.h> using namespace std; long long n; vector<long long> a[400005]; long long child[400005]; long long res = -1; long long initscore = 0; void dfs(int node, int p, long long score) { res = max(res, score); for (int v : a[node]) { if (v != p) { dfs(v, node, score + n - 2 * child[v]); ...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
0503d25b04ec24728ae4f40a81bd183a
2,100
PASSED
#include<bits/stdc++.h> #define ll long long #define ld long double #define st string #define fr first #define se second const ll mod=1e9+7; const ld PI=3.141592653589793238462643; using namespace std; ll d[200200], s[200200], us[200200], answer=0; vector<ll> v[200200]; void dfs(ll x) { us[x]=1; for(ll i=0...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
52c62bfeeb569c419b1eda7702c11b63
2,100
PASSED
/*input 9 1 2 2 3 2 5 2 6 1 4 4 9 9 7 9 8 */ /* ______________ | ) | ) / |______/...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
40e7c6720db5941348cb7e4a8a7f799b
2,100
PASSED
/*input 9 1 2 2 3 2 5 2 6 1 4 4 9 9 7 9 8 */ /* ______________ | ) | ) / |______/...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
df04b02d88ce91ee4dc21547da4f4e4d
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long ll input(){ ll x=0,f=0;char ch=getchar(); while(ch<'0'||ch>'9') f|=ch=='-',ch=getchar(); while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(); return f? -x:x; } const int N=2*1e5+7; ll d[N],sz[N]; struct edge{ int v,next; }e[N*2]; int head[N],to...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
784d1302ca4a32d340d27ed4656efdac
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define int long long vector<int> v[200005]; int dp[200005], sub[200005]; int ans, n; void dfs(int x,int p = -1) { sub[x] = 1; for (int i : v[x]) { if(i != p) { dfs(i, x); ...
C++
d5a8fb9f0d69c12c16124d32cf22b46f
17c4e21784afcf2515b67d28ca257d67
2,100
PASSED
#include <stdio.h> const int nmax = (int)1e+5; int a[nmax]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); int left = 0; int right = n - 1; int leftsum = 0; int rightsum = 0; int alice = 0; int bob = 0; while (left < right) { ...
C++
8f0172f742b058f5905c0a02d79000dc
f769f73377ce79f65888b9a6594ef060
1,200
PASSED
#include <iostream> #define MAX 100006 using namespace std; int main() { long long n; int a[MAX]; long long i; cin >> n; int k = n; for (i = 1; i <= n; i++) cin >> a[i]; long long s1=0, s2=0; i = 0; long long j = n+1; long long dem1 = 0, dem2 = 0; while (n > 0) { ...
C++
8f0172f742b058f5905c0a02d79000dc
dce563fca2a0239db1c872a50576b3aa
1,200
PASSED
#include <iostream> using namespace std; int main() {int *A,n,*p,i,*p1,s1,s2,sum1,sum2,j,t; cin>>n; s1=1;s2=1; A=new int[n]; for(i=0;i<n;i++) cin>>A[i]; j=0; t=n-1; sum1=A[0];sum2=A[n-1]; if(n==1){cout<<1<<" "<<0<<endl;} else{ while(j<t){if(sum1<sum2){j++;if(j<t) s1++;sum1+=A[j];continue;} if(sum1>sum2){ t--;if(j<t) ...
C++
8f0172f742b058f5905c0a02d79000dc
5858cfc5fe0ee555e04627d3b79f8a8a
1,200
PASSED
#include <cstdio> #include <vector> using namespace std; int main(){ #ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); #endif int n; scanf("%d", &n); vector<int> a(n); if (n == 1){ printf("1 0"); return 0; } int ans1 = 0, ans2 = 0; for (int i = 0; i < n; ++i){ scanf("%d", &a[i]); } int idx = 0, ...
C++
8f0172f742b058f5905c0a02d79000dc
4f2925df830bf06d75301be251f58a66
1,200
PASSED
#include <iostream> #include <vector> using namespace std; typedef unsigned int uint; int main() { uint dim = 0; cin>>dim; uint temp = 0; if (dim == 1) { cin>>temp; cout<<1<<" "<<0; return 0; } if (dim == 2) { cin>>temp>>temp; cout<<1<<" "<<1; return 0; } vector<uint> choco; vector<bool> chocoEa...
C++
8f0172f742b058f5905c0a02d79000dc
5c086b0f8918f5ce53a24c8bebd3ea3d
1,200
PASSED
#include <iostream> #include <cstdio> #include <string> #include <string.h> #include <cstdlib> #include <cmath> #include <vector> #include <list> #include <cctype> #include <algorithm> #include <climits> #include <queue> #include <functional> #include <map> using namespace std; typedef pair<int,int> pii; typedef pair<p...
C++
8f0172f742b058f5905c0a02d79000dc
b43256521ca76a75c91205a0fc9d45a2
1,200
PASSED
#include <iostream> #include <stdio.h> using namespace std; void main() { long int n, *mass; cin>>n; mass = new long int[n]; for(int i = 0; i < n; i++) cin>>mass[i]; long int l = 0, r = n - 1, A = mass[l], B = mass[r]; for(int i = 0; i < n; i++) { ...
C++
8f0172f742b058f5905c0a02d79000dc
069618ef7eb52f3627e11db3e7500402
1,200
PASSED
#include <iostream> #include <conio.h> using namespace std; void main() { long int n, t[100000]; int i,x=0; cin>>n; if (n==1) {cout<<1<<" "<<0;} else{ cin>>x; t[0]=x; for (i=1; i<n; i++){ cin>>x; t[i]=t[i-1]+x; } x=t[n-1]/2; i=0; while (t[i]<=x) i++; if (t[i-1]<=t[n-1]-t[i]) i++; cout<<i<<" "<<n-i; } }
C++
8f0172f742b058f5905c0a02d79000dc
24ddc1e235ee0231b53987834a6c8eec
1,200
PASSED
#include <iostream> using namespace std; void main() { long int n, t[100000]; int i,x=0; cin>>n; if (n==1) {cout<<1<<" "<<0;} else{ cin>>x; t[0]=x; for (i=1; i<n; i++){ cin>>x; t[i]=t[i-1]+x; } x=t[n-1]/2; i=0; while (t[i]<=x) i++; if (t[i-1]<=t[n-1]-t[i]) i++; cout<<i<<" "<<n-i; } }
C++
8f0172f742b058f5905c0a02d79000dc
87b22da534a186beca570757e2e5f9c3
1,200
PASSED
#include <iostream> using namespace std; void main() { long int n, t[100000]; int i,x=0; cin>>n; if (n==1) {cout<<1<<" "<<0;} else{ cin>>x; t[0]=x; for (i=1; i<n; i++){ cin>>x; t[i]=t[i-1]+x; } x=t[n-1]/2; i=0; while (t[i]<=x) i++; if (t[i-1]<=t[n-1]-t[i]) i++; cout<<i<<" "<<n-i; } }
C++
8f0172f742b058f5905c0a02d79000dc
6b4ad98925d8476a193184776b70572b
1,200
PASSED
#include <stdio.h> int main() {int t,i,j; unsigned int n,s,k,b,x,y,c,a[100000]; scanf("%d",&t); for(i=0;i<t;i++) {scanf("%u %u %u",&n,&s,&k); for(j=0;j<k;j++) scanf("%u",&a[j]); x=s; y=s; c=1; while(c!=0) { if(x<=n){ for(j=0;j<k;j++) { if(a[j]==x) {x++; c=1; break;} else {c=0...
C
faae9c0868b92b2355947c9adcaefb43
d7a2efbeaeec84d86598bcd8982d3c2b
1,100
PASSED
#include<stdio.h> #include<string.h> int main(){ int t,n,s,k,i,a[2000],dps[2000]={0},dpb[2000]={0}; scanf("%d",&t); while(t--){ int mark=1; memset(a,0,sizeof(a));memset(dps,0,sizeof(dps));memset(dpb,0,sizeof(dpb)); scanf("%d%d%d",&n,&s,&k); int x=1,y=1,xs,ys; for(i=1;i<=k;i++){ scanf("%d",&a[i]); if(...
C
faae9c0868b92b2355947c9adcaefb43
bcbbebb1eb2454a4727517cfc44d9c12
1,100
PASSED
#include<stdio.h> int main() { int t,n,s,k,i,j,p,c,d,a,b,q; scanf("%d",&t); while(t--) { p=0; scanf("%d %d %d",&n,&s,&k); int m[k+1]; for(i=1;i<=k;i++) { scanf("%d",&m[i]); if(m[i]==s) p=i; } if(p==0) printf("0\n"); ...
C
faae9c0868b92b2355947c9adcaefb43
e5d8516554e45b7de386bce4ac4f54b6
1,100
PASSED
int search(int k,int a[],int x) { int i,jok=0; for(i=0;i<k;i++) { //printf("hell %d \n",a[i]); if(x==a[i]){ jok=1; break; } } if(jok==1) return 0; else return 1; } int main(){ int t,n,s,k,i,m=0,g=0,l,f; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d %d %d",&n,&s,&k); int j,a[k]; for(j=0;j<k;j++) scanf("...
C
faae9c0868b92b2355947c9adcaefb43
520f32396242c5f75e137cc3759e04d8
1,100
PASSED
#include<stdio.h> int main() { long long int n; scanf("%lld",&n); long long int po=0; while(po++!=n) { long long int no,present,damage; scanf("%lld%lld%lld",&no,&present,&damage); long long int A[damage],C[4007]; for(int i=0; i<4007; i++) { C[i]=1; } for(long long int i=0; i<dam...
C
faae9c0868b92b2355947c9adcaefb43
08832f11a5f42dfab264cc85fff9b02b
1,100
PASSED
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--){ int n,s,k,a,b,count1=0,count2=0; scanf("%d%d%d",&n,&s,&k); int arr[k]; for(int i=0;i<k;i++) scanf("%d",&arr[i]); for(int i=0;i<=1000;i++){ a=0; for(int j=0;j...
C
faae9c0868b92b2355947c9adcaefb43
f24f0379ef9616e2c8a15b2c46a2d5b5
1,100
PASSED
#include <stdio.h> #include <stdlib.h> int cmp(const void *a, const void *b){ return *(int *)a-*(int *)b; } int main(void){ int T, n, s, k, i, idx, dis, on, K[1000]; scanf("%d", &T); while(T--){ scanf("%d %d %d", &n, &s, &k); on=1; for(i=0; i<k; ++i){ scanf("%d", &K[i]); } qsort(K, k, sizeof(i...
C
faae9c0868b92b2355947c9adcaefb43
5a0229bb34e06212f543776106e4a45c
1,100
PASSED
#include<stdio.h> #include<math.h> int main() { int t; scanf("%d",&t); while(t--){ int i,j; long long int n,now,close; int close_now[1001]; scanf("%lld %lld %lld",&n,&now,&close); for(i=1;i<=close;i++){ scanf("%d",&close_now[i]); } int min=0; while(1){ int k1=1,k2=1; for(i=1;i<=close;i++){ ...
C
faae9c0868b92b2355947c9adcaefb43
e293cc6aa6f7b49e95f09f7e66afb67e
1,100
PASSED
#include<stdio.h> int a[1002][1002]; int main(){ int t,n,s,k,z,min,mid,l,r,f; scanf("%d",&t); for(int p=1;p<=t;++p){ scanf("%d %d %d",&n,&s,&k); for(int j=1;j<=k;++j){ scanf("%d",&a[p][j]); } for(int i=1;i<=k;++i){ min=i; for(int j=i;j<=k;++j){ if(a[p][j]<a[p][min])min=j; } z=a[p][i]; a...
C
faae9c0868b92b2355947c9adcaefb43
d6a82d9d42d9689fffadf9ca513d57c1
1,100
PASSED
#include<stdio.h> #include<math.h> int main() { int t; scanf("%d",&t); int n,s,k; for(int i=0;i<t;i++) { scanf("%d%d%d",&n,&s,&k); int o; int m[1001]={0}; for(o=0;o<k;o++) { scanf("%d",&m[o]); m[o]=abs(m[o]-s); } for (o=0;o<k-1;o++) { for (int j=0;j<k-o-1;j++) if (m[j]>m[j+1]) { int ...
C
faae9c0868b92b2355947c9adcaefb43
a218de13627baa8ee89373cb21531b7b
1,100
PASSED
import java.io.*; import java.util.Arrays; import java.util.Scanner; public class solii_runner{ static class helper { public int Parent(int index) { return index >> 1; } public int Left(int index) { return (index << 1); } public int Right(int index) { return (index << 1) | 1; } } static class min_...
Java
08c4d8db40a49184ad26c7d8098a8992
31cd2433946709c9d7830a9d1dc8ec00
1,300
PASSED
import java.util.*; import java.io.*; public class CF545D{ public static void main(String[] args)throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); int a[] = new int[n]; for(int i = 0; i < n;...
Java
08c4d8db40a49184ad26c7d8098a8992
56f9f0b0a4858d1460f14b7683a8a544
1,300
PASSED
import java.util.*; import java.io.*; public class CF545D{ public static boolean[] bol; public static void main(String[] args)throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); int a[] = new in...
Java
08c4d8db40a49184ad26c7d8098a8992
97cf7630676f9c759d3c178bfa0943b0
1,300
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.util.Arrays; public class Main_545D { public static void main(String[] args) throws IOException { StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new ...
Java
08c4d8db40a49184ad26c7d8098a8992
ba5ba654fb4bd04a194ef9068c3311a8
1,300
PASSED
import java.util.*; public class q { public static void main(String args[]) { Scanner s=new Scanner(System.in); String a=s.nextLine(); String t=s.nextLine(); String b[]=t.split(" "); int c[]=new int[b.length]; for(int i=0;i<b.length;i++) { c[i]...
Java
08c4d8db40a49184ad26c7d8098a8992
7c1d260c7beabbc774ec98eaf8596444
1,300
PASSED
//package helloworld; import java.util.*; import java.io.*; public class QueueTime { public static void main(String[] args)throws Throwable { PrintWriter pw = new PrintWriter(System.out); BufferedReader bf =new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> t = new ArrayList<Integer>(); ...
Java
08c4d8db40a49184ad26c7d8098a8992
81b06ecec8dc1efeb345108f1b3af727
1,300
PASSED
// package CodeForces; import java.util.*; import java.io.*; public class Problem_545D { public static void main(String[] args)throws Throwable { PrintWriter pw = new PrintWriter(System.out); BufferedReader bf =new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> t = new ArrayList<Integer>(...
Java
08c4d8db40a49184ad26c7d8098a8992
04aa3e207815be3952e8d46ed76cbbcf
1,300
PASSED
//package helloworld; import java.util.*; import java.io.*; public class QueueTime { public static void main(String[] args)throws Throwable { PrintWriter pw = new PrintWriter(System.out); BufferedReader bf =new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> t = new ArrayList<Integer>(); ...
Java
08c4d8db40a49184ad26c7d8098a8992
ce227df9741db7269e39d24d2d731352
1,300
PASSED
// Queues // Codeforces code - 545D import java.util.Arrays; import java.util.Scanner; public class q { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long arr[] = new long[n]; for (int i= 0;i<n;i++) { arr[i] = scan.nextLong(); } Arrays.sort(a...
Java
08c4d8db40a49184ad26c7d8098a8992
546444c2a513ec8b42146edeaf4786b5
1,300
PASSED
import java.util.*; public class SolutionC { public static void main(String args[]){ Scanner s1=new Scanner(System.in); int n=s1.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++){ arr[i]=s1.nextInt(); } Arrays.sort(arr); long sum=0,count=0; for(int i=0;i<n;i++){ int ext=arr[i]; if(sum<=ex...
Java
08c4d8db40a49184ad26c7d8098a8992
d0abc05fdd30870119b7fc45ac7f1e25
1,300
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author legionary */ public class Main { public static void main(String[] a...
Java
b3978805756262e17df738e049830427
96e80a552cea83f7765e6ef19026b1be
1,000
PASSED
import java.util.Scanner; public class Problem1257B { public static int magicStick1(int x, int y) { return (x % 2 == 0) ? x = x * 3 / 2 : x > 1 ? x - 1 : 0; } public static void main(String[] args) { Scanner key = new Scanner(System.in); var num = key.nextInt(); var x = n...
Java
b3978805756262e17df738e049830427
8ec15315ddb0ca3d65f4222752d197c9
1,000
PASSED
import java.util.Scanner; public class Problem1257Bv2 { public static int magicStick1(int x, int y) { if (x % 2 == 0) { x = x*3/2; return x; } else if (x>1){ x--; return x; } return 0; } public static void main(String[] args) ...
Java
b3978805756262e17df738e049830427
227847cb3faad421a069e44c1f5423a4
1,000
PASSED
import java.util.Scanner; public class Problem1257Bv2 { public static int magicStick1(int x, int y) { if (x % 2 == 0) { x = x * 3 / 2; return x; } else { return x > 1 ? x - 1 : 0; } } public static void main(String[] args) { var entrada = new Scanner(System.in); int num =...
Java
b3978805756262e17df738e049830427
f249fdc101628c7004e8967f05ac304b
1,000
PASSED
import java.util.Scanner; public class Problem1257B { public static int magicStick1(int x, int y) { if (x % 2 == 0) { x = x*3/2; return x; } return 0; } public static int magicStick2(int x, int y){ if (x > 1) { x--; return x; ...
Java
b3978805756262e17df738e049830427
6c6ced483871564242d40fd1976d59f5
1,000
PASSED
import java.util.Scanner; public class codeforces_1257B { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t= sc. nextInt(); while(t-->0) { int x=sc.nextInt(); int y=sc.nextInt(); if(x==1 && y!=1) { ...
Java
b3978805756262e17df738e049830427
9dbc85fd9d4df81c0a2bf0ab086adf73
1,000
PASSED
import java.util.*; public class ED_R_76B { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int t = Integer.parseInt(sc.nextLine()); for(int i =0;i<t;i++) { String xy = sc.nextLine(); String[] numbers = xy.split(" "); ...
Java
b3978805756262e17df738e049830427
4564b8a6700aaaa47c1ca540a1ffa9b0
1,000
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.util.Set; import java.io.OutputStreamWriter; import java.util.InputMismatchException; ...
Java
b3978805756262e17df738e049830427
6a76b7bf84b74e1553916717b1661af9
1,000
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.util.Set; import java.io.OutputStreamWriter; import java.util.InputMismatchException; ...
Java
b3978805756262e17df738e049830427
fa9ffef337ec27002d48bb1d0f1f8be7
1,000
PASSED
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreEl...
Java
b3978805756262e17df738e049830427
ae9d3d75de731375e750e4dcbb702c13
1,000
PASSED
#include <bits/stdc++.h> //#define int long long using namespace std; int n, g[303][303], mi; long dp[603][303][303]; signed main() { cin >> n; for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { cin >> g[i][j]; } } for(int i = 0; i < 603; i++) { for(int j = 0; j < 303; j++) { for(int k...
C++
45ccda0657d2b02540b1fc33745820b8
2c1103e42f7839b06ce13ca17c39ae03
2,000
PASSED
#include <bits/stdc++.h> //#define int long long using namespace std; int n, g[303][303], mi; long dp[603][303][303]; signed main() { cin >> n; for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { cin >> g[i][j]; } } memset(dp, 0xcc, sizeof(dp)); dp[2][1][1] = g[1][1]; for(int i = 3; i <= n*2;...
C++
45ccda0657d2b02540b1fc33745820b8
7dcf7283d9532ff819b3633380aeac98
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 305; int v[N][N],dp[2][N][N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i<=n; i++) for (int j = 1; j<=n; j++) cin >> v[i][j]; int t = 0; dp[0][1][1] = v[...
C++
45ccda0657d2b02540b1fc33745820b8
2737063067a276b496f734b3b1f58e6a
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 305; int v[N][N],dp[2][N][N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i<=n; i++) for (int j = 1; j<=n; j++) cin >> v[i][j]; int t = 0; dp[0][1][1] = v[...
C++
45ccda0657d2b02540b1fc33745820b8
83a0808de17ce83c1a274f18028d42d0
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int mat[305][305], dp[305][305][305], n; bool valid(int x, int y){return x >= 1 and x <= n and y >= 1 and y <= n;} int main(){ cin >> n; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) cin >> mat[i][j]; fo...
C++
45ccda0657d2b02540b1fc33745820b8
2cbcba6871fe124f25ca8f40098b3d20
2,000
PASSED
# include <bits/stdc++.h> # define FILE using namespace std; const int mod = 1e9 + 7; int n, a[300][300], pred[2][2] = {{0,-1}, {-1,0}}; int dp[300][300][300]; void solve(){ cin >> n; for( int i = 0; i < n; i ++ ){ for( int j = 0; j < n; j ++ ){ cin >> a[i][j]; } } if( n =...
C++
45ccda0657d2b02540b1fc33745820b8
ddd843e813408c17c4e0a10264bfdff9
2,000
PASSED
// :) // "Khodaya, be man "Tagwaye setiz" biamooz ta // dar anbuh masuliat nalaghzam ..." -Shariati #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define F first #define S second #define MP make_pair using namespace std; using namespace __gnu_pbds; template <typ...
C++
45ccda0657d2b02540b1fc33745820b8
6666b15b532baba0b949c3f7e7975f6c
2,000
PASSED
#include <bits/stdc++.h> #define FIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define ii pair<int,int> #define F first #define S second #define pb push_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define fore(i,a,b...
C++
45ccda0657d2b02540b1fc33745820b8
3d065d0aaa404e038dd4743e0b0e35ad
2,000
PASSED
#include <iostream> #include <stdio.h> #include <math.h> #include <unordered_set> #include <string> #include <string.h> #include <map> #include <unordered_map> #include <random> #include <set> #include <cassert> #include <string.h> #include <limits.h> #include <stack> #include <functional> #include <queue> #include <io...
C++
45ccda0657d2b02540b1fc33745820b8
074085cc7b090302109dc399faa9be0b
2,000
PASSED
#include <iostream> #include <stdio.h> #include <math.h> #include <unordered_set> #include <string> #include <string.h> #include <map> #include <unordered_map> #include <random> #include <set> #include <cassert> #include <string.h> #include <limits.h> #include <stack> #include <functional> #include <queue> #include <io...
C++
45ccda0657d2b02540b1fc33745820b8
35ececdbaaef2a47365eb56ef6d98983
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define all(sdk) sdk.begin(),sdk.end() #define mll map<int, int> #define pb push_back #define rep(i,a,b) for(int i=a;i<b;++i) #define repd(i,a,b) for(int i=a;i>=b;--i) #define mp make_pair #define hell 1000000007 #define endl '\n' #define vvll vector<vec...
C++
753113fa5130a67423f2e205c97f8017
5760ed38c9575b25a69ab453a31a90c1
900
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define mk make_pair #define pb push_back #define REP(i, a, b) for (int i = int(a); i < int(b); ++i) #define rREP(i, a, b) for (int i = i...
C++
753113fa5130a67423f2e205c97f8017
556e6f7dca18bfd39077325b00ef8445
900
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define mk make_pair #define pb push_back #define REP(i, a, b) for (int i = int(a); i < int(b); ++i) #define rREP(i, a, b) for (int i = i...
C++
753113fa5130a67423f2e205c97f8017
6f4524031a32973b1b2596bf96e3db8b
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s[n][2]; for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { cin >> s[i][j]; } } vector < string > v; for(int i=0;i<n;i++) { if(s[i][1] == "rat") v.push_back(s[i][0]); } for(int i=0;i<n;i++) { if(s[i][1] == "woman" |...
C++
753113fa5130a67423f2e205c97f8017
b73d82d8fe5e4b88be31377b6da246fa
900
PASSED
#include <bits/stdc++.h> using namespace std; void selectionSort(pair<string,int> arr[], int n) { int i, j, min_idx; // One by one move boundary of unsorted subarray for (i = 0; i < n-1; i++) { // Find the minimum element in unsorted array min_idx = i; for (j = i+1; j < n; j++) ...
C++
753113fa5130a67423f2e205c97f8017
7927c363bc093ff892cdcfa8678cd72d
900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5 + 5; int n; vector <string> rat; vector <string> child; vector <string> man; vector <string> captain; string s, ss; int main(){ cin >> n; for(int i=0; i<n; i++){ cin >> s >> ss; if(ss == "captain")captain.push_back(s...
C++
753113fa5130a67423f2e205c97f8017
39903b1a69d62ffa04a534912ab01d96
900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5 + 5; map <string , vector<string> > mp; int main() { int n; cin >>n ; while(n--){ string s , ss; cin >> s >>ss ; if(ss == "child"){mp["woman"].push_back(s);continue;} mp[ss].push_back(s); } ...
C++
753113fa5130a67423f2e205c97f8017
573de56caaf9336b48916fcc07e7a161
900
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n ; cin >> n; string name[105]; string type[105]; string ne[105]; int c = 0 ; for (int i = 0 ; i < n ; i++){ cin >> name[i]; cin >> type[i]; } for (int i = 0 ; i < n ; i++){ if(type[...
C++
753113fa5130a67423f2e205c97f8017
99df2ff99cefd203680033fb0cb8a7bb
900
PASSED
#include<iostream> using namespace std; int main(){ int n ; cin >> n; string name[105]; string type[105]; string ne[105]; int c = 0 ; for (int i = 0 ; i < n ; i++){ cin >> name[i]; cin >> type[i]; } for (int i = 0 ; i < n ; i++){ if(type[i]== ...
C++
753113fa5130a67423f2e205c97f8017
11d2c658a17eb42f51b98dc5774e09f3
900
PASSED
#include<iostream> using namespace std; int main(){ int n ; cin >> n; string name[105]; string type[105]; string A[105]; int c = 0 ; for (int i = 0 ; i < n ; i++){ cin >> name[i]; cin >> type[i]; } for (int i = 0 ; i < n ; i++){ if(type[i]== "...
C++
753113fa5130a67423f2e205c97f8017
1cccb38e4f8545866a0dd84c5a1ce4c0
900
PASSED
#include <iostream> #include <cstring> #include <cstdio> #include <string> #include <algorithm> using namespace std; const int maxn = 1e5+7; typedef long long ll; string str; ll n,a[maxn]; ll l=-1e9,r=1e9; int main(){ cin>>n; for(int i=0;i<n;i++)cin>>a[i]; cin>>str; for(int i=4;i<n;i++) { if(str[i]!=str[i-1]) ...
C++
3d8c881d96c998dce7059384cd882273
27d63f9ee4486b9755c5c608a2f9598b
1,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int main() { int n; cin>>n; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; string s; cin>>s; int r=(1e9),l=-1*r; for(int i=4;i<n;i++) { if(s[i]=='0'&&s[i-1]==s[i-2]&&s[i-2]==s[i-3]&&s[i-3]==s[i-4]&&s[i-1]=='1') { int rr=1e9; for(int j...
C++
3d8c881d96c998dce7059384cd882273
dfdd87261d092f85203aeaad59fe31fe
1,600
PASSED
#include <iostream> using namespace std; int main() { int max_temp,min_temp,n,i,j,count,max,min; char ch; cin >> n; int a[n],b[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); } scanf("%c",&ch); for(i=0;i<n;i++) { scanf("%c",&ch); b[i]=ch-48; } max_temp=-1000000000; min_temp=-max_temp; for(i=4;i<n;...
C++
3d8c881d96c998dce7059384cd882273
5726c57915422911cb126a93df8f86c8
1,600
PASSED
#include <stdio.h> int main() { int l,r,n,i,j,co,max,min; char ch; scanf("%d",&n); int a[n],b[n]; for(i=0;i<n;i++) scanf("%d",&a[i]); scanf("%c",&ch); for(i=0;i<n;i++) { scanf("%c",&ch); b[i]=ch-48; } l=-1000000000; r=-l; for(i=4;i<n;i++) { max=min=a[i]; co=0; for(j=i-1;j>=i-4&&b[j...
C++
3d8c881d96c998dce7059384cd882273
9824cf9ed5169bfcb706eaffde8b40a1
1,600
PASSED
#include <stdio.h> int main() { int max_temp,min_temp,n,i,j,count,max,min; char ch; scanf("%d",&n); int a[n],b[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); } scanf("%c",&ch); for(i=0;i<n;i++) { scanf("%c",&ch); b[i]=ch-48; } max_temp=-1000000000; min_temp=-max_temp; for(i=4;i<n;i++) { max=...
C++
3d8c881d96c998dce7059384cd882273
5d77acff510f55ac8d4c121a8a19548a
1,600
PASSED
#include <stdio.h> int main() { int l,r,n,i,j,co,max,min; char ch; scanf("%d",&n); int a[n],b[n]; for(i=0;i<n;i++) scanf("%d",&a[i]); scanf("%c",&ch); for(i=0;i<n;i++) { scanf("%c",&ch); b[i]=ch-48; } l=-1000000000; r=-l; for(i=4;i<n;i++) { max=min=a[i]; co=0; for(j=i-1;j>=i-4&&b[j...
C++
3d8c881d96c998dce7059384cd882273
51a735f90e7f8ea3ffafb397c25164d2
1,600
PASSED
#include <iostream> using namespace std; void handle(int a[], int b[], int &n); int main() { int n, i; scanf("%d", &n); int a[n], b[n]; char ch; for(i = 0; i < n; i++) { scanf("%d",&a[i]); } scanf("%c",&ch); for(i = 0; i < n; i++) { scanf("%c",&ch); b[i] = ch - '0'; } handle(a, b, n); return...
C++
3d8c881d96c998dce7059384cd882273
5baa4f530aab5caf714029563875473b
1,600
PASSED
#include <iostream> #include <cstdio> /*********************************************************************************************************************** * PROTOTYPE ************************************************************************************************************************ /*! *Function {void} handl...
C++
3d8c881d96c998dce7059384cd882273
6a7a49707dbeb8abb236b7b7d43357b6
1,600
PASSED
#include <iostream> #include <cstdio> /*********************************************************************************************************************** * PROTOTYPE ************************************************************************************************************************ /*! *Function {void} handl...
C++
3d8c881d96c998dce7059384cd882273
7e462d9610f4fd4514f7871929f84165
1,600
PASSED
#include <iostream> using namespace std; void handle(int a[], int b[], int &n) { int i, j, max_temp, min_temp, max, min, count; max_temp = -1000000000; min_temp = -max_temp; for(i = 4;i < n; i++) { max = min = a[i]; count = 0; for(j=i-1;j>=i-4&&b[j]!=b[i];j--) { if(a[j]>max) max=a[j]...
C++
3d8c881d96c998dce7059384cd882273
986f97676f5d5b90dab30fe3175476fe
1,600
PASSED
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int maxn=100001; int a[maxn],b[maxn]; bool cmp(int a,int b) { return a>b; } int main() { int n,x,i,ans; while(~scanf("%d%d",&n,&x)) { for(i=1;i<=n;i++) scanf("%d",&a[i]);sort(a+1,a+1+n,cmp); for(i=1;i<=...
C++
77919677f562a6fd1af64bc8cbc79de5
60e2b74eafd99e813d376496a85370ca
1,900
PASSED
// 10 monthes remaining for red =D #pragma comment(linker, "/STACK:256000000") #include <stdio.h> #include <iostream> #include <cmath> #include <math.h> #include <string.h> #include <algorithm> using namespace std; int main() { int n, x, a[100009], b[100009], y, z; scanf("%d %d", &n, &x); y=1; z=...
C++
77919677f562a6fd1af64bc8cbc79de5
db5cb2edfb556427b39c1fa2396b02d3
1,900
PASSED
#include <iostream> #include <stdio.h> #include <algorithm> using namespace std; bool con (long x, long y) { if (x>y) return true; return false; } long a[100005], b[100005]; int main () { //freopen ("input.txt", "r", stdin); //freopen ("output.txt", "w", stdout); long n, x, i, j, ans=0; scan...
C++
77919677f562a6fd1af64bc8cbc79de5
61047a7f726c78af590850dc5dee0658
1,900
PASSED
//State: CF222D - Olympiad MS C++ Accepted 171 ms //用set做删减的二分 #include <iostream> #include <stdio.h> #include <algorithm> #include <functional> #include <cmath> #include <cstring> #include <string> #include <vector> #include <map> #include <set> #include <utility> #include <stack> #include <queue> #include <deque> #...
C++
77919677f562a6fd1af64bc8cbc79de5
df3f1612d5b598a49b2c50b6417c06a5
1,900
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; #define MAXN 100005 int N, X, a[MAXN], b[MAXN]; int main(void){ scanf ("%d %d", &N, &X); for (int i = 1; i <= N; i ++) scanf ("%d", &a[i]); for (int i = 1; i <= N; i ++) scanf ("%d", &b[i]); sort (a+1, a...
C++
77919677f562a6fd1af64bc8cbc79de5
11b3da122f266883b5f69b7260c66138
1,900
PASSED
#include <iostream> #include <fstream> #include <cmath> #include <algorithm> #include <vector> #include <set> #include <map> #include <stack> #include <queue> #include <cstdlib> #include <cstdio> #include <string> #include <utility> #include <iomanip> using namespace std; int n,x,ans; int a[100001],b[100001]; int m...
C++
77919677f562a6fd1af64bc8cbc79de5
c78562a5a7495f13e693253bbe4b85c4
1,900
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> //#include <functor> using namespace std; int b[100011] = {0}; int a[100011] = {0}; bool pr(int a,int b) { return a > b; } int main() { //freopen ("input.txt","r",stdin); int n,x; cin >> n >> x; for (int i = 0; i < n; i++) scanf ("%d",&...
C++
77919677f562a6fd1af64bc8cbc79de5
f53ef2852b8b6ea4c9e5f24d3cd31534
1,900
PASSED
#pragma comment(linker, "/STACK:65777216") #include <iostream> #include <vector> #include <math.h> #include <stdio.h> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <deque> #include <queue> #include <set> #include <map> using namespace std; #define pb push_back #define mp make_pair...
C++
77919677f562a6fd1af64bc8cbc79de5
2d21ee1a1c66f2c80dcefc3aa080ebe2
1,900
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <c...
C++
77919677f562a6fd1af64bc8cbc79de5
2f1faf21ff2299b5275a4e7190a82814
1,900
PASSED
#include <stdio.h> #include <algorithm> #include <set> #include <map> #include <vector> #include <string> #include <queue> #include <math.h> #define N 100100 using namespace std; int a[N], b[N]; int main() { int i, j, k, t, n; for(scanf("%d%d", &n, &k), i=0; i<n; scanf("%d", &a[i]), i++); for(i=0; i<n; scan...
C++
77919677f562a6fd1af64bc8cbc79de5
6f22cb041b47d2f23fc7962c2d53cffa
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define foru(i, k, n) for (int i = k; i < n; i++) #define ford(i, k, n) for (int i = k; i >= n; i--) #define pb push_back #define mp make_pair #include <string.h> #include <stdlib.h> #include <malloc.h> #include <math.h> #...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
f1b86dd994f253d9f92740d9dcd6e307
1,600
PASSED