akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int ans = 0;
        for(int i = 0; i < s.length; i++){
            if(s[i] != t[i]){
                ans++;
            }
        }
        System.out.println(ans);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}

Measured memory_bytes: 31496
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

typedef pair<int, int> P;

int main(){
	
	int H, W;
	
	cin >> H >> W;
	
	int ans = 0;
	
	string map[1001];
	
	for(int i = 0; i < H; i++){
		cin >> map[i];
	}
	
	queue<P> que;
	
	for(int i = 1; i < H - 1; i++){
		for(int j = 1; j < W - 1; j++){
			if(map[i][j] == '.'){
				continue;
			}
			int num = map[i][j] - '0';
			int count = 0;
			for(int x = -1; x <= 1; x++){
				for(int y = -1; y <= 1; y++){
					if(x == 0 && y == 0){
						continue;
					}
					if(map[i + y][j + x] == '.'){
						count++;
					}
				}
			}
			if(count >= num){
				P p;
				p.first = i;
				p.second = j;
				que.push(p);
			}
		}
	}
	
	int q_size = que.size();
	
	for(int i = 0; i < q_size; i++){
		P p = que.front();
		que.pop();
		map[p.first][p.second] = '.';
		que.push(p);
	}
	/*
	for(int i = 0; i < H; i++){
		cout << map[i] << endl;
	}
	*/
	while(!que.empty()){
		ans++;
		queue<P> que_next;
		while(!que.empty()){
			P p = que.front();
			que.pop();
			
			for(int i = p.first - 1; i <= p.first + 1; i++){
				for(int j = p.second - 1; j <= p.second + 1; j++){
					if(map[i][j] == '.'){
						continue;
					}
					int num = map[i][j] - '0';
					int count = 0;
					for(int x = -1; x <= 1; x++){
						for(int y = -1; y <= 1; y++){
							if(x == 0 && y == 0){
								continue;
							}
							if(map[i + y][j + x] == '.'){
								count++;
							}
						}
					}
					
					if(count >= num){
						P p2;
						p2.first = i;
						p2.second = j;
						que_next.push(p2);
					}
				}
			}
		}
		
		que = que_next;
		
		int q_size = que.size();
		
		for(int i = 0; i < q_size; i++){
			P p = que.front();
			que.pop();
			if(map[p.first][p.second] != '.'){
				map[p.first][p.second] = '.';
				que.push(p);
			}
		}
		/*
		for(int i = 0; i < H; i++){
			cout << map[i] << endl;
		}
		*/
	}
	
	cout << ans << endl;
	
	return 0;
}

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

int main(){
    int64_t N, X[50], Y[50];
    cin >> N;
    set<pair<int64_t, int64_t>> st;
    for(int i=0; i<N; i++){
        cin >> X[i] >> Y[i];
        st.insert({X[i], Y[i]});
    }
    int ans = N;
    for(int i=0; i<N; i++) for(int j=0; j<N; j++){
        if(i==j) continue;
        int64_t x = X[i] - X[j], y = Y[i] - Y[j];
        int res = N;
        for(int k=0; k<N; k++) if(st.count({X[k]+x, Y[k]+y})) res--;
        ans = min(ans, res);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
int a,b,c;
cin >> a >> b >> c;
bool flg = false;
if(a + b == c) flg = true;
if(b + c == a) flg = true;
if(a + c == b) flg = true;
if(flg) cout << "Yes" << endl;
else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(v) (v).begin(),(v).end()
#define endl "\n"
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define SET(A,VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int MAX = 1e6+8;
const int sz = 1e5+5;
void f_io(){
    IOS;
    // #ifndef ONLINE_JUDGE
    // FRE
    // #endif
}
int32_t main(){
    f_io();
    int t = 1;
    //cin>>t;
    while(t--){
        int n; cin >> n;
        map <int,int> cnt;
        rep(i,0,n){
            int temp; cin >> temp;
            cnt[temp]++;
        }
        int two = 0;
        vi v;
        for(auto it : cnt){
            v.pb(it.ss);
            two += it.ss - 1;
        }
        if(two%2){
            cout << v.size() - 1 << endl;
            continue;
        }
        else{
            cout << v.size() << endl;
            continue;
        }
    }
}

Measured memory_bytes: 7676
// Math = ♥️

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define ordered_set                            \
    tree<ll, null_type, less<ll>, rb_tree_tag, \
         tree_order_statistics_node_update>
ll n, m;
vvi g;
vi dp;

#define mod(a) (((a % m) + m) % m)

void dfs(ll u = 0, ll p = 0) {
    dp[u] = 1 % m;
    for (auto it : g[u]) {
        if (it == p) {
            continue;
        }

        dfs(it, u);
        dp[u] *= (1 + dp[it]);
        dp[u] %= m;
    }
}

void dfs2(ll u = 0, ll p = 0, ll papa = 0) {
    vi pref, suff;
    for (auto it : g[u]) {
        if (it == p) {
            pref.pb(papa);
            suff.pb(papa);
        } else {
            pref.pb(dp[it]);
            suff.pb(dp[it]);
        }
    }

    ll curr = 1 % m;
    for (auto &it : pref) {
        it = mod(curr * mod(1 + it));
        curr = it;
    }

    curr = 1;
    for (auto it = suff.rbegin(); it != suff.rend(); it++) {
        *it = mod(curr * mod(1 + *it));
        curr = *it;
    }

    curr = 0;
    for (auto it : g[u]) {
        if (it == p) {
            curr++;
            continue;
        }
        ll back = 1 % m, front = 1 % m;
        if (curr != 0) {
            back = pref[curr - 1];
        }

        if (curr != suff.size() - 1) {
            front = suff[curr + 1];
        }

        ll mult = mod(back * front);
        dp[it] *= (1 + mult);
        dp[it] %= m;

        dfs2(it, u, mult);
        curr++;
    }
}

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

    cin >> n >> m;
    g.resize(n);
    dp.resize(n);

    for (int i = 0; i < n - 1; i++) {
        ll x, y;
        cin >> x >> y;
        x--, y--;

        g[x].pb(y);
        g[y].pb(x);
    }

    dfs();
    dfs2();

    for (auto it : dp) {
        cout << it << "\n";
    }
}


Measured memory_bytes: 22528
#include <iostream>

#define SIZE 10

using namespace std;

int map[SIZE][SIZE] = {0};

void drop(int x, int y) {
	if (0 <= x && x < SIZE && 0 <= y && y < SIZE) {
		map[x][y]++;
	}
}

int main() {
	int x, y, s, count = 0, most = 0;
	char e;
	while (cin>>x>>e>>y>>e>>s) {
		drop(x, y);
		drop(x, y + 1);
		drop(x + 1, y);
		drop(x, y - 1);
		drop(x - 1, y);

		if (s > 1) {
			drop(x + 1, y + 1);
			drop(x + 1, y - 1);
			drop(x - 1, y - 1);
			drop(x - 1, y + 1);
		}

		if (s > 2) {
			drop(x, y + 2);
			drop(x, y - 2);
			drop(x + 2, y);
			drop(x - 2, y);
		}
	}

	for (int i = 0; i < SIZE; i++) {
		for (int j = 0; j < SIZE; j++) {
			if (map[i][j] > most) {
				most = map[i][j];
			}

			if (map[i][j] == 0) {
				count++;
			}
		}
	}

	cout << count << endl << most << endl;
	return 0;
}

Measured memory_bytes: 3004
(let* ((s (read-line))
       (x (read-line))
       (ans (length x)))
  (loop :for _ :from 0 :to (- (length s) (length x))
        :do (loop :for i :from 0 :to (1- (length x))
                  :with c := 0
                  :if (char/= (char x i) (char s (+ i _)))
                  :do (incf c)
                  :finally (setf ans (min ans c))))
  (format t "~A~%" ans))


Measured memory_bytes: 24660
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;

ll a[200000],b[200000];
ll c[200000],d[200000];
ll s[200000];

int main(){
	int n,m;scanf("%d%d",&n,&m);
	vector<int>v;
	rep(i,n){
		scanf("%lld%lld",&a[i],&b[i]);
		v.push_back(a[i]);
	}
	rep(i,m){
		scanf("%lld%lld",&c[i],&d[i]);
		v.push_back(c[i]);
	}
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
	vector<P>u;
	rep(i,n){
		a[i]=lower_bound(v.begin(),v.end(),a[i])-v.begin();
		u.push_back(P(a[i],b[i]));
	}
	memset(s,0x3f,sizeof(s));
	rep(i,m){
		c[i]=lower_bound(v.begin(),v.end(),c[i])-v.begin();
		s[c[i]]=min(s[c[i]],d[i]);
	}
	for(int i=1;i<v.size();i++){
		s[i]=min(s[i],s[i-1]);
	}
	sort(u.begin(),u.end(),greater<>());
	priority_queue<int,vector<int>,greater<int>>que;
	for(auto p:u){
		que.push(p.second);
		while(que.size()>=s[p.first]){
			que.pop();
		}
	}
	ll ans=0;
	while(!que.empty()){
		ans+=que.top();
		que.pop();
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 9936
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define int long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
int n,m,top,t[100005],a[100005],ans[100005];
main()
{
	re(n),re(m);
	a[top=1]=n;
	for(int x;m--;)
	{
		re(x);
		while(top && x<=a[top])--top;
		a[++top]=x;
	}
	m=top;
	t[m]=1;
//	for(int i=1;i<=m;++i)
//		printf("%d ",a[i]);
//	puts("");
	for(int i=m;i>=1;--i)
		for(int k=a[i];k;)
		{
			int l=0,r=i-1;
			while(l < r)
			{
				int mid=l+r+1>>1;
				if(a[mid]<=k)l=mid;
				else r=mid-1;
			}
			if(!l)
			{
//				cerr<<"*"<<k<<endl;
				ans[0]+=t[i];
				ans[k+1]-=t[i];
				k=0;
			}
			else
			{
				t[l]+=k/a[l]*t[i];
				k%=a[l];
			}
		}
//	for(int i=1;i<=m;++i)
//		printf("%d ",t[i]);
//	puts("");
	for(int i=1;i<=n;++i)
		printf("%lld\n",ans[i]+=ans[i-1]);
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int arr[100005];
int dp[3005][3005];
int anss  = 0 ;
char rep[100005];
int c=0;
string str1,str2;
int lcs(int first,int last)
    {
        if(first<=0|last<=0)
            {
                return 0;
            }
        if(dp[first][last]!=-1)
            return dp[first][last];
        if(str1[first]==str2[last]&&(first!=str1.size()&&last!=str2.size()))
        {
            dp[first][last]=1+lcs(first-1,last-1);
            anss = max(anss,dp[first][last]);

        }
        else
            {
            dp[first][last] = max(dp[first][last],max(lcs(first-1,last),lcs(first,last-1)));
            }
        return dp[first][last];

    }
void printstring()
    {
        int i = str1.size();
        int j = str2.size();
        int idx = anss;
        char str[anss+1];
        str[idx+1]='\0';
        while(i>0&&j>0)
        {
            if(str1[i]==str2[j])
            {
                str[idx]= str1[i];
                idx--;
                i--;
                j--;
            }
            else if(dp[i-1][j]>dp[i][j-1])
            {
                i--;
            }
            else
                j--;
        }
        cout<<str<<endl;
    }
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    for(int i=0;i<3006;i++)
        for(int j=0;j<3006;j++)
            dp[i][j]=-1;
    cin>>str1>>str2;
    str1="X"+str1;
    str2="Y"+str2;
    string ans="";
    int n = min(str2.size(),str1.size());
    int n1 = max(str2.size(),str1.size());
    lcs(str1.size()-1,str2.size()-1);
    printstring();

}













Measured memory_bytes: 39244
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a:usize = read();
    let b:usize = read();
    println!("{}", std::cmp::min(a, b).to_string().repeat(std::cmp::max(a,b)));
}


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

int main() {

	int n, k, r, s, p; cin >> n >> k >> r >> s >> p;
	string t; cin >> t;
	
	vector<char> result(n, 'e');
	
	int ans = 0;	
	for (int i = 0; i < t.size(); i++) {		
		if (i <= k - 1) { // k回目まで
			if (t[i] == 'r') {
				ans += p;
				result[i] = 'p';
			}
			if (t[i] == 's') {
				ans += r;
				result[i] = 'r';
			}
			if (t[i] == 'p') {
				ans += s;
				result[i] = 's';
			}
		}
		else  {  // k < i
			if (t[i] == t[i - k]) {

				if (t[i] == 'r') {
					if (result[i - k] == 'p') {}
					else {
						ans += p;
						result[i] = 'p';
					}
				}
				else if (t[i] == 's') {
					if (result[i - k] == 'r') {}
					else {
						ans += r;
						result[i] = 'r';
					}
				}
				else if (t[i] == 'p') {
					if (result[i - k] == 's') {}
					else {
						ans += s;
						result[i] = 's';
					}
				}
			}
			else { // k回前と違えばなんでも出せる
				if (t[i] == 'r') {
					ans += p;
					result[i] = 'p';
				}
				if (t[i] == 's') {
					ans += r;
					result[i] = 'r';
				}
				if (t[i] == 'p') {
					ans += s;
					result[i] = 's';
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

using ll = long long;

#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 input(...) __VA_ARGS__; in(__VA_ARGS__)

#if __has_include("debugger.cpp")
  #include "debugger.cpp"
#else
void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) > 0) cout << " ";
  print(std::forward<Tail>(tail)...);
}
# endif

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

struct Node {
  ll node, cost;
};

int main() {
  ll input(v, e);
  vector<vector<ll>> graph(v, vector<ll>(v, 1ll << 60));
  REP(i, e) {
    ll input(s, t, d);
    graph[s][t] = d;
  }
  REP(i, v) graph[i][i] = 0;

  REP(k, v) REP(s, v) REP(g, v) {
    graph[s][g] = min(graph[s][g], graph[s][k] + graph[k][g]);
  }
  REP(k, v) REP(s, v) REP(g, v) {
    if (graph[s][g] > graph[s][k] + graph[k][g]) {
      print("NEGATIVE CYCLE");
      return 0;
    }
  }
  auto f = [](ll x){
    if (x >= 1ll << 50) return string("INF");
    else return to_string(x);
  };
  REP(i, v) {
    REP(j, v) {
      if (j == 0) cout << f(graph[i][j]);
      else cout << " " << f(graph[i][j]);
    }
    cout << endl;
  }
}



Measured memory_bytes: 3340
fn main() {
    let summary = read_vec::<u32>();
    let weights = read_vec::<u32>();
    let n = summary[0];
    let mut sum = 0;
    for w in weights {
        sum += w;
    }
    println!("{}", if sum <= n { (n - sum) as i32 } else { -1 });
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 2288
#include<iostream>
using namespace std;
int main(){
    int n;
    int ans=0,p=1,k=1;
    cin>>n;
    while(n>=p){
        if(n>=p*10){
            ans+=9*k;
            k*=100;
        }
        else if (n<10) ans+=n;
        else ans+=(n/p-1)*p+(n%p+1);
        p*=100;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline ll input() {
    ll n;
    cin >> n;
    return n;
}

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , k;

int main() {
    fast_io;

    cin >> n >> k;
    if(k == 1)  return cout << 0 << endl , 0;
    cout << n - k << endl;

    return 0;
}
/*
todo :
    1- set constants
    2- check TimeLimit and MemoryLimit
    3- check special test cases
    4- don't forget BS can help you that is good idea(use for loop for floats)
    5- don't forget printf and scanf can help you in your code speed
*/


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

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

    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    reverse(H.begin(), H.end());
    int ans = 0, cnt = 0;
    int tmp = H[0];
    for (int i = 1; i < N; i++) {
        if (tmp <= H[i])
            cnt++;
        else {
            ans = max(cnt, ans);
            cnt = 0;
        }
        tmp = H[i];
    }
    ans = max(cnt, ans);
    cout << ans << endl;
}

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

int main()
{
  ll N; cin >> N;
  vector<deque<ll>> A(N, deque<ll>());
  for (int i=0; i<N; i++){
    for (int j=0; j<N-1; j++){
      ll tmp;
      cin >> tmp;
      A[i].push_back(tmp);
    }
  }

  ll day = 0;
  vector<ll> d(N,-1);
  ll cnt = 0;
  while (true) {
    vector<ll> done(N, 0);
    ll tmp = 0;
    for (int i=0; i<N; i++) {
      if (A[i].empty() && d[i] < 0) continue;

      if (d[i] < 0) {
        d[i] = A[i].front()-1;
        A[i].pop_front();
      }
      if (d[d[i]] == i && done[d[d[i]]] == 0 && done[d[i]] == 0) {
        done[d[d[i]]] = 1;
        done[d[i]] = 1;
        d[d[i]] = -1;
        d[i] = -1;
        cnt++;
        tmp++;
      }
    }
    if (tmp <= 0) break;
    day++;
  }
  if (cnt == N*(N-1)/2) cout << day << endl;
  else cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 11008
/**
 *   author: Shubham Srivastava
 *   created: 28 January 2020  11:34:01
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF 1e15
#define sorti(v) sort(v.begin(),v.end())
#define sortd(v) sort(v.rbegin(),v.rend())
typedef pair<ll, ll> pll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
ll parent[2000005];

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n;cin>>n;
    vector <ll> arr(n);
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    vector <vector <ll> > dp(n+1, vector <ll> (n+1,0));
    for(ll i=n-1;i>=0;i--){
        for(ll j=i;j<n;j++){
            if(i == j)
                dp[i][j] == 0;
            else{
                ll sum = 0;
                dp[i][j] = INF;
                for(ll k=i;k<=j;k++)
                    sum += arr[k];
                for(ll k=i;k<j;k++)
                    dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+1][j]+sum);
            }
        }
    }
    cout<<dp[0][n-1];
return 0;
}

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

using namespace std;

typedef long long int ll;

#define FOR(i,l,r) for(i=l;i<r;i++)

#define REP(i,n) FOR(i,0,n)

#define ALL(x) x.begin(),x.end()

#define P pair<ll,ll>

#define F first

#define S second
string solve(string S,string T){
  int i;
  REP(i,S.size())if(S[i]!=T[i])return "No";
  return "Yes";
}
signed main(){

  string S,T;cin>>S>>T;

  cout<<solve(S,T)<<endl;

  return 0;

}

Measured memory_bytes: 3632
#include <complex>
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;

typedef complex<double> P;

class Triangle{

private:
	//Op`ÌR_ÌÀW
	P a, b, c;
	//Op`ÌRÓÌ·³
	double A, B, C;
	//Op`ÌÊÏ
	double s;

public:
	//RXgN^(RÂÌ_ÆÓÆpxðú»)
	Triangle(P p1, P p2, P p3){
		a = p1;
		b = p2;
		c = p3;
		B = abs( c-a );
		A = abs( b-c );
		C = abs( a-b );
		double z = ( A + B + C ) / 2.0;
		s = sqrt( z * (z-A)*(z-B)*(z-C));
	}
	double getArea(){//Op`ÌÊÏðÔ·
		return s;
	}
};

int main(){
	double x,y;
	vector<P> polygon;

	while( scanf("%lf,%lf" , &x , &y ) != EOF ){
		P p(x,y);
		polygon.push_back(p);
	}
	double sum = 0;
	for(int i=1 ; i+1<polygon.size() ; ++i){
		P a = polygon[0];
		P b = polygon[i];
		P c = polygon[i+1];
		Triangle tri(a,b,c);
		
		sum += tri.getArea();
	}
	printf("%.6lf\n" , sum);
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void chmax(int &a, int b) { if (a < b) a = b; }
 
int main(){
  int N; string S; cin >> N >> S;
  
  int res = 0;
  vector<vector<int>> dp(N+1, vector<int>(N+1, 0));
  for(int i=N-1; i>=0; --i){
    for(int j=N-1; j>i; --j){
      if(S[i] == S[j]) chmax(dp[i][j], dp[i+1][j+1]+1);
      chmax(res, min(dp[i][j], j-i));
    }
  }
  cout << res << endl;
}
      

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

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

    ull N;
    cin >> N;
    string sN = to_string(N);

    int sumDigits = 0;
    rep (i, sN.size())
        sumDigits += sN[i] - '0';

    if (N % sumDigits == 0)
        cout << "Yes" << "\n";
    else
        cout << "No" << "\n";
}

Measured memory_bytes: 256
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N=nextInt();
		int M=nextInt();

		int l=1;
		int r=1000000;
		int[][] p = new int[M][];
		for(int i=0;i<M;i++){
			p[i] = nextInts();
			if(p[i][0] > l){
				l=p[i][0];
			}
			if(p[i][1] < r){
				r=p[i][1];
			}
		}

		System.out.println(Math.max(r-l+1,0));
	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 49104
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	ll a[7];
	rep(i,7)cin >> a[i];
	
	ll ret = 2*(a[0]/2+a[3]/2+a[4]/2);
	if(a[0] > 0 && a[3] > 0 && a[4] > 0){
		ret = max( ret , 3+2*((a[0]-1)/2+(a[3]-1)/2+(a[4]-1)/2) );
	}
	cout << ret+a[1] << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := newIo()
	defer io.Flush()
	N, A, B := io.NextInt(), io.NextInt(), io.NextInt()
	X := make([]int, N)
	result := 0
	for i := range X {
		X[i] = io.NextInt()
		if i < 1 {
			continue
		}
		result += int(math.Min(float64((X[i]-X[i-1])*A), float64(B)))
	}
	fmt.Println(result)
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


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

int n;

void dfs(string s, char mx){
    if(s.length() == n){
        printf("%s\n", s.c_str());
    } else {
        for(char c='a';c<=mx;c++){
            dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
        }
    }
}

int main(void){
    cin >> n;
    dfs("", 'a');
    return 0;
}

Measured memory_bytes: 1536
# a+b=c -> b=c-a
C = [list(map(int, input().split())) for _ in range(3)]

# a1を決めて探索
for a1 in range(101):
  b1 = C[0][0] - a1
  b2 = C[0][1] - a1
  b3 = C[0][2] - a1
  
  # a2 = c-b
  a2 = C[1][0] - b1
  a3 = C[2][0] - b1
  # a+b = c  になっているか
  if (C[1][1]-b2) == a2 and (C[1][2]-b3) == a2:
    if (C[2][1]-b2) == a3 and (C[2][2]-b3) == a3:
      print("Yes")
      exit()
print("No")      

Measured memory_bytes: 3064
let n = Scanf.scanf " %d" (+) 0
let vs = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let cs = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let _ = Array.mapi (fun i v -> max 0 @@ v - cs.(i)) vs |> Array.fold_left (+) 0 |> Printf.printf "%d\n"

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

        ll n;
        cin>>n;
        ll a[n],i,count=0;

        for(i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
                count++;
        }
        for(i=0;i<n;i++)
        {
            if(a[i]%2==0)
            {
                if(a[i]%3==0||a[i]%5==0)
                {
                    count--;
                }
            }
        }
        if(!count)
            cout<<"APPROVED"<<endl;
        else
            cout<<"DENIED"<<endl;


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define COUTDOUBLE(v) cout << std::setprecision(10)<<(v)<<endl;
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};


int main(){
    SCIN(str);
    if(str.size() == 2){
        COUT(str);
    }else{
        reverse(ALL(str));
        COUT(str);
    }
    rt 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 3001;
inline char get() {
	static char buf[10000], *S = buf, *T = buf;
	if (S == T) {
		T = (S = buf) + fread(buf, 1, 10000, stdin);
		if (S == T) return EOF;
	}
	return *S++;
}
inline void read(int &x) {
	static char c; x = 0; int sgn = 0;
	for (c = get(); c < '0' || c > '9'; c = get()) if (c == '-') sgn = 1;
	for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
	if (sgn) x = -x;
}

int n;
int a[N];
ll dp[N][N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read(n);
  for (int i = 0; i < n; i++) {
    read(a[i]);
  }
  for (int sz = 0; sz < n; sz++) {
    for (int l = 0; l+sz < n; l++) {
      int r = l + sz;
      dp[l][r] = max(-dp[l+1][r] + a[l], -dp[l][r-1] + a[r]);
    }
  }
  cout << dp[0][n-1] << nl;
  return 0;
}


Measured memory_bytes: 70016
import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [n, m] <- readInts
  as <- getNLns n
  bs <- getNLns m
  putStrLn $ solve n m as bs

solve :: Int -> Int -> [String] -> [String] -> String
solve n m as bs =
  case foldM testMatch () genCandidates of
    Left  _ -> "Yes"
    Right _ -> "No"
  where
    d = n - m
    ds = [0 .. d]
    --
    testMatch _ (i, j) =
      let e = forM_ [0 .. m - 1] (\x ->
            if (drop j $ take (m + j) (as !! (i + x))) == bs !! x
              then Right ()
              else Left ()
            )
      in case e of
        Right _ -> Left ()
        Left  _ -> Right ()
    genCandidates :: [(Int, Int)]
    genCandidates = foldl' (\a x -> a ++ (zip (repeat x) ds)) [] ds


-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

toTup2 :: [[a]] -> [(a, a)]
toTup2 = map (\ys -> case ys of y : z : zs -> (y, z))

encIdx2 :: Int -> (Int, Int) -> Int
encIdx2 mx (y, x) = y * mx + x

decIdx2 :: Int -> Int -> (Int, Int)
decIdx2 mx idx = (idx `div` mx, idx `mod` mx)

encIdx3 :: (Int, Int) -> (Int, Int, Int) -> Int
encIdx3 (my, mx) (z, y, x) = z * my * mx + y * mx + x

decIdx3 :: (Int, Int) -> Int -> (Int, Int, Int)
decIdx3 (my, mx) idx = (z, y, x)
  where
    basez = my * mx
    z = idx `div` basez
    y = (idx `mod` basez) `div` mx
    x = idx `mod` mx

while :: Monad m => m Bool -> m () -> m ()
while cond body = do
  b <- cond
  when b $ do
    body
    while cond body


Measured memory_bytes: 1148
#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>
using namespace std;
using i64 = int64_t;
int n;
vector<int> x;
int main() {
    cin >> n;
    x.resize(n + 1);
    vector<int> res(n * n);
    for (int i = 1; i <= n; ++i) {
        cin >> x[i];
        res[x[i] - 1] = i;
    }
    if (n == 1) {
        cout << "Yes\n1\n";
        return 0;
    }
    vector<pair<int, int>> ps;
    for (int i = 1; i <= n; ++i) {
        ps.emplace_back(x[i], i);
    } 
    sort(begin(ps), end(ps));
    bool f = false;
    for (int i = 0, j = 0, k = -1; i < n * n; ++i) {
        while (j == 0) {
            k++;
            if (k == n) {
                k = 0;
                f = true;
            }
            if (!f) j = ps[k].second - 1;
            else j = n - ps[k].second;
        }
        cerr << k << endl;
        if (res[i] == 0) {
            res[i] = ps[k].second;
            --j;
        }

    }
    for (int i = 1; i <= n; ++i) {
        int cnt = 0;
        for (int j = x[i] - 1; j >= 0; --j) {
            cnt += res[j] == i;
        }
        cerr << i << ' ' << cnt << endl;
        if (cnt != i) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    for (int y : res) cout << y << ' ';
    cout << '\n';
    return 0;
}

Measured memory_bytes: 2176
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int l = sc.nextInt();

        double a = l / 3.0;
        double b = (l - a) / 2.0;
        double c = l - a - b;
        double ans = a * b * c;
        
        System.out.printf("%8.9f%n", ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
 
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define len(x) int((x).size())
#define res(x) cout << ((x) ? "YES\n" : "NO\n" )

typedef long long int integer;
typedef long double doble;

void solution() {
	int n, d;
	cin >> n >> d;
	d = (d * 2) + 1;
	int ans = (n/d);
	ans += (n%d) ? 1 : 0;
	cout << ans << endl;	
}
 
int main(){
	int t = 1;
	//cin >> t;
	while(t--) solution();
	return 0;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if((a + b) > (c + d)){
    cout << "Left" << endl;
  }else if((a + b) < (c + d)){
    cout << "Right" << endl;
  }else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

int main(void){
	char s[100010];
	int i;
	chin(s);
	rep(i,strlen(s)){
		if(s[i]==s[i+1]){
			print2(i+1,i+2);
			return 0;
		}
		if(s[i]==s[i+2]){
			print2(i+1,i+3);
			return 0;
		}
	}
	print2(-1,-1);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i in range(n - 1):
    if lst[i] == i + 1:
        lst[i], lst[i + 1] = lst[i + 1], lst[i]
        cnt += 1
if lst[n - 1] == n:
    cnt += 1
print(cnt)

Measured memory_bytes: 14008
use std::collections::BinaryHeap;

fn main() {
    let (n, m) = {
        let v = read_vec::<usize>();
        (v[0], v[1])
    };

    // 仕事の読み込み
    let mut works = vec![vec![]; m + 1];
    for _ in 0..n {
        let (a, b) = {
            let v = read_vec::<usize>();
            (v[0], v[1])
        };
        if a <= m { works[a].push(b); }
    }

    let mut heap = BinaryHeap::new();
    let mut reword: usize = 0;
    for i in 1..m+1 {
        // heapにi日後に報酬がもらえるものを加える
        for b in works[i].iter() {
            heap.push(b);
        }

        if let Some(max) = heap.pop() {
            reword += *max;
        }
    }

    println!("{}", reword);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T  {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse::<T>().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap())
    .collect()
}

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

int main()
{
	int a,b,c,sum=0,i=0;
	
	cin >> a >> b >> c;
	
	if(a*c <= b){
		cout << c << endl;
	}else{
		while(sum <= b){
			i++;
			sum=a*i;
		}
		cout << i-1 << endl;
	}
}


Measured memory_bytes: 256
import java.util.*;

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

  static void solve(Scanner sc) {
    ArrayDeque<Integer> idxList = new ArrayDeque<>();
    ArrayDeque<Puddle> areaStuck = new ArrayDeque<>();// 水たまりスタック
    char[] input = sc.next().toCharArray();

    for (int i = 0; i < input.length; i++) {
      if (input[i] == '\\') {
        idxList.push(i);
      } else if (input[i] == '/' && idxList.size() > 0) {
        // 水たまりができたら、対応する\の位置と面積をつど求める
        int j = idxList.pop();
        int tmp = i - j;
        // もっと大きい水たまりができるなら、スタックから取り出して集約する
        while (areaStuck.size() > 0 && areaStuck.peek().beginIndex > j) {
          Puddle stuck = areaStuck.pop();
          tmp += stuck.area;
        }
        areaStuck.push(new Puddle(i, tmp));
      }
    }

    int sum = 0, cnt = areaStuck.size();
    StringBuilder sb = new StringBuilder();
    while (!areaStuck.isEmpty()) {
      int tmp = areaStuck.removeLast().area;
      sb.append(tmp).append(' ');
      sum += tmp;
    }
    System.out.println(sum);
    System.out.print(cnt);
    System.out.println(sb.length() > 0 ? (" " + sb.toString().trim()) : "");
  }
}

class Puddle {
  int beginIndex;
  int area;

  Puddle(int beginIndex, int area) {
    this.beginIndex = beginIndex;
    this.area = area;
  }
}



Measured memory_bytes: 28332
n,m = map(int, input().split()) 
AB = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    a -= 1
    b -= 1 
    AB[a].append(b)
    AB[b].append(a)

for i in range(n):
    print(len(AB[i]))


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int64 modpow(int64 a, int64 r){
    if(r == 0)return 1;
    if(r % 2 == 0){
        int64 x = modpow(a, r / 2);
        return x * x % MOD;
    }else{
        return modpow(a, r - 1) * a % MOD;
    }
}

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

// int64 lcm(int64 a, int64 b){
//     return a / gcd(a, b) * b;
// }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<int64> a(n);
    // int64 l = 1;
    map<int32,int32> factors;
    REP(i,n){
        cin >> a[i];
        // l = lcm(l, a[i]);
        map<int32,int32> m;
        int64 b = a[i];
        int64 p = 2;
        while(b >= 2){
            // cout << b << endl;
            if(b % p == 0){
                m[p]++;
                b /= p;
            }else{
                factors[p] = max(factors[p], m[p]);
                if(p * p > b){
                    p = b;
                }else{
                    p++;
                }
            }
        }
        factors[p] = max(factors[p],m[p]);
    }
    int64 l = 1;
    for(pii p : factors){
        // cout << p.first << " " << p.second << endl;
        l *= modpow(p.first, p.second);
        l %= MOD;
    }
    // cout << l << endl;
    int64 ans = 0;
    REP(i,n){
        // cout << g * modpow(a[i] , MOD-2) % MOD << endl;
        ans += l * modpow(a[i] , MOD-2) % MOD;
        ans %= MOD;
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define rep(i,n) for (ll i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y) {
  while (y != 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

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

  ll a, b;
  cin >> a >> b;

  ll g = gcd(a, b);
  vector<ll> c;

  for (ll i = 1; i*i <= g; i++) {
    if (g == i*i) {
      c.push_back(i);
    } else if (g % i == 0) {
      c.push_back(i);
      c.push_back(g/i);
    }
  }
  sort(c.begin(), c.end());
  map<ll, bool> mp;

  for (int i = 0; i < c.size(); i++) {
    mp[c[i]] = true;
  }

  for (ll i = 1; i < c.size(); i++) {
    if (mp[c[i]]) {
      for (ll j = i+1; j < c.size(); j++) {
        if (c[j] % c[i] == 0) {
          mp[c[j]] = false;
        }
      }
    }
  }

  ll ans = 0;

  /* for debug
  rep(i, c.size()) {
    cout << c[i] << " " << mp[c[i]] << endl;
  }
  */
  rep(i, c.size()) {
    if (mp[c[i]] ) { ans++; }
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;

using namespace std;

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

  int ans = 0;
  int n = s.size();
  rep(i, n){
    if(s[i] != s[n - 1 - i]){
      s[i] = s[n - 1 - i];
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256