source_code stringlengths 26 62k | lang_cluster stringclasses 11
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | difficulty int32 -1 3.5k ⌀ | exec_outcome stringclasses 1
value |
|---|---|---|---|---|---|
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
int t,x,y,n;
cin>>t;
while(t--){
cin>>n;
bool flag1 = false , flag2 = false;
int a = 2000, b = 0;
int indx1 , indx2 , indx3;
for(int i = 0 ; i < n ; i++){
cin>>x;
if( flag1 == false){
if(x ... | C++ | dd55e29ac9756325530ad2f4479d9f6d | e2a863959e3209ff5998f3095265f37f | 900 | PASSED |
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <c... | C++ | dd55e29ac9756325530ad2f4479d9f6d | 4bae19e5cd7bc4475632c6758ff98370 | 900 | PASSED |
#include <stdio.h>
void main()
{
int t, n, p[1005], i, con;
scanf("%d", &t);
int flag;
while(t--)
{
flag = 0;
scanf("%d", &n);
for(i = 0; i<n; i++)
{
scanf("%d", &p[i]);
}
for(i = 0; i < n-2; i++)
{
if((p[i]<p[i+1]) && (p[i+1]>p[i+2]))
{
printf("YES\n");
printf("%d %d %d\n", i+1, i+... | C++ | dd55e29ac9756325530ad2f4479d9f6d | c19a43ef94d6db94015f6db56a5cdc85 | 900 | PASSED |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#define endl "\n"
using ll = long long;
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
... | C++ | dd55e29ac9756325530ad2f4479d9f6d | 8bea94534aa122667e59498a96b5976c | 900 | PASSED |
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
long mas[2000];
long t;
cin >> t;
for (int i = 0; i < t; i++) {
long n;
cin >> n;
for (int j = 0; j < n; j++) {
cin >> mas[j];
}
bool f = false;
for (int j = 1; j < n - 1; j++) {
if (ma... | C++ | dd55e29ac9756325530ad2f4479d9f6d | 239fa5efe516c6b4cc7a798a607353ea | 900 | PASSED |
#include <iostream>
#include <string>
static bool opposite(char d1, char d2)
{
switch (d1) {
case 'U': return d2 == 'D';
case 'D': return d2 == 'U';
case 'L': return d2 == 'R';
case 'R': return d2 == 'L';
}
}
int main()
{
std::ios_base::sync_with_stdio(false);
long n;
std::cin >> n;
std::string s;
std::g... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 39fc1c0f0dae2967100b6eda2e2a49f5 | 1,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define sc scanf
#define pf printf
#define pi 3.141592653589793
#define pb push_back
#define debug(x) cout<<x<<endl;
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d %d", &a,&b);
#define ... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 935905392eb1396b54867db27ef1985d | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
bool l,r,u,d;
int main(){
int n;
cin>>n;
string s;
cin>>s;
int sm=0;
for (int i=0;i<n;i++){
if (s[i]=='R'){
if (l) {l=0;u=0;d=0;r=1;sm++;}
else r=1;
}
if (s[i]=='L'){
if (r) {l=1;u=0;d=0;r=0;sm++;}
else l=1;
}
if (s[i]=='U... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 50d7547babf8ae1ff7c8d3868e19b5b5 | 1,400 | PASSED |
#include<algorithm>
#include<assert.h>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<deque>
#include<iostream>
#include<map>
#include<memory.h>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<utility>
#include<v... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 8c19b351883ba35dba68ab4237f0ac5b | 1,400 | PASSED |
#include<algorithm>
#include<assert.h>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<deque>
#include<iostream>
#include<map>
#include<memory.h>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<utility>
#include<v... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | fd936ff0aa763b945e5454335bb0cb53 | 1,400 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstring>
#include <set>
#include <queue>
#include <cctype>
#include <map>
#include <stack>
#include<cstdlib>
#include <sstream>
#include <deque>
#include<list>
#include<time.h>
#define ll long long
#define LL long lo... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 42d74f1ee9922b27f16a10c53b4c5228 | 1,400 | PASSED |
//codeforces
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
using namespace std;
int main(){
int n,k1,k2=-1,ans=1;
char x;
scanf ("%d\n%c",&n,&x);
k1=x;
while (--n){
scanf ("%c",&x);
if (k1==x||k2==x){
continue;
}
if (k1!=x&&k2==-1){
if... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | c53d4575e60dd8a9e504f03e52b20129 | 1,400 | PASSED |
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll long long
#define mp make_pair
#define mod 1000000007
#define eps 1e-8
#define inf 1e18
const double PI = acos(-1);
using namespace std;
int main(){
ios::sync_with_stdio(0);
int n;
cin... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 8ad28cf39c8c8d0f4e824d14e4ae013b | 1,400 | PASSED |
//
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
int n;
string m;
while (cin >> n >> m)
{
int seq(1);
bool bLeft(false), bRight(false), bUp(false), bDown(false);
for (int i = 0; i < n; i++)
{
if (
(m[i] == 'L' and bRight)
or
(m[i] == 'R' and bLeft)
or
... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 931032fe3e41cc1333d155b3d4c54131 | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mmax(a,b,c) max(max(a,b),c)
#define mmin(a,b,c) min(min(a,b),c)
#define sqr(n) ( ( n ) * ( n ) )
#define pb push_back
#define mp make_pair
const int N = 200500;
char c[N];
int idr, idl, idu, idd;
int main()
{
// freopen("input.txt", "r"... | C++ | b1c7ca90ce9a67605fa058d4fd38c2f2 | 70992faf537e3118ce17a5f37da7cccf | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a... | C++ | bc3d0d902ef457560e444ec0128f0688 | 1ba288158c1f9704c01721d070a94216 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
const int MAXN = 300010;
deque<char> oleg, egor;
string ans;
int l, r;
void Oleg()
{
int rem = (r - l) / 2 + 1;
while (oleg.size() > rem) oleg.pop_back();
if (l != r && oleg.front() >= egor.back()) {
ans[r--] = ... | C++ | bc3d0d902ef457560e444ec0128f0688 | 3da53024d4daa3baadafbb41326bfabc | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
template <typename T>
ostream& operator<<(ostream& out, vector<T>& cont)
{
out << "{ ";
for(auto& it : cont)
{
out << it << ", ";
}
out <<" }";
return out;
}
int main()
{
ios_base::sync_with_stdio(... | C++ | bc3d0d902ef457560e444ec0128f0688 | fd30bd110dc5801ad545ef4b01df0dc6 | 1,800 | PASSED |
#include<bits/stdc++.h>
#define pb push_back
using namespace std ;
int main ()
{
string a , b ;
cin >> a >> b ;
sort (a.begin() , a.end() ) ;
sort (b.begin() , b.end() ) ;
reverse(b.begin() , b.end());
int n = a.size() ;
int c1 = 0, c2 = 0 ;
int en1 = ((n+1)/2)-1, en2 = (n/2)-1 ;
st... | C++ | bc3d0d902ef457560e444ec0128f0688 | e92592d3db33d398c4f69820c5b990f0 | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool compare(char a,char b)
{
if(a>b)
return true;
else
return false;
}
int main()
{
unsigned int aindex=0,bindex=0,cindex=0;
static int marked[300009];
unsigned int sizea,sizeb;
char a[300009];
char b[300009... | C++ | bc3d0d902ef457560e444ec0128f0688 | 5f005f33f0c9c3e071d439ca3856cedb | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
//#define int int64_t
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define sz(a) ((int) a.size())
#define all(a) a.begin(), a.end()
#define forn(i, j, n) for (int i = j; i < n; ++i)
#define forc(i, n, j) for (int i = n - ... | C++ | bc3d0d902ef457560e444ec0128f0688 | 638a9c91b9091fc61a19b52e8e729383 | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
string s,t;
long long a[26],b[26];
int main()
{
ios_base::sync_with_stdio(false);
cin>>s;
cin>>t;
long long n,i,j,k;
n=s.size();
char ans[n+1];
for(i=0;i<n;i++)
{
a[s[i]-'a']++;
b[t[i]-'a']++;
}
j=0;
k=25;
while(b[k]==0 && k>=0)
k--;
while(a[j]==0... | C++ | bc3d0d902ef457560e444ec0128f0688 | 7f8b5268ce4274146539aa4ada7d870b | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
string s, t, ans;
int main(){
cin >> s >> t;
sort(s.begin(), s.end());
sort(t.begin(), t.end());
ans = s;
int n = s.size();
int oleg_best = 0, oleg_worst = n/2,
igor_best = n-1, igor_worst = n - (n/2);
if(n%2==0) oleg_worst--;
int first = 0, last = ... | C++ | bc3d0d902ef457560e444ec0128f0688 | 8e17a127bd3a2e8ac7cddb12c10540c0 | 1,800 | PASSED |
#include <bits/stdc++.h>
typedef long long int ll;
#define FastIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define F first
#define S second
#define pb push_back
#define R return
#define mp make_pair
using namespace std;
pair<int,int> a[1009];
int main()
{
FastIO
freopen("input.txt","r",s... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | bde626f8533369b5b8843db85d697443 | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n,k,i,j,l;
cin>>n>>k;
int a[n],b[n],c[k];
for(i=0; i<n; i++){
cin>>a[i];
b[i]=a[i];
}
sort(a,a+n);
for(i=n-k,l=0; i<n; i++,l++)
{
... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | 0d277771e2a02c772b9fe495884e264d | 1,000 | PASSED |
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <climits>
#include <fstream>
using namespace std;
struct comp
{
bool operator () (const pair <int,int> &a, const pair <int,int> &b)
{
if (a.first > b.first)
return true;
else
return f... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | db13493a228ac65fdcb1b731dd510020 | 1,000 | PASSED |
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<string>
#include<iostream>
#include<sstream>
using namespace std;
int n, k;
int a[10000], b[10000];
int main() {
freopen("input.txt", "r", stdin);
freopen("output... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | 7916b5d8bb0898a7635cfedf9dd4516b | 1,000 | PASSED |
#include <bits/stdc++.h>
#define sf(x) scanf("%d",&x)
#define sfd(x) scanf("%lf",&x)
#define sfbig(x) scanf("%I64d",&x)
#define sfbig2(x,y) scanf("%I64d%I64d",&x,&y)
#define pfbig(x) printf("%I64d\n",x)
#define sf2(x,y) scanf("%d%d",&x,&y)
#define sfc(x) scanf("%c",x)
#define pf(x) printf("%d\n",x);
#define EPS 1e-7
#d... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | 8dde31f643e11d1037b159e3d0664e81 | 1,000 | PASSED |
#include <fstream>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;
const int MAX = 1000;
int main()
{
ifstream cin("input.txt");
ofstream cout("output.txt");
int n, k;
P p[MAX];
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> p[(p[i].second = i)].first;
sort(p, p + n);
cout << p[n-k]... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | 57541985e95795d7568a8ee334d0a294 | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,k,z;
cin>>n>>k;
priority_queue<pair<int,int > > q;
set<int > a;
set<int >::iterator it;
for(int i=0;i<n;i++)
{
cin>>z;
q.push(make_pai... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | 9307c2c60e65b89e4ee0d49f9d1a0b78 | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
bool compare(const pair<int,int>& first,const pair<int,int>& second)
{
return first.first>second.first;
}
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,k,z;
cin>>n>>k;
vector <pair<int,int > > a;
for(int... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | 00189390e9f7e12f22e55dbc93128045 | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define PB push_back
#define FOR(prom,a,b) for( ll prom = (a); prom < (ll)(b); ++prom )
#define F(a) FOR(i,0,a)
#define FF(a) FOR(j,0,a)
#define E... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | d3dfc463e44af45de268197b4dc67def | 1,000 | PASSED |
#include <iostream>
#include <map>
#include <vector>
#include <array>
#include<string.h>
#include<algorithm>
using namespace std;
vector<int>vec;
bool find(int a)
{
for(int i = 0 ; i < vec.size();i++)
if(vec[i] == a)
return true;
return false;
}
int main()
{
int n , k ;
freopen("input.txt","r",stdin);
freo... | C++ | a585045a9a6f62bfe1c0618c2ee02f48 | 60bb140037ff9b4a60ffccd413190654 | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct knight
{
ll power, coin, id;
};
bool cmp(struct knight k1, struct knight k2)
{
return k1.power<k2.power;
}
int main()
{
ll n, k;
cin >> n >> k;
knight a[n];
for(ll i=0; i<n; i++)
cin >> a[i].power;
for(ll i=0... | C++ | fa55be247a70fb509182f2fe203f6024 | 2a664759b91effe459c7abd8e068991f | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n,k;
cin>>n>>k;
vector<pair<ll,ll> >v(n);
map<ll,ll> mp;
ll arr[n];
for(ll i=0;i<n;i++)
{
cin>>v[i].first;
mp[v[i].first]=i;
}
for(ll i=0;i<n;i++)
{
cin>>v[i].second;
}
... | C++ | fa55be247a70fb509182f2fe203f6024 | 2173deaec469f3858cdfae572eb7ce3d | 1,400 | PASSED |
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0)
using namespace std;
typedef long long ll;
struct node
{ ll a,b,id;
}s[100005];
bool cmp(node x,node y)
{ return x.a <y.a ;
}
bool cmp1(node x,node y)
{ return x.id <y.id;
}
ll sum[20];
multiset<ll>p;
multiset<ll>::iterator it;
int main()... | C++ | fa55be247a70fb509182f2fe203f6024 | edbf73eb1fd7f2bef2f18cc02d481f74 | 1,400 | PASSED |
#include <iostream>
#include <cctype>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
using namespace std;
int main()
{
cin.tie(NULL);
ios_base::sync_with_stdio(false);
long long n, k, sum = 0, j;
cin >> n >> k;
vector < pair<long long, pair<long lon... | C++ | fa55be247a70fb509182f2fe203f6024 | 3b2be39fe5a840fcc788155676b16cd7 | 1,400 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md l + ((r - l) >> 1)
#define all(x) x.begin(),x.... | C++ | fa55be247a70fb509182f2fe203f6024 | 305d8aa9916044577e37bbc0d17e33d2 | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n, k, maxf = 0;
cin >> n >> k;
vector <long long> f(n);
vector <long long> m(n);
vector < pair <pair <long long, long long>, long long> > p(n);
for (long long i = 0; i < n; i++)
{
cin >> f[i];
maxf = max(... | C++ | fa55be247a70fb509182f2fe203f6024 | 80fbf753b35e6d9e80b947d8d53efcb5 | 1,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ios::sync_with_stdio(0);
ll n,k;
cin >> n >> k;
map<ll,ll>M;
ll i,j;
vector< pair<ll,ll> >a(n);
for(i=0;i<n;i++)
cin >> a[i].first;
for(i=0;i<n;i++)
{
cin >> a[i].second ;
M.insert(make_pair(a[i].first,a[i].second));
}... | C++ | fa55be247a70fb509182f2fe203f6024 | 4f5e6a0f0138b7aa497b56ac28af9808 | 1,400 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(c) c.begin(),c.end()
#define rap(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) rap(i,0,n)
#define efor(i,a) for(auto i : a)
#define rev1(i,n) for(ll i=n-1;i>=0;i--)
using namespace std;
int main() {
ll n,k;
cin>>n>>k;
vector< pair<ll, pa... | C++ | fa55be247a70fb509182f2fe203f6024 | 55b911a15d508c041677a6c3dc818f55 | 1,400 | PASSED |
#include<iostream>
#include<algorithm>
#include<vector>
#include <numeric>
using namespace std;
int c[100000];
long long a[100000];
pair<int,int>arr[100000];
int main()
{
int i,j,n,k,x;
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>arr[i].first;
arr[i].second=i;
}
for(i=0;i<n;i++)
cin>>c[i];
sort(arr,arr+n);
vect... | C++ | fa55be247a70fb509182f2fe203f6024 | 02a3157cfc6e6b900362ab695c1ef4e9 | 1,400 | PASSED |
/*
D.M.BHIKADIYA
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define se second
#define mp make_pair
typedef long long int ll;
int main()
{
ll n,k;
cin>>n>>k;
ll a[n],b[n];
for(ll i=0;i<n;i++)
cin>>a[i];
for(ll i=0;i<n;i++)
cin>>b[i];
vector<pair<ll,ll>> v(n)... | C++ | fa55be247a70fb509182f2fe203f6024 | 6d804268e78dd76e94e1a15eb69e1f42 | 1,400 | PASSED |
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define CLR(t, value) memset(t, value, sizeof(t))
#define ALL(v) v.begin(), v.end()
#define SZ(v) ((int)(v).size())
#define TEST(x) cerr << "test " << #x << " " << x << endl;
#define sc(x) scanf("%d",... | C++ | 1a9968052a363f04380d1177c764717b | b8db4952383f23711cabaedef20436a4 | 1,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int MAX=1e5+9;
int n,m,p1=1,p2=2,p3=1;
pair<int,int> ans[MAX];
vector<pair<pair<int,int>,int> > edge;
int main()
{
cin>>n>>m;
for (int i=0,w,t;i<m;i++) cin>>w>>t,edge.push_back({{w,-t},i});
sort(edge.begin(),edge.end());
for (auto e:edge)
{
if (e.first.second==-... | C++ | 1a9968052a363f04380d1177c764717b | 901ad66cd47a791908a02eadf9721993 | 1,700 | PASSED |
//Be Name Khoda
//no comment...
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typena... | C++ | 1a9968052a363f04380d1177c764717b | de29aa2b95c2a034632f40d79fa94d25 | 1,700 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<string>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 7;
struct edge{
int s, e;
int dis;
... | C++ | 1a9968052a363f04380d1177c764717b | 299511e2b749cbf37e0af40883b8851b | 1,700 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define ft first
#define sd second
using namespace std;
typedef pair <int, int> pii;
const int N = 100000;
int n, m, k, l, p, t = 1, nz = 1;
vector <pii> a, b;
pii o[N];
int main()
{
cin >> n >> m;
for (int i = 0; i < m; i++)
{
cin >> k >> l;
if (l == 1)
... | C++ | 1a9968052a363f04380d1177c764717b | 9358d4adf2e79afc09b485abf04d44b8 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
const int N = 1e5 + 3;
pair < int , int > p[N];
pair < int , int > ans[N];
int parent[N] , height[N];
vector < int > v;
struct DSU {
int parent[N];
int sz[N];
DSU() {
for(int i = 0; i < N; ... | C++ | 1a9968052a363f04380d1177c764717b | 4b04505b428d9294d8161d3dde8217bf | 1,700 | PASSED |
#include<bits/stdc++.h>
#define In_the_name_of_allah_the_merciful ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Alhamdulillah return 0;
#define pb push_back
#define ins(x) insert(x)
#define fi first
#define se second
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.r... | C++ | 1a9968052a363f04380d1177c764717b | 22764597ceb3aca04837aae50e7e1992 | 1,700 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mod 998244353
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ps push
#define pll pair<long,long>
typedef long long ll;
#define PI 3.14159265
#def... | C++ | 1a9968052a363f04380d1177c764717b | a8005d52272b4b125bc0931a2a399a81 | 1,700 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define endl "\n";
using namespace std;
const double pi=acos(-1);
const int N=2e5+7,mod=1000000007,M=2e9;
int n,m,u,v;
struct edge{
int w... | C++ | 1a9968052a363f04380d1177c764717b | 0bb8172c0a1881b7d83731a59f7f30b5 | 1,700 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl '\n'
#define pii pair<ll int,ll int>
#define vi vector<ll int>
#define vvi vector<vi>
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#def... | C++ | 1a9968052a363f04380d1177c764717b | 257954c6d039f0956c1649e21a3c9349 | 1,700 | PASSED |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ch[1000005];
ll s[1000005];
ll n;
ll ans;
void calc(ll l,ll r){
ll rans=1e18;
ll psum=0,qsum=0,qans=0;psum=s[l];
for(register ll i=l+1;i<=r;i++) {qsum+=s[i];qans+=1ll*s[i]*(i-l);}
rans=min(rans,qans);
for(register ll i=l+1;i<=r;i++){
qans+=psum... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | bd88120ffb0e77ba499e73abc89683e0 | 2,100 | PASSED |
#include <bits/stdc++.h>
#define debug(a) cout << #a ": " << a << endl
using namespace std;
typedef long long ll;
inline int read(void){
register int ans = 0;
register char ch = getchar();
while (ch<'0' || ch>'9') ch = getchar();
while (ch>='0' && ch<='9') ans = ans*10+ch-'0', ch = getchar();
return... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | 6f489c380a4d7510b7f4586705ad12b1 | 2,100 | PASSED |
// Author: wlzhouzhuan
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rint register int
#define rep(i, l, r) for (rint i = l; i <= r; i++)
#define per(i, l, r) for (rint i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define ... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | 50f7fdef5f730540f65501992838acdc | 2,100 | PASSED |
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;
int akari[1000010],n;
int st[1000010],ouo[1000010],p;
vector<int> sana;
inline int cal(int k)
{
int res=0;
for(int i=1;i<n;i++)
{
res+=min(abs(akari[i]%k-k),abs(akari[i]%k));
}
return res;
}
signed main(){
ios::sync_with_stdi... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | 34605b137683633259cf900643d40417 | 2,100 | PASSED |
#include <iostream>
#include <cstdio>
#include <climits>
#define int long long
using namespace std;
const int MAX=1000006;
int a[MAX],n,sum,aim,fin=9223372036854775807;
signed main() {
scanf("%lld", &n);
for (int i = 1; i <= n; i++)scanf("%lld", &a[i]), sum += a[i];
if (sum == 1) {
printf("-1");
return 0;
}
fo... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | 100c60e40e69a413dd93bcb6fa8edc92 | 2,100 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include<climits>
using namespace std;
const int N = 2e6 + 50;
long long n, a[N], sum, ans = LLONG_MAX;
long long deal(long long x)
{
long long ans = 0,n... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | 8d3232f8bb78c018b7aa3cf1f57b57bb | 2,100 | PASSED |
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1000010;
const ll mod=1000000007;
bool IOerror=0;
in... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | 88d5c294791083f0c24c725c30b46ead | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1000010;
const ll mod=1000000007;
bool read(ll &x) {
scanf("%lld",&x);
}
char s[N];
ll a[N],pre[N],suf[N],n,m,ans,all,b[N];
vector<ll>v;
vector<pair<ll,ll> >p;
const ll Maxn = 1000000;
ll pri[Maxn+5],np[Maxn+5],tot;
void gao(ll val) {
... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | 45012c3e3b507eeee7c921ad96a51c5a | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1000010;
const ll mod=1000000007;
bool IOerror=0;
inline char nc(){
static char buf[100000],*p1=buf+100000,*pend=buf+100000;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,100000,stdin);
if (pend==p1){IOerror=1;return -... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | eeeb5fa218bf0432531277eb21e84b2a | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1000010;
const ll mod=1000000007;
bool IOerror=0;
inline char nc(){
static char buf[100000],*p1=buf+100000,*pend=buf+100000;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,100000,stdin);
if (pend==p1){IOerror=1;return -1... | C++ | 90f08c2c8f7575330639fdd158bc8e6b | cdd5b5555c72ba8695b63800b7879596 | 2,100 | PASSED |
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif
using namespace std;
#define MAXN ((int)60+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
... | C++ | 6d47da375461c228bc70b117887cba33 | cc424d1ca84df4c8fcb3de7a04636957 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 66, INF = 1000000009;
int n, m, q;
int a[N][N][N];
int dp[N][N][N];
int main()
{
cin >> n >> m >> q;
for (int i = 0; i < m; ++i)
{
for (int x = 1; x <= n; ++x)
{
for (int y = 1; y <= n; ++y)
{
... | C++ | 6d47da375461c228bc70b117887cba33 | bacc416f69dfc1f2e950d51fb22d6c49 | 1,800 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define gcd __gcd
#define lcm(a, b) (a*b)/gcd(a, b) ... | C++ | 6d47da375461c228bc70b117887cba33 | 177ddc7c6a46b17f6de348030eb373f8 | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int maxn=70;
int cost[maxn][maxn][maxn],dp[maxn*20][maxn][maxn];
const int inf=0x3f3f3f3f;
int main()
{
int n,r,x,y,k,m;
scanf("%d%d%d",&n,&m,&r);
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
for(k=1;k<=n;k++)scanf("%d",&cost[i][j][... | C++ | 6d47da375461c228bc70b117887cba33 | 9318b32ffd1d618c8e7c347d45064a3b | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int car[60][60][60],dist[60][60][60],d[1001][60][60];
int main(){
int n,m,r,s,t,k;
cin>>n>>m>>r;
for(int i=0;i<m;i++)
for(int j=0;j<n;j++)
for(int k=0;k<n;k++){
cin>>car[i][j][k];
dist[i][j][k]=car[i][j][k];
}
for(int l=0;l<m;l++)
... | C++ | 6d47da375461c228bc70b117887cba33 | c96a6f4c7e6ba143ed195a889243a871 | 1,800 | PASSED |
# include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x << ", " << #y <... | C++ | 6d47da375461c228bc70b117887cba33 | 99ea7414e8606b7d93bd9788d96f5785 | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int int_fast32_t
main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m,r,s,t,k;
cin>>n>>m>>r;
int dp[n+1][n+1][n],d[m+1][n+1][n+1];
for(int i=0;i<=n;++i) for(int j=0;j<=n;++j) for(int k=0;k<n;++k) dp[i][j][k]=1e8;
for(int c=1;c<=m;++... | C++ | 6d47da375461c228bc70b117887cba33 | c468bb610603d438c972c7759afbe422 | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m,r,s,t,k;
cin>>n>>m>>r;
int dp[n+1][n+1][n],d[m+1][n+1][n+1];
for(int i=0;i<=n;++i) for(int j=0;j<=n;++j) for(int k=0;k<n;++k) dp[i][j][k]=1e8;
for(int c=1;c<=m;++c) for(int i=1;i<=n;++i) ... | C++ | 6d47da375461c228bc70b117887cba33 | cfc623301bbb7e4b667ab7cedc5a7e9d | 1,800 | PASSED |
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
#define R register
#define LL long long
const int N = 60 + 5;
int read() {
int x = 0, f = 1; char a = getchar();
for(; a > '9' || a < '0'; a = get... | C++ | 6d47da375461c228bc70b117887cba33 | 5c1328de1bfaf31890b628f68f39a7a4 | 1,800 | PASSED |
//#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy... | C++ | 6d47da375461c228bc70b117887cba33 | 6ef1eec247489879bdb40270fd10d276 | 1,800 | PASSED |
#------------------------------what is this I don't know....just makes my mess faster--------------------------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer ... | Python | 9c84eb518c273942650c7262e5d8b45f | 3efa832d96b478d2c89d224af50d44e6 | 1,100 | PASSED |
import math
class Vector:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
return Vector(self.x + other.x, self.y + other.y)
def __neg__(self):
return Vector(-self.x, -self.y)
def __sub__(self, other):
return self + -other
def __... | Python | 9c84eb518c273942650c7262e5d8b45f | d5b56f149fa49fb2debc41e5a87bd322 | 1,100 | PASSED |
n,d = map(int,input().split())
m = int(input())
ans = []
for i in range(m):
x1,y1 = map(int,input().split())
t1 = x1+y1
t2 = x1-y1
if t1>=d and t1<=(2*n-d) and t2>=(-d) and t2<=d:
ans.append('YES')
else:
ans.append('NO')
for i in ans:
print(i) | Python | 9c84eb518c273942650c7262e5d8b45f | 3eae4970aefecc4697176b28a7e24893 | 1,100 | PASSED |
n, d = map(int, input().split())
m = int(input())
for i in range(m):
x, y = map(int, input().split())
if y >= d - x and y <= x + d and y >= x - d and y <= -x - d + 2 * n:
print("YES")
else:
print("NO")
| Python | 9c84eb518c273942650c7262e5d8b45f | 1a448623d329856148589ee486d306ea | 1,100 | PASSED |
n, d = map(int, input().split())
def k(x, y):
if y >= x - d and y <= x + d and y >= -x + d and y <= -x + 2 * n - d:
return 1
else:
return 0
m = int(input())
for i in range(m):
x, y = map(int, input().split())
if k(x, y):
print("YES")
else:
print("NO") | Python | 9c84eb518c273942650c7262e5d8b45f | 2fbeac21cb82e505866d86997840c7d5 | 1,100 | PASSED |
n,d = map(int,input().split())
m = int(input())
a = []
for i in range(m):
x1,y1 = map(int,input().split())
t1 = x1+y1
t2 = x1-y1
if t1>=d and t1<=(2*n-d) and t2>=(-d) and t2<=d:
a.append('YES')
else:
a.append('NO')
for j in a:
print(j) | Python | 9c84eb518c273942650c7262e5d8b45f | 262e39e3fd4622c820f146bc86a2434e | 1,100 | PASSED |
import sys
import string
import math
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction
def mi(s):
return map(int, s.strip().split())
def lmi(s):
return list(mi(s))
def tmi(s):
return tuple(mi(s))
def mf(f, s):
return ma... | Python | 9c84eb518c273942650c7262e5d8b45f | 989159de6427129c5502f3dc5a4faad8 | 1,100 | PASSED |
n, d = map(int,input().split()) # co-ordinates of corn field
m = int(input()) # no of grasshopper
for i in range(m):
a,b = map(int,input().split())
eqn1 = a+b-d
eqn2 = -a+b-d
eqn3 = a+b-2*n+d
eqn4 = -a+b+d
if eqn1 >= 0 and eqn2 <= 0 and eqn3 <= 0 and eqn4 >= 0 :
print("YES")
else :
print("NO") | Python | 9c84eb518c273942650c7262e5d8b45f | f1280cc45535ef9e2a3f46777becbd31 | 1,100 | PASSED |
def check(n, d, x, y):
if (y >= -x + d) and (y <= 2 * n - d - x) and (y <= d + x) and (y >= x - d):
return True
return False
n, d = map(int, input().split())
m = int(input())
ans = []
for i in range(m):
x, y = map(int, input().split())
if check(n, d, x, y):
ans.append('YES')
else:
... | Python | 9c84eb518c273942650c7262e5d8b45f | 9fdd1b8a63688e25a54f4204fd37f6e4 | 1,100 | PASSED |
def rs(): return input().strip()
def ri(): return int(input())
def ria(): return list(map(int, input().split()))
def ia_to_s(a): return ' '.join([str(s) for s in a])
def solve(n, d, x, y):
# \ 0 = -x - y + d
# \\ 0 -x - y + d + 2 * (n-d)
# / 0 = x - y - d
# // 0 = x - y + d
return y >= -x+d and y ... | Python | 9c84eb518c273942650c7262e5d8b45f | 0cc28eb39376e69a909374838a4bc341 | 1,100 | PASSED |
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define fill(A,B) memset(A,B,sizeof(A))
#define For(i,A,B) for(int i=(A);i<(int)(B);i++)
#define rep(i,A,B) for(int i=(A);i<=(B);i++)
#define dep(i,B,A) for(int i=(B);i>=(A);i--)
#define re(i,A) for(int i=0;i<(int)(A);i++... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | e5f71f43cc63fad628cb78f31372d872 | 2,900 | PASSED |
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<bitset>
#include<iomanip>
#include<iostream>
#include<cmath>
using namespace std;
#define rep(i,x,y) for(i=x;i<=y;i++)
#define _rep(i,x,y) for(i=x;i>=y;i--)
#define REP(i,x,y) fo... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | 2e06c37dc07df7abf334cb1ba1a3aa98 | 2,900 | PASSED |
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
using namespace std;
#define fr(i,n) for(int i=0;i<n;i++)
#define fo(i,n) for(int i=1;i<=n;i++)
#define fe(i,n) for(__typeof(n.begin()) i=n.begin();i!=n.end();i++)
typedef pair<int, int> ii;
typedef long long... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | 58805d8ffa9427f6fb36c8b411182b28 | 2,900 | PASSED |
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <ctime>
//#include <cmath>
#include <vector>
#include <map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pint;
typedef pair<LL,LL> pll;
#define fi first
#define se second
typedef map<int,int> ma... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | 5d401dd2e01ec048af28156a2be22e3f | 2,900 | PASSED |
//while(true)rp++;
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<set>
#include<utility>
#include<vector>
using namespace std;
#define FF first
#define SS second
#define... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | 18be24d20b009386c22654c07aeae1de | 2,900 | PASSED |
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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 <cst... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | 4e2ba302bffb3b05e4b8fbc6980394ca | 2,900 | PASSED |
// Determinant
// 行列式(ぎょうれつしき)
#include<cstdio>
#include<algorithm>
void Get(long long &T)
{
char C;bool F=0;
for(;C=getchar(),C<'0'||C>'9';)if(C=='-')F=1;
for(T=C-'0';C=getchar(),C>='0'&&C<='9';T=T*10+C-'0');
F&&(T=-T);
}
void Get(int &T)
{
char C;bool F=0;
for(;C=getchar(),C<'0'||C>'9';)if(C=='-')F=1;
for(T... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | 7529dba2ef86c0e030c196216561d544 | 2,900 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class E
{
private static int MOD;
public static void main(String [] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStr... | Java | 3247c416952cd4335ec9319cd0ef0da2 | ce97b43c7c4a570a3026be64bc7f3856 | 2,900 | PASSED |
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.util.Collection;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.TreeSet;
import java.io.InputStream;
/**
* Bu... | Java | 3247c416952cd4335ec9319cd0ef0da2 | 5cce311b9ca94408bbd6f809bbb909be | 2,900 | PASSED |
#include<cstdio>
#include<cstring>
#include<algorithm>
#define mN 610
using namespace std;
struct lhy{
int x,y,next;
}edge[100010];
int h,l,n,m,p,ans,tot,N,x,y;
int f[mN][mN],sum[mN],son[mN],q[mN],st[mN],ed[mN],out[mN],in[mN];
inline void add(int x,int y)
{
edge[++tot].x=x;edge[tot].y=y;edge[tot].next=son[x];son... | C++ | 3247c416952cd4335ec9319cd0ef0da2 | 15cf254056dba3adc370756ed7bc313c | 2,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> ii;
typedef vector<ii> vii;
long long arr[100009],has[100009],cnt=0;
int r[]={0,-1,-1,-1,0,1,1,1},c[]={1,1,0,-1,-1,-1,0,1};
#define mp ... | C++ | a7846e4ae1f3fa5051fab9139a25539c | 40e1b003b3dd45d1e9b8ac5244e387b6 | 1,300 | PASSED |
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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 <cst... | C++ | a7846e4ae1f3fa5051fab9139a25539c | 2141a511f15c0297205c85dcb560c988 | 1,300 | PASSED |
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define s(n) scanf("%d",&n)
int main()
{
int i,n,k,j;
s(n);s(k);
double num,d;
d=sqrt(1+8*(long long int)k);
num=(1+d)/2;
if(n<(int)num)
printf("no solution\n");
else if(n==(int)num && (n)*(n-1)<=2*k)
printf... | C++ | a7846e4ae1f3fa5051fab9139a25539c | affebc1e5d99504c5c6ea7e5d54934eb | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.beg... | C++ | a7846e4ae1f3fa5051fab9139a25539c | 7fd94a44b010071eeff6d9ec90a07541 | 1,300 | PASSED |
#ifndef __MYLIB_H
#define __MYLIB_H
#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility> // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
#include<list>
using namespace std;
#endif... | C++ | a7846e4ae1f3fa5051fab9139a25539c | f9609000e01268381668d865242d184d | 1,300 | PASSED |
#include <iostream>
using namespace std;
#define FOR(i,a,b) for(int i = (int)a; i <(int)b; i++ )
int main() {
int n,k;
cin >> n >> k;
if ( k >= (n*(n-1))/2 ) {
cout << "no solution" << endl;
return 0;
}
int x = 1000*1000*1000*-1 + 1;
FOR(i,0,n) cout << 0 << " " << x++ << endl;
return 0;
}
| C++ | a7846e4ae1f3fa5051fab9139a25539c | 51c6ce122a8eafc6fdde5a747c7830aa | 1,300 | PASSED |
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<vector>
#define LL long long
#define oo 1000000000
using namespace std;
int main(){
int n,K,i,j;
while(scanf("%d %d",&n,&K)!=EOF... | C++ | a7846e4ae1f3fa5051fab9139a25539c | 3792532ee69d28ca51ee5e4d5efba951 | 1,300 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.