akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;



int main() {

    string s;
    cin>>s;
    fin(s.substr(0,3));

}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/04/20  Problem: ABC 052 B / Link: http://abc052.contest.atcoder.jp/tasks/abc052_b  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	LL K, S; cin >> K>>S;
	FOR(i, 0, K + 1) {
		FOR(j, 0, K + 1) {
			int k = S-i-j;
			if (k >= 0 && k<=K) {
				ans++;
			}
		}
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n[4];
  for(int i=0; i<4; i++){
    cin >> n[i];
  }
  sort(n, n+4);
  int a = n[0]*1000 + n[1]*100 + n[2]*10 +n[3];
  if(a==1479){
    cout << "YES" << endl;
  }else{
    cout <<"NO" << endl;
  }  
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] hikakuStr = line.split("[\\s]+");
		// TODO ?????????????????????????????????????????????
		int a = Integer.parseInt(hikakuStr[0]);
		int b = Integer.parseInt(hikakuStr[1]);

		int d = a / b;
		int r = a % b;
		double f = (double) a / b;

		System.out.println(d + " " + r + " " + String.format("%.8f", f));
	}

}

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

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

    int ans = 0;
    for (int i = 1; i < n; i++) {
        int cnt = 0;
        for (char c = 'a'; c <= 'z'; c++) {
            bool left = false, right = false;
            for (int j = 0; j < i; j++) {
                if (s[j] == c)
                    left = true;
            }
            for (int j = i; j < n; j++) {
                if (s[j] == c)
                    right = true;
            }
            if (left && right) {
                cnt++;
            }
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, amax = -1, r = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
        amax = max(amax, a[i]);
    }
    for(int i = 0; i < n; i++){
        if(a[i] != amax && abs(amax - a[r] * 2) >= abs(amax - a[i] * 2)){
            r = i;
        }
    }
    cout << amax << ' ' << a[r] << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define X first
#define Y second
#define vsort(v) sort(v.begin(), v.end())
#define vrev(v) reverse(v.begin(), v.end())
#define P pair

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

// 2進数変換
// string s = bitset<20>(x).to_string();

using namespace std;
using ll = long long;

int main(int argc, const char *argv[])
{
    string s;
    cin >> s;
    int cnt = 0;

    for (int i = 0; i < s.length() - 1; i++)
    {
        if (s[i] != s[i + 1])
        {
            s.erase(s.begin() + i, s.begin() + i + 1 + 1);
            cnt += 2;
            // cout << "i: " << i << " s: " << s << endl;
            i = max(i - 2, -1);
        }
        if(s.length() == 0){
          break;
        }
    }
    cout << cnt << endl;
}


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

using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> C(H * 2);
  for (int i = 0; i < H * 2; i+=2) {
    cin >> C[i];
    C[i + 1] = C[i];
  }

  for (int i = 0; i < H * 2; ++i) {
    cout << C[i] << endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	string S; 
	cin >> S; 
	bool A[12] = {}; 
	for(int i = 0; i < S.size(); i++){
		if(S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T'){
			A[i] = true; 
		}
	}
	int ans = 0; int tmp = 0; 
	for(int i = 0; i < S.size(); i++){
		if(A[i]){
			tmp ++; ans = max(ans, tmp); 
		}
		else{
			tmp = 0; 
		}
	}
	cout << ans << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#define pb push_back
#define mp make_pair
using namespace std;
const int N=3e2+5;
const long long INF=1e18;

int n;
int a[N][N];

priority_queue <pair <int, pair<int,int> > > pq;

struct edge{

  int v;
  int w;

  edge() {}

  edge(int _v,int _w)
  {
      v=_v;

      w=_w;
  }

};

vector <edge> nb[N];

long long dist[N];

bool vis[N];

void Djikstra(int v)
{
    int i;
    int ver,d;

    memset(vis,false,sizeof(vis));

    for(i=1;i<=n;i++)
        dist[i]=INF;
    dist[v]=0;

    priority_queue <pair <long long,int> > p;

    p.push(mp(0,v));

    while(!p.empty())
    {
        while(vis[p.top().second])
        {
            p.pop();

            if(p.empty())
                break;
        }

        if(p.empty())
            break;

        ver=p.top().second;
        d=-p.top().first;

        vis[ver]=true;
        p.pop();

        for(i=0;i<nb[ver].size();i++)
        {
            if(d+nb[ver][i].w < dist[nb[ver][i].v])
            {
                p.push(mp(-(d+nb[ver][i].w),nb[ver][i].v));

                dist[nb[ver][i].v]= d + nb[ver][i].w;
            }
        }



    }
}

long long ans;

int main()
{
  int i,j;
  int d,u,v;

  cin>>n;
  for(i=1;i<=n;i++)
  {
      for(j=1;j<=n;j++)
      {
        scanf("%d",&a[i][j]);

       if(i < j)
        pq.push(mp(-a[i][j],mp(i,j)));
      }
  }

  for(i=1;i<=n;i++)
  {
      for(j=1;j<=n;j++)
      {
          if(a[i][j] != a[j][i])
          {
              printf("-1\n");

              return 0;
          }
      }
  }



  while(!pq.empty())
  {
      d=-pq.top().first;

      u=pq.top().second.first;
      v=pq.top().second.second;

      pq.pop();

      Djikstra(u);

      if(dist[v] == d)
        continue;

      if(dist[v] < d)
      {
          printf("-1\n");
          return 0;
      }

      if(dist[v] > d)
      {
        nb[u].pb(edge(v,d));

        nb[v].pb(edge(u,d));

        ans+=d;
      }



  }

  printf("%lld\n", ans);


  return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define out(a) cout<<fixed<<setprecision((a))


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

	ll N;
	cin >> N;
	vector<ll> W(N);
	ll sum=0;
	FOR(i,0,N){
		cin >> W[i];
		sum += W[i];
	}
	ll ans = sum;
	ll x = 0;
	FOR(i,0,N){
		x += W[i];
		ans = min(ans,abs(abs(x)-abs(sum-x)));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import Data.List
import Data.List.Split
import Data.Function
import Data.Map(fromList,keys,member,(!))

main = do
  s <- getContents
  let [u,v] =splitOn "\n\n" s
  mapM_ (\x->putStrLn $ (show.fst$x) ++ " "++ (show.snd$x)) $ aux u v
  
aux :: String -> String -> [(Int,Int)]
aux u v =   [(x,fore!x+aft!x)|x<-keys fore,x `member` aft]
  where
    insort :: String -> [[Int]]
    insort s = sortBy (\x y->if (head x) < (head y) then LT else GT) . map (map (read::String->Int).splitOn ",") . lines $ s
    
    grp :: [[Int]] -> [(Int,Int)]
    grp w =map (\x->((head.head $ x),length x) ). groupBy ((==) `on` head) $ w
    fore= fromList . grp . insort $ u
    aft = fromList . grp . insort $ v

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

int main(){
	int n,p;
	while(cin>>n>>p and n>0){
		int win=p;
		int a[n+1]={};
		a[0]=1; p--;
		int i=1,ans;
		while(true){
			if(p>0){
				p--; a[i]++;
				if(a[i]==win){
					ans=i; break;
				}
			}else{
				p=a[i]; a[i]=0;
			}
			i++;
			if(i==n) i=0;
		}
		cout<<ans<<endl;
	}
	return 0;
}



Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++);
int main(){
    int N;
    cin >> N;
    ll ans = 0;
    for(int i=1;i<N;i++){
        ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*╔═══╗──╔╗╔╗───────────────────╔╗────────╔═══╦═══╗
  ║║─║╠╗╠╗╔╣╚═╦══╦═╗╔╦╗╔═╗╔══╦══╣╚═╦╦══╦══╣║─║║║─╚╝
  ║╔═╗║╚╝║╚╣║║║╚╝║║─╔╦╗║║║║╚╝║╚╝║╚╝║║║═╬══║╔═╗║╚╩═║
  ╚╝─╚╩══╩═╩╝╚╩══╩╝─╚╩╝╚╝╚╩══╩══╩══╩╩══╩══╩╝─╚╩═══╝*/
#include<bits/stdc++.h>
#define mod 1000000007
#define modc 998244353
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define deb(x) cout << #x << " " << x << endl;
#define deb2(x,y) cout << #x << " " << x << " " <<  #y << " " << y << endl
#define deb3(x,y,z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " "  << z << endl;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using namespace std;
template <class T>
string to_binary(T n)
{
	string binaryNum;
	int i = 0;
	while (n > 0) {
		binaryNum.pb((n % 2)+'0');
		n = n / 2;
		i++;
	}
	reverse(binaryNum.begin(),binaryNum.end());
	return binaryNum;
}
template<class T>
bool perfectSq(T n)
{
	if(sqrt(n) == floor(sqrt(n)))
		return true;
	else
		false;
}
void solve()
{
	int i,j;
	ll sum = 0,prod = 1;
	string s;
	cin >> s;
	s[1] = 'B'+'R'-s[1];
	cout << s << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t = 1;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>

int main(int argc, void **argv)
{
	long long x, a;

	scanf("%lld %lld", &x, &a);

	puts( x < a ? "0" : "10 ");

	return 0;
}


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

int main(){
 int n;
 int A[100000];
 int gcd[100000];
 int i_value;
 int i_next_value;
 int gcd_previous;
 int min=0;

 cin>>n;

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




for(int i=0;i<n-1;i++){
    gcd[i]=__gcd(A[i],A[i+1]);
    A[i+1]=gcd[i];
}

sort(gcd,gcd+n-1);

cout<<gcd[0]<<endl;
return 0;

} 


Measured memory_bytes: 1024
K,S=map(int,input().split())
z = list(range(0,K+1))
ans = []
for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans.append(K + 1 - (s_z - K))
  else:
    ans.append(s_z + 1)
print(sum(ans))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

  int d[16010] ;
  int dd[16010] ;
  int e[16010] ;
  int ee[16010] ;
int main(){
  string s ; cin>> s ;
  ll x,y ; cin>>x>> y ;
  x+=8005 ;y+=8005 ;
  ll k= s.size() ;
  vector<ll> A, B ;
  ll yoko = 0 ;
  ll tate =0 ;
  bool ok= 1 ;
  rep(i,k){
    if(s[i]=='F'){
        if(ok) yoko++ ;
        else tate ++ ; 
    }
    else{
    if(yoko>0) A.pb(yoko) ;
    if(tate>0) B.pb(tate) ;
    yoko=0 ;tate=0 ;
    ok = 1-ok ;
    }
    if(i==k-1){
    if(yoko>0) A.pb(yoko) ;
    if(tate>0) B.pb(tate) ;     
    }
  }
 
 ll  p= A.size() ;
 ll  q= B.size() ;
  rep(i,16010){
      d[i]=0 ;
      e[i]=0 ;
      dd[i]=0 ;
      ee[i] =0 ;
  }
  d[8005]=1 ;
  e[8005]=1 ;
  rep(i,p){
    rep(j,16010){
        if(d[j]==1){
            ll xx= j+A[i] ;
             dd[xx]= 1 ;
            ll yy = j-A[i] ;
            if(i>0|| s[0]=='T') dd[yy]=1 ;
        }
    }
    rep(j,16010){
     d[j]=dd[j] ;
     dd[j]=0 ;
    }
  }

  rep(i,q){
    rep(j,16010){
        if(e[j]==1){
            ll xx= j-B[i] ;
            ll yy= j+B[i] ;
             ee[xx]= 1 ;
           ee[yy]=1 ;
        }
    }
    rep(j,16010){
       e[j]=ee[j] ;
       ee[j]=0 ;
    }
  }
  bool oko=1 ;
  if(d[x]==0) oko=0 ;
  if(e[y]==0) oko=0 ;
  if(oko) cout<<"Yes"<<endl ;
  else cout<< "No"<<endl ;
 return 0 ;
}


Measured memory_bytes: 3936
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
ll n, k;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  ll d = n/k;
  ll ans = 0;
  ans += d * d * d;
  if(k%2==0){
    d = (n+k/2) / k;
    ans += d * d * d;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;int N,a,b,i,V[1<<20],f[1<<20];pair<int,int>R[1<<20];main(){for(cin>>N;i<N;cin>>a>>b,R[i]={a,a+b},i++);for(sort(R,R+N),b=V[N]=1;a=i--;b=V[i]=(b+V[f[i]=a])%998244353)for(;a<N&&R[a].first<R[i].second;a=f[a]);cout<<*V;}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string s;
  cin >> s;
  string sc="";
  if(s.size()%2==1){
    for(int i=0;i<s.size()-1;i++){
      sc+=s[s.size()-1];
      s.pop_back();
    }
    s.pop_back();
  }
  else{
    for(int i=0;i<s.size()-1;i++){
      sc+=s[s.size()-1];
      s.pop_back();
    }
  }
  int count=0;;
  for(int i=0;i<s.size();i++){
    if(s[i]==sc[i]){
    }
    else{
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
def examA():
    W = {'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'}
    S = SI()
    ans = W[S]
    print(ans)
    return

def examB():
    R = {"R","U","D"}
    L = {"L","U","D"}
    S = SI()
    ans = "Yes"
    for i,s in enumerate(S):
        if i%2==0 and s in R:
            continue
        if i%2==1 and s in L:
            continue
        ans = "No"
        break
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    # https://tjkendev.github.io/procon-library/python/string/z-algorithm.html
    def z_algo(S):
        N = len(S)
        A = [0] * N
        i = 1; j = 0
        A[0] = l = len(S)
        while i < l:
            while i + j < l and S[j] == S[i + j]:
                j += 1
            if not j:
                i += 1
                continue
            A[i] = j
            k = 1
            while l - i > k < j - A[k]:
                A[i + k] = A[k]
                k += 1
            i += k; j -= k
        return A
    N = I()
    S = SI()
    ans = 0
    for i in range(N):
        Z = z_algo(S[i:])
        for k,n in enumerate(Z[1:]):
            cur = min(k+1,n)
            ans = max(ans,cur)
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int su = 0;
    repall (c, s) { su += c - '0'; }
    yn(su % 9 == 0);

    return 0;
}


Measured memory_bytes: 3784
n, k = map(int, input().split())
probability = 0
for x in range(1,n+1):
	power = 0
	i = 0
	while(True):
		if(x*(2**i) >= k):
			power = i
			break
		i += 1
	probability += (1/n)*((1/2)**power)
print(probability)

Measured memory_bytes: 3060
import java.util.Scanner;

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

		// 入力値の取得
		int D = sc.nextInt();
		int T = sc.nextInt();
		int S = sc.nextInt();
		
		// 結果の出力
		if (D % S == 0) {
			if (D / S <= T) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		else {
			if (D / S <= (T - 1)) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		
		sc.close();
	}
}


Measured memory_bytes: 35848
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef vector<int> vi;
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define SZ(x) (int((x).size()))
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
#define repe(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	lint A, B, V, W, T;
	cin >> A >> V >> B >> W >> T;
	if (V <= W) {
		cout << ((A == B) ? "YES" : "NO") << endl;
	} else {
		cout << (((abs(A - B) + (V - W - 1)) / (V - W) <= T) ? "YES" : "NO") << endl;
	}
	return 0;
}

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

long long M, K, A[1 << 18];

int main() {
	cin >> M >> K;
	if ((1LL << M) <= K) {
		cout << "-1" << endl;
		return 0;
	}
	if (M == 0) {
		if (K == 0) cout << "0 0" << endl;
		else cout << "-1" << endl;
		return 0;
	}
	if (M == 1) {
		if (K == 0) cout << "0 0 1 1" << endl;
		else cout << "-1" << endl;
		return 0;
	}

	A[1 << M] = K; int cl = (1 << M), cr = (1 << M);
	for (int i = 0; i < (1 << M); i++) {
		if (i == K) continue;
		cl--; cr++; A[cl] = i; A[cr] = i;
	}
	A[0] = K;
	for (int i = 0; i < (2 << M); i++) { if (i) cout << " "; cout << A[i]; } cout << endl;
	return 0;
}

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

int	main()
{
  int	N;
  int	K;
  int	len;
  
  cin >> N >> K;
  
  while (N-- > 0)
  {
    int	x;
    cin >> x;
    
    if (x > K - x)
      len += 2 * (K - x);
    else
      len += 2 * x;
  }
  cout << len << endl;
  return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll n,q,p[200005],t[800005],lazy[800005],hell=998244353;
ll add(ll x,ll y){
	x+=y;
	if(x>=hell)
		x-=hell;
	return x;
}
ll sub(ll x,ll y){
	x-=y;
	if(x<0)
		x+=hell;
	return x;
}
ll exp(ll x,ll y){
	ll res=1;
	x%=hell;
	while(y){
		if(y&1)
			res=(res*x)%hell;
		y>>=1;
		x=(x*x)%hell;
	}
	return res;
}
void build(ll v,ll tl,ll tr){
	if(tl==tr){
		t[v]=sub(p[n-tl+1],p[n-tr])%hell;
		return;
	}
	ll tm=(tl+tr)/2;
	build(2*v,tl,tm);
	build(2*v+1,tm+1,tr);
	t[v]=add(t[2*v],t[2*v+1]);
}
void push(ll v,ll tl,ll tr){
	ll &x=lazy[v];
	if(!x)
		return;
	ll tm=(tl+tr)/2;
	t[2*v]=(x*sub(p[n-tl+1],p[n-tm]))%hell;
	t[2*v+1]=(x*sub(p[n-tm],p[n-tr]))%hell;
	lazy[2*v+1]=lazy[2*v]=x;
	x=0;
}
void upd(ll v,ll tl,ll tr,ll l,ll r,ll val){
	if(l>r)
		return;
	if(l==tl&&r==tr){
		t[v]=(val*sub(p[n-tl+1],p[n-tr]))%hell;
		lazy[v]=val;
		return;
	}
	push(v,tl,tr);
	ll tm=(tl+tr)/2;
	upd(2*v,tl,tm,l,min(r,tm),val);
	upd(2*v+1,tm+1,tr,max(l,tm+1),r,val);
	t[v]=add(t[2*v],t[2*v+1]);
}
ll get(ll v,ll tl,ll tr,ll l,ll r){
	if(l>r)
		return 0;
	if(l==tl&&r==tr)
		return t[v];
	push(v,tl,tr);
	ll tm=(tl+tr)/2;
	return add(get(2*v,tl,tm,l,min(r,tm)),get(2*v+1,tm+1,tr,max(l,tm+1),r));
}
void solve(){
	cin>>n>>q;
	ll val=exp(10,hell-2);
	build(1,1,n);
	for(ll i=0;i<q;i++){
		ll l,r,x;
		cin>>l>>r>>x;
		upd(1,1,n,l,r,x);
		cout<<(get(1,1,n,1,n)*val)%hell<<"\n";
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1,pr=1;
    p[0]=1;
    for(ll i=1;i<200005;i++){
    	pr=(10*pr)%hell;
    	p[i]=add(pr,p[i-1]);
    }
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

Measured memory_bytes: 13548
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli INF = 1 << 30;
const int MAX_N = 21000;
const int MAX_M = 20;
lli table[MAX_N+1][256];
int x[MAX_N];
int book[MAX_M];
void db_print(int line[]){
  for(int i = 100; i < 200; ++i){
    cout << i << "[" << line[i] << "]" << endl;
  }
  cout << endl;
}
int main(){
  int N, M;
  while(true){
    cin >> N >> M;
    if((N|M) == 0){
      break;
    }
    for(int i = 0; i < M; ++i){
      cin >> book[i];
    }
    for(int i = 0; i < N; ++i){
      cin >> x[i];
    }
    for(int i = 0; i < N+1; ++i){
      for(int j = 0; j < 256; ++j){
	table[i][j] = INF;
      }
    }
    //fill_n((int *) table, (N+1) * 256, INF);
    table[0][128] = 0;
    for(int i = 0; i < N; ++i){
      //db_print(table[i]);
      for(int j = 0; j < 256; ++j){
	for(int b = 0; b < M; ++b){	  
	  int d = book[b];
	  if(0 <= j+d && j+d <= 255){
	    int t = (x[i] - (j+d)) * (x[i] - (j+d));
	    table[i+1][j+d] = min(table[i+1][j+d], table[i][j]+t);
	  }
	  if(j+d < 0){
	    int t = (x[i] - 0) * (x[i] - 0);
	    table[i+1][0] = min(table[i+1][0], table[i][j]+t);
	  }
	  if(j+d > 255){
	    int t = (x[i] - 255) * (x[i] - 255);
	    table[i+1][255] = min(table[i+1][255], table[i][j]+t);
	  }
	}
      }
    }
    //db_print(table[N]);
    lli ans = INF;
    for(int i = 0; i < 256; ++i){
      ans = min(ans, table[N][i]);
    }
    cout << ans << endl;
  }    
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >>a[i];
  }
  sort(a,a+n);
  int maxa=a[n-1];
  int maxj=0;
  int tempj=0;
  for(int i=0;i<n-1;i++){
    if(min(a[i],maxa-a[i])>=maxj){
      maxj=a[i];
      tempj=a[i];
    }
  }
  cout<<maxa<<" "<<tempj<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

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

	int ans = 0;
	for (int i = S.size() - 2; i >= 2; i-=2)
	{
		string even_S = S.substr(0, i);
		int even_sub_string_size = even_S.size() / 2;
		if (even_S.substr(0, even_sub_string_size) == even_S.substr(even_sub_string_size, even_sub_string_size)) {
			ans = even_S.size();
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 1e5 + 10;
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
using std::cin;
using std::cout;
using std::string;
string s;
int N, dp[maxn];
signed main()
{
    cin >> s;
    N = s.size();
    dp[0] = 1;
    for (ri i = 0; i < N; ++i) {
        if (dp[i] == 0)
            continue;
        if (i + 5 <= N && s.substr(i, 5) == "dream")
            dp[i + 5] = 1;
        if (i + 5 <= N && s.substr(i, 5) == "erase")
            dp[i + 5] = 1;
        if (i + 6 <= N && s.substr(i, 6) == "eraser")
            dp[i + 6] = 1;
        if (i + 7 <= N && s.substr(i, 7) == "dreamer")
            dp[i + 7] = 1;
    }
    if (dp[N] == 1) {
        puts("YES");
    } else {
        puts("NO");
    }
    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstring>
#include <string>

class Dice
{
public:
	Dice(int* pValue)
	{
		memcpy(m_value, pValue, sizeof(int) * 6);
	}

public:
	Dice Roll(char direction) const
	{
		Dice d = (*this);

		switch (direction)
		{
		case 'N':
		{
			d.m_value[0] = m_value[1];
			d.m_value[1] = m_value[5];
			d.m_value[4] = m_value[0];
			d.m_value[5] = m_value[4];
		}
		break;
		case 'E':
		{
			d.m_value[0] = m_value[3];
			d.m_value[2] = m_value[0];
			d.m_value[3] = m_value[5];
			d.m_value[5] = m_value[2];
		}
		break;
		case 'W':
		{
			d.m_value[0] = m_value[2];
			d.m_value[2] = m_value[5];
			d.m_value[3] = m_value[0];
			d.m_value[5] = m_value[3];
		}
		break;
		case 'S':
		{
			d.m_value[0] = m_value[4];
			d.m_value[1] = m_value[0];
			d.m_value[4] = m_value[5];
			d.m_value[5] = m_value[1];
		}
		break;
		default:
			break;
		}

		return d;
	}

	Dice Spin() const
	{
		Dice d = (*this);

		d.m_value[1] = m_value[2];
		d.m_value[2] = m_value[4];
		d.m_value[3] = m_value[1];
		d.m_value[4] = m_value[3];

		return d;
	}

	int GetTop() const
	{
		return m_value[0];
	}

	int GetFront() const
	{
		return m_value[1];
	}

	int GetRight() const
	{
		return m_value[2];
	}

private:
	int m_value[6];
};

Dice FindTop(const Dice& dice, int top)
{
	if (dice.GetTop() == top)
	{
		return dice;
	}

	Dice d = dice.Roll('S');
	for (int i = 0; i < 3; ++i)
	{
		if (d.GetTop() == top)
		{
			return d;
		}

		d = d.Roll('S');
	}

	d = dice.Roll('E');
	if (d.GetTop() == top)
	{
		return d;
	}

	d = dice.Roll('W');
	if (d.GetTop() == top)
	{
		return d;
	}

	return dice;
}

Dice FindFront(const Dice& dice, int front)
{
	Dice d = dice;
	for (int i = 0; i < 4; ++i)
	{
		if (d.GetFront() == front)
		{
			return d;
		}

		d = d.Spin();
	}

	return d;
}

bool Find(const Dice& dice1, const Dice& dice2)
{
	Dice d2 = dice2;
	d2 = FindTop(d2, dice1.GetTop());
	if (d2.GetTop() != dice1.GetTop())
	{
		return false;
	}

	d2 = FindFront(d2, dice1.GetFront());
	if (d2.GetFront() != dice1.GetFront())
	{
		return false;
	}

	return d2.GetRight() == dice1.GetRight();
}

int main(int argc, char** argv)
{
	int val[6];
	std::cin >> val[0] >> val[1] >> val[2] >> val[3] >> val[4] >> val[5];
	Dice d1 = Dice(val);

	std::cin >> val[0] >> val[1] >> val[2] >> val[3] >> val[4] >> val[5];
	Dice d2 = Dice(val);

	std::cout << (Find(d1, d2) ? "Yes" : "No") << std::endl;

	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int n, k; cin >> n >> k;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    ll ans = 0;
    for(int l = 0; l <= min(k,n); l++){
        for(int r = 0; r <=  min(k,n)- l; r++){
            vector<int> s;
            ll now = 0;
            rep(i,l) s.push_back(v[i]), now += v[i];
            rep(i,r) s.push_back(v[n-1-i]), now += v[n-1-i];
            sort(ALL(s));
            for(int i = 0; i < min(k-l-r,(int)s.size());++i){
                if(s[i] < 0) now -= s[i];
            }
            ans = max(ans, now);
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int a;
    int b;
    int c;
    int result[3];
    
    cin >> a >> b >> c;
    
    if (a < b)
    {
        if(a < c)
        {
            result[0] = a;
            if (b < c)
            {
                result[1] = b;
                result[2] = c;
            }
            else
            {
                result[1] = c;
                result[2] = b;
            }
        }
        else
        {
            result[0] = c;
            result[1] = a;
            result[2] = b;
        }
    }
    else
    {
        if (b < c)
        {
            result[0] = b;
            if (a < c)
            {
                result[1] = a;
                result[2] = c;
            }
            else
            {
                result[1] = c;
                result[2] = a;
            }
        }
        else
        {
            result[0] = c;
            result[1] = b;
            result[2] = a;
        }
    }
    
    cout << result[0] << " " << result[1] << " " << result[2] << endl;
    
    return 0;
}


Measured memory_bytes: 3096
#include "stdio.h"

int main(){
	int n, y, i;
	int S[14]={}, H[14]={}, C[14]={}, D[14]={};
	char x;
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%s %d", &x, &y);
		if(x=='S'){S[y]=1;}
		if(x=='H'){H[y]=1;}
		if(x=='C'){C[y]=1;}
		if(x=='D'){D[y]=1;}
	}
	for(i=1;i<=13;i++){
		if(S[i]==0){printf("%s %d\n", "S", i);}
	}
	for(i=1;i<=13;i++){
		if(H[i]==0){printf("%s %d\n", "H", i);}
	}
	for(i=1;i<=13;i++){
		if(C[i]==0){printf("%s %d\n", "C", i);}
	}
	for(i=1;i<=13;i++){
		if(D[i]==0){printf("%s %d\n", "D", i);}
	}
	return 0;
}

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

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		String s = nextToken();
		out.println(s.substring(0, 4) + " " + s.substring(4, 12));
	}
	

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

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

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int q = int.Parse(Console.ReadLine());

            while(q-->0)
            {
                string[] tmp = Console.ReadLine().Split(' ');
                int a = int.Parse(tmp[1]);
                int b = int.Parse(tmp[2]);

                switch(tmp[0])
                {
                    case "reverse":
                        string s = new string(str.Substring(a, b - a + 1).Reverse().ToArray());
                        str = str.Substring(0, a) + s + str.Substring(b+1);
                        break;
                    case "replace":
                        str = str.Substring(0, a) + tmp[3] + str.Substring(b+1);
                        break;
                    default:
                        Console.WriteLine(""+str.Substring(a, b-a+1));
                        break;
                }
            }
        }
    }
}

Measured memory_bytes: 9504
use proconio::{fastout, input};
use std::cmp::{max, min};

#[fastout]
fn main() {
    input! {
        n :usize,
        w: i64,
        wv:[(i64, i64); n],
    }

    let w0 = wv[0].0;
    let mut vals = vec![vec![]; 4];
    for i in 0..n {
        vals[(wv[i].0 - w0) as usize].push(wv[i].1);
    }

    vals[0].sort_by_key(|t| -t);
    vals[1].sort_by_key(|t| -t);
    vals[2].sort_by_key(|t| -t);
    vals[3].sort_by_key(|t| -t);

    let mut res = 0;
    let mut zero = 0;
    let mut one = 0;
    let mut two = 0;

    for i in 0..=vals[0].len() {
        if i > 0 {
            zero += vals[0][i - 1];
        }
        for j in 0..=vals[1].len() {
            if j > 0 {
                one += vals[1][j - 1];
            } else {
                one = 0;
            }
            for k in 0..=vals[2].len() {
                if k > 0 {
                    two += vals[2][k - 1];
                } else {
                    two = 0;
                }
                let now = w0 * (i + j + k) as i64 + (j + 2 * k) as i64;
                let mut cmp = zero + one + two;
                if now > w {
                    continue;
                }
                let can_take = (w - now) / (w0 + 3);
                for l in 0..min(can_take as usize, vals[3].len()) {
                    cmp += vals[3][l];
                }
                res = max(res, cmp);
            }
        }
    }
    println!("{}", res);
}


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

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


int main()
{
   int n;
   cin>>n;
   ll a[n];
   for(int i=0;i<n;i++)
        cin>>a[i];
   if(n<3)
        cout<<"0"<<endl;
   else
   {
       int c=0;
      for(int i=0;i<n-2;i++)
      {
          for(int j=i+1;j<n-1;j++)
          {
              for(int k=j+1;k<n;k++)
              {
                  if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k]){
                  if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i])
                   {
                       //cout<<(i+1)<<" "<<(j+1)<<" "<<(k+1)<<endl;
                       c++;
                   }
                  }
              }
          }
      }
      cout<<c<<endl;
   }
  return 0;
}


Measured memory_bytes: 3596
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val s = br.readLine()!!
    var ans = 0
    var x = 0
    for (c in s) {
        if (c == 'I') x++ else x--
        ans = max(ans, x)
    }
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 34124
#include<iostream>
#include<map>
using namespace std;
long long n;
map<long long, long long>M;
long long solve_1(long long W) {
	if (M[W] >= 1)return M[W];
	if (W == 0)return 0;
	if (W == 1)return 1;
	if (W % 2 == 0) {
		long long a1 = solve_1(W / 2);
		M[W] = a1;
		return a1;
	}
	if (W % 2 == 1) {
		long long a1 = solve_1(W / 2) + solve_1(W / 2 + 1);
		M[W] = a1;
		return a1;
	}
}
long long solve(long long W) {
	if (W == 0)return 0;
	if (W == 1)return 1;
	if (W % 2 == 0) { return (3 * solve(W / 2) - solve_1(W / 2) + 1000000007) % 1000000007; }
	if (W % 2 == 1) { return (3 * solve(W / 2) + solve_1(W / 2 + 1) + 1000000007) % 1000000007; }
}
int main() {
	cin >> n;
	cout << solve(n + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<queue>
#include<stack> 
#include<cstdio>
using namespace std;
char a[50],b[50];
int main()
{
	stack<char>q;
	while(cin>>a)
	{
		int len=strlen(a);
		for(int i=0;i<len;i++)
		{
			if(a[i]=='0')
				q.push('0');
			else if(a[i]=='1')
				q.push('1');
			else if(a[i]=='B'&&!q.empty())	
				q.pop();
		}
		int j=0;
		while(!q.empty())
		{
			b[j++]=q.top();
			q.pop();
		}
		for(int i=j-1;i>=0;i--)
		{
			cout<<b[i];
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())

def conv_e_2_num(x):
    return 1 if x == "#" else 0

def is_painted(masu, x, y):
    return masu[y][x] == 1

def check_lrtb(masu, x, y, w, h):
    return (x - 1 >= 0 and is_painted(masu, x - 1, y)) \
        or (x + 1 < w and is_painted(masu, x + 1, y)) \
        or (y - 1 >= 0 and is_painted(masu, x, y - 1)) \
        or (y + 1 < h and is_painted(masu, x, y + 1)) \

def check_all(masu, w, h):
    if w == h and w == 1:
        return True
    for y in range(h):
        for x in range(w):
            if is_painted(masu, x, y):
                if check_lrtb(masu, x, y, w, h):
                    continue
                else:
                    return False
    return True


masu = []
for y in range(h):
    masu.append(list(map(conv_e_2_num, list(input()))))

print('Yes') if check_all(masu, w, h) else print('No')


Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
int i,j,k,t=1,p=0,m=1e9+7,r=0,a[2019];
char s[200001];
int main(){
    scanf("%s",s);
    for(i=0;s[i]!='\0';i++);
    for(j=--i;i>=0;i--){
        p=(p+(s[i]-48)*t)%2019;
        t=(t*10)%2019;
        a[p]++;
    }
    for(i=0;i<2019;i++){
        r+=a[i]*(a[i]-1)/2;
    }
    printf("%d",r+a[0]);
    return 0;
}

Measured memory_bytes: 1880
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N >> K;
	vector<long double >v(N);
	for (auto &i : v) {
		cin >> i;
		i /= K;
		i *= 3.1415926535;
		i *= 2;
	}
	long double x = 0, y = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 1; j < N; j++) {
			x += cos((v[i] + v[(i + j) % N]) / 2 + ((i + j) / N)*3.1415926535)*(N - j - 1);
			y += sin((v[i] + v[(i + j) % N]) / 2 + ((i + j) / N)*3.1415926535)*(N - j - 1);
		}
	}
	cout << setprecision(20) << x *6/( N*(N - 1)*(N - 2) ) << " " << y *6/( N*(N - 1)*(N-2) ) << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  vector<bool> ok(N, true);
  for (int i = 0; i < M; i++) {
    int a, b; cin >> a >> b;
    a--; b--;
    if (H.at(a) > H.at(b)) {
      ok.at(b) = false;
    }
    else if (H.at(a) < H.at(b)) {
      ok.at(a) = false;
    }
    else {
      ok.at(a) = false;
      ok.at(b) = false;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (ok.at(i)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3788