source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int ar[n]; for(int i = 0; i < n; ++i) scanf("%d", &ar[i]); set<int>s(ar, ar+n); vector<int>v(ar, ar+n); vector<int>:: iterator it1; ///it1 = find(v.begin(), v.end(), p); set<int>:: iterator ...
C++
a5ee97e99ecfe4b72c0642546746842a
34187bc20276b388679f0a9a9a67049e
1,100
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int n; long long int sum=0; cin>>n; vector<int> v(n); for(int i=0;i<n;i++) { cin>>v[i]; } sort(v.rbegin(),v.rend()); long long int temp; temp=v[0]; v[0]=v[1]; v[1]=temp; if(v[0]+v[2]>v[...
C++
a5ee97e99ecfe4b72c0642546746842a
ea0fdbff8db64d0a788d99a6a7c89fa5
1,100
PASSED
#include <bits/stdc++.h> //MEII BLACK //CMEII using namespace std; #define fi first #define se second #define fore(i,a,b) for (int i=a,ThxDem=b;i<ThxDem;i++) #define ford(i,a,b) for (int i=a,ThxDem=b;i>ThxDem;i--) #define pb push_back #define ALL(s) s.begin(),s.end() #define ll long long #define ull unsigned long lo...
C++
a5ee97e99ecfe4b72c0642546746842a
7ec90dcf73ba5ea81077ba996355c939
1,100
PASSED
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define...
C++
a5ee97e99ecfe4b72c0642546746842a
356a8f354bd9ecc19d0e928ef87f8005
1,100
PASSED
def inint(): return int(input()) def mp(): return map(int,input().split()) from bisect import bisect,bisect_left def sol(i,j): works=bisect(a,j)-bisect_left(a,i) if works==0:return A if i==j:return B*works m=(i+j)>>1 return min(B*(j-i+1)*works,sol(i,m)+sol(m+1,j)) n,k,A,B=mp() ...
Python
4695aa2b3590a0734ef2c6c580e471a9
e7c3fd91e0f1a37d1a760cf4f3954780
1,700
PASSED
from bisect import bisect, bisect_left n, k, A, B = map(int, input().split()) a = [int(i) for i in input().split()] a = sorted(a) l = 2**n def solve(i, j): num_a = bisect(a, j) - bisect_left(a, i) if num_a == 0: p = A elif i==j: p = B * num_a else: m = i+j>>1 p = min(B *...
Python
4695aa2b3590a0734ef2c6c580e471a9
776bdc7694e65ce64c24b22ac2213e20
1,700
PASSED
n,k,A,B = map(int,input().split()) a = list (map(int,input().split())) def bs (l,r,val,a): """ a normal binary search function that gonna search between l and r and find a position pos in array a which a[pos] <= val """ l1 = l r1 =r res = -1 while (l1 <= r1 ): mid = (l1+r1) // 2 # positio...
Python
4695aa2b3590a0734ef2c6c580e471a9
b7010ae52f84bc74bd4bd54bfc820616
1,700
PASSED
import bisect n, k, A, B = list(map(int, input().strip().split())) positions = sorted(list(map(int, input().strip().split()))) def solve(start, end, positions): # print(start, end, positions) avg_cnt = len(positions) if avg_cnt == 0: burn_cost = A else: burn_cost = B * avg_cnt * (end...
Python
4695aa2b3590a0734ef2c6c580e471a9
79be32e148cd0fe1011403c015e1f787
1,700
PASSED
n, k, A, B = list(map(int, input().strip().split())) positions = sorted(list(map(int, input().strip().split()))) def solve(start, end, positions): # print(start, end, positions) avg_cnt = len(positions) if avg_cnt == 0: burn_cost = A else: burn_cost = B * avg_cnt * (end - start) ...
Python
4695aa2b3590a0734ef2c6c580e471a9
6e3e9e914cb8a550df9e7771fb268ce0
1,700
PASSED
# -*- coding: utf-8 -*- # @Time : 2019/2/4 0:20 # @Author : LunaFire # @Email : gilgemesh2012@gmail.com # @File : C. Creative Snap.py def main(): n, k, a, b = map(int, input().split()) pos = list(map(int, input().split())) pos.sort() def search(interval_left, interval_right, index_left, inde...
Python
4695aa2b3590a0734ef2c6c580e471a9
1a457108fcd8e5d23512d6b4b0dac188
1,700
PASSED
import bisect def Bin(ot,do): return bisect.bisect_right(a,do) - bisect.bisect_left(a,ot) def rec(l,r): kol = Bin(l,r) z = x if kol>0: z = y*kol*(r-l+1) if l<r: z = min(z, rec(l, (l+r)//2)+rec(((l+r)//2)+1, r)) return z n, k, x, y = map(int, input().split()) a = list(m...
Python
4695aa2b3590a0734ef2c6c580e471a9
66528842a1666c3e28f285ef8293a598
1,700
PASSED
from sys import stdin # stdin=open('input.txt') def input(): return stdin.readline()[:-1] # from sys import stdout # stdout=open('input.txt',mode='w+') # def print1(x, end='\n'): # stdout.write(str(x) +end) # a, b = map(int, input().split()) # l = list(map(int, input().split())) # # CODE BEGINS HERE............
Python
4695aa2b3590a0734ef2c6c580e471a9
2ff65ce03f9313bf69b7cf4f384a1a68
1,700
PASSED
import sys input = sys.stdin.readline sys.setrecursionlimit(100000) def bs(num): low=0 high=k-1 while (low<high): mid=(low+high)//2 if l[mid]>num: high=mid-1 else: low=mid+1 if l[low]>num: return low else: return low+1 def solve(start,end): if start==end: if start in d: return 1*b*d[start] ...
Python
4695aa2b3590a0734ef2c6c580e471a9
74ad641218bef4b05929c7f54a1dfaae
1,700
PASSED
from bisect import bisect_left import sys sys.setrecursionlimit(10 ** 6) n, k, A, B = map(int, input().split()) a = sorted(map(int, input().split())) def dfs(l, r): num = bisect_left(a, r) - bisect_left(a, l) q = A if num == 0 else B * num * (r - l) if num == 0 or l == r - 1: return q else: ...
Python
4695aa2b3590a0734ef2c6c580e471a9
78e55ae3ada731863110b5ab86f1e8a8
1,700
PASSED
# include<map> # include<set> # include<queue> # include<stack> # include<deque> # include<math.h> # include<vector> # include<bitset> # include<stdio.h> # include<ctype.h> # include<iostream> # include<stdlib.h> # include<string.h> # include<algorithm> # define si size # define er erase # define sc scanf # define be b...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
64f718b91b3c1328cc000ba3e922e967
1,900
PASSED
#include <iostream> #include <fstream> #include <sstream> #include <cmath> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <cstdlib> #include <cstring> #include <map> #include <queue> #include <set> #include <queue> #include <stack> #include <list> #include <deque> #include <assert.h...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
4d79d6614a3c9306b1729940a8c68d0e
1,900
PASSED
#include <iostream> #include <fstream> #include <sstream> #include <cmath> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <cstdlib> #include <cstring> #include <map> #include <queue> #include <set> #include <queue> #include <stack> #include <list> #include <deque> #include <assert.h...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
b9ac8c1a60f0060c4227e192e8011164
1,900
PASSED
#include<iostream> #include<stdio.h> #include<algorithm> #include<set> using namespace std; struct node{ int l , r; }a[108]; int b[108]; bool cmp(const int & i, const int & j){ return a[i].r<a[j].r || a[i].r == a[j].r && a[i].l <a[j].l; } int ans[108]; set<int> s; set<int>::iterator it; int main(){ int...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
c61eed0fd3af36a98c93a28c337b5e78
1,900
PASSED
#include <iostream> #include <cstdlib> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <set> //#include <> #include <map> #define ll long long int #define FOR(a, b) for (int a = 0; a < b; a++) #define clr(a) memset(a, 0, sizeof(a)) using namespace std; const int inf = 1000000000; ...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
d32b31ee1dd72276e547ff9ba19d7bba
1,900
PASSED
#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #include<set> using namespace std; pair<pair<int,int>,int>p[105]; int ans[105]; set<int>s; int main() { int n,i,j; while(scanf("%d",&n)!=EOF) { for(i = 1; i<=n; i++) { scanf("%d%d",&p[i].first.second,&p[i]....
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
22c36b71a10c185bef3557ec65d81447
1,900
PASSED
#include <cstdio> #include <algorithm> using namespace std; const int N = 101; struct node { int l, r, id; }; struct node a[N]; int ans[N]; bool cmp(const node x, const node y) { if(x.r != y.r) return x.r < y.r; return x.l < y.l; } int main() { int n; scanf("%d", &n); for(int i = 0; i < n; i ++) { scanf("%d%d",...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
8abd0eac40fe0c50bdbdb2f0aeffebed
1,900
PASSED
#include <cstdio> #include <cctype> #include <vector> #include <set> #include <queue> #include <map> #include <stack> #include <iostream> #include <algorithm> #include <iterator> #include <string> #include <cstring> #include <sstream> #include <cstdlib> #include <cmath> #include <locale> #define _MP make_pair #define s...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
40f69125a1aad4a827914d582cbb4164
1,900
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<set> using namespace std; struct event{ int r,l,id; // public event(){}; event( int a, int b, int c){ r = a; l = b; id = c;} // event( int a, int b, int c) : r(a); l(b); id(c); {;} }; bool comp(event a, event b) { if( a.l != b.l) return a.l < b....
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
ace7e247d39e1b858b1029c3f8834008
1,900
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <algorithm> #include <stack> using namespace std; stack< pair< int , int > > s; int next[20000000]; int find(int a){ if( next[a] == a ) return a; return next[a] = find(next[a]); } int main(){ int n; for(int i = 0; i < 10000002; i++) next[i] = ...
C++
2e6e21ce00b438f51ae4b503ca7c0a1e
a8b1786bf97518442162f9619425bdb2
1,900
PASSED
#include <iostream> #include <sstream> #include <string> using namespace std ; int main() { string str ; int times ; cin >> times ; char row[8] ; char column[8] ; string reverseCol ; int i , j; for(int f = 0 ; f < times ; f++) { i = j = 0 ; cin >> str ; ...
C++
910c0e650d48af22fa51ab05e8123709
4d231ee1c4c5fda6efbaec5628aaca6e
1,600
PASSED
#include <iostream> #include <math.h> #include <stack> using namespace std; void alpherbet_presentation(char s[]) { int n = strlen(s) / sizeof(char); int i; for (i = 0; (s[i] >= 'A') && (s[i] <= 'Z'); i++) { switch (s[i]) { case 'A': s[i] = 1; break; case 'B': s[i] = 2; break; case 'C': s[i] = 3; break; ...
C++
910c0e650d48af22fa51ab05e8123709
874d50ea800ce67cc507434bdf0f53d1
1,600
PASSED
#include <stdlib.h> #include <stdio.h> #include <string> #include <math.h> #include <fstream> #include <iostream> #include <vector> #include <deque> #include <cstdlib> using namespace std; // Disable warning messages C4996. #pragma warning(disable:4996) //int fr(vector<int>, int); //int fr(vector<int>&, int); int ma...
C++
910c0e650d48af22fa51ab05e8123709
19c097bb6ca1bacdb6dde3ebd280462d
1,600
PASSED
#include <iostream> #include <conio.h> #include <math.h> int main() { long int n; scanf("%d", &n); getchar(); char **str = (char **)malloc(sizeof(char *)*n); for(int i = 0; i < n; i++) { str[i] = (char *)malloc(sizeof(char *)*100); gets(str[i]); } for(int i = 0; i < n; i++) { int metod = 0; bool met_a...
C++
910c0e650d48af22fa51ab05e8123709
d04747aa5c37d7592c3dbb1d055b361b
1,600
PASSED
#include <cstdio> #include <cstring> #include <cctype> #include<iostream> using namespace std; void chuyen(int a){ char ch; if (a>26) chuyen((a-1)/26); printf("%c",((a-1)%26)["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]); } /*void g(int t){ if(t){ g((t-1)/26); putchar(65+(t-1)%26); } */ int main() { in...
C++
910c0e650d48af22fa51ab05e8123709
7832f991682fecef373aa99e9ecfd6d3
1,600
PASSED
#include <iostream> #include <string> #include <sstream> #include <math.h> using namespace std; string rctoexc(string s) { string temp1,temp2,result; stringstream ss; int t; for(int i=1;i<s.length();i++) { if(s[i]>='0'&&s[i]<='9'){} else { temp1=s.substr(1,i-1); temp2=s.substr(i+1,s.length()-i-1); ...
C++
910c0e650d48af22fa51ab05e8123709
936f25d49f0b249c1142ce869a5a6147
1,600
PASSED
#include <iostream> #include <string> #include <stdlib.h> #include <cmath> using namespace std; bool IsDigital(char c); string ExcelToXY(string code); string IntColunmToStringColumn(int columnInt); int power(int x, int y); string XYToExcel(string code); bool IsExcelFormat(string code); void main() { int n; cin >> n;...
C++
910c0e650d48af22fa51ab05e8123709
7df5a1f8db9014e4b5133645f78995c5
1,600
PASSED
import java.io.*; import java.util.*; public class R150qB { @SuppressWarnings("unchecked") public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); int m = in.nextInt(); int...
Java
2d098058a553a70f30977266059f01c2
221545a1968d4b8cc70718b5d51f354d
2,000
PASSED
import java.io.*; import java.util.*; public class Main { void solve() { int n = in.nextInt(); int m = in.nextInt(); int h = in.nextInt(); int t = in.nextInt(); ArrayList<Integer>[] g = new ArrayList[n]; for (int i = 0; i < n; ++i) { g[i] = new ArrayList<>(); } for (int i = 0; i < m; ++i) { in...
Java
2d098058a553a70f30977266059f01c2
566e3aaf62fa56620b382c97cd6c3969
2,000
PASSED
import java.util.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; public class test{ // ArrayList<Integer> lis = new ArrayList<Integer>(); // ArrayList<String> lis = new ArrayList<String>(); // PriorityQueue<Integer...
Java
2d098058a553a70f30977266059f01c2
3fc68888663032eb8ea86bd1d7d33165
2,000
PASSED
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Random; import java.util.StringTokenizer; import java.util.TreeSet; public class BB { public static ...
Java
2d098058a553a70f30977266059f01c2
1af8d6866e6bc32df38bc67e25f251ac
2,000
PASSED
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Random; import java.util.StringTokenizer; import java.util.TreeSet; public class Hydra { public stat...
Java
2d098058a553a70f30977266059f01c2
9d95b0a61e563506b8504f9db772d1a6
2,000
PASSED
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); ...
Java
2d098058a553a70f30977266059f01c2
57afa970a0a03b5b59927045e5eaf3e6
2,000
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.Random; import java.util.Set; import java.util.StringTokenizer...
Java
2d098058a553a70f30977266059f01c2
f0e81b594628c094bd938a7a618484de
2,000
PASSED
import java.io.* ; import java.util.*; import static java.lang.Math.* ; import static java.util.Arrays.* ; public class B { public static void main(String[] args) throws IOException { // out.println("300 597 100 100"); // for( int i = 2; i < 300; i++){ // out.println(1 + " " + (1+i)); // ...
Java
2d098058a553a70f30977266059f01c2
81a596f8e67de7b03c3c497e3ed08d86
2,000
PASSED
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Comparator; import java.io.OutputStream; import java.util.RandomAccess; import java.io.PrintWriter; import java.util.AbstractList; import java.io.Writer; import java.util.List; import java.io.IOException; import java.util.Arrays; import ...
Java
2d098058a553a70f30977266059f01c2
88aeba51515173af8b625530dd1d4098
2,000
PASSED
import java.io.*; import java.util.*; public class Solution { private StringTokenizer st; private BufferedReader in; private PrintWriter out; private long[][] nsBig; private int[][] nsLst; public void solve() throws IOException { int n = nextInt(); int m = nextInt(); int u = nextInt(); int v = nextInt...
Java
2d098058a553a70f30977266059f01c2
01330411300f520703c90efdb7b14410
2,000
PASSED
import java.io.*; public class First { public static void main(String[] args) throws IOException { int n; int x, y; int max = 1; int count = 1; n = nextInt(); y = nextInt(); while (--n > 0) { x = y; y = nextInt(); if (y...
Java
1312b680d43febdc7898ffb0753a9950
babd7d59f1d6ab9a5fd4dbf6e1688989
900
PASSED
import java.util.Scanner; public class First { public static void main(String[] args) { int n; int x, y; int max = 1; int count = 1; Scanner sc = new Scanner(System.in); n = sc.nextInt(); y = sc.nextInt(); while (--n > 0) { x = y; ...
Java
1312b680d43febdc7898ffb0753a9950
31437a7c0c3dbf8ad2c3cf6f95142d1c
900
PASSED
import java.util.*; public class subSequence { public static void main(String []args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int arr[] = new int[n]; for(int i=0; i<n; i++) arr[i] = s.nextInt(); int ans = segment(arr); System.out.println(ans); } static int segment(int arr[]) {...
Java
1312b680d43febdc7898ffb0753a9950
e0c597021074414d1e73b80c0b9930af
900
PASSED
import java.util.Scanner; public class Codeforces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[100005]; int[] b = new int[100005]; int n = sc.nextInt(); a[0]=sc.nextInt(); b[0]=1; int ans=1; for(in...
Java
1312b680d43febdc7898ffb0753a9950
5dc1c8c6b84bc4277122264ff2779da3
900
PASSED
import java.util.*; public class Problem580A { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int runtime = scanner.nextInt(); int [] input = new int[runtime]; int realresult = 1; int newresult = 1; for(int i = 0; i < runtime; i++) { input[i] = scanner.nextInt(); ...
Java
1312b680d43febdc7898ffb0753a9950
1c9d34d0542395811a7af2e773df0122
900
PASSED
import java.util.*; public class kefa_and_first_steps { public static void main( String[] args ) { Scanner in = new Scanner( System.in ); int n = in.nextInt(), a = in.nextInt(), c = 1, m = Integer.MIN_VALUE; for ( int i = 1; i < n; i++ ) { int b = in.nextInt(); ...
Java
1312b680d43febdc7898ffb0753a9950
b811577d23278340ea415c44bf668f7b
900
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; ...
Java
1312b680d43febdc7898ffb0753a9950
77eadbbad0654b799f53730a5f5219e7
900
PASSED
#include<bits/stdc++.h> #include<iostream> using namespace std; int main() { int n,a[1000000],c=1,k=0,s[1000000],ans=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ if(a[i]<=a[i+1]){ c++; } else { s[k]...
C++
1312b680d43febdc7898ffb0753a9950
bc9a663a1c3e856795ed37a6b45cbc4e
900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,i,c=0; cin>>n; int a[n]; vector <int > v; int maxx =0; for(i=0;i<n;i++) { cin>>a[i]; v.push_back(a[i]); } for(i=0;i<v.size()-1;i++) { if(v[i+1]>=v[i]) { c++; } ...
C++
1312b680d43febdc7898ffb0753a9950
9b30287377bf80e2014ca62d3bbf2eb0
900
PASSED
// http://codeforces.com/contest/580/problem/A // #include <iostream> #include <algorithm> #include <vector> #define ll long long using namespace std ; int main () { std::ios::sync_with_stdio(false); ll start,end,n,local_max=0,global_max=0; bool check=false; cin>>n; cin>>start; if(n==1) {cout<<1<<endl; return ...
C++
1312b680d43febdc7898ffb0753a9950
c0064969a07e4177b1735bd6be1d8fa1
900
PASSED
#include <iostream> #include <cmath> #include <algorithm> using namespace std; #define fr first #define sc second #define mkp make_pair int n, m, k, sz, csz, ans; pair <int, pair <int, int> > d[3000]; bool u[100][100], u2[100][100], ok; char c[100][100]; bool in(int x, int y){ return ((0 <= x && x < n) && (0 <= y &...
C++
e514d949e7837c603a9ee032f83b90d2
723de8cc3f27e0fef1f9bbc7b23ba3a2
1,600
PASSED
#include <iostream> #include <cstring> #include <vector> #include <queue> #include <algorithm> #include <math.h> #include <string.h> #include <functional> #include <stdio.h> #include <deque> using namespace std; #define pii pair<int, int> #define si(a) scanf("%d", &(a)) #define sc(a) scanf("%c"...
C++
e514d949e7837c603a9ee032f83b90d2
5e176aea642a5ef602d3c1e1fee67746
1,600
PASSED
#include<bits/stdc++.h> #define ss second #define ff first using namespace std; char d[51][51]; bool vis[51][51]; int a,b,c,ans=0,u,t=0,w; vector<pair<int,pair<int,int> > > v; void func(int l,int r) { vis[l][r]=1; u++; if(l-1<=0 or r-1<=0 or l+1>a or r+1>b) { w=1; } if(d[l][r+1]=='.' and !vis[l][r+1]) { ...
C++
e514d949e7837c603a9ee032f83b90d2
b5dc09d37e462afa641c5f97389fb469
1,600
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #include <vector> #include <map> #include <set> #include <queue> #include <list> #include <cstdlib> #include <iterator> #include <cmath> #include <iomanip> #include <bitset> #include <cctype> using namespace std; #define ls...
C++
e514d949e7837c603a9ee032f83b90d2
40b4f647f277a62a905b4c7509c90bed
1,600
PASSED
#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> using namespace std; const int MAXN=55; const int d[4][2]={{0,1},{1,0},{0,-1},{-1,0}}; char s[MAXN][MAXN]; bool vis[MAXN][MAXN]; vector<vector<pair<int,int> > >world; vector<pair<int,int> >lake; void dfs(int x,in...
C++
e514d949e7837c603a9ee032f83b90d2
00421c4148b4b17e927d9af576293293
1,600
PASSED
#include <bits/stdc++.h> using namespace std; void BDAYA () { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int gcdB(int a, int b) { while(b) b ^= a ^= b ^= a %= b; return a; } int gcd(int a,int b) { if(!a) return b; return gcd(b%a,a); } int n,m,k,c,ccc=0; char a[60][60]; int vis[60...
C++
e514d949e7837c603a9ee032f83b90d2
9f8a6dd56c50e2a69de6996fb2ce5fd6
1,600
PASSED
#include <bits/stdc++.h> using namespace std; void BDAYA () { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int gcdB(int a, int b) { while(b) b ^= a ^= b ^= a %= b; return a; } int gcd(int a,int b) { if(!a) return b; return gcd(b%a,a); } int n,m,k,c,ccc=0; char a[60][60]; bool vis[6...
C++
e514d949e7837c603a9ee032f83b90d2
1e6f22da771010a7c4c48b9af7cb6875
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; bool vis[55][55],flag; vector<pair<int,pair<int,int> > >lake; int row,col; string str[55]; bool isin(int i,int j) { if(i>=0 && i<row && j>=0 && j<col)return true; return false; } int dfs(int x,int y) { int i,xx=0; ...
C++
e514d949e7837c603a9ee032f83b90d2
718764ec00e30f3b36f88cb8a10d0f6b
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; bool vis[55][55],flag; vector<pair<int,pair<int,int> > >lake; int row,col,cnt; string str[55]; bool isin(int i,int j) { if(i>=0 && i<row && j>=0 && j<col)return true; return false; } void dfs(int x,int y) { int i; ...
C++
e514d949e7837c603a9ee032f83b90d2
c0c97db29290f1887380977611712ed0
1,600
PASSED
#include<cstdio> #include<algorithm> #include<cmath> #include<utility> #include<cstring> using namespace std; int n,m,k; char s[155][155]; struct NODE{ int t; pair<int ,int >p; }cnt[100005]; int check(int x,int y){ if(x == 1 || x == n || y == 1 || y == m) return 0; return 1; } int flag[55][55],cont,pan; int tm = 0...
C++
e514d949e7837c603a9ee032f83b90d2
6afb257a28fa52e4243ce2e761a07b66
1,600
PASSED
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int n,i; scanf("%d",&n); char word[1000]; int *roots; int rootLen = 0; roots = (int *)malloc(rootLen*sizeof(int)*26); for(i=0;i<n;i++) { int root[26] = {0},j,c=1; scanf("%s",&word); for(j=0;j<strlen(word);j++) { if(root[word[j]-97]...
C
cf1eb164c4c970fd398ef9e98b4c07b1
ffae398b3c2d4e9a319c4e4ca5a7d6c7
900
PASSED
#include <stdio.h> #include <string.h> char process_str(char string[]){ char temp; int i, j, count = 0, len = strlen(string); for(i = 0; i < len-1; i++){ for(j = i + 1; j < len; j++){ if(string[i] == string[j]){ string[j] = '\0'; } } } for(i =...
C
cf1eb164c4c970fd398ef9e98b4c07b1
bd745773cd97747aab6b8caa03e89a37
900
PASSED
#include<stdio.h> int used[27][1001]; int cnt,par; char c[1001]; int main() { int n; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%s",&c); for(int t=0;c[t]!='\0';t++) used[c[t]-'a'+1][i]=1; par=0; for(int j=0;j<i;j++) { int tt=1; ...
C
cf1eb164c4c970fd398ef9e98b4c07b1
df265face5b54bb1e7d136f60ed9a0a2
900
PASSED
#include <stdio.h> #include <string.h> #include <stdlib.h> #define NO_OF_CHARS 256 #define bool int void sort_string(char *s); char *removeDups(char *str); void sort_string(char *s) { int c, d = 0, length; char *pointer, *result, ch; length = strlen(s); result = (char*)malloc(length+1); pointer = s;...
C
cf1eb164c4c970fd398ef9e98b4c07b1
8c91dc5f3520baea890628f31bcbce5a
900
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { //code int n; scanf("%d",&n); char **A=(char**)malloc(n*sizeof(char*)); char **R=(char**)malloc(n*sizeof(char*)); for(int i=0;i<n;i++) A[i]=(char*)malloc(1000*sizeof(char)); for(int i=0;i<n;i++) R[i]=(char*)malloc(27*sizeof(char)); for(i...
C
cf1eb164c4c970fd398ef9e98b4c07b1
bfbc90403222250d7b92c5e28056b1a0
900
PASSED
#include<stdio.h> #include<string.h> int mark[1005][30]; char a[1005]; int main() { int n,sum=0; scanf("%d",&n); for(int i=1;i<=n;i++) { int flag=1; scanf("%s",a); int l=strlen(a); for(int j=0;j<l;j++) mark[i][a[j]-'a']=1; for(int j=1;j<i;j++) { int ok=1; for(int g=0;g<30;g++) if(mark[j][g]...
C
cf1eb164c4c970fd398ef9e98b4c07b1
1f93bf245b5acebad9e1c4e1788c9c1e
900
PASSED
//package March16; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java...
Java
cf1eb164c4c970fd398ef9e98b4c07b1
488e0f1ef2f2112d9b6cda022f75888f
900
PASSED
// Don't place your source in a package import java.util.*; import java.lang.*; import java.io.*; // Please name your class Main public class Main { public static void main (String[] args) { Scanner in = new Scanner(System.in); HashSet<String> hs = new HashSet<String>(); int n = in.nextInt(), count =...
Java
cf1eb164c4c970fd398ef9e98b4c07b1
5a0a2edc1f5c5bf662d3205b46f6a940
900
PASSED
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.Arrays; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Java
cf1eb164c4c970fd398ef9e98b4c07b1
e021da2ab5eb04a013d7719e16ce7783
900
PASSED
import java.util.Arrays; import java.util.Scanner; import java.util.*; // http://codeforces.com/problemset/problem/975/A public class aramic{ public static void main(String...args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); HashSet<String> wordSet = new HashSet<>(); for( int i = 0;i<n;...
Java
cf1eb164c4c970fd398ef9e98b4c07b1
5f5341141ef74c01648c85238afe9e0a
900
PASSED
from sys import stdin from collections import * get_bit = lambda x, i: (x >> i) & 1 rints = lambda: [int(x) for x in stdin.readline().split()] n, a, b = int(input()), rints(), rints() mem, ans, mem1 = Counter(a), 0, [] for i, j in mem.items(): if j > 1: mem1.append(i) for i in range(n): for j in mem1:...
Python
9404ec14922a69082f3573bbaf78ccf0
07395e79ac411d79f3464827b3013755
1,700
PASSED
mod=10**9+7 from sys import stdin, stdout import bisect from bisect import bisect_left as bl #c++ lowerbound bl(array,element) from bisect import bisect_right as br #c++ upperbound import itertools import collections import math import heapq from random import randint as rn def modinv(n,p): ...
Python
9404ec14922a69082f3573bbaf78ccf0
aeb897478000abac2c1d89b2273268ea
1,700
PASSED
mod=10**9+7 #import resource #resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY]) #import threading #threading.stack_size(2**27) #import sys #sys.setrecursionlimit(10**7) fact=[1] for i in range(1,100001): fact.append((fact[-1]*i)%mod) ifact=[0]*100001 ifact[100000]=pow(fact[100000],mod...
Python
9404ec14922a69082f3573bbaf78ccf0
d6cc12a364f08dde5889cf90500f4655
1,700
PASSED
'''input 6 3 2 1 3 5 6 1 2 3 4 5 6 ''' import sys from collections import Counter readln = sys.stdin.readline def write(s): sys.stdout.write(str(s)) def writeln(s): sys.stdout.write(str(s)) sys.stdout.write('\n') def readint(): return int(readln()) def readints(): return map(int, readln().split...
Python
9404ec14922a69082f3573bbaf78ccf0
d36fda99c0c0b504ca82ac6becb2cc9b
1,700
PASSED
from collections import Counter def main(): n=int(input()) A=tuple(map(int,input().split())) B=tuple(map(int,input().split())) C=Counter(A) if C.most_common()[0][1]==1: return 0 skill=set() for key,cnt in C.most_common(): if cnt==1: break skill.add(key) ...
Python
9404ec14922a69082f3573bbaf78ccf0
33a7a2dada2f245314d4a2b5c3236df1
1,700
PASSED
import sys input=sys.stdin.readline t=1 while(t): t-=1 n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) g={} for i in range(n): try: g[a[i]]+=1 except: g[a[i]]=1 res=0 for i in range(n): for j in g.keys(): ...
Python
9404ec14922a69082f3573bbaf78ccf0
8458cc7a85c7a8b6e820ebbad7f8745f
1,700
PASSED
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) from collections import defaultdict hash = defaultdict(int) for i,j in enumerate(a): hash[j]+=1 res = 0 for i in range(n): for k in hash: if hash[k]>1: if a[i]|k==k: res+=b[i] b...
Python
9404ec14922a69082f3573bbaf78ccf0
39f6a2d13bcfac4d145680c75cfb64ba
1,700
PASSED
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) d = {} for i in a: if i in d: d[i]+=1 if i not in d: d[i] = 1 rez = 0 g = [] for i in d: if d[i]>1: g.append(i) for i in range(n): if d[a[i]]>1: rez+=b[i] continue ...
Python
9404ec14922a69082f3573bbaf78ccf0
a7f005c2dc9cbffec67fb61206c38473
1,700
PASSED
from collections import Counter def main(): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) rv = 0 nums = {} for i in range(len(a)): if a[i] not in nums: nums[a[i]] = [] nums[a[i]].append(i) visited = set() for num in nums: if len(nums[num]) > 1: i = nums[nu...
Python
9404ec14922a69082f3573bbaf78ccf0
bcfd9b6f85cf402f2c06076dcfa50f34
1,700
PASSED
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) d = {} for i in range(n): if a[i] not in d: d[a[i]] = [] d[a[i]].append(b[i]) res = 0 v = [] for i in d.keys(): if len(d[i]) > 1: v.append(i) res += sum(d[i]) for i in d.keys...
Python
9404ec14922a69082f3573bbaf78ccf0
abdb860071f731df6bda5606d9376fac
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; int a,b; void into(){ scanf("%d%d",&a,&b); } vector<int>ans[2]; void Get_ans(){ int i=0,s=0; for (;s<=a+b;s+=++i); s-=i;--i; for (;i>=1;--i) if (i<=a){ a-=i; ans[0].push_back(i); }else{ b-=i; ans[1].push_back(i); } } void ...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
c16d8814cb65c9de72f9954d64cf28f2
1,600
PASSED
#include <bits/stdc++.h> using namespace std; // Macro Tools ///////////////////////////////////////////////////////////////// #define GET_MACRO_09(A0, A1, A2, A3, A4, A5, A6, A7, A8, NAME, ...) NAME #define EXPAND_01(MACRO, A0, ...) \ MACRO(A0, ##__VA_ARGS__) #define EXPAND_02(MACRO, A0, A1, ...) \ MACR...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
ef2a45da6c3819dde93cd5f3b5a3c00c
1,600
PASSED
#include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <set> #include <map> #include <fstream> #include <iomanip> #define ll long long #define ull unsigned long long #define vi vector<int> #define vll vector<long long> #define vs vector<string> #define endl '\n' using n...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
33e2c95ac29586b2e876a14b34b4d54e
1,600
PASSED
#include<cstdio> #include<algorithm> #include<iostream> #include<string> #include<vector> #include<queue> #include<cstring> #include<cmath> #include<map> #include<set> #define ll long long using namespace std; const int maxn = 2e5+10; ll s[maxn]; int ans1[maxn]; int ans2[maxn]; int vis[maxn]; int main() { s[0] =...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
6d1b3c3aa379453cbb5fdfdfeafd57d2
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pub push_back #define pob pop_back #define ss second #define ff first ll n,m,a,b,i=1,x,y,j,P[1000001],aa; vector<ll>v,vv,v1,vv1; main (){ cin>>a>>b; aa=a; x=a+b; while(1){ if(i*(i+1)/2>x) break; i++; } i--; j=min(a...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
1f5a1a7759383bc18d5847ffc0963688
1,600
PASSED
#include <bits/stdc++.h> using namespace std; void solve (queue <long long> * q, queue <long long> * p, long long a, long long b, long long n) { if (a > b) { swap(a, b); swap(q, p); } long long i = 1; while (a >= n && n) { p->push(n); a -= n; n--; } if (...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
3b96ee6902162cec731e60c580b2d9cb
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long priority_queue<int>Q1,Q2; int main() { ll a,b,f = 0,s = 0,limit = 1,xx = 0; cin>>a>>b; while(1) { ll sum = (limit * (limit + 1)) /2; if(sum>(a + b)) break; xx = limit; limit++; } f...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
c82bdea1eb58960f5a0668a48f0cde04
1,600
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; #define ll long long int #define fin for(i=0;i<n;i++) #define fjn for(j=0;j<n;j++) #define pb push_back ll i,j; int main(){ // ios_base::sync_with_stdio(false); // cin.tie(NULL); // cout<<setprecision(15); ll a,b; cin>>a>>b; ll y,x=2...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
12817b7f09280cc575a78040136bd258
1,600
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <utility> #include <vector> #include <map> #include <string> #include <set> #include <queue> #include <algorithm> #include <ctime> #include <cmath> #include <iomanip> #include <functional> #include <cassert> using namespace std; typedef l...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
d845906d93203e41e3089d5456070d32
1,600
PASSED
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b; cin >> a >> b; vector<int> ans; long long x = 1; while ((x * (x + 1)) / 2 <= a + b) x++; x--; set<int> v; for (int i = x; i > 0; i--) { if (a == 0) break; if (i <= a) { ans.push_back(i); v.insert(i); a -= i; } el...
C++
fab438cef9eb5e9e4a4a2e3f9e4f9cec
596fd034dd6f9fa6b239f922db89fc96
1,600
PASSED
#include <iostream> #include <vector> #include <algorithm> using namespace std; vector<int> prefix_function(string s){ int n = s.length(); vector<int> f(n); f[0]=0; for(int i=1;i<n;i++){ int j = f[i-1]; whil...
C++
fd94aea7ca077ee2806653d22d006fb1
c41b7cbe533907928e89d8e8dca8ea3a
1,700
PASSED
#include <iostream> #include <stdio.h> #include <cstring> using namespace std; char s[1000010]; int p[1000010]; bool num[1000010]; int main() { // your code goes here scanf("%s",s); int n = strlen(s); for (int i = 0; i < n; i++) { p[i] = 0; num[i] = false; } ...
C++
fd94aea7ca077ee2806653d22d006fb1
46c7f54cccd2ed53fab523ccd42620db
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define ll long long const int mod=1e9+7; const int mul=31; int mulP[1000010]; string s; int hv[1000010]; vector<int> cango; int gethv(int l,int r) // [l.r] { if(l==0) return hv[r]; int r1=(hv[l-1]*mulP[r-l+1])%mod; int r2=hv[r]-r1; while(r2<0)...
C++
fd94aea7ca077ee2806653d22d006fb1
8bd3cbd8ecf3b83e0b72262cf0433415
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define ll long long const int mod=998244353; const int mul=31; int mulP[1000010]; string s; int hv[1000010]; vector<int> cango; int gethv(int l,int r) // [l.r] { if(l==0) return hv[r]; int r1=(hv[l-1]*mulP[r-l+1])%mod; int r2=hv[r]-r1; while(r...
C++
fd94aea7ca077ee2806653d22d006fb1
f0f3c56dba95b4cb89790a14abb1064c
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define mem(a,b) memset(a,b,sizeof(a)) #define FOR(i,j,k) for(int i=j;i<=k;i++) #define REV(i,j,k) for(int i=j;i>=k;i--) #define inf freopen("in.txt", "r", stdin) #define outf freopen("out.txt", "w", stdout) #define pf printf #define sf(n) sc...
C++
fd94aea7ca077ee2806653d22d006fb1
ad1da77568c5c613bfd8209ea5ecd806
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define mem(a,b) memset(a,b,sizeof(a)) #define FOR(i,j,k) for(int i=j;i<=k;i++) #define REV(i,j,k) for(int i=j;i>=k;i--) #define inf freopen("in.txt", "r", stdin) #define outf freopen("out.txt", "w", stdout) #define pf printf #define sf(n) sc...
C++
fd94aea7ca077ee2806653d22d006fb1
c605aeebe6939c47e8b2648e0a774508
1,700
PASSED
#include <iostream> #include <map> #include <set> #include <unordered_set> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair < int, int >pii; #ifndef ONLINE_JUDGE auto __redirect__ = freopen("in", "r", stdin); #else # include<bits/stdc++.h>...
C++
fd94aea7ca077ee2806653d22d006fb1
e0b2649df1ba1d5c16e2834360b5a0c3
1,700
PASSED
#include <iostream> #include <map> #include <set> #include <unordered_set> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair < int, int >pii; #ifndef ONLINE_JUDGE auto __redirect__ = freopen("in", "r", stdin); #else # include<bits/stdc++.h>...
C++
fd94aea7ca077ee2806653d22d006fb1
195332f196303de7f8443eba01291974
1,700
PASSED
#include <iostream> #include <map> #include <set> #include <unordered_set> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair < int, int >pii; #ifndef ONLINE_JUDGE auto __redirect__ = freopen("in", "r", stdin); #else # include<bits/stdc++.h>...
C++
fd94aea7ca077ee2806653d22d006fb1
afb59bfdf62cd0fe36eccfe779003a44
1,700
PASSED