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
//upsolve #include<bits/stdc++.h> using namespace std; int main() { int n;cin>>n; map<long long int,long long int >mp; for(int i=1;i<=n;i++) { int x; cin>>x; mp[x-i]+=x; } long long int sum=0; for(auto &i: mp) { sum=max(sum,i.second); } cout<<sum<<endl; return 0; ...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
ecd4c7f494ba643b537a39855f5af03e
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { vector< pair <long long,long long> >v; vector<long long int>ans; vector<int>::iterator it; long long int n,i,sum=0,length; cin>>n; long long int a[n]; for(i=0;i<n;i++) { cin>>a[i]; v.push_back( make_pair(a[i]-i-1,i+1) ); ...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
0d4db3587fb41f52df807d38ef87d33f
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; map<long long int,long long int>Sum; for(long long int i=1;i<=n;i++){ long long int x; cin >> x; Sum[i - x] += x; } long long int ans = 0; for(auto i : Sum){ ans = max(ans , i.s...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
c77df15f719d32bccace79fd60546e39
1,400
PASSED
#include <bits/stdc++.h> using namespace std; long long int fac(int a) { if(a<0) return 400000-a; return a; } int main() { vector <int> a; long long int n,b[1000005],c[1000005]={0},d[1000005]={0},ans=0,t=0,s=0,x=0,y=0; scanf("%lld",&n); for(int i=1;i<=n;i++) { scanf("%lld",&b[i]); d[i]=fac(b[...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
92fb1ef7bffdd209f86747fee1a64171
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn0=200010; const int maxn1=800010; const int maxn2=400000; ll b[maxn0]; ll a[maxn1]; int main() { int n; scanf("%d",&n); memset(a,0,sizeof(a)); ll ans=0; for(int i=1;i<=n;i++){ scanf("%lld",&b[i]); a[b[i...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
a049185861948f0937391a7c35bdce1c
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define _ ios_base::sync_with_stdio(0);cin.tie(0); #define endl '\n' #define ff first #define ss second #define pb push_back typedef long long ll; typedef pair<int, int> pii; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; int main(){ _ int...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
54ab7da342a56e2f70b410e3dc1c072a
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define N 100005 #define MOD 1000000007 #define dd double #define rep(i, n) for(int i = 0; i < n; i++) #define pb push_back #define mp make_pair #define all(v) v.begin(),v.end() #define c...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
b9db496e2f4fa040c87302b4ff44a6d9
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int arr[n]; map<int,long long int> m; for(int i=0;i<n;i++) { cin>>arr[i]; m[arr[i]-i]+=arr[i]; } long long int ans=-1; for(map<int,long long int>::iterator itr=m.begin();itr!=m.end();itr...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
14e39fdaa67b88bbf4cb4835e976b768
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { int n; cin>>n; vector <int> arr(n); unordered_map <int, ll> m; for(int i=0;i<n;i++) { cin>>arr[i]; m[arr[i]-i] += arr[i]; } ll ans = 0; for(auto it = m.begin();it!=m.end();it++) ans = max(ans, it->second); cout<<a...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
6940d2a5d870eedc204a90ca29bed2c3
1,400
PASSED
//bismillahir rahmanir rahim #include <iostream> #include <math.h> #include <string.h> #include <vector> #include <stack> #include <algorithm> #include <queue> #include <deque> #include <set> #include <map> #include <cstdio> #include <iterator> #define ll long long #def...
C++
49a78893ea2849aa59647846b4eaba7c
dd56a6c4ac38630b0924fcf080615683
2,600
PASSED
#include <bits/stdc++.h> using namespace std; inline int in() {int x; scanf("%d", &x); return x;} #define pr(x) {cout << #x << ' ' << x << endl;} #define PII pair<int, int> #define mp make_pair const int maxn = 100000 + 5; int n, num[maxn * 2]; vector<int> G[maxn * 2]; PII a[maxn]; void input() { n = in(); ...
C++
49a78893ea2849aa59647846b4eaba7c
dc0c820011101c2e8ec1e5abceeacfa1
2,600
PASSED
#include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #include<cmath> #include<vector> using namespace std; int color[200500]; int p[100500][2]; int vis[200500]; vector<int >mp[200500]; int n; void Dfs(int u,int col) { color[u]=col; vis[u]=1; for(int i=0;i<mp[u].size();i++) { ...
C++
49a78893ea2849aa59647846b4eaba7c
bc42b5da8b19c3c108dca6f8214247ff
2,600
PASSED
#include <bits/stdc++.h> using namespace std; #define wl(n) while(n--) #define fr(i,a,b) for(i=a;i<b;i++) #define rev(i,a,b) for(i=b-1;i>=a;i--) #define mem(a,i) memset(a,i,sizeof(a)) typedef pair<int,int> ii; #define mp make_pair #define ll long long #define MOD 1000000007 #define pb push_back #define psh push #defi...
C++
49a78893ea2849aa59647846b4eaba7c
3d2c5401fbfa6350f23fd803a543618a
2,600
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cmath> #include <climits> #include <cassert> #include <iostream> #include <algorithm> #include <map> #include <set> #include <stack> #include <queue> #include <string> #include <list> #include <bitset> #include <vector> using namespace s...
C++
49a78893ea2849aa59647846b4eaba7c
884f8a8165b53cf048eaa9d1b6ea44a4
2,600
PASSED
/* ���⣺ ����n����ʾ��2n����Χ��һȦ�������ӱ��ϣ���Ӧ��2n������n�����£�ÿ����ռ��һ��λ�ӣ�Ȼ��n�У�ÿ������������ʾ����������λ�õ��������£�Ҫ�����²��ܳ�ͬһ��ʳ��������������ڵ������˵�ʳ��������������Dz�ͬ�ģ�ֻ������ʳ�1������2������һ�ֿ��з��䷽ʽ�����ܷ������-1. ��⣺ һ��ʼ�����˵���⣬����˵����֮�����ߣ�2*i��2*i-1λ�õ������ߣ�Ȼ����ж���Ⱦɫ���������˼·д�˴�...
C++
49a78893ea2849aa59647846b4eaba7c
40d865e980717b5e1ded7aeb4acc56b9
2,600
PASSED
// // main.cpp // codeforces // // Created by Yi Xu on 11/24/16. // Copyright © 2016 Yi Xu. All rights reserved. // #include <stdio.h> #include <iostream> #include <sstream> #include <ios> #include <iomanip> #include <functional> #include <algorithm> #include <vector> #include <string> #include <list> #include <qu...
C++
49a78893ea2849aa59647846b4eaba7c
08688c3d33cad6e5384be7bf61dbfecc
2,600
PASSED
#include <bits/stdc++.h> using namespace std; const int Maxn=2e5+10; int n,m,x[Maxn],y[Maxn],p[Maxn],h[Maxn],ans[Maxn]; bool boo[Maxn]; struct GG { int node,Next; }G[Maxn*4]; void Insert(int a,int b) { m++; G[m].node=b; G[m].Next=h[a]; h[a]=m; } void BFS(int u) { p[1]=u,ans[1]=0,boo[1]=true;...
C++
49a78893ea2849aa59647846b4eaba7c
e611875e9945fae580cf653769b81c98
2,600
PASSED
#include <iostream> #include <cstring> #include <stack> #include <vector> #include <set> #include <map> #include <cmath> #include <queue> #include <cstdio> #include <cstdlib> #include <climits> #include <deque> #include <bitset> #include <algorithm> using namespace std; const double eps=1e-10; const double pi=3.1...
C++
49a78893ea2849aa59647846b4eaba7c
209833c140f33da7ac94d3e87a87cdda
2,600
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <algorithm> using namespace std; const int maxn = 1e5 + 5; int n, m; int a[maxn]; int b[maxn]; int f[2 * maxn]; int op[2 * maxn]; bool v[2 * maxn]; int mod; int read(){ int x; scanf("%d", &x);...
C++
49a78893ea2849aa59647846b4eaba7c
fdc29b30edb7e1ff75cc737dbe4efc09
2,600
PASSED
#include <bits/stdtr1c++.h> using namespace std; int n,m,k,p; vector<long long> get_score(vector<long long>& dsum, int dshift) { priority_queue<long long> q; vector<long long> res; res.push_back(0); for(auto i: dsum) q.push(i); long long s = 0; for(int i=0; i<k; ++i) { long long a = q.top(); s += a; res...
C++
8a905ae55ac9364a9ed2807f06a05ff0
b0fde9493be870e20bacbfb089f61573
2,000
PASSED
#include <cstdio> #include <string.h> #include <iostream> #include <queue> #include <algorithm> using namespace std; long long N, M, K, P, g[1005][1005]; long long rs[1000005], cs[1000005]; int main(void) { ios_base::sync_with_stdio(false); cin >> N >> M >> K >> P; for(int i=0; i<N; i++) for(int ...
C++
8a905ae55ac9364a9ed2807f06a05ff0
01fa57df8fc198d8ca74ce66c79f8f87
2,000
PASSED
#include <bits/stdc++.h> #define FOR(i, a, b) for( LL i = (a); i < (b); i++ ) #define ALL(A) A.begin(), A.end() #define Set(a, s) memset(a, s, sizeof (a)) #define pb push_back #define mp make_pair typedef long long LL; using namespace std; LL arr[1009][1009]; LL h[1009]; LL v[1009]; LL besth[1000009]; LL bestv[10000...
C++
8a905ae55ac9364a9ed2807f06a05ff0
1686b7464279a8f21af1df39bc5ea2e4
2,000
PASSED
//by maximumSHOT #define _USE_MATH_DEFINES #include <iostream> #include <cmath> #include <math.h> #include <vector> #include <algorithm> #include <string> #include <cstring> #include <queue> #include <map> #include <set> #include <time.h> #include <clocale> #include <fstream> //#include <conio.h> using namespace std...
C++
8a905ae55ac9364a9ed2807f06a05ff0
e74c98ed0abf103c12707d04508ef3e3
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1123; const int maxk = 1000000 + 123; long long heapn[maxn], heapm[maxn]; void up(long long i, long long *heap) { for (long long j = i >> 1; (i > 1) && (heap[i] > heap[j]); i = j, j = i >> 1) swap(heap[i], heap[j]); } void down(long long i, long long...
C++
8a905ae55ac9364a9ed2807f06a05ff0
af8d9ab34473f9c17dbc703cc8df24c9
2,000
PASSED
#include <iostream> #include <queue> using namespace std; priority_queue<long long> lins, cols; long long nbs[1000][1000]; long long rep = -(1ll<<62); long long modifLin, modifCol; long long scoreCol[1000001]; int main() { //freopen("t.in", "r", stdin); ios::sync_with_stdio(false); //cout << rep << end...
C++
8a905ae55ac9364a9ed2807f06a05ff0
08c7a5cf0055f9b81370d9e5c8ea8a2c
2,000
PASSED
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <string.h> #include <time.h> #include...
C++
8a905ae55ac9364a9ed2807f06a05ff0
5b7a6ad6a852545b308b146ec8b3822f
2,000
PASSED
// #include <algorithm> // #include <queue> // #include <cstdio> // using namespace std; // typedef long long ll; // typedef unsigned long long ull; // typedef unsigned int uint; // typedef vector<int> vec; // typedef vector<vec> mat; // static const double EPS = 1e-9; // static const double PI = acos(-1.0); // const ...
C++
8a905ae55ac9364a9ed2807f06a05ff0
90cbfdb4f314bdfc803cc526739a2989
2,000
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <string> #include <set> #include <map> #include <list> #include <cstdlib> #include <cstring> #include <ctime> #include <cstdio> #include <cmath> using namespace std; typedef long long ll; const ll maxn = 1010; int n,...
C++
8a905ae55ac9364a9ed2807f06a05ff0
465fec038f83845ad1f9c46d6a6780b3
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define gc getchar int getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; } int getstr(ch...
C++
8a905ae55ac9364a9ed2807f06a05ff0
122447134d4bf64da1fc78ac0d4c1d28
2,000
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> using namespace std; int n,m; __int64 get(__int64 ti,__int64 Ti,__int64 xi,__int64 costi,__int64 y) { __int64 ans=0,p=y*(Ti-ti); if(p>=m) ans+=costi*y; else ans+=costi*y,ans+=((m-p)+(Ti-ti))*xi; return ans; } int ...
C++
96a3f9d559a40050095de2f5f70b147f
29f909536d4a5f07f0911a75317cf33d
1,900
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> using namespace std; int n,m; __int64 get(__int64 ti,__int64 Ti,__int64 xi,__int64 costi,__int64 y) { __int64 ans=0,p=y*(Ti-ti); if(p>=m) ans+=costi*y; else ans+=costi*y,ans+=((m-p)+(Ti-ti))*xi; return ans; } int ...
C++
96a3f9d559a40050095de2f5f70b147f
b07b08af6467416f651ee7ab231b7c10
1,900
PASSED
#include <algorithm> #include <string> #include <vector> #include <queue> #include <iostream> #include <cmath> #include <sstream> #include <map> #include <set> #include <numeric> #include <memory.h> #include <cstdio> #include <assert.h> using namespace std; #define pb push_back #define INF 1011111111 #define FOR(i,a,...
C++
96a3f9d559a40050095de2f5f70b147f
a7d5b82fe8871aea36f89dbe0583058d
1,900
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <list> #include <cmath> #include <fstream> #include <algorithm> #include <string> #include <queue> #include <set> #include <map> #include <complex> #include <iterator> #include <cstdlib> #include <cstring> #include <sstream> #include <stack> #include <cli...
C++
96a3f9d559a40050095de2f5f70b147f
cc4c7b1f101f8d0100a48b8d6cd3f7c5
1,900
PASSED
#include <cstdlib> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <math.h> using namespace std; int main(int argc, char *argv[]) { cout.setf(ios::fixed); cout.precision(7); long long n,m; cin>>n>>m; long long*t=new long long[n], *cost=new long ...
C++
96a3f9d559a40050095de2f5f70b147f
4a5df1667296971c254cad2d1781a9bb
1,900
PASSED
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; long long n,m,s,t,T,x,c; int main(){ cin>>n>>m; for(int i=0;i<n;i++){ cin>>t>>T>>x>>c; if(T<=t) s+=c+x*m; else s+=min(c+x*m,c*((m-1)/(T-t)+1)); } cout<<s; }
C++
96a3f9d559a40050095de2f5f70b147f
c371edc0da6aef5451f668559f921412
1,900
PASSED
/* uva : author : rafsan algo : */ #include<iostream> #include<vector> #include<map> #include<algorithm> #include<cstdio> #include<math.h> #include<cstdlib> #include<cstring> #include<queue> #include<fstream> #include<sstream> #include<stack> #include<list> #include<deque> #include<bitset> #include<utility> #include<c...
C++
96a3f9d559a40050095de2f5f70b147f
c32f4eac0b5221375b34a14043c36580
1,900
PASSED
#include <cstdio> int main() { int n,m; scanf("%d%d",&n,&m); long long t,T,x,c; long long ans=0; for (int i=0;i<n;i++) { scanf("%I64d%I64d%I64d%I64d",&t,&T,&x,&c); if (t>=T) ans+=x*m+c; else ans+=(m+T-t-1)/(T-t)*c<x*m+c?(m+T-t-1)/(T-t)*c:x*m+c; } printf("%I64d...
C++
96a3f9d559a40050095de2f5f70b147f
afd19228898288f9661b9abd67865999
1,900
PASSED
import java.util.*; import java.io.*; public class Problem { static int memo[][]; static long a, b, c, n, v, m, e, t; static ArrayList[] edgeList; static int[][] matrix; // static int[] a; final static int Infinity = Integer.MAX_VALUE; public static void main(String[] args) throws Exception { Scanner sc = new...
Java
40d679f53417ba058144c745e7a2c76d
a6056210d69cff99b40591f34cb27baa
800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; import java.io.PrintWriter; public class a { public static void main(String[] args) { FastScanner fs = ne...
Java
40d679f53417ba058144c745e7a2c76d
3daffe5809221b1ceddbe65a9a11ce7c
800
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Tanzim Ibn Patowary */ public class Main { public static void main(String[] args) { I...
Java
40d679f53417ba058144c745e7a2c76d
8b6f8ca69f4e1bc8deda247c4f6ff017
800
PASSED
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++){ System.out.println(Math.max(sc.nextInt(),Math.max(sc.nextInt(),sc.nextInt()))); } } }
Java
40d679f53417ba058144c745e7a2c76d
40d91818fb73ecbfca6ac94573fe0585
800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A { public static void main (String[] args) throws java.lang.Exception { FastReader in = new FastReader(); int t = in.nextInt(); while(t-->0) { int a = in.nextInt(...
Java
40d679f53417ba058144c745e7a2c76d
acea32f3961674ab14474bcaa762f489
800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A { public static void main (String[] args) throws java.lang.Exception { FastReader in = new FastReader(); int t = in.nextInt(); while(t-->0) { int a = in.nextInt(...
Java
40d679f53417ba058144c745e7a2c76d
bbd11971518845814777583f462ae0b2
800
PASSED
import java.util.*; public class Solution{ public static void main(String[] agrs){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int z=0;z<t;z++){ double a = sc.nextDouble(); double b = sc.nextDouble(); double c = sc.nextDouble(); ...
Java
40d679f53417ba058144c745e7a2c76d
792c853cdf827d881056f2ab61a067b8
800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class code1{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
40d679f53417ba058144c745e7a2c76d
ce4ed1c1ac5e63b383b1b499f68d94c7
800
PASSED
//package codeforce; import javafx.scene.transform.Scale; import java.util.Scanner; public class ograzhdenie { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { long a = sc.nextLong(), b = sc.next...
Java
40d679f53417ba058144c745e7a2c76d
2fecf849f93d31a74f96abe3ee4d626a
800
PASSED
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static class FastReader { BufferedReader br; StringTokenizer st; public FastReade...
Java
40d679f53417ba058144c745e7a2c76d
9cdc88c545ac88797d33f0fc0481f953
800
PASSED
#include<bits/stdc++.h> #define FRU freopen("out.txt","w",stdout) #define FRO freopen("in.txt","r",stdin) #define pb push_back #define mp make_pair #define ff first #define ss second #define mem(ara,n) memset(ara,n,sizeof ara) #define loop(i,j,n) for(i=j;i<n;i++) #define rloop(i,j,n) for(i=n;i>=j;i--) #define INF 21474...
C++
9e71b4117a24b906dbc16e6a6d110f50
68e2f288181e33651695a117adc39c9a
900
PASSED
#include <iostream> using namespace std; long long k,jami=0,p = 0,q=10000000000000,n, a[100000]; int main(int argc, char** argv) { cin >> n; cin >> k; for(int i = 0; i<n; i++){ cin >> a[i]; q= min(a[i],q); } for(int i = 0; i<n; i++){ if((a[i]-q)%k==0){ p+=(a[i]-q)/k; } else{ cout << -1; re...
C++
9e71b4117a24b906dbc16e6a6d110f50
c989a232ef9ee122261d270f85eb0312
900
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <cstdio> #include <map> #include <ctime> #include <random> #include <cstdlib> using namespace std; typedef int64_t ll; const int INF = 1e9; vector<vector<int>> g; int main(){ ios_base::sync_with_stdio(false); int n, k; c...
C++
9e71b4117a24b906dbc16e6a6d110f50
cc35e135df611f24950c68691d02db74
900
PASSED
#include<bits/stdc++.h> using namespace std; long long int i,j,k,m,s,p,n,q,b; long long int ami[2000000]; int main(){ cin>>n>>m; s=1000000008; for(int i=0;i<n;i++){cin>>ami[i];s=min(ami[i],s);} //cout<<s<<" "<<m<<endl; long long int x=0; for(int i=0;i<n;i++){ //cout<<ami[i]-s<<endl; if((ami[i]-...
C++
9e71b4117a24b906dbc16e6a6d110f50
2cdefbb6ca153a9abf373a17c5877423
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long int n,m,i,sum=0,count=0,min=10000000000,flag=0; cin>>n>>m; long long int a[n]; for(i=0; i<n; i++) cin>>a[i]; for(i=0; i<n; i++) { if(a[i]<min) min=a[i]; } if(n==1) cout<<"0"; else ...
C++
9e71b4117a24b906dbc16e6a6d110f50
c9ebcddcdcf500fc82b86d57c9c17325
900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int #define dd double #define sc scanf #define pr printf #define VI vector<int> #define VS vector<string> #define VC vector<char> #define VLL vector<long long int> #define FOR(i,a,b) for(i=a;i<=b;i++) #define FILE freopen("input.txt","rt",stdin); freope...
C++
9e71b4117a24b906dbc16e6a6d110f50
21083287b49a31855156679d3f51a5db
900
PASSED
#include<bits/stdc++.h> #define pi 3.1415 #define ll long long #define pii pair<int,int> #define debug(a) cout<<a<<'\n' #define maxn 100009 #define MOD 1000000007 #define INF (int)3000009 using namespace std; double somapa(double a1,double an,double n){ return ((a1+an)*...
C++
1c8423407ea7a0b2647e41392670d6b7
d2f38e2c22bd6c4675bbecaf04598804
1,700
PASSED
#include <iostream> #include <stdio.h> #define Nmax 100005 using namespace std; long long m, n, x[Nmax], sum=0; double res=0, d[Nmax]; int main() { cin>>n>>m; for (int i=1; i<=m; i++) { cin>>x[i]>>d[i]; sum+=x[i]*n; if (d[i]>=0) sum+=d[i]*n*(n-1)/2; else { ...
C++
1c8423407ea7a0b2647e41392670d6b7
23aa671cf66d04b568ff8a13e0d9b209
1,700
PASSED
#include<bits/stdc++.h> #define M ((ll) 998244353) using namespace std; typedef long long ll; typedef long double ld; ll n,m,x,d,ans,t; int main() { cin >> n >> m; t=n/2; while(m--) { scanf("%I64d%I64d",&x,&d); if(d>=0) ans += n*(n-1)/2*d; else if(n&1) ...
C++
1c8423407ea7a0b2647e41392670d6b7
3818e06d559406c5e6a7ad8d8fe1506b
1,700
PASSED
#include <bits/stdc++.h> #include <stdlib.h> #include <time.h> using namespace std; long long mod=1e9+7; long long INF=1e7; double EPS = 1e-12; typedef long long int lld; double tick(){static clock_t oldt;clock_t newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt = newt;return diff;} #define rep(i,a,n) fo...
C++
1c8423407ea7a0b2647e41392670d6b7
ed6cfa62502c7c937b1ffee95ab2ca94
1,700
PASSED
#include <bits/stdc++.h> #include <stdlib.h> #include <time.h> using namespace std; long long mod=1e9+7; long long INF=1e7; double EPS = 1e-12; typedef long long int lld; double tick(){static clock_t oldt;clock_t newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt = newt;return diff;} #define rep(i,a,n) fo...
C++
1c8423407ea7a0b2647e41392670d6b7
1217973051252ed410a772a8ec9b284f
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ff first #define ss second #define LOG1(a) cerr<< #a << " = " << (a) << "\n" #define LOG2(a, b) cerr<< #a << " = " << (a) << ", " << #b << " = " << (b) << "\n" #define endl "\n" #define sz(a) (int)(a.size()) #define all(...
C++
1c8423407ea7a0b2647e41392670d6b7
c268f3d0d709904be9fe76cac4c74219
1,700
PASSED
#include<stdio.h> #include <set> #include<map> #include<string.h> #include <cmath> #include <queue> #include <stack> #include <vector> #include <string> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> #define FOR(i,a,b) for (int i=(a);i<(b);i++) #include ...
C++
1c8423407ea7a0b2647e41392670d6b7
760cd7dc1034ac9d9bbb1020f40da9d9
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define files(name) freopen(name".in","r",stdin); freopen(name".out","w",stdout); #define all(a) a.begin(),a.end() #define len(a) (int)(a.size()) #define pb push_back #define mp make_pair #define fir first...
C++
1c8423407ea7a0b2647e41392670d6b7
b70f67c6a260946e6c27ffcd78e77a63
1,700
PASSED
#include<bits/stdc++.h> #define ll long long #define int long long #define inf (1LL<<61) #define fi first #define se second #define pb push_back #define pa pair<int,int> #define mkp(a,b) make_pair(a,b) const int N=1e6+10; const int mod=1e9+7; int dir[4][2]={0,1,1,0,0,-1,-1,0}; using namespace std; int32_t main() { ...
C++
1c8423407ea7a0b2647e41392670d6b7
fe5a210fb361d08bfd2232c17bb4b515
1,700
PASSED
#include<bits/stdc++.h> #define ll long long #define int long long #define inf (1LL<<61) #define fi first #define se second #define pb push_back #define pa pair<int,int> #define mkp(a,b) make_pair(a,b) const int N=1e6+10; const int mod=1e9+7; int dir[4][2]={0,1,1,0,0,-1,-1,0}; using namespace std; int32_t main() { ...
C++
1c8423407ea7a0b2647e41392670d6b7
f24e39659d772c8e6996a4891f229113
1,700
PASSED
#include <cstdio> #include <iostream> #include <string.h> using namespace std; int main() { char S[300]; string res = ""; gets(S); int c = 0; while(S[c] != 0) { if(S[c] == '@') { cout << "No solution"; return 0; } while(S[c] != '@' && S[c] != 0) ...
C++
71b4674e91e0bc5521c416cfc570a090
705fc53f7255e48a95edbf4a242b0af0
1,500
PASSED
#include<stdio.h> #include<string.h> #include<stdlib.h> int konum[2005],uz; char dizi2[2005],dizi[2005]; void CT() { int i,csay=0,hsay=0; for(i=0;i<uz-1;i++) { if(dizi[i]=='@' && dizi[i+1]=='@') { printf("No solution"); exit(0); } if(dizi[i]=='@' && dizi[i+2]=='@') { printf("No solution"); ...
C++
71b4674e91e0bc5521c416cfc570a090
3c077410684d6c5bfbef801cfda1cf88
1,500
PASSED
#include <iostream> using namespace std; int main() { // your code goes here long i,l,flag=0;; string s; cin>>s; l =s.length(); if (s[0]=='@' || s[l-1]=='@') { flag=1;} int a[300]={0},c=0; for (i=0;i<l;i++){ if (s[i]=='@') {a[i]=1;c++;} else a[i]=0; } for (i=0;i<l;i++){ if (a[i...
C++
71b4674e91e0bc5521c416cfc570a090
4e817a091e25a0781a74cf8df2b23a19
1,500
PASSED
/*Get a life -_- */ #include <bits/stdc++.h> using namespace std; typedef long long int li; int main() { ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); li n,j=1,sum=0, max=0, min=INT_MAX, flag=0, temp=0, count=0, mid, ans=0, i, a, b, c, d; string s; cin>>s; n=s.size(); if(s[0]=='@' |...
C++
71b4674e91e0bc5521c416cfc570a090
c749623342105162e4c28bec5ff16aeb
1,500
PASSED
#include<bits/stdc++.h> using namespace std; int main() { char arr[2000]; int w,j,x,y=0,z; cin>>arr; x=strlen(arr); // cout<<"X+"<<x<<endl;// if(arr[0]=='@'||arr[x-1]=='@'||x==1||x==2) cout<<"No solution"; else { for(w=0;w<x;w++) { if(arr...
C++
71b4674e91e0bc5521c416cfc570a090
ec6efe72242e1e9b90f90ffe377bbb63
1,500
PASSED
#include <bits/stdc++.h> using namespace std; // io #define get(i) scanf("%d", &i) #define flush fflush(stdin) // manipulations #define f(i, n) for (int i = 0; i < n; i++) #define fr(i, n) for (int i = n - 1; i >= 0; i--) #define ff(i, a, b) for (int i = a; i <= b; i++) #define lowbit(x) (x & -x) #define sz(x) int((x...
C++
71b4674e91e0bc5521c416cfc570a090
4cbf11ef28e87294081245c268240e9b
1,500
PASSED
#include <bits/stdc++.h> using namespace std ; typedef long long ll ; bool good(string s) { int i = 0 ; for(; i < s.size() ; i++) if(s[i] == '@') break; if(i+1 < s.size() && i != 0 && s[i+1] != '@') return 1; else return 0; } int main () { string s , nw; cin >> s; vector<string> f ;...
C++
71b4674e91e0bc5521c416cfc570a090
222c0bd37c42d6a7feaa05843956a92d
1,500
PASSED
#include <bits/stdc++.h> #define ll long long #define FAST ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL); using namespace std; int main() { FAST; string s; cin >> s; int sz=s.size(),n=1,a[sz+10],nn=0; for(int i=0;i<sz;i++){ if(s[i]=='@' && (i==0 || i==sz-1)){ nn=1...
C++
71b4674e91e0bc5521c416cfc570a090
5dbe615a338cbce41f1c50a6c77e3a5b
1,500
PASSED
/* .m. */ #include "bits/stdc++.h" #define sp <<" " #define el <<"\n" #define S second #define F first #define pb push_back #define all(ar) ar.begin(),ar.end() using namespace std; typedef long long ll; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(0); #i...
C++
71b4674e91e0bc5521c416cfc570a090
a3637dd8f02b92ff22e9c93c9a4fe994
1,500
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FastIO ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0) #define pb push_back #define siz 100009 #define inf 1000000 #define mp make_pair #define rep(i,n) for(int i=0...
C++
71b4674e91e0bc5521c416cfc570a090
fbc16ad587854443f1c9f0521a5c730f
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define LL long long int #define L long int #define IM INT_MAX #define Im INT_MIN int main(){ int t; cin>>t; for(int i=0;i<t;i++){ LL n,x,s=0,y; cin>>n>>y; vector<LL>v,v1; for(int j=0;j<n;j++){ cin>>x; v.push_back(x); s+=x; ...
C++
0924971933265f4be34710149a541087
a858409596c4b1186c4836817aa46028
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int t , n , s; scanf("%d",&t); while(t--) { scanf("%d%d",&n , &s); vector<int> a(n); for(int i = 0 ; i < n ; ++i) scanf("%d",&a[i]); int pos = 0 , i; for(i = 0 ; i < n ; +...
C++
0924971933265f4be34710149a541087
a75a3e8647bdc4534a76b89b71b47fad
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int t , n , s; scanf("%d",&t); while(t--) { scanf("%d%d",&n , &s); vector<int> a(n); for(int i = 0 ; i < n ; ++i) scanf("%d",&a[i]); int pos = -1 , i; for(i = 0 ; i < n ; ...
C++
0924971933265f4be34710149a541087
d09f76b15040a801c13ad8a5dbbfd43b
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int t , n , s; scanf("%d",&t); while(t--) { scanf("%d%d",&n , &s); vector<int> a(n); for(int i = 0 ; i < n ; ++i) cin >> a[i]; int pos = -1 , i; for(i = 0 ; i < n ; ++i) ...
C++
0924971933265f4be34710149a541087
a5cd49c158accf9767e60e4673b25573
1,300
PASSED
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long int #define f(i, a, b) for(int i=a; i<b; i++) #define pb push_back #define vi vector<int> #define vl vector<long long> #define vii vector<vector<int>> #define vll vector<vector<long long>> using namespace std; i...
C++
0924971933265f4be34710149a541087
7682ccb516c784aa99676d6793f6b538
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long // #define int long long typedef unsigned long long ul ; typedef long long ll ; typedef string str ; typedef pair < int, int > pii ; typedef pair < ll, ll> pll ; typedef vector < int > vi ; typedef vector < ll > vll ; //#define cerr cout #define MO...
C++
0924971933265f4be34710149a541087
c6ab06c900887f4e6de86831667c5b6a
1,300
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define db double #define f(i,a,n,x) for(ll i=a;i<=n;i=i+x) #define rf(i,a,n,x) for(ll i=a;i>=n;i=i-x) #define bs(start,end,value) binary_search(start,end,value) #define is(start,end) is_sorted(start,end) #define np(start,end) next_permutation(start,...
C++
0924971933265f4be34710149a541087
e7f1d2a4b91340113c06b9b01c467e21
1,300
PASSED
#include "iostream" #include "algorithm" #include "numeric" #include "cstring" #include "math.h" #include "string" #include "vector" #include "ctime" #include "queue" #include "stack" #include "map" #include "set" #include <ext/pb_ds/...
C++
0924971933265f4be34710149a541087
67d63b0bfe7c3dad526df09ab6e9d757
1,300
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long bool check(ll a[],ll n,ll s) { ll sum=0; for(int i=0;i<n;i++) { sum+=a[i]; } if(sum<=s) return true; else return false; } int main() { int t; cin>>t; while(t--) { ll n,s; cin>>n>>s; ll a[n]; for(int i=0...
C++
0924971933265f4be34710149a541087
7cd102aca91a1f9f4560a8e183afc2a4
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; long long n,s,sum=0; while(t--){ cin>>n>>s; long long a[n],indx=-1,mx=0; for(int i=0;i<n;i++){ cin>>a[i]; sum+=a[i]; } if(sum<=s){ cout<<"0"<<endl; ...
C++
0924971933265f4be34710149a541087
1ac73da131784f47649a0d587a2f22d5
1,300
PASSED
#include <stdio.h> #include <string.h> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <map> #define FOR(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long lld; int n, q; string s; int dp[256][256][256]; char v[3][256]; int len[3] = {}; int pre[100010][26]...
C++
0cc9671ff72e44bd5921cc0e46ada36c
62401bd27710b2d77ffd5519a50264b3
2,200
PASSED
#include<stdio.h> #include<algorithm> using namespace std; #define fo(i,a,b) for(int i=a;i<=b;i++) #define fd(i,a,b) for(int i=a;i>=b;i--) int n,q,c[110000][26],f[5][1100],ft[5],id,now,cl[110000],clt,g[252][252][252]; bool b[110000]; char s[110000],ss[5]; int main(){ scanf("%d%d%s",&n,&q,s+1); fo(i,1,n) s[i]-='...
C++
0cc9671ff72e44bd5921cc0e46ada36c
ab395397caf0d383c779b8b2f4161531
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #pragma region void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {c...
C++
0cc9671ff72e44bd5921cc0e46ada36c
fd7bc5ed34b58c183bca590b1d200a74
2,200
PASSED
/* _____ _____ _____ __ __ _______ _____ _____ ______ _______ __ | _ \ | _ \ |_ _| \ \ / / | ____| |_ _| | ___| ( ___| |__ __| / \ | |_) ) | |_) ) | | \ \/ / | |____ | | | |__ \ (__ | | / /\ \ | ____/ ...
C++
0cc9671ff72e44bd5921cc0e46ada36c
339d7e07f8f62656fced9515587414c2
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5+5; const int M=250+5; int nex[N][26],len[4],dp[M][M][M]; char a[4][M],s[N]; int main() { int n,q; scanf("%d %d",&n,&q); scanf("%s",s+1); for(int i=0;i<26;i++) nex[n][i]=nex[n+1][i]=n+1; for(int i=n-1;i>=0;i--){ ...
C++
0cc9671ff72e44bd5921cc0e46ada36c
c1e3d4d86c72ee0c7b188708de0671cc
2,200
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> #include<math.h> #include<random> #include<queue> #include<tuple> #include<stack> #include<string> #include<bitset> using namespace std; typedef long long int ll; typedef pair<int, int> pp; typedef tup...
C++
0cc9671ff72e44bd5921cc0e46ada36c
20668d08af8fb2ab15df8a49eee0b52d
2,200
PASSED
#include <bits/stdc++.h> #define fori(i, a, b) for (int i = a; i <= b; ++ i) #define fori2(i, a, b) for (int i = a; i < b; ++ i) #define ford(i, a, b) for (int i = a; i >= b; -- i) using namespace std; typedef long long ll; const int A = 'z' - 'a' + 1; const int N = 1e5; const int N2 = 25e1; int n, q; string s, ...
C++
0cc9671ff72e44bd5921cc0e46ada36c
bd73bc20d345c5b1dd1c206781de7360
2,200
PASSED
#include <iostream> #include <iomanip> #include <algorithm> #include <vector> #include <set> #include <map> #include <cstring> #include <string> #include <queue> #include <stack> #include <utility> #include <tuple> #include <functional> #include <cmath> #define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr); ...
C++
0cc9671ff72e44bd5921cc0e46ada36c
fb9f188e0d0633327004047687ece7fb
2,200
PASSED
#include <iostream> #include <iomanip> #include <algorithm> #include <vector> #include <set> #include <map> #include <cstring> #include <string> #include <queue> #include <stack> #include <utility> #include <tuple> #include <functional> #include <cmath> #define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr); ...
C++
0cc9671ff72e44bd5921cc0e46ada36c
44df230de97bbf35f377305998086541
2,200
PASSED
#include <iostream> #include <iomanip> #include <algorithm> #include <vector> #include <set> #include <map> #include <cstring> #include <string> #include <queue> #include <stack> #include <utility> #include <tuple> #include <functional> #include <cmath> #define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr); c...
C++
0cc9671ff72e44bd5921cc0e46ada36c
a12b2dbd92662358ea29391fcde900b8
2,200
PASSED
#include<bits/stdc++.h> using namespace std; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #define endl '\n' #define int int64_t #define ff first #define ss second #define pb push_back #define nl cout<<'\n'; #define vi vector<i...
C++
27998621de63e50a7d89cb1c1e30f67c
c22ede5c2ac045bbf4d2e14ce2d8d9c4
1,800
PASSED
#include<bits/stdc++.h> using namespace std; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #define endl '\n' #define int int64_t #define ff first #define ss second #define pb push_back #define nl cout<<'\n'; #define vi vector<i...
C++
27998621de63e50a7d89cb1c1e30f67c
3f3936378ad15076eb0cc72abd4c8249
1,800
PASSED
#include<bits/stdc++.h> #define pb push_back #define pf push_front #define clr(x) memset(x, 0, sizeof(x)) #define all(a) a.begin(),a.end() #define s second #define f first #define forn(i, a,b) for(int i = int(a); i < int(b); ++i) #define forn_r(i, b, a) for(int i = int(b); i > int(a); i--) #define trav(a,x) for (auto& ...
C++
27998621de63e50a7d89cb1c1e30f67c
e83613987e058b81c5c679cfd5b94e06
1,800
PASSED
#include <bits/stdc++.h> #include <algorithm> using namespace std; const int INF = 1e9; long absx(long x, long y) { if(x > y) return x - y; return y - x; } long minx(long x, long y) { return x > y ? y : x; } void solve() { int n; scanf("%d", &n); vector<int> t(n); for (int i = 0...
C++
27998621de63e50a7d89cb1c1e30f67c
5b5005872b2f9d88d5bd9c8a1e804aec
1,800
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; int bestTakeout(vector<int> &t, int n){ int N = n*2; vector<vector<int>> tab(n, vector<int>(N)); tab[0][0] = abs(t[0]); for(int i = 1; i < N; i++) tab[0][i] = min(tab[0][i-1], abs(t[0] - i)); for(int i = 1;i < n; i++){ tab[...
C++
27998621de63e50a7d89cb1c1e30f67c
886fcb374dad3a1b040dd835de8dadc3
1,800
PASSED
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair using namespace std; typedef long long ll; typedef pair<int,int> pii; const double eps = 1e-8; const int NINF = 0xc0c0c0c0; const int INF = 0x3f3f3f3f; const ll mod = 1e9 + 7; const ll N = 2e2 + 5; int n,a[N],f[2*N]; int main(){ io...
C++
27998621de63e50a7d89cb1c1e30f67c
8e3c8b1cc1199bacb3eccd054ee528d3
1,800
PASSED
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair using namespace std; typedef long long ll; typedef pair<int,int> pii; const double eps = 1e-8; const int NINF = 0xc0c0c0c0; const int INF = 0x3f3f3f3f; const ll mod = 1e9 + 7; const ll N = 2e2 + 5; int n,a[N],f[N][2*N]; int main(){ ...
C++
27998621de63e50a7d89cb1c1e30f67c
89726fbdaa6bee37fa2177b154b6285b
1,800
PASSED