code_file1 stringlengths 80 4k | code_file2 stringlengths 91 4k | similar_or_different int64 0 1 |
|---|---|---|
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using std::cin;
using std::cout;
const int Maxn = 2e7 + 5, Mod = 998244353;
typedef long long ll;
typedef ll arr[Maxn];
ll Add(ll x, ll y) { return (x += y) >= Mod ? x - Mod : (x < 0 ? x + Mod : x); }
ll min(ll x, ll y) { return x < y ? x : y; }
ll max... | #include<bits/stdc++.h>
using namespace std;
// (POLICY BASED DS)
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using ordered_set=tree<T,null_type,less<T>,... | 0 |
#pragma region header
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#inc... | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
bool flg = true;
int c_cnt = 0;
for(int i=0; i<s.length(); i++){
if(i==0){
if(s.at(i)!= 'A'){
flg = false; break;
}
}else if(isupper(s.at(i))){
if(i==1... | 0 |
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
typedef long long int ll;
const ... | #define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(c) begin(c), end(c)
#define range(i,a,b) for(int i = a; i < (int)(b); i++)
#define rep(i,b) range(i,0,b)
#define eb emplace_back
typedef long long ll;
#define int ll
auto const inf = numeric_limits<int>::... | 1 |
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef long long ll;
char mp[50][101];
int m, n;
void fill_mp(int num, int x, char ch)
{
for (int i = x; ; i += 2)
{
for (int ... | #include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
int main(){
int n;
cin >> n;
string s;
cin >> s;
vi v1(n);
rep(i,n){
if (i == 0){
v1.at(i) = 0;
... | 0 |
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct TEMP_OMAZINAI_ { TEMP_OMAZINAI_() { std::ios::sync_... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
typedef tuple<ll, ll, ll> Point;
vector<Point> Points[2];
typedef tuple<ll, ll, ll> Edge;
vector<Edge> Edges;
vector<ll> Parent, Rank;
ll R;
void init() {
Parent.resize(N, -1);
Rank.resize(N, 0);
}
ll root(ll v) {
if (Parent[v] == -1) re... | 1 |
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;
int main()
{... | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define inf 0x3f3f3f3f
#define MAX(x,y) x=max(x,y)
using namespace std;
const int N=18;
const int M=32775;
int n,m,bin[N],num[M],ma[N][M],sum[M],f[N][M],g[M];
int read()
{
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch... | 0 |
#include <bits/stdc++.h>
#define MAX 100005
#define bit(x) (1ll << x)
using namespace std;
int n;
int cnt[64];
long long a[MAX], ans;
inline long long Rd() {
long long x = 0; char ch = getchar();
while(!isdigit(ch)) ch = getchar();
while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return x;
}
struct lin... | #include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; } re... | 0 |
/*
This Submission is to determine how many 120/240 min const. delivery point there are.
//info
120 req. steps <= 5
*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iter... | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int n;
while(cin>>n){
if(n==0)
break;
int da[22][22]={};
int x,y;
for(int i=0;i<n;i++){
cin>>x>>y;
da[y][x]=1;
}
int m;
cin>>m;
char v;
int l;
int nx=10,ny=10;
for(int i=0;i<m;i++){
cin>>v;
... | 0 |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000500;
const int mod = 1e9 + 7;
int a[maxn], pref[maxn], cntzer[maxn];
long long dp[maxn];
vector < int > v[maxn];
long long add(long long a, long long b){
a += b;
if(a >= mod) a -= mod;
return a;
}
long long mul(long long a, long long b){
... | #include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x... | 1 |
#include <bits/stdc++.h>
#define ll long long
#define str string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define vc vector<char>
#define vvc vector<vc>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvvll vector<vvll... | /*Hatsune Miku 4ever!*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _for(i,a,b) for(int i = (a);i < b;i ++)
#define _rep(i,a,b) for(int i = (a);i > b;i --)
#define INF 0x3f3f3f3f
#define mod 1000000007
#define lowbit(x) ((x)&(-x))
#define pb push_back
#define MIKU 39
#define Design ios::... | 1 |
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <set>
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() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをs... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
int main() {
int N, count = 0;
cin >> N;
vector<int> v(N);
for(int i=0; i<N; i++) {
cin >> v[i];
}
sort(v.begin(), v.end());
for(int i=0; i<N; i++) {
if(v[i] == v[i+1] && i... | 1 |
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>
using ll = long long int;
using namespace std;
int main(){
ll N, tmp;
vector<ll> A;
cin >> ... | //ヘッダー
#include<bits/stdc++.h>
using namespace std;
//型定義
typedef long long ll;
//定数
const ll INF=1e+17;
const int MOD=1e+9+7;
//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)
//v... | 1 |
#include<stdio.h>
#include<string.h>
#define N 8
int mp[N][N],row[N],col[N],dneg[2*N-1],dops[2*N-1];
void init()
{
for(int i=0; i<N; i++)
row[i]=col[i]=0;
for(int i=0; i<2*N-1; i++)
dneg[i]=dops[i]=0;
for(int i=0; i<N; i++)
for(int j=0; j<N; j++)
mp[i][j]=0;
}
void che... | // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprec... | 0 |
#include<algorithm>
using namespace std;
#define MAXN 100000
int AC[MAXN] = {};
int WA[MAXN] = {};
int main()
{
int ACCount = 0;
int WACount = 0;
int n,m;
scanf("%d %d",&n,&m);
for(int i = 0; i < m; i++)
{
int curNum;
char first, second;
scanf("%d %c%c", &curNum, &firs... | #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>;
vector<int> x(10), y(10);
double dist (int i, int j) {
double dx = x.at(i) - x.at(j);
double dy = y.at(i) - y.at(j);
return pow(dx*dx + dy*dy, 0.5);
}
int main() {
... | 0 |
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define pi 3.141592653589793238462643383279
#define int long long
#define ff first
#define ss second
#define endl '\n'
#define inf 21474836478965499999
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define hig... | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int t;
cin>>t;
long long int ans = 0, max = t;
for(int i = 1; i < n; i++) {
cin>>t;
if(t < max) {
ans += max-t;
}
else if(t > max) {
max = t;
}
}
cou... | 1 |
#include <iostream>
using namespace std;
#include <stdio.h>
#include <algorithm>
#include <string>
/********
* ?????¢??¢?´¢ Linear Search
*********/
/*
int linearSearch(int strS int strT, int n )
{
int key;
for(int i =0 ; i < n; i++){
if(strS[i] == key){
return i;
}
}
return NOT_FOUND;
}
*/
int main... | #include <iostream>
#include <set>
#include <algorithm>
using namespace std;
#define V(a) a.begin(), a.end()
typedef set<int> s;
int main()
{
s a[2], C;
for (auto &i : a) {
int n, x;
cin >> n;
while (n--) {
cin >> x;
i.insert(x);
}
}
set_intersection(V(a[0]), V(a[1]), inserter(C, C.end()));
cout... | 1 |
#include<bits/stdc++.h>
int main(){
int h, m, k;
scanf("%d %d", &h, &m);
int s = h*60 + m;
scanf("%d %d", &h, &m);
int g = h*60 + m;
scanf("%d", &k);
printf("%d\n", std::max(0, g-s-k));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(){
int h1, h2, m1, m2 , k; cin >> h1 >> m1 >> h2 >> m2 >> k;
m1 += 60 * h1; m2 += h2 * 60;
cout << m2 - m1 - k << '\n';
return 0;
} | 1 |
#include<stdio.h>
int main()
{
int N,R;
int Z;
scanf("%d %d",&N,&R);
Z=100*(10-N);
if(N>=10){
printf("%d",R);
}
else if(N<10){
printf("%d",R+Z);
}
return 0;
} | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 2e3 + 20;
const int maxm = maxn * maxn + 20;
const int mod = 1e9 + 7;
int dp[maxn][maxn] , fac[maxm] , caf[maxm];
inline void mkay(int &a)
{
if(a >= mod)
a -= mod;
else if(a < 0)
a += mod;
}
int bpw(int ... | 0 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin>>n;
for(int i=111; i<=999; i+=111) if(n<=i){cout<<i; break;}
} | #include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
#ifdef ONLINE_JUDGE
#define D(...)
#else
#define D(...)cerr<<__LINE__<<":"<<"["<<#__VA_ARGS__<<"]->",P(__VA_ARGS__)
#endif
void P(){cerr<<endl;}
template<typename H,typename...T>void P(H h,T...t){cerr<<h<<" ";P(t...);}
in... | 1 |
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
vector<vector<int>> g(100010);
vector<int> check(100010, -1);
bool dfs(int key){
bool flag=false;
for(int i=0; i<g[key].size(); ++i){
if(check[g[key][i]]<0){
check[g[key][i]]=1-check[key];
flag |= dfs(... | #include<bits/stdc++.h>
#define MP make_pair
#define FR first
#define SE second
using namespace std;
const int S=(1<<20)+5;
char buf[S],*H,*T;
inline char Get()
{
if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
if(H==T) return -1;return *H++;
}
inline int read()
{
int x=0;char c=Get();
while(!isdigit(c)) c=Ge... | 1 |
#include <iostream>
#include <algorithm>
#include <utility>
#include <fstream>
#include <iomanip>
#include <complex>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#define IO ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define endl '\n'
//const int MOD = 1e9+7;
bool ok(int a, int b, int c, int d, vector<char> s){
int ans=0;
if(s[1]=='+')
ans = a+b;
else
ans = a-b;
if(s[3]=='+')
ans = ans + ... | 0 |
//
// main.cpp
// testing
//
// Created by 伊藤大騎 on 2019/01/07.
// Copyright © 2019 HamamatsuJOHOKU. All rights reserved.
//
/*
科目選択 (Selecting Subjects)
JOI 君は物理,化学,生物,地学,歴史,地理の 6 科目のテストを受けた. それぞれのテストは 100 点満点で採点された.
JOI 君は物理,化学,生物,地学の 4 科目から 3 科目を選択し,歴史,地理の 2 科目から 1 科目を選択する.
テストの合計点が最も高くなるように科目を選ぶとき, JOI 君の選... | #include <iostream>
using namespace std;
typedef struct {
int top;
int S;
int E;
int W;
int N;
int bottom;
} dice;
void swap4(int *a, int *b, int *c, int *d) {
int tmp = *a;
*a = *b;
*b = *c;
*c = *d;
*d = tmp;
}
void roll(dice *dp, char dir) {
if (dir == 'E') {
s... | 0 |
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
typedef unsigned long long ull;
#define vvi std::vector<std::vector<int> >
#define vvs std::vector<std::vector<string... | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool ch... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll 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(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),... | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif
void init() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
int h[30];
void solve() {
string s; cin >> s;
for (int i = 0; i < (int)s.size(); ++i) {
++h[s[... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
int main()
{
int n = 0;
fscanf(stdin, "%d", &n);
vector<ll> rows(n + 5), cols(n + 5);
for (int i = 0; i < n; ++i) {
fscanf(stdin, "%lld %lld", &rows[i + 1], &cols[i + 1]);
}
vector<vector<ll> > dp(n + 5, vector<... | # include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) fo... | 0 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)
ll par[2][200010... | //============================================================================
// Name : hoba.cpp :)
// Author : (O_O Diab) (Why_not) (el 3AQ)
// Version :
// Copyright : please, Don't touch me :(
// Description : problem (I) in C++
// MAIN IDEA : max sum of S(X) + S(S(X)) => 100 so brute force
//==... | 1 |
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
... | #include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const int N = 205, X = 1e5+10;
int n, x;
int s[N];
int dp[2][X]; // dp[i][j] = # of ways to end with j, last mod i
void add(int& a, int b) {
a += b;
if (a >= MOD) a -= MOD;
}
i... | 0 |
#include <bits/stdc++.h>
using namespace std;
int N, M;
bool feeld[25][25];
void solve() {
int x = 10, y = 10;
for (int i = 0; i < M; i++) {
char c;
int d;
cin >> c >> d;
if (c == 'N') {
for (int j = 0; j < d; j++) {
feeld[++y][x] = 0;
}
}
if (c == 'E') {
for (int j = 0; j < d; j++) {
... | #include <bits/stdc++.h>
using namespace std;
#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end()), v.end()); }
TEMP_T T cums(T& v){ T r(v.size()); partial_s... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF... | #include <bits/stdc++.h>
using namespace::std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;
template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& op... | 0 |
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>... | #include<stdio.h>
#include<algorithm>
#define reg register
#define ri reg int
#define rep(i, x, y) for(ri i = x; i <= y; ++i)
#define nrep(i, x, y) for(ri i = x; i >= y; --i)
#define DEBUG 1
#define ll long long
#define max(i, j) (i) > (j) ? (i) : (j)
#define min(i, j) (i) < (j) ? (i) : (j)
struct IO {
#define MAXSIZE... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template... | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
cout << max((2*max(a,b))-1, a+b) << endl;
return 0;
} | 0 |
#include<iostream>
#include<algorithm>
using namespace std;
static const int INFTY = (1 << 21);
int main(){
int t[105][105];int c[105][105];
int n,m,a,b,cost,time,kk,p,q,r;
while(cin >> n >> m,n,m){
for(int i=1;i<105;i++){
for(int j=1;j<105;j++){
t[i][j] = c[i][j] = INFTY;
}
}
for(int i = 0;i < n;i+... | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string s, t, r;
int n, a, b;
cin >> s >> n;
while (n--) {
cin >> t >> a >> b;
if (t == "print")
cout << s.substr(a, b - a + 1) << endl;
else if (t == "reverse")
reverse(s.begin() + a, s.begin() + b + 1);
else ... | 0 |
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x... | #include<bits/stdc++.h>
using namespace std;
vector<int>adj[100003],leaf;
int par[100003],depth[100005],sparse[100005][20],root=0,lz=0;
int lca(int p,int q)
{
int a,b,c,d,lp,i,j;
if(depth[p]<depth[q])
{
c=p; p=q; q=c;
}
for(j=19;j>=0;j--)
{
if((depth[p]-(1 << j))>=depth[q])... | 1 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// 1個置くと3増えて全体でN*Q
// クオリティQは3の倍数になる必要がある(N != 0 mod 3)
using block = vector<string>;
// Quality 1
block b3 = {
"a..",
"a..",
".aa"
};
// Quality 3
block b4 = {
"aacd",
"bbcd",
"cdaa",
"cdbb"
};... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const ... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
string s;
int alp[27];
for (int i = 0; i < 26; i++) {
alp[i] = 0;
}
alp[26] = 1;
cin >> s;
if (s == "zyxwvutsrqponmlkjihgfedcba") {
puts("-1");
} else {
string ans = "";
for (int i = 0; i < (int)s.size(); ... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
string S, ans;
cin >> S;
if (S.size() == 26) {
ans = S;
if (!next_permutation(begin(ans), end(ans)))
ans = "-1";
else
for (int i = 0; i != 26; ++i) {
if (S[i] != ans[i]) {
ans.resize(i + 1);
... | 1 |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
int d;
double area;
int x;
//int y;
while(cin >> d)
{
x = 0;
//d = 0;
area = 0;
while(x <= 600 - d)
{
area += pow(x,2.0) * d;
x += d;
//cout << x << endl;
}
printf("%ld\n",(long int)area );
//cout <... | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int d, ans, n;
while(cin >> d){
ans = pow(d, 3);
n = 600 / d - 1;
ans *= n*(n+1)*(2*n+1) / 6;
cout << ans << endl;
}
return 0;
} | 1 |
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;... | // Created by conan1024hao in 2019.
// Copyright © 2019 conan1024hao. All rights reserved.
// 専用ライブラリです、自由にコピーして構いません。
// 感谢看我的代码!Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#... | 0 |
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
// order_of_key (val): r... | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
// 強連結成分分解
// 計算量: O(V + E)
// operator[]: 頂点kが属する強連結成分の番号を返す
class StronglyConnectedComponents {
int V;
vector<vector<int>> G, rG;
vector <int> comp; // 強連結成分の番号(トポロジカル順)
vector <int> order; // DFSで辿った順
vector <in... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RA... | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int h[10] = { 6,2,5,5,4,5,6,3,7,... | 0 |
#include <bits/stdc++.h>
using namespace std;
void input(int& rnTrgSu, int& rnTrgKin)
{
cin >> rnTrgSu >> rnTrgKin;
}
int dfs(int nPos, int nTrgSu, int nTrgKin, vector<int>& rvnMoneyCnt)
{
const vector<int> cnvnMoney{10000, 5000, 1000};
if (nTrgSu == 0 && nTrgKin == 0) return 1;
if (nTrgKin < 0) ... | #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 k,x;
cin >> k >> x;
int mn = x - k + 1;
int mx = x + k - 1;
vector<int> ans;
for(int i = mn; i < mx; i++) cout << i << " ";
cout << mx << endl;
}
// cout ... | 0 |
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)
typedef long long ll;
using namespace std;
int gcd(int a, int b) { //最大公約数
if (b==0) return a;
else return gcd(b, a%b);
}
int lcm(int a, int b) { //最小公倍数
return a * b / gcd(a, b);
}
int main()
{... | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif
void init() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
}
const int N = 2e5+23;
int a[N];
map<int, int> m;
void solve() {
int n; scanf("%d", &n)... | 0 |
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main() {
int N, M; cin >> N >> M;
vector<int> A(N), B(M); unordered_map<int, int> a, b; bool ok = true;
REP(i, 0, N) {
ci... | #include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
ll N,M;
cin >> N >> M;
int A[N],B[M];
int Acnt[1100000];
int Bcnt[1100000];
ll a = 0;
ll b = 0;
ll ans = 1;
for (int i = 0; i < 1100000; i++)... | 1 |
#include <bits/stdc++.h>
#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)
using namespace std;
typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("%lld", &x); return (x); }
int main()
{
int n;
scanf("%d\n", &n);
loop... | #include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.... | 0 |
#include <bits/stdc++.h>
using namespace std;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define... | #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long LL;
typedef double db;
int get(){
char ch;
while(ch=getchar(... | 0 |
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <string>
using namespace std;
int main()
{
string s;
cin>>s;
int d=INT_MAX;
for(int i=0;i<=s.size()-3;i++)
{
int k=i+2;
int k1=0;
for(int j=i;j<=k;j++)
{
k1=k1*10+(s[j]... | /*https://atcoder.jp/contests/abc114/tasks/abc114_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output to output.txt
freopen("output.txt", "w",... | 1 |
#include"bits/stdc++.h"
#define rep(i, N) for(int i = 0;i < N;i++)
typedef long long ll;
const int mod = 1e9 + 7;
using namespace std;
int main(void) {
int N, Q; cin >> N >> Q;
string S; cin >> S;
vector<int> l(Q), r(Q);
rep(i, Q) {
cin >> l[i] >> r[i];
l[i]--;
r[i]--;
}
rep(i, S.size()-1) {
if (S... | #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn = 1007, maxm = 2007;
const int inf = 1e9 + 7;
int cnt = 1;
int head[maxn], vis[maxn], dfn[maxn], vis2[maxn];
//head[x]:点x连接的最后一条边号
//vis[x]:标记每次dfs访问过的点,以免重复搜索耗时
//dfn[x]:x的时间戳
//vis[x]2:dfs中标记访问过的次数,找环
int b[maxn];
struct edge
{
int u, v... | 0 |
#include <iostream>
#include <vector>
using namespace std;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
int main() {
int N;
while(cin >> N && N) {
vector<int> v(N);
rep(i, N) cin >> v[i];
ll mx = -1<<29;
rep(i, N) {
ll sum = 0;
REP(... | #include <stdio.h>
int
main(void)
{
char line[80];
int a[5000];
int n;
while (fgets(line, sizeof line, stdin)) {
if (sscanf(line, "%d", &n) == 1) {
if (n == 0) {
break;
}
for (int i = 0; i < n; i++) {
if (fgets(line, sizeof line, stdin) == NULL) {
return 1;
}
if (sscanf(line, "... | 1 |
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
const int INF = 1e9 + 7;
const int N = 1e5+5;
int main() {
IO;
int sx, sy, tx, ty;
cin >> sx >> sy >> tx >> ty;
string ans, ur, ld, m... | #include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i)... | 0 |
// J'aime
// Chemise Blanche
#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()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl
void MAIN() {
string s, t;
cin >> s >> t;
co... | // https://atcoder.jp/contests/abc149/tasks/abc149_a
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#... | 1 |
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
double x1,x2,y1,y2,d;
cin >> x1 >> y1 >> x2 >> y2;
d = sqrt(pow(x1-x2, 2) + pow(y1-y2, 2));
printf("%lf\n", d);
return 0;
} | #include <iostream>
using namespace std;
int main ()
{
int p, q, r;
cin >> p >> q >> r;
cout << min(min(p + q, p + r), q + r);
}
| 0 |
#include <iostream>
using namespace std;
const int DEPTH = 17;
const int INTMAX = (1LL << 31) - 1;
struct RUQ {
int d[1 << (DEPTH + 1)];
int t[1 << (DEPTH + 1)];
RUQ() {
int i;
for (i = 0; i < (1 << (DEPTH + 1)); i++) {
d[i] = INTMAX;
t[i] = -1;
}
}
//[l, r)
void update(int l, int r, int x, int ... | #include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int N, Q;
int main() {
scanf("%d%d", &N, &Q);
vector<int> tp(Q), s(Q), t(Q), x(Q);
for (int i = 0; i < Q; i++) {
scanf("%d%d", &tp[i], &s[i]);
if (tp[i] == 0) scanf("%d%d", &t[i], &x[i])... | 1 |
//Badwaper gg
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define pb push_back
#define re register ll
#define fr first
#define sd second
#define FOR(i,a,b) for(re i=a;i<=b;i++)
#define REP(i,a,b) for(re i=a;i>=b;i--)
#define lowbit(x) (x&(-x))
#define Z(x) (x>=mod?x-mod:x)
#define N 41... | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 45;
const int mod = 1e9 + 7;
using namespace std;
int n, x, y, z, now, lim, f[N][(1 << 17) + 5], ans;
template < typename T >
inline T read()
{
T x = 0, w = 1; char c = getchar();
while(c < '0' || c > '9') { if(c == '-') w... | 1 |
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define fi first
#define si ... | #include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
string s;
cin >> n >> s;
vector<int> ans;
for(int i = 0; i < 4; i++){
ans.resize(n);
ans[0] = i%2;
ans[1] = i/2;
for(int j = 1; j < n-1; j++){
if(s[j] == 'o'){... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
ll a[n+2];
for(int i=0;i<n;i++)cin>>a[i];
ll cnt[n+2]={0};
cnt[0]=a[0];
for(int i=1;i<n;i++)cnt[i]=cnt[i-1]+a[i];
l... | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define r... | 0 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5;
const int MAXM = 100;
int N, M;
vector<int> V1, V2, A, B;
int main()
{
int i, j;
scanf("%d%d", &N, &M);
int cnt=0;
for(i=1; i<=M; i++)
{
int X;... | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
template <typename T> inline void getint(T &num){
register int ch, neg = 0;
while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
num = ch & 15;
while(isdigit(ch = getchar())) num... | 1 |
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main() {
int c[6] = {0},same[5] = {0};
while(scanf("%d,%d,%d,%d,%d\n",&c[0],&c[1],&c[2],&c[3],&c[4]) == 5) {
int same[5] = {0};
int straight = 0;
for(int i=0;i<5;i++) {
for(int j=0;j<5;j++) {
if(c[i] == c[j]) {... | #include <iostream>
#include <string>
using namespace std;
int main()
{
int n; char c; string s;
while(cin >> n)
{
int cd[13]={0},pr[5]={0};
cd[n-1]++;
for(int i=0; i<4; i++)
{
cin >> c >> n;
cd[n-1]++;
}
for(int i=0; i<13; i++)
{
pr[cd[i]]++;
}
bool st=false;
for(int i=0; i<10; i++)... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;
int main(){
int n;
cin >> n;
string s;
cin >> s;
vector<int> l(n+1),r(n+1);
for(int i... | #include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pi... | 0 |
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_... | #include "bits/stdc++.h"
using namespace std;
#define ASC(vec) vec.begin(), vec.end() // 昇順ソート 例:sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin... | 1 |
#include <iostream>
#include <vector>
#include <stack>
#include <bitset>
#include <utility>
#include <algorithm>
using namespace std;
const int kNil = -1;
const int kMaxV = 100010;
enum class Color {
kWhite,
kGrey,
kBlack,
};
template <class T>
struct Edge {
using w_type = T;
Edge(int u, int v, w_type w):... | #include "bits/stdc++.h"
#include "math.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) ... | 0 |
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string... | #include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <algorithm>
using namespace std;
int a;
char test[21];
char temp;
int main()
{
scanf("%s",test);
for(a=strlen(test)-1;a>=0;a--)
{
printf("%c",test[a]);
}
printf("\n");
return 0;
} | 0 |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<char,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;
int main(){
string N;
cin >> N;
ll n=N.size();
ll ans=0;
vector<ll> keta(n,0);
for(ll ... | #include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#... | 0 |
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
ll modpow(ll x,ll n){
ll res=1;
while(n>0){
if(n&1)res=res*x%MOD;
x=x*x%MOD;
n>>=1;
}
return res;
}
int main(){
int n,x;
cin>>n>>x;... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
int main(){
const... | 0 |
/*
Contest 096
B - Maximum Sum
Rakesh Kumar --> 23/09/2020
*/
#include <bits/stdc++.h>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0); std::cout.tie(0);
int a = 0, b = 0, c = 0;
std::cin >> a >> b >> c;
int k = 0;
std::cin >> k;
int v = std::max(std::max(a, b),... | /*Author- Soumak Poddar*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define sll signed long long int
#define ull unsigned long long int
#define um unordered_map
#define us unordered_set
#define mm multimap
#define mp make_pair
#define pb push_back
#define M 1000000007
bool comp(pair<int,i... | 0 |
#include<iostream>
#include<vector>
using namespace std;
void show(int arr[], int N){
for(int i=0; i<N; i++)
if(i<N-1)
cout<<arr[i]<<' '<<flush;
else
cout<<arr[i]<<flush;
cout<<endl;
}
void swap(int& a, int& b){
int t=a;
a=b;
b=t;
}
int ShellSort(int* arr, int N);
int InsertionSort_r(int* arr, int N... | #include <iostream>
#include <algorithm>
#include <vector>
typedef int TInt;
typedef std::vector<TInt> TList;
TList Input()
{
int Count;
std::cin >> Count;
TList List(Count);
for(int i = 0; i < Count; ++i){
std::cin >> List[i];
}
return List;
}
int insertionSort(TList& A, int g)
{
i... | 1 |
#include<iostream>
using namespace std;
int a;
int main() {
while (cin >> a) {
cout << (900 - a)*(900 - a) * 100 - 9000000 << endl;
}
} | #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int f(int n) {
return n * n;
}
int main(vo... | 1 |
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include<algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>
#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 =... | #include <iostream>
#include <string>
using namespace std;
int main(){
string str;
int i,j;
cin >> str;
string st="";
for( i=str.size()-1; i>=0 ; i-- )
st+=str[i] ;
cout << st << endl;
} | 1 |
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
ll n,y;
... | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pa... | 1 |
/// However long the night,
/// The dawn will break
/// ICPC next year
#include<bits/stdc++.h>
using namespace std ;
const int N = 1e6+5 ;
int n ,a[N] ,b[N] ;
vector<int> xorA ,xorB ;
int nn ,mm ,pat[N], str[N];
int F[N];
int getNextLen(int len, int c){
while(len && c != pat[len])
len = F[len-1];
if(c ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
struct Compress {
vector<T> xs;
Compress(const vector<T>& vs) : xs(vs) {
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
}
int compress(const T& x) {
return ... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
//ライブラリ始まり
//定数
//円周率
const double PI = 3.1415926535897932384;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnop... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;
int main(){
int N, A, B;
cin >> N >> A >> B;
int X[N];
for(int i=0; i<N; i++) cin >> X[i];
sort(X, X+N);
int now = X[0];
ll ans =... | 1 |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) pu... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1e9+7;
int main(){
ll a,b;
cin>>a>>b;
cout << a*b;
}
| 0 |
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#d... | #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int timer = 0;
struct needed {
needed(int verNum) {
for (int i = 0; i < verNum; i++) {
visited.push_back(false);
preNum.push_back(1 << 30);
lowest.push_back(1 << 30);
parent.push_back(-1);
}
}
vector<bo... | 1 |
/*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#inclu... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int N;
string S;
int Q;
int k[100];
ll D[1000010];
ll M[1000010];
ll C[1000010];
ll sum[1000010];
ll ans[100];
void input(){
cin >> N >> S >> Q;
for(int i = 0; i < Q; i++){
cin >> k[i];
}
}
void solve(){
for(int i = 0; i < N; i+... | 1 |
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const in... | #include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll ... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef long long ll;
ll gcd(ll x,ll y){
if(y==0) return x;
else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
return x/gcd(x,y)*y;
}
int main(){
int n;
cin>>n;
vector<int> a(n);
rep(i,n){
ci... | // g++ A.cpp -Wall -Wextra -Woverflow -Wshadow -O2
#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <cmath>
#include <iomanip>
#include <set>
#include <bitset>
using namespace std;
typedef long long LL;
typede... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define maxn 1000010
#define ll long long
#define db double
#define vi vector<int>
#define pb push_back
#define mod 998244353
ll ksm(ll a, ll b) {
if (!b) return 1;
ll ns = ksm(a, b >> 1);
ns = ns * ns % mod;
if (b & 1) ns = ns * a % mod;
return ns;
}
// head... | #include<bits/stdc++.h>
using namespace std;
int n,offset,j,pre,ans;
string s,t;
deque<int> q;
int main()
{
cin>>n>>s>>t;
q.push_back(n);j=n-1;
for (int i=n-1;i>=0;i--)
{
pre=j;
while(j>=0 && (j>i || s[j]!=t[i])) j--;
if (j<0)
{
printf("-1\n");
return 0;
}
if (pre==j)
{
while(!q.empty() && q... | 1 |
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void... | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)((n)-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se seco... | //q098.cpp
//Wed Sep 16 20:16:46 2020
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i... | 0 |
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define re... | #include <iostream>
using namespace std;
int main()
{
string test;
getline(cin,test);
if (test[0] == 'A' && test[1] == 'C')
{
cout << "Yes" << endl;
}
else if(test[1] == 'A' && test[2] == 'C')
{
cout << "Yes" << endl;
}
else if(test[2] == 'A' && test[3] == 'C')
{
cout << "Yes" << endl;... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
const int mx=200010;
const ll m... | #include<iostream>
using namespace std;
int main() {
int a, b; cin >> a >> b; a--; b--;
cout << "100 100" << endl;
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 100; j++) {
if (a > 0 && i % 2 == 0 && j % 2 == 1) { cout << '.'; a--; }
else cout << '#';
}
cout << endl;
}
for (int i = 0; i < 50; i... | 1 |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define al... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned ui;
typedef unsigned long long ul;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef pair<bool, bool> pbb;
typedef vector<int> vi;
#define pb push_back
#define fi first
#def... | 1 |
#include <iostream>
#include <math.h>
using namespace std;
class point{
public:
double x, y;
int set();
};
int point::set()
{
cin >> x >> y;
return 0;
}
int main()
{
point P1, P2;
P1.set();
P2.set();
cout << fixed << sqrt((P1.x - P2.x)*(P1.x - P2.x) + (P1.y - P2.y)*(P1.y - P2.y)) << endl;
return 0;
} | #include <iostream>
#include <cmath>
#include <cstdio>
int main()
{
using namespace std;
double x1, x2, y1, y2;
double dis;
cin >> x1 >> y1 >> x2 >> y2;
dis = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
printf("%.8lf\n", dis);
return 0;
} | 1 |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
... | #include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <str... | 1 |
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
using namespace std;
int main(){
long long N;
long long travel[5];
cin >> N;
for (int i = 0; i < 5; i++){
cin >> travel[i];
}
sort(travel, travel + 5);
... | #include<stdio.h>
#define INFTY 2000000000
long long count = 0;
void merge(int A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int L[n1+1], R[n2+1];
for (int i = 0; i < n1; i++) L[i] = A[left + i];
for (int i = 0; i < n2; i++) R[i] = A[mid + i];
L[n1] = INFTY;
R[n2] = IN... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define MOD 1000000007LL
#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define int ll
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()
#define ... | 1 |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define fore... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
int main(void){
int n;
string h = "Hoshino";
string s;
cin >> n;
getline(cin, s);
stringstream ss(s);
ss >> n;
rep(loop, n) {
getline(cin, s);
rep(i, s.size()){
if(i+h.si... | 1 |
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int n,m;
for(;cin>>n>>m;)
{
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int cnt[n];
int ans=0;
int anscnt=0;
memset(cnt,0,sizeof(cnt));
for(int i=0;i<m;i++)
{
int b;
cin>>b;
for(int j=0;j<n... | //
// main.cpp
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n,m;
int A[1001]={},B[1001]={};
vector<pair<int,int> > vec;
cin >> n >> m;
for(int i=0;i<n;i++){
cin >> A[i];
// vec.push_back(make_pair(A[i],i));
}
for(int i=0;i<m;i++){
cin >> B[i];
}
// sort(vec.begin(),ve... | 1 |
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp mak... | #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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
t... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define chmax(x, y) do { x = max(x, y); } while(0)
#define chmin(x, y) do { x = min(x, y); } while(0)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#def... |
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<clas... | 1 |
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;
const long INF = 1e9 + 1;
int main() {
string n;
cin >> n;
while(1) {
if(... | #include <string>
#include <iostream>
using namespace std;
string reverse_seq(string str)
{
string str_ = "";
for(string::size_type i = 0; i < str.size(); i++)
{
str_ = str[i] + str_;
}
return str_;
}
int main()
{
string str;
cin>>str;
cout << reverse_seq(str) << endl;
} | 0 |
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define rep(i,n) for(i = 0;i < n;++i)
template <typename T>
struct RUQ //calculateはminimum
{
int n;
const T ex = 1 << 30; //dat 初期値(minなので)
const T em = 1 << 30; //lazy 初期値(minなので)
vector<T> dat, lazy; //tree本体
RUQ(vector<T>... | #include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;
void chmax(int& a, int b) { a = max(a, b);}
void chmin(int& a,int b) {a = min(a,b);}
int main(){
int h,w... | 1 |
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#d... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Union{
vector<int> par;
vector<int> size;
Union(int n) : par(n), size(n,1){
for(int i=0; i < n; i++){
size[i] = 1;
par[i] = i;
}
}
int find(int x){
if (x == par[x]) return x;
return par[x] = find(par[x]);... | 0 |
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template <typename TYPE>
void print_vec(const vector<TYPE>& v){
for(int i=0; i<v.size(); i++){
cout << v[i] << " ";
}
cout << endl;
}
template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
cout << endl; cout << " ";
f... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
void doit(){... | 0 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
string s;
cout << 0 << endl;
cin >> s;
if(s == "Vacant"){
return 0;
... | #include<bits/stdc++.h>
using namespace std;
int N;
const double EPS = 1e-10;
struct state{
string name;
double k;
state(){}
state(int P,int A,int B,int C,int D, int E,int F,int S,int M){
int time = A + B + C + (D + E)*M;
int num = M * F;
int mon = num * S;
int s = mon - P;
k = (double)s/(... | 0 |
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<iomanip>
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
... | #include <iostream>
#include <map>
using namespace std;
#define MN 101
int n;
int ks[MN];
string raw;
map<char, int> kmap;
map<int, char> rkmap;
void init_() {
for (char i = 'a'; i <= 'z'; i++) {
kmap[i] = i - 'a';
rkmap[i - 'a'] = i;
}
for (char i = 'A'; i <= 'Z'; i++) {
kmap[i... | 0 |
#include "bits/stdc++.h"
#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}
using namespace std;
using ... | #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> num(n,0);
for(... | 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>
#include <cctype>
#in... | #include <bits/stdc++.h>
using namespace std;
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.en... | 1 |
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 100000001
#define dmp make_pair
#define dpb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b)... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int ans;
vector<int>v;
vector<int>pos;
int sol(int i,int j){
int smsm=0;
int tmp=k;
priority_queue<int>pq;
for(int s=0;s<=i&&tmp;s++){
smsm+=v[s];
pq.push(-v[s]);
tmp--;if(tmp==0)break;
}
if(j<=i){
int ssss=smsm;
int ttmp=tmp;
... | 0 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+10;
int n,m,a[N],ans,v,p;
LL sum[N];
bool ck(int x){
if(n-x+1<=p)return true;
if(x+p-1>=v){
int pos=a[n-p+1];
return (a[x]+m>=pos);
}
int lft=v-(x+p-1);
LL mid=0,num=0;
for(int i=x+1;i<=n-p+1;i++){
if(a[i]>a[x]+m)return fals... | #include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;
// 插入此處
LL a[100005];
int main() {
LL n, m, v, p;
cin >> n >> m >> v >> p;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n, [](LL x, LL y) { return x > y; });
// for ... | 1 |
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
using namespace std;
int main(){
int n,q;
while(1){
pair<int,int> data[101]={};
rep(i,0,101){
data[i].second=-i;
}
cin>>n>>q;
if(n==0 && q==0) break;
rep(i,0,n){
int m,d;
... | #include <bits/stdc++.h>
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;
}
#ifdef DEBUG
void debug() { cer... | 0 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define pb push_back
void solve(){
ll sx,sy,tx,ty;
cin>>sx>>sy>>tx>>ty;
ll dx=tx-sx;
ll dy=ty-sy;
string s1,s2;
for(int i=0;i<dy;i++){
s1+='U';
s2+='D';
}
for(int i=0;i<dx;i++)
{
s1+='R';
s2+='L';
}
string f1= "LU"+s1+"RD";
str... | #include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>
#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
const int INF = 1e9;
using namespace std;
class dice{... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.