akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
deque<char>dq;   
int main()
{
    fastread;
    string s;
    ll i,j,k,l,n,m;
    cin>>s;
    ll q;
    ll sz=s.size();
    for(i=0;i<sz;i++)
    	dq.pb(s[i]);
    cin>>q;
    ll cnt=0;
    ll wfront=1;
    while(q--){
       ll type;
       cin>>type;
       if(type==1){
       	  cnt++;
       	  if(cnt%2==0)
       	  	wfront=1;
       	  else
			 wfront=2;	
	   }
	   else{
	   	ll wend;
	   	char ch;
	   	 cin>>wend>>ch;
	   	 	   if(wend==1&&wfront==1)
	   	 	   		dq.pf(ch);
	   	 	   	else if(wend==2&&wfront==1)
	   	 	   		dq.pb(ch);
	   	 	   	else if(wend==1&&wfront==2)
					   dq.pb(ch);
				else if(wend==2&&wfront==2)
					 dq.pf(ch);	   	
	   }
	}
	///cout<<dq.size()<<endl;
	if(wfront==1){
		ll sz1=dq.size();
		for(i=0;i<sz1;i++)
			cout<<dq[i];
	}
	else{
		ll sz1=dq.size();
		for(i=sz1-1;i>=0;i--)
			cout<<dq[i];
	}
    return 0;
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.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))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}

struct edge{int to, cost;};

class Graph
{
public:
    int V;
    vector<vector<edge>> G;

    Graph(int V): V(V){
        G = vector<vector<edge>>(V, vector<edge>(0));
    }

    void add_edge(int from, int to, int cost){
        G[from].push_back(edge({to, cost}));
    }

    void add_edge2(int v1, int v2, int cost){
        add_edge(v1, v2, cost);
        add_edge(v2, v1, cost);
    }

    int dfs(int v, vec &dp){
        if(dp[v] >= 0) return dp[v];
        int a = 0;
        REP(k, G[v].size()){
            a = max(a, dfs(G[v][k].to, dp) + 1);
        }
        dp[v] = a;
        return dp[v];
    }

};

signed main(){

    int N, M; cin >> N >> M;
    int x, y;
    Graph G(N);
    REP(i, M){
        cin >> x >> y;
        G.add_edge(x - 1, y - 1, 1);
    }
    vec dp(N, -1);
    REP(i, N){
        if(dp[i] < 0) G.dfs(i, dp);
    }
    int ans = 0;
    REP(i, N) ans = max(ans, dp[i]);
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 8064
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define Maxn 100000;
using namespace std;
int a,b,c,d;
int main()
{
    cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	int sum1=min(min(a,b),min(b,c));
	int sum2=min(d,e);
	int ans=sum1+sum2-50;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1160
import numpy as np

N = int(input())
h = list(map(int,input().split()))

memo = np.zeros(N)
memo[0] = 0
memo[1] = abs(h[0]-h[1])

for i in range(2,N):
  a = memo[i-1] + abs(h[i] - h[i-1])
  b = memo[i-2] + abs(h[i] - h[i-2])
  memo[i] = min(a,b)

print(int(memo[N-1]))

Measured memory_bytes: 22744
n, y = gets.split(' ').map(&:to_i)

res = [-1, -1, -1]

(0..n).each do |man|
  (0..(n - man)).each do |go_sen|
    total = (10_000 * man) + (5_000 * go_sen) + (1_000 * (n - man - go_sen))
    if total == y
        res = [man, go_sen, n - man - go_sen]
        break
    end
  end
end

puts res.join(' ')


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define iter(v, i) for (__typeof__((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double eps = 1e-9;
const double pi = 3.141592653589793238462;

int main() {
    //freopen("", "rt", stdin);
    //freopen("", "wt", stdout);
    int a, b;
    cin >> a >> b;
    if (a <= 0 && b >= 0)
        cout << "Zero\n";
    else if (b < 0)
        cout << ((b - a + 1) % 2 == 0 ? "Positive\n" : "Negative");
    else
        cout << "Positive\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    map<int, int> mp;
    rep(i, n) {
        for (int j = -1; j <= 1; ++j) {
            mp[a[i] + j]++;
        }
    }
    int ans = 0;
    for (auto p : mp) {
        chmax(ans, p.se);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

const int N = 102;
typedef pair<int, int> pii;

struct TFlow {
    const int infFlow = int(1e9 + 7);
    struct TEdge {
        int u, v, cf;
        TEdge() {u = v = cf = 0;}
        TEdge(int u, int v, int cf): u(u), v(v), cf(cf) {}
    };
    int s, t, n, FlowVal;
    vector<TEdge> e;
    vector<vector<int>> a;
    vector<int> h;
    vector<vector<int>::iterator> p;
    TFlow() {}
    TFlow(int s, int t, int n): s(s), t(t), n(n) {
         e.clear(); a.resize(n + 1); h.resize(n + 1); p.resize(n + 1);
    }
    void AddEdge(int u, int v, int cf) {
        a[u].pb(e.size()); e.pb(u, v, cf);
        a[v].pb(e.size()); e.pb(v, u, 0);
    }
    void BFS() {
        fill(h.begin(), h.end(), n);
        h[t] = 0; queue<int> q; q.push(t);
        while(q.size()) {
            int u = q.front(); q.pop();
            for(int i: a[u]) {
                i ^= 1;
                int v = e[i].u;
                if(e[i].cf == 0 || h[v] < n) continue;
                h[v] = h[u] + 1;
                if(v == s) return;
                q.push(v);
            }
        }
    }
    int DFS(int u, int In) {
        if(u == t) return In;
        int Out = 0, i, v, q;
        for(; p[u] != a[u].end(); ++p[u]) {
            i = *p[u], v = e[i].v;
            if(e[i].cf == 0 || h[v] != h[u] - 1) continue;
            q = DFS(v, min(In, e[i].cf));
            Out += q; In -= q;
            e[i].cf -= q, e[i ^ 1].cf += q;
            if(In == 0) return Out;
        }
        return Out;
    }
    int GetMaxFlow() {
        FlowVal = 0;
        while(BFS(), h[s] < n) {
            for(int u = 0; u < n; ++u) p[u] = a[u].begin();
            for(int u = 0; u < n; ++u) FlowVal += DFS(s, infFlow);
        }
        return FlowVal;
    }
};

int n, m;
string s;
pii S, T;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> m;
    TFlow Flow = TFlow(0, n + m + 1, n + m + 2);
    ///s = 0, t = n + m + 1, n row(1 -> n), m col(n + 1 -> n + m)
    for(int i = 1; i <= n; ++i) {
        cin >> s; s = ' ' + s;
        for(int j = 1; j <= m; ++j) {
            if(s[j] == '.') continue;
            if(s[j] == 'S') {
                Flow.AddEdge(0, i, int(1e9 + 7));
                Flow.AddEdge(0, j + n, int(1e9 + 7));
                S = mp(i, j);
            } else if(s[j] == 'T') {
                Flow.AddEdge(j + n, n + m + 1, int(1e9 + 7));
                Flow.AddEdge(i, n + m + 1, int(1e9 + 7));
                T = mp(i, j);
            }
            Flow.AddEdge(i, j + n, 1);
            Flow.AddEdge(j + n, i, 1);
        }
    }
    if(S.fi == T.fi || S.se == T.se) return cout << -1, 0;
    else cout << Flow.GetMaxFlow();
}


Measured memory_bytes: 1196
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
string s;
int main()
{
	cin>>s;
	int len=s.length();
	long long ans=0;
	for (int i=0;i<len;++i)
	{
		ans+=s[i]-'0';
		ans%=9;
	}
	if (ans%9==0)
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
    return 0;
}

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

 void insertionSort(vector<int> a, int n){
    for(int i=1;i<n;i++){
        int tmp = a[i],j;
        for(j=i-1;j>=0 && a[j] > tmp;j--)a[j+1] = a[j];
        a[j+1] = tmp;

        for(int k=0;k<n;k++){
            cout << a[k];
            if(k != n-1)cout << " ";
            else cout << endl;
        }
    }
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i != n-1)cout << " ";
        else cout << endl;
    }

    insertionSort(a, n);
    
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  cin >> n;
  int l=1,r=n+1;
  while(l+1!=r) {
    int m=(l+r)/2;
    int x=n;
    for(int i=m; i>=1; i--) {
      if(x>=i) x-=i;
    }
    if(x) l=m;
    else r=m;
  }
  for(int i=r; i>=1; i--) {
    if(n>=i) {
      pr(i);
      n-=i;
    }
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "wt", stdout);
//#endif
    int n;
    cin >> n;
    vi a(n);
    vi cnt(n,0);
    forn(i,0,n) {
        cin>>a[i];
        cnt[a[i]] ++;
    }
    int nmax = 0;
    forn(i,0,n) {
        if(cnt[i] > 0) nmax = i;
    }
    int nmin = (nmax + 1)/2+1;
    forn(i,0,nmax+1) {
        cnt[max(i, nmax-i)]--;
    }
    forn(i,0,n) {
        if(cnt[i] < 0) {
            cout<< "Impossible"<<endl;
            return 0;
        }
    }
    if(nmax == 1 && n>2) {
        cout<< "Impossible"<<endl;
        return 0;
    }
    forn(i,0,nmin) {
        if(cnt[i] > 0) {
            cout<< "Impossible"<<endl;
            return 0;
        }
    }
    cout<<"Possible"<<endl;
    
    
}



Measured memory_bytes: 256
n = int(input())
x = input()

num_of_1 = x.count("1")

first = int(x, 2)

def f(x):
    if x == 0:
        return 0
    return 1 + f(x % bin(x).count('1'))

if num_of_1 == 1:
    for i in range(n):
        if x[i] == '1':
            print(0)
        elif i == n-1:
            print(2)
        else:
            print(1)
    exit()

first_one, first_zero = first % (num_of_1 - 1), first % (num_of_1 + 1)

for i in range(n):
    if x[i] == "0":
        print(1 + f((first_zero + pow(2, n-i-1, num_of_1 + 1)) % (num_of_1 + 1)))
    else:
        print(1 + f((first_one - pow(2, n-i-1, num_of_1 - 1)) % (num_of_1 - 1)))

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

int pcnt(int x) {
  return __builtin_popcount(x);
}

int f(int x) {
  if (x == 0) return 0;
  return f(x % pcnt(x)) + 1;
}

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

  vector<int> x(n);
  rep(i, n) x[i] = s[i] - '0';  // 0~9には0の48から1ずつ増えながら数値が振られているので素の差を見ればintへ一桁ずつ落とし込める

  int pc = 0;
  rep(i, n) pc += x[i];
  vector<int> ans(n);
  // 0の場合と1の場合を確かめる
  rep(b, 2) {
    int npc = pc;
    if (b == 0)
      npc++;
    else
      npc--;
    if (npc <= 0) continue;
    int r0 = 0;
    rep(i, n) {
      r0 = (r0 * 2) % npc;
      r0 += x[i];
    }
    int k = 1;
    for (int i = n - 1; i >= 0; --i) {
      if (x[i] == b) {
        int r = r0;
        if (b == 0)
          r = (r + k) % npc;
        else
          r = (r - k + npc) % npc;
        ans[i] = f(r) + 1;
      }
      k = (k * 2) % npc;
    }
  }

  rep(i, n) cout << ans[i] << endl;

  return 0;
}

Measured memory_bytes: 5192
//#include <bits/stdint.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
int main(){
    LL x;
    cin >> x;
    LL ans=0;
    ans+=(x/500)*1000;
    x%=500;
    ans+=(x/5)*5;
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s)
{
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}
template <class T>
inline string toString(T x)
{
	ostringstream sout;
	sout << x;
	return sout.str();
}

//math
//-------------------------------------------
template <class T>
inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0, sizeof(a))

//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
					  << " " << __FILE__ << endl;

int main(void)
{
	int na, nb, nc;
	int n, y;
	cin >> n >> y;
	y /= 1000;
	na = y / 10;
	nb = y / 5;
	nc = y;
	REP(i,na+1){
		REP(j,nb+1){
			int k = n - i - j;
			// int nk = y - i * 10 - j * 5;
			if(i + j + k == n && i * 10 + j * 5 + k == y && k >= 0){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
			// REP(k, nc + 1)
			// {
			// 	if(i + j + k == n && i * 10 + j * 5 + k == y){
					
			// 	}
			// }
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int a, b;

char ans[100][100];

int main() {
	cin >> a >> b;
	cout << 100 << " " << 100 << endl;
	REP(i, 50)REP(j, 100)ans[i][j] = '#';
	for (int i = 50; i < 100; i++)REP(j, 100)ans[i][j] = '.';
	a--, b--;
	REP(i, 50)REP(j, 100) {
		if (i % 2 == 0 && j % 2 == 1 && a) {
			ans[i][j] = '.';
			a--;
		}
	}
	for (int i = 50; i < 100; i++) {
		REP(j, 100) {
			if (i % 2 == 1 && j % 2 == 1 && b) {
				ans[i][j] = '#';
				b--;
			}
		}
	}
	REP(i, 100) {
		REP(j, 100) {
			cout << ans[i][j];
		}
		cout << endl;
	}
	system("pause");
}

Measured memory_bytes: 504
#include<iostream>
#include<vector>
#include<string>

int main(){
    int n, k;
    std::cin >> n >> k;
    std::vector<int> snuke(n, 0);
    int cnt = n;
    for(int i = 0;i < k; i++){
        int d;
        std::cin >> d;
        for(int j = 0; j < d; j++){
            int a;
            std::cin >> a;
            a--;
            if(snuke[a] == 0) cnt--;
            snuke[a]++;
        }
    }

    std::cout << cnt << std::endl;
    return 0;
}


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

int main(void)
{
  int a,b,c;
  int i;
  int counter = 0;
  cin >> a >> b >> c;

  for(i = a; i <= b; i++){
    if(c % i == 0){counter++; }
  }
  cout << counter << endl;
  return 0;
}

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

int main(){
    int d, n;
    cin >> d >> n;
    int count = 0;
    int num = 1;
    while (true){
        int temp_d = d;
        int temp_num = num;
        while (true){
            if (temp_num % 100 != 0){
                break;
            } else {
                temp_num /= 100;
                temp_d--;
            }
        }
        if (temp_d == 0){
            count++;
        }
        if (count == n){
            break;
        }
        num++;
    }
    cout << num << endl;
    return 0;
}

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

int main()
{
    int a, b, c, ab, x, y;
    scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);
    a = std::min(a, c * 2);
    b = std::min(b, c * 2);
    ab = std::min(a + b, c * 2);
    if (x < y)
    {
        printf("%d\n", x * ab + (y - x) * b);
    }
    else
    {
        printf("%d\n", y * ab + (x - y) * a);
    }

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/10;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll a,b,Q; cin >> a >> b >> Q;
    vector<ll> s(a+2); rep(i,a) cin >> s[i+1];
    vector<ll> t(b+2); rep(i,b) cin >> t[i+1];
    s[0] = -LINF;
    t[0] = -LINF;
    s[a+1] = LINF;
    t[b+1] = LINF;

    //debug(s);
    //debug(t);

    while(Q--){
        ll x; cin >> x;

        int si = lower_bound(all(s),x) - s.begin();
        int ti = lower_bound(all(t),x) - t.begin();

        ll ans = LINF;


        assert(0 <= si and si < a+2);
        assert(0 <= ti and ti < b+2);
        ll rs = s[si];
        ll ls = s[si-1];
        ll rt = t[ti];
        ll lt = t[ti-1];

        ans = min(ans,max(rs,rt)-x);
        ans = min(ans,x-min(ls,lt));
        ans = min(ans,(rs-x)*2+(x-lt));
        ans = min(ans,(rt-x)*2+(x-ls));
        ans = min(ans,(x-ls)*2+(rt-x));
        ans = min(ans,(x-lt)*2+(rs-x));
        cout << ans << endl;
    }
}


Measured memory_bytes: 2944
#include <iostream>
#include <climits>
using namespace std;
int main(void){
    // Your code here!
    int N;
    int A[100];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    int min_Num = INT_MAX, max_Num = INT_MIN;

    for(int i = 0; i < N; i++){
        if(min_Num > A[i]) min_Num = A[i];
        if(max_Num < A[i]) max_Num = A[i];
    }
    
    
    cout << max_Num - min_Num << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll n,m;
	cin>>n>>m;

	ll an=(n*(n-1))/2;
	an+=(m*(m-1))/2;
	cout<<an;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include<bitset>
#include<stdio.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 100000000;

bool isOK(int a[],int index,int key){
    if(a[index] >= key){
        return true;
    }else{
        return false;
    }
}

int binary_search(int a[],int n,int key){
    int left = -1;
    int right = n;

    while(right-left>1){
        int mid = left + (right - left)/2;
        if(isOK(a,mid,key)){
            right = mid;
        }else{
            left = mid;
        }
    }
    return right;
}

int factrial(int n){
    if(n==0){
        return 1;
    }else{
        return n*factrial(n-1);
    }
}

int main(void){
    int n;
    cin  >> n;
    double ans = (n/2 + (n%2))/(double)n;

    cout << setprecision(10) <<ans << endl;
    return 0;
}


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



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;



    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scaner sc = new Scaner();
        write wr = new write();
        Math2 mmath = new Math2();
        //ここから

        var x=sc.IntArr;
        var a=x[0];
        string s=sc.Str;
        
        if(a>=3200)wr.wri(s);
        else wr.wri("red");
        
        //ここまで
       
    }


    
}


 class Math2
{
    public long[] Fact;  //Nまでの階乗
    public long[] invFact;  //階乗の逆元
    public void FactoricalModSet(long N,long MOD=1000000007)
    {
        Fact = new long[N + 1];
        invFact = new long[N + 1];

        Fact[0] = 1;
        for(long i = 1; i <= N; ++i)
        {
            Fact[i] = Fact[i - 1] * i%MOD;
        }
        invFact[N] = powMOD(Fact[N], MOD - 2);

        for (long i = N; i > 0; --i)
        {
            invFact[i - 1] = invFact[i] * i%MOD;
        }

    }

    public long nCrMod(long n,long r,long MOD=1000000007)
    {
        return (Fact[n] * invFact[r] % MOD * invFact[n-r]%MOD);
    }

    public long powMOD(long x,long n,long MOD = 1000000007)
    {
        long res = 1;
        while (n > 0)
        {
            if ((n & 1) != 0) res = res * x % MOD;
            x = x * x % MOD;
            n >>= 1;
        }
        return res;
    }

    static long GCD(long x, long y)
    {
        if (y == 0) return x;
        return GCD(y, x % y);
    }

    static long LCM(long x, long y)
    {
        return x * y / GCD(x, y);
    }
}


class Scaner
{
    public string Str => Console.ReadLine();

    public string[] StrArr => Str.Split(' ');

    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public char[] CharArr => Str.ToArray();
    public long Long1 => LongArr[0];
    public int Int1 => IntArr[0];
    
}



class write
{
    public  void wri<T>(T x)
    {
        Console.WriteLine(x);
    }
}



Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
int main() {
  int n, m;
  cin >> n >> m;
  string s[n], t[m];
  rep(i,n)
    cin >> s[i];
  rep(i,m)
    cin >> t[i];
  rep(i,n-m+1)
  {
    rep(j,n-m+1)
    {
      int f = 0;
      rep(k,m)
      {
        rep(l,m)
        {
          if (s[i + k][j + l] != t[k][l]) {
            f = 1;
            break;
          }
        }
        if (f) {
          break;
        }
      }
      if (!f) {
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int i, j, H, W;

  for( ; ; )
  {
    scanf("%d %d", &H, &W);

    if( H == 0 && W == 0 )
      break;

    for( i = 0 ; i < H ; i++ )
    {
      for( j = 0 ; j < W ; j++ )
      {
        if( i == 0 || i == H - 1 )
          printf("#");
        else
        {
          if( j == 0 || j == W - 1 )
            printf("#");
          else
            printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
}



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

#define ff              first
#define ss              second
// #define int             long long
// #define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             998244353
#define endl            "\n"
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
int max(int a, int b) {if (a > b) return a; else return b;}
int min(int a, int b) {if (a < b) return a; else return b;}
// #DEBUG
void __print(int x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
// ###################################################################

void fast()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int n,m;
char grid[1005][1005];
int dp[1001][1001];
int solve(int i,int j){
	if(i>=n || j>=m)
		return 0;
	if(grid[i][j]=='#')
		return 0;
	if(i==n-1 && j==m-1)
		return 1;
	if(dp[i][j]!=-1)
		return dp[i][j];
	return dp[i][j]=(solve(i+1,j)+solve(i,j+1))%mod;
}
int32_t main(){
  	fast();
	memset(dp,-1,sizeof dp);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>grid[i][j];
		}
	}
	cout<<solve(0,0)<<"\n";
return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;

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

    int ans = max(a,b);

    if(ans <= 8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int a1,a2,a3;
    a1=in.nextInt();
    a2=in.nextInt();
    a3=in.nextInt();
    if((a1+a2+a3)>=22)
    {
      System.out.println("bust");
    }
    else
    {
      System.out.println("win");
    }
  }
}


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

int main(){
  int N, A; cin >> N >> A;
  int s = N % 500;
  if(s <= A) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    string s;
    cin >> s;
    int l = s.size() - 2;
    cout << s[0] << l << s[s.size() - 1] << endl;
}

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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int n;

int c;
      
const int N = 401;
          
ll pref[N][N];

ll dp[N][N];

int a[Sz], b[Sz];
                  
int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  cin >> n >> c;        
  for (int i = 1; i <= n; i++)  cin >> a[i];
  for (int i = 1; i <= n; i++)  cin >> b[i];
  for (int x = 1; x <= 400; x++) {
    pref[0][x] = 1;      
    ll pw = 1;
    for (int d = 1; d <= c; d++) {
      pw = (pw * x) % Mod;
      pref[d][x] = pw;
    }
  } 
  for (int i = 0; i <= c; i++)
    for (int j = 1; j <= 400; j++)
      pref[i][j] = (pref[i][j - 1] + pref[i][j]) % Mod;
  
  dp[0][c] = 1;
  for (int i = 1; i <= n; i++) {    
    for (int rem = 0; rem <= c; rem++) {  
      for (int x = 0; x <= rem; x++) {    
        ll sum = pref[x][b[i]] - pref[x][a[i] - 1] + Mod;
        sum = (sum * dp[i - 1][rem]) % Mod;
        dp[i][rem - x] = (dp[i][rem - x] + sum) % Mod;
      }
    }
  }
  cout << dp[n][0];

  return 0;
}






// Coded by Z..



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

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

int main() {
  int n, t, a;
  cin >> n >> t >> a;
  vector<int> h(n);
  vector<pair<double, int>> kionsa(n);
  int minnid = INF;
  rep(i, n) {
    cin >> h[i];
    kionsa[i].first = abs(a - (t - h[i] * 0.006));
    kionsa[i].second = i;
  }
  sort(kionsa.begin(), kionsa.end());

  int ans = kionsa[0].second + 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
#define MOD 1000000007
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))

int main()
{	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);


	ll n,d;
	cin>>n>>d;
	ll ans= (d*2)+1;
	if(n%ans==0)
		cout<<n/ans;
	else cout<<(n/ans)+1;	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <cmath>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

ll factorial(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        return n * factorial(n - 1);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f)
{
    int indexes[n];
    for (int i = 0; i < n; i++)
        indexes[i] = i;
    do
    {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main()
{
    int N = input<int>();
    vector<pll> xy;
    for (int i = 0; i < N; i++)
    {
        int x, y;
        cin >> x >> y;
        xy.push_back(pll(x, y));
    }

    double s = 0;
    foreach_permutation(N, [&](int *indexes) {
        for (int i = 0; i < N - 1; i++)
        {
            s += sqrt(pow(xy[indexes[i]].first - xy[indexes[i + 1]].first, 2) + pow(xy[indexes[i]].second - xy[indexes[i + 1]].second, 2));
        }
    });

    printf("%.10lf\n", s / factorial(N));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

using namespace std;

#define N 310000

int main(int argc, char const *argv[])
{
	int n;
	vector<int> v;
	int check;

	v.push_back(6);
	for(int i1=8;i1<N;i1++){
		if(i1%7==1 || i1%7==6){
			check=0;
			for(int i2=0;v[i2]*v[i2]<=i1;i2++){
				if(i1%v[i2]==0) {
					check=1;
					break;
				}
			}
			if(check==0) v.push_back(i1);
		}
	}

	while(1){

		cin>>n;
		if(n==1) break;
		
		set<int> s;

		for(int i1=0;i1<v.size();i1++){
			if(n%v[i1]==0) s.insert(v[i1]);
		}

		cout<<n<<":";
		for(set<int>::iterator it=s.begin();it!=s.end();it++){
			cout<<" "<<(*it);
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1348
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    ll h;
    cin >> h;
    lli ans = 1, num = 1;
    while(true){
        if (h == 1) break;
        h /= 2;
        num *= 2;
        ans += num;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

N, K = map(int, input().split())

d = defaultdict(int)

for i in range(K):
    _ = int(input())
    A = [int(x) - 1 for x in input().split()]
    for j in range(len(A)):
        d[A[j]] += 1

ans = 0
for i in range(N):
    if d[i] == 0:
        ans += 1
print(ans)


Measured memory_bytes: 9504
import java.io.*;


public class Main{
	public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int time, hour, minute, sec;

		time = Integer.parseInt(br.readLine());
		minute = (time % (60 * 60)) / 60;
		hour = time / (60 * 60);
		sec = (time % (60 * 60)) % 60;

		System.out.println(hour + ":" + minute + ":" + sec);

	}
}

Measured memory_bytes: 24192
#include <stdio.h>
int main(){
  int h,w,n,i,j,f=1,b=0,a=0,t=-1,d[310][310]={};
  char s[310][310];
  scanf("%d %d %d",&h,&w,&n);
  for(i=0;i<h;i++)
    scanf("%s",s[i]);
  for(i=0;i<h;i++){
    b=a=a+f;
    f=0;
    for(j=0;j<w;j++){
      if(s[i][j]=='#'){
	      if(f==1) a++;
	      f=1;
      }
      d[i][j]=a;
    }
    if(f==1&&t==-1) t=i;
    if(f==0){
      for(j=0;j<w;j++)
        d[i][j]=d[i-1][j];
    }
  }
  for(i=0;i<w;i++){
    for(j=0;j<t;j++)
      d[j][i]=d[t][i];
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++)
      printf("%d%c",d[i][j],j+1==w?'\n':' ');
  }
  return 0;
}


Measured memory_bytes: 1152
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
const int sz=2e5+7;
int a[sz],n,pos[sz];
int xds[sz*4][2];
void build(int nd,int L,int r)
{	int mid=(L+r)/2;
	if(L==r)
	{	xds[nd][0]=xds[nd][1]=sz;
		xds[nd][L%2]=a[L]; return ;
	}
	build(nd*2,L,mid); build(nd*2+1,mid+1,r);
	for(int ii=0;ii<2;ii++)
		xds[nd][ii]=min(xds[nd*2][ii],xds[nd*2+1][ii]);
}
int ask(int nd,int L,int r,int x,int y,int k)
{	int mid=(L+r)/2;
	if(L>y||r<x) return sz;
	if(L>=x&&r<=y) return xds[nd][k];
	return min(ask(nd*2,L,mid,x,y,k),ask(nd*2+1,mid+1,r,x,y,k));
}
struct ST
{	int l,r,v;
	ST(int aa=0,int bb=0,int cc=0):l(aa),r(bb),v(cc){}
	bool operator < (const ST& rsh) const
	{
		return v>rsh.v;
	}
};
priority_queue<ST> Q;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){scanf("%d",&a[i]); pos[a[i]]=i;}
	build(1,1,n);
	while(!Q.empty()) Q.pop();
	int v=xds[1][1];
	Q.push(ST(1,n,v));
	for(int i=2;i<=n;i+=2)
	{	ST t=Q.top(); Q.pop();
		v=ask(1,1,n,t.l,t.r,t.l%2);
		printf("%d ",v);
		int p=pos[v];
		v=ask(1,1,n,p+1,t.r,(p+1)%2);
		printf("%d%c",v,i<n?' ':'\n');
		int pp=pos[v];
		if(t.l<p-1)
		{	v=ask(1,1,n,t.l,p-1,t.l%2);
			Q.push(ST(t.l,p-1,v));
		}
		if(p+1<pp-1)
		{	v=ask(1,1,n,p+1,pp-1,(p+1)%2);
			Q.push(ST(p+1,pp-1,v));
		}
		if(pp+1<t.r)
		{	v=ask(1,1,n,pp+1,t.r,(pp+1)%2);
			Q.push(ST(pp+1,t.r,v));
		}
	}
	return 0;
}


Measured memory_bytes: 9848
#include<iostream>
#include<unordered_map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
 
int main(){
  long long int A, B;
  cin >> A >> B;
  
  if(A <= 5)
    cout << 0 << endl;
  else if(6 <= A && A <= 12)
    cout << B/2 << endl;
  else
    cout << B << endl;
  
  return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
if len(s) == len(t):
  a = 0
  for i in range(len(t)):
    if s[i] == t[i]:
      a+=1
  print(len(s)-a)
  exit(0)
g = []
for i in range(len(s)-len(t)):
  n = 0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      n+=1
  g.append(len(t)-n)
print(min(g))

Measured memory_bytes: 9136
n, m = map(int, input().split())
h = list(map(int, input().split()))

s=set()
for _ in range(m):
    a, b = map(int, input().split())
    a_h=h[a-1]
    b_h=h[b-1]
    if a_h>=b_h:
        s.add(b)
    if a_h<=b_h:
        s.add(a)

ans = n-len(s)
print(ans)



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

Measured memory_bytes: 3060
import math

N = int(input())
C = list()
S = list()
F = list()
A = list()

# C,S,FについてN-1の大きさのlistを作る
for i in range(N-1):
    a, b, c = map(int, input().split())
    C.append(a)
    S.append(b)
    F.append(c)
    A.append(0)
A.append(0)

# 駅番号は0からN-1
# 駅iから出発して駅kを最初に出発する時刻を更新していく
for i in range(N-2): # 駅0から駅N-2
    A[i] = S[i]
    for j in range(i+1,N-1): # 次の駅i+1から最後から2つ手前の駅まで
        if A[j-1] + C[j-1] > S[j]:
            A[j] = F[j] * math.ceil((A[j-1]+C[j-1])/F[j])
        else:
            A[j] = S[j]
    A[N-1] = A[N-2] + C[N-2]
    print(A[N-1])    
print(S[N-2] + C[N-2]) #駅N-2
print(0) #駅N-1


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define PP pop_back()
#define set(x,y) memset(x,y,sizeof(x))
#define MIN3(x,y,z) min(min(x,y),z)
#define MAX3(x,y,z) max(max(x,y),z)
#define ALL(x) x.begin(),x.end()
#define sz(x) (int) x.size()
#define sag node*2+1
#define sol node*2
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define ROF(i,j,k) for(int i=j;i>=k;i--)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define ii pair<int,int>
#define pll pair<ll,ll>
#define st first
#define nd second
#define ll long long
#define llu long long unsigned
#define lf double
#define orta (bas+son)/2
#define MOD 1000000007
#define inf 200000000000001
#define N 100005
using namespace std;

int ans,n,a[N],b[N];

int main() {

  scanf("%d",&n);
  FOR(i,1,n) {
    scanf("%d",&a[i]);
  }
  FOR(i,1,n) {
    ans+=(a[a[i]]==i);
  }
  printf("%d",ans/2);

}


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

int main(void){
    vector<int> c(3);

    for(int i=0;i<3;i++)
        cin>>c[i];

    sort(c.begin(),c.end());
    reverse(c.begin(),c.end());

    cout<<c[0]*10+c[1]+c[2]<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define cu continue
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf LLONG_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
#define vll vector <ll>
#define dbg(n) cout<<#n<<' '<<n<<endl;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    


    ll n;
    cin>>n;
    ll a[n];
    ll f[200005]={0};
    for(ll i=0;i<n;i++)
    {
    	cin>>a[i];
    	f[a[i]]++;
    }
	ll s=0;
	ll v[200005]={0};
	for(ll i=0;i<200005;i++)
	{
		v[i]=i*(i-1)/2;
	}
	for(ll i=0;i<200005;i++)
		s+=v[f[i]];
	ll x,ans=0;
	for(ll i=0;i<n;i++)
	{
		ans=0;
		x=f[a[i]];
		ans=s-v[x];
		x--;
		if(x>0)
		ans+=(x*(x-1)/2);
		cout<<ans<<'\n';
	}
}       



Measured memory_bytes: 7296