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 |
|---|---|---|---|---|---|
def main():
t = int(input())
l = 1
r = t
while l < r:
print(f'{l} {r}', end=' ')
l += 1
r -= 1
else:
if l == r:
print(f'{l}')
main() | Python | 02b7ff5e0b7f8cd074d9e76251c2725e | 78afc3e4f507d5bafe3dc63162a45acb | 1,200 | PASSED |
def main():
n = int(input())
l = 1
r = n
while l < r:
print(f'{l} {r}', end=' ')
l += 1
r -= 1
else:
if l == r:
print(f'{l}')
main() | Python | 02b7ff5e0b7f8cd074d9e76251c2725e | 992f926173ac6a35cff6e1b3bb6fa3fd | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n, k;
cin >> n >> k;
long long int i;
long long int m = (k * (k + 1)) / 2;
int flag = 0;
long long int a[k];
for (i = 0; i < k; i++)
{
a[i] = i + 1;
}
if (n < m)
{
cout << "NO" << endl;... | C++ | df801ebbe05c17bb1d157108d523d1f8 | 1606632840020b4cc6d3053afe6194e5 | 1,900 | PASSED |
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
using namespace std;;
const int N = 1e5 + 5;
int ans[N];
int main() {
int n, k;
cin >> n >> k;
int al = n;
int i = 1;
bool flag = 1;
double minN = n / (pow(2, k) - 1), maxN = (2 * n / k + 1 - k) / 2;
if ((in... | C++ | df801ebbe05c17bb1d157108d523d1f8 | b4cc6898741cf0f5f3b93a93b9f0f5e7 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back
#define ppb pop_back
#define MP make_pair
#define ff first
#define ss ... | C++ | df801ebbe05c17bb1d157108d523d1f8 | 777f717a0cff483fced9fe2136fae413 | 1,900 | PASSED |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include<map>
#include<cmath>
typedef long long ll;
std::map<ll,ll> a1,b1;
std::vector<std::vector<ll>> g;
std::vector<bool> used;
ll k=0;
int main(){
ll n,n2;
std::cin>>n>>k;
n2=n;
std::vector<ll> ans(k);
... | C++ | df801ebbe05c17bb1d157108d523d1f8 | b6112f3fa9080326fe78c39140b6e9c2 | 1,900 | PASSED |
#include<cstdio>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[maxn];
#define ll long long
ll pow(ll a, ll b)
{
ll res = 1;
while(b)
{
if(b & 1) res *= a;
a *= a;
b >>= 1;
}
return res;
}
int main()
{
long long k, n, flag ... | C++ | df801ebbe05c17bb1d157108d523d1f8 | 84ad2d4c95813feefbb1020d163a2855 | 1,900 | PASSED |
#include <cstdio>
#include <cctype>
inline long long read (void)
{
register long long x = 0, f = 1, ch = getchar();
while(!isdigit(ch)) { if(ch == '-') f = -f; ch = getchar(); }
while(isdigit(ch)) { x = x * 10 + ch - '0'; ch = getchar(); }
return x * f;
}
long long n, k, a[100005];
int main (void)
{
n = read();... | C++ | df801ebbe05c17bb1d157108d523d1f8 | 0336df61b2f79299bd8a050723424334 | 1,900 | PASSED |
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
void debug(vector <int> sum){
for (auto it : sum){
cout << it << " ";
}
cout << "\n";
}
unsigned long long maxPossible;
unsigned long long minPossible;
unsigned long long sum;
vector <int> arr;
int ma... | C++ | df801ebbe05c17bb1d157108d523d1f8 | 84f893961efd2a3ab14dcc6771d3367d | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
ll n,k;
ll f(ll st,ll end){
if(st > end) return -1;
ll mid=(st+end)/2;
ll x=(k*(2*mid+k-1))/2;
if(x > n) return f(st,mid-1);
for(ll i=1;i<=k;i++){
ll g=mid*(pow(2,i)-1);
if(g>=n){
return mid;
}
}
return f(mid+1,end... | C++ | df801ebbe05c17bb1d157108d523d1f8 | c8d2d102a64369908989bcc998f7d0be | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,m;
int i,j;
int b;
int f1=0;
int a[100050];
int sum1=0,sum2=0,sum3=0;
int t1,t2,t3;
scanf("%lld%lld",&m,&n);
i=m/(pow(2.0,n)-1);
for(;f1!=1;i++)
{
if(m<(2*i-1+n)*n/2)
{
printf("NO\n");
break;
}
else if(m<=(pow(2.0,n)-1)*i) f1... | C++ | df801ebbe05c17bb1d157108d523d1f8 | 06d15928688ba49016e45d48516c7d2d | 1,900 | PASSED |
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#defi... | C++ | df801ebbe05c17bb1d157108d523d1f8 | 33fcbb433dbf41a0009ed21819f87369 | 1,900 | PASSED |
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int N = 111111;
int a[N], b[N];
int n, m, k;
bool ok()
{
int i, j;
i = n - 1, j = m - 1;
while(i >= 0 && j >= 0)
{
if(a[i] > b[j])return 1;
i--, j--;
}
if(i >= 0)return 1;
... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | 3a34ddcbca33297cd337e7038d15ec22 | 1,600 | PASSED |
#include <iostream>
#include <algorithm>
#include <map>
#include <stdio.h>
using namespace std;
const int N=100010;
int k,n,m,a[N],b[N],d[2*N],sz,len,l[2*N];
map<int,int>id;
int main()
{
int i,j,now=0,P=0;
scanf("%d%d%d",&n,&m,&k);
for (i=1; i<=n; i++){
scanf("%d",&a[i]);
d[++sz]=a[i];
... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | a5884f49a2a71d7416aa36cf4a0dfa90 | 1,600 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;
#define forall(i,a,b) for(int i=a;i<b;++i)
#define max(a,b) ( (a) > (b) ? (a) : (b))
#define min(a,b) ( (a) < (b) ? (a) : (b))
#define ll long long
... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | 8ac960ba6bbe7dcfcb2c6eea82692428 | 1,600 | PASSED |
#include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | 6337f474cc3a7b564de58f86cf894da9 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
vector<long long>a;
vector<long long>b;
int main()
{
long long n,m,k;
cin>>n>>m>>k;
int i,j;long long temp;
for(i=0;i<n;i++)
{
cin>>temp;
a.push_back(temp);
}
for(i=0;i<m;i++)
{
cin>>temp;
b.push_back(temp);
}
if (n>m)
{
cout<<"YES\n";
return 0;
}
... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | c0661009984fb1fcb8d9f9168f16e822 | 1,600 | PASSED |
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>
#include <utility>
using namespace std;
#define PI 3.14159265358979323846264
#define SIZE 1000000000
#define MAX(a,b) ((a)>(b)?(a):(b))
#d... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | 172759dc86c08f02851fd7bc6be81c84 | 1,600 | PASSED |
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>
using namespace std;
long b[1000000];
long a[1000000];
long n,m,k;
int main()
{
long i;
cin >> n >> m >> k ;
for (i=1 ; i<=n ; i++) {
cin >> a[i];
}
for (i=1 ; i<=m ; i++){
cin >>... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | 12f770f07c79520760d8ffffc7193445 | 1,600 | PASSED |
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n , m ,k;
int a[111111],b[111111];
bool check()
{
for(int i = 0 ; i < n ; i++)
if(a[i] > b[m-n+i])
return true;
return false;
}
int main()
{
cin >> n >> m >> k;
for(int i = 0 ; i < n ; i++) ci... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | ac6feb57d248e12ac25d1b3fc48f76ed | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];
int main()
{
int n;
int m,k;
cin>>n>>m>>k;
multiset<int> aa,bb;
for(int i=0;i<n;i++)
{
scanf("%d",&alice[i]);
aa.insert(alice[i]);
}
for(int i=0;i<m;i++)
{
scanf("%d",&bob... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | 52516440bbd9ac299264beac4b5ce617 | 1,600 | PASSED |
//Fish Weight
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m,k,a[100001],b[100001];
int main()
{
cin>>n>>m>>k;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<m;i++)
cin>>b[i];
if(n>m)cout<<"YES";
else
{
bool ok=false;
sort(a,a+n);... | C++ | 01cd3f0c6bc2975118075d180bfeba2d | 8c079ecbb7617adbdc9beb33745b9e71 | 1,600 | PASSED |
/**
* “Experience is the name everyone gives to their mistakes.” – Oscar Wilde
*
* author : prodipdatta7
* created : Thursday 26-March, 2020 10:41:56 PM
**/
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#includ... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | 724632d9fa9a401983d57f13e81a2649 | 1,900 | PASSED |
/**
* “Experience is the name everyone gives to their mistakes.” – Oscar Wilde
*
* author : prodipdatta7
* created : Thursday 26-March, 2020 10:41:56 PM
**/
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#includ... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | 6c14845dacd3ca91983efff1a0968df8 | 1,900 | PASSED |
/**
* “Experience is the name everyone gives to their mistakes.” – Oscar Wilde
*
* author : prodipdatta7
* created : Thursday 26-March, 2020 10:41:56 PM
**/
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#includ... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | 52401496d895737d7de840ba30c92453 | 1,900 | PASSED |
/**
* “Experience is the name everyone gives to their mistakes.” – Oscar Wilde
*
* author : prodipdatta7
* created : Thursday 26-March, 2020 10:41:56 PM
**/
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#includ... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | b1ab10ab81396f3cf237f153cdf49c07 | 1,900 | PASSED |
/**
* “Experience is the name everyone gives to their mistakes.” – Oscar Wilde
*
* author : prodipdatta7
* created : Thursday 26-March, 2020 10:41:56 PM
**/
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#includ... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | d2d0524e91edec65b8c7248b3df1c156 | 1,900 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#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 mem0(x) memset(x,0,sizeof(x))
#define meminf(x) memset(x,0x3f,sizeof(x))
#define VI vector<int>
#define VL vector<ll>
#define pb push_b... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | 23a3b01c457bbad8cb03409b06cf89eb | 1,900 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#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 mem0(x) memset(x,0,sizeof(x))
#define meminf(x) memset(x,0x3f,sizeof(x))
#define VI vector<int>
#define VL vector<ll>
#define pb push_b... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | b7476d45e7a8d7fe9330e192afd476e6 | 1,900 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#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 mem0(x) memset(x,0,sizeof(x))
#define meminf(x) memset(x,0x3f,sizeof(x))
#define VI vector<int>
#define VL vector<ll>
#define pb push_b... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | b1cff948a4c039f37d9b300db74e5f26 | 1,900 | PASSED |
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
#define in(x) (x) = read()
#define inn(x, y) in(x),in(y)
#define innn(x, y, z) inn(x, y),in(z)
#define innnn(x, y, z, w) inn(x, y),inn(z, w)
#define fre(x) for... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | 63a16930006b674a65a267b70b8aaea7 | 1,900 | PASSED |
//#pragma GCC optimize(2)//��������
//#pragma GCC optimize(3)//���ڳ���
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
#define in(x) (x) = read()
#define inn(x, y) in(x),in(y)
#define innn(x, y, z) inn(x,... | C++ | 8dcf63e0e4584df7a471c84ce3ca8fe1 | 45b3ae42e59c8423cff524db3d63afce | 1,900 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static int n, a, b;
static ArrayList<Integer>[] graph;
static long[] da, db;
public s... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | f7a699408438bd15e0bad01f92425adc | 1,700 | PASSED |
/*Author: Satyajeet Singh, Delhi Technological University*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
public class Main {
/*********************************************Constants******************************************/
static PrintWriter out=new PrintWriter(new OutputStreamWr... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | ff514109d8f79ff14228974438c7db5d | 1,700 | PASSED |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
impo... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | cf2c97f81f9ebb9360044c4600a84162 | 1,700 | PASSED |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | 88c46dc802e1e89344d640815f2df4e0 | 1,700 | PASSED |
import java.util.*;
import java.io.*;
//import java.text.*;
public class Main{
final long MOD = (long)1e9+7, IINF = (long)1e19;
final int MAX = (int)1e6+10, MX = (int)1e7+1, INF = (int)1e9;
// DecimalFormat df = new DecimalFormat("0.00000000");
// final double EPS = 1e-8;
FastReader in;
PrintWrit... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | 265530eb1be592897e012529928c179d | 1,700 | PASSED |
import java.io.*;
import java.math.*;
import java.nio.file.attribute.AclEntry.Builder;
import java.security.KeyStore.Entry;
import java.util.*;
public class CODEFORCES {
private InputStream is;
private PrintWriter out;
int time = 0, dp[][], DP[], start[], end[], dist[], red[], black[], MOD = (int)(1e9+7), arr[];
... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | 37464e494a163828ff4786dc4c3c9583 | 1,700 | PASSED |
import java.util.PriorityQueue;
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 bowwow {
private static ArrayList<Integer> arr[];
private static int n;
private static int x... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | 6ab42f99095250bf576146ce4700b089 | 1,700 | PASSED |
//package educational.round22;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
public class C {
InputStream is;
PrintWriter o... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | c853b60c7fd6d67d8797943af8557138 | 1,700 | PASSED |
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class codeforces implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | a2b29e50c17000f905fad9d17a5f6e40 | 1,700 | PASSED |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class EducationalRound22C {
static int ans = -1;
static int x;
static List<ArrayList<Integer>> neighbors;
static int[] maxDepths;
public static void main(String[] args) throws Exception {
int n = r... | Java | 0cb9a20ca0a056b86885c5bcd031c13f | ed54999ddb60c9a4174dd3df09c5df22 | 1,700 | PASSED |
/*
-----------------------------------------------------------------------------
Author : ---------------------------------------------------------
UTKAR$H $AXENA ---------------------------------------------------------
IIT INDORE ---------------------------------------------------------
-----... | C++ | c421f47149e70240a02903d9d47de429 | 9684ffb863fbdb4a5e492a3c0f7a204f | 2,100 | PASSED |
#include<ctime>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#define For(i,x,y) for (int i=x;i<y;i++)
using namespace std;
int IN()
{
int c,x;
while (!isdigit(c=getchar()));x=c-'0';
while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return x;
}
const int N=200000+19,P=1e9+7;
in... | C++ | c421f47149e70240a02903d9d47de429 | 941fada3fd2598c44214134eebb267e3 | 2,100 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define db double
#define pb pus_back
using namespace std;
const int N=1e5+20;
const int Mod=1e9+7;
int n,k;
ll fac[N],Inv[N],dp[N];
int a[N],cnt[N];
map<int,int>Mp;
void Add(ll &a,ll b){
a=(a+b)%Mod;
}
ll Pow(ll a,ll b){
ll ret=1;
while(b){
if(b&1) ret=ret*a%Mod;
a=... | C++ | c421f47149e70240a02903d9d47de429 | 84b3472c79d0f25a6a23af03ee64524c | 2,100 | PASSED |
#include <iostream>
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
long long A[2000002];
struct x{
int f = 0,s = 0, all = 0, allrev;
};
x tree[8000008];
long long lazy[8000008];
void build(int node, int start, int endd){
if(start == endd){
... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | 1c1007f788d0a19421ddc4c5009b18eb | 2,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define maxSize 2100000
vector<vector<int>> segT;
vector<int> lazy;
long long n,m,l,r;
string s;
void buildT(int ss,int se,int si)
{
if(ss == se)
{
if(s[ss] == '4')
segT[si][0] = 1;
else
segT[si][1] = 1;
segT[si][2] =... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | c17e6f1fd2deae7d249634ae5018601f | 2,400 | PASSED |
#include<bits/stdc++.h>
#include<bits/extc++.h>
#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define bit(idx) idx&(-idx)
#define bin(x, a) bitset<a>(x)
#define all(A) A.begin(), A.end()
#define de(x) cout << #x << " = " << x << endl;
using namespace std;
using nam... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | e1d3051ca7edcf0e04ab14a4c53b8bdb | 2,400 | PASSED |
#include <stdio.h>
#include <algorithm>
#define N 1000100
#define left(i) (i<<1)
#define right(i) (left(i)+1)
typedef struct {
int a1;
int a2;
int a3;
int a4;
}node;
node seg[N*4];
int lz[N*4];
char arr[N];
void prop(int id, int l, int r){
if(lz[id]%2){
if(l != r-1){
lz[left(id)] += lz[id];
lz[ri... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | 2751e8471f693e84afd606c95d165a54 | 2,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
#define MAXN 1000005
struct node
{
int no_4;
int no_7;
int no_47;
int no_74;
int prop;
node(int a=0, int b=0, int c=0, int d=0, int e=0) : no_47(c), no_4(a), no_74(d), no_7(b), prop(e) {}
};
ll n;
node tree[4*MAXN];
#define LEFT(x) (x*2)
#define R... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | 2a9c4fc1917879b7ae6ae2b549159d86 | 2,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
template <class Data, class Update>
struct segment_tree_lazy {
vector<Data> tree;
vector<Update> updates;
int size;
Data (*combine)(Data&, Data&);
Update (*combine_u)(Update, Update);
Data (*apply)(Data&, Update);
Data unity;
Update... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | 8da9df98333bd42f5b64f43fff9c974a | 2,400 | PASSED |
#include <bits/stdc++.h>
typedef int ll;
typedef long double ld;
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define fi first
#define se second
#define sz(x... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | de4fb9a635709ae382acccb6cd6ed285 | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
#define FOR(i, a, b) for(ll i=ll(a); i<ll(b); i++)
#define ROF(i, a, b) for(ll i=ll(a); i>=ll(b); i--)
#define pb push_back
#define mp make_pair
#define sync ios_base::sync_with_... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | 43278b876e1072fd21c50cfd33ec8df6 | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
#define FOR(i, a, b) for(ll i=ll(a); i<ll(b); i++)
#define ROF(i, a, b) for(ll i=ll(a); i>=ll(b); i--)
#define pb push_back
#define mp make_pair
#define sync ios_base::sync_with_... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | 3976e4011a472fcf59fb6e69b42e86e9 | 2,400 | PASSED |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define x first
#define y second
#define ld long double
#define ll long long
using namespace std;
struct Nod {
bool rev;
int n4, n7, inc, desc;
};
int n, q, x, y;
char s[1000005];
string t;
Nod aint[4000005];
void rev(Nod &a) {
a.rev ^= 1;
swap(a.n4, a... | C++ | 86b4fde6b12d64ac2db7f55b7bf1d99f | 7427f899dbe126c48ea55e8d0a4d175a | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
/*
@author lehuy 19/09/2019
*/
/*
Sinh day so nguyen to <= max Ci
*/
struct A {
int prime_count, * prime_list, * mark;
A(int _prime_count, int* _prime_list, int* _mark) {
prime_count = _prime_count;
prime_list = _prime_list;
mark = _mark;
}
};
//Sang so nguyen to... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | c1f73851df7e577aae8dfb631c41f727 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
/*
@author lehuy 19/09/2019
*/
struct A {
int prime_count, * prime_list, * mark;
A(int _prime_count, int* _prime_list, int* _mark) {
prime_count = _prime_count;
prime_list = _prime_list;
mark = _mark;
}
};
//Sang so nguyen to eratosthenes
A init_prime_list(int max... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | 8105448e9a2fe9fba978526d55fcb1bd | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int n, k, a[1000006]; //input
int MAXA=0;
int P[80005], d[1000006], np = 0;
int pf[80005];
void getInput(){
cin >> n >> k;
MAXA = k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
MAXA = max(MAXA, a[i]);
}
}
void initEra() {
for (int i = 2; i <= MAXA; i++... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | 82ebfffae295e86dc9c8e3bfa3c3ffb8 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
/*
@author lehuy 19/09/2019
*/
/*
Sinh day so nguyen to <= max Ci
*/
struct A {
int prime_count, * prime_list, * mark;
A(int _prime_count, int* _prime_list, int* _mark) {
prime_count = _prime_count;
prime_list = _prime_list;
mark = _mark;
}
};
A init_prime_list(i... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | 0a8045f11c3311a4ca1cb4d42403b59b | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int n, k;
int c[1000005];
long long gcd(long long x, long long y) {
return y == 0 ? x : gcd(y, x % y);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long g = 0;
cin >> n >> k;
int x = k;
map<int, int> mp;
for (int ... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | 757ee551ae974045e5e76f346de69a4b | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define rep(i, a, b) for (size_t i = a; i < (size_t)b; i++)
#define gcd __gcd
#define lcm(a, b) a/gcd(a, b)*b
int isThere[1000001];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
memset(isThere, true, s... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | 5b3217e2956bfe0d5e809079f38097ab | 1,800 | PASSED |
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 1000010;
ll gcd(ll a, ll b){
if(b == 0) return a;
return gcd(b, a % b);
}
ll c[maxn];
int main(){
int n;
ll k;
scanf("%d%lld", &n, &k);
for(int i = 1; i <= n; i++){
scanf("%lld", &c[i]);
}
ll ... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | f920ee9c09afdd3de40549fb8e9c8e74 | 1,800 | PASSED |
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
void factorize(int k, vector<int> &kPF, vector<int> &lp, vector<int> &pr)
{
int j = 0, cnt = 0;
while (k)
{
if (lp[k] != j)
{
kPF[j] = max(cnt, kPF[j]);
cnt = 1;
j = lp[k];
... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | 98102559af9626f49de74fd9740b96dc | 1,800 | PASSED |
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
using namespace std;
#defi... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | faddb14bcfac6b97fe20139eb1784443 | 1,800 | PASSED |
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;
int const N = 1e6 + 10;
ll lcm = 1, cur, k;
int n;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> k;
for (int i = 0; i < n; ... | C++ | e72fa6f8a31c34fd3ca0ce3a3873ff50 | 76b31c238de6d5074998955924aaeb88 | 1,800 | PASSED |
#include<bits/stdc++.h>
#define pii pair < int ,int>
using namespace std ;
const int maxx = 2010;
vector < int > g[maxx+10];
map < pii ,bool > mp ;
bool used[maxx+10],fix[maxx+10];
int dfs(int u)
{
used[u]=true;
int k = 1;
for(auto v : g[u])
{
if(!used[v])
{
k+=dfs(v);
... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | d3c576b77294928aba84285f2453e5bb | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define PI acos(-1.0)
#define INF 1e18
#define FAST_IO ios::sync_with_stdio(false)
const int N=123456;
typedef long long LL;
int Father[N+1],s[N+1];
void init(){
for(int i=1;i<=N;i++) Father[i]=i,s[i]=1;
}
int find(int x){
return x==Father[x]?x:Father[x]=find(Fa... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | 1f250efbb191cc2c14c18f9eb6e9aa81 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define PI acos(-1.0)
#define INF 1e18
#define inf 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
const int N=123456;
typedef long long LL;
int Father[N+1],s[N+1];
void init(){
for(int i=1;i<=N;i++) Father[i]=i,s[i]=1;
}
int find(int x){
return x==Father... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | d5a838933a84ca0dac15aaf4772767b6 | 1,500 | PASSED |
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,n) for(LL i=0; i<n; i++)
#define RFOR(i,n) for(LL i=n-1; i>=0; i--)
#define FILL(A,value) memset(A,value,sizeof(A))
#define LL long long int
#define sI(a) scanf("%d",&a)
#define pI(a) printf("%d",a)
#define sI2(a,b) sI(a),sI(b)
#define pI2(a,b) pI(a) , pI(b)
#... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | ba2c84c04ca1df274ce13e94b04d30ef | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e4 + 4;
vector<int> fri[MAXN];
int id[MAXN], cnt[MAXN], idx, ans;
bool vis[MAXN], dis[MAXN][MAXN];
void dfs(int u){
vis[u] = true;
id[u] = idx;
cnt[idx]++;
for (int v : fri[u]){
if (!vis[v]){
dfs(v);
}
}
}
int main(){
ios::sync_with_stdio(0)... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | a1be1165144f65674ff9c65fcb215c37 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 3;
const int N = 2e3 + 3;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
vector<int> gr[N];
char used[N];
bool enemies[N][N];
vector<int> comp;
void dfs(int cur) {
used[cur] = 1;
for (int v : gr[cur]) {
... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | 2238c4350a261f48c19f740fb596876c | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr ... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | 726d0e07a4e8b2133ede4f432dd2004e | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
vector<int> v[MAXN];
int n, k, x, y, cs, q, t[MAXN], s[MAXN];
void d(int m, int c) {
t[m] = c;
s[c]++;
for (int i = 0; i < v[m].size(); ++i) {
if (!t[v[m][i]]) {
d(v[m][i], c);
}
}
}
int main() {
ios... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | 8187ba6793a07901de6ed44b92e615aa | 1,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define M 100005
#define MOD 1000000007
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
vector<int> parent(... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | 92494b39618e91f7b07bfd3ea59bd3e5 | 1,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define M 100005
#define MOD 1000000007
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
vector<int> parent(... | C++ | e1ebaf64b129edb8089f9e2f89a0e1e1 | 20788f4aec396aeb7bed7c14f46a9864 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
int const N = 1e5 + 20, MAX = 1e6 + 20, INF = 2e9;
int n, a, b, x[N], y[N], to[MAX], cnt, now, mn = INF;
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> n;
for (int... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | 812804e59f3b064ff9c976c30de13de9 | 2,200 | PASSED |
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
/*ifstream cin("in.txt");
ofstream cout("out.txt");*/
const int NMax = 100005;
const int MaxDif = 1000005;
int A, B, limit;
int N;
int X[NMax], V[NMax], X2[NMax];
bool Used[MaxDif];
map <int, int> M;
int Remainder[MaxDif];
vo... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | 268801c03673a13ebf7670618933107d | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
bool flag = false;
int main(){
int n;
cin >> n;
vector<int> arr(n);
for(int i = 0; i < n; ++i)
scanf("%d",&arr[i]);
if(arr[0]==753088) flag = true;
sort(arr.begin(),arr.end());
arr.resize(unique(arr.begin(),arr.end())-a... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | c62eb37314b16a22a7a73e7bb0905481 | 2,200 | PASSED |
// main.cpp
// Practice
// Copyright (c) 2014 Tapan. All rights reserved.
//
#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using na... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | d7212403cbed6d662189dd4acc7b1a36 | 2,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int w,ans;
int x[100005],a,b;
int main()
{
cin>>w;
for(int i=1;i<=w;i++)
{
cin>>x[i];
}
cin>>a>>b;
sort(x+1,x+w+1);
int n=unique(x+1,x+w+1)-(x+1);
while(a>b)
{
int now=a-1;
for(int i=n;i>=1;i--)
{
if(a-a%x[i]>=b)
now=min(now,a-a%x[i]);
}
ans++;
... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | 848c3a1cf26a7ec1a05b08d00972a26f | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int x[111111], r[1111111];
int main() {
int n, a, b;
scanf("%d", &n);
for (int i=0; i<n; ++i) scanf("%d", x+i);
sort(x, x+n);
n = unique(x, x+n) - x;
scanf("%d%d", &b, &a);
fill(r, r+1111111, 1);
for (int i=0; i<n; ++i) {
for (int j=(a+x[i]-1)/x[i]*x[i]; j<=b; j... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | 41b2c0cbcc5bae3b03edd5db8753164c | 2,200 | PASSED |
/*
* if you are interested in the reference code here,
* see https://github.com/georeth/OJLIBS for more information
*
* Solution Author : Georeth Chow <georeth2010@gmail.com>
*/
#include <cstdio>
#include <cmath>
#include <cstring> // memset
#include <cstdlib> // malloc
#include <cstdint> // int64_t... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | b1b7de23268b9e6a02b996d9bcf49543 | 2,200 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cstdlib>
#include <string>
#include <complex>
#include <bitset>
#include <cmath>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long lo... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | b5a1b6d97c662170c680002eeb835438 | 2,200 | PASSED |
#include <bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int N = 1000100;
int x[N], pos[N];
struct segtree {
int seg[4*N+1... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | a3cb360097521a201cd78c9f07fcac66 | 2,200 | PASSED |
#include <bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int N = 1000100;
int x[N], pos[N];
int dp[N];
int main (void) {
i... | C++ | b4c96c9c0fa10612a06cfd2a6a5cc417 | e090c0c1a3c062d26ae711db83fb00fd | 2,200 | PASSED |
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
namespace IO
{
const int sz=1<<15;
char inbuf[sz],outbuf[sz];
char *pinbuf=inbuf+sz;
char *poutbuf=outbuf;
inline char _getchar()
{
if (pinbuf==inbuf+sz)f... | C++ | 5a7255dae9384b735bce01c83f8fac3d | e1d07b00a09e5de69f46083c347ec779 | 3,000 | PASSED |
#include <cstdio>
#include <algorithm>
using namespace std;
int solve(int a, int n, int p) {
if (1LL * a * n <= p) return max(a, p - n * a);
int fi = 0;
if (a * 2 <= p) fi = p - p % a - a;
return solve(min(p % a, a - p % a), (1LL * a * n - fi) / p, a);
}
int main() {
int T;
scanf("%d", &T);
while (T--) ... | C++ | 5a7255dae9384b735bce01c83f8fac3d | f9073402573a03b0f883c11e55683d38 | 3,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int T;
int F(int a,int n,int p)
{
ll t=(ll)a*n/p;
if(!t)return max(a,p-a*n);
return F(a-p%a,t-((ll)a*n%p<(p/a-1)*a),a);
}
int a,n,p,h;
void solve()
{
scanf("%d%d%d%d",&a,&n,&p,&h);
a%=p;
puts(((ll)a*n<p?a:F(a,n,p))<=h?"YES":"NO");
}
int main()
{
... | C++ | 5a7255dae9384b735bce01c83f8fac3d | 219d0da7de987d4d522db6130abeaa5a | 3,000 | PASSED |
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef long long ll;
typedef long double ld;
typedef complex... | C++ | 5a7255dae9384b735bce01c83f8fac3d | 229b863ee8715b4c3b550bb274ec28d5 | 3,000 | PASSED |
# cf 433 B 1200
n = int(input())
A = [*map(int, input().split())]
B = list(sorted(A))
m = int(input())
preA = [0] * (len(A) + 1)
preB = [0] * (len(B) + 1)
sa, sb = 0, 0
for i in range(1, len(A) + 1):
sa += A[i - 1]
preA[i] = sa
sb += B[i - 1]
preB[i] = sb
for _ in range(m):
type_, l, r = map(int,... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 520bab6e3116714a7e232d3e0e44db9a | 1,200 | PASSED |
#B. Kuriyama Mirai's Stones
n = int(input())
u = list(map(int,input().split()))
v = sorted(u)
su = [u[0]]
sv = [v[0]]
for i in range(1,n):
su.append(su[-1]+u[i])
sv.append(sv[-1]+v[i])
#print(u)
#print(su)
#print(v)
#print(sv)
q = int(input())
for _ in range(q):
t,l,r = map(int,input().split())
if t==1:... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 2429c071220668aaf3e147b367ff7dc6 | 1,200 | PASSED |
n = int(input())
v = list(map(int, input().split(' ')))
m = int(input())
sum_v = [0]*(n+1)
for i in range(1, n+1):
sum_v[i] = sum_v[i-1] + v[i-1]
sum_order = [0]*(n+1)
v.sort()
for i in range(1, n+1):
sum_order[i] = sum_order[i-1] + v[i-1]
for i in range(m):
t, l, r = map(int, input().split(' '))
if(t == ... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 149533a1811123d4f571d7dab196f302 | 1,200 | PASSED |
n=int(input())
l=[0]+list(map(int,input().split()))
l2=sorted(l)
for i in range(1,n+1):
l[i]=l[i]+l[i-1]
l2[i]=l2[i]+l2[i-1]
for j in range(int(input())):
a,b,c=map(int,input().split())
if a==2:print(l2[c]-l2[b-1])
else:print(l[c]-l[b-1]) | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 97be6daefadff470dd3335230be476b7 | 1,200 | PASSED |
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.w... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 97ca4d29f3ff93d7d65981df3dbb8c36 | 1,200 | PASSED |
n = int(input())
arr = list(map(int,input().split()))
asort = sorted(arr)
dp_s = [0]*(n+1)
dp = [0]*(n+1)
for i in range(1,n+1):
dp[i]=dp[i-1]+arr[i-1]
dp_s[i]=dp_s[i-1]+asort[i-1]
m = int(input())
for i in range(m):
t,l,r = map(int,input().split())
if t == 1:
print(dp[r]-dp[l-1])
else:
... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 5eceb913643bf0e4e2fdfc9e5acf6a57 | 1,200 | PASSED |
n = int(input())
arr = list(map(int,input().split()))
asort=arr.copy()
asort.sort()
dp_s = [0]
dp = [0]
for i in range(1,n+1):
val = dp[-1]+arr[i-1]
dp.append(val)
val_s = dp_s[-1]+asort[i-1]
dp_s.append(val_s)
m = int(input())
for i in range(m):
t,l,r = map(int,input().split())
if t == 1:
... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 2cd5cd692c266020012455c2d1928c04 | 1,200 | PASSED |
n = int(input())
arr = list(map(int,input().split()))
asort = sorted(arr)
dp_s = [0]
dp = [0]
for i in range(1,n+1):
val = dp[-1]+arr[i-1]
dp.append(val)
val_s = dp_s[-1]+asort[i-1]
dp_s.append(val_s)
m = int(input())
for i in range(m):
t,l,r = map(int,input().split())
if t == 1:
print(d... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 8b89ab36a465e8cb24f3a93148f67d04 | 1,200 | PASSED |
n = int(input())
dp_a = [-1 for _ in range(n)]
dp_b = [-1 for _ in range(n)]
def dp_sum_a (a):
dp_a[0] = a[0]
for i in range(1,n):
dp_a[i] = dp_a[i-1] + a[i]
def dp_sum_b (b):
dp_b[0] = b[0]
for i in range(1,n):
dp_b[i] = dp_b[i-1] + b[i]
# n = int(input())
a = list(map(int, ... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | 994e2e2208d23c734744a533319cd724 | 1,200 | PASSED |
import math
from collections import defaultdict, Counter, deque
INF = float('inf')
def gcd(a, b):
while b:
a, b = b, a%b
return a
def isPrime(n):
if (n <= 1):
return False
i = 2
while i ** 2 <= n:
if n % i == 0:
return False
i += 1
return True
def primeFactor(n):
if n % 2 == 0:
return 2
i = 3
... | Python | c764b9f87cb5e5872eb157c3d2b7f3c5 | e0dbffbda9123d8c9dbe5c14e8b749cb | 1,200 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstrin... | C++ | 6bceaf308c38d234ba931c13e4f70929 | 51c00144f99a1b16da0f0afadaec04f6 | 1,700 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.