akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;
 
#define Pr(f,...) //printf(f,##__VA_ARGS__),fflush(stdout)
 
typedef long long ll;
 
const int N=3e5+50,P=1e9+7;

void upd(int &a,int b) { a+=b; if(a>=P)a-=P; }
 
int n,a[N],b[N];
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	scanf("%d",&n);
	rep(i,1,n){
		scanf("%d",a+i);
		b[i]=a[i];
	}
	sort(b+1,b+n+1);
	int x=b[n/2],y=b[n/2+1];
	rep(i,1,n)printf("%d\n",a[i]<=x?y:x);
	return 0 ;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pb push_back

ll k,a,b;
int main()
{
        cin >> k >> a >> b;
        if(b <= a+2) {
                cout << k+1 << endl;
        }else {

                if(k < a+1) {
                        cout << k+1 << endl; return 0;
                }
                if(k == a+1) {
                        cout << b << endl; return 0;
                }
                ll yos = k - a - 1;
                if(yos%2==0) {
                        yos /= 2;
                        cout << (yos+1)*b - (yos*a) << endl;
                }else {
                        yos /= 2;
                        cout << (yos + 1)*b - (yos)*(a) + 1 << endl;
                }
        }
        //cout << 48518828981938099 << endl;
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>

using namespace std;

string s;

int main()
{
    cin>>s;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='1')
        {
            s[i]='9';
        }
        else

        {
            s[i]='1';
        }
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int n,a,b,c,d,x;
  long long la,lb,lc,lx;
  double da,db,dc;
  string s,ss,sss;
  
  double ans = 0;
  string anss = "";
  
  cin >> n;
  vector<int> va(n);
  //vector<int> vb(n);
  //vector<int> vc(n-1);
 // vector<vector<int>> data(n, vector<int>(a));
 /* for (int i = 0; i < n; i++) {
    for (int j = 0; j < a; j++) {
      cin >> data.at(i).at(j);
    }
  }*/
  rep(i,0,n) cin >> va.at(i);
  //rep(i,0,n-1) cin >> vc.at(i);
  //int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  //int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
int count = 0;
  rep(i,1,n-1){
    if(va.at(i) > va.at(i-1) && va.at(i+1) > va.at(i) || va.at(i) < va.at(i-1) && va.at(i+1) < va.at(i))count++;
  }
  cout << count << endl;
 // cout << fixed << setprecision(5) << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#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 <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;
ll INF = 1e10;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a<b&& b<c)
	{
		co("Yes");
	}
	else
	{
		co("No");
	}
	return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int n;
	cin >> n;
	cout << "ABC" << n << endl;
}

Measured memory_bytes: 256
//
// Created by kashi on 27-07-2020.
//
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define Endl endl
#define int long long
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss<p2.ss;
}
int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}
int32_t main() {
    int h,a;
    cin>>h>>a;
    cout<<(h+a-1)/a<<Endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
    int A, B;
    cin >> A >> B;
    for (int i = 0; i < 10000; ++i) {
        if (((i * 8) / 100 == A) && ((i * 10) / 100) == B) {
            cout << i;
            return 0;
        }
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int N, T, A;
    cin >> N >> T >> A;

    double diff = 1001001001;
    int ans = 0;
    for(int i=1; i<=N; ++i){
        int H;
        cin >> H;
        double temp = T - 0.006 * H;
        if(fabs(temp - A) < diff){
            diff = fabs(temp-A);
            ans = i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define MOD 1000000007
typedef long long ll;

int main(){
	int a, b, c, d, e, f, g, h, i, j, k, l, ans;
	scanf("%d%d", &a, &b);
	c = a + 1;
	d = b + 1;
	e = a * 12.5;
	f = b * 10;
	g = c * 12.5;
	h = d * 10;
	i = e * 0.08;
	j = f * 0.1;
	k = g * 0.08;
	l = h * 0.1;
	if((a == i) && (e >= f) && (h > e)) ans = e;
	else if((a != i) && (e >= f) && (h > e)) ans = e + 1;
	else if((f > e) && (g > f)) ans = f;
	else ans = -1;
	printf("%d", ans); 
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000


//// RangeMinimum(Segtree) (0-indexed)
struct RangeMinQuery{
	int dat[2*MAX_N-1];// (ex. MAX_N=1<<17
	int size;

	void init(int n_){
		size=1;
		while(size<n_) size*=2;
		for(int i=0;i<2*size-1;i++)dat[i]=INT_MAX;
	}

	void update(int k,int a){
		k+=size-1;
		dat[k]=a;
		while(k>0){
			k=(k-1)/2;
			dat[k]=min(dat[k*2+1],dat[k*2+2]);
		}
	}

	int subquery(int a,int b,int k,int l,int r){
		if(r<=a||b<=l)return INT_MAX;
		if(a<=l&&r<=b)return dat[k];
		else{
			return min(subquery(a,b,k*2+1,l,(l+r)/2),subquery(a,b,k*2+2,(l+r)/2,r));
		}
	}
	
	int query(int a,int b){
		return subquery(a,b,0,0,size);
	}
};

//// RangeMaximum(Segtree) (0-indexed)
struct RangeMaxQuery{
	int dat[2*MAX_N-1];// (ex. MAX_N=1<<17
	int size;

	void init(int n_){
		size=1;
		while(size<n_)size*=2;
		for(int i=0;i<2*size-1;i++)dat[i]=0;
	}

	void update(int k,int a){
		k+=size-1;
		dat[k]=a;
		while(k>0){
			k=(k-1)/2;
			dat[k]=max(dat[k*2+1],dat[k*2+2]);
		}
	}

	int subquery(int a,int b,int k,int l,int r){
		if(r<=a||b<=l)return 0;
		if(a<=l&&r<=b)return dat[k];
		else{
			return max(subquery(a,b,k*2+1,l,(l+r)/2),subquery(a,b,k*2+2,(l+r)/2,r));
		}
	}
	int query(int a,int b){
		return subquery(a,b,0,0,size);
	}
};

RangeMaxQuery rmaxq;
RangeMinQuery rminq;

int n,d;
int m[111];
int c[111][1111];

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>n>>d;
		if(n==0)break;
		rminq.init(n);
		rmaxq.init(n);
		int mcnt=0;
		rep(i,n){
			cin>>m[i];
			c[i][0]=0;
			int sum=0;
			mcnt+=m[i];
			repl(j,1,m[i]+1){
				int cc;
				cin>>cc;
				sum+=cc;
				c[i][j]=sum;
			}
			rminq.update(i,c[i][m[i]]);
			rmaxq.update(i,c[i][m[i]]);
		}

		bool ok;
		while(mcnt){
			ok=false;
			rep(i,n){
				if(m[i]==0)continue;
				rminq.update(i,c[i][m[i]-1]);
				rmaxq.update(i,c[i][m[i]-1]);
				if(rmaxq.query(0,n)-rminq.query(0,n)<=d){
					m[i]--;
					mcnt--;
					ok=true;
					break;
				}else{
					rminq.update(i,c[i][m[i]]);
					rmaxq.update(i,c[i][m[i]]);
				}
			}
			if(!ok)break;
		}
		if(mcnt==0)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef long double ld;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  ll A,B,N; cin>>N>>A>>B;
  cout << max(0LL, B*(N-2) - A*(N-2) +1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int N = 100;
int A[N][N] = {{0}};
int n;
int t = 0;
int d[N] = {0};
int f[N] = {0};

void dfs(int id) {
    // cerr << "begin: " <<  id << " " << t << endl;
    if (d[id] != 0) {
        return;
    }
    ++t;
    d[id] = t;

    for (int i = 0; i < n; ++i) {
        if (A[id][i] != 0) {
            dfs(i);
        }
    }

    // cerr << "end: " <<  id << " " << t << endl;
    if (f[id] == 0) {
        ++t;
        f[id] = t;
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int u;
        cin >> u;

        int k;
        cin >> k;
        for (int j = 0; j < k; ++j) {
            int x;
            cin >> x;
            A[u-1][x-1] = 1;
        }
    }

    for (int i = 0; i < n; ++i) {
        if (d[i] == 0)
            dfs(i);
    }


    for (int i = 0; i < n; ++i) {
        cout << i + 1 << " ";
        cout << d[i] << " " << f[i];
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3132
#include <stdio.h>

int main()
{
	int last = 4280,now;
	int cost;

	scanf("%d",&now);

	while(now >= 0){
		cost = 1150;
		
		while(30 < now){
			cost += 160;
			now--;
		}
		while(20 < now){
			cost += 140;
			now--;
		}
		while(10 < now){
			cost += 125;
			now--;
		}

		printf("%d\n",last-cost);

		scanf("%d",&now);
	}


	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>

typedef long long ll;

#define pb push_back
#define mp make_pair
#define rep(i, s, n) for(ll i=s;i<n;i++)
#define repeq(i,s,n) for(ll i=s;i<=n;i++)
#define MOD (ll)10e9+7

template<typename T>
void max_self(T& a, T b) { a=a>b?a:b; }
template<typename T>
void min_self(T& a, T b) { a=a<b?a:b; }

using namespace std;

ll n;
ll a, b;


int main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);


    cin >> a >> b;

    cout << (a*b)/__gcd(a,b) << endl;
    

    return 0;

}


Measured memory_bytes: 384
use std::io;
use std::str::FromStr;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {

    from_line!(n: i32);

    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());

    let v: Vec<i64> = buf.split_whitespace()
        .map(|n| i64::from_str(n).unwrap())
        .collect();

    let mut max = -1000000;
    let mut min = 1000000;
    let mut sum = 0;
    for i in v {
        if i < min {
            min = i;
        }
        if i > max {
            max = i;
        }
        sum += i;
    }
    println!("{} {} {}", min, max, sum);
}



Measured memory_bytes: 5040
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(int argc, char *argv[])
{
	int cubic;
	char str[256];
	char buf[256];
	char buf2[256];
	long height;
	long width;
	int i;
	int k;
	fgets(str, 256, stdin);
	
	i = 0;
	k = 0;
	while(str[i]!=' ')
	{
		buf[i] = str[i];
		i++;
	}
	height = atoi(buf);


	while(str[i]!='\0')
	{
		buf2[k] = str[i];
		i++;
		k++;
	}
	width = atoi(buf2);

	printf("%ld %ld\n", height*width, (2*(height+width)));
	return 0;
}

Measured memory_bytes: 532
#include<stdio.h>

int main()
{
  int x, y, n;
  while(1){
    scanf("%d %d", &x, &y);
    if(x == 0 && y == 0){
      break;
    }
   if(x > y){
      n = x;
      x = y;
      y = n;
      }
    printf("%d %d\n", x, y);
  }
  return 0;
}

Measured memory_bytes: 600
import java.util.*;
class Main{
  public static void main(String[]args){
    Scanner s=new Scanner(System.in);
   while(s.hasNext()) {
   String[] line = s.nextLine().split(" ");
   int a = Integer.parseInt(line[0]);
   int b = Integer.parseInt(line[1]);
   System.out.println(gcd(a,b));
   }
  }

  public static int gcd(int a, int b) {
  if(b == 0) return a;
  else return gcd(b, a%b);
  }
}

Measured memory_bytes: 17340
#include <bits/stdc++.h>
using namespace std;

#define ll long long

signed main()
{
  int n,k; cin >> n >> k;
  vector<int> p(n);
  for(int i=0; i<n; ++i) cin >> p[i];
  sort(p.begin(), p.end());

  int sum=0;
  for(int i=0; i<k; ++i) sum+=p[i];
  cout << sum;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	int a,b,c;
	int i,j,k,l;
	int x[1000][3],Xcnt;
	int abc[3];
	int flg;

	cin>>n;
	
	cin>>a>>b>>c;
	abc[0]=a,abc[1]=b,abc[2]=c;
	sort(abc,abc+3);
	/*cout<<"abc=";
	for(k=0;k<3;k++) cout<<abc[k]<<" ";
	cout<<endl;*/
	for(l=0;l<3;l++) x[Xcnt][l]=abc[l];
	Xcnt=1;
	
	for(i=1;i<n;i++){
		cin>>a>>b>>c;
		abc[0]=a,abc[1]=b,abc[2]=c;
		sort(abc,abc+3);
		
		/*cout<<"abc=";
		for(k=0;k<3;k++) cout<<abc[k]<<" ";
		cout<<endl;*/
		
		for(j=0;j<Xcnt;j++){
			flg=0;
			for(k=0;k<3;k++){
				if(abc[k]!=x[j][k]) break;
				else if(k==2) flg=1;
			}
			if(flg==1) break;
			if(j==Xcnt-1){
				for(l=0;l<3;l++) x[Xcnt][l]=abc[l];
				Xcnt++;
				break;
			}
			
		}
	}
	
	cout<<n-Xcnt<<endl;
	
	return 0;
}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
#include<iostream>

using namespace std;

int main()
{
    string a;
    cin>>a;
    if(a[2]==a[3] && a[4]==a[5])
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
#define ll long long
#define mod 998244353
using namespace std;
int n,m;
int a[1000010],b[1000010],t[10];
ll ans=1ll;
char s[1000010];
queue<int>q[5];
inline int read(){
	int ans=0,k=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')k=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=(ans<<3)+(ans<<1)+(c-'0');c=getchar();}
	return ans*k;
}
int main(){
	scanf("%d%s",&n,s);
	m=n*3;
	for(register int i=0;i<m;i++){
		if(s[i]=='R'){
			a[i]=1;
			q[1].push(i);
		}
		else if(s[i]=='G'){
			a[i]=2;
			q[2].push(i);
		}
		else{
			a[i]=3;
			q[3].push(i);
		}
	}
	for(register int i=1;i<=n;i++){
		t[1]=q[1].front();
		t[2]=q[2].front();
		t[3]=q[3].front();
		q[1].pop();q[2].pop();q[3].pop();
		sort(t+1,t+4);
		for(register int j=1;j<=3;j++){
			b[t[j]]=j;
		}
	}
	ll t0=n,t1=0,t2=0;
	for(register int i=0;i<m;i++){
		if(b[i]==1){
			ans=ans*t0%mod;
			t0--;t1++;
		}
		else if(b[i]==2){
			ans=ans*t1%mod;
			t1--;t2++;
		}
		else{
			ans=ans*t2%mod;
			t2--;
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;

int s[100][100];
char c;
int dp[100][100];

int main(){
    int H,W;
    cin>>H>>W;
    rep(i,H)rep(j,W){
        cin>>c;
        s[i][j]=(c=='#')?1:0;  
    }
    int count=0;
    dp[0][0]=(s[0][0]==1)?1:0;
    rep(i,H)rep(j,W){
        if(i==0 && j==0){
            dp[0][0]=s[0][0];
        }
        else if(i==0){
            dp[i][j]=dp[i][j-1];
            if(s[i][j]==1 &&s[i][j-1]==0)dp[i][j]=dp[i][j-1]+s[i][j];
        }
        else if(j==0){
            dp[i][j]=dp[i-1][j];
            if(s[i][j]==1 &&s[i-1][j]==0)dp[i][j]=dp[i-1][j]+s[i][j];
        }
        else{
            int a=(s[i][j]==1 &&s[i][j-1]==0)?1:0;
            int b=(s[i][j]==1 &&s[i-1][j]==0)?1:0;
            if(dp[i-1][j]+b>dp[i][j-1]+a)dp[i][j]=dp[i][j-1]+a;
            else{
                dp[i][j]=dp[i-1][j]+b;
            }
        }
    }
    cout<<dp[H-1][W-1]<<endl;



    return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;

int main(){
	int h, r;
	cin >> h >> r;
	if(h+r<0) cout << -1 << endl;
	else if(h+r==0) cout << 0 << endl;
	else if(h+r>0) cout << 1 << endl;
	return 0;
}


Measured memory_bytes: 3096
N = int(input())
X = list(map(int, input().split()))

p_max = 100
ans_min = 1000000 # 最大でも(100 - 1) ** 2 * 100だからそれを超えればいい
for p in range(1, p_max):
    sum_ = 0
    for x in X:
        sum_ += (x - p) ** 2
    ans_min = min(sum_, ans_min)
print(ans_min)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }






int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    /*
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    */
    
    
    string s;
    cin >> s;
    string t = s;
    reverse(all(t));
    
    int c = 0;
    rep(i, sz(s) / 2) if (s[i] != t[i]) c++;
    cout << c << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);

  char s[n];
  scanf("%s",s);

  int count=0;
  int ans=0;

  for(int i=0 ; i<n ; i++){
    if(s[i]=='I') count++;
    if(s[i]=='D') count--;

    if(ans<count) ans = count;
  }

  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int a;
  scanf("%d",&a);
  int b=a/100,c=a%100;
  if((b==0||b>12)&&(c==0||c>12)){
    printf("NA");
  }else if(b==0||b>12){
    printf("YYMM");
  }else if(c==0||c>12){
    printf("MMYY");
  }else{
    printf("AMBIGUOUS");
  }
  return 0;}

Measured memory_bytes: 128
#include <iostream>
#include <string>

using namespace std;
 
int main(){
    int n,nm[100];
     
    while(true){
        string first = "0000000";
         
        cin >> n;
        if(n == -1) break;
         
        for(int i = 0 ; i < n ; i++){
            cin >> nm[i];
             
            string str;
            switch(nm[i]){
	    case 0:
		str = "0111111";
		break;
	    case 1:
		str = "0000110";
		break;
	    case 2:
		str = "1011011";
		break;
	    case 3:
		str = "1001111";
		break;
	    case 4:
		str = "1100110";
		break;
	    case 5:
		str = "1101101";
		break;
	    case 6:
		str = "1111101";
		break;
	    case 7:
		str = "0100111";
		break;
	    case 8:
		str = "1111111";
		break;
	    case 9:
		str = "1101111";
		break;
            }
            string ans = "";
            for(int j = 0 ; j < 7 ; j++){
                if(first[j]!= str[j]) ans += '1';
                else ans += '0';
            }
            cout << ans << endl;
            first = str;
        }
    }
    return 0;
}

Measured memory_bytes: 3036
program money
    implicit none
    integer(8) x, i, money1, money2, r, flag
    read(*,*) x
    flag=0
    i=0
    money1=100
    r=100
    do while (flag==0)
        if ( money1>=x ) then
            flag=1
        else
            money2=money1+money1/100
            money1=money2
            i=i+1
        end if
    end do
    write(*,*) i
end program money

Measured memory_bytes: 2860
using System;
using System.Linq;

namespace T1PBC2018
{
    class C
    {
        static void Main(string[] args)
        {
            //input, N, A
            int N = int.Parse(Console.ReadLine());
            int[] A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(Console.ReadLine());
            }
            //Aを降順でソートする
            A = A.OrderByDescending(x => x).ToArray();

            if (N % 2 == 0)
            {
                long res = 0;
                for (int i = 0; i < N / 2 - 1; i++)
                {
                    res += A[i] * 2;
                }
                res += A[N / 2 - 1] * 1;
                res += A[N / 2] * -1;
                for (int i = N / 2 + 1; i < N; i++)
                {
                    res += A[i] * -2;
                }
                Console.WriteLine(res);
            }
            else
            {
                long res1 = 0;
                long res2 = 0;
                for (int i = 0; i < N / 2 - 1; i++)
                {
                    res1 += A[i] * 2;
                }
                res1 += A[N / 2 - 1] * 1;
                res1 += A[N / 2] * 1;
                for (int i = N / 2 + 1; i < N; i++)
                {
                    res1 += A[i] * -2;
                }

                for (int i = 0; i < N / 2; i++)
                {
                    res2 += A[i] * 2;
                }
                res2 += A[N / 2] * -1;
                res2 += A[N / 2 + 1] * -1;
                for (int i = N / 2 + 2; i < N; i++)
                {
                    res2 += A[i] * -2;
                }

                Console.WriteLine(Math.Max(res1, res2));

            }

        }
    }
}

Measured memory_bytes: 20316
#include<stdio.h>
int main(void)
{
	int n,m,d,a=0,x=0,i,j;
	char s[100][100];
	scanf("%d %d %d", &n, &m, &d);
	for(i=0; i<n; i++)
	scanf("%s", &s[i]);
	for(i=0; i<n; i++)
	{
		for(j=0; j<m; j++)
		{
			if(s[i][j]=='.')
			a++;
			if(s[i][j]=='#'||j==m-1)
			{
				if(a>=d)
				x+=a-d+1;
				a=0;
			}
		}
	}
	a=0;
	for(i=0; i<m; i++)
	{
		for(j=0; j<n; j++)
		{
			if(s[j][i]=='.')
			a++;
			if(s[j][i]=='#'||j==n-1)
			{
				if(a>=d)
				x+=a-d+1;
				a=0;
			}
		}
	}
	printf("%d\n", x);
	
	return 0;
}


Measured memory_bytes: 2100
#include <stdio.h>
int main(void)
{
	char x,y,z;
	int X,Y,Z,i;
	scanf("%c\n%c",&x,&y);
	z=x;
	for(i=1; i<=2; i++){
		if(z=='A'){
			Z=10;
		}else if(z=='B'){
			Z=11;
		}else if(z=='C'){
			Z=12;
		}else if(z=='D'){
			Z=13;
		}else if(z=='E'){
			Z=14;
		}else if(z=='F'){
			Z=15;
		}
		if(i==1){
			X=Z;
			z=y;
		}else{
			Y=Z;
		}
	}
	if(X<Y){
		printf("<\n");
	}else if(X>Y){
		printf(">\n");
	}else{
		printf("=\n");
	}
	return 0;
}

Measured memory_bytes: 128
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        a: i64,
        b: i64,
    }
    let mut i = 0;
    let mut a = a;
    let mut b = b;
    if a > b {
        i += a;
        a-=1;
    } else {
        i +=b;
        b-=1;
    }
    if a > b {
        i += a;
    } else {
        i +=b;
    }
    println!("{}", i);
}

Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
	int a,b;
	char op;
	while(cin>>a>>op>>b){
		if(op=='?') break;
		if(op=='+') cout<<a+b<<endl;
		else if(op=='-') cout<<a-b<<endl;
		else if(op=='*') cout<<a*b<<endl;
		else if(op=='/') cout<<a/b<<endl;
	}
	return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;


int main(){
    ll N, W;
    cin >> N >> W;
    vll val(N+1); vll wei(N+1);
    for(int i=1; i<N+1; i++){
        cin >> val[i] >> wei[i];
    }
    ll dp[N+1][W+1];
    for(int i=0; i<N+1; i++){
      dp[i][0] = 0;
    }
    for(int i=0; i<W+1; i++){
      dp[0][i] = 0;
    }
    for(int i=1; i<N+1; i++){
      for(int w=1; w<W+1; w++){
          if(wei[i] > w){dp[i][w] = dp[i-1][w];}
          else{dp[i][w] = max(dp[i-1][w-wei[i]]+val[i], dp[i-1][w]);}
      }
    }
    cout << dp[N][W] << endl;
}


Measured memory_bytes: 10972
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  
  int count = 0;

 for ( int i = 0; i< N; i++ ) {
  if (i == 0 ) count = K;
  else {
   count *= ( K - 1 );
  }
 }
  
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
using namespace std;

const int MX = 10000000;
bool sieve[MX];

int main() {
    memset(sieve, false, sizeof sieve);
    sieve[0] = sieve[1] = true;
    for (int i=2; i*i<MX; ++i) {
        if ( ! sieve[i]) {
            for (int j=i*i; j<MX; j+=i) {
                sieve[j] = true;
            }
        }
    }
    int n;
    while (cin >> n) {
        int l, h;
        for (int i=n-1; ; --i) {
            if ( ! sieve[i]) {
                l = i; break;
            }
        }
        for (int i=n+1; ; ++i) {
            if ( ! sieve[i]) {
                h = i; break;
            }
        }
        cout << l << " " << h << endl;
    }
    return 0;
}

Measured memory_bytes: 10932
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n; string s; read(n, s);

	int mindeg = 0;

	{
		int deg = 0;
		for (char c : s) {
			if (c == '(') deg++;
			else deg--;
			mindeg = min(mindeg, deg);
		}
		
		string res;
		for (int i = 0; i < -mindeg; i++)
			res += '(';
		res += s;
		for (int i = 0; i < deg - mindeg; i++)
			res += ')';
	
		die(res);
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
using ll = long long;

template <int M, bool IsPrime = false> class Modulo {
  int n;
  static typename std::enable_if<IsPrime, ll>::type inv(ll a, ll p) {
    return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
  }

public:
  Modulo() : n(0) { ; }
  Modulo(int m) : n(m) {
    if (n >= M)
      n %= M;
    else if (n < 0)
      n = (n % M + M) % M;
  }
  Modulo(ll m) {
    if (m >= M)
      m %= M;
    else if (m < 0)
      m = (m % M + M) % M;
    n = m;
  }
  explicit operator int() const { return n; }
  explicit operator ll() const { return n; }
  bool operator==(const Modulo &a) const { return n == a.n; }
  Modulo &operator+=(const Modulo &a) {
    n += a.n;
    if (n >= M) n -= M;
    return *this;
  }
  Modulo &operator-=(const Modulo &a) {
    n -= a.n;
    if (n < 0) n += M;
    return *this;
  }
  Modulo &operator*=(const Modulo &a) {
    n = (ll(n) * a.n) % M;
    return *this;
  }
  Modulo operator+(const Modulo &a) const {
    Modulo res = *this;
    return res += a;
  }
  Modulo operator-(const Modulo &a) const {
    Modulo res = *this;
    return res -= a;
  }
  Modulo operator-() const { return Modulo(0) - *this; }
  Modulo operator*(const Modulo &a) const {
    Modulo res = *this;
    return res *= a;
  }

  Modulo operator^(ll m) const {
    if (m == 0) return Modulo(1);
    const Modulo a = *this;
    Modulo res = (a * a) ^ (m / 2);
    return m % 2 ? res * a : res;
  }
  typename std::enable_if<IsPrime, Modulo>::type
  operator/(const Modulo &a) const {
    return *this * inv(ll(a), M);
  }
  typename std::enable_if<IsPrime, Modulo>::type operator/=(const Modulo &a) {
    return *this *= inv(ll(a), M);
  }

  friend bool is_zero(const Modulo &x) { return int(x) == 0; }
  friend int abs(const Modulo &x) { return int(x); }

  static Modulo fact(int n, bool sw = true) {
    static std::vector<Modulo> v1 = { 1 }, v2 = { 1 };
    if (n >= (int)v1.size()) {
      const int from = v1.size(), to = n + 1024;
      v1.reserve(to);
      v2.reserve(to);
      for (int i = from; i < to; ++i) {
        v1.push_back(v1.back() * Modulo<M, true>(i));
        v2.push_back(v2.back() / Modulo<M, true>(i));
      }
    }
    return sw ? v1[n] : v2[n];
  }
  static Modulo comb(int a, int b) {
    if (b < 0 || b > a) return 0;
    return Modulo::fact(a, true) * Modulo::fact(b, false) *
           Modulo::fact(a - b, false);
  }
};
using Mod = Modulo<1000000007, true>;

int main(void)
{
  ll n,a,b,c;
  cin >> n >> a >> b >> c;
  Mod tmp = 0;
  for(ll i=n-1;i>=0;--i) {
    tmp += Mod::comb(n-1+i,i) * (n+i)
      * ((Mod(a)^n)*(Mod(b)^i)
         + (Mod(b)^n)*(Mod(a)^i))
      / (Mod(a+b)^n+i);
  }
  tmp *= 100;
  tmp /= a+b;
  cout << (ll)tmp << endl;
  return 0;
}


Measured memory_bytes: 1800
#include <stdio.h>
int main(void){
    int n,sum=100000;
    
    scanf("%d",&n);
    
    for(int i=1;i<=n;i++){
        sum*=1.05;
        if(sum%1000>=1){
            sum=sum-(sum%1000)+1000;
        }
    }
    printf("%d\n",sum);
    return(0);
}



Measured memory_bytes: 2036
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;

int n,k;

int main(){
	cin >> n >> k;
	
	ll c = n/k;
	if(k % 2){
		cout << c * c * c << endl;
	}
	else{
		c *= c*c;
		ll d = 0;
		for(int i = k/2; i <= n; i+=k){
			d++;
		}
		d *= d*d;
		cout << d + c << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
dl = []
a_l = []
for i in range(k):
  d = int(input())
  dl.append(k)
  a = list(map(int, input().split()))
  a_l.append(a)

an = []
for i in a_l:
  for j in i:
    if j not in an:
      an.append(j)
print(n - len(an))

Measured memory_bytes: 9080
import numpy as np
N,M,C = map(int,input().split())

B = np.array(input().split(), dtype=np.int32)
A = np.array([input().split() for _ in range(N)], dtype=np.int32)

answer = (((A*B).sum(axis = 1) + C) > 0).sum()
print(answer)

Measured memory_bytes: 12428
import java.util.Scanner;
import java.math.BigDecimal;

public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
 

		if (b % 2 == 1 || a * 4 < b || a * 2 > b) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 35704
h, w = gets.split.map(&:to_i)
cm = Array.new(h + 2){Array.new(w + 2, 0)}
que = []
1.upto(h) do |i|
  s = gets.chomp
  1.upto(w) do |j|
    if s[j - 1] == '.'
      cm[i][j] = -1
    else
      que.push(i)
      que.push(j)
      cm[i][j] = 0
    end
  end
end
while que.size > 0
  y = que.shift
  x = que.shift
  if cm[y + 1][x] == -1
    cm[y + 1][x] = cm[y][x] + 1
    que.push(y + 1)
    que.push(x)
  end
  if cm[y - 1][x] == -1
    cm[y - 1][x] = cm[y][x] + 1
    que.push(y - 1)
    que.push(x)
  end
  if cm[y][x + 1] == -1
    cm[y][x + 1] = cm[y][x] + 1
    que.push(y)
    que.push(x + 1)
  end
  if cm[y][x - 1] == -1
    cm[y][x - 1] = cm[y][x] + 1
    que.push(y)
    que.push(x - 1)
  end
end
puts cm.flatten.max

Measured memory_bytes: 35068
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S=in<string>();
	int maxN = 8;
	for(int i=0;i<maxN;i++){
		ll sum = S[0]-'0';
		int v = i;
		for(int j=1;j<S.size();j++){
			ll t = S[j]-'0';
			if(v&1){
				sum += t;
			}
			else{
				sum -= t;
			}
			v >>= 1;
		}
		if(sum==7){
			v = i;
			cout << S[0];
			for(int j=0;j<3;j++){
				cout << (v&1 ? '+' : '-');
				cout << S[j+1];
				v>>=1;
			}
			cout << "=7" << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
  p.sort()
else:
  p = []
  print(x)
a = 0
for i in range(n):
  if p.count(x - i) == 0 or p.count(x + i) == 0:
    if p.count(x - i) == 0:
      print(x - i)
    else:
      print(x + i)
    a += 1
    break

if n == 1 and a == 0:
  if p[0] == x:
    print(x - 1)
  else:
    print(x)

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;

int main(void) {
	int N, K;
	cin >> N >> K;
	int x = 1;
	for (int i = 0; i < N; i++) {
		x = min (x * 2, x + K);
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}
	int i = 0;
	int count = 0;
	while (i != 1) {
		if (count >= n) {
			count = -1;
			break;
		}
		i = a[i];
		count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 640
//
#include <bits/stdc++.h>

#define endl '\n'
using namespace std;
using ll = long long;

const int N = 3003;

bool vis[N][N];
int n;
ll arr[N];
ll dp[N][N];

void init();
void process();

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    init();
    process();
    cout.flush();
    return 0;
}

void init()
{
    cin >> n;
    for(int i = 0; i < n; i++) cin >> arr[i];
}

ll f(int l, int r, bool first)
{
    if(vis[l][r]) return dp[l][r];
    if(l == r) dp[l][r] = (first? 1 : -1) * arr[l];
    else if(first == true)
    {
        dp[l][r] = max(f(l+1, r, false) + arr[l], f(l, r-1, false) + arr[r]);
    }
    else
    {
        dp[l][r] = min(f(l+1, r, true) - arr[l], f(l, r-1, true) - arr[r]);
    }
    vis[l][r] = true;
    return dp[l][r];
}

void process()
{
    cout << f(0, n-1, true) << endl;
}



Measured memory_bytes: 79744
#include <bits/stdc++.h>
using namespace std;

int N, M;

int main()
{
    cin >> N >> M;
    vector<int> a(N+1, 0); 
    for (int i=0; i<M; i++)
    {
        int s, t;
        cin >> s >> t;
        if (s == 1) a[t] |= 1;
        if (t == N) a[s] |= 2;
    }
    for (auto i : a) if (i == 3)
    {
        cout << "POSSIBLE" << endl;
        return 0;
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        boolean ok = false;
        if (b % a == 0) {
            ok = true;
        }
        if (ok) {
            System.out.println(a + b);
            return;
        }
        System.out.println(b - a);
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>

using namespace std;



int main() {

	int n;
	cin >> n;
	int a[100001] = {};
	int b[100000] = {};
	long long int cnt = 0;
	long long int ans = 0;
	for (int i = 0; i < n + 1; i++) {
		cin >> a[i];
		cnt += a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	int c;
	for (int i = 0; i < n; i++) {
		if (a[i] > 0) {
			if (b[i] - a[i] >= 0) {
				c = a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			else {
				a[i] -= b[i];
				b[i] = 0;
			}
		}
		if (a[i + 1] > 0) {
			if (b[i] - a[i + 1] >= 0) {
				c = a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
			else {
				a[i + 1] -= b[i];
				b[i] = 0;
			}
		}
	}
	for (int i = 0; i < n + 1; i++) {
		ans += a[i];
	}
	cout << (cnt - ans) << endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;

int main()
{
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif*/
string s;
cin>>s;
bool flag=false;
for(long long i=0;i<s.size();i++)
{	//cout<<s[i]<<" ";
	if(i%2 ==0)
	{
		if(s[i]=='R'||s[i]=='U'||s[i]=='D')
			flag=true;
		else
			{//cout<<i;
				flag=false;
				break;
			}
	}
	else
	{
		if(s[i]=='L'||s[i]=='U'||s[i]=='D')
			flag=true;
		else
			{	//cout<<i;
				flag=false;
				break;
			}
	}
}
if(flag==true)
	cout<<"Yes";
else
	cout<<"No";


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
map<int,int>mp;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,L,N,M,K,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> M;
  Vec(P,lli,N,0);
  DV(Q,lli,N,0,0);
  rep(i,0,N)cin >> P[i];
  rep(i,0,M){
    cin >> A >> B;
    Q[A-1].pb(B-1);
    Q[B-1].pb(A-1);
  }
  rep(i,0,N){
    flag=1;
    for(auto v:Q[i])if(P[v]>=P[i])flag=0;
    sum+=flag;
  }
  Out(sum);
}

Measured memory_bytes: 9772
#include <vector>
#include <iostream>

int main(){
	using std::cin;
	int n,m;
	
	std::vector<std::string> blue,red;

	scanf("%d\n",&n);
  	blue.resize(n);
	for(int i=0; i<n; i++)
		cin>>blue[i];
  
	scanf("%d\n",&m);
  	red.resize(m);
	for(int i=0; i<m; i++)
		cin>>red[i];
	
  	int r=0;
    for(int i=0; i<n-1; i++){
        int count = 1;
        for(int j=i+1; j<n; j++){
            if(blue[i]==blue[j]) ++count;
        }
        for(int k=0; k<m; k++){
            if(blue[i]==red[k]) --count;
        }
        r = std::max(r,count);
    }

    printf("%d\n",r);

    return 0;
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

int main() {
  double L;
  cin >> L;
  cout << fixed << setprecision(6);
  cout << L*L*L/27 << endl;
}

Measured memory_bytes: 256
K, S = map(int, input().split())

# 各ケースごとに格子点の個数を求める
if 0 <= S <= K:
    print(int((S+1)*(S+2)/2))
elif K < S <= 2*K:
    print(int((K+1)**2 - (2*K-S)*(2*K-S+1)/2 - (S-K)*(S-K+1)/2))
else:
    print(int((3*K-S+1)*(3*K-S+2)/2))

Measured memory_bytes: 3060
eat_num = gets.to_i
eat_j = gets.split.map(&:to_i)
m = gets.split.map(&:to_i)
m2 = gets.split.map(&:to_i)

total = 0
pre_j = 0
eat_j.each do |i|
  total += m[i - 1]
  total += m2[i -2] if pre_j == (i - 1) && i != 1
  pre_j = i
end
puts total


Measured memory_bytes: 1788
#include <stdio.h>
#include <string>
#include <iostream>

using namespace std;

/**
 * abc_136_3
 */
void abc_136_c() {
  // 入力を受け取る
  int n;
  scanf("%d", &n);

  int h[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &h[i]);
  }

  // 各マスを左から見ていき右隣のマスより2以上大きければNo
  // 1大きければ減らしたあと、左のマス以上の値であるかを確認し、そうでなければNo
  // 等しければ
  // それいがいはYes
  string result = "Yes";
  if (n == 1) {
    printf("%s\n", result.c_str());
    return;
  }
  for (int i = 0; i < n - 1; i++) {
    if (h[i] - 1 > h[i + 1]) {
      result = "No";
      printf("%s\n", result.c_str());
      return;
    } else if (h[i] - 1 == h[i + 1]) {
      h[i] = h[i] - 1;
      if (i != 0 && h[i - 1] > h[i]) {
        result = "No";
        printf("%s\n", result.c_str());
        return;
      }
    } else {
      if (i != 0 && h[i - 1] < h[i]) {
        h[i]--;
      }
    }
  }
  printf("%s\n", result.c_str());
}

int main() {
  abc_136_c();
  /*
  int n;
  scanf("%d", &n);

  int count = 0;
  for (int i = 1; i <= n; i++) {
    if (std::to_string(i).length() % 2 == 1) {
      count++;
    }
  }
  printf("%d\n", count);
  */

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>

int main(){
    int n;
    cin >> n;
    ll a=2, b=1, c;

    if(n==1){
        cout << 1; 
        return 0;
    }

    for(ll i=3; i<=n; ++i){
        c=a+b;
        a = b;
        b = c;
    }

    cout << a+b;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int n,a[3010];
long long dp[3010][3010];
long long s[3010];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		s[i]=s[i-1]+a[i];
	for(int i=1;i<=n;i++)
		dp[i][i]=a[i];
	for(int i=1;i<n;i++)
		for(int j=1;i+j<=n;j++){
			long long a1=a[j]+s[i+j]-s[j]-dp[j+1][i+j];
			long long a2=a[i+j]+s[i+j-1]-s[j-1]-dp[j][i+j-1];
			dp[j][i+j]=max(a1,a2);
		}
	cout<<2*dp[1][n]-s[n];
	return 0;
}

Measured memory_bytes: 70016
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	int N, K;
	cin >> N >> K;
	vector<int> p(N);
	REP(i, N){
		cin >> p[i];
	}
	sort(ALL(p));
	int ans = 0;
	REP(i, K){
		ans += p[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3616
function Main(input) {
	const lines = input.split('\n');
	const bricks = lines[1].split(' ').map(v => v*1);

	let idx = 0, cnt = 0;
	bricks.forEach((a) => {
		if (a === idx + 1) idx++;
		else cnt++;
	});

	console.log(idx == 0 ? -1: cnt );
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22244
h,w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
i = 0
j = 0
k = 0
l = 0
ans = []
n = 1
while n < h*w:
    k += 2*((j+1)%2)-1
    if k == w or k == -1:
        k -= (k+abs(k))//k-1
        l += 1
    if a[j][i]%2 == 1:
        a[l][k] += 1
        ans.append([j+1,i+1,l+1,k+1])
    i = k
    j = l
    n += 1
print(len(ans))
for i in ans:
    for j in range(3):
        print(i[j], end = " ")
    print(i[-1])

Measured memory_bytes: 31240