akhauriyash/Code-Regression huggingface dataset:
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

bool pal(string s){
	int n = s.size();
	if(n  & 1)return false;
	n/=2;
	string s1 = s.substr(0,n);
	string s2 = s.substr(n,n);
	return s1 == s2; 

}

int main(){
	
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(pal(s)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}


	

	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<(n);i++)
typedef long long ll;

ll gcd(ll a, ll b){
    if(a<b) swap(a,b);
    if(a%b == 0) return b;
    else return gcd(b,a%b);
}

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ans = a*c;
    ans = max(ans,a*d);
    ans = max(ans,b*c);
    ans = max(ans,b*d);
    cout << ans << endl;
}

Measured memory_bytes: 3632
use proconio::input;
use std::cmp::Reverse;
use std::collections::BinaryHeap;

const INF_LL: usize = 1_000_000_000_000_000_000;

fn main() {
  input! {
    n: usize,
    m: usize,
    s: usize,
    edge: [(usize, usize, usize, usize); m],
    ex: [(usize, usize); n],
  }
  let mut d = vec![vec![INF_LL as i64; 2501]; n];
  let mut g = vec![vec![Vec::<(i64, usize, usize)>::new(); 2501]; n];
  d[0][std::cmp::min(s, 2500)] = 0;
  for i in 0..m {
    let (mut u, mut v, a, b) = edge[i];
    u -= 1; v -= 1;
    for j in a..2501 {
      g[u][j].push((b as i64, v, j-a));
      g[v][j].push((b as i64, u, j-a));
    }
  }
  for i in 0..n {
    let (c, d) = ex[i];
    for j in 0..2501 {
        let nxt = std::cmp::min(j + c, 2500);
        g[i][j].push((d as i64, i, nxt));
    }
  }

  let mut heap = BinaryHeap::new();
  heap.push((0 as i64, 0, std::cmp::min(s, 2500)));

  while let Some((mut dd, vv, cc)) = heap.pop() {
    dd *= -1;
    if d[vv][cc] < dd {
      continue;
    }
    for &(dis, u, s) in g[vv][cc].iter() {
      if dd + dis < d[u][s] {
        d[u][s] = dd + dis;
        heap.push((-d[u][s], u, s));
      }
    }
  }

  for i in 1..n {
    let mut res: i64 = INF_LL as i64;
    for &r in d[i].iter() {
      res = std::cmp::min(res, r);
    }
    println!("{}", res);
  }
}

Measured memory_bytes: 28964
import java.util.*;


public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] s = S.toCharArray();
		int n = S.length();
		boolean OK = true;
			int i = 0;
			int j = (n-1)/2-1;
			while(j-i>=1) {
				if(s[i]==s[j] && s[n-1-i]==s[n-1-j]) {
				i++;
				j--;
				
				} 
				else {
					OK = false;
					break;
				}
			}
			for(int k = 0; k < n/2; k++) {
				if(s[k]!=s[n-1-k]) {
					OK = false;
					break;
				}
			}
		System.out.println(OK?"Yes":"No");
	}
}

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

using namespace std;

int main(){
    vector<int>Times(101,0);
    int x;
    while(cin >> x){
      Times[x]+=1;
    }
    
    int ma =-1;
    for(int x=1; x<=100; x++){
        if(ma<Times[x]) ma=Times[x];
    }
     
    for(int x=1; x<=100; x++){
        if(Times[x] == ma) cout << x << endl;
    } 
    return 0;
}


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

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

int main() {
	string s;
	cin >> s;

	rep(i,s.size()) {
		if (s[i] == '?') cout << 'D';
		else cout << s[i];
	}
	return 0;
} 

Measured memory_bytes: 3752
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// solution 
use std::cmp;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        M: usize,
    }
    println!("{}", (1<<M)*(1900*M+100*(N-M)));
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)


int main() {
	int a, b;
	cin >> a >> b;
	if (b == 1)cout << 0;
	else cout << a - b;
	return 0;
}

	

Measured memory_bytes: 256
ABCD=input()
digits=3
ops=[""]*(digits+1)
for i in range(1<<digits):
    for j in range(digits):
        if (i>>j)&1:
            ops[j]="+"
        else:
            ops[j]="-"
    evals=""
    for num,op in zip(ABCD,ops):
        evals+=num+op
    if eval(evals)==7:
        print(evals+"=7")
        break

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = sc.nextInt();
		int D = sc.nextInt();
		int k = D/10;
		int ans = 0;
		for(int m = 1; m<=M;m++ ) {
			for(int j = 2; j <=k; j++) {
				for(int i = 2; i <=9; i++) {

					if((i*j == m) &&((j*10+i)<=D)) {
						//System.out.println(m+"="+i+"*"+j);
						ans++;
					}
				}
			}
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 21588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <unordered_set>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll m, n;
    cin >> m >> n;
    
    vector<vector<int>> vec(m,vector<int>(n, 0));
    for(int i= 0; i<m;i++){
        for(int j = 0;j<n;j++){
            char x;
            cin >> x;
            vec[i][j] = x;
        }
    }
    
    vector<vector<int>> dp(m,vector<int>(n, 0));
    
    dp[0][0] = (vec[0][0] == '#');
    
    for(int i = 1;i<n;i++){
        dp[0][i] = dp[0][i-1] + (vec[0][i-1] == '.' && vec[0][i] == '#');
    }
    
    for(int i = 1;i<m;i++){
        dp[i][0] = dp[i-1][0] + (vec[i-1][0] == '.' && vec[i][0] == '#');
    }
    
    for(int i= 1; i<m;i++){
        for(int j = 1;j<n;j++){
            
            dp[i][j] = min(dp[i-1][j] + (vec[i-1][j] == '.' && vec[i][j] == '#')
                          ,dp[i][j-1] + (vec[i][j-1] == '.' && vec[i][j] == '#'));
            
        }
    
    }
    
    cout << dp[m-1][n-1];
}








Measured memory_bytes: 384
N, M = map(int, input().split())

if N == 1:
    print(M)
else:
    d = 1
    ds = []
    while d ** 2 <= M:
        if M % d == 0:
            ds.append(d)
            ds.append(M//d)
        d += 1
    ds.sort(reverse=True)
    for d in ds:
        if N * d <= M:
            print(d)
            break


Measured memory_bytes: 2940
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;

signed main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;

    int y = ty - sy;
    int x = tx - sx;

    rep(i,y) cout << "U";
    rep(i,x) cout << "R";
    rep(i,y) cout << "D";
    rep(i,x+1) cout << "L";
    rep(i,y+1) cout << "U";
    rep(i,x+1) cout << "R";
    cout << "DR";
    rep(i,y+1) cout << "D";
    rep(i,x+1) cout << "L";
    cout << "U" << endl;

    
    
    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 3010, mod = 1e9 + 7;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int d = k; d <= n + 1; d++) {
        int min1 = (d * (d - 1)) / 2;
        int max1 = (n * (n + 1)) / 2 - ((n - d) * (n - d + 1)) / 2;
        ans += max1 - min1 + 1;
        ans %= mod;
    }
    cout << ans;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, k;
  cin >> n >> k;

  if(k <= (n+1) / 2){
    cout << "YES\n";
  }else{
    cout << "NO\n";
  }
  return 0;
}



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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	int n;cin>>n;
	ll k;cin>>k;
	vi vis(n+1,-1);
	vi a(n+1);
	int c=1;
	vis[1]=0;int j=0;
	repi(i,n) cin>>a[i+1];
	if(a[1]!=1){
		while(k>0){
		c=a[c];
		//cout<<c<<endl;
		j++;k--;
		if(vis[c]==-1) vis[c]=j;
		else k%=j-vis[c];
		
		}
	}
	db(c);
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 50;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;


int N, K;
vector<int> H;

int dp[303][303];

void solve() {
    if (N == K) {
        cout << 0 << endl;
        return;
    }
    FOR(i, 0, N + 2)
    FOR(j, 0, N + 2)
    dp[i][j] = INF;
    int ans = INF;
    dp[0][K] = 0;
    FOR(i, 0, N + 1) {
        FOR(x, 0, K + 1) {
            if (dp[i][x] < INF) {
                if (N - i <= x)
                    chmin(ans, dp[i][x]);
                for (int y = i + 1; y <= N && x >= y - i - 1; y++) {
                    int dif = max(H[y] - H[i], 0ll);
                    chmin(dp[y][x - (y - i - 1)], dp[i][x] + dif);
                }
            }
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    H.resize(N);
    FOR(N)
    cin >> H[i + 1];


    solve();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int M,N;cin>>M>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    
    if(M==2){
        int cnt=0;
        int ans=INF;
        vector<int> B(N);
        for(int i=0;i<N;i++){
            B[i]=i%2+1;
        }
        for(int i=0;i<N;i++){
            if(A[i]!=B[i]) cnt++;
        }
        ans=min(ans,cnt);
        
        for(int i=0;i<N;i++){
            B[i]=3-B[i];
        }
        
        cnt=0;
        for(int i=0;i<N;i++){
            if(A[i]!=B[i]) cnt++;
        }
        ans=min(ans,cnt);
        
        cout<<ans<<endl;
    }else{
        int cnt=0;
        
        for(int i=1;i+1<N;i++){
            if(A[i-1]==A[i]&&A[i]==A[i+1]){
                A[i]=INF;
                cnt++;
            }
        }
        
        for(int i=1;i<N;i++){
            if(A[i-1]==A[i]) cnt++;
        }
        
        cout<<cnt<<endl;
    }
}





Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
const ll mo=1000000007;
ll ans=0;
ll dp[1010][1010][8];

int main()
{ 
rep(i,1010)rep(j,1010)rep(k,8){
    dp[i][j][k]=-9999999999999999;
}
ll n,m;
cin >> n>>m; 
ll table[n][3]={};
rep(i,n) {
    cin >> table[i][0]>>table [i][1]>> table[i][2];
}
rep(i,8){
dp[0][0][i]=0;
}
rep(i,n+1)rep(j,m+1){
    //採択しない
    rep(k,8){
        if(dp[i][j][k]>=0)dp[i+1][j][k]=max(dp[i][j][k],dp[i+1][j][k]);
    }
    //0以上なら採択
    if(j!=m){
        dp[i+1][j+1][0]=max(dp[i][j][0]+table[i][0]+table[i][1]+table[i][2],dp[i+1][j+1][0]);
    }
    if(j!=m){
        dp[i+1][j+1][1]=max(dp[i][j][1]+table[i][0]+table[i][1]-table[i][2],dp[i+1][j+1][1]);
    }
    if(j!=m){
        dp[i+1][j+1][2]=max(dp[i][j][2]+table[i][0]-table[i][1]+table[i][2],dp[i+1][j+1][2]);
    }
    if(j!=m){
        dp[i+1][j+1][3]=max(dp[i][j][3]+table[i][0]-table[i][1]-table[i][2],dp[i+1][j+1][3]);
    }
    if(j!=m){
        dp[i+1][j+1][4]=max(dp[i][j][4]-table[i][0]+table[i][1]+table[i][2],dp[i+1][j+1][4]);
    }
    if(j!=m){
        dp[i+1][j+1][5]=max(dp[i][j][5]-table[i][0]+table[i][1]-table[i][2],dp[i+1][j+1][5]);
    }
    if(j!=m){
        dp[i+1][j+1][6]=max(dp[i][j][6]-table[i][0]-table[i][1]+table[i][2],dp[i+1][j+1][6]);
    }
    if(j!=m){
        dp[i+1][j+1][7]=max(dp[i][j][7]-table[i][0]-table[i][1]-table[i][2],dp[i+1][j+1][7]);
    }
}
rep(i,8){
    ans=max(dp[n][m][i],ans);
}
//2次元配列の中身を見る

/* for (int i = 0; i < n; ++i){
for (int j = 0; j < m; ++j) {
    cout << dp[i][j][2] << " ";
}cout  << endl;} */

cout << ans << endl;
return 0;
} 

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

int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	c *= 2;
	a = min(a, c);
	b = min(b, c);
	ll ans = 0;
	if (a + b >= c) {
		if (x > y) {
			ans += c * y;
			x -= y;
			y = 0;
		}
		else {
			ans += c * x;
			y -= x;
			x = 0;
		}
	}
	ans += a * x + b * y;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}

template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

const int N = 1000010;
const int INF = 0x3f3f3f3f;

int dp[N][2];

int main()
{
	ios_base::sync_with_stdio(false);
	
	string s;
	cin >> s;
	reverse(all(s));

	memset(dp, INF, sizeof dp);

	int n = s.length();

	dp[0][0] = 0;
	for(int i = 0; i < n; ++i)
		for(int t = 0; t < 2; ++t) {
			int x = t + (s[i] - '0');

			dp[i + 1][0] = min(dp[i + 1][0], dp[i][t] + x);
			dp[i + 1][1] = min(dp[i + 1][1], dp[i][t] + (10 - x));
		}

	int ans = INF;
	for(int t = 0; t < 2; ++t) ans = min(ans, dp[n][t] + t);
	cout << ans << '\n';

	return 0;
}



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

using namespace std;

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back

const int N = 100005;

void solve() {
	int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
	ld a, b;
	cin >> a >> b;
	a *= b;
	a = floor(a);
	cout << setprecision(0) << fixed << a;
	return ;
}

int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	// int t; cin >> t; while (t--)
	solve();
	return 0;
}

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1e9;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

// !!import gcd()!!
int gcdVec(vector<int> a) {
    int ret = a[0];
    rep2(i, 1, a.size()) {
        ret = gcd(ret, a[i]);
    }
    return ret;
}

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

    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    int g = gcdVec(a);
    if (k % g == 0 && k <= *max_element(all(a))) {
        cout << "POSSIBLE" << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	int n,l,s,i;

	scanf("%d%d",&n,&l);
	int d[n],e[n];

	for(i=0;i<n;i++)
		d[i]=l+i;
	
	s=0;
	for(i=0;i<n;i++)
		s=s+d[i];


	if(l+n-1>0){
		if(l<=0)
			printf("%d\n",s);
		else printf("%d\n",s-d[0]);
	}
		else printf("%d\n",s-d[n-1]);

		return 0;

	}



Measured memory_bytes: 128
import java.util.*;

public class Main {

	static long MOD = 1000000007l;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] A = new long[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}
		sc.close();

		// 累積和
		long[] S = new long[N + 1];
		S[0] = 0;
		for (int i = 0; i < N; i++) {
			S[i + 1] = (S[i] + A[i]) % MOD;
		}

		long ans = 0;
		for (int i = N - 1; i > 0; i--) {
			ans += A[i] * S[i];
			ans %= MOD;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 62800
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using namespace std;

//
int main() {
    int n;
    cin >> n;

    string s;
    cin >> s;

    vector<int> ridx;
    vector<int> gidx;
    vector<int> bidx;
    rep(i, 0, s.size()) {
        switch (s[i]) {
            case 'R': ridx.push_back(i); break;
            case 'G': gidx.push_back(i); break;
            case 'B': bidx.push_back(i); break;
            default: break;
        }
    }

    int sum = 0;
    for (int ri : ridx) {
        for (int gi : gidx) {
            // for (int bi : bidx) {
            // if (abs(ri - gi) == abs(gi - bi) | abs(ri - bi) == abs(bi - gi) |
            //     abs(gi - ri) == abs(ri - bi)) {
            //     continue;
            // }
            // cnt++;
            // }
            int cnt = 0;
            vector<int> sch;
            sch.push_back(2 * ri - gi);
            if ((ri + gi) % 2 == 0) sch.push_back((ri + gi) / 2);
            sch.push_back(2 * gi - ri);

            for (int val : sch) {
                if (binary_search(bidx.begin(), bidx.end(), val)) {
                    cnt++;
                }
            }
            sum += cnt;
        }
    }
    cout << ridx.size() * gidx.size() * bidx.size() - sum << endl;

    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
  vector<int> A;
  unsigned long long ans = 0;
  int x;
  int N,M;
  int i,j;
  
  cin >> N >> M;
  for(i=0;i<N;i++){
    cin >> x;
    A.push_back(x);
  }
  sort(A.begin(),A.end());
  for(i=0;i<M;i++){
      A[N-1] = A[N-1] / 2;
      if( N > 1 && A[N-1] < A[N-2] ){
      	x = A[N-1];
	A.pop_back();
	auto itr = lower_bound(A.begin(),A.end(),x);
	A.insert(itr,x);
      }
  }
  for(i=0;i<N;i++){
     ans = A[i] + ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 892
//
//AtCoder Beginner Contest 152
//C - Low Elements
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <functional>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n;

    cin >> n;

    int p[n];

    REP(i, n) cin >> p[i];

    int m = p[0];
    int ans = 0;

    REP(i, n) {
        m = min(m, p[i]);
        if (m == p[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4344
n, m =map(int, input().split())
INF = 10**15

a, b, c = [([0]*m) for _ in range(3)] 
for i in range(m):
    d,e,f = map(int, input().split())
    a[i] = d-1
    b[i] = e-1
    c[i] = -f

d = [INF]*n
d[0] = 0

for _ in range(n-1):
    for x,y,z in zip(a,b,c):
        if d[x] == INF:
            continue
        d[y] = min(d[y], d[x]+z)

ans = -d[-1]
negative = [False]*n

for _ in range(n):
    for x,y,z in zip(a,b,c):
        if d[x] == INF:
            continue
        if d[y] > d[x]+z:
            d[y] = d[x]+z
            negative[y] = True
        negative[y] |= negative[x]

if negative[-1]:
    print("inf")
else:
    print(ans)


Measured memory_bytes: 3188
import Control.Applicative
import Control.Monad
import Data.List.Split

main :: IO ()
main = do
  ls <- init . lines <$> getContents
  mapM_ (print . truncate) $ (\(x,y) -> [x,y]) $ fst $ foldl f ((0,0), 0) ls
  where
    f :: ((Double, Double), Double) -> String -> ((Double, Double), Double)
    f ((x,y), ang) l = let
        [d, a] = map read $ splitOn "," l
        ang' = ang/180*pi
      in ((x+d*sin ang', y+d*cos ang'), ang+a)

Measured memory_bytes: 4244
#include<map>
#include<cstdio>
#include<vector>

#define	pb			push_back
#define	rep(i,n)	for(int i=0;i<(n);i++)

using namespace std;

typedef	vector<int>			vi;

const int dx[]={1,1,0,-1,-1,-1,0,1},dy[]={0,-1,-1,-1,0,1,1,1};

vi nbr[20];
map<vi,int> memo[21];

int solve(vi card){
	int n=card.size();
	if(memo[n].count(card)>0)	return memo[n][card];

	int ans=n;
	rep(i,n)rep(j,nbr[i].size())if(nbr[i][j]<n){
		if(card[i]==card[nbr[i][j]]){
			vi card2(n-2);
			for(int k1=0,k2=0;k1<n;k1++) if(k1!=i && k1!=nbr[i][j]) card2[k2++]=card[k1];
			ans=min(ans,solve(card2));
		}
	}
	return memo[n][card]=ans;
}

int main(){
	int field[5][4];
	rep(i,5)rep(j,4)	field[i][j]=4*i+j;
	rep(i,5)rep(j,4){
		rep(k,8){
			int x=j+dx[k],y=i+dy[k];
			if(0<=x && x<4 && 0<=y && y<5)	nbr[4*i+j].pb(field[y][x]);
		}
	}

	int T;	scanf("%d",&T);
	while(T--){
		rep(i,21)	memo[i].clear();

		vi card(20);
		rep(i,20)	scanf("%d",&card[i]);
		printf("%d\n",solve(card));
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)

int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   ll h;
   cin >> h;
   ll cur = 1 , ans = 0;
   while(h){
      ans += cur;
      cur *= 2;
      h /= 2;
   }
   cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<map>

using namespace std;

#define rep(i, a, n) for (int i = (a); i < (n); ++i)

int main(){
  int n,lr;
  cin>>n;
  int a[n];
  map<int ,int> mp;

  rep(i,0,n){cin>>a[i];}
  for(int i=0;i<n;i++){mp[a[i]]++;}
  int ans=0;
  for(auto p:mp){
    int x=p.first;
    int m=p.second;
    m<x ? ans+=m : ans+=m-x;
  }
  cout<<ans<<endl;
}

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

int main() {
	cin.sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int e, y;
	cin >> e >> y;
	switch(e) {
    case 0:
		if (1868 <= y && y <= 1911) {
			cout << 'M' << y - 1868 + 1<< endl;
		} else if (y <= 1925) {
			cout << 'T' << y - 1912 + 1 << endl;
		} else if (y <= 1988) {
			cout << 'S' << y - 1926 + 1 << endl;
		} else {
			cout << 'H' << y - 1989 + 1 << endl;
		}
		break;
	case 1:
		cout << y + 1868 - 1 << endl;
		break;
	case 2:
		cout << y + 1912 - 1 << endl;
		break;
	case 3:
		cout << y + 1926 - 1 << endl;
		break;
	case 4:
		cout << y + 1989 - 1 << endl;
		break;
	}
}


Measured memory_bytes: 3192
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, masu[100008][2];
string s;

int main(){
	cin >> s;
	ll n = s.size();
	
	for(ll i = 0; i < n; i++){
		masu[i][0] = 1;
		masu[i][1] = 0;
	}
	
	for(ll i = 0; i < n-1; i++){
		if(s[i] == 'R'){
			masu[i+1][0] += masu[i][1];
			masu[i+1][1] += masu[i][0];
			masu[i][0] = 0;
			masu[i][1] = 0;
		}
	}
	
	for(ll i = n-1; i > 0; i--){
		if(s[i] == 'L'){
			masu[i-1][0] += masu[i][1];
			masu[i-1][1] += masu[i][0];
			masu[i][0] = 0;
			masu[i][1] = 0;
		}
	}
	
	
	
	for(ll i = 0; i < n;){
		if(masu[i][0] == 0){
			cout << 0;
			i++;
		}
		else{
			cout << masu[i][0] << " " << masu[i][1];
			i++;
			i++;
		}
		if(i != n){cout << " ";}
		else{cout << endl;}
	}
	
	
	return 0;
}

Measured memory_bytes: 2176
#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 all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll k;
	ll ans=0;
	cin >>n>>k;
	map<int,ll>list;
	int a;ll b;
	rep(i,n){
		cin>>a>>b;
		list[a]+=0;
		list[a]+=b;
	}
	ll sum=0LL;
	for(auto itr=list.begin();sum<k;itr++){
		ans=(itr->F);
		sum+=(itr->S);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4224
#include<stdio.h>

int main(){
    int a, b, c, d,e,f,g;
     scanf("%d",&a);
     b = a /1.08;
     c = b - 1;
     d = b + 1;
     e = (int)b*1.08;
     f = (int)c*1.08;
     g = (int)d*1.08;
    if(e == a){
        printf("%d", b);
        return 0;      
    } else if(f == a){
        printf("%d",c);
        return 0;
    }else if(g == a){
        printf("%d", d);
        return 0;
    }else{
        printf(":(");
    }
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    double sum = 0;
    for (int i = 0; i < N; i++) {
        double a;
        cin >> a;
        sum += 1 / a;
    }
    printf("%.6f", 1 / sum);
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#define _A_ true
#define SystemOutPrintln cout
#define FinishFunction return
#define Not void
#define Main int main
#define writeln printf
#define WHO while
#define destroy break
#define Vector vector<int>
using namespace std;

Vector Vec;

Not rec(int n,int m){
  if(n == 0){
    vector<int>::iterator it = Vec.begin();
    while(it != Vec.end()){
      SystemOutPrintln << *it;
      it++;
      if(it != Vec.end())SystemOutPrintln << " ";
      else writeln("\n");
   
    }
    FinishFunction;
  }
  for(int i=m;i>0;i--){
    if(n-i>=0){
      Vec.push_back(i);
      //SystemOutPrintln << "n-i = " << n-i << ", i = " << i << endl;
      rec(n-i,i);
      Vec.pop_back();
    }
  }
}

Main(){
  int n;
  WHO(_A_){
  cin >> n;
  if(n == 0)destroy;
  Vec.clear();
  rec(n,n);
  }
  FinishFunction 0;
}

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

int main(void) {
    string a;
    cin >> a;
    int cnt = 0;
    if ('o' == a[0]) cnt++;
    if ('o' == a[1]) cnt++;
    if ('o' == a[2]) cnt++;

    cout << 700 + (cnt * 100) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  string s;
  int q;
  cin >> s >> q;
  deque<char> deq;
  for(int i = 0; i < s.size(); i++) deq.push_back(s[i]);
  vector<int> t(q), f(q);
  vector<char> c(q);
  for(int i = 0; i < q; i++){
    cin >> t[i];
    if(t[i] == 2) cin >> f[i] >> c[i];
  }
  
  bool flag = true;
  for(int i = 0; i < q; i++){
    if(t[i] == 1){
      flag = !flag;
      continue;
    }
    if(flag){
      if(f[i] == 1) deq.push_front(c[i]);
      else deq.push_back(c[i]);
    }else{
      if(f[i] == 1) deq.push_back(c[i]);
      else deq.push_front(c[i]);
    }
  }
  
  int size = deq.size();
  if(flag){
    for(int i = 0; i < size; i++){
      cout << deq.front();
      deq.pop_front();
    }
  }else{
    for(int i = 0; i < size; i++){
      cout << deq.back();
      deq.pop_back();
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 5412
#include<iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  long N, K;
  cin >> N >> K;
  vector<long> H(N);
  for(int i=0; i<N; ++i){
    cin >> H.at(i);
  }
  sort(H.begin(), H.end(), greater<long>());
  long sum = 0;
  for (int i = 0; i < H.size(); i ++){
    if(i >= K){
      sum += H.at(i); 
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll  long long
#define ull unsigned long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
using namespace std;

int main(){
    
    string a,b;
    ll n;
    cin>>a>>b;
    ll ans=0;
    n=a.size();
	for(ll i=0;i<n;i++)ans+=(a[i]!=b[i]);
	cout<<ans;
	
	
	 
	
}
    


	
	
    



Measured memory_bytes: 3916
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
//template< typename T >
//T mod_pow(T x, T n, const T &p) {
//  T ret = 1;
//  while(n > 0) {
//    if(n & 1) (ret *= x) %= p;
//    (x *= x) %= p;
//    n >>= 1;
//  }
//  return ret;
//}
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
#define mp make_pair
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
//
//
//

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  string s;
  cin >> s;
  ll dp[s.length()+1][2];
  dp[0][0]=0;
  dp[0][1]=0;
  rep1(i,s.length()){
    ll id = s.length()-i;
    ll sp = s[id]-'0';
    // 初期化
    dp[i][0] = INF;
    dp[i][1] = INF;
    // 一桁前が繰りあげないパターン
    dp[i][0] = min(dp[i][0],sp + dp[i-1][0]);
    dp[i][1] = min(dp[i][1],10-sp+dp[i-1][0]);
    //pri3(sp,dp[i][0],dp[i-1][1]);
    // 一桁前が繰りあげるパターン
    sp++;
    if(i!=1){
      if(sp==10){
        sp=0;
        dp[i][1] = min(dp[i][1],dp[i-1][1]);
      }else{
        dp[i][0] = min(dp[i][0],sp+dp[i-1][1]);
        dp[i][1] = min(dp[i][1],10-sp+dp[i-1][1]);
      }
    }
  }
  ll ans = min(dp[s.length()][0],dp[s.length()][1]+1);
  pri(ans);
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define erep(i, n) for(int i = 0; i <= (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
#define rSORT(a, i) sort(all(a),(i))

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1E-11;

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; }

//fixed << setprecision(10)

/////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
	vector<vector<int>> c(3, vector<int>(3));
	rep(i, 3)rep(j, 3)cin >> c[i][j];
	
	vector<int>a(3);
	vector<int>b(3);

	a[0] = 0;

	for (int i = 0; i < 3; i++) {
		b[i] = c[0][i] - a[0];
	}

	for (int i = 1; i < 3; i++) {
		a[i] = c[i][0] - b[0];
	}

	
	bool okay = true;
	rep(i, 3) {
		rep(j, 3) {
			if (a[i] + b[j] != c[i][j]){
			cout << "No" << endl;
			return 0;
			}
		}
	}
	cout << "Yes" << endl;
	
	/*
	cout << "\n";
	rep(i, 3)cout << a[i] << ' ';
	rep(i, 3)cout << b[i] << ' ';
	*/
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
inline void chk(int *arr, int n)
{
	if (n & 1 ^ 1)
		throw false;
	for (int i = 0; i < n; i++)
	{
		if (arr[i] < 0 || arr[i] >= n)
			throw false;
	}
	if (n == 1)
		return;
	for (int i = 0; i < n; i++)
	{
		if ((arr[i] == i) ^ (i & 1))
			throw false;
	}
	int x = -1, y = -1;
	for (int i = 0; i < n; i += 2)
	{
		if (arr[i] < i)
		{
			if (arr[i] < x)
				throw false;
			x = arr[i];
		}
		else
		{
			if (arr[i] < y)
				throw false;
			y = arr[i];
		}
	}
}
int arr[300005], lazy[300005];
int main()
try
{
	// freopen("ARC102-F.in", "r", stdin);
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", arr + i);
		int x = i, y = --arr[i];
		if (x > y)
			std::swap(x, y);
		lazy[x]++;
		lazy[y]--;
	}
	for (int i = 1; i < n; i++)
		lazy[i] += lazy[i - 1];
	for (int i = 0; i < n; i++)
	{
		int st = i;
		while (lazy[i])
			i++;
		for (int j = st; j <= i; j++)
			arr[j] -= st;
		chk(arr + st, i - st + 1);
	}
	puts("Yes");
	return 0;
}
catch (bool)
{
	puts("No");
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  if(a>b) swap (a, b);
  cout << b*2-(a!=b) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

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

	//提出数が合格数と同じならYes
	//それ以外ならNoを出力する
	if (n == m) //ACの場合
	{
		printf("Yes\n");
	}
	else //ACではない場合
	{
		printf("No\n");
	}
}

Measured memory_bytes: 128
n, k = map(int, input().split())
an = list(map(int, input().split()))

maxi = max(an)
if k == 0:
    print(maxi)
    exit(0)


def judge(t):
    m = 0
    for i in an:
        if i%t == 0:
            m +=i//t
        else:
            m += i//t+1
    #print('judge', m, n+k)
    if m <= n+k:
        #print("true")
        return True
    else:
        #print("false")
        return False

mini = 0
#maxi = max(an)

while mini+1 != maxi:
    check = (mini+maxi)//2
    #print(check)
    if judge(check):
        maxi = check
        #print(mini, maxi)
    else:
        mini = check
        #print(mini, maxi)

print(maxi)

Measured memory_bytes: 30988
#include <stdio.h>
bool ban[10];
bool can(int n)
{
	while (n)
	{
		if (ban[n%10])
			return false;
		n/=10;
	}
	return true;
}
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for (int i=1;i<=k;++i)
	{
		int tmp;
		scanf("%d",&tmp);
		ban[tmp]=true;
	}
	while (!can(n))
		++n;
	printf("%d",n);
	return 0;
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  vector<pair<long long, int>> pf;
  for (long long i = 2; i <= (long long)sqrt(n); i++) {
    if (n % i == 0) {
      pf.emplace_back(i, 1);
      n /= i;
      while (n % i == 0) {
        pf.back().second++;
        n /= i;
      }
    }
  }
  if (n > 1) {
    pf.emplace_back(n, 1);
  }
  int sum = 0;
  for (auto pfi : pf) {
    sum += (int)(floor(sqrt(1 + 8 * pfi.second) - 1) / 2);
  }
  cout << sum << '\n';
  return 0;
}

Measured memory_bytes: 3624
N = int(input())
A = [int(input()) for _ in range(N)]
left_max = [0] * (N + 1)
right_max = [0] * (N + 1)

for index, a in enumerate(A, start=1):
    left_max[index] = max(left_max[index - 1], a)

for index, a in enumerate(reversed(A), start=1):
    right_max[index] = max(right_max[index - 1], a)

for i in range(N):
    print(max(left_max[i], right_max[N - i - 1]))


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

int main() {
    int n;
    std::cin >> n;
    std::string s;
    std::cin >> s;

    int ans = 0;
    char prev = '0';
    for (int i = 0; i < n; i++) {
        if (s[i] != prev) {
            ans++;
            prev = s[i];
        }
    }

    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (k >= a) cout << 0 << " " << max(b-k+a, 0ll) << endl;
  else cout << a - k << " " << b << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	uint64_t s; cin >> s;

	uint64_t i = sqrt(s) - 1;
	while (i * i < s) {
		i++;
	}

	uint64_t a = 0, b = 0, c = 0, d = 0;
	c = s / i;
	if (s % i == 0) {
		d = 0;
		a = 0;
		b = i - b;
	}
	else {
		d = 1;
		b = s % i;
		a = i - b;
	}

	cout << 0 << " " << (c + d) << " " << a << " " << 0 << " " << (a + b) << " " << c << endl;

	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))

route = []
town = set()
now = 1

while True:
    now = a[now-1]
    if now in town:
        break
    town.add(now)
    route.append(now)

count = route.index(now)
if count >= k:
    print(route[k-1])
else:
    route = route[count:]
    num = (k-count)%len(route)
    print(route[num-1])


    


Measured memory_bytes: 32372
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  string s;
  cin>>s;
  
  if(s=="RRR") cout<<3<<endl;
  else if(s=="RRS") cout<<2<<endl;
  else if(s=="SRR") cout<<2<<endl;
  else if(s=="RSR" || s=="RSS" || s=="SRS" || s=="SSR") cout<<1<<endl;
  else cout<<0<<endl;

  return 0;
}

Measured memory_bytes: 3640