akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/range/numeric.hpp>

#ifdef _MSC_FULL_VER
#include"randomizer.hpp"
#include"debug_print.hpp"
#endif

#include<cstdlib>
#include<ctime>

namespace lib
{
	template<class T>using pair = std::pair<T, T>;
	template<class T>constexpr T pow(T base, std::uint64_t p)
	{
		T ret = T(1);
		for (std::uint64_t i = 0; i <= 63; ++i)
		{
			if (((1ull << i) & p) != 0)
			{
				ret *= base;
			}
			base *= base;
		}
		return ret;
	}
	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

	struct union_find
	{
		std::vector<int> upper;
		union_find(std::size_t size):upper(size, -1) {}

		int group(int index)
		{
			if (upper[index] == -1)
			{
				return index;
			}
			else
			{
				return upper[index] = group(upper[index]);
			}
		}

		bool merge(int x, int y)
		{
			auto gx = group(x);
			auto gy = group(y);
			if (gx != gy)
			{
				upper[gx] = gy;
				return true;
			}
			return false;
		}

		auto get()
		{
			std::map<int, std::set<int>> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret[group(i)].emplace(i);
			}
			return ret;
		}

		auto tops()
		{
			std::set<int> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret.emplace(group(i));
			}
			return ret;
		}

		bool is_same_group(int x, int y)
		{
			return group(x) == group(y);
		}
	};
}

namespace out
{
	namespace detail
	{
		template<class>struct void_out
		{
			typedef void type;
		};
		template<class T>auto write(std::ostream& ost, T const& val)
			->typename void_out<decltype(ost << val)>::type
		{
			ost << val;
		}
		template<class T, class... Ts>void write(std::ostream& ost, T const& val, Ts const&... nexts)
		{
			write(ost, val);
			ost << " ";
			write(ost, nexts...);
		}
	}
	void write_line()
	{
		std::cout << std::endl;
	}
	template<class...Ts>void write_line(Ts const&... args)
	{
		detail::write(std::cout, args...);
		write_line();
	}
	template<class Range>void write_range(Range const& rng)
	{
		for (auto const& v : rng)
		{
			write_line(v);
		}
	}
}

namespace adaptor = boost::adaptors;

void Main()
{
	int N, H, W;
	std::cin >> N >> H >> W;
	out::write_line((N - H + 1)*(N - W + 1));
}

int main()
{
	std::cin.tie(nullptr);
	std::cin.sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/agc037/tasks/agc037_b
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

const MOD: u64 = 998244353;

fn main() {
    input! {
        n: u64,
        s: chars
    };

    let mut total = 1u64;
    let mut state = vec![0u64; 8];
    state[0] = n as u64;
    for i in 0..s.len() {
        let v = match s[i] {
            'R' => 1,
            'G' => 2,
            'B' => 4,
             _  => unreachable!("invalid color")
        };
        let w0 = 7 ^ v; // people don't have v
        if state[w0] >= 1 {
            total *= state[w0];
            total %= MOD;
            state[w0] -= 1;
            state[w0^v] += 1;
            continue;
        }

        let mut has1 = false;
        for w1 in vec![6 ^ v, 5 ^ v, 3 ^ v] {
            if w1 != 7 && state[w1] >= 1 {
                has1 = true;
                total *= state[w1];
                total %= MOD;
                state[w1] -= 1;
                state[w1^v] += 1;
                break;
            }
        }
        if has1 {
            continue;
        }

        assert!(state[0] >= 1);
        total *= state[0];
        total %= MOD;
        state[0] -= 1;
        state[v] += 1;
    }
    println!("{}", total);
}



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

int main()
{
    ll n,sum=0;
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        if(i%3==0&&i%5==0)
        {

        }
        else if(i%3==0)
        {

        }
        else if(i%5==0)
        {

        }
        else sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<stack>
#include<iomanip>
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define drep(i,n) for(int i=((int)n)-1;i>-1;i--)
#define Rep(i,n0,n) for(int i=n0;i<((int)n);i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<((int)n);j++)
#define W(x) cout<<x<<endl;
#define Debug(x) cout<<"#DEBUG "<<x<<endl;
#define INF (1<<29)
#define INF2 (long long)8*(long long)INF*(long long)INF
#define mod 1000000007

typedef long long ll;

using namespace std;


int min(int x,int y){if(y<x)return y;else return x;}
int max(int x,int y){if(y>x)return y;else return x;}
int fact(int x){int i=1;rep(j,x){i*=(j+1);} return i;}
long long fact(long long x){long long i=1;rep(j,x){i*=(j+1);} return i;}
int gcd(int x, int y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}
ll gcd(ll x, ll y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}
//AGC018B
int main()
{
    int n,m;
    cin >> n >> m;
    if(n%m==0)
    {
        W(0)
    }
    else W(1)
    return 0;
}

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

int main(){
string str;
getline(cin,str);

for(int i=0;i<(int)str.size();i++){
if(islower(str[i])){str[i]=toupper(str[i]);}
else if(isupper(str[i])){str[i]=tolower(str[i]);}
}

cout<<str<<endl;
return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int64_t> vec(n);
    rep(i,n){
        cin >> vec[i];
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    int64_t ans=0;
    if(n%2==0){
        rep(i,n/2){
            if(i==0) ans+=vec[i];
            else ans+=2*vec[i];
        }
    }
    else{
        rep(i,(n+1)/2){
            if(i==0||i==(n-1)/2) ans+=vec[i];
            else ans+=2*vec[i];
        }
    }
    cout << ans << endl;
}

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

int main(){
  int N,i,cnt=0;
  cin >> N;

  for(i=1;i<=N;i++){
    if(1<=i && i<=9 || 100<=i && i<=999 || 10000<=i && i<=99999)
    cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define i64 long long
#define N (int)(1e5)
#define pii pair<int,int>
#define L first 
#define R second
#define all(x) x.begin(),x.end()
using namespace std;
bool isDigit(char c){
	return (c>='0' and c<='9');
}
int main(){
	int n,a,b;
	cin>>a>>b; getchar();
	string s; cin>>s;
	int len = s.size();
	if(len!=a+b+1 or s[a]!='-'){
		printf("No\n"); return 0;
	}
	bool valid = true;
	for(int i=0;i<len and valid;i++){
		if(i==a) continue;
		//printf("%d %c\n", i, s[i]);
		if(!isDigit(s[i])) valid = false;
	}
	printf("%s\n",valid ? "Yes" : "No");
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A.at(i);
    map<int, set<int>> L, R;
    int LL, RR;
    for(int i=0; i<N; i++){
        LL = (i+1) + A.at(i);
        RR = (i+1) - A.at(i);
        if(L.count(LL)) L.at(LL).insert(i);
        else L[LL] = {i};
        if(R.count(RR)) R.at(RR).insert(i);
        else R[RR] = {i};
    }
    int64_t count = 0;
    set<int> Rset;
    for(auto p : L){
        if(R.count(p.first)){
            Rset = R.at(p.first);
            auto itr = Rset.begin();
            int Rsize = Rset.size();
            for(auto l : p.second){
                int cnt = 0;
                while(l >= *itr){
                    itr++;
                    cnt++;
                    if(itr == Rset.end()) break;
                }
                count += (Rsize - cnt);
            }
        }
    } 
    cout << count << endl;
}

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

int main(){
	long long N;

	int cnt = 0;

	cin >> N;

	if (N == 1) cout << 0 << endl;
	else if(N == 2) cout << 1 << endl;
	else {
		cout << ( 1 + (N-1) ) * (N-1) / 2  << endl;
	}
	
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

int bubbleSort(vector<int> &A, int N){
    int flag = 1;   // 逆の隣接要素が存在する
    int count = 0;  // 本来不要
    while(flag){
        flag = 0;
        for(int i=N-1; i>=0; i--){
            if(A[i] < A[i-1]){
                swap(A[i], A[i-1]);
                flag = 1;
                count += 1; // 本来不要
            }
        }
    }
    return count;
}

int main()
{
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        int Ai; cin >> Ai;
        A[i] = Ai;
    }
    int count = bubbleSort(A, N);
    for(int i=0; i<N; i++){
        cout << A[i];
        if(i != N-1) cout << " ";
    }
    cout << endl;
    cout << count << endl;
}   


Measured memory_bytes: 3100
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

ll t;

bool eval(vector<ll> &p,const vector<string> &s){
    ll count = 0;
    vector<bool> used(s[0].size(),false);
    for(int i = 0; i < s[0].size(); i++){
        if(used[i])continue;
        for(int j = i+1; j < s[0].size(); j++){
            if(used[j])continue;
            bool flag = true;
            for(int k = 0; k < s.size(); k++){
                if(s[p[k]][i] != s[p[s.size()-k-1]][j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                used[i] = true;
                used[j] = true;
                break;
            }
        }
        if(!used[i])count++;
    }
    if(count > 1){
        return false;
    }else if(count == 0){
        return true;
    }else{
        for(int i = 0; i < s[0].size(); i++){
            if(!used[i]){
                for(int j = 0; j < s.size(); j++){
                    if(s[p[j]][i] != s[p[s.size() - j - 1]][i]){
                        return false;
                    }
                }
            }
        }
        return true;
    }
}

bool dfs(vector<ll> &p,vector<bool> selected,const vector<string> &s,int x,int lim,int m){
    if(x == lim){
        return eval(p,s);
    }
    for(int i = m; i < selected.size(); i++){
        if(!selected[i]){
            selected[i] = true;
            for(int j = i+1; j < selected.size(); j++){
                if(!selected[j]){

                    selected[j] = true;
                    p[x] = i;
                    p[p.size() - x - 1] = j;
                    if(dfs(p,selected,s,x+1,lim,i+1)){
                        return true;
                    }
                    selected[j] = false;
                }
            }
            selected[i] = false;
            return false;
        }
    }
    return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll h,w;
    cin >> h >> w;

    vector<string> s;
    for(int i = 0; i < h; i++){
        string str;
        cin >> str;
        s.push_back(str);
    }

    vector<ll> p(s.size(),-1);
    vector<bool> sel(s.size(),false);


    if(s.size()%2 == 0){
        if(dfs(p,sel,s,0,s.size()/2,0)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }else{
        for(int i = 0; i < s.size(); i++){
            p[s.size()/2] = i;
            sel[i] = true;
            if(dfs(p,sel,s,0,s.size()/2,0)){
                cout << "YES" << endl;
                return 0;
            }
            sel[i] = false;
        }
        cout << "NO" << endl;
    }

    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    ll A, B;
    cin >> A >> B;

    if((A+B) % 2 == 0){
        cout << (A+B)/2 << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

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

int key(char a){
  if(a=='+'){
    return 1;
  }else{
    return -1;
  }
  return 0;
}

int main(){
  char a,b,c,d;
  int ans;
  ans=0;
  cin>>a>>b>>c>>d;
  ans+=key(a);
  ans+=key(b);
  ans+=key(c);
  ans+=key(d);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>
using namespace std;
typedef long long int lli;

// returns (最大値, 集合)
// 負の重みなし
pair<int, lli> weighted_max_indep_set(vector<lli> adj_bit, vector<int> weight){
    adj_bit.emplace_back();
    weight.emplace_back();
    int n = adj_bit.size();
    int half = n/2;
    lli halfmask = (1LL<<half) -1;
    // グラフと重みを２つに分割する
    vector<vector<int>> adj(2, vector<int>(half));
    vector<vector<int>> w(2, vector<int>(half));
    for(int i=0; i<half; i++){
        adj[0][i] = adj_bit[i] & halfmask;
        adj[1][i] = adj_bit[half+i] >> half;
        w[0][i] = weight[i];
        w[1][i] = weight[half+i];
    }
    vector<int> unusable(half, 0);
    for(int i=0; i<half; i++){
        unusable[i] = adj_bit[i] >> half;
    }
    // それぞれbitDPして全列挙
    vector<vector<int>> gain(2, vector<int>(1<<half, -1));
    gain[0][0] = gain[1][0] = 0;
    vector<int> cover(1<<half, 0);
    for(int i=0; i<(1<<half); i++){
        if(gain[0][i] == -1) continue;
        for(int j=0; j<half; j++){
            if(i>>j&1) continue;
            int next = i | (1<<j);
            cover[next] = cover[i] | unusable[j];
            if(i&adj[0][j]) continue;
            gain[0][next] = max(gain[0][next], gain[0][i]+w[0][j]);
        }
    }
    for(int i=0; i<(1<<half); i++){
        for(int j=0; j<half; j++){
            if(i>>j&1) continue;
            int next = i | (1<<j);
            if(i&adj[1][j]){
                gain[1][next] = max(gain[1][next], gain[1][i]);
            }else{
                gain[1][next] = max(gain[1][next], gain[1][i]+w[1][j]);
            }
        }
    }
    // 対応付け
    pair<int, lli> res(0, 0);
    for(int i=0; i<(1<<half); i++){
        if(gain[0][i] == -1) continue;
        int ok = cover[i]^halfmask;
        pair<lli, lli> sub(gain[0][i]+gain[1][ok], i | ((lli)ok<<half));
        if(sub.first > res.first){
            res = sub;
        }
    }
    return res;
}

int main(){
    while(1){
        int n;
        cin >> n;
        if(n == 0) break;
        
        vector<string> a(n);
        vector<int> b(n);
        vector<vector<string>> d(n);
        map<string, int> str2idx;
        for(int i=0; i<n; i++){
            int c;
            cin >> a[i] >> b[i] >> c;
            str2idx[a[i]] = i;
            d[i].resize(c);
            for(int j=0; j<c; j++){
                cin >> d[i][j];
            }
        }
        vector<long long int> adj(n);
        for(int i=0; i<n; i++){
            for(string s: d[i]){
                adj[i] |= 1LL<<str2idx[s];
            }
        }
        for(int i=1; i<n; i++){
            if(adj[0]>>i&1) b[i] = 0;
        }
        cout << weighted_max_indep_set(adj, b).first << endl;
    }
    return 0;
}


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

int main()
{
    long long t,n,m,i,j,k,x=0,y=0,z;
    cin>>n;
    long long a[n+5];
    if(n==1){
        cin>>m;
        cout<<m<<endl;
        return 0;
    }
    for(i=0;i<n;i++){
        cin>>a[i];
        if(i==0){
            x=a[i];
        }
        else{
            x=__gcd(x,a[i]);
        }

    }
    cout<<x<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
const int MAXN = 200001;
ll a[MAXN];

int main()
{
   // freopen("in.txt", "r", stdin);
    int k;
    cin >> k;
    for (int i = k - 1; i >= 0; i--)
        cin >> a[i];
    ll mn = 2, mx = 2;
    for (int i = 0; i < k; i++)
    {
        if ((mn - 1) / a[i] == mx / a[i])
        {
            cout << -1;
            return 0;
        }
        mn = (ll)((mn - 1) / a[i] + 1) * a[i];
        mx = (ll)(mx / a[i]) * a[i] + a[i] - 1;
    }
    cout << mn << " " << mx;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {
	double n, k;
	double ans = 0;

	cin >> n >> k;

	for (double i = 1; i <= n; i++) {
		double point = i,count=0;
		while (point < k) {
			point *= 2;
			count++;
		}
		ans += (1.0 / n) * pow(0.5, count);
	}

	printf("%.12f", ans);

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String[] d = sc.nextLine().split(" ");
            String month = d[1], day = d[2];
            if (d[1].length() == 1) {
                month = "0" + d[1];
            }
            if (d[2].length() == 1) {
                day = "0" + d[2];
            }
            int date = Integer.parseInt(d[0] + month + day);
            if (date >= 19890108) {
                System.out.println("heisei" + " " + (Integer.parseInt(d[0]) - 1988) + " " + d[1] + " " + d[2]);
            } else if (date >= 19261225) {
                System.out.println("showa" + " " + (Integer.parseInt(d[0]) - 1925) + " " + d[1] + " " + d[2]);
            } else if (date >= 19120730) {
                System.out.println("taisho" + " " + (Integer.parseInt(d[0]) - 1911) + " " + d[1] + " " + d[2]);
            } else if (date >= 18680908) {
                System.out.println("meiji" + " " + (Integer.parseInt(d[0]) - 1867) + " " + d[1] + " " + d[2]);
            } else {
                System.out.println("pre-meiji");
            }
        }
    }
}

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

//#define int long long
#define deb(x) cout << #x << " = " << x << endl
template <typename T> vector<T> readVector(int n) { vector<T> res(n); for (int i = 0 ; i < n ; i++) cin >> res[i]; return res; }

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int h, w, m;
    cin >> h >> w >> m;
    vector<int> hor(3e5 + 5, 0), ver(3e5 + 5, 0);

    set<pair<int, int>> st;

    for(int i=0; i<m; i++) {
        int x, y;
        cin >> x >> y;
        st.insert({x, y});
        hor[x]++;
        ver[y]++;
    }
    /// now i have hor and ver
    vector<int> mx_hor, mx_ver;
    int mx_h = 0, mx_v = 0;
    for(int i=0; i<hor.size(); i++) {
        if(hor[i] > mx_h) {
            mx_hor.clear();
            mx_hor.push_back(i);
            mx_h = hor[i];
        } else if(hor[i] == mx_h) {
            mx_hor.push_back(i);
        }
    }
    for(int i=0; i<ver.size(); i++) {
        if(ver[i] > mx_v) {
            mx_ver.clear();
            mx_ver.push_back(i);
            mx_v = ver[i];
        } else if(ver[i] == mx_v) {
            mx_ver.push_back(i);
        }
    }
    int ans = mx_h + mx_v;
    int one = 1;
    for(auto u: mx_hor) {
        for(auto v: mx_ver) {
            if(st.find({u, v}) == st.end()) {
                one = 0;
                break;
            }
        }
        if(one == 0) break;
    }
    cout << ans-one;
    return 0;
}


Measured memory_bytes: 23684
#include<stdio.h>
#include<string.h>
int main(void){
  int a,b;
  char s[10],t[10],u[10];
  scanf("%s %s",s,t);
  scanf("%d %d",&a,&b);
  scanf("%s",u);
  if(strcmp(s,u)==0){
    printf("%d %d",a-1,b);
  }else {
    printf("%d %d",a,b-1);
  }
  return 0;
}
  


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    //code goes 
	long a,b; 
	scanf("%ld %ld",&a,&b);  
	if(a==1 && b==1){
	    printf("1");
	    return 0;
	}
	if(a==1){
	    printf("%ld",b-2);
	    return 0; 
	}
	if(b==1){
	    printf("%ld",a-2);
	    return 0;
	}
	long ans = (a*b) - 2*(a+b) + 4;
	printf("%ld",ans);
	return 0;
}



Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int x[100000];
int maxn[100001];

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}
void ShowData(int x[],int left,int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	int sum = 0;
	scanf("%d", &x[0]);
	REPS(i, m-1) {
		scanf("%d", &x[i]);
	}
	QSort(x, 0, m - 1, 1);
	REPS(i, m - 1) {
		maxn[i] = x[i] - x[i - 1];
		//ShowData(maxn, 0, m - n + 1);
	}
	QSort(maxn, 0, m - 1, 0);
	int de = 0;
	REP(i, n - 1) {
		de += maxn[i];
	}
	PRINTD(x[m - 1] - x[0] - de);
}

Measured memory_bytes: 896
a = int(input())
h = list(map(int,input().split()))

max = 0
temp = 0
for i in range(1,a):
    if h[i] <= h[i - 1]:
        temp += 1
    else:
        if max < temp:
            max = temp
        temp = 0
if max < temp:
    max = temp
print(max)


Measured memory_bytes: 14252
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = list(s())
ans = 0
for i in range(len(N)):
    ans += int(N[i])
if int(''.join(N))%ans == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 77440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

struct UnionFind {
    UnionFind() {}
    UnionFind(int n) {
        resize(n);
    }
    
    void resize(int n) {
        par.resize(n, -1);
    }
    
    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }
    
    bool merge(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return false;
        if (par[rx] > par[ry]) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
        return true;
    }
    
    bool is_same(int x, int y) {
        return (root(x) == root(y));
    }
    
    int size(int x) {
        return -par[root(x)];
    }
    
private:
    vector<int> par;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i, m) {
        ll x, y, z;
        cin >> x >> y >> z;
        x--; y--;
        uf.merge(x, y);
    }
    set<ll> s;
    rep(i, n) s.insert(uf.root(i));
    cout << sz(s) << endl;
    return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  float l;
  cin>>l;
  float ans=(l*l*l)/27;
  cout<<fixed<<setprecision(15)<<ans;
  return 0;

}

Measured memory_bytes: 3788
N,A,B = map(int,input().split())
d = B-A
if d%2==0:
    print(d//2)
else:
    ans1 = A-1
    a = 1
    b = B-(A-1)
    if (b-a)%2==0:
        ans1 += (b-a)//2
    else:
        ans1 += 1 + (b-a)//2

    ans2 = N-B
    a = A+(N-B)
    b = N
    if (b-a)%2==0:
        ans2 += (b-a)//2
    else:
        ans2 += 1 + (b-a)//2
    print(min(ans1, ans2))

Measured memory_bytes: 3064
N = int(input())
t, x, y = 0, 0, 0
for _ in range(N):
    nt, nx, ny = map(int, input().split())
    if (nt-t)%2 != (nx-x+ny-y)%2 or (nt-t) < abs(nx-x) + abs(ny-y):
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 3060
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,m,a[10][10];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            char c;
            scanf(" %c",&c);
            if(c=='#')a[i][j]=1;
        }
    }
    for(int i=1,j=1;a[i][j];){
        a[i][j]=0;
        if(a[i+1][j])++i;
        else ++j;
    }
    bool ok=1;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j)if(a[i][j])ok=0;
    }
    if(ok)puts("Possible");
    else puts("Impossible");
    //system("pause");
    return 0;
}


Measured memory_bytes: 256
N = int(input())
n3 = N // 3
n5 = N // 5
n15 = N // 15
sum3 = 3*n3*(n3+1)//2
sum5 = 5*n5*(n5+1)//2
sum15 = 15*n15*(n15+1)//2
print(N*(N+1)//2 - sum3 - sum5 + sum15)

Measured memory_bytes: 9180
// youngjinp20
// 2020 03

#include <bits/stdc++.h>
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; }
#define byr(x) [](const auto& a, const auto& b) { return a.x > b.x; }
#define smax(a, b) ((a) < (b) ? ((a)=(b), true) : false)
#define smin(a, b) ((a) > (b) ? ((a)=(b), true) : false)
using namespace std;

typedef long long ll;

const int MOD = 1e9+7;
const int MAX = 101;
const int KAX = 1e5+1;
int N, K;
int a[MAX];
int dp[MAX][KAX];

int main() {
	cin >> N >> K;
	for (int i=1; i<=N; i++) {
		cin >> a[i];
	}

	dp[0][0] = 1;

	for (int i=1; i<=N; i++) {
		ll sum = 0;
		for (int j=0; j<=K; j++) {
			sum += dp[i-1][j];
			sum %= MOD;
			dp[i][j] += sum;
			dp[i][j] %= MOD;
			if (j-a[i] >= 0) {
				sum += MOD;
				sum -= dp[i-1][j-a[i]];
				sum %= MOD;
			}
		}
	}

	cout << dp[N][K];

	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    string s;
    cin >> s;
    map<char, int>mp;
    for (auto c : s)mp[c]++;
    cout << min(mp['0'], mp['1']) * 2 << endl;
    return 0;
}

Measured memory_bytes: 512
local n, m = io.read("*n", "*n")
local edge = {}
local asked = {}
for i = 1, n do
  edge[i] = {}
  asked[i] = false
end
for i = 1, m do
  local a, b = io.read("*n", "*n")
  edge[a][b], edge[b][a] = true, true
end

local pos1 = 1
local pos2 = next(edge[1])

local forward = {pos1}
local backward = {pos2}
asked[pos1], asked[pos2] = true, true
local hasdst = true
while hasdst do
  asked[pos1] = true
  hasdst = false
  for dst, _u in pairs(edge[pos1]) do
    if not asked[dst] then
      pos1 = dst
      table.insert(forward, dst)
      hasdst = true
      break
    end
  end
end
hasdst = true
while hasdst do
  asked[pos2] = true
  hasdst = false
  for dst, _u in pairs(edge[pos2]) do
    if not asked[dst] then
      pos2 = dst
      table.insert(backward, dst)
      hasdst = true
      break
    end
  end
end
for i = 1, math.floor(#backward / 2) do
  backward[i], backward[#backward + 1 - i] = backward[#backward + 1 - i], backward[i]
end
for i = 1, #forward do
  table.insert(backward, forward[i])
end
print(#backward)
print(table.concat(backward, " "))


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


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	lli N;
	cin >> N;

	if (N == 1)
		cout << "Hello World" << endl;
	else {
		lli a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());

            var count = 1;
            for(var i = 0; i < n; i++){
                if(count * 2 > count + k){
                    count += k;
                }else{
                    count *= 2;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		int[] s;
		while (n != 0 || k != 0) {
			s = new int[k];
			for (int i = 0; i < k; i++) {
				s[i] = in.nextInt();
			}
			boolean isYes = true;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < k; j++) {
					if (isYes) {
						s[j] -= in.nextInt();
						isYes = s[j] >= 0;
					} else {
						in.next();
					}
				}
			}
			System.out.println(isYes ? "Yes" : "No");
			n = in.nextInt();
			k = in.nextInt();
		}
	}
}

Measured memory_bytes: 12000
from collections import deque
class UnionFind:
    def __init__(self, N):
        self.parents = [-1 for i in range(N)]
        self.unit = [0 for i in range(N)]
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]
    
    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if x > y:
            x, y = y, x
            
        self.parents[x] += self.parents[y]
        self.parents[y] = x

N, M = map(int, input().split())
uf = UnionFind(N)


lists = [False for i in range(N)]
lists[0] = True
a = N - 1
dicts = {i:[] for i in range(N)}
d = deque([0])

for i in range(M):
    tmpa, tmpb = map(lambda x: int(x) - 1, input().split()) 
    dicts[tmpa] += [tmpb]
    dicts[tmpb] += [tmpa]
    uf.union(tmpa, tmpb)

if -uf.parents[0] == N:
    print('Yes')
    while a > 0:
        tmp = d.popleft()
        for i in dicts[tmp]:
            if not lists[i]:
                if tmp != 0:
                    lists[i] = tmp
                else:
                    lists[i] = -1
                d.append(i)
                a -= 1
    
    for i in range(1, N):
        print(lists[i] + 1 if lists[i] != -1 else 1)
else:
    print('No')


Measured memory_bytes: 104492
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef vector<int> vi;
const int mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,cnt=0;
    cin  >> n;
    vector<int> a;
    a.push_back(n);
    while(1){
        a.push_back((a[a.size()-1])%2==0?a[a.size()-1]/2:a[a.size()-1]*3+1);
        for(int i=0;i<a.size()-1;i++){
            if(a[i]==a[a.size()-1]){
                cout << cnt+2 << endl;
                return 0;
            }
        }
        cnt++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

int main(){
    ll N,temp,A,B,ans=0,amari=0;
    
    cin >> N >> A >> B;
    if(A==0) {
        cout << 0 << endl;
        return 0;
    }
    temp = N/(A+B);
    amari = N % (A+B);
    ans += A*temp;
    if(amari > A) ans += A;
    else ans += amari;
    cout << ans << endl;
}

Measured memory_bytes: 256
function Main(input) {
  var od = ['R', 'U', 'D'];
  var ev = ['L', 'U', 'D'];
  input = input.split('');
 
  var results = 'Yes';
  for (var i = 0; i < input.length; i++) {
    if (input[i] == 'U' || input[i] == 'D') {
      continue;
    }
    if (input[i] == 'R') {
      if ((i + 1) % 2 == 0) {
        results = 'No';
        break;
      }
    } else if (input[i] == 'L') {
      if ((i + 1) % 2 != 0) {
        results = 'No';
        break;
      }
      
    }
  }
  console.log(results);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){
  
  long long A,B,C,K;
  
  cin>>A>>B>>C>>K;
  
  long res = 0;
  
  int count = 0;
  
   for(int i = 0;i < K;i++){
      if(A>0){
      res++;
      A--;
      count++;
      }else{
        break;
      }
    }
  
  K -= count;
  count = 0;
 
      for(int i = 0;i < K;i++){
      if(B>0){
      B--;
      count++;
      }else{
        break;
      }
    }
  
K -= count;

    for(int i = 0;i < K;i++){
      if(C>0){
      res--;
      C--;
      }else{
        break;
      }
    }
  
  cout<<res;


	return 0;
}

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

const int MaxN = 1e5 + 6.66;
vector<pair<int, long long>> g[MaxN];
long long mark[MaxN];
bool mark2[MaxN];
long long mn[2];
vector<long long> odd_c;
int st_c;

int odd_cycle(int v = 1, int p = 0, int s = 1) {
  mark[v] = s;
  s = s % 2 + 1;
  for(auto x : g[v]) {
    if(x.first == p) continue;
    if(mark[x.first] == 0) {
      int z = odd_cycle(x.first, v, s);
      if(z != -1) {
        if(z) {
          odd_c.push_back(x.second);
          if(z == v) return 0;
        }
        return z;
      }
    } else if(mark[x.first] != s) {
      odd_c.push_back(x.second);
      st_c = x.first;
      return x.first;
    }
  }
  return -1;
}

bool check_dfs(int v, int val) {
  if(val <= 0) return false;
  mark[v] = val;
  for(auto x : g[v]) {
    if(mark[x.first]) {
      if(x.second != mark[x.first] + val) return false;
    } else if(!check_dfs(x.first, x.second - val)) return false;
  }
  return true;
}

bool bi_dfs(int v, long long val, bool sign) {
  mn[sign] = min(mn[sign], val);
  mark[v] = val;
  mark2[v] = true;
  for(auto x : g[v]) {
    if(mark2[x.first]) {
      if(x.second != mark[x.first] + val) return false;
      continue;
    }
    if(!bi_dfs(x.first, x.second - val, !sign)) return false;
  }
  return true;
}

int main() {
  int n, m; scanf("%d %d", &n, &m);
  for(int i = 0; i < m; i++) {
    int u, v; 
    long long w;
    scanf("%d %d %lld", &u, &v, &w);
    g[u].push_back({v, w});
    g[v].push_back({u, w});
  }
  if(~odd_cycle()) {
    long long sign = 1;
    long long sum = 0;
    for(auto x : odd_c) {
      sum += sign * x;
      sign *= -1;
    }
    memset(mark, 0, sizeof mark);
    printf("%d\n", sum % 2 == 0 && sum > 1 && check_dfs(st_c, sum / 2));
    return 0;
  }
  mn[0] = mn[1] = 15e15 + 7;
  memset(mark, 0, sizeof mark);
  if(!bi_dfs(1, 0, 0)) printf("0\n");
  else if(mn[1] <= 0 && mn[0] <= 0) printf("%d\n", 0);
  else printf("%lld\n", max(0LL, mn[1] + mn[0] - 1));
  return 0;
}


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

int n,a,b,t,ans=1;

int main()
{
    scanf("%d%d",&n,&a);
    for(int i=1;i<n;++i)
    {
	scanf("%d",&b);
	
	if(t){if((t==1&&a>b)||(t==2&&a<b))++ans,t=0;}
	else t=a==b?0:(a>b)+1;

	a=b;
    }

    printf("%d\n",ans);
    
    return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

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

gcd0 = a[0]
for i in range(1,n):
    gcd0 = gcd(gcd0, a[i])
    
maxi = int(gcd0**(1/2))
ans0 = []
for i in range(1, maxi+1):
    if gcd0%i == 0:
        x, y = i, gcd0//i
        ans0.append(x)
        ans0.append(y)
ans = list(set(ans0))
ans.sort()
for i in ans:
    print(i)



Measured memory_bytes: 5624
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
const int MAXN=1000;
char s[MAXN];
int main()
{
    scanf("%s",s+1);
    if(s[1]=='S'&&s[2]=='U')
        printf("7");
    if(s[1]=='M'&&s[2]=='O')
        printf("6");
    if(s[1]=='T'&&s[2]=='U')
        printf("5");
    if(s[1]=='W'&&s[2]=='E')
        printf("4");
    if(s[1]=='T'&&s[2]=='H')
        printf("3");
    if(s[1]=='F'&&s[2]=='R')
        printf("2");
    if(s[1]=='S'&&s[2]=='A')
        printf("1");


    return 0;
}

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

int power(int n)
{
    int ret = 1;
    int x = 2;
    while (n > 0)
    {
        if (n & 1)
        {
            ret *= x;
        }
        x *= x;
        n >>= 1;
    }
    return ret;
}
int f(int init, int k)
{
    int count = 0;
    while (init < k)
    {
        init <<= 1;
        count++;
    }
    return power(count);
}

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

    double ans = 0;
    for (int i = 1; i <= N; i++)
    {
        ans += 1. / (double)f(i, K) / (double)N;
    }

    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int main()
{
	double r;
	cin >> r;
	printf("%.10lf\n", 2.0 * 3.1415926535897932384 * r);
	return 0;
}

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

int main() {
    int n, a[110];
    cin >> n;
    for (int i=1; i<=n; i++){
        a[i-1] = i;
    }

    int max_count=0, max_index;
    int count;


    for(int j=0; j<n; j++){
        count = 0;

        while(true){
            if (a[j]%2==0){
                a[j] /= 2;
                count++;
            }
            else {
                break;
            }
            
        }
        if (max_count<count) {
            max_count = count;
            max_index = j+1;
        }
    }

    if (n==1) cout << 1 << endl;
    else{
    cout << max_index << endl;
    }

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    bool ok = true;
    for (int& nbr : g[i]) {
      if (h[i] <= h[nbr]) ok = false;
    }
    if (ok) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int mcxitonum(string s){
	int num = 0;
	char before = ' ';
	for (int i = 0;(unsigned) i < s.length(); i++){
		char now = s[i];
		int beforenum;
		if ('0' <= before && before <= '9'){
			beforenum = before - '0';
		}
		else{
			beforenum = 1;
		}
		if (now == 'm'){
			num += beforenum * 1000;
		}
		else if (now == 'c'){
			num += beforenum * 100;
		}
		else if (now == 'x'){
			num += beforenum * 10;
		}
		else if (now == 'i'){
			num += beforenum;
		}
		before = now;
	}
	return num;
}

string numtomcxi(int num){
	string s = "";
	stringstream ss;

	int m = num / 1000;
	if (m > 1){
		ss << m << "m";
		s += ss.str();
		ss.str("");
	}
	else if (m == 1){
		s += "m";
	}


	num = num % 1000;
	int c = num / 100;
	if (c > 1){
		ss << c << "c";
		s += ss.str();
		ss.str("");
	}
	else if (c == 1){
		s += "c";
	}

	num = num % 100;
	int x = num / 10;
	if (x > 1){
		ss << x << "x";
		s += ss.str();
		ss.str("");
	}
	else if (x == 1){
		s += "x";
	}

	num = num % 10;
	int i = num;
	if (i > 1){
		ss << i << "i";
		s += ss.str();
		ss.str("");
	}
	else if (i == 1){
		s += "i";
	}

	return s;

}


int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
	string s1, s2;
	cin >> s1 >> s2;
	cout << numtomcxi(mcxitonum(s1) + mcxitonum(s2)) << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mod 1000000007
#define vll vector<ll>
#define inf 1e18
#define pll pair<ll,ll>
#define ff first 
#define ss second 
#define PI acos(-1)
using namespace std;
ll n,k;
ll a[200005];
ll check(ll x)
{
	ll sum=0;
	for(ll i=1;i<=n;i++)
	{
		//if(a[i]>x)
		sum+=(ceil(1.0*(a[i])/x) -1);
	}
	if(sum<=k)return 1;
	return 0;
}
int main() 
{
    fastio; 
    ll T=1;
    //cin>>T; 
    while(T--)
    { 	
    	cin>>n>>k;
    	for(ll i=1;i<=n;i++)cin>>a[i];
    	ll lo=1,hi=*max_element(a+1,a+n+1);
    	while(lo<hi)
    	{
    		ll mid=(lo+hi)/2;
    		if(check(mid))
    		{
    			hi=mid;
			}
			else
			{
				lo=mid+1;
			}
		}
		cout<<hi<<endl;
	}
}
 

Measured memory_bytes: 5080
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,a[N];
ll sum1[N],sum2[N];
ll solve(int l1,int r1,int l2,int r2)
{
    if(l1<=0||l1>=r1||l2<=0||l2>=r2) return 1e18;
    //cout<<sum1[r1]<<' '<<sum1[l1]<<' '<<sum2[r2]<<' '<<sum2[l2]<<endl;
    return max(max(sum1[r1]-sum1[l1],sum1[l1]),max(sum2[r2]-sum2[l2],sum2[l2]))-min(min(sum1[r1]-sum1[l1],sum1[l1]),min(sum2[r2]-sum2[l2],sum2[l2]));
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum1[i]=sum1[i-1]+a[i],sum2[i]=a[i];
    reverse(sum2+1,sum2+1+n);
    for(int i=1;i<=n;i++) sum2[i]+=sum2[i-1];
    ll ans=1e18;
    for(int i=2;i<=n-2;i++)
    {
        int m=n-i;
        int pos1=lower_bound(sum1+1,sum1+1+i,sum1[i]/2)-sum1;
        int pos2=lower_bound(sum2+1,sum2+1+m,sum2[m]/2)-sum2;
        for(int j=pos1-1;j<=pos1+1;j++)
            for(int k=pos2-1;k<=pos2+1;k++)
            ans=min(ans,solve(j,i,k,m));
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 4096
#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++)
using ll = long long;
using P = pair<ll,ll>;
#define pb push_back
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/*
 string -> int : stoi(S);
 int -> string : to_string(N);
 Sのn文字以降をm文字取り出す : S.substr(n,m)
cout << fixed << setprecision(2) << 3.14 << endl; //3.1

 int: -2,147,483,648 ～ 2,147,483,647 (2×10^9)
 ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 (9×10^18)

*/

int main() {

  ll n, m, count=0, ans=0;
  string s;
 
  cin >> n >> s;

  int len = s.length();
  if(len <= n) cout << s << endl;
  else {
    s= s.substr(0,n);
    s+="...";
    cout << s << endl;
  }

}

Measured memory_bytes: 3632