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 <iostream>
#include <stdio.h>
using namespace std;
int a[200001],q[200001];
int main(){
int n,c=0,e=0;
scanf("%d", &n);
for(int i=1;i<=n;i++){
scanf("%d", &a[i]);
if(a[i]==0){
e=i;
}
else if(e!=0){
a[i]=i-e;
}
}
for(int i=1;i<=n;i++){
if(a[i]==0){
e=i;
break;
}
}
for(int i=1;i<... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 39627440808b7fe534ff716e8a6efae5 | 1,200 | PASSED |
#include <bits/stdc++.h>
#define F(i, l,r) for(long long i =l; i<=r; ++i)
#define Fr(i, l,r) for(long long i =l; i>=r; --i)
using namespace std;
typedef long long ll;
ll n, a[200200], d[200200], z[200200], k, h, m;
int main()
{
cin >> n;
F(i, 1, n)
{
scanf("%I64d", &a[i]);
if(a[i] == 0) {
... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 5cf430cb6e014ebafb2bbcc1993501c6 | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int ans[200002]={0};
void fill(){
for(int i=0;i<200002;i++) ans[i] = 1e7;
}
int main() {fill();
int n;cin>>n;
int arr[200002];
queue<int>q;
stack<int>st;
for(int i=0;i<n;i++){
cin>>arr[i];
if(arr[i] == 0) q.push(i), st.push(i);
}
for(int i=0;i<n;i++){
if(q.s... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 130026a0af3c16f3cdc06729c2c8752d | 1,200 | PASSED |
#include "cstdio"
#include "iostream"
#include "sstream"
#include "algorithm"
#include "string"
#include "cstring"
#include "queue"
#include "cmath"
#include "vector"
#define inf 0x3f3f3f
#define mj
#define db double
#define ll long long
using namespace std;
const int N=2e6+5;
const int mod=1e9+7;
int a[N],f[N];
int m... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 5a4e71b3b070a91251db352207a41cbe | 1,200 | PASSED |
#include<iostream>
#include<cmath>
using namespace std;
int a;
int tab[((int)(2e5))+1];
int out[((int)(2e5))+1];
int zeropos=-1;
int firstzero=-1;
int main()
{
cin>>a;
for(int i=0;i<a;i++)
{
cin>>tab[i];
}
for(int i=0;i<a;i++)
{
if(tab[i]==0)
{
zeropos = i;
... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 7c935011fe11510dae47fc98f30ae2d9 | 1,200 | PASSED |
#include<iostream>
using namespace std;
int main()
{int n,a[200008],i,j,k,b[200008];
cin>>n;
k=-1;
for(i=0;i<n;i++)
{cin>>a[i];
if(a[i]==0)
b[++k]=i;
}
i=0;
while(i<=b[0])
{a[i]=b[0]-i;
i++;
}
j=0;
while(i<=b[k])
{for(i=b[j]+1;i<=b[j+1]-1;i++)
{a[i]=min(i-b[j],b[j+1]-i);
}
j++;
}
for(i=b[k... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 3c24469ba52e0ec8a50414bbd3f12b3c | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, t, r;
cin >> n;
vector <int> a(n);
queue <int> q;
for (int i = 0; i < n; i++){
cin >> a[i];
if (a[i] == 0) q.push(i);
}
t = q.front();
q.pop();
r = n * 2;
if (!q.empty()){
r = q.front();
q.pop();
}
for (int i = 0; i < n; i++){
i... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 4c81b3b2c942e31a182fad5e3fa646c6 | 1,200 | PASSED |
#include <iostream>
using namespace std;
int main()
{
int a[1000000],rez[1000000],rez1[1000000];
int b,c,d,e,f,g,h,i,j,k,l,m,n;
cin >> n ;
for (i=0;i<n;i++)
cin >> a[i];
l=1000001;
for (i=0;i<n;i++)
{
l=l+1;
if (a[i]==0) l=0;
rez[i]=l;
}
l=10000... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 7f75b07959069fd373b0ebc37c9bb899 | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define ll long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define D1(x) {cerr<<" [" <<#x<<": "<<x<<"]";cout << endl;}
#define D2(x) {cerr<<" [" <<#x<<": ";fo... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 34597a7bcb5cfd66460c9ee2b2cba28c | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
#define ff first
#define ss second
#define pb ... | C++ | 2031f2ac5652609fda77830e93ffcc2c | 5518be5221ce0c6402249e7877609ffa | 1,200 | PASSED |
//题目链接 http://codeforces.com/contest/617/problem/E
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6+1e5;//这里是坑点虽然1e6够了,但是由于哈希
//的原因,异或后可能大于1e6,所以需要注意
long long ans[maxn],flag[maxn],pos[maxn],a[maxn];
long long Ans = 0,k;
struct node
{
int l,r,id;
}Q[maxn];
int cmp(node a,node b)... | C++ | feec32948519ff16f767a823e634eccb | 6dd74f2941f2b921115c1dc1a637baae | 2,200 | PASSED |
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxl 2000010
using namespace std;
long long n,m,k,size,cnt,res;
long long a[maxl],sum[maxl],pos[maxl],l[maxl],r[maxl];
long long num[maxl];
long long ans[maxl];
struct que
{
long long l,r,ind;
}q[maxl];
bool cmp(const que &x,const que &y... | C++ | feec32948519ff16f767a823e634eccb | ce9183a1202ca243190224c41647bd78 | 2,200 | PASSED |
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxl 2000010
using namespace std;
long long n,m,k,size,cnt,res;
long long a[maxl],sum[maxl],pos[maxl],l[maxl],r[maxl];
long long num[maxl];
long long ans[maxl];
struct que
{
long long l,r,ind;
}q[maxl];
bool cmp(const que &x,const que &y... | C++ | feec32948519ff16f767a823e634eccb | fce0062fbbc0de33216073b701f7cb24 | 2,200 | PASSED |
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxl 2000010
using namespace std;
long long n,m,k,size,cnt,res;
long long a[maxl],sum[maxl],pos[maxl],l[maxl],r[maxl];
long long num[maxl];
long long ans[maxl];
struct que
{
long long l,r,ind;
}q[maxl];
bool cmp(const que &x,const que &y... | C++ | feec32948519ff16f767a823e634eccb | 16b68a51c3cd006462748320bd31727e | 2,200 | PASSED |
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];
struct query
{
int id, l, r;
}Q[maxn];
bool cmp(query A, query B)
{
if(A.l / block != B.l / block) retur... | C++ | feec32948519ff16f767a823e634eccb | 47461ebd0d3ba9f5ec0378aa65aa5a1a | 2,200 | PASSED |
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];
struct query
{
int id, l, r;
}Q[maxn];
bool cmp(query A, query B)
{
if(A.l / block != B.l / block) retur... | C++ | feec32948519ff16f767a823e634eccb | be6acfc31e6ef6de98d431b10c89d710 | 2,200 | PASSED |
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];
struct query
{
int id, l, r;
}Q[maxn];
bool cmp(query A, query B)
{
if(A.l / block != B.l / block) retur... | C++ | feec32948519ff16f767a823e634eccb | b0c7105137dde101fb544036f4f1ce54 | 2,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
static ll block,cnt;
long long int ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
ll first,second,index;
};
struct node p[1000010];
unordered_map<int,int> freq;
ll n,k,q,a[1000010],i;
lo... | C++ | feec32948519ff16f767a823e634eccb | 747da8269ecaea746beaed7fb37fb05b | 2,200 | PASSED |
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
const int MAX1=0x7f7f7f7f;
const int MAXN=5e6+10;
const int MAX=1e5+10;
typedef long l... | C++ | feec32948519ff16f767a823e634eccb | 69cc0c9047a74f55ee35f7f7bd8b3ee7 | 2,200 | PASSED |
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define ll long long
const int maxn=5e6+10;
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
int l, r, id;
} q[maxn];
int cmp(query ... | C++ | feec32948519ff16f767a823e634eccb | 49a8f0dc6824499ff90eb8f11a30a39e | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;int n,q,x,y;map<int,pair<char,int>>m;int query(){char c;cin>>x>>y>>c;auto b=m.lower_bound(x);if(b->first==x)return 0;if(c=='L')--b;int ans=abs(b->first-x);if (b->second.first==c)ans+=b->second.second;m[x]={c,ans};return ans;}int main(){cin>>n>>q;m[0]={'U',0};m[n+1]={'L',0};f... | C++ | 870720d864ce169db2037f19f029719c | 0481feed0c66bce783658feac8b9f65f | 2,200 | PASSED |
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define maxn 200010
using namespace std;
ifstream fin("comentariu.in");
ofstream fout("comentariu.out");
int arb[2][4*maxn],pos[2][maxn];
int x[maxn],y[maxn];
char c[maxn];
int ll,val,stop,n,q;
vector<pair<int,int> > l,u;
se... | C++ | 870720d864ce169db2037f19f029719c | 3e03c965d637130c8edfb3419d9669d9 | 2,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
struct node{long long x,y;char c;}a[2000000+5];
struct node1{long long now,id;}b[2000000+5];
long long Q1[2000000+5],Q2[2000000+5],ans[2000000+5];
bool visit[2000000+5];
bool cmp(node1 A,node1 B)
{
return A.now<B.now||A.now==B.now&&A.id<B.id;
}
bool cmp1(node1 A,node1 B)
{
... | C++ | 870720d864ce169db2037f19f029719c | cfa80590d71c99af800040dd173cee11 | 2,200 | PASSED |
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <deque>
#include <ctime>
#include <cstring>
#include <unordered_map>
//#include <bits/stdc++.h>
using namespace std;
#define fr fir... | C++ | 870720d864ce169db2037f19f029719c | 0f09f819eb6abd658cda9c5c66bfcbb7 | 2,200 | PASSED |
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <deque>
#include <ctime>
#include <cstring>
#include <unordered_map>
//#include <bits/stdc++.h>
using namespace std;
#define fr fir... | C++ | 870720d864ce169db2037f19f029719c | db9f234107597c337f65a9dc6582d18d | 2,200 | PASSED |
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <deque>
#include <ctime>
#include <cstring>
#include <unordered_map>
//#include <bits/stdc++.h>
using namespace std;
#define fr fir... | C++ | 870720d864ce169db2037f19f029719c | 59dbeaf46ac52b7b494368406accd8f2 | 2,200 | PASSED |
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <deque>
#include <ctime>
#include <cstring>
#include <unordered_map>
//#include <bits/stdc++.h>
using namespace std;
#define fr fir... | C++ | 870720d864ce169db2037f19f029719c | fbf97339c8551b5186b3d8378a7293bd | 2,200 | PASSED |
#include <cstdio>
#include <algorithm>
using namespace std;
struct node
{
int from, to, value;
node *left, *right;
node(int _from, int _to)
: from {_from}, to {_to}, value {0},
left {NULL}, right {NULL}
{
}
~node()
{
delete left;
delete right;
... | C++ | 870720d864ce169db2037f19f029719c | 5d9298d31fb1757713851239b44cb675 | 2,200 | PASSED |
#include <cstdio>
#include <unordered_map>
using namespace std;
struct tree
{
unordered_map <int, int> M;
int i0;
tree (int n)
{
i0 = 32;
while (i0 <= n)
i0 *= 2;
}
void add(int p, int q, int a, int b, int v, int value)
{
if (p >= a && q <= b)
... | C++ | 870720d864ce169db2037f19f029719c | 3fd4e2fd87d12863cd24435f39f5b466 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define out(x) cerr << #x"=" << x << endl
const int N = 2e5 + 10;
int n, q;
char s[20];
int x[N], y[N], d[N];
vector<int> vx, vy;
unordered_map<int, int> rkx, rky;
int nx, ny;
bool ff[N][2];
int treex[N * 4], treey[N * 4];
void update(int p, int l, int r, int ll, int ... | C++ | 870720d864ce169db2037f19f029719c | cea435af31515730cafeaf395f38a1e9 | 2,200 | PASSED |
import java.util.Scanner;
public class D1_690 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int R = in.nextInt();
in.nextInt(); // C
String row = null;
for (int r=0; r<R; r++) {
row = in.next();
}
int answer = 0;... | Java | c339795767a174a59225a79023b5d14f | e7d679b214c26fec239f92625f825433 | 1,200 | PASSED |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.*;
import java.io.*;
/**
*
* @author root
*/
public class D1 {
static int map[][];
static boolean visite... | Java | c339795767a174a59225a79023b5d14f | 6fb25eafcbd847a8795c923537462681 | 1,200 | PASSED |
import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int r = s.nextInt(), c = s.nextInt(); s.nextLine();
char[] lastRow = new char[c];
for(int i = 0; i < r; i++) {
if(i == r-1) {
lastRow = s.nextLine().toCharArray();
}... | Java | c339795767a174a59225a79023b5d14f | d2f9c7c83177169517ffaadd4c1da944 | 1,200 | PASSED |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | c339795767a174a59225a79023b5d14f | 0316a650511025d9a0004c43c100cb4d | 1,200 | PASSED |
import java.util.Scanner;
public class King {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r = sc.nextInt();
int c = sc.nextInt();
int k = 0;
int l = 1;
String s = "";
for (int i = 0; i < r; i++) {
s = sc.next(... | Java | c339795767a174a59225a79023b5d14f | aae65774e2b16238228b8766b744470c | 1,200 | PASSED |
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
private static Set<Integer> integers;
private static int wall[][];
private static int R;
private static int C;
public static void main(String[] args) {
integers = new HashSet<>();
Scanner scanner = new Scanner(Sys... | Java | c339795767a174a59225a79023b5d14f | d2393aae645ad62fb98e490dd2fe662c | 1,200 | PASSED |
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Igor Kraskevich
*/
public c... | Java | c339795767a174a59225a79023b5d14f | 1c75c436ec262e43d1e4448d0c0398dd | 1,200 | PASSED |
import java.util.*;
import java.io.*;
public class D1{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
String[] line = br.readLine().split(" ");
int r =... | Java | c339795767a174a59225a79023b5d14f | 091122f071b8be8c53351d8b9e035c42 | 1,200 | PASSED |
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Main4easy {
public static void runBFS(boolean[][] mat, int i, int j, int H, int W){
Queue<Par> q = new LinkedList<>();
q.add(new Par(i, j));
mat[i][j] = false;
while(!q.isEmpty()){
... | Java | c339795767a174a59225a79023b5d14f | 34a91600d14933ce8684878c86b3d65d | 1,200 | PASSED |
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 101;
int n, m;
char a[N][N];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
bool isValid(int x, int y){
return x >= 0 && y >= 0 && x < n && y < m && a[x][y] == 'B';
}
void dfs(int x, int y){
a[x][y] = '.';
for(int i = ... | C++ | c339795767a174a59225a79023b5d14f | 4c5cdb7a3714cb29d3fd351fe313564f | 1,200 | PASSED |
#include<cstdio>
#include<cmath>
int n;
int main()
{ while (scanf("%d",&n)!=EOF)
{ if (n==1) {printf("1\n1\n");continue; }
if (n==2) {printf("1\n1\n"); continue;}
if (n==3) {printf("2\n1 3\n"); continue;}
if (n==4) {printf("4\n2 4 1 3\n"); continue;}
printf("%d\n",n);
... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 56cd3da17684dd1856619d19fb2bc932 | 1,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mod 1000000007
#define reset(s,val) memset(s,val,sizeof(s))
#define eps 0.0000001
#define pi acos(-1)
#define sqr(x) (x)*(x)
#define maxn 32000
int n;
int main( ){
//freopen("input.txt","r",stdin);
... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 96801ca91c267a6f06b6822a5c804e11 | 1,100 | PASSED |
#include<iostream>
using namespace std;
int main()
{
int n;
cin >>n;
if(n%2!=0||n==2||n==4)
{
if(n==1||n==2)
{
cout << "1" << endl;
cout << "1" <<endl;
}
else if(n==3)
{
cout << "2" <<endl;
cout << "1 3" << endl;
... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 8f82d284310392816662f4ff0e83ddb5 | 1,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
long x,n,i,t,l,r;
cin >> n;
if(n==1 || n==2) cout << 1 << endl << 1 << endl;
else
{
if(n%2==0)
{
l=1;
r=n/2+1;
cout << n << endl;
while(r!=n+1)
{
cout << r << " " << l << " ";
l++;
r++;
}
cout << endl;
}
else
{
... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 9252b85188d3fb497695f35b7aea09d7 | 1,100 | PASSED |
//Codeforces 534 A
//http://codeforces.com/problemset/problem/534/A
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1){
cout << 1 << endl;
cout << 1 << endl;
}
else if (n == 2){
cout << 1 << endl;
cout << 1 << endl;
}
else i... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 70f49269c97b3898b1dafc70abe98adb | 1,100 | PASSED |
//Codeforces 534 A
//http://codeforces.com/problemset/problem/534/A
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 2){
cout << 1 << endl;
cout << 1 << endl;
}
else if (n == 3){
cout << 2 << endl;
cout << 1 << " " << 3 << endl;
... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 21352add059209da451ca584b31971f6 | 1,100 | PASSED |
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
long long i,j,k,n,t=0;
cin>>n;
if(n==1) cout<<1<<endl<<1;
else
if(n==2) cout<<1<<endl<<1;
else
if(n==3) cout<<2<<end... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 5ab09d99900ff26451af3ee6a480d082 | 1,100 | PASSED |
#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
for (i=1; i<=5000; i++)
a[i]=i;
cin>>n;
if (n==1 || n==2)
cout<<1<<endl<<1<<endl;
else
if (n==3)
cout<<2<<endl<<"1 3"<<endl;
else
if (n%2==0)
{
cout<<n<<endl;
for (i=n-1; i>0; i-=2)
cou... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | bc96c46c1de38b455a1c3dbc3abfbea9 | 1,100 | PASSED |
#include <iostream>
#include <sstream>
using namespace std;
int i1,rn;
string IntToString (int a)
{
ostringstream temp;
temp<<a;
return temp.str();
}
main(){
cin>>i1;
rn=i1/2*2;
if(i1==1){
cout<<1<<endl<<1;
return 0;
}
if(i1==2){
cout<<1<<endl<<1;
return 0;
}
if(i1==3){
cout<<2<<endl<<1<<" ... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | 9766a73e9cfe9d4ce0638b424938ea39 | 1,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a) memset(a,0,sizeof(a));
#define I int
#define F float
#define D double
#define S string
#define C char
#define END return 0;
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (in... | C++ | a52ceb8a894809b570cbb74dc5ef76e1 | a5e0ec597dce811e33f84f9e0cf49e80 | 1,100 | PASSED |
#include<stdio.h>
int candle[10001];
void merge(int min,int mid,int max)
{
int tmp[1000];
int i,j,k,m;
j=min;
m=mid+1;
for(i=min;j<=mid&&m<=max;i++){
if(candle[j]<=candle[m]){
tmp[i]=candle[j];
j++;
}
else{
tmp[i]=candle[m];
m++... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | f4b9e102248dd55b1c32b7255517040b | 1,600 | PASSED |
#include <stdio.h>
int w[1000], lig[1000];
int main()
{
#ifdef LOCAL
freopen("data.in", "r", stdin);
#endif
int m, t, r, i, j, k, l, need, count, prevs, preve;
while(scanf("%d%d%d", &m, &t, &r) != EOF)
{
count = 0;
for(i = 0; i < 400; i++)
{
w[i] = 0; lig[i] ... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | 60f6ad77bcb23787d49492a76161f4a2 | 1,600 | PASSED |
/*288*/
#include<stdio.h>
int mem[301];
int main()
{
int m,r,t;
int i,w,j,k;
int x,ans=0;
int can[301]={0};
scanf("%d %d %d",&m,&t,&r);
if(r>t)
{
printf("-1\n");
return 0;
}
for(i=0;i<m;i++)
{
scanf("%d",&w);
mem[w]=1;
}
for(i=1;i<=300;i++)
{
if(mem[i])
{
int x,count=0;
for(k=1;k<=r;k++... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | dd5220344fc1a29417414148900cebba | 1,600 | PASSED |
/*288*/
#include<stdio.h>
int mem[301];
int main()
{
int m,r,t;
int i,w,j,k;
int x,ans=0;
int can[301];
scanf("%d %d %d",&m,&t,&r);
if(r>t)
{
printf("-1\n");
return 0;
}
for(i=1;i<=r;i++)can[i]=0;
scanf("%d",&w);
mem[w]=1;
j=w;
for(i=1;i<m;i++)
{
scanf("%d",&w);
mem[w]=1;
}
for(i=j;i<=w;i++)
... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | f3e599afe272af8a176779038151ca7f | 1,600 | PASSED |
/*288*/
#include<stdio.h>
int mem[301];
int main()
{
int m,r,t;
int i,w,j,k;
int x,ans=0;
int can[301];
scanf("%d %d %d",&m,&t,&r);
if(r>t)
{
printf("-1\n");
return 0;
}
for(i=1;i<=r;i++)can[i]=0;
for(i=0;i<m;i++)
{
scanf("%d",&w);
mem[w]=1;
}
for(i=1;i<=w;i++)
{
if(mem[i])
{
int count=0;... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | 0820c665a0d40f697666b0e4ec89210e | 1,600 | PASSED |
#include<stdio.h>
int stack[90005];
int arr[305];
int main()
{
int m,t,r,i,flag = 0;
scanf("%d%d%d",&m,&t,&r);
for(i=0;i<m;i++)
scanf("%d",&arr[i]);
int count = 0,l = 0,f = r-1;
for(i=0;i<r;i++)
stack[i] = arr[0]-r+i;
count = r;
int j;
if(t<r)
flag=1;
... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | b0d0e5a679108b1b60973628f906dd8f | 1,600 | PASSED |
#include <stdio.h>
int can[602];
int main()
{
int m,t,r,i,k;
int ans = 0;
scanf("%d%d%d",&m,&t,&r);
int A[m];
for(i = 0;i < m;i++){
scanf("%d",&A[i]);
}
if(r > t){
printf("-1\n");
return 0;
}
for(i = 0;i < m;i++){
int j = A[i] - 1;
while(can[A... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | 18ad71c36479fce7b387751b46fda0f7 | 1,600 | PASSED |
#include<stdio.h>
int main(void){
int n; int t; int r;
scanf("%i %i %i", &n, &t, &r);
int Pole[n];
int i;
for(i=0;i<n;i++){
scanf("%i", &Pole[i]);
}
int mini=1000000;
int zacatky[1000];
int stav=1;
int zrovna=0;
int rozsviceni[1500];
for(i=0;i<1500;i++){
r... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | 6afda527da4ecd9fe9288eaddc7431e5 | 1,600 | PASSED |
#include <stdio.h>
char Flag[601];
int Cnt[601];
int main()
{
int m, t, r, w, i, j;
scanf("%d %d %d", &m, &t, &r);
while(m--) {
scanf("%d", &w);
w += 300;
Flag[w] = 1;
}
int Cur = 0;
for(i = 0; i < 601; ++i) {
Cur += Cnt[i];
if(Flag[i] == 1) {
... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | 3f6f9c24f9a75be8ac27cff379daed72 | 1,600 | PASSED |
#include"stdio.h"
int main()
{
int f,temp,x[1200]={0},w[1200]={0},i,m,t,r,ans=0,j,z;
scanf("%d%d%d",&m,&t,&r);
for(i = 0;i < m ; ++i){
scanf("%d",&temp);
if(x[temp+600]>=r)continue;
int shit = x[temp+600];
for(j = 0;j<r-shit;++j){
int s = t - 1;
for(z... | C | 03772bac6ed5bfe75bc0ad4d2eab56fd | f0e69d7a6c032610c52abf9c79e61c51 | 1,600 | PASSED |
n, m = gets.split.map(&:to_i)
aa = []
not_zero = false
n.times do|_x|
arr = gets.split
aa << arr
unless not_zero
not_zero=true if arr.include?("1")
end
end
unless not_zero
puts 0
exit
end
changed = Array.new(n,"0").map{Array.new(m,"0")}
ans = []
0.upto(n-1-1) do |i|
0.upto(m-1-1) do |j|
if... | Ruby | ad641a44ecaf78ca253b199f3d40ef96 | cec2980efe921100cd909f53ca132877 | 1,200 | PASSED |
l, c = map(int, raw_input().split())
m1 = []
m2 = []
cont = 0
for i in xrange(l):
m1.append(map(int, raw_input().split()))
m2.append([0] * c)
ans = []
for i in xrange(l -1):
for j in xrange(c - 1):
if m1[i][j] == m1[i+1][j] == m1[i+1][j+1] == m1[i][j+1] == 1:
m2[i][j] = m2[i+1][j] = m2[i+1][j+1] = m2[i][j+1]... | Python | ad641a44ecaf78ca253b199f3d40ef96 | 9b0bd597cbb603f436d7b501b27afa34 | 1,200 | PASSED |
n, m = map(int, raw_input().split())
a = [[0] * m for i in range(n)]
ans = []
def check(inx):
# print "Check for %s" % (inx,)
coords = [(0, 0,), (1, 1,), (0, 1,), (1, 0,)]
can = True
for coord in coords:
x, y = inx[0] + coord[0], inx[1] + coord[1]
if (x >= n or y >= m) or not a[x][y]:
... | Python | ad641a44ecaf78ca253b199f3d40ef96 | 8827013f66cd215bd2ec8ef181557d9c | 1,200 | PASSED |
import sys
n,m=map(int,raw_input().split())
p=[]
for i in xrange(n):
q=list(map(int,raw_input().split()))
p.append(q)
l=[[0 for i in xrange(m)] for i in xrange(n)]
ans=[]
for i in xrange(n):
for j in xrange(m):
if i==0:
if j==0:
if p[i][j]==1:
if ... | Python | ad641a44ecaf78ca253b199f3d40ef96 | 2c5ffb571af045fac6fea51262ba4e76 | 1,200 | PASSED |
n,m = map(int, raw_input().split(' '))
a = []
b = []
for i in range(n):
row = map(int, raw_input().split())
a.append(row)
b.append([0 for x in row])
np = False
moves = []
for i in range(n-1):
for j in range(m-1):
if a[i][j]:
if b[i][j] == 0:
if a[i][j+1] != 1 or a[i+... | Python | ad641a44ecaf78ca253b199f3d40ef96 | f6edf00dd2e9d57287cd40a4fd11d5ef | 1,200 | PASSED |
n,m = [int(nm) for nm in raw_input().split(" ")]
e = [[[] for _ in xrange(m)] for _ in xrange(n)]
for i in range(n):
ei = [int(eij) for eij in raw_input().split(" ")]
for j in range(m):
eij = ei[j]
e[i][j] = eij
xy = []
for i in range(n-1):
for j in range(m-1):
if (e[i][j] * e[i][j+1] * e[i+1][j] * e[i+1][j+1]... | Python | ad641a44ecaf78ca253b199f3d40ef96 | 4f5aafb53239bf020fd28c101fe8967c | 1,200 | PASSED |
w, h = map(int, raw_input().split())
matrix = []
shit = []
for j in range(h+2):
shit.append(0)
matrix.append(shit)
for i in range(w):
raw = map(int, raw_input().split())
raw = [0] + raw + [0]
matrix.append(raw)
matrix.append(shit)
ans = []
flag = 0
for i in range(1, w+1):
for j in range(1, h + 1):
... | Python | ad641a44ecaf78ca253b199f3d40ef96 | 9123b1b68edf27bbae44f6df42999fe9 | 1,200 | PASSED |
import sets
n,m=map(int,raw_input().split())
ans=[]
A=[]
czy = 0
czy2 = 0
for i in range(n):
A.append(list(map(int,raw_input().split())))
for i in range(n):
for j in range(m):
if A[i][j] == 1:
czy = 1
break
for i in range(n):
for j in range(m):
if i>0 and j>0 and A[i-1][j-1]==1 and A[i-1][j]==1 and A[i]... | Python | ad641a44ecaf78ca253b199f3d40ef96 | a4d2eb95cfde5d95dc4a97337d679973 | 1,200 | PASSED |
n,m=map(int,raw_input().split())
l=[]
l2=[]
ans=[]
ac=0
b=[[0 for i in range(m)] for j in range(n)]
for i in range(n):
temp=map(int,raw_input().split())
l.append(temp)
l2.append(temp[:])
for i in range(n):
for j in range(m-1):
l[i][j]=l[i][j]*l[i][j+1]
for i in range(m):
for j in range(n-1):... | Python | ad641a44ecaf78ca253b199f3d40ef96 | 6884af99298f70c555e1a137eff3042c | 1,200 | PASSED |
n,m=map(int, raw_input().split())
l=[]
# check=0
for i in range(n):
lst=list(map(int, raw_input().split()))
# if lst!=[0]*m: check=1
l.append(lst)
# if check==0: print 0
# else:
count=[]
for i in range(n-1):
for j in range(m-1):
if l[i][j]==1 and l[i+1][j]==1 and l[i][j+1]==1 and l[i+1][j+1]==1... | Python | ad641a44ecaf78ca253b199f3d40ef96 | 84b65c59ca029b0e2a9a4b0d10ff9f53 | 1,200 | PASSED |
#include <stdio.h>
#include <stdio.h>
#define N 300005
int main(int argc, char *argv[])
{
char ch[N];
int n,i,a[N]={0},pref[N]={0},sum=0,l,r;
scanf("%s",ch);
scanf("%d",&n);
for(i=0;i<strlen(ch)-1;i++)
if(ch[i]==ch[i+1]){
a[i]++;
}
for(i=1;i<=strlen(ch);i++){
sum+=a[i-1];
pref[i]=sum;
// p... | C | b30e09449309b999473e4be6643d68cd | 410d1e49bafbf6064f43d98dbbc8556d | 1,100 | PASSED |
#include<stdio.h>
#include<string.h>
int main()
{
char x[100001];
gets(x);
int t,n=strlen(x),a,b,i,y[100001]={},sum=0;
for(i=0;i<n-1;i++)
{ y[i+1]=sum;
if(x[i]==x[i+1]) {y[i+1]++; sum=y[i+1]; }}
scanf("%d",&t);
while(t--)
{
int c=0;
scanf("%d %d",&a... | C | b30e09449309b999473e4be6643d68cd | 842e377179638cef84e32586d9068171 | 1,100 | PASSED |
#include<stdio.h>
#include<string.h>
int main(){
int n,m,i,c=0,ans=0,j,k;
char str[100000];
gets(str);
scanf("%d", &m);
int x[m];
for(i=0;str[i];i++){
if(str[i]==str[i+1]){
c++;
x[i]=c;
}
else x[i]=c;
}
/*for(i=0;i<strlen(str);i++) printf(... | C | b30e09449309b999473e4be6643d68cd | 770ec2471d5f9f6e339e4fdb8158be08 | 1,100 | PASSED |
#include<stdio.h>
#include<string.h>
int main()
{ char ch[100010];
long long int l, r, i, j, N[100011], q, ans, ct=0;
scanf("%s", ch);
long long int x=strlen(ch);
scanf("%lld", &q);
N[0]=0;
for(i=1; i<x; i++)
{ if(ch[i]==ch[i-1])
... | C | b30e09449309b999473e4be6643d68cd | e611684594e4514bb06880a18f2775b3 | 1,100 | PASSED |
#include<stdio.h>
#include<string.h>
int dp[200000];
int main()
{
char arr[200001];
int m;
int arr1[100001];
int arr2[100001];
scanf("%s",arr);
scanf("%d",&m);
for(int i=0;i<m;i++)
{
scanf("%d %d",&arr1[i],&arr2[i]);
}
int k=strlen(arr);
// printf("%d",k);
for(int i=0;i<k-1;i++)
{
if(i==0)
{
if... | C | b30e09449309b999473e4be6643d68cd | b636e885bbbe6fa406b195f3cf59b98e | 1,100 | PASSED |
#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
char str[100001];
int str2[100001]={0};
scanf("%s",str);
int len=strlen(str),l,r;
for(int i=0;i<strlen(str)-1;i++)
{
if(str[i]==str[i+1])
{
str2[i+1]++;
}
}
for(int i=1;i<len;i++)
{
... | C | b30e09449309b999473e4be6643d68cd | 8036c0aa57f7f82117d14b9722db2ece | 1,100 | PASSED |
#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
char str[100001];
int str2[100001]={0};
scanf("%s",str);
int l,r;
for(int i=0;i<100001;i++)
{
if(str[i+1]=='\0')
{
break;
}
if(str[i]==str[i+1])
{
str2[i+1]++;
... | C | b30e09449309b999473e4be6643d68cd | 50b616225a69becf9603c0cba3d096f5 | 1,100 | PASSED |
#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
char str[100001];
int str2[100001]={0};
scanf("%s",str);
int len=strlen(str),l,r;
for(int i=0;i<strlen(str)-1;i++)
{
if(str[i]==str[i+1])
{
str2[i+1]++;
}
}
for(int i=1;i<len;i++)
{
... | C | b30e09449309b999473e4be6643d68cd | 70598dc37ac729e291aeb415cd4efaf1 | 1,100 | PASSED |
#include<string.h>
#include<stdio.h>
int main(){
int a[100002]={0},n,m,l,r,i,c=0;
char s[100002];
gets(s);
scanf("%d",&m);
n=strlen(s);
for(i=0;i<n-1;i++){
if(s[i]==s[i+1]) c++;
a[i+1]=c;
}
for(i=0;i<m;i++){
scanf("%d ... | C | b30e09449309b999473e4be6643d68cd | 483cd3292c75ef05dc4cb4280342925c | 1,100 | PASSED |
#include<string.h>
#include<stdio.h>
int main(){
int a[100002]={0},n,m,l,r,i,c=0;
char s[100002];
gets(s);
scanf("%d",&m);
n=strlen(s);
for(i=0;i<n-1;i++){
if(s[i]==s[i+1]) c++;
a[i+1]=c;
}
for(i=0;i<m;i++){
scanf("%d%... | C | b30e09449309b999473e4be6643d68cd | 2351e65d0d30e97d50096c36ffeb09cc | 1,100 | PASSED |
#include <cmath>
#include <ctime>
#include <iostream>
#include <string>
#include <vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<cctype>
#include <iomanip>
#include <string>
#include <sstream>
#include <functional>
... | C++ | b263917e47e1c84340bcb1c77999fd7e | afcb584294ad217e502eb261ac4e677c | 1,600 | PASSED |
#include <cmath>
#include <ctime>
#include <iostream>
#include <string>
#include <vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<cctype>
#include <iomanip>
#include <string>
#include <sstream>
#include <functional>
... | C++ | b263917e47e1c84340bcb1c77999fd7e | 778c870b1d1b9cf21a3d16b2cab03043 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXN 1000010
int dp[MAXN][30];
char memo[MAXN][30];
int n;
int s[MAXN];
int solve(int pos, int mod){
if(pos == n) return mod == 0 ? 0 : -1e9;
if(memo[pos][mod]) return dp[pos][mod];
memo[pos][mod] = 1;
int ans = 0;
ans = max(solv... | C++ | b263917e47e1c84340bcb1c77999fd7e | 740be52692dc1b6147e3340f93ed5c14 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXN 1000010
int dp[MAXN][30];
char memo[MAXN][30];
int n;
int s[MAXN];
int solve(int pos, int mod){
if(pos == n) return mod == 0 ? 0 : -1e9;
if(memo[pos][mod]) return dp[pos][mod];
memo[pos][mod] = 1;
int ans = 0;
ans = max(solv... | C++ | b263917e47e1c84340bcb1c77999fd7e | 859ad3dc2b27ea2966913d66c9643ef6 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXN 1000010
int dp[MAXN][30];
char memo[MAXN][30];
int n;
int s[MAXN];
int solve(int pos, int mod){
if(pos == n || s[pos] == 0) return mod == 0 ? 0 : -1e9;
if(memo[pos][mod]) return dp[pos][mod];
memo[pos][mod] = 1;
int ans = 0;
... | C++ | b263917e47e1c84340bcb1c77999fd7e | f705196b4ac61c05107ae211aa5b3c5b | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int a[(int) 1e5 + 5];
int res[(int) 1e5 + 5];
int main() {
//ios::sync_with_stdio(0);
int n, sm = 0;
scanf("%d", &n);
map<int, int> mp;
for (int i = 0; i < n; ++i) {
scanf("%d", a + i);
sm += a[i];
mp[a[i]]++;
}
sort(a, a + n);
if (a[0]... | C++ | b263917e47e1c84340bcb1c77999fd7e | 6dbef82a4c831d3b0c70f1832bad704d | 1,600 | PASSED |
#include<iostream>
using namespace std;
int n, d[10], a, u, i;
int main() {
while (cin >> n) {
while (n--)
cin >> a, ++d[a], u += a;
if (u % 3)
for (i = 1; i < 10; ++i)
if (i % 3 == u % 3 && d[i])
--d[i], u -= i, i = 10;
bool t = 0;
for (i = 1; u % 3 && i < 10; ++i)
if ((i + i) % 3 && d[i] ... | C++ | b263917e47e1c84340bcb1c77999fd7e | 1b81a6c1e4abdfe8f4a5c136a66777f2 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0;i<n;i++)
#define for1(i, n) for(int i = 1;i<=n;i++)
const int N = 1e5 + 10;
int a[N];
int n, sum = 0;
vector<int> ans;
void input(){
cin >> n;
for1(i, n) scanf("%d",&a[i]);
sort(a + 1, a + n + 1);
reverse(a + 1, a + n + 1);
... | C++ | b263917e47e1c84340bcb1c77999fd7e | 1ae29f46a779c0d34a5ad6dea36b7c84 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef map <int, int> mii;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
int const maxn = int(1e5 + 12);
int const maxb = int(2e6 + 12);
int const inf = int(1e9 + 7);
ll const linf = ll(1e18 + 12);
double... | C++ | b263917e47e1c84340bcb1c77999fd7e | 22264b711fca4c3864ed2c62489a7592 | 1,600 | PASSED |
#include <iostream>
#include<bits/stdc++.h>
#define pb push_back
#define print cout<<
#define FRD freopen("in.txt", "r", stdin)
#define FWR freopen("out.txt", "w", stdout)
#define is_bit_on(n,k)((n>>k)&1)
#define setbit0(n,k)((n)&(!(1<<k)))
#define setbit1(n,k) ((n)|((1<<k)))
#define flipbit(n,k) ((n)^((1<<k)))
#defi... | C++ | b263917e47e1c84340bcb1c77999fd7e | 6cf79056435150c26a0f57785c217dba | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if (a == 0) return b;
else return gcd(b % a, a);
}
int main(){
ll n,fpb,sum=1, now; cin >> n;
ll a[n];
for (int i=0; i<n;i++){
cin >> a[i];
}
fpb=a[0];
for (int i=0; i<n;i++){
fpb=gcd(fpb,a[i]);
... | C++ | 6379ec153377fb9c30a7b897659da7d6 | 8af41fc12aa8c79a0cf203ec95d513a4 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if (a == 0) return b;
else return gcd(b % a, a);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,fpb,sum=1, now; cin >> n;
ll a[n];
for (int i=0; i<n;i++){
cin >> a[i... | C++ | 6379ec153377fb9c30a7b897659da7d6 | 0c45b0bb6ae26f4e8d7503e6702a9f9e | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if (a == 0) return b;
else return gcd(b % a, a);
}
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,fpb,sum=1, now; cin >> n;
ll a[n];
for (int i=0; i<n;i++){
cin >>... | C++ | 6379ec153377fb9c30a7b897659da7d6 | f4c7b203e61d6a9f508bd4bd70ff1adf | 1,300 | PASSED |
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <queue>
using namespace std;
long long gcd(long long a,long long b)
{
return b?gcd(b,a%b):a;
}
int main()
{
int t,n,k;
while(~scanf("%d",&n))
{
long lo... | C++ | 6379ec153377fb9c30a7b897659da7d6 | a2607efdc25635a965ebc5c7e813e515 | 1,300 | PASSED |
#include<stdio.h>
using namespace std;
long long str[400005];
long long gcd(long long a,long long b)
{
return b==0?a:gcd(b,a%b);
}
long long get(long long x)
{
long long sum=0;
for(long long i=1; i*i<=x; i++)
{
if(x%i==0)
{
sum++;
if(x/i!=i)
sum++;
... | C++ | 6379ec153377fb9c30a7b897659da7d6 | 32b082e1c716fcdd53027b81463a3c37 | 1,300 | PASSED |
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<stack>
#include<cstring>
#include<math.h>
using namespace std;
typedef long long ll;
const int inf=0x7f7f7f;
ll a[400005];
int main()
{
ll n;
scanf("%I64d",&n);
for(ll i=1;i<=n;i++)
{
scanf("%I64d",&a[i]);
}
... | C++ | 6379ec153377fb9c30a7b897659da7d6 | fe0344c34e9204abbd28536d1f06bcab | 1,300 | PASSED |
#include<stdio.h>
#include<string.h>
typedef long long ll;
ll a[400005],vis[400005],prime[400005],tot=0;
ll gcd(ll a,ll b)
{
return b==0? a:gcd(b,a%b);
}
ll check(ll n)
{
int flag=0;
for(ll i=1;i*i<=n;i++)
{
if(n%i==0)
{
tot++;
}
if... | C++ | 6379ec153377fb9c30a7b897659da7d6 | 6d72709b987cd5aee5f15acc99e484c5 | 1,300 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N = 4e5+5;
typedef long long LL;
LL a[N];
LL gcd(LL a,LL b)
{
if(!b)return a;
gcd(b,a%b);
}
int main()
{
int n;
ios::sync_with_stdio(false);
cin >> n;
for(int i=0; i<n; i++)
... | C++ | 6379ec153377fb9c30a7b897659da7d6 | fab264588dfcb16b7c25ca2cade415c0 | 1,300 | PASSED |
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;
long long s1[400005];
typedef long long ll;
int n;
int main()
{
int t,n;
scanf("%d",&n);
scanf("%I64d",&s1[1]);
ll g=s1[1];
ll ans=0;
for(int i=2; i<=n; i++)
{
scanf("%I64d",&s1[i]);
... | C++ | 6379ec153377fb9c30a7b897659da7d6 | 8e379cacecf46f04adda70fc58935c97 | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
long long n;
long long gcd(long long a,long long b)
{
return !b?a:gcd(b,a%b);
}
void solve()
{
long long i,a[n],res,ans=0;
for (i=0;i<n;i++)
cin>>a[i];
res=a[0];
for (i=1;i<n;i++)
res=gcd(res,a[i]);
for (i=1;i*i<=res;i++)
if (r... | C++ | 6379ec153377fb9c30a7b897659da7d6 | 59335c1c2cb19edeea3d7c14fd96b1c4 | 1,300 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.