akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    long long res = 0;
    long long two_factor = 1;
    for (int d = 0; d < 60; ++d) {
        long long even = 0, odd = 0;
        for (int i = 0; i < N; ++i) {
            if (A[i] & (1LL<<d)) ++odd;
            else ++even;
        }
        long long add = (odd * even) % MOD * two_factor % MOD;
        res = (res + add) % MOD;
        two_factor = (two_factor * 2) % MOD;
    }
    cout << res << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using _TYPE = int;
typedef tree< _TYPE, null_type, less< _TYPE >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main() {
    IO;
    string s, t;
    cin >> s >> t;
    if(((int) s.size() == (int) t.size() - 1) && (t.substr(0, s.size()) == s))
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        if (arr[0] == arr[1] && arr[1] == arr[2]) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
  }
    

}


Measured memory_bytes: 22740
#include <iostream>

using namespace std;

 

int main()
{
    int i, ans, a, b, c;
    
    cin >> a >> b >> c;
    ans = 0;
    while(a<=b)
    {
        if(c%a==0)
        {
            ans++;
        }
        a++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int n;
    cin>>n;
    vector<vector<long long int>> grid(n,vector<long long int>(3));
    REP(i,n){
        cin>>grid[i][0]>>grid[i][1]>>grid[i][2];
    }
    vector<vector<long long int>> dp(n,vector<long long int>(3));
    REP(i,n){
        REP(j,3){
            if(i==0){
                dp[i][j]=grid[i][j];
            }else{
                REP(k,3){
                    if(k!=j){
                        dp[i][j]=max(dp[i-1][k]+grid[i][j],dp[i][j]);
                    }
                }
            }
        }
    }
    long long int result=0;
    REP(i,3){
        result=max(dp[n-1][i],result);
    }
    cout<<result<<endl;
    return 0;
}


Measured memory_bytes: 11136
a = list(input())
b = list(input())
len_a = len(a)
len_b = len(b)

ans = "EQUAL"
if len(a) > len(b):
  ans = "GREATER"
elif len(a) < len(b):
  ans = "LESS"
else:
  for i in range(len(a)):
    if a[i] > b[i]:
      ans = "GREATER"
      break
    elif a[i] < b[i]:
      ans = "LESS"
      break
print(ans)

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

vector<pair<long long, long long> > prime_factorize(long long N) {
	vector<pair<long long, long long> > res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0; // 指数

		 // 割れる限り割り続ける
		while (N % a == 0) {
			++ex;
			N /= a;
		}

		// その結果を push
		res.push_back({ a, ex });
	}

	// 最後に残った数について
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

int main() {
	
	ll a; ; cin >> a;
	vector<pair<long long, long long>> a_prime;  // a^x ならば { a, x }
	a_prime = prime_factorize(a);
	ll ans = 0;
	for (ll i = 0; i < a_prime.size(); i++) {
		ll tmp = 1;
		while (true) {
			if (tmp <= a_prime[i].second) {
				a_prime[i].second -= tmp;
				tmp++;
				ans++;
			}
			else {
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
from collections import Counter
n,k = map(int,input().split())
c = 0
list_A = Counter(list(map(int,input().split())))
t = len(list_A.keys())-k
if t<=0:
  print(0)
else:
  B =sorted(list_A.items(),key=lambda x:x[1])
  for j in range(t):
    c += B[j][1]
  print(c)
    

Measured memory_bytes: 37784
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int N;
  int C[505], S[505], F[505];
  scanf("%d", &N);
  rep(i, 0, N-1) scanf("%d %d %d", &C[i], &S[i], &F[i]);

  rep(x, 0, N) {
    int t = 0;
    rep(s, x, N-1) {
      if ( t < S[s] ) t = S[s];
      else t = ((t - 1) / F[s] + 1) * F[s];
      t += C[s];
    }
    printf("%d\n", t);
  }
  return 0;
}


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

int main()
{
  int a, b;
  cin >> a >> b;
  if (a != 3 && b != 3) cout << 3 << endl;
  else if(a != 2 && b != 2) cout << 2 << endl;
  else cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 3564
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n,m = readline() |> split |> parseMap
	s = chomp(readline())
	g = [Int[] for i in 1:n]
	ac = zeros(Int,n)
	bc = zeros(Int,n)
	for i in 1:m
		a,b = readline() |> split |> parseMap
		if s[a] == 'A'
			ac[b] += 1
		else
			bc[b] += 1
		end
		if s[b] == 'A'
			ac[a] += 1
		else
			bc[a] += 1
		end
		push!(g[a],b)
		push!(g[b],a)
	end
	stack = Int[]
	for i in 1:n
		if ac[i]==0||bc[i]==0
			push!(stack,i)
		end
	end
	l = Int[]
	vst = zeros(Int,n)
	while !isempty(stack)
		x = pop!(stack)
		if vst[x] == 0
		vst[x] = 1
		push!(l,x)
		for i in 1:length(g[x])
			if s[x] == 'A'
				ac[g[x][i]] -= 1
			else
				bc[g[x][i]] -= 1
			end
			if (ac[g[x][i]] == 0 || bc[g[x][i]] == 0)
				push!(stack,g[x][i])
			end
		end
		end
	end
	println(length(l)==n?"No":"Yes")
end
main()

Measured memory_bytes: 169156
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;
ll x,y,h,n,now,ans,mx;
struct lala{
	ll x,y,h;
}p[102];
bool check(int cx,int cy){
	mx=0x3f3f3f3f3f;
	for(int i=1;i<=n;i++){
		x=p[i].x,y=p[i].y,h=p[i].h;
		now=abs(cx-x)+abs(cy-y);
		mx=min(mx,now+h);
	}
	for(int i=1;i<=n;i++){
		x=p[i].x,y=p[i].y,h=p[i].h;
		now=abs(cx-x)+abs(cy-y);
		if(max(mx-now,0ll)!=h) return 0;
	}
	return 1;
}
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld%lld",&p[i].x,&p[i].y,&p[i].h);
	}
	for(ll i=0;i<=100;i++){
		for(ll j=0;j<=100;j++){
			if(check(i,j)){
				printf("%lld %lld %lld\n",i,j,mx);
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define rrep(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end());
#define ll long long 
#define vi vector<int>
#define vvi vector<vector<int> >

using namespace std;

void p(int x) {
	cout << x << endl;
}

void pp(string s) {
	cout << s << endl;
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	string s;
	cin >> s;

	int bnum = 0;
	int sum = 0;
	rep(i, 0, s.length()) {
		if (s[i] == 'c')cout << "No" << endl;
		else if (s[i] == 'a') {
			if (sum < a + b) {
				sum++;
				cout << "Yes" << endl;
			}
			else cout << "No" << endl;
		}
		else if (s[i] == 'b') {
			if (sum < a + b && bnum < b) {
				cout << "Yes" << endl;
				bnum++;
				sum++;
			}
			else cout << "No" << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 896
#include <stdio.h>
#include <stdbool.h>

int n_from;
int from[20];

int id;
bool canMake(int id, int target);

int main(void)
{
    int i;

    scanf("%d", &n_from);
    for (i = 0; i < n_from; i++) {
        scanf(" %d", &from[i]);
    }

    int n_target;
    scanf("%d", &n_target);
    int target;
    while (n_target--) {
        id = 0;
        scanf(" %d", &target);
        if (canMake(id, target)) {
            printf("yes\n");
        } else {
            printf("no\n");
        }
    }

    return 0;
}

bool canMake(int id, int target)
{
    if (id == n_from) {
        return (target == 0);
    }

    if (canMake(id + 1, target)) {
        return true;
    }
    if (canMake(id + 1, target - from[id])) {
        return true;
    }

    return false;
}

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

#define MAX 100005
#define INF (1<<26)
string s;

int t[MAX];
int dp[2][10][10][2];

int change[]={0,1,2,3,1,2,3,1,2,3};
int check(int L,int R){
  if(L==0||R==0)return 1;
  if(change[L]<=change[R])return 1;
  else return 0;
}

void update(int &a,int b){if(b<a)a=b;}

int solve(){
  int len=s.size();
  if(len<=2)return 0;

  for(int i=0;i<len;i++){
    t[i]=s[i]-'0';
    if(i<2)
      for(int j=0;j<10;j++)
	for(int k=0;k<10;k++)
	  dp[i][j][k][0]=dp[i][j][k][1]=INF;
  }
  dp[0][t[0]][0][0]=0;
  dp[0][0][t[0]][1]=0;

  int ans=INF;
  for(int i=1;i<len;i++){
    int to=t[i],ai=i%2,bi=1-ai;
    for(int j=0;j<10;j++)
      for(int k=0;k<10;k++)
	dp[ai][j][k][0]=INF,
	  dp[ai][j][k][1]=INF;
    for(int j=0;j<10;j++){

      for(int k=0;k<10;k++){
	if(check(to,j)){
	  update(dp[ai][to][j][0],
		 dp[bi][k][j][0]+1);
	  update(dp[ai][to][j][0],
		 dp[bi][k][j][1]);
	}
	if(check(j,to)){
	  update(dp[ai][j][to][1],
		 dp[bi][j][k][1]+1);  
	  update(dp[ai][j][to][1],
		 dp[bi][j][k][0]);
	}
      }

      if(i==len-1){
	ans=min(ans,dp[ai][to][j][0]);
	ans=min(ans,dp[ai][j][to][1]);
      }
    }
  }
  return ans;
}

int main(){
  while(1){
    cin>>s;
    if(s=="#")break;
    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 1708
M, D = map(int, input().split())
answer = 0
for i in range(1,M+1):
    for j in range(20, D+1):
        d_1 = j % 10
        if d_1 < 2:
            continue
        d_10 = j // 10
        if d_1 * d_10 == i:
            answer += 1
print(answer)

Measured memory_bytes: 39152
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

const ll MOD = 1e9 + 7;
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    string S1,S2;
    cin >> S1 >> S2;
    ll res = 0;
    ll len = S1.length();
    bool flag = false;
    for(int i = 0;i < len;){
        if(i == 0){
            if(S1[i] == S2[i]){
                res = 3;
                i++;
                flag = true;
            }else{
                res = 6;
                i+=2;
            }
            continue;
        }
        
        if(flag){
            if(S1[i] == S2[i]){
                (res *= 2)%=MOD;
                i++;
            }else{
                (res*=2)%=MOD;
                i+=2;
                flag = false;
            }
        }else{
            if(S1[i] == S2[i]){
                i++;
                flag = true;
            }else{
                (res *=3)%=MOD;
                i+=2;
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;

  
  if(a==b && a==c && b==c){
    cout << "No";
  }
  else if(a!=b && a!=c && b!=c){
    cout << "No";
  }
  else cout << "Yes";
}

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

using namespace std;

const int max_n = 2022, mod = 998244353;

int n, dp[2 * max_n][2 * max_n], cnt[2][max_n];
string s;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> s;
    n = s.length();
    for (int i = 0; i < n; ++i) {
        cnt[0][i] = s[i] - '0';
        cnt[1][i] = 2 - cnt[0][i];
        if (i) {
            cnt[0][i] += cnt[0][i - 1];
            cnt[1][i] += cnt[1][i - 1];
        }
    }
    cnt[0][n] = cnt[0][n - 1];
    cnt[1][n] = cnt[1][n - 1];
    dp[0][0] = 1;
    for (int i = 0; i < 2 * n; ++i) {
        for (int j = 0; j <= i; ++j) {
            if (!dp[i][j]) {
                continue;
            }
            if (j + 1 <= cnt[0][min(i, n - 1)]) {
                dp[i + 1][j + 1] += dp[i][j];
                dp[i + 1][j + 1] %= mod;
            }
            if (i - j + 1 <= cnt[1][min(i, n - 1)]) {
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= mod;
            }
        }
    }
    printf("%d\n", dp[2 * n][cnt[0][n - 1]]);
    return 0;
}


Measured memory_bytes: 62208
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int r;
    cin >> r;
    cout << 2*r*3.141519 << endl; 
}

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

int main() {
	int n, ret;
	string s;
	cin >> n;
	cin >> s;
	ret = n;

	vector<int>w(n), e(n);
	w[0] = e[n-1] = 0;

	for (int j = 1; j < n; j++) {
		w[j] = w[j - 1] + (s[j-1] == 'W');
		e[n - 1 - j] = e[n - j] + (s[n - j] == 'E');

	}
	ret = n;
	for (int j = 0; j < n; j++) {
		if (ret > w[j] + e[j]) {
			ret = w[j] + e[j];
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int c[6];
int main(void)
{
	int a,b;
	int cnt=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		int x=i;
		c[4]=x%10;
		x=x/10;
		c[3]=x%10;
		x=x/10;
		c[2]=x%10;
		x=x/10;
		c[1]=x%10;
		x=x/10;
		c[0]=x%10;
		if(c[0]==c[4]&&c[1]==c[3]){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}
		

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int A=scan.nextInt();
		int B=scan.nextInt();
		int C=scan.nextInt();
		int D=scan.nextInt();
		int s=0,temp=0;
		if(A<B){
			temp=A;
		}
		else if(B<=A){
			temp=B;
		}
		if(C<D){
			s=C;
		}
		else if(D<=C){
			s=D;
		}
		System.out.println(temp+s);
		}
}


Measured memory_bytes: 35656
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x;
    cin>>n>>x;
    int h[n+1]={};
    for(int i=1;i<=n;i++)cin>>h[i];
    vector<vector<vector<long long>>>dp(n+1,vector<vector<long long>>(x+1,vector<long long>(n+1,1000000000000000)));
    //i列見て、j行捨てて、末尾がk列目のとき最小コスト
    dp[0][0][0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=x;j++){
            for(int k=0;k<=n;k++){
                dp[i+1][j][i+1]=min(dp[i+1][j][i+1],dp[i][j][k]+max(0,h[i+1]-h[k]));
                if(j<x)dp[i+1][j+1][k]=min(dp[i+1][j+1][k],dp[i][j][k]);
            }
        }
    }
    long long ans=1000000000000000;
    for(int i=0;i<=n;i++)ans=min(ans,dp[n][x][i]);
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int>dp(N+110, 0);
    for (int i = 100; i < 106; ++i) {
        dp[i] = 1;
    }
    for (int i = 100; i < N; ++i) {
        if(dp[i] == 0) continue;
        for (int j = 100; j < 106; ++j) {
            dp[i+j] = 1;
        }
    }
    cout << dp[N] << "\n";
    return 0;
}

Measured memory_bytes: 640
/* Murad Eynizade */

#include <bits/stdc++.h>
#define intt long long
#define FAST_READ ios_base::sync_with_stdio(0);cin.tie(0);
#define F first
#define S second

using namespace std;

const int mod = 1000000007;

int n , m , dp[1000][1000];

char arr[1000][1000];

int main()
{
    FAST_READ;
    cin>>n>>m;
    for (int i = 0;i<n;i++)
        for (int j = 0;j<m;j++)
            cin>>arr[i][j];
    dp[0][0] = 1;
    for (int i = 1;i<m;i++) {
        if (arr[0][i] == '#')break;
        dp[0][i] = 1;
    }
    for (int i = 1;i<n;i++) {
        if (arr[i][0] == '#')break;
        dp[i][0] = 1;
    }
    for (int i = 1;i<n;i++)
        for (int j = 1;j<m;j++)
            if (arr[i][j] == '.')dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
    cout<<dp[n - 1][m - 1]<<endl;
    return 0;
}


Measured memory_bytes: 5120
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define pint pair<int, int>
#define mp make_pair

using namespace std;

typedef long long ll;




ll gcb(ll a, ll b) {
	if (b == 0) return a;
	return gcb(b, a%b);
}

void cop(ll &a, ll &b) {
	ll g = gcb(a, b);
	a /= g;
	b /= g;
}

ll lcm(ll a, ll b){
	return a * b / gcb(a, b);
}

ll dfs(int now, vector<vector<ll>> &to, vector<vector<ll>> &co) {
	if (now == -1) return 1;

	ll tmp1 = co[now][0] * dfs(to[now][0], to, co);
	ll tmp2 = co[now][1] * dfs(to[now][1], to, co);

	ll l = lcm(tmp1, tmp2);

	tmp1 = l / co[now][0];
	tmp2 = l / co[now][1];

	return tmp1 + tmp2;
}


int main() {
	int n;

	while (cin >> n, n)
	{
		vector<vector<ll>> to(n), co(n);
		int root;
		vector<bool> isroot(n, true);

		rep(i, n) {
			ll p, q;
			int r, b;
			cin >> p >> q >> r >> b;

			cop(p, q);
			r--; b--;

			to[i].push_back(r);
			to[i].push_back(b);

			co[i].push_back(p);
			co[i].push_back(q);

			if(r >= 0 ) isroot[r] = false;
			if (b >= 0) isroot[b] = false;
		}

		rep(i, n) {
			if (isroot[i]) {
				root = i;
				break;
			}
		}

		cout << dfs(root, to, co) << endl;

	}


	return 0;
}




Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define FOR(i, l, r) for(int i = (int)l; i <= (int)r; ++i)

using namespace std;
const int Nmax = 1e5 + 11;
const int inf = 1e9 + 112;

int n, a[Nmax][4], f[Nmax][4];

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    FOR(i, 1, n) FOR(j, 1, 3) {
        cin >> a[i][j];
    }
    FOR(i, 1, n) FOR(j, 1, 3) {
        FOR(k, 1, 3) {
            if (j == k) continue;
            f[i][j] = max(f[i][j], f[i - 1][k] + a[i][j]);
        }
    }
    cout << max({f[n][1], f[n][2], f[n][3]});
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char s[10];
cin >> s;
s[3] = '8';
REP(i,10) cout << s[i];
cout << endl;
}


Measured memory_bytes: 256
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = int.Parse(_[0]);
            var b = int.Parse(_[1]);

            if(b >= a){
                Console.WriteLine(a);
            }else{
                Console.WriteLine(a - 1);
            }
        }
    }
}


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

int main()
{
    int N;
    cin >> N;
    int a =0 ;
    for (int i = 1;i <= N;i++) {
        int cnt = 0;
        for (int j = 1;j <= i;j++) {
            if(i % j == 0){
                cnt++;
            }
        }
        if(cnt == 8 && i % 2 == 1){
            a++;
        }
        }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    
    int N = 0;
    int M = 0;
    scanf("%d %d", &N, &M);
    
    int x[10000] = { 0 };
    for (int i = 0; i < M; i++ ) {
        scanf("%d ", &x[i]);
    }
    
    int total = 0;

    for (int i = 0; i < M; i++) {
        total += x[i];
    }
    
    int pol = N - total;
    if (pol >= 0) {
        printf("%d", pol);
    }
    else {
        printf("%d",-1);
    }
    return 0;
}

Measured memory_bytes: 2192
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    int N,Y; cin >> N >> Y;
    for (int x=0; x<=N; x++){
        for (int y=0; y<=N-x; y++){
            int z=N-x-y;
            if (x*10000+y*5000+z*1000==Y){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " <<  -1 << " " << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 14, 2020 11:30:20 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  H = list(map(int, input().split()))

  nmove = 0
  max_ = 0
  prev = H[0]
  for i in range(1, N):
    if prev >= H[i]:
      nmove += 1
      max_ = max(max_, nmove)
    else:
      nmove = 0
    prev = H[i]

  print(max_)


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 84916
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

int n, m;
int x[123456];
vector<int>slot[123456];
vector<int>conv[123456];
int amount[123456];

int main(void)
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i)scanf("%d", x + i);
	sort(x, x + n);
	for (int i = 0; i < n; ++i)
	{
		int modsl = x[i] % m;
		slot[modsl].push_back(x[i]);
	}
	for (int j = 0; j < m; ++j)
	{
		amount[j] = slot[j].size();
		if (amount[j] == 0)continue;
		for (auto itr = slot[j].begin(); itr != slot[j].end(); ++itr)
		{
			if (itr != slot[j].begin() && *(itr - 1) == *itr)
			{
				++conv[j].back();
			}
			else
			{
				conv[j].push_back(1);
			}
		}
		sort(conv[j].begin(), conv[j].end());
	}
	int ans = 0;
	ans += amount[0] / 2;
	if (m % 2 == 0)
	{
		ans += amount[m / 2] / 2;
	}
	int bar = (m / 2 + ((m % 2 == 0) ? 0 : 1));
	for (int ss = 1; ss < bar; ++ss)
	{
		int large = ss;
		int small = m - ss;
		if (amount[ss] < amount[m - ss])
		{
			int tmp = large;
			large = small;
			small = tmp;
		}
		//if (conv[large].empty())continue;
		while (!conv[large].empty() && amount[large] > amount[small])
		{
			if (conv[large].back() == 1)break;
			conv[large].back() -= 2;
			amount[large] -= 2;
			++ans;
			if (conv[large].back() <= 1)conv[large].pop_back();
		}
		ans += min(amount[large], amount[small]);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 13056
#include <stdio.h>

int main(void) {
	int N;
	char S[128], T[128];
	int i;
	if (scanf("%d", &N) != 1) return 1;
	if (scanf("%127s%127s", S, T) != 2) return 1;
	for (i = 0; i < N; i++) {
		printf("%c%c", S[i], T[i]);
	}
	putchar('\n');
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x)  (int)x.size()
#define en     '\n'
#define sp     ' '
#define in(v)  for(auto &a: v)cin >> a;
#define out(v) for(auto &a: v)cout << a << sp;cout << en;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll n, ans = 0, i, j;cin >> n;
    for(i = 1;i <= n;i++){
        for(j = 1;j <= n;j++){
            if(i * j < n)ans++;
            else break;
        }
    }
    cout << ans << en;
    return 0;
}


Measured memory_bytes: 3568
#include <stdio.h>
 
int main(void){
 
    int x, y, q, r;
    long long int a,b,z;
 
    while(scanf("%lld %lld", &a, &b)!=EOF){
 
    x = a;
    y = b;
 
    if(x < 0) x = -x;
    if(y < 0) y = -y;
    for(;;){
        q = x/y;
        r = x - q*y;
        if(r == 0) break;
        x = y;
        y = r;
    }
    z=a*b/y;
    printf("%d %lld\n",y,z);
    }
    return 0;
}


Measured memory_bytes: 2060
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int H, W;
    cin >> H >> W;

    char grid[H][W];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> grid[i][j];
        }
    }

    int dp[H][W];
    fill(dp[0], dp[H], 0);
    dp[0][0] = 1;

    queue<P> que;
    que.push(make_pair(0, 0));

    bool visited[H][W];
    fill(visited[0], visited[H], false);

    bool has[H][W];
    fill(has[0], has[H], false);
    has[0][0] = true;

    while (que.size() > 0) {
        P p = que.front(); que.pop();
        visited[p.first][p.second] = true;
        has[p.first][p.second] = false;

        for (int i = 0; i <= 1; i++) {
            for (int j = 0; j <= 1; j++) {
                if (!(i == 0 || j == 0)) continue;
                if (i == 0 && j == 0) continue;
                if ((p.first + i < 0) || (p.first + i >= H) || (p.second + j < 0) || (p.second + j >= W)) continue;
                if (grid[p.first + i][p.second + j] == '#') continue;
                if (visited[p.first + i][p.second + j]) continue;

                dp[p.first + i][p.second + j] += dp[p.first][p.second];
                dp[p.first + i][p.second + j] %= MOD;

                if (!has[p.first + i][p.second + j]) {
                    que.push(make_pair(p.first + i, p.second + j));
                    has[p.first + i][p.second + j] = true;
                }
            }
        }
    }

    cout << dp[H-1][W-1] << endl;

    return 0;
}

Measured memory_bytes: 11008
#include<stdio.h>

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

    int i,flg=0;
    for(i = 1 ; i <= 9 ; i++){
        if(N%i == 0 && N/i < 10){
            printf("Yes");
            flg++;
            break;
        }
    }
    if(flg == 0){
    printf("No");
    return 0;
    }
}

Measured memory_bytes: 128
from collections import defaultdict
from bisect import bisect_right
s = input()
t = input()
n = len(s)
m = len(t)

# 存在確認
aa = set(s)
for i in t:
    if i not in aa:
        print(-1)
        exit()

d = defaultdict(list)

for i in range(n):
    d[s[i]].append(i)

pos = -1
cnt = 0
for c in t:
    j = bisect_right(d[c], pos)
    if j < len(d[c]):
        pos = d[c][j]
    else:
        cnt += 1
        pos = d[c][0]
print(cnt*n + pos+1)

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

int main() {
	long long int a, b, t, aa, bb;

	while (1) {
		cin>>a;
		if (cin.eof()) break;
		cin>>b;

		aa = a;
		bb = b;

		while (1) {
			if (b==0) break;

			t = b;
			b = a % b;
			a = t;
		}
		cout<<a<<" "<<aa*bb/a<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <cstddef>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>
#include <regex>
#include <complex>

using ll = long long;
using ull = unsigned long long;
using ld = long double;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

constexpr ll lim = 1000000000000000ll;

int main()
{
	using namespace std;
	using std::cin;

	int h, a;
	cin >> h >> a;

	cout << h / a + (h % a == 0 ? 0 : 1) << endl;

	return 0;
}

Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    vx = []
    vy = []
    vh = []
    si = -1
    for i in range(n):
        a,b,c = readInts()
        vx.append(a)
        vy.append(b)
        vh.append(c)
        if vh[i] > 0:
            si = i


    resx,resy,resh = -1,-1,-1
    for cx in range(101):
        for cy in range(101):
            h = vh[si] + abs(cx - vx[si]) + abs(cy - vy[si])
            ok = True
            for i in range(n):
                if vh[i] > 0:
                    if h - vh[i] != abs(cx - vx[i]) + abs(cy - vy[i]):
                        ok = False
                if vh[i] == 0:
                    if h > abs(cx - vx[i]) + abs(cy - vy[i]):
                        ok = False
            if ok:
                resx = cx
                resy = cy
                resh = h
    print(resx,resy,resh)



if __name__ == '__main__':
  main()


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    vector<vector<int>> v(H, vector<int>(W));

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(i<B && j<A) v[i][j] = 1;
            else if(i>=B && j>=A) v[i][j] = 1;
        }
    }

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++)
            cout << v[i][j];
        cout << endl;
    }



    return 0;
}

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

int main()
{
	int n = 0, k = 0;
	unsigned long long a = 2;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a;
		int j = 2;
		while (j <= sqrt(a)) {
			if (a % j == 0)
				break;
			if (j == 2)
				j++;
			else
				j += 2;
		}
		if (j > sqrt(a))
			k++;
	}

	cout << k << endl;
		
	return 0;
}

Measured memory_bytes: 3104
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, s[100010], q, t;
signed main() {
	cin >> n;
	rep(i, n)cin >> s[i];
	cin >> q;
	int ans = 0;
	rep(i, q){
		cin >> t;
		if (binary_search(s, s + n, t))ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* 最大公約数 */
ll gcdx(ll a, ll b) {
    return b ? gcdx(b, a % b) : a;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N)cin >> A[i];
    ll set = A[0];
    REP(i,N){
        set = gcdx(set,A[i]);
    }
    map<ll,bool> diva;
    bool pairwise = 1;
    REP(i,N){
        ll div = A[i];
        if(pairwise == 0)break;
        for(ll l = 2;l*l <= A[i];l++){
            if(pairwise == 0)break;
            if(div % l == 0){
                if(diva[l] == 1){
                    pairwise = 0;
                }else{
                    diva[l] = 1;
                }
                while(div % l == 0){
                    div /= l;
                }
            }
        }
        if(div != 1){
            if(diva[div] == 1){
                pairwise = 0;
            }else{
                diva[div] = 1;
            }
        }
    }
    cout << (pairwise ? "pairwise coprime" : (set == 1 ? "setwise coprime" : "not coprime")) << "\n";
}

Measured memory_bytes: 11124
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N;
  cin >> N;
  map<int, int> m{};
  int M;
  rep(i, N)
  {
    int a;
    cin >> a;
    M = max(a, M);
    m[a]++;
  }
  int ans = 0;
  rep(i, M + 1)
  {
    int tmp = m[i] + m[i - 1] + m[i + 1];
    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N,K;cin>>N>>K;
    ll ans=0;
    if(K!=0){
    for(int b=K+1;b<=N;b++){
        int n=b-K;
        ans+=(ll)(N/b)*n;
        int r=N%b;
        if(r>=K)ans+=(ll)r-K+1;
    }
    }
    else ans=pow(N,2);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++) cin >> a[i];

    for(int i=0;i<N-1;i++) cout << a[i] << ' ';
    cout << a[N-1] << endl;

    for(int i=1;i<N;i++){
        int v = a[i];
        int j = i-1;
        while(j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        for(int k=0;k<N-1;k++) cout << a[k] << ' ';
        cout << a[N-1] << endl;
    }
}


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

int main(){
    int m,n;
    cin >> m >> n;
    int a[m][n];
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            cin >> a[i][j];
        }
    }
    int ans=0;
    for(int i=0;i<m;i++){
        int count=0;
        for(int j=0;j<n;j++){
            if(a[i][j]==1)count++;
        }
        if(count>ans)ans=count;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoders {
	class Program {
		static void Main(string[] args) {
		var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			var K = inputArray[0];

			//ルンルン数を格納するque
			var que = new Queue<long> ();

			for (int i = 1; i < 10; i++) {
				que.Enqueue(i);
			}

			long ans;
			var count = 0;
			while (true) {
				var poped = que.Dequeue();
				var remain = poped % 10;

				if (remain != 0) {
					que.Enqueue(poped * 10 + remain - 1);
				}
				que.Enqueue(poped * 10 + remain);

				if (remain != 9) {
					que.Enqueue(poped * 10 + remain + 1);
				}

				count++;
				if (count == K) {
					ans = poped;
					break;
				}
			}

			Console.WriteLine(ans);
		}



		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}

	
}


Measured memory_bytes: 16864
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
    int n,x=0,ans=0;
    cin>>n;
    char s[n];
    REP(i,n)cin>>s[i];
    REP(i,n){
        if(s[i]=='D')x--;
        if(s[i]=='I')x++;
        ans=max(ans,x);
    }
    cout<<ans<<endl;
}

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

int main() {
  int N;
  cin >> N;
  int64_t x[N+1], y[N+1], z[N+1], w[N+1];
  for (int i=1; i<=N; i++){
    cin >> x[i] >> y[i];
  }
  for (int i=1; i<=N; i++){
    z[i]=x[i]+y[i];
    w[i]=x[i]-y[i];
  }
  int64_t maxz, minz, maxw, minw;
  maxz=max(z[1],z[2]);
  for(int i=3; i<=N; i++){
    maxz=max(maxz,z[i]);
  }
  minz=min(z[1],z[2]);
  for(int i=3; i<=N; i++){
    minz=min(minz,z[i]);
  }
  maxw=max(w[1],w[2]);
  for(int i=3; i<=N; i++){
    maxw=max(maxw,w[i]);
  }
  minw=min(w[1],w[2]);
  for(int i=3; i<=N; i++){
    minw=min(minw,w[i]);
  }
  int64_t a, b, ans;
  a=maxz-minz;
  b=maxw-minw;
  ans=max(a,b);
  cout << ans << endl;
}


Measured memory_bytes: 9852
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

  int num;
  int ans;
  vector<vector<int>> v(n,vector<int>(n,0));
  rep(i,n){
    cin >> a;
    rep(j,a){
      cin >> num >> ans;
      if(ans == 0) v.at(i).at(num-1) = -1;
      else v.at(i).at(num-1) = 1;
    }
  }

  bool rA[n] = {false};
  int cnt = 0;
  int ansmax = 0;
  bool flag = true;

  for(int i = 0; i < (1<<n); i++){
    for(int j = 0; j < n; j++){
      if(i & (1<<j)){
        rA[j] = true;
        cnt++;
      }
    }
    for(int j = 0; j < n; j++){
      if(!flag) break;
      if(!rA[j]) continue;
      for(int k =0; k < n; k++){
        if(v.at(j).at(k) == 1 && !rA[k]){
          flag  = false;
          break;
        }else if(v.at(j).at(k) == -1 && rA[k]){
          flag  = false;
          break;
        }
      }
    }
      if(flag){
        ansmax = max(ansmax,cnt);
      }
      cnt = 0;
      rep(i,n) rA[i] = false;
      flag = true;
  }
  printf("%d\n", ansmax);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX(NUM1, NUM2)		(((NUM1)>(NUM2))?NUM1:NUM2)

int main()
{
  int err;
  int k, x;
  int i;
  
  err = scanf("%d %d", &k, &x);
  
  if(!err)return -1;
  
  for(i=(x-k)+1; i<(x+k); i++)
    printf( ((i!=(x+k)-1)?"%d ":"%d"), i);
  printf("\n");
  
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<ctime>
using namespace std;
int read()
{
	int x=0,f=1;char c=getchar();
	while(c==' '||c=='\n'||c=='-')
	{if(c=='-') f=-f;c=getchar();}
	while(c>='0'&&c<='9')
	{x=x*10+(c-'0');c=getchar();}
	return x*f;
}
string s;
int l,ans=0;
int main(void)
{
	cin>>s;
	l=s.length();
	for(int i=0;i<ceil(l/2);i++)
	{
		char c1=s[i];
		char c2=s[l-i-1];
		if(c1!=c2)
			++ans;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	if n == 0 {
		fmt.Println(0)
		return
	}

	ans := ""
	for n != 0 {
		if n%2 == 0 {
			ans = "0" + ans
		} else {
			n--
			ans = "1" + ans
		}
		n /= -2
	}
	fmt.Println(ans)
}


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

typedef long long ll;

ll a, b, c, two, n;

ll one;

int main() {
	scanf("%lld%lld%lld%lld%lld", &a, &b, &c, &two, &n);
	
	one = std::min(c, std::min(a * 4, b * 2));
	
	if (one * 2 <= two) printf("%lld\n", one * n);
	else printf("%lld\n", (n >> 1) * two + (n & 1) * one);
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdtr1c++.h>
#include<list>
#include<algorithm>
#include<cstdlib>
using namespace std;

int main(){
    string N;
    cin >> N;
    if(N[0] == '9' || N[1] == '9'){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    void Run()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int[] c = new int[9];
        for (int i = 0; i < n; i++)
        {
            int r = sc.NextInt();
            c[Math.Min(r / 400, 8)]++;
        }
        int res = 0;
        for (int i = 0; i < c.Length - 1; i++)
            if (c[i] > 0) res++;
        Console.WriteLine("{0} {1}", res == 0 ? 1 : res, res + c[8]);
    }

    static void Main(string[] args)
    {
        new Program().Run();
    }

    static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


Measured memory_bytes: 13268
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())

point = 0
for i in range(n):
    if (i >= k) & (t[i] == t[i - k]):
        t[i] = 'a'
        continue
    else:
        if t[i] == 'r':
            point += p
        elif t[i] == 's':
            point += r
        else:
            point += s
print(point)

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

using namespace std;

int main() {
  int N, M;
  vector<int> s;
  vector<int> c;
  
  cin >> N >> M;
  
  for (int i = 0; i < M; i++) {
    int si;
    int ci;
    cin >> si >> ci;
    s.push_back(si);
    c.push_back(ci);
  }
  
  int result[N];
  bool invalid = false;
  for (int i = 0; i < N; i++) {
    result[i] = -1;
  }
  for (int i = 0; i < s.size(); i++) {
    int si = s[i];
    int ci = c[i];
    if (N != 1 && si == 1 && ci == 0) {  // pattern: 0XX
      invalid = true;
      continue;
    }
    if (result[si-1] != -1 && result[si - 1] != ci) { // doubly
      invalid = true;
      continue;
    }
    result[si - 1] = ci;
  }

  if (invalid) {
    cout << "-1" << endl;
  } else {
    for (int i = 0; i < N; ++i) {
      if (result[i] == -1) {
        if (i == 0) {
          if (N == 1) {
            cout << 0;
          } else {
            cout << 1;
          }
        } else {
	      cout << 0;
        }
      } else {
	    cout << result[i];
      }
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    vector<ll> D(K,0);
    for(ll i=0;i<K;++i)cin>>D[i];
    for(ll i=0;i<1000000000;++i){
        if(i<N)continue;
        string S=to_string(i);
        bool ok=1;
        for(char p: S){
            for(ll j=0;j<K;++j)if(p-'0'==D[j])ok=0;
        }
        if(ok){
            prt(i)return 0;
        }
    }
    

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int k=sc.nextInt();
    int sum=0;
    if(k<=a)
      sum=sum+k;
    else if(k<=(a+b))
      sum=sum+a;
    else
      sum=sum+a-(k-a-b);
    System.out.println(sum);
  }
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    cin >> n;
    vec<P> a(n);
    REP(i, n) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(all(a), greater<P>());
    Matrix dp(n + 1, Array(n + 1, -INF)); //i番目まで見て、j個左に寄せたとき
    dp[0][0] = 0;

    REP(i, n) {
        REP(l, n) {
            if(dp[i][l] == -INF)
                continue;
            int r = n - 1 - (i - l);
            chmax(dp[i + 1][l], dp[i][l] + a[i].first * abs(r - a[i].second));
            chmax(dp[i + 1][l + 1], dp[i][l] + a[i].first * abs(l - a[i].second));
        }
    }
    ll ans = 0;
    REP(i, n)
    chmax(ans, dp[n][i]);
    cout << ans << en;
}

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

    solve();
    // ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 34620