akhauriyash/Code-Regression huggingface dataset:
n=97
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(j+t-1);a(j+t,n,j+t);[*map(b,r(j+t,j+29))];a(j+29,x,i+t,1);b(j+t-1);a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)if t-30<s<30]

Measured memory_bytes: 9096
#include<cstdio>
using namespace std;
int main(void)
{
	int x,y,cnt,ans,i;
	double a,b,c;
	scanf("%d %d",&x,&y);
	cnt=2;
	a=(double)x/y;
	b=(double)y/x;
	for(i=1;i<y;i++){
		c=x*i%y;
		if(c==0){
			cnt++;
		}
	}
	ans=(x+1+y+1)-cnt;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2756
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<map>
#include<set>
#include<queue>
#include <algorithm>
#define ll long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define forz(i,a,b) for(int i=(a);i<=(b);i++)
#define forf(i,a,b) for(int i=(a);i>=(b);i--)
#define mems(x,v) memset(x,v,sizeof(x))
using namespace std;
int n,i,j,a,b,t,f;
int main()
{
scanf("%d%d",&a,&b);
f=0;
for(i=10*b;i<10*(b+1);i++)
{
    t=i*0.08;
    if(t==a)
    {
        f=1;
        printf("%d",i);
        break;
    }
}
if(f==0)printf("-1");
return 0;
}

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

#include <cmath>
#include <string>

using namespace std;

int main() {
  int n;
  int l[1000];
  int r[1000];
  int sum = 0;

  cin >> n;

  for (int i = 0; i < n; ++i) {
    cin >> l[i] >> r[i];
  }

  for (int i = 0; i < n; ++i) {
    sum += r[i] - l[i] + 1;
  }

  cout << sum << endl;
  
  return 0;
}


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

can = []
left = []

for i in range(nk+1):
  if i != 0:
    left.append(v[i-1])
  right = []
  for j in range(nk-i+1):
    if j != 0:
      right.append(v[-j])
    tmp = left + right
    tmp.sort()
    now = sum(tmp)
    rest = min(k-i-j,len(tmp))
    for h in range(rest):
      if tmp[h] < 0:
        now -= tmp[h]
    can.append(now)
print(max(can))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#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 Graph = vector<vector<int>>;
using ll = long long;


int main() {
    int x;
    cin>>x;
    int count500=x/500;
    int count5=(x-500*count500)/5;
    cout<<count500*1000+count5*5<<endl;
}

Measured memory_bytes: 3620
n = int(input())
dic = {}
march = set(['M', 'A', 'R', 'C', 'H'])
for i in range(n):
  s = input()[0]
  if s in march:
    dic.setdefault(s, 0)
    dic[s] += 1
if len(dic) <= 2:
  print(0)
  exit()
march = ['M', 'A', 'R', 'C', 'H']
for t in march:
  dic.setdefault(t, 0)
march = ['MAR', 'MAC', 'MAH', 'MRC', 'MRH', 'MCH', 'ARC', 'ARH', 'ACH', 'RCH']
res = 0
for t in march:
  res += (dic[t[0]] * dic[t[1]] * dic[t[2]])
print(res)

Measured memory_bytes: 9240
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  int p[n];
  int count = 0;
  for(int i = 0; i < n; i++){
    cin >>p[i];
  }
  for(int i = 0; i<n;i++){
    if(i+1 != p[i])count++;
  }
  if(count==2 || count==0){
    cout <<"YES";
  }else{
    cout << "NO";
  }
}



Measured memory_bytes: 256
import sys
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    d = defaultdict(int)
    for _ in range(n):
        d[input()] += 1
    max_v = max(d.values())
    d_sorted = sorted(d)

    for word in d_sorted:
        if d[word] == max_v:
            print(word)

if __name__ == '__main__':
    main()


Measured memory_bytes: 32480
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;

int main(){
  int n;
  cin >> n;
  vector<int> an(n);
  int cnt = 0, memo = INF;
  ll ans = 0;
  for(int i=0; i<n; ++i){
    cin >> an[i];
    if(an[i] <0){
      ++cnt;
      ans += abs(an[i]);
    }else{
      ans += an[i];
    }
    memo = min(memo, abs(an[i]));
  }
  if(cnt%2 == 0){
    cout << ans << endl;
  }else{
    ans -= memo *2;
    cout << ans << endl;
  }
}

Measured memory_bytes: 3792
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,kane,g;
    kane=0;
    g=99999;
    cin>>a>>b>>c;
    while(1){
        if(a%g==0&&b%g==0){
            break;
        }
        g--;
    }
    kane=(a/g)*(b/g)*c;
    cout<<kane<<endl;
}



Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int f(int n) {
    if (n % 2 == 0) return n / 2;
    else return 3 * n + 1;
}

int main() {
    int s;
    cin >> s;
    
    vector<int> a;
    set<int> b;
    a.push_back(s);
    b.insert(s);
    int cnt = 0;
    while (true) {
        if (b.count(f(a[cnt]))) break;
        a.push_back(f(a[cnt]));
        b.insert(f(a[cnt]));
        ++cnt;
    }
    cout << cnt + 2 << endl;
    return 0;
}


Measured memory_bytes: 256
# ABC127 D-Integer Cards
from operator import itemgetter
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

A.sort()
BC.sort(key=itemgetter(1),reverse=True)

c = 0
for i in range(M):
    for j in range(BC[i][0]):
        if A[c] < BC[i][1]:
            A[c] = BC[i][1]
        else:
            print(sum(A))
            exit()
        c += 1
        if c == N:
            print(sum(A))
            exit()

print(sum(A))

Measured memory_bytes: 32972
def main():
    N = int(input())
    A = (
    1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889,
    13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857,
    71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836,
    194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709,
    397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712,
    709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467,
    1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570,
    1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104,
    2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249,
    3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949,
    4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008,
    5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016,
    6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897,
    8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813,
    10493367, 10611772, 10813692)
    print(A[N - 1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 62816
#include <stdio.h>

//---------------------------------------
void seiseki(int m, int f, int r);
//---------------------------------------

int main(void)
{
	int m, f, r; //m_??????????¨?, f_??????????¨?, r_???????¨?

	while(1){
		scanf("%d %d %d", &m, &f, &r);
		if(m == -1 && f == -1 && r == -1){
			break;
		}
		else{
			seiseki(m, f, r);
		}
	}
   return 0;
}
//-----------------------------------------
void seiseki(int m, int f, int r)
{
	if((m == -1) || (f == -1) || ((m + f) < 30)){  //??????????¨??????????????¨????????????????????¬????????????´???????????? F
		printf("F\n");
	}
	else if(((m + f) < 50) && (r < 50)){  //??????????¨???¨??????????¨????????¨??????°??? 30 ??\??? 50 ?????? ??????50??????????????°????????? D
	    printf("D\n");
	}                                         
	else if((m + f) < 65){  //??????????¨???¨??????????¨????????¨??????°??? 50 ??\??? 65 ??????????????°????????? C
		printf("C\n");
	}
	else if((m + f) < 80){  //??????????¨???¨??????????¨????????¨??????°??? 65 ??\??? 80 ??????????????°????????? B
		printf("B\n");
	}
	else{
		printf("A\n");
	}

}

Measured memory_bytes: 2596
while True:
    h, w = map(int, input().split())

    if h==0 and w ==0:
        break
    # print('*'*h)
    else:
        count=1
        for i in range(0, h):
            if count==1:
                print('#'*w)
            elif count==h:
                print('#'*w)
            else:
                print('#'+'.'*(w-2)+'#')
            count+=1
    print()



Measured memory_bytes: 5616
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, m, i, j, ans=0;
    vector<int> t(100), p(100), x(100);

    cin >> n;
    for(i=0;i<n;i++){
        cin >> t.at(i);
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> p.at(i) >> x.at(i);
    }

    for(i=0;i<m;i++){
        ans=0;
        for(j=0;j<n;j++){
            if(j==p.at(i)-1) ans=ans+x.at(i);
            else ans=ans+t.at(j); 
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
N = int(input())

if N < 105:
    print(0)
else:
    c = 0
    for n in range(105, N+1, 2):
        nf = 0
        for i in range(1, n+1):
            if n%i == 0:
                nf += 1
        if nf == 8:
            c += 1
    print(c)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main(){
  int n;  scanf("%d", &n);
  char s[103][12];
  int p[103];
  int mark[103] = {0};
  char tmps[12];
  int tmpp = 0, flag = 0;
  
  for(int i=1; i<=n; i++)
    scanf("%s %d", s[i], p+i);

  do{
    flag = 0;
    strcpy(tmps, "zzzzzzzzzzz");
    for(int i=1; i<=n; i++){
      if(mark[i])  continue;
      if(strcmp(tmps, s[i]) > 0){
	strcpy(tmps, s[i]);
	tmpp = p[i];
	flag = i;
      }else if(strcmp(tmps, s[i])==0 && tmpp < p[i]){
	tmpp = p[i];
	flag = i;
      }
    }
    if(flag)  printf("%d\n", flag);
    mark[flag] = 1;
  }while(flag);

  return 0;
}


Measured memory_bytes: 128
def checkBingo(A,c):
    for i in range(3):
        for j in range(3):
            if A[i][j]==c:
                A[i][j]=0

    for i in range(3):
        if max(A[i])==0 :
            return 1
    for i in range(3):
        if A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
            return 1
    if A[0][0]==0 and A[1][1]==0 and A[2][2]==0:
        return 1
    if A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
        return 1
    return 0

A=[]
for i in range(3):
    A.append( list(map(int,input().split()) ))

# print(A, min(A[0]),min(A[1]),min(A[2]))
n = int(input())

res=0
for i in range(n):
    b = (int(input()))
    # print(A)
    res += checkBingo(A,b)

if res :
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll N;
	cin>>N;
	ll h[N];
	for(ll i=0;i<N;i++)
		cin>>h[i];
	ll ans=0;
	ll dp[N];
	dp[0]=0;
	dp[1]=dp[0]+abs(h[1]-h[0]);
	for(ll i=2;i<N;i++)
	{
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	cout<<dp[N-1];
}

Measured memory_bytes: 1792
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int D = max(A, B);
    int E = max(D, C);
    int F = (E * 3) - (A + B + C);

    if (F % 2 == 1) {
        cout << F / 2 + 2 << endl;
    }
    else {
        cout << F / 2 << endl;
    }
}

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

int main()
{
	int A,B,C,D,x,min,max;
	cin >> A >> B >> C >> D;
	if(A >= B || C >= D || A < 0 || B > 100 || C < 0 || D >100)
	exit(0);
	if(C > B || A > D)
	x = 0;
    else
	{
	if(A < C)
        max = C;
    else
        max = A;
    if(B < D)
        min = B;
    else
        min = D;
    x = min - max;
    }
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    int ans = 0, N = S.length();
    for(int i = 0; i < N / 2; ++i)
        ans += (S[i] != S[N - i - 1]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ll  long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define Fast_IO() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
#define ld long double
using namespace std;
clock_t time_p = clock();
void dem()
{

        time_p=clock()-time_p;
        cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
using namespace std ;
const ll MAX =  1000 * 1000 ;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
const int MOD = 1000 * 1000 * 1000 + 9 ;
const int N = 301 ;
const int INF = INT_MAX ;
const int M = 200005;
const double EPS = 1e-9 ;
ld dis ( pii &a , pii &b  ){
ld  d = 0.0 ;
d =  sqrt((ld)( a.ff - b.ff ) * ( a.ff - b.ff ) + (ld) ( a.ss - b.ss) * (a.ss - b.ss ) )  ;
return d ;
}
int main (){

     int n ;
     cin >> n ;
    vector<pii> v ( n );
    vector<int>per;
    for (auto &i : v )
        cin >> i.ff >> i.ss ;
    for ( int i = 0 ; i < n ;++ i )
        per.pb(i) ;
     ld res = 0 ;
     ld sz = 0 ;
     do {
            ld cur = 0 ;
            for ( int i = 1 ; i < n ; ++ i ){
                cur += dis ( v[ per[ i ] ]  , v[ per[ i - 1 ] ]) ;
            }
            ++sz ;
            res += cur ;

     }while ( next_permutation(all( per ))) ;

      cout<<setprecision(20)<< ( res / sz )  ;

    return 0 ;
}
/*
9
2 3 1 0 4 5 33 32 3
*/




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

using namespace std;

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

    string s;
    cin >> s;

    int ans = 0;
    for (int i = 0, j = s.length() - 1; i < j; i++, j--) {
        if (s[i] != s[j]) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
class PrioirtyQueue
  
  def initialize()
    @val = []
  end

  def push(x)
    @val.push(x)
    idx = @val.size - 1
    while (idx > 0 and @val[idx-1][0] < @val[idx][0])
      @val[idx - 1], @val[idx] = @val[idx], @val[idx - 1]
      idx = idx - 1
    end
  end

  
  def top()
    return @val[0]
  end

  def lastPop()
    return @val.pop()
  end
  
  def pop()
    res = @val[0]
    @val.shift()
    return res
  end

  def getVal()
    return @val
  end

  def size()
    return @val.size
  end
end


X, Y, Z, k = gets.chomp.split(' ').map{|x| x.to_i}
A = gets.chomp.split(' ').map{|x| x.to_i}.sort.reverse
B = gets.chomp.split(' ').map{|x| x.to_i}.sort.reverse
C = gets.chomp.split(' ').map{|x| x.to_i}.sort.reverse

q = PrioirtyQueue.new()
q.push([A[0]+B[0]+C[0], 0, 0, 0])


def push(q, used, v, a, b, c)
  key = [a, b, c].to_s
  if used.key?(key)
    return
  end
  used[key] = 1
  q.push([v, a, b, c])
end

used = {}     
while k != 0
  ans, a, b, c = q.pop()
  k -= 1
  p ans
  
  if a < X-1
    push(q, used, A[a + 1] + B[b] + C[c], a + 1, b, c)
  end
  if b < Y-1
    push(q, used, A[a] + B[b + 1] + C[c], a, b + 1, c)
  end
  if c < Z-1
    push(q, used, A[a] + B[b] + C[c + 1], a, b, c + 1)
  end

  while q.size > k
    q.lastPop()
  end
    
end







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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   ll n; cin>>n;
   int res=0;
   vector<int> pw;
   for(ll p=2;p*p<=n;p++)if(n%p==0){
      pw.push_back(0);
      while(n%p==0){
         n/=p; pw.back()++;
      }
   }
   if(n!=1)pw.push_back(1);
   for(int x:pw){
      int add=0;
      while(add*(add+1)/2<=x)add++;
      res+=add-1;
   } cout<<res<<endl;
   return 0;
}


Measured memory_bytes: 3632
N , M = map(int ,input().split())
left = 1
right = N
for i in range(M):
    tmp_left , tmp_right = map(int ,input().split())
    if left < tmp_left:
        left = tmp_left
    if right > tmp_right:
        right = tmp_right
ans = right - left + 1
if ans < 0:
    print("0")
else:
    print(right - left + 1)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>

int main(){
	int n,i,s;
	
	while(~scanf("%d",&n)){
		if(n==0)break;
		
		s=0;
		for(i=2;n*2>=i*i;i++){
			if(i%2==1 && (double)n/i==n/i){
				++s;
				continue;
			}
			if(i%2==0 && (double)n/i-n/i==0.5){
				++s;
				continue;
			}
		}
		printf("%d\n",s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll =  long long;

using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;


constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace { 
	template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
	template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
	template<typename T> void chadd(T& a, T b) { a = a + b; }

	template <typename T> void Cout(T& x, char end = '\n') { std::cout << x << end; }
	template <typename T> void Cout(std::vector<T>& x, char sep = ' ', char end = '\n') { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }


	// 標準入出力
	struct inp {
		size_t sz;
		inp(size_t _sz = 1) : sz(_sz) {}
		template <typename T> operator T () const { T a; std::cin >> a; return a; }
		template <typename T> operator std::vector<T>() const { vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
		template <typename T, typename U> operator std::pair<T, U>() const { T f; U s; std::cin >> f >> s; return std::pair<T, U>(f, s); }
	};

	inp inp1; // input one
}


int main() {

	string s = inp1;
	reverse(allof(s));
	int n = s.size();

	// 桁DP
	// dp[i][f] := i + 1桁目まで支払いが完了したときにフラグがfの時の最小コスト
	// f=0? ぴったり払う : 余分に払う

	vector<vector<int>> dp(n + 1, vector<int>(2, inf));
	dp[0][0] = 0;
	//dp[0][1] = 0;

	rep(i, n) {
		// ぴったり払うとき
		chmin(dp[i + 1][0], dp[i][0] + (s[i] - '0'));
		if (s[i] != '9')
			chmin(dp[i + 1][0], dp[i][1] + (s[i] - '0' + 1));
		else
			chmin(dp[i + 1][1], dp[i][1]);
		// 余分に払うとき
		chmin(dp[i + 1][1], dp[i][0] + ('9' - s[i] + 1));
		if (s[i] != '9')
			chmin(dp[i + 1][1], dp[i][1] + ('9' - s[i]));
		else
			chmin(dp[i + 1][1], dp[i][1]);
	}

	Cout(min(dp[n][0], dp[n][1] + 1));

	return 0;
}

Measured memory_bytes: 55940
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
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;}
typedef long long ll;
const int INF = 1e9;

string S, T;



int main()
{
    cin >> S >> T;
    int sizes = S.size();
    int sizet = T.size();
    if(sizes < sizet){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    // 一致する可能性のある場所を探索、全部？なら次のループ
    vector<string> answers;
    REP(i,sizes){
        if(sizes - i < sizet) break;
        bool isok = true;
        string ans = S;
        REP(j,sizet){
            if(S[i+j]==T[j]){
                continue;
            } else if(S[i+j]=='?'){
                ans[i+j] = T[j];
            } else {
                isok = false;
            }
        }
        // TがSの部分文字列だったら、?を全てaに変える。
        // Sの前から後ろに一致列を探索してるため、後に追加した物の方が辞書順は前になる。
        if(isok){
            REP(i,sizes) if(ans[i]=='?') ans[i] = 'a';
            answers.push_back(ans);
        } 
    }
    if(answers.size()==0) cout << "UNRESTORABLE" << endl;
    else cout << answers[answers.size()-1] << endl;
    return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    
    int ans = 0, p = 1;
    vi used(n, 0);
    Rep(i, n) {
        int tmp = 0;
        int l = 0 + i, r = n-1 - i;
        while (l < data.size()-i && r > i && l != r && used[l] != p && used[r] != p) {
            tmp += data[l] + data[r];
            used[l] = used[r] = p;
            l += i; r -= i;
            ans = max(ans, tmp);
        }
        p++;
    }

    std::cout << ans << std::endl;


    return 0;
}


Measured memory_bytes: 1920
#include <stdio.h>
#define BUFSZ 100

int main(void){
    char buf[BUFSZ+1];
    int cnt=0;
    char *end,*ptr;
    bool regul;
    
    while (scanf("%s", buf) != EOF){
        regul=true;
        for (end=buf; *end!='\0'; end++);
        for (ptr=buf, end--; ptr < end; ptr++,end--){
          if (*ptr != *end) regul=false;
        }
        if (regul) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

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

// 0-indexed
// now node k
// child node k*2+1 and k*2+2
// parent node (k-1)/2
struct data {
  int a;
};
const int maxint = 2147483647;
data resetdata = {maxint};
struct RMQ {
  // except bottom size
  int sizen;
  vector<data> dat;
  RMQ(int newn = 1, data resets = resetdata) {
    reset(newn, resets);
  }
  void reset(int newn = 1, data resets = resetdata) {
    sizen = 1;
    while(sizen < newn) sizen *= 2;
    dat.resize(2 * sizen - 1);
    for(int i = 0; i < dat.size(); ++i) dat[i] = resets;
  }
  // "go up" process
  // data[k].a = newnum
  bool update(int k, int newnum) {
    k += sizen - 1;
    dat[k].a = newnum;
    while(k > 0) {
      k = (k - 1) / 2;
      dat[k].a = min(dat[k * 2 + 1].a, dat[k * 2 + 2].a);
    }
    return 1;
  }
  // "go down" process
  // return min number in [a,b)
  // pick(a,b,0,0,sizen)
  int pick(int a, int b, int k = 0, int l = 0, int r = -1) {
    if(r == -1) r = sizen;
    // [l,r)[a,b) or [a,b)[l,r)
    if(r <= a || b <= l) return maxint;
    // [a,[l,r),b)
    if(a <= l && r <= b) return dat[k].a;
    // else
    int nowl, nowr, nextlr = k * 2 + 1, med = (l + r) / 2;
    nowl = pick(a, b, nextlr, l, med);
    nowr = pick(a, b, nextlr + 1, med, r);
    return min(nowl, nowr);
  }
};

long long k;
vector<long long> v, sv, ans;
RMQ rmq;

long long calc(long long x) {
  long long ans = 0;
  while(x > 0) {
    ans += x % 10;
    x /= 10;
  }
  return ans;
}
bool asc(const long long l, const long long r) {
  long double lc = (long double)l / calc(l),
              rc = (long double)r / calc(r);
  if(lc != rc)
    return lc < rc;
  else
    return l < r;
}
void solve();

int main() {
  cin >> k;
  solve();
  for(int i = 0; i < k; ++i) cout << ans[i] << endl;
  return 0;
}

void solve() {
  long long ten = 1, nine = 0;
  while(1) {
    bool fin = 0;
    for(long long i = 1; i <= 150; ++i) {
      if(ten * i + nine > (long long)1e17) {
        fin = 1;
        break;
      }
      v.push_back(ten * i + nine);
      sv.push_back(ten * i + nine);
    }
    if(fin) break;
    nine *= 10;
    nine += 9;
    ten *= 10;
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  sort(sv.begin(), sv.end());
  sv.erase(unique(sv.begin(), sv.end()), sv.end());
  sort(sv.begin(), sv.end(), asc);
  rmq = RMQ(sv.size(), {1});
  for(int i = 0; i < sv.size(); ++i) {
    long long now = sv[i], id = 0;
    id = lower_bound(v.begin(), v.end(), now) - v.begin();
    if(id == 0 || rmq.pick(id, v.size())) {
      ans.push_back(now);
    }
    rmq.update(id, 0);
  }
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#define FOR(i,a,b) for(int i=(a);i<(b);++i) 
#define REP(i,n) FOR(i,0,n)
#define EACH(x,a) for(auto& (x):(a))
#define ALL(obj) (obj).begin(),(obj).end()
#define Yes(n) cout<<((n)?"Yes":"No")<<endl;
using namespace std;
using ll=long long;
const int INF=1e9;
const ll LINF=1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}


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

  string S; cin>>S;
  int l = S.length();
  if(l==2) cout<<S<<endl;
  else{
    reverse(ALL(S));
    cout<<S<<endl;
  }

  return 0;
}


Measured memory_bytes: 764
H,W,K = map(int, input().split())

import numpy as np

A = np.zeros([H,W])
cntResult = 0

for i in range(H):
    B = input()
    for j in range(W):
        if B[j] == '.':
            A[i,j] = 0
        else:
            A[i,j] = 1

sumA = np.sum(A)
sumH = [0]*H
sumW = [0]*W
for i in range(H):
    sumH[i] = np.sum(A[i,:])

for i in range(W):
    sumW[i] = np.sum(A[:,i])


for i in range(2**H):
    cntH = format(i, '0%db' % H)
    for j in range(2**W):
        cntW = format(j, '0%db' % W)
        result = 0
        for k in range(H):
            for l in range(W):
                if int(cntH[k]) == 0 and int(cntW[l]) == 0:
                    result += A[k,l]
        if result == K:
            cntResult += 1

print(cntResult)


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

using namespace std;

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

#define st first
#define nd second

const int MAXN = 1e6 + 5, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18, MOD = 1e15 + 37;
const ld PI = acos(-1);

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

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

    char c;
    cin >> c;
    cout << (c >= 'A' && c <= 'Z' ? 'A' : 'a') << "\n";
}


Measured memory_bytes: 3688
n = int(input())
nums = []
for i in range(n):
  nums.append(int(input()))
count = 0
for j in range(n):
  if nums[j]%2 == 0:
    count += (nums[j]//2)
    nums[j] = 0
  else:
    if 0 < j and 0 < nums[j-1]:
      count += (nums[j]//2) + 1
      nums[j] = 0
      nums[j-1] = 0
    elif j < n-1 and 1 <= nums[j+1]:
      count += (nums[j]//2) + 1
      nums[j] = 0
      nums[j+1] -= 1
    else:
      count += (nums[j]//2)
      nums[j] = 1
print(count)

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

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ')
                           .Select(s => int.Parse(s))
                           .Distinct();
            var min = a.Min();
            var max = a.Max();
            Console.WriteLine(max - min);
        }
    }
}

Measured memory_bytes: 27908
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, char> Pc;
typedef pair<int, string> Ps;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
const int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const string dir8[8] = {"U", "RU", "R", "RD", "D", "LD", "L", "LU"};

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
struct Node { int data; Node *left, *right; Node(int data) : data(data), left(NULL), right(NULL) {} };
// clang-format on

int N, M, Q;
void rec(vector<int> A) {}
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A) {
  if (A.size() == N + 1) {
    int now = 0;
    REP(i, Q) {
      if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }

  A.push_back(A.back());
  while (A.back() <= M) {
    dfs(A);
    A.back()++;
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  cin >> N >> M >> Q;
  a = b = c = d = vector<int>(Q);
  REP(i, Q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i], b[i];
  }
  dfs(vector<int>(1, 1));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3112
fun main(args: Array<String>) {
    a59(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}


fun a59(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val charArray = args[0].split(" ").map { it[0].toUpperCase() }.toCharArray()
    println(charArray)
}



Measured memory_bytes: 38240
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr = new int[10];
            for (int i = 0; i <= 9; i++)
            {
                arr[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(arr);
            for (int i = 9; i >= 7; i--)
            {
                Console.WriteLine(arr[i]);
            }
        }
    }
}

Measured memory_bytes: 20060
fun main(args: Array<String>) {
    val n = Integer.parseInt(readInputLine())
    val s = readInputLine()
    val k = Integer.parseInt(readInputLine())
    
    val notReplaceChar = s.get(k - 1)
    val charList = s.toCharArray().map { c -> if (c != notReplaceChar) {'*'} else {c}}
    var res = ""
    for (c in charList) {
        res = res + c.toString()
    }
    println(res)
}

fun readInputLine(): String {
    return readLine()!!
}


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

int main(){
    cout << fixed <<setprecision(10);
    int n; cin>>n;
    vector<double> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end(),greater<>());
    for(int i=0;i<n-1;i++){
        v[n-1-i-1]= (v[n-1-i]+v[n-1-i-1])/2;
    }
    cout << v[0]<<endl;

    
}

Measured memory_bytes: 256
S=input()
T=input()
dict1={}
a=0
for i in range(len(S)):
  if S[i] in dict1:
    if dict1[S[i]]!=T[i]:
      a=1
  else:
    dict1[S[i]]=T[i]
dict2={}
for i in range(len(T)):
  if T[i] in dict2:
    if dict2[T[i]]!=S[i]:
      a=1
  else:
    dict2[T[i]]=S[i]
if a==0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define inf 1e9
#define pi 3.1415926536
#define mod 1000000007
#define fr(i,a,b,in) for(int i=a;i<b;i+=in)
#define frn(i,a,b,dc) for(int i=a;i>=b;i-=dc)
#define test(t) int t; cin>>t; while(t--)
int main()
{
	fastio();
	string st="ACL",ans="";
	int k;
	cin>>k;
	fr(i,0,k,1){
		ans+=st;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long

//union find
struct union_find{
    int *parent; //parent[i]=parent of i
    int N;
    union_find(int N):N(N){
        parent=new int[N];
        rep(i,N)parent[i]=i; //init
    }
    int root(int x){ // take the root of x 
        if(parent[x]==x) return x;
        parent[x]=root(parent[x]); // recursion
        return parent[x];
    }
    void unite(int x,int y){// unite tree y to tree x
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return;
        parent[ry]=rx;
    }
    bool same(int x,int y){
        int rx=root(x);
        int ry=root(y);
        return rx==ry;
    }
    bool IsAllSameTree(){
        int rt=parent[0];
        rep(i,N){
            if(rt!=parent[i])return false;
        }
        return true;
    }
};

int main(){
    int N;char s[100004];
    scanf("%d",&N);
    scanf("%s",&s);
    union_find uf((N+1)*4);
    //iとi+1番目のペア…i*4+a (a:羊羊=0 羊狼=1 狼羊=2 狼狼=3)
    rep(i,N-1){
        if(s[i+1]=='o'){
            uf.unite(i*4+0,(i+1)*4+0);
            uf.unite(i*4+1,(i+1)*4+3);
            uf.unite(i*4+2,(i+1)*4+1);
            uf.unite(i*4+3,(i+1)*4+2);
        }else{
            uf.unite(i*4+0,(i+1)*4+1);
            uf.unite(i*4+1,(i+1)*4+2);
            uf.unite(i*4+2,(i+1)*4+0);
            uf.unite(i*4+3,(i+1)*4+3);
        }
    }
    int parent=-1;int end=-1;char ans[100004];
    if(s[0]=='o'){
        if(uf.root((N-1)*4+0)==0){parent=uf.root(0);end=0;}
        if(uf.root((N-1)*4+1)==3){parent=uf.root(3);end=1;}
        if(uf.root((N-1)*4+2)==1){parent=uf.root(1);end=2;}
        if(uf.root((N-1)*4+3)==2){parent=uf.root(2);end=3;}
    }else{
        if(uf.root((N-1)*4+0)==1){parent=uf.root(1);end=0;}
        if(uf.root((N-1)*4+1)==2){parent=uf.root(2);end=1;}
        if(uf.root((N-1)*4+2)==0){parent=uf.root(0);end=2;}
        if(uf.root((N-1)*4+3)==3){parent=uf.root(3);end=3;}
    }
    if(parent==-1){printf("-1\n");return 0;}
    if(end<2)ans[N-1]='S';
    else ans[N-1]='W';
    for(int i=N-2;i>-1;i--){
       if(s[i+1]=='o'){
           if(ans[i+1]=='S'&&uf.root(i*4+0)==parent){ans[i]='S';continue;}
           if(ans[i+1]=='S'&&uf.root(i*4+2)==parent){ans[i]='W';continue;}
           if(ans[i+1]=='W'&&uf.root(i*4+3)==parent){ans[i]='W';continue;}
           if(ans[i+1]=='W'&&uf.root(i*4+1)==parent){ans[i]='S';continue;}
        }else{
            if(ans[i+1]=='S'&&uf.root(i*4+0)==parent){ans[i]='S';continue;}
            if(ans[i+1]=='S'&&uf.root(i*4+2)==parent){ans[i]='W';continue;}
            if(ans[i+1]=='W'&&uf.root(i*4+1)==parent){ans[i]='S';continue;}
            if(ans[i+1]=='W'&&uf.root(i*4+3)==parent){ans[i]='W';continue;}
        }
    }
    ans[N]='\0';
    printf("%s\n",ans);
}

Measured memory_bytes: 2048
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] arr = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1,
				51 };
		System.out.println(arr[N-1]);
	}
}

Measured memory_bytes: 27072
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define pii pair<int,int>
#define pb(x) push_back(x)
#define lbound lower_bound
#define ubound upper_bound
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcountll(x)
#define heap_min priority_queue<int,vector<int>,greater<int>>
#define heap_max priority_queue<int>
#define precision(x) cout << setprecision(x) << fixed;
#define printv(v) for(auto p : v) cout << p << " ";
#define printa(a,n) for(int i = 0 ; i < n ; i++) cout << a[i] << " "; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int32_t main()
{
   fast;
   #ifndef ONLINE_JUDGE
   freopen("goodluckin.txt","r",stdin);
   freopen("goodluckout.txt","w",stdout);
   #endif
   
   int l,r,d;
   int n,c = 0;
   cin >> n;
   for(int i = 1 ; i<=n ; i++){
    cin >> l;
    if(l%2==1 && i%2==1){
      c++;
    }
   }
   cout << c;
}


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

pub 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 s = read::<String>().chars().collect::<Vec<char>>();

    let mut cnt = 0;
    for i in 0..s.len()/2 {
        if s[i] != s[s.len()-i-1] {
            cnt+=1;
        }
    }
    println!("{}", cnt);
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename Tuple, size_t N>
struct TuplePrinter {
  static void print(const Tuple &t) {
    TuplePrinter<Tuple, N-1>::print(t);
    cout << ", " << get<N-1>(t);
  }
};

template<typename Tuple>
struct TuplePrinter<Tuple, 1> {
  static void print(const Tuple &t) {
    cout << get<0>(t);
  }
};

template<typename... T>
ostream &operator<<(ostream &os, const tuple<T...> &tup) {
  os << "(";
  TuplePrinter<decltype(tup), sizeof...(T)>::print(tup);
  return os << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }


int main() {
  double l; cin>>l;
  double x = l/3;
  print(x * x * x);

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;

void solve(){
	int N;
	cin>>N;
	int ans=1;
	rep(i,2,N+1){
		bool isGood=0;
		rep(j,2,i){
			if(i%j==0){
				isGood=1;
				break;
			}
		}
		if(!isGood){
			ll cur=i;
			ll sum=0;
			while(N/cur){
				sum+=N/cur;
				cur*=i;
			}
			ans=(1LL*ans*(sum+1))%hell;
		}
	}
	cout<<ans;
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<ll>a(n+2),b(n+2),now(n+2);
    bool f=1;
    rep(i,n)cin>>a[i+1];
    rep(i,n)cin>>b[i+1];
    a[0]=a[n];
    a[n+1]=a[1];
    b[0]=b[n];
    b[n+1]=b[1];
    rep(i,n+2){
        now[i]=b[i];
    }
    queue<ll>q;
    REP(i,1,n+1){
        if(b[i]==a[i])continue;
        if(b[i-1]+b[i+1]<=b[i]-a[i]){
            q.push(i);
        }
    }
    ll cnt=0;
    while(!q.empty()){
        ll k=q.front();
        q.pop();
        ll d=now[k+1]+now[k-1];
        ll dd=now[k];
        dd-=a[k];
        cnt+=dd/d;
        dd%=d;
        dd+=a[k];
        now[k]=dd;
        if(k==1)now[n+1]=now[k];
        if(k==n)now[0]=now[k];
        ll i=k+1;
      if(i==n+1)i=1;
        if(now[i]==a[i]);
        else if(now[i-1]+now[i+1]<=now[i]-a[i]){
            q.push(i);
        }
        i=k-1;
      if(i==0)i=n;
        if(now[i]==a[i]);
        else if(now[i-1]+now[i+1]<=now[i]-a[i]){
            q.push(i);
        }
        //rep(j,n+2)cout<<now[j]<<' ';
        //cout<<endl;
    }
    REP(i,1,n+1){
        if(a[i]!=now[i])f=0;
        //cout<<a[i]<<' '<<now[i]<<endl;
    }
    cout<<(f?cnt:-1)<<endl;
}

Measured memory_bytes: 5760
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 320000
#define mod 1000000007
char s[N];
int n, f[N][7];
void Add(int b, int &a){a = (a + b) % mod;}
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	f[0][0] = 1;
	for (int i = 1; i <= n; i++)
	{
		if (s[i] == '?' || s[i] == '0')
		{
			Add(f[i - 1][0], f[i][1]);
			Add(f[i - 1][1], f[i][2]);
			Add(f[i - 1][2], f[i][1]);
			Add(f[i - 1][3], f[i][4]);
			Add(f[i - 1][4], f[i][5]);
			Add(f[i - 1][5], f[i][4]);
			Add(f[i - 1][6], f[i][6]);
		}
		if (s[i] == '?' || s[i] == '1')
		{
			Add(f[i - 1][0], f[i][3]);
			Add(f[i - 1][1], f[i][0]);
			Add(f[i - 1][2], f[i][1]);
			Add(f[i - 1][3], f[i][6]);
			Add(f[i - 1][4], f[i][3]);
			Add(f[i - 1][5], f[i][4]);
			Add(f[i - 1][6], f[i][6]);
		}
	}
	printf("%d\n", (f[n][3] + f[n][6]) % mod);
}



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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 1001001001;

vi cities;
vi a;
vector<bool> visited;
bool blocked = false;

int dfs(int v){
	// cout << v << endl;
	if(visited[v]) return v;
	visited[v] = true;
	cities.push_back(v);
	return dfs(a[v]);
}

int main(){
	ll n; cin >> n;
	unsigned long long k; cin >> k;
	a = vi(n); visited = vector<bool>(n,false);
	rep(i, n){
		int t; cin >> t;
		a[i] = t-1;	
	} 
	int end = dfs(0);
	ll leng = cities.size();
	int pos = find(all(cities), end) - cities.begin();
	// rep(i, cities.size()) cout << cities[i] << " ";
	// cout << endl;
	// cout << "pos" <<pos << "end" << end <<endl;
	if (k < leng){
		cout << cities[k] + 1 << endl;
	} else {
		int loop = leng - pos;
		k -= pos;
		k = k % loop;
		cout << cities[pos + k] + 1 <<endl;
	}
}

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


int main(){
  int A, B, C;
  cin >> A >> B >> C;
  bool possible = false;
  for (int i = 0; i<B;i++){
    if (A*i % B ==C) possible = true;
  }

  cout << (possible ? "YES":"NO") << endl;

}
 

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N;
  string S;
  cin >> N >> S;
  int x = 0;
  int maxx = 0;
  for(int i=0;i<N;i++){
    if(S[i] == 'I') x++;
    else x--;
    if(x > maxx) maxx = x;
  }
  cout << maxx << endl;
  return 0;
}
    

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

long long n;

int main(){
    ios_base::sync_with_stdio(0);
    //freopen("input.txt","r",stdin);

    cin>>n;
    long long sum = 0;
    for(long long k=1;k<=n;k++)
    {
        long long nk = n/k;
        sum += k*nk*(nk+1)/2;
    }
    cout<<sum;
}


Measured memory_bytes: 3684
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int X = sc.nextInt();
		int Y = sc.nextInt();
		System.out.println((Y%2==0 && X*2<=Y && Y<=X*4)? "Yes" : "No");

		sc.close();
	}
}


Measured memory_bytes: 27076