akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
/* S.size() s.substr(l,r=s.size()-l) -> l文字目からr文字分
__gcd()　lower_bound(a+l,a+r,x)-a でindex
// 配列  -> min/max({}) 
// vector-> *min_element(a+l,a+r)  *忘れず lとrで[l,r) 
//reverse(a+l,a+r)   配列aの[l,r)を逆順に strはreverse(all(s))
//sort(a+l,a+r,greater <int>()) 配列aの[l,r)昇順sort,大きい順はgreater<type>()
//vectorならall(v)
clock()/CLOCKS_PER_SEC で秒数
vector v.push_back(x),v.pop_back()
q.push(x),front()で先頭を返す,pop()で削除, size(),empty()
<deque>(push/pop)_(front/back)/fornt/back/insert/
priority_queue 宣言は priority_queue< Type, vector<Type>, greater<Type>> Q1; 
// pq.push(x),top()で参照 pop()で削除   greaterで最小 lessで最大がtopに*/
using namespace std;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define print(i) std::cout << (i) << '\n'
#define rrep(i,n) for(int (i)=(n)-1;(i)!=-1;(i)--)
#define vep(i,v) for(auto (i)=v.begin();(i)<(v.end());(i)++)
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; }
inline long long ceildiv(long long a, long long  b) { return (a+b-1)/b; }
typedef pair<long long,long long> P;
typedef pair<int,int> PI;
using Graph = std::vector<std::vector<int> >;
const long long inf = 10e17;
const long long mod = 1000000007;
//int |x|<=2*10**9     long |x|<= 9*10**18
//printf(".(小数点以下の桁数)lf(double時、float ならf)")

int Q[55][6];

vector<int> A;
int n,m,q,ans=0;
void dfs(){
    
  if (A.size()==n){
      int su=0;
      rep(i,q){
               if (A[Q[i][1]-1]-A[Q[i][0]-1]==Q[i][2])su+=Q[i][3];}
      ans=max(ans,su);return ;}
else{
  int haji;if (A.size()>=1){haji=A[A.size()-1];}else{ haji=1;}
  rep(i,m-haji+1){
  A.push_back(i+haji);
  dfs();
  A.pop_back();}
}

}
int main(){
cin>>n>>m>>q;

rep(i,q){rep(j,4){cin>>Q[i][j];}}
dfs();
print(ans);
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
  int n;
  cin>>n;
  int a[n];
  int ans=0;
  int cou=1;
  rep(i,n)cin>>a[i];

  rep(i,n){
    if(a[i]!=cou){
      ans++;
    }
    else{
      cou++;
    }
  }
  if(cou==1){
    cout<<-1<<endl;
  }
  else{
    cout<<ans<<endl;
  }
}




Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector <ll> a(n);
  REP(i, n) {
	cin >> a[i];
  }
  sort(all(a));
  ll prd = 1;
  ll cst = 1e18;
  REP(i, n) {
	if (prd == 0) {
		break;
	  }
	if (a[i] > cst / prd) {
		cout << -1 << endl;
		return 0;
	  }
	prd *= a[i];
  }
  cout << prd << endl;
  return 0;
}


Measured memory_bytes: 4068
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n, s=0;
  cin>>n;
  for(int i=1; i<=n; i++){
   for(int j=1; j<=n; j++){
    for(int k=1; k<=n; k++) s+=__gcd(i,__gcd(j,k));
   }
  }
  cout<<s;
}


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

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

	string s;
	long long int k;

	cin >> s;
	cin >> k;

	for(int i=0;i<min(k,(long long int)s.length());i++)
	{
		if(s[i]!='1')
		{
			cout << s[i] << '\n';
			return 0;
		}
	}

	cout << 1 << '\n';
	
	return 0;	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll k;string l;cin>>k>>l;
  cout<<((k<3200)?"red":l)<<endl;
  //caricurate
  //output
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

plus = []
minus = []
for i in a:
    if i >= 0: plus.append(i)
    if i < 0: minus.append(-i)
plus.sort(reverse=True)
minus.sort(reverse=True)

ans = 1
if k == n:
    for x in a:
        ans = (ans * x) % mod
else:
    i, j = 0, 0
    if k % 2 == 1:
        if len(plus) != 0:
            ans = plus[0]
            i += 1
        else:
            minus.sort()
            ans = -minus[0]
            j += 1
    while i + j != k:
        x_p = plus[i] * plus[i + 1] if i < len(plus) - 1 else 0
        x_m = minus[j] * minus[j + 1] if j < len(minus) - 1 else 0
        if x_p > x_m:
            ans = (ans * x_p) % mod
            i += 2
        else:
            ans = (ans * x_m) % mod
            j += 2
print(ans)


Measured memory_bytes: 31628
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

signed main()
{
  ll n,k; cin>>n>>k;
  vi a(n); vi f(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>f[i];
  
  vsort(a);
  rvisort(f);
  
  ll l = -1, r = 1e12;
  while(l+1<r){
    ll c = (l+r)/2;
    bool ok = [&](){
      ll s = 0;
      rep(i,n){
        s += max(0ll, a[i]-c/f[i]);
      }
      return s<=k;
    }();
    if(ok) r=c; else l = c;
  }
  cout << r << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		String[] a = new String[H];
		for(int i = 0;i < H;++i)
			a[i] = sc.next();
		sc.close();
		
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < W+2;++i)
			sb.append('#');
		sb.append('\n');
		for(int i = 0;i < H;++i) {
			sb.append('#');
			sb.append(a[i]);
			sb.append("#\n");
		}
		for(int i = 0;i < W+2;++i)
			sb.append('#');
		sb.append('\n');
		System.out.println(sb.toString());
	}
}


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

int main(){
   int a ,b;
   a = 700;
   string S ;
   cin >> S ;
   for(b = 0 ; b < 3; b++ )
    if(S.at(b)=='o'){
     a += 100 ;
   }
   cout << a << endl ;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    char a[15],b[15],c[15];
    while(~scanf("%s %s %s",a,b,c))
    {
        if(a[strlen(a)-1]==b[0]&&b[strlen(b)-1]==c[0]) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}


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

using namespace std;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

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

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

vll primes;
bool is_prime(const unsigned n) {
  if (n % 2 == 0 || n % 3 == 0) {
    if (n == 2 || n == 3) {
      return true;
    }
    return false;
  }
  if (n == 1) {
    return false;
  }

  for (unsigned i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }

  return true;
}

std::map<ll, ll> prime_factorization(ll n) {
  std::map<ll, ll> prime_factors;
  for (ll i : primes) {
    if (i * i > n)
      break;

    while (n % i == 0) {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;

  return prime_factors;
}

ll pfc(ll n) {
  ll num_divisor = 1;

  for (ll i : primes) {
    ll cnt = 0;
    if (i * i > n)
      break;

    while (n % i == 0) {
      cnt++;
      n /= i;
    }

    num_divisor *= (cnt + 1);
  }

  if (n != 1) {
    num_divisor *= 2;
  }

  return num_divisor;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;

  ll ans = 0;

  REP(i, n + 1) {
    ll syoko = i;
    ll makko = (n / i) * i;
    ll kosa = (n / i);
    ll sum = (syoko + makko) * kosa / 2;
    ans += sum;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<stack>
#include<map>
#include<queue>
#include<vector>
#include<cmath>
#include<set>
#define inf 0x3f3f3f3f
typedef long long ll;

const int maxn=1e5+5;

using namespace std;

int a[maxn],b[maxn],mina,minb;
int A,B,M;
int x,y,c,minn;


int main()
{
    scanf("%d%d%d",&A,&B,&M);
    mina=minb=inf;
    for(int i=1;i<=A;i++)
    {
        scanf("%d",&a[i]);
        mina=min(mina,a[i]);
    }
    for(int i=1;i<=B;i++)
    {
        scanf("%d",&b[i]);
        minb=min(minb,b[i]);
    }
    minn=mina+minb;
    for(int i=1;i<=M;i++)
    {
        scanf("%d%d%d",&x,&y,&c);
        minn=min(minn,a[x]+b[y]-c);
    }
    printf("%d\n",minn);
}

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

static const int MAX = 1e5;

// 隣接リストを用いた深さ優先探索（再帰ver.） O(|V|+|E|)
vector<int> G[MAX], color(MAX), topo;
// main関数からこれらを削除すること

void dfs(int u) {
  color[u] = 1; // GRAY
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (color[v] == 0) dfs(v);
  }
  color[u] = 2; // BLACK
  topo.emplace_back(u);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  // 無向(有向)グラフの隣接リスト
  int n, m; // n:頂点数 m:辺数
  cin >> n >> m;
  
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    G[u].emplace_back(v);
  }
  
  for (int i = 0; i < n; i++) {
    if (color[i] == 0) dfs(i);
  }
  
  vector<int> d(n);
  int ans = 0;
  for (int i = 0; i < topo.size(); i++) {
    for (int j = 0; j < G[topo[i]].size(); j++) {
      d[topo[i]] = max(d[topo[i]], d[G[topo[i]][j]] + 1);
    }
    ans = max(ans, d[topo[i]]);
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 8440
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

ll binpow(ll a, ll b) {
    if (b == 0)
    {
        return 1;
    }
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
    {
        return res * a;
    }
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m;
    string s,t;
    cin>>s;
    cin>>t;
    n=sz(s);
    m=sz(t);
    if (m!=n+1)
    {
        cout<<"No";
        return 0;
    }
    for (int i=0;i<n;++i)
        if (s[i]!=t[i])
        {
            cout<<"No";
            return 0;
        }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3660
n,k = [int(i) for i in input().split()]
s = [int(i) for i in input()]

num = [0]
which = s[0]
sign = [which]
for i in s:
  if i != which:
    which = 1-which
    num.append(0)
    sign.append(which)
  num[-1] += 1

num_0 = len(sign) - sum(sign)

if k >= num_0:
  print(sum(num))
  exit()

if sign[0] == 0:
  num = [0] + num

if sign[-1] == 0:
  num.append(0)

sum_now = sum(num[0:2*k+1])
ans = sum_now

for i in range(0,len(num),2):
  if i == 0:
    continue
  if i+2*k >= len(num):
    break
  
  plus = num[i+2*k-1]+num[i+2*k]
  minus = num[i-2] + num[i-1]
  diff = plus - minus
  sum_now += diff
  if sum_now > ans:
    ans = sum_now

print(ans)



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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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





int ans[100002];
int degree[100002];
pair<PII,int>edges[100002];

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,j,n,x,y,mx=0;
    cin >> n;
    for(i=1;i<n;i++)
    {
        cin >> x >> y;
        ++degree[x],mx=max(mx,degree[x]);
        ++degree[y],mx=max(mx,degree[y]);
        edges[i].FI.FI=min(x,y),edges[i].FI.SE=max(x,y);
        edges[i].SE=i;
    }
    cout << mx << '\n';
    for(i=1;i<=n;i++)degree[i]=1;
    sort(edges+1,edges+n);
    map<int,bool>mp[n+1];
    for(i=1;i<n;i++)
    {
        x=edges[i].FI.FI;
        mp[x-1].C;
        y=edges[i].FI.SE;
        while(mp[x][degree[x]])++degree[x];
        ans[edges[i].SE]=degree[x];
        mp[x][degree[x]]=mp[y][degree[x]]=true;
        ++degree[x];
    }
    for(i=1;i<n;i++)cout << ans[i] << '\n';
    return 0;
}


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

string solve(long long x, long long a, long long b) {
	if(abs(x - a) > abs(x - b)) return "B";
	else return "A";
}

int main() {
	long long b;
	long long a;
	long long x;
	scanf("%lld", &x);
	scanf("%lld", &a);
	scanf("%lld", &b);
	string ans = solve(x, a, b);
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;

string S;

int ans = -1;

vector<string> DIC;

void CALL(string S, int n) {

	if ((int)S.size() == n) { ans = 1; }

	for (int i = 0; i < 4; i++) {
		int num = DIC[i].size();
		if (n + num - 1 <= (int)S.size() && S.substr(n, num) == DIC[i]) { /*cout << DIC[i];*/  CALL(S, n + num); }
   }


}

int main(void) {

	cin >> S;

	DIC.push_back("dream");
	DIC.push_back("dreamer");
	DIC.push_back("erase");
	DIC.push_back("eraser");

	CALL(S,0);

	if (ans == -1) { cout << "NO" << endl; }
	else { cout << "YES" << endl; }

	//system("pause");
	return 0;
}

Measured memory_bytes: 2432
#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> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define rlo(i,n) for(int i=n-1;i>=0;i--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define pr(a) {for(auto x:a)cout<<x<<" ";cout<<nl;}
#define yes cout<<"Yes"<<nl
#define no cout<<"No"<<nl
#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

void f()
{
  string s;
  map<string,int>m;
  char c;
  int n;

  cin>>n>>s;

  m[s]++;
  c=s[sz(s)-1];
  for(int i=1;i<n;i++)
  {
    cin>>s;
    m[s]++;
    if(m[s]>1||s[0]!=c)
    {
      no;
      return;
    }
    c=s[sz(s)-1];
  }

  yes;
}

int main()
{
    su;
    f();
    return 0;
}

Measured memory_bytes: 3676
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (true) {
			int height = sc.nextInt();
			int width = sc.nextInt();
			if (height == 0 && width == 0) {
				break;
			}
			for (int i = 0; i < height; i++) {
				for (int j = 0; j < width; j++) {
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}


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

using ll = long long;
const ll INF = 1LL<<60;
const ll MOD = 1000000007LL;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP2(i,x,n) for(ll i=x;i<(ll)(n);i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく


void solve() {
	string S;
    cin >> S;
	
    int count=0;
  
  	int N = S.size();
  
  REP(i,N/2){
    if(S[i]!=S[N-i-1]){count++;}
  }
  	cout << count << endl;

	return;
}

signed main() {
    

    solve();

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int main()
{
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<a[2]*10+a[1]+a[0]<<endl;


}

Measured memory_bytes: 256
a = STDIN.gets().to_i
b = STDIN.gets().to_i
c = STDIN.gets().to_i
d = STDIN.gets().to_i
e = STDIN.gets().to_i
k = STDIN.gets().to_i

if (e - a) <= k
  puts "Yay!"
else
  puts ":("
end


Measured memory_bytes: 1788
def solve_knapsack(w, v, q)

	n = w.length
	inf = 1e9.to_i
	ans = [-inf] * (q + 1)

	ans[0] = 0

	(w.zip(v)).each do |wi, vi|
		(0..(q-wi)).each do |kkk|
			k = (q-wi) - kkk
			ans[k+wi] = [ans[k+wi], ans[k] + vi].max
		end
	end

	ans.max
	
end


if __FILE__ == $0

	n, q = gets().split().map(&:to_i)
	v, w = [], []
	n.times do |i|
		vi, wi = gets().split().map(&:to_i)
		v << vi
		w << wi
	end

	a = solve_knapsack(w, v, q)
	puts a

	#w = [3,2,4,1,3]
	#v = [2,3,3,2,6]
	#q = 10
	#a = solve_knapsack(w, v, q)
	#puts "ans: #{a}"

end

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

namespace ABC150A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b;
			var word = Console.ReadLine().Split(' ');
			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			if ((a * 500) < b)
			
				Console.WriteLine("No");
			else
				Console.WriteLine("Yes");
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 13140
N = gets.to_i
ps = gets.split(' ').map(&:to_i)
result = 0;
na = []
min = 4611686018427387903
ps.each_with_index do |p, index|
  if index == 0
    result += 1;
    next;
  end
  na.push(ps[index - 1])
  if min > ps[index - 1]
    min = ps [index - 1]
  end
  if p < min
    result += 1;
  end
end

puts result;



Measured memory_bytes: 18948
#include <iostream>
#include <string>
#include <map>
#include <cstring>
#include <vector>

int N;

int R[1010], W[1010];

int dp[2020];
int main() {
    for(;;) {
        std::cin >> N;

        if(N == 0) {
            return 0;
        }

        int sum = 0;
        for(int i = 0; i < N; ++i) {
            std::cin >> R[i] >> W[i];

            sum += R[i];
        }

        int overHalf = -1;
        for(int i = 0; i < N; ++i) {
            if(R[i] * 2 > sum) {
                overHalf = i;
                break;
            }
        }

        if(overHalf == -1) {
            for(int i = 0; i < N; ++i) {
                sum += W[i];
            }

            std::cout << sum << std::endl;

            continue;
        }

        int reading = R[overHalf] * 2;

        memset(dp, 0, sizeof(dp));
        dp[0] = 1;
        for(int i = 0; i < N; ++i) {
            if(i == overHalf)
                continue;
            for(int j = 2000; j >= 0; --j) {
                if(W[i] + j <= 1500)
                    dp[j + W[i]] = dp[j + W[i]] || dp[j];
            }
        }

        int cut;
        for(int i = R[overHalf] - (sum - R[overHalf]); i >= 0; --i) {
            if(dp[i]) {
                cut = i;
                break;
            }
        }

        int writing = 0;
        for(int i = 0; i < N; ++i) {
            writing += W[i];
        }

        std::cout << reading + (writing - cut) << std::endl;
    }
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define REP(i,n) for(long long i=0;i<n;++i)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
using namespace std;
using point = pair< int,int >;
using ll = long long;

int main(){
    int sum = 0, in;
    REP(i, 10) {
        cin >> in;
        sum += in;
    }

    printf("%d\n", sum);
    return 0;
}




Measured memory_bytes: 3140
#include<iostream>
#include<cstdio>
#define M 100010
using namespace std;
int n,L,flag,mark,a[M];
int main() {
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<n;i++) if(a[i]+a[i+1]>=L) flag=true,mark=i;
	if(!flag) {puts("Impossible");return 0;}
	puts("Possible");
	for(int i=1;i<mark;i++) printf("%d\n",i);
	for(int i=n-1;i>mark;i--) printf("%d\n",i);
	printf("%d\n",mark);
	return 0;
}

Measured memory_bytes: 1152
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    A = list(map(int, input().split()))
    sum = C
    for j in range(M):
        sum += A[j]*B[j]
    if sum>0:
        ans += 1

print(ans)


Measured memory_bytes: 9168
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 55

int H,W;
int h,w;
int A[NUM][NUM],B[NUM][NUM],C[NUM][NUM];


int main(){

	scanf("%d %d",&H,&W);

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			scanf("%d",&A[row][col]);
		}
	}

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			scanf("%d",&B[row][col]);
		}
	}

	scanf("%d %d",&h,&w);

	for(int row = 0; row < h; row++){
		for(int col = 0; col < w; col++){
			scanf("%d",&C[row][col]);
		}
	}

	int ans = -BIG_NUM;
	int tmp;

	bool FLG;

	for(int row = 0; row+h <= H; row++){
		for(int col = 0; col+w <= W; col++){

			FLG = true;
			tmp = 0;

			for(int a = 0; a < h; a++){
				for(int b = 0; b < w; b++){
					tmp += A[row+a][col+b];
					if(B[row+a][col+b] != C[a][b]){
						FLG = false;
						break;
					}
				}
				if(!FLG)break;
			}
			if(FLG){
				ans = max(ans,tmp);
			}
		}
	}

	if(ans == -BIG_NUM){

		printf("NA\n");

	}else{

		printf("%d\n",ans);
	}

	return 0;
}



Measured memory_bytes: 3244
#include "bits/stdc++.h"
using namespace std;

// コンテスト中のみ
#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
#define ld long double
ll INF = (1LL << 60);
int MOD = 1000000007;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll n, x, t; cin >> n >> x >> t;
	cout << (n + x - 1) / x * t << endl;
	return 0;
}

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

int main(){
  while(1){
    int x,y,s;
    cin >> x >> y >> s;
    
    if(x==0 && y==0 && s==0)
      break;
      
    int tmax = -1;
    
    for(int a=1; a<=s-1; a++){
      int ax = a*(100+x)/100;  
      int ay = a*(100+y)/100;    
      
      for(int b=1; b<=s-1; b++){
      int bx = b*(100+x)/100;  
      int by = b*(100+y)/100;  
      
      if(ax+bx==s){
        tmax = max(tmax,ay+by);
       }
        else if(ax+bx>s){
          break;
         }  
      }
   }
   cout << tmax << endl;
 }
 return 0;
}   


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
	cin>>a;
	int i,j;
	for(i=0;i<a.size();i++)
	{
		if(a[i]=='C')break;
	}
	
	for(j=a.size()-1;j>=0;j--)
	{
		if(a[j]=='F')break;
	}
	
	if(i<j)cout<<"Yes";
	
	else cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

int inf = std::numeric_limits<int>().max();

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define ll long long
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

int digit(int n) {
	string s = to_string(n);
	return s.size();
}

int main() {
	int n;
	cin >> n;
	int ans = 0;
	for(int i=1; i<=n; i++) {
		if (digit(i) % 2) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = str(input())
l1 = []
for c in n:
	l1.append(c)

z, o = '0', '1'

one, zero = [], []

for i in range(len(l1)):
	if i%2 == 0:
		one.append(o)
		zero.append(z)
	else:
		one.append(z)
		zero.append(o)

c1, c2 = 0,0
for i in range(len(l1)):
	if l1[i] == one[i]:
		c1 += 1
	if l1[i] == zero[i]:
		c2 += 1

ans = min(c1, c2)
print(ans)

Measured memory_bytes: 5616
n=int(input())
s=input()
count=0
char="RGB"
A=[[0,0,0] for i in range(n)]
if s[0]=="R":
    A[0][0]+=1
elif s[0]=="G":
    A[0][1]+=1
else:
    A[0][2]+=1

for i in range(1,n):
    x=A[i-1][0]
    y=A[i-1][1]
    z=A[i-1][2]
    if s[i]=="R":
        x+=1
    elif s[i]=="G":
        y+=1
    else:
        z+=1
    A[i][0]=x
    A[i][1]=y
    A[i][2]=z
#print(A)
count=0
for i in range(n):
    for k in range(i+2,n):
        if s[i]!=s[k]:
            c=3-char.index(s[i])-char.index(s[k])
            x=A[k][c]-A[i][c]
            count+=x
            if (i+k)%2==0:
                j=(i+k)//2
                if char.index(s[j])==c:
                    count-=1
print(count)


Measured memory_bytes: 69084
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, m = [int(x) for x in input().split()]
    if n > m:
        n, m = m, n
    if n == 1:
        if m == 1:
            print(1)
        else:
            print(m-2)
    else:
        print((n-2)*(m-2))



    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""


Measured memory_bytes: 9404
#include<iostream>

using namespace std;

int k, s;

bool binary_s(int n) {
  int l = 0;
  int r = k;
  if(k == n) {
    return true;
  }else if(n == 0) {
    return true;
  }
  while(r - l >= 1) {
    int i = (l + r) /2;
    if(i == n) {
      return true;
    }
    else if(i < n) l = i + 1;
    else r = i;
  }

  return false;
}

int main() {
  int ans = 0;
  cin >> k >> s;
  for(int i = 0; i <= k; i++) {
    for(int j = 0; j <= k; j++) {
      if(binary_s(s-i-j)) {
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl


int main() {
	lint A, B, C, D;
	cin >> A >> B >> C >> D;
	while (1) {
		C -= B;
		if (C <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
		A -= D;
		if (A <= 0) {
			cout << "No" << endl;
			return 0;
		}
	}
}

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

int assignFromTop(int n, int k, int c, string* s){
    int interval = c + 1, cnt = 0;
    for(int d = 0; d < n; d++){
        if(interval++ <= c)continue;
        if((*s)[d] == 'x')continue;
        
        ++cnt;
        (*s)[d] = (cnt <= k) ? 't' : 'T';
        interval = 1;
    }
    return cnt;
}

int assignFromEnd(int n, int k, int c, string* s){
    int interval = c + 1, cnt = 0;
    for(int d = n-1; d >= 0; d--){
        if(interval++ <= c)continue;
        if((*s)[d] == 'x')continue;

        ++ cnt;
        (*s)[d] = ((*s)[d] == 't') ? 'O' : 'e';
        interval = 1;
    }
    return cnt;
}

int main(){
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    int cT = assignFromTop(n, k, c, &s);
    int cE = assignFromEnd(n, k, c, &s);
    if(cT <= k && cE <= k)
        for(int i = 0; i < n; i++){
            if(s[i] == 'O')cout << i + 1 << endl;
        }
    return 0;
}

Measured memory_bytes: 1796
# coding: utf-8
# Your code here!
N=input()
K=int(input())
#Nは最大で100桁あるので、整数では扱いにくい
#そこでstringで入力する

#桁DPの典型的な問題
#まず、Nの具体的な値は無視して、以下のDPをする
#dp[i][j][k]=[j*10^i,(j+1)*10^i)までに0でない桁がk桁あるような数の個数
#このDPは、以下の遷移で求まる
#dp[i][j][k]=(i=0 j=0 k=0)1
#            (i=0 j=0 k!=0)0
#            (i=0 j!=0 k=1)1
#            (i=0 j!=0 k!=1)0
#            (i!=0 j=0)Σ[j,0~9] dp[i-1][j][k]
#            (i!=0 j!=0)Σ[j,0~9] dp[i-1][j][k-1]

dp = [[[0 for i in range(5)] for j in range(11)] for k in range(104)]
for j in range(10):
    if j==0:
        dp[0][j][0]=1
    else:
        dp[0][j][1]=1

for k in range(K+1):
    for i in range(len(N)):
        if i==0:
            continue
        for j in range(10):
            if j==0:
                for l in range(10):
                    dp[i][j][k]+=dp[i-1][l][k]
            elif (k != 0):
                for l in range(10):
                    dp[i][j][k]+=dp[i-1][l][k-1]


#そうしてDPのボードが完成したら答えを求める
#Nの上からi桁目をDとおき、[0,D)だけdp[i][j][k]を足す
#なお、最後の桁だけは[0,D]
#Dが0のときは以降の桁に0が残り続けるので、kをデクリメントする
#全ての桁を調べるかkが負になったら終了

Ans=0
k=K
for i in range(len(N)):
    D=int(N[i])
    if i==len(N)-1:
        D+=1
    for j in range(D):
        Ans+=dp[len(N)-i-1][j][k]
    if D!=0:
        k-=1
    if k<0:
        break

print(Ans)




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

using namespace std;

int main(){
    int N, K, Q; cin >> N >> K >> Q; int A, P[N];
    for (int i = 1; i <= N; i++) P[i]  = K;
    for (int i = 0; i <  Q; i++) {cin >> A; ++P[A];}
    for (int i = 1; i <= N; i++) P[i] -= Q;
    for (int i = 1; i <= N; i++) {
        if (P[i] > 0) cout << "Yes" << endl;
        else          cout << "No"  << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
int main() {
	int N;
	cin>>N;
	vector<int> X(N);
	vector<int> Y(N);
	rep(i,N){
		cin>>X[i];
		Y[i]=X[i];
	}
	sort(all(Y));
	int ans = 0;
	rep(i,N){
		if(X[i]<=Y[N/2-1])ans = Y[N/2];
		else ans = Y[N/2-1];
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3712
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] h = new int[N];
		for (int i = 0; i < N; i++) {
			h[i] = sc.nextInt();
		}

		int[] cost = new int[N];
		cost[N - 1] = 0;
		for (int i = N - 2; i >= 0; i--) {
//			if(i == N-2)cost[i]=Math.abs(h[i+1]-h[i]);
			int temp = K + 1;
			cost[i] = Integer.MAX_VALUE;
			while (temp-- > 1) {
				if (i + temp <= N - 1) {
//					System.out.println(":::"+i+":"+temp);
					cost[i] = Math.min(cost[i], cost[i + temp] + Math.abs(h[i + temp] - h[i]));
				}
			}
		}
		pw.println(cost[0]);
		// end

		sc.close();
		pw.close();
	}
}


Measured memory_bytes: 50952
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.container; // SList, DList, BinaryHeap

void main()
{
  auto n = readln.chomp.to!size_t;
  auto a = readln.split.to!(int[]);

  auto s1 = new long[](n+1), s2 = new long[](n+1);

  auto q1 = a[0..n].heapify!"a>b";
  s1[0] = reduce!"a+b"(0L, a[0..n]);

  foreach (i; 0..n) {
    auto ai = a[n+i];
    s1[i+1] = s1[i];
    if (ai > q1.front) {
      s1[i+1] += ai - q1.front;
      q1.replaceFront(ai);
    } 
  }

  auto q2 = a[n*2..$].heapify!"a<b";
  s2[0] = reduce!"a+b"(0L, a[n*2..$]);

  foreach (i; 0..n) {
    auto ai = a[n*2-i-1];
    s2[i+1] = s2[i];
    if (ai < q2.front) {
      s2[i+1] -= q2.front - ai;
      q2.replaceFront(ai);
    }
  }

  auto ans = long.min;
  foreach (i; 0..n+1)
    ans = max(ans, s1[i] - s2[n-i]);

  writeln(ans);
}


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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

const int N = 10005;
int ans[N];
int32_t main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= 100;i++){
        for(int j = 1;j <= 100;j++){
            for(int k = 1;k <= 100;k++){
                int val = SQR(i) + SQR(j) + SQR(k) + i * j + k * j + i * k;
                if(val <= n)ans[val]++;
            }
        }
    }
    for(int i = 1;i <= n;i++)cout << ans[i] << "\n";
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll k,a,b,yes=0;
    cin>>k>>a>>b;
    for(ll i=a;i<=b;i++){
        if(i%k==0){
            yes=1;
            break;
        }
    }
    if(yes) cout<<"OK";
    else cout<<"NG";
    return 0;
}

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

template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

typedef long long ll;
const ll MOD = 1000000007;
const int max_n = 200010;
ll a[max_n], s[max_n];
int n;

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

    ll ans=0;
    rep(i, n){
        s[i+1] = s[i] + a[i];
    }

    rep(i, n){
        ll tmp = (s[n] - s[i+1]) % MOD;
        ans += tmp * a[i];
        ans %= MOD;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6596
#include <stdio.h>

int main(void)
{
    int n;
    int building, floor, room;
    int infobox[5][4][11];
    // order : building, floor, room
    int person;
    int i, j, k;

    //prep init
    for (i = 1; i < 5; i++)
    {
        for (j = 1; j < 4; j++)
        {
            for (k = 1; k < 11; k++)
            {
                infobox[i][j][k] = 0;
            }
        }
    }

    scanf("%d\n", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d %d %d %d", &building, &floor, &room, &person);
        infobox[building][floor][room] = infobox[building][floor][room] + person;
    }

    for (i = 1; i < 5; i++)
    {
        for (j = 1; j < 4; j++)
        {
            for (k = 1; k < 11; k++)
            {
                if (i == 1)
                {
                    printf(" %d", infobox[i][j][k]);
                    k != 10 ? printf("") : printf("\n");
                }
                else if (i == 2)
                {
                    printf(" %d", infobox[i][j][k]);
                    k != 10 ? printf("") : printf("\n");
                }
                else if (i == 3)
                {
                    printf(" %d", infobox[i][j][k]);
                    k != 10 ? printf("") : printf("\n");
                }
                else if (i == 4)
                {
                    printf(" %d", infobox[i][j][k]);
                    k != 10 ? printf("") : printf("\n");
                }
                if ((j == 3 && k == 10) && (i != 4))
                {
                    printf("####################\n");
                }
            }
        }
    }
    return (0);
}


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

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, n, a) for(int i = (a); i >= (n); i--)
#define mod 1e9+7
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n;
  cin >> n;
  if(n == 1) {
    cout << "Yes" << endl;
    cout << 2 << endl;
    cout << 1 << " " << 1 << endl;
    cout << 1 << " " << 1 << endl;
    return 0;
  }
  int ps = 3;
  int sum = 3;
  while(n > sum) {
    sum += ps, ps += 1;
  }
  if(n != sum) {
    cout << "No" << endl;
    return 0;
  }

  vector<vector<int> > v(ps);

  v[0].pb(1);
  v[0].pb(2);
  v[1].pb(2);
  v[1].pb(3);
  v[2].pb(3);
  v[2].pb(1);
  int kps = 3, ksum = 6;
  int sn = 4;
  while(ksum != n * 2) {
    ksum += kps * 2;
    rep(i, 0, kps) {
      v[i].pb(sn + i);
    }
    rep(i, 0, kps) {
      v[kps].pb(sn + i);
    }
    sn += kps;
    kps++;
  }

  cout << "Yes" << endl;
  cout << kps << endl;
  rep(i, 0, kps) {
    cout << kps - 1 << " ";
    rep(j, 0, v[i].size()) {
      cout << v[i][j] << " ";
    }
    cout << endl;
  }
}


Measured memory_bytes: 3200
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt(), ans = 0;
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scanner.nextInt();
        for (int i = 0; i < n; ans++) {
            int j = i, k = i;
            while (++j < n && a[j - 1] <= a[j]);
            while (++k < n && a[k - 1] >= a[k]);
            i = Math.max(j, k);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 50620
#include<iostream>
#include<string.h>
using namespace std;
int m,n;
int a[1000][1000];
char c[1000][1000],s;
void dfs(int x,int y){
	if(x<0||x>=m||y<0||y>=n)
	return;
	if(s==c[x][y]&&a[x][y]==0){
		a[x][y]=1;
	}
	else
	return;
	dfs(x+1,y);
	dfs(x,y+1);
	dfs(x-1,y);
	dfs(x,y-1);
}
int main(){
	int k=0;
	while(cin>>m>>n&&m!=0&&n!=0){
		memset(a,0,sizeof(a));
		for(int i=0;i<m;i++){
			for(int j=0;j<n;j++)
			{
				cin>>c[i][j];
			}
		}
		for(int i=0;i<m;i++){
			for(int j=0;j<n;j++)
			{
				s=c[i][j];
				if(a[i][j]==0){
					k++;
					dfs(i,j);
				}
			}
		}
		cout<<k<<endl;
		k=0;
	}
	return 0;
} 



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

using namespace std;

#define INF 1e9
typedef pair<int,int> P;

int h,w;
int v[50][50][4];
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};

int d[50][50];

int bfs(){
    queue<P> que;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++)d[i][j]=INF;
    }

    que.push(P(0,0));
    d[0][0]=0;

    while(que.size()){
        P p=que.front();que.pop();

        if(p.first==h-1 && p.second==w-1)break;

        for(int i=0;i<4;i++){
            int ny=p.first+dy[i],nx=p.second+dx[i];


            if(0<=nx && nx<w && 0<=ny && ny<h && d[ny][nx]==INF && v[p.first][p.second][i]==0){
                que.push(P(ny,nx));
                
                d[ny][nx]=d[p.first][p.second]+1;
            }
        }
    }

    return d[h-1][w-1];

}

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

    while(1){
        cin>>w>>h;

        if(w==0)break;

        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                for(int k=0;k<4;k++)v[i][j][k]=0;
            }
        }

        for(int i=0;i<2*h-1;i++){
            if(i%2==0){
                for(int j=0;j<w-1;j++){
                    int a;
                    cin>>a;
                    v[i/2][j][0]=a;
                    v[i/2][j+1][2]=a;
                }
            }
            else{
                for(int j=0;j<w;j++){
                    int a;
                    cin>>a;
                    v[i/2][j][3]=a;
                    v[(i/2)+1][j][1]=a;
                }
            }
        }

        int ans=bfs()+1;

        if(ans==INF+1)ans=0;

        cout<<ans<<endl;

    }

}


Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(int argc,char** argv) {
	string s;
	cin >> s;
	for(int i = 0;i < s.size();i += 2) cout << s[i];
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <limits>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

int main()
{
    ll N, M;
    scanf("%lld %lld", &N, &M);

    vector<vector<ll>> route(N);
    for (ll i = 0; i < M; i++)
    {
        ll A, B;
        scanf("%lld %lld", &A, &B);
        route[A - 1].push_back(B - 1);
        route[B - 1].push_back(A - 1);
    }

    vector<ll> dis(N, 0x0fffffffffffffff);
    dis[0] = 0;
    vector<ll> to(N, 0);
    queue<ll> sq;
    sq.push(0);

    while (!sq.empty())
    {
        ll current = sq.front();
        sq.pop();
        for (const auto dest : route[current])
        {
            if (dis[dest] > dis[current] + 1)
            {
                dis[dest] = dis[current] + 1;
                to[dest] = current;
                sq.push(dest);
            }
        }
    }

    printf("Yes\n");
    for (ll i = 1; i < N; i++)
    {
        printf("%lld\n", to[i] + 1);
    }
}


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

int main(){
	int n;cin>>n;
	ll sum=0;
	int Min=INT_MAX;
	bool flag=false;
	rep(i,n){
		int a,b;cin>>a>>b;
		if(a!=b)flag=true;
		sum+=b;
		if(a>b)Min=min(Min,b);
	}
	if(!flag){
		puts("0");
	}
	else cout<<sum-Min<<endl;
}

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

using namespace std;

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

    // 0x61 - 0x7a
    string result;
    while(N) {
        N--;
        result += 'a' + N % 26;
        N = N / 26;
    }

    reverse(result.begin(), result.end());
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int x, y;
	cin >> x >> y;
	cout << x + y / 2 << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

using namespace std;

int main() {
  int N,C[4]={};
  cin >> N;
  string s;
  map<string, int> men;
  men["AC"] = 0;
  men["WA"] = 1;
  men["TLE"] = 2;
  men["RE"] = 3;
  while(N--) {
    cin >> s;
    C[men[s]]++;
  }
  printf("AC x %d\n", C[0]);
  printf("WA x %d\n", C[1]);
  printf("TLE x %d\n", C[2]);
  printf("RE x %d\n", C[3]);

  return 0;
}


Measured memory_bytes: 3704
#include <iostream>
#include <string>
using namespace std;
int main(){
    string a,b;
    cin >> a >> b;
    a += b;
    int x = stoi(a);
    for(int i = 0; i <= x; i++)
    {
        if (x == i*i) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())
s = input()
max = 0
for i in range(N):
    count = 0
    s1 = s[:i]
    s2 = s[i:]
    A = set(s1)
    B = set(s2)
    for c in A:
        if c in B:
            count += 1
    if count > max:
        max = count
print(max)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
static const int MAX = 200000;

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

	a *= n;

	if (a < b) {
		cout << a << endl;
	}
	else {
		cout << b << endl;
	}

    return 0;
}

Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split())
A = np.array([list(input()) for _ in range(N)])
B = np.array([list(input()) for _ in range(M)])
for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M, j:j+M] == B).all():
      print('Yes')
      exit()
print('No')

Measured memory_bytes: 12440