akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
       Console.WriteLine(3*N*N);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    vector<ll> A(N-1);
    vector<vector<ll>> B(N+1,vector<ll>(M));
    for (int i=0;i<N-1;++i) cin >> A[i];
    for (int i=0;i<N;++i){
        for (int j=0;j<M;++j){
            cin >> B[i][j];
        }
    }
    vector<vector<ll>> C(N+1,vector<ll>(M,0));
    vector<ll> imos(N+1,0);
    for (int j=0;j<M;++j){
        stack<int> st;
        B[N][j]=1<<30; st.emplace(N);
        C[N][j]=N;
        for (int i=N-1;i>=0;--i){
            while(!st.empty()&&B[st.top()][j]<B[i][j]) st.pop();
            C[i][j]=st.top();
            st.emplace(i);
        }
        for (int i=0;i<N;){
            imos[C[i][j]]+=B[C[i][j]][j]-B[i][j];
            i=C[i][j];
        }
    }
    ll ans=0;
    for (int l=0;l<N;++l){
        ll sum=0;
        for (int i=0;i<M;++i) sum+=B[l][i];
        ans=max(ans,sum);
        for (int r=l+1;r<N;++r){
            sum+=imos[r]-A[r-1];
            ans=max(ans,sum);
        }
        for (int i=0;i<M;++i){
            int j=C[l][i];
            imos[j]-=B[j][i]-B[l][i];
            for (int k=l+1;k<j;){
                imos[C[k][i]]+=B[C[k][i]][i]-B[k][i];
                k=C[k][i];
            }
        }
    }
    cout << ans << '\n';

}

Measured memory_bytes: 16384
#include <iostream>
#define ll long long int
using namespace std;
int main() 
{
    ll len;
    cin >> len;
    string s;
    cin >> s;
    // ll len = s.length();
    ll r = 0, w = 0;
    for(ll i = 0; i < len; i++)
    {
        if ( s[i] == 'W') w++;
        else r++;
    }
    if ( w == 0 || r == 0) cout << 0;
    else
    {
        ll count = 0;
        for( ll i = 0; i < r; i++ )
        {
            if ( s[i] == 'W') count++;
        }
        cout << count;
    }
    cout << endl;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<60;
const double eps = 1e-4;
const double PI=3.1415926535897932;
const int SZE = 1e6+1;

char s[100009];

int main(){
	RS(s);
	int n=LEN(s);
	if(s[0]==s[n-1]){
		if(n%2){
			puts("Second");
		}
		else{
			puts("First");
		}
	}
	else{
		if(n%2){
			puts("First");
		}
		else{
			puts("Second");
		}
	}
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
    int n,a[100001]={0},k,sum,p;
int i,j,h;
while(1){
cin>>n>>k;
if(n==0&&k==0)break;
cin>>a[1];
for(i=2;i<=n;i++){
	cin>>a[i];
	a[i]+=a[i-1];
}
sum=a[k];
for(i=k+1;i<=n;i++){
    sum=max(sum,a[i]-a[i-k]);
	}
cout<<sum<<endl;
}
return 0;
}



Measured memory_bytes: 3496
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
int main() {
	int x, y, n;
	cin >> x >> y >> n;
	int l = x,r=y;
	while (l % n)l++;
	while (r % n)r--;
	if (l <= r)cout << (r - l) / n+1;
	else cout << 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

    ll N = SZ(S);
    ll k = 0;
    S += string(7, '*');
    while(k < N) {
        if(S.substr(k, 7) == "dreamer") {
            if(S.substr(k+7, 4) == "aser") k += 11;
            else if(S.substr(k+7, 3) == "ase") k += 10;
            else k += 7;
        }
        else if(S.substr(k, 5) == "dream") k += 5;
        else if(S.substr(k, 6) == "eraser") k += 6;
        else if(S.substr(k, 5) == "erase") k += 5;
        else break;
    }
    if(k == N) PR("YES");
    else PR("NO");

    return 0;
}

/*



*/

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
    long long n,m,a,b,p;
    cin>>n>>m;
    vector<pair<long long,long long>> A(n);
    rep(i,n) cin>>a>>b,A[i]=make_pair(a,b);
    sort(A.begin(),A.end());
    long long ans=0;
    rep(i,n){
        if(m>=A[i].second) ans+=A[i].first*A[i].second,m-=A[i].second;
        else{ans+=A[i].first*m;break;}
    }
    cout<<ans;
}

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

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define endl '\n'
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

using ll = long long;
using P = pair<ll, ll>;

/*追加部分*/



/*main関数*/

int main() {
FASTIO;
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());

    int sum_a = 0, sum_b = 0;

    for(int i = 0; i < n; i++){
        i%2 == 0 ? sum_a += a[i] : sum_b += a[i];
    }

    cout << sum_a - sum_b << endl;

return 0;
}

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

int main() {
    int n;
    cin>>n;
    n = n%10;
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
        cout<<"hon"<<endl;
    else if(n == 0 || n == 1 || n == 6 || n == 8)
        cout<<"pon"<<endl;
    else
        cout<<"bon"<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
const ll INF=1e15;
ll d[N],a[N];
int n,m,T,q[N],s,t;
int main() {
    scanf("%d%d%d",&n,&m,&T); for(int i=1;i<=n;i++){ scanf("%lld",&a[i]); d[i]=INF; }
    s=1,t=1;
    ll z=INF;
    for(int i=1;i<=n;i++){
        while(s<=t&&2*(a[i]-a[q[s]+1])>T){ z=min(z,d[q[s]]-a[q[s]]-2*a[q[s]+1]); s++; }
        d[i]=min(d[i],a[i]+z+2*a[i]); d[i]=min(d[i],d[q[s]]+a[i]-a[q[s]]+T);
        while(s<=t&&d[q[s]]-a[q[s]]>=d[i]-a[i]) t--; q[++t]=i;
    }
    ll ans=d[n]+m-a[n];
    printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 2176
use itertools_num::ItertoolsNum as _;
use proconio::input;
use proconio::marker::Chars;

#[allow(unused_mut)]
fn main() {
    input! {
        n: usize,
        q: usize,
        s: Chars,
        lr: [(usize,usize);q],
    }
    let mut v = vec![0];
    for i in 1..n {
        if s[i - 1] == 'A' && s[i] == 'C' {
            v.push(1);
        } else {
            v.push(0);
        }
    }
    let cumsum = v.iter().cumsum().collect::<Vec<u32>>();
    //println!("{:?}", cumsum);
    for i in lr.iter() {
        println!("{}", cumsum[i.1 - 1] - cumsum[i.0 - 1]);
    }
}


Measured memory_bytes: 5952
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long k = scanner.nextLong();
			int[] a = new int[n];
			IntStream.range(0, n).forEach(i -> a[i] = scanner.nextInt() - 1);
			List<Integer> list = new ArrayList<>();
			// containsを計算用
			Set<Integer> set = new HashSet<>();
			list.add(0);
			set.add(0);
			int index = 0, count = 0;
			while (!set.contains(a[index])) {
				list.add(a[index]);
				set.add(a[index]);
				count++;
				if (k == count) {
					System.out.println(a[index] + 1);
					return;
				}
				index = a[index];
			}
			int start = list.indexOf(a[index]);
			System.out.println(list.get(start + (int) ((k - list.size()) % (list.size() - start))) + 1);
		}
	}
}


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

using namespace std;
using   vi = vector<int>;
using   vvi = vector<vi>;
using   vs = vector<string>;
#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
const int maxn=1e5+10;
vector<int> v[maxn];
int vis[maxn];
int a[maxn];
int solve(int k)
{
    if(vis[k]==1)
    {
        return a[k];
    }
    vis[k]=1;
    int o=0;
    for(auto x: v[k])
    {
        o=max(o,solve(x)+1);
    }
    a[k]=o;
    return o;
}
int main()
{     int n,m;
      cin>>n>>m;
      ffor(i,0,m)
      {
          int x,y;
          cin>>x>>y;
          v[x].pb(y);
      }
      int ans=0;
      ffor(i,1,n+1)
      {    
            // cout<<a[i]<<" ";
            ans=max(ans,solve(i));
      }
      cout<<ans;
     // ffor(i,1,5)

	return 0;
}


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

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
}

public class Main {
  private static ArrayList<String> solve(long l, long[] as) {
    ArrayList<String> answer = new ArrayList<String>();
    for (int i = 1; i < as.length; i++) {
      if (as[i-1] + as[i] >= l) {
        answer.add("Possible");
        for (int k = 1; k < i; k++) {
          answer.add("" + k);
        }
        for (int k = as.length - 1; k > i; k--) {
          answer.add("" + k);
        }
        answer.add("" + i);
        return answer;
      }
    }
    answer.add("Impossible");
    return answer;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    long l = reader.nextLong();
    long[] as = new long[n];
    for (int i = 0; i < n; i++) {
      as[i] = reader.nextLong();
    }
    
    ArrayList<String> answer = solve(l, as);
    for (String s : answer) {
      out.println(s);
    }
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}



Measured memory_bytes: 47260
#include <bits/stdc++.h>
#define pii pair<int, pair<int, int>>
#define ss second
#define ff first
#define all(x) ((x).begin(), (x).end())

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;
const ll oo = 10000000;
const int maxn = 40, maxab = 10;
int n, ma, mb, dp[maxn+1][maxn*maxab + 1][maxn*maxab + 1], a[maxn+1], b[maxn+1], c[maxn+1];

int main(){
    ios_base::sync_with_stdio(false);

    cin >> n >> ma >> mb;
    
    for (int i=0; i<n; ++i) cin >> a[i] >> b[i] >> c[i];

    for (int i=0; i<=n; ++i){
        for (int j=0; j <= maxn*maxab; ++j){
            for (int k=0; k <= maxn*maxab; ++k){
                dp[i][j][k] = oo;
            }
        }
    }

    dp[0][0][0] = 0;

    for (int k=0; k < n; ++k){
        for (int i=0; i<=maxn*maxab; ++i){
            for (int j=0; j<=maxn*maxab; ++j){
                if (dp[k][i][j] == oo) continue;
                dp[k+1][i][j] = min(dp[k][i][j], dp[k+1][i][j]);
                dp[k+1][i+a[k]][j+b[k]] = min(dp[k+1][i+a[k]][j+b[k]], dp[k][i][j] + c[k]);
            }
        }
    }

    int ans = oo;

    for (int i=1; i<=maxn*maxab; i++){
        for (int j=1; j<=maxn*maxab; j++){
            if (i*mb == j*ma) ans = min(ans, dp[n][i][j]);
        }
    }
    if (ans == oo) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 25984
N = int(input())
A = list(map(int, input().split()))
INF = float("inf")
B = [[A[i], -INF] for i in range(1 << N)]
for i in range(N):
    for j in range(1 << N):
        if j & (1 << i):
            tmp = B[j] + B[j ^ (1 << i)]
            tmp = sorted(tmp, reverse=True)
            B[j] = tmp[:2]

ans = -INF
for i in range(1, 1 << N):
    ans = max(ans, sum(B[i]))
    print(ans)


Measured memory_bytes: 145968
#include <algorithm>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, k, a[200010];

int m, node[1000010], lazy[1000010];
bool clearf[1000010];
void init(int n_) {
	m = 1;
	while (m < n_)m *= 2;
}
void eval(int k, int l, int r) {
	if (lazy[k] != 0) {
		node[k] += lazy[k];
		if (r - l > 1) {
			lazy[2 * k + 1] += lazy[k] / 2;
			lazy[2 * k + 2] += lazy[k] / 2;
		}
		lazy[k] = 0;
	}
}

void add(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
	if (r < 0)r = m;
	eval(k, l, r);
	if (b <= l || r <= a)return;
	if (a <= l && r <= b) {
		lazy[k] += (r - l) * x;
		eval(k, l, r);
	}
	else {
		add(a, b, x, 2 * k + 1, l, (l + r) / 2);
		add(a, b, x, 2 * k + 2, (l + r) / 2, r);
		node[k] = node[2 * k + 1] + node[2 * k + 2];
	}
}

int getsum(int a, int b, int k = 0, int l = 0, int r = -1) {
	if (r < 0)r = m;
	eval(k, l, r);
	if (b <= l || r <= a)return 0;
	if (a <= l && r <= b)return node[k];
	int vl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
	int vr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);
	return vl + vr;
}

signed main() {
	cin >> n >> k;
	map<int, int> mp;
	mp[0] = 0;
	REP(i, n) {
		cin >> a[i];
		a[i] -= k;
		if (i)a[i] += a[i - 1];
		mp[a[i]] = 0;
	}
	int cnt = 0;
	for (auto ite = mp.begin(); ite != mp.end(); ite++) {
		(*ite).second = cnt;
		cnt++;
	}
	rep(i, n + 1)a[i] = mp[a[i]];
	int ans = 0;
	init(n + 10);
	rep(i, n + 1) {
		ans += getsum(0, a[i] + 1);
		add(a[i], a[i] + 1, 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 24576
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
#define enld endl
typedef long long ll;
using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,m,x; cin >> n >> m >> x;
    int c[15],A[15][15];
    for(int i=0;i<n;i++){
        cin >> c[i];
        for(int j=0;j<m;j++) cin >> A[i][j];
    }

    int ans = -1;
    for(int i=0;i<(1<<n);i++){
        int skill[15];
        int cost = 0;
        Fill(skill, 0);
        for(int j=0;j<n;j++){
            if(((i>>j)&1) == 1){
                cost += c[j];
                for(int k=0;k<m;k++){
                    skill[k] += A[j][k];
                }
            }
        }
        bool flag = true;
        for(int j=0;j<m;j++){
            if(skill[j] < x){
                flag = false;
                break;
            }
        }
        if(flag){
            if(ans == -1){
                ans = cost;
            }else{
                ans = min(ans, cost);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
import sys

l,r=map(int,input().split())
minimum=2019
if r-l>=2019:
	print(0)
	sys.exit()
else:
	l,r=l%2019,r%2019
	if l>r:
		print(0)
		sys.exit()
	elif r-l==1:
		print((l*r)%2019)
	else:
		for i in range(l,r):
			for j in range(l,r+1):
				if minimum==0:
					print(0)
					sys.exit()
				if i>=j:
					pass
				else:
					if minimum>(i*j)%2019:
						minimum=(i*j)%2019
		print(minimum)

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

int main() {
  long long N;
  cin >> N;
  for (long long h = 1; h <= 3500; h++) {
    for (long long n = 1; n <= 3500; n++) {
      if (4 * h * n - N * n - N * h <= 0) continue;
      if ((N * h * n) % (4 * h * n - N * n - N * h) == 0) {
        cout << h << " " << n << " " << (N * h * n) / (4 * h * n - N * n - N * h) << endl;
        return 0;
      }
    }
  }

  return 0;
}



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

int main() {
  int A, B, result;
  string op;

  cin >> A >> op >> B;
  
  if (op == "+") {
    result = A + B;
  }
  
  if (op == "-") {
    result = A - B;;
  }
  cout << result << endl;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
from functools import lru_cache
sys.setrecursionlimit(10**9)
mod = 998244353

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

    """
    再帰の計算式自体は合っていた！
    メモ化再帰とdpで計算量は変わらないはずだが、取りあえずdpで書き直してみる。
    """

    dp = [[0] * (S + 1) for _ in range(N)] # dp[n][s] = (N=n, S=sに対する問題の解)
    dp[0][0] = 1
    for n in range(1, N): dp[n][0] = (dp[n - 1][0] * 2 + 1) % mod
    for s in range(1, S + 1): dp[0][s] = 1 if s == A[0] else 0
    for n in range(1, N):
        for s in range(1, S + 1):
            dp[n][s] = (dp[n - 1][s] * 2 + dp[n - 1][s - A[n]]) if s >= A[n] else dp[n - 1][s] * 2
            if A[n] == s: dp[n][s] += 1
            dp[n][s] %= mod
    print(dp[N - 1][S])

    

if __name__ == "__main__":
    main()


Measured memory_bytes: 139972
#include <iostream>

using namespace std;

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

  int ans = 0;
  int maxp = -1;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    ans += tmp;
    maxp = max(maxp, tmp);
  }
  ans -= maxp / 2;

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;
const int Max_N(3050);
const int MOD(1000000000 + 7);

constexpr int Mult(int a, int b)
{
	return a * 1LL * b % MOD;
}

constexpr int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

void exgcd(int a, int b, int &x, int &y)
{
	if (b == 0)
		x = 1, y = 0;
	else
		exgcd(b, a % b, y, x), y -= x * (a / b);
}

inline int inverse(int a)
{
	int invx, invy;
	exgcd(a, MOD, invx, invy);
	return (invx % MOD + MOD) % MOD;
}

namespace io
{
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush (){fwrite (obuf, 1, oS - obuf, stdout);oS = obuf;}
	inline void putc (char x){*oS ++ = x;if (oS == oT) flush ();}
	template <class I>
	inline void gi (I &x) {for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;}
	template <class I>
	inline void print (I x){
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;while(x) qu[++ qr] = x % 10 + '0',  x /= 10;while (qr) putc (qu[qr--]);}
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io::gi;
using io::putc;
using io::print;

int N, Q, A[Max_N], F[Max_N][Max_N], inv2;

int main()
{
	gi(N), gi(Q), inv2 = inverse(2);
	for (int i = 1;i <= N;++i)
		gi(A[i]);
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= N;++j)
			if (i != j)
				F[i][j] = (A[i] > A[j]);
	for (int i = 1, x, y;i <= Q;++i)
	{
		gi(x), gi(y), F[x][y] = F[y][x] = Mult(Add(F[x][y], F[y][x]), inv2);
		for (int i = 1;i <= N;++i)
			if (i != x && i != y)
			{
				F[x][i] = F[y][i] = Mult(Add(F[x][i], F[y][i]), inv2);
             			F[i][x] = F[i][y] = Mult(Add(F[i][x], F[i][y]), inv2);
			}
	}
	int Ans = 0;
	for (int i = 1;i <= N;++i)
		for (int j = i + 1;j <= N;++j)
			Ans = Add(Ans, F[i][j]);
	while (Q--)
		Ans = Add(Ans, Ans);
	print(Ans);
	return 0;
}

Measured memory_bytes: 39168
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) {
    return a < b ? b = a, true : false;
}
template<typename T> bool chmax(T a, T &b) {
    return a > b ? b = a, true : false;
}

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool isprime(ll n) {
    if (n < 2) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
vll sieve(ll n) {
    str flg(n + 1, '1');
    for (ll i = 2; i * i <= n; i++) {
        if (flg[i] == '0') continue;
        for (ll j = i * i; j <= n; j += i)
            flg[j] = '0';
    }
    vll res;
    for (ll i = 2; i <= n; i++)
        if (flg[i] == '1') res.push_back(i);
    return res;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

/*----------------------------------------------------------------*/

void solve();

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}
void solve() {
    ll n;
    std::cin >> n;

    vll a(n);
    for (ll i = 0; i < n; i++)
        std::cin >> a[i];

    ll xor_all = 0;
    for (ll i = 0; i < n; i++)
        xor_all ^= a[i];

    for (ll i = 0; i < n; i++)
        std::cout << (xor_all ^ a[i]) << (i < n - 1 ? ' ' : '\n');
}


Measured memory_bytes: 4776
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

H, W, N = map(int, input().split())

m = {}

for i in range(N):
    a, b = map(int, input().split())
    for j in range(-2, 1):
        for k in range(-2, 1):
            if not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2:
                continue
            m[(a + j, b + k)] = m.get((a + j, b + k), 0) + 1

ans = [0] * 10

for k, v in m.items():
    ans[v] += 1


ans[0] = (H - 2) * (W - 2) - sum(ans[1 : 10])
for i in range(10):
    print(ans[i])

Measured memory_bytes: 167104
n=int(input())
l=[]
for _ in range(n):
    temp=list(map(int,input().split()))
    l.append(temp)
dp=[[0]*3 for _ in range(n)]

dp[0][0],dp[0][1],dp[0][2]=l[0]

for i in range(n-1):
    for j in range(3):
        for k in range(3):
            if j==k: continue
            dp[i+1][k]=max(dp[i+1][k],dp[i][j]+l[i+1][k])
print(max(dp[n-1]))


Measured memory_bytes: 100764
n,c,k = (int(i) for i in input().split())
t = [int(input()) for i in range(n)]
t.sort()
num,num2,answer = t[0]+k,0,1
for i in range(n):
	num2 += 1
	if t[i]>num or num2>c:
		num,num2=t[i]+k,1
		answer+=1
print(answer)

Measured memory_bytes: 7484
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;


int main (int argc, char const *argv[])
{
    string N;
    cin>>N;
    int ans=0;
    
    for(int i = 0; i < 4; i++)
    {
        
        if (N[i]=='2') {
            ans++;
        }
        
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
const lli INF = 1e18L+5;
/*
lli power(lli x,lli y)
{
    lli res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}
*/
int main()
{
//cout.precision(10);
//cout.setf(ios::fixed,ios::floatfield);
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
	lli T=1;
    //cin>>T;
	while(T--)
	{
		string s,t;
		cin>>s>>t;
		lli cunt=0,i;
		for(i=0;i<3;i++)
		{
			if(s[i]==t[i])
			cunt++;
		}
		cout<<cunt<<endl;
	}
}
/*
contest
tt
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.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++)
typedef long long ll;
// using Graph = vector<vector<Edge>>;
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

// dp[i+1][j] i番目までの品物を選んだとき，重さj以下で最大の価値の総和
int main()
{
    int N, W;
    cin >> N >> W;
    vector<int> w(N + 5);
    vector<int> v(N + 5);
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }

    vector<vector<ll>> dp(N + 5, vector<ll>(W + 100, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if (j - w[i] >= 0) {
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
            }
        }
    }

    cout << dp[N][W] << endl;
}

Measured memory_bytes: 86312
#include<stdio.h>
int main(void){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a+b==c || b+c==a || c+a==b){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Scanner;


public class Main {

	Scanner sc;
	
	boolean solve(HashMap<Integer,Integer> v){
		boolean even=true;
		for(Entry<Integer,Integer> e:v.entrySet()){
			if(e.getValue()%2!=0)even=false;
		}
		return even;
	}
	
	int ni(){
		return sc.nextInt();
	}
	
	void io(){
		HashMap<Integer,Integer> v;
		sc=new Scanner(System.in);
		
		while(sc.hasNext()){
			v=new HashMap<Integer,Integer>();
			int a,b;
			while(true){
				a=ni();b=ni();
				if(a==0&&b==0)break;
				
				int n=1;
				if(v.containsKey(a)){
					n=v.get(a)+1;
				}
				v.put(a,n);

				n=1;
				if(v.containsKey(b)){
					n=v.get(b)+1;
				}
				v.put(b,n);
			}
			v.put(1,v.get(1)+1);
			v.put(2,v.get(2)+1);
			
			System.out.println(solve(v)?"OK":"NG");
		}
		sc.close();
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().io();
	}

}

Measured memory_bytes: 21116
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, i = 0, sum = 1;
  cin >> N >> K;
  while (i < N) {
    if (sum <= K) {
      sum *= 2;
    }
    else {
      sum += K;
    }
    i++;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// int N が既に与えられているとする. 

int main(){
    int N, c;
    c = 0;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
     cin >> vec.at(i);
    }
    /* 達していない時 */
    if (N < 3) {
        cout << 0 << endl;
        return 0;
    }

    std::sort(vec.begin(), vec.end());
    for (int i = 0; i < N-2; i++) {
        for (int j = i+1; j < N-1; j++) {
            if (vec[i] != vec[j]) {
                for (int k = j+1; k < N; k++) {
                    /* 全要素が異なるかつ足した数が一番大きい辺と等しくなければ三角形 */
                    if (vec[j] != vec[k] && vec[i] + vec[j] > vec[k]) 
                        c++;
                }
            }
        }
        
    }
    cout << c << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
set<string>st;

int main()
{
    int N;
    cin>>N;
    int cnt=0;
    while(N--){
        string s;
        cin>>s;
        if(st.find(s)!=st.end())continue;
        cnt++;
        st.insert(s);
    }
    cout<<cnt;
}


Measured memory_bytes: 19120
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

int main () {
    int n = 0, m = 0;
    cin >> n >> m;
    int a = 0, b = 0;
    int tmp = 0;
    int two = 0;
    int to = 0;
    int len = (int)pow(2, n);
    vector<vector<pair<int, int>>> tree(len);
    for (int i=0; i<m; i++) {
        cin >> a >> b;
        two = 0;
        for (int j=0; j<b; j++) {
            cin >> tmp;
            tmp--;
            two += (int)pow(2, tmp);
        }
        for (int j=0; j<len; j++) {
            to = (j | two);
            if (to != j) {
                tree.at(j).push_back(make_pair(to, a));
            }
        }
    }
    vector<ll> dis(len, (ll)1e16);
    dis.at(0) = 0;
    priority_queue<pair<ll, int>> que;
    que.push(make_pair(dis.at(0), 0));
    while (!que.empty()) {
        auto t = que.top();
        que.pop();
        int v = t.second;
        if (dis.at(v) < t.first) {
            continue;
        }
        for (int i=0; i<(int)tree.at(v).size(); i++) {
            auto e = tree.at(v).at(i);
            if (dis.at(e.first) > dis.at(v) + e.second) {
                dis.at(e.first) = dis.at(v) + e.second;
                que.push(make_pair(dis.at(e.first), e.first));
            }
        }
    }
    if (dis.at(len-1) == (ll)1e16) {
        cout << -1 << endl;
    }
    else {
        cout << dis.at(len-1) << endl;
    }
    return 0;
}


Measured memory_bytes: 35840
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    rep(i, S.length()) {
        if(i % 2 == 0 && S[i] == 'L')  {
            cout << "No" << endl; return 0;
        }
        if(i % 2 == 1 && S[i] == 'R')  {
            cout << "No" << endl; return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 3644
use proconio::{input, marker::Chars};

fn main() {
    input! {
        n: usize,
        s: Chars,
    }

    let mut count_white = 0;
    for &c in s.iter() {
        if c == '.' {
            count_white += 1;
        }
    }

    let mut count_black = 0;
    let mut ans = count_white;

    for c in s {
        match c {
            '.' => {
                count_white -= 1;
            },
            '#' => {
                count_black += 1;
            },
            _ => {}
        }
        ans = std::cmp::min(ans, count_black + count_white);
    }

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


Measured memory_bytes: 2988
use std::fmt::Write;

fn main(){
    let mut sc = Scanner::new();

    while sc.read() {
        let n = sc.next();
        let mut x = vec![0i64; n];
        for i in 0..n {
            x[i] = sc.next();
        }
        let mut d = vec![0i64; n-1];
        for i in 0..n-1 {
            d[i] = x[i+1] - x[i];
        }
        let m = sc.next();
        let k = sc.next();
        let mut perm:Vec<_> = (0..n-1).collect();
        for _ in 0..m {
            let a = sc.next::<usize>() - 1;
            perm.swap(a-1, a);
        }
        let perm2 = pow(&perm, k);
        let mut res = vec![0i64; n-1];
        for i in 0..n-1 {
            res[i] = d[perm2[i]];
        }
        
        let mut ans = String::new();
        let mut cur = x[0];
        writeln!(&mut ans, "{}", cur).unwrap();
        for i in 0..n-1 {
            cur += res[i];
            writeln!(&mut ans, "{}", cur).unwrap();
        }
        
        print!("{}", ans);
    }
}

fn pow(perm: &Vec<usize>, k: usize) -> Vec<usize> {
    if k == 0 {
        (0..perm.len()).collect()
    } else if k%2 == 1 {
        let x = pow(perm, k-1);
        prod(&x, &perm)
    } else {
        let x = pow(perm, k/2);
        prod(&x, &x)
    }
}

fn prod(a: &Vec<usize>, b: &Vec<usize>) -> Vec<usize> {
    let n = a.len();
    let mut res = vec![0; n];
    for i in 0..n {
        res[i] = a[b[i]];
    }
    res
}

#[allow(dead_code)]
struct Scanner {
    buf: Vec<u8>, i: usize, next: Option<String>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner { buf: vec![], i: 0, next: None, }
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        self.wrapped::<T>().unwrap()
    }

    fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut res = Vec::<T>::with_capacity(n);
        for _ in 0..n { res.push(self.next()) }
        res
    }

    fn wrapped<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.read();
        self.next.take().and_then(|s| s.parse::<T>().ok())
    }

    fn read(&mut self) -> bool {
        if self.next.is_some() { return true }
        let mut s = String::with_capacity(16);
        while let Some(c) = self.get_char() {
            if !c.is_whitespace() { s.push(c); }
            else if !s.is_empty() { break; }
        }
        self.next = if !s.is_empty() { Some(s) } else { None };
        self.next.is_some()
    }

    fn get_char(&mut self) -> Option<char> {
        use std::io::Read;
        let mut reader = std::io::stdin();
        let mut buffer = [0u8;1];  // read exactly one byte
        match reader.read_exact(&mut buffer) {
            Ok(_) => Some(buffer[0] as char),
            _ => None
        }
    }
}


Measured memory_bytes: 7956
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pi;
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vouble vector<double>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mis map<int,str>
#define msi map<str,int>
#define mid map<int,double>
#define mod 100000007
#define elif else if
#define str string
int digitsum(int a){
  int b=0;
  while(a){
    b+=a%10;
    a/=10;
  }
  return b;
}
signed main(){
  int N,M,c=0,c2=0;
  string S,T;
  char C;
  double D;
  cin>>S;
  if(S[S.size()-1]=='2'||S[S.size()-1]=='4'||S[S.size()-1]=='5'||S[S.size()-1]=='7'||S[S.size()-1]=='9')cout<<"hon"<<endl;
  else if(S[S.size()-1]=='3')cout<<"bon"<<endl;
  else cout<<"pon"<<endl;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define pi 3.14159265

bool compare(pll a, pll b){
    return (a.first*b.second) < (a.second*b.first);
}

const int mod = 1e9 + 7;
const ll inf = ll(1e18);

ll modexp(ll x,ll n){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%mod,n/2);
    return (x*modexp((x*x)%mod,n/2))%mod;
}

int main(){
    fastio;
    string s;
    cin>>s;
    int n=s.length();
    int ans=0;
    f(i,0,n/2){
        if(s[i]!=s[n-i-1])ans++;
    }
    cout<<ans<<endl;
}

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

int main(void)
{
	int num[6];
	int n, sum, tmp, i;
	char ope[8];
	
	while (scanf("%d", &n) != EOF && n != 0){
		sum = 1;
		for (i = 0; i < 6; i++){
			num[i] = i + 1;
		}
		for (i = 0; i < n; i++){
			scanf("%s", ope);
			if (strcmp(ope, "North") == 0){
				tmp = num[0];
				num[0] = num[1];
				num[1] = num[5];
				num[5] = num[4];
				num[4] = tmp;
				sum += num[0];
			}
			else if (strcmp(ope, "East") == 0){
				tmp = num[0];
				num[0] = num[3];
				num[3] = num[5];
				num[5] = num[2];
				num[2] = tmp;
				sum += num[0];
			}
			else if (strcmp(ope, "West") == 0){
				tmp = num[0];
				num[0] = num[2];
				num[2] = num[5];
				num[5] = num[3];
				num[3] = tmp;
				sum += num[0];
			}
			else if (strcmp(ope, "South") == 0){
				tmp = num[0];
				num[0] = num[4];
				num[4] = num[5];
				num[5] = num[1];
				num[1] = tmp;
				sum += num[0];
			}
			else if (strcmp(ope, "Right") == 0){
				tmp = num[1];
				num[1] = num[2];
				num[2] = num[4];
				num[4] = num[3];
				num[3] = tmp;
				sum += num[0];
			}
			else if (strcmp(ope, "Left") == 0){
				tmp = num[1];
				num[1] = num[3];
				num[3] = num[4];
				num[4] = num[2];
				num[2] = tmp;
				sum += num[0];
			}
		}
		printf("%d\n", sum);
	}
	
	return (0);
}

Measured memory_bytes: 1032
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let i = 0;
  let s = lines[i++];
  while (i < lines.length && s !== "-") {
    i++;
    while (true) {
      let ss = lines[i++];
      const n = Number(ss);
      if (isNaN(n)) {
        console.log(s);
        s = ss;
        break;
      } else {
        s = s.slice(n) + s.slice(0, n);
      }
    }
  }
});



Measured memory_bytes: 16260
s = input()

stack = []
for c in reversed(s):
  stack.append(c)
  if len(stack) > 7:
    print('NO')
    break  
  if ''.join(reversed(stack)) in ('erase', 'dream', 'eraser', 'dreamer'):
    stack = []
else:
  print('NO' if stack else 'YES')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = (ll)998244353;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};


void solve(){
	
	ll a[5];
	mem(a,-1);
	ll n , m, pos, c;
	cin >> n >> m;
	while(m--){
		cin >> pos >> c;
		if(a[pos] != -1 && a[pos] != c){
			cout << "-1";
			return;
		}
		if(pos == 1 && c == 0 && n > 1){
			cout << "-1";
			return;
		}
		if(pos > n){
			cout << "-1";
			return;
		}
		a[pos] = c;
	}
	if(a[1] == -1 && n != 1) a[1] = 1;
	f1(n) cout << ( a[i] == -1 ? (ll)0 : a[i] );
 	
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


Measured memory_bytes: 256
main=do
 [h,w]<-map read.words<$>getLine
 print$min(solve h w)(solve w h)
solve h w=min(a h w)$if w>2 then(b h w)else 1145141919810
a h w=minimum[(maximum x)-(minimum x)|i<-[1..w-1],let x=[h`div`2*i,(h-h`div`2)*i,h*(w-i)]]
b h w=minimum[(maximum x)-(minimum x)|i<-[2..w-1],let x=[i`div`2*h,(i-i`div`2)*h,(w-i)*h]]

Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int h = 18;
const int l = 1 << h;
const int offset = 110000;
ll data[l];

void init() {
	fill_n(data, l, 0);
}

void update(int i) {
	i += offset;
	for (; i < l; i += i & -i) {
		data[i]++;
	}
}

ll query(int i) {
	i += offset;
	int ret = 0;
	for (; i > 0; i -= i & -i) ret += data[i];
	return ret;
}

const ll limit = 100010;
ll n,a[limit],val[limit];



bool check(int arg){
	ll cnt = 0LL;
	rep(i,n){
		if(a[i] <= arg)
			val[i] = 1;
		else
			val[i] = -1;
	}

	const ll total = 1LL * n * (n + 1) / 2LL;
	const ll thr = (total + 2) / 2;

	init();
	update(0);
	ll csum = 0;
	rep(i,n){
		csum += val[i];
		cnt += query(csum - 1);
		update(csum);
	}

	//cerr << thr << " " << cnt << " " << arg << endl;

	return  (thr <= cnt);
}

int main(void){
	cin >> n;
	rep(i,n) cin >> a[i];

	ll ng = 0, ok = 1 << 30;
	while(abs(ok - ng) > 1){
		const ll mid = (ok + ng) / 2;
		if(check(mid))
			ok = mid;
		else
			ng = mid;
	}

	cout << ok << endl;
	return 0;
}

Measured memory_bytes: 3840
N, Q = map(int, input().split())
S = input()
a = [0]
total = 0
for k in range(1,N, 1):
	if S[k - 1] == 'A':
		if S[k] == 'C':
			total = total + 1
	a.append(total)
for i in range(Q):
	l, r = map(int, input().split())
	print(a[r - 1] - a[l - 1])


Measured memory_bytes: 6100