akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
int a,b;
int main()
{
	a=read();b=read();
	pr2(max(max(a+b,a-b),a*b));
	return 0;
}


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

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n = 0, m = 0;
    scanf("%d %d", &n, &m);
    long long int ans = 0;
    ans += (n * (n - 1))/2;
    ans += (m * (m - 1))/2;

    printf("%lld", ans);
    
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    
    int a,b,k;
    cin>>a>>b>>k;
    
    for(int i=a;i<=b;i++){
        
        if(i<a+k || b-k<i){
            cout<<i<<endl;
        }
            
        
    }
    
    
    
    
    
    return 0;
}








Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include "set"
#include "map"
#include "unordered_map"
#include <string>
#include <iomanip>
#include <numeric>
#include "cmath"

using namespace std;
#define double long double
#define int long long
#define all(a) a.begin(), a.end()
const int N=1e5+50;
vector<int> g[N];
bool vis[N];

void dfs(int node){
    vis[node]=true;

    for(auto to: g[node]){
        if(!vis[to])
            dfs(to);
    }
}

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



    int n, m; cin>>n>>m;

    for(int i=0; i<m; i++){
        int u, v; cin>>u>>v;

        g[u].push_back(v);
        g[v].push_back(u);
    }

    int cnt=0;

    for(int i=1; i<=n; i++){
        if (!vis[i])
            dfs(i), cnt++;
    }


    cout<<cnt-1<<'\n';


}

Measured memory_bytes: 10428
#include <stdio.h>

int main(){
  int a, b, c, k;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  int ans=0;
  if(a>=k) {
    printf("%d",k);
    return 0;
  }else if(a+b>=k){
    printf("%d",a);
    return 0;
  }else{
    printf("%d",a-(k-(a+b)));
    return 0;
  }
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

// π M_PI
// deg = rad*180/M_PI

int main() {
    string s;
    cin >> s;
    std::vector<char> v;
    rep(i, s.size()) {
        v.push_back(s[i]);
    }
    ll q;
    cin >> q;
    ll num[q];
    ll f[q];
    char c[q];

    rep(i, q) {
        cin >> num[i];
        if ( num[i] == 2 ) {
            cin >> f[i] >> c[i];
        }
    }

    ll top = 0;
    rep(i, q) {
        if ( num[i] == 1 ) {
            top = !top;
        } else {
            if (top) {
                if ( f[i] == 1 ) {
                    s.insert(s.end(), c[i]);
                } else {
                    s.insert(s.begin(), c[i]);
                }
            } else {
                if ( f[i] == 1 ) {
                    s.insert(s.begin(), c[i]);
                } else {
                    s.insert(s.end(), c[i]);
                }
            }
        }
    }

    if (top) {
        reverse(ALL(s));
    }

    cout << s << endl;
    return 0;
}


Measured memory_bytes: 4420
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
if len(set(a)) == n:
    print('YES')
else:
    print('NO')


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

// 最大公約数
int gcd(int m, int n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;
	
	// ユークリッドの方法
	while(m != n)
	{
		if (m > n) m = m - n;
		else       n = n - m;
	}
	return m;
}//gcd

// 最小公倍数
int lcm(int m, int n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm


int main(){

    int a, b;
   
    while(scanf("%d %d", &a, &b) != -1) {
        if(200000000 < a || 200000000 < b){
            exit(0);
        }
        printf("%d %d\n", gcd(a, b), lcm(a, b));
    }
    return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000000
#define MAX 200001
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
const int MX = 1000005;

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    int ans = 0;
    for(int i = 0; i < s.size(); i++){
        if(cnt == 0){
            if(s[i] == 'p') ans--;
            cnt++;
        }
        else{
            if(s[i] == 'g') ans++;
            cnt--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

template <size_t N>
struct Solver
{
    bool is_prime[N + 1];
    int ans[N + 1];
    constexpr Solver() : is_prime(), ans()
    {
        is_prime[0] = false;
        is_prime[1] = false;
        for (size_t i = 2; i <= N; i++)
        {
            is_prime[i] = true;
        }
        for (size_t prime = 2; prime <= N; prime++)
        {
            if (is_prime[prime])
            {
                for (size_t q = prime * 2; q <= N; q += prime)
                {
                    is_prime[q] = false;
                }
            }
        }
        for (size_t i = 1; i <= N; i++)
        {
            ans[i] += ans[i - 1];
            if (is_prime[i] && is_prime[(i + 1) / 2])
            {
                ans[i] += 1;
            }
        }
    }
};

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

    constexpr auto M = 100000;
    constexpr auto solver = Solver<M>();
    int Q;
    cin >> Q;
    for (size_t i = 0; i < Q; i++)
    {
        int l, r;
        cin >> l >> r;
        auto ans = solver.ans[r] - solver.ans[l - 1];
        cout << ans << '\n';
    }
}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <string>
#include <type_traits>
using namespace std;

#define INF 1e18
#define int long long

bool palindrome(string s) {
    string t = s;
    reverse(t.begin(), t.end());
    return s == t;
}

signed main() {
    string s; cin >> s;

    int ans = 0;
    int l = 0;
    int r = s.size() - 1;
    while(l < r) {
        if(s[l] != 'x' && s[r] != 'x' && s[l] != s[r]) {
            cout << -1 << endl;
            return 0;
        }
        if(s[l] == s[r]) {
            l++; r--;
        } else if(s[l] != 'x') {
            r--; ans++;
        } else {
            l++; ans++;
        }
    }

    cout << ans << endl;
    return 0;
}


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


ll INF = 100100100100100100;
int main()
{
    // input
    int n;
    int w;
    cin >> n >> w;
    vector<int> weights(n+1);
    vector<int> values (n+1);

    ll max_value_sum=0;
    ll max_weight_sum=0;
    rep(i, n){
        cin >> weights[i+1];// weight
        cin >> values[i+1]; // values
        max_value_sum += values[i+1];
        max_weight_sum += weights[i+1];
    }

    // dp
    vector<vector<ll>> dp (n+1, vector<ll>(max_value_sum+1));
    rep(i,n+1) rep(v, max_value_sum+1) dp[i][v] = INF;

    dp[0][0] = 0;
    
    for (int i=0; i<n; i++){
        for(ll v=0; v<=max_value_sum; v++){
            if(values[i+1] <= v) dp[i+1][v] = min(dp[i][v], dp[i][v-values[i+1]]+weights[i+1]);
            else dp[i+1][v] = dp[i][v];
        }
    }

    // output
    ll ans = 0;
    for(ll v=0; v<=max_value_sum; v++){
        if(dp[n][v] <= w){
            ans = max(ans, (ll)v);
        }
    }

    cout << ans << endl;
    return 0;
}

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

int main() {

    ll x; cin >> x;
    ll tmp = 100;
    ll year = 0;
    if (x <= tmp) cout << 0 << endl;
    while (tmp < x) {
        tmp += tmp / 100;
        year++;
    }
    cout << year << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

void showTable( vector<vector<int>> table ){
  int n = table.size();
  int m = table.front().size();
  rep(i,n){
    rep(j,m){
      cout << table[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}

int main(){
  int n,m; cin >> n >> m;
  vector<int> a(m), b(m), c(m,0);

  rep(i,m){
    cin >> a[i] >> b[i];
    rep(j,b[i]){
      int tmp;
      cin >> tmp;
      tmp--;
      c[i] += pow(2,tmp);
    }
  }

  int st_n = pow(2,n);
  vector<vector<int>> dp(st_n, vector<int>(m+1, inf));
  dp[0][0] = 0;
  
  rep(i,st_n){
    rep(j,m){
      if(j != 0) dp[i][j] = min(dp[i][j-1], dp[i][j]);
      dp[i|c[j]][j+1] = min(min(dp[i|c[j]][j], dp[i][j]+a[j]), dp[i|c[j]][j+1]);
      //showTable(dp);
    }
  }

  if(dp.back().back() == inf) cout << -1 << endl;
  else cout << dp.back().back() << endl;

}


Measured memory_bytes: 16384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;
const int MOD = 1000000007;
signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int K,T;cin >> K >> T;
    vector<int> A(T);REP(i,T) cin >> A[i];
    sort ALL(A);reverse ALL(A);
    int N = 0,M = 0;
    N += A[0];
    REPP(i,1,T){
        M += A[i];
        if(N - M < 0) swap(N,M);
    }
    cout << max(N - M - 1,0) << endl;
}

Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    to = [[None]*(n+1) for _ in range(60)]
    to[0] = [None] + a[:]
    tio = to[0]
    for i in range(1, 60):
        ti = to[i]
        for j in range(1, n+1):
            ti[j] = tio[tio[j]]
        tio = ti
        to[i] = ti[:]
    ans = 1
    for i in range(59, -1, -1):
        num = 1<<i
        if num <= k:
            ans = to[i][ans]
            k -= num
    print(ans)
        

if __name__ == "__main__":
    main()

Measured memory_bytes: 226052
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 50;
const int ININF = 1000000;
using pint = pair<int, int>;
using Edge = pair<long long, pint>; //<cost,<u,v>>の形
vector<Edge> edges;
int Nokaburi(string t, int k1, int k2) {
    if(t == "AB") {
        if(k1 == 0 || k1 == 1) {
            return k1;
        } else if(k2 == 0 || k2 == 1) {
            return k2;
        }
    } else if(t == "BC") {
        if(k1 == 1 || k1 == 2) {
            return k1;
        } else if(k2 == 1 || k2 == 2) {
            return k2;
        }
    } else {
        if(k1 == 0 || k1 == 2) {
            return k1;
        } else if(k2 == 0 || k2 == 2) {
            return k2;
        }
    }
    return k1;
}
string out(int n) {
    if(n == 0) {
        return "A";
    } else if(n == 1) {
        return "B";
    } else {
        return "C";
    }
}
int main() {
    int N;
    long long a, b, c;
    cin >> N >> a >> b >> c;
    vector<string> q(N);
    rep(i, 0, N) { cin >> q[i]; }
    vector<string> res(N);
    vector<int> t(3);
    t[0] = a;
    t[1] = b;
    t[2] = c;

    rep(i, 0, N) {
        int k1, k2, k3;
        int pl = 0;
        int mi = 0;
        if(q[i] == "AB") {
            k1 = 0;
            k2 = 1;
            k3 = 2;
        } else if(q[i] == "BC") {
            k1 = 1;
            k2 = 2;
            k3 = 0;
        } else {
            k1 = 0;
            k2 = 2;
            k3 = 1;
        }
        if(t[k1] == t[k2] && t[k1] == 0) {
            cout << "No" << endl;
            return 0;
        }
        if(t[k1] == 0) {
            pl = k1;
            mi = k2;
        } else if(t[k2] == 0) {
            pl = k2;
            mi = k1;
        } else {
            if(t[k1] == 1 && t[k2] == 1) {
                if(i != N - 1) {
                    pl = Nokaburi(q[i + 1], k1, k2);
                    if(k1 == pl) {
                        mi = k2;
                    } else {
                        mi = k1;
                    }
                } else {
                    pl = k1;
                    mi = k2;
                }
            } else if(t[k1] == 1) {
                pl = k1;
                mi = k2;
            } else if(t[k2] == 1) {
                pl = k2;
                mi = k1;
            } else {
                pl = k1;
                mi = k2;
            }
        }
        t[pl]++;
        t[mi]--;
        // cout << out(pl) << endl;
        // cout << t[0] << "," << t[1] << "," << t[2] << endl;
        res[i] = out(pl);
    }
    cout << "Yes" << endl;
    rep(i, 0, N) { cout << res[i] << endl; }
}


Measured memory_bytes: 9600
#define DEBUG 0
/**
 * File    : B.cpp
 * Author  : Kazune Takahashi
 * Created : 6/11/2019, 7:10:24 PM
 * Powered by Visual Studio Code
 */
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
typedef long long ll;
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}
void No()
{
  cout << "No" << endl;
  exit(0);
}
const int MAX_SIZE = 1000010;
class mint
{
public:
  static ll MOD;
  ll x;
  mint() : x(0) {}
  mint(ll x) : x(x % MOD) {}
  mint operator-() const { return mint(0) - *this; }
  mint &operator+=(const mint &a)
  {
    if ((x += a.x) >= MOD)
    {
      x -= MOD;
    }
    return *this;
  }
  mint &operator-=(const mint &a) { return *this += -a; }
  mint &operator*=(const mint &a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint &operator/=(const mint &a) { return (*this *= power(MOD - 2)); }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  bool operator<(const mint &a) const { return x < a.x; }
  bool operator==(const mint &a) const { return x == a.x; }
  const mint power(ll N)
  {
    if (N == 0)
    {
      return 1;
    }
    else if (N % 2 == 1)
    {
      return *this * power(N - 1);
    }
    else
    {
      mint half = power(N / 2);
      return half * half;
    }
  }
};
ll mint::MOD = 1e9 + 7;
istream &operator>>(istream &stream, mint &a) { return stream >> a.x; }
ostream &operator<<(ostream &stream, const mint &a) { return stream << a.x; }
mint inv[MAX_SIZE];
mint fact[MAX_SIZE];
mint factinv[MAX_SIZE];
void init()
{
  inv[1] = 1;
  for (int i = 2; i < MAX_SIZE; i++)
  {
    inv[i] = (-inv[mint::MOD % i]) * (mint::MOD / i);
  }
  fact[0] = factinv[0] = 1;
  for (int i = 1; i < MAX_SIZE; i++)
  {
    fact[i] = mint(i) * fact[i - 1];
    factinv[i] = inv[i] * factinv[i - 1];
  }
}
mint choose(int n, int k)
{
  if (n >= 0 && k >= 0 && n - k >= 0)
  {
    return fact[n] * factinv[k] * factinv[n - k];
  }
  return 0;
}
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// const double epsilon = 1e-10;
// const ll infty = 1000000000000000LL;
// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

int N;
int W[110];
int sum = 0;

int main()
{
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> W[i];
    sum += W[i];
  }
  int t = 0;
  int ans = abs(sum - t - t);
  for (auto i = 0; i < N; i++)
  {
    t += W[i];
    ans = mins(ans, abs(sum - t - t));
  }
  cout << ans << endl;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define INPUT()              freopen("input.txt", "r", stdin)
    #define OUTPUT()             freopen("output.txt", "w", stdout)
    #define F                    first
    #define S                    second
//Templatefunctions
    template<typename T>T gcd(T x, T y) { if (y == 0)return x; else return gcd(y, x%y);}
    template <class T> T euclideanDistance(T x1 , T x2 , T y1 , T y2){return sqrt(( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ));}
    template <class T> T digitSum(T n){T sum = 0;while(n > 0)sum += n % 10,n /= 10;return sum;}
//datatypes
    typedef long long int ll;
    typedef unsigned long long int ull;
    typedef long double ld;
//constants
    const double INF = 1e+9;
    const double INFLL = 1e+18;
    const double EPS = 1e-9;
    const double PI = acos(-1);
    const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
           //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
           //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
    const int dx[] = {0 , 1 , 0 , -1};
    const int dy[] = {1 , 0 , -1 , 0};
//helpers
    //#define MOD         1000000007LL
    #define MAX         2000005
    const ll MOD = 1000000000 + 7;
    //int arr[10000005];
    char str[MAX+10];
//Global Variables
    int dp[MAX],n;
    std::map<int,int>::iterator it;
    int ans;
    int main()
    {
//        int t;
//        scanf("%d",&t);
//        int x = 2;
//        while(t--)
//        {
//        }
        ll n , k;
        scanf("%lld%lld",&n,&k);

        for(int i = 0 ;i < n ; i++)
        {
            scanf("%d",&dp[i]);
        }
        vector<int> m,d;
        for(int i = 0 ; i < n  ; i++)
        {
            int cnt = 0;
            for(int j = i+1 ; j < n ; j++)
            {
                if(dp[j] < dp[i])cnt++;
            }
            m.push_back(cnt);
            cnt = 0;
            for(int j = 0 ; j < i ; j++)
            {
                if(dp[j] < dp[i])cnt++;
            }
            d.push_back(cnt);
        }
        ll ans = 0;
        ll temp = (k * (k+1))/2L;
        temp -= k;
        temp = temp%MOD;
        //printf("temp-%lld\n",temp);
        for(int i = 0 ; i < n ; i++)
        {
            ans += ((temp+k)*m[i])%MOD;
            ans += (temp*d[i])%MOD;
        }
        printf("%lld\n",ans%MOD);
    }
//


Measured memory_bytes: 256
import collections
n = int(input())
ss = [input() for _ in range(n)]
ctr = collections.Counter(ss)
print('%s x %d' % ('AC', ctr['AC']))
print('%s x %d' % ('WA', ctr['WA']))
print('%s x %d' % ('TLE', ctr['TLE']))
print('%s x %d' % ('RE', ctr['RE']))

Measured memory_bytes: 16612
#include<iostream>

using namespace std;

int main(){

	int t;
	int h,m,s;

	cin >> t;

	h = t/3600;
	t = t - h*3600;
	m = t/60;
	t = t -m*60;
	s = t;

	cout << h << ":" << m << ":"<< s << endl;

	return 0;

}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int V,E;
double P,Q;
vector<int> G[15];


void printbit(int S){
  for(int i=0;i<V;i++){
    cout<<(S>>i&1)<<' ';
  }
  cout<<endl;
}

double func(int S,int U){

  double res=1;
  for(int i=0;i<V;i++){
    if(S>>i&1){
      for(int j=0;j<(int)G[i].size();j++){
        int w=G[i][j];
        if(S>>w&1)continue;
        if(U>>w&1)        res*=P;
      }
    }
  }



  return res;
}

double dp[(1<<14)];

double rec(int S){

  if(dp[S]!=-1)return dp[S];
  if(S==1)return 1.0;

  double res=0;
  int sup=S;
  int sub=sup;
 

  do{
    if(sub&1){
      if(sub!=S){
        double A=rec(sub);
        double B=func(sub,S);
        res+=A*B;
      }
    }
    sub=(sub-1)&sup;
  }while(sub!=sup);

  res=1.0-res;

  return dp[S]=res;
}

void init(){
  for(int i=0;i<15;i++)G[i].clear();
  for(int i=0;i<(1<<14);i++){
    dp[i]=-1;
  }
}


bool check(){
  bool visited[15]={};
  visited[0]=true;
  queue<int> que;
  que.push(0);

  while(!que.empty()){
    int pos=que.front();que.pop();
    for(int i=0;i<(int)G[pos].size();i++){
      int w=G[pos][i];
      if(visited[w])continue;
      visited[w]=true;
      que.push(w);
    }
  }

  for(int i=0;i<V;i++)
    if(!visited[i])return false;

  return true;
}

int main(){
  while(cin>>V>>E>>P){
    init();
    P/=100.0;
    Q=1.0-P;
    for(int i=0;i<E;i++){
      int a,b;
      cin>>a>>b;
      a--;b--;
      G[a].push_back(b);
      G[b].push_back(a);
    }

    if(!check()){
      printf("0.0\n");
      continue;
    }
    printf("%.10f\n",rec((1<<V)-1));
  }
  return 0;
}

Measured memory_bytes: 1392
def main():
    n = int(input())
    a_l = list(map(int, input().split()))
    b_l = list(map(int, input().split()))
    c_l = list(map(int, input().split()))
    res = 0
    pre = 0
    for a in a_l:
        res += b_l[a-1]
        if (a - pre == 1) and (a != 1):
            res += c_l[a-2]
        pre = a
    print(res)

if __name__ == "__main__":
    main()

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

using namespace std;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        string t1 = s.substr(0, i);
        string t2 = s.substr(i);
        int tmp = 0;
        for (char c = 'a'; c <= 'z'; ++c) {
            if ((t1.find(c) != string::npos) and (t2.find(c) != string::npos)) {
                tmp++;
            }
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    float R;
    float L;
    cin >> R;
    L = M_PI * R * 2;
    cout << L;
    return 0;
}


Measured memory_bytes: 3792
/* 
    HARSHAD VAGHASIYA

        @DAIICT
    
          H_M_Vaghasiya
    
            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define MAX_INT 100000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
ll gcd(ll a,ll b){return __gcd(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm; 
}
ll pow2(ll n,ll k){
    ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;
        n=n*n;
        k/=2;
    }return ans;
}
void solve(){
    ll i,j,k,n,m,x,y,z;
    
}
int main()
{
    FS; 
    ll i,j,k,n,m,x,y,z;
    cin>>n>>k>>x;
    vector<ll> ans(n+1,0);
    for(i=0;i<x;i++){
        cin>>y;
        ans[y]++;
    }
    
    for(i=1;i<=n;i++){
        if( k-x + ans[i] >0){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,counta=0,countb=0,countc=0;
cin >>n >>a >>b;
int wa[n];
for (int i=0;i<n;i++){
cin >> wa[i];
if (wa[i]<=a)counta++;
else if (wa[i]<=b)countb++;
else countc++;
}

cout <<min(counta,min(countb,countc)) <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define pb push_back
    #define mp make_pair
    #define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #define F first
    #define S second
    #define sz(x) (int)x.size()
    #define all(x) (x).begin(), (x).end()
    #define rep(i, n) for(int i = 0; i < n; ++i)
    #define repr(i,n) for(int i = n - 1; i >= 0; --i)
    #define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
    #define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
    #define Repr(i, a, n) for(int i = (n); i >= (a); --i)
    typedef long long ll;
    typedef std::vector<int> vi;
    typedef std::pair<int, int> pii;
    const int inf = int(1e9);
    const int mod = inf + 7;
    const double PI = acos(-1.0);
    using namespace std;
    const int N = 1e5 + 155;
    template<typename T>
    inline void read(T&x){
        x=0;int f=1;char ch = getchar();
        while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
        while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
        x*=f;
    }

    void solve(){
        int n;
        string s;
        cin >> n >> s;
        string t = "";
        for(int i = 0; i < n / 2; i++) {
            t += s[i];
        }    
        if (t == s.substr(n / 2)) cout << "Yes";
        else cout << "No";
    }
     
    int main(){
        OP
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        int t = 1;
        while(t--)
        solve();
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> P(n), Q(n);
  string ps, qs;
  rep(i, n) {
    cin >> P[i];
    ps += char('0'+P[i]);
  }
  rep(i, n) {
    cin >> Q[i];
    qs += char('0'+Q[i]);
  }
  vector<string> v;
  vector<bool> used(n);
  auto dfs = [&](auto dfs, int cur, string tmp) -> void {
    if(cur == n) {
      v.push_back(tmp);
      return;
    }
    rep(i, n) {
      if(used[i]) continue;
      used[i] = true;
      dfs(dfs, cur+1, tmp+(char)('1'+i));
      used[i] = false;
    }
  };
  dfs(dfs, 0, "");
  cout << abs(find(all(v), qs) - find(all(v), ps)) << endk;
  return 0;
}


Measured memory_bytes: 5328
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    x=INT()
    a=INT()
    y=x%500
    if a>=y:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
//My i/o stream
struct fastio
{
	char s[100000];
	int it, len;
	fastio() {it=len=0;}
	inline char get()
	{
		if (it<len) return s[it++]; it=0;
		len=fread(s, 1, 100000, stdin);
		if (len==0) return EOF; else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while (c==' '||c=='\n') c=get();
		if (it>0) it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0; bool ng=0; char c; c=_buff.get();
	while (c!='-'&&(c<'0'||c>'9')) c=_buff.get();
	if (c=='-') ng=1, c=_buff.get();
	while (c>='0'&&c<='9') r=r*10+c-'0', c=_buff.get();
	return ng?-r:r;
}
template <class T> inline void putnum(T x)
{
	if (x<0) putchar('-'), x=-x;
	register short a[20]={}, sz=0;
	while (x) a[sz++]=x%10, x/=10;
	if(sz==0) putchar('0');
	for (int i=sz-1; i>=0; i--) putchar('0'+a[i]);
}
inline char getreal() {char c=_buff.get(); while (c<=32) c=_buff.get(); return c;}

int mod = 1e9+7;
ll qpow(ll x, ll k) {return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}

const int maxn = 100111;
int n;
ll inv[maxn], fac[maxn], ifac[maxn];
ll C(int x, int y) {return fac[x]*ifac[y]%mod*ifac[x-y]%mod;}
int dp[6011][2011];
int pw2[maxn], pwi2[maxn], pwi6[maxn];
ll calc(int c1, int c2, int c3)
{
//	ll ret = 1ll*fac[3*n]*qpow(inv[2], c2)%mod*qpow(inv[6]%mod, c3)%mod;
	ll ret = 1ll*fac[3*n]*pwi2[c2]%mod*pwi6[c3]%mod;
	ret = 1ll*ret*ifac[c1]%mod*ifac[c2]%mod*ifac[c3]%mod;
	ret = ret*pw2[c3]%mod;
	return ret%mod;
}
int main()
{
	cin>>n>>mod;
	inv[1] = 1;
	for (int i=2; i<maxn; i++) inv[i] = mod-(mod/i)*inv[mod%i]%mod;
	fac[0] = 1;
	for (int i=1; i<maxn; i++) fac[i] = fac[i-1]*i%mod;
	ifac[0] = 1;
	for (int i=1; i<maxn; i++) ifac[i] = ifac[i-1]*inv[i]%mod;
	pw2[0] = 1;
	for (int i=1 ;i<maxn; i++) pw2[i] = pw2[i-1]*2ll%mod;
	pwi2[0] = 1;
	for (int i=1 ;i<maxn; i++) pwi2[i] = pwi2[i-1]*inv[2]%mod;
	pwi6[0] = 1;
	for (int i=1 ;i<maxn; i++) pwi6[i] = pwi6[i-1]*inv[6]%mod;
	
	ll ans = 0;
	for (int i=0; i<=n; i++)
	{
		for (int j=0; i+j<=n; j++)
		{
			ans += calc(3*(n-i-j)+j, j, i);
		}
	}
	cout<<(ans%mod+mod)%mod<<endl;
	return 0;
}

Measured memory_bytes: 5120
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        n: usize,
        k: usize,
        d: [String; k],
    }

    'all: for i in n..10*n {
        if i.to_string().chars().all(|x| !d.contains(&x.to_string())) {
            println!("{}", i);
            break;
        }
    }
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int length = str.length();
        int n = Integer.parseInt(sc.next());
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < length; i += n) {
            ans.append(str.charAt(i));
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21716
var
 s:ansistring;
 i,j,k:longint;
 a:array['a'..'z'] of 0..1;
begin
 readln(s);
 for i:=1 to length(s) do a[s[i]]:=1;
 for i:=1 to 26 do begin if a[chr(i+96)]=0 then begin writeln(chr(i+96));halt;end;if a[chr(i+96)]<>0 then inc(k);end;
 if k=26 then writeln('None');
end.

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define reps(i,j,k) for(int i=j;i<k;++i)
#define rep(i,j) reps(i,0,j)
int n,pw;
#define N 100000
int vw[N], pf[N], vf[N], th[N];
double f(double w) {
	double vit;
	double res = pw * w;
	rep(i, n){
		vit = w * vw[i];
		double tmp;
		tmp = max((th[i] - vit) / (vf[i]), 0.0);
		res += tmp * pf[i];
	}
	return res;
}
int main(){
	while(cin >>n, n){
		cin >> pw;
		rep(i, n) cin >> vw[i] >> pf[i] >> vf[i] >> th[i];
		double l, r;
	l = 0;
	r = 100;

	rep(i,100) {
	//	cout << l << " " << r << endl;
		double ml = (r-l)/3.0 + l;
		double mr = 2.0*(r-l)/3.0 + l;

		double s = f(ml);
		double q = f(mr);

		if (s < q) {
			r = mr;
		}
		else{
			l = ml;
		}
	}
	cout << f(l) << endl;
	}

	
	return 0;
}

Measured memory_bytes: 4636
#include <iostream>
using namespace std;
int main(){
    int a[101][301]={};
    for(int i=1;i<101;i++){
        for(int j=i+1;j<101;j++){
            for(int k=j+1;k<101;k++){
                if(i+j+k>300)break;
                for(int l=k;l<=100;l++){
                    a[l][i+j+k]++;
                }
            }
        }
    }
    int n,x;
    while(cin>>n>>x){
        if(n==0)break;
        cout<<a[n][x]<<'\n';
    }
}


Measured memory_bytes: 3216
// #define USE_CPP11
// #define USE_PRINTF

#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <complex>
#include <memory>
#include <sstream>

#ifdef USE_CPP11
#include <unordered_map>
#include <unordered_set>
#include <functional>
#endif

#define PRINT(obj) cout << obj << endl
#define REP(i, n) for(int (i) = 0; (i) < (n); i++)
#define SPACE " "

typedef long long ll;

using namespace std;

const int INF = 1e9;

namespace Scanner {
#ifdef USE_PRINTF
  int    nextInt()    { int    d; scanf("%d" , &d); return d; }
  float  nextFloat()  { float  f; scanf("%f" , &f); return f; }
  double nextDouble() { double f; scanf("%lf", &f); return f; }  
  string nextString() { string s; scanf("%s" , &s); return s; }
  ll     nextll()     { ll     l; scanf("%ll", &l); return l; }
#else
  int    nextInt()    { int    d; cin >> d; return d; }
  float  nextFloat()  { float  f; cin >> f; return f; }
  double nextDouble() { double f; cin >> f; return f; }  
  string nextString() { string s; cin >> s; return s; }
  ll     nextll()     { ll     l; cin >> l; return l; }
#endif

  string getLine() { 
    string input;
    getline(cin, input);
    return input;
  }
};

namespace myLibrary {
  vector<string> split(const string& str, char delim) {
    vector<string> ret;
    size_t current = 0, found;
    while ((found = str.find_first_of(delim, current)) != string::npos) {
      ret.push_back(string(str, current, found - current));
      current = found + 1;
    }
    ret.push_back(string(str, current, str.size() - current));
    return ret;
  }
  
#ifdef USE_CPP11
  ///
  /// higher-order functional
  /// This is something like map in haskell, python, etc.
  /// Sample usage:
  ///   vector<int> a = {1, 2, 3, 4, 5};
  ///   vector<int> b = myLibrary::_Map<int, int>(a, [](int n){
  ///     return n * n;
  ///   });
  /// Result:
  ///   b = 1, 4, 9, 16, 25
  ///
  template<typename T_IN, typename T_OUT, class Functor>
  vector<T_OUT> _Map(vector<T_IN> src, Functor func) {
    vector<T_OUT> ret;
    for (int i = 0; i < src.size(); i++) {
      ret.push_back(func(src[i]));
    }
    return ret;
  }
#endif

};

/// BEGIN //////////////////////////////////////////////////////////

int cs[20];
int memo[50001];

int solve(int n, const int m) {
  int score, score_min = INF;
  if (n == 0) {
    return 0;
  }
  if (memo[n] != 0) {
    return memo[n];
  }
  
  for (int i = 0; i < m; i++) {
    if (cs[i] > n) {
      continue;
    }
    score = 1 + solve(n - cs[i], m);
    if (score < score_min) {
      score_min = score;
    }
  }
  
  return memo[n] = score_min;
}
  
int main() {
  int n = Scanner::nextInt();
  int m = Scanner::nextInt();
   

  REP(i, m) {
    cs[i] = Scanner::nextInt();  
  }
  
  int ans = solve(n, m);

  PRINT(ans);
  
  return 0;
}

/// END   //////////////////////////////////////////////////////////

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int lcm(int a, int b)
{
   return a * b /__gcd(a, b);
}


int main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,n)
    cin>>a[i];
  int ans=0;
  rep(i,n)
    ans+=a[i]-1;
    
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
 
  int num = n / 1.08;
  if((int)(num*1.08)==n) cout << (int)(n / 1.08) << endl;
  else if((int)((num+1)*1.08)==n) cout << (int)(n / 1.08 + 1) << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        String tmp = s.substring(k - 1, k).toLowerCase();
        String ans = s.substring(0, k - 1);
        System.out.print(ans + tmp);
        String ans2 = s.substring(k, s.length());
        System.out.println(ans2);
    }
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  int n;
  string s;
  cin>>n;
  cin>>s;
  if(n%2==1){
    cout<<"No";
    return 0;
  }
  
  rep(i, n/2){
    if(s[i]!=s[n/2+i]){
      cout<<"No";
      return 0;
    }
  }
  
  cout<<"Yes";
  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
using Int = long long;

int main() {

	string s;
	cin >> s;
	Int len = s.size();
	Int ans = 0;

	for (Int i = 0; i < (1LL << (len - 1)); i++) {
		Int temp = 0;
		for (Int j = 0; j < len; j++) {
			temp *= 10;
			temp += s[j]-'0';
			if (i & (1LL << j)||j==len-1) {
				ans += temp;
				temp = 0;
			}

		}

	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

const ll inf = 1 << 30;
const ll mod = 1000000000 + 7;

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

	a += a;
	if (a.find(b) == string::npos)
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, e, n) for (int i = e; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,ll>;
const ll inf=1000000000007;
const int mod=1000000007;


int main() {
  int a,b; cin >> a >> b;
  if(b%a==0) cout << a+b << endl;
  else cout << b-a << endl;

  return 0;

}


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

// # 文字列の型変換全然うまくいかない。あきらめた

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int func(string N) {
    int total = 0;
    for (int i = 0; i < N.size(); i++) {
        total += ctoi(N.at(i));
    }
    return total;
}


int main() {
    string N;
    cin >> N;
    int A = stoi(N) % func(N);
    if (A == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

int n;
int k;

int main() {
	cin >> n >> k;
	long long int ans = LLONG_MAX;
	for (int i = 0; i < (1 << n); i++) {
		long long int r = 1;
		for (int j = 0; j < n; j++) {
			if ((i >> j) & 1) {
				r *= 2LL;
			}
			else {
				r += k;
			}
		}
		ans = min(ans, r);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	string a;
	int lena,sum=0;
	cin>>a;
	lena=a.length();
	for(int i=0;i<lena-1;i++)
	if(a[i]!=a[i+1])
	sum++;
	cout<<sum<<endl;
}

Measured memory_bytes: 512
import math
in1 = input().split()
A = float(in1[0])
B = float(in1[1])
H = float(in1[2])
M = float(in1[3])
aH = 0.5 * (H * 60 + M)
aM = 6*M
ra = abs(aH-aM)
ra1 = min(360 - ra, ra)
C2 = ((A*A)+(B*B))- (2*(A*B))*(math.cos(math.radians(ra1)))
print(math.sqrt(C2))


Measured memory_bytes: 9404
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	private static long[] x = new long[100010];
	private static long[] y = new long[100010];
	
	private static final long MOD = 1000000007;
	private static List<Long> list1 = new ArrayList<Long>() , list2 = new ArrayList<Long>();
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int i , j , n = scan.nextInt() , m = scan.nextInt();
		for (i = 0;i < n;i ++) {
			x[i] = scan.nextLong();
		}
		for (i = 0;i < m;i ++) {
			y[i] = scan.nextLong();
		}
		Arrays.sort(x , 0 , n);
		Arrays.sort(y , 0 , m);
	
		for (i = 0;i < n - 1;i ++) {
			long temp = x[i + 1] - x[i];
			list1.add(temp);
		}
		for (i = 0;i < m - 1;i ++) {
			long temp = y[i + 1] - y[i];
			list2.add(temp);
		}
		
		n = list1.size();
		m = list2.size();
		long value = 0 , ans = 0;
		for (i = 0;i < n;i ++) {
			long temp = ((long) (i + 1) * (long) (n - i)) % MOD;
			value = (value + (temp * list1.get(i)) % MOD) % MOD;
		}
		
		for (i = 0;i < m;i ++) {
			long temp = ((long) (i + 1) * (long) (m - i)) % MOD;
			ans = (ans + (((temp * list2.get(i)) % MOD) * value) % MOD) % MOD;
		}
		System.out.println(ans);
		
	}

} 





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

typedef pair<int,int> pii;
typedef pair<pii,int> pipii;

int N,M;
long long K;
vector<pii> V;
priority_queue<int> Q;
pipii edge[10000];
long long D[100010] = {0};
bool F[100010] = {0};
vector<pii> G[1010];

int main()
{
    for(int i = 1; i < 100000 + 1; i++)
    {
        D[i] = -1000000000000000;
    }
    D[1] = 0;
    scanf("%d%d",&N,&M);
    for(int i = 0; i < M; i++)
    {
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        edge[i] = make_pair(make_pair(a,b),c);
    }
    bool O = 1;
    F[N] = true;
    for(int i = 0; i < N + 1; i++)
    {
        if(i == N)
        {
            break;
        }
        O = false;
        for(int j = 0; j < M; j++)
        {
            if(F[edge[j].first.second] == 1 && F[edge[j].first.first] == 0)
            {
                F[edge[j].first.first] = true;
            }
        }
    }
    O = 1;
    for(int i = 0; i < N; i++)
    {
        if(!O)
        {
            break;
        }
        O = false;
        for(int j = 0; j < M; j++)
        {
            if(F[edge[j].first.second] == true && D[edge[j].first.first] + edge[j].second > D[edge[j].first.second])
            {
                D[edge[j].first.second] = D[edge[j].first.first] + edge[j].second;
                O = true;
                if(i == N - 1)
                {
                    printf("inf\n");
                    return 0;
                }
            }
        }
    }
    printf("%lld\n",D[N]);
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>

int main() {
    int x[3];
    scanf("%d %d %d", &x[0], &x[1], &x[2]);
    for(int i=2; i>0; i--) {
        for(int j=0; j<i; j++){
            if(x[j] > x[j+1]) std::swap(x[j], x[j+1]);
        }
    }
    printf("%d %d %d\n", x[0], x[1], x[2]);
}


Measured memory_bytes: 2748
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w
using namespace std;

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n,a[100000],b[100000],c[100000],bans[100001] = {},aans[100001] = {};
	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	for(int i = 0;i < n;i++) cin >> b[i];
	for(int i = 0;i < n;i++) cin >> c[i];
	sort(a,a + n);
	sort(b,b + n);
	sort(c,c + n);
	for(int i = n - 1;i >= 0;i--){
		int ind = upper_bound(c,c + n,b[i]) - c;
		bans[i] = n - ind + bans[i + 1];
	}
	for(int i = n - 1;i >= 0;i--){
		int ind = upper_bound(b,b + n,a[i]) - b;
		aans[i] = bans[ind] + aans[i + 1];
	}
	cout << aans[0] << endl;
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const double pi=3.14159265358979323846;

void solve(){
	int a,b,h,m;
	cin>>a>>b>>h>>m;
	double x=((double)2*pi/(double)(60*12))*((double)(h*60)+(double)m);
	double y=((double)2*pi/(double)60)*(double)m;
	double z=min(abs(x-y),2*pi-abs(x-y));
	double ans=pow(a,2)+pow(b,2)-2*a*b*cos(z);
	ans=sqrt(ans);
	cout<<setprecision(12)<<ans<<endl;
}

int32_t main(){
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		solve();	
	}
}

Measured memory_bytes: 4172
#include <bits/stdc++.h>
using namespace std;
int a[1<<19];
multiset<int> mx[1<<19];
multiset<int>::iterator its;

int main(){
	int n;
	scanf("%d", &n);
	for(int i=0;i<(1<<n);i++){
		scanf("%d", &a[i]);
		mx[i].insert(a[i]);
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<(1<<n);j++){
			if((j>>i)&1){
				for(its = mx[j^(1<<i)].begin();its != mx[j^(1<<i)].end();its++){
					mx[j].insert(*its);
				}
			}
			while(mx[j].size() > 2) mx[j].erase(mx[j].begin());
		}
	}
	int ans = 0;
	for(int i=1;i<(1<<n);i++){
		int res = *mx[i].rbegin() + *++mx[i].rbegin();
		ans = max(ans, res);
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 54272
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A =sc.nextInt();
      int B =sc.nextInt();
      if (A==1 && B==2){
        System.out.println(3);
      }else if (A==1 && B==3){
        System.out.println(2);
      }else if (A==2 && B==1){
        System.out.println(3);
      }else if (A==2 && B==3){
        System.out.println(1);
      }else if (A==3 && B==1){
        System.out.println(2);
      }else if (A==3 && B==2){
        System.out.println(1);
      }sc.close();
    }
}

      
      

Measured memory_bytes: 23764