akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int m = fs.nextInt();
		int d = fs.nextInt();
		
		int ans=0;
		
		for(int i = 2; i <= d; i++) {
			
			int d1 = i % 10;
			int d2 = i / 10;
			
			if(d1 < 2 || d2 < 2) {
				continue;
			}
			
			int mul = d1 * d2;
			
			if(2 <= mul && mul <= m) {
				ans++;
			}
		}
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 21076
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String S=sc.next();
//		String S="";
//		for(int i=0;i<500000;i++) {
//			S=S+"ab";
//		}
		char c[]=S.toCharArray();
		int N=c.length;
		char d[]=new char[N];
		int x[]=new int[N+1];
		int j=0;
		int count=0;
		for(int i=0;i<N;i++) {
			if(c[i]!='x') {
				d[j]=c[i];
				j++;
			}
			else {
				x[j]++;
			}
		}
		if(j==0) {
			System.out.println(0);
			return;			
		}
		for(int i=0;i<=(j-1)/2;i++) {
			if(d[i]!=d[j-1-i]) {
				System.out.println(-1);
				return;
			}
		}
		for(int i=0;i<=j/2;i++) {
			count+=Math.abs(x[i]-x[j-i]);
		}
		System.out.println(count);
		
	}
}


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

using namespace std;

long long roundDown(long long a, long long b) {
	return a - (a % b);
}

long long roundUp(long long a, long long b) {
	if(a % b == 0) {
		return a;
	} else {
		return roundDown(a, b) + b;
	}
}

int main(void) {
	int K;
	vector<long long> A;
	cin >> K;
	for(int i = 0; i < K; ++i) {
		long long t;
		cin >> t;
		A.push_back(t);
	}
	long long dpmax = 2;
	long long dpmin = 2;
	for(int i = K - 1; i >= 0; --i) {
		//A[i]が区間[dpmin, dpmax]に含まれているかどうか
		if(roundUp(dpmin, A[i]) <= roundDown(dpmax, A[i])) {
			dpmin = roundUp(dpmin, A[i]);
			dpmax = roundDown(dpmax, A[i]) + A[i] - 1;
		} else {
			cout << "-1\n";
			return 0;
		}
	}
	cout << dpmin << ' ' << dpmax << '\n';
	return 0;
}



Measured memory_bytes: 1400
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
 
int asc(const void *a, const void *b) {
    char *left_char = (char *)a;
    char *right_char = (char *)b;
    return strcmp( left_char, right_char );
}

int main(){
    int n,i,j,c=1;
    scanf("%d",&n);
    char s[200001][12];
    for(i=0;i<n;i++){
        scanf("%11s",s[i]);
    }
    //for(i=0;i<n;i++){ printf("%s\n",s[i]); }
    qsort(s, n, sizeof(*s), asc);
    //for(i=0;i<n;i++){ printf("%s\n",s[i]); }
    for(i=0;i<n-1;i++){
        if(strcmp(s[i],s[i+1])!=0){ c++; }
    }
    printf("%d",c);
    return 0;
}


Measured memory_bytes: 6228
#include <iostream>

using namespace std;
int a,b,cf,n,i,p,x;
bool ok;
int main()
{
    cin>>a>>b;
    n=b;
    ok=false;
    while(n)
    {
        cf++;
        n/=10;
    }
    p=1;
    for(i=1;i<=cf;++i)
        p*=10;
    x=a*p+b;
    for(i=1;i*i<=x;++i)
        if(i*i==x)ok=true;

    if(ok==true) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int A,B;

int main() {

	cin >> A>>B;

	rep(i, 1234) {
		if (A != i + 1 && B != i + 1) {
			cout << i + 1 << endl;
			return 0
				;
		}
	}


	return 0;
}

Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
l = LS()
if l[0] == l[1]:
    print('H')
else:
    print('D')

Measured memory_bytes: 68248
// 文字列大好きいろはちゃんイージー
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n,l;
    cin>>n>>l;
    vector<string> s;
    for(int i=0;i<n;i++){
        string S;
        cin>>S;
        s.push_back(S);
    }
    sort(s.begin(),s.end());
    for(int i=0;i<n;i++){
        cout<<s[i];
    }cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main 
{
	static long[][] dp;
	
	static long[] gc;
	static long[] cg;
	static long[] ggc;
	static long[] tgc;
	static long[] gtc;
	static long[] ac;
	static int n;
	
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		n = sc.nextInt();
		
		dp = new long[n+4][4]; //A C G T
		
		gc = new long[n+4];
		cg = new long[n+4];
		ggc = new long[n+4];
		tgc = new long[n+4];
		gtc = new long[n+4];
		ac = new long[n+4];
		
		
		
		long MOD = 1000000007;
		
		for(int i = n-1; i >= 0; i--)
		{
			if(i==n-1)
			{
				for(int j = 0; j < 4; j++)
					dp[i][j] = 1;
			}
			
			//A
			else
			{
				gc[i] = dp[i+1][1];
				cg[i] = dp[i+1][2];
				ac[i] = dp[i+1][1] - cg[i+1]; //ac minus! acg shouldn't be counted.
				
				ggc[i] = gc[i+1];
				tgc[i] = gc[i+1];
				gtc[i] = gc[i+1]; //tc = gc?
				for(int l = 0; l < 4; l++)
				{
					for(int k = 0; k < 4; k++)
					{
						dp[i][l] = (dp[i][l] + dp[i+1][k])%MOD;
					} //A C G T
					 //gc cg ggc tgc gtc ac
					if(l == 0)
					{
						dp[i][l] = (dp[i][l] - gc[i+1] - cg[i+1] - ggc[i+1] - tgc[i+1] - gtc[i+1])%MOD;

					}
					else if(l == 2)
						dp[i][l] = (dp[i][l] - ac[i+1])%MOD;
						
					while(dp[i][l]<0)dp[i][l]+=MOD;
				}
			}
		}
		
		
		long sum = 0;
		for(int i = 0; i < 4; i++)
		{
			sum = (sum + dp[0][i])%MOD;
		}
		
		System.out.println(sum);

	}

}


Measured memory_bytes: 21972
#include <iostream>
#include <queue>
#include <cstring>

using namespace std;

typedef struct task{
    string name;
    int time;
}T;

int main(void)
{
    queue <T> p;
    int n,t;
    int time=0;
    cin>>n>>t;
    T task[n];
    for(int i=0;i<n;i++)
    {
        cin>>task[i].name;
        cin>>task[i].time;
        p.push(task[i]);
    }
    while(!p.empty())
    {
        if(p.front().time<=t)
        {
            time+=p.front().time;
            cout<<p.front().name<<' '<<time<<endl;
            p.pop();
        }
        else
        {
            time+=t;
            p.front().time-=t;
            p.push(p.front());
            p.pop();
        }
    }
    return 0;
}



Measured memory_bytes: 7152
n = int(input())
a = [int(num) for num in input().split()]
b = [0] * (n+1)
b[n] = a[-1]
for i in range(n):
    b[n-1-i] = b[n-i] + a[-i-2]
#c = [0] * (n+1)
#c[n] = a[-1]
#for i in range(n):
#    c[n-1-i] = c[n-i] // 2 + a[-i-2]
#print(c)

ans = 1
fl = True
if a[0] == 0:
    n_dep = 1
elif a[0] == 1 and n == 0:
    fl = False
else:
    ans = -1
    fl = False

if fl:
    for i in range(1,n+1):
        #print(i,n_dep)
        if a[i] > n_dep*2:
            ans = -1
            break
        elif n_dep * 2 <= b[i]:
            n_dep *= 2
            ans += n_dep
            n_dep -= a[i]
        else:
            n_dep = b[i] - a[i]
            ans += b[i]
    
print(ans)

Measured memory_bytes: 20172
//By: Luogu@rui_er(122461)
#include <bits/stdc++.h>
using namespace std;

double n;
string s;

int main()
{
	cin>>n;
	s = to_string(int(ceil(n/1.08)));
	cout<<((floor(ceil(n/1.08)*1.08)==n)?s:":(")<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int mt[n];
  int dam[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> dam[i];
    sum += dam[i];
  }
 
  mt[0] = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      mt[0] += dam[i];
    } else {
      mt[0] -= dam[i];
    }
  }

  for (int i = 0; i < n-1; i++) {
    mt[i+1] = 2* dam[i] - mt[i];
  }

  for (int i = 0; i < n; i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << mt[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
import math 
import bisect
import heapq
from collections import deque

n = int(input())
h = list(map(int,input().split()))

l = [0] * n
l[0] = 0
for i in range(1,n):
    l[i] = l[i-1] + 1 if h[i-1] >= h[i] else 0

print(max(l))


Measured memory_bytes: 14540
n,m=map(int, input().split())
alist=[list(map(int, input().split())) for i in range(m)]
ans=-1
for i in range(999,-1,-1):
  if len(str(i))==n:
    x=True
    stri=str(i)
    for j in range(m):
      if stri[alist[j][0]-1]!=str(alist[j][1]):
        x=False
    if x:
      ans=i
print(ans)

Measured memory_bytes: 8920
#include <bits/stdc++.h>
using namespace std;
int main () {
    long long A, B, C, K;
    cin >> A >> B >> C >> K;
    if (K <= A) {
        cout << K << endl;
    }
    else if (K <= A+B) {
        cout << A << endl;
    }
    else {
        cout << A - (K-A-B) << endl;
    }
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO = "No";

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if ((a<c&&c<b) || (b<c&&c<a)) cout << YES << endl;
    else cout << NO << endl;
    return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define pb push_back
#define ll long long
#define ld long double
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define X first
#define Y second
#define fr(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007
#define fi ios_base::sync_with_stdio(false);cin.tie(NULL);

//#include <bits/stdc++.h>
//using namespace Std;
//typedef long long ll;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;


int n;
ll a[100005];
int b[100005];




void convert()
{
    int t[n+1];
    for(int i=0;i<n+1;i++)
    t[i]=b[i];
    
    sort(t,t+n+1);

    for(int i=0;i<n+1;i++)
    {
        b[i]=lower_bound(t,t+n+1,b[i])-t+1;
    }
   
}

int lsb(int i)
{
    return i & -i;
}


ll getSum(ll bit[],int i)
{
    ll sum=0;
    while(i>0)
    {
        sum+=bit[i];
        i-=lsb(i);
    }
    return sum;
}

void update(ll bit[],int i)
{
    while(i<=n)
    {
        bit[i]+=1;
        i+=lsb(i);
    }
}

ll inversioncnt()
{
   ll cnt=0;
   convert();
   ll BIT[n+1];
   fr(i,0,n+1)
   BIT[i]=0;

   for(int i=n;i>=0;i--)
   {
      cnt+=getSum(BIT, b[i]-1);
      update(BIT,b[i]);
   }
   return cnt;
}

bool fun(ll p)
{
   ll k= ((ll)n* (n+1))/2 ;
   ll bnd=(k>>1) + (k%2);
   ll cc=0;
   b[0]=0;
   fr(i,1,n+1)
   {
      if(a[i-1]>=p)
      b[i]=1;
      else
         b[i]=-1;

   }
   fr(i,1,n+1)
   b[i]+=b[i-1];

   
   //cout<<"\n";
   ll cnt=inversioncnt();

 //  cout<<k-cnt<<"@"; 
   return (k-cnt)>= bnd;

}

int main()
{
  // ifstream f("tt.txt");
 //  f>>n;
cin>>n;
 //cout<<n;
   fr(i,0,n)
   {
      //f>>a[i];
    //  cout<<a[i];
    cin>>a[i];
   }

   ll s=0,e=1e9+12,ans=-1;
   while(e-s>1)
   {
      ll mid=(s+e)>>1;
      
    //  cout<<mid<<":";
      if (fun(mid))
      {
         s=mid;
      
      }
      else
      e=mid;
      //cout<<"\n";
   }
  // if(n!=1)
   cout<<s;
   
   
}


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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

set<pair<int,pair<int,int> > > query; //time, q, x. q=0:delete or 1: insert or 2:query
Int N,Q;

int main(void) {
    cin>>N>>Q;

    for(int i = 0;i < N;i++) {
        int s,t,x;
        cin>>s>>t>>x;
        query.insert({s-x, make_pair(1, x)});
        query.insert({t-x, make_pair(0, x)});
    }
    for(int i = 0;i < Q;i++) {
        int d;
        cin>>d;
        query.insert({d, make_pair(2, i)});
    }

    vector<int> D(Q);
    multiset<int> se;
    for(auto it: query) {
        int time = it.first;
        int q = it.second.first;
        int x = it.second.second;
        if(q == 0) {
            se.erase(se.find(x));
        } else if(q == 1) {
            se.insert(x);
        } else {
            if(se.empty()) {
                D[x] = -1;
            } else {
                D[x] = *se.begin();
            }
        }
    }

    for(int i = 0;i < Q;i++) {
        cout<<D[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 48896
def get_s(cas,fone,pone)
  count = 0
  10.times do |nn|
    count += 1 if ((cas[nn] == 1) && (fone[nn] == 1))
  end
  return pone[count]
end
  n = gets.chomp.to_i
fd = []
fmax = 
pd = []
n.times do |nn|
  fd[nn] = []
  nlist = gets.chomp.split(" ").map{ |it| it.to_i}
  10.times do |mm|
    fd[nn][mm] = nlist[mm]
  end
end
n.times do |nn|
  pd[nn] = []
  nlist = gets.chomp.split(" ").map{ |it| it.to_i}
  11.times do |mm|
    pd[nn][mm] = nlist[mm]
  end
end
max = false
1023.times do |nn|
  nn += 1
  cas = []
  code=  nn.to_s(2)
  code = code.rjust(10,"0")
  code.each_char do |bin|
    cas.push(bin.to_i)
  end
  score = 0
  n.times do |mm|
    score += get_s(cas,fd[mm],pd[mm])
  end
 max = score if max == false
 max = score if max < score
end
print max,"\n"

Measured memory_bytes: 1916
#include <iostream>
#include <math.h>
using namespace std;
 
#define int long long
long long area;
int ax, ay, bx, by, cx, cy;
 
signed main()
{
    cin >> area;
    ax = ay = 0;
    if (area <= 1e9)
    {
        return cout << 0 << ' ' << 0 << ' ' << 0 << ' ' << 1 << ' ' << area << ' ' << 0, 0;
    }
    int n = sqrt(area+1e9);
/*
    int l = 0, r = 1e18;
    while(l != r)
    {
        int mid = (l+r)/2;
        if (mid*(mid+1) >= (area+1e9))
        {
            r = mid;
            n = min(n,mid);
        }
        else
            l = mid+1;
    }
*/
    long long need = n*n-area;
    bx = need, by = n, cx = n, cy = 1;
    cout << ax << ' ' << ay << ' ' << bx << ' ' << by << ' ' << cx << ' ' << cy;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	string s1,s2,s3;

	cin>>s1>>s2>>s3;

	cout<<s1[0]<<s2[0]<<s3[0]<<endl;



	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int y;
string x;
int main()
{
	cin>>x;
	for(int i=0; i<x.size(); i++)
		if(x[i]=='9')
		{
			y=1;
			cout<<"Yes"<<endl;
			break;
		}
	if(y==0)
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b,q;
    cin >> a >> b >> q;

    vector<ll> s(a),t(b),x(q);

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

    for(int i = 0; i < b; i++){
        cin >> t[i];
    }

    for(int i = 0; i < q; i++){
        cin >> x[i];
    }

    sort(s.begin(),s.end());
    sort(t.begin(),t.end());



    for(int i = 0; i < q; i++){
        auto sitr = lower_bound(s.begin(),s.end(),x[i]);
        auto titr = lower_bound(t.begin(),t.end(),x[i]);
        vector<ll> spos;
        vector<ll> tpos;

        if(sitr == s.begin()){
            spos.push_back(*sitr);
        }else if(sitr == s.end()){
            spos.push_back(s.back());
        }else{
            spos.push_back(*sitr);
            spos.push_back(s[sitr - s.begin() - 1]);
        }

        if(titr == t.begin()){
            tpos.push_back(*titr);
        }else if(titr == t.end()){
            tpos.push_back(t.back());
        }else{
            tpos.push_back(*titr);
            tpos.push_back(t[titr - t.begin() - 1]);
        }

        ll ans = INF;

        for(int j = 0; j < spos.size(); j++){
            for(int k = 0; k < tpos.size(); k++){
                ans = min(ans,min(abs(x[i] - spos[j]) + abs(spos[j] - tpos[k]),abs(x[i] - tpos[k]) + abs(tpos[k] - spos[j])));
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000009
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int main()
{
        int n;
        cin >> n;
        ll a[n] , b[n] , c[n - 1];
        for(int i = 0 ; i < n ;i++)
        	cin >> a[i];
        for(int i = 0 ; i < n ; i++)
        	cin >> b[i];
        for(int i = 0 ; i < n - 1 ; i++)
        	cin >> c[i];
        ll sum = b[a[0] - 1];
        for(int i = 1 ; i < n ; i++)
       	{
       	//	cout << b[a[i] - 1] << endl;
       		if(a[i] == a[i - 1] + 1){
       			//cout << b[a[i] - 1];
       			sum += b[a[i] - 1];
       			sum += c[a[i - 1] - 1];
       		//	cout << c[a[i-1] - 1] << endl;
       		}
       		       			

       		else
       			sum += b[a[i] - 1];
       	}
       	cout << sum << endl;
}

Measured memory_bytes: 384
//Bismillahir Rahmanir Rahim
//In the name of Allah the Most Merciful
//Astagfirullahil laji Rabbi Minkulli Jamio
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
int i,j,k;
main()
{
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    if(k>=n) cout<<x*n<<endl;
    else
    {
        cout<<(k*x)+(n-k)*y<<endl;
    }
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int N;
  int K;
  cin >> N >> K;
  vector<int> h(N);
  for(int i = 0; i < N; ++i){
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  int ans = h[K-1] - h[0];
  for(int i = 1; i < N-K+1; ++i){
    ans = min(ans, h[i+K-1] - h [i]);
  }
  cout << ans << endl;
}

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

int main() {
    int x1,x2,x3,x4,x5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    if (x1 == 0) {
        cout << 1 << endl;
    }else if(x2 == 0) {
        cout << 2 << endl;
    }else if(x3 == 0) {
        cout << 3 << endl;
    }else if(x4 == 0) {
        cout << 4 << endl;
    }else{
        cout << 5 << endl;
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
// #include <regex> //正規表現
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


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

int N; cin >> N;



cout << pow(N, 3) << endl;
}

// 境界，出力文字列 チェック



Measured memory_bytes: 256
n = int(raw_input())
C = [[] for _ in [0]*n]
W = {}
for i in range(n):
  C[i] = map(int, raw_input().split())
  W[(i, i)] = 0
for i in range(1, n):
  for j in range(0, n-i):
    a = j+i
    W[(j, a)] = min([C[j][0] * C[k][1] * C[k+1][0] * C[a][1] + W[(j, k)] + W[(k+1, a)] for k in range(j, a)])
print W[0, n-1]

Measured memory_bytes: 4480
#include <iostream>
using namespace std;
void change(int num[],int a, int b)
{
	int tmp = num[a];
	num[a] = num[b];
	num[b] = tmp;
}
int main()
{
	int w,n;
	int order[30]={0};
	cin >> w >> n;
	for(int i=0; i < w; i++){
		order[i] = i;
	}
	while(n--){
		int a,b;
		scanf("%d , %d ", &a, &b);
		change(order, a-1, b-1);
	}
	for(int i=0; i< w; i++){
		cout << order[i]+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int main(void)
{
   int a,b,c;
   int i;

   scanf("%d%d",&a,&b);

   if(b/100){
     a = a * 1000;
     a = a+b;
   }
   else if(b/10){
     a = a * 100;
     a = a+b;
   }
   else {
     a = a*10;
     a = a+b;
   }
   i=1;
   c = 0;
   while(i<1000){
    if(i*i == a){
      c = 1;
      i=1000;
    }
    else{
      i++;
    }
   }
   if(c==1){
     printf("Yes\n");}
   else{
     printf("No\n");}
   return 0;
}


Measured memory_bytes: 128
<?php
$w = trim(fgets(STDIN));
$w = strtolower($w);
$result = 0;
while (true) {
    $t = explode(" ", trim(fgets(STDIN)));
    if ($t[0] == 'END_OF_TEXT') {
        break;
    }
    $t = array_map('strtolower', $t);
    foreach ($t as $value) {
        if ($value == $w) {
            ++$result;
        }
    }
}
echo $result . PHP_EOL;


Measured memory_bytes: 9272
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
//#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
int power(int x, unsigned int y)
{
    int res = 1;

    x = x;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x);

        y = y>>1;
        x = (x*x);
    }
    return res;
}
bool isprime(int x)
{
      if(x<2)
        return false;
    for(int i=2;i*i<=x;i++)
     {
        if (x%i==0)
            return false;
    }
    return true;
}
vector<int>primeFactors(int n)
{
    vector<int>v;
    while (n % 2 == 0)
    {
        v.pb(2);
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            v.pb(i);
            n = n/i;
        }
    }
    if (n > 2)
        v.pb(n);
    return v;
}
void solve()
{
   int k,a,b;
   cin>>k>>a>>b;
   for(int i=a;i<=b;i++)
   {
       if(i%k==0)
       {
           cout<<"OK"<<endl;
           return ;
       }
   }
   cout<<"NG"<<endl;
}
signed main()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
//cin>>t;
t=1;
while(t--)
{
  solve();
}
}


Measured memory_bytes: 3624
unittest
{
	assert( [ "10" ].solve == 170 );		// 追加ケース
	
	assert( [ "4" ].solve == 23 );
	assert( [ "100" ].solve == 26879 );
	assert( [ "10000000" ].solve == 838627288460105 );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	
	// 約数dごとに割り切れる数の個数を集計
	auto ans = 0L;
	foreach( d; 1L .. n + 1 )
	{
		auto c = n / d;							// dで割り切れる数はc個
		ans += ( c * ( c + 1 ) / 2 ) * d;		// d刻みでc個の合計
	}
	return ans;
}


Measured memory_bytes: 2744
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String[] str = br.readLine().split(" ");
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);
		int d = Integer.parseInt(str[3]);
		if(Math.abs(a-c)<=d){
			System.out.println("Yes");
		}else if(Math.abs(a-b)<=d && Math.abs(b-c)<=d){
			System.out.println("Yes");

		}else{
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 21204
#include <cmath>
#include <iostream>
using namespace std;
int sum(int m) {
  return (1 + m) * m / 2;
}
int main(void) {
  int X;
  cin >> X;
  for (int i = 1; i < 1000000000; i++){
    if (sum(i) >= X) {
      cout << (i) << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define fr first
#define se second
const ll mod = 1e9+7;

ll power(ll x,ll y){
    if(x==0) return 1;
    ll ans=1;
    x%=mod;
    while(y>0){
        if(y&1)
            ans = (ans*x)%mod;
        x = (x*x)%mod;
        y = y>>1;
    }
    return (ans+mod)%mod;
}


// void solve(ll cas){
//     ll s;cin>>s;
//     ll t=s/3,ans=0;
//     for(ll i=1;i<=t;i++){
//         ll x = s-3*i;
//         ans = (ans%mod + power(i,x)%mod)%mod;
//         // cout<<ans<<endl;
//     }
//     cout<<(ans+mod)%mod<<endl;
// }

void solve(ll cas){
    ll n;
    cin>>n;
    vector<ll> u,v;
    for(ll i=0;i<n;i++){
        ll x,y;cin>>x>>y;
        v.pb(x+y);u.pb(x-y);
    }
    sort(v.begin(),v.end());sort(u.begin(),u.end());
    ll ans = max(u[n-1]-u[0],v[n-1]-v[0]);
    cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll qu=1;
    // cin>>qu;
    for(ll cas=1;cas<=qu;cas++){
        solve(cas);
    }
}

Measured memory_bytes: 6688
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

mod = 2019
s = input()
rui = []
ima = 0
ten = []
ten = 1
ss = [0]*len(s)
for i in reversed(range(len(s))):
    num = int(s[i])*ten
    ss[i] = num % mod
    ten *=10
    ten %= mod

ima = 0
for i in reversed(range(len(ss))):
    ima +=  int(ss[i])
    ima = ima % mod
    rui.append(ima)
dp = [0]*mod
for  i in range(len(rui)):
    dp[rui[i]] += 1
ans = dp[0]
for i in range(mod):
    tmp = dp[i] 
    ans += tmp*(tmp-1)//2
print(ans)

Measured memory_bytes: 23748
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

		int dp[1003][1003];
		int masu[1003][1003];
int main(){
	while(1){
		int n,m,k;
		scanf("%d%d%d",&n,&m,&k);
		if(n==0)break;
		rep(i,1003)rep(j,1003)masu[i][j]=dp[i][j]=0;
		rep(i,n){
			rep(j,m){
				scanf("%d",&masu[j][i]);
			}
		}
		
		dp[0][0]=k-1;
		
		rep(i,m){
			rep(j,n){
				dp[i+1][j]+=dp[i][j]/2;
				dp[i][j+1]+=dp[i][j]/2;
				
				if(dp[i][j]%2==1){
					if(masu[i][j]==0){
						dp[i][j+1]++;
					}else{
						dp[i+1][j]++;
					}
				}
				masu[i][j]+=dp[i][j];
				masu[i][j]%=2;
			}
		}
		
		int x=0,y=0;
		while(1){
			if(masu[x][y]==0){
				y++;
			}else{
				x++;
			}
			if(y>=n || x>=m){
				break;
			}
		}
		printf("%d %d\n",y+1,x+1);
	}
}

/*
3 4 3
1 0 1 1
0 1 0 0
1 0 1 0

*/

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


int main() {
	ll n,a[100010];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	ll x2=0;
	for(int i=0;i<n;i++){
		if(i%2){
			x2-=a[i];
		}
		else{
			x2+=a[i];
		}
	}
	cout << x2<<endl;
	for(int i=0;i<n-1;i++){
		x2 =-1*x2+2*a[i];
		cout << x2<<endl;
	}
	return 0;
}

Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int result = 0;
    int count = 0;
    int num = 0;
    for (int i = 0; i < N; i++)
      if (num >= (num = sc.nextInt()))
        count++;
      else {
        if (result < count)
          result = count;
        count = 0;
      }
    if (result < count)
      result = count;
    System.out.println(result);
  }
}

Measured memory_bytes: 49864
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

//#include <cstdlib>
#include <cmath>

double pi = acos(-1);

double trans(double deg) {
    return 2 * pi * deg / 360;
}

double bbb(double rad) {
    return rad * 180 / pi;
}

#include <iomanip>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double a, b, x;
    cin >> a >> b >> x;
    double theta = bbb(atan(b / a));
    double ans1 = bbb(atan((2 * a * a * b - 2 * x) / a / a / a));
    double ans2 = bbb(atan(a * b * b / x / 2));
    dump(theta, ans1, ans2);
    cout << fixed << setprecision(10);
    if (ans1 <= theta) {
        cout << ans1 << endl;
    } else {
        cout << ans2 << endl;
    }

    return 0;
    /*
    double l = 0, r = 89.99999999999;
    double ans = 0.0;
    while (abs(l - r) > 1e-9) {
        double mid = (l + r) / 2;
        double tra = trans(mid);
        double t = (x + 0.5 * a * a * a * tan(tra)) / (a * a);
        dump(cos(tra) * t);
        if (cos(tra) * t <= b) {
            ans = mid;
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << ans << endl;
    //*/
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> P2;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
int X, N, Q;
vector<P> qs;

struct Node {
  long long a, b, c;
  Node(long long a, int b, int c) : a(a), b(b), c(c) {}
  Node() : a(0), b(0), c(X) {}
  int f(int x) {
    if (x+a <= b) return b;
    else if (x+a>=c) return c;
    return x+a;
  }
};

Node node[200001];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> X >> N;
  vector<int> xs, rs;
  rep(i, N) {
    int r;
    cin >> r;
    xs.pb(r);
    rs.pb(r);
  }
  cin >> Q;
  rep(i, Q) {
    int t, a;
    cin >> t >> a;
    xs.pb(t);
    qs.pb(P(t, a));
  }
  sort(all(xs)); uniq(xs);
  node[0] = Node(0, 0, X);
  rep(i, xs.size()) {
    int x = xs[i];
    int n = x - (i>0?xs[i-1]:0);
    if ((lower_bound(all(rs), x) - rs.begin()) % 2) {
      // up
      node[i+1] = Node(n, min(n, X), X);
    }
    else {
      node[i+1] = Node(-n, 0, max(X-n, 0));
    }
  }
  rep(i, xs.size()) {
    Node a = node[i], b = node[i+1];
    node[i+1] = Node(a.a + b.a, b.f(a.b), b.f(a.c));
  }
  for (P q : qs) {
    int t = q._1, a = q._2;
    int p = lower_bound(all(xs), t) - xs.begin();
    cout << node[p+1].f(a) << "\n";
  }
  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  int L, R;
  cin >> L >> R;
  for(int i = 0; i < M - 1; i++) {
    int l, r;
    cin >> l >> r;
    if(r < L || R < l) {
      cout << 0 << endl;
      return 0;
    }
    if(r < R) {
      R = r;
    }
    if(l > L) {
      L = l;
    }
  }
  cout << R - L + 1 << endl;
}

Measured memory_bytes: 3604
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
// #define INF (0x3f3f3f3f)
#define INF 9e+18

/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Graph Start
struct edge {
    int from, to;
    long long cost;
};
/// Graph End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

#define int long long


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Ciniii(a,b,c);
    if(a==b) cout << c << nn;
    else if(a==c) cout << b << nn;
    else cout << a << nn;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});
//条件式が真ならwhileの中身を回し続ける

bool flag[1050000];

int main() {
	ll n;
	cin >> n;
	vector<ll>A(n);
	rep(i, n) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	rep(i, n-1) {
		if (A[i] == A[i + 1]) {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int ans = 0;
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - i - 1])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 

 
const int INF = 1000000;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);

struct Input
{
	int n;
	char c;
	char str[1024];
	string s;
	ll l;
	int nextInt(){
		scanf("%d", &n);
		return n;
	}
	ll nextLong(){
		scanf("%lld", &l);
		return l;
	}
	char nextChar(){
		scanf("%c", &c);
		return c;
	}
	string next(){
		scanf("%s", str);
		return string(str);
	}
	string nextLine(){
		getline(cin, s);
		return s;
	}
};
Input in;

int main(){
	while(1){
		int n = in.nextInt();
		if(n == 0) break;
		vector<pii> v;
		rep(i, n){
			int m = in.nextInt(), a = in.nextInt(), b = in.nextInt();
			v.pb(mp(a, m));
			v.pb(mp(b, -m));
		}
		sort(all(v));
		bool f = true;
		int w = 0;
		rep(i, v.size()){
			w += v[i].se;
			if(w > 150) f = false;
		}
		cout<<(f?"OK":"NG")<<endl;
	}
}

Measured memory_bytes: 1208
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (a, b, c) = (v[0], v[1], v[2]);
    if c % gcd(a, b) == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}

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

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

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}


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

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

	int count = 0;
	bool ans = true;
	if(s.at(0) != 'A' || isupper(s.at(1)) || isupper(s.at(s.size()-1)))
		ans = false;
	for(int i=2; i < s.size()-1; i++) {
		if(s.at(i) == 'C')
			count++;
		else if(isupper(s.at(i)))
			ans = false;
	}
	if(count != 1) ans = false;

	if(ans)
		cout << "AC" << endl;
	else
		cout << "WA" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long n,x;
  in(n,x);
  vector<long>l(n);
  ins(l);
  long ans=1,d=0,e;
  rep(i,n){
    e=d+l[i];
    if(e<=x)ans++;
    d=e;
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

using ll = long long;

const ll mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

const int max_n = (1 << 23);

int bit[max_n + 1][26], N;

vector<int> sum(int i) {
    int s = 0;
    vector<int> a(26, 0);
    while (i > 0) {
        // s |= bit[i];
        // s += bit[i];
        for (int j = 0; j < 26; ++j) a[j] += bit[i][j];
        i -= i & -i;
    }
    for (int j = 0; j < 26; ++j) if (a[j] > 0) ++s;
    return a;
}

void add(int i, int j, int x) {
    while (i <= N) {
        bit[i][j] += x;
        i += i & -i;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    string S;
    cin >> S;

    for (int i = 0; i < (int)S.size(); ++i) {
        add(i + 1, S[i] - 'a', 1);
    }

    int Q;
    cin >> Q;
    for (int i = 0; i < Q; ++i) {
        int k;
        cin >> k;
        if (k == 1) {
            int a;
            char c;
            cin >> a >> c;
            add(a, S[a - 1] - 'a', -1);
            S[a - 1] = c;
            add(a, c - 'a', 1);
        }
        else {
            int l, r;
            cin >> l >> r;
            int ans = 0;
            auto vr = sum(r);
            auto vl = sum(l - 1);
            for (int j = 0; j < 26; ++j) {
                if (vr[j] - vl[j] > 0) ++ans;
            }
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 52252