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<cstdio> #include<string> #include<ctime> #include<cmath> #include<cstring> #include<algorithm> #include<stack> #include<climits> #include<queue> #include<map> #include<set> #include<sstream> #include<unordered_map> using namespace std; typedef long long LL; typedef unsigned long long ul...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
00bb552060bafac549a8cc5c7f4bc1bd
1,600
PASSED
#include<iostream> #include<cstdio> using namespace std; typedef long long LL; const int N=3e5+100; LL a[N],b[N],c[N]; int main() { int w; cin>>w; while(w--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%lld%lld",a+i,b+i); LL sum=0; for(int i=1;i<=n;i++)//�����ܵ���ը���ʣ��Ѫ����Ϊ���� c { ...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
96004f040f6cde6fcd22f59eb8ebe6a6
1,600
PASSED
#include <iostream> using namespace std; const int N = 3e5+5; long long h[N],b[N]; int main() { long long i,j,k,n,t,x,d; for(cin >> t;t>0; t--){ cin >> n ; x=0; for(i=0; i<n; i++){ scanf("%lld%lld",&h[i],&b[i]); } for(i=0,x=0,k=2e12;i<n;i++) x+=max(0LL,h[i]-b[(i-1+n)%n]),k=min(k,h[i]-max(...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
f82720a8525dc8dd81dd0485e9771787
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int t,n,poz; long long int a[300009],b[300009],val,sol; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int i; cin>>t; while(t--) { cin>>n; sol=0; val=1000000000001; for(i=1;i<=n;i++) cin>>a[i]...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
e10bd560eb840740dc464d81798c8acc
1,600
PASSED
#include <iostream> #include <cstdio> using namespace std; int main(){ int T; scanf("%d",&T); while(T--){ int n; scanf("%d",&n); long long a[n]; long long b[n]; for(int i=0;i<n;i++) scanf("%lld%lld",&a[i],&b[i]); long long m; if(a[0]>b[n-1]) m=b[n-1]; else m=a[0]; int mark=0; for(int i...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
643084e697c15cff62644ae5a6c86f63
1,600
PASSED
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; long long a[300005],b[300005],c[300005]; int main() { long long i,j,t,n,sum,y; scanf("%lld",&t); while (t--) { sum = 0; scanf("%lld",&n); for (i=0; i<n; i++) scanf("%lld%lld",&a[i],&b[i]); c[0] ...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
f0a9509842fede8713ca54b67d4b1cdc
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); long long t; cin >> t; while(t--){ long long n; cin >> n; long long a[n],b[n],z = 0, no_bullets = 0; for(long long i = 0; i < n; i++){ cin >> a[i] >> b[i]; if(i > 0) no_bullets += max(z,a[i]-...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
b4e03237019ec8771168c67029cf88b3
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long t; scanf("%lld", &t); while(t--){ long long n; scanf("%lld", &n); long long a[n],b[n]; for(long long i = 0; i < n; i++){ scanf("%lld%lld", &a[i], &b[i]); } long long effect = 1e18, ind, z = 0; for(long long i ...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
b7406f98123fb69de4863c67d8e4aa0f
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int int main () { ll i1, i2, i3, t1, t2, ans; ll t, n, a[300050], b[300050], c[300050]; scanf("%lld", &t); for (i1 = 0; i1 < t; i1++){ scanf("%lld", &n); for (i2 = 0; i2 < n; i2++){ scanf("%lld", &a[i2]); scanf("%lld", &b[i2]); } c...
C++
414d1f0cef26fbbf4ede8eac32a1dd48
7d8d027ac9ed7cbdd63b4ae15165e66d
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 1; vector<int> g[MAXN]; vector<int> depend[MAXN]; struct operation { string type; int v, u; }; operation l[MAXN]; int val[MAXN]; void dfs(int v = 1) { if (l[v].type == "IN") { depend[v].emplace_back(v); val[v] = l[v]....
C++
3c058688183e5cd7dd91ae592ccd8048
b14a36c8c7ab1fff9bf81f7e8e83c42e
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 1; vector<int> g[MAXN]; list<int> depend[MAXN]; struct operation { string type; int v, u; }; operation l[MAXN]; int val[MAXN]; void dfs(int v = 1) { if (l[v].type == "IN") { depend[v].emplace_back(v); val[v] = l[v].v;...
C++
3c058688183e5cd7dd91ae592ccd8048
f2ebe8cbd4e11314844f1240e7fee7f5
2,000
PASSED
#include <iostream> #include <vector> using namespace std; #define pb push_back const int maxn = 1e6 + 5; enum NodeType {ZERO, ONE, AND, XOR, OR, NOT}; int n, fa[maxn]; NodeType t[maxn]; bool v1[maxn], v2[maxn], key[maxn]; vector<int> g[maxn]; bool dfs1(int x, int f) { fa[x] = f; vector<bool> c; for (...
C++
3c058688183e5cd7dd91ae592ccd8048
0bc9b4b2ac8022568118e539fdcdd71c
2,000
PASSED
/******************* Problem: Author:CXY1999 Status:Coding Head Vision 2.1 *******************/ #include<cstdio> #include<iostream> #include<cstring> #include<cstdlib> #include<climits> #include<vector> #include<set> #include<cmath> #include<queue> #include<utility> #include<algorithm> #define pb push_back #define BG b...
C++
3c058688183e5cd7dd91ae592ccd8048
b1f6e5beed108c26f2410630d050e21a
2,000
PASSED
#include <iostream> #include <map> #include <algorithm> #include <string> #include <vector> #include <iomanip> using std::cout; using std::cin; using std::string; using std::map; int left[1000001]; int right[1000001]; int ttype[1000001]; bool val[1000001]; bool evaled[1000001]; int leaves[500001]; map<int, bool> flip...
C++
3c058688183e5cd7dd91ae592ccd8048
208e4a12895e619a649b76481781f734
2,000
PASSED
#include <iostream> #include <map> #include <algorithm> #include <string> #include <vector> #include <iomanip> using namespace std; typedef struct Node { Node* left; Node* right; Node* parent; int _type; bool val; bool evaled; bool leftChild; bool flipped; int index; Node(int t...
C++
3c058688183e5cd7dd91ae592ccd8048
5d3aafdf8f6a0547318d263b878227a0
2,000
PASSED
#include <iostream> #include <map> #include <algorithm> #include <string> #include <vector> #include <iomanip> using std::cout; using std::cin; using std::string; using std::map; typedef struct Node { int left, right, ttype, val, evaled; } Node; Node node[1000001]; map<int, bool> flipped; int countLeaves = 0; boo...
C++
3c058688183e5cd7dd91ae592ccd8048
32a842a9ebd2562cfb265255dabfd409
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1000000; unordered_map<int, int> leaves; queue<int> marked; vector<int> node[N]; int type[N]; int mark[N]; void marklul(int ix) { if(mark[ix]==0) return; mark[ix]=0; // marked.push(ix); for(int i=0;i<node[ix].size();i++) { marklul(node[ix][i]); }...
C++
3c058688183e5cd7dd91ae592ccd8048
017fe7d901254a87cc2c288f1cf707a4
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1000000; unordered_map<int, int> leaves; queue<int> marked; vector<int> node[N]; int type[N]; int mark[N]; void marklul(int ix) { // if(mark[ix]==0) // return; // mark[ix]=0; marked.push(ix); // for(int child : (ArrayList<Integer>)node[ix]) // { ...
C++
3c058688183e5cd7dd91ae592ccd8048
aa02f28d91ed8f236c4f74e2d44b38ca
2,000
PASSED
#pragma optimization_level 3 #pragma GCC optimize("Ofast") //Comment optimisations for an interatcive problem - use endl #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> using namespace std; #define fastio ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0)...
C++
3c058688183e5cd7dd91ae592ccd8048
7dc7e63eff9725d7fda8fbda0d390d2c
2,000
PASSED
inp = input() n, m = inp.split() n = int(n) m = int(m) inp = input() a = inp.split() remainder = 0 for aith in a: names = int(aith) if names == 0: print(0, end=" ") else: pages = int((names + remainder) / m) remainder = (names + remainder) % m print(pages, end=" ")
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
3794a6ddf45465943e15bd3e76dc57e9
900
PASSED
n, m = map(int, input().split()) l = [int(x) for x in input().split()] g = [] tot = 0 for i in range(n): ans = 0 tot += l[i] if tot >= m: ans += tot//m tot = tot%m g.append(ans) print(*g)
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
1cbbef1b11a46251534ba0937db47ed9
900
PASSED
import sys input = sys.stdin.readline out = sys.stdout n, m = map(int,input().split()) a = list(map(int,input().split())) current = 0 for i in range(n): k = 0 if current != 0: z = m - current current = 0 k += 1 a[i] -= z if a[i] != 0: k += a[i] // m ...
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
f5e40322eb55da9e65c3b34ec79bc609
900
PASSED
inp = input().split(" ") pages = input().split(" ") days = inp[0] names = int(inp[1]) result = 0 npages = 0 np = 0 for i in range(int(days)): result += int(pages[i]) npages = int(result/names) print(npages - np) np = npages
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
344b7096d9f4b1910c825d8c456ec6a1
900
PASSED
n, m = map(int, input().split()) a = list(map(int, input().split())) a2, answer = 0, [] for i in range(n): a1 = a2 a2 += a[i] answer.append(a2//m - a1//m) print(*answer)
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
c4402364eb4b8a05975d220dd47f0b99
900
PASSED
n,m = map(int,input().split()) arr = list(map(int,input().split())) brr = [] brr.append( arr[0]//m ) if arr[0]//m == 0: page = arr[0] else: page = arr[0]%m for i in range(1,n): if page==0: page+=arr[i] brr.append(arr[i]//m) page=page%m # print("A") else: x = m - p...
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
2b1cd670748926dc0dc444aaa45b46a8
900
PASSED
m,n=map(int,input().split()) a=[int(i) for i in input().split()] z=0 for k in range(m): u=a[k]+z print((u)//n,end=" ") z=(u%n)
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
2e8f8062786d4443ebbfd9ad609494b8
900
PASSED
n,m=map(int,input().split()) b=list(map(int,input().split())) s=0 c=[] p=0 for j in range(n): s+=b[j] c.append(int(s/m)-p) p+=int(s/m)-p print(*c)
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
1a10fbd6d05435a2dfe64b61c9bc9a24
900
PASSED
#-------------Program-------------- #----Kuzlyaev-Nikita-Codeforces---- #-------------Training------------- #---------------------------------- n,m=map(int,input().split()) a=list(map(int,input().split())) now=0 for i in range(n): p,now=(now+a[i])//m,(now+a[i])%m print(p,end=" ")
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
580d6b63dbe40a7adafbd89654af3896
900
PASSED
n,m=map(int,input().split()) l=[int(i) for i in input().split()] pr=0 for i in l: curr=(pr+i) #print(curr) print(curr//m,end=' ') pr=curr%m
Python
a2085c2d21b2dbe4cc27a15fa4a1ec4f
7d9d0c2b798c27ba78d281069ca35307
900
PASSED
#include<bits/stdc++.h> #define max(a,b) (a>b?a:b) #define min(a,b) (a<b?a:b) #pragma GCC optimize(3) const int big=0x7fffffff; using namespace std; inline void read(int &x) { x=0;char ch=getchar();int pd=1; while(ch<'0'||ch>'9'){if(ch=='-')pd=-pd;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc...
C++
d5fbb3033bd7508fd468edb9bb995d6c
a6735283322c6f6ba8a429c7ef0f0d0a
1,700
PASSED
#include<iostream> #include<cstdio> #include<queue> #include<set> #include<vector> #define MAX 100005 #define LMAX 100000000000000 using namespace std; int vis[MAX]; struct road { int x, cost; }; vector<road> v[MAX]; set<int> s[MAX]; long long dis[MAX]; int n, m, k; void spfa() { int now,cos,next; for (int i = 0; i...
C++
d5fbb3033bd7508fd468edb9bb995d6c
9ab1b1caeac2f61a71144294cf096b7f
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef pair<int,int> pi; typedef pair<ll, ll> pll; typedef vector<ll> vl; typedef vector<pi> vpi; #define inf 10000000000000000 #define mod 1000000007 #define rep(i,a,b) for (int i = a; i <= b; i++) #defi...
C++
d5fbb3033bd7508fd468edb9bb995d6c
623b86eb2617129572463d3e18edfce7
1,700
PASSED
#include <iostream> #include <algorithm> #include <string.h> #include <stdio.h> #include <time.h> #include <ctime> #include <iomanip> #include <vector> #include <set> #include <map> #include <stack> #include <queue> #include <math.h> #include <stdlib.h> #define F first #define S second #define ll long long #define ull ...
C++
d5fbb3033bd7508fd468edb9bb995d6c
af20dcd53dfe1f35a0ec96844f761f73
1,700
PASSED
#include<bits/stdc++.h> using namespace std; vector<pair<long long,long long> > g[1000000]; set<long long> g1[1000000]; set<pair<long long,long long> > s; long long d[1000000]; int main() { long long n, m; cin >> n >> m; for (long long x, y, z, i = 1; i <= m; i++) { cin >> x >> y >> z; if...
C++
d5fbb3033bd7508fd468edb9bb995d6c
f73c9d3696f15e958ba7082b1af57259
1,700
PASSED
#include <cstdio> #include <algorithm> #include <vector> #include <cmath> #include <set> #include <unordered_set> #include <map> #include <cstring> #include <iostream> #include <stack> #include <queue> #include <numeric> #define rep(i, n) for(int i = 0; i < n; i++) #define repR(i, j, k) for(int i = j; i < k; i++) #defi...
C++
d5fbb3033bd7508fd468edb9bb995d6c
f02b5a7c63ff9776b89784daa39453e3
1,700
PASSED
//R<3S #include <bits/stdc++.h> #define hell 1000000007 #define PI 3.14159265358979323844 #define mp make_pair #define pb push_back #define fi first #define se second #define ALL(v) v.begin(), v.end() #define SORT(v) sort(ALL(v)) #define REVERSE(v) reverse(ALL(v)) #define endl "\n" #define vecmax(v) max_element(all(...
C++
d5fbb3033bd7508fd468edb9bb995d6c
4e731e5a91ff38de0296b2ac2dc86bb6
1,700
PASSED
#include<bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int M = 1e6 + 1; int n,m,p,d,uu,vv,ww,tot; int ft[M],book[M],dis[M]; vector <int> vis[M]; struct cmp { bool operator () (int a,int b) { return dis[a] > dis[b]; } }; priority_queue<int,vector<int>,cmp> Q; struct node { int v,last,w; }...
C++
d5fbb3033bd7508fd468edb9bb995d6c
5bdd56df00528497504284c8b032c870
1,700
PASSED
#include<bits/stdc++.h> #define int long long const int Maxn=1e5+10; using namespace std; int n,to[Maxn*2],first[Maxn*2],Next[Maxn*2],we[2*Maxn],cnt,dis[Maxn]; bool vis[Maxn]; map<int,bool>mp[100001]; priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >q; //first 存权,保证顶为权值最小,second存边值 int R()...
C++
d5fbb3033bd7508fd468edb9bb995d6c
5872916f2ed2b6d3cd4bbc6c705a87ca
1,700
PASSED
//************************ //* Date: 2018.9.19 * //* Problem: 229B * //* Author: xuziyuan * //************************ #include <bits/stdc++.h> #define rt0 return 0 #define rep(i,n) for(int i=0;i<n;i++) #define repn(i,n) for(int i=1;i<=n;i++) #define replet(c) for(char c='a';c<='z';c++) #define LL lo...
C++
d5fbb3033bd7508fd468edb9bb995d6c
02df372e8b86233e2d3fdba726554010
1,700
PASSED
s = raw_input() t = sum( s.count(x)&1 for x in set(s) ) print 'First' if t&1 or t==0 else 'Second'
Python
bbf2dbdea6dd3aa45250ab5a86833558
d696f88cccde2107b2e4aa60d7554307
1,300
PASSED
s=raw_input() h={} for i in s : if (h.get(i)==None): h[i]=1 else : h[i]+=1 cnt=0 for i in h: if (h[i] % 2 == 1) : cnt+=1 if (cnt%2==1 or cnt==0) : print 'First' else : print 'Second'
Python
bbf2dbdea6dd3aa45250ab5a86833558
4f940c5bec461c94b85a942c1b43be91
1,300
PASSED
def check(list): breaker=0 deleter=[] if len(s)%2==0: for z in range(len(list)): if list[z]%2==1: breaker+=1 deleter.append(z) if breaker==0: return True,'' else: return False,deleter else: ...
Python
bbf2dbdea6dd3aa45250ab5a86833558
dea5b54ede6a652f479e430de75ebd44
1,300
PASSED
from collections import Counter s = Counter(raw_input().strip()) c = sum(1 for i in s.values() if i % 2) print "First" if c % 2 or not c else "Second"
Python
bbf2dbdea6dd3aa45250ab5a86833558
03a87ed2941cdb8b973a59858dc84c40
1,300
PASSED
#include<stdio.h> #include<string.h> int main() { char str[1001]; scanf("%s", str); int ara[26],i,alp=0,even=0,p=1; for(i=0;i<26;i++) { ara[i] = 0; } for(i=0;str[i]!='\0';i++) { ara[str[i]-97]++; } for(i=0;i<26;i++) { if(ara[i]>0) { ...
C
bbf2dbdea6dd3aa45250ab5a86833558
89d4c969ca76b026033227088a17d691
1,300
PASSED
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ char tab[1001]; int occ[26]={0}; int k=1,l,i,j,count=0; gets(tab); l=strlen(tab); for(i=0;i<l;i++){ occ[tab[i]-97]++; } for(i=0;i<26;i++){ if(occ[i]%2!=0) count++; } if(count==0||count%2!=0)printf("First"); else printf("Seco...
C
bbf2dbdea6dd3aa45250ab5a86833558
e0e08676204b3efb89a1b54d7b1ae288
1,300
PASSED
#include<stdio.h> #include<string.h> int a1[30]; int main() { char s1[1000]; int len,i1,c=0; scanf("%s",&s1); len=strlen(s1); for(i1=0;i1<len;i1++){ if(s1[i1]=='a'){ a1[1]=a1[1]+1; } else if(s1[i1]=='b'){ a1[2]=a1[2]+1; } else if(s1[i...
C
bbf2dbdea6dd3aa45250ab5a86833558
5480f2dda389e653715ae1c149c7c2f7
1,300
PASSED
#include <stdlib.h> #include <stdio.h> #include <string.h> #define MAX 1010 int main(void) { int n, i; char s[MAX]; scanf("%s", s); int fr[26]; for (i = 0; i < 26; i++) fr[i] = 0; n = strlen(s); for (i = 0; i < n; i++) fr[s[i]-'a']++; int sum = 0; for (i = 0; i < 26; i++) ...
C
bbf2dbdea6dd3aa45250ab5a86833558
76b4690c7bb9b6f01776954bdc514bcd
1,300
PASSED
#include <stdio.h> #include <string.h> int main () { char a [1005]; int i, ara [26] = {0}; gets (a); int l = strlen(a); for (i = 0; i < l; i ++) { ara [a [i] - 97] ++; } int cnt = 0; for (i = 0; i < 26; i ++) { if (ara [i] & 1) cnt ++; } if (cnt...
C
bbf2dbdea6dd3aa45250ab5a86833558
8a10921cb45d2994c2eca1518822a69b
1,300
PASSED
#include<stdio.h> #include<string.h> int main() { char a[1000]; scanf("%s",a); int arr[26]={0},j,n,count=0; for(j=0;j<strlen(a);j++) { arr[a[j]-'a']=arr[a[j]-'a']+1; } for(j=0;j<26;j++) { if(arr[j]%2!=0) { count++; } } if(count==0 || count%2!=0) { printf("First\n"); } else { ...
C
bbf2dbdea6dd3aa45250ab5a86833558
9c2ea199ddfb7db40508525c45c19f61
1,300
PASSED
import java.util.Scanner; public class Crosswords { public static void main( String[] args ) { Scanner hi = new Scanner( System.in ); String[] badoof = hi.nextLine().split(" "); String[] badyoof = hi.nextLine().split(" "); int[] oof = new int[2]; int[] yoof = new int[badyoof....
Java
080a3458eaea4903da7fa4cf531beba2
afec1a0e65bd3eec20206ef747475477
1,100
PASSED
import java.io.File; import java.io.FileNotFoundException; import java.nio.file.FileAlreadyExistsException; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException{ Scanner scan = new Scanner(System.in); // Scanner scan = new Scanner(new File...
Java
080a3458eaea4903da7fa4cf531beba2
7fccf3c0306a1b840749d23b8562ca0d
1,100
PASSED
import java.util.*; public class JapaneseCrosswordsStrikeBack { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); int sum = 0; sc.nextLine(); for(int i = 0; i < n; i++) ...
Java
080a3458eaea4903da7fa4cf531beba2
480e9387c000013590dfb480da4663e7
1,100
PASSED
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Main main = new Main(); main.run(args); } private void run(String[] args) throws Exception { Scanner sc = new Scanner(System.in); // Scanner sc = new Scanner(new...
Java
080a3458eaea4903da7fa4cf531beba2
452335c9f4fab75a7b0ae00249cbabd5
1,100
PASSED
import java.io.*; import java.util.*; public class CF884B { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int x = Integer.p...
Java
080a3458eaea4903da7fa4cf531beba2
db91661a995bc84f9ee23de43233946b
1,100
PASSED
import java.util.*; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); int a[] = new int[n]; long sum=0; for (int i = 0; i < n; i++) { a[i] = input...
Java
080a3458eaea4903da7fa4cf531beba2
a86e788925908556fd8873405496ae27
1,100
PASSED
import java.util.*; public class Japanese_crossword { public static void main(String a[]){ Scanner s = new Scanner(System.in); int n = s.nextInt(); long x = s.nextLong(); int[] arr = new int[n]; for(int i=0;i<n;i++){ arr[i] = s.nextInt(); } if(arr.length==1 && arr[0]==x){ System.out.println("YES...
Java
080a3458eaea4903da7fa4cf531beba2
0062dde7e94165137d997bc8078ece50
1,100
PASSED
import java.util.*; public class Japanese_crossword { public static void main(String a[]){ Scanner s = new Scanner(System.in); int n = s.nextInt(); long x = s.nextLong(); int[] arr = new int[n]; for(int i=0;i<n;i++){ arr[i] = s.nextInt(); } if(arr.length==1 && arr[0]==x){ System.out.println("YES...
Java
080a3458eaea4903da7fa4cf531beba2
e71ac66f7bddd16e1f09ef8c0058a15d
1,100
PASSED
import java.util.*; public class Main { public static void main(String[] args) { Scanner in; in = new Scanner(System.in); int n, x; n = in.nextInt(); x = in.nextInt(); int tot = 0; for(int i=1; i<=n; i++) { int u; u = in.nextInt(); tot += u; ...
Java
080a3458eaea4903da7fa4cf531beba2
35078570d5ccf529216d90971272c592
1,100
PASSED
import java.util.Scanner; public class B { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n = scan.nextInt(), x = scan.nextInt(); int[] arr = new int[n]; int i; int sum = 0; for(i = 0 ; i < n ; i++) { arr[i] = scan.nextInt();...
Java
080a3458eaea4903da7fa4cf531beba2
4df14c4a36f5db5692b7e7483694829d
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MA=1e6+15; const int MB=1e5+5; const int INF=1e9+7; ll n,l; ll minn[MB],maxx[MB]; //记录每个序列最小值,最大值 ll dmax[MA]; // ll ans=0,ax; int flag[MB]; //自身是否满足 int main() { scanf("%lld",&n); for(int i=1;i<=n;++i){ scanf("%lld",&...
C++
b6b60d1e21e51771d6ba2a8b41619296
f2cbdb70d433740d65955bb424ddbfd8
1,400
PASSED
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; typedef long long ll; struct sq { int l, r; bool operator <(const sq& x) { return r < x.r; }//先排右边的 }; sq a[100010]; int n; int len; ll dans;//上升=n^2-不升 int bs(int num) {//升序序列中找第一个大于等于num的数 int i = 1, j = len; while (i < j) { int mid ...
C++
b6b60d1e21e51771d6ba2a8b41619296
073d5d9806401063e18e18cd9596af25
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ long long int n; cin >> n; long long int count=0; long long int ans=0; vector<long long int> a; vector<long long int> b; long long int p=n; while(p--){ int l; cin >> l; long long int mini=INT_MAX,maxi = INT_MIN; long long int temp[l]; bool f...
C++
b6b60d1e21e51771d6ba2a8b41619296
3c0cc87d1950868c91c1fb3a7b41087c
1,400
PASSED
#include <iostream> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstdio> #include <cstring> #include <iomanip> #include <string> #include <set> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; #define ms(a, x) memset(a, x, sizeof(a)) #define fore(i, a, n) for...
C++
b6b60d1e21e51771d6ba2a8b41619296
1699e1007afef23355027694b64f29c1
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6 + 2; int t[N]; void up1(int x){ for(x; x > 0; x -= (x & -x)){ t[x]++; if(x==0) return ; } } int get1(int x){ int res = 0; for(x; x <= 1000000; x += (x & -x)){ res += t[x]; } return res; } int main(){ ll...
C++
b6b60d1e21e51771d6ba2a8b41619296
6d27afaeda387a51e2c91246a2f34fc6
1,400
PASSED
#include <iostream> #include<stdio.h> #include<ctype.h> #include<string.h> #include <algorithm> #include <cstring> #include<queue> #include <stack> #include<map> using namespace std; const int maxn=1e6+5; int a[100005]; int zd; int zx; //100005 int b[maxn]; int c[maxn]; int main(){ int n; cin >> n; ...
C++
b6b60d1e21e51771d6ba2a8b41619296
9b731d0b11ad5bea1425746a924cb0a3
1,400
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1E5+10; int a[N],b[N]; int main() { int x,s=0; long long ans=0; scanf("%d",&x); for(int j=x;j--;) { int n,l,k=0; scanf("%d%d",&n,&l); a[s]=b[s]=l; while(--n) { scanf("%d",b+s); if...
C++
b6b60d1e21e51771d6ba2a8b41619296
509d08df7b24628a372ba4fcfee5d2e2
1,400
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX=1000000; vector<long long> fen(MAX+2, 0); void Update(int p){ for(int i=p; i<=MAX; i+=i&-i){ fen[i]++; } } long long Get(int p){ long long res=0; for(int i=p; i>0; i-=i&-i){ res+=fen[i]; } return res; } int main(){ ios_base::sync_with_stdio(false); ...
C++
b6b60d1e21e51771d6ba2a8b41619296
c5959d105524ecbcd89734049b2061a1
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long res=0, k=0; vector<int> b, c; for(int i=0; i<n; i++){ int x; cin >> x; int Max_ai=0, Min_ai=1e6; bool isAScent=0; for(int j=0; j<x; j++){ int y; cin...
C++
b6b60d1e21e51771d6ba2a8b41619296
4f83aad210c3e27843047ba49a8e81a0
1,400
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX=1000000; vector<long long> fen(MAX+2, 0); void Update(int p){ for(int i=p; i<=MAX; i+=i&-i){ fen[i]++; } } long long Get(int p){ long long res=0; for(int i=p; i>0; i-=i&-i){ res+=fen[i]; } return res; } int main(){ ios_base::sync_with_stdio(false); ...
C++
b6b60d1e21e51771d6ba2a8b41619296
0078b4be1153839a9661d6a21a621892
1,400
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned long long #define pb push_back #define ft first #define sd second using namespace std; const ll SHIFT = 1e5; struct func{ ll m, b; func(){ m = 0; b = 1e10 + 1; } //lo maximo que da es 10^5 * 10^5 + 0 = 10^10 func( ll ...
C++
8f511d06d2c28817b80f56d1153da805
37417b67dda2b99f718e259c17f892ea
2,700
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned long long #define pb push_back #define ft first #define sd second using namespace std; const ll SHIFT = 1e5; struct func{ ll m, b; func(){ m = 0; b = 1e10 + 1; } //lo maximo que da es 10^5 * 10^5 + 0 = 10^10 func( ll ...
C++
8f511d06d2c28817b80f56d1153da805
2a4f411df92b1b9c62f3c2bc35d97e89
2,700
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned long long #define pb push_back #define ft first #define sd second using namespace std; struct func{ ll m, b; func(){ m = 0; b = 1e10 + 1; } //lo maximo que da es 10^5 * 10^5 + 0 = 10^10 func( ll m_, ll b_ ){ m = m_; b...
C++
8f511d06d2c28817b80f56d1153da805
9419275a9344b87496f66e3c25c8cdbf
2,700
PASSED
#include <bits/stdc++.h> #define lsb(x) (x & (-x)) #define ll long long // 217 // 44 using namespace std; const ll INF = 1e18; const int MAXN = (int) 1e5; char lg[MAXN + 1]; int a[MAXN + 1], b[MAXN + 1]; vector <int> g[MAXN + 1]; int lvl[MAXN + 1]; int idl[MAXN + 1], idr[MAXN + 1]; int cnt; void dfs(int nod) { ...
C++
8f511d06d2c28817b80f56d1153da805
52d241407bfeee92c9cf43229996d4b8
2,700
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; const int maxn=100000+10; const ll inf=1e18; int n,rt[maxn],ls[maxn*20],rs[maxn*20],sz;ll A[maxn],B[maxn],f[maxn],k[maxn*20],b[maxn*20];bool vis[maxn*20]; int head[maxn],to[maxn<<1],nxt[maxn<<1],tot; void update(int &rt,int l,int r,ll _k,ll _b) { if(...
C++
8f511d06d2c28817b80f56d1153da805
6ee7ec309f6ef11fab2f0d11fa7e221f
2,700
PASSED
#include <stdio.h> #include <string.h> #include <algorithm> #define rep(i,st,ed) for (int i=st;i<=ed;++i) typedef long long LL; const LL INF=1000000000000000LL; const int N=200005; struct line {LL k,b;}; struct edge {int y,next;} e[N*2]; struct treeNode {int l,r; line rec;} t[N*51]; int a[N],b[N]; int root[N],tot; i...
C++
8f511d06d2c28817b80f56d1153da805
beb2c7780416cb2e4699707960e892ee
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back struct func{ int b; ll w; }; ll calc(func x,int a) { return (ll)x.b*a+x.w; } vector<vector<func> > leaves; const int N=1e5+5; vector<int> a(N),b(N); vector<vector<int> > graf(N); func newFunc; struct node{ int l,r;...
C++
8f511d06d2c28817b80f56d1153da805
4f706736bd93824f82234445d9dc7b9e
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back struct func{ int b; ll w; }; const int add=1e5; ll calc(func x,int a) { return (ll)x.b*a+x.w; } vector<vector<func> > leaves; const int N=1e5+5; vector<int> a(N),b(N); vector<vector<int> > graf(N); func newFunc; struct...
C++
8f511d06d2c28817b80f56d1153da805
83f302a5fa2ba1e9f2ac377292f2382f
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back struct func{ int b; ll w; }; const int add=1e5; ll calc(func x,int a) { return (ll)x.b*a+x.w; } vector<vector<func> > leaves; const int N=1e5+5; vector<int> a(N),b(N); vector<vector<int> > graf(N); struct node; node *n...
C++
8f511d06d2c28817b80f56d1153da805
c8ca7971dac7439d197c4bc663338b35
2,700
PASSED
#include<stdio.h> #include<vector> #include<set> #include<algorithm> #define inf 1000000000000000000ll #define N 100005 using namespace std; typedef long long ll; ll a[N],b[N]; vector<ll>vt[N]; ll ans[N],who[N]; struct node { ll x,y; node () {} node (ll a,ll b) {x=a,y=b;} bool operator < (const node &a...
C++
8f511d06d2c28817b80f56d1153da805
bee7ccc6cd67a94708c5003e1eced9ad
2,700
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin>>t; while(t--) { long long int l,x,a=14,b=10,c=6; cin>>l; x=l; x=x-a; x=x-b; x=x-c; if(x>=1) { cout<<"YES\n"; } else { ...
C++
8a6c3436f73286ca54f51fb90017a299
2171bf07ca1f55b5af61796444d7b670
800
PASSED
/* In the name of Allah, Most Gracious, Most Merciful */ #include<bits/stdc++.h> #include<numeric> using namespace std; //*** constant value *** const long double PI = 3.141592653589793238; const double EPS = 1e-6 ; //*** constant value *** //****** define ******** #define IOS ios...
C++
8a6c3436f73286ca54f51fb90017a299
b4c6b85b6366c53c51aa3ed58e6f7585
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; #define F first #define S second #define ALL(a) a.begin(),a.end() #define mp make_pair #define pb push_back #define FOR(i,a,b) for(int i=a;i<b;i++) #define FORN(i,a,b) for(int i=a;i<=b;i++) #de...
C++
8a6c3436f73286ca54f51fb90017a299
d497de664c1dbc28b6332e05c5677583
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; #define F first #define S second #define ALL(a) a.begin(),a.end() #define mp make_pair #define pb push_back #define FOR(i,a,b) for(int i=a;i<b;i++) #define FORN(i,a,b) for(int i=a;i<=b;i++) #de...
C++
8a6c3436f73286ca54f51fb90017a299
e269c1e19d5d00758569f2251de457b5
800
PASSED
#include <iostream> using namespace std; int main() { int n, t; cin >> t; for (int i = 0; i < t; i++) { cin >> n; if (n < 31) { cout << "NO\n"; continue; } if (n == 36) { cout << "YES\n5 6 10 15\n"; continue; } if (n == 40) { cout << "YES\n5 6 14 15\n"; continue; } if (n == 44) { cout...
C++
8a6c3436f73286ca54f51fb90017a299
0412a01f8480102ba21e7221257983ee
800
PASSED
#include <bits/stdc++.h> #include<queue> using namespace std; /************************/ typedef long long ll; const int N = 200000 + 10; const int M = 1000000007; const double eps = 1e-9; const double PI = acos(-1); const int oo = 1000000000; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; ...
C++
8a6c3436f73286ca54f51fb90017a299
a1c8d8c19f9a94844b363908b24f0eae
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t ; cin>>t; for (int i = 0; i < t; ++i) { int x ; cin>>x ; if(x<=30) cout<<"NO\n" ; else { if(x==40) { cout<<"YES"<<endl ; cout<<10<<" "<<15<<" "<<6<<" "<<9<<endl ; } ...
C++
8a6c3436f73286ca54f51fb90017a299
da4e9ff84ff3510c025990fd12c00b30
800
PASSED
#include<bits/stdc++.h> using namespace std; #define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define vi std::vector<int> #define vll std::vector<long long int> #define ll long long int #define ull unsigned long long int #define pi aco...
C++
8a6c3436f73286ca54f51fb90017a299
77d91d33b6ddc0bf80e8d950e6bea824
800
PASSED
#include <bits/stdc++.h> #define ll long long int #define fori(i, start, lim) for(long long i=start;i<lim;i++) #define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define set0(x) memset(x,0,sizeof(x)) using namespace std; template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);} void so...
C++
8a6c3436f73286ca54f51fb90017a299
6bd778bb80fda17c9f3fe8fbba8fc1e7
800
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<cstdlib> #include<cmath> #include<map> using namespace std; typedef long long ll; #define Inf 0x3f3f3f3f #define Maxn 20 int main() { int t, a, b, c, d; long int n; scanf("%d", &t); while...
C++
8a6c3436f73286ca54f51fb90017a299
c45e2caa41e46407a86b18c9b944b573
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n) { int ans[n+1]; int ans1[2*n+1],result1=0,result2=0; for(int i=1; i<=n; i++) { ans[i]=0; } for(int i=0; i<2*n; i++) { cin>>ans1[i]; } ...
C++
7f98c9258f3e127a782041c421d6317b
37fed8f0a7e3c4bd5ef3a37fb90835f0
800
PASSED
#include <iostream> using namespace std; int main() { int n; cin >> n; int max = 0; int size = 0; bool arr[n]; for(int i = 0; i < n; i++)arr[i] = false; for(int i = 0; i < 2 * n; i++) { int x; cin >> x; x--; bool single = !arr[x]; if(single) { arr[x] = true; size++; if(size ...
C++
7f98c9258f3e127a782041c421d6317b
e5ad6c04ea86991b95399690d2a3f392
800
PASSED
#include<iostream> using namespace std; int main(){ long long n,t,x[200100],s=0,k,maks=1; bool b[200100]={0}; cin>>n; for(t=1;t<=2*n; t++)cin>>x[t]; k=1;s++;b[x[1]]=1; for(t=2;t<=2*n; t++){//cout<<x[t]<<"*"<<s<<endl; if(b[x[t]]==0){s++;b[x[t]]=1;} else {s--;b[x[t]]=0;} if(s>maks)maks=s;} ...
C++
7f98c9258f3e127a782041c421d6317b
1ccf3d1f38443485db003e4ca6504672
800
PASSED
//#include <bits/stdc++.h> #include <iostream> #include <string.h> #include <string> #include <stdlib.h> #include <sstream> #include <stdio.h> #include <vector> #include <stack> #include <set> #include <map> #include <cmath> #include <iomanip> #include <algorithm> #include <utility> #include <queue> using namespace std...
C++
7f98c9258f3e127a782041c421d6317b
903b1b8b767d8eb7e343dfa6177550fc
800
PASSED
#include<iostream> #include<map> using namespace std; map <int,int> s; int main(){ long long n; cin>>n; n*=2; long long ans=0; while(n){ long long i; cin>>i; if(s[i]==0){ s[i]++; } else s.erase(i); if(s.size()>ans) ans=s.size(); n--; } cout<<ans; return 0; }
C++
7f98c9258f3e127a782041c421d6317b
44a3f14dd10b22e7edb14fb0c92638af
800
PASSED
#include <iostream> #include <bits/stdc++.h> #include <string.h> #include <math.h> using namespace std; int main() { long long int n; cin>>n; long long int arr[n]; long long int a; long long int i; long long int max=0; long long int pairs=0; for(i=0;i<n;i++) { arr[i]=i; }...
C++
7f98c9258f3e127a782041c421d6317b
2a6c36982c9655e4b457e11834f30d50
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,c=0,mx=c; cin>>n; int arr[2*n]; for(int i=0;i<2*n;i++) cin>>arr[i]; map<int ,int>mp; for(int i=0;i<2*n;i++) mp.insert({arr[i],0}); for(int i=0;i<2*n;i++) { if(mp[arr[i]]==0){ mp[arr[i]]=1...
C++
7f98c9258f3e127a782041c421d6317b
aa79117a284e370a382258629cd4a754
800
PASSED
#include<iostream> #include<algorithm> using namespace std; int a[200001]; bool f[200001]; int main() { int n,i,j,s=0,mmax=0; cin>>n; for(i=1;i<=2*n;i++) { cin>>a[i]; if(f[a[i]]) { f[a[i]]=0; s--; } else { f[a[i]]=1; s++; } mmax=max(mmax,s); } cout<<mmax; return 0; }
C++
7f98c9258f3e127a782041c421d6317b
07a9de6b3699434f5766f12fc908c0b8
800
PASSED
#include<bits/stdc++.h> using namespace std; long long n,b,ans,maxn,a[100001]; int main(){ scanf("%d",&n); for(int i=1;i<=2*n;i++){ scanf("%d",&b); a[b]++; if(a[b]==2) maxn--;//如果成双就配对,桌上的袜子的个数减 1 else maxn++;//否则桌子上的袜子个数加 1 ans=max(ans,maxn);//取最大值 } printf("%d\n",ans);//输出 return 0; }
C++
7f98c9258f3e127a782041c421d6317b
22ec1f656f7f7ff77b8119dc0b4cd85b
800
PASSED
#include<bits/stdc++.h> using namespace std; int i,n,b,ans,maxn,a[100001]; int main(){ scanf("%d",&n); for(i=1;i<=2*n;++i){ scanf("%d",&b); ++a[b]; if(a[b]==2) maxn--; else maxn++; ans=max(ans,maxn); } printf("%d",ans); }
C++
7f98c9258f3e127a782041c421d6317b
d5ae82f60eb3cfd2628b993dd4372c83
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,a,sum=0; cin >> n; map<int,vector<int>> parernt,childrens; parernt[1].push_back(0); for(int i = 2 ; i <= n ; i += 1){ cin >> a; parernt[i].push_back(a); childrens[a].push_back(i); } for(int i = 1 ; i <=...
C++
69edc72ec29d4dd56751b281085c3591
07052bf46751e63436bb92f3cf822aaf
1,200
PASSED