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; //#include<ext/rope> //using namespace __gnu_cxx //#include<ext/pb_ds/priority_queue.hpp> //using namespace __gnu_pbds; #define lowbit(x) (x&-x) #define pb(x) push_back(x) #define all(x) (x).begin(),(x).end() #define clr(a,b) memset(a,b,sizeof(a)) #define caze(T) for(scanf("...
C++
edc54435b62e76287da94836ad3aa86b
ff766c9bcc1e207f9403b81b4b6ea863
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ss second #define ff first #define N 1003 #define inf 1000000009 #define ll long long #define pii pair<int,int> #define sz(a) int(a.size()) #define all(a) a.begin(),a.end() ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll mod = 1e9+7; //998244...
C++
edc54435b62e76287da94836ad3aa86b
7ef66619ad71779da42b2f643465b8e7
1,900
PASSED
#include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; typedef int64_t ll; char graph[1002][1002]; struct record{ char a, b, c; int U, D; record(char a, char b, char c, int U, int D): a(a), b(b), c(c), U(U), D(D){} }; ll val(record A){ return (((ll)A.a << 40) + ((ll)A.b <...
C++
edc54435b62e76287da94836ad3aa86b
151f22e27a5f9beef280c32f899be6a8
1,900
PASSED
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int MAXN = 1111; int n, m, dp[MAXN][MAXN], dp_new[MAXN][MAXN]; string blanket[MAXN]; int main() { ios_base::sync_with_stdio(false); cin >> n >> m; for (int i = 0; i < n; i++) { cin >> blanket[i]; } for (int i = 0;...
C++
edc54435b62e76287da94836ad3aa86b
a7709bc5b311d8eb7c4148fcdbca014a
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1111; int n, m, dp[MAXN][MAXN]; string blanket[MAXN]; int main() { ios_base::sync_with_stdio(false); cin >> n >> m; for (int i = 0; i < n; i++) { cin >> blanket[i]; for (int j = 0; j < m; j++) { ...
C++
edc54435b62e76287da94836ad3aa86b
f441c67180beb73dbc798265ec19e78c
1,900
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define all(x) x.begin(),x.end() #define len(x) (int)(x).size() #define int long long /* #pragma GCC omptimize("unroll-loops") #pragma optimize("SEX_ON_THE_BEACH") #pragma GCC optimize("no-stack-protector") #pragma comment(linker, "/STACK:10000000000") ...
C++
edc54435b62e76287da94836ad3aa86b
fb4adc9417c555c51c34baced040c9ff
1,900
PASSED
#include<bits/stdc++.h> #define ll long long int #define mk make_pair #define pb push_back #define INF (ll)1e18 #define pii pair<ll,ll> #define mod 1000000007 //998244353 #define f(i,a,b) for(ll i=a;i<b;i++) #define fb(i,a,b) for(ll i=a;i>b;i--) #define ff first #define ss second #define srt(v) if(!v.empty())sort(v.be...
C++
edc54435b62e76287da94836ad3aa86b
6aea061bd7716c06e5336e2ab63b42a6
1,900
PASSED
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/hash_policy.hpp> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #ifdef local #define readinfile(file) freopen(file, "r", stdin) template<class T> void err(T x) { cerr << x << endl;} template<c...
C++
edc54435b62e76287da94836ad3aa86b
8db05da98532358373824473c5e86bfb
1,900
PASSED
#include<bits/stdc++.h> using namespace std; char a[1005][1005]; int h[1005],b[1005],v[1005],s[1005]; int main(){ int n,m; cin>>n>>m; for(int i=1;i<=n;i++) scanf("%s",a[i]+1); int ans=0; for(int j=1;j<=m;j++){ for(int i=1;i<=n;i++){ if(a[i][j]!=a[i][j-1]) h[i]=1; else h[i]++; } int c=0; for(int...
C++
edc54435b62e76287da94836ad3aa86b
c14d73842dd2cf1959887bfd5a71bb5f
1,900
PASSED
#include<bits/stdc++.h> #define fr(i,j,n) for(int i=j;i<n;i++) #define pb push_back #define rf(i,j,p) for(int i=p-1;i>=j;i--) #define vi vector<int> #define vll vector<long long> #define ll long long #define hmm "\n" #define sp " " #define srt(v) sort(v.begin...
C++
3336662e6362693b8ac9455d4c2fe158
50e4c3ec79db9f0f0d5b5b774f9d39fa
1,300
PASSED
#include<bits/stdc++.h> #define fr(i,j,n) for(int i=j;i<n;i++) #define pb push_back #define rf(i,j,p) for(int i=p-1;i>=j;i--) #define vi vector<int> #define vll vector<long long> #define ll long long #define hmm "\n" #define sp " " #define srt(v) sort(v.begin...
C++
3336662e6362693b8ac9455d4c2fe158
127b7872072b3c995908dcf58495a2de
1,300
PASSED
#include <iostream> #include <vector> #include <string> #include<map> #include<algorithm> #include <algorithm> #include<set> #include<queue> #include<deque> #include <cmath> #include<stack> #include <cstring> #include<list> typedef long long ll; #defin...
C++
3336662e6362693b8ac9455d4c2fe158
a54a9b6d3393868217bda5fb90e7e7e7
1,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; #define pb push_back int n, b, w; vi r; string s; int main(){ cin >> n >> s; for(int i=0;i<n;i++){ if(s[i]=='W')w++; } b = n-w; if(b%2&&w%2){ cout << -1 << endl; return 0; } char v = (b%2==0?'W':'B')...
C++
3336662e6362693b8ac9455d4c2fe158
7f58b4e279c7189cad5cb488d8b8f57a
1,300
PASSED
#include <bits/stdc++.h> const long long INF = 1LL << 60; const long long MOD = 1000000007; const double PI = acos(-1.0); #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n - 1); i >= 0; --i) #define perm(c) sort(ALL(c));for(bool c##p=1;c##p...
C++
3336662e6362693b8ac9455d4c2fe158
d5de2c49540f017afb8b0e454fb35f3d
1,300
PASSED
// // main.cpp // ervb // // Created by Kanak Gautam on 21/04/20. // Copyright © 2020 Kanak Gautam. All rights reserved. // #include <iostream> #include <algorithm> #include <map> #include <vector> #include <cmath> #include <queue> #include <string> #include<set> #define pb push_back #define mk make_pair #defin...
C++
3336662e6362693b8ac9455d4c2fe158
08c6518bebc9678975c1568e420fa265
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define mkp make_pair #define ff first #define ss second #define all(a) a.begin(), a.end() #define clr(a, b) memset(a, b, sizeof(a)) #define forn(i, n) for(int i=0; i<(int)(n); ++i) #define forab(i, a, b) for(int i=(int)(a); i<=(...
C++
3336662e6362693b8ac9455d4c2fe158
fb4dd674b3a2b1ad4c996f3f0ba74666
1,300
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <stack> #include <utility> #include <cmath> #include <string> #include <bitset> #include <queue> #include <cstdio> #include <cstring> #include <deque> #include <unordered_map> #include <climits> #include <map> #include <iomanip> #define ci(t) cin>>t #d...
C++
3336662e6362693b8ac9455d4c2fe158
244d411a0d48cbeb36765879dad5ad86
1,300
PASSED
# include <iostream> # include <string> # include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; char qw1 = 'a', qw2 = 'a'; int c = 0, k = count(s.begin(), s.end(), 'B'), k2 = count(s.begin(), s.end(), 'W'); vector <int> asd; if (k % 2 == 0) { qw1 = 'B'; qw2 = 'W'; } els...
C++
3336662e6362693b8ac9455d4c2fe158
60b403641ff0f0da1fdf30d89be9fe9b
1,300
PASSED
#include <iostream> #include <fstream> #include <vector> #include <set> #include <map> #include <unordered_map> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <ctime> #include <algorithm> #include <sstream> #include <list> #include <queue> #include <deque> #include <stack> #include <c...
C++
3336662e6362693b8ac9455d4c2fe158
6024cb153cae00face435ccda8ce0956
1,300
PASSED
/** * Created by kapilkrishnakumar on 11/4/15. * http://codeforces.com/problemset/problem/573/A */ import java.util.*; public class BearPoker { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] lowest = new int[n]; for(int ...
Java
2bb893703cbffe9aeaa0bed02f42a05c
4644b14681c3a5f7d2d388e333cccef9
1,300
PASSED
import java.io.*; import java.util.*; import java.util.List; public class Main { private static StringTokenizer st; private static BufferedReader br; public static long MOD = 1000000007; private static double EPS = 0.0000001; public static void print(Object x) { System.out.println(x + "");...
Java
2bb893703cbffe9aeaa0bed02f42a05c
64e051ee258c1438ec4cfd529bf1c572
1,300
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.List; public class B { static String NO = "No"; static String YES = "Yes"; public static void main(String[] args) throws Exception { readIntArray(); ...
Java
2bb893703cbffe9aeaa0bed02f42a05c
37b98bc60140be57fb656f332914f281
1,300
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
2bb893703cbffe9aeaa0bed02f42a05c
70794f7308e116d9876dc45d1215186f
1,300
PASSED
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static class Reader...
Java
2bb893703cbffe9aeaa0bed02f42a05c
6a735f21dbabd0f86eb15460309289b1
1,300
PASSED
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.HashSet; import java.util.InputMismatchException; public class Main { class MyScanner { private byte[] buf = new byte[1024]; private int curChar; private int numChars; BufferedInputStream...
Java
2bb893703cbffe9aeaa0bed02f42a05c
d9d3a4986e17c882ad1492497d514bd4
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int n,sum,now; int a[200005]; inline int gcd(int a,int b) { if (!b) return a; return gcd(b,a%b); } int main(){ scanf("%d",&n); for (register int i=1; i<=n; ++i) scanf("%d",&a[i]); sum=a[1]; for (register int i=2; i<=n; ++i) sum=gcd(sum,a[i]); for (register int i=1...
C++
2bb893703cbffe9aeaa0bed02f42a05c
511a8e66be79636dd2c069fed0b834e4
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int n,sum,now; int a[200005]; inline int gcd(int a,int b) { if (!b) return a; return gcd(b,a%b); } int main(){ scanf("%d",&n); for (register int i=1; i<=n; ++i) scanf("%d",&a[i]); sum=a[1]; for (register int i=2; i<=n; ++i) sum=gcd(sum,a[i]); for (register int i=1...
C++
2bb893703cbffe9aeaa0bed02f42a05c
fb7dd270a7c0f98a0701d9fa3cc70103
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int n; int a[100100]; int main() { cin >> n; for (int i = 0 ; i < n;i++ ) { cin >> a[i]; while(a[i] % 2 == 0) a[i]/=2; while(a[i] % 3 == 0) a[i]/=3; } for (int i = 1; i < n; i++) { if (a[i] != a[0]) { cout << "N...
C++
2bb893703cbffe9aeaa0bed02f42a05c
ce330b61998630783bb19b6c973012fc
1,300
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <bitset> #include <cstdio> #include <cstdlib> #define DN 2000005 #define LL long long #define x first #define y second using namespace std; typedef pair<int,int> per; typedef vector<int>::iterator it; int n,a=-1,b; void div23(int &a) { for(;a%2==0...
C++
2bb893703cbffe9aeaa0bed02f42a05c
6378ebaabc69da8c9d5959d7a1210059
1,300
PASSED
#!/usr/bin/env python from __future__ import division, print_function import os import sys from io import BytesIO, IOBase def main(): for _ in range(int(input())): n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split(...
Python
7647528166b72c780d332ef4ff28cb86
363d4c03f6f540b6003a447a4228a50a
800
PASSED
from random import randint def calc(a,b,c,n): sol = [0 for i in range(n)] f=randint(0,2) if f==0: sol[0]=a[0] if f==1: sol[0]=b[0] if f==2: sol[0]=c[0] for i in range(1,n): if i==n-1: if sol[i-1]!=a[i] and sol[0]!=a[i]: ...
Python
7647528166b72c780d332ef4ff28cb86
a252ff77ea5c1285687d8b312aa38ea0
800
PASSED
test=int(input()) for i in range(test): n=int(input()) a=[int(x) for x in input().split(' ')] b=[int(x) for x in input().split(' ')] c=[int(x) for x in input().split(' ')] p = [a[0]] for i in range(1, n - 1): z = [a[i], b[i], c[i]] for j in z: if j != p[i - 1]: ...
Python
7647528166b72c780d332ef4ff28cb86
39f22d575ac2cf1d31712e300290dbb7
800
PASSED
from sys import * from math import * t=int(stdin.readline()) for _ in range(t): n=int(stdin.readline()) a = list(map(int, stdin.readline().split())) b = list(map(int, stdin.readline().split())) c = list(map(int, stdin.readline().split())) ans=[a[0]] for i in range(1,n-1): if a[i]!=ans[i-...
Python
7647528166b72c780d332ef4ff28cb86
514a640d3fa682d6f3fd360d29be19d4
800
PASSED
# 1408A.py for _ in range(int(input())): n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) l = [0]*n l[0] = a[0] for i in range(1,n): if i!=n-1: if a[i]!=l[i-1]: l[i] = a[i] ...
Python
7647528166b72c780d332ef4ff28cb86
b7f3067ca6f6ce50effa2cf59c1bd817
800
PASSED
fun main() { print( buildString { repeat(readLine()!!.toInt()) { val n = readLine()!!.toInt() val a = readLine()!!.split(" ").map { it.toInt() } val b = readLine()!!.split(" ").map { it.toInt() } val c = rea...
Kotlin
7647528166b72c780d332ef4ff28cb86
2d34f7c11da6f026fca846afdaf82150
800
PASSED
import java.lang.Math.abs import java.util.* import kotlin.math.max import kotlin.math.min // solution is at the bottom // this is a lie fun main() { repeat(readInt()) { val n = readInt() val a = readIntArray(n) val b = readIntArray(n) val c = readIntArray(n) val result = ...
Kotlin
7647528166b72c780d332ef4ff28cb86
1dabc489a57a7c3f0a68da77c0aa573f
800
PASSED
import java.util.* import kotlin.math.max import kotlin.math.pow private fun readLn() = readLine()!! // string line private fun readStrings() = readLn().split(" ") // list of strings private fun readLong() = readLn().toLong() private fun readLongs() = readStrings().map { it.toLong() } // list of ints private fun readI...
Kotlin
7647528166b72c780d332ef4ff28cb86
87fd44bf8f48124400c45f75b21859d7
800
PASSED
fun main() { var T = readLine()!!.toInt() while (T > 0) { T-- var n = readLine()!!.toInt() var a = readLine()!!.split(' ').map { it.toInt() }.toMutableList() var b = readLine()!!.split(' ').map { it.toInt() }.toMutableList() var c = readLine()!!.split(' ').map { it.toInt(...
Kotlin
7647528166b72c780d332ef4ff28cb86
08ac8d346f6f47a2f4fd13014fdac40e
800
PASSED
fun main() { repeat(readLine()!!.toInt()) { val n = readLine()!!.toInt() val a = readLine()!!.split(" ").map { it.toInt() } val b = readLine()!!.split(" ").map { it.toInt() } val c = readLine()!!.split(" ").map { it.toInt() } val d = IntArray(n) d[0] = a[0] fo...
Kotlin
7647528166b72c780d332ef4ff28cb86
9e13d406f3b152fadb8b735363c342e8
800
PASSED
#include<iostream> #include<fstream> using namespace std; //#define cin fin //ifstream fin("input.txt"); const int Maxn=1000*1000+10; int n,m,a[Maxn],x[Maxn],X=1,s[Maxn*4],temp; bool mark[Maxn]; void Sum(int y,int l,int r,int nod=1,int L=1,int R=Maxn){ if(r<L || R<l)return; if(l<=L && R<=r)s[nod]+=y; else{ int...
C++
c0ffe4f1b470693a47e971c4b3be8f09
e91adb26780b2f8566abfbd83c52da7b
2,000
PASSED
#include <bits/stdc++.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ++I) #define REPP(I, A, B) for (int I = (A); I < (B); ++I) #define PER(I, N) for (int I = (N); I >= 0; --I) #define PERR(I, A, B) for (int I = (A); I >= B; --I) #define ITR(I, A) for...
C++
c0ffe4f1b470693a47e971c4b3be8f09
13f7abcbcb5c11385f5ff091e0808320
2,000
PASSED
#include <bits/stdc++.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ++I) #define REPP(I, A, B) for (int I = (A); I < (B); ++I) #define PER(I, N) for (int I = (N); I >= 0; --I) #define PERR(I, A, B) for (int I = (A); I >= B; --I) #define ITR(I, A) for...
C++
c0ffe4f1b470693a47e971c4b3be8f09
ac8fcb125ccd0f005fd9ec5963c6ec8e
2,000
PASSED
#include <cstdlib> #include <cstring> #include <memory> #include <cstdio> #include <fstream> #include <iostream> #include <cmath> #include <string> #include <sstream> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <algorithm> using namespace std; typedef signed long long ll;...
C++
c0ffe4f1b470693a47e971c4b3be8f09
31fb203faf3738916cef4dd89cbce4b9
2,000
PASSED
#include <algorithm> #include <bitset> #include <deque> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define fst firs...
C++
c0ffe4f1b470693a47e971c4b3be8f09
cb817d5d4498c89caca1aa6768930845
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vpi; typedef vector<vpi> vvpi; int tree[5000000]; int read(int idx){ int sum = 0; while (idx > 0){ sum += tree[...
C++
c0ffe4f1b470693a47e971c4b3be8f09
8a65b4d1bee40731b8cfdc87ef8c84c4
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vpi; typedef vector<vpi> vvpi; int tree[8000000]; int read(int idx){ int sum = 0; while (idx > 0){ sum += tree[...
C++
c0ffe4f1b470693a47e971c4b3be8f09
2c6fd48be8f0b65495cd8fe1ebd11e1d
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vpi; typedef vector<vpi> vvpi; int tree[5000000]; int read(int idx){ int sum = 0; while (idx > 0){ sum += tree[...
C++
c0ffe4f1b470693a47e971c4b3be8f09
3f27f9dae2a60344d74adfe10a1071d0
2,000
PASSED
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; #define MAXN 1000010 int N, M, pos, l; int v[MAXN]; int quanti[MAXN*4], num[MAXN*4]; inline int Sx(int x) { return (x<<1); } inline int Dx(int x) { return (x<<1)+1; } void Update(int p, int a, int pos, int q, int dove) { //cout<<"Updat...
C++
c0ffe4f1b470693a47e971c4b3be8f09
baec55fe68b46dc4aba7ee49b61e390f
2,000
PASSED
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; #define MAXN 1000010 int N, M, pos, l; int v[MAXN]; int quanti[MAXN*4], num[MAXN*4]; inline int Sx(int x) { return (x<<1); } inline int Dx(int x) { return (x<<1)+1; } void Update(int p, int a, int pos, int q, int dove) { if(p==a) { q...
C++
c0ffe4f1b470693a47e971c4b3be8f09
f87149ac8731b315446daabe7a71823c
2,000
PASSED
#include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <cmath> typedef long long LL; using namespace std; LL sum,a,b,n,dq,dqsum,ans,flag; LL c[100]; int main() { scanf("%I64d%I64d%I64d",&n,&a,&b); if (n==1) { if (a==1&&b==1) { printf("inf\n"); return 0; } if (a==1&&b!=1)...
C++
ccdd28603921a99fa5f1f75d42f479a9
05119363ab14191630212f50d0572af4
2,800
PASSED
#include <cstdio> #include <cstring> #include <iostream> using namespace std; long long t, a, b; long long c[105], tot; int ok(long long a, long long b){ if (a == 1){ return 0; } tot = 0; while (b){ c[tot++] = b % a; b /= a; } long long T = 1; for (int i = 0; i < tot...
C++
ccdd28603921a99fa5f1f75d42f479a9
e0b32c1577d70edfdd31e3dc62f8b363
2,800
PASSED
#include <iostream> using namespace std; int main(){ //freopen("in","r",stdin); long long a,b,c; cin>>a>>b>>c; if(a>1&&b==1&&c==1){ cout<<1; return 0; } if(a==1&&b==1&&c==1){ cout<<"inf"; return 0; } if(a==b&&b==c){ cout<<2; return 0; } if(b==1){ cout<<0; return 0; } long long bb=b; while(c!=0){ ...
C++
ccdd28603921a99fa5f1f75d42f479a9
2bb50a5194269d063b8b391f197f8702
2,800
PASSED
#define NDEBUG #ifdef NDEBUG #define debugf(...) ((void)0) #else #define debugf(...) printf(__VA_ARGS__) #endif // NDEBUG #include<bits/stdc++.h> #define MOD 1000000007 #define LL long long using namespace std; LL gcd(LL x,LL y) /// x,y > 0 { return y==0 ? x : gcd(y,x%y) ; } void get_ans(LL a,LL b,LL &x,LL &y,LL ...
C++
ccdd28603921a99fa5f1f75d42f479a9
50406acd9264b396403eb4f76b45042b
2,800
PASSED
//#define DEBUG //comment when you have to disable all debug macros. //#define LOCAL //uncomment for testing from local file #define NDEBUG //comment when all assert statements have to be enabled. //#define GRAPH #include <iostream> #include <cstring> #include <sstream> #include <fstream> #include <cstdl...
C++
ccdd28603921a99fa5f1f75d42f479a9
34a18be406ebebd31d5b1fd928798c8b
2,800
PASSED
#include <algorithm> #include <iostream> #include <cmath> #include <cstdlib> #include <cstdio> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> ii; #define rep(i, a, b) for(int i = a; i < b; i++) #define red(i, a, b) for(int i = a; i > b; i--) #define RED true #define BLACK false #def...
C++
ccdd28603921a99fa5f1f75d42f479a9
f131637b33dbd6337a0b8d2f8b145207
2,800
PASSED
#include <iostream> #include <cstdio> #include<cstring> #include<cmath> long long t,a,b,h,f[110]; using namespace std; long long mi(long long n,long long m) { long long res=1; for(int i=1;i<=m;i++)res*=n; return res; } void solve(long long a,long long b) { for(int i=h;i;i--) { long long t=mi...
C++
ccdd28603921a99fa5f1f75d42f479a9
5ec701785cac1d1cd31d94aeaefcb54e
2,800
PASSED
/* ID: keyvank2 TASK: combo LANG: C++ */ #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair #define MAXINT ((~0) ^ (1 << 31)) #define MAXLL ((~0) ^ ((ll)1 << 63)) #define INF ((int)2e9) #define INFL ((ll)9e18) #define FOR(i,j,k) for(int i = j; i < k; i++) #define REP...
C++
ccdd28603921a99fa5f1f75d42f479a9
a92b83b32fbbee0614e6397373bd8d9f
2,800
PASSED
#include <cstdio> #include <vector> long long t, a, b; std::vector<long long int> cf; int main(){ scanf("%I64d%I64d%I64d", &t, &a, &b); if(t == 1){ if(a == 1 && b == 1){ puts("inf"); return 0; } else if(a == 1){ puts("0"); return 0; ...
C++
ccdd28603921a99fa5f1f75d42f479a9
249afe7bc046ff34926360ba406fdba1
2,800
PASSED
#include <stdio.h> #include <iostream> #include <cstring> #include <algorithm> #include <cmath> using namespace std; #define ll long long ll i,j,t,n,m,l,r,k,z,y,x; ll a,b,ans; int main() { scanf("%I64d%I64d%I64d",&t,&a,&b); if (t==1) { if (a==1) { if (a==b) printf("inf\n"); ...
C++
ccdd28603921a99fa5f1f75d42f479a9
ee88f6fe116b7c64f2b34fc8a6f2d7b1
2,800
PASSED
import java.io.*; import java.util.HashSet; import java.util.Iterator; /** * Created by Scruel on 2017/5/10. * Personal blog : http://blog.csdn.net/scruelt * Github : https://github.com/scruel * //TODO */ public class CF746E { static BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.o...
Java
86bf9688b92ced5238009eefd051387d
ccfeaa12edd46e93049541c67ad99e42
1,900
PASSED
import java.io.*; import java.util.*; public class E { FastScanner in; PrintWriter out; int i = 0, j = 0; void solve() { /**************START**************/ int n = in.nextInt(), m = in.nextInt(); int[] nums = new int[n]; TreeSet<Integer> evens = new TreeSet<Integer>(); TreeSet<Integer> odds = new Tre...
Java
86bf9688b92ced5238009eefd051387d
7d6999a351c7f30ff2233df07362dbf9
1,900
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; /** * Created by Firеfly on 12/18/2016. */ public class code { public static void main(String[] args) throws IOException { Woorker worker = new Woorker(); } } ...
Java
86bf9688b92ced5238009eefd051387d
b88d9a41eab50f006c86d64824e2681b
1,900
PASSED
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.LinkedList; import java.util.StringTokenizer; import java.util.TreeSet; public class P746E { public static void main(String[] args) { FastScanner scan = new FastScanner(); Print...
Java
86bf9688b92ced5238009eefd051387d
1025e384993a325e73ab329a51a8b22e
1,900
PASSED
import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.InputMismatchException; public class E { public static void main(String[] args) { FastScannerE sc = new FastScannerE(System.in); int N = sc.nextInt(); int NH = N/2; int M = sc.nex...
Java
86bf9688b92ced5238009eefd051387d
cf243f6ba66b70c2f05519cffdd46bfc
1,900
PASSED
import java.io.*; import java.util.*; public class A558 { static BufferedReader in = null; static PrintWriter out = null; static StringTokenizer st = new StringTokenizer(""); public static void main(String[] args) { try { in = new BufferedReader(new InputStreamReader(System.in)); out = new Pri...
Java
86bf9688b92ced5238009eefd051387d
384c4fc9e397d9a5063d4747ee291ff8
1,900
PASSED
import java.io.*; import java.util.*; public class A558 { static BufferedReader in = null; static PrintWriter out = null; static StringTokenizer st = new StringTokenizer(""); public static void main(String[] args) { try { in = new BufferedReader(new InputStreamReader(System.in)); out = new Pri...
Java
86bf9688b92ced5238009eefd051387d
2fee02dc8d3cc035ffdf0814f954f035
1,900
PASSED
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import static java.lang.Math.abs; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Long.parseLong; import s...
Java
86bf9688b92ced5238009eefd051387d
0853c3e47965c0bd9c9ef31c28be6336
1,900
PASSED
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
86bf9688b92ced5238009eefd051387d
b7530aa2ace0bef77defbd921973c0a3
1,900
PASSED
import java.util.*; import java.io.*; public class NumbersExchange { /************************ SOLUTION STARTS HERE ***********************/ private static void solve(FastScanner s1, PrintWriter out){ int N = s1.nextInt(); int M = s1.nextInt(); int arr[] = s1.nextIntArray(N); HashSet<Integer> even...
Java
86bf9688b92ced5238009eefd051387d
2147466e1b22b3c6defd91ea1c2ad82d
1,900
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <c...
C++
95ccc87fe9e431f9c6eeffeaf049f797
08ef37e8e7edabdcda7aaf754ad4e6cd
1,300
PASSED
#include <bits/stdc++.h> using namespace std; string conv(string s){ string ret; for(int i = 0; i < (int)s.size(); i++){ if(isalpha(s[i])){ ret += tolower(s[i]); } } return ret; } int main(){ string arr[4], str; set<string> s; int n; for(int i = 0; i < 3; i++){ cin >> arr[i]; a...
C++
95ccc87fe9e431f9c6eeffeaf049f797
db4f23be112d4a55c5ef515cba520f5d
1,300
PASSED
/* Sep 20, 2010 - a.cpp done by :: Mohammed Magdi (magdi) */ #include<iostream> #include <string> #include <algorithm> using namespace std; string clear(string s) { string res = ""; for (int i = 0; i < s.length(); ++i) { if (s[i] == '-' || s[i] == '_' || s[i] == ';') continue; if...
C++
95ccc87fe9e431f9c6eeffeaf049f797
5964eccaffeb4fccfe68f2e62b758744
1,300
PASSED
#include <bits/stdc++.h> const int maxn = 1005; using namespace std; char a[1005],b[1005],c[1005],tmp[maxn],d[maxn]; void solve(char tmp[],char a[]) { int pos = 0; int len = strlen(tmp); for(int i = 0; i < len; i ++ ) { if(tmp[i]>='A'&&tmp[i]<='Z'){ a[pos++] = tmp[i]+32; } ...
C++
95ccc87fe9e431f9c6eeffeaf049f797
260070230b50285237e6d6e77a0fa2df
1,300
PASSED
#include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <string> #include <map> #define oo 1000000000 #define mod 100000000 #define N 100010 #define next nxt using namespace std; char t[1111]; void input(string &s) { s=""; scanf("%s",t); for (int i=0;t[i];++i)...
C++
95ccc87fe9e431f9c6eeffeaf049f797
1fada4a4adaf4475faafaff559e3bf0f
1,300
PASSED
#include <stdio.h> #include <string.h> #include <string> #include <map> using namespace std; map <string,int> mp; char t[1010]; void input(string &s) { s=""; scanf("%s",t); for (int i=0;t[i];++i) { if (t[i]>='a'&&t[i]<='z') t[i]=t[i]-'a'+'A'; if (t[i]>='A'&&t[i]<='Z') ...
C++
95ccc87fe9e431f9c6eeffeaf049f797
d7b546710e256692f1bcb091682d98ac
1,300
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cctype> using namespace std; char s1[150],s2[150],s3[150],str[700]; char ans[10][505]; void solve(char a[150],char b[150],char c[150],int i){ strcpy(ans[i],a); strcat(ans[i],b); strcat(ans[i],c); } int main(){ int i,n,flag,c; for(i = 0;(c = getchar...
C++
95ccc87fe9e431f9c6eeffeaf049f797
b7991bc67e14089a29bc31c6f2a1cd97
1,300
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cctype> using namespace std; char s1[150],s2[150],s3[150],str[700]; char ans[10][505]; void solve(char a[150],char b[150],char c[150],int i){ strcpy(ans[i],a); strcat(ans[i],b); strcat(ans[i],c); } int main(){ int i,n,flag,c; for(i = 0;(c = getchar...
C++
95ccc87fe9e431f9c6eeffeaf049f797
9e11f1fb7ea975a67180711cb8ea96b8
1,300
PASSED
/* * 61B.cpp * * Created on: Aug 7, 2014 * Author: Menna */ #include<iostream> #include<string> #include<vector> #include<map> #include<algorithm> using namespace std; int main() { string input[3]; int arr[3]={0,1,2}; string temp; map<string,bool> vis; string tt=""; for (int i = 0...
C++
95ccc87fe9e431f9c6eeffeaf049f797
438b1f115be1c1f87b269d29f7a3a84c
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define _ ios_base::sync_with_stdio(0);cin.tie(0); # define PI 3.14159265358979323846 const double EPS = 1e-10; ///***************************************** class XBallGame { public : }; string arr[3]; string all[6]; int main() { //freopen("input.txt","r",stdi...
C++
95ccc87fe9e431f9c6eeffeaf049f797
54d467d87362a33e227851744b467325
1,300
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Scanner; public class aa { public static void main(String[] args)throws NumberFormatException, IOException { //Scanner in=new Scanner(Syst...
Java
48f3ff32a11770f3b168d6e15c0df813
cf42093e45d008beb55949ba9ab37270
1,200
PASSED
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; public class SerejaAndArray { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamRead...
Java
48f3ff32a11770f3b168d6e15c0df813
4d49b73a340484c906520c26598cbfaa
1,200
PASSED
import java.io.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); String line = stdin.readLine(); String[] prms = line.split(" "); int n = Integer.parseInt(prms[0]); int m = Integer.p...
Java
48f3ff32a11770f3b168d6e15c0df813
af2fada83af1e6cbb319c34fbc30e392
1,200
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.InputMismatchException; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { ...
Java
48f3ff32a11770f3b168d6e15c0df813
21877dd65ffd8d526faafcb3e81e0c87
1,200
PASSED
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; import java.io.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[]...
Java
48f3ff32a11770f3b168d6e15c0df813
71a38f07d1786360f0a218df676d9fff
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class B { public static void main(String[] args)throws IOException { StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); st.nextToken()...
Java
48f3ff32a11770f3b168d6e15c0df813
6c5688d2723083e299636e7a103d63dc
1,200
PASSED
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class B { public static void main(String[] args) throws Exception{ InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt...
Java
48f3ff32a11770f3b168d6e15c0df813
feee5d8956de69cd9bfd3added691376
1,200
PASSED
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math.BigInteger; import...
Java
48f3ff32a11770f3b168d6e15c0df813
0be4cdc7b1c98f69702c405341131b9d
1,200
PASSED
import java.util.*; import java.io.*; public class B { Scanner sc = new Scanner(System.in); void doIt() { int n = Integer.parseInt(sc.next()); int m = Integer.parseInt(sc.next()); long [] a = new long[n+1]; int [] w = new int[n+1]; for(int i = 1; i <= n; i++) { a[i] = Long.parseLong(sc.next()); w[i] ...
Java
48f3ff32a11770f3b168d6e15c0df813
726da2bf29cbfc1aea7b9cda84d2ea72
1,200
PASSED
import java.util.*; import java.io.*; public class B { Scanner sc = new Scanner(System.in); void doIt() { int n = sc.nextInt(); int m = sc.nextInt(); long [] a = new long[n+1]; int [] w = new int[n+1]; for(int i = 1; i <= n; i++) { a[i] = sc.nextLong(); w[i] = 0; } int old = 0; long cur_v = 0; ...
Java
48f3ff32a11770f3b168d6e15c0df813
112efb76cb47256d2c03921974a5044f
1,200
PASSED
#include <string> #include <iostream> #include <fstream> #include <math.h> #include <vector> #include <time.h> #include <algorithm> #include <map> #include <set> using namespace std; string s[10000]; int sum[200][200]; int main() { int n,m; cin>>n>>m; for (int i=0;i<n;i++) { cin>>s[i]; }...
C++
d715095ff068f4d081b58fbfe103a02c
b83dcf2d0f75eddbd53c17ea4419eeed
800
PASSED
#include <iostream> using namespace std; int main () { int n,m; cin>>n>>m; char a [50][50]; int k,l=999999,r=0,s=0,count=0; bool p=true; bool q=false; for (int i=0;i<n;i++) { for (int j=0;j<m;j++) { cin>>a[i][j]; if (a[i][j]=='*') {if(p)k=i;if(j<l)l=j;p=false;} ...
C++
d715095ff068f4d081b58fbfe103a02c
1dae8eb606ccc9b06876462c8a90d2f1
800
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n, m, min, max, In = 51, Im = -1; cin >> n >> m; vector<int>v; char mat[50][50]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> mat[i][j]; if (mat[i][j] == '*') { if (i < In)In = i; ...
C++
d715095ff068f4d081b58fbfe103a02c
bc4d9417f6d0c8d1e5d1769a4e0cf62c
800
PASSED
#include <iostream> #include <string> using namespace std ; int main () { int r , c ; cin >> r >> c; string *grid = new string [r] ; for (int i = 0 ; i < r ; i++) { cin >> grid[i] ; } int mr = 100, mc = 100, xr = 0 , xc = 0; for (int i = 0 ; i < r ; i++) { ...
C++
d715095ff068f4d081b58fbfe103a02c
7c92316daa18d10a87e03b37345d7752
800
PASSED
#include <iostream> using namespace std ; int main () { int n , m ; cin >> n >> m ; int rmin = n , cmin = m, rmax = 0, cmax = 0; char **arr = new char* [n] ; for (int i = 0 ; i < n ; i++) { arr[i] = new char [m] ; for (int j = 0 ; j < m ; j++) { cin >>...
C++
d715095ff068f4d081b58fbfe103a02c
664659b0f59f1ae66e0d9b955100ee06
800
PASSED
#include<iostream> using namespace std; #include<string> #include<algorithm> #include<iomanip> void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } int main() { fast(); cout<<fixed<<setprecision(6); int n,m; cin>>n>>m; char a[50][50]; int x=-1,y=-1,z=-1,s=-1; for(int i=0...
C++
d715095ff068f4d081b58fbfe103a02c
a445513acd28042714f6cf3303249b97
800
PASSED
#include <iostream> #include <string> using namespace std; int main(){ int m,n, max = 0; cin >> m >> n; int min = n; string *a = new string [m]; for(int i = 0; i < m; i++){ cin >> a[i]; } int head, back, left = n; int right = 0; for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ if(a[i][j] == '*'...
C++
d715095ff068f4d081b58fbfe103a02c
0e552ce43fa91f8abf56eb191f1b2551
800
PASSED
#include<iostream> #include<string> #include<algorithm> using namespace std; int f[90][100]; int n, m; char s; int hangx[4409]; int coty[4999]; int tt = 0; void xaydung(int hang, int cot) { int x = hang; int y = cot; int bao1 = 0; int bao2 = 0; int demx = 0; int demy = 0; int maxx; if (m<n) maxx = n; else maxx...
C++
d715095ff068f4d081b58fbfe103a02c
3b9f83ba1c1facaa914d14a78a5d5c24
800
PASSED
#include <iostream> using namespace std; int main() { //freopen("INPUT.txt","r",stdin); char s[51][51]; int m,n,mxi=0,mxj=0,mni=50,mnj=50; cin>>m>>n; for(int i=0;i<m;i++) for(int j=0;j<n;j++) { cin>>s[i][j]; } for(int i=0;i<m;i++) for(int j=0;j<n;j++) { if (s[i][j]=='*') { if(i>mxi) ...
C++
d715095ff068f4d081b58fbfe103a02c
f075a1fa0719d4ba233afb59d106bd47
800
PASSED
#include <iostream> #include <fstream> #include <string> #include <vector> #define _CRT_SECURE_NO_WARNINGS using namespace std; void main(int argc, char **args) { int n, m; cin >> n >> m; //char d[50][50]; vector<string> d; string l; int x0 = 50, y0 = 50, x1 = -1, y1 = -1, aux; for(...
C++
d715095ff068f4d081b58fbfe103a02c
d5a14a96ad58826f04ecbc6b703a925f
800
PASSED
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for(int i = (a); i <= (b); i++) #define PER(i, a, b) for(int i = (a); i >= (b); i--) #define rep(i, a, b) for(int i = (a); i < (b); i++) #define all(S) (S).begin(), (S).end() #define pf push_front #define pb push_back #define mk make_pair #define S se...
C++
b85c8bfbe67a23a81bef755f9313115a
34cdd58417a4f490366a78609614fa94
1,500
PASSED