akhauriyash/Code-Regression huggingface dataset:
// webcode about science as the new webcode about pirates/monkeys/ninjas?  here's hoping!
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<(int)(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(int)(a);i--)
template<typename T> ostream& operator<<(ostream& s, vector<T> t) {rep(i, 0, t.size()) s << (i ? " " : "") << t[i]; return s;}
template<typename T> istream& operator>>(istream& s, vector<T> &t) {rep(i, 0, t.size()) s >> t[i]; return s;}
template<typename T, typename U> ostream& operator<<(ostream& s, pair<T, U> t) {s << "(" << t.first << "," << t.second << ")"; return s;}
template<typename T, typename U> istream& operator>>(istream& s, pair<T, U> &t) {s >> t.first >> t.second; return s;}
typedef long long ll;

const int N = 888;
bool seen[N][N];
int rem[N][N];
int di[4] = { -1, 0, 1, 0};
int dj[4] = {0, 1, 0, -1};

vector<string> s;
int h, w;

bool canGo(int i, int j) {
    if (i < 0 || j < 0 || i >= h || j >= w)  return false;
    return s[i][j] != '#';
}

int main() {
    ios_base::sync_with_stdio(false);
    int k;
    cin >> h >> w >> k;
    s.resize(h);
    cin >> s;
    int i0 = 0, j0 = 0;
    rep(i, 0, h) rep(j, 0, w) {
        if (s[i][j] == 'S') {
            i0 = i;
            j0 = j;
        }
    }
    queue<pair<int, int>> q;
    q.push({i0, j0});
    rem[i0][j0] = k;
    while (!q.empty()) {
        int i, j;
        tie(i, j) = q.front();
        q.pop();
        seen[i][j] = true;
        if (rem[i][j] == 0) continue;
        
        rep(dir, 0, 4) {
            int ni = i + di[dir];
            int nj = j + dj[dir];
            if (!canGo(ni, nj) || seen[ni][nj]) continue;
            seen[ni][nj] = true;
            rem[ni][nj] = rem[i][j] - 1;
            q.push({ni, nj});
        }
    }
    
    //rep(i, 0, h) {rep(j, 0, w) cout << seen[i][j] << " "; cout << endl;}
    int best = h * w;
    rep(i, 0, h) rep(j, 0, w) {
        if (seen[i][j]) {
            int cur = min(min(i, j), min(h - i - 1, w - j - 1));
            if (cur == 0) {
                cout << 1 << endl;
                return 0;
            }
            cur = (cur - 1) / k + 1;
            best = min(best, cur);
        }
    }
    cout << best + 1 << endl;
}


Measured memory_bytes: 4480
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <ctime>

using namespace std;

#define LOCAL 0
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define fore(i, a, b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= (_b); --i)
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1& arg1){
    cerr << name << ": " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1& arg1, Args&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " /";
    __f(comma + 1, args...);
}

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

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1e9 + 7;

int main() {
#if LOCAL
    freopen("CP.inp", "r", stdin);
//    freopen("CP.out", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vi a(n); fore(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    LL ans = 0;
    fore(i, 0, n) fore(j, i + 1, n) {
        ans += upper_bound(a.begin() + j + 1, a.end(), a[i] + a[j] - 1) - lower_bound(a.begin() + j + 1, a.end(), a[j] - a[i] + 1);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  int ans = 0;
  int cnt = 0;
  int last = -1;
  while (n--) {
    int h;
    cin >> h;
    if (h <= last) {
      ++cnt;
    }
    else {
      if (ans < cnt)
        ans = cnt;
      cnt = 0;
    }
    last = h;
  }
  if (ans < cnt)
    ans = cnt;
  cout << ans << endl;
}

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

typedef long long ll;
typedef long double lxd;
typedef vector<ll> vll ;
 
#define INF 1e10 ;
#define mem(dp,a) memset(dp,a,sizeof dp)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) ;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define f(i,n) for (ll i=0;i<n;i++)
#define fo(i,n,x) for (ll i=x;i<=n  ;i++)
#define mp(a,b) push_back(make_pair(a,b))
#define pb(x) push_back(x)
#define make_graph(a,b) adj[a].pb(b) ; adj[b].pb(a);
#define tr(c,it) for(((c).begin())it=(c).begin();it!=(c).end();it++)
#define test ll t; cin>>t; label: while(t--)
#define fls fflush(stdout)
#define F first
#define S second

main(){
    ll n ;
    cin>>n  ;
    ll x = 3, y = 5 ;
    ll s = 0 ;
    for(int i = 1 ; i <= n ; ++i){
        x-- ; y-- ;
        if(x != 0 && y != 0)s+=i;
        if(x == 0){
            x = 3 ;
        }
        if(y == 0){
            y = 5 ;
        }
    }
    cout<<s ;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include <numeric>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD=1000000007;
//scanf("%d", &a) '\n'


int main() {
	ll n, k;
	cin >> n >> k;
	vector<int> a(n),b(2*n);
	rep(i, n) { cin >> a[i]; 
	b[i] = a[i];
	b[i + n] = a[i];
	}

	ll count = 0;;
	ll ans1 = 0;
	rep(i, n - 1) {
		rep2(j, i + 1, n) {
			if (a[i] > a[j]) ++ans1; 
		}
	}
	rep(i, n) {
		rep2(j, n, 2 * n) { if (b[i] > b[j])  ++count;  }
	}
	ans1 =(ans1* k)%MOD; 
	//count = ((count%MOD)*(k * (k - 1)%MOD)* 500000004)%MOD;
	count %= MOD;
	ll al = (k*(k - 1)) % MOD;
	count *= al;
	count %= MOD;
	count *= 500000004;
	count %= MOD;
	cout <<(ans1+count)%MOD ;
}
	

Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

string S;
string T="CODEFESTIVAL2016";
int ans;

signed main(){

    in(S);
    rep(i,S.size()){
        if(S[i]!=T[i]) ans++;
    }

    out(ans);

    return 0;
}


Measured memory_bytes: 256
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const N = nextInt()
    const arr = next().split("")
    let cnt = 1
    for(let i = 0; i<arr.length-1;i++){
        if(arr[i] !== arr[i+1]) cnt++
    }
    console.log(cnt)
}
Main()

Measured memory_bytes: 33844
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()

def dfs(s, max_ch):
    if len(s) == n:
        print(s)
    else:
        for i in range(ord('a'), max_ch + 1):
            next_ch = (max_ch + 1) if i == max_ch else max_ch
            dfs(s + chr(i), next_ch)

dfs("", ord("a"))

Measured memory_bytes: 4428
def warshall_floyd(d, n):
    # d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


def read_input():
    n, m = map(int, input().split())

    edges = []
    for i in range(m):
        a, b, c = map(int, input().split())
        edges.append((a - 1, b - 1, c))

    return n, m, edges

def submit():
    n, m, edges = read_input()

    # 全ノード間の最短経路を求める
    d = [[float('inf') for _ in range(n)] for _ in range(n)]

    for edge in edges:
        d[edge[0]][edge[1]] = edge[2]
        d[edge[1]][edge[0]] = edge[2]

    for i in range(n):
        d[i][i] = 0

    d = warshall_floyd(d, n)

    # 各edgeについていずれかの2点間の最短経路に含まれうるか確認する
    edge_inuse = [0 for _ in range(m)]
    for e, edge in enumerate(edges):
        for i in range(n):
            for j in range(n):
                dist1 = d[i][j]
                dist2 = d[i][edge[0]] + edge[2] + d[edge[1]][j]

                if dist1 == dist2:
                    edge_inuse[e] = 1
                    break

            if edge_inuse[e] == 1:
                break

    print(m - sum(edge_inuse))
    return


if __name__ == '__main__':
    submit()


Measured memory_bytes: 45296
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt( br.readLine() );
      String[] line = br.readLine().split(" ");

      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = Integer.parseInt(line[i]);
      }

      insertionSort(a, n);
    }
  }

  public static void insertionSort(int a[], int max) {
    StringBuilder line = new StringBuilder(a.length*4);
    for (int i=0,j=0,v=0; i < max; i++) {
      for( j = i-1, v = a[i]; j>=0 && a[j]>v; j-- ) {
        a[j+1] = a[j];
      }
      a[j+1] = v;
      dispIntArray(a,line);
      line.setLength(0);
    }
  }
  public static void dispIntArray(int a[],StringBuilder line) {
    for (int i=0, max = a.length-1; i < max; i++) {
     line.append(a[i] + " ");
    }
    System.out.println( line.append(a[a.length-1]) );
  }
}


Measured memory_bytes: 28340
"use strict";
    
const divisor = num => {
    let results = [];
    
    for(let i=1; i<=num; i++) {
        if( (num % i === 0) ) {
            results.push(i);
        }
    }
    
    return results;
}

const getGcd = (a, b) => {
  return a ? getGcd(b % a, a) : b;
}

const main = arg => {
    arg = arg.trim().split("\n");
    const A = parseInt(arg[0].split(" ")[0]);
    const B = parseInt(arg[0].split(" ")[1]);
    
    // 最大公約数を見つける
    let gcd = getGcd(A, B);
    
    let answer = 1;

    // 最大公約数の素因数の数が答えになる
    // ループを回すのは平方根までで良い
    for(let i=2; i*i<=gcd; i++) {
        if(gcd % i === 0) {
            answer++;
            while(gcd%i===0) gcd /= i;
        }
    }
    
    if(gcd !== 1) {
        answer++;
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EMPTY 0

using namespace std;

typedef long long ll;
ll LLINF = LLONG_MAX;

int n,a[5][5],tmp[5][5];
ll score[5],maxi;
int dx[] = {0,1,0,-1}; // ???,???,?????????
int dy[] = {1,0,-1,0};
bool used[5][5];

inline bool isValid(int x,int y) { return 0 <= x && x < 5 && 0 <= y && y < 5; }

void update(){

  rep(i,5) rep(j,5) tmp[i][j] = a[i][j];
  ll point = 0, phase = 0;
  bool update = true;
  while( update ){
    ++phase;
    update = false;
    memset(used,false,sizeof(used));
    rep(y,5){
      rep(x,5){
        if(  a[y][x] == EMPTY ) continue;
        rep(i,2) {
          int cnt = 0;
          int cx = x, cy = y, color = a[cy][cx];
          while( isValid(cx,cy) && a[cy][cx] == color ) {
            ++cnt, cx += dx[i], cy += dy[i];
          }
          if( cnt >= 3 ) {
            update = true;
            cx = x, cy = y;
            while( isValid(cx,cy) && a[cy][cx] == color ) {
              used[cy][cx] = true;
              ++cnt, cx += dx[i], cy += dy[i];
            } 
          }
        }
      }
    }
    ll sum = 0;
    rep(y,5) rep(x,5) if( used[y][x] ) {
      assert( 1 <= a[y][x] && a[y][x] <= 5 );
      sum += score[a[y][x]-1] * phase;
      a[y][x] = EMPTY;
    }
    point += sum;
    rep(x,5){
      for(int y=4;y>=0;y--) if( a[y][x] != EMPTY ) {
          int cx = x + dx[0], cy = y + dy[0];
          while( isValid(cx,cy) && a[cy][cx] == EMPTY ){
            swap(a[cy][cx],a[cy+dy[2]][cx+dx[2]]);
            cx += dx[0], cy += dy[0];
          }          
      }
    }
  }
  maxi = max(maxi,point);
  rep(i,5) rep(j,5) a[i][j] = tmp[i][j];
}

void dfs(int cx,int cy,int prev,int depth){
  update();
  if( depth >= n ) return;

  rep(i,4) if( ( i + 2 ) % 4 != prev ) {
    int nx = cx + dx[i], ny = cy + dy[i];
    if( !isValid(nx,ny) ) continue;
    swap(a[ny][nx],a[cy][cx]);
    dfs(nx,ny,i,depth+1);
    swap(a[ny][nx],a[cy][cx]);
  }
}

void compute(){
  maxi = -LLINF;
  rep(i,5) rep(j,5) dfs(j,i,-1,0);
  cout << maxi << endl;
}

int main(){
  while( cin >> n, n != -1 ){
    rep(i,5) rep(j,5) cin >> a[i][j];
    rep(i,5) cin >> score[i];
    compute();
  }
  return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define LIM 1000007
#define ll long long
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  string s[3] = {a, b, c};
  int p[3] = {0, 0, 0};
  char name[3] = {'A', 'B', 'C'};
  int i = 0;
  while (1) {
    if (p[i] >= s[i].size()) {
      cout << name[i] << endl;
      return 0;
    }
    char next = s[i][p[i]];
    p[i]++;
    if (next == 'a') {
      i = 0;
    } else if (next == 'b') {
      i = 1;
    } else {
      i = 2;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = get_int

if A >= N % 500
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 14444
import java.util.Scanner;

public class Main {

	public static void main(String... nui) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println((a == b) ? c : (b == c) ? a : b);
		
	}

}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;
const double PI=3.14159265358979323846;



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

    cout << N*2*PI;


}


Measured memory_bytes: 3788
S = input()
K = 13
MOD = 10**9 + 7

dp = [0] * K
dp[0] = 1

for s in S:
    newDp = [0] * K
    if s == '?':
        for i in range(10):
            for j in range(K):
                newDp[(j * 10 + i) % K] += dp[j]
    else:
        i = int(s)
        for j in range(K):
            newDp[(j * 10 + i) % K] += dp[j]
    dp = newDp
    for i in range(K):
        dp[i] %= MOD

print(dp[5])


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

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

void solve(){
	//code
	int n;
	cin>>n;
	if(n%1000==0) cout<<0;
	else cout<<(n/1000+1)*1000-n;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}



Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; string s; cin >> n >> s;
  int r = count(ALL(s), 'R'), no = 0;
  REP(i, r) no += s[i] == 'R';
  cout << r - no << '\n';
  return 0;
}


Measured memory_bytes: 3708
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        var x = new ArrayList<Integer>();
        for (int i = 0; i<n; i++) {
            x.add(fs.nextInt());
            x.add(fs.nextInt());
        }
        int c = 0;
        String ans = "No";
        for (int i = 0; i<x.size()-1; i++) {
            if (x.get(i) == x.get(i+1)) {
                c++;
                i++;
            } else {
                c=0;
            }
            if (c==3) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);


    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }

}


Measured memory_bytes: 32856
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    #define te  ll ti;   cin >> ti;  while(ti--) solve();  
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 200100;

    void solve(){
        ll n, cnt=0, pre=0;
        cin >> n;
        ll a[n];
        map<ll, ll> mp; 
        rep(i, n) cin >> a[i], mp[a[i]]++;
        trav(i, mp){
            pre++;
            i.snd%2==0 ? cnt++:0;
        }
        cout << (cnt%2 ? pre-1:pre) << endl;
    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
     /*
      #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
      #endif
     */
      //te
      solve();
      return 0;
    } 


Measured memory_bytes: 7296
import sys
def input():
    return sys.stdin.readline().rstrip('\n')

def calc(X, N, p):
    k = 0
    while True:
        if not X - k in p:
            return X - k
        elif not X + k in p:
            return X + k
        k += 1
    

(X, N) = tuple([int(s) for s in input().split()])
p = [int(s) for s in input().split()]
print(calc(X, N, p))

Measured memory_bytes: 61844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	ll n, k, q;
	cin >> n >> k >> q;

	vector<ll> vll(n);

	for (int i = 0; i < n; i++) {
		vll[i] = k-q;
	}

	for (int i = 0; i < q; i++) {
		ll a;
		cin >> a;
		vll[a - 1]++;
	}

	for (int i = 0; i < n; i++) {
		if (vll[i] > 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}

}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"---------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
						For(_x,L,R)cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
int T,a,b,c,d;
int len,m,flag;
char Get(int p){
	if (flag)
		p=a+b-p+1;
	int res;
	if (p<=m)
		res=p%(len+1)?'A':'B';
	else
		res=(a+b-p+1)%(len+1)?'B':'A';
	if (flag)
		res=res=='A'?'B':'A';
	return res;
}
void Solve(){
	a=read(),b=read(),c=read(),d=read();
	if (a==b){
		For(i,c,d)
			putchar(i&1?'A':'B');
		puts("");
		return;
	}
	flag=0;
	if (a<b)
		swap(a,b),flag=1;
	len=(a+(b+1)-1)/(b+1);
	int rd=a/len,rem=b-a/len,rec=a%len;
	if (!rec)
		rec=len,rem++,rd--;
	if (rem<=(LL)rec*len)
		m=rd*(len+1)+rec-(rem-1)/len;
	else {
		rd--;
		rem-=rec*len;
		rem++;
		while (rem>(LL)len*len){
			int tmp=rem/(len*len);
			rem-=tmp*len*len;
			rem+=tmp;
			rd-=tmp;
		}
		m=rd*(len+1)+len-(rem-1)/len;
	}
	For(i,c,d)
		putchar(Get(i));
	puts("");
}
int main(){
	T=read();
	while (T--)
		Solve();
	return 0;
}

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

using namespace std;
typedef long long int LL;
typedef long long int LLint;

//Faster Coding
#define ED return 0
#define GET(a) int a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << endl
#define ANS(a,b) int a;cin >> a;cout << b << endl
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//Difficult Syntax
#define DOUBLECHANGE(count) cout << setprecision(count)

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const long long INF = 999999999;
const long long mod = 1000000007;

int main(){
      cin.tie(0);
      ios::sync_with_stdio(false);
      SGET(S);
      SGET(T);
      int ans = 0;
      for(int i = 0;i < 3;i++){
          if(S[i] == T[i])ans++;
      }
      PRINT(ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
/*int p = 998244353;*/
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
signed main(){
	int lim = 10000;
	int a, b; cin >> a >> b;
	int n; cin >> n;
	rep(ind, n) {
		int s, f; cin >> s >> f;
		if (f <= a || b <= s) { f++; f--; }
		else {
			cout << 1 << endl; return 0;
		}
	}
	cout << 0 << endl;
}


Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int N;
int A[1 << 18], B[1 << 18], C[1 << 18];
vector<int> X[1 << 18], XX[1 << 18];
vector<int> Y[1 << 18];

int dp[1 << 18], dist[1 << 18];
int cl[1 << 18], cr[1 << 18], cnts;

void dfs(int pos, int dep) {
	dp[pos] = 1;
	dist[pos] = dep;
	cnts++; cl[pos] = cnts;
	for (int i : X[pos]) {
		if (dp[i] >= 1) continue;
		dfs(i, dep + 1);
		dp[pos] += dp[i];
		XX[pos].push_back(i);
	}
	cr[pos] = cnts;
}

vector<int> solve(int col) {
	vector<pair<int, int>> S;
	for (int i : Y[col]) S.push_back(make_pair(dist[i], i));
	sort(S.begin(), S.end());
	reverse(S.begin(), S.end());

	set<pair<int, int>> V; vector<int> res;
	for (int i = 0; i < S.size(); i++) {
		for (int j : XX[S[i].second]) {
			int pos = j;
			int pl = cl[pos], pr = cr[pos];

			auto itr = V.lower_bound(make_pair(pl, -1));
			vector<pair<int, int>> vec;
			while (itr != V.end()) {
				int pos = (*itr).first;
				if (pos <= pr) vec.push_back(*itr);
				else break;
				itr++;
			}
			for (pair<int, int> j : vec) V.erase(j);

			int ret = dp[pos];
			for (int j = 0; j < vec.size(); j++) ret -= dp[vec[j].second];
			res.push_back(ret);
		}
		V.insert(make_pair(cl[S[i].second], S[i].second));
	}

	int ret = dp[1]; auto itr = V.begin();
	while (itr != V.end()) {
		ret -= dp[(*itr).second];
		itr++;
	}
	res.push_back(ret);
	return res;
}

int main() {
	// Step #1: 入力
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> C[i];
	for (int i = 1; i <= N - 1; i++) cin >> A[i] >> B[i];
	for (int i = 1; i <= N - 1; i++) {
		X[A[i]].push_back(B[i]);
		X[B[i]].push_back(A[i]);
	}
	for (int i = 1; i <= N; i++) Y[C[i]].push_back(i);

	// Step #2: オイラーツアーなど
	dfs(1, 0);

	// Step #3: 計算
	for (int i = 1; i <= N; i++) {
		vector<int> G = solve(i);
		long long ans = 1LL * N * (N + 1LL) / 2LL;
		for (int j : G) ans -= 1LL * j * (j + 1LL) / 2LL;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 62664
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;

ll n, k, mod = 1000000007;

ll modpow(ll a, ll n, ll mod){
  if(n == 1) return a;
  ll ret = modpow(a, n / 2, mod);
  if(n % 2 == 0) ret = (ret * ret) % mod;
  else ret = (((ret * ret) % mod) * a) % mod;
  return ret;
}

vector<ll> modkaijo(ll n, ll mod){
  vector<ll> k(n + 1);
  k[0] = 1;
  for(int i = 1; i <= n; i++){
    k[i] = (k[i - 1] * i) % mod;
  }
  return k;
}

ll modchoose(ll l, ll r, vector<ll>& kaijo, ll mod){
  ll x = kaijo[l], y = kaijo[r], z = kaijo[l - r], ret;

  y = modpow(y, mod - 2, mod);
  z = modpow(z, mod - 2, mod);
  ret = (((x * y) % mod) * z) % mod;
  return ret;
}

void solve(){
  cin >> n >> k;
  ll ans = 0;
  vector<ll> kaijo = modkaijo(n, mod);
  for(ll i = 0; i <= min(k, n - 1); i++){
    ll x = modchoose(n, i, kaijo, mod), y = modchoose(n - 1, i, kaijo, mod);
    ans = (ans + ((x * y) % mod)) % mod;
  }
  cout << ans << endl;


  return;
}

int main(){
  solve();
  return 0;
}


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

int main(){
    double L; cin >> L;
    double ans = L*L*L/27;
    printf("%.12f\n",ans);
    return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;

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

  for (int i = 0; i < h; i++) {
    int count = 0;
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '.') {
        count++;
      }
    }
    if (count == w) {
      for (int j = 0; j < w; j++) {
        a[i][j] = ' ';
      }
    }
  }

  for (int i = 0; i < w; i++) {
    int count = 0;
    for (int j = 0; j < h; j++) {
      if (a[j][i] == '.' || a[j][i] == ' ') {
        count++;
      }
    }
    if (count == h) {
      for (int j = 0; j < h; j++) {
        a[j][i] = ' ';
      }
    }
  }

  for (int i = 0; i < h; i++) {
    bool flag = false;
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#' || a[i][j] == '.') {
        cout << a[i][j];
        flag = true;
      }
    }
    if (flag) {
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string s;
int main(){
	cin>>s;
	int len=s.size();
	for(int i=0;i<len-1;i++){
		if(s[i]==s[i+1]){
			cout<<i+1<<" "<<i+2<<endl;
			return 0;
		}
	}
	for(int i=0;i<len-2;i++){
		if(s[i]==s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return 0;
		}
	} 
	cout<<"-1 -1"<<endl;
	return 0;
	
}

Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		for(int i=1;i<=3;i++){
			if(A != i && B != i){
				Console.WriteLine(i);
			}
		}
	}
	int A,B;
	public Sol(){
		A = ri();
		B = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int a[1000];

int main(){
	a[1] = 1;
	for(int i = 2; i <= 999; i++) a[i] = a[i-1] + i;

	int w, e;
	cin >> w >> e;

	for(int i = 1; i < 999; i++){
		if(a[i + 1] - a[i] == e - w){
			cout << a[i + 1] - e << endl;
			break;
		}
	}

	return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string input;
    cin >> input;
    int number[input.length()];
    for (int i = 0; i < input.length(); ++i) {
        number[i] = input[i] - '0';
    }
    int answer = 10000;
    for (int i = 2; i < input.length(); ++i) {
        answer = min(answer, abs((number[i - 2] * 100 + number[i - 1] * 10 + number[i]) - 753));
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    #n = int(stdin.readline().rstrip())
    n,k = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #ab = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    a = [0]*(10**5+1)
    m = 0
    for i in range(n):
        A,B = map(int, stdin.readline().rstrip().split())
        a[A] += B
        m = max(m,A)
    j = 0
    for i in range(10**5):
        j += a[i]
        if j >= k:
            print(i)
            exit()
    print(m)



if __name__ == '__main__':
    solve()


Measured memory_bytes: 11668
while True:
    H, W = map(int, input().split())
    if H == W == 0:
        break
    
    for i in range(H):
        if i % 2 == 0:
            if W % 2 != 0:
                print("#." * (W // 2) + "#")
                continue
            print("#." * (W // 2))
        else:
            if W % 2 != 0:
                print(".#" * (W // 2) + ".")
                continue
            print(".#" * (W // 2))
    print()

Measured memory_bytes: 7652
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll ans = 0;
    ll _min = 0;
    for (ll i = 0; i < n; i++)
    {
        if (a[i] < _min)
        {
            ans += _min - a[i];
        }
        else if (_min < a[i])
        {
            _min = a[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4796
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String input = br.readLine();
		
		int n = Integer.parseInt(input);
		
		String[] tmpArray = br.readLine().split(" ");
		
		int oddPattern = 1;
		for(int i = 0; i < n; i++){
			int tmp = Integer.parseInt(tmpArray[i]);
			
			if(tmp % 2 == 0){
				oddPattern *= 2;
			}
			else {
				oddPattern *= 1;
			}
		}
//		System.out.println("odd" + oddPattern);
		int evenPattern = (int)Math.pow(3, n) - oddPattern;
		System.out.println(evenPattern);
		
	}

}


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

int main()
{
  int X, Y;
  cin >> X >> Y;
  
  int ans = 0;
  
  if (X == 1) ans += 300000;
  else if (X == 2) ans += 200000;
  else if (X == 3) ans += 100000;
  
  if (Y == 1) ans += 300000;
  else if (Y == 2) ans += 200000;
  else if (Y == 3) ans += 100000;
  
  if (X == 1 && Y == 1) ans += 400000;
  
  cout << ans << endl;
  return 0;
}

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

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

typedef long long ll;
typedef array<ll, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void dfs(int a, int x, vector<ll>& where, const vector<vector<pair<int,int>>>& adj) {
        if (where[a] != LLONG_MAX) {
                if (where[a] == x) return;
                else {
                        cout << "No\n";
                        exit(0);
                }
        }
        where[a] = x;
        for (auto b: adj[a]) {
                dfs(b.first, b.second + x, where, adj);
        }
}



void _main() {
        int n, m; cin >> n >> m;
        vector<vector<pair<int,int>>> adj(n + 1);
        for (int i = 0; i < m; i++) {
                int a, b, c; cin >> a >> b >> c;
                adj[a].emplace_back(b, c);
                adj[b].emplace_back(a, -c);
        }

        vector<ll> where(n + 1, LLONG_MAX);
        for (int i = 1; i <= n; i++) {
                if (where[i] != LLONG_MAX) continue;
                dfs(i, 0, where, adj);
        }

        cout << "Yes";
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

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

int main()
{
    int d, t, s;
    cin >> d >> t >> s;
    if(d <= t*s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 100000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
#define int long long
/* define/include */

signed main(){
  int n,m;
  cin >> n >> m;
  // m回 => 期待値 * 4
  int ans = ((n-m)*100 + m*1900);
  int p=1;
  LOOP(i,m){
    p*=2;
  }
  cout << ans * p;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    # print(A)
    ans = -1
    for i in range(N-1):
        if A[i]*2 < A[i+1]:
            ans = i
        A[i+1] += A[i]
    print(N-ans-1)

if __name__ == "__main__":
    main()


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

using namespace std;

bool check(string &S)
{
  while(S.size() > 3) {
    char ei = 'B';
    if(S.substr(0, 3) == "ABC") ei = 'A';
    else if(S.substr(S.size() - 3) == "ABC") ei = 'C';
    string T;
    bool ext = false;
    for(int i = 0; i < S.size(); i++) {
      if(S.substr(i, 3) == "ABC") T += ei, i += 2;
      else T += S[i], ext |= S[i] == ei;
    }
    if(ext || S == T) return (false);
    swap(S, T);
  }
  return (S == "ABC");
}

int main()
{
  string S;
  cin >> S;
  if(check(S)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3208
#include<iostream>

using std::cin;
using std::cout;
using std::endl;

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int l = a + b, r = c + d;
	if (l == r) cout << "Balanced" << endl;
	if (l > r)cout << "Left" << endl;
	if (l < r)cout << "Right" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<pair<int, int> > a(n);
    for(int i=0;i<n;i++){
        int v;
        cin>>v;
        a[i]=make_pair(v,i+1);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n-1;i++){
        cout<<a[i].second<<" ";
    }
    cout<<a[n-1].second<<endl;
    return 0;
}


Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		String S = sc.next();
		sc.close();
		
		int p;
		for(int i=0; i<A; i++) {
			try {
				p = Integer.parseInt(""+S.charAt(i));
			} catch(NumberFormatException e) {
				System.out.println("No");
				return;
			}
		}
		
		if('-' != S.charAt(A)) {
			System.out.println("No");
			return;
		}
		
		for(int i=A+1; i<=A+B; i++) {
			try {
				p = Integer.parseInt(""+S.charAt(i));
			} catch(NumberFormatException e) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	}
}

Measured memory_bytes: 22612
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    alp='abcdefghijklmnopqrstuvwxyz'
    s=STR()
    flg=0
    for i in alp:
        if not(i in s):
            print(i)
            flg=1
            break
    if flg==0:
        print('None')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#define MAX 1000000001
int n,*A,Left[100001],Right[100001],i,j,k;
long long count=0;
void Merge(int left,int mid,int right){
  int n1=mid-left,n2=right-mid;
  for(i=0;i<n1;i++)
    Left[i]=A[left+i];
  for(i=0;i<n2;i++)
    Right[i]=A[mid+i];
  Left[n1]=MAX;
  Right[n2]=MAX;

  for(i=0,j=0,k=left;k<right;k++){
    if(Left[i]>Right[j]){
      A[k]=Right[j++];
      count+=n1-i;
    }
    else A[k]=Left[i++];
  }
}
void MergeSort(int left,int right){
  int mid;
  if(right-left>1){
    mid=(left+right)/2;
    MergeSort(left,mid);
    MergeSort(mid,right);
    Merge(left,mid,right);
  }
}
int main(void){
  scanf("%d",&n);
  A=(int *)malloc(sizeof(int)*n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  MergeSort(0,n);
  printf("%lld\n",count);
  return 0;
}



Measured memory_bytes: 3420
#include<cstdio>
using namespace std;

int main() {
	int n, result = 0;
	int arr[200001] = { 0, };
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
		result ^= arr[i];
	}

	for (int i = 0; i < n; i++) {
		printf("%d ", result^arr[i]);
	}

	return 0;
}

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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second

using namespace std;

const int N = 1001000;
int n, k, a[N];

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	out << v.size() << '\n';
	for(auto e : v) out << e << ' ';
	return out;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n;
	int ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for(int i = 2; i <= n; i++) {
		if(a[i] == a[i - 1])
			ans++, a[i] = -1;
	}
	cout << ans << '\n';
}	

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle{
  int f[N2];
  int space;
  string path;

  bool operator<(const Puzzle &p) const{
    for(int i=0;i<N2;i++){
      if(f[i]==p.f[i]) continue;
      return f[i]>p.f[i];
    }
    return false;
  }
};

static const int dx[4]={-1,0,1,0};
static const int dy[4]={0,-1,0,1};
static const char dir[4]={'u','l','d','r'};

bool isTarget(Puzzle p){
  for(int i=0;i<N2;i++)
    if(p.f[i]!=(i+1)) return false;
  return true;
}

string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle,bool> V;
  Puzzle u,v;
  s.path="";
  Q.push(s);
  V[s]=true;

  while(!Q.empty()){
    u=Q.front(); Q.pop();
    if(isTarget(u)) return u.path;
    int sx=u.space/N;
    int sy=u.space%N;
    for(int r=0;r<4;r++){
      int tx=sx+dx[r];
      int ty=sy+dy[r];
      if(tx<0 || ty<0 ||tx>=N || ty>=N) continue;
      v=u;
      swap(v.f[u.space],v.f[tx*N+ty]);
      v.space=tx*N+ty;
      if(!V[v]){
	V[v]=true;
	v.path+=dir[r];
	Q.push(v);
      }
    }
  }
  return "unsolvable";
}

int main(){
  Puzzle in;

  for(int i=0;i<N2;i++){
    scanf("%d",&in.f[i]);
    if(in.f[i]==0){
      in.f[i]=N2;
      in.space=i;
    }
  }
  string ans=bfs(in);
  printf("%d\n",ans.size());

  return 0;
}



Measured memory_bytes: 30780
char s[99],t[101],*T;
r;main(n,i,j){for(scanf("%d%s",&n,s);n--;){
	for(scanf("%s",t),T=t-1;;){
		if(!(T=strchr(T+1,s[0])))break;
		for(i=1;T[i];i++)
			if(T[i]==s[1]){
				for(j=2;j<strlen(s);j++)if(i*j>=strlen(T)||T[i*j]!=s[j])break;
				if(j==strlen(s)){r++;goto next;}
			}
	}
	next:;
}printf("%d\n",r);exit(0);}

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

int main(){
    int n, m, sum = 0;
    cin >> n >> m;
    rep(i,m){
        int a;
        cin >> a;
        sum += a;
    }
    cout << max(-1, n - sum) << endl;
}

Measured memory_bytes: 3608