akhauriyash/Code-Regression huggingface dataset:
/*input
4
20 11 9 24
*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  vector<int> vec;
  int v, ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v;
    vec.pb(v);
    ans ^= v;
  }  
  for (int i = 0; i < n; i++) {
    vec[i] ^= ans;
  }
  out(vec);

  return 0;
}

Measured memory_bytes: 4284
//   __      __       .__           .____________                   __________        __ ________   __                 
//  /  \    /  \ ____ |_________  __| _\______   \__ __  ____  _____\______   \__ ___/  |\_____  \ |  | ______  ___.__.
//  \   \/\/   _/ __ \|  \_  __ \/ __ | |    |  _|  |  \/ ___\/  ___/|    |  _|  |  \   __/   |   \|  |/ \__  \<   |  |
//   \        /\  ___/|  ||  | \/ /_/ | |    |   |  |  / /_/  \___ \ |    |   |  |  /|  |/    |    |    < / __ \\___  |
//    \__/\  /  \___  |__||__|  \____ | |______  |____/\___  /____  >|______  |____/ |__|\_______  |__|_ (____  / ____|
//         \/       \/               \/        \/     /_____/     \/        \/                   \/     \/    \/\/     

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second

using namespace std;

void solve()
{
    ll n, m;
    cin >> n >> m;
    vector <ll> h(n + 1), val(n + 1, 1);
    for(ll i = 1; i <= n; i++)
        cin >> h[i];
    for(ll i = 0; i < m; i++)
    {
        ll u, v;
        cin >> u >> v;
        if(h[u] <= h[v])
            val[u] = 0;
        if(h[v] <= h[u])
            val[v] = 0;
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++)
        if(val[i])
            ans++;
    cout << ans << endl;
}

int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q = 1;
	//cin >> q;
	for(int i = 1; i <= q; i++)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 4744
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;
	rep(x, 1, 10001) {
		int a = x * 8 / 100;
		int b = x * 10 / 100;
		if (a == A && b == B) {
			cout << x << endl;
			return;
		}
	}
	cout << -1 << endl;
}







Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as V
--import Data.Array.IArray (listArray, accumArray, (!))
import Data.Array (Array, listArray, (!))
import Data.Array.MArray
import Data.Array.ST (STUArray, runSTUArray)
import Data.Array.Unboxed (UArray)
import Data.List (sortOn, sortBy, unfoldr, partition)
import Data.Char (isSpace)
import Control.Monad.ST (ST)
import Control.Monad.Trans.State (StateT(..))
import qualified Control.Monad.Cont as C
import qualified Data.ByteString.Char8 as B

import Debug.Trace (trace)

-- utility functions

--tr x = trace (show x) x
tr = id

--   Input functions
readInt = B.readInt . B.dropWhile isSpace

readInts :: Int -> B.ByteString -> [Int]
readInts n = take n . unfoldr readInt

readIntsV :: Int -> B.ByteString -> V.Vector Int
readIntsV n = V.unfoldrN n readInt

--readIntsA :: Int -> B.ByteString -> UArray Int Int
--readIntsA n bs = runSTUArray $ do
--  arr <- newArray_ (0,n-1)
--  go arr 0 bs
--  return arr
--  where
--    go :: STUArray s Int Int -> Int -> B.ByteString -> ST s ()
--    go arr i bs
--      | i==n = return ()
--      | otherwise = do
--        let Just (x,bs') = readInt bs
--        writeArray arr i x
--        go arr (i+1) bs'

readTsV :: Int -> B.ByteString -> V.Vector (Int,Int)
readTsV n = V.unfoldrN n $ runStateT ((,) <$> StateT readInt <*> StateT readInt)

readTs :: Int -> B.ByteString -> [(Int,Int)]
readTs n = take n . unfoldr readT where
  readT = runStateT ((,) <$> StateT readInt <*> StateT readInt)

dp :: (Array Int Int -> Int -> Int) -> Int -> Int
dp f n = result ! n where
  result = listArray (0,n) $ map nth [0..]
  nth i = f result (tr i)

-- main

amount = [1,6,36,216,1296,7776,46656,9,81,729,6561,59049]

solv n = dp f n where
  f t 0 = 0
  f t i = 1 + minimum [t!j| a<-amount, let j=i-a, j>=0]

main = do
  n <- read <$> getLine
  print $ solv n


Measured memory_bytes: 41084
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    
    int n, k;
    cin >> n >> k;
    ld p[n];
    rep(i,n) cin >> p[i];

    ld sum[n];
    sum[0] = p[0];
    for (int i=1; i < n; i++){
        sum[i] = sum[i-1] + p[i];
    }

    ld max = sum[k-1];
    for (int i=0; i < n - k; i++){
        if (max < sum[i+k] - sum[i]) max = sum[i+k] - sum[i];
    }

    printf("%.15Lf\n", (max+k)/2);
    

    

}





//              g++ -std=c++1z


Measured memory_bytes: 6528
#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(int x) {
  if(x == 2) return true;

  if(x < 2 || x % 2 == 0) return false;

  int i = 3;
  while(i <= sqrt(x)) {
	if(x % i == 0) return false;
	i += 2;
  }
  return true;
}
int main() {
  int i, n, num, cnt = 0;
  cin >> n;
  for(i = 0; i < n; i++) {
	cin >> num;
	if(isPrime(num)) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  string S;
  cin >> S;
  int N = S.size();
  int log_N = floor(log2(N));
  ll K = 10000000000;
  ll log_K = floor(log2(K));
  // cerr << N << " " << log_K << endl;
  vector<vector<int>> parent(log_K + 1, vector<int>(N));
 
  for(int i = 0; i < N; i++){
    if(S[i] == 'L'){
      parent.at(0).at(i) = i-1;
    } else { 
      parent.at(0).at(i) = i+1;
    }
  }
 
  for(int k = 0; k < log_K; k++){
    for(int i = 0; i < N; i++){
      if(parent[k][i] == -1){
        parent[k+1][i] = -1;
      } else { 
        parent[k+1][i] = parent[k][parent[k][i]];
        // cerr << k+1 << " " << i << " " << parent[k+1][i] << endl;
      }
    }
  }

  vector<int> v_ans(N,0);
  for(int i = 0; i < N; i++){
    // K個上
    int ans = i;
    for(ll k = log_K; k >= 0; k--){
      if((K>>k)&1){
        ans = parent[k][ans];
      }
    }
    v_ans[ans]++;
  }
  
  
  for(int i = 0; i < N; i++){
    if(i == N-1){
      cout << v_ans[i] << endl;
    } else {
      cout << v_ans[i] << " ";
    }
  }
}


Measured memory_bytes: 14328
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
template<typename T, int N, T F(const T& a, const T& b)>
struct SegTree
{
public:
    SegTree()
    {
        dat = vector<T>(N * 2 - 1, 0);
    }

    void update(int i, T x)
    {
        i += N - 1;
        dat[i] = x;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = F(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = N)
    {
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return dat[k];
        else
        {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(vl, vr);
        }
    }

    vector<T> dat;
};

/*------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
------------------------------------------------------------------------------*/











//------------------------------------------------------------------------------
const unsigned MOD = 1000000007;
int N; string S[2];
//------------------------------------------------------------------------------
void _main()
{
     cin >> N >> S[0] >> S[1];
 
    unsigned ans = 1;
    int x = 0;
    int pre = -1;
    while (x < N)
    {
        if (S[0][x] == S[1][x])
        {
            if (pre < 0) ans = 3;
            else if (pre == 0) ans *= 2;
            else ans *= 1;
            x++; pre = 0;
        }
        else
        {
            if (pre < 0) ans = 6;
            else if (pre == 0) ans *= 2;
            else ans *= 3;
            x += 2; pre = 1;
        }
        ans %= MOD;
    }
 
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  string X;
  rep(i,a){
    X += (char)('0' + b);
  }
  string Y;
  rep(i,b){
    Y += (char)('0' + a);
  }

  if(X < Y) cout << X << endl;
  else cout << Y << endl;
  
  return 0;
}



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

int main(){
  int N,K,x,a;
  cin >> N >> K;
  for(int i = 0; i < N; i++)
  {
    cin >> x;
  if(x < (K-x)) a += x*2;
  	else a += (K-x)*2;
  }
      
  cout << a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, m;
    cin >> n >> m;
    vector<int> ans(n), cnt(n, 1);
    ans[0] = 1;
    rep(i, m) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        if (ans[x]) ans[y] = 1;
        cnt[x]--;
        cnt[y]++;
        if (!cnt[x]) ans[x] = 0;
    }
    cout << accumulate(all(ans), 0) << endl;
}


Measured memory_bytes: 3992
#include <vector>

template<typename T>
struct fenwick_tree {
    int n;
    std::vector<T> data;
    fenwick_tree(int n) : n(n), data(n + 1, 0) {}
    void add(int i, T x) { for (i++; i <= n; i += i & -i) { data[i] += x; }}
    T get_sum(int i) const {
        T ret = 0;
        for (; i > 0; i -= i & -i) { ret += data[i]; }
        return ret;
    }
    T get_sum(int l, int r) const {
        return get_sum(r) - get_sum(l);
    }
};

template<typename T>
struct fenwick_tree_range {
    fenwick_tree<T> ft;
    fenwick_tree_range(int n) : ft(fenwick_tree<T>(n)) {}
    void add(int l, int r, T x) { ft.add(l, x), ft.add(r, -x); }
    T operator[](int i) const { return ft.get_sum(i + 1); }
};

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

int main() {
    int n, q;
    cin >> n >> q;
    fenwick_tree_range<int> ft(n);
    for (int i = 0; i < q; i++) {
        int com;
        cin >> com;
        if (com == 0) {
            int s, t, x;
            cin >> s >> t >> x;
            s--, t--;
            ft.add(s, t + 1, x);
        } else if (com == 1) {
            int i;
            cin >> i;
            i--;
            cout << ft[i] << endl;
        }
    }
}


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

int keta(int N){
  int counter = 1;
  while(N/10 > 0){
    N /= 10;
    counter ++;
  }
  return counter;
}

int beki(int x, int n){
  int res = 1;
  while(n > 0){
    if(n & 1) res *= x;
    x = x * x;
    n >>= 1;
  }
  return res;
}

int main(){
  int A, B;
  cin >> A >> B;
  string S;
  cin >> S;
  bool flag = true;
  int ssize = S.size();
  for(int i = 0; i < ssize; i++){
    if(i == A){
      if(S.at(i) != '-') flag = false;
    }
    else{
      if(S.at(i) < '0' || S.at(i) > '9') flag = false;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

char ss[100000+10];
char ts[100000+10];
vector<int> occurs[30];

ll solve(void) {
  int sLen = strlen(ss);
  int tLen = strlen(ts);
  REP(i, sLen) {
    occurs[ss[i]-'a'].push_back(i);
  }
  ll res = 0;
  REP(i, tLen) {
    int c = ts[i] - 'a';
    if(occurs[c].empty()) {
      return -1;
    }
    int cur = res % sLen;
    auto it = lower_bound(occurs[c].begin(), occurs[c].end(), cur);
    if(it == occurs[c].end()) {
      res += sLen-cur;
      res += *occurs[c].begin() + 1;
    } else {
      res += *it - cur + 1;
    }
  }
  return res;
}

int main(void) {
  scanf("%s%s", ss, ts);
  ll res = solve();
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1148
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n; readV(n);
  int[] a; readA(n, a);

  auto n1 = 0, n2 = 0, n3 = 0;
  foreach (ai; a) {
    if (ai%4 == 0)      ++n1;
    else if (ai%2 == 0) ++n2;
    else                ++n3;
  }

  writeln(n2 == 0 && n3 <= n1+1 || n2 > 0 && n3 <= n1 ? "Yes" : "No");
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define all(z) z.begin(),z.end()
#define mcc ((int)1e9+7)
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> fst;

const int N=1e5+7;
int dp[N][3],ar[N][3],n;

void solve()
{
    cin>>n;
	for (int i=0;i<n;i++)
	{
		cin>>ar[i][0]>>ar[i][1]>>ar[i][2];
	}
	memcpy(dp[0],ar[0],sizeof(ar[0]));
	for (int i=1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+ar[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+ar[i][1];
		dp[i][2]=max(dp[i-1][1],dp[i-1][0])+ar[i][2];
	}
	cout<<*max_element(dp[n-1],dp[n-1]+3)<<endl;
}

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 2560
fn main() {
    let (s, t) = input();
    println!("{}", solve(&s, &t));
}

fn input() -> (String, String) {
    let mut buf1 = String::new();
    let mut buf2 = String::new();
    std::io::stdin().read_line(&mut buf1).unwrap();
    std::io::stdin().read_line(&mut buf2).unwrap();
    buf1.pop();
    buf2.pop();
    (buf1, buf2)
}

fn solve(s: &str, t: &str) -> String {
    if t.len() - s.len() != 1 { return String::from("No"); }
    let s_vec = s.as_bytes().to_vec();
    let t_vec = t.as_bytes().to_vec();
    for i in (0..s.len()) {
        if s_vec[i] != t_vec[i] { return String::from("No"); }
    }
    String::from("Yes")
}

#[cfg(test)]
mod tests {
    #[test]
    fn test_solve() {
        assert_eq!(super::solve("chokudai", "chokudaiz"), String::from("Yes"));
    }
}

Measured memory_bytes: 2120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		boolean yellow = false;
		int n = scan.nextInt();
		String s = scan.nextLine();
		s = scan.nextLine();
		if (s.contains("Y")) {
			yellow = true;
		}
		if (yellow) {
			System.out.println("Four");
			return;
		} else {
			System.out.println("Three");
			return;
		}
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF=(1LL<<60);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
	init();
	ll A,B,C;cin>>A>>B>>C;
	if(A==B)cout<<C<<endl;
	if(A==C)cout<<B<<endl;
	if(B==C)cout<<A<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt()-1;
    int B = sc.nextInt()-1;
    int C = sc.nextInt()-1;
    int D = sc.nextInt()-1;
    String S = sc.next();
    boolean twoRock = false;
    for (int i = 1; i < N; i++) {
      if (A < i && i < Math.max(C, D)
          && S.charAt(i-1) == '#'
          && S.charAt(i) == '#') {
        twoRock = true;
      }
    }
    if (twoRock) {
      System.out.println("No");
      return;
    }
    if (C < D) {
      System.out.println("Yes");
      return;
    }
    
    boolean overtake = false;
    for (int i = 1; i < N-1; i++) {
      if (B <= i && i <= D && i+1 <= C
          && S.charAt(i-1) == '.'
          && S.charAt(i) == '.'
          && S.charAt(i+1) == '.') {
        overtake = true;
      }
    }
    System.out.println(overtake ? "Yes" : "No");
  }
}

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

using namespace std;

int main()
{
    int n,a,b,t=0;
    vector<int> l;
    cin >> a >> b >> n;
    int gcd;
    gcd =__gcd(a,b);
    for(int i=gcd; i>=1; i--)
    {
        if(gcd%i==0)
        {
            t++;
        }
        if(gcd%i==0 && t==n)
        {
            cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
/*小文字判定
if((moji>= 'a') && (moji<='z')){
    printf("a\n");
    return 0;
  }
  */

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	int a[210000],b,c,n,i;

scanf("%d",&n);
	if(n>=30){
    printf("Yes\n");
      return 0;
    }
  printf("No");
	
return 0;
}


Measured memory_bytes: 1724
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;
 
namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var a = ReadStringNext();
            var b = ReadStringNext();
            var c = ReadStringNext();
            var ans = a[a.Length - 1] == b[0] && b[b.Length - 1] == c[0] ? "YES" : "NO";
            Console.WriteLine($"{ans}");
        }
    }
 
    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
 
        public static string[] Buffer = new string[] { };
        public static int Index;
        public static string ReadStringNext()
        {
            if (Buffer.Length == 0 || Buffer.Length <= Index - 1)
            {
                Buffer = ReadStringArray();
                Index = 0;
            }
            return Buffer[Index++];
        }
 
        public static int ReadNextInt()
        {
            return int.Parse(ReadStringNext());
        }
    }
}

Measured memory_bytes: 13140
# coding: utf-8

import fractions

(n,x) = map(int, input().rstrip().split(" "))

x_list = list(map(int, input().rstrip().split(" ")))

current = abs(x-x_list[0])
for i in range(1,n):
    current = fractions.gcd(current, abs(x-x_list[i]))

print(current)

Measured memory_bytes: 16280
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    SORT(a);
    int sum = 0;
    rep(i, n)
    {
        sum += a[i];
    }
    cout << sum - a.back() / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int count=0,i=0,flag=0;
  int H[10000],W[10000];
  while(true){
    cin >> H[i] >> W[i];
    if(H[i]==0 && W[i]==0)
      break;
    count++;
    i++;
    }
  for(int l=0;l<count;l++){
    for(int k=0;k<H[l];k++){
      flag=k%2;
      for(int j=0;j<W[l];j++){
        if(flag==0){
          printf("#");
          flag=1;
        }
        else{
          printf(".");
          flag=0;
        }
      }
      printf("\n");
     }
    printf("\n");
  }
  return 0;
}


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

template<typename T>
struct BITs{
    int n;
    vector<T> v1,v2;
    BITs(const int n_) : n(n_) , v1(n_+1 , T(0)) , v2(n_+1 , T(0)) {};
    void add(const int l,const int r,const T x){//区間加算
        if(l==r){subadd(l,x,2);return;}
        subadd(l,x,1);
        subadd(r+1,-x,1);
        subadd(l,-x*(l-1),2);
        subadd(r+1,x*r,2);
        return;
    }
    void subadd(const int i,const T x,const int k){
        for(int idx=i;idx<=n;idx+=(idx & -idx)){
            if(k==1)v1[idx]+=x;
            else v2[idx]+=x;
        }
    }
    T sum(const int l,const int r)const{
        return subsum(r)-subsum(l-1);
    }
    T subsum(const int i)const{
        T res(0);
        for(int idx=i;idx>0;idx -= (idx & -idx)){
            res+=v1[idx]*i+v2[idx];
        }
        return res;
    }
};

int main(){
    int n;ll d,a;cin >> n >> d >> a;
    vector<pair<ll,ll>> z(n);
    rep(i,n)cin >> z[i].first >> z[i].second;
    sort(z.begin(),z.end());
    vector<ll> x(n),h(n);
    rep(i,n){
        x[i]=z[i].first;
        h[i]=z[i].second;
    }

    vector<ll> cango(n);//cango[i]:=xがx[i]+2*d以内の最小のindex
    rep(i,n){
        int idx=distance(x.begin(),upper_bound(x.begin()+i,x.end(),x[i]+2*d));
        cango[i]=idx-1;
    }

    //ここから1-indexedに注意
    BITs<ll> ans(n);
    rep(i,n)ans.add(i+1,i+1,h[i]);

    ll cnt=0;
    rep(i,n){
        ll nowh=ans.sum(i+1,i+1);
        if(nowh<=0)continue;
        nowh=(nowh+a-1)/a;
        cnt+=nowh;
        ans.add(i+1,cango[i]+1,-a*nowh);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 14304
S = input()
if S == 'SUN':
  print(7)
elif S  == 'MON':
  print(6)
elif S == 'TUE':
  print(5)
elif S == 'WED':
  print(4)
elif S == 'THU':
  print(3)
elif S == 'FRI':
  print(2)
elif S == 'SAT':
  print(1)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int N=3e5+10;
int f[N]; // f[i]: frequency of number i
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
 	int n;
 	cin >> n;
 	REP(i,n) {
 		int a;
 		cin >> a;
 		--a;
 		f[a]++;
 	}
 	sort(f,f+n);
 	vector<int> s(n+1,0);
 	REP(i,n) s[i+1]=s[i]+f[i];
 	// O(nlognlogn):
 	// n: 1->n
 	// logn: for every k find max remove steps by bsearch
 	// logn: bsearch check  
 	for(int k=1; k<=n; k++) {
		int l=0,r=n+1;
		while(r-l>1) {
			int x=(l+r)/2;
			bool ok=[&] {
				int i=lower_bound(f,f+n,x)-f;
				int tot=(n-i)*x + s[i];
				return (LL)tot>=(LL)x*k; // 一次取k個 取x次 所需總共數量
			}();
			if(ok) l=x; else r=x;
		}
		cout << l << '\n';
 	}

    return 0;
}

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

#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back;

/** Dateloper */


using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>A(n),B;
    int maxx=0,pos=0;
    for(int i=1;i<=n;i++)
       {
        cin>>A[i];
        B.push_back(A[i]);
       }
       sort(B.begin(),B.end());
    for(int i=1;i<=n;i++)
    {
        if(A[i]!=B[n-1])
            cout<<B[n-1]<<endl;
        else cout<<B[n-2]<<endl;
    }
    return 0;
}



Measured memory_bytes: 3316
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = int64_t;

int main() {
  double a, b, h, m;
  cin >> a >> b >> h >> m;

  double ra = (h / 12.0 + m / 60.0 / 12.0) * 360.0;
  double rb = m / 60.0 * 360.0;
  double r = min(fabs(ra - rb), fabs(360.0 + rb - ra)) * acos(-1) / 180.0;

  cout << fixed << setprecision(10) << sqrt(a * a + b * b - 2 * a * b * cos(r))
       << endl;
  return 0;
}


Measured memory_bytes: 4252
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

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

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

ll modpow(ll a, ll b, ll mod) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

ll modinv(ll a, ll mod) {
    return modpow(a, mod - 2, mod);
}
ll p(ll a, ll mod) {
    ll res = 1;
    FOR(i, 1, a + 1) {
        res *= modinv(i, mod);
        res %= mod;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);


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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};

signed main() {
	ll x;
	scanf("%lld", &x);
	ll ans = (x / 11)*2;
	if ((x % 11) > 6) {
		ans += 2;
	}
	else if((x % 11))
		ans++;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n,k,h=0;cin>>n>>k;
    string s;cin>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='R'){
            if(i==n-1)continue;
            else if(s[i+1]=='R')h++;
        }
        else{
            if(i==0)continue;
            else if(s[i-1]=='L')h++;
        }
    }
    cout<<min(n-1,h+k*2)<<endl;
}


Measured memory_bytes: 3744
#pragma region template 1.2
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    ll N, K;
    cin >> N >> K;
    vi h(N);
    REP(i, N)
    {
        cin >> h[i];
    }

    vi dp(N, INF);
    dp[0] = 0;
    REP1(i, N - 1)
    {
        REP1(j, min(i, K))
        {
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
        }
    }
    ll ans = dp[N - 1];
    OUT(ans);
}

Measured memory_bytes: 1792
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 200010

using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
long long int MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int H,W,K;
int grid[900][900];
bool used[900][900];
int ans;
int sx,sy;
void bfs(int stx,int sty){
	queue<pair<int,pii> > Qs;//cost,zahyo
	Qs.push(mp(0,mp(stx,sty)));
	while(1){
		if(Qs.empty())break;
		pair<int,pii> now=Qs.front();
		Qs.pop();
		
		int dist=now.first,x=now.second.first,y=now.second.second;
		if(used[x][y])continue;
		used[x][y]=true;
		//cout<<x<<" "<<y<<endl;
		int hoge=min(min(x,H-1-x),min(y,W-1-y));
		ans=min(ans,(hoge+K-1)/K+1);
		if(dist==K)continue;
		for(int i=0;i<4;i++){
			int nx=x+dx[i],ny=y+dy[i];
			if(nx>=0&&nx<H&&ny>=0&&ny<W){
				if(grid[nx][ny]==0)Qs.push(mp(dist+1,mp(nx,ny)));
			}
		}
	}
}
int main(){
	cin>>H>>W>>K;
	for(int i=0;i<H;i++){
		string str;
		cin>>str;
		for(int j=0;j<W;j++){
			used[i][j]=false;
			if(str[j]=='#'){
				grid[i][j]=1;
			}else if(str[j]=='.'){
				grid[i][j]=0;
			}else{
				sx=i;sy=j;
				grid[i][j]=0;
			}

		}
	}
	ans=H*W+1;
	bfs(sx,sy);
	/*for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(used[i][j])cout<<1<<" ";
			else cout<<0<<" ";
		}
		cout<<endl;
	}*/
	cout<<ans<<endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using p = pair<int,int>;

int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  vector<int>ans(n);
  rep(i,n) ans[i] = i + 1;
  
  int A, B;
  int count = 0;
 
  do{
    count++;
    if(a == ans) A = count;
    if(b == ans) B = count;
  }while(next_permutation(all(ans)));
  
  cout << abs(A-B) << endl ;
  
  return 0;
}

Measured memory_bytes: 256
/***********************************************
#
#      Filename: C.cpp
#
#        Author: Comsyl - ylsong15@fudan.edu.cn
#   Description: ---
#        Create: 2017-06-09 19:05:37
***********************************************/
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N;
    cin >> N;
    auto v = vector<int>();
    int x;
    for (int i = 0; i < N; ++ i) {
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    int ans = accumulate(v.begin(), v.end(), 0);
    if (ans % 10) {
        cout << ans << endl;
    } else {
        x = -1;
        for (int i = 0; i < v.size(); ++ i) {
            if (v[i] % 10) {
                x = v[i];
                break;
            }
        }
        if (x == -1) {
            cout << 0 << endl;
        } else {
            cout << ans - x << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  ll n, m, x;
  cin >> n >> m >> x;

  vector<vector<ll>> algo(n, vector<ll>(m, 0)); vector<ll> books(n);
  rep(i, n) {
      cin >> books[i];
      rep(j, m) {
          cin >> algo[i][j];
      }
  }
  
  ll ans = 1e9;
  for (ll bit = 0; bit < (1 << n); bit++)
  {
      /* code */
      vector<ll> S;
      rep(j, n) {
          if (bit & (1 << j))
          {
              /* code */
              S.push_back(j);
              ll count = 0;  
              rep(k, m) {
                  ll sum = 0; ll book_sum = 0;
                  rep(l, S.size()) {
                      sum += algo[S[l]][k];
                      book_sum += books[S[l]];
                  }
                  if (sum < x) break;
                  count++;
                  if (count == m) ans = min(book_sum, ans);
              }
            //   cout << ans << endl;
          }
      }
  }
  cout << ((ans == 1e9) ? -1 : ans) << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
int h[300000];
int w[300000];
int main(){
  int H;
  int W;
  int M;
  cin >> H >> W >> M;

  for(int i = 0; i < M; i++){
    cin >> h[i] >> w[i];
  }

  map <int, int> h_count;
  map <int, int> w_count;

  for(int i = 0; i < M; i++){
    if(h_count.find(h[i]) != h_count.end()){
      h_count[h[i]] ++;
    } else {
      h_count[h[i]] = 1;
    }

    if(w_count.find(w[i]) != w_count.end()){
      w_count[w[i]] ++;
    } else {
      w_count[w[i]] = 1;
    }
  }

  int max_h_count = 0;
  int max_w_count = 0;
  for(auto it = h_count.begin(); it != h_count.end(); it++){
    max_h_count = max(max_h_count, it->second);
  } 
  for(auto it = w_count.begin(); it != w_count.end(); it++){
    max_w_count = max(max_w_count, it->second);
  }

  int ans = max_h_count + max_w_count - 1;
  set <int> max_h_set;
  for(auto it = h_count.begin(); it != h_count.end(); it++){
    if(it->second == max_h_count){
      max_h_set.insert(it->first);
    }
  }

  set <int> max_w_set;
  for(auto it = w_count.begin(); it != w_count.end(); it++){
    if(it->second == max_w_count){
      max_w_set.insert(it->first);
    }
  }

  int cross_count = 0;
  for(int i = 0; i < M; i++){
    if(max_h_set.find(h[i]) != max_h_set.end() && max_w_set.find(w[i]) != max_w_set.end()){
      cross_count ++;
    }
  }

  if(cross_count < max_h_set.size() * max_w_set.size()){
    cout << max_h_count + max_w_count << endl;
  } else {
    cout << max_h_count + max_w_count - 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 62192
S=input()
if S=="SUN":
    print(7)
elif S=="MON":
    print(6)
elif S=="TUE":
    print(5)
elif S=="WED":
    print(4)
elif S=="THU":
    print(3)
elif S=="FRI":
    print(2)
else:
    print(1)

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

#define pb push_back
#define all(a) (a).begin(), (a).end()

using ll = long long;
using pii = pair<int, int>;

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    string s; cin >> s;
    bool val = (s[2] == s[3] && s[4] == s[5]);
    cout << (val ? "Yes" : "No");
}

Measured memory_bytes: 256
function main (input) {
  var inputs = input.split("\n");
  var number = inputs[0];
  var count = 1;
  var students = inputs[1].split(" ").map(elm => {
    return {id: count++, numofpeople: elm};
  });
  
  //console.log(students, number);
  students.sort((a,b) => {
    return a.numofpeople - b.numofpeople;
  });
  //console.log(students, number);

  console.log(students.map (elm => {return elm.id}).join(" "));
     
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 36136
#include <stdio.h>

int main(){
   char input[101] = {0};
   char first,final,number;

   scanf("%s",input);

   for(char i = 0;i < 101;i++){
      if(input[i] == NULL){
         number = i ;
         break;
      }
   }

   first = input[0];
   final = input[--number];
   number--;

   printf("%c%d%c\n",first,number,final);

   return 0;
}

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

int main()
{
    ll a, b, f=10, c, x, n, i, y=0;
    cin >> a >> b;
    n = b;
    while(1)
    {
        if(b/10!=0)
        {
            f = f*10;
            b = b/10;
        }
        else
        {
            break;
        }
    }
    c = ((a*f) + n);
    for(i=1;i<=10000;i++)
    {
        if(c==(i*i))
        {
            y = 1;
            break;
        }
    }
    if(y==0)
    {
        cout << "No\n";
    }
    else if(y==1)
    {
        cout << "Yes\n";
    }
    return 0;
}

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

// Preparing for IOI 2018

using namespace std;

const int inf = (int) 1e9 + 7;
const int N = (int) 1e6 + 7;
const double PI = 3.141592653589793238462643;
const double eps = 0.000000001;

#define ok puts("OK");
#define ll long long
#define fr first
#define sc second
#define eb emplace_back
#define pb push_back
#define sz(s) ((int)s.size())
#define all(s) s.begin(), s.end()

inline void solve () {                  
	ll q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	ll ans = 1e18;
	ll one = min(q * 4, min(h * 2, s));
	if (n & 1) {            
		ans = ((n - 1) / 2 * d) + one;
	} else {
		ans = n / 2 * d;
	}
	ans = min(ans, n * one);
	cout << ans;
}

int test = 1;

main () {
        // freopen("example.in", "r", stdin); freopen("example.out", "w', stdout);
        // scanf ("%d", &test);
        while (test--) {
                solve();
        }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
char a[105][105];
int n, m;
void dfs(int i,int j)
{
	char s = a[i][j];
	a[i][j] = '.';
	if (a[i + 1][j] == s&&i + 1 < n)
		dfs(i + 1, j);
	if (a[i][j + 1] == s&&j + 1 < m)
		dfs(i, j + 1);
	if (a[i][j - 1] == s&&j - 1 >= 0)
		dfs(i, j - 1);
	if (a[i - 1][j] == s&&i - 1 >= 0)
		dfs(i - 1, j);
}
int main(void)
{

	while (cin >> n >> m)
	{
		int temp = 0;
		if (!n && !m)
			break;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				cin >> a[i][j];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if (a[i][j] != '.')
				{
					dfs(i, j);
					temp++;
				}
		cout << temp << endl;
	}
}

Measured memory_bytes: 3784
def main():
    n = int(input())
    p = list(map(int, input().split()))
    loop = n - 3 + 1
    count = 0
    for i in range(loop):
        if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]:
            count += 1
    print(count)
main()  

Measured memory_bytes: 9108