code_file1 stringlengths 80 4k | code_file2 stringlengths 91 4k | similar_or_different int64 0 1 |
|---|---|---|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
//#define int long long
//signed main(){
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int h,w;
cin >> h >> w;
vector<bool> a(h*w,false);
queue<int> que;
for(int i = 0; i < h; i++) ... | #include <bits/stdc++.h>
#define P pair<int, int>
using namespace std;
const int INF=1e5;
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int main(){
int h,w,a[1009][1009];
string s[1009];
cin >> h >> w;
memset(a, -1, sizeof(a));
for(int i=0;i<h;i++)cin >> s[i];
queue<P> q;
for(int i=0;i<h;i++){
for(i... | 1 |
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#defin... | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <iostream>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <lim... | 1 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k;
int main(){
scanf("%lld",&k);
int n=50;
vector<ll> v(n,n-1);
for(int i=0;i<n;i++)v[i]+=k/n;
for(int i=0;i<n;i++)v[i]-=k%n;
for(int i=0;i<k%n;i++)v[i]+=n+1;
printf("%d\n",n);
for(int i=0;i<n;i++)printf("%lld ",v[i]);... |
#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
#de... | 0 |
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#define EPS 1e-10
using namespace std;
typedef long long llong;
void whatday(int m, ... | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#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(... | 1 |
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); })... | #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef pair<int,int> int_pair;
typedef pair<ll,ll> ll_pair;
#define N 1002
#define INF 1e9+1
int Levenshtein(string s1,string s2){//hensyu kyori
vector<vector<int> > dp;
int ss1=s1.size(),ss2=s2.siz... | #include <stdint.h>
#include <cstdlib>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <iostream>
#include <bitset>
#include <array>
#include <stdio.h>
using namespace std;
# define MAX 1000
uint64_t D0[MAX]={0}, HP[MAX]={0}, HN[MAX]={0}, VP[MAX]={0}, VN[MAX]={0};
uint64_t Cmap[MAX][20] ... | 1 |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <numeric>
#include <iomanip>
using namespace std;
#def... | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007
#define rev(v) reverse(v.begin(), v.end());
bool comp(int a, int b){
return (a<b);
}
int main(){
int n; cin >> n;
int a, b;
if(n... | 0 |
#include <bits/stdc++.h>
using namespace std;
// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// -----------... | #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... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int field[606][606][2];
int D[2];
int N;
vector<int> dx[2];
vector<int> dy[2];
void bfs(int x, int y, int index, int val) {
if(x < 0... | #include<bits/stdc++.h>
using namespace std;
int n,D_1,D_2,cnt;
bool chk(int i,int j,int d){
int u=__builtin_ctz(d);
if(u&1)return!(i>>(u/2)&1);
else return!((i^j)>>(u/2)&1);
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>D_1>>D_2;
for(int i=0;i<2*n;++i)
for(int j=0;j<2*n;++j)
if... | 1 |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include... | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
using namespace std;
#def... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef pair<double,string> pds;
bool hikaku(pds lhs,pds rhs){
if(lhs.first>rhs.first) return true;
else if(lhs.first==rhs.first)return lhs.second<rhs.second;
else return false;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
while(cin>>n,n){... | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
using namespace std;
struct Info{
char name[21];
double seed_price,before_leaf,after_leaf,num,sell_price,count,rate;
};
//???????????????????????????3,left?????????????????´??????1,right?????????????????¨??... | 1 |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 10;
typedef long long ll;
const ll mod = 998244353;
int tot, K;
char s[maxn];
int a[maxn];
ll f[maxn][maxn][maxn];
ll ans;
inline ll norm(const ll & x) { return x >= mod ? x - mod : x;}
int main()
{
scanf("%s%d", s + 1, &K);
K = min(K, 300);
int le... | #include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#def... | 0 |
#include <bits/stdc++.h>
using namespace std;
int N;long long base=1000000007LL;
int main() {
cin >> N;
long long A[3][N];long long count=3LL;
for (int i=0;i<N;i++) {
for (int j=0;j<3;j++) {
A[j][i]=0LL;
}
}
for (int i=0;i<N;i++) {
long long x;cin >> x;
if (i==0) {
A[0][0]=1LL;
... | #include <bits/stdc++.h>
using namespace std;
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; } return 0; }
using ll = long long;
using P = pair<int,int>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4]... | 1 |
#include <iostream>
using namespace std;
int main(void){
long long n,a,min=1000000,max=-1000000,s=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>a;
if(a>max)max=a;
if(a<min)min=a;
s=s+a;
}
cout<<min<<" "<<max<<" "<<s<<endl;
}
| #include <bits/stdc++.h>
using namespace std ;
int main(){
int a[3];
cin >> a[0] >> a[1] >> a[2];
sort(a,a+3);
int Ans = a[0]+a[1];
cout << Ans << endl;
} | 0 |
#include <cstdio>
#include <algorithm>
using namespace std;
#define INF (1<<27)
int cost[100][100];
int main() {
int n,k;
while(scanf("%d %d",&n,&k),n) {
fill((int*)cost,(int*)(cost+100),INF);
for(int i=0;i<k;i++) {
int a,b,c;
scanf("%d",&a);
if(a==0) {
scanf("%d %d",&a,&b);
if(cost[a-1][b-1]==IN... | #include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <utility>
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
using namespace std;
typedef pair<int, int> P;
const int inf = 1e9;
int n, k;
vector<P> vec[101];
int d[101];
void dijkstra(int ... | 1 |
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>
#define V... | #include <stdio.h>
const int INF=2147483647;
struct segment_tree{
int map[2000010];
void build(int now,int l,int r){
if(l==r){
map[now]=INF;
return;
}
map[now]=-1;
int mid=(l+r)/2;
build(now*2+1,l,mid);
build(now*2+2,mid+1,r);
retur... | 0 |
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
int main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int n,h,w; cin>>n>>h>>w;
cout<<(n-h+1)*(n-w+1)<<endl;
return 0;
}
| /*************************************
* problem: AT2164 Rabbit Exercise.
* user ID: 63720.
* user name: Jomoo.
* time: 2019-08-14.
* language: C++.
* upload place: Luogu.
*************************************/
#include <bits/stdc++.h>
using namespace std;
#define puts_return(x) { puts(... | 0 |
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
char c=getchar();bool f=0;x=0;
while(!isdigit(c)) f|=c=='-',c=getchar();
while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
if(f) x=-x;return x;
}
template<... | #define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP ... | 1 |
#include<bits/stdc++.h>
using namespace std;
int arr[55], pref[55];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n, k;
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
pref[i] = arr[i] + pref[i - 1];
}
int answer = -2e9;
int sum1 = 0;
for (int i... | #define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair //pairのコンストラクタ
#d... | 1 |
#include <bits/stdc++.h>
using namespace std;
bool nabeatsu(int n){
if(n % 3 == 0) return true;
int temp = n;
while(temp > 0){
if(temp % 10 == 3) return true;
temp /= 10;
}
return false;
}
int main(){
int n; cin >> n;
for(int i = 1; i <= n; i++){
if(nabeatsu(i)){
... | #include <iostream>
#include <vector>
using namespace std;
int powerOf2(int n) {
int res = 0;
while (n % 2 == 0) {
res++;
n /= 2;
}
return res;
}
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int pow2 = 1e9;
for (int i = 0; i < n; i++) {
pow2 = min(po... | 0 |
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
using namespace std;
int main()
{
string S;
cin >> S;
if (S.length() == 3) {
reverse(S.begin(), S.end());
cout << S << endl;
}
else {
cout << S << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define all(v) v.begin(), v.end()
const ll mod=1000000007;
ll countBits(ll in){
int res=0;
for(;in>0;in>>=1){
if((in&0x01)!=0){
res++;
}
}
return res;
}
template<typenam... | 1 |
//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<in... | #include <cstdio>
#include <cstring>
#include <algorithm>
#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;
const int N=605;
int n,d1,d2;
bool vis[N][N];
bool fill(int d) {
int t=0;
for(;!(d&3);d>>=2) t++;
if ((d&3)==1) fo(i,0,n-1) fo(j,0,n-1) vis[i][j]|=((i>>t)+... | 0 |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cout << #x << " = " << x << endl;
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))
const int IN... | #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 N, Q; cin >> N >> Q;
string S; cin ... | 0 |
#include <bits/stdc++.h>
using namespace std;
// TYPEDEF
// ----------------------------------------
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;
//... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
struct fastio {
fastio() {
ios::sync_with_stdio(false);
cout << setprecision(10) << fixed;
cin.tie(0);
}
};
fastio _fast_io;
const int N = 2e5 + 5;
int n;
int a[N];
int cnt[N];
int res;... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << setprecision(20) << fixed;
int N, M;
cin >> N >> M;
int max = 0;
if(M%N == 0){
cout << M / N <<endl;
return 0;
}
for(int i = 1; i <= M/N; i++){
if(M % i == 0 && M % i <= N){
m... | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vecto... | 0 |
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < n; ++i)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
bool chk(int bit, vector<vector<P>> &p)
{
bool result = true;
for (int i = 0; i < (int)p.size(); i++)
{
if (!(bit & (1 << i)))
... | #ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O20")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
#define p(x) (cout << x << "\n")
using ll = long long; using ld ... | 1 |
#include<stdio.h>
int main()
{
int N,R,A;
scanf("%d %d", &N, &R);
A =100*(10-N);
if(N>=10){
printf("%d", R);
}
else{
printf("%d", R + A);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a=0,b=0;
cin >> a;
cin >> b;
cout << 2 * b - a << endl;
return 0;
} | 0 |
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
int main() {
string abcd;
cin >> abcd;
rep(i, 1<<3) {
bitset<3> bit(i);
... | #include<bits/stdc++.h>
using namespace std;
const int MAX = 2e5 ;
const int INF = 1e9 + 1e5 + 2;
const int mod= 1e9+7;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define what_is(x) cerr << #x << " = " << x << endl;
#define eps 1e-15
#define F first
#define S second
typedef long long ll;
ll f... | 1 |
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsig... | #include<iostream>
#include<string.h>
using namespace std;
int main(){
char str [21];
cin >> str;
for(int i = strlen(str)-1; i >= 0; i--){
cout << str[i];
}
cout << endl;
} | 1 |
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
char str[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> str;
int len = strlen(str);
str[len - 8] = 0;
cout << str << "\n";
return 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(){
string S;
cin>>S;
rep(i,S.size()-1){
if(S.at(i)=='A'){
if(S.at(i+1)=='C'){
cout<<"Yes"<<endl;
return 0;
... | 0 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define clr(a,h) memset(a, (h), sizeof(a))
#define mem(a,h) ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n)
{
// Corner cases
if (n <= 1)
return 1;
if (n <= 3)
return 2;
// This is checked so that we can skip
// mid... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define loop(i,n)for(i=0;i<n;i++)
#define INF 1000000000
using ll = long long int;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
#define MAX 100005
int main()
{
I... | #include <bits/stdc++.h>
using namespace std;
const int maxn=1e6;
int arr[maxn],n;
int main() {
cin>>n;
bool flag;
int ans=1;
int temp;
cin>>arr[0];
temp=arr[0];
for(int i=1;i<n;i++)
{
cin>>arr[i];
if(arr[i]<temp)
ans+=1;
temp=min(arr[i],temp);
}
cout<<ans;
} | 1 |
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
using namespace std;
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n; cin >> n;
if(n == 0){
cout << 0 << endl; return 0;
}
string bin = "";
while(n != 0){
ll fo... | #include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
using namespace boost;
using namespace boost::adaptors;
int main() {
int64_t n;
cin >> n;
if (n == 0) {
cout << 0 << endl;
return 0;
}
vector<int64_t> ans;
whi... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int q;
string s;
set<int> ac;
vector<int> wa(n+1, 0);
for(int i=0; i<m; i++) {
cin >> q >> s;
if(ac.count(q)) continue;
if(s=="AC") ac.insert(q);
else wa[q]++;
}
for(int i=1; i<n+1; i++) if(!ac.c... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
int main(void){
int N,M;
cin >>N>>M;
bool AC[N];
int WA[N];
int WAsum=0;
int ACsum=0;
rep(i,N){
WA[i]=0;
AC[i]=false;
}
while(M>0){
int p;
string s;
... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> Pl... | #include <bits/stdc++.h>
using namespace std;
int main() {
string A;
cin >> A;
if(A[1]=='A' && A[2]=='C'||A[0]=='A'&& A[1]=='C'||A[2]=='A'&&A[3]=='C'||A[3]=='A'&&A[4]=='C'){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
} | 0 |
#include<iostream>
#include<cstring>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;
#define MAX 500000
#define INF 2e9
int L[MAX/2+2],R[MAX/2+2];
long long cnt=0;
long long merge(int A[],int n,int left,int mid,int right)
{
long long cnt=0;
int n1=mid-left;
int n2=right-mid;
for(int ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int M = 1 << 18 + 1;
int N;
cin >> N;
vector<int> A(N), a(N), ord(N);
for ( int i = 0; i < N; i++ ) {
cin >> A[i];
a[i] = A[i];
}
sort(a.begin(), a.end());
for ( int i = 0; i < N; i++ ) {
... | 1 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = (1e+9)+7;
int main(){
int n;
cin >> n;
vector<int> a(n);
ll sm = 0;
for(int i=0; i<n; i++){
cin >> a[i];
sm = (sm + a[i]) % MOD;
}
ll ans = 0;
for(int i=0; i<n; i++){
sm -= a[i];
if(sm < 0) sm += MOD;
... | #include <bits/stdc++.h>
using namespace std;
int64_t mod = 1e9+7;
int main() {
int n;
cin >> n;
vector<int64_t>arr(n);
for(auto & i : arr)
cin >> i;
vector<int64_t>sufsum;
sufsum.push_back(0);
for(int i = n-1; i > 0; --i){
auto a = sufsum.back();
a+=arr[i];
... | 1 |
#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; }
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i... | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.1415926535897932;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int... | 0 |
#include<iostream>
#include<string>
#include<algorithm>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int main() {
string str, cmd, p, tmp;
int q, i, j, a, b;
cin >> str >> q;
rep(i,q) {
cin >> cmd;
if (cmd == "print") {
cin >> a >> b;
cout << str.substr(a,b-a+1) ... | #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#... | 0 |
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(a... | #include <bits/stdc++.h>
using namespace std;
signed main()
{
int a,b,c=1,d;
cin>>a>>b;
d=a;
for(int i=1;i<=d;i++){
if(a>b){
a-=b;
a+=b-1;
c++;
}
}
cout<<c<<"\n";
}
| 1 |
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#defi... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0)
#define setbit0(n, i) ((n) & (~(1LL << (i))))
#define setbit1(n, i) (... | 1 |
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdio>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii;
typedef long long ll ;
#define lo... | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int n;
string s;
string::size_type t;
cin >> n;
getchar();
while (n--) {
getline(cin, s);
t = 0;
while ((t = s.find("Hoshino", t)) != string::npos) {
s[t + 6] = 'a';
t += 1;
}
cout << s... | 1 |
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>
typedef unsigned long long ull;
typedef long long ll;
ll DENOM = 1000000000LL + 7LL;
using namespac... | /* Perseverance can make miracle happens */
/* If u identify me then u r my frnd */
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define pq priority_queue<int>
#define mpi map<int,int>
#define pb push_back
#define ff first
#define ss second
#define forn(i,n) for(int ... | 1 |
#include<bits/stdc++.h>
using namespace std;
int main(){
int get_rate=0;
int get_goal=0;
cin >> get_rate >> get_goal;
cout << 2*get_goal-get_rate;
} | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
const int MaxN = 1000000;
int n;
char s[MaxN + 2], t[MaxN + 2];
int q_l, q_r;
int q[MaxN + 1];
inline int solve()
{
if (!strcmp(s + 1, t + 1))
return 0;
q_l = 1, q_r = 0;
int l = 0, last = n + ... | 0 |
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int* mallocint(int si)
{
return (int*) malloc(si * sizeof(int));
}
int* inputint(int n)
{
int *ans = mallocint(n);
for( int i = 0; i < n; i++ ) cin >> ans[i];
return ans;
}
#define _INF -2000000001
int main()
{
int n;
cin >> ... | #include <iostream>
using namespace std;
int main()
{
string date;
cin>> date;
date[3]='8';
cout<<date;
return 0;
}
| 0 |
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
... | #include<bits/stdc++.h>
using namespace std;
#define Nitroboost ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
const int mod=1e9+7;
const int N=1e6+5;
int main()
{
Nitroboost;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("out... | 0 |
#include<bits/stdc++.h>
using namespace std ;
#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ar array
#define inf() ifstream cin("d.txt")
#define onf() ofstream cout("test.txt")
#define mod 1000000007
#define pb push_back
#def... | #include <bits/stdc++.h>
using namespace std;
int const MX = 2e5 + 2;
int main()
{
int d, s, t;
cin>>d>>t>>s;
int time = (d + s - 1)/s;
if(time <= t) cout<<"Yes\n";
else cout<<"No\n";
}
| 1 |
#include <stdio.h>
void grade(int students)
{
while(students != 0) {
for(int i = 0; i < students; ++i) {
int math, english, japanese;
scanf("%d %d %d", &math, &english, &japanese);
int mean = (math + english + japanese) / 3;
if ((math == 100) || (english == 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 point[3];
int n;
int ave;
... | 1 |
#include<bits/stdc++.h>
using namespace std;
const int N=1050;
int a[N],b[N],col,n,m,com,tot;
const long long mod=1e9+7;
long long ans=0;
bool vis[2][N*N];
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++) {
scanf("%d",&a[i]);
vis[0][a[i]]=true;
}
for(int j=1;j<=m;j++) {
scanf("%d",&b[j]);
vis[1][b[j]]... | #include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define MOD 1000000007
#defin... | 1 |
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
const ll INF = 9e18;
const ll MODULO = 998244353L;
void print() { cout << endl; }
template <typename Head, typename... Tail>
void print(Head head, Tail... tail) {
int size = sizeof...(Tail);
cout << head;
if (size > 0)... | // #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<c... | 0 |
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x)... | #include <iostream>
#include <vector>
#include <algorithm>
//#include <fstream>
using namespace std;
int main()
{
// cut here before submit
// freopen ("testcase.thanksgiving", "r", stdin );
int n, m;
while (cin >> n >> m && n && m){
vector <int> bp(n + 1);
int i;
bp[0] = 10001;
for (i = 1; i <= n; ++i){... | 0 |
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main(){
int card[4];
char c;
while(cin >> card[0] ){
for(int i=1;i<5;i++){
cin >> c >> card[i];
}
sort(card, card+5);
int two = 0;
boo... | #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>
us... | 1 |
#include <iostream>
using namespace std;
int main() {
class Dice {
public:
int men[6];
void setMen(int i, int value) {men[i] = value;}
void getMen() {cout << men[0] << endl;}
void SwitchMen (char Alpha) {
switch (Alpha) {
... | #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
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
signed main(){
int n,a,b,c;
while(1){
cin>>a>>b>>c;
n=a+b+c;
if(n==0... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define MOD 1000000007
int32_t main(){
int d, t, s;
cin >> d >> t >> s;
if(((double)d/(double)s) <= t)
cout << "Yes";
else
cout << "No";
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int mod=1e9+7;
const int N=1e6+10;
void read(int &a)
{
a=0;int d=1;char ch;
while(ch=getchar(),ch>'9'||ch<'0') if(ch=='-') d=-1;
a=ch^48;
while(ch=getchar(),ch>='0'&&ch<='9') a=(a<<3)+(a<<1)+(ch^48);
a*=d;
... | 1 |
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int gcd(int x, int y) {
if (y == 0) return x;
return gcd(y, x % y);
}
bool solve(int n, vector<int> a) {
int parity = 0, odds = 0, minelem = a[0];
for (int i = 0; i < n; ++i) {
parity = (parity + a[i] - 1) % 2;
if (a[i] & 1) ++odds;... | #include<bits/stdc++.h>
/*zzzzdfadfadfad*/
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long LL;
const int N=100500;
int read(int &n)
{
char ch=' ';int q=0,w=1;
for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
if(ch=='-')w=-1,ch=getch... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin>>n;
vector<long long >v;
vector<long long >t;
vector<long long >f;
set<long long>s;
set<long long>::iterator it;
map<long long,long long>m;
for(int i=0;i<n;i++)
{
long long x;
cin>>x;
... | #include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#defin... | 1 |
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define PI acos(... | #include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = v... | 0 |
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
vector<int> x = {1,-1,0,0};
vector<int> y = {0,0,-1,1};
int main(){
set<ll> data;
ll n;
cin ... | #include <iostream>
using namespace std;
int main(){
int n, m;
cin >> n;
cin >> m;
int a[1000] = {};
int b[1000] = {};
int point[1000] = {};
int selected;
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < m; i++){
cin >> b[i];
}
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
... | 0 |
/* 十 聖イシドールスよ、迷えるプログラマを導き給え! 十 */
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <deque>
#define rep(i, n) for(int i = 0; i < n; i++)
//const long long INF = 1LL << 60;
const int INF = 1e9;
using ll = long long;
int main()
{
int N, Q;
std::cin ... | #include <bits/stdc++.h>
using namespace std;
struct StQuery
{
StQuery() : m_nLeft(0), m_nRigt(0) { }
int m_nLeft;
int m_nRigt;
};
void input(string& rsStr, vector<StQuery>& rvoQuery)
{
int nStrSiz, nQuerySiz;
cin >> nStrSiz >> nQuerySiz;
rvoQuery.resize(nQuerySiz);
cin >> rsStr;
for (StQuery& ro... | 1 |
#include <stdio.h>
int main() {
char s1[101], s2[101];
scanf("%s %s", s1, s2);
printf("%s%s\n", s2, s1);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define ii pair < int , int >
const int N=1;
int main()
{
string x,y;
cin>>x>>y;
cout<<y+x;
}
| 1 |
#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;
int dist[1005][1005];
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};
int main(){
int h,w;cin >> h >> w... | #include <bits/stdc++.h>
using namespace std;
long long M=1000000007;
vector<int> num;
int isprime[105];
int n,m,d;
string a,b;
long long dp[10005][2][2][105];
long long solve(int idx,int flag,int flag2,int rem)
{
//cout<<rem<<endl;
if(idx==b.size())
{
if(rem==0)
return 1;
... | 0 |
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;
int fac[2000005], ifac[2000005];
void gen_fac()
{
fac[0] = 1;
r... | //#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
ll c=a%i_7;
if(c>=0)r... | 1 |
#include<cstdio>
int main()
{
while(true) {
int a, b, c, n;
int test[3000], r[1000];
int ans[1000];
scanf("%d%d%d", &a, &b, &c);
if(a == 0)
break;
scanf("%d", &n);
for(int i = 0; i < n; ++i) {
scanf("%d%d%d%d", test + i * 3, test + i * 3 + 1, test + i * 3 + 2, r + i);
test[i * 3] -= 1, test[i * 3 + 1] -= 1, test[i *... |
#include<iostream>
using namespace std;
struct Test{
int A[3];
bool R;
};
Test tests[1000];
int info[301], M[3], N;
int main()
{
while(true)
{
for(int i = 0; i <= 300; i++)
info[i] = 2;
cin >> M[0] >> M[1] >> M[2];
if(!(M[0] || M[1] || M[2]))
break;
cin >> N;
for(int i = 1... | 1 |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
// memo fixed setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */ template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";s... | #include <iostream>
#include <algorithm>
#include <stdlib.h>
using namespace std;
int main(void){
int n;cin>>n;
int a[n];
for (int i =0;i<n;i++){
cin>>a[i];
}
int sm=0;
for (int i =0;i<n;i++){
sm+=a[i];
}
for (int i =0;i<n;i++){
a[i]*=n;
}
int... | 1 |
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
std::fill((T*)array, (T*)(array + N), val);
}
... | #include<bits/stdc++.h>
using namespace std;
const int MAXN=10005;
int P=1e9+7,d,len;
char k[MAXN];
long long a[MAXN],dp[10005][105];
long long dfs(int pos,int tot,bool lim)
{
// cout<<pos<<' '<<tot<<' '<<lim<<endl;
if(pos==len+1)
{
if(tot==0) return 1;
return 0;
}
if(!lim&&dp[pos][tot]!=-1) return dp[pos][t... | 1 |
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
using namespace std;
int d[30],len,dp[30][30][30];
int DP(int n){
int ret=0;
memset(dp,0,sizeof(dp));
dp[0][0][0]=1;
for(int i=0;i<(n>>1);i++)
for(int j=0;j<10;j++)
for(int k=0;k<10;k++)
if(dp[i][j][k])
for(int x=0;x<10;x++){
... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll D,ans;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>D;
if(D%9){
cout<<0<<'\n';
return 0;
}
D/=9;ll pw=1;
for(int i=1;i<=17;++i){
ll tmp=1,d=D,lp=pw,rp=1;pw*=10;
ll b=(pw-1)/9;
for(int j=0;j+j<=i;++j){
tmp*=10-a... | 1 |
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
(xs.empty()?cout:(cout<<xs[... | #include <bits/stdc++.h>
#define INF 1e9
using namespace std;
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a) (a).begin(),(a).end()
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a... | 1 |
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
int c;
while((c=a%b)!=0){
a=b;
b=c;
}
return b;
}
vector<int> divisor(int n){
vector<int> div;
for(int i=1;i<=n;i++){
if(n%i==0){
div.push_back(n/i);
}
}
sort(div.begin(),div.en... | #include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int main(){
int n,memo;
priority_queue<int,vector<int>,greater<int> > que;
cin >> n;
int a[n];
rep(i,0,n){
cin >> a[i];
}
sort(a,... | 1 |
#include"bits/stdc++.h"
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define I... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用(EPSより小さいと0と判定など)
... | 1 |
#include <bits/stdc++.h>
using namespace std;
const int inf = 1001001001;
int main(){
string str;
cin >> str;
vector<int> num;
for(int i=0;i<str.size();i++){
num.push_back(str.at(i)-'0');
}
reverse(num.begin(),num.end());
num.push_back(0);
int n=num.size();
// 下からi桁目までに使用する紙幣の最小
... | #include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for... | 1 |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,y;
cin >> n >> y;
int tth=n,fth=0,th=0;
bool ok=false;
for(int i=0;i<=n;i++){
tth=i;
for(int j=0;j<=n-i;j++){
fth=j;
th=n-i-j;
if(tth*10000+fth*5000+th*1000==y){
ok=true;
break;
}
}
if(ok)
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int K,N;
cin >> N >> K;
cout << N-K+1 << endl;
}
| 0 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pll;
ll n,x[100010]={0},y[100010]={0};
vector<pll>vx,vy;
vector<pll>edge[100010];
priority_queue<pll,vector<pll>,greater<pll>>q;
//priority_queue<pll>q;
bool used[100010];
ll res=0;
signed main(){
cin>>n;
for(int i=0;i<n;+... | #include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define MOD2 998244353
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<... | 1 |
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(), v.end()
#define sz size()
#define mp make_pair
#define pb push_back
#define rep(p, a, b) for (ll p = a; p < b; p++)
#define rap(p, a, b) for (ll p = a; p <= b; p++)
#define per(p, a, b) for (ll p = a; p >= b; p--)
#define F f... | #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>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)
int main()... | 1 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
const int MAX_N = 410;
const int MAX_X = 3e5+10;
const int MOD = 1e9+7;
int dp[MAX_N][MAX_X];
// i番目までで先頭の値がjの時の総和をdp[i][j]をおく
void modadd(int &a, int b ){
a = (a+b)%MOD;
}
signed main(void){
int N,X; cin >> N >> X;
... | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#defi... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,v... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;
#define fi first
#define se second
const ll MOD = 1e9 + 7;
const ll MOD2 = 99824... | 1 |
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
char c=getchar();bool f=0;x=0;
while(!isdigit(c)) f|=c=='-',c=getchar();
while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
if(f) x=-x;return x;
}
template<... | #include <iostream>
#include <algorithm>
using namespace std;
static const int N = 100;
int main() {
int n, p[N + 1], m[N + 1][N + 1];
scanf("%d", &n);
for ( int i = 1; i <= n; i++ ) {
cin >> p[i - 1] >> p[i];
}
for ( int i = 1; i <= n; i++ ) m[i][i] = 0;
for ( int l = 2; l <= n; l++ ) {
for ( int i ... | 0 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl)... | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
void insertionSort(vector<int> &a, int g, long &cnt)
{
int j;
int v;
for (int i = g; i < a.size(); i++)
{
v = a[i];
j = i - g;
while (j >= 0 && a[j] > v)
{
a[j + g] = a[... | 0 |
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;
template<typename T>
struct BIT{
int n;
vector<T> d;
BIT(int n = 0):n(n),d(n+1){}
void add(int i,T x... | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,q; cin>>n>>m>>q;
vector<vector<int>> a(n,vector<int> (n,0));
for(int i=0;i<m;i++){
int l,r; cin>>l>>r;
l--; r--;
a[l][r]++;
}
vector<vector<int>> s(n+1,vector<int> (n+1,0));
for(int i=0;i<n;i++){
fo... | 1 |
#include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
using namespace std;
#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?fa... | #include <iostream>
using namespace std;
static const int INF = 1000001;
int main() {
while (true) {
int e;
cin >> e;
if (e == 0) break;
int i;
for (i = 0; i * i * i <= e; i++)
;
int t = i - 1;
int m = INF;
for (int j = t; j >= 0; j--) {
int tz = j * j * j;
for (int k = 0; tz + k * k <... | 1 |
#include <iostream>
using namespace std;
int main(){
int n;
long a, min = 1000000, max = -1000000, sum = 0;
cin >> n;
for (n; n > 0; n--) {
cin >> a;
if ( a > max) max = a;
if ( a < min) min = a;
sum += a;
}
cout << min << " " << max << " " << sum << "\n";
return 0;
} | #include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
faster;
ll int tc=1;
while(tc--)
{
ll int n;
cin>>n;
str... | 0 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).b... | #include<bits/stdc++.h>
using namespace std;
#define deb(x) cerr<<"["#x<<" : "<<x<<" ]\n";
int main()
{
using ll = long long;
ll n, y;
cin >> n >> y;
ll k = y - 1000*n;
deb(k);
int b = 0, a = 0;
while(true) {
if((k - (4000*b)) < 0) {
puts("-1 -1 -1");
return 0;
}
if((k - 4000*b) % 9000 == 0) {... | 1 |
#include <iostream>
using namespace std;
long long d, t, s;
int main()
{
cin >> d >> t >> s;
if(t * s >= d)
cout << "Yes";
else
cout << "No";
return 0;
}
| #include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)
signed main(){
int A,B;
string S,ans="No";
cin>>A>>B>>S;
int SS=S.size();
if((A+B+1)!=SS){
cout<<ans<<endl;
return 0;
}
rep(i,SS){
if(i!=A&&S[i]=='-'){
cout<<a... | 0 |
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
int ctoi(char c) {return c-'0';}/*char to int*/
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}/*MAX*/
int lcm(ll a,ll b){return a*b/gcd(a,b);}/*MIN*/
bool primecheck(ll n){/*sosuu*/if(n < 2) return false;else{for(int i = 2; i * i <= n; i++... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
int n;
cin >> n;
vector<double> a(n);
vector<double> b(n);
int sum=0;
rep(i,n){
cin >> a[i];
sum+=a[i];
}
double ave=(double)sum/n;
int ans=0;
rep(j,n){
b[j]=abs(av... | 1 |
#include<cstdio>
using ull = unsigned long long;
const static int MOD = 1000000007;
const static int MAX_H = 100;
const static int MAX_W = 8;
ull dp[MAX_H+1][MAX_W], fibonacci[8] = {1, 1, 2, 3, 5, 8, 13, 21};
int main(){
unsigned H, W, K;
scanf("%u %u %u", &H, &W, &K);
if(W == 1){
printf("1\n");
... | //#define NDEBUG
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#defi... | 1 |
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using... | #include<bits/stdc++.h>
using namespace std;
long long dp[2][3003];
int main()
{
long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
vector<long long>u,v,w; vector< pair<long lon... | 1 |
// includes
#include "bits/stdc++.h"
using namespace std;
// macros
#define ll long long
#define MOD 1000000007 // 998244353 //100000000 //
#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define sz(x) ((ll)(x).size())
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; ... | #include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;
inline int read(){
int x=0,f=1;char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
f... | 0 |
/*
Author : Devil088
*/
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define sep cout<<"\n";
#define Yes cout<<"Yes\n";
#define No cout<<"No\n";
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";
inline string shift(string s){
int n = s.length();
string r = "";
r+=s[n-1];
for(int i=0;i<n-1;... | /**
* author: otera
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<... | 1 |
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int64_t N;
cin >> N;
vector<int64_t> parts_a(N);
for (int64_t n = 0; n < N; ++n) {
cin >> parts_a[n];
}
sort(parts_a.begin(), parts_a.end());
vector<int64_t> parts_b(N);
for (int64_t ... | #include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>
... | 0 |
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <func... | #include <iostream>
#include <cstdint>
#include <vector>
#include <algorithm>
int main() {
std::int64_t n, m;
std::vector<std::int64_t> in, pairSum;
in.reserve(1000);
pairSum.reserve(1000 * 1000);
while (std::cin >> n >> m, n + m != 0) {
in.push_back(0);
for (int i = 0; i < n; ++i) {
int p;
std::cin >>... | 1 |
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)
#define lb(x) (x&-x)
#define get(x) ((int)log2(x))
const int INF=0x3f3f3f3f;
const int N=66666;
int f[17][N],sum[N];
int v[17][17];
int read() {
int x=0,v=1; char ch=getchar();
for (;ch<'0'||... | #include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=2010;
const int MOD=1e9+7;
int n,k;
long long fac[MAXN*MAXN],inv[MAXN*MAXN],f[MAXN][MAXN];
long long C(long long x,long long y)
{
return fac[x]*inv[y]%MOD*inv[x-y]%MOD;
}
long long qpow(long long x,long long y)
{
long long tmp=1;
for(;y;y>>=1... | 0 |
#include<cstdio>
#include<cstring>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
ll a[MAXN];
int n,now,cnt0,cnt1;
ll gcd(ll x,ll y){
if(y==0)
return x;
return gcd(y,x%y);
}
bool solve(){
int cnt0=0,cnt1=0,now=0;
for(int i=1;i<=n;i++){
if(a... | #include <bits/stdc++.h>
using namespace std;
int main()
{
// freopen("AGC010-D.in", "r", stdin);
int n, cur = 0;
cin >> n;
vector<int> arr(n);
copy(istream_iterator<int>(cin), istream_iterator<int>(), arr.begin());
string str[] = {"First", "Second"}, ans;
while (ans.empty()) {
int cnt = count_if(arr.begin(), ... | 1 |
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_bac... | 0 |
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define MAX_V 200005
int V;
vector<int> nG[MAX_V], rG[MAX_V], G[MAX_V], vs; //... | #include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=100005;
int n,m;
int head[MAXN];
struct node
{
int from;
int to;
int next;
}edge[MAXN<<1];
int edge_cnt;
void add_edge(int fr,int to)
{
edge[++edge_cnt].from=fr;
edge[edge_cnt].to=to;
edge[edge_cnt].next=head[fr];
... | 0 |
#include <iostream>
#include <set>
using namespace std;
set<int> f(int x) {
set<int> s;
if (x == 0) s.insert(0);
while (x > 0) {
s.insert(x % 10);
x /= 10;
}
return s;
}
bool has_common(const set<int> &a, const set<int> &b) {
auto ai = a.begin(), bi = b.begin();
while (ai != a.end() && bi != b.... | #include <bits/stdc++.h>
#include <string>
#include <vector>
#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;
int main(){
int n,k;
cin >> n >> k;
set<int> s;
rep(i,10) s.insert(i);
rep(i,k){
int m;cin >> m;
... | 1 |
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
string s;
cin>>s;
if(s[0]=='R'){
if(s[1]=='R'){
if(s[2]=='R'){
cout<<"3"<<endl;
}
else{
cout<<"2"<<endl;
}
}
else{
cout<<"1"<<endl;
}
}
else{
if(s[1]=='R'){
if(s[2]=='R'){
cout<<"2"<<endl;
}
els... | #include<iostream>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0;i <= (signed)s.length() - 3;i++) {
if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
cout << i + 1 << " " << i + 3 << endl;
return 0;
}
}
if (s.length() >= 2) {
if (s[s.length() - 1] == s[s.lengt... | 0 |
#include <iostream>
#include <string>
#include <algorithm>
#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 <cc... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
ll n, m; cin >> n >> m;
map<ll,ll> data;
ll sum = 0; data[0]++;
for(int i=0; i<n; i++){
ll a; cin >> a;
sum += a;
sum %= m;
data[sum]++;
}
ll ans = 0;
for(auto x : data) ans += x.... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<ll, ll> P;
typedef pair<ll,P> event;
#define MOD 1000000007
const int MAX = 510000;
int main(){
ll N;
cin>>N;
ll num=N;
queue<char>memo;
for(ll i... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define INF (1ll<<60)
#define mod 1000000007
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline... | 1 |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int Mod = 998244353;
int fpow(int x, int y) {
int res = 1;
while (y) {
if (y & 1) res = 1ll * res * x % Mod;
x = 1ll * x * x % Mod;
y >>= 1;
}
return res;
... | #include <bits/stdc++.h>
using namespace std;
const int md = 998244353;
inline void add(int &a, int b) {
a += b;
if (a >= md) {
a -= md;
}
}
inline int mul(int a, int b) {
return (long long) a * b % md;
}
inline int power(int a, int b) {
int res = 1;
while (b > 0) {
if (b & 1) {
res = mul... | 1 |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,... | #include<bits/stdc++.h>
using namespace std;
int main () {
int x, ans = 0;
cin >> x;
ans += x/500*1000;
x -= x/500*500;
ans += x/5*5;
cout << ans << endl;
} | 0 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for ( int i = 0; i < (n); i++ )
signed main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
int N;
cin >> N;
set<int> paper;
REP(i, N) {
int A;
cin >> A;
if ( paper.count(A) ) {
paper.erase(A);
} ... | #define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <que... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.