code1 stringlengths 54 12k | code2 stringlengths 65 12k | similar int64 0 1 | __index_level_0__ int64 45 101M |
|---|---|---|---|
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MAX=105;
const LL INF=1LL<<31;
LL G[MAX][MAX],A[MAX][MAX];
int V,E;
void init(int type){
for(int i=0;i<MAX;i++){
for(int j=0;j<MAX;j++){
if(type){
if(i!=j)G[i][j]=INF;
else G[i][j... | #include <vector>
#include <algorithm>
using namespace std;
using Int = long long;
struct edge{
int to;
Int cost;
};
vector<Int> Potential(const vector<vector<edge>>& G){
vector<Int> dist(G.size(),0);
for(int i = 1;i < G.size();i++){
for(int v = 0;v < G.size();v++){
for(auto & e : G[... | 1 | 77,913,682 |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int mx = 10e8;
template <class T>
inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
int H, N;
cin >> H >> N;
... | #include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
int main(){
int H, N; cin >> H >> N;
pii AB[N];
re... | 1 | 32,560,802 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int need_right = 0, need_left = 0;
rep(i, s.size()) {
if (s[i] == '(')
need_right++;
else {
if (!need... | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
int N; cin >> N;
string S; cin >> S;
int a = 0;
int b = 0;
int sa = 1001001001;
rep(i, N){
if(S[i] == '('){
a++;
}... | 1 | 91,452,374 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
using ll = long long;
const int Inf = 100100100;
const double EPS = 1e-9;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n... | 1 | 31,736,434 |
#include<iostream>
#include<map>
#include<string>
using namespace std;
int main(){
int n;
string d;
char ch[12];
map<string,bool> T;
cin >> n;
for(int i=0; i<n; i++){
cin >> d >> ch;
if(d=="insert"){
T[string(ch)] = true;
}else if(d=="find"){
if(T[... | #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int main(){
int n;
scanf("%d",&n);
set<string> s;
for(int i=0;i<n;i++){
char l[6],r[12];
scanf("%s %s",&l,&r);
string k=r,h=l;
if(h=="insert"){... | 1 | 11,015,925 |
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;
int main(){
int a, b, c, d;
cin >> a >> b >> c >> d;
int minv = min(b, d);
int maxv = max(a, c);
if(minv >= maxv){
printf("%d\n", minv - maxv);
}
else{
printf("0\n");
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rev(x) greater<x>()
#define MOD 1000000007
#define INF 1000000000
typedef long long LL;
typedef long double LD;
bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
if (a.second != b.second) {
return a.second < b.s... | 1 | 6,395,121 |
#include <iostream>
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)
void solve(ll N, ll K) {
cout << (N%K != 0) << endl;
}
int main() {
ll N;
cin >> N;
ll K;
cin >> K;
solve(N, K);
retu... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if(N%K == 0) cout << 0 << endl;
else cout << 1 << endl;
} | 1 | 83,706,284 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
int main(){
ll n, l;
cin >> n >> l;
vector<ll> a(n), b(n-1);
rep(i, 0, n) cin >> a[i];
rep(i, 0, n-1) b[i] = a[i] + a[i+1];
auto mx = max_element(b.be... | #pragma region Macros
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;
template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, co... | 1 | 62,774,171 |
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
long long inf=1000000007;
int main(){
long long n,k;
string s;
cin>>n>>k>>s;
vector<pair<long long,long long>> line;
int now;
int cnt=0;
for(int i=0;i<n;i++){
int hoge=s.at(i)-'0';
if(i==0){
now=hoge;
cnt++;
continue;
}
if(now!=hoge... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;
int main() {... | 1 | 66,972,661 |
#include<bits/stdc++.h>
using namespace std;
int main(void){
int N, cnt = 0, ans = 0;
cin >> N;
for(int i = 1; i <= N; i++){
if(i % 2 == 1){
for(int j = 1; j <= i; j++){
if(i % j == 0)
cnt++;
}
if(cnt == 8)
ans++;
cnt = 0;
}
}
cout << ans << "\n";
return 0;
} | #include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#includ... | 1 | 32,215,817 |
#include<stdio.h>
int main(void)
{
int a1,a2,a3,a4,b1,b2,b3,b4,s,s1;
scanf("%d %d %d %d",&a1,&a2,&a3,&a4);
scanf("%d %d %d %d",&b1,&b2,&b3,&b4);
s=a1+a2+a3+a4;
s1=b1+b2+b3+b4;
if(s>=s1){
printf("%d\n",s);
}
else if(s<s1){
printf("%d\n",s1);
}
return 0;
} | #include<iostream>
using namespace std;
int main(){
int a,sum[2]={0};
for(int i=0;i<4;i++){
cin>>a;
sum[0]+=a;
}
for(int i=0;i<4;i++){
cin>>a;
sum[1]+=a;
}
cout<<(sum[0]<sum[1]?sum[1]:sum[0])<<endl;
return 0;
} | 1 | 76,835,626 |
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long s;
const long long u=1e9;
int main()
{
cin>>s;
if(s==1e18) cout<<"0 0 "<<u<<" 0 0 "<<u<<endl;
else
{
cout<<"0 0 ";
long long p=s/u,k=s%u;
k=u-k;
cout<<p+1<<" "<<u-(s%u)<<" ";
cout... | #include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
const int maxn=100010;
typedef long long ll;
int main()
{
ll s;
cin >> s;
ll a=0,b=0,c=0,d=0;
a=d=sqrt(s);
while(s>a*d)
{
if(a < d) a++;
else d++;
}
ll k=a*d-s;
for(int i=1;i<=sqrt(k);i++)
{
if(!(... | 1 | 80,082,810 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=10000+10;
int n;
ll a[N];
int main() {
while(cin >> n){
ll x;
ll n1=0,n2=0;
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<n;i++){
cin >> x;
if(x>a[i]){
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
int main(){
ll N;
cin >> N;
vector<ll> a(N), b(N);
rep(i, 0, N) cin >> a[i];
rep(i, 0, N) cin >> b[i];
ll ca = 0, cb = 0;
rep(i, 0, N){
if... | 1 | 47,165,754 |
#include<iostream>
#include<stack>
#include<string>
using namespace std ;
int main(){
string s ;
while( getline( cin , s ) ){
if( s[0] == '.' ) break ;
stack<int> st ;
int t = 0 ;
for( int i=0 ; i<s.size() ; i++ ){
if( s[i] == '(' ) st.push(1) ;
if( s[i] == '[' ) st.push(2) ;
if( s[i] == ')' ){
i... | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begi... | 1 | 16,564,379 |
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
struct UnionFind{
vector<int> par;
UnionFind(int N) : par(N) {
rep(i,N)par[i]=i;
}
int r... | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return... | 1 | 44,008,104 |
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,... | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,... | 1 | 38,629,172 |
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
int a,b,c;cin>>a>>b>>c;
int sum=a+b+c;
int count=0;
int tmp=max(a,b);
int ... | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < ... | 1 | 1,290,601 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, a;
cin >> n;
vector<int> A(n);
for (int i = 1; i <= n; ++i) {
cin >> a;
A[i-1] = a - i;
}
sort(A.begin(), A.end());
int b = A[n/2];
long long res = 0;
for (int i = 0; i < n; ++i) {
... | #include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#include <functional... | 1 | 15,460,294 |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x[4], y[4], xh, yh;
for (int i = 0; i < 2; ++i)
{
cin >> x[i] >> y[i];
}
xh = x[1] - x[0];
yh = y[1] - y[0];
y[2] = y[1] + xh;
x[2] = x[1] - yh;
y[3] = y[2] - yh;
x[3] = x[2] - xh;
cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << en... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz";
const string ALP="ABCDEFGHIJK... | 1 | 43,472,627 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);
struct fastio {
fastio() {
ios::sync_with_stdio(false);
cout << setprecision(10) << fixed;
cin.tie(0);
}
};
fastio _fast_io;
int a, b, c, ans;
i... | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_e... | 1 | 49,948,362 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
void solve() {
string s;
cin >> s;
if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])) {
cout << "Yes" << '\n';
}
else cout... | #include <iostream>
using namespace std;
int main()
{
int i,c;
string s;
cin>>s;
if((s[0]==s[1]&& s[1]==s[2])||(s[1]==s[2]&& s[2]==s[3]))
cout<<"Yes";
else
cout<<"No";
return 0;
} | 1 | 41,963,462 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#defin... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;i++)
const double eps = 1e-9;
struct V{
double x, y;
V(double x=0, double y=0): x(x), y(y) {}
V& operator+=(const V& v) {
x += v.x;
y += v.y;
return *this;
}
V operator+(const... | 1 | 51,546,506 |
#include<stdio.h>
int main()
{
int r;
scanf("%d",&r);
int a = r * r;
printf("%d",a);
} | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD 1000000007
const ll INF... | 1 | 40,547,561 |
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
in... | #include <bits/stdc++.h>
using namespace std;
vector<int> factor(100 + 1);
void prime_factor(int n) {
for (int i = 2; i * i <= n; i++)
while (n % i == 0) {
factor[i]++;
n /= i;
}
if (n != 1) factor[n] += 1;
}
int num(int n) {
int ret = 0;
for (auto x:factor) {
... | 1 | 76,209,657 |
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define repitr(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
usin... | #include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>
#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#defin... | 1 | 76,866,113 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(int i = s; i < (int)(n); i++)
int main() {
ll n,sum = 0,ans = 0;
cin >> n;
vector<int>a(n);
vector<int>b(n);
rep(i,0,n) cin >> a[i];
rep(i,0,n) cin >> b[i];
rep(i,0,n){
a[i] -= b[i];
sum += a[i];
}
if(su... | 1 | 13,542,888 |
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
int R, G, B, N;
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;
int main(){
int R,G,B,N; cin>>R>>G>>B>>N;
int64_t ans=0;
rep(r,0,N/R+1){
rep(g,0,(N-r*R)/G+1){
... | 1 | 49,948,075 |
#include <iostream>
using namespace std;
int main()
{
int value = 0;
int count = 0;
do
{
if (count > 0)
cout << "Case " << count << ": " << value << endl;
++count;
cin >> value;
} while(value != 0);
return 0;
} | #include <iostream>
using namespace std;
int main()
{
int i=1, j=1, x[100000];
x[0]=-1;
while(x[i-1] != 0)
{
cin >> x[i];
i=i+1;
}
while(x[j] != 0)
{
cout <<"Case " <<j <<": " <<x[j] <<endl;
j=j+1;
}
return 0;
} | 1 | 30,579,789 |
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void so... | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return fa... | 1 | 61,684,540 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int n,m;
vector<int> E[maxn],ans;
int vis[maxn];
int ind[maxn];
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n>>m;
... | #include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main(){
int V, E;
cin >> V >> E;
vector<pair<int, int> > edge(E);
for (int i = 0; i < E; i++) {
cin >> edge[i].first >> edge[i].second;
}
vector<int> ans;
vector<int> state(V, 1);
for (int k = 0; k < V... | 1 | 78,608,098 |
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>
#define PI 3.14159265358979
#define MOD 1000000007
using namespace std;
int main(void) {
string s, t;
int n,l,m,max;
bool flag = true;
vector <long... | #include<bits/stdc++.h>
using namespace std;
#define Fast_as_duck ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define rev(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long
typedef pair <int , in... | 1 | 24,028,897 |
#include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>
using namespace std;
const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);
ll dp[100010][3];
void show_table(ll I, ll J) {
... | #pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll lon... | 1 | 18,201,613 |
#include<bits/stdc++.h>
using namespace std;
#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef long double ld;
const ld pi=3.1415926535897932384626433;
const int... | using namespace std;
#include <iostream>
#include <string>
int main(){
string weather;
cin >> weather;
int max = 0;
int count = 0;
for (int i = 0; i < weather.length(); i++){
if (i == 0){
if (weather[i] == 'R'){
count = 1;
max = 1;
}
}
else {
if (weather[i] == 'R'... | 1 | 60,414,778 |
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;
ll mod(ll a, ll b){
ll ret=a%b;
if(ret<0) ret+=b;
return ret;
}
ll modpow(ll a,ll b,ll c){
ll res=1;
while(b>0){
if(b&1) res=mod(... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all... | 1 | 71,263,624 |
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <chrono>
using namespace std;
class cNode
{
public:
int key;
cNode *prev, *next;
cNode(){}
cNode(int ikey)
{
key = ikey... | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
using namespace std;
struct node{
node *pre, *next;
int key;
};
node *head;
node * find(int x){
node *ima=head->next;
while(ima->key!=x&&ima!=head) ima=ima->next;
return ima;
}
void mk_node(int key,node *next,node *prev){
node *n=(n... | 1 | 62,791,192 |
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>
#include <unordered_map>
using namespace std;
typedef long long ll;
ll ans, mx, mn, flag, sum, cnt;
ll k,l;
void mostFrequent(ll arr[],ll n){
unordered_map<ll, ll> hash;
for (int i = 0; i < n; i++)
... | #include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b)... | 1 | 44,438,670 |
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using P = pair<int, int>;
int main () {
while(1) {
int n, m;
cin >> n >> m;
if (n == 0) break;
vector<P> v;
for (int i = 0; i < n; ++i) {
int d, p;
cin >> d >> p;
... | #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;
template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
int n, m;
... | 1 | 93,998,776 |
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
int h,n; cin >> h >> n;
int sum=0;
REP(i,n... | #include <bits/stdc++.h>
#include<chrono>
#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)
using namespace std;
using namespace chrono;
const ll MOD = 1000000007;
const ll N = 300... | 1 | 63,122,725 |
#include<iostream>
using namespace std ;
int main()
{
int a,b ;
cin>>a>>b ;
if(a==1 && b==2 ||a==2 &&b==1)
{
cout<<"3"<<endl ;
}
else if(a==1 && b==3 ||a==3 &&b==1)
{
cout<<"2"<<endl ;
}
else if(a==3 && b==2 ||a==2 &&b==3)
{
cout<<"1"<<endl ;
}
re... | #include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long int
#define double long double
#define mod 1000000007
#define rp(i,a,b) for (int i = a; i <= b; i++)
#define hi ios_base :: sync_with_stdio(false); cin.tie(0);cout.tie(0);
int i,j,k;
main()
{
int a,b;cin>>a>>b;
int ar[4]={0... | 1 | 1,856,880 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int X,Y,A,B,C;cin >> X >> Y >> A >> B >> C;
vector<ll> P(A);
vector<ll> Q(B);
vector<ll> R(C);
for(int i=0;i<A;i++){
cin >> P[i];
}
for(int i=0;i<B;i++){
cin >> Q[i];
}
for(int i=0;i<C;i++){
cin >> R[i];
}
... | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;
const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
if(m == 0)return 0;
if(m == 1)return 1;
long long ans = 1;
long long tmp = m;
for(int i=0;i<=30;... | 1 | 8,456,819 |
#include <iostream>
#include <queue>
using namespace std;
#define MAXSIZE 1024
char square[MAXSIZE][MAXSIZE];
int H, W, N;
int flag[MAXSIZE][MAXSIZE];
int dir[4][2] = { 1, 0, -1, 0, 0, 1, 0, -1 };
struct Node
{
int x;
int y;
};
int BFS(int &x, int &y, int n) {
for (int i = 0; i < H; i ++)
{
for (int j = 0; j < W;... | #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>
using namespace std;
const int INF = 8101919;
const int MAX_H = 1000;
const int MAX_W = 1000;
const int MAX_N = 10;
struct pt {
int x;
int y;
};
int h;
int w;
int n;
pt cheese[MAX_N];
queue<pt> nextsearch;
pt ... | 1 | 47,476,579 |
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
double x1, y1, x2, y2;
cin >> setprecision(10) >> x1;
cin >> setprecision(10) >> y1;
cin >> setprecision(10) >> x2;
cin >> setprecision(10) >> y2;
cout << setprecision(10) << sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y... | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){
double x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
cout << fixed << setprecision(5) << hypot(x2 - x1, y2 - y1) << endl;
} | 1 | 63,763,768 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll n; cin >> n;
string s; cin >> s;
ll r = 0, g = 0, b = 0, ans = 0;
for(ll i = 0; i < n; ++i){
if(s[i] == 'R')r++;
else if(s[i] == 'G')g++;
else b++;
}
ans = r * g * b;
for(ll i = 0; i < n; ++i){
for(ll j = 1; j <= n; ++j){... | #include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f
#define pi 3.1415926535898... | 1 | 25,490,497 |
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int *a = new int[26]();
for(int i=0;i<s.length();i++)
{
if( a[s[i] -'a' ] != 0)
{
cout<<"no";
return 0;
}
a[s[i]-'a']++;
}
cout<<"yes";
} | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
bool flg = false;
for (int i = 0; i < s.size()-1;i++){
for (int j = i + 1; j < s.size();j++) {
if(s[i]==s[j]){
flg = true;
}
}
}
if(!flg){
cout << "yes" << endl;
}else{
cout << "no" << endl;
... | 1 | 78,292,791 |
#include <bits/stdc++.h>
using namespace std;
void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld"... | #include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
int main() {
int H, W;
cin >> H >> W;
vector<vector<char>> G(H, vector<... | 1 | 71,726,819 |
#include <iostream>
#include <string>
using namespace std;
int main(){
string a;
getline (cin , a);
for(int i=0 ; i<1200 ; i++){
if(a[i]=='\0') break;
if(a[i]>='a' && a[i]<='z'){
a[i]-=0x20;
} else if (a[i]>='A' && a[i]<='Z'){
a[i]+=0x20;
}
if (a[i]==' '){
cout << " ";
} else {
cout << a[i];
... | #include<cctype>
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
char n;
while(1){
scanf("%c",&n);
if(n == '\n') break;
if(isalpha(n)){
if(islower(n)) printf("%c",toupper(n));
else if(isupper(n)) printf("%c",tolower(n));
}else{
... | 1 | 17,298,060 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int ans = 9999;
for (int i = 0; i < s.length()-2; i++) {
int temp = 100*(s[i]-'0') + 10*(s[i+1]-'0') + (s[i+2]-'0');
temp = abs(753-temp);
ans = min(ans,temp);
}
cout << ans << endl;
} | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
string s;
cin >> s;
int res = 0;
res = pow(10,9);
for(int i = 0;i < s.size()... | 1 | 67,650,214 |
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x) cerr << #x << " = " << (x) << endl;
#de... | #include <bits/stdc++.h>
using namespace std;
int main() {
int r, g;
cin >>r >>g;
int ans = r + (g - r) * 2;
cout << ans;
} | 1 | 85,884,741 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 100000000;
int main() {
int A, B, K;
int ans;
cin >> A >> B >> K;
int cnt = 0;
for (int i = min(A, B); i >= 1; i--) {
if (A % i == 0 && B % i == 0) {
cnt++;
}
if (cnt == K) {
... | #include<bits/stdc++.h>
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define ff first
#define ss second
#defin... | 1 | 76,455,887 |
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;
map<int64_t,int> prime_factor(int64_t n) {
map<int64_t,int> ret;
for(int64_t i = 2; i * i <= n; i++) {
w... | #include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define eb emplace_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using name... | 1 | 79,371,166 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ll long long
int main(){
int k;
string s;
cin >> k >> s;
if(s.length() <= k){
cout << s << endl;
}else if(s.length() > k){
rep(i,k){
cout << s[i] ;
}
cout << "..... | #include<bits/stdc++.h>
using namespace std;
int main(){
int k;
string s;
cin >> k >> s;
int cnt=0;
for(int i=0;i<s.length();i++){
cnt++;
}
if(cnt<=k){
cout<<s<<endl;
}
else{
for(int i=0;i<k;i++){
cout<<s[i];
}
cout<<"..."<<endl;
}
return 0;
} | 1 | 98,541,793 |
#include <bits/stdc++.h>
#define rep(i,N) for (int i=0;i<N;i++)
using namespace std;
int main(void){
int a,b,c,dis;
cin >>a>>b>>c>>dis;
if (abs(a-c)<=dis){
cout<<"Yes"<<endl;
}
else if (abs(a-b)<=dis && abs(b-c)<=dis){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001;
const double PI = 3.14159265358979323846;
int main(void){
int a,b,c,d;
cin >> a >> b >> c >> d;
if(abs(c-a) <= d){
cout << ... | 1 | 74,296,006 |
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);
using namespace std;
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cout<<fixed<<setprec... | #include <bits/stdc++.h>
using namespace std;
void init () {
srand (time(0));
int XOR[20] = {0};
for (int n = 1; n <= 3; ++n) {
for (int k = 1; k < (1<<n); ++k) {
vector <int> a(1<<(n+1));
for (int i = 0; i < (1<<n); ++i) a[i] = i, a[i+(1<<n)] = i;
sort (a.begin(),a.end());
cout << "n = " << n << ", k ... | 1 | 33,930,125 |
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
char s[11];
cin >> s;
if(s[2]==s[3]&&s[4]==s[5]){
cout << "Yes\n";
}
else
cout <<"No";
return 0;
} | #include<bits/stdc++.h>
#define inf 1000000000
#define mod 1000000007
#define pb push_back
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define fi first
#define se second
using namespace std;
template <class T> void chmax(T &x,T y){x=x>y?x:y;return;}
template <class T> void chmin(T... | 1 | 80,258,648 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes c... | 1 | 53,660,058 |
#include <bits/stdc++.h>
using namespace std;
#define X ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
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 __pr... | #pragma region
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, a... | 1 | 3,485,624 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long int li;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265359
#define MOD 998244353
const int MAX = 510000;
int main() {
int N,K;
cin>>N>>K;
vector<ll>V(N);
rep(i... | #include <algorithm>
#include <iostream>
#include <set>
#include <vector>
int main()
{
int N, K;
std::cin >> N >> K;
std::vector<int> D(N);
for(int i=0; i<N; i++) {
std::cin >> D[i];
}
int ret = 0;
for(int k=0; k<=K; k++) {
for(int r=0; r<=k; r++) {
int tmp = 0;
std::multiset<int> neg;... | 1 | 49,844,170 |
#include <iostream>
#include <queue>
#include <cstdint>
using namespace std;
int main() {
int n, m; cin >> n >> m;
uint64_t sum = 0;
priority_queue<int> que;
for (int i = 0; i < n; ++i) {
int a; cin >> a;
sum += a;
que.push(a);
}
for (int i = 0; i < m; ++i) {
int ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,... | 1 | 47,585,180 |
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.14159265359
int main() {
int n,m;
string a[60],b[60];
bool flag = true;
cin >> n >> m;
for(int i=0;i<n;i++)cin >> a[i];
for(int i=0;i<m;i++)cin >> b[i];
for(int sy=0;sy<n;sy++){
if(sy+m-1>n)break;
... | 1 | 8,770,646 |
#include <iostream>
#include <cstdio>
#include <queue>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int dist[105];
queue<int> que;
vector<int> G[105];
int main(int argc, const char * argv[])
{
int n;
cin >> n;
for(int i = 0;i <= n;i++) {
dist[i]=-1;
}
for(int i = 0;i < n;i++)... | #include <bits/stdc++.h>
#define MAX 100
using namespace std;
int n;
vector<int> G[MAX];
int d[MAX];
int main()
{
cin >> n;
for (int i = 0; i < n; i++) {
d[i] = -1;
}
for (int i = 0, u, k; i < n; i++) {
cin >> u >> k;
for (int j = 0, v; j < k; j++) {
cin >> v;
G[u - 1].push_back(v - 1);
}
}
queue<in... | 1 | 66,550,312 |
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b) for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n) For(i, 0, n)
#define debug(x) cerr << #x << " = " << (x) << endl;
template<clas... | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;... | 1 | 94,449,277 |
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
ll stock=0;
ll yen=1000;
int i=0;
while(i<n)
{
while(i+1<n&&a[i]>=a[i+1])
{
i++;
}
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
int N, M;
void func()
{
cin>>N;
ll a[N];
rep(i, 0, N)cin>>a[i];
ll dp[N]={};
dp[0]=1000;
rep(i, 1, N) {
dp[i]=dp[... | 1 | 22,671,341 |
#include<cstdio>
using namespace std;
int s;
int func(int now,int sum,int num){
int count=0;
if(!num)return s==sum?1:0;
if(now==10 || !num || sum>s) return 0;
count+=func(now+1,sum+now,num-1);
count+=func(now+1,sum,num);
return count;
}
int main(void){
int n,i;
while(scanf("%d %d",&n,&s),n){
printf("%d\n",fun... | #include <iostream>
using namespace std;
int bit_count( const int n )
{
int cnt = 0;
for ( int i = 0; i < 10; i++ )
{
if ( n & 1 << i ) cnt++;
}
return cnt;
}
int main( void )
{
int n, s;
while ( cin >> n >> s )
{
if ( n == 0 && s == 0 ) break;
int answer = 0;
for ( int i = 0; i < 1 << 10; i++ )
{
... | 1 | 90,666,509 |
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
cout << max(0, c - (a - b)) << "\n";
return 0;
} | #include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout fr... | 1 | 70,961,172 |
#include <bits/stdc++.h>
using namespace std;
#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;
ll mod = 1e9 + 7ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } r... | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2;
cin>>n1>>n2;
int a[n1],b[n2];
for(int i = 0 ; i < n1 ; i++) cin>>a[i];
for(int i = 0 ; i < n2 ; i++) cin>>b[i];
long long int cnt[n1+1][n2+1];
memset(cnt,0,sizeof(cnt));
for(int i = 0 ; i < n1 ; i++){
for(int j = 0 ; j < n2 ; j... | 1 | 28,965,717 |
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;
... | #include <iostream>
using namespace std;
int main()
{
int a;
int b;
int c;
cin>>a>>b>>c;
if(a==b){
cout<<c;
}
if(a==c){
cout<<b;
}
if(b==c){
cout<<a;
}
} | 1 | 60,397,040 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int S, W;
cin >> S >> W;
cout << (W >= S ? "unsafe" : "safe") << endl;
} | #include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
int arr[101] = {0};
int main()
{
int a, b;
cin >> a >> b;
if(a>b)
{
cout << "safe";
}
else
{
cout << "unsafe";
}
} | 1 | 93,809,220 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD... | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) ... | 1 | 22,875,433 |
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
type... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
vector<ll> b(n);
rep(i, n){
a[i]+=i*n;
b[i]+=(n-i-1)*n;
ll r;
cin >> r;
b[r-1]+=i;
}
for(auto an:a)cout << an+1 << " ";
cout << endl;
for(auto ... | 1 | 2,984,099 |
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
te... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
struct edge{ll to,cost;};
const int inf = 1<<28;
const ll INF = 1LL<<53;
const int COMBMAX = 500005;
const ll MOD = 1e9+7;
#define _... | 1 | 10,147,631 |
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define ... | #include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
using namespace std;
int main(){
int W,H;
cin >> W >> H;
vector<int> p(W,0);
vector<int> q(H,0);
for(... | 1 | 25,522,713 |
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=998244353;
int GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LC... | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
int N;
cin >> N;
ll a[N];
for(int i = 0; i < N; i++) ... | 1 | 67,983,776 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int X, Y, A, B, C;
cin >> X >> Y >> A >> B >> C;
vector<pair<ll, ll>> apple;
ll tmp;
rep(i, A) {
cin >> tmp;
apple.push_back(make... | #include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;
#define vsort(a) sort(a.begin(),a.end(),greater<int>());
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(... | 1 | 17,584,086 |
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
ll mod= 1e9 + 7;
int main() {
int n;
cin >>n;
ll ans=100000000;
int a[n];
rep(i,n){
cin >> a[i];
}
for(int i=-100;i<=100;i++){
ll sum=0;
rep(r,n){
int g=a[r]-i;
sum+... | #include<iostream>
#include<math.h>
using namespace std;
#define ll long long
int main(){
int n;
cin>>n;
int arr[n];
double sum=0;
for(int i=0;i<n;i++)
{
cin>>arr[i];
sum+=arr[i];
}
ll floormid, ceilmid;
ceilmid=ceil(sum/n);
floormid= floor(sum/n);
ll ans1=0, ans2=0;
for(int i=0;i<n;i++)
{
ans1+= pow(arr[i]-... | 1 | 68,867,906 |
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<util... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
template <class T> inline bool chmin(T& a, T b) {
if (a... | 1 | 9,286,939 |
#include <iostream>
int main()
{
unsigned int x;
std::cin >> x;
if (x < 1200) std::cout << "ABC" << std::endl;
else std::cout << "ARC" << std::endl;
return 0;
} | #include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
using ll = long long;
class Stream{
public:
Stream(){
}
void read(){
}
t... | 1 | 24,493,485 |
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
long double L,ans;
cin >> L;
ans = pow(L/3.0,3.0);
cout << fixed << setprecision(8) << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main(){
double l;
cin >> l;
cout << fixed << setprecision(12) << l*l*l / 27.0 << endl;
return 0;
} | 1 | 44,492,448 |
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
ll n;
cin >> n;
ll ans=0;
for(ll i=1;i*i<=n;i++)
{
if(n%i==0)
{
ans = i;
}
}
cout << (ans-1)+(n/ans-1);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define INF 2e18
#define eps 1e-9
#define FastRead ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead freopen("input.txt","r",stdin)
#define fWrite freopen("output.txt","w",stdout)
#defi... | 1 | 9,071,754 |
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<long long, long long>;
template <class T>
using vec = vector<T>;
template <class T>
using gr... | #include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int is_black(vector<string> &S, int i, int j) {
if (S.at(i).at(j) == '#') {
return 1;
}
return 0;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int64_t H, W;
ci... | 1 | 100,168,014 |
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const string mcxi = "mcxi";
bool isNum(char c){return '0' <= c && c <= '9';}
int c2i(char c){return c - '0';}
void solve() {
string lhs, rhs;
cin>>lhs>>rhs;
int sum[4];
memset(sum, 0, sizeof sum);
in... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
int ctoi(char c) {
return c - '0';
}
int f(char c) {
int ret = 0;
if(c == 'm') ret = 1000;
if(c == 'c') ret = 100;
if(c == 'x') ret = 10;
... | 1 | 93,964,124 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)
template <class T, class ... | #include <stdio.h>
int main(){
int a,b;
char s[20];
bool pos = true;
scanf("%d %d",&a,&b);
scanf("%s",s);
if(s[a] != '-'){
pos = false;
}
for(int i = 0;s[i]!='\0';i++){
if(i != a){
if(s[i]< '0' || s[i]> '9'){
pos = false;
break;
}
}
}
(pos) ? printf("Yes\n") : printf("No\n");
return 0;
} | 1 | 86,339,373 |
#include <bits/stdc++.h>
using namespace std;
const string YES = "Yes";
const string NO = "No";
void solve(long long A, long long B, long long C)
{
cout << ((A + B >= C) ? YES : NO) << endl;
}
int main()
{
long long A;
scanf("%lld", &A);
long long B;
scanf("%lld", &B);
long long C;
scanf("%l... | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll a,b,c;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>a>>b>>c;
if(a+b>=c)
cout<<"Yes";
else
cout<<"No";
return 0;
} | 1 | 44,596,574 |
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;
int main() {
ll N, K;
cin >> N >> K;
vector<ll> H(N);
for (ll i = 0; i < N; i++) {
cin >> H[i];
}
vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, LLONG_MAX / 2));
dp[0][0] = 0;
for (ll i = 1; i <= N; i++) {
f... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>
const int MOD = 1e9 + 7;
const int ... | 1 | 9,321,802 |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <climits>
#include <utility>
#include <numeric>
typedef long long ll;
using namespace std;
int main(void){
const ll BIG = 1LL << 60;
int n, i;
... | #include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 100000000
const int maxn= 100010;
lli a[maxn];
lli pre[maxn];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n=0;lli leafnahi=1ll,res=0ll;
cin>>n;... | 1 | 95,202,807 |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
int X[N];
for (int i = 0; i < N; i++) cin >> X[i];
int ans = INT_MAX;
for (int i = 1; i <= 100; i++) {
int sum = 0;
for (int j = 0; j < N; j++) {
sum += pow(X[j] - i, 2);
}
ans... | #include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;i++)
int main()
{
int n;
cin >> n;
vector<int> x(n);
rep(i, n) cin >> x[i];
int su... | 1 | 10,335,644 |
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned i... | #include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
const char* col = "RYGB";
int main()
{
int h, w, d;
cin >> h >> w >> d;
vector<string> bd(h, string(w, '.'));
if (d % 2 == 1) {
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
... | 1 | 46,256,856 |
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
vector<pair<ll,ll>> V;
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cout<<fixed<<setprecision(20);
int W,H,x;
cin >> W >> H;
rep(i,W)cin >> ... | #include <bits/stdc++.h>
using namespace std;
#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))
using lint = long long;
using pii = pair< int, int >;
template< typename T > using Vec = vector< T >... | 1 | 90,043,963 |
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define... | #include <bits/stdc++.h>
using namespace std;
int main() {
int h,w,m;
cin>>h>>w>>m;
int height[h];
int width[w];
for(int i=0; i<h; i++) height[i]=0;
for(int i=0; i<w; i++) width[i]=0;
vector<pair<int, int>> bomb;
for(int i=0; i<m; i++) {
int a,b;
cin>>a>>b;
height[a-1]++;
width[b-1]++;
... | 1 | 19,381,202 |
#include<bits/stdc++.h>
using namespace std;
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sq(x) (x)*(x)
#define PI acos(-1.0)
#define nl '\n'
typedef long long int ll;
typedef unsigned long long int llu;
long long int gcd(long long int a,long long int b)
{
if(b==0)
... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define int long long int
#defin... | 1 | 46,388,677 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
bool comp(string a, string b){
if(b == "-") return true;
if(a == "-") return false;
if(a.size() > b.size()) return true;
if(a.size() < b.size()) return false;... | #include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define pii pair<int, int>
#define All(x) (x).begin(), (x).end()
#define mp make_pair
#define Task "abc"
typedef long long ll;
const int maxn = 1e4 + 10;
const ll mod = 1e9 + 7;
int n, m;
int c[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
int num[10], cost[1... | 1 | 26,703,196 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
vector<vector<vector<ll>>> Lun(12, vector<vector<ll>>(10, vector<ll>(0)));
int K;
cin >> K;
vector<ll> nums(0);
for (int i = 0; i < 10; i++)
{
Lun[0][i].push_back(i);
if (i != 0)
{
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;... | 1 | 47,436,250 |
#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
double n;
cin>>n;
cout<<fixed<<setprecision(12)<<(n*n*n)/27<<"\n";
} | #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
double l;
cin >> l;
l /= 3;
double ans = l*l*l;
printf("%.10f",ans);
return 0;
} | 1 | 77,481,557 |
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <queue>
#include <math.h>
#define SIZE 1002
#define REP(i, n) for (int i = 0; i < (n); i++)
#define X first
#define Y second
using namespace std;
typedef pair<double, double> V;
typedef long long ll;
int n;
bool less_theta(V& i, V& j... | #include <bits/stdc++.h>
using namespace std;
#ifdef NeverBeRed
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second
ll cross(point a, point b) { return imag(conj(a) * b); }
int qua(point x)
{
if (x.real() > 0 ... | 1 | 5,777,624 |
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typede... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#defin... | 1 | 99,491,553 |
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> ... | #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> bou(N);
for (int i = 0; i < N; i++) {
cin >> bou.at(i);
}
std::sort(bou.begin(), bou.end(), std::greater<int>() );
int M = 0;
for (int i=0;... | 1 | 672,945 |
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
string s,t;
cin>>s>>t;
int n=s.length();
int m=t.length();
string ans="UNRESTORABLE";
for(int i=0;i<=n-m;i++){
bool flag=true;
string u=s;
for(int j=0;j<m;j++){
if(s[i+j]!... | #include<iostream>
#include<string>
using namespace std;
int main(){
string s,t;
cin>>s>>t;
int ss=s.size();
int ts=t.size();
int crt=-1;
for(int i=0;i<ss;++i){
bool f=false;
for(int j=i;j<i+ts;++j){
if(j>ss-1){
f=false;
break;
... | 1 | 70,934,892 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> V... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pai... | 1 | 97,410,544 |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int64_t N, ans = 0;
cin >> N;
vector<int64_t> A(N);
for (int i = 0; i < N; i++)
{
cin >> A.at(i);
if (i && A.at(i - 1) == A.at(i))
{
A.at(i) = -1;
ans++;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(){
int N;
cin >> N;
vector<int> a(N+1,0);
rep(i, N){
cin >> a[i];
}
int s = 0;
int ans = 0;
rep(i, N){
if(a[i] == a[i+1]){
... | 1 | 15,194,537 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
int main(){
int n;
cin >> n;
VI a(n);
rep(i,n){
cin >> a.at(i);
}
if(n%2==0){
VI b(n/2);
VI c(n/2);
rep(i... | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
int S [512345];
int main() {
int N;
int left =212345 , right = left +1;
cin >> N;
vector<int> A(N);
rep(i, 0, N){
... | 1 | 65,077,019 |
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorith... | #include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vect... | 1 | 79,967,773 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.