akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    s: chars,
  }
  let n = s.len();
  let mut stay = vec![false; n];
  for i in 1 .. n {
    if s[i-1] == 'R' && s[i] == 'L' {
      stay[i-1] = true;
      stay[i] = true;
    }
  }
  let mut count = vec![1; n];
  for i in 1 .. n {
    if s[i-1] == 'R' && ! stay[i-1] {
      count[i+1] += count[i-1];
      count[i-1] = 0;
    }
  }
  for i in (1 .. n).rev() {
    if s[i] == 'L' && ! stay[i] {
      count[i-2] += count[i];
      count[i] = 0;
    }
  }
  for &c in &count {
    puts!("{} ", c);
  }
  puts!("\n");
}


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

#define TRACE
#ifdef TRACE
#define TR(...) __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 TR(...)
#endif

typedef long long                LL;
typedef vector < int >           VI;
typedef pair < int,int >         II;
typedef vector < II >            VII;

#define MOD                      1000000007
#define EPS                      1e-12
#define N                        200100
#define PB                       push_back
#define MP                       make_pair
#define F                        first 
#define S                        second
#define ALL(v)                   v.begin(),v.end()
#define SZ(a)                    (int)a.size()
#define FILL(a,b)                memset(a,b,sizeof(a))
#define SI(n)                    scanf("%d",&n)
#define SLL(n)                   scanf("%lld",&n)
#define PLLN(n)                  printf("%lld\n",n)
#define PIN(n)                   printf("%d\n",n)
#define REP(i,j,n)               for(LL i=j;i<n;i++)
#define PER(i,j,n)               for(LL i=n-1;i>=j;i--)
#define endl                     '\n'
#define fast_io                  ios_base::sync_with_stdio(false);cin.tie(NULL)
int a[210];
int main() {
  int n; cin >> n;
  REP(i,0,2*n) cin >> a[i];
  int ans = 0;
  sort(a , a+2*n);
  for(int i = 0 ; i < 2*n ; i += 2)
    ans += min(a[i] , a[i+1]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>

using namespace std;

int H, W;
string S[405];

int C[405][405];

int B[405][405];

long long int b[160005], w[160005];

void visit(int i, int j,int K) {

	C[i][j] = K;

	string str;
	if (S[i][j] == '.') { str = "#"; }
	else { str = "."; }

	if ((S[i - 1].substr(j, 1) == str) && (C[i - 1][j] == 0)) { visit(i - 1, j, K); }
	if ((S[i +1].substr(j, 1) == str) && (C[i + 1][j] == 0)) { visit(i + 1, j, K); }
	if ((S[i].substr(j-1, 1) == str) && (C[i][j-1] == 0)) { visit(i, j-1, K); }
	if ((S[i].substr(j+1, 1) == str) && (C[i][j + 1] == 0)) { visit(i, j + 1, K); }
}

int main(void) {

	cin >> H >> W;
	string tmp = "";
	for (int i = 0; i <= W + 1; i++) { tmp += "?"; }
	S[0] = tmp; S[H + 1] = tmp;

	for (int i = 1; i <= H; i++) {
		cin >> tmp;
		S[i] = "?" + tmp + "?";
	}

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (S[i][j] == '#') { B[i][j] = 1; }
			else { B[i][j] = -1; }
		}
	}

	int K = 1;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (C[i][j] == 0) {
				visit(i, j, K);
				K++;
			}
		}
	}
	


	long long int ans = 0;

	/*for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			for (int u = 1; u <= H; u++) {
				for (int v = 1; v <= W; v++) {
					if ((B[i][j] == 1) && B[u][v] == -1) { if (C[i][j] == C[u][v]) { ans++; } }
				}
			}

		}
	}*/
	
	/*for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cout << C[i][j] << " ";
		}
		cout << endl;
	}*/


		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) {
					if (S[i][j] == '#') { b[C[i][j]]++; }
					else { w[C[i][j]]++; }
				}
			}
			
		
		//cout << "b= " << b << " w= " << w << endl;
		
		for (int i = 1; i < K; i++) {
			ans += w[i] * b[i];
		}
	

	/*for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cout << C[i][j] << " ";
		}cout << endl;
	}*/

	cout << ans << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 39424
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int n;
	cin >> n;
	cout << (n + 1) / 2 << '\n';
}

Measured memory_bytes: 3624
B = input()
S = B
a = 0
if S[0] == "A":
    if S[2:-1].count("C") == 1:
        if "C" in S[2:-1]:
            t = 2 + S[2:-1].index("C")
            S = str(S.lstrip("A"))
            S = str(S[0] + S[1:t-1] + S[t:])
            if S.islower():
                a = 1
if a == 1:
    print("AC")
else:
    print("WA")

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

typedef long long ll;

int main(){
	ll A,B;
	cin >> A >> B;
	vector<ll> AA(40);
	vector<ll> BB(40);

	A--;
	for(ll j=0; j<40; j++){
		ll i = (1LL<<j);
		if(A<i)break;
		ll a = (A+1)/(i*2) * i;
		ll b = ((A+1)%(i*2)) - i;
		if(b>0)a+=b;
		AA[j] = a;
	}
	for(ll j=0; j<40; j++){
		ll i = (1LL<<j);
		if(B<i)break;
		ll a = (B+1)/(i*2) * i;
		ll b = ((B+1)%(i*2)) - i;
		if(b>0)a+=b;
		BB[j] = a;
	}

	ll ans = 0;
	for(ll j=0; j<40; j++){
		ll i = (1LL<<j);
		if((BB[j]-AA[j]) %2)ans += i;
	}


	cout << ans << endl;
}

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

int main(){
  vector<int> A(5);
  for(int i = 0; i < 5; i++) cin >> A.at(i);
  int k;
  cin >> k;
  int t = 0;
  for(int i = 0; i < 4; i++){
    for(int j = i; j < 5; j++){
      if(A.at(j) - A.at(i) > k){
        cout << ":(" << endl;
        t = 1;
        break;
      }
    }
    if(t == 1){
      break;
    }
  }
  if(t == 0){
    cout << "Yay!" << endl;
  }
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

int main(){
  ll N; cin>>N;
  ll p[N+1];
  map<ll, ll> mp;
  for(ll i=1;i<=N;++i){
    cin >> p[i];
    mp[ p[i] ] = i;
  }
  ll k = 0;
  ll temp = 1;
  for(ll x=1;x<N;++x){
    if(mp[ x ]<mp[ x+1 ]){
      ++temp;
    }else{
      chmax(k,temp);
      temp = 1;
    }
  }
  chmax(k,temp);
  cout << N-k << "\n";
}

Measured memory_bytes: 17648
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n, m;
	std::string s, t;
	std::cin >> n >> m >> s >> t;
	int g = gcd(n, m);
	for(int i = 0; i < g; i++) {
		if(s[i * (n / g)] != t[i * (m / g)]) {
			std::cout << "-1\n";
			return 0;
		}
	}
	std::cout << (long long) n / g * m << '\n';
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
ll dp[44][440][440];
int main(){
	ll n,ma,mb,ans=INF;
	cin>>n>>ma>>mb;
	vector<ll> a(n),b(n),c(n);
	rep(i,n){
		cin>>a[i]>>b[i]>>c[i];
	}
	rep(i,44)
	rep(j,440)
	rep(k,440)
	dp[i][j][k]=INF;
	dp[0][0][0]=0;
	rep(i,n){
		rep(j,411){
			rep(k,411){
				dp[i+1][j][k]=min(dp[i][j][k],dp[i+1][j][k]);
				dp[i+1][j+a[i]][k+b[i]]=min(dp[i][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
			}
		}
	}

	rep(i,n+1){
		FOR(j,1,401){
			FOR(k,1,401){
				if(j*mb==k*ma)ans=min(ans,dp[i][j][k]);
			}
		}
	}

	cout<<((ans==INF)?-1:ans)<<endl;

    return 0;
}

Measured memory_bytes: 66816
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


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

    int t;
    cin >> t;
    rep(k,t) {
        string x1,x2;
        cin >> x1 >> x2;
        int n=x1.size(),m=x2.size();
        vector<vector<int>> dp(n+1,vector<int>(m+1));
        rep(i,n) {
            rep(j,m) {
                if (x1[i]==x2[j]) {
                    dp[i+1][j+1]=dp[i][j]+1;
                } else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
            }
        }
        cout << dp[n][m] << endl;
    }

    return 0;   
}



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

int main() {
    double x[4], y[4];
    while (cin >> x[0] >> y[0]) {
        for (int i = 1; i < 4; i++) {
            cin >> x[i] >> y[i];
        }
        double v1[2] = {x[0] - x[1], y[0] - y[1], };
        double v2[2] = {x[2] - x[3], y[2] - y[3], };

        if (v1[0] * v2[0] + v1[1] * v2[1] == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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

using namespace std;

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

int main() {
    int a, b;
    scanf ("%d %d", &a, &b);
    int ans = a <= b ? a : a - 1;
    printf ("%d\n", ans);
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int N = s.size();
  bool check = 0;
  int A,Z;
  for(int i = 0; i < N; i++){
      if(s[i] == 'A' && check == false){
      A = i;
      check = true;
    }
    if(s[i] == 'Z'){
      Z = i;
    }
  }
  cout << Z - A + 1 << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

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

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    LL N,K; cin >> N >> K;

    LL ans = K;
    REP(i,N-1){
        ans *= K-1;

    }
    cout << ans << endl;

}


Measured memory_bytes: 256
# frozen_string_literal: true

$memo = {}

def fibonacci(n)
  return $memo[n] if $memo[n]
  return $memo[n] = 1 if n == 0 || n == 1

  $memo[n] ||= fibonacci(n - 2) + fibonacci(n - 1)
end

n = gets.to_i
puts fibonacci(n)



Measured memory_bytes: 8896
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, n;
    cin >> h >> w >> n;
    int ans = min((n+h-1)/h, (n+w-1)/w);
    cout << ans << endl;
    return 0;
}


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

const int MAX_N=1e5;

int N,A[MAX_N];

int main(){
	cin>>N;
	int mx=0,mn=N;
	REP(i,N){
		cin>>A[i];
		mx=max(mx,A[i]);
		mn=min(mn,A[i]);
	}
	bool flg;
	if (mx-mn>1){
		flg=false;
	}else if (mx==mn){
		if (A[0]==N-1 || A[0]<=N/2){
			flg=true;
		}else{
			flg=false;
		}
	}else{
		int n1=0,n2=0;
		REP(i,N){
			if (A[i]==mx){
				n1++;
			}else{
				n2++;
			}
		}
		if (mx-n2>0 && mx-n2<=n1/2){
			flg=true;
		}else{
			flg=false;
		}
	}
	cout<<(flg ? "Yes"  : "No")<<endl;
	return 0;
}

Measured memory_bytes: 640
N,M=map(int,input().split())
ac=[False]*N
wa=[0]*N
for i in range(M):
  p,s=input().split()
  p=int(p)-1
  if ac[p]:
    continue
  else:
    if s=="WA":
      wa[p]+=1
    if s=="AC":
      ac[p]=True
account=0
wacount=0
for i in range(len(ac)):
  account+=ac[i]
  if ac[i]:
    wacount+=wa[i]
    
print(account,wacount)

Measured memory_bytes: 4596
S = input ()

even_clear = 0
odd_clear = 0
number = 1

for value in S:
    if number % 2 == 0 and  not value == "R":
        even_clear += 1

    elif number % 2 == 1  and not value == "L":
        odd_clear += 1
    number += 1

number_pop = number - 1

if number_pop == (even_clear + odd_clear):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
a, b, c, d = gets.chomp.split.map(&:to_i)
  
if b < 0 && d < 0
  puts (a * c)
elsif b >= 0 && d >= 0
  puts [(a * c), (b * d)].max
elsif b < 0
  if c < 0
    puts (a * c)
  else
    puts (b * c)
  end
elsif d < 0
  if a < 0
    puts (c * a)
  else
    puts (d * a)
  end
end


Measured memory_bytes: 14392
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <climits>

using namespace std;

int main() {
	int a, b, c, x, y;

	cin >> a >> b >> c >> x >> y;

	int total = a*x+b*y;


			for (int k = 0 ;k<=2*max(x,y);k++) {
					
				int d = 0;
				if (x-k/2>0) {
					d = x - k / 2;
				}

				int e = 0;
				if (y - k / 2 > 0) {
					e = y - k / 2;
				}

					int total1 = a * d + b * e + c * k;

					if (total1<total) total = total1;

			}


	cout << total << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
 
int main() {
  string s,t;
  cin >> s >> t;     
  int a,b;
  a=s.size();
  b=t.size();
  string c=s.substr(0, a);
  string d=t.substr(0, a);
  
  if(b=a+1 && c == d){
      cout << "Yes" << endl;
    
  return 0;
  }
      cout << "No" << endl;

}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
long long comeven(vector<int> &fr, int n) {
  long long com = 0;
  for(int i = 0; i < n/2; i++) com += fr.at(i);
  com *= 2;
  com -= fr.at(0);
  return com;
}

int main() {
  int n;
  cin >> n;
  vector<int> fr(n);
  for(int i = 0; i < n; i++) cin >> fr.at(i);
  sort(fr.begin(), fr.end());
  reverse(fr.begin(), fr.end());
  
//  for(int i = 0; i < n; i++) cout << fr.at(i) << ' ';
//  cout << endl;
  
  if(n % 2 == 0) cout << comeven(fr, n) << endl;
  else cout << comeven(fr, n-1) + fr.at((n-1)/2) << endl;
}

Measured memory_bytes: 3972
#include<iostream>
#include<bitset>
using namespace std;
int n, i, sum;
int v[2005];
bitset<2000002> d;
int main(){
    cin>> n;
    for(i = 1; i <= n; i++){
        cin>> v[i];
        sum += v[i];
    }
    d[0] = 1;
    for(i = 1; i <= n; i++){
        d |= (d << v[i]);
    }
    for(i = sum / 2; i >= 0; i--){
        if(d[i] == 1){
            cout<< sum - i;
            break;
        }
    }
}


Measured memory_bytes: 1024
/*
ID: 5ak0
PROG:
LANG: C++11
*/

#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mpr make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9 + 7;

string s;
int ans1, ans2;


int main(){
    ios_base::sync_with_stdio(0);
    #ifndef SAKO
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    #endif // SAKO

    cin >> s;
    ans1 += s[0] - '0';
    ans2 += s[0] - '0' - 1;
    for (int i = 1; i < s.size(); ++i)
        ans2 += 9, ans1 += s[i] - '0';
    cout << max(ans1, ans2);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.System.*;

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int N = sc.nextInt();
    int M = sc.nextInt();
    int prob = 1;
    for(int i=0; i<M; i++) prob *= 2;
    int ans = (1900 * M + 100 * (N-M) ) * prob;
    out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 21076
#import decimal
#decimal.getcontext().prec==500 Floatの桁数を500まで増やす
#Decimal(c).sqrt() それで平方根を求める
#Decimal(1) / Decimal(7) 1/7
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())
N,M,P=map(int,input().split())
ABC=[list(map(int,input().split())) for i in range(M)]
for i in range(M):
    ABC[i][2]=-1*(ABC[i][2]-P)
data=[[] for i in range(N+1)]
for a,b,c in ABC:
    data[b].append(a)

idle_max=10**9




visited=set()
stack=[N]
while stack:
    a=stack.pop()
    for p in data[a]:
        if not p in visited:
            visited.add(p)
            stack.append(p)




data=[idle_max for i in range(N+1)]
data[1]=0
for i in range(N-1):
    for a,b,c in ABC:
        if data[a] != idle_max:
            data[b]=min(data[b],data[a]+c)
predata=copy.copy(data)
value=data[N]
for i in range(N):
    for a,b,c in ABC:
        if data[a] != idle_max:
            data[b]=min(data[b],data[a]+c)

for i in visited:
    if predata[i]>data[i]:
        break
else:
    print(max(-value,0))
    exit()
print(-1)


Measured memory_bytes: 74068
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	string a, b; cin >> a >> b;
	string s = a + b;

	int x = 0;
	REP(i,s.length()){
		x = x*10 + (s[i] - '0');
	}

	bool ans = false;
	REP(i,1000){
		if((i*i) == x) ans = true;
	}

	if(ans == true) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		if(0 < n && n < 10) {
			if(0 < m && m < 10) {
				System.out.println(n*m);
				return;
			}
		}
		
		System.out.println(-1);

	}
}


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

const int MAX_N = (int)100 + 5;
const int INF = (int)1000 + 5;

int a, b, c, k;

int ans;

int main(void){
  // Here your code !
  scanf("%d %d %d", &a, &b, &c);
  scanf("%d", &k);

  int mabc = max(a, max(b, c));
  int powmabc = pow(2, k) * mabc;

  ans = powmabc + a + b + c - mabc;

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

  return 0;
}


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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#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, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main()
{
  int n; cin >> n;
  lint a[n] = {0};
  lint b[n-1];
  REP(i,n-1){
    cin >> b[i];
  }
  lint sum = 0;
  a[0] = b[0];
  sum += a[0];
  //cout << a[0] <<" " << sum<< "\n";
  FOR(i,0,n-2){
    //cout << b[i] << b[i+1] << "\n";
    if(b[i] < b[i+1]){
     a[i+1] = b[i];
     //cout << "b[i]=" <<b[i] << "\n";
    }
    else{
     a[i+1] = b[i+1]; 
     //cout <<"b[i+1]="<<b[i+1]<< "\n";
    }
    sum += a[i+1];
    //cout << sum << "\n";
  }
  a[n-1] = b[n-2];
  sum += a[n-1];
  cout << sum << "\n";
  return 0;
}



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

int main() {
  int N;
  int s = 0;
  bool f = true;
  cin >> N;
  vector<int> vec(N);
  
  for (int i=0;i<N;i++) cin >> vec.at(i);
  for (int i=0;i<N;i++) s += vec.at(i);
  for (int i=0;i<N;i++) {
    if (s <= vec.at(i)*2) f = false;
  }
  if (f==true) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int N, M, Q;
vector<int> a;
vector<int> b;
vector<int> c;
vector<int> d;

ll ans = 0;

void dfs(int x, vector<int> A){
	A.push_back(x);
	if(A.size() == N){
		ll tmp = 0;
		REP(i,Q){
			if(A[b[i]-1]-A[a[i]-1] == c[i]) tmp += d[i];
		}
		ans = max(ans, tmp);
		return ;
	}else{
		FOR(i,x,M+1){
			dfs(i, A);
		}
	}
	return ;

}



int main(void){

	cin >> N >> M >> Q;
	REP(i,Q){
		int x, y, z, w; cin >> x >> y >> z >> w;
		a.push_back(x);
		b.push_back(y);
		c.push_back(z);
		d.push_back(w);
	}
	vector<int> A;
	dfs(1, A);
	cout << ans << endl;







	return 0;

}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,s=0,ans=1;cin>>n;
  lvector A(n+1);rep(i,n+1) {cin>>A[i];s+=A[i];}
  if(A[0]==1) {print((n==0)?1:-1);return 0;}
  if(A[0]>1) {print(-1);return 0;}
  s-=A[0];
  ll root=1,num;
  for(ll d=1;d<=n;++d) {
    num=min(root*2,s);
    root=num-A[d];
    if(root<0) {ans=-1;break;}
    ans+=num;
    s-=A[d];
  }
  print(ans);
  return 0;
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	map<int, int> M;
	map<int, int> ACM;
	int p;
	string s;
	int WA = 0, AC = 0;
	for (int i = 0; i < m; ++i)
	{
		cin >> p >> s;
		if (s == "WA")
		{
			++M[p];
		}
		else if (s == "AC")
		{
			if (ACM[p] == 0)
			{
				ACM[p] = 1;
				WA += M[p];
				++AC;
			}
		}
	}
	cout << AC << " " << WA << endl;
	return 0;
}

Measured memory_bytes: 9600
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    map<pair<int, int>, int> F;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int cur = i;
        while (cur > 9) {
            cur /= 10;
        }
        F[{cur, i % 10}]++;
    }
    //clfor (auto x : F) cout << x.F << " " << x.S << endl;
    ll ans = 0;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            ans += F[{i, j}] * F[{j, i}];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits>

using namespace std;

#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, s, n) for(int i = s; i < (int)(n); ++i)

int h, n;
vector<int> a;
vector<int> b;
vector<int> memo;

const int MAX = numeric_limits<int>::max();
const int OFFSET = 10e3 + 1;

int query(int r) {
  if (memo[r + OFFSET] > 0) {
    return memo[r + OFFSET];
  }
  if (r >= h) {
    return memo[r + OFFSET] = 0;
  } else {
    int m = MAX;
    Rep(i, n) {
      int m2 = query(r + a[i]) + b[i];
      m = min(m, m2);
    }
    return memo[r + OFFSET] = m;
  }
}

int main() {
  cin >> h >> n;
  Rep(i, n) {
    int x, y;
    cin >> x >> y;
    a.push_back(x);
    b.push_back(y);
  }

  memo.resize(OFFSET * 2);

  int m = MAX;
  Rep(i, OFFSET + 1) {
    m = min(m, query(-i));
  }
  cout << m << endl;
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <numeric>
#include <iomanip>


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

	std::cin >> a >> b >> c >> d;

	long long ans = (a * b) - (c * b + d * a) + (c * d);

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<numeric>
#include<stack>
#include<map>
#include<queue>
#include<unordered_map>
#include<cmath>
#include<utility>

using ULL = unsigned long long;
using LL = long long;
using String = std::string;
using Ints = std::vector<int>;
using Doubles = std::vector<double>;
using Bools = std::vector<bool>;
using Strings = std::vector<std::string>;
using ULLs = std::vector<ULL>;
using LLs = std::vector<LL>;

// pythonのdictionary相当
template <typename T1, typename T2>
using Dict = std::unordered_map<T1,T2>;



int main(void) {
    int N;
    std::cin >> N;

    std::cout << (N>=30?"Yes":"No") << std::endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N,M;
	cin >> N >> M;
	
	int ans = 0;
	if(N>=2)
	{
		ans += ((N*(N-1))/2);
	}
	if(M>2)
	{
		ans += ((M*(M-1))/2);
	}
	
	cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <list>
//#include "../cxx-prettyprint/prettyprint.hpp"

int main() {
    std::string slopes;
    std::getline(std::cin, slopes);

    std::stack<int> down_indices;               // 下り斜面の位置
    std::stack<std::pair<int, int>> floods;     // 水たまりの左の位置、水たまりの面積

    int total_area = 0;
    for (int i = 0; i < slopes.size(); i ++) {
        if (slopes[i] == '\\') {
            down_indices.push(i);
        } else if (slopes[i] == '/' && !down_indices.empty()) {
            int left = down_indices.top();
            down_indices.pop();
            total_area += i - left;
            int current_area = i - left;
            while (!floods.empty() && floods.top().first > left) {
                current_area += floods.top().second;
                floods.pop();
            }
            floods.push({left, current_area});
        }
    }

    // 出力用に面積の値を並べ替える。
    std::list<int> areas;
    while (!floods.empty()) {
        areas.push_front(floods.top().second);
        floods.pop();
    }

    std::cout << total_area << std::endl;
    std::cout << areas.size();
    for (int area : areas) {
        std::cout << " " << area;
    }
    std::cout << std::endl;
}



Measured memory_bytes: 3344
#include "bits/stdc++.h"

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

using namespace std;
const long long INF = 1LL << 61;

int main() {
	int N, K; cin >> N >> K;
	string S; cin >> S;

	int count = 1;
	char preCh = S[0];
	rep(i, N) {
		if (preCh != S[i])count++;
		preCh = S[i];
	}
	//cout << count;
	count = max(1, count - 2 * K);
	cout << N - count;
}

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

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<char>> A(H, vector<char>(W));
  vector<vector<char>> B(H + 2, vector<char>(W + 2, '0'));

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A.at(i).at(j);
      if (A.at(i).at(j) == '#') {
        B.at(i + 1).at(j + 1) = '#';
        for (int k = i; k < i + 3; k++) {
          for (int l = j; l < j + 3; l++) {
            if (B.at(k).at(l) != '#') B.at(k).at(l)++;
          }
        }
      } 
    }
  }

  for (int i = 1; i < H + 1; i++) {
    for (int j = 1; j < W + 1; j++) {
      cout << B.at(i).at(j);
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int A , B ;
   float sum,sub,mult;
    cin>> A>> B ;
    sum=A+B;
    sub=A-B;
    mult=A*B;
 if (sum>=sub && sum>= mult){
    cout<< sum;
}else if (sub>= sum && sub >= mult){
    cout<<sub;
}else{
    cout<< mult;
    }

return 0;
}





Measured memory_bytes: 256
// https://atcoder.jp/contests/arc062/tasks/arc062_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  string S;
  cin >> S;

  ll res = 0;

  rep(i, S.size()) {
    char self = i % 2 == 0 ? 'g' : 'p';
    char oppo = S[i];

    if (oppo == 'p' && self == 'g') --res;
    if (oppo == 'g' && self == 'p') ++res;
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

int main()
{
    int n;
    while (cin >> n)
    {
        if (n == 0)
            return 0;
        vector<string> v(n);
        for (int i = 0; i < n; i++)
            cin >> v[i];
        bool flag_left = 0, flag_right = 0, aim = 1;
        int sum = 0;
        for (int i = 0; i < n; i++)
        {
            if (v[i] == "lu")
                flag_left = 1;
            else if (v[i] == "ru")
                flag_right = 1;
            else if (v[i] == "ld")
                flag_left = 0;
            else
            {
                flag_right = 0;
            }

            if (aim && flag_left == 1 && flag_right == 1)
            {
                aim = 0;
                sum++;
            }
            else if (!aim && flag_left == 0 && flag_right == 0)
            {
                aim = 1;
                sum++;
            }
        }
        cout << sum << endl;
    }
}



Measured memory_bytes: 3100
#include <stdio.h>
#include <iostream>
int dt[2 << 9][2 << 9];
int score[2 << 9][2 << 9];
using namespace std;
int max(int a, int b)
{
	if (a >= b)
		return a;
	else
		return b;
}

int main()
{
	int n=2, m;
	cin >> m;
	

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			cin >> score[i][j];
		}
	}
	dt[1][1] = score[1][1];

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			dt[i][j] = max(dt[i - 1][j], dt[i][j - 1]) + score[i][j];
		}
	}
	printf("%d", dt[n][m]);
}

Measured memory_bytes: 2304
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define dump(x) 
#endif

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

const int MAX_P = 200010;
LL inv[MAX_P];
LL MOD = 1000000000 + 7;
int fact[MAX_P], rfact[MAX_P];
void init(){
    inv[1] = 1;
    for (int i = 2; i < MAX_P; ++i){
        inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    }
    fact[0] = rfact[0] = 1;
    for(int i = 1; i < MAX_P; i++){
        fact[i] = ((LL)fact[i - 1] * i) % MOD;
        rfact[i] = ((LL)rfact[i - 1] * inv[i]) % MOD;
    }
}
LL comb(int n, int k){
    return (((LL)fact[n] * rfact[n - k]) % MOD) * rfact[k] % MOD;
}
LL C(int W, int H) {
    return comb(W + H, W);
}
int main(){
    iostream_init();
    init();
    int W, H, A, B;
    while(cin >> H >> W >> A >> B) {
        LL answer = 0;
        for(int y = 0; y < H - A; y++) {
            answer += C(B-1, y) * C(W-B-1, H-1-y) % MOD;
            answer %= MOD;
        }
        cout << answer << endl;
    }
    return 0;
}



Measured memory_bytes: 3328
($N,$K)=glob<>;
@V=glob<>;
for$i(-1..$N-1){
	for$j($i+1..$N){
		@_=sort{$a-$b}@V[0..$i,$j..$N-1];
		if(@_<=$K){
			$_[0]<0&&shift@_ for@_+1..$K;
			$x=0;
			$x+=$_ for@_;
			$\+=$-=$x-$\
		}
	}
}
print


Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace AtCorder
{
	public class Program
	{
		/// <summary>
		/// ABC 102
		/// </summary>
		public static void Main()
		{
			int n = int.Parse(ReadLine());
			var list = ReadLine().Split()
				.Select(x => double.Parse(x))
				.Select((x, i) => x - i + 1)
				.ToList();
			list.Sort();
			double b = list[0];
			if (n > 1)
			{
				if (n % 2 == 1)
				{
					b = list[n / 2];
				}
				else
				{
					b = (list[n / 2 - 1] + list[n / 2]) / 2D;
				}
			}
			var ans = list.Sum(x => Math.Abs(x - b));
			WriteLine(ans);
		}
	}
}


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;

    return 0;
}











Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
const double phi = (1 + sqrt(5)) / 2;
const double phi_ = (1 - sqrt(5)) / 2;
ll fib(ll n){
    double res = pow(phi, n+1) - pow(phi_, n+1);
    return res / sqrt(5);
}
ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}
ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}
string to_bin_string(int n){
    stringstream ss;
    ss << bitset<3>(n); //任意の桁数<m>
    string s = ss.str();
    return s;
}
int main()
{
    int n; cin >> n;
    ll r = 0;
    REP(i,1,n+1){
        if(i % 3 != 0 && i % 5 != 0)r += i;
    }
    cout << r << endl;
    return 0;
} 

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    string s;
    cin>>s;
    int n=s.size();
    vector<vector<ll>> dp(n+1,vector<ll>(13,0));
    dp[0][0]=1;
    rep(i,n){
        if(s[i]=='?'){
            rep(j,13){
                rep(k,10){
                    dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%mod;
                }
            }
        }
        else{
            int num=s[i]-'0';
            rep(j,13){
                dp[i+1][(j*10+num)%13]=(dp[i+1][(j*10+num)%13]+dp[i][j])%mod;
            }
        }
    }
    cout<<dp[n][5]<<endl;
    return 0;
}


Measured memory_bytes: 13696
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

void solve(){
  string s, t;
  cin >> s >> t;
  int n = len(s);
  forn(i, n){
    bool ok = 1;
    forn(j, n){
      if (s[(i+j)%n] != t[j]) ok = 0;
    }
    if (ok) {
      cout << "Yes";
      return;
    }
  }
  cout << "No";
}

int main() {
  ios::sync_with_stdio(false); 
  cin.tie(0); cout.tie(0);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
1000000000000000000


*/

Measured memory_bytes: 3644
import itertools
import numpy

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

s = [list(map(int,input().split())) for i in range(n[0])]

list(itertools.combinations(s,2))

count = 0

for element in itertools.combinations(s, 2):
    #print(element[0])
    #print(element[1])
    a =	numpy.array(element[0])
    b =	numpy.array(element[1])
    u =	b - a
    #print(numpy.linalg.norm(u))
    if(numpy.linalg.norm(u).is_integer() == True):
    	count =	count + 1


print(count)

Measured memory_bytes: 12412