source_code stringlengths 26 62k | lang_cluster stringclasses 11
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | difficulty int32 -1 3.5k ⌀ | exec_outcome stringclasses 1
value |
|---|---|---|---|---|---|
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int degree[n],xorsum[n];
queue<int>q;
vector< pair<int,int> >v;
for(int i=0;i<n;i++)
{
cin>>degree[i]>>xorsum[i];
if(degree[i]==1)
q.push(i);
}
while(!q.empty())
{
int ... | C++ | 14ad30e33bf8cad492e665b0a486008e | 951233b0f6424ed25701e9f36c01b1a5 | 1,500 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(x) cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
const ld Pi = 3.14159265359;
const ll Mod = 1000 * 10... | C++ | 14ad30e33bf8cad492e665b0a486008e | 9722dc0118ae093a9a921a9a81eda383 | 1,500 | PASSED |
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
using namespace std;
int n, degree[100500], s[100500];
stack<int> q;
vector<int> a[100500];
vector<pair<int, int> > cm;
int main(){
cin >> n;
for(int i=0;i<n;i++){
cin >> degree[i] >> s[... | C++ | 14ad30e33bf8cad492e665b0a486008e | 108a17fda4b18ec38c7b3e33563bb8ff | 1,500 | PASSED |
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
using namespace std;
int n, degree[100500], s[100500];
stack<int> q;
vector<int> a[100500];
vector<pair<int, int> > cm;
int main(){
cin >> n;
for(int i=0;i<n;i++){
cin >> degree[i] >> s[... | C++ | 14ad30e33bf8cad492e665b0a486008e | 653992739b21c185fd8cf7d5e2e1bb93 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vector <pair <int, int> > id;
queue <int> q;
for (int i = 0; i < n; ++ i) {
int d, s; cin >> d >> s;
id.emplace_back(d, s);
if (d == 1) q.push(i... | C++ | 14ad30e33bf8cad492e665b0a486008e | cbb69bab965b15f2fa0b8a6f43f080e2 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10... | C++ | 14ad30e33bf8cad492e665b0a486008e | b6c6c3563fe6430a426ea36725683e73 | 1,500 | PASSED |
#include <bits/stdc++.h>
#define INF (ll)1e9
#define EPS 1e-6
#define pb push_back
#define pause system("pause");
#define exit exit(0)
using namespace std;
using ll = long long;
using ull = unsigned long long;
int n;
int l[100005], r[100005];
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
c... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 33c11d0212e89ff8790d0d4a7fb9882d | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,a[1000001],b[1000001];
long long ans;
int main()
{
cin>>n;
ans=n;
for(int i=1;i<=n;++i)scanf("%d%d",&a[i],&b[i]);
sort(a+1,a+n+1);
sort(b+1,b+n+1);
for(int i=1;i<=n;++i)ans+=max(a[i],b[i]);
cout<<ans<<endl;
return 0;
} | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 54874dffea4ed7fbc542b59291db9597 | 1,900 | PASSED |
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <iostream>
#include <fstream>
#ifndef _TB
#define _TB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, b, a) for(int i = b - 1; i >= a; --i)... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | e18d98e6c850561026b03e54f461cb3d | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++)
cin >> a[i] >> b[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
long long cnt = n;
for (int i = 0; i < n; i++)
cnt += max(a[i], b[i]);
cout << cnt;
}
int main() {
... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 2d800fc633fc41ac9632b8cd855c599f | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define per(i,a,b) for(int i=b-1;i>=a;--i)
const int N=1e5+10;
int L[N],R[N];
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d",&L[i],&R[i]);... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 8bb46c069bdaedd74f514d9eec732cd8 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+100;
typedef long long ll;
typedef pair<int,int> pi;
const ll mod=998244353;
const double eps=1e-8;
const double PI=acos(-1.0);
struct node
{
int id;ll value;bool l;
bool operator < (const node & poin)const
{
return value>poin.value;
... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 7468f33877cd2a2f1a96c8f5151ddd94 | 1,900 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int n;
vector <pair <int,int> > A;
vector <pair <int,int> > B;
bool srt(pair <int,int> x , pair <int,int> y){
return x.first < y.first;
}
int a1[100001];
int b1[100001];
int p [100001];
long long sum = 0;
int main(){
cin >> n;
int a , b;
for... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 4079e292f2fff663bfa283273f80d3e9 | 1,900 | PASSED |
#include<bits/stdc++.h>
#include<iostream>
//#define IORD
#define eps 1e-8
#define inf 0x3f3f3f3f
#define mod (1000000007)
using namespace std;
typedef long long LL;
typedef pair<int,int> pp;
const int maxn=1e5+10;
LL n,al[maxn],ar[maxn];
LL Sol()
{
LL ans=0;
sort(al,al+n);
sort(ar,ar+n);
for(int i=0... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 238074901c275bb9e2501d120696c6f6 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,a,b;
cin >> n;
vector<long long> x,y;
for(int i = 0 ; i < n ; i += 1){
cin >> a >> b;
x.push_back(a);
y.push_back(b);
}
sort(x.begin(),x.end());
sort(y.begin(),y.end());
long long ans=0;
f... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | 002dfc83fc71dba0966119a6fad9080f | 1,900 | PASSED |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typede... | C++ | 2090c7382ef9bc8dfd9ca1fc1743d3a7 | b674e057ac1c0357f9d2bf6e52f86a52 | 1,900 | PASSED |
import java.util.*;
import java.io.*;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long x=sc.nextLong();
long a[]=new long[2*n+1];
for(int i=1;i<=n;i++){a[i]=sc.nextLong();a[n+i]=a[i];}
long b[]=new long[2*n+1];
long c[]=new long[2*n+1]... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | 280f237abbac77b1f6b432c659c27507 | 1,900 | PASSED |
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef{
static long a[];
static long mv[];
static long cd[];
static long tdv[];
static int n;
static long k;
public static void main (String[] ar... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | af12845f0f8427470260237eeafba309 | 1,900 | PASSED |
import java.io.*;
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int bs(long d, long[] arr) {
int start = 0, end = arr.length - 1, ret = -1;
while(start <= end) {
int mid = (start + end) >> 1;
if(d <= arr[m... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | dca05b7f1b663eddcdc06fc2da30c124 | 1,900 | PASSED |
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.List;
... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | 9ff03a81e722d35576bc974b8b6cf287 | 1,900 | PASSED |
import java.io.*;
import java.util.*;
public class D {
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static MyScanner sc;
static {
try {
sc = new MyScanner();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | fde71a3e15bd31f01d90e4131caa7ea5 | 1,900 | PASSED |
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
BufferedReader br = new BufferedReader(new I... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | 3ab9d08b5e529c22dbb21c8a1971fa68 | 1,900 | PASSED |
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
impor... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | 55506a85ece2a0d564dcabc6faac75a2 | 1,900 | PASSED |
//package 第1358场;
/* 盗图小能手
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | 01811315ffd18a86afed5a2616ba6279 | 1,900 | PASSED |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
static int MOD = 1000000007;
public static void main(String[] args) throws IOException {
... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | 3bd58a863e0e8c8493fcc1e1bb021dc4 | 1,900 | PASSED |
import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class d645 implements Runnable{
public static void main(String[] args) {
try{
new Thread(null, new d645(), "process", 1<<26).start();
}
catch(Exception e){
System.out.println(e);
... | Java | 9ba374e20305d93ba42ef152e2cad5b5 | 7d0ceb46e6a940f7653f400ec3fa952b | 1,900 | PASSED |
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define AlPHA "abcdefghijklmnopqrstuvwxyz"
#define PI 3.14159265
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin) ;
fr... | C++ | 684273a4c6711295996e520739744b0f | 29a5276af9a1602c7bb92682398aec84 | 1,400 | PASSED |
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define AlPHA "abcdefghijklmnopqrstuvwxyz"
#define PI 3.14159265
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin) ;
fr... | C++ | 684273a4c6711295996e520739744b0f | 19a4e5f8da666172492e146d0ae02708 | 1,400 | PASSED |
/*
"We know what we are, but know not what we may be."
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 3;
const long long M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 26, BL = 400;
const double EPS = 3... | C++ | 684273a4c6711295996e520739744b0f | b76e8445e34a2894c134ca66a4d55a10 | 1,400 | PASSED |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll fun(ll a, ll b)
{
if (a % b == 0)
return a / b;
else
{
return a / b + 1;
}
}
ll modularExponentiation(ll x, ll n, ll M)
{
if (n == 0)
return 1;
else if (n % 2 == 0)
return modularExponentiation(... | C++ | 684273a4c6711295996e520739744b0f | cddb135986d680fa4363e0d66ac57bc0 | 1,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
long long a[maxn];
long long n,k,m;
int main()
{
cin >> n >> m >> k;
long long ans = 0;
long long s = 0;
long long kk = k;
long long sum = 0;
for(int i = 0;i < m;i++)
{
cin >> a[i];
}
for(int i = 0;i < m;i++... | C++ | 684273a4c6711295996e520739744b0f | 4080c339e63959d9efeb8d23f1eb0272 | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dis[100010];
int main()
{
ll n,m,k,ans=0,i,k1,j,s,sum;
scanf("%lld%lld%lld",&n,&m,&k);
for(i=1; i<=m; i++)
scanf("%lld",&dis[i]);
s=sum=0;
k1=k;
for(i=1; i<=m; i++)
{
if(dis[i]<=k+sum)
s++;
... | C++ | 684273a4c6711295996e520739744b0f | 6c5f40e11ad1e028f8257e0b02515892 | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dis[100010];
int main()
{
ll n,m,k,ans=0,i,k1,j,s,sum;
scanf("%lld%lld%lld",&n,&m,&k1);
for(i=1; i<=m; i++)
scanf("%lld",&dis[i]);
s=sum=0;
k=k1;
for(i=1; i<=m; i++)
{
if(dis[i]<=k)
{
... | C++ | 684273a4c6711295996e520739744b0f | ba23651c22ab902c28b20f0514c15f7a | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dis[100010];
int main()
{
ll n,m,k,ans=0,i,k1,j,s,sum;
scanf("%lld%lld%lld",&n,&m,&k1);
for(i=1; i<=m; i++)
scanf("%lld",&dis[i]);
s=sum=0;
k=k1;
for(i=1; i<=m; i++)
{
if(dis[i]<=k)
{
... | C++ | 684273a4c6711295996e520739744b0f | 4221b2a54919e07dff94387dedb1571a | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define NO() cout<<"NO"<<endl
#define YES() cout<<"YES"<<endl
#define fast... | C++ | 684273a4c6711295996e520739744b0f | dcbfcec26f367f521bd96104c17a8d18 | 1,400 | PASSED |
/*
author: masab hasnain
*/
/*
Formulae:
total number of subsegments = (n*(n+1))/2
*/
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b){
return b == 0LL ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b){
return (a * b) / gcd(a, b);
}
ll mod_pow(ll base, ll power, ll mod... | C++ | 684273a4c6711295996e520739744b0f | 7e23125087b7f59b7274e322c1fd4c67 | 1,400 | PASSED |
#include <iomanip>
#include <iostream>
#include <vector>
#include <bitset>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <cassert>
#include <cmath>
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | 2aaf3c48948a88874fe3ccd8f3395304 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end()
//#define endl '\n'
#defi... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | 1a9409c181eba1461b25f854d8b6e546 | 2,200 | PASSED |
#include <vector>
#include <unordered_set>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
int n, m;
int v[100000][2];
vector<unordered_set<int>> g;
int mark[1000];
bool dfs(int pos) {
if (mark[pos] == 2) return false;
if (mark[pos] == 1) {
return true;
}
mark[pos... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | fab4ccc40bbcf94d5bfb01c5c30ddb8f | 2,200 | PASSED |
#include <bits/stdc++.h>
#define fi first
#define se second
#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORD(i, a, b) for(int i = (a); i > (b); --i)
#define REPD(i, a, b) for(int i = (a); i >=(b); --i)
#define TR(it, a) for(__typeof(a.begin()) it = ... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | 3e28d33b28af46bd0ffecc0c9e786fce | 2,200 | PASSED |
#include <iostream>
#include <vector>
using namespace std;
vector <vector <int> > g;
vector <int> us, par, tout, ord;
bool cond, cond2;
int start, t;
void deldge (int v, int u) {
for (int j = 0; j < g[v].size(); j++) {
if (g[v][j] == u) {
g[v][j] = -1;
break;
}
}
}
vo... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | 1f9cb36e2ccabdbc85ead05199cad481 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int p[505],a,b,n,m,k,kiri,kanan,visited[505],cur,last;
vector<vector<int> > v;
bool cek[505][505],ada[505];
vector<vector<int> > component;
vector<pair<int,int> > ci;
bool cycle(int now){
//cout<<now<<endl;
visited[now] = 1;
bool res = 0;
for(int i = 0; i< ... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | c5233709146d1ef2492181126e9afd02 | 2,200 | PASSED |
//CuongTV
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i <= b; ++i)
#define FORD(i, a, b) for(int i = a; i >= b; --i)
#define ll long long
#define ii pair<int, int>
#define pb push_back
#define mp make_pair
#define S second
#define F first
//Declare global variables
using namespace std;
vector<int> ... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | 001a821a5b0a1aa07a04645716b1737a | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define emp emplace
#define fi first
#define se second
#define INF 0x3f3f3f3f
typedef long long ll;
typedef pair<int, int> ii;
const int N = 501;
int n, m;
vector<int> g[N];
vector<ii> cycle;
int vis[N], p[N];
int da, db;
bool ok = 0;
void dfs1(in... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | 89566e5e5069a0746ffacfbd3fa6f81b | 2,200 | PASSED |
#include <iostream>
#include <vector>
using namespace std;
vector<int>path;
int N,M;
vector<int>adj[501];
bool foundCycle=false;
int inCycle;
bool visited[501];
bool done=false;
int state[501];
void check(int node, int x, int y){
if (state[node]==2)
return;
state[node]=1;
for (int i=0;i<adj[node].size();i++)... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | 7a5773053bdf37a02c41351613f650fe | 2,200 | PASSED |
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int... | C++ | 18006c31aa5ca2c55d83f4222a6c7479 | b28c26653449ebc61db24dd3ce2f60bd | 2,200 | PASSED |
#include<iostream>
#include<algorithm>
#include<string>
#include <queue>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long ll;
const ll maxn=100010;
const ll inf=1e9+7;
ll n,a[maxn];
ll minv=inf;
ll sum[3];
int main()
{
scanf("%I64d",&n);
for(ll i=1; i<=n; i++)
{
scanf("%I6... | C++ | dbbea6784cafdd4244f56729996e9187 | 16ce9d95ff37d0bf00b8e66437913097 | 1,700 | PASSED |
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 10000000
using namespace std;
typedef long long ll;
const int MAXN=1e9+10;
const int MAX=1... | C++ | dbbea6784cafdd4244f56729996e9187 | 7a25c25c43080039c402a1ff85aedd31 | 1,700 | PASSED |
#include <iostream>
#include <array>
#include <string>
#include <cstdint>
#include <map>
#include <cmath>
#include <vector>
#include <set>
#include <iomanip>
#include <memory>
#include <algorithm>
int main() {
//freopen("input.txt", "r", stdin);
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);... | C++ | dbbea6784cafdd4244f56729996e9187 | fc74fbe7b842bd2cb0bf703eddd89cad | 1,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
int b[3];
map<int,int> s;
for(int i=0;i<n;i++)
{
cin>>a[i];
s[a[i]]++;
}
if(s.size()==1)
{
cout<<n<<endl;
for(int i=0;i<n;i++)
{
cout<<a... | C++ | dbbea6784cafdd4244f56729996e9187 | 009d3c0b3bbc75cea9be70c7e49e2db3 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int medidas[100005];
int main(){
ios_base::sync_with_stdio(false);
int n;
cin >>n;
set<int> range;
int aux;
for(int i=0; i<n; i++){
cin >>aux;
medidas[i]=aux;
range.insert(aux);
}
int min, med, max, con... | C++ | dbbea6784cafdd4244f56729996e9187 | 56c59ae27af3768fd209abf86d68b65a | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define fill(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout... | C++ | dbbea6784cafdd4244f56729996e9187 | be7b49f7491eb66f491752e9a87a94f5 | 1,700 | PASSED |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = (int) 1e5 + 5;
int a[N];
int main() {
int n;
cin >> n;
ll sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
sort(a, a + n);
int low = a[0];
int high = a[n - 1];
int mid = low + (high - low) / ... | C++ | dbbea6784cafdd4244f56729996e9187 | 85cb644101e76bf6093a5031ffc60bc2 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define mxn 100005
int x[mxn];
map <int, int> mp;
int main()
{
int n;
cin>>n;
for(int i=0; i<n; i++) scanf("%d", x+i);
sort(x, x+n);
if(x[n-1]-x[0]<=1){
printf("%d\n", n);
for(int i=0; i<n; i++) printf("%d ", x[i]);
return 0;
... | C++ | dbbea6784cafdd4244f56729996e9187 | af06abc9d8e2b28605743d8eb80e658b | 1,700 | PASSED |
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> v(n);
map<int,int> m;
for(int i=0;i<n;i++)
{
cin>>v[i];
m[v[i]]++;
}
sort(v.begin(),v.end());
if(m.size()==2)
{
vector<pair<int,int> > vvv... | C++ | dbbea6784cafdd4244f56729996e9187 | 74245bbc684a48d7f2c2b77509238f27 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
#ifndef ONLINE_JUDGE
freopen("in", "r", stdin);
#endif
int n;
cin >> n;
map<int, int> mp;
for(int i = 0; i < n; ++i) {
int tmp;
cin >> tmp;
++mp[tmp];
}
vector<pair<int, int> > freq;
freq.resize(3);
int cnt = 0;
for(aut... | C++ | dbbea6784cafdd4244f56729996e9187 | d9070f5d49c23fcd1d295a8b7fab0bd0 | 1,700 | PASSED |
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <map>
#include <string>
using namespace std;
const int INF=0x3f3f3f3f;
struct node
{
int p,i;
bool friend operator < (node a,node b)
{
return ... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 6f546783ec377d9095b13b7813f46eb5 | 1,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=200000+5;
struct T
{
int p,a,b;
int id;
}buf[N];
bool operator < (T A,T B)
{
return A.p>B.p;
}
priority_queue<T> q[4];
bool flag[N];
int n,m;
int main()
{
cin>>n;
for(int i=1;i<=n;i++) cin>>buf[i].p;
for(int i=1;i<=n;i++) cin>>buf[i].a;
for(int i=1;i<=n;i+... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 3e2a867b82214c698ab316db97c4f9a4 | 1,400 | PASSED |
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
#define N 200005
#define rep(i,l,k) for(int i=l;i<=k;i++)
int n,m,c[N];
bool vis[N];
struct Neko{
int a,b,p,id;
bool operator < (const Neko &zech)const {
return p>zech.p||(p==zech.p&&id>zech.id);
}
}E[N];
priority_queue<Neko>q[4]... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 0dc3ac6150073293e702ab37a9cdf7a6 | 1,400 | PASSED |
#include<iostream>
#include<queue>
using namespace std;
const int N=200000+5;
struct Node{
int p,id;
bool operator < (const Node &B)const{
return p>B.p;
}
};
priority_queue<Node> q[4];
int n,p[N],a[N],b[N],m,c[N];
bool flag[N];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>p[i];
}
... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 851b419bf6c567e6b762f7819a8c6045 | 1,400 | PASSED |
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
using namespace std;
const int MAXN=200005;
int n,m;
int p[MAXN],a[MAXN],b[MAXN];
int c[MAXN];
struct Tshirt
{
int val,num;
};
int tag[MAXN];
bool operator <(const Tshirt &a,const Tshirt &b)
{
return a.val>b.val;
}
int main()
{
... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 800b3c54deeca93aceaf0e24facaed5d | 1,400 | PASSED |
#include <iostream>
#include <queue>
using namespace std;
const int N=200000+5;
struct Node{
int price,id;
bool operator<(const Node &B)const{
return price>B.price;
}
};
priority_queue<Node> q[4];
int n,m,p[N],a[N],b[N],c;
bool book[N];
int main(){
cin>>n;
for(int i=1;i<=n;++i) cin>>p[i];
for(int i=1;i<=n;++i) ... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 84a862d48ff63c2f72a1f609bd264363 | 1,400 | PASSED |
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;
struct apple{
int p,id;
bool operator<(const apple &a)const{
return a.p<p;
}
}f[200010];
int vis[200010],c,n,m,i,j;
priority_queue<apple> q[4];
int main(){... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | ecad3238e5ab4c246db98ddafabaae91 | 1,400 | PASSED |
#include<iostream>
#include<queue>
using namespace std;
const int N=200005;
int n,m,buy[N];
struct clothes{
int a,b,p,id;
bool bought;
}c[N];
bool operator<(clothes A,clothes B){
return A.p>B.p;
}
priority_queue<clothes> q[4];
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>c[i].p;
c[i].id=i;
}
for(int i=1;... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 13fafd4f90afca0caa5d7132c83ad3e9 | 1,400 | PASSED |
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
const int N = 200000 + 5;
int n, m, c;
int p[N], a[N], b[N];
int vis[N];
struct node {
int price, id;
}tmp;
struct cmp1 {
bool operator () (node x, node y) {
return x.price > y.price;
}
};
priority_queue<node, vector<no... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 96d5516ec6a88b68dce09ee86a32d2bf | 1,400 | PASSED |
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
using namespace std;
struct st
{
int p,a,b,id;
}aa[200005];
bool operator < (st x,st y)
{
return x.p>y.p;
}
priority_queue<st,vector<st>,less<st> > q[4];
int n,m,x,ans,aid;
bool flag[200005],f;
int main()
{... | C++ | d5ead5b6be04cd9389a70e9e420039a6 | 48c26e61db408c1466a5783f94625aad | 1,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define MAX 5000000
bool status[MAX+7];
vector<int>primes;
int counter[MAX+7];
void sieve()
{
for(int i=2; i<=MAX; i++)
status[i]=true;
for(int i=4; i<=MAX; i+=2)
status[i]=false;
int sqrtn=sqrt(MAX);
for(int i=3; i<=sqrtn; i+=2)
{
... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 543116060b0df8e662296abe618e6af3 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int p[5000004];
void sieve(){
int aux;
memset(p,0,sizeof(p));
for(int i=2;i<5000004;i++){
if(p[i]==0){
for(int k=i;k<=5000003;k+=i){
aux=k;
while(aux%i==0){
p[k]++;
... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 219f6879f2db9fc04a62c907d4f940ed | 1,700 | PASSED |
//2016-05-23 20:32:09.163000
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
#define NN 5555555
int qf, qb, q[1111111];
int np, p[NN], prime[NN/10], s[NN], cnt[NN];
int pre() {
int n, i, k, j;
memset(p, 0, sizeof(p));
np=0;
fo... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 4200ec7cfaccd03cc1f2a6365c4ae154 | 1,700 | PASSED |
//2016-05-23 19:38:58.403000
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define NN 5000500
int prime[NN], cn[NN], dd[NN];
void pre() {
int i, j;
for(i=2; i<NN; i++) {
// printf("%d %d\n", i, prime[i]);
if(prime[i]) continue;
if(i>NN/i+100) continue;
for(j=i*i; j<NN; j+=i) {... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 9eeb12ea9427af2b30b0397645abcef3 | 1,700 | PASSED |
//2016-05-23 19:10:10.207000
#include <algorithm>
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
using namespace std;
#define NN 5100000
int p[NN], num[NN];
int prepare() {
for (int i=2; i<NN; i++) {
if (p[i]) continue... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 7dac7bc6ea6e1e6c3dd2b215cbdff811 | 1,700 | PASSED |
//2016-05-23 19:29:13.721000
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#define NN 1111
#define inf 0x3f3f3f3f
#define INF 1e200
#define eps 1e-7
using namespace std;
#define NN 5555555
int flag[NN], res[NN], sum[NN];
void pre() {
... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 3c39c0291b86d85896ceb0a6adc70357 | 1,700 | PASSED |
//2016-05-23 19:49:45.391000
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <memory.h>
#define NN 5000010
using namespace std;
int tot[NN],t[NN],pk,p[NN],vst[NN];
void pre(){
for(int i=2; i<NN; i++){
if(vst[i]) continue;
p[pk++]=i;
t[i]=1;
if(i>2500) continue;
for(int j=i*i; j<NN; j+... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 9c817bf16d9285bf4fc0996c43337a48 | 1,700 | PASSED |
//2016-05-23 19:11:53.415000
#include <algorithm>
#include <cstdio>
#include <memory.h>
#include <set>
#include <queue>
#include <string.h>
#include <vector>
using namespace std;
#define NN 5000100
#define rep(i, a, b) for (int i = (a); i < (b); i ++)
#define clr(a, b) memset(a, b, sizeof(a))
typedef long long INT;
... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | 39b2013df8014f37066c4f17926fb2d4 | 1,700 | PASSED |
//2016-05-23 19:40:19.550000
#include<algorithm>
#include<stdio.h>
#include<memory.h>
#include<queue>
#include<vector>
using namespace std;
typedef long long INT;
#define NN 5000100
int cn[NN],mk[NN],p[NN],ans[NN];
int cnt=0;
int main(){
// freopen("d.in","r",stdin);
int T,i,j,a,b,r;
memset(mk,0,sizeof(mk));
memset(... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | ca99c9b65e6c00a176cc45d71bd77542 | 1,700 | PASSED |
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
typedef long long ll;
ll arr[5000001]={0};
void init()
{
ll k,j;
for(k=2;k<=5000000;k++)
{
if(!arr[k])
{
for(j=1;j*k<=5000000;j++)
{
ll op=j*k;
while(op%k==0)... | C++ | 79d26192a25cd51d27e916adeb97f9d0 | ad8b6bfe949c55c524a2831a75f262ee | 1,700 | PASSED |
#include <stdio.h>
int main(){
int x,i;
long n,m;
double c[100006];
scanf("%d",&x);
n=1;
m=0;
scanf("%lf",&c[0]);
for(i=1;i<x;i++){
scanf("%lf",&c[i]);
if(c[i-1]<c[i]){
n++;
if(n>m)
m=n;
}
else
n=1;
... | C | 4553b327d7b9f090641590d6492c2c41 | 753c0727fa1c3280feae3a52116c6fe6 | 800 | PASSED |
#include<stdio.h>
int main(void)
{
int n,j,count,max=0;
scanf("%d",&n);
int a[n];
for( j=0; j<n ;j++)
scanf("%d",&a[j]);
if(n==1) max=1;
else
for( count=1,j=0; j<n-1 ;j++)
if(a[j]<a[j+1])
{count++;if(count>max) max=count;}
else
{if(count>max) max=count; count=1;}
printf("%d",max);
} | C | 4553b327d7b9f090641590d6492c2c41 | 412e0859b89121a4753e5fc60418f4da | 800 | PASSED |
#include<stdio.h>
int main()
{
int array[100005];
int n,i , num,count,p , max;
scanf("%d",&n);
scanf("%d",&p);
count = 1;
max = 1;
for(i = 0 ;i < n-1; i++){
scanf("%d",&num);
if(num<=p){
count = 1;
p = num;
}
else if(num > p){
... | C | 4553b327d7b9f090641590d6492c2c41 | 1a269554479d5f19f7e91b5b9aed7780 | 800 | PASSED |
#include <stdio.h>
int main(void) {
int n, i, b = 0, c = 0, ans = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
int a;
scanf("%d", &a);
if (a > b) {
c++;
if (c > ans) {
ans = c;
}
} else {
c = 1;
... | C | 4553b327d7b9f090641590d6492c2c41 | d8f88e864e7a9b78c44655b0037393eb | 800 | PASSED |
#include <stdio.h>
int main ()
{
int n, arr[100000], arr1[100000], i, j = 0, k, l, ct = 1, max;
scanf("%d", &n);
for(l = 0; l < n; l++)
{
scanf("%d", &arr[l]);
}
if(n == 1)
{
printf("1\n");
}
else
{
for(i = 0; i < (n - 1); i++)
{
if(ar... | C | 4553b327d7b9f090641590d6492c2c41 | b231922b97a30dbac2d056a6e6480438 | 800 | PASSED |
#include <stdio.h>
int main()
{
int n,i,foo=1,min=0;
scanf("%d ",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d ",&a[i]);
}
for(i=1;i<n;i++)
{
if(a[i]>a[i-1])
{
foo++;
}
else {
if(foo>min)
min=foo;
foo=1;
}
}
if(foo>min)
printf("%d",foo);
else printf("%d",min);
return 0;
} | C | 4553b327d7b9f090641590d6492c2c41 | 44449741d649fd8685f920439f4e1846 | 800 | PASSED |
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n];
int i;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
long int j,k=1,l=1;
for(j=0;j<n-1;j++)
{
if(a[j+1]>a[j])
++k;
else
{
if(k>=l)
{
l=k;
}
k=1;
}
}
if(l>k)
printf("%ld\n",l);
else
printf("%ld\n",k);
}
| C | 4553b327d7b9f090641590d6492c2c41 | efea1f8c0d05f01a349cdcaa3835b6bf | 800 | PASSED |
#include<stdio.h>
int main(void)
{
int n,i,max=1,max_store=1;
long long int a[100005];
scanf("%d",&n);
scanf("%I64d",&a[0]);
for(i=1;i<n;i++) {
scanf("%I64d",&a[i]);
if(a[i]>a[i-1]) {
max++;
if(max>max_store) {
max_store=max;
}
}
else {
max=1;
}
}
printf("%d",max_store);
return 0;
} | C | 4553b327d7b9f090641590d6492c2c41 | 4f9a3ce02b5a67e4d1986c0add800b71 | 800 | PASSED |
#include <stdio.h>
#define N 100000
int arr[N];
int num[N];
int main(){
int i,n,max=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&num[i]);
if(i==0) arr[0]=1;
else if(num[i]>num[i-1])arr[i]=arr[i-1]+1;
else arr[i]=1;
if(arr[i]>max) max=arr[i];
}
printf("%d\n",max );
return 0;
} | C | 4553b327d7b9f090641590d6492c2c41 | d5bcd89a7c328e460e8eae2c47bbff57 | 800 | PASSED |
#include<stdio.h>
main()
{
long long int n,t=1,k=1,j;
scanf("%lld",&n);
int a[n];
for(j=0;j<n;j++)
{
scanf("%lld",&a[j]);
}
for(j=0;j<(n-1);j++)
{
if(a[j+1]-a[j]<=0)
{
t=0;
}
t++;
if(t>k)
k=t;
}
printf("%d",k);
} | C | 4553b327d7b9f090641590d6492c2c41 | 1e899674af87079b1033a3a9b3f3b0bc | 800 | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
#define ll long long
#define maxn 500010
#define int ll
using namespace std;
int n , m ;
char a[maxn] , b[maxn] ;
signed main()
{
cin >> n >> m ;
cin >> (a + 1) >> (b + 1) ;
int res = 2 , ans = 0 ;
for(int i = 1 ; i <= n ; ++i)
{
if(a[i] == 'b') res -- ;
... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | adedf8db5e379f40e25a52242e3ffc5b | 2,000 | PASSED |
#include <iostream>
#include <string>
using namespace std;
#define FOR(i, a, b) for (int i=a; i<b; i++)
int main() {
int n, k;
cin >> n >> k;
string s, t;
cin >> s >> t;
if (k==1) {cout << n; return 0;}
long nodesLevel = 1;
long long total = 0;
FOR (i, 0, n) {
node... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | 6165b4536590221749099fc81c9f0b91 | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
long long l,r,n,k;
long long ans=0;
char s[500010],b[500010];
int main() {
cin>>n>>k;
scanf("%s%s",s+1,b+1);
for(int i=1;i<=n;++i) {
if(s[i]=='b') l++;
if(b[i]=='b') r++;
ans+=min((r-l+1),k);
if((r-l+1)<=k+10) l*=2,r*=2,r-=l,l=0;
} cout<<ans;return 0;
}
| C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | 6389eaa1114a2e8826fbca36a8c82c6b | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int n,k;
char a[N],b[N];
int main ()
{
scanf("%d%d%s%s",&n,&k,a,b);
long long cur = 1,ans = 0;
if (k == 1)
{
cout << n << endl;return 0;
}
for (int i = 0;i < n;i++)
{
cur *= 2;
if (a[i] != 'a') --cur;
if (b[i] != 'b') --cur;
cur = min(... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | 7128b4731a2a727a439e0e49c83377fd | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout);
#define LL long long
#define ULL unsigned LL
#define fi first
#define se second
#define pb push_back
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define lch(x) tr[x].son[0]
#define rch(x) tr[x]... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | 594eac9923b94f6467ebc619ad25e3c1 | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout);
#define LL long long
#define ULL unsigned LL
#define fi first
#define se second
#define pb push_back
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define lch(x) tr[x].son[0]
#define rch(x) tr[x]... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | 1775ba45ec85d1421502c5f9e2e3479b | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout);
#define LL long long
#define ULL unsigned LL
#define fi first
#define se second
#define pb push_back
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define lch(x) tr[x].son[0]
#define rch(x) tr[x]... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | da512eabea9b41e4f1df410a5b330e26 | 2,000 | PASSED |
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define mem(x,num) memset(x,num,sizeof x)
#define reg(x) for(int i=last[x];i;i=e[i].next)
using namespace std... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | 78331997b5dc0956b09a4f34a2cd765e | 2,000 | PASSED |
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
string s, t;
cin >> s >> t;
vector<int> dp(n+1);
dp[0] = 1;
long long rasp = 0;
for(int i = 1; i <= n; ++i)
{
dp[i] = 2 * dp[i-1];
i... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | 105359135e67d9905bb7567db8545d46 | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+7;
int n,k;
char s[N],t[N];
int main() {
scanf("%d%d",&n,&k);
scanf("%s",s+1); scanf("%s",t+1);
long long cnt=1,ans=0;
for (int i=1;i<=n;i++) {
cnt*=2;
if (s[i]=='b') cnt--;
if (t[i]=='a') cnt--;
if (cnt>1e9) cn... | C++ | a88e4a7c476b9af1ff2ca9137214dfd7 | a42e3ddbb2c6551fed5a44b78b14a172 | 2,000 | PASSED |
import math
for _ in range(int(input())):
n,k = map(int, input().split())
s = input()
#print(s[::-1])
if s.count('0') == len(s):
print(math.ceil(len(s)/(k+1)))
else:
anz = 0
st = s.index('1')
en = n - s[::-1].index('1')
#print(st,en)
if (st) > 0:
... | Python | fd85ebe1dc975a71c72fac7eeb944a4a | 6d760167b3b033669bf2d67d5ed37ae9 | 1,300 | PASSED |
for _ in range(int(input())):
n, k = map(int,input().split())
a = input()
if n == 1:
if a[0] == '0':
print(1)
else:
print(0)
else:
aa = []
for i in a:
aa.append(int(i))
c = 0
i = 0
while i < n:
if aa[... | Python | fd85ebe1dc975a71c72fac7eeb944a4a | 733b75d54d0313774154051aecaeca86 | 1,300 | PASSED |
t=int(input())
for _ in range(t):
left=True
right=True
ans=0
n,k=map(int,input().split())
s=input()
if s[0]=='1':
left=False
if s[-1]=='1':
right=False
cnt=0
for i in range(n):
if s[i]=='0':
cnt+=1
if s[i]=='1':
if left:
... | Python | fd85ebe1dc975a71c72fac7eeb944a4a | 77cf5aab687310db7ed5b26a73fb4e67 | 1,300 | PASSED |
for _ in range(int(input())):
n,k=map(int,input().split())
s=input()
last1=n-1
numbers=1
if n==1 and s=='0':
numbers=1
elif n==1 and s=='1':
numbers=0
elif n==2 and '1' not in s:
numbers=1
elif n==2 and '1' in s:
numbers=0
else:
for i in range(... | Python | fd85ebe1dc975a71c72fac7eeb944a4a | 020ad3805f259310fb76885d138b8573 | 1,300 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.