akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int h, n;
vector<int> b;

int dp[10000][8];

int dfs(int i = 1, int bit = 0) {
  if (i == h) { // 最後まで来た場合
    return 0;
  }
  bit |= b[i]; // 置ける状況を取得

  int &ret = dp[i][bit]; // おける最大数、配列の中身を変えたいので参照取得
  if (~ret)
    return ret;  // 計算済みなら返す  retが-1だと~retは0となり計算するために次へ

  ret = 0;
  if (bit == 0) // 2つ置く場合
    ret = max(ret, dfs(i + 1, 0b111) + 2);
  if ((bit & (0b100)) == 0) // 左に置く場合
    ret = max(ret, dfs(i + 1, 0b110) + 1);
  if ((bit & (0b010)) == 0) // 中に置く場合
    ret = max(ret, dfs(i + 1, 0b111) + 1);
  if ((bit & (0b001)) == 0) // 右に置く場合
    ret = max(ret, dfs(i + 1, 0b011) + 1);
  ret = max(ret, dfs(i + 1, 0)); // 置かない場合

  // 5パターンの最大値がretに
  return ret;
}

int main() {
  memset(dp, -1, sizeof(dp));
  cin >> h >> n;

  // eiはそれぞれ x の値に対応するおけない箇所
  int ei[4] = {0b100, 0b110, 0b011, 0b001};
  b.assign(h + 1, 0);
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    // 置けなくなる箇所をパターンとして用意
    b[y + 1] |= ei[x];
    b[y] |= ei[x];
  }

  cout << dfs() << endl;
}


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

using namespace std;

int main(){
string s;
cin >> s;
if(s=="zyxwvutsrqponmlkjihgfedcba"){cout << -1; return 0;}
int a[26];
for(int i = 0;i<26;i++) a[i] = 0;
for(int i = 0;i<s.size();i++){
    a[s[i]-'a'] = 1;
}
for(int i = 0;i<26;i++){
    if(a[i]==0){
        cout << s << char(i+'a');
        return 0;
    }
}
string b = s;
//for(auto x : b) cout << x << ' ';
//cout << endl;
next_permutation(b.begin(),b.end());
//for(auto x : b) cout << x << ' ';
//cout << endl;
for(int i = 0;i<26;i++){
    if(b[i]==s[i]) cout << s[i];
    else{cout << b[i]; return 0;}
}


}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	
	int i ,a[31],b ;
	
	for(i=0;i<31;i++) a[i]=0;
	
	for(i=0;i<28;i++){
		cin >> b;
		a[b] = 1;
	}
	
	for(i=1;i<31;i++){
		if(a[i]==0) cout<< i<<endl;
	}
	
	
	
	
	return 0;
	
}
	

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define ll long long
#define PI 3.1415926535897932384626433832795l
#define MAX_NUM 1000000000000
using namespace std;
template <typename T>
inline T __lcm(T a, T b)
{
    return (a * b) / __gcd(a, b);
}


int a[1000006];
void solve()
{
    ll n;
    cin>>n;
    int temp=3;
    while(temp<=n)
    {
        a[temp]=1;
        temp+=3;
    }
    temp=5;
    while(temp<=n)
    {
        a[temp]=1;
        temp+=5;
    }
    ll sum=0;
    for(int i=0;i<=n;i++)
    {
        if(a[i]==0)
        {
            sum+=i;
        }
    }
    printf("%lld\n",sum);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("inputf.txt", "r", stdin);
    freopen("outputf.txt", "w", stdout);
#endif // ONLINE_JUDGE

    solve();
    return 0;
}


Measured memory_bytes: 7676
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll powmod(ll m, ll p) {
    if (p == 0) return 1;
    ll tmp = powmod(m, p / 2);
    if (p & 1) return (tmp * tmp % 2019) * m % 2019;
    else return (tmp * tmp % 2019); 
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = s.size();
    vll cnt(2020, 0);
    cnt[0] = 1;
    ll tmp = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        ll ppp = powmod(10, i) * (s[n - i - 1] - '0') % 2019;
        tmp = (tmp + ppp) % 2019;
        ans += cnt[tmp];
        cnt[tmp]++;
    }
    cout << ans << '\n';
    return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int H, W; cin >> H >> W;
    int h, w; cin >> h >> w;

    cout << (H - h) * (W - w) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

ll a, b, c, d;

ll gcd(ll a, ll b){
	if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(b, a%b);
}

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

ll cnt(ll n){
	return n-(n/c+n/d-n/lcm(c,d));
}

int main(){
	cin >> a >> b >> c >> d;
	cout << cnt(b)-cnt(a-1) << endl;
	return 0;
}

Measured memory_bytes: 256
a,b=input().split()
b=b[0]+b[2]+b[3]
length=len(a)
ans=0
for i in range(length):
    n=int(a[-i-1])*10**(i)
    for j in range(3):
        m=int(b[-j-1])*10**j
        ans+=n*m
print(ans//100)


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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

struct dice {
    mt19937 mt;
    dice() {
        random_device rd;
        mt = mt19937(rd());
    }
    int operator()(int x) { return this->operator()(0, x - 1); }
    int operator()(int x, int y) {
        uniform_int_distribution<int> dist(x, y);
        return dist(mt);
    }
} dc;

struct union_find {
    vector<int> v;
    union_find(int n) : v(n, -1) {}
    int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return;
        if (-v[x] < -v[y]) swap(x, y);
        v[x] += v[y]; v[y] = x;
    }
    bool root(int x) { return v[x] < 0; }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -v[find(x)]; }
};

void dfs_c(int u, vector<vector<int>>& a, vector<int>& c) {
    int N = a.size();
    rep(v, N) if (!a[u][v] && c[v] == -1) {
        c[v] = c[u];
        dfs_c(v, a, c);
    }
}

bool dfs(int u, vector<vector<int>>& a, vector<bool>& vis, vector<bool>& unko, vector<vector<int>>& b) {
    int N = a.size();
    if (vis[u]) return false;
    vis[u] = true;
    if (unko[u]) {
        unko[u] = false;
        return true;
    }
    rep(v, N) if (!a[u][v] && dfs(v, a, vis, unko, b)) {
        b[u][v] ^= 1;
        b[v][u] ^= 1;
        return true;
    }
    return false;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> a(N, vector<int>(N));
    while (M--) {
        int u, v; cin >> u >> v;
        a[u - 1][v - 1] = a[v - 1][u - 1] = true;
    }
    rep(t, 100) {
        vector<vector<int>> _a = a;
        union_find uf(N);
        rep(u, N) rep(v, N) if (a[u][v]) uf.unite(u, v);
        while (uf.size(0) < N) {
            int u = dc(N), v = dc(N);
            if (!uf.same(u, v)) {
                _a[u][v] = _a[v][u] = true;
                uf.unite(u, v);
            }
        }
        int K = 0;
        vector<int> c(N, -1);
        rep(u, N) if (c[u] == -1) {
            c[u] = K++;
            dfs_c(u, _a, c);
        }
        vector<int> deg(N);
        rep(u, N) rep(v, N) if (_a[u][v]) deg[u]++;
        vector<int> odd(K);
        rep(u, N) if (deg[u] % 2) odd[c[u]]++;
        bool ok = true;
        rep(k, K) if (odd[k] % 2) ok = false;
        if (!ok) continue;
        vector<bool> unko(N);
        rep(u, N) if (deg[u] % 2) unko[u] = true;
        vector<vector<int>> b(N, vector<int>(N));
        rep(u, N) if (unko[u]) {
            unko[u] = false;
            vector<bool> vis(N);
            dfs(u, _a, vis, unko, b);
        }
        vector<i_i> E;
        rep(u, N) for (int v = u + 1; v < N; v++) {
            if (!a[u][v] && _a[u][v]) E.pb(i_i{u, v});
            if (b[u][v]) E.pb(i_i{u, v});
        }
        cout << E.size() << endl;
        for (i_i e: E) {
            int u, v;
            tie(u, v) = e;
            cout << u + 1 << ' ' << v + 1 << endl;
        }
        return 0;
    }
    cout << -1 << endl;
}



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

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

int main()
{
	int N;
	while(cin >> N, N){
		int xma = 0, xmi = 0, yma = 0, ymi = 0;
		vector<int> x(N), y(N);
		for(int i = 1, n, d;i < N;i++){
			cin >> n >> d;
			x[i] = x[n] + dx[d];
			y[i] = y[n] + dy[d];
			xma = max(xma, x[i]);
			xmi = min(xmi, x[i]);
			yma = max(yma, y[i]);
			ymi = min(ymi, y[i]);
		}
		cout << (xma - xmi + 1) << ' ' << (yma - ymi + 1) << endl;
	}
	return 0;
}

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

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            switch (n) {
                case 25:
                Console.WriteLine("Christmas");
                break;
                case 24:
                    Console.WriteLine("Christmas Eve");
                    break;
                case 23:
                    Console.WriteLine("Christmas Eve Eve");
                    break;
                case 22:
                    Console.WriteLine("Christmas Eve Eve Eve");
                    break;

            }

        }
    }
}

Measured memory_bytes: 13140
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
#include <numeric>
#include <map>
#include <cmath>

using namespace std;


namespace mod {

template<class T, int M>
class MInt;

template<class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp);

template<class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n);

template<class T, int M>
class MInt {
  T n_;
public:
  MInt() : n_(0) {}
  MInt(T n) : n_((n % M + M) % M) {}

  MInt& operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }
  
  MInt& operator-=(const MInt &rhs) {
    n_ += M - rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt& operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % M;
    return *this;
  }

  MInt& operator/=(const MInt &rhs) {
    return (*this) *= Inv(rhs);
  }

  T Get() {
    return n_;
  }
};

template<class T, int M>
MInt<T, M> operator-(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res -= rhs;
}

template<class T, int M>
MInt<T, M> operator+(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res += rhs;
}

template<class T, int M>
MInt<T, M> operator*(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res *= rhs;
}

template<class T, int M>
MInt<T, M> operator/(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res /= rhs;
}

template<class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp) {
  if (exp == 0) {
    return 1;
  }
  
  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }
  
  return a;
}

template<class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n) {
  return Pow(n, static_cast<T>(M - 2));
}
}


const int m = 1e9+7;
using ll = long long;
using MInt = mod::MInt<ll, m>;
using PrimeFactors = map<int, int>;

int main(int argc, const char *argv[])
{
  int n;
  cin >> n;

  vector<int> a(n);
  vector<int> lcm_factors(pow(10, 6) * 2, 0);
  auto update_lcm = [&](int n) {
    int prime = 2;
    for (int prime = 2; prime * prime <= n; prime++) {
      int cnt = 0;
      while (n % prime == 0) {
        n /= prime;
        cnt++;
      }

      if (cnt > 0) {
        lcm_factors[prime] = max(lcm_factors[prime], cnt);
      }
    }

    lcm_factors[n] = max(lcm_factors[n], 1);
  };

  for (int i = 0; i < n; i++) {
    cin >> a[i];
    update_lcm(a[i]);
  }

  MInt a_lcm(1);
  for (int i = 1; i < lcm_factors.size(); i++) {
    a_lcm *= mod::Pow(MInt(i), static_cast<ll>(lcm_factors[i]));
  }
  
  MInt ans = accumulate(a.begin(), a.end(), MInt(0),
      [&](const auto &acc, int cur) { return acc + a_lcm / MInt(cur); });
  cout << ans.Get() << "\n";
  return 0;
}


Measured memory_bytes: 8064
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    string s, t;

    cin>>s>>t;

    int n = s.size(), m = t.size();

    int ans = 0, cnt;
    for(int i = 0; i <= n - m; i++) {
        cnt = 0;
        for(int j = i; j < i + m; j++) {
            if(s[j] == t[j-i])
                cnt++;
        }
        ans = max(ans, cnt);
    }

    cout<<m - ans<<endl;

    return 0;
}



Measured memory_bytes: 3656
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  ll n;
  cin >> n;
  string s;
  while(n>0){
    n = n-1;
    int k = n%26;
    s += char(k+97);
    n = n /26;
  }
  reverse(s.begin(),s.end());
  cout << s << endl;
}

Measured memory_bytes: 3612
import java.io.*;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String input = in.readLine();
		String[] size = input.split(" ");
		int length  = Integer.parseInt(size[0]);	
		int height  = Integer.parseInt(size[1]);	
		System.out.println(length*height + " " + (length*2+height*2));

	}

}

Measured memory_bytes: 16896
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    string x;
    cin >> x;
    int n = x.size();
    int ren = 0;
    int cnt = 0;
    REP(i,n){
        if(x[i]=='S'){
            ren++;
        }else{
            ren--;
        }
        chmin(cnt,ren);
    }
    put(-cnt*2);
    return 0;
}


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

int M[105][100005];
int A[105];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    int n, k;
    cin >> n >> k;

    for(int i = 0; i < n; i++)
        cin >> A[i];
    for(int i = 0; i <= A[0]; i++)
        M[0][i] = i+1;
    for(int i = A[0]+1; i <= k; i++)
        M[0][i] = M[0][A[0]];

    for(int i = 1; i < n; i++)
    {
        M[i][0] = 1;
        for(int j = 1; j <= k; j++)
        {
                M[i][j] = M[i][j-1];
                M[i][j] += (M[i-1][j] - (j - A[i] - 1 >= 0 ? M[i-1][j - A[i] - 1] : 0)) % 1000000007;
                M[i][j] %= 1000000007;
        }
    }
    cout << (M[n-1][k] - M[n-1][k-1] + 1000000007) % 1000000007;

    return 0;
}

Measured memory_bytes: 41344
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MOD=1e9+7;

int ad(int x,int y){
	return (x+y)%MOD;
}
int mi(int x,int y){
	return ((x-y)+MOD)%MOD;
}

int main(){
	int N;
	cin>>N;
	//ACGTが0123で、下3文字。
	int dp[101][4][4][4];
	
	rep(i,4)rep(j,4)rep(k,4)dp[3][i][j][k]=1;
	dp[3][0][2][1]=0;
	dp[3][2][0][1]=0;
	dp[3][0][1][2]=0;
	for(int x=4;x<=N;x++){
		rep(i,4)rep(j,4)rep(k,4){
			dp[x][i][j][k]=0;
			rep(l,4)dp[x][i][j][k]=ad(dp[x][i][j][k],dp[x-1][l][i][j]);
			if(i==0&&j==2&&k==1){
				rep(l,4)dp[x][i][j][k]=mi(dp[x][i][j][k],dp[x-1][l][i][j]);
			}
			if(i==2&&j==0&&k==1){
				rep(l,4)dp[x][i][j][k]=mi(dp[x][i][j][k],dp[x-1][l][i][j]);
			}
			if(i==0&&j==1&&k==2){
				rep(l,4)dp[x][i][j][k]=mi(dp[x][i][j][k],dp[x-1][l][i][j]);
			}
			if(i==2&&j!=0&&k==1){
				dp[x][i][j][k]=mi(dp[x][i][j][k],dp[x-1][0][i][j]);
			}
			if(i!=0&&j==2&&k==1){
				dp[x][i][j][k]=mi(dp[x][i][j][k],dp[x-1][0][i][j]);
			}
			if(i==2&&j==2&&k==1){
				dp[x][i][j][k]=ad(dp[x][i][j][k],dp[x-1][0][i][j]);
			}
        }
	}
	int ans=0;
	rep(i,4)rep(j,4)rep(k,4)ans=ad(ans,dp[N][i][j][k]);
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> point;

const double EPS = 1e-9;
double cross(point a,point b){
    return imag(conj(a)*b);
}

bool is_parallel(point a1,point a2,point b1,point b2){
    return abs(cross(a2-a1,b2-b1)) < EPS;
}

int main(){
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        vector<point> ps(4);
        for(int j=0;j<4;j++){
            cin >> ps[j].real() >> ps[j].imag();
        }
        if(is_parallel(ps[0],ps[1],ps[2],ps[3])){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1228
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.IO;
using System.Text;
using System.Diagnostics;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        long multitwo = 0;
        long multifour = 0;

        for(long i = 0; i < n; i++)
        {
            if (a[i] % 4 == 0)
            {
                multifour++;
            }
            else if(a[i] % 2 ==0)
            {
                multitwo++;
            }
        }

        if(multitwo + multifour * 2 >= n)
        {
            Console.WriteLine("Yes");
        }
        else if (multitwo == 0 && multifour * 2 + 1 >= n)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 22880
#include <iostream>
#include <array>

using namespace std;

int main()
{
    int a, b;
    
    while (cin >> a >> b)
    {
        int c = a + b;
        int digit = 0;
        while (c != 0)
        {
            c /= 10;
            digit++;
        }
        cout << digit << endl;
    }
    
    return 0;
}



Measured memory_bytes: 2972
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
#define rrep(i,n) for(int i = n-1; i >= 0 ; i--)
typedef long long ll;
constexpr auto INFI = 2147483647;
const ll INFL = 9223372036854775807;

int main(){
    int s, w;
    cin >> s >> w;
    cout << ((s > w) ? "safe" : "unsafe") << endl;
  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    int K;
    cin>>K;

    vector<int> nums {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout<<nums[K - 1]<<endl;
}

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

int main()
{
	int32_t N;
	cin >> N;

	vector<int32_t> a(N);
	for (int32_t i = 0; i < N; i++)
		cin >> a[i];

	vector<int32_t> power_of_2(29);
	for (int32_t i = 0; i < 29; i++)
		power_of_2[i] = 1 << (i + 1);

	int32_t res = 0;
	for (int32_t i = 0; i < N; i++) {
		for (int32_t j = 28; j >= 0; j--) {
			if (a[i] % power_of_2[j] == 0) {
				a[i] /= power_of_2[j];
				res += j + 1;
			}
		}
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 384
from collections import deque

N = int(input())
S = deque(list(input()))
count = 1
if len(S) == 1:
    print(1)
else:
    q = S.popleft()
    while (True):
        if q != S[0]:
            count += 1
        q = S.popleft()
        if len(S) == 0:
            break
    print(count)


Measured memory_bytes: 4920
n=input()
a=int(n[0])
b=int(n[1])
c=int(n[2])
d=int(n[3])
if a+b+c+d==7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a+b+c-d==7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
elif a+b-c-d==7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
elif a+b-c+d==7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a-b+c+d==7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a-b-c+d==7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a-b+c-d==7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
elif a-b-c-d==7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;

int main(){
    string s;
    cin >> s;
    int N=s.length();
    int imos[26][N];
    memset(imos,0,sizeof(imos));
    for(int i=0;i<N;i++){
        imos[(int)(s[i]-'a')][i]++;
    }
    for(int i=0;i<26;i++){
        int u=-10,v=-1;
        for(int j=0;j<N;j++){
            if(imos[i][j]==1){
                v=u;
                u=j;
                if(u-v<=2){
                    cout << v+1 << " " << u+1 << endl;
                    return 0;
                }
            }
        }
    }
    puts("-1 -1");
    return 0;
}

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

int n, a, k, ans = 0;

int main()
{
    scanf( "%d", &n ); 

    for( int i = 1; i <= n; i ++ )
    {
        scanf( "%d%d", &a, &k );
        
        while( a % k != 0 )
            a -= ( ( a % k - 1 ) / ( a / k + 1 ) + 1 ) * ( a / k + 1 );
        ans ^= a / k;
    }

    if( ans ) printf( "Takahashi\n" );
    else printf( "Aoki\n" );

    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    A = list(enumerate(map(int,input().split())))
    A.sort(key = lambda x:-x[1])

    left = list(range(-1,N + 2))
    right = list(range(1,N + 4))
    ans = 0
    for i,a in A:
        L = left[i]
        R = right[i]
        ans += a*(i - L)*(R - i)
        left[R] = L
        right[L] = R
    print(ans)
if __name__ == '__main__':
    main()

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

int main() {
    string s; cin >> s;
    int counter = 0;
    int ans = 0;
    for (int i=0; i<s.size(); i++) {
        switch(s[i]) {
            case 'A':
            case 'T':
            case 'G':
            case 'C':
                counter++;
                break;
            default:
                ans = max(ans, counter);
                counter = 0;
                break;
        }
    }
    cout << max(ans, counter) << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << ((a*b>c*d)?a*b:c*d) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k; cin >> n >> k;
  if((n+1)/2 >= k){
      cout << "YES" << endl;
  }else{
      cout << "NO" << endl;
  }

}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int S,h,m,s, T;
  scanf("%d",&S);
   
  h=S/3600;
  T=S%3600;
  m=T/60;
  s=T%60;
 
printf("%d:%d:%d\n",h,m,s);
 
return 0;
}


Measured memory_bytes: 2096
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
double PI=atan(1.)*4;
struct P{double x,y;
P(double t):x(cos(2*t*PI)),y(sin(2*t*PI)){}
P(){x=y=0;}
}p[40];
double memo[40][40][40];
int n;
double F(int rest,int k,int last,int i1)
{
	double &ans=memo[rest][k][last];
	if(ans>=0)
		return ans;
	//à¤SÆÁÄàÔÉíÈ¢æ@àµ­Íà¤æêÈ¢æ
	if(rest>n-k || !rest)
		return ans=0;
	//±Ì_Ìp
	return ans=std::max( F(rest-1,k+1,k,i1)+((p[k].y-p[i1].y)*(p[last].x-p[i1].x)-(p[last].y-p[i1].y)*(p[k].x-p[i1].x))/2,
		//ÌpµÈ¢
		F(rest,k+1,last,i1) );
}
int main()
{
	int m,i,j;
	double t;
	while(scanf("%d%d",&n,&m),n)
	{
		for(i=0;i<n;++i)
		{
			scanf("%lf",&t);
			p[i]=P(t);
		}
		t=0;
		for(i=0;i+1<n;++i)
		{
			memset(memo,192,sizeof(memo));
			for(j=i+1;j<n;++j)
				t=std::max(t,F(m-2,j+1,j,i));
		}
		printf("%f\n",t);
	}
	return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll a,b,c,d;cin>>a>>b>>c>>d;
  ll e=c*d/gcd(c,d);
  buf=c-a%c;
  if(buf==c)buf=0;
  ll x=((b-b%c)-(a+buf))/c+1;
  //out<<a-a%c spa b+buf spa buf<<endl;
  buf=d-a%d;
  if(buf==d)buf=0;
  ll y=((b-b%d)-(a+buf))/d+1;
  buf=e-a%e;
  if(buf==e)buf=0;
  ll z=((b-b%e)-(a+buf))/e+1;
  cout<<(b-a+1)-(x+y-z)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	ll cnt = 0;
	if (k == 0) return !printf("%lld", (ll)n*(ll)n);
	for (int i = k + 1; i <= n; i++)
	{
		int can = i - k;
		cnt += n / i * can;
		cnt += max(0, n - n / i * i - k + 1);
	}
	return !printf("%lld", cnt);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define pb push_back
using namespace std;

struct edge {
    int to,from,cost;
};

bool app[11];
const int INF = 10000000;
vector<edge> E;
int d[11];

int wf(int a){
    FOR(i,0,11)d[i]=10000000;
    d[a]=0;
    while(1){
        bool update=false;
        FOR(i,0,E.size()){
            edge&e=E[i];
            if(d[e.to]>d[e.from]+e.cost){
                update=1;
                d[e.to]=d[e.from]+e.cost;
            }
        }
        if(!update) break;
    }
    int sum=0;
    FOR(i,0,11){
        if(app[i]) sum+=d[i];
    }
    return sum;
}

int main(){
    int n;
    while(1){
        cin>>n;
        if(!n) break;
        E.clear();
        memset(app,0,sizeof(app));
        FOR(i,0,n){
            int a,b,c; cin>>a>>b>>c;
            E.pb({a,b,c});
            E.pb({b,a,c});
            app[a]=app[b]=1;
        }
        int ans=INF;
        int town;
        FOR(i,0,11){
            if(!app[i])continue;
            int t=wf(i);
            if(ans>t){
                ans=t;
                town=i;
            }
        }
        cout<<town<<" "<<ans<<endl;
    }
}

Measured memory_bytes: 1216
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
template<typename T> class segtree{
private:
    int n,sz;
    vector<T> node;
public:
    segtree(const vector<T>& v) : n(1), sz((int)v.size()){
        while(n < sz) n *= 2;
        node.resize(2*n-1, numeric_limits<T>::max());
        for(int i = 0; i < sz; i++){
            node[i+n-1] = v[i];
        }
        for(int i=n-2; i>=0; i--){
            node[i] = min(node[i*2+1], node[i*2+2]);
        }
    }
    void update(int k,T a){
        k += n-1;
        node[k] = a;
        while(k>0){
            k = (k-1)/2;
            node[k] = min(node[2*k+1],node[2*k+2]);
        }
    }
    T query(int a,int b,int k=0,int l=0,int r=-1){
        if(r < 0) r = n;
        if(r <= a || b <= l){
            return numeric_limits<T>::max();
        }
        if(a <= l && r <= b){
            return node[k];
        }else{
            T vl = query(a,b,2*k+1,l,(l+r)/2);
            T vr = query(a,b,2*k+2,(l+r)/2,r);
            return min(vl,vr);
        }
    }
    void print(){
        for(int i = 0; i < sz; i++){
            cout<<query(i,i+1)<< " ";
        }
        cout<<endl;
    }
};

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    vector<int> b(n),dp(n);
    rep(i,n) cin >> a[i];
    rep(i,n)b[i] = -a[i];
    rep(i,n){
        if(i==0)dp[i] = 1;
        else{
            if(a[i-1]<a[i]){
                dp[i] = dp[i-1]+1;
            }else{
                dp[i] = 1;
            }
        }
    }
    int same = 0;
    // for(int i=k-1;i<n;i++){
    //     if(dp[i]>=k){
    //         same++;
    //     }
    // }
    //cerr << same << endl;
    if(dp[k-1]>=k){
        same = 1;
    }
    int cnt = 1;
    segtree<int> sg(a),sg2(b);
    rep(i,n-k){//i~i+k-1 to i+1~i+k hikaku
        int p = sg.query(i,i+k+1);
        int q = -sg2.query(i,i+k+1);
        //cerr << i << " " <<i+k << " " << p << " " << q << endl;
        if(p!=a[i]||q!=a[i+k]){
            cnt++;
            if(dp[i+k]>=k){
                if(same>0){
                    cnt--;
                }else{
                    same++;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 6656
#include<stdio.h>

int main(void){
	int S;
	int h, m, s;
	scanf("%d", &S);
	h = S / 3600;
	S = S - (h * 3600);
	m = S / 60;
	S = S - (m * 60);
	s = S;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}

Measured memory_bytes: 2716
function main()
  
  n = parse(Int,readline())
  a = map(x -> parse(Int,x), split(readline()))
  
  b = []
  
  for i in 1:n
    if i % 2 == 1
      push!(b, a[i])
    else
      unshift!(b, a[i])
    end
  end
  
  if n % 2 == 1
    b = reverse(b)
  end
  
  for i in b
    print(i, " ")
  end
  
  println()
  
end

main()

Measured memory_bytes: 212288
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,a,b,c,d = f()
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input()

    has_2_consecu = 0
    for i in range(a+1, max(c,d)-1):
        if s[i]=='#' and s[i+1] == '#':
            has_2_consecu = 1
            break



    if has_2_consecu:
        print('No')
        return

    if d>c:
        print('Yes')
        return
    else:
        has_3_consecu = 0
        for i in range(b-1, d):
            if s[i]=='.' and s[i+1] == '.' and s[i+2]=='.':
                has_3_consecu = 1
                break
        
        if has_3_consecu:
            print('Yes')
            return
        
        if a+1 == b and s[b+1] == '.':
            print('Yes')
            return
    
    print('No')




solve()


Measured memory_bytes: 3636
#include <stdio.h>

void printRectangle(int h, int w) {
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
}

int main() {
    int h, w;

    while (1) {
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0) break;

        printRectangle(h, w);
    }
    return 0;
}


Measured memory_bytes: 2048
import java.util.*;
import java.util.stream.IntStream;
import java.io.*;

public class Main {

	void solve() {
		int n = in.nextInt();
		int m = in.nextInt();

		int[][] a = new int[n][n];
		for (int i = 0; i < m; i++) {
			int from = in.nextInt() - 1, to = in.nextInt() - 1, cost = in.nextInt();
			a[from][to] = a[to][from] = cost;
		}

		int[] cost = new int[1 << n];
		for (int i = 0; i < 1 << n; i++) {
			for (int x = 0; x < n; x++) {
				for (int y = x + 1; y < n; y++) {
					if ((i & (1 << x)) != 0 && (i & (1 << y)) != 0) {
						cost[i] += a[x][y];
					}
				}
			}
		}
		
		int[][] dp = new int[n][1 << n];
		int INF = Integer.MIN_VALUE / 2;
		for (int[] i : dp) {
			Arrays.fill(i, INF);
		}
		for (int mask = 0; mask < 1 << n; mask++) {
			if ((mask & 1) != 0 && (mask & (1 << (n - 1))) == 0) {
				dp[0][mask] = cost[mask];
			}
		}
		
		int[][] bits = new int[1 << n][];
		for (int i = 0; i < 1 << n; i++) {
			bits[i] = new int[Integer.bitCount(i)];
			int tmp = 0;
			for (int j = 0; j < n; j++) {
				if ((i & (1 << j)) != 0) {
					bits[i][tmp++] = j;
				}
			}
		}
		
		for (int mask = 1; mask < 1 << n; mask++) {
			for (int last = 0; last < n; last++) {
				if ((mask & (1 << last)) == 0) {
					continue;
				}
				int mx = INF;
				int andMask = mask ^ (1 << last);
				for (int submask = andMask; submask > 0; submask = (submask - 1) & andMask) {
					for (int prevLast : bits[submask]) {
						if ((submask & (1 << prevLast)) == 0) {
							continue;
						}
						if (a[last][prevLast] == 0) {
							continue;
						}
						
						int newCost = dp[prevLast][submask] + a[last][prevLast] + cost[mask ^ submask];
						if (newCost > mx) {
							mx = newCost;
						}
					}
				}
				dp[last][mask] = Math.max(dp[last][mask], mx);
			}
		}
		
		out.println(cost[(1 << n) - 1] - dp[n - 1][(1 << n) - 1]);
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 27780
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MOD 1000000007
#define MAXN 100005
void solve() {
    int n;
    cin >> n;
    int a[n];
    int sum = 0;
    for(int i=0;i<n;i++) {
        cin >> a[i];
        sum += a[i];
    }
    int sum1 = 0;
    int min = 100005;
    for(int i=0;i<n-1;i++) {
        sum1 += a[i];
        if(abs(sum1 - (sum - sum1)) < min)
            min = abs(sum1 - (sum - sum1));
    }
    cout << min << endl;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define Little 1
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,w=0,n=0,m=0,o=0;
  std::cin >> x;
  string s;
  map<string,int> map;
  rep(i,x){
    std::cin >> s;
    map[s]++;
  }
  std::cout << map.size() << '\n';
}


Measured memory_bytes: 19224
#include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

int main() {
  string s;
  cin >> s;
  int i=0;
while(i<3){
  if(s[i]=='7'){
    cout << "Yes";
    goto end;
  }
  i++;
}
  cout <<"No" ;
  end:
  return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(void)
{
	int a, b;

	scanf("%d %d", &a, &b);
	
	if (-1000 <= a && b <= 1000)
	{
		if (a < b)
		{
			printf("a < b\n");
		}
		else if (a > b)
		{
			printf("a > b\n");
		}
		else if (a == b)
		{
			printf("a == b\n");
		}

	}
	return 0;
}


Measured memory_bytes: 2072
#include <stdio.h>

typedef struct c{
  char e;
  int num;
  int m;
}C;

int Partition(C *,int,int );
void QuickSort(C *,int,int );

C A[100000];

main(){
  int n,i;
  char murata;

  scanf("%d%c",&n,&murata);

  for(i = 0 ; i < n;i++ ){
    scanf("%c %d%c",&A[i].e,&A[i].num,&murata);
    A[i].m = i;
  }

  QuickSort(A,0,n - 1);

  for(i = 0 ; i < n ; i++){
    if(A[i].num == A[i+1].num && A[i].m > A[i+1].m){
      printf("Not stable\n");
      break;
    }
  }

  if(i == n){
    printf("Stable\n");
  }

  for(i = 0;i < n ;i++){
    printf("%c %d\n",A[i].e,A[i].num);
  }

  return 0;


}

int Partition(C *A, int p,int r){
  int x,i,ch,j;
  char cchh;
  x = A[r].num;
  i = p - 1;
  for(j = p ; j < r ; j++){
    if(A[j].num <= x){
      i = i + 1;
      ch = A[i].num;
      cchh = A[i].e;
      A[i].num = A[j].num;
      A[i].e = A[j].e;
      A[j].num = ch;
      A[j].e = cchh; ch = A[i].m;
      A[i].m = A[j].m;
      A[j].m = ch;
    }
  }
  ch = A[i + 1].num;
  A[i + 1].num = A[r].num;
  A[r].num = ch;

  ch = A[i + 1].m;
  A[i + 1].m = A[r].m;
  A[r].m = ch;

  cchh = A[i + 1].e;
  A[i + 1].e = A[r].e;
  A[r].e = cchh;

  return i + 1;
}

void QuickSort(C *A, int p,int r){
  int q;
  if(p < r){
    q = Partition(A, p, r);
    QuickSort(A, p, q-1);
    QuickSort(A, q+1, r);
  }
}

Measured memory_bytes: 1780
//CODEFORCES:-
//coded by AMAN BHARTI NIT PATNA
//ALL RIGHTS RESERVED
//ECE 2K18
#include<bits/stdc++.h>
using namespace std;

//#define home
#define TASK "soln"
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define pb push_back
#define ll long long int
#define br cout<<endl;
#define fo for(int i=0;i<n;i++)
#define foo for(int i=1;i<=n;i++)
#define mod 1000000007


void solve(){
    ll n;
    cin>>n;
    ll a[n];
    fo{cin>>a[i];}
    ll sum =0;
    for(int i=1;i<n;i++){
        if(a[i]<a[i-1]){sum+=a[i-1]-a[i];a[i]=a[i-1];}
    }
    cout<<sum;
    br;
}

int main(){
	#ifdef home
        assert(freopen(TASK".in","r",stdin));
        assert(freopen(TASK".out","w",stdout));
    #endif

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    // int t;
    // cin>>t;
    // while(t-->0)
    solve();

    #ifdef home
        eprintf("Time: %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif

    return 0;
}

Measured memory_bytes: 5200
# -*- coding:utf-8 -*-

def main():
    while True:
        try:
            val=str(format(int(input()),'010b'))
            LIST=[2**(10-x) for x in range(10,0,-1) if val[x-1]=="1"]

            for i in LIST:
                print(i,end="")
                if LIST.index(i)==len(LIST)-1:
                    print("")
                else:
                    print(" ",end="")
        except:
            break

    
if __name__ == '__main__':
    main()

Measured memory_bytes: 7600
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	string bef;
	set<string>ans;
	cin >>n;
	rep(i,n){
		cin>>bef;
		ans.insert(bef);
	}
	cout<<ans.size()<<endl;
}

Measured memory_bytes: 19224
#include<bits/stdc++.h>
#include <iostream>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
//#define mod 1e9+7 // was not working
//const int mod=1e9+7; //works kool

vector<double>P(3000, 0.0);
vector<vector<double>>dp(3000,vector<double>(3000, 0.0));

int main() {
    fast;
    int N;
    cin>>N;
    
    
    for(int i=1;i<=N;i++)
       cin>>P[i];
    
    
    dp[0][0]=1.0;
    
    for(int i=1;i<=N;i++){
        for(int j=0;j<=i;j++){
            if(j==0)
                dp[i][j] = dp[i-1][j]*(1-P[i]);
            else{
                dp[i][j] = dp[i-1][j-1]*P[i] + dp[i-1][j]*(1-P[i]); //j heads till last coin so prob of tail here
            }
        }
    }

    double ans=0.0;
    
    for(int i=(N+1)/2;i<=N;i++)
        ans+=dp[N][i];
    
    printf("%.9f",ans);
    return 0;
}


Measured memory_bytes: 70784
#include<iostream>
using namespace std;
int main()
{
	string a;
	int s=1000,b=0;
	cin>>a;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]=='C')
{
if(i<s)
{
s=i;
}
}
		if(a[i]=='F')
{
if(i>b)
{
b=i;
}
}
	}
	if(s<b)
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
return 0;
}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll as(n);
  rep(i, n) { cin >> as[i]; }
  Sort(as);

  unordered_map<ll, ll> um;
  unordered_map<ll, bool> dupchk;
  vll chk(n, 0);
  ll ans = 0;
  rep(i, n) {
    if(dupchk.count(as[i]) == 0) dupchk[as[i]] = false;
    for (ll j = 1; j * j <= as[i]; j++) {
      if(as[i] % j == 0){
        if (um.count(j) != 0 || um.count(as[i]/j) != 0) {
          ans++;
          if(um.count(as[i]) != 0 && dupchk[as[i]] == false){
            ans++;
            dupchk[as[i]] = true;
          }
          dupchk[as[i]] = true;
          break;
        }
      }
    }  // j
    um[as[i]] = i;
  }  // i

  cout << n - ans << endl;

  return 0;
}


Measured memory_bytes: 22836