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;
char in[256], out[256];
int main()
{
//char in[300];
gets (in);
//char out[1000];
int i, j, outlen=0;
for (i=0; in[i]; i++){
if (in[i] == '.'){
if (out[outlen-1] != ' ' && outlen != 0){
out[outlen++] = ' ';
}
for (j=0; j<3; j++)
out[outlen+... | C++ | c7d8c71a1f7e6c7364cce5bddd488a2f | 141d4d2914a8e984b03c810ab287b27e | 1,700 | PASSED |
#include <iostream>
#define NN 100005
using namespace std;
int N,M,K,a,b,c,r,MIN=INT_MAX;
int G[NN][3],Keys[NN];
int main(){
cin>>N>>M>>K;
for(int i=0;i<M;i++)
cin>>G[i][0]>>G[i][1]>>G[i][2];
for(int i=0;i<K;i++)
cin>>r,
Keys[r]=1;
for(int i=0;i<M;i++)
if((Keys[G[i][0]]==0 and Keys[G[i][1]]==1)
o... | C++ | b0e6a9b500b3b75219309b5e6295e105 | 6e990cf713e4d3f989ca7cc6e2429725 | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define INF 2139062143
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cin.tie(0);
#define ll long long
#define fiab(i,a,b) for(int i=a;i<b;i++)
#define rfiab(i,a,b) for(int i=a;i>=b;i--)
#define ve vector
#define pb push_back
#define sz(x) (int)x.size()
ve<ve<pair<... | C++ | b0e6a9b500b3b75219309b5e6295e105 | e2bfdb619afc47e31f87081df6661685 | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,k;
cin>>n>>m>>k;
//vector<vector<int>> road(n,vector<int> (n,INT_MAX));
//map<pair<int,int>,int> road;
unordered_map<int,unordered_map<int,int> > road;
//unordered_map not possible -> no hash for pair
int u,v;
int l;
... | C++ | b0e6a9b500b3b75219309b5e6295e105 | a7f9c13e63005c4c4183185e90cc79e4 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int n, m, k, storge[MAXN];
int ans = 1e9 + 5;
bool visited[MAXN] = {};
vector < pair < int, int > > adj[MAXN];
int main()
{
//freopen("pyramid.in", "r", stdin);
//freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0); cin.tie(0);... | C++ | b0e6a9b500b3b75219309b5e6295e105 | fd643f838f096197822c6e8ffb344a2d | 1,300 | PASSED |
/* Ekla Cholo Re */
#include<iostream>
#include<sstream>
#include<iterator>
#include<vector>
#include<stack>
#include<set>
#include<unordered_map>
#include<map>
#include<deque>
#include<cassert>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<list>
#include<string>
#include<algorithm>
#include<utili... | C++ | b0e6a9b500b3b75219309b5e6295e105 | 6bbc0017f34cbc686fd8adf7967554db | 1,300 | PASSED |
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef vector<long long> vi;
typedef vector <vi> vii;
int s[1000000] ={0};
vi dfs_num;
vector <vector<pair<long long, long long>>> adj;
long long c=10e11;
void dfs(int u) {
//dfs_num[u]=1;
for (int j = 0; j < (int)ad... | C++ | b0e6a9b500b3b75219309b5e6295e105 | ecfa3c7844d14fee9859f90d1e912225 | 1,300 | PASSED |
#include <iostream>
#include <vector>
#include <queue>
#define int long long
const int INF = 200000000000000;
#define mp make_pair
using namespace std;
int answer = INF;
vector< vector< pair<int, int> > > graph;
vector<bool> stock;
vector<bool> visited;
main() {
int n,
m,
k;
cin >> n >> m >> k;
visited.resi... | C++ | b0e6a9b500b3b75219309b5e6295e105 | 23c15e1fe9679ecead48a431459b5905 | 1,300 | PASSED |
input()
a=list(map(int,input().split()))
q,r=sum(a)%2,0
for i in a:
if i%2==q:r+=1
print(r) | Python | 4c59b4d43b59c8659bf274f3e29d01fe | 1825ba72a5060d53c5c2983dfbbdcdd2 | 900 | PASSED |
d=b=0;n=int(input());a=[int(x) for x in input().split()];
for i in range(n):
if a[i]%2==0: d+=1
else: b+=1
if sum(a)%2==0: print(d)
else: print(b) | Python | 4c59b4d43b59c8659bf274f3e29d01fe | 320e1dfcb6eec96fbe998050756e536b | 900 | PASSED |
n,a=int(input()),list(map(int,input().split()))
even=list(filter(lambda x:x%2==0,a))
odd=n-len(even)
if odd%2!=0:
print(odd)
else:
print(len(even)) | Python | 4c59b4d43b59c8659bf274f3e29d01fe | ef51150391394c2b1d441e537c820640 | 900 | PASSED |
n=int(input())
lst=[int(i)for i in input().split()]
su=sum(lst)
for i in lst:
if (su-i)%2:
n-=1
print(n)
| Python | 4c59b4d43b59c8659bf274f3e29d01fe | f2e1666ec43b6fb75e610ee266a9490d | 900 | PASSED |
n=int(input())
a=list(map(int, input().rstrip().split()))
o=0
e=0
for i in range(n):
if a[i]%2==0:
e+=1
else:
o+=1
if sum(a)%2==1:
print(o)
else:
print(e) | Python | 4c59b4d43b59c8659bf274f3e29d01fe | 211a5b449c3639fc88dac0ca1f8da3dd | 900 | PASSED |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 4 21:43:50 2020
@author: vru
"""
n = int(input())
x = []
x = input().split()
s = 0
flag = 0
for i in range(len(x)):
x[i] = int(x[i])
s = s + x[i]
for i in range(len(x)):
if (s-x[i])%2 ==0:
flag = flag + 1
print(flag)
| Python | 4c59b4d43b59c8659bf274f3e29d01fe | 9a6b365ab66673da65907f078d87540c | 900 | PASSED |
n = int(input())
p = input().split()
odd = 0
even = 0
oddness = 0
for i in p:
if int(i)%2 == 0:
even += 1
else:
oddness += 1
odd += 1
if oddness%2 == 0:
print(even)
else:
print(odd)
| Python | 4c59b4d43b59c8659bf274f3e29d01fe | 9e151819a7122008829647834eaf4da2 | 900 | PASSED |
n=int(input())
L=list(map(int,input().split()))
imp=0
s=0
for i in range(n):
if L[i]%2==1:
imp=imp+1
if imp%2==1:
if imp>2:
s=imp
else :
s=1
else:
s=n-imp
print(s) | Python | 4c59b4d43b59c8659bf274f3e29d01fe | be3d92ee184040b7c3514af455e70f68 | 900 | PASSED |
n=int(input())
l=[int(x) for x in input().split()]
s=sum(l)
c=0
for x in range(len(l)):
if (s-l[x])%2==0:
c+=1
print(c) | Python | 4c59b4d43b59c8659bf274f3e29d01fe | 4efd7e292ce29e47ba53edc266974be3 | 900 | PASSED |
n=int(input())
l=list(map(int,input().split()))
k=0
for x in l:
if x%2: k+=1
if k==n and n%2==0: print(0)
elif k%2: print(k)
else: print(n-k) | Python | 4c59b4d43b59c8659bf274f3e29d01fe | c0cfc8c3e50fb1439810029215794dec | 900 | PASSED |
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
int const MAX = 200000 + 10;
pair<int, pair<int, int>> traps[MAX];
int soldier[MAX];
bool segUnion(int k,int t,int n) {
int n1 = (n - k);
vector<pair<int, int>> points(2 * n1);
for (int i = 0; (i+k) < n; ++i) {
points[... | C++ | 14d158dd02d65096946445e14a5f210d | 801784f4bbe28c43dab8c48e078784ec | 1,900 | PASSED |
#include <cstdio>
#include <utility>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
class segTree
{
int* segarr;
int n;
int constructTreeUtil(int arr[], int si, int as, int ae);
int queryUtil(int qs, int qe, int ss, int se, int si);
void updateUtil(int i, int si, int ... | C++ | 14d158dd02d65096946445e14a5f210d | 1973ed563dc78b98f9a372ee53239403 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int M, N, K, T;
const int MAXN = 2e5 + 15;
int A[MAXN];
vector<pair<int, pair<int, int> > > R;
int main()
{
ios::sync_with_stdio(false);
cin >> M >> N >> K >> T;
for (int i = 0; i < M; ++i)
cin >> A[i];
sort(A, A + M);
R.resize(K);
in... | C++ | 14d158dd02d65096946445e14a5f210d | e5138ccdd5124a007034aba6edfe41d2 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int m, n, k, t;
const int MAXN = 2e5 + 2;
int a[MAXN];
struct Trap {
int l, r, d;
Trap(int _l = 0, int _r = 0, int _d = 0) {
l = _l;
r = _r;
d = _d;
}
bool operator < (const Trap a) const {
return d < a.d;
}
void print() {
printf("(%d, %d, %d)\n", l, r, d... | C++ | 14d158dd02d65096946445e14a5f210d | f52b806afc7f1b3a907800f7bfba3f61 | 1,900 | PASSED |
#pragma GCC optimize(2)
#include<bits/stdc++.h>
//#define int long long
using namespace std;
const int N=2e5+10;
int m,n,k,tt,a[N],vis[N],L,R,cnt[N];
struct node{int l,r,d;}t[N];
int cmp(int a,int b){return a>b;}
inline int check(int mid){
int low=a[mid],tot=0; memset(cnt,0,sizeof cnt);
for(int i=1;i<=k;i++) if(t[i].... | C++ | 14d158dd02d65096946445e14a5f210d | 46dc81c187b462808ae75a10ce666b2c | 1,900 | PASSED |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define inf 1000000007
const int max_n = 2e5+10;
typedef long long ll;
struct node{
int x,y,z;
... | C++ | 14d158dd02d65096946445e14a5f210d | f4174738ed2105f71417aa9d6818f50d | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool mysort(pair<ll,pair<ll,ll> > a, pair<ll,pair<ll,ll> > b){
a.second.first=-a.second.first;
b.second.first=-b.second.first;
a.second.second=-a.second.second;
b.second.second=-b.second.second;
return a<b;
}
bool works(ll n,ll m,ll k,ll t, ll... | C++ | 14d158dd02d65096946445e14a5f210d | e45c6cb43f54de5211ccc39175fe835b | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int b[200001];
int m,n,k,t;
int a[200001];
pair<int,pair<int,int> >p[200001];
bool func(int x){
x=a[x-1]+1;
//cout<<x<<endl;
int temp=-1;
int cnt=0,ans=0;
for(int i=0;i<=n;i++){
b[i]=0;
}
for(int i=0;i<k;i++){
... | C++ | 14d158dd02d65096946445e14a5f210d | aff5dd6815ee55d977cf6b5a172eb3d3 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int a[200100];
struct T{
int l, r ,d;
}trap[200100];
int n, m ,k, t;
int pref[200100];
bool check(int x){
memset(pref, 0, sizeof(pref));
for(int i = 1; i <= k; ++i){
if(trap[i].d > x)
pref[trap[i].l]++, pref[trap[i].r+1]--;
}
int ... | C++ | 14d158dd02d65096946445e14a5f210d | b32365eaf49d99f1ee43e53eec8ede87 | 1,900 | PASSED |
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef pair<int, int> pt;
#define x first
#define y second
int m, n, k, t;
vector<int> l, r, d, a;
bool can(int x)
{
int mn = int(1e9);
for (int i = 0; i < x; i++)
mn = min(mn, a[i]);
vector<pt> segm;... | C++ | 14d158dd02d65096946445e14a5f210d | 11947c1fbeb516805b0166a765681803 | 1,900 | PASSED |
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
public class Review4 {
public static void main(String[] args) {
Scanner UserInput = new Scanner(System.in);
int num = UserInput.nextInt();
ArrayList<Integer> list = new ArrayList<>(num);
ArrayList<Integer> sorted = new ArrayL... | Java | c9744e25f92bae784c3a4833c15d03f4 | 242a9bd48de464f8d276104a7ddc60d9 | 1,300 | PASSED |
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main (String[] args) {
Scanner scanner = new Scanner (System.in);
try {
int size = scanner.nextInt ();
Integer[] raw = new Integer[size];
Integer[] sorted = new Integer[si... | Java | c9744e25f92bae784c3a4833c15d03f4 | 226a2434fb7912c9b7a63df4375a3352 | 1,300 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class One1 {
public static void main(String[] args)throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
in... | Java | c9744e25f92bae784c3a4833c15d03f4 | fa15ccf36cba3b60094cde8716f77f96 | 1,300 | PASSED |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class NewClass {
static final int INF = Integer.MAX_VALUE;
static void mergeSort(int[] a, int p, int r)
{
if( p < r )
{
int q = (p + r) / 2;
mergeSort(a, p, q);
mergeSort(a, q + 1, r)... | Java | c9744e25f92bae784c3a4833c15d03f4 | fea9f91384a5040524f3ee09fad76450 | 1,300 | PASSED |
import java.util.Scanner;
public class HelloWorld{
public static void main(String []args){
int n,a[];
Scanner in = new Scanner(System.in);
n=in.nextInt();
a=new int[n];
for(int i=0;i<n;i++)a[i]=in.nextInt();
int count=0,i1=0,i2=0,max=0,min=0,m1=0,m2=0;
if(n<2){
Syste... | Java | c9744e25f92bae784c3a4833c15d03f4 | f21add6b5a37fb09257043dc6c1e2c50 | 1,300 | PASSED |
import java.math.*;
import java.util.*;
public class BruteForce {
public static Scanner in =new Scanner(System.in);
/* public static String getB(int n,int l){
StringBuilder build=new StringBuilder();
while(n>0){
if(n%2==0)
build.append(0);
else... | Java | c9744e25f92bae784c3a4833c15d03f4 | 977ae249bc66a48cd2c7b8020e36b8be | 1,300 | PASSED |
import java.util.Scanner;
public class SorttheArray451b {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[]x=new int[n];
boolean tt = true;
int z=0;
int b=0;
for (int i = 0; i < n; i++) {
x[i... | Java | c9744e25f92bae784c3a4833c15d03f4 | e3cd162916e50b00fa9f76d8d8b9179f | 1,300 | PASSED |
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author uuu
... | Java | c9744e25f92bae784c3a4833c15d03f4 | 7caa42b83fd5265410190d859287892d | 1,300 | PASSED |
/* package whatever; // 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 final class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
BufferedRea... | Java | c9744e25f92bae784c3a4833c15d03f4 | 8106152794dd0928acaeebb11721ea9e | 1,300 | PASSED |
import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class B451
{
static class FastReader
{
BufferedReader br;
Stri... | Java | c9744e25f92bae784c3a4833c15d03f4 | 186e1a469f3e5c9a4c26d2f945e97e21 | 1,300 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF 1000000000000
#define NEG_INF -1000000000000
#define pll pair<... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | edecc2e183a671f88510c266c1f9e186 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100010;
const int mod=1000000007;
int vis[N];
struct node{
ll x,y,z,id;
bool friend operator <(node a,node b){
return make_tuple(a.x,a.y,a.z)<make_tuple(b.x,b.y,b.z);
}
}a[N],b[N];
ll cal(int id1,int id2) {
return (a[... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | 3f79eb25c413cc463fae0e7fff91744e | 1,900 | PASSED |
//include <paBezanAshghal>
#include <bits/stdc++.h>
#define Time printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define For(J,R,K) for(int J=R;J<K;++J)
#define Rep(I,N) For(I,0,N)
#define MP make_pair
#define ALL(X) (X).begin(),(X).end()
#define SF ... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | cb24eda69356a1e9acb44beb9f366fe6 | 1,900 | PASSED |
//include <paBezanAshghal>
#include <bits/stdc++.h>
#define Time printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define For(J,R,K) for(int J=R;J<K;++J)
#define Rep(I,N) For(I,0,N)
#define MP make_pair
#define ALL(X) (X).begin(),(X).end()
#define SF ... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | 8b4c2eada4c5938c45755bc506e4072c | 1,900 | PASSED |
//include <paBezanAshghal>
#include <bits/stdc++.h>
#define Time printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define For(J,R,K) for(int J=R;J<K;++J)
#define Rep(I,N) For(I,0,N)
#define MP make_pair
#define ALL(X) (X).begin(),(X).end()
#define SF ... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | 5f0b4848097a09bb14a3e81427a05153 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x)
#define memset0(x) memset((x), 0, sizeof(x))
#define memsetM1(x) memset((x), -1, sizeof(x))
#define F first
#define S second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef tuple<int, int, int, int> Tiii;... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | b813d747856563ac833c815cd2f739c0 | 1,900 | PASSED |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vec = vector<int>;
#define for0(i, n) for(int i = 0; i < n; ++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | c1fa913e3b4a55b6f550921de48113c6 | 1,900 | PASSED |
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
#define fi first
#define se second
#define LL long long
using namespace std;
const int N = 1e6 + 7;
const int mod = 1e9 + 7;
const int B = 317;
int n;
int a[N];
pair < pair < int , int > , pair < int , int > > p[N];
map < pair < int , int > , vector < int > ... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | 725df98096908c06b2983dd7d36050cf | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define me(a, b) memset(a, b, sizeof(a))
#define IOS() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const int maxn = 5e5+5;
struct point{
ll x, y, z;
int vis;
... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | 1e2b57d027c04517c14e364b06f035a5 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull unsigned long long
#define ll ... | C++ | 3d92a54be5c544b313f1e87f7b9cc5c8 | 2d5f1038da11765e7634bf9971aa98a4 | 1,900 | PASSED |
#include<stdio.h>
#include<string.h>
int main()
{
int n, i, j, count = 0;
scanf ("%d", &n);
char str[n][102];
for (i = 0; i < n; i++) {
scanf ("%s", str[i]);
}
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
if ((j + 1) < n && str[i][j + 1]=='o')
... | C | 03fcf7402397b94edd1d1837e429185d | 9af15124a2eda317f02851efadfb158f | 1,000 | PASSED |
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int i, j;
char a[102][102];
for (i = 1; i <= n; i++)
scanf("%s", a[i]);
for (i = 1; i <= n; i++)
for (j = n; j > 0; j--)
a[i][j] = a[i][j-1];
for (i = 1; i <= n; i++){
a[0][i] = 'a';
a[n+1][i]... | C | 03fcf7402397b94edd1d1837e429185d | 18190a2e4bc0845f4d7473974f862bd9 | 1,000 | PASSED |
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int i, j;
char a[1002][1002];
for (i = 1; i <= n; i++)
scanf("%s", a[i]);
for (i = 1; i <= n; i++)
for (j = n; j > 0; j--)
a[i][j] = a[i][j-1];
for (i = 1; i <= n; i++){
a[0][i] = 'a';
a[n+1][... | C | 03fcf7402397b94edd1d1837e429185d | bcd09fbf55eaa5d57283e5dd185ea73a | 1,000 | PASSED |
#include<Stdio.h>
int main()
{
int i,j,n,c=0;
scanf("%d",&n);
char s[105],a[n][n];
for(i=0;i<n;i++)
{
scanf("%s",s);
for(j=0;j<n;j++)
a[i][j]=s[j];
}
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
c=0;
if(a[i-1][j]=='o'&&i>0)
... | C | 03fcf7402397b94edd1d1837e429185d | bf29f3150eeb29803f093b532a3d9f8d | 1,000 | PASSED |
#include <stdio.h>
int main()
{
int n, i, j;
char a[105][105];
scanf("%d", &n);
for(i=0; i<n; i++)
scanf("%s", &a[i]);
int flag=0, sum;
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
sum=0;
if(a[i][j+1]=='o')
sum++;
if(a[... | C | 03fcf7402397b94edd1d1837e429185d | c689be621e26d936dcc6e2fd8b98e065 | 1,000 | PASSED |
#include<stdio.h>
int main()
{ int n,i,j,count=0;
scanf("%d",&n);
char a[n+1][n+1];
for(i=0;i<n;i++)
{
scanf("%s",&a[i]);
}
int flag =0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{ count =0;
if(i-1>=0)
{
if(a[i-1][j]=='o')
... | C | 03fcf7402397b94edd1d1837e429185d | 4990d1f5558fb7041f5cac14bdbafed3 | 1,000 | PASSED |
#include <stdio.h>
int main()
{
int n, k, i, j, flag, count;
char a[111][111];
scanf ("%d", &n);
for (i = 0; i < n; i++) {
scanf ("%c", &k);
for (j = 0; j < n; j++) {
scanf ("%c", &a[i][j]);
}
}
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {... | C | 03fcf7402397b94edd1d1837e429185d | 83c85093139c0233d629a54b5ea997c4 | 1,000 | PASSED |
#include<stdio.h>
int i,j,n,c=0;
char a[101][101];
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf(" %c",&a[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[i-1][j]=='o' && i-1>=0 )
c++;
if(a[i][j-1]=='o' && j-1>=0)
c+... | C | 03fcf7402397b94edd1d1837e429185d | 98c8ac51cb3f1ce37d8693b11cf96f03 | 1,000 | PASSED |
#include<stdio.h>
int i,j,n,c=0;
char a[101][101];
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf(" %c",&a[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[i-1][j]=='o' && i>=1 )
c++;
if(a[i][j-1]=='o' && j>=1)
c++;
... | C | 03fcf7402397b94edd1d1837e429185d | 3944af2d1e289f1cc6e6ecd84b3df9e9 | 1,000 | PASSED |
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,j,ocount=0;
char c[100][100];
scanf("%d ",&n);
for(i=0;i<n;i++)
{
scanf("%s",c[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if((i < (n-1)) && (c[i+1][j] == 'o'))
{
... | C | 03fcf7402397b94edd1d1837e429185d | ac6f9542b22e1d2c387028a1b707c142 | 1,000 | PASSED |
/*
Aleksandar "Al3kSaNdaR" Ivanović
292D - Connected Components
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <numer... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | f6ed2b98799109fc37d40f6eb5466321 | 1,900 | PASSED |
/*
Aleksandar "Al3kSaNdaR" Ivanović
292D - Connected Components
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <numer... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | 8330ce29f34f2ac0b885b39a512173fb | 1,900 | PASSED |
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair <int, int> ii;
const int Maxn = 505;
int n, m;
vector <ii> neigh[Maxn];
int k;
int l, r;
bool taken[Maxn];
int res;
void Traverse(int v)
{
taken[v] = true;
for (int i = 0; i < neigh[v].size(); i++) {
ii u = ne... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | a3b8ca65a2ed5f02ccc4c5065b80c3b1 | 1,900 | PASSED |
#include<iostream>
#include<string>
#include<math.h>
#include<queue>
#include<stack>
#include<stdio.h>
#include<map>
#include<set>
#include<memory.h>
#include<algorithm>
#include<vector>
using namespace std;
int n,m,k,par[502];
int find(int x){
if(par[x]==x)return x;
return par[x]=find(par[x]);
}
int x[10002],y... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | d7d5d701a3d3cc2819691417481b840a | 1,900 | PASSED |
#include <iostream>
#include <cstdio>
using namespace std;
int p[10004];
int pre[10004];
int suf[10004];
int x[10004];
int y[10004];
int rank[10004];
int get(int pos)
{
if(p[pos] == pos) return pos;
else return get(p[pos]);
}
int main()
{
int n, m;
scanf("%d%d", &n, &m);
for(int i = 0; ... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | c528b7a65f7eccd2d93a9c65df479bab | 1,900 | PASSED |
/*===============*\
| ID: TMANDZU |
| LANG: C++ |
\*===============*/
//Tornike Mandzulashvili
//#pragma comment(linker,"/STACK:256000000")
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <map>
#inclu... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | d7671b79f543ac566c70fd724bcf1529 | 1,900 | PASSED |
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int Maxn=505;
int n,m;
vector< pair< int,int > > neigh[Maxn]; //��¼����
int k,l,r;
bool taken[Maxn]; //�൱��used
void Traverse(int v) ... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | 9f59f9e808087bb1e541fad774917784 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<bool,bool> pbb;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
#define ld long double
#define rep(i,n) for (int i=1;i<=n;++i)
int par[505];
int rnk[505];
int res,u[10005],v[10005];
inline void ... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | 96311b72502a9932a4182c4323e80fb2 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n, m, x, y, u, v, k, ans;
int p[501], a[10010], b[10010];
int l[501], r[501];
inline int find(int x) {
if (p[x] == x)
return x;
return p[x] = find(p[x]);
}
int main(int argc, char **argv) {
scanf("%d%d", &n, &m);
int idx = 1;
for (int i = 1; i <= n; ++i)
p[i... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | 91e44155033e14b77c026dd7db646195 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n, m, x, y, u, v, k, ans;
int p[501], a[10010], b[10010];
inline int find(int x) {
if (p[x] == x) return x;
return p[x] = find(p[x]);
}
int main(int argc, char **argv) {
scanf("%d%d", &n, &m);
for (int i = 1; i <= m; ++i)
scanf("%d%d", &a[i], &b[i]);
scanf("%d... | C++ | 357e4fe985e9eb0c10b9b363fce79ae7 | 06e68a99264f1929b4ea10c2159a27fa | 1,900 | PASSED |
#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
const int N = 1001;
int a[N] = {};
for (int i = 0; i < n; ++i) {
int num;
cin >> num;
a[num] = true;
}
i... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | 8c6469faa6527a83bf11dc9da03746ad | 800 | PASSED |
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
using namespace std;
int main()
{
int i,j,k,n,m,a[1000],b[1000],t,flag =0;
cin>>t;
while(t--)
{
flag = 0;
cin>>n>>m;
for(j=0;j<n;j++)
{
cin>>a[j];
}
for(j=0;j<m;j++)
... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | e45a4d63385e002b0c1bf99c476b653a | 800 | PASSED |
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = 1e3+5;
int a[maxn],b[maxn];
int main()
{
int T;cin >> T;
while(T--)
{
int n,m;scanf("%d%d",&n,&m);
for(int i = 0;i < n;++i)
scanf("%d",a+i);
for(int i = 0;i < m;++i)
scanf("%d",b+i);
sort(a,a+n);
sort(b,b+m)... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | b181aa2cb6160af81044c8f85f819599 | 800 | PASSED |
#include<iostream>
#include<cstring>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n,m;
int flag[100001];
memset(flag,0,sizeof(flag));
cin >> n >> m;
int sign = 0;
int same;
for(int i=0;i<n;i++){
int a;
cin >> a;
flag[a] = 1;
}
for(int i=0;i<m;i++){
int a;
cin >> ... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | 33e054c110a12218fda97ff2abc8492e | 800 | PASSED |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int t, n, m, x;
cin >> t;
for (int q = 0; q < t; q++) {
cin >> n >> m;
vector<int> a, b;
for (int i = 0; i < n; i++) {
cin >> x;
a.push_back(x);
}
fo... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | c1d2daf1a2017195a5428b5f29d96812 | 800 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <utility>
#include <functional>
#include <algorithm>
using namespace std;
long long t;
int main(){
scanf("%lld", &t);
while(t--){
long long m,n;
bool a[1050];
for(long i=0; i<1050; ++i){a[i]=... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | 2b28cadccfe9a7a34a520ed6d159d164 | 800 | PASSED |
#include <iostream>
#include <cstring>
#include <cctype>
#include <string>
#include <math.h>
using namespace std;
int main()
{
int t; cin >> t;
while (t--) {
int ct = 0;
int n, m; cin >> n >> m;
int* a = new int[n];
int* b = new int[m];
for (int i = 0; i < n; i++) cin >> ... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | c714ecc01784f75cdd5ee39d926cc862 | 800 | PASSED |
#include <iostream>
using namespace std;
int comp(const void* a, const void* b)
{
return *(int*)a < *(int*)b ? -1 : *(int*)a > *(int*)b;
}
int main()
{
int t,n,m;
int* dataN;
int* dataM;
cin >> t;
while (t-- > 0) {
cin >> n >> m;
dataN = new int[n];
dataM = new int[m];
for (int i = 0; i < n; i++) {
c... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | 3b2f92bb19be25cc81ae5fdaf331358e | 800 | PASSED |
#include<iostream>
#include<unordered_map>
#define long long ll 1000;
using namespace std;
void solve()
{
int n, m;
cin >> n >> m;
unordered_map<int, int> mp;
/* code */
while(n--)
{
int a;
cin >> a;
mp[a] = 1;
}
int ans = -1;
while(m--)
{
... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | a89bc58d7ec8551c6e8be5ad390c9ad1 | 800 | PASSED |
#include<iostream>
#include<math.h>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include<list>
#include<stack>
#include<map>
#include<deque>
#include<string>
#include<set>
#include<unordered_map>
#define IOT ios_base::sync_with_stdio(0);cin.tie(0);
#define Mod 1000000007
#define repi(a,n) for(i... | C++ | 776a06c14c6fa3ef8664eec0b4d50824 | 704afbfa0e82134ce4c480c1b1f79b4b | 800 | PASSED |
for i in range(int(input())):
a, b = map(int, input().split())
print(0.5 + a / (b << 4) if 4 * b > a else 1 - b / a if a else 1)
| Python | 92feda270834af751ca37bd80083aafa | ced6afd8e24e4094feee1568c8dd79d7 | 1,800 | PASSED |
for i in range(int(input())):
a, b = map(int, input().split())
print(0.5 + a / (b << 4) if 4 * b > a else 1 - b / a if a else 1) | Python | 92feda270834af751ca37bd80083aafa | dc84482addee5b8d48696042c1b66945 | 1,800 | PASSED |
for i in range(int(input())):
a, b = map(int, input().split())
print(0.5 + a / (b << 4) if 4 * b > a else 1 - b / a if a else 1)
# Made By Mostafa_Khaled | Python | 92feda270834af751ca37bd80083aafa | 9d54262cea0835c1d816bb2e1332b23e | 1,800 | PASSED |
t = int(input())
for _ in range(t):
a, b = map(int, input().split())
if a == 0 and b == 0:
print(1)
elif a == 0:
print(0.5)
elif b == 0:
print(1)
elif a > 4 * b:
print('%.10f' % ((a - b) / a))
else:
print('%.10f' % (a / 16 / b + 0.5))
| Python | 92feda270834af751ca37bd80083aafa | bf8b4889d013ddb9e890319e0d37efa5 | 1,800 | PASSED |
for i in range(int(input())):
a, b = map(int, input().split())
print(0.5 + a / (b << 4) if 4 * b > a else 1 - b / a if a else 1)
| Python | 92feda270834af751ca37bd80083aafa | 90f51945d4cdb7913eaea38288706fcd | 1,800 | PASSED |
t = int(input())
for i in range(t):
a, b = input().split()
a = int(a)
b = int(b)
print(0.5 + a / (b << 4) if 4 * b > a else 1 - b / a if a else 1) | Python | 92feda270834af751ca37bd80083aafa | 927ba7ac812248fa407596f4c3c8caec | 1,800 | PASSED |
for i in range(int(input())):
a, b = map(int, input().split())
print(0.5 + a / (b << 4) if 4 * b > a else 1 - b / a if a else 1)
| Python | 92feda270834af751ca37bd80083aafa | 6ccf3e7f638c431d24684dafa523e3c1 | 1,800 | PASSED |
#Infinity
#geti,getia
#Object # dcopy
#
#String # to_a
# "abc".to_a #=> ["a","b","c"]
#String # to_ia
# "1 2 3".to_ia #=> [1,2,3]
#
#Array # rsort,rsort!
# [1,3,2,4].rsort #=> [4,3,2,1]
#
#Integer # divisor
# 24.divisor #=> [1,2,3,4,6,8,12,24]
#
include Math
require "prime"
require "bigdecimal"
require "bigdeci... | Ruby | 92feda270834af751ca37bd80083aafa | 16a90dfb79ee836bf38b4a9c56aa3224 | 1,800 | PASSED |
n = gets.to_i
n.times do
a, b = gets.split.map(&:to_i)
if b == 0
o = 1.0
elsif a == 0
o = 0.5
elsif a < 4*b
o = (a*b + a*a*Rational(1,8))/(2*a*b)
else
o = (2*a*b - b*b*Rational(2,1))/(2*a*b)
end
p o.to_f
end
| Ruby | 92feda270834af751ca37bd80083aafa | 8c08a9ed8777163e242a36964b178a63 | 1,800 | PASSED |
t = input()
for _ in xrange(t):
a,b = map(float,raw_input().split())
if b==0:
print 1
continue
if a==0:
print 0.5
continue
if a>=4*b: res = (b*2+a-b*4)*b
else: res = a*a/8
print "%.7f"%(0.5+.5*res/(a*b)) | Python | 92feda270834af751ca37bd80083aafa | 29890c5ee0dbf6a92f680dc8a9b6bd44 | 1,800 | PASSED |
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
using namespace std;
#define pb push_back
#define sz(x) (int)(x).size()
const int N = 2e5 + 10;
struct DSU {
int n, parent[N], node[N], root[N];
DSU (int Q) : n(Q) {
for(int i = 0; i < n; i++) {
... | C++ | 810f267655da0ad14538c275fd13821d | 58382fed7ba6cb5fb9b7edf71d5dfd59 | 1,500 | PASSED |
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
using namespace std;
#define pb push_back
const int N = 1e5 + 5;
vector<int> g[N];
vector<int> vis, ans[2];
int n, m;
void makeG() {
for(int i = 0; i < n; i++)
g[i].clear();
for(int i = 0; i < m; i++... | C++ | 810f267655da0ad14538c275fd13821d | 36002bf61ede951a7ab8fb342cf9c7f8 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int n,m;
int color[100005];
int component[100005];
vector<int> G[100005];
vector<int> Pari , Arya;
vector<bool> visited(100005 , false);
bool not_bipartite = false;
map<int,int> count_comp;
void dfs(int u , int c , int comp) {
visited[u] = true;
color[u] = c;
... | C++ | 810f267655da0ad14538c275fd13821d | 51a4239afd08261dcdc019b0aa81628f | 1,500 | PASSED |
#include <bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define INF INT_MAX
#define MOD 1000000007
vvi adj(120000);
vvi c(2);
int mark[120000]... | C++ | 810f267655da0ad14538c275fd13821d | 2c4d0d0591982a7388a9d256402450c3 | 1,500 | PASSED |
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<cstring>
#include<string>
//#include<unordered_map>
using namespace std;
const int maxn=1e5+50;
int n,m,ans;
vector<int>v[maxn],v1,v2;
int col[maxn];
bool bfs(int x)
{
queue<int>q;
//m... | C++ | 810f267655da0ad14538c275fd13821d | 38e4e4176c576d2bc55748c0280e8258 | 1,500 | PASSED |
/*
*author: rits1272
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define MAX 1e9
#define MIN -1e9
#define INF 1e18
#define MOD 1000000007
#define int long long
#define FOR(x, n) for(int i=x; i<n; i++)
#define print(x) cout << "[" << #x << ":" << x << "] ";
#d... | C++ | 810f267655da0ad14538c275fd13821d | 7abaee523789da31b2ea6658b86ed033 | 1,500 | PASSED |
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#define MAXL 1299710
#define ll long long
#define inf 0x7f7f7f7f
using namespace std;
const int maxn= 1e5+7;
const ll mod=9999999967;
struct node
{
int to,w,next;
} edge[maxn<<1];
int head[maxn],d[maxn],color[maxn];
int cnt=... | C++ | 810f267655da0ad14538c275fd13821d | f65dd7325ff20ba1b6a2d3aa147f2283 | 1,500 | PASSED |
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#define MAXL 1299710
#define ll long long
#define inf 0x7f7f7f7f
using namespace std;
const int maxn= 1e5+7;
const ll mod=9999999967;
struct node
{
int to,w,next;
} edge[maxn<<1];
int head[maxn],d[maxn],color[maxn];
int cnt=... | C++ | 810f267655da0ad14538c275fd13821d | 0f4ea6da03edf2778478e09c3db0caac | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define rem 1000000007
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
#define v(x) vector<x>
#define pb(x) push_back(x)
#define ppb() pop_back()
#define mp(x,y) make_pair(x,y)
... | C++ | 810f267655da0ad14538c275fd13821d | 0f9c37c62a106d9aca07e35ef8966b98 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
inline int in() { int x; scanf("%d", &x); return x; }
const int N = 120021;
vector <int> vc[2];
vector <int> g[N];
int mark[N];
bool dfs(int v, int color = 2)
{
mark[v] = color;
vc[color - 1].push_back(v);
for(int u : g[v])
{
if(!mark[u] && dfs(u, 3 - color))
r... | C++ | 810f267655da0ad14538c275fd13821d | 921723eb70fa5160d6efa66427da9595 | 1,500 | PASSED |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int point = 0;
int a[300100];
int b[300101][2];
for (int i = 0; i < n; i++) {... | C++ | d34ffd75ef82111d1077db4b033d5195 | 3caba99ea44bf70bc9a6dfd1f0320021 | 1,500 | PASSED |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
using namespace std;
//Compiler version g++ 6.3.0
int main()
{
int t;
cin >> t;
std::vector<int> numb;
int n;
int cach[200005][3];
for(int tt = 0;tt<t;tt++){
cin >> n;
numb.clear();
numb.... | C++ | d34ffd75ef82111d1077db4b033d5195 | 77028c646808a12913476163aa410d58 | 1,500 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.