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 <cstdio> # include <cstring> # include <cmath> # include <cstdlib> # include <iostream> # include <vector> # include <algorithm> # include <queue> # include <set> # include <map> using namespace std; int main(){ int n; string formed="<3"; scanf("%d",&n); string part,final; for(int i=0;i<n;i++){ cin>>...
C++
36fb3a01860ef0cc2a1065d78e4efbd5
3b260b54ac787d73a769300e0c597be6
1,500
PASSED
for i in range(int(input())): a,b,c,d=map(int,input().split()) # a,b,c,d=l n=max(a-c-1,c) m=max(b-d-1,d) print(max(d*a,c*b,n*b,m*a))
Python
ccb7b8c0c389ea771f666c236c1cba5f
712c54208be4a777884a268813c66347
800
PASSED
t = int(input()) while t: a, b, x, y = map(int, input().split()) left = x*b; right = (a - 1 - x) * b up = a * y down = (b - 1 - y) * a print(max(max(left, right), max(up, down))) t -= 1
Python
ccb7b8c0c389ea771f666c236c1cba5f
9efa99ac63f1936400274efd09f76b6c
800
PASSED
t = int(input()) for _ in range(t): area = 0 inpt = input() num = list(map(int, inpt.split())) a = num[0] b = num[1] x = num[2] y = num[3] if ((a - x - 1) * b) >= ((b - y - 1) * a) and ((a - x - 1) * b) >= (a * y) and ((a - x - 1) * b) >= (b * x): print((a - x - 1) * b) ...
Python
ccb7b8c0c389ea771f666c236c1cba5f
fb6ae3cfb665c17e4f5fc77a40ba827b
800
PASSED
for _ in range(int(input())) : a,b,x,y = map(int,input().split()) m = ((b-1)-y)*a n = (y*a) p = ((a-1)-x)*b q = (x*b) ans = max(m,n,p,q) print(ans)
Python
ccb7b8c0c389ea771f666c236c1cba5f
7414c6794628e9c29e1a0ca37ebda01d
800
PASSED
for i in range(int(input())): a, b, x, y = map(int, input().split()) print(max(max(x, a - x - 1) * b, max(y, b - y - 1) * a)) #help from _IchBin_
Python
ccb7b8c0c389ea771f666c236c1cba5f
4e2810a72a43dec9ffd3c9eeaec72130
800
PASSED
t=int(input()) for i in range(t): ar=list(map(int,input().rstrip().split())) x=ar[2]+1 y=ar[3]+1 a=ar[0] b=ar[1] maxarea=(a-x)*(b) area=(y-1)*a if area>maxarea:maxarea=area area=(x-1)*b if area>maxarea:maxarea=area area=a*(b-y) if area>maxarea:maxarea=area print(maxar...
Python
ccb7b8c0c389ea771f666c236c1cba5f
46630f1445d60e0d1a9fd6d32f1fc9ee
800
PASSED
t = int(input()) solutions = [] for i in range(t) : string = str(input()) st = string.split() a = int(st[0]) b = int(st[1]) x = int(st[2]) y = int(st[3]) case1 = (b-y-1)*a case2 = y*a case3 = x*b case4 = (a-x-1)*b case = max(case1, case2, case3, case4) solutions.append(ca...
Python
ccb7b8c0c389ea771f666c236c1cba5f
e0026eb56299068ccfb6e1c85dcad908
800
PASSED
t = int(input()) matrix = [] def checkTop(a, y): base = 0 height = 0 if (y != 0): height += y base += a return base * height def checkRight(a, b, x): base = 0 height = 0 if (x != a): base +=(a-1)-x height += b return base * height def checkBottom(a, b,...
Python
ccb7b8c0c389ea771f666c236c1cba5f
47515f475f8c70712b62f500df2462ab
800
PASSED
test_cases = int(input()) for test in range(test_cases): w, l, x, y = input().split() w = int(w) l = int(l) x = int(x) y = int(y) width_choice = max(w - x - 1, x - 0) length_choice = max(l - y - 1, y - 0) best_area = max(width_choice * l, length_choice * w) print(best_area)
Python
ccb7b8c0c389ea771f666c236c1cba5f
d65b98f63fd734b4f19a3f0b8133d78c
800
PASSED
t=int(input()) for n in range(1,t+1): list=[] for n in range(1,t+1): a,b,x,y = input().split() x=int(x) y=int(y) a=int(a) b=int(b) list.append(max(x*b, (a-x-1)*b, a*(y), a*(b-y-1))) for n in list: print(n)
Python
ccb7b8c0c389ea771f666c236c1cba5f
52c6fbfbce2c9e6f52fa38e65dd6b466
800
PASSED
#include <bits/stdc++.h> using namespace std; #define MAXN 100000 #define rint register int inline int rf(){int r;int s=0,c;for(;!isdigit(c=getchar());s=c);for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);return s^45?r:-r;} int Wu[4096], f[64][64][104], g[4096][104], w[16], m, n, q, E, K, B = 6, L = 63, H = 4032; char _[...
C++
736b35e915e67ca63e07386059aca2e5
0a14d2aa9342a48d1ee13405707c0fc8
1,900
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define xx first #define yy second const int B=500; using namespace std; using namespace __gnu_pbds; #define be begin() #define rb rbegin() #define all(v) v.begi...
C++
736b35e915e67ca63e07386059aca2e5
804fb152ecfeb5a8d4f0216840cf0878
1,900
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define xx first #define yy second const int B=500; using namespace std; using namespace __gnu_pbds; #define be begin() #define rb rbegin() #define all(v) v.begi...
C++
736b35e915e67ca63e07386059aca2e5
6663fa5fbe66df96894da74c6a6dec99
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define for1(i,a,b) for(int i=a;i<=b;i++) #define fastio ios_base::sync_with_stdio(0); cin.tie(0); const int MAX0=13; const int MAX1=4097; const int MAX2=101; int n,m,q,l; int v[MAX0],a[MAX1],t[MAX1]; int r[MAX1][MAX2]; void enter() { fastio; cin>>n>>m>>q; fo...
C++
736b35e915e67ca63e07386059aca2e5
fc9c05e8d968ea2861738dde4e775fea
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define for1(i,a,b) for(int i=a;i<=b;i++) #define fastio ios_base::sync_with_stdio(0); cin.tie(0); const int MAX0=13; const int MAX1=1<<13; const int MAX2=101; int n,m,q,l; int v[MAX0],a[MAX1],t[MAX1]; int r[MAX1][MAX2]; void enter() { fastio cin>>n>>m>>q; fo...
C++
736b35e915e67ca63e07386059aca2e5
ac172b75c752b4de8a8f730cb34add0d
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define for1(i,a,b) for(int i=a;i<=b;i++) const int MAX0=13; const int MAX1=4097; const int MAX2=101; int n,m,q,l; int v[MAX0],t[MAX1],a[MAX1]; int r[MAX1][MAX2]; void enter() { ios_base::sync_with_stdio(false); cin.tie(0); cin>>n>>m>>q; for1(i,0,n-1) cin...
C++
736b35e915e67ca63e07386059aca2e5
b16b6199995c09adb87419a18b616b2e
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, q, k, MAXW = 1; string s, t; cin >> n >> m >> q; vector<int> w(n); for (int i = 0; i < n; i++){ cin >> w[i]; MAXW += w[i]; } MAXW = min...
C++
736b35e915e67ca63e07386059aca2e5
8473dd000cb3a5ae83c1396558a5271a
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int wu(int u, int v, vector<int>* w) { int answer = 0; for (size_t i = 0; i < (*w).size(); i++) if ((u >> i & 1) == (v >> i & 1)) answer += w->at((*w).size() - 1 - i); return answer; } int main() { ios::sync_with_stdio(0); ...
C++
736b35e915e67ca63e07386059aca2e5
fdec3be94f35776c1f5a29beb8c4461d
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int wu(int u, int v, vector<int>* w) { int answer = 0; for (size_t i = 0; i < (*w).size(); i++) if ((u >> i & 1) == (v >> i & 1)) answer += w->at((*w).size() - 1 - i); return answer; } int main() { ios::sync_with_stdio(0); ...
C++
736b35e915e67ca63e07386059aca2e5
79da8089d7a2e86af5df90452fce2283
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int wu(int u, int v, vector<int>* w) { int answer = 0; for (size_t i = 0; i < (*w).size(); i++) if ((u >> i & 1) == (v >> i & 1)) answer += w->at((*w).size() - 1 - i); return answer; } int main() { ios::sync_with_stdio(0); ...
C++
736b35e915e67ca63e07386059aca2e5
2d964f057f7502f863b1f0c5a1631a64
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int #define vi vector<int> #define pb push_back #define ff first #define ss second #define ppi pair<int,int> #define forn(i,n) for(int i=0;i<n;i++) #define M 1000000007 #define all(x) x.begin(), x.end() #define fastio ios_base::sync_with_stdio(false);ci...
C++
fc01082e3ed7877126e750bc380f5c63
a725714ce5e09d944bd217352b509529
1,300
PASSED
#include <bits/stdc++.h> using namespace std; void solve() { int a,b; cin>>a>>b; string s; cin>>s; s=s+'0'; int n=s.size(); int count0=0; int cost=0; int start=0,endd=n; for(int i=0;i<n;i++){ if(s[i]=='0') start++; else break; } for(int i=n-1;i>0;i--){ if(s[i...
C++
fc01082e3ed7877126e750bc380f5c63
b6bf3256b60b4f54c5e04e95fb531b8a
1,300
PASSED
#include <bits/stdc++.h> using namespace std; void solve() { int a,b; cin>>a>>b; string s; cin>>s; //s=s+'0'; int n=s.size(); int count0=0; int cost=0; int start=0,endd=n; for(int i=0;i<n;i++){ if(s[i]=='0') start++; else break; } for(int i=n-1;i>0;i--){ if(s...
C++
fc01082e3ed7877126e750bc380f5c63
23ea783b8d77e780ea377f980844d20c
1,300
PASSED
#include<bits/stdc++.h> #include<chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; using namespace __gnu_pbds; #define ll long long int #define ull unsigned long long int #define FOR(I,a,b) for(int I=a;I<b;I++) #define FORit(it,a) for...
C++
fc01082e3ed7877126e750bc380f5c63
3434bf28d0622500da92b940dfdd8218
1,300
PASSED
#include<bits/stdc++.h> #include<chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; using namespace __gnu_pbds; #define ll long long int #define ull unsigned long long int #define FOR(I,a,b) for(int I=a;I<b;I++) #define FORit(it,a) for...
C++
fc01082e3ed7877126e750bc380f5c63
97c868cb73eb2234bc5b70619bac97c8
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long const ll MOD = 1000000007; long long int mem[5001] = {INT_MIN}; ll int ct = 0; int main() { // freopen("input01.txt", "r", stdin); // freopen("output01.txt", "w", stdout); ll int t; cin >> t; while (t--) { ll int a, b; ...
C++
fc01082e3ed7877126e750bc380f5c63
169388c538eddc3f3810d139a1ddf6a2
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define int long long #define ll long long #define pii make_pair #define pb push_back #define ff first #define ss second int ceil(int a, int b) { if(a%b==0) return a/b; else return a/b+1; } bool checkbit(int p...
C++
fc01082e3ed7877126e750bc380f5c63
c051edc3513d1d82f3136811a85db44d
1,300
PASSED
#include<bits/stdc++.h> #define ll long long #define ull unsigned long long #define in(ar,n) for(int i=0;i<n;i++)cin>>ar[i] #define in2d(ar,n,m) for(int i=0;i<n;i++)for(int i=0;i<m;i++)cin>>ar[i] #define out(ar,n) \ for(int i=0;i<n;i++) \ cout<<ar[i]<<" "; \ cout<<endl; #define swap(a,b)\ int t = a; \...
C++
fc01082e3ed7877126e750bc380f5c63
9d9416b60d604bc52f8ba6c7a962ad60
1,300
PASSED
#pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define vii vector<int> #define vll ...
C++
fc01082e3ed7877126e750bc380f5c63
4a1772d99ee76aa80a1eac3a7929459f
1,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef long long int ll; typedef pair<int,int> pii; #define all(x) (x).begin(),(x).end() #define sz(x) x.size() #define mp(x,y) make_pair((x),(y)) void solve(){ int a,b; cin>>a>>b; string s; cin>>s; vector<pii> v; int i=0;...
C++
fc01082e3ed7877126e750bc380f5c63
1a1da7f65ec2cbdd64b0ebe69a37b00d
1,300
PASSED
ax,ay,bx,by,tx,ty=map(int,input().split()) n=int(input()) l=[tuple(map(int,input().split())) for _ in range(n)] a,b=[],[] for i in range(n): x,y=l[i] lt=((tx-x)*(tx-x)+(ty-y)*(ty-y))**0.5 la=((ax-x)*(ax-x)+(ay-y)*(ay-y))**0.5 lb=((bx-x)*(bx-x)+(by-y)*(by-y))**0.5 a+=[(la-lt,i)] b+=[(lb-lt,i)] a.sort();b.sor...
Python
ae8687ed3cb5df080fb6ee79b040cef1
8694d69785e15093f3cc9909d405f96b
1,800
PASSED
def readlist(): return list(map(float, input().split())) def hypot(P): a = 0 for p in P: a += p*p return a**0.5 def dist(P1, P2): P = [P1[i] - P2[i] for i in range(len(P1))] return hypot(P) ax, ay, bx, by, tx, ty = readlist() A = [ax, ay] B = [bx, by] T = [tx, ty] n = int(input()) Bot...
Python
ae8687ed3cb5df080fb6ee79b040cef1
57f28e32ff1eda0458118f85bfec34b7
1,800
PASSED
#import math def readlist(): return list(map(float, input().split())) def dist(P1, P2): aa = (P1[0] - P2[0]) bb = P1[1] - P2[1] return (aa*aa + bb*bb)**0.5 ax, ay, bx, by, tx, ty = readlist() A = [ax, ay] B = [bx, by] T = [tx, ty] n = int(input()) Bottles = [] for i in range(n): Bottles.append(r...
Python
ae8687ed3cb5df080fb6ee79b040cef1
8edcccb4d1fd15a12538353c6d870ef3
1,800
PASSED
import math def readlist(): return list(map(float, input().split())) def dist(P1, P2): return math.hypot(P1[0] - P2[0], P1[1] - P2[1]) ax, ay, bx, by, tx, ty = readlist() A = [ax, ay] B = [bx, by] T = [tx, ty] n = int(input()) Bottles = [] for i in range(n): Bottles.append(readlist()) dists_to_T = [dist...
Python
ae8687ed3cb5df080fb6ee79b040cef1
87b75a50ec9bfc676955724f3f083975
1,800
PASSED
#import math def readlist(): return list(map(float, input().split())) def dist(P1, P2): return ((P1[0] - P2[0])*(P1[0] - P2[0]) + (P1[1] - P2[1])*(P1[1] - P2[1]))**0.5 ax, ay, bx, by, tx, ty = readlist() A = [ax, ay] B = [bx, by] T = [tx, ty] n = int(input()) Bottles = [] for i in range(n): Bottles.appe...
Python
ae8687ed3cb5df080fb6ee79b040cef1
a03e30612b7bdbe019cb6d5b6187fa09
1,800
PASSED
read = lambda: map(int, input().split()) ax, ay, bx, by, tx, ty = read() n = int(input()) p = [tuple(read()) for i in range(n)] a, b = [], [] for i in range(n): x, y = p[i] pt = ((tx - x) ** 2 + (ty - y) ** 2) ** 0.5 pa = ((ax - x) ** 2 + (ay - y) ** 2) ** 0.5 pb = ((bx - x) ** 2 + (by - y) ** 2) ** 0.5...
Python
ae8687ed3cb5df080fb6ee79b040cef1
d9962201ae8a092b24cd0748bf21676d
1,800
PASSED
read = lambda : map(int, input().split()) def dis(x1, y1, x2, y2): return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 ax, ay, bx, by, tx, ty = read() n = int(input()) a, b = [], [] sum = 0 for i in range(n): x, y = read() dist = dis(tx, ty, x, y) a.append((dis(ax, ay, x, y) - dist, i)) b.a...
Python
ae8687ed3cb5df080fb6ee79b040cef1
0adb6957fb524cc81f44f1abd0a5be07
1,800
PASSED
import math def dis(x1, y1, x2, y2): return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) str = input().split() argu = [] for i in str: argu.append(int(i)) n = int(input()) total = 0 array = [[], []] for i in range(n): x, y = input().split() x = int(x) y = int(y) td = dis(x, y, argu[4], argu[5]) ad = dis(...
Python
ae8687ed3cb5df080fb6ee79b040cef1
b65be4ef81b0932a71d069dc748eb171
1,800
PASSED
import os,io from sys import stdout import collections # import random # import math # from operator import itemgetter input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline # from collections import Counter # from decimal import Decimal # import heapq # from functools import lru_cache import sys # import threadi...
Python
ae8687ed3cb5df080fb6ee79b040cef1
9e61aed151a6588874677bbadc924dfd
1,800
PASSED
def glen(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5 xa, ya, xb, yb, xt, yt = map(int,input().split()) n = int(input()) x = [0]*n y = [0]*n for i in range(n): x[i], y[i] = map(int,input().split()) inf = 10**10 afmin = [0, 0] asmin = [0, 0] for i in range(n): a = glen(xa,ya,x[i],y[i])-glen(xa,ya,xt,yt)...
Python
ae8687ed3cb5df080fb6ee79b040cef1
8ce198844ff74b83e18276ec59ac16bf
1,800
PASSED
import java.math.*; import java.io.*; public class C408C{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] num1=br.readLine().split(" "); int A=Integer.parseInt(num1[0]); int B=Integer.parseInt(num1[1])...
Java
a949ccae523731f601108d4fa919c112
48965e532f595240288b631f9d878991
1,600
PASSED
import java.util.Scanner; public class test { public static void main(String args[]) { Scanner input = new Scanner(System.in); double a = input.nextInt(); double b = input.nextInt(); input.close(); double c = a * a + b * b; double xA = 0, yA = 0, xB = 0, yB = 0; ...
Java
a949ccae523731f601108d4fa919c112
336f5e550389065b158b9b569d699116
1,600
PASSED
import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class solver implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTok...
Java
a949ccae523731f601108d4fa919c112
4ea4226af5fba4d186e36dc29928b1e5
1,600
PASSED
import java.util.*; public class C { Scanner sc = new Scanner(System.in); void doIt() { int a = sc.nextInt(); int b = sc.nextInt(); if(a > b) { int tmp = a; a = b; b = tmp; } // swap for(int x = 1; x < a; x++) { for(int y = 1; y < a; y++) { if(x*x + y*y == a*a) { // candidate int m = x * b / a; ...
Java
a949ccae523731f601108d4fa919c112
ee27e7b44151c825aa5d4e47255daf1f
1,600
PASSED
import java.util.*; public class a { public static void main(String[] args) { Scanner input = new Scanner(System.in); int a = input.nextInt(), b = input.nextInt(); int g = gcd(a, b); if(a>b) { int temp = a; a = b; b = temp; } int[] first = py(g); if(first.length == 0 || f...
Java
a949ccae523731f601108d4fa919c112
1101be5a1e5e446a1330f7143a66e4bd
1,600
PASSED
import java.io.InputStream; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class CF239CDev2 { class Triangle implements Comparable<Triangle> { int a, b, c; Triangle(int a, int b, int c) { this.a = a; this.b = b; this.c = c; } @Override pu...
Java
a949ccae523731f601108d4fa919c112
b4304372312fdb0fa580adfef939f6c8
1,600
PASSED
import java.io.*; import java.util.StringTokenizer; /** * Created by Vadim Semenov on 30-03-2014. */ public class TaskC implements Runnable { private Output solve(Input input) { for (int i = 1; i <= input.b; i++) { for (int j = 1; j < i; j++) { int k = i - j; i...
Java
a949ccae523731f601108d4fa919c112
7341466de7441f565bac53409aaa5814
1,600
PASSED
import java.util.List; import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author desc */ public class Main { public static void m...
Java
a949ccae523731f601108d4fa919c112
df489870b1f194e987454e621900b0d4
1,600
PASSED
import java.util.*; import java.awt.Point; import java.io.*; import java.math.BigInteger; public class C1 { FastScanner in; PrintWriter out; public int gcd(int a, int b) { while (b !=0) { int tmp = a % b; a = b; b = tmp; } ...
Java
a949ccae523731f601108d4fa919c112
9a912d2547236b5b6f8caf0fc51ecbef
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Triangle { static class Point { long x, y; Point(long x, long y) { this.x = x; this.y = y; } public long sqDist(Point o) { long xD...
Java
a949ccae523731f601108d4fa919c112
9a5b9b1032017c0998099363ce792103
1,600
PASSED
#include <bits/stdc++.h> #define pb push_back #define ll long long #define endl "\n" #define mp make_pair #define all(c) (c).begin(),(c).end() #define hell 1000000007 #define ff first #define ss second #define pii pair<ll,ll> #define bs binary_search #define upd upper_bound #define lbd lower_bound #define vi vector<ll>...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
04dc2d82946ab88e5504dfd0da6a7027
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int n; long long w[100003]; vector<vector<int>>tree; vector<pair<long long,long long>>oper; void dfs(int node,int par){ for(auto i:tree[node]){ if(i!=par){ dfs(i,node); oper[node].first=max(oper[node].first,oper[i].first); oper[node].second=max...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
7598e7b9394265fe316c5f237912166c
1,800
PASSED
// Author :mastermindevil/mdragneell #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ull unsigned long long #define ll long long #define int long long #define ld long double #define pb push_back #define pi pair< int,int > #define pl pair< l...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
00fec624a93e0370edb8ddb100750eb2
1,800
PASSED
#include <bits/stdc++.h> #define endl "\n" using namespace std; using ll = long long; using pii = pair<int, int>; constexpr int N = 1e5+5; int n, a, b; ll val[N]; vector<int> gr[N]; bool used[N]; pair<ll, ll> dfs(int i = 1) { used[i] = true; ll m[]{0, 0}; for (int j: gr[i]) if (!used[j]) { au...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
dbe7e5a0a297379d1ceab57d1e971244
1,800
PASSED
/* Vivek Rathi CSE 2nd Year MNNIT */ #include<bits/stdc++.h> using namespace std; #define M 1000000007 #define ll long long int #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define debug1(x) cout<<#x<<" "<<x<<endl; #define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<end...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
ed67e3810f24712c4520f4363282b687
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define mp make_pair #define int long long #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid (...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
58b59f8216985ce51dbd70b01acdd43c
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second typedef long long ll; int n; ll val[100010]; vector<int> adj[100010]; pair<ll, ll> dfs(int u, int from) { ll inc = 0, dec = 0; for (auto v: adj[u]) { if (v == from) continue; auto a = dfs(v, u); inc = max(inc, a.ff); ...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
309c3cdb9cb48d0590d7fb94a251cb9f
1,800
PASSED
#include <bits/stdc++.h> #define loop(i, n) for(int i = 0; i < n; i++) #define loop1(i, a, n) for(int i = a; i < n; i++) #define PI 3.141592653589793238 #define bc __builtin_popcountll #define pf push_front #define pb push_back #define rf pop_front #define rb pop_back #define fs first #define sc second #define mp make...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
e36c730b88fd7b4712de8d533bc03cf6
1,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n, x, y; int arr_num[N], arr_mark[N]; long long dp[N][2]; vector <int> gr[N]; void dfs (int a) { for (int u = 0; u < gr[a].size(); u++) { if (arr_mark[a] != gr[a][u]) { arr_mark[gr[a][u]] = a; dfs(gr[a][u]); dp[a][0] = max(dp[a][...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
d4228a3062a131d745e3655769ccaeee
1,800
PASSED
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; using ull = unsigned long long; using ll = long long; vector<int> *adj = nullptr; void dfs(int curr, int prev, vector<pair<ll, ll>> &dp, vector<ll> &v) { for (auto &&next...
C++
f3c26aa520f6bfa6b181ec40bde7ee1b
71c359dd29a6e19d38c8798b148213df
1,800
PASSED
from collections import defaultdict def findLen(s): N = len(s) def checkFor(size): left, right = 0, size-1 c = defaultdict(int) for i in range(left, right+1): c[s[i]] += 1 while right < N-1: if c["1"]>0 and c["2"]>0 and c["3"]>0: return True ...
Python
6cb06a02077750327602a1a7eeac770f
303c8dc84d5c0e26afad1fe907c20820
1,200
PASSED
from collections import deque def check(dic): if dic['1'] > 0 and dic['2'] and dic['3']: return True return False def solution(): n = input() s = 0 e = 0 d = deque([]) d_dic = {'1': 0, '2': 0, '3': 0} ans = 100000000 while 1: if ans == 3: break ...
Python
6cb06a02077750327602a1a7eeac770f
e89e00eaed56d85809836149613693e5
1,200
PASSED
#coding isn't(not) for me. i have seen this solution before t=int(input()) while t: s=input() if s.count('1')==0 or s.count('2')==0 or s.count('3')==0: print("0") t-=1 continue cl=[] sv=s[0] counter=1 for i in range(1,len(s)): if s[i]==sv: counter+=1 else: cl.append((sv,counter)) counter=1 ...
Python
6cb06a02077750327602a1a7eeac770f
cb6bea0d67781742ccb7b6bd637c6b06
1,200
PASSED
def find(arr, ind): s = 0 e = len(arr)-1 ans = -1 while s <= e: # print(s, e) mid = (s+e)//2 if arr[mid] > ind: ans = arr[mid] e = mid-1 else: s = mid+1 return ans t = int(input()) for _ in range(t): s = input() a, b, c = [], [], [] for i in range(len(s)): if s[i] == '1': a += [i] elif...
Python
6cb06a02077750327602a1a7eeac770f
e91d153659b648f9abd024c86f7669ea
1,200
PASSED
t = int(input()) for _ in range(t): s = input() o = -1 tw = -1 th = -1 b = 2000000 for i in range(len(s)): if s[i]=="1": o = i elif s[i]=="2": tw = i else: th = i if o!= -1 and tw!= -1 and th != -1: z = max([o,th,tw...
Python
6cb06a02077750327602a1a7eeac770f
a9a4e78d90dd923571efd0bb18d2bb63
1,200
PASSED
for _ in range(int(input())): s=input() if len(set(s))<3: print(0) else: ans=len(s) mark=[0,0,0] mark[0]=s.find('1') mark[1]=s.find('2') mark[2]=s.find('3') r=max(mark) l=-1 while ans>3 and r!=-1: if mark[0]!=r:mark[0]=s....
Python
6cb06a02077750327602a1a7eeac770f
7e26aa836b37e7d01494c4b784328f8d
1,200
PASSED
for _ in range(int(input())): s=input() n=len(s) ans=n+1 l=0 b=0 count=[0 for i in range(4)] for i in range(n): count[int(s[i])]+=1 while count[int(s[l])]>1: count[int(s[l])]-=1 l+=1 if count[1]>0 and count[2]>0 and count[3]>0: ans=...
Python
6cb06a02077750327602a1a7eeac770f
eacd4833a57d8aa878591bd3d44fbcbf
1,200
PASSED
no_of_chars = 256 def findSubString(string, pat): len1 = len(string) len2 = len(pat) if len1 < len2: return "" hash_pat = [0] * no_of_chars hash_str = [0] * no_of_chars for i in range(0, len2): hash_pat[ord(pat[i])] += 1 start, start_index, min_len = 0, -1, float('inf') count = 0 for...
Python
6cb06a02077750327602a1a7eeac770f
90f6d65cb73214110a55d8b0881c623f
1,200
PASSED
for _ in range(int(input())): s=input();n=len(s);p,q,r=-1,-1,-1;ans=n+1 for i in range(n): if s[i]=="1":p=i elif s[i]=="2":q=i else:r=i if p>=0 and q>=0 and r>=0: mi=min(p,q,r) ma=max(p,q,r) ans=min(ans,ma-mi+1) if ans==n+1: print(0) else: print(ans)
Python
6cb06a02077750327602a1a7eeac770f
a3f8e9617a2191ceb8f0d04c6858ac4c
1,200
PASSED
n = int(input()) for _ in range(n): ans = float("inf") v=[] a = input() for i in a: if v==[]: v.append(i) else: if len(v)>1: if i!=v[0] and i!=v[1]: v.append(i) ans = min(len(v),ans) v = [v[-2],v[-1]] elif i==v[0]: v =[v[-1]] v.append(i) else: v.append(i) else:...
Python
6cb06a02077750327602a1a7eeac770f
958eb3f192762db31b984926e6777586
1,200
PASSED
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; // +8 public class cf1375f { public static void main(String[] args) throws IOException { long a[][] = new long[3][2]; r(); for (int i = 0; i < 3; ++i) { a[i][0] = nl(); ...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
1b018d96fb6f971029ca0250ffe2c3d2
2,600
PASSED
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1375f { public static void main(String[] args) throws IOException { long a[] = rla(3), op; prln("First"); flush(); prln(op = maxof(a)); flush(); a...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
563e10e72387c586edfd4e808585260f
2,600
PASSED
import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.System.exit; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
0e786332ba7f15d094a64b442a0cc8e5
2,600
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.io.IOException; import java.util.InputMismatchException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
d5daa818f71ed93ca18038d56f906f21
2,600
PASSED
import java.io.*; import java.util.*; import java.math.*; public class F { public static void main(String[] args)throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); long a = sc.nextInt(); long b = sc.nextInt(); long c = sc.nextInt(); long query = 1000000...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
0ac9a251b47d2a96dddcf24ad71660eb
2,600
PASSED
//package global9; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class F2 { Scanner in; PrintWriter out; String INPUT = ""; void solve() { int n = 3; long[] a = new long[n]; for(int i = 0;i < n;i++) { a[i] = ni(); } out.println("First"); out.flush(); l...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
7134a43ea3e4045541741b0707e6e9f7
2,600
PASSED
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { try{ PrintWriter out = new PrintWriter(System.out); long[] a=new long[3]; for(int i=0;i<3;i++){ a[i]=in.nextInt(); ...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
df84a1e067bcfca08c917db4531d4878
2,600
PASSED
import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class template { public static void main(String[] args) throws Exception { new template().run(); } public void run() throws Exception { FastScanner f = new FastScanner(); PrintWriter out = new PrintWriter(System.out); /// ...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
f4357c657f57f07d7591b21676becf65
2,600
PASSED
import java.util.*; public class Question6 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { long[] arr = new long[3]; arr[0] = sc.nextLong(); arr[1] = sc.nextLong(); arr[2] = sc.nextLong(); long max = -1;long other = -1; long maxi = 0;long min = -1; if(arr[0] >=...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
c8f43d2ea8d0b5802a65c8b6dcdd9144
2,600
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class...
Java
351c6fb0a9d1bbb29387c5b7ce8c7f28
2dabf5a4f2248b84360eeed60a28568d
2,600
PASSED
#include<cstdio> #include<cmath> struct node { long long P; int K,l; }A[100]; long long B[100][100]; int T,N,i,j; long long V,S,p,X,Y,Z; void dfs2(int x,long long b) { int i; long long a,c; if(b*b*p>V) return; if(x>N) { a=p,c=V/a/b; if(a*b+a*c+b*c<S) { S=a*b+a*c+b*c; X=a,Y=b,Z=c; } return; } fo...
C++
50068fdc898ee1f8d7220d9782ce50cf
ef0b5c992ec2f6180382f7276074a8ab
2,900
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <iostream> #include <sstream> #include <vector> #include <string> #include <queue> #include <list> #include <algorithm> #include <map> #include <set> #include <stack> using namespace std; #define all(c) (c).begin(),(c).end() #define ...
C++
50068fdc898ee1f8d7220d9782ce50cf
325c833bad8409f86b56f8a017c62a6c
2,900
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <algorithm> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <cstdlib> #include <string> #include <cstring> #include <cstdio> #include <cmath> #include <cstdli...
C++
50068fdc898ee1f8d7220d9782ce50cf
5bad0d9ee35c7ef6a3ec781dc5b64cfa
2,900
PASSED
#include <iostream> #include <cmath> #include <map> using namespace std; const int N = 20; const double eps = 1e-8; int n, sqrt3, sqrt2; pair<long long, int> p[N]; long long v, ans, ansa, ansb, ansc; void dfsb(int k, int a, long long b) { if (b > sqrt2) return; if (k == n + 1) { long long c = v / a / b, s = 2ll ...
C++
50068fdc898ee1f8d7220d9782ce50cf
fb269301727aa21a4a87ca41a8cb8b90
2,900
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; bool stop; long long int ans,V,BC,ansA,ansB,ansC,lim,A,p[1000],rem[1000]; int k,a[1000],b[1000]; void calc(); long long int power(long long int a,int b); void dfsA(int dep,long long int A0) { if(A0*A0*A0...
C++
50068fdc898ee1f8d7220d9782ce50cf
94616430201bb188646bdc736137f77f
2,900
PASSED
#include <cstdio> #include <cmath> int _,n;long long v,p[100][100],e[100],ans,p1,p2,p3,q1,q2,q3; void dfs2(long long x,int d) { if (x*x*p1>v) return; if (d>n) { p2=x;p3=v/p1/p2; if (p1*p2+p1*p3+p2*p3<ans) ans=p1*p2+p1*p3+p2*p3,q1=p1,q2=p2,q3=p3; } else { for (int t=e[d];t>=0;t--) dfs2(x*p[d][t],d+1); } } void...
C++
50068fdc898ee1f8d7220d9782ce50cf
d3340fc71e172bd40fc5f5d898705d01
2,900
PASSED
#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <cmath> using namespace std; enum {MAXN = 70}; typedef long long ll; pair<ll,int> p[MAXN]; int seq[MAXN]; ll v[MAXN][MAXN]; const ll INF = 1LL << 62; ll val; int maxa,maxb,curb,N; void searchB(int k,int cur) { if (k == N) ...
C++
50068fdc898ee1f8d7220d9782ce50cf
23847b431336622091e3f1cc902233d3
2,900
PASSED
#include<cstdio> #include<cmath> typedef long long ll; int T,i,j,n,q[20]; ll A,B,C,a,b,c,M,MA,ans,v,p[20]; void cal(int s,ll now) { if(now>M)return; if(s>n) { if(now<a)return; b=now,c=v/a/b; if(a*b+a*c+b*c<ans) ans=a*b+a*c+b*c,A=a,B=b,C=c; return; } if(q[s]) q[s]--,cal(s,now*p[s]),q[s]++; cal(s+1,now...
C++
50068fdc898ee1f8d7220d9782ce50cf
2bd1c9fd083ddc9231159fca77862124
2,900
PASSED
#include<cstdio> #include<cstring> #include<cmath> #define ll long long using namespace std; const int N=50; int T,n,p[N]; ll v[N],V,A,B,C,a,b,c; ll LA,LB,Ans; void Dfs_b(int k,ll num){ if (num>LB) return; if (k>n){ c=V/a/(b=num); if (a>b or b>c or a>c) return; ll ans=2*V/a+2*a*(b+c); if (ans<Ans) A=a,B=b,C=...
C++
50068fdc898ee1f8d7220d9782ce50cf
90065653deaab1f15d2f9b468335eb95
2,900
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long LL; struct Tpair{ LL x,y; Tpair(LL _x=0,LL _y=0){x=_x,y=_y;} inline bool operator <(const Tpair &b)const{ return x!=b.x?x<b.x:y<b.y; } }; struct Tcxx{ LL a,b,c,...
C++
50068fdc898ee1f8d7220d9782ce50cf
e1158396a37c85580534756c731f5a94
2,900
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <stack> #include <cstdio> #include <deque> #include <ctime> #include <climits> #include <queue> #include <iomanip> #include <cmath> using namespace std; #define lli long long int main() { ios::sync_with_stdio(0); cin.tie(nullptr); int n; ...
C++
5cb7ce7485c86ca73c0adfd27227adf9
9d558c3d63a922f582e1d0d13e0daefd
2,400
PASSED
#pragma GCC optimize("O0") #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N; double v[maxn] , w[maxn]; double S1[maxn] , S2[maxn]; double vv[maxn] , ww[maxn]; // x = ((w + v) +- sqrt((w + v)^2 - 4v)) / 2 // y = v / x int main(){ scanf("%d" , &N); for(int i = 1; i <= N; ++i)scanf("%lf" , ...
C++
5cb7ce7485c86ca73c0adfd27227adf9
68c709e42ea643b53cd9d4cd28790b2a
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define ff first #define ss second using ll = long long int; using ull = unsigned long long int; using dd = double; using ldd = long double; using si = short int; #ifdef HOME #define debu...
C++
5cb7ce7485c86ca73c0adfd27227adf9
7c47d1f745d42e7beb0f8a4fb27172d2
2,400
PASSED
#ifdef ONLINE_JUDGE #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #endif #include <bits/stdc++.h> #define debug std::cerr << "Debug(" << __LINE__ << "): " #define pub push_back #define pob pop_back #define pup push #defin...
C++
5cb7ce7485c86ca73c0adfd27227adf9
fb0449463f7878b67c40e8ec34a3dee7
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/priority_queue.hpp> //#pragma GCC optimize("O3") //#pragma GCC target("sse4") //#pragma GCC target("avx2") #define deb(x) cout << #x << " = " << x << "\n" #define all(x) (x).begin(), (x).end() #de...
C++
5cb7ce7485c86ca73c0adfd27227adf9
990777cfcaab7211b51f391306401b06
2,400
PASSED
#include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; double xi[n], yi[n]; for (int i = 0; i < n; i++) cin >> xi[i]; for (int i = 0; i < n; i++) cin >> yi[i]; double a[n + 1], b[n + 1], xt = 0, y...
C++
5cb7ce7485c86ca73c0adfd27227adf9
6234a1466a2028d97ff2fe603e3f69a0
2,400
PASSED
//#pragma GCC optimize("O0") #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N; double v[maxn] , w[maxn]; double S1[maxn] , S2[maxn]; double vv[maxn] , ww[maxn]; // x = ((w + v) +- sqrt((w + v)^2 - 4v)) / 2 // y = v / x int main(){ scanf("%d" , &N); for(int i = 1; i <= N; ++i)scanf("%lf" ...
C++
5cb7ce7485c86ca73c0adfd27227adf9
1d68fd7a4949685ed7ac6cbf4e44a9eb
2,400
PASSED
#pragma GCC optimize("O0") #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N; double v[maxn] , w[maxn]; double S1[maxn] , S2[maxn]; double vv[maxn] , ww[maxn]; // x = ((w + v) +- sqrt((w + v)^2 - 4v)) / 2 // y = v / x int main(){ scanf("%d" , &N); for(int i = 1; i <= N; ++i)scanf("%lf" , ...
C++
5cb7ce7485c86ca73c0adfd27227adf9
240b999ae4ceb46fe20beac553a2839e
2,400
PASSED
#include<bits/stdc++.h> using namespace std; double pmax[200001],pmin[200001],sb[200001],sa[200001]; int n; int main() { scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%lf",pmax+i),pmax[i]+=pmax[i-1]; for(int i=1;i<=n;i++)scanf("%lf",pmin+i); for(int i=n-1;i;i--)pmin[i]+=pmin[i+1]; for(int i=1;i<=n;i++) { double a...
C++
5cb7ce7485c86ca73c0adfd27227adf9
b33d43879e7d49953481f78755d8d04c
2,400
PASSED