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
using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var n = Int32.Parse(Console.ReadLine()); var res = -1; for(var i = 0; i < n; ++i) switch (Console.ReadLine()) { case "Te...
C#
e6689123fefea251555e0e096f58f6d1
df1ed9e313480e0bd30745a5acf563d0
800
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Olymp { class Program { static void Main(string[] args) { int n; long sum = 0; n = Convert.ToInt32(Console.ReadLine()); ...
C#
e6689123fefea251555e0e096f58f6d1
8d6da084c963c7668ca37e1e03c21d71
800
PASSED
using System; using System.Diagnostics; using System.IO; using System.Linq; namespace Codeforces { internal class Template { private void Solve() { var n = cin.NextInt(); long sum = 0; for (int i = 0; i < n; i++) { var str = cin.NextString(); if (str == "Tetrahedron") { sum += 4; ...
C#
e6689123fefea251555e0e096f58f6d1
91b966636ffdd867d8cb65119c88d08d
800
PASSED
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Training_App { class Program { s...
C#
e6689123fefea251555e0e096f58f6d1
d6d59b48c9edaf5c80b2a5d70f248d65
800
PASSED
using System; using System.Collections.Generic; class A785 { static Dictionary<string, int> Face = new Dictionary<string, int> { {"Tetrahedron", 4}, {"Cube", 6}, {"Octahedron", 8}, {"Dodecahedron", 12}, {"Icosahedron", 20} }; public static void Main() { ...
C#
e6689123fefea251555e0e096f58f6d1
1ac85020732ad56cf4be1fc7da866abc
800
PASSED
#pragma warning(disable:4996) #pragma comment(linker, "/STACK:336777216") #pragma GCC optimize("Ofast") #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; typedef long long ll; #define int long l...
C++
87045c4df69110642122f2c114476947
9d71336fd66034d57c24167045d7cf39
1,900
PASSED
#include<stdio.h> #include<stdlib.h> int cmpfunc (const void * a, const void * b) { return ( *(long long int*)a - *(long long int*)b ); } int main() { long long arr[200005]={0},i,j,num=1,n; scanf("%lld",&n); for(i=0;i<n;i++) scanf("%lld",&arr[i]); qsort(arr,n,sizeof(long long int),cmpfunc); f...
C
482b3ebbbadd583301f047181c988114
efb52cb5762f79c4ee5ee1e148075178
1,200
PASSED
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class Solution { public static void main(String[] args) throws IOException { IO io = new IO() ; int n = io.getInt(), cur = 1 ; List<Integer> l = io.getIntegerArray(n) ; l.sort(Comparator.comparingInt(...
Java
482b3ebbbadd583301f047181c988114
9e1913f96e71d4d6422c83fc6b31ca6f
1,200
PASSED
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.Inpu...
Java
482b3ebbbadd583301f047181c988114
48f19b3604cd920c1f13dfea037e4aa3
1,200
PASSED
import java.util.PriorityQueue; import java.util.Scanner; public class CF358B { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(), curr = 0; PriorityQueue<Integer> a = new PriorityQueue<Integer>(); for(int i = 0; i < n; i++)a.add(scan.nextInt()); for(int...
Java
482b3ebbbadd583301f047181c988114
afc568f90b2e6fd9ccc896da7972b605
1,200
PASSED
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Alyona_and_Mex1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); //long[] arr = new long[(int) n]; ArrayList <Long> arr = ne...
Java
482b3ebbbadd583301f047181c988114
2fc00f66358311d6992a7a82b6c386d4
1,200
PASSED
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class alyonaMex682B { public static void main (String[] args) throws Exception { ...
Java
482b3ebbbadd583301f047181c988114
061148a2837c659debd6b86e533e1692
1,200
PASSED
import java.util.*; public class B682 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = 100001; int[] ar = new int[m]; for (int i = 0; i < n; i++) { int cur = scan.nextInt(); ar[Math.min(cur, 100000)]++; } int max = 0; for...
Java
482b3ebbbadd583301f047181c988114
19a5420f568f59aae05ddaec8e82391a
1,200
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class R358B { public static void main (String[] args) throws java.lang.Exception { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); Long[] a = new Long[n...
Java
482b3ebbbadd583301f047181c988114
af29a79b9eeb19500c59780ad8eb1ca2
1,200
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class R358B { public static void main (String[] args) throws java.lang.Exception { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); ArrayList<Long> a = ...
Java
482b3ebbbadd583301f047181c988114
834c820b390f724d0a85fb2d5c000b7a
1,200
PASSED
/** * Created by bubbl on 6/27/2016. */ import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception{ FastScanner sc = new FastScanner(); int n = sc.n...
Java
482b3ebbbadd583301f047181c988114
f45926e3275978f00dc118a1a962c9b5
1,200
PASSED
#include <bits/stdc++.h> #define pb(a) push_back(a) #define ll long long int #define scd(a) scanf("%d",&a) #define mp(a,b) make_pair(a,b) #define scl(w) scanf("%I64d",&w) #define scdd(a,b) scanf("%d %d",&a,&b) #define srt(a) sort(a.begin(),a.end()) #define...
C++
0148aed9b07c4f65b2507fcb8b837360
2e9a24e74e92f1c4fa54c14ff3105750
1,500
PASSED
#include<cstdio> #include<iostream> #include<algorithm> using namespace std; struct segment{ int l,r,i; }sg[300005]; bool cmp(segment a,segment b) { if(a.l==b.l)return a.r>b.r; return a.l<b.l; } int main() { int n,i,j; cin>>n; for(i=1;i<=n;i++){ scanf("%d%d",&sg[i].l,&sg[i].r);sg[i].i=i;...
C++
0148aed9b07c4f65b2507fcb8b837360
2b22d1d0dcd2279133b21240a80b79f1
1,500
PASSED
#include<bits/stdc++.h> using namespace std; using INT = long long; const int NN = 303030; int L[NN], R[NN]; int id[NN]; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int n; cin >> n; for(int i=1; i<=n; i++) { scanf("%d %d", L+i, R+i); id[i] = i; }...
C++
0148aed9b07c4f65b2507fcb8b837360
dad270fe0c151b1aedbfb68d300f9594
1,500
PASSED
#include <bits/stdc++.h> #define x first #define y second #define NN 300100 using namespace std; using INT = long long; using pii = pair<int, int>; pii p[NN]; int id[NN]; bool cmp(int u, int v){ if(p[u].x == p[v].x) return p[u].y > p[v].y; return p[u].x < p[v].x; } int main(){ #ifndef ONLINE_JUDGE freopen("in.in"...
C++
0148aed9b07c4f65b2507fcb8b837360
fe34d70cab60e776f9c6b08873a078a4
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define NN 300010 int l[NN], r[NN]; int id[NN]; int n; int main () { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i=1; i<=n; i++) cin >> l[i] >> r[i]; for(int ...
C++
0148aed9b07c4f65b2507fcb8b837360
f30bdc5ad2f32d6b7ffba7c11ffa518e
1,500
PASSED
#include<bits/stdc++.h> #define NN 300100 #define inf 1000000020 using namespace std; using INT=long long; using pii=pair<int, int>; using pi3=pair<pii, int>; pi3 p[NN]; int mn[NN], l[NN], r[NN]; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int n; cin>>n;...
C++
0148aed9b07c4f65b2507fcb8b837360
5f3f0559e9ac862145c5c442236f4e28
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define NN 300010 int L[NN], R[NN]; int id[NN]; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for(int i=1; i<=n; i++) cin >> L[i] ...
C++
0148aed9b07c4f65b2507fcb8b837360
8e5fcd20b29924de72fb51efd4237b4f
1,500
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 3e5+10; int id[N], L[N], R[N]; int main() { int n; cin>>n; for(int i=1; i<=n; i++) scanf("%d %d", L+i, R+i), id[i] = i; sort(id+1, id+n+1, [&](int i, int j) {return L[i] != L[j] ? L[i] < L[j] : R[i] > R[j];}); for(int i=2; i<=n; i++) if(R[id[i]] <= R[id[i-1...
C++
0148aed9b07c4f65b2507fcb8b837360
fbf8dad119a9bf96e90f12e8cc9e5ed2
1,500
PASSED
#include <bits/stdc++.h> using namespace std; using pii=pair<int, int>; using pi3=pair<pii, int>; const int NN = 303030; pi3 p[NN]; set<pii> s; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int n; cin>>n; for(int i=1; i<=n; i++) { scanf("%d %d", &p[i...
C++
0148aed9b07c4f65b2507fcb8b837360
1b0a46a7a3d77c38563200eca05ae4ec
1,500
PASSED
#include<bits/stdc++.h> #define x first #define y second using namespace std; using pii=pair<int,int>; const int NN=300300; pii p[NN]; int id[NN]; bool cmp(int u,int v){ if(p[u].x==p[v].x) return p[u].y>p[v].y; return p[u].x<p[v].x; } int main(){ #ifndef ONLINE_JUDGE freopen("in.in","r",stdin); freopen("out.out","...
C++
0148aed9b07c4f65b2507fcb8b837360
e4c497a306007c6ec126277804bba3c8
1,500
PASSED
#include <bits/stdc++.h> #define pb push_back #define ll long long using namespace std; int r,maxx,ans,minn = INT_MAX,ma,b[1000003];; int main() { ios::sync_with_stdio(false); int n; cin >> n; for (int i = 1; i<=n; i++){ int x,y; cin >> x >> y; mi...
C++
608f8246bc6067e259898e8ed94db4c4
88fe6467447889c74ab9b483711c7c8a
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define ff first #define ss second const int INF=1000*1007; const int MOD=1e9 + 7; const int MAXN=100100; char ans[MAXN],s[MAXN]; int main() { ios_base::sync_with_stdio(false); ll n; cin>>n; ll t=0,q=0,m=0; for...
C++
608f8246bc6067e259898e8ed94db4c4
35cd6c25a7775922d7d4b23cedbc285f
1,100
PASSED
#include<bits/stdc++.h> #define IO ios::sync_with_stdio(false);\ cin.tie(0);\ cout.tie(0); using namespace std; const int maxn = 2e5+10; int n; int t[maxn],c[maxn]; int main() { IO; cin>>n; for(int i=0; i<n; i++) cin>>t[i]>>c[i]; int maxA = c[0], cnt = c[0]; for(int i=1; i<n; i++) ...
C++
608f8246bc6067e259898e8ed94db4c4
19a62dee78af9499a2ee5df7c6164b87
1,100
PASSED
#include<bits/stdc++.h> #define IO ios::sync_with_stdio(false);\ cin.tie(0);\ cout.tie(0); using namespace std; const int maxn = 2e5+10; int n; int t[maxn],c[maxn]; int main() { IO; cin>>n; for(int i=0; i<n; i++) cin>>t[i]>>c[i]; int time = t[0], maxA = c[0], cnt = c[0]; for(int i=...
C++
608f8246bc6067e259898e8ed94db4c4
1e6b2df9e5db0a2f8a65302fd98a4c87
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long uLL; typedef long double ldb; typedef pair<int,int> pii; int main() { ios_base::sync_with_stdio(0);cin.tie(0); int n; cin>>n; LL q = 0; LL a = 0, b = 0; LL t, c; cin>>t>>c; for(LL i = 1;; ++i...
C++
608f8246bc6067e259898e8ed94db4c4
cf96ae5020e8b2aa0652cba45795b2db
1,100
PASSED
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl '\n' #define ff first #define ss second #define mod 1000000007 #define pb push_back #define mp make_pair #define int long long #define all(a) a.begin(), a.end() #define ull unsigned long long #define N 2000010 #define in...
C++
608f8246bc6067e259898e8ed94db4c4
63501526bfc52ec391b0a38ce3a49352
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define MOD 1000000007 #define pi pair<int,int> #define gcd(a,b) __gcd((a),(b)) #define endl "\n" #define UB upper_bound #define LB lower_bound #define BS binary_search #define PI 3.1415926535897932384626433832795 const int maxn =...
C++
608f8246bc6067e259898e8ed94db4c4
e8065c50726cbc55d8c79bb7a5a5db0d
1,100
PASSED
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/STACK:32000000") #pragma GCC optimize("O3") #include <stdio.h> #include <string.h> #include <memory.h> #include <stdlib.h> #include <iostream> #include <time.h> #include <algorithm> #include <math.h> #include <vector> #include <set> #include <queue> #include <...
C++
608f8246bc6067e259898e8ed94db4c4
418e6a965cacaf61648276df225e3c34
1,100
PASSED
#include<iostream> using namespace std; int n,t,c; long long m,s,maxn; int main() { cin>>n; while(n--) { cin>>t>>c; s-=t-m; s=max(s,0ll); s+=c; maxn=max(maxn,s); m=t; } cout<<m+s<<" "<<maxn<<endl; return 0; }
C++
608f8246bc6067e259898e8ed94db4c4
523b1f7b56df849fc3d46caa1c025267
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int n, t, c, prv, len, ans1, ans2; int main() { cin >> n; while (n--) { scanf("%d %d", &t, &c); len = max(0, len - t + prv) + c; prv = t; ans1 = max(ans1, t) + c; ans2 = max(ans2, len); } cout << ans1 << ' ' << ans2; return 0; }
C++
608f8246bc6067e259898e8ed94db4c4
8f0b89f86a4971b448cef10b8b463462
1,100
PASSED
import java.util.* fun main() { // readFromFile() readLine() val b = readLine()!!.split(" ").map { it.toInt() } val n = b.count { it == -1 } val indices = LinkedList<Int>().apply { addAll(0 until n) } val result = Array<MutableList<Int>>(n) { mutableListOf() } var iterator = indices.iterator...
Kotlin
f3eba51f70e2ca5b43a124f623900485
43a5aa4d3e0f4e76c9e5daa92b66f60d
null
PASSED
import java.io.* import kotlin.math.min import java.util.* import kotlin.collections.ArrayList import kotlin.collections.HashSet import kotlin.math.max object programkt { const val fileName = "" //================================================================================ private fun run() { ...
Kotlin
f3eba51f70e2ca5b43a124f623900485
8a533896a944db74a45faa1b2f20179b
null
PASSED
import java.io.* import java.lang.Math.* import java.math.BigInteger import java.util.* import kotlin.collections.ArrayList import kotlin.collections.HashMap import kotlin.collections.LinkedHashMap import kotlin.math.sqrt typealias IntInt = Array<IntArray> typealias LongLong = Array<LongArray> fun solve() { var n...
Kotlin
f3eba51f70e2ca5b43a124f623900485
40ca11eb77adab0189a4ba201dad64d0
null
PASSED
fun main() { val n = readInt() val A=readInts().toTypedArray() var ct=0; for (v in A) if (v==-1) ct++ var B=Array(ct){mutableListOf<Int>()} var p=0 //var q=0 var L=mutableListOf<Int>() println(ct) for (i in 0 until ct) { if (A[i]>-1) { B[i].a...
Kotlin
f3eba51f70e2ca5b43a124f623900485
91f6dde3e890669a32d0629b6e9e2d55
null
PASSED
fun main() { val nNumbers = readLine()!!.toInt() val numbers = readLine()!!.split(' ').map(String::toInt).toIntArray() var minusIndexes = ArrayList<Int>() var minusesCounts = ArrayList<Int>(numbers.size) val nSeq = numbers .asIterable() .filterIndexed(fun(index: Int, n: Int): Boolea...
Kotlin
f3eba51f70e2ca5b43a124f623900485
8e0ae3cce80406a2dd8a2c903127e007
null
PASSED
import java.lang.StringBuilder import java.util.* import kotlin.collections.ArrayList class Link(var idx: Int) { var next: Link = this var prev: Link = this } fun solve(arr: IntArray): Array<ArrayList<Int>> { val time = System.currentTimeMillis() val len = arr.size val num = arr.count { it < 0 } ...
Kotlin
f3eba51f70e2ca5b43a124f623900485
45e7b3c13f19beb2a7b069abebe6f76a
null
PASSED
fun main() { readLine() val b = readLine()!!.split(" ").map { it.toInt() } val n = b.count { it == -1 } println(n) val a = List(n) { mutableListOf<Int>() } val indices = List(n) { it }.toMutableSet() var iter = indices.iterator() for (x in b) { if (!iter.hasNext()) { ...
Kotlin
f3eba51f70e2ca5b43a124f623900485
3f962777466614c5a2de26ea04eb41dd
null
PASSED
import java.util.* fun main() { val m = readLine()!!.toInt() val b = readLine()!!.split(" ").map{ it.toInt() } val a : MutableList<MutableList<Int>> = ArrayList() for (x in b) { if (x == -1) { a.add(ArrayList<Int>()) } } val n = a.size val next = ArrayList<I...
Kotlin
f3eba51f70e2ca5b43a124f623900485
03630255accda9205bf5af9e44ca2c90
null
PASSED
import java.util.* fun main() { val m = readLine()!!.toInt() val b = readLine()!!.split(" ").map{ it.toInt() } val a : MutableList<MutableList<Int>> = ArrayList() for (x in b) { if (x == -1) { a.add(ArrayList<Int>()) } } val n = a.size val next = ArrayList<I...
Kotlin
f3eba51f70e2ca5b43a124f623900485
fbf433a1021f3fe4657c9d232a616fa0
null
PASSED
import java.io.BufferedReader import java.io.FileReader import java.io.InputStreamReader import java.io.PrintWriter import java.util.* import kotlin.collections.ArrayList import kotlin.collections.HashMap import kotlin.math.abs import java.util.Queue as Queue val INF = 2e9.toInt() fun solve() { val n = readInt() ...
Kotlin
f3eba51f70e2ca5b43a124f623900485
447c5560dd87fd30afee3c7d417aa9be
null
PASSED
import sys n,k = map(int,sys.stdin.readline().strip().split()) #n is the number of decimals #k is the number of changes allowed s = list(input()) s = [int(x) for x in s] left = 0 if len(s) == 1 and k!= 0: s[0] = 0 else: if s[0] != 1 and k!= 0: s[0] = 1 k -= 1 left += 1 while k !...
Python
0515ac888937a4dda30cad5e2383164f
447a8f3537abb66822c7befb2b1f13d4
1,000
PASSED
if __name__ == '__main__': n, k = list(map(int, input().split())) s = list(input()) if k != 0: if s[0] != '1' and len(s) > 1: s[0] = '1' k -= 1 if len(s) == 1 : s[0] = '0' for i in range(1, n): if k == 0: break ...
Python
0515ac888937a4dda30cad5e2383164f
3e5c407439c0e49a53dd786d2bc803d9
1,000
PASSED
n, k = map(int, input().split()) c = input() if n == 1 and k > 0: print(0) else: res = "" #t = min(n,k+c.count('0')) e = k j = 0 while e > 0 and j < n: if j == 0 and c[j] != '1': e-=1 elif j > 0 and c[j] != '0': e-=1 j+=1 for i in range(j): ...
Python
0515ac888937a4dda30cad5e2383164f
7ab43e32fd9ef41e55abdfcc0ecdab5c
1,000
PASSED
n,k=map(int,input().split()) s=list(input()) from sys import exit if s[0]=='0':print(0);exit() else: if n==1: if k>0:print(0) else:print(s[0]) exit() else: if k>0: if s[0]!='1': s[0]='1';k-=1 for i in range(1,n): if k==0:break if s[i]!='0':s[i]...
Python
0515ac888937a4dda30cad5e2383164f
b144012bc0e1e1adf1c45823a01c629c
1,000
PASSED
n,k= map(int,input().split()) a= input() if k==0: print(a) elif n==1: if k==0: print(a) else: print("0") else: s= list(a) i=0 if (s[0]!='1'): s[0]='1' k-=1 i=1 while(i<n): if (s[i]!='0' and k>0): s[i]='0' k-=1 if (k=...
Python
0515ac888937a4dda30cad5e2383164f
4d264a3f1f999c7941f04cda803423f3
1,000
PASSED
m, k = input().split() k = int(k) n = input() if k == 0: print(n) elif m == '1': print(0) else: if n[0] != '1': k -= 1 awn = '1' for i in n[1:]: if i != '0' and k != 0: k -= 1 awn += '0' else: awn += i print(awn)
Python
0515ac888937a4dda30cad5e2383164f
f0e829485937f6fb1a4063100d152df6
1,000
PASSED
n,k =list(map(int,input().split())) a = list(input()) if k==0: print("".join(a)) else: if n==1: print(0) else: if a[0]=="1": i=1 while i<n and k>0: if a[i]!="0": a[i]="0" k=k-1 i+=1 p...
Python
0515ac888937a4dda30cad5e2383164f
914a8655f0a89bedef34438af06584ae
1,000
PASSED
a,b=map(int,input().split()) s=input() d="" p=0 cnt=0 if a==1 and b>=1: print(0) exit() if a==1 and b==0: print(s) exit() for i in range(len(s)): if cnt>=b: p=1 if p==1: d+=s[i] elif i==0: if s[i]!="1": cnt+=1 d+="1" else: if s[i]!="0": cnt+=1 d+="0" print(d)
Python
0515ac888937a4dda30cad5e2383164f
be1f12635c2ef527d7193bb25231be8a
1,000
PASSED
n, k = map(int, input().split()) s = input() if(k==0): print(s) elif(n==1): print("0") else: if(s[0]=='1'): k+=1 print("1",end="") for i in range(1,len(s)): if(k-1>0 and s[i]!='0'): print("0",end="") k-=1 else: print(s[i],end="")
Python
0515ac888937a4dda30cad5e2383164f
73a89bafb962bc35750f2d7291cfd5a6
1,000
PASSED
n,k=map(int,input().split()) s=input() k1=k a=[int(s[i]) for i in range(n)] if n==1:a[0]=0 if a[0]!=1 and n!=1: a[0]=1 k-=1 for x in range(1,n): if k == 0: break if a[x]!=0: a[x]=0 k-=1 if(k1==0):print(s) else: for m in range(0,n): print(a[m],end="")
Python
0515ac888937a4dda30cad5e2383164f
f0c420301450a488c595b4765ec0dff6
1,000
PASSED
/* * Remember a 6.0 student can know more than a 10.0 student. * Grades don't determine intelligence, they test obedience. * I Never Give Up. * I will become Candidate Master. * I will defeat Saurabh Anand. * Skills are Cheap,Passion is Priceless. */ import java.util.*; import java.util.Map.Entry; import java.i...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
3b3c9285aa8a6a6edaead3cc7cc07cbe
1,600
PASSED
import java.io.*; import java.util.*; public class AlyonaTree { static Graph g[]; static String ver[]; static int par[],count; static long d[]; static boolean vis[]; public static void main(String args[]) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n=Intege...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
0cdcd60f14c05b4253708c83489ed2e8
1,600
PASSED
import java.awt.*; import java.io.*; import java.util.*; public class Abc { static int n; static int arr[]; static int cnt[]; static ArrayList<Integer> adj[]; static Map<Point,Integer> map; static int ans=0; public static void main(String[] args) throws Exception { FastReader sc = n...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
b68042d0aec8dc150c8084a904150763
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class _Alyona_and_the_Trees { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parse...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
0f7cdde3c0f1d3aece06afb82907b44c
1,600
PASSED
import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.math.BigInteger; import java.util.regex.*; public class Myclass { public static ArrayList a[]=new ArrayList[200001]; static boolean visited[]=new boolean [200001]; static long value[]; static long maxi[]; static long dp[...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
0410d3c3997c0887a941553b3d144961
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class C358 implements Runnable{ static long oo = 987654321; static long[] val; static int[] mark; ...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
18a904ed80621688b64ee558002c16ff
1,600
PASSED
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class C35...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
fb34945c4ad4db68b72d23e825309db1
1,600
PASSED
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; import java.util.StringTokenizer; public class Main ...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
92d405d90280ad630129c0729e856243
1,600
PASSED
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; import java.io.*; public class Main { void solve() { int n = sc.nextInt(); V[] vs = new V[n]; for (int i = 0; i < n; i++) { vs[i] = new V(); vs[i].id = i + 1; } for (int i = 0; i < n; i++) { vs[i].a = sc.next...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
95e61ee81289f9e7cfeac3a2ce4b1156
1,600
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.io.Writer; impo...
Java
0c4bc51e5be9cc642f62d2b3df2bddc4
1a4b1fd2c5054f8b17b7134d7de3dd8d
1,600
PASSED
#include <bits/stdc++.h> #define X first #define Y second #define FOR(i, a, b) for (i=(a); i <= (b); i++) #define FORD(i, a, b) for (i=(a); i >= (b); i--) #define itr(t) vector<t>::iterator #define ritr(t) vector<t>::reverse_iterator #define IT(i, v) for (i=(v)->begin(); i != (v)->end(); i++) #define RIT(i, v) for (i=...
C++
333790c28eb02ad568a2406d5b2fafa6
afddc4fb8425c2796be0108529226358
1,700
PASSED
#include<iostream> #include<stdio.h> #include<algorithm> #include<set> using namespace std; long long a,s,d,f,g,h,j,k,l,i,n,m; set<long long> x,z,c,v; main(){ cin>>n>>m>>k>>l; for(i=0;i<n;i++){ scanf("%d",&a); x.insert(a+k); c.insert(a+l); s=x.size(); x.insert(a); if(x.size()==s) {d=1;} s=c.size(); c.insert(a); if(c.s...
C++
333790c28eb02ad568a2406d5b2fafa6
d4be2332cb4faaa81a038d95366b1b71
1,700
PASSED
#include <iostream> #include <string> #include <vector> #include <cstdio> #include <set> #include <queue> #include <algorithm> #include <cstring> #include <map> #include <cmath> #include <cstdio> #include <sstream> #include <stack> #define open_in(n) freopen("n","r",stdin) #define open_out(n) freopen("n","w",stdout) #...
C++
333790c28eb02ad568a2406d5b2fafa6
5e83cb836b21634f94f0c689cc63a52e
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int a[100005],n,l,x,y,p,q; int bse(int a[],int l,int r,int k) { if (l==r && a[l]!=k) return 0; int t=a[(l+r)/2]; if (t==k) return (l+r)/2; else if (t<k) return bse(a,(l+r)/2+1,r,k); else return bse(a,l,(l+r)/2,k); } in...
C++
333790c28eb02ad568a2406d5b2fafa6
5b84bca5ed390ac893de7edf97149c63
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vii; #define pb push_back #define mp make_pair #define X first #define Y second #define MEM(a,b) memset(a,(b),sizeof(a)) #define pr(a) cout<<#a<<" = "<<(a)<<endl #define loop(x,a,...
C++
333790c28eb02ad568a2406d5b2fafa6
6460baa45da09d4774f9a872cb6e9212
1,700
PASSED
#include <bits/stdc++.h> using namespace std; namespace my_useful_tools { #define rep(_i, _k, _j) for(int _i = _k; _i <= _j; ++_i) #define foreach(_i, _s) for(typeof(_s.begin()) _i = _s.begin(); _i != _s.end(); ++_i) #define pb push_back #define mp make_pair #define ipir pair<int, int> #define ivec vector<int> #define ...
C++
333790c28eb02ad568a2406d5b2fafa6
8b0ab08ab921a4430a12c4a21ee32b5d
1,700
PASSED
#include<cstdio> #include<cmath> #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int maxn=100000+10; int n,l,x,y,xy; int num[maxn],sum[maxn]; void reading() { scanf("%d%d%d%d",&n,&l,&x,&y); for (int i=1;i<=n;i++) scanf("%d",&num[i]); } bool find(int x) { int l=1,r=n,mid; while ...
C++
333790c28eb02ad568a2406d5b2fafa6
565b883c3c3ee777f92effebd67c4fe1
1,700
PASSED
#include<iostream> #include<cstdlib> #include<cstdio> #include<cstring> using namespace std; int da[100010]; int x,y,n,l; bool erfen(int a,int b,int c) { if (a==b&&da[a]!=c)return false; if (da[a]==c) return true; if (da[b]==c)return true; int mid=(a+b)/2; if (c>da[mid])return erfen(mid+1,b,c); else return erfen(...
C++
333790c28eb02ad568a2406d5b2fafa6
2f7676acee8cf7d9691fa5ffe5572161
1,700
PASSED
#include<iostream> #include<cstring> #include<cstdio> #include<cstdlib> #include<algorithm> using namespace std; int n,l,x,y,a,b,c,d; int aa[100100]; int find(int q) { int j=1; //printf("##%d\n",q); for (int i=2;i<=n;i++) { while (aa[i]-aa[j]>q) j++; if (aa[i]-aa[j]==q) return j; } return 0; } int find1(int ...
C++
333790c28eb02ad568a2406d5b2fafa6
8b1f289a8a53c67923d61b3f253e01b8
1,700
PASSED
#include <iostream> using namespace std; #include <cstdlib> #include <cstring> #include <cstdio> #include <algorithm> #include <set> const int maxn = 100010; set<int> S; int n,l,x,y,value[maxn]; int solve0() { S.clear(); for(int i=1;i<=n;i++) S.insert(value[i]); bool isokX=false,isokY=false; f...
C++
333790c28eb02ad568a2406d5b2fafa6
385d74a841dddbba7395cf7c6ddb2dd0
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pii; #define fi first #define se second #define mp make_pair #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count()); const int N = (int)2e5 + 9; ...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
95d8fe9bd276514f4f5b7fe135e0cc0f
2,200
PASSED
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *********...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
0ed36ac5ff771375c99452c441cfb8be
2,200
PASSED
#include<bits/stdc++.h> //#include "rubo.h" #define MP make_pair #define PB push_back #define in int #define ll long long #define vc vector #define SQ(j) (j)*(j) //#define x first //#define y second //#define ld long double #define dbl double #define pll pair<long long,long long> #define pii pair<int,int> #define al...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
33ba71b97d74342b699d566241e5e464
2,200
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll MAX_N = 1e5 + 20 , md = 998244353; ll dp[MAX_N][2] , f[2 * MAX_N] , g[2 * MAX_N] , a[MAX_N] , b[MAX_N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n , k; cin>>n>>k; for(int i = 0 ; i < n ; i++){ if(i ...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
7a63b7f8f54734508f9bca2c0053dd39
2,200
PASSED
#include <bits/stdc++.h> using namespace std; int const N = 3e5 + 5; int const MOD = 998244353; int n, k; int a[N]; vector < int > b[2]; long long dp[N]; long long pow_mod(int x, int y) { if (y == 0) { return 1; } long long u = pow_mod(x, y/ 2); u = u * u % MOD; if (y % 2 == 1) { u = u * x % MOD; } ret...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
ae5b0f1a527c421754dbcab7d6343212
2,200
PASSED
#include <bits/stdc++.h> using namespace std; long long mod= 998244353; long long same[100001]; long long diff[100001]; long long cntDiff(long long k, long long l); long long numOfWays1(long long a, long long b, long long k, long long l){ long long dp[l+1][2]; dp[0][1] = 1; if(a==-1){ dp[0][1] = 0; } dp[0][0] ...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
9fa007791c9c19493ab35d0b68a8e6e5
2,200
PASSED
#include <bits/stdc++.h> using namespace std; long long mod= 998244353; long long numOfWays(long long a, long long b, long long k, long long l){ long long dp[l+1][2]; dp[0][1] = 1; if(a==-1){ dp[0][1] = 0; } dp[0][0] = 0; long long sum=1; for(int i=1;i<=l;i++){ dp[i][0] = (mod + sum - dp[i-1][0])%mod; dp[...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
43bd66cce8a6bcb4677a8ac2c768cde7
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int mod = 998244353; int a[200005]; LL dp[200005][2]; int main(){ int n, k; scanf("%d%d", &n, &k); for(int i=1;i<=n;i++) scanf("%d", &a[i]); int last = -1; int x = 0; for(int i=1;i<=n;i+=2){ x = i; if(i...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
b05b26caed681fcd2c5ff4db735348da
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int mod = 998244353; int a[200005]; LL dp[200005][2]; int main(){ int n, k; scanf("%d%d", &n, &k); for(int i=1;i<=n;i++) scanf("%d", &a[i]); int last = 1; for(int i=1;i<=n;i+=2){ if(i == 1){ if(a[i] == -1){...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
5bd263518f8c5077b5008e9fa81e3ab1
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int mod = 998244353; LL dp[200005][2]; int n, k, a; LL solve(vector<int> &a){ memset(dp, 0, sizeof(dp)); int last = 0; for(int i=1;i<a.size();i++){ int val = a[i]; if(i == 1){ if(val == -1){ ...
C++
a393e63c1d9fcdb7b0e8d525a1f1b8dd
343464b4b8de1c212095095e9ca8b69d
2,200
PASSED
# python3 q7.py < test.txt t = int(input()) for i in range(t): n, m, a, b = map(int, input().split()) if n * a != m * b: print('NO') continue print('YES') shift = 0 for j in range(1, m): if (j * n) % m == 0: shift = j break col = [j for ...
Python
8aa648ff5adc0cf7b20fea52d2c34759
94a7d72264d735562157d6bb6d342f3e
1,900
PASSED
#Bhargey Mehta (Junior) #DA-IICT, Gandhinagar import sys, math mod = 10**9 def solve(test_index): n, m, a, b = map(int, input().split()) if a * n != b * m: print('NO') return else: print('YES') ans = [[0 for i in range(m)] for i in range(n)] for i in range(n): f...
Python
8aa648ff5adc0cf7b20fea52d2c34759
2695f4c79e0519ff10420c43855c7148
1,900
PASSED
import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None ...
Python
8aa648ff5adc0cf7b20fea52d2c34759
e87454a5f3cb097139fbe303d30375bf
1,900
PASSED
from sys import stdin, stdout t = int(stdin.readline()) for _ in range(t): n, m, a, b = map(int, stdin.readline().split()) if n*a != m*b: print("NO") continue shift = 0 for i in range(1, m): if (i*n)%m == 0: shift = i break board = [[0]*m for _ ...
Python
8aa648ff5adc0cf7b20fea52d2c34759
6669d35752b5f57a55275f9eecf1257b
1,900
PASSED
t = int(input()) for kek in range(t): (n, m, a, b) = map(int, input().split()) mat = [[0 for i in range(m)] for i in range(n)] if n*a != m*b: print('NO') continue x = a i = 0 j = 0 while i < n: j = j % m if x > 0: x -= 1 mat[i][j] = ...
Python
8aa648ff5adc0cf7b20fea52d2c34759
562433a69e9c99da3b7ac8fe41f699c9
1,900
PASSED
for o in range(int(input())): n,m,a,b=map(int,input().split()) if n*a!=m*b: print('NO') else: g=[] x=['1']*a+['0']*(m-a) x*=2 for i in range(n): g+=[x[i*a%m:i*a%m+m]] print('YES') for i in g: print(''.join(i))
Python
8aa648ff5adc0cf7b20fea52d2c34759
f067956023d076681d26e030c1ada83c
1,900
PASSED
import os import sys from io import BytesIO, IOBase def solution(n, m, a, b): if n * a != b * m: write("NO") return write("YES") res = [[0] * m for _ in range(n)] try: d = next(d for d in range(1, m) if (d * n) % m == 0) except BaseException: d = 0 dx = 0 ...
Python
8aa648ff5adc0cf7b20fea52d2c34759
501991e678a374b3f9d479af3ff8f177
1,900
PASSED
from math import gcd def check(n, m, a, b): if m/n == a/b: return gcd(m, n) return 0 def draw_matrix(n, m, a, b): gcd = check(n, m, a, b) # print("gcd here `````````````````````", gcd) if not gcd: return False x_kecil, y_kecil = m//gcd, n//gcd factor = a//x_kecil # prin...
Python
8aa648ff5adc0cf7b20fea52d2c34759
394e28120f1a9e4936f679ee4300102c
1,900
PASSED
t=int(input()) for i in range(t): num1=list(map(int,input().split())) n=num1[0] m=num1[1] a=num1[2] b=num1[3] if a*n==b*m: print("YES") j=0 matrix=[[0 for k in range(m)] for l in range(n)] for k in range(n): for l in range(a): matrix[k]...
Python
8aa648ff5adc0cf7b20fea52d2c34759
7ccc597cbded8913d23da819d70f57f0
1,900
PASSED
import sys input = sys.stdin.readline for _ in range(int(input())): n, m, a, b = map(int,input().split()) if a*n!=b*m: print('NO') continue print('YES') for s in range(m): found = True grid = [[0]*m for i in range(n)] for i in range(n): for j in range(...
Python
8aa648ff5adc0cf7b20fea52d2c34759
445aaf97e3cc01758180d902cc49ab3b
1,900
PASSED
#include <bits/stdc++.h> using namespace std; struct node { int pos1; int pos2; string a; string b; }; stack<int> tryy; vector<node> catchh; string throww = ""; int idx; bool cmp(node x, node y) { return x.pos1 < y.pos1; } int main() { int n; cin >> n; getchar(); for(int i = 1; i <= n; ++ i) { string s...
C++
320e6c06194f8b1ccf1f4218d0757d2f
1d9ac5810e5ed66e7d5ea5560d71f990
1,800
PASSED
//lxrtxdy! #include<iostream> #include<cstdio> #include<cstring> #define maxn 100010 using namespace std; int n,cnt; char s[maxn],st[maxn],tmp[maxn],ch; int main(){ // freopen("Cola.txt","r",stdin); scanf("%d",&n); ch=getchar(); while(ch!='\n')ch=getchar(); bool flag=0; while(n--){ int len=0; bool key=0; ch=...
C++
320e6c06194f8b1ccf1f4218d0757d2f
a5446ff386b06e6efbb19ce5c0b76c14
1,800
PASSED
#include<bits/stdc++.h> #define oo 2000000000 #define ll long long using namespace std; struct node { stack<int> ms; }; stack<int> StackOfTry; map<string,node> MapOfType; string str; int n,m,p,k,len,i; char s[80]; bool f; int main() { scanf("%d\n",&m); f=true; MapOfType.clear(); for (p=1;p<=m;p++) ...
C++
320e6c06194f8b1ccf1f4218d0757d2f
2388c164c2475d97b8e2c93ad657198d
1,800
PASSED
// Problemok.cpp: определяет точку входа для консольного приложения. // //# include "stdafx.h" # include <iostream> # include <string> # include <complex> # include <math.h> # include <set> # include <vector> # include <map> # include <queue> # include <stdio.h> # include <stack> # include <algorithm> # include <list...
C++
320e6c06194f8b1ccf1f4218d0757d2f
c409bfa95dbb485fe007cb4424d85017
1,800
PASSED