akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("myfile.in","r",stdin);freopen ("myfile.out","w",stdout);
using namespace std;

ll n,ar[N],dp[N],k;

ll f(int ind)
{
	if(dp[ind]!=-1)
		return dp[ind];
	if(ind==n)
		return dp[ind]=0;
	ll mn=99999999999;
	for(int i=1;i<=k && i+ind<=n;i++)
	{
		ll tut=f(ind+i)+fabs(ar[ind]-ar[ind+i]);
		mn=min(mn,tut);
	}
	// return mn;
	
	return dp[ind]=mn;
}	
	


int main()
{
	fast;
	cin>>n>>k;
	memset(dp,-1,sizeof(dp));
	for(int i=1;i<=n;i++)
		cin>>ar[i];
	ll a=f(1);
	cout<<a<<endl;
	// for(int i=1;i<=n;i++)
	// 	cout<<dp[i]<<sp;
}


Measured memory_bytes: 15232
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

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

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

signed main() {
  string S;
  cin >> S;
  string original = S;
  REVERSE(S);
  ll ans = 0;

  ll end;
  if (S.size() % 2 == 0) {
    end = S.size() / 2;
  } else {
    end = S.size() / 2 + 1;
  }

  rep(i, end) {
    if (original[i] != S[i]) {
      ans++;
    }
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main(void) {
  int n, m, X, Y;
  cin >> n >> m >> X >> Y;
  vector<int> x(n + 1);
  rep(i, n) cin >> x[i];
  x[n] = X;
  vector<int> y(m + 1);
  rep(i, m) cin >> y[i];
  y[m] = Y;
  int xmax = -999;
  rep(i, n + 1) xmax = max(xmax, x[i]);
  int ymin = 999;
  rep(i, m + 1) ymin = min(ymin, y[i]);
  if(xmax >= ymin) {
    cout << "War" << endl;
    return 0;
  }
  cout << "No War" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
//	100x+101y+102a+103b+104c+105d
//	100*(x+y+a+b+c+d)+y+2a+3b+4c+5d=X;

	ll i,j,k,l,n,a,b,c,d;
	cin>>n;

	for(i=0;i*100<=n;i++){
		for(j=0;j*101<=n-i*100;j++){
			for(a=0;a*102<=n-j*101-i*100;a++){
				for(b=0;b*103<=n-a*102-j*101-i*100;b++){
					for(c=0;c*104<=n;c++){
						for(d=0;d*105<=n;d++){
							if(100*(i+j+a+b+c+d)+j+2*a+3*b+4*c+5*d==n){
								cout<<"1";return 0;
							}
						}
					}
				}
			}
		}
	}
	cout<<"0";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main(void) {
    int n;
    int score, sum_score;
    int max_score, min_score;
    int i;

    cin >> n;
    while (n) {
        sum_score = 0;
        max_score = 0;
        min_score = 1000;
        for (i=0; i<n; i++) {
            cin >> score;
            sum_score += score;
            if (score < min_score) {
                min_score = score;
            }
            if (score > max_score) {
                max_score = score;
            }
        }

        sum_score -= min_score + max_score;
        cout << sum_score / (n-2) << endl;

        cin >> n;
    }

    return 0;
}

Measured memory_bytes: 1156
#include <iostream>
using namespace std;
int main(){
	int a,b,c;
	cin >> a;
	cin >> b;
	cin >> c;
	if((a<c&&b>c)||(a>c&&b<c)){
		cout << "Yes";
	}else{
		cout << "No";
	}
	return 0;
}



Measured memory_bytes: 256
# https://atcoder.jp/contests/abc079/tasks/abc079_d
# ワーシャルフロイド

h, w = map(int, input().split())
edge = [[] for _ in range(10)]
for i in range(10):
    edge[i] = list(map(int, input().split()))

num = [list(map(int, input().split())) for _ in range(h)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            # iからjへの最短距離
            # 負の辺がある場合　つっこむとかなり遅くなる
            # if edge[i][k] != float('inf') and edge[k][j] != float('inf'):
            edge[i][j] = min(edge[i][j], edge[i][k] + edge[k][j])

ans = 0
for i in num:
    for j in i:
        if j == 1 or j == -1:
            continue
        else:
            ans += edge[j][1]

print(ans)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
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; }
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)

int main()
{
  ll a,b,c,d;
  cin >> a>>b>>c>>d;
  ll ans=-1e18;
    chmax(ans,b*d);
    chmax(ans,a*c);
    chmax(ans,a*d);
    chmax(ans,b*c);

  cout<< ans<<endl;
}


Measured memory_bytes: 3612
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = sc.nextInt()
    val b = sc.nextInt()
    val mx = Math.min(a, b)
    val mn = Math.max(0, a + b - n)
    println("$mx $mn")
}

Measured memory_bytes: 31260
#include <bits/stdc++.h>
using namespace std;
int c[300];
int n, m;
int one, two;
int done2;
int main()
{
	scanf("%d%d", &n, &m);
	if (n % 2 && m % 2) one++;
	if (n%2) two+=m-one;
	if (m%2) two+=n-one;
	two/=2;
//	printf("%d %d\n", one, two);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			char a;
			scanf(" %c", &a);
			c[a]++;
		}
	}
	for (int i = 0; i < two; i++)
	{
		bool done = false;
		for (int j = 'a'; j <= 'z'; j++)
		{
			if (c[j] % 4 == 2)
			{
				c[j]-=2;
				done = true;
				break;
			}
		}
		if (done) done2++;
	}
	if (one)
	{
		for (int j = 'a'; j <= 'z'; j++)
		{
			if (c[j]%4 == 1) c[j]--;
		}
	}
	for (int j = 'a'; j <= 'z'; j++)
		{
			if (c[j]%4 != 0)
			{
				printf("No\n");
				return 0;
			}
		}
	if ((two-done2) % 2 != 0)
		{
			printf("No\n");
				return 0;
		}
	printf("Yes\n");
}

Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int[] x=new int[m];
    if(n>=m){
      System.out.println(0);
      return;
    }
    int[] s=new int[m-1];
    for(int i=0;i<m;i++){
      x[i]=sc.nextInt();
    }
    Arrays.sort(x);
    for(int i=0;i<m-1;i++){
      s[i]=x[i+1]-x[i];
    }
    Arrays.sort(s);
    int sum=0;
    for(int i=m-2;i>m-2-n+1;i--){
      sum+=s[i];
    }
    System.out.println(x[m-1]-x[0]-sum);
  }
}

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

int main(){
  int n,m;
  cin>>n>>m;
  cout<<(n-1)*(m-1)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cassert>

using namespace std;

typedef long double real;
#define EQ(x,y) (abs((x)-(y))<EPS)

real EPS = 1e-9;

const int MAX_N = 101;
const int MAX_M = 53;

const bool debug = false;

int N, M; real L;
vector<real> P, T, V;
void input() {
    cin >> N >> M >> L;
    P.clear(); P.resize(N);
    T.clear(); T.resize(N);
    V.clear(); V.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> P[i] >> T[i] >> V[i];
        P[i] /= 100;
    }
}

real X[MAX_N][MAX_M]; // X[i][j] :: i人目がm回休む確率
real S[MAX_N][MAX_M]; // S[i][j] :: i人目がm回未満だけ休む確率

void init() {
    for (int i = 0; i < N; i++) for (int j = 0; j <= M; j++) X[i][j] = 0;
    for (int i = 0; i < N; i++) for (int j = 0; j <= M + 1; j++) S[i][j] = 0;
    for (int i = 0; i < N; i++) {
        static real dp[MAX_M][MAX_M];
        for (int j = 0; j <= M; j++) for (int k = 0; k <= M; k++) dp[j][k] = 0;
        dp[0][0] = 1;
        for (int j = 0; j < M; j++) {
            for (int k = 0; k <= j; k++) {
                dp[j + 1][k] += dp[j][k] * (1.0 - P[i]);
                dp[j + 1][k + 1] += dp[j][k] * P[i];
            }
        }
        for (int k = 0; k <= M; k++) {
            X[i][k] = dp[M][k];
        }
    }
    for (int i = 0; i < N; i++) {
        S[i][0] = 0;
        for (int j = 0; j <= M; j++) {
            S[i][j + 1] = S[i][j] + X[i][j];
        }
    }
}

void solve() {
    init();
    for (int i = 0; i < N; i++) { // i人目
        if (V[i] == 0) {
            printf("%.12Lf\n", real(0));
            continue;
        }
        real ans = 0;
        for (int j = 0; j <= M; j++) { // j回休んだ
            real p = X[i][j];
            real time = L / V[i] + j * T[i];
            for (int k = 0; k < N; k++) { // k人目
                if (i == k) continue;
                if (EQ(T[k], 0)) {
                    p *= (L / V[k] - EPS > time);
                } else {
                    // c回以上休む必要
                    int c = max(0, int(ceil((time - L / V[k]) / T[k] + EPS) + EPS));
                    if (c > M) {
                        p = 0;
                        break;
                    }
                    real pk = 1.0 - S[k][c];
                    p *= pk;
                }
            }
            ans += p;
        }
        printf("%.12Lf\n", ans);
    }
}

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

Measured memory_bytes: 1468
n = int(input())
a = list(map(int, input().split(" ")))

total = sum(a)
half = total / 2
current = 0


for i in range(n):
    current += a[i]
    if half < current:
        half_index = i
        break

pos_r = current - half
pos_l = a[half_index] - pos_r

print(int(min(pos_l, pos_r) / 0.5))


Measured memory_bytes: 26220
use std::io::Read;

#[allow(non_snake_case)]
struct Input {
    D: usize,          // Days
    s: Vec<Vec<i64>>,  // score(day, contest)
    c: Vec<i64>        // cost(contest)
}

fn compute_score(input: &Input, out: &Vec<usize>) -> i64 {
    let mut score = 0;
    let mut last = vec![0; 26];
    for d in 0..out.len() {
        score += input.s[d][out[d]];
        last[out[d]] = d + 1;
        for i in 0..26 {
            score -= input.c[i] * (d + 1 - last[i]) as i64;
        }
    }
    score
}

#[allow(dead_code)]
fn solve_debug(input: &Input) -> Vec<usize> {
    let out = vec![0; input.D];
    out
}

fn evaluate(input: &Input, out: &Vec<usize>, k: usize) -> i64 {
    let mut score = 0;
    let mut last = vec![0; 26];
    for d in 0..out.len() {
        score += input.s[d][out[d]];
        last[out[d]] = d + 1;
        for i in 0..26 {
            score -= input.c[i] * (d + 1 - last[i]) as i64;
        }
    }
    for d in out.len()..(out.len() + k).min(input.D) {
        for i in 0..26 {
            score -= (d + 1 - last[i]) as i64 * input.c[i];
        }
    }
    score
}

fn solve(input: &Input, k: usize) -> Vec<usize> {
    let mut out = vec![];
    for _ in 0..input.D {
        let mut max_score = i64::min_value();
        let mut best_i = 0;
        for i in 0..26 {
            out.push(i);
            let score = evaluate(&input, &out, k);
            if max_score < score {
                max_score = score;
                best_i = i;
            }
            out.pop();
        }
        out.push(best_i);
    }
    out
}

#[allow(non_snake_case)]
fn main() {
    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();
    let mut iter = buffer.split_whitespace();

    let D: usize = iter.next().unwrap().parse().unwrap();
    let c: Vec<i64> = (0..26)
        .map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let s: Vec<Vec<i64>> = (0..D)
        .map(|_| (0..26)
            .map(|_| iter.next().unwrap().parse().unwrap()).collect()
        )
        .collect();
    let input = Input{ D, s, c };

    let mut score = i64::min_value();
    let mut out = vec![];
    for k in 0..=26 {
        let out_tmp = solve(&input, k);
        let score_tmp = compute_score(&input, &out_tmp);
        if score_tmp > score {
            score = score_tmp;
            out = out_tmp;
        }
    }

    for i in 0..D {
        println!("{}", out[i] + 1);
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N, K, S;
    cin >> N >> K >> S;
    rep(0, i, K)
    {
        cout << S << ' ';
    }
    rep(0, i, N - K)
    {
        if (S == 1)
        {
            cout << 2 << ' ';
        }
        else
        {
            cout << S - 1 << ' ';
        }
    }
    cout << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 1145141919
#define MOD 1000000007
#define ALL(a) begin((a)),end((a))
#define ms(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///
typedef pair<double, string> pds;
bool comp(const pds &p1, const pds &p2)
{
	if (p1.first == p2.first) return p1.second < p2.second;
	else return p1.first > p2.first;
}
int main()
{
	int n; 
	while (cin >> n, n)
	{
		vector<pair<double, string>> ary;
		REP(i, n)
		{
			ary.resize(n);
			string l;
			int p, a, b, c, d, e, f, s, m;
			cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
			ary[i].second = l;
			int x = (a + b + c) + (d + e)*m;
			int y = s*f*m - p;

			if (y == 0) ary[i].first = 0;
			else ary[i].first = double(y) / x;
		}
		sort(ALL(ary),comp);
		REP(i, n) cout << ary[i].second << endl;
		puts("#");
	}
	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int c[100100];
int d[100100];
int h[100100];

signed main() {

    int n, m;
    
    cin >> n >> m;
    int a, b;
    for(int i = 1; i <= n; i++)
        cin >> h[i];

    for(int i = 0; i < m; i++) {
        cin >> a >> b;
        c[a]++;
        c[b]++;
        if(h[a] > h[b]) d[a]++;
        if(h[a] < h[b]) d[b]++;
    }

    int sum = 0;

    for(int i = 1; i <= n; i++) {
        if(c[i] == d[i]) sum++;
    }

    cout << sum << endl;
        
  
    return 0;
}



Measured memory_bytes: 4824
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstdlib>
#include <vector>

#define rep(i, n) for(long i=0; i<(long)(n); ++i)

using namespace std;

// Globals
int n;
const int N=20000;
//int ts[N], xs[N], ys[N]; 
vector<int> ts, xs, ys;

void input() {
  cin >> n;
  ts=vector<int>(n);
  xs=vector<int>(n);
  ys=vector<int>(n);
  rep(i, n) cin >> ts[i] >> xs[i] >> ys[i];
}

void solve() {
  int now_x=0, now_y=0, now_t=0;
  rep (i, n) {
    int x=xs[i], y=ys[i], t=ts[i];
    int dist = abs(now_x - x) + abs(now_y - y);
    int dur = t - now_t;
    bool ok = dist <= dur && dist%2 == dur%2;
    if (!ok) {
      cout << "No" << endl;
      return;
    }
    //printf("%d,%d,%d,%d,%d,%d,%d,%d\n",now_x,x,now_y,y,now_t,t,dist,dur);
    now_x=x; now_y=y; now_t=t;
  }
  cout << "Yes" << endl;
}

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



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c; cin>>a>>b>>c;
    int maxi = max(max(a,b),c);
    int cand = 3*maxi-(a+b+c);
    if (cand%2==1){
        cout<<(cand+3)/2<<endl;
    }else{
        cout<<cand/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	bool ans = true;
	string s;
	cin >> s;
	for(int i = 0;i < s.length();i++){
		if((i % 2 == 0 && s[i] == 'L') || (i % 2 && s[i] == 'R')) ans = false;
	}
	if(ans) Yes();
	else No();
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    String s = sc.next();

    sc.close();

    if (3200 <= a) {
      System.out.println(s);
    } else {
      System.out.println("red");
    }

  }

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
string S;
ll Prev[2], Next[2];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> S;
    while(S.back() == '0') S.pop_back();
    Prev[1] = 1e18;
    for(int i = S.size() - 1; i >= 0; i--) {
        Next[0] = 1e18;
        Next[1] = 1e18;
        chmin(Next[0], Prev[0] + (int)(S[i] - '0'));
        chmin(Next[1], Prev[1] + (int)('9' - S[i]));
        chmin(Next[1], Prev[0] + (int)('9' - S[i] + 1));
        if(S[i] != '9') chmin(Next[0], Prev[1] + (int)(S[i] - '0') + 1);
        swap(Prev, Next);
        //cerr << i << " " << Prev[0] << " " << Prev[1] << endl;
    }
    cout << min(Prev[0], Prev[1] + 1) << endl;
    return 0;
}


Measured memory_bytes: 1948
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
	ll N,x,y,ans=0;
	
	cin>>N;
	
	
	x=1;
	while(x*x<=N){
		if(N%x==0){
			y=N/x;
		}
		x++;
	}
	
	while(y>0){
		ans++;
		y/=10;
	}
	
	cout<<ans<<endl;



	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
    int n;
    for(;;){
        scanf("%d",&n);
        if(n==0) break;
        int a[10];
        for(int i=0;i<10;i++){
            a[i]=0;
        }
        for(int i=0;i<n;i++){
            int ins;
            scanf("%d",&ins);
            a[ins]++;
        }
        for(int i=0;i<10;i++){
            if(a[i]>0){
                for(int j=0;j<a[i];j++){
                    printf("*");
                }
                printf("\n");
            }else printf("-\n");
        }
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
//debug
#define vecprint(v) rep(i,v.size())cout << v[i] << " ";cout << endl;
#define setprint(s) for(auto i=s.begin();i!=s.end();i++)cout << *i << " ";cout << endl;
#define mappairprint(s) for(auto i=s.begin();i!=s.end();i++)cout << i->first << " " << i->second << endl;cout << endl;
//reader
#define r1(a) cin>>(a)
#define r2(a,b) cin>>(a)>>(b)
#define r3(a,b,c) cin>>(a)>>(b)>>(c)
//writer
#define w1(a) cout<<(a)<<" "
#define w2(a,b) cout<<(a)<<" "<<(b)<<" "
#define w3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "
#define wl1(a) cout<<(a)<<endl
#define wl2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wl3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
//variable definition
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
//roop
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define all(c) c.begin(),c.end()
//term
#define elif else if
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
using namespace std;
using ll = long long;
//const
constexpr double PI = 3.141592653589793238462643383279;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};


int main() {
  //input
  int x,n;
  cin >> x >> n;
  
  set<int> p;
  rep(i,n) {
    int tmp;
    cin >> tmp;
    p.insert(tmp);
  }
  
  //process
  if(!p.count(x)) {
    cout << x << endl;
    return 0;
  }
  
  int diff = 1;
  while(1) {
    if(!p.count(x-diff)) { cout << x-diff << endl; break; }
    if(!p.count(x+diff)) { cout << x+diff << endl; break; }
    diff++;
  }
  
  //output
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String str = "";
            int i = 1;
           while ((str = Console.ReadLine()) != "0")
            {
                   Console.WriteLine("Case {0}: {1}", i, str);
                ++i;
            }
        }
    }
}

Measured memory_bytes: 5804
#include <iostream>

#define u unsigned
#define s short
#define ll long long
#define REP(i, a, b) for (auto i = (a); i < (b); i++)
#define REPR(i, a, b) for (auto i = (a-1); i >= (b); i--)

using namespace std;

int main()
{
    u int A, B;

    cin >> A >> B;

    cout << A * B;

    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
    int j,h,f;
    long n,w1,w2;
    while(scanf("%ld",&n)!=EOF)
    {


        for(h=1; h<=3500; h++)
        {
            f=0;
            for(j=1; j<=3500; j++)
            {
                w1=n*h*j;
                w2=4*h*j-n*(h+j);
                if(w1>0&&w2>0&&w1%w2==0)
                {

                    f=1;
                    printf("%d %d %ld\n",h,j,w1/w2);
                    break;
                }
            }
            if(f)
                break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
int  n;
  scanf("%d",&n);
  if(n%2==0){
    printf("0.5000000000");
  }
  else{int ue=n/2+1;
      // printf("%d\n",ue);
       double ans=(double)ue/(double)n;
printf("%.10lf",ans);
  }
  return 0;
}

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

int main(){
  string s;
  cin >> s;
  if(s[0] != s[1]){
    if(s[1] != s[2]){
      if(s[2] != s[0]){
        puts("Yes");
        return 0;
      }
    }
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(){
  int a, b, c, d;
  std::cin >> a >> b >> c >> d;

  if(b <= c || d <= a) std::cout << 0;
  else if(a < c){
    if(d < b) std::cout << d - c;
    else std::cout << b - c;
  }else{
    if(b < d) std::cout << b - a;
    else std::cout << d - a;
  }

  return 0;
}


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

using namespace std;

//#define MD 10

int main(){
    int a,b;
    cin>>a>>b;
    int ans=0;
    for(int i=1;i<=a;i++){
        if(i==a){
            if(i<=b){
                ans++;
            }
        }else{
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  double ans = 0;
  rep(i,0,n) {
    double a;
    cin >> a;
    ans += 1/a;
  }
  ans = 1/ans;
  printf("%.10lf\n", ans);
  return 0;
}

Measured memory_bytes: 3752
#include <stdio.h>
#include <math.h>

#define PI 3.14159265358979323846264338327950L
int main(void) {
  int a, b, h, m;
  scanf("%d%d%d%d", &a, &b, &h, &m);

  long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);
  long double rsq = (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rad);
  printf("%20.20Lf\n", sqrtl(rsq));

  return 0;
}


Measured memory_bytes: 2576
#include <stdio.h>

int main()
{
	char c[3][4];
	scanf("%s", c[1]);
	scanf("%s", c[2]);
	if (c[1][0] != c[2][2] || c[1][1] != c[2][1] || c[1][2] != c[2][0]) printf("NO\n");
	else printf("YES\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1616
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define INF 2147483647.0
#define EPS 0.000000001
const double PI=acos(-1.0);
struct Point
{
	int x,y;
	double angle()
	  {
	  	return atan2((double)y,(double)x);
	  }
};
struct Range
{
	double l,r;
}ranges[4010];
bool cmp(const Range &a,const Range &b)
{
//	return a.r<b.r;
	return a.l==b.l ? a.r<b.r : a.l<b.l;
}
int n;
int main()
{
	//freopen("e.in","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	  {
	  	Point a,b,c,d;
	  	scanf("%d%d%d%d",&a.x,&a.y,&b.x,&b.y);
	  	if(a.x<0 && b.x<0 && a.y<0 && b.y>=0)
	  	  {
	  	  	ranges[i].l=b.angle();
	  	  	b.y=a.y;
	  	  	ranges[i].r=b.angle()+2.0*PI;
	  	  	continue;
	  	  }
	  	ranges[i].l=INF;
	  	ranges[i].r=-INF;
	  	
	  	ranges[i].l=min(ranges[i].l,a.angle());
	  	ranges[i].r=max(ranges[i].r,a.angle());
	  	
	  	ranges[i].l=min(ranges[i].l,b.angle());
	  	ranges[i].r=max(ranges[i].r,b.angle());
	  	
	  	swap(a.y,b.y);
	  	
	  	ranges[i].l=min(ranges[i].l,a.angle());
	  	ranges[i].r=max(ranges[i].r,a.angle());
	  	
	  	ranges[i].l=min(ranges[i].l,b.angle());
	  	ranges[i].r=max(ranges[i].r,b.angle());
	  }
	for(int i=1;i<=n;++i)
	  {
	  	ranges[i+n].l=ranges[i].l+2.0*PI;
	  	ranges[i+n].r=ranges[i].r+2.0*PI;
	  }
	sort(ranges+1,ranges+2*n+1,cmp);
	int ans=214783647;
	for(int j=1;j<=n;++j){
	double now=INF;
	int tans=0;
	for(int i=j;i<=j+n-1;++i)
	  if(fabs(now-INF)<EPS || now-ranges[i].l<(-EPS))
	    {
	      now=ranges[i].r;
	      ++tans;
	    }
	  else now=min(now,ranges[i].r);
	ans=min(ans,tans);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N, K;
    cin >> N >> K;
    int b[2*K][2*K], w[2*K][2*K];
    fill(b[0], b[2*K], 0);
    fill(w[0], w[2*K], 0);
    rep(i, N){
        int x, y;
        char c;
        cin >> x >> y >> c;
        if(c == 'B') b[x%(2*K)][y%(2*K)]++;
        else w[x%(2*K)][y%(2*K)]++;
    }
    int numb[2*K+1][2*K+1], numw[2*K+1][2*K+1];
    rep2(i, 1, 2*K){
        numb[0][i] = 0;
        numw[0][i] = 0;
        numb[i][0] = 0;
        numw[i][0] = 0;
    }
    rep2(i, 1, 2*K){
        rep2(j, 1, 2*K){
            numb[i][j] = numb[i-1][j]+numb[i][j-1]+b[i-1][j-1]-numb[i-1][j-1];
            numw[i][j] = numw[i-1][j]+numw[i][j-1]+w[i-1][j-1]-numw[i-1][j-1];
        }
    }
    int ans = 0;
    rep(i, K){
        rep(j, K){
            int p[] = {0, K-i, 2*K-i, 2*K};
            int q[] = {0, K-j, 2*K-j, 2*K};
            int sum = 0;
            rep(x, 3) rep(y, 3){
                int A = p[x], B = p[x+1], C = q[y], D = q[y+1];
                if((x+y)%2 == 0){
                    sum += numb[B][D]-numb[A][D]-numb[B][C]+numb[A][C];
                }
                else{
                    sum += numw[B][D]-numw[A][D]-numw[B][C]+numw[A][C];
                }
            }
            ans = max(ans, sum);
            ans = max(ans, N-sum);
        }
    }
    cout << ans << endl;
}

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

using namespace std;
int a[25];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	int ans=0;
	for(int i=0;i<n;i++){
		bool flag=1;
		for(int j=0;j<i;j++){
			if(a[j]>a[i])flag=0;
		}
		if(flag)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
for i in range(sys.maxsize):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print("F")
    elif m+f>=80:
        print("A")
    elif m+f>=65:
        print("B")
    elif m+f>=50:
        print("C")
    elif m+f>=30:
        if r>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")


Measured memory_bytes: 5600
#include<cstdio>
#include<algorithm>
const int maxn = 1e5 + 5;
using namespace std;

int n,m,cnt1,cnt2;
long long a[maxn],ans;

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%lld", &a[i]);
	}
	sort(a + 1, a + n + 1);
	if(a[1] == 0) printf("0\n");
	else{
		ans = 1LL;
		bool ok = 1;
		long long nowa,now,cnta = 0,cnt = 0,x,y;
		for(int i = 1; i <= n; i++){
			nowa = a[i];now = ans;
			cnta = 0; cnt = 0;
			while(nowa){
				x = nowa;
				nowa /= 10;
				cnta++;
			}
			while(now){
				y = now;
				now /= 10;
				cnt++;
			}
			if(x * y >= 10) cnt++;
			//printf("%lld %lld %lld %d\n", x, y, ans, cnta + cnt);
			if(cnta + cnt > 20){
				ok = 0;
				break;
			}
			ans *= a[i];
		}
		//printf("%d\n",ok);
		if(ok && ans > 0 && ans <= 1000000000000000000LL){
			printf("%lld\n", ans);
		}
		else printf("-1\n");
	}
	return 0;
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,i,ans=0;cin>>N;ll A[N];
  REP(i,N)cin>>A[i];sort(A,A+N);i=0;
  while(i<N){
    ll j=i;
    while(j<N&&A[i]==A[j])j++;
    ans+=(j-i)%2;
    i=j;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
N = int(input())
dic = {}
max_v = 0

for i in range(N):
    temp = input()
    if temp in dic:
        dic[temp] += 1
    else:
        dic[temp] = 1
    max_v = max(max_v, dic[temp])

keys = sorted(dic.keys())
for k in keys:
    if dic[k] == max_v:
        print(k)


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

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

using namespace std;

const int IINF = INT_MAX;
const int MAX_N = 50000;
int N,W,H,x[MAX_N],y[MAX_N],uf[MAX_N],masks[MAX_N],sz[MAX_N];
// ↑←↓→

int find(int x) {
  if( x == uf[x] ) return x;
  return uf[x] = find(uf[x]);
}

void unit(int x,int y){
  x = find(x), y = find(y);
  if( x != y ) uf[x] = y;
}

int main(){
  cin >> N >> W >> H;
  rep(i,N) { 
    cin >> x[i] >> y[i];
    uf[i] = i, masks[i] = sz[i] = 0;

    if( y[i] == 1 ) masks[i] |= (1<<0);
    if( x[i] == 1 ) masks[i] |= (1<<1);
    if( y[i] == H ) masks[i] |= (1<<2);
    if( x[i] == W ) masks[i] |= (1<<3);
  }
  map<int,int> mp;
  rep(i,N){
    if( mp.count(x[i]) ) unit(find(mp[x[i]]),find(i));
    else                 mp[x[i]] = i;
  }
  mp.clear();
  rep(i,N){
    if( mp.count(y[i]) ) unit(find(mp[y[i]]),find(i));
    else                 mp[y[i]] = i;
  }

  map<int,int> bitmask;
  set<int> S;
  vector<int> group;
  rep(i,N) find(i);
  rep(i,N) S.insert(find(i));
  rep(i,N) ++sz[find(i)];

  if( S.size() == 1 ) {
    cout << sz[find(0)] - 1 << endl;
    return 0;
  }

  rep(i,N) bitmask[find(i)] |= masks[i];
  for(set<int>::iterator it = S.begin(); it != S.end(); it++) group.push_back(*it);

  int ans = IINF;
  rep(i,4){
    int cost = (int)S.size()-1;
    rep(j,(int)group.size()){
      cost += sz[group[j]];
      if( (bitmask[group[j]]>>i) & 1 ) --cost; 
    }
    ans = min(ans,cost);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6132
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

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

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(all(a));
    a.resize(unique(all(a)) - a.begin());
    n = a.size();
    int kek = a[0];
    bool one = 0;
    for (int i = 0; i < n; i++) {
        kek = (kek * a[i]) / gcd(kek, a[i]);
        if (kek > m) {
            one = 1;
            break;
        }
    }
    int val = -1;
    for (int i = (a[n - 1] >> 1); i <= m; i += a[n - 1]) {
        bool ok = 1;
        for (int j = 0; j < n - 1; j++) {
            if ((i - (a[j] >> 1)) % a[j]) {
                ok = 0;
                break;
            }
        }
        if (ok) {
            val = i;
            break;
        }
    }
    if (one) {
        if (val != -1) cout << 1;
        else cout << 0;
        return 0;
    }
    if (val == -1) {
        cout << 0;
        return 0;
    }
    cout << (m - val) / kek + 1;
}
/*

*/


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#define FOR(i,a,b) for(int i = a ; i <= b; i++)
#define REP(i,n) for(int i = 0; i < n; i++)
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

    //全ての文字列を左右反転
    reverse(S.begin(), S.end());
    REP(i,4) reverse(divide[i].begin(), divide[i].end());
    
    //橋から切っていく
    bool can = true;
    for(int i = 0; i < S.size(); ){
        bool can2 = false; //4この文字列たちどれかでdivideできるか
        REP(j, 4){
            string d = divide[j];
            if(S.substr(i, d.size()) == d){ //dでdivideできるか
                can2 = true;
                i += d.size();
            }
        }
        if(!can2){
            can = false;
            break;
        }
    }
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

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

  int cnt=0;
  for(int x=a; x<=b; x++){
    if(c % x == 0) cnt++;
  }

  cout<<cnt<<endl;

  return 0;
}



Measured memory_bytes: 3116
# A - XOR Circle

N = int(input())
a = list(map(int,input().split()))
a.sort()

if a[N-1]==0:
    ans = 'Yes'
elif N%3!=0:
    ans = 'No'
elif a[0]==a[N//3-1] and a[N//3]==a[2*N//3-1] and a[2*N//3]==a[N-1] and a[0]^a[N//3]^a[2*N//3]==0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Measured memory_bytes: 14708
def solve(x, y, d, m):
    ret = ""
    dx = [-1, 0, 0, 1]
    dy = [0, -1, 1, 0]
    mode = ['R', 'U', 'D', 'L']
    for i in range(m):
        dir = 0
        t = abs(x + d[i] * dx[0]) + abs(y + d[i] * dy[0])
        for j in range(4):
            nx = x + d[i] * dx[j]
            ny = y + d[i] * dy[j]
            if abs(nx) + abs(ny) < t:
                t = abs(nx) + abs(ny)
                dir = j
        x = x + d[i] * dx[dir]
        y = y + d[i] * dy[dir]
        ret += mode[dir]

    print (ret)


def main():
    m = 34
    X, Y, d = [], [], []

    for i in range(32, 0, -1):
        d += [2**i]
    d += [1]

    N = int(input())
    even, odd = 0, 0

    for i in range(N):
        x, y = map(int, input().split())
        X += [x]; Y += [y]

        if (abs(x) + abs(y)) % 2 == 0:
            even += 1
        else:
            odd += 1

    if even and odd:
        print(-1)
        return 0

    if odd:
        m -= 1
    else:
        d += [1]

    print(m)
    print(" ".join(map(str, d)))

    for i in range(N):
        solve(X[i], Y[i], d, m)

main()

Measured memory_bytes: 3188
#include <iostream>
#include <utility>
#include <stdint.h>
#include <string>

using namespace std;

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

  bool flag = true;
  for (int ii=0; flag && ii<S.size(); ++ii) {
    if ((ii%2==0 && S[ii]=='L') || (ii%2 && S[ii]=='R'))
      flag = false;
  }

  cout << (flag ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	c := make([]int, 5)
	r := []string{"M", "A", "R", "C", "H"}
	for i := 0; i < n; i++ {
		s := Scan()
		for j := 0; j < 5; j++ {
			if string(s[0]) == r[j] {
				c[j]++
			}
		}
	}
	ans := 0
	for i := 0; i < 5; i++ {
		for j := i + 1; j < 5; j++ {
			for k := j + 1; k < 5; k++ {
				ans += c[i] * c[j] * c[k]
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1772
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt();
		int max = max (a, b, c);
		int prod = 1;
		if (a != max) {
			prod *= a;
		} 
		if (b!=max) {
			prod *= b;
		}
		if (c != max) {
			prod *= c;
		}

		System.out.println(prod/2);
	}

	public static int max (int a, int b, int c) {
		int max = a;
		if (b > a) {
			max = b;
		}
		if (c > b) {
			max = c;
		}

		return max;
	}
}


Measured memory_bytes: 35744
N, C = map(int, input().split())
xy = [[int(i) for i in input().split()] for _ in range(N)]
c = [0]
rc = [0]
uc = [0]
ruc = [0]
sum = 0
out = 0
for x, cal in xy:
    sum += cal
    c.append(max(c[-1], sum-x))
    rc.append(max(rc[-1], sum-2*x))
sum = 0
for x, cal in xy[::-1]:
    sum += cal
    uc.append(max(uc[-1], sum-C+x))
    ruc.append(max(ruc[-1], sum-2*(C-x)))
for w, wr in zip(c, ruc[::-1]):
    out = max(out, w+wr)
for w, wr in zip(rc, uc[::-1]):
    out = max(out, w+wr)
print(out)

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  int n;
  cin >> n;
  vector<vector<ll>> v(n,vector<ll>(n));
  rep(i,n)rep(j,n)cin >> v[i][j];
  vector<vector<ll>> w(v);
  rep(k,n)rep(i,n)rep(j,n)w[i][j] = min(w[i][j],w[i][k]+w[k][j]);
  rep(i,n)rep(j,n){
    if(v[i][j] != w[i][j]){
      cout << -1 << endl;
      return 0;
    }
  }
  ll res = 0;
  rep(i,n)for(int j = i+1;j < n;j++)res += v[i][j];
  rep(i,n)for(int j = i+1;j < n;j++){
    rep(k,n){
      if(k == j || k == i)continue;
      if(v[i][k]+v[k][j] == v[i][j]){
        res -= v[i][j];
        break;
      }
    }
  }
  cout << res << endl;
  


  return 0;
}


Measured memory_bytes: 5064
<?php
  fscanf(STDIN, "%d %d", $h, $n);
  $a = array();
  $a_by = 0;

  $a = explode(" ", fgets(STDIN));

	for($i=0; $i<$n; $i++){
      $a_by += $a[$i];
    }

	if($a_by >= $h){
      echo "Yes";
    }else{
      echo "No";
    }

  ?>

Measured memory_bytes: 12792
#include <stdio.h>

int min(int a,int b){
    if(a>b) return b;
    else return a;
}
int dec(int a,int b){
    if(a>b) return a-b;
    else return b-a;
}

int main(){
    int n;
    scanf("%d", &n);
    int h[n];
    int dp[n];
    for(int i=0;i<n;i++) scanf("%d", &h[i]);
    //漸化式の初項
    dp[0]=0;
    dp[1]=dec(h[1],h[0]);
    //漸化式の立式
    for(int i=2;i<n;i++){
        dp[i]=min(dp[i-1]+dec(h[i],h[i-1]),dp[i-2]+dec(h[i],h[i-2]));
    }
    
    printf("%d", dp[n-1]);
    return 0;
}


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

int main(){
    int n,k;cin>>n>>k;
    int ans=0;
    
    for(int i=0;pow(k,i)<=n;i++){
        if(pow(k,i)<=n) ans=i;
    }

    cout<<ans+1<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef pair<ll,pi> pii;
typedef vector<pi> vpi;
typedef set<ll> si;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define f first
#define s second
ll INF = 1e18;
ll MOD = 1e9+7;
#define lb lower_bound
#define ub upper_bound
#define SZ(x) (ll)x.size()
#define ALL(x) x.begin(),x.end()

string S;
int N;
bool B[100100];
vi V;

int main(){
  cin>>S;
  N = SZ(S);
  if (S[N-1] - '0'){cout<<-1;return 0;}
  for (int i=0;i<N-1;++i)B[i+1] = S[i] - '0';
  //for (int i=1;i<=N;++i)cout<<i<<' '<<B[i]<<'\n';
  for (int i=1;i<=N;++i){
    int p = N-i;
    if (B[i] != B[p]){
      cout<<-1;
      return 0;
    }
    if(B[i])V.pb(i);
  }
  if (!SZ(V) || V[0] != 1){
    cout<<-1;
    return 0;
  }
  int cur = 1, cs = 1;
  for (int i=1;i<SZ(V); ++i){
    int add = V[i] - cs;
    for (int x=cur;x<V[i];++x)cout<<x<<' '<<V[i]<<'\n';
    cur = V[i];
    cs = V[i];
  }
  for (int i=cur + 1; i <=N;++i)cout<<cur<<' '<<i<<'\n';
}

Measured memory_bytes: 2548
/*
  Lower bound: first element that is greater-or-equal.
  int i=lower_bound(a,a+n,x)-a;
  Upper bound: first element that is strictly greater.
  #include<boost/multiprecision/cpp_int.hpp>
  namespace mp=boost::multiprecision;
  mp::cpp_int u=1; for(unsigned i=1;i<=n;i++) u*=i;
*/
#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define eps 1e-7
#define I (int)
const int mod=(int)1e9+7;
const long long INF = 1000000000000000000LL;
const int WASTE=(int)2e5;
//#define int long long
int power(int a,int b,int m){
	int i=1;
	while(b){
		if(b%2)
			i=(i*a)%mod;
		b/=2;
		a=(a*a)%mod;
	}
	return i;
}
const int N=1e5+5;
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    int n,a,b;
    cin>>n>>a>>b;
    b-=a;
    if(b%2)
    	cout<<"Borys";
    else
    	cout<<"Alice";
	return 0;
}

Measured memory_bytes: 256