akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	string s;
	cin>>s;
	while(s!=""){
		if(s.substr(0,5)=="dream"||s.substr(0,7)=="dreamer"||s.substr(0,5)=="erase"||s.substr(0,6)=="eraser"){
			if(s.substr(0,6)=="eraser"){
        		s.erase(0,6);
        		continue;
        	}
    		if(s.substr(0,5)=="erase"){
      			s.erase(0,5);
      			continue;
    		}
	        if(s.substr(0,7)=="dreamer"){
	        	if(s.substr(7,1)=="a")
	         	   s.erase(0,5);
				else
	        	   s.erase(0,7);
	        	continue;
	        }
	        if(s.substr(0,5)=="dream"){
	       	    s.erase(0,5);
	       	    continue;
	        }
		}
		else{
			cout<<"NO";
			return 0;
		}
	}
	cout<<"YES";
	return 0;
} 


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define endl "\n"
#define PI acos(-1)
#define BMW_GTR ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

typedef long long ll;
using namespace std;

//ll const n = 50005;

int main()
{
    BMW_GTR;

    int X;
    cin >> X;

    cout << (X / 500) * 1000 + ((X % 500) / 5) * 5;

    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<iomanip>

using namespace std;


int main() {
	
	double a;
	double maxt = 0;
	double mint = 99999999;
	
	while( cin >> a)
	{
			maxt = max(maxt, a);
			mint = min(mint, a);	
	}

	cout << fixed << setprecision(6) << maxt - mint << "\n";
	
	
	return 0;
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n&1)
	{
		double a=(n+1)/2.0/n;
		printf("%.10lf",a);
	}
	else
	
	{
		printf("%.10lf",0.5);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

int main(){
	ll n, k; cin >> n >> k;
	vector<ll> a(n,0);
	REP(i,k){
		ll d; cin >> d;
		REP(j,d){
			ll x; cin >> x;
			a[x-1]++;
		}
	}
	ll ans = 0;
	REP(i,n){
		if (a[i]==0){
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (h,n) = get!(usize, usize);
    let ab = get!(usize, usize; n);
    let mx = ab.iter().map(|e| e.0).max().unwrap();
    const INF: usize = 1_000_000_000_000_000;
    let mut dp = vec![vec![INF; h+mx+1]; n+1];
    for i in 0..n {
        dp[i][0] = 0;
    }
    for i in 0..n {
        for j in 0..h+mx+1 {
            dp[i+1][j] = if j<ab[i].0 {
                dp[i][j]
            } else {
                min!(dp[i+1][j-ab[i].0]+ab[i].1,dp[i][j])
            };
        }
    }
    let mut mn = std::usize::MAX;
    for i in h..h+mx+1 {
        mn = min!(mn,dp[n][i]);
    }
    println!("{}", mn);
}


Measured memory_bytes: 115068
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>

using namespace std;

 
int main(){

	string s,p;
	int n;
	cin>>n>>s;int sum=0;
	int L=s.size()-1;
	for(int i=0;i<n;i++)
	{
		cin>>p;bool FF=false;
		for(int j=0;j<p.size();j++)
		{
			
			
			if(p[j]==s[0]){int y=sum;int x=1;
				for(int k=j;k<p.size();k++){
					x=1;
					if(p[k]==s[x]){
						int r=k-j;x++;
						bool f=true;
						int K=k+r;
						while(1){
							if(K>p.size()-1)break;
							if(p[K]==s[x]){
								K=K+r;x++;}//cout<<"#"<<r;}
							else f=false;
							if(K>p.size()-1)f=false;
							if(x>L){sum++;FF=true;}
							if(f==false||x>L){break;}
						}
					}
					if(sum>y)break;
				}
				if(sum>y)break;
				//cout<<x;
			}
			
		if(FF==true)break;
		}
	}cout<<sum<<endl;
	return 0;
}

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

int main(){
  int a,b,c;
  cin >>a >>b >>c;
  if(a+b+c >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
  return 0;
}


Measured memory_bytes: 256
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    H,W = map(int, input().split())
    s = [list(input().rstrip()) for _ in range(H)]
    dp = [[0]*W for _ in range(H)]
    if s[0][0] == '#':
        dp[0][0] = 1
    for i in range(H):
        for j in range(W):
            if i == j == 0:
                continue
            elif i == 0:
                if s[i][j] == '#' and s[i][j-1] == '.':
                    dp[i][j] = dp[i][j-1] + 1
                else:
                    dp[i][j] = dp[i][j-1]
            elif j == 0:
                if s[i][j] == '#' and s[i-1][j] == '.':
                    dp[i][j] = dp[i-1][j] + 1
                else:
                    dp[i][j] = dp[i-1][j]
            else:
                p1 = dp[i-1][j]
                p2 = dp[i][j-1]
                if s[i][j] == '#' and s[i-1][j] == '.':
                    p1 += 1
                if s[i][j] == '#' and s[i][j-1] == '.':
                    p2 += 1
                dp[i][j] = min(p1, p2)
    print(dp[H-1][W-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; i++)
#define FORD(i, a, b) for (int i = (a), i##_len = (b); i > i##_len; i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

int main() {
    int n, q;
    cin >> n;
    vector<tuple<int, int>> vw(n);
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        vw[i] = make_tuple(a, b);
    }
    cin >> q;
    vector<tuple<int, int>> vl(q);
    REP(i, q) {
        int a, b;
        cin >> a >> b;
        vl[i] = make_tuple(a, b);
    }

    int former = min(512, n);
    vector<vector<int>> former_dp(former, vector<int>(100001, -1));
    vector<set<int>> former_set(former);

    former_dp[0][0] = 0;
    former_dp[0][get<1>(vw[0])] = get<0>(vw[0]);
    former_set[0].insert(0);
    former_set[0].insert(get<1>(vw[0]));

    FOR(i, 1, former) {
        int v, w;
        tie(v, w) = vw[i];
        auto& anc_dp = former_dp[(i - 1) / 2];
        auto& now_dp = former_dp[i];
        auto& anc_set = former_set[(i - 1) / 2];
        auto& now_set = former_set[i];
        for (auto j : anc_set) {
            now_dp[j] = anc_dp[j];
            now_set.insert(j);
        }
        for (auto j : anc_set) {
            if (w + j <= 100000) {
                now_dp[w + j] = max(now_dp[w + j], anc_dp[j] + v);
                now_set.insert(w + j);
            }
        }
    }

    REP(i, former) {
        int m = 0;
        auto& now_dp = former_dp[i];
        FOR(j, 1, 100001) {
            m = max(m, now_dp[j]);
            now_dp[j] = m;
        }
    }

    for (auto temp : vl) {
        int v, l;
        tie(v, l) = temp;
        if (v <= former) {
            cout << former_dp[v - 1][l] << endl;
            continue;
        }
        vector<tuple<int, int>> later;
        int vv = v;
        while (vv > former) {
            later.push_back(vw[vv - 1]);
            vv >>= 1;
        }
        auto& anc_dp = former_dp[vv - 1];
        int m = later.size();
        int ans = 0;
        REP(i, pow(2, m)) {
            int v_sum = 0;
            int w_sum = 0;
            int ii = i;
            for (auto temp : later) {
                int j, k;
                tie(j, k) = temp;
                if (ii & 1) {
                    v_sum += j;
                    w_sum += k;
                }
                ii >>= 1;
            }
            if (w_sum > l) { continue; }
            ans = max(ans, v_sum + anc_dp[l - w_sum]);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 215132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int N;cin>>N;
    string s;
    ll m,a,r,h,c;m=0;a=0;r=0;h=0;c=0;
    for(int i=0;i<N;i++){
        cin>>s;
        if(s[0]=='M')m++;
        if(s[0]=='A')a++;
        if(s[0]=='R')r++;
        if(s[0]=='C')c++;
        if(s[0]=='H')h++;
    }
    cout<<m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,x=1,cnt=0;
  cin >> N;
  vector<int>a(N);
  for(int i=0; i<N; i++)
    cin >> a.at(i);
  while(x!=2){
    x = a.at(x-1);
    cnt++;
    if(cnt>N){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3768
# unionfind
class Uf:
	def __init__(self, N):
		self.p = list(range(N))
		self.rank = [0] * N
		self.size = [1] * N
	#検索 ノード番号を受け取って一番上の親ノードの番号を帰す
	def root(self, x):
		if self.p[x] != x:
			self.p[x] = self.root(self.p[x])

		return self.p[x]
	#同じ集合に属するか判定
	def same(self, x, y):
		return self.root(x) == self.root(y)
	#併合
	def unite(self, x, y):
		# 根を探す
		u = self.root(x)
		v = self.root(y)

		if u == v: return

		#木の高さを比較し、低いほうから高いほうに辺を張る
		if self.rank[u] < self.rank[v]:
			self.p[u] = v
			self.size[v] += self.size[u]
			self.size[u] = 0
		else:
			self.p[v] = u
			self.size[u] += self.size[v]
			self.size[v] = 0
			#木の高さが同じなら片方を1増やす
			if self.rank[u] == self.rank[v]:
				self.rank[u] += 1
	#ノード番号を受け取って、そのノードが含まれている集合のサイズを返す
	def count(self, x):
		return self.size[self.root(x)]

N, M = map(int, input().split())
uf=Uf(N)
P = list(map(int, input().split()))
P=[i-1 for i in P]
for i in range(M):
	x, y = map(int, input().split())
	x-=1
	y-=1
	uf.unite(x,y)

#「値iを含む位置jと位置iが同じグループに属している」という条件を満たすiの数を数える
ans=0
for i in range(N):
	if uf.root(P[i]) == uf.root(i):
		ans+=1
print(ans)

Measured memory_bytes: 92336
n = input()
import numpy
a = map(int, raw_input().split())
cumsum_a = numpy.cumsum(a)
cumsum_v = 0
res1 = 0
for i, v in enumerate(cumsum_a):
  # -|0 to +
  if i % 2 == 0:
    if v + cumsum_v <= 0:
      res1 += -(v + cumsum_v) + 1
      cumsum_v += -(v + cumsum_v) + 1
  # + to -
  else:
    if v + cumsum_v >= 0:
      res1 += (v + cumsum_v) + 1
      cumsum_v += -(v + cumsum_v) - 1

cumsum_v = 0
res2 = 0
for i, v in enumerate(cumsum_a):
  # -|0 to +
  if i % 2 != 0:
    if v + cumsum_v <= 0:
      res2 += -(v + cumsum_v) + 1
      cumsum_v += -(v + cumsum_v) + 1
  # + to -
  else:
    if v + cumsum_v >= 0:
      res2 += (v + cumsum_v) + 1
      cumsum_v += -(v + cumsum_v) - 1
print min(res1, res2)

Measured memory_bytes: 19308
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MAX = 5100000;
//ll gcd(ll a, ll b) {
//    return (b==0) ? a : gcd(b, a%b);
//}

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};


vector<int> to[100005];
int n;
vector<int> dist;
void dfs(int v, int d=0, int p=-1) {
    dist[v] = d;
    for (int u: to[v]) {
        if (u == p) continue;
        dfs(u, d+1, v);
    }
}

vector<int> calcDist(int s){
    dist = vector<int>(n);
    dfs(s);
    return dist;
}

int gcd(int x, int y) {
    if (x % y == 0)
        return y;
    return gcd(y, x%y);
}
int main() {
    long a, b; cin >> a >> b;
    long ans = a * b;
    // LCM x * y / GCD(x,y)
    cout << a * b / gcd(a, b) << endl;
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

int MOD = 1000000007;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> a(N,0);
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
    vector<vector<long long> > dp(N+1,vector<long long>(K+1,0));
    for(int i=0; i<=K; i++){
        dp[0][i]=1;
    }
    for(int i=0; i<N; i++){
        for(int j=0; j<=K; j++){
            if(j==0){
                dp[i+1][0]=1;
                continue;
            }
            if(j<=a[i]){
                dp[i+1][j]=(dp[i+1][j-1]+dp[i][j])%MOD;
            }else{
                dp[i+1][j]=(dp[i+1][j-1]+dp[i][j]-dp[i][j-a[i]-1])%MOD;
            }
        }
    }
    int ans = dp[N][K];
    if(K>0){
        ans-=dp[N][K-1];
    }
    if(ans<0){
        ans+=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 80256
// AOJ 0056: Goldbach's Conjecture
// 2017.10.28 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

#define MAX  50000
#define HALF 2761		// prime[2760]=24989, prime[2761]=25013
char table[MAX+1];		// zero: if prime 
int sz, prime[5200] = {   // prime[46] = 223, max sz = 5132
	3,      5,      7,     11,     13,     17,     19,     23,     29, 
    31,     37,     41,     43,     47,     53,     59,     61,     67,     71, 
    73,     79,     83,     89,     97,    101,    103,    107,    109,    113, 
   127,    131,    137,    139,    149,    151,    157,    163,    167,    173, 
   179,    181,    191,    193,    197,    199,    211,    223 };
int ans[MAX+MAX] = {0,0,0,0,1,0};
char buf[10], *p;

int main()
{
	int i, j, k;

	for (i = 0; i < 47; i++) {
		k = prime[i];
		for (j = k<<1; j < MAX; j += k) table[j] = 1;
	}
	for (sz = 0, i = 3; i <= MAX; i += 2) if (!table[i]) prime[sz++] = i;
	for (i = 0; i < HALF; i++) for (j = i; j < sz; j++)
		ans[prime[i] + prime[j]]++;

	while (fgets(p=buf, 10, stdin) && *buf != '0') {
		i = 0; while (*p >= '0') i = (i<<3) + (i<<1) + (*p++ & 0xf);
		if (i & 1) putchar('1'-table[i-2]);
		else printf("%d", ans[i]);
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 2008
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}
int main()
{
    int N, R;
    cin >> N >> R;

    if (N<10)
        cout << R+100*(10-N) << endl;
    else
        cout << R << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000001;
constexpr ll INF= 1e18;
constexpr ll MOD = 998244353;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int main() {
    int N;
    cin >> N;
    vector<int> two;
    vector<int> three;
    vector<int> six;
    for(int i = 1;i <= 30000;i++) {
        if(i % 6 == 0) {
            six.push_back(i);
        }
        else if(i % 2 == 0) {
            two.push_back(i);
        }
        else if(i % 3 == 0) {
            three.push_back(i);
        }
    }
    if(N == 3) {
        cout << "2 5 63" << endl;
    }
    else if(N == 4) {
        cout << "2 5 20 63" << endl;
    }
    else {
        int A = 0;
        int B = 0;
        int C = 0;
        for(int i = 1;i <= 10000;i++) {
            bool cnt = true;
            for(int j = 1;j <= 5000;j++) {
                if(i % 2 == 0 && j % 2 == 0) {
                    if(N >= i + j && N - (i + j) <= 5000) {
                        A = i;
                        B = j;
                        C = N - A - B;
                        cnt = false;
                        break;
                    }
                }
            }
            if(cnt == false) {
                break;
            }
        }
        for(int i = 0;i < A;i++) {
            cout << two.at(i) << " ";
        }
        for(int i = 0;i < B;i++) {
            cout << three.at(i) << " ";
        }
        for(int i = 0;i < C;i++) {
            cout << six.at(i) << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 512
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define ll long long int
#define fab(a,b,i) for(int i=a;i<b;i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
string s,t; 
ll dp[4000][4002];
ll recurse(ll sptr,ll tptr)
{
	if(sptr<0)
		return 0;
	if(tptr<0)
		return 0;
	if(dp[sptr][tptr]!=-1)
		return dp[sptr][tptr];
	if(s[sptr]==t[tptr])
		return dp[sptr][tptr]=recurse(sptr-1,tptr-1)+1;
	else 
		

		return dp[sptr][tptr]=max(recurse(sptr-1,tptr),recurse(sptr,tptr-1));
	
}
int main()
{ quick;

    cin>>s>>t;
    fab(0,s.size(),i)
    fab(0,t.size(),j)
    {
    	//cout<<dp[i][j];
    	dp[i][j]=-1;
    
    }

    ll sptr=s.size()-1,tptr=t.size()-1;
    ll siz=recurse(sptr,tptr);
    sptr=s.size()-1;tptr=t.size()-1;
    string ans="";
    while(sptr>=0 and tptr>=0)

    {
    	if(s[sptr]==t[tptr])
    		{ans=s[sptr]+ans;
    			sptr--;
    			tptr--;}
    	else if(sptr>0 and tptr>0 and dp[sptr-1][tptr]>dp[sptr][tptr-1])
    		sptr--;
    	else if(tptr==0)
    		sptr--;
    	else 
    		tptr--;


    }
    //assert(ans.size()==siz);
    cout<<ans<<endl;
    


	return 0;
}

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

int main(int argc, char const *argv[])
{
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	int x3=x2-y2+y1,y3=y2-x1+x2,x4=x1-y2+y1,y4=y1-x1+x2;
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
	return 0;
}


Measured memory_bytes: 256
# abc112_a.py
# https://atcoder.jp/contests/abc112/tasks/abc112_a

# ★ RE:2
# in4.txt
# s1.txt

# A - Programming Education /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点: 100点

# 問題文
# 2020年, AtCoder 社は年商 10 億円を超え, プログラミング教育にも手を出すようになった.
# ある日行われたテストでは, 1 才児は Hello World を出力するプログラムを, 2 才児は整数 A, B を入力して A+B を出力するプログラムを書かなければならない.
# 高橋君はこのテストを受けているが, 突然自分が何才なのかが分からなくなってしまった.
# そこで, 最初に自分の年齢 N (N は 1 または 2) を入力し, N=1 ならば Hello World と出力し, N=2 ならば A, B を入力して A+Bを出力するプログラムを作ることにした.
# 高橋君に代わって, このようなプログラムを作りなさい.

# 制約
#     Nは 1 または 2
#     Aは 1 以上 9以下の整数
#     Bは 1 以上 9以下の整数

# 入力
# 入力は以下の 2 つのうちいずれかの形式で標準入力から与えられる.
# 1

# 2
# A
# B


# 出力
# N=1のとき, Hello World と出力し, N=2 のとき, A+Bを出力しなさい.

# 入力例 1
# 1

# 出力例 1
# Hello World

# N=1なので, 高橋君は 1才である. したがって, Hello World を出力する.

# 入力例 2
# 2
# 3
# 5

# 出力例 2
# 8

# N=2なので, 高橋君は 2 才である. A=3,B=5 なので, A+B である 8 を出力する. 


global FLAG_LOG
FLAG_LOG = False


def log(value):
    return
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    n = int(lines[0])
    # values = list(map(int, lines[1].split()))
    # n = lines[0]

    if n == 1:
        return ['Hello World']
    else:
        A = int(lines[1])
        B = int(lines[2])
        return [A+B]


# 引数を取得
def get_input_lines():
    line = input()
    N = int(line)
    # N, M = list(map(int, line.split()))
    lines = list()
    lines.append(line)
    if N == 2:
        for _ in range(2):
            lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['1']
        lines_export = ['Hello World']
    if pattern == 2:
        lines_input = ['2', '3', '5']
        lines_export = [8]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines()
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;

int main() {
	double W, H, x, y;
	cin >> W >> H >> x >> y;

	cout.precision(10);
	cout << fixed << W * H / 2.0;
	cout << " " << ((x*2 == W && y*2 == H) ? 1 : 0) << endl;

	return 0;
}


Measured memory_bytes: 256
function main (input) {
    const args = input.split('\n');
    const n = args[0];
    const a = args[1].split(' ');
    var flg = true;
    var cnt = 0;
    while (flg) {
        for (var i=0;i<n;i++) {
            if (a[i]%2!=0 ) {
                flg = false;
            }
            a[i] = a[i]/2;
            
        }cnt++;
    }
    console.log(cnt-1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define ll long long
#define For(i,x,y) for(int i=x;i<=y;i++)
#define Rep(i,x,y) for(int i=x;i>=y;i--)
#define Forn(i,x,y) for(int i=x;i<y;i++)
#define oo 1000000
#define zyy 1000000007
#define M 100
#define N 200005
using namespace std;
inline int read(){int x=0,f=0;char ch=getchar();for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;return f?-x:x;}
inline void write(ll x){if(x<10) putchar(x+48);else write(x/10),putchar(x%10+48);}
inline void writeln(ll x){if(x<0) putchar('-'),x=-x;write(x);putchar('\n');}
int n,a[N],ans;
int main(){
	n=read();For(i,1,n) a[i]=read(),ans+=a[i];
	sort(a+1,a+1+n);
	if(ans%10!=0) return writeln(ans),0;
	For(i,1,n) if(a[i]%10!=0){
		ans-=a[i];
		return writeln(ans),0;
	}
	puts("0");
	return 0;
}

Measured memory_bytes: 768
from collections import deque
H,W = map(int,input().split())
grid = []
d = deque()
next_d = deque()
for i in range(H):
    grid.append(list(input()))
for i in range(H):
    for j in range(W):
        if grid[i][j] == '#':
            d.append((i,j))
dx = [0,-1,0,1]
dy = [1,0,-1,0]
ans = -1
while d:
    ans += 1
    while d:
        y,x = d.pop()
        for i in range(4):
            next_y = y+dy[i]
            next_x = x+dx[i]
            if next_y >= 0 and next_y < H and next_x >= 0 and next_x < W:
                if grid[next_y][next_x] == '.':
                    grid[next_y][next_x] = '#'
                    next_d.append((next_y,next_x))
    d = next_d
    next_d = deque()
print(ans)

Measured memory_bytes: 147200
#!/usr/bin/env python3
import sys


def solve(N: int, S: "List[str]"):
    m = len([i for i in S if i[0] == 'M'])
    a = len([i for i in S if i[0] == 'A'])
    r = len([i for i in S if i[0] == 'R'])
    c = len([i for i in S if i[0] == 'C'])
    h = len([i for i in S if i[0] == 'H'])

    print(
        m*a*r+
        m*a*c+
        m*a*h+
        m*r*c+
        m*r*h+
        m*c*h+
        a*r*c+
        a*r*h+
        a*c*h+
        r*c*h
        )

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [ next(tokens) for _ in range(N) ]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

int n, m;
int seen[100100] = {};
vector<vector<int>> g(100100, vector<int>());

int main()
{
  cin >> n >> m;
  rep(i, m)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  rep(i, n) seen[i] = -1;

  queue<int> q;
  q.push(0);
  seen[0] = 1;

  while (!q.empty())
  {
    int v = q.front();
    q.pop();

    for (auto i : g[v])
    {
      if (seen[i] == -1)
      {
        seen[i] = v;
        q.push(i);
      }
    }
  }

  bool flag = true;
  repi(i, 1, n)
  {
    if (seen[i] == -1)
      flag = false;
  }

  if (flag)
  {
    cout << "Yes" << endl;
    repi(i, 1, n)
    {
      cout << seen[i] + 1 << endl;
    }
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const int MOD = 10000;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n, k;
    cin >> n >> k;

    vector< P > v(k);
    rep(i, k){
        cin >> v[i].first >> v[i].second;
        --v[i].second;
    }
    SORT(v);

    int dp[101][3][3] = {0};
    if(v[0].first == 1){
        dp[1][(v[0].second + 1) % 3][v[0].second] = 1;
    }else{
        rep(l, 3){
            dp[1][(l + 1) % 3][l] = 1;
        }
    }

    REP(i, 1, n){
        rep(j, 3){
            rep(l, 3){
                rep(m, 3){
                    if(j == l && l == m){
                        continue;
                    }
                    auto it = lower_bound(v.begin(), v.end() - 1, make_pair(i + 1, -1));
                    if((*it).first == i + 1 && (*it).second != m){
                        continue;
                    }
                    dp[i + 1][l][m] += dp[i][j][l];
                    dp[i + 1][l][m] %= MOD;
                }
            }
        }
    }

    int ans = 0;
    rep(j, 3){
        rep(l, 3){
            ans += dp[n][j][l];
            ans %= MOD;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    string s; cin >> s;
    ll ans = 0;
    rep(i, 1<<(s.size() - 1)) {
        ll now = s[0] - '0';
        rep(j, s.size() - 1) {
            if(i & (1<<j)) {
                ans += now;
                now = s[j + 1] - '0';
            }
            else {
                now *= 10;
                now += s[j + 1] - '0';
            }
        }
        ans += now;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3604
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  int x = a.size();
  int y = b.size();

  if(a[x-1] == b[0] && b[y-1] == c[0]){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program {
    static int N;
    static int[] x;
    static long[,,] dp;

    static void Main(string[] args) {
        var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
        N = st[0];
        int A = st[1];

        var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Array.Sort(p);

        x = new int[N];

        for (int i = 0; i < N; i++) {
            x[i] = p[i];
        }

        dp = new long[N, N + 1, A * N + 1];  //少し大きめに配列を確保

        //dpテーブルの全ての値を-1にしておく
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N + 1; k++) {
                for (int s = 0; s <= A * N; s++) {
                    dp[j, k, s] = -1;
                }
            }
        }

        //あらかじめ分かっている値は入力していく
        dp[0, 0, 0] = 1;
        for (int s = 0; s <= A * N; s++) {
            if (s == x[0]) {
                dp[0, 1, s] = 1;
            } else {
                dp[0, 1, s] = 0;
            }
        }

        //dpテーブルの全ての値を計算
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N + 1; k++) {
                if (k == 1) {
                    //Console.WriteLine("a");
                }
                for (int s = 0; s <= A * N; s++) {
                    dp[j, k, s] = CalculateDP(j, k, s);
                }
            }
        }


        //答えを得る
        long ans = 0;
        for (int i = 0; i <= N; i++) {
            ans += dp[N - 1, i, i * A];
        }

        Console.WriteLine(ans - 1);
    }

    static long CalculateDP(int j, int k, int s) {
        //すでにテーブルが埋まっていれば、値を返す
        if (dp[j, k, s] != -1) {
            return dp[j, k, s];
        }

        //パターン[3]
        if (j == 0 && k == 0 && s == 0) {
            dp[j, k, s] = 1;
            return dp[j, k, s];
        }

        //パターン[2]
        if (j >= 1 && k >= 1 && x[j] <= s) {
            dp[j - 1, k, s] = CalculateDP(j - 1, k, s);
            dp[j - 1, k - 1, s - x[j]] = CalculateDP(j - 1, k - 1, s - x[j]);
            dp[j, k, s] = dp[j - 1, k, s] + dp[j - 1, k - 1, s - x[j]];
            return dp[j, k, s];
        }

        //パターン[1]
        if (j >= 1) {
            dp[j, k, s] = dp[j - 1, k, s];
            return dp[j, k, s];
        }

        //パターン[4](その他)
        dp[j, k, s] = 0;
        return dp[j, k, s];
    }
}

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

int main() {
    int N, K;
    cin >> N >> K;
    int n = N;
    int a[100000];
    int c;
    bool conczero = false;
    for (int i = 0; i < N; i++) {
        cin >> c;
        if (c == 0) {
            K = K - 1;
            n = N - 1;
        }
        a[i] = c;
    }
    if (K == 0) {
        cout << 0 << endl;
        return 0;
    }
    int b[10000];
    int j = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] == 0) {
            continue;
        }
        b[j] = a[i];
        j++;
    }
    int min_distance = -1;
    int min_dis;
    for (int l = 0; l < n - K + 1; l++) {
        int r = l + K - 1;
        int l_dis = abs(b[l]) + abs(b[r] - b[l]);
        int r_dis = abs(b[r]) + abs(b[r] - b[l]);
        min_dis = min(l_dis, r_dis);
        if (min_dis < min_distance || min_distance < 0) {
            min_distance = min_dis;
        }
    }
    cout << min_distance << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
ll n,a,b;
vector<ll> h;
bool f(ll x){
    ll cnt=0;
    rep(i,0,h.size()){
        cnt+=max((ll)0,((h[i]-b*x)+(a-b)-1)/(a-b));
    }
    return  cnt<=x;
}
int main(){
    cin>>n>>a>>b;
    h.resize(n);
    rep(i,0,n) cin>>h[i];
    
    ll ng = -1, ok = INF+100;
    while (ok - ng > 1) {
        ll mid = (ng + ok) / 2;
        (f(mid) ? ok : ng) = mid;
    }
    
    cout<<ok<<endl;

}


Measured memory_bytes: 1024
N = int(input())
an_list = list(map(int, input().split()))

alice_sum = 0
bob_sum = 0

while len(an_list) != 0:
    alice_sum += max(an_list)
    an_list.remove(max(an_list))
    if len(an_list) != 0:
        bob_sum += max(an_list)
        an_list.remove(max(an_list))

print(alice_sum - bob_sum)


Measured memory_bytes: 2940
// Author: Harshdeep Sharma , IIT  Indore
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
// #define MOD  998244353
#define ll long long
const double PI = atan(1.0) * 4;
// const ll INF = (int)1e9 ;
const int di[4] = { -1, 0, 1, 0} ;
const int dj[4] = {0, -1, 0, 1} ;
const ll INF = (ll)2e18 + 50;
const int maximum  = numeric_limits<int>::max();
const int minimum  = numeric_limits<int>::min();
// const int N = 1e5 + 5 ;
const ll mod = 1e9 + 7 ;
// const int N = 1e5 + 5 ;

ll power(ll a , ll e) {
	ll res = 1LL ;
	while (e > 0) {
		if (e % 2 == 1) res = res * a;
		a =  a * a  ;
		e /= 2 ;
	}
	return res ;
}






int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t ;
	// cin >> t ;
	// while (t--) {
	int n;
	cin >> n ;
	map<pair<int, int>, int > cnt;
	for (int i = 0 ; i < n ; i++) {
		double x ;
		cin >> x ;
		ll y = llround(x * 1e9) ;
		// cout << y << "\n";
		int a = 0 , b = 0 ;
		while (y % 2 == 0) {
			a++ ;
			y /= 2 ;
		}
		while (y % 5 == 0) {
			b++ ;
			y /= 5 ;
		}
		++cnt[ {a, b}] ;
	}
	ll ans = 0 ;
	// for (auto p : cnt) {
	// 	cout << p.first.first << " " <<  p.first.second << " " << "\n";
	// }
	for (auto a : cnt) {
		for (auto b : cnt) {
			if (a.first.first + b.first.first >= 18 && b.first.second + a.first.second >= 18) {
				if (a < b) {
					ans += (ll) a.second *  b.second;
				}
				else if (a == b) {
					ans += (ll) a.second * (a.second - 1) / 2;
				}
			}
		}
	}
	cout << ans << "\n";





	// }









	return 0 ;

}



Measured memory_bytes: 3724
use std::io;


fn main() {
    let s = read_one::<String>().chars().collect::<Vec<_>>();
    if s[0] == s[1] || s[1] == s[2] || s[2] == s[3] {
        println!("Bad");
    } else {
        println!("Good");
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int A, B; cin >> A >> B;
    cout << (max({A+B, A-B, A*B})) << endl;
	return 0;
}

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

int main()
{
    int a[200000];
    int q;
    int c,x;
    int j = 0;

    cin >> q;

    for (int i = 0; i < q; i++) {
        cin >> c;
        //cout << c;
        if (c == 0){
          cin >> x;
          a[j] = x;
          //cout << a[j];
          j++;
        } else if(c == 1){
          cin >> x;
          cout << a[x] << endl;
        } else if(c == 2){
          j=j-1;
        }
    }
}



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

int main()
{
	int N, W=0, P=0, G=0, Y=0;
	string color;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> color;
		if (color == "W")
			W = 1;
		else if (color == "P")
			P = 1;
		else if (color == "G")
			G = 1;
		else if (color == "Y")
			Y = 1;
	}

	if ((W + P + G + Y) / 4)
		cout << "Four" << endl;
	else
		cout << "Three" << endl;
    return 0;
}


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

int main(void){

    int t;
    cin >> t;

    while(t--){
        int p,q;
        cin >> p >> q;
        int tmp=p*p+q*q,cnt=0;

        for(int n=0;n*n<=tmp;n++){
            for(int m=0;m*m<=tmp;m++){
                if(m*m+n*n<1)continue;
                if((m*p+n*q)%(m*m+n*n)==0 && (m*q-n*p)%(m*m+n*n)==0)cnt++;
            }
        }

        if(cnt*2<=8)cout << "P" << endl;
        else cout << "C" << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)

int main()
{

    ll n,i,j,k,l,a,b,c,d,e,f;
   char a1[100];

    scanf("%lld",&a);

    scanf("%s",&a1);
    if(a<3200)
    {
        printf("red\n");

    }
    else
    {
        printf("%s\n",a1);
    }

}


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

namespace Atc_0022
{
    class Program
    {
        static void Main(string[] args)
        {
            string rStr = Console.ReadLine();

            for (int i = 0; i < rStr.Length -1; i++)
            {
                if(rStr.Substring(i,1) != rStr.Substring(i + 1, 1))
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");

        }
    }
}


Measured memory_bytes: 25756
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String w, t;
    int count, i, wm, tm;
    char[] wch, tch;

    count = 0;
    w = sc.next();
    wm = w.length();
    wch = new char[wm];
    for(i = 0;i < wm;i++){
      wch[i] = w.charAt(i);
      if(wch[i] >= 'A' && wch[i] <= 'Z'){
        wch[i] += 'a' - 'A';
      }
    }

    for(;;){
      t = sc.next();
      if("END_OF_TEXT".equals(t)){
        break;
      }else{
        tm = t.length();
        tch = new char[tm];
        for(i = 0;i < tm;i++){
          tch[i] = t.charAt(i);
          if(tch[i] >= 'A' && tch[i] <= 'Z'){
            tch[i] += 'a' - 'A';
          }
        }

        if(wm == tm){
          for(i = 0;i < tm;i++){
            if(wch[i] != tch[i])break;
          }
          if(i == tm)count++;
        }
      }
    }

    System.out.println(count);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 18060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 2e5+100;
using namespace std;
typedef long long ll;
int a[110];
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k,d,x;
    cin>>n>>k;
    while(k--){
    	cin>>d;
    	for(int i=1;i<=d;i++){
    		cin>>x;
    		a[x]++;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(a[i]==0)
		ans++;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define FOR(i, r, n) for (int i=(int)(r); i<=(int)(n); i++)
#define all(v) v.begin(), v.end()
#define INF 2147483647
#define INF64 9223372036854775807
#define MOD 1000000007

int main(){

  	int x=1;
  
    rep(i, 365){
      cout<<x<<endl;
      x++;
      if(x>26) x=1;
    }

}

Measured memory_bytes: 3592
import Data.List

main = interact $ unlines . map (show' . save_your_privacy) . read' . lines
 where
  read' ("0":_) = []
  read' (n:xs) = (pss, ls) : read' xs'
   where
    (pss',(ls':xs')) = splitAt (read n) xs
    pss = map (\(m:ps)->(m,ps)) . zipWith (:) [1..] . map (tail . map read . words) $ pss'
    ls = tail . map read . words $ ls'
  show' rs = if length rs == 1 then show (head rs) else "-1"

save_your_privacy (mpss,ls) = map fst (filter suspect mpss)
 where suspect (m,ps) = intersect ls ps == ls

Measured memory_bytes: 6520
N, M = map(int, input().split())
init = list(map(int, input().split()))

parent = [i for i in range(N+1)]
depth = [1 for i in range(N+1)]

def get_parent(x):
    if x == parent[x]:
        return x
    else:
        return get_parent(parent[x])

for _ in range(M):
    a, b = map(int, input().split())
    pa, pb = map(get_parent, [a,b])
    if pa == pb:
        continue
    if depth[pa] < depth[pb]:
        pa, pb = pb, pa
        a, b = b, a
    parent[pb] = pa
    depth[pa] = max(depth[pa], depth[pb]+1)


index = [[] for _ in range(N+1)]
value = [[] for _ in range(N+1)]
for n in range(1, N+1):
    p = get_parent(n)
    index[p].append(n)
    value[p].append(init[n-1])

ans = 0
for n in range(1, N+1):
    idx, val = index[n], value[n]
    if idx:
        idx.sort()
        val.sort()
        i, j = 0, 0
        while i < len(idx) and j < len(idx):
            if idx[i] == val[j]:
                ans += 1
                i += 1
                j += 1
            elif idx[i] > val[j]:
                j += 1
            else:
                i += 1
print(ans)


Measured memory_bytes: 38452
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
template<typename T>
T gcd(T x, T y){
    if ((x==1)||(y==1)) return 1;
    if (x>y) {
        if (x%y==0) {
            return y;
        }else{
            return gcd(y, x%y);
        }
    }else{
        if (y%x==0) {
            return x;
        }else{
            return gcd(x, y%x);
        }
    }
}

ll goch(ll a){
    for (ll i = 0; i*i*i*i*i <= a; i++) {
        if (i*i*i*i*i == a) {
            return i;
        }
    }
    return -1;
}


int main() {
    IN(int, n);
    IN(int, m);
    IN(int, x);
    vi2 a(n,vi(m+1));
    REP(i, n){
        REP(j, m+1){
            cin >> a[i][j];
        }
    }
    int ans = INF;
    bool kano = false;
    
    for (int bit = 0; bit < (1<<n); bit++) {
        vi rikai(m,0);
        int kin = 0;
        REP(i, n){
            if (bit & (1<<i)) {
                kin += a[i][0];
                REP(j, m){
                    rikai[j] +=  a[i][j+1];
                }
            }
        }
        bool flag = true;
        REP(i, m){
            if(rikai[i]<x){
                flag = false;
            }
        }
        if (flag) {
            kano = true;
            ans = min(ans,kin);
        }
    }

    if (kano) {
        COUT(ans);
    }else{
        COUT(-1);
    }
}


Measured memory_bytes: 3596