akhauriyash/Code-Regression huggingface dataset:
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

const INF: i64 = 1 << 60;
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let F: Vec<Vec<usize>> = sc.mat(N, 10);
    let P: Vec<Vec<i64>> = sc.mat(N, 11);
    let mut ans = -INF;
    for bit in 0..1<<10 {
        if bit == 0 {
            continue;
        }
        let mut cnt = vec![0; N];
        let mut p = 0;
        for i in 0..10 {
            if bit>>i & 1 != 0 {
                for j in 0..N {
                    if F[j][i] == 1 {
                        cnt[j] += 1;
                    }
                }
            }
        }
        for i in 0..N {
            p += P[i][cnt[i]];
        }
        ans = max(ans, p);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
INF=10**9+7
L=[int(i)-1 for i in input().split()]
x=[int(i)   for i in input().split()]
y=[int(i)   for i in input().split()]
x.sort()
y.sort()

X=[x[i+1]-x[i] for i in range(L[0])]
Y=[y[i+1]-y[i] for i in range(L[1])]

usingX=[0 for i in range(L[0])]
usingY=[0 for i in range(L[1])]

if L[0]%2==0:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		#print(usingX)
		usingX[i]+=temp*int(L[0]/2-temp)
		#print(usingX)
		usingX[i]*=2
		#print()
else:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		usingX[i]+=temp*int((L[0]-1)/2-temp)
		usingX[i]*=2
		
		usingX[i]+=temp
	#temp=int((L[0]-1)/2)
	#usingX[temp]-=(temp+1)*2


if L[1]%2==0:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		#print(usingY)
		usingY[i]+=temp*int(L[1]/2-temp)
		#print(usingY)
		usingY[i]*=2
		#print()
else:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		usingY[i]+=temp*int((L[1]-1)/2-temp)
		usingY[i]*=2
		
		usingY[i]+=temp
	#temp=int((L[1]-1)/2)
	#usingY[temp]-=(temp+1)*2	

#print(usingX)
#print(usingY)
for i in range(L[0]):
	X[i]*=usingX[i]
for j in range(L[1]):
	Y[j]*=usingY[j]
ans=sum(X)*sum(Y)
print(ans%INF)

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

int main(){
  int n,k; cin>>n>>k;
  vector<int>v(n);
  vector<ll>dp(n+1,LLONG_MAX);
  for(int i=0;i<n;i++) cin>>v[i];
  dp[1]=0;
  for(int i=1;i<=n;i++){
    for(int j=max(1,i-k);j<i;j++){
      dp[i]=min(dp[i],dp[j]+(ll)abs(v[i-1]-v[j-1]));
    }
  }
  cout<<dp[n];
}
  

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

int main() {
	string s;
	cin >> s;
	int k = 0;
	for(int i = 0;i < s.size();i++)
	{
		if(k == 0)
		{
			if(s.at(i) == 'C')
			{
				k++;
			}
		}
		else if(k == 1)
		{
			if(s.at(i) == 'F')
			{
				k++;
			}
		}
	}
	string kai = "No";
	if(k == 2)
	{
		kai = "Yes";
	}
	cout << kai << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a, b, c, k;
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);

    if(a > b){
        k = a;
        a = b;
        b = k;
    }
    if(b > c){
        if(a > c){
            k = c;
            c = b;
            b = a;
            a = k;
        }
        else{
            k = c;
            c = b;
            b = k;
        }
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}


Measured memory_bytes: 2040
#include<iostream>
using namespace std;
 
int main(){
  int a, b;

  cin >> a >> b;

if(a<b){
  cout << "a < b" << endl;
}
if(a>b){
  cout << "a > b" << endl;
}
if(a==b){
  cout << "a == b" << endl;
}
  return 0;		 
}



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

int main() {
	// your code goes here
	int x,y,z;
	cin>>x>>y>>z;
	if(x==y)
	{
		cout<<z<<'\n';
	}
	else if (x==z)
	{
		cout<<y<<'\n';
	}
	else
	{
		cout<<x<<'\n';
	}
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    W = [input() for _ in range(N)]
    reslut = 'Yes'
    if len(W) != len(set(W)):
        reslut = 'No'
    for i in range(1, N):
        if W[i - 1][-1] != W[i][0]:
            reslut = 'No'
    print(reslut)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn main() {
    let n: u32 = read();
    let vv: Vec<Vec<i32>> = read_vec2(n);
    let mut a = [[[0i32; 10]; 3]; 4];

    for v in vv {
        a[v[0] as usize -1]
         [v[1] as usize -1]
         [v[2] as usize -1] += v[3]
    }

    for (l,i) in a.iter().enumerate() {
        for j in i {
            for k in j {
                print!(" {}", k);
            }
            println!();
        }
        if l != a.len() - 1 {
            println!("####################");
        }
    }
}


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

int main(){
	
	int n, denied = 0;
	
	cin >> n;
	
	for (int i = 0; i < n; i++){
		int a;
		cin >> a;
		
		if (a % 2 == 0){
			if (a % 3 != 0 && a % 5 != 0){
				denied++;
			}
		}
		
	}
	
	if (denied > 0){
		cout << "DENIED";
	} else {
		cout << "APPROVED";
	}
	
	
}


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

typedef long long ll;

int a[2000];
ll occurrences[2001];
ll suffix[2002];
ll num;
int n;

ll MOD = 1e9 + 7;

ll solve(ll k)
{
    if (k == 0) {return 0;}
    if (k == 1) {return num;}
    if (k % 2 == 0)
    {
        ll result = 2 * solve(k / 2);
        result %= MOD;
        for (int i = 0; i < n; i++)
        {
            ll u = (k / 2) * (k / 2) % MOD;
            result += u * suffix[a[i] + 1];
            result %= MOD;
        }
        return result;
    }
    ll result = solve(k - 1) + num;
    result %= MOD;
    for (int i = 0; i < n; i++)
    {
        result += (k - 1) * suffix[a[i] + 1];
        result %= MOD;
    }
    return result;
}

int main()
{
    for (int i = 0; i <= 2000; i++)
    {
        occurrences[i] = 0;
    }
    ll k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        occurrences[a[i]]++;
    }
    suffix[2001] = 0;
    for (int i = 2000; i >= 0; i--)
    {
        suffix[i] = suffix[i + 1] + occurrences[i];
    }
    num = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (a[i] > a[j]) {num++;}
        }
    }
    cout << solve(k) << endl;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

bool comp(int a, int b){
    return (a<b);
}

int main(){
    string flag = "APPROVED";
    int n; cin >> n;
    vector<int> a(n);
    REP(i,0,n) cin >> a[i];
    REP(i,0,n){
        if(a[i]%2==0){
            if(a[i]%3!=0){
                if(a[i]%5!=0){
                    flag = "DENIED";
                }
            }
        }
    }
    cout << flag << endl;
    return 0;
}

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

using namespace std;

vector<vector<int>> bingo(3, vector<int>(3));
int N;
int solve(){

  for(int j = 0;j < 3;j++){
    for(int k = 0;k < 3;k++){
        cin >> bingo[j][k];
    }
  }
  cin >> N;
  vector<int>temp(N);
  for(int i = 0;i < N;i++){
  	cin >> temp[i];
  }
  int index;
  for(index = 0;index < N;index++){
    for(int j = 0;j < 3;j++){
      for(int k = 0;k < 3;k++){
        if(temp[index] == bingo[j][k]){
          bingo[j][k] = 0;
        }
      }
    }
  }
  if(bingo[0][0] == 0){
   	if(bingo[0][1] == 0){
      if(bingo[0][2] == 0){
        cout << "Yes" << endl;
        return 0;
      }
   	}
    if(bingo[1][0] == 0){
      if(bingo[2][0] == 0){
        cout << "Yes" << endl;
        return 0;
      }
    }
    if(bingo[1][1] == 0){
      if(bingo[2][2] == 0){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  if(bingo[1][0] == 0){
    if(bingo[1][1] == 0){
      if(bingo[1][2] == 0){
        cout << "Yes" << endl;
          return 0;
      }
    }
  }
  if(bingo[2][0] == 0){
    if(bingo[2][1] == 0){
      if(bingo[2][2] == 0){
        cout << "Yes" << endl;
        return 0;
      }
    }
    if(bingo[1][1] == 0){
      if(bingo[0][2] == 0){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  if(bingo[0][1] == 0){
    if(bingo[1][1] == 0){
      if(bingo[2][1] == 0){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  if(bingo[0][2] == 0){
   	if(bingo[1][2] == 0){
      if(bingo[2][2] == 0){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
int main(){
	solve();
  	return 0;
}


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

int main() {
  int H,W;
  cin>>H>>W;
  vector<string> s(H);
  rep(i,H) cin>>s[i];
  rep(i,H){
    rep(j,W){
      if(s[i][j]=='#'){
        bool flag=false;
        if(j>0&&s[i][j-1]=='#')flag=true;
        else if(j<W-1&&s[i][j+1]=='#')flag=true;
        else if(i>0&&s[i-1][j]=='#')flag=true;
        else if(i<H-1&&s[i+1][j]=='#')flag=true;
        if(!flag){
          puts("No");
          return 0;
        }
      }
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
if N == 3:
    if S == "ooo":
        print("SSS")
    elif S == "xxx":
        print("SSW")
    else:
        print(-1)
    exit()
def solve(first, second):
    R = [None] * N
    R[0] = first
    if (S[0] == "o" and R[0] == "S") or (S[0] == "x" and R[0] == "W"):
        R[1] = R[-1] = second
    else:
        R[1] = second
        R[-1] = "S" if second != "S" else "W"
    for i, s in enumerate(S):
        if i == 0:
            continue
        if (s == "o" and R[i] == "S") or (s == "x" and R[i] == "W"):
            new = R[i - 1]
        else:
            new = "W" if R[i - 1] != "W" else "S"
        if i == N - 2:
            if new != R[i + 1]:
                return False, None
        if i == N - 1:
            if new != R[0]:
                return False, None
            else:
                return True, R
        R[i + 1] = new
for f, s in [("S", "S"), ("S", "W"), ("W", "S"), ("W", "W")]:
    ok, result = solve(f, s)
    if ok:
        print("".join(result))
        break
else:
    print(-1)


Measured memory_bytes: 4196
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
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; }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  set<int> st;
  int n;
  cin >> n;
  REP(i, n) {
    int tmp;
    cin >> tmp;
    st.insert(tmp);
  }
  string ans = (n == st.size() ? "YES" : "NO");
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9600
#include<iostream>
#include<math.h>
using namespace std;

int main(){
    int n;
    double ave, alfa;
    
    while(1){
        ave = 0;
        alfa = 0;
        cin >> n;
        double s[n];
        
        if(n == 0) break;
        
        for(int i = 0; i < n; i++){
            cin >> s[i];
            ave += s[i];
        }
        ave /= n;
        
        for(int i = 0; i < n; i++){
            alfa += (s[i] - ave) * (s[i] - ave) / n;
        }
        alfa = sqrt(alfa);
        
        cout << fixed << alfa << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3268
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  s=s+"S";
  int i,max=0,c=0;
  for(i=0; i<s.size(); i++)
  {
    if(s[i]=='R')
    {
      c++;
    }
    else
    {
      if(c>max)
      {
        max=c;
      }
      
      c=0;
    }
  }
  cout<<max;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int X = 0;
	for (int i = 0; i < N; i++) {
		X ^= a[i];
	}
	for (int i = 0; i < N; i++) {
		a[i] ^= X;
	}
	for (int i = 0; i < N; i++) {
		cout << a[i] << endl;
	}
	return 0;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	int a[40005];
	int b[40005];
	
	while(1){
		cin >> n;
		if(n == 0) break;
		
		for(int i = 1;i <= n;++i){
			cin >> a[i];
		}
		for(int i = 1;i <= n;++i){
			cin >> b[i];
		}
		
		int t[40005] = {};
		
		sort(a + 1, a + 1 + n, greater<int>());
		sort(b + 1, b + 1 + n, greater<int>());
		
		int s = 1, w = 1;
		while(s <= n && w <= n){
			while(a[w] > b[s] && w <= n){
				++w;
			}
			if(w <= n && a[w] <= b[s]){
				++t[w];
				++w; ++s;
			}
		}
		
		for(int i = 1;i <= n;++i){
			t[i] += t[i - 1];
		}
		
		int ans = -1;
		for(int k = 1;k <= n;++k){
			if(k - t[k] >= (k + 2) / 2){
				ans = k;
				break;
			}
		}
		
		if(ans == - 1 || ans == n){
			cout << "NA" << endl;
		}else{
			cout << ans << endl;
		}
	}
	
	return 0;
}


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

void Print(vector<vector<bool>>& vec) {
  for (auto v : vec) {
    for (auto b : v) cerr << (b ? "o" : "x");
    cerr << endl;
  }
}

int main() {
  int w, h, n;
  cin >> w >> h >> n;
  vector<vector<bool>> map(h, vector<bool>(w));
  rep(loop, n) {
    int X, Y, a;
    cin >> X >> Y >> a;
    rep(y, h) rep(x, w) {
      if (a == 1 && x < X) map[y][x] = true;
      if (a == 2 && x + 1 > X) map[y][x] = true;
      if (a == 3 && y < Y) map[y][x] = true;
      if (a == 4 && y + 1 > Y) map[y][x] = true;
    }
  }

  Print(map);

  int ans = 0;
  rep(i, h) ans += count(map[i].begin(), map[i].end(), false);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef long double ld;


int main() {
    ll N;
    cin >> N;
    string s;
    cin >> s;
    ll count_R = 0, count_W = 0;


    ll half;
    if(N % 2 != 0){
        half = (N - 1) / 2 + 1;
    }
    else{
        half = (N / 2);
    }
    
    rep(i,N){
        if(s[i] == 'R'){
            count_R++;
        }
        else{
            count_W++;
        }        
    }   
    ll ans = 0;
    for(int i = count_R; i < N; i++){
        if(s[i] == 'R'){
            ans++;
        }
    }
    cout << min(ans,count_W) << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <climits>

using namespace std;

int main() {
  int X, Y;
  cin >> X >> Y;

  if ((X * Y) % 2 == 0) {
    std::cout << "Even" << std::endl;
  } else {
    std::cout << "Odd" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
        cout<<s[i];
        if(i<n-1)cout<<" ";
    }
    cout<<endl;
    for(int i=1;i<n;i++){
        int v=s[i];
        int j=i-1;
        while(j>=0&&s[j]>v){
            s[j+1]=s[j];
            j--;
        }
        s[j+1]=v;
        for(int ii=0;ii<n;ii++){
            cout<<s[ii];
            if(ii<n-1)cout<<" ";
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3108
n = int(input())
P = [0] * n
for i in range(n):
    P[i] = list(map(int, input().split()))
P = sorted(P, key=lambda x: x[2], reverse=True)

max_h = P[0][2]

P2 = set()
for i in range(101):
    for j in range(101):
        P2.add((i, j))
for hh in range(max_h+200, max_h-1, -1):
    P3 = P2.copy()
    for x, y, h in P:
        for xx, yy in P3.copy():
            dx = abs(xx - x)
            dy = abs(yy - y)
            th = max(hh-dx-dy, 0)
            if th != h:
                P3.remove((xx, yy))
    if len(P3) == 1:
        xx, yy = P3.pop()
        print('%d %d %d' % (xx, yy, hh))


Measured memory_bytes: 119084
#include<iostream>
#include<string>
using namespace std;
int main(){
    string str;
    int ans=0;
    while(cin>>str){
        for(int i=0;;i++){
            if(str[i]==0)break;
            if(str[i]>'0'&&str[i]<='9'){
                int j;
                for(j=i;str[j]>='0'&&str[j]<='9';j++){};
                int a=j-i;
                j--;
                int r=1;
                while(a--){
                    ans+=(str[a+i]-'0')*r,r*=10;
                }
                i=j;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1180
S = input()

ans = True
for i in range(len(S)):
  if S[i] == "D" or S[i] == "U": continue
  else:
    if S[i] == "R" and i % 2 != 0: ans = False
    elif S[i] == "L" and i % 2 == 0: ans = False
      
if ans == True: print("Yes")
else: print("No")
    

Measured memory_bytes: 2940
#include<iostream>
#include<vector>

int main() {
	char str[11];
	std::cin >> str;
	long long int ans = 0;
	int length = 0;

	for (int i = 0; i < 10; i++) {
		if (str[i] == '\0')break;
		length++;
	}

	std::vector<int>arr(length);
	for (int i = 0; i < length; i++)arr[i] = str[i] - '0';

	for (int i = 0; i < 1<<(length-1); i++) {
		long long int sum = 0;
		long long int tempSum = arr[0];
		for (int j = 0; j < length - 1; j++) {
			if (i >> j & 1) {
				sum += tempSum;
				tempSum = arr[j + 1];
			}
			else {
				tempSum *= 10;
				tempSum += arr[j + 1];
			}
		}

		sum += tempSum;
		ans += sum;
	}
	printf("%lld\n", ans);

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,ret=0,mn=INT_MAX,p; cin>>n;
	for (int i=0; i<n; i++) {
		cin>>p;
		if(mn>p)
			mn=p, ret++;
	}
	cout<<ret<<endl;
	return 0;
}

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

const int N = 400, M = 100000;

std::bitset <N> s[N];
int x[M], y[M], n, m, ans;

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> m;
	for (int i = 0; i < m; ++i)
		std::cin >> x[i] >> y[i], --x[i], --y[i];
	for (int i = 0; i < n; ++i) {
		s[i].set(i);
		for (int j = m - 1; ~j; --j) {
			bool a = s[i].test(x[j]), b = s[i].test(y[j]);
			if (a ^ b) s[i].set(x[j]), s[i].set(y[j]);
			else if (a && b) {s[i].set(); break;}
		}
	}
	for (int i = 0; i < n; ++i)
		for (int j = i + 1; j < n; ++j)
			ans += !(s[i] & s[j]).any();
	std::cout << ans << '\n';
	return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

template<class T>
T gcd(T a, T b){return b ? gcd(b, a % b) : a;}
template<class T>
T lcm(T a, T b){return a / gcd(a, b) * b;}

int main() {
    int n, k;
    ll a, b, m, x = 1;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        b = a;
        int cnt = 0;
        while (a % 2 == 0) {
            a /= 2;
            cnt++;
        }
        if (i == 0) {
            k = cnt;
        }
        else if (k != cnt) {
            cout << 0 << endl;
            return 0;
        }
        x = lcm(x, b / 2);
        if (x > m) {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << (int)ceil((double)(m / x) / 2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int g[3][200];
	int s[3][200];
	for(int i = 0;i < n;i++){
		for(int j = 0;j < 3;j++){
			cin >> g[j][i];
			s[j][i] = 1;
		}
	}
	for(int i = 0;i < 3;i++){
		for(int j = 0;j < n;j++){
			for(int k = j+1;k < n;k++){
				if(g[i][j] == g[i][k]){
					s[i][j] = 0;
					s[i][k] = 0;
				}
			}
		}
	}
	int p[200];
	for(int i = 0;i < n;i++){
		p[i] = 0;
	}

	for(int i = 0;i < n;i++){
		for(int j = 0;j < 3;j++){
			if(s[j][i] == 1){
				p[i] += g[j][i];
			}
		}
	}
	for(int i = 0;i < n;i++){
		cout << p[i] << endl;		
	}
	return 0;
	
}


Measured memory_bytes: 3104
#include "bits/stdc++.h"
using namespace std;

#define say(obj) (cout << obj << endl)
#define endline (cout << endl)
#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to, cost;
	edge_(ll to, ll cost) : to(to), cost(cost) {}
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr int		INF = (int)1e7;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template <typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template <typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template <typename T>
ostream& operator << (ostream& os, const vector<vector<T>>& mat) {
	for (const vector<T>& m : mat) os << m << endl;
	return os;
}

template <typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template <typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template <typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	ll x;
	cin >> x;

	ll ans = 0;
	if (x <= 6)
		ans = 1;
	else {
		ans += x / 11 * 2;
		x -= x / 11 * 11;
		if (0 < x && x <= 6)
			ans++;
		else if (7 <= x && x <= 11)
			ans += 2;
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef struct _node{
    int key;
    struct _node *left;
    struct _node *right;
}NODE;

NODE* makeNode(int x){
    NODE *n=(NODE*)malloc(sizeof(NODE));
    n->key=x;
    n->left=NULL;
    n->right=NULL;    
    return n;
}

NODE* insert(NODE *t,int x){
    if(t==NULL) return makeNode(x);
    if(t->key<x) t->right=insert(t->right,x);
    else t->left=insert(t->left,x);
    return t;
}

void inorder(NODE *t){
    if(t==NULL) return;    
    if(t->left!=NULL) inorder(t->left);
    printf(" %d",t->key);
    if(t->right!=NULL) inorder(t->right);
    return;
}

void preorder(NODE *t){
    if(t==NULL) return;    
    printf(" %d",t->key);
    if(t->left!=NULL) preorder(t->left);
    if(t->right!=NULL) preorder(t->right);
    return;
}

int main(void){
    NODE *root;
    root=NULL;
    
    int n;
    scanf("%d\n",&n);
    
    char com[6+1];
    int a;
    while(n--){
        scanf("%s",com);
        switch(com[0]){
            case 'i':
                scanf("%d\n",&a);
                root=insert(root,a);
                break;
		
            case 'p':
                inorder(root);
                printf("\n");
                preorder(root);
                printf("\n");
                break;
        }
    }
    
    return 0;
}




Measured memory_bytes: 17336
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

int h, w;

bool contain(int y, int x){
    return (0 <= y && y < h && 0 <= x && x < w);
}

signed main(){
    int m, n;
    cin >> m >> n;
    char c[110][110];
    int d[110][110] = {0};
    rep(i, 0, m){
        rep(j, 0, n){
            cin >> c[i][j];
        }
    }
    h = m;
    w = n;
    int ans = 0;
    rep(i, 0, m){
        rep(j, 0, n){
            if(c[i][j] == 'o'){
                rep(k, 0, 3){
                    int y = i;
                    int x = j + k - 1;
                    if(contain(y, x)){
                        d[y][x]++;
                    }
                }
            }
            if(c[i][j] == 'x'){
                rep(k, 0, 3){
                    rep(l, 0, 3){
                        int y = i + k - 1;
                        int x = j + l - 1;
                        if(contain(y, x)){
                            d[y][x]++;
                        }
                    }
                }
            }
        }
    }
    rep(i, 1, m){
        rep(j, 0, n){
            if(d[i][j] == 0) ans++;
        }
    }
    cout << ans << endl;
}

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

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

  vector<long long> x(N);
  vector<long long> y(N);

  for (int i = 0; i < N; i++){
    cin >> x.at(i) >> y.at(i);
  }

  int count = 0;

  for (int i = 0; i < N; i++){
    if (sqrt(x.at(i) * x.at(i) + y.at(i) * y.at(i)) <= D) count += 1;
  }


  cout << count << endl;
}

Measured memory_bytes: 6472
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,a;
  a = 0;
  cin>>N;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin>>vec[i];
    if(vec[i] != i+1){
      a++;
    }
  }
  if(a ==0 || a ==2){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

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

int l, r, mn = 1e9 + 10;
string s;

int main() {
	cin >> s >> s;
	for (int i = 1; i < s.size(); i++)
		if (s[i] == 'E')
			r++;
	
	for (int i = 0; i < s.size(); i++) {
		mn = min(mn, l + r);
		if (s[i] == 'W')
			l++;
		if (i != (int)s.size() - 1 && s[i + 1] == 'E')
			r--;
	}
	cout << mn;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI=acos(-1);
const int INF = numeric_limits<int>::max();

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

    int ans = k;

    for (int i = 0; i * k <= b; ++i){
        ans = k * i;
        if (a <= ans && ans <= b){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;

    return 0;
    
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int,int> pii;
typedef std::pair<int,double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1000000007;



void solve(){
    
    int n,k;
    cin >> n >> k;
    cout << n-k+1;
    
    
    
}



int main(){
    int T;
    T = 1;
    // cin >> T;
    while(T--){
        solve();
        cout << endl;
    }
}





































Measured memory_bytes: 3608
Scanf.scanf "%d" (fun t ->
    let calc n =
        let co = [|
            [| 869418286; 727008098; 660103155; 183023413; 471090892; 417297686; 237315285; 542573865;
               444014759; 927321758; 184117322; 5655049;   347662323; 346175634; 765144583; 0         |];
            [| 869418286; 727008098; 660103155; 183023413; 471090892; 417297686; 237315285; 542573865;
               444014759; 927321758; 184117322; 962779130; 404391958; 700407153; 729548371; 539588932 |]
        |].(n mod 2)
        in
        Array.fold_left (fun acc v -> (acc * n + v) mod 1000000007) 0 co |> Printf.printf "%d\n"
    in
    for i = 1 to t do
        Scanf.scanf " %d" calc
    done
)

Measured memory_bytes: 3884
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	if (s=="SUN") cout<<7<<endl;
	if (s=="MON") cout<<6<<endl;
	if (s=="TUE") cout<<5<<endl;
	if (s=="WED") cout<<4<<endl;
	if (s=="THU") cout<<3<<endl;
	if (s=="FRI") cout<<2<<endl;
	if (s=="SAT") cout<<1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=1e18,MOD=1e9+7,MAX=1e6+2;



int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    double a,b,c;
    cin>>a>>b>>c;
    if(a/b<=c)
        cout<<"Yes";
    else
        cout<<"No";
}

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

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

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    int a,b;
    cin>>a>>b;
    cout<<(a+b)%24;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

ll N, M;

void solve() {
    ll ans;
    if (N * 2 >= M) {
        ans += M / 2;
    } else {
        ans += N;
        ans += (M - N * 2) / 4;
    }
    cout << ans << endl;
}

int main() {
    cin >> N >> M;
    solve();
    return 0;
}

Measured memory_bytes: 256
class Combination:
    def __init__(self, n_max, mod=10**9+7):
        # O(n_max + log(mod))
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max+1):
            f = f * i % mod
            fac.append(f)
        f = pow(f, mod-2, mod)
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()

    def __call__(self, n, r):  # self.C と同じ
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def C(self, n, r):
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def P(self, n, r):
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[n-r] % self.mod

    def H(self, n, r):
        if (n == 0 and r > 0) or r < 0: return 0
        return self.fac[n+r-1] * self.facinv[r] % self.mod * self.facinv[n-1] % self.mod

    def rising_factorial(self, n, r):  # 上昇階乗冪 n * (n+1) * ... * (n+r-1)
        return self.fac[n+r-1] * self.facinv[n-1] % self.mod

    def stirling_first(self, n, k):  # 第 1 種スターリング数  lru_cache を使うと O(nk)  # n 要素を k 個の巡回列に分割する場合の数
        if n == k: return 1
        if k == 0: return 0
        return (self.stirling_first(n-1, k-1) + (n-1)*self.stirling_first(n-1, k)) % self.mod

    def stirling_second(self, n, k):  # 第 2 種スターリング数 O(k + log(n))  # n 要素を区別のない k グループに分割する場合の数
        if n == k: return 1  # n==k==0 のときのため
        return self.facinv[k] * sum((-1)**(k-m) * self.C(k, m) * pow(m, n, self.mod) for m in range(1, k+1)) % self.mod

    def balls_and_boxes_3(self, n, k):  # n 要素を区別のある k グループに分割する場合の数  O(k + log(n))
        return sum((-1)**(k-m) * self.C(k, m) * pow(m, n, self.mod) for m in range(1, k+1)) % self.mod

    def bernoulli(self, n):  # ベルヌーイ数  lru_cache を使うと O(n**2 * log(mod))
        if n == 0: return 1
        if n % 2 and n >= 3: return 0  # 高速化
        return (- pow(n+1, self.mod-2, self.mod) * sum(self.C(n+1, k) * self.bernoulli(k) % self.mod for k in range(n))) % self.mod

    def faulhaber(self, k, n):  # べき乗和 0^k + 1^k + ... + (n-1)^k
        # bernoulli に lru_cache を使うと O(k**2 * log(mod))  bernoulli が計算済みなら O(k * log(mod))
        return pow(k+1, self.mod-2, self.mod) * sum(self.C(k+1, j) * self.bernoulli(j) % self.mod * pow(n, k-j+1, self.mod) % self.mod for j in range(k+1)) % self.mod

    def lah(self, n, k):  # n 要素を k 個の空でない順序付き集合に分割する場合の数  O(1)
        return self.C(n-1, k-1) * self.fac[n] % self.mod * self.facinv[k] % self.mod

    def bell(self, n, k):  # n 要素を k 個以下に分割する場合の数  O(k**2 + k*log(mod))
        return sum(self.stirling_second(n, j) for j in range(1, k+1)) % self.mod

mod = 10**9+7
comb = Combination(2000)
n, k = map(int, input().split())
print(comb.H(k, n-k))



Measured memory_bytes: 5776
from copy import deepcopy

class Dice():

    def num_input(self):
        self.number = list(map(int,input().split()))
        self.E = [4,2,1,6,5,3]
        self.N = [2,6,3,4,1,5]
        self.S = [5,1,3,4,6,2]
        self.W = [3,2,6,1,5,4]
    
    def rotate(self,order):
        tmp = deepcopy(self.number)
        if order == "E":
            for i in range(6):
                self.number[i] = tmp[self.E[i]-1]
        elif order == "N":
            for i in range(6):
                self.number[i] = tmp[self.N[i]-1]
        elif order == "S":
            for i in range(6):
                self.number[i] = tmp[self.S[i]-1]
        elif order == "W":
            for i in range(6):
                self.number[i] = tmp[self.W[i]-1]
    
    def output(self):
        print(self.number[0])
    

if __name__ == "__main__":
    dice = Dice()
    dice.num_input()
    order = input()
    for i in order:
        dice.rotate(i)
    dice.output()


Measured memory_bytes: 6344
#include<cstdio>
#include<iostream>
#include<string>
struct Node {
    int id;
    Node* parent;
    Node* l_child;
    Node* r_sib;
    
    Node(int i,Node* p,Node* l,Node* r){
        id = i;
        parent = p;
        l_child = l;
        r_sib = r;
    }
    
};

class RootedTree {
    Node** Tree;
    Node* nil =NULL;
    Node* cur;
    
    public :RootedTree(int c){
        Tree = new Node*[c];
        for(int i = 0;i < c;++i) Tree[i] = new Node(i,nil,nil,nil);
    }

    void ChangeCurNode(int id){
	    cur = Tree[id];
    }

    void AddChild(int id_c) {
		   Tree[id_c] -> parent = cur;
		   cur->l_child = Tree[id_c];
		   cur = cur->l_child;
	   }

	   void AddSibiling(int id_c) {
		   Tree[id_c] -> parent = cur -> parent;
		   cur->r_sib = Tree[id_c];
		   cur = cur->r_sib;
	   }
    
    int GetDepth(){
        Node *p;
        int c=0;
        if(cur -> parent != nil){
            p = cur -> parent;
            c++;
            while(p -> parent != nil){
                p =  p-> parent;
                c++;
            }
            return c;
        } else{
            return 0;
        }
        
    }
    
    char* GetType(){
        if(cur -> parent == nil){
            return "root";
        } else if(cur -> l_child == nil) {
            return "leaf";
        } else{
            return "internal node";
        }
    }
    
    char* GetChildren(char *res) {
		   if (cur->l_child != nil) {
			   sprintf(res, "%d", cur->l_child->id);
			   Node* s;
			   if (cur->l_child->r_sib != nil) {
				   s = cur->l_child->r_sib;
				   sprintf(res, "%s, %d", res, s->id);
				   while ((s = s->r_sib) && (s != nil)) sprintf(res, "%s, %d", res, s->id);
			   }
		   }
		   return res;
    }
        void PrintChildren() {
		   if (cur->l_child != nil) {
			   printf("%d", cur->l_child->id);
			   Node* s;
			   if (cur->l_child->r_sib != nil) {
				   s = cur->l_child->r_sib;
				   printf(", %d", s->id);
				   while ((s = s->r_sib) && (s != nil)) printf(", %d",s->id);
			   }
		   }
	   }
    
    int GetParent(){
        if(cur -> parent != nil){
            return cur -> parent -> id;
        } else {
            return -1;
        }
    }
};


int main(){
    int n,id,k;
    RootedTree *rt;
    scanf("%d",&n);
    rt = new RootedTree(n);
    for(int i = 0;i < n;++i){
        scanf("%d %d",&id,&k);
	    rt -> ChangeCurNode(id);
        for(int j= 0;j < k;++j){
    		scanf("%d",&id);
             if(j == 0){
    		    rt -> AddChild(id);
    		 } else {
                rt -> AddSibiling(id);
    		}
        }
    }
    
    char *str;
    for(int i=0;i < n;++i){
        rt -> ChangeCurNode(i);
        printf("node %d: parent = %d, depth = %d, %s, [",i,rt -> GetParent(),rt -> GetDepth(),rt -> GetType());
        rt -> PrintChildren();
        printf("]\n");
    }
}


Measured memory_bytes: 8680
#include <bits/stdc++.h>
using namespace std;
int main() {
 int A, B, C;
 cin >> A >> B >> C;
 if (A + B >= C && A*B*C != 0){
   cout << "Yes" << endl;
  }else if(A + B < C){
    cout << "No" << endl;
  }
}  


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int r, D, x;
int dfs(int i){
    if(i==2000) return x;
    int xi = dfs(i-1) * r -D;
    if(2001 <= i && i <= 2010) cout << xi << endl;
    return xi;
}

int main(){
    cin >> r >> D >> x;
    dfs(2010);
    return 0;
}

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

#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define MAXN 10005
#define MAXM 100005
#define pi 3.14159265359

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
typedef long long ll;
typedef priority_queue<int> pqi;
typedef priority_queue<pii, vpii, greater<pii> > dij;

int N, ans;

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

	cin >> N;
	for(int i = 0; i < 32; i++){
		if(N < (1 << (i+1))){
			ans = 1 << i;
			break;
		}
	}

	cout << ans << "\n";

	return 0;		
}

Measured memory_bytes: 256