akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

def main():
    S = input()
    for i in range(1, 100):
        if S == ('hi'*i):
            print('Yes')
            return
    print('No')

main()







Measured memory_bytes: 5556
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <map>

using namespace std;





bool mmp[80][80][80*160*2+1];
int a[80][80];
int main()
{
    int h,w;scanf("%d%d",&h,&w);
    for (int i=0;i<h;++i)
    for (int j=0;j<w;++j)
        scanf("%d",&a[i][j]);
    for (int i=0;i<h;++i)
    for (int j=0;j<w;++j){
        int tmp;scanf("%d",&tmp);
        a[i][j]-=tmp;if (a[i][j]<0) a[i][j]=-a[i][j];
    }
    int base=80*160;
    mmp[0][0][ a[0][0]+base ]=mmp[0][0][ -a[0][0]+base ]=1;

    for (int i=0;i<h;++i)
    for (int j=0;j<w;++j)
    for (int k=0;k<=base*2;++k){
        if (!mmp[i][j][k])continue;
        int tmp;
        if (i+1<h){
            tmp=k+a[i+1][j];if (tmp<=base*2) mmp[i+1][j][tmp]=1;
            tmp=k-a[i+1][j];if (tmp>=0) mmp[i+1][j][tmp]=1;
        }
        if (j+1<w){
            tmp=k+a[i][j+1];if (tmp<=base*2) mmp[i][j+1][tmp]=1;
            tmp=k-a[i][j+1];if (tmp>=0) mmp[i][j+1][tmp]=1;
        }
    }
    int ans=base;
    for (int k=0;k<=base*2;++k){
        if (!mmp[h-1][w-1][k]) continue;
        int tmp=k-base;if (tmp<0) tmp=-tmp;
        if (tmp<ans) ans=tmp;

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









Measured memory_bytes: 158976
#include <stdio.h>

int powi(int a, int b) {
  return b == 1 ? a : powi(a, b - 1) * a;
}

int main(void) {
  int n, m, i;
  scanf("%d%d", &n, &m);
  printf("%d", ((n - m) * 100 + m * 1900) * powi(2, m));
  return 0;
}

Measured memory_bytes: 128
N = gets
origList = gets.strip.split(" ").map{|x| x.to_i }
sorted = origList.sort
grouped = sorted.group_by{ |x| x }
puts grouped.values.reduce(0) { |num, v|
    if( v[0] > v.length )
        num + v.length
    elsif( v[0] < v.length )
        num + ( v.length - v[0])
    else
        num
    end
}


Measured memory_bytes: 21004
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

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();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	for(string line; getline(cin, line);) {
		rep(i,line.length()) {
			if(line[i] == '@') {
				rep(j,line[i+1] - '0') cout << line[i+2];
				i += 2;
			} else {
				cout << line[i];
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class A
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Scanner.Scan<string>();
            Console.WriteLine(S == "AAA" || S == "BBB" ? "No" : "Yes");
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 26664
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <bitset>

namespace IO {
    template <typename _T>
    inline bool read (_T& x) {
        x = 0;
        _T y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return false;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return true;
    }

    template <typename _T>
    inline _T input () {
        _T x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return x;
    }
};
using namespace IO;

namespace modular {
    const int MOD = 1000000007;

    inline int add (int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }

    inline void inc (int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }

    inline int mul (int x, int y) { return 1LL * x * y % MOD; }

    inline int qpow (int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x)) if (y & 1) ans = mul(ans, x);
        return ans;
    }
};

#define reg register
#define MAX_N 407
#define MAX_M 200007
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for(int i = l; i <= r; ++i)
#define lep(i, l, r) for(int i = l; i < r; ++i)
#define irep(i, r, l) for(int i = r; i >= l; --i)
#define ilep(i, r, l) for(int i = r; i > l; --i)
typedef long long ll;
typedef std::bitset<MAX_N> bsn;

int N, M;
int a[MAX_M], b[MAX_M];
bsn al[MAX_N];
bool fail[MAX_N];

int main () {
#ifdef LOCAL
    FIN("in");
#endif
    read(N), read(M);
    rep (i, 1, M) read(a[i]), read(b[i]);
    rep (i, 1, N) {
        al[i].set(i);
        irep (j, M, 1) if (al[i][a[j]] || al[i][b[j]]) {
            if (al[i][a[j]] && al[i][b[j]]) { fail[i] = true; break; }
            if (al[i][a[j]]) al[i].set(b[j]);
            if (al[i][b[j]]) al[i].set(a[j]);
        }
    }
    int res = 0;
    rep (i, 1, N) if (!fail[i]) {
        rep (j, i + 1, N) if (!fail[j]) {
            if (!(al[i] & al[j]).any()) res++;
        }
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 1024
//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 100000 + 50;

int n, a[N], cnt[N];

void solve(){
   cin>>n;

   vector<int> dp(n + 1000, 0);

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

   dp[0] = 1;

   for (int i = 1; i <= n; ++i)
   {
      if(a[i] == 0){
         dp[i] = dp[i-1] * (3 - cnt[0]) % mod;
      }
      else{
         dp[i] = dp[i-1] * cnt[a[i] - 1] % mod;
         dp[i] -= dp[i-1] * cnt[a[i]] % mod;
         dp[i] += mod;
         dp[i] %= mod;
      }
      dp[i] %= mod;
      cnt[a[i]]++;
   }
   
   cout<<dp[n];
}

int32_t main(){_
   
   int t = 1;
//   cin >> t;

   while(t--){
     solve();
     cout << endl;
   }
   

   return 0;
}

Measured memory_bytes: 2560
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    string s;
    cin >> s;
    ll sum = 0;
    rp(i,s.length()) if(s[i] == '1') sum++;
    cout << sum << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
// Problem: A - Kyu in AtCoder
// Contest: AtCoder - M-SOLUTIONS Programming Contest 2020
// URL: https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
 *   ﷽
 * In the name of Allah, the Most Gracious, the Most Merciful
 */

#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <climits>

using namespace std;

int main()
{
	int x;
	cin >> x;
	x = x - 400;
	int ans = 8;
	while(x >= 200)
	{
		x = x - 200;
		ans--;
	}
	cout << ans;
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  string s; int k;
  cin >> s >> k;
  for (char &c: s) {
    if ('z'+1-c > k) continue;
    if (c == 'a') continue;
    k -= 'z'+1-c;
    c = 'a';
  }
  k %= 26;
  s.back() += k;
  if (s.back() > 'z') s.back() -= 26;
  cout << s;
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define print(x) std::cout<<x<<"\n"
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SZ(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = lcm(a, v[i]);} return a;}
VI Bit2Vector(const ll bit, ll n) {	VI s;	rep(i,n) if (bit & (1 << i)) s.push_back(i); return s;}

//dp[ j ][ i] := j-1 番目までの品物から価値が
// i 以上を達成するように選んだときの、重さの総和の最小値
void Knapsac(){
	ll n,w; ll res=0;
	cin>>n>>w;
	VI wei(n),val(n);
	rep(i, n)	cin >> wei[i]>>val[i];
	ll v=100100;
	VVI dp(n+1,VI(v,INF));
	dp[0][0]=0;
	rep(j,n){
		rep(i,v+1){
			if(i>=val[j])	chmin(dp[j+1][i],dp[j][i-val[j]]+wei[j]);
			chmin(dp[j+1][i],dp[j][i]);
		}
	}

	rep(i,v){
		if(dp[n][i]<=w) res=i;
	}
	cout << res << "\n";
	return;
}

void Main()
{
	Knapsac();
	return;
}

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


Measured memory_bytes: 80256
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+18;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//省略
using vi  = vector<int>;
using vii = vector<vector<int>>;
using vl  = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
    int N;
    cin>>N;
    vi C(N);
    map<ll,ll> mp;
    REP(i,N){
        cin>>C[i];
    }
    vl dp(N+1,0);
    dp[0]=1;
    REP(i,N){
        dp[i+1]=dp[i];
        if(mp.count(C[i])){
            ll idx=mp[C[i]];
            if(idx!=i-1) dp[i+1]+=dp[idx+1];
        }
        mp[C[i]]=i;
        dp[i+1]%=MOD;
    }
    cout<<dp[N]<<endl;
}

Measured memory_bytes: 17872
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int>> piii;

int V;//頂点数
const int SIZE_OF_G=400;
vector<int> G[SIZE_OF_G];
int match[SIZE_OF_G];
bool used[SIZE_OF_G];

void init(int v){
  V=v;
  for(int i=0;i<V;i++)G[i].clear();
}

void add_edge(int u,int v){
  G[u].push_back(v);
  G[v].push_back(u);
}

bool dfs(int v){
  used[v]=true;
  for(int i=0; i<G[v].size();i++){
    int u=G[v][i],w=match[u];
    if(w<0||(!used[w]&&dfs(w))){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}

int bipartite_match(){
  int res=0;
  memset(match,-1,sizeof(match));
  for(int v=0; v<V;v++){
    if(match[v]<0){
      memset(used,0,sizeof(used));
      if(dfs(v))res++;
    }
  }
  return res;
}

int main(){
	int n;
	pii x[211]={},y[211]={};//(0:無,1:赤、２：青),idx
	int a[111]={},b[111]={},c[111]={},d[111]={};
	cin>>n;
	V=n;
	int ans=0;
	FOR(i,0,n){
		cin>>a[i]>>b[i];
		x[a[i]]=make_pair(1,i);
		y[b[i]]=make_pair(1,i);
	}
	FOR(i,0,n){
		cin>>c[i]>>d[i];
		x[c[i]]=make_pair(2,i);;
		y[d[i]]=make_pair(2,i);;
	}
	FOR(i,0,n){
		FOR(j,0,n){
			if(a[i]<c[j]&&b[i]<d[j])add_edge(i,j+n);
		}
	}

	cout<<bipartite_match()<<endl;
    return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  
  for(int i = 0; i < W + 2; i++) {
    cout << "#";
  }
  cout << endl;
  
  for(int j = 0; j < H; j++) {
    string s;
    cin >> s;
    cout << "#" << s << "#" << endl;
  }
  
  for(int k = 0; k < W + 2; k++) {
    cout << "#";
  }
  cout << endl;
}
    

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll v,e,r; cin>>v>>e>>r;
    vector<vector<P>> edges(v);
    rep(i,e){
        ll s,t,d;
        cin>>s>>t>>d;
        edges[s].push_back({d,t});
    }

    vector<ll> dist(v,INF);
    
    priority_queue<P,vector<P>,greater<P>> q;
    q.push({0,r});
    while(!q.empty()){
        P tmp=q.top();
        ll d=tmp.first,t=tmp.second;
        q.pop();
        if(d < dist[t]){
            dist[t] = d;
            for(auto x:edges[t]){
                ll l=x.first,u=x.second;
                if(dist[u] > d+l) q.push({d+l,u});
            }
        }
    }
    
    for(auto d:dist){
        if(d==INF) cout<<"INF"<<endl;
        else cout<<d<<endl;
    }
    return 0;
}


Measured memory_bytes: 21428
#include <iostream>
#include <vector>

using namespace std;


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

    vector<int> Nums;

    //1-0-1-0-1-0を作りたい。
    int now = 1;
    int cnt = 0;
    for(int i = 0; i < N; i++){
        if(S[i] == (char)('0'+now)) cnt++;
        else{
            Nums.push_back(cnt);
            //０と1を切り替える。
            now = 1 - now;
            cnt = 1;
        }
    }
    //最後が加えられてなかったら加える
    if(cnt != 0) Nums.push_back(cnt);

    //1-0-1-0のようにするには偶数にならないといけない。偶数じゃなかったら最後の0が足りてないってことだから0を足してあげる。
    if(Nums.size() % 2 == 0) Nums.push_back(0);

    //今回の見る範囲
    int Add = 2 * K + 1;

    //事前に変化していく変数を用意する。
    int left = 0;
    int right = 0;
    int tmp = 0; //leftからrightを含めないまでの合計

    int ans = 0;

    for(int i = 0; i < Nums.size(); i += 2){
        //移動していくゴール地点を用意。
        int Nextleft = i;
        int Nextright = min(i + Add, (int)Nums.size());

        //ゴール地点に行くまで、左は減らしてみぎは足していく。
        while(Nextleft > left){
            tmp -= Nums[left];
            left++;
        }
        while(Nextright > right){
            tmp += Nums[right];
            right++;
        }

        ans = max(ans, tmp);
    }

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


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1ll << 62)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){
  
  int n,m;
  cin >> n >> m;
  vector<int> a(m),b(m);
  vector<ll> c(m,0);
  REP(i,m){
    cin >> a[i] >> b[i];
    REP(j,b[i]){
      int x;cin >> x;
      x--;
      c[i] |= (1 << x);
    }
  }
  vector<vector<ll>> dp(m,vector<ll>((1 << n),INF));
  dp[0][0] = 0;
  dp[0][c[0]] = a[0];
  REP(i,m-1){
    REP(j,(1 << n)){
      dp[i+1][j] = min(dp[i][j],dp[i+1][j]);
      dp[i+1][(j | c[i+1])] = min(dp[i+1][(j | c[i+1])],dp[i][j]+a[i+1]);
    }
  }
  dp[m-1][(1 << n)-1] != INF ? cout << dp[m-1][(1 << n)-1] << endl: cout << -1 << endl;
  


  

  return 0;
}

Measured memory_bytes: 32384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long h = in.nextLong();
        long[] dp = new long[1000];
        //initialize
        for(int i = 0; i < 1000; i++) {
            dp[i] = -1;
        }
        dp[0] = 0;
        dp[1] = 1;
        
        System.out.println(solve(h));
        
    }

    public static long solve(long x) {
        if(x == 1) {
            return 1;
        } else {
            return 2 * solve(x/2) + 1;
        }
    }

}


Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
using namespace std;
 
int main() {
	int n,m;
    cin>>n>>m;
    int a[m+1]={};
    for(int i=0;i<n;i++){
        int temp;
        cin>>temp;
        for(int j=0;j<temp;j++){
            int alpha;
            cin>>alpha;
            a[alpha]++;
        }
    }
    int ans=0;
    for(int i=0;i<m+1;i++){
        if(a[i]==n){
            ans++;
        }
    }
    cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#Exhaustive Search (bit全探索ver)
n = int(input())
A = list(map(int,input().split()))
q = int(input())
m = list(map(int,input().split()))

count_list = []
for i in range(1<<n):
    copy_A = A.copy()
    count = 0
    for j in range(n):
        mask = 1 << j
        if mask & i != 0:
            count += A[j]
    count_list.append(count)

for k in m:
    if k in count_list:
        print('yes')
    else:
        print('no')
    


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

int main()
{
  char c;
  cin >> c;
  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
  {
    cout << "vowel" << endl;
  }
  else
  {
    cout << "consonant" << endl;
  }
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)


int main(){
  ll a,b,q;
  cin >> a >> b >> q;
  ll s[a],t[b],x[q];
  rep(i,a)cin >> s[i];
  rep(i,b)cin >> t[i];
  rep(i,q)cin >> x[i];

  rep(i,q){
    ll *spos =lower_bound(s,s+a,x[i]);
    ll *tpos =lower_bound(t,t+b,x[i]);
    ll sidx= distance(s,spos);
    ll tidx= distance(t,tpos);
    ll sd[2],td[2];
    //cout << sidx <<" " << tidx << endl;
    if(sidx>0){
      sd[0]=s[sidx-1];
    }
    sd[1]=s[sidx];
    if(sidx==0)sd[0]=sd[1];
    if(sidx==a)sd[0]=sd[1]=s[sidx-1];

    if(tidx>0){
      td[0]=t[tidx-1];
    }
    td[1]=t[tidx];
    if(tidx==0)td[0]=td[1];
    if(tidx==b)td[0]=td[1]=t[tidx-1];

    ll ans=1e12;
    //cout << sd[0] <<" "<< sd[1] <<" "
    //<< td[0] <<" "<< td[1] <<" " <<endl;
    //ここまでok
    rep(k,2){
      rep(j,2){
        ll res=0;
        res+=abs(x[i]-sd[k]);
        res+=abs(sd[k]-td[j]);
      //  cout << res << " ";
        ans=min(ans,res);
        res =0;
        res+=abs(x[i]-td[j]);
        res+=abs(td[j]-sd[k]);
        //cout << res << " ";
        ans=min(ans,res);
      }
    }
    cout << ans <<endl;
  }
}


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

#include <atcoder/all>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
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;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

typedef struct UnionFindTree {
    vector<int> par;

    UnionFindTree(int n) { par.resize(n, -1); }

    bool is_root(int x) { return par[x] < 0; }

    int find(int x) {
        if (is_root(x)) return x;
        return par[x] = find(par[x]);
    }

    int size(int x) { return -par[find(x)]; }

    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    bool same(int x, int y) { return find(x) == find(y); }
} UF;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    UF uf(n);
    int cnt = n;
    rep(_, m) {
        int a, b;
        scanf("%d%d", &a, &b);
        --a;
        --b;
        cnt -= uf.unite(a, b);
    }
    printf("%d\n", cnt - 1);
}

Measured memory_bytes: 3872
#include <iostream>
using namespace std;
int digitSum(int n) {
    int ret = 0;
    while (n > 0) {
        ret += n % 10;
        n /= 10;
    }
    return ret;
}
int main() {
    int N, A, B, ans = 0, ds;
    cin >> N >> A >> B;
    for (int i = 1; i <= N; i++) {
        ds = digitSum(i);
        if (A <= ds && ds <= B) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int n, a, b;
	string s;
	cin >> n >> a >> b >> s;
	int cntab, cntb;
	cntab = 0, cntb = 0;
	lp(n) {
		if (s[i] == 'a') {
			if (cntab < a + b) {
				cout << "Yes" << endl;
				cntab++;
			}
			else cout << "No" << endl;
		}
		else if (s[i] == 'b') {
			if (cntab < a + b&&cntb < b) {
				cout << "Yes" << endl;
				cntab++;
				cntb++;
			}
			else cout << "No" << endl;
		}
		else cout << "No" << endl;
	}
	return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s;

int main() {
	cin >> s;
	inc(i, 5) { s += '@'; }
	
	cout << (s.substr(0, 4) == "YAKI" ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 768
li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a=int(input())
print(li[a - 1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, k;
	cin >> n >> k;
	int t;
	if (n % 2 == 1) t = n / 2 + 1;
	else t = n / 2;
	cout << (t >= k ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<(n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
struct UF
{
  vector<int> par; // 親のインデックスを記憶する配列
  vector<int> sz; // サイズを記憶する。
  vector<int> rank;
  // 初期化
  UF(int n):par(n),sz(n),rank(n){
    for(int i = 0; i < n; i++){
      par[i] = i;sz[i] = 1;rank[i] = 0;
    }
  }
  // 親を求める
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  // xとyの属する集合を併合
  void merge(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if(rank[x] < rank[y]){
      par[x] = y;
      sz[y] += sz[x];
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      if(rank[x] == rank[y])rank[x]++;
    }
  }
  // xとyが同じ集合ならtrue
  bool same(int x, int y) { return find(x) == find(y); }
  // 素の集合のサイズを求める
  int size(int n){return sz[find(n)];}
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  UF uni(n+10);
  vi ans;
  vector<pair<ll,ll>>pll(m);
  ll now=n*(n-1)/2;
  for(int i=0;i<m;i++){
    cin>>pll[i].F>>pll[i].S;
  }
  for(int i=m-1;i>=0;i--){
    ans.pb(now);
    if(uni.same(pll[i].F,pll[i].S)==false){
      now-=uni.size(pll[i].F)*uni.size(pll[i].S);
      uni.merge(pll[i].F,pll[i].S);
    }
  }
  for(int i=m-1;i>=0;i--)
    cout<<ans[i]<<endl;
  return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   ll n;cin >>n;
   vector<ll>a(n);
    for (int i = 0; i < n; ++i) {
        ll x;cin>>x;
        x-=(i+1);
        a[i]=x;
    }
   sort(all(a));
    ll b=a[n/2];
   ll ans=0;
    for (int i = 0; i < n; ++i) {
        ans+=abs(a[i]-b);
    }
    cout <<ans <<endl;
   return 0;
}

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

#define pb push_back
#define F first
#define S second
#define fo(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
    return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

const int N = 2e5 + 3;
int n, a[N];
int cntPos(int i, ll val) {
	int lo = i + 1, hi = n - 1, ret = i;
  	while (lo <= hi) {
    	int mid = (lo + hi) / 2;
      	if ((ll) a[i] * a[mid] <= val) {
			ret = mid;
          	lo = mid + 1;
        } else{
        	hi = mid - 1;
        }
    }
	return ret - i;
}
int cntNeg(int i, ll val) {
	int lo = i + 1, hi = n - 1, ret = n;
  	while (lo <= hi) {
    	int mid = (lo + hi) / 2;
      	if ((ll) a[i] * a[mid] <= val) {
			ret = mid;
        	hi = mid - 1;
        } else{
          	lo = mid + 1;
        }
    }
	return n - ret;
}
int main() {
	ll k;
  	cin >> n >> k;
  	for (int i = 0; i < n; ++i)
      	cin >> a[i];
  	sort(a, a + n);
	ll lo = -1e18, hi = 1e18, res = -1;
	while (lo <= hi) {
		ll mid = (lo + hi) / 2, counter = 0;
		for (int i = 0; i < n; ++i) {
          	if (a[i] > 0)
              counter += cntPos(i, mid);
          	else
            	counter += cntNeg(i, mid);
        }
		if (counter < k) {
			lo = mid + 1;
		} else {
			res = mid;
			hi = mid - 1;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1024
# coding: utf-8
# Your code here!

A, B = map(int, input().split())

# print(A)
# print(B)

if A % 3 == 0:
    print('Possible')
elif B % 3 == 0:
    print('Possible')
elif (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

Measured memory_bytes: 2940
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector<int> seq{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;

    cin >> k;

    cout << seq[k - 1] << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int n;
    if ((s[0] == s[1] && s[2] == s[3] || s[0] == s[2] && s[1] == s[3] || s[2] == s[1] && s[0] == s[3])&&!(s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3]))
        cout << "Yes" << endl;
    else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  ll n, d;
  cin >> n >> d;
  int ans = 0;
  rep(i, n){
    int a, b;
    cin >> a >> b;
    ll x = (ll)a*a+(ll)b*b;
    if(d*d >= x) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
string a[10005];
int n,m;
int main()
{
    cin>>n>>m; 
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++)cout<<a[i];
  return 0;
}//咕咕

Measured memory_bytes: 384
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
S = list(sr())
start = 0
for i in range(1, N):
    if S[i] == S[i-1]:
        start += 1

answer = min(start + 2 * K, N-1)
print(answer)
# 45

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;

int checker(vector<string> &c) {
  int count = 0;
  for (int i = 0; i < c.size(); i++) {
    for (int j = 0; j < c[i].size(); j++) {
      if (c[i][j] == '#') {
        count++;
      }
    }
  }

  return count;
}

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h), temp(h);
  for (int i = 0; i < h; i++) {
    cin >> c[i];
  }
  temp = c;

  int ans = 0;

  vector<vector<bool>> flag(h, vector<bool>(w, false));

  for (int hbit = 0; hbit < (1 << h); hbit++) {
    for (int wbit = 0; wbit < (1 << w); wbit++) {
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
          if (hbit & (1 << i)) {
            c[i] = string('r', w);
          }
          if (wbit & (1 << j)) {
            for (int l = 0; l < h; l++) {
              c[l][j] = 'r';
            }
          }
        }
      }
      if (checker(c) == k) {
        ans++;
      }
      c = temp;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3648
#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil

using namespace std;

int main() {

	int A, B;
	cin >> A >> B;

	cout << A * B << endl;

	return 0;

}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    string S, T;
    cin >> S >> T;

    bool f = true;
    string U;
    REP(i,0,51) U += 'z';
    if(SZ(S) < SZ(T)) f = false;
    else {
        string V;
        REP(i,0,SZ(S)-SZ(T)+1) {
            bool g = true;
            V = S;
            REP(j,0,SZ(T)) {
                if(S[i+j] != T[j]) {
                    if (S[i+j] == '?') V[i+j] = T[j];
                    else {
                        g = false;
                        break;
                    }
                }
            }
            if(g) {
                REP(j,0,SZ(V)) {
                    if(V[j] == '?') {V[j] = 'a';}
                }
                U = MIN(U,V);
            }
        }
    }

    if(SZ(U) == 51) f = false;
    if(f) PR(U);
    else PR("UNRESTORABLE");


    return 0;
}

/*



*/

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int maxn = 1e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k, q;
    cin >> n >> k >> q;
    vector<int>v,d;
    f (n) {
        int x;
        cin >> x;
        v.pb(x);
    }
    d = v;
    sort(all(d));
    v.pb(-1e9);
    int mi = 1e9;
    for (int i = 0 ; i < n; i++) {
        vector<int>now;
        vector<int>g;
        for (auto j : v) {
            if (j < d[i]) {
                sort(all(now));
                for (int l = 0 ; l < (int)now.size() - k + 1 ; l++) {
                    g.pb(now[l]);
                }
                now.clear();
            }
            else {
                now.pb(j);
            }
        }
        if ((int)g.size() >= q) {
            sort(all(g));
            mi = min(mi, g[q - 1] - g[0]);
        }
    }
    cout << mi << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    string st;
    cin>>st;
    REP(i,st.length()-1){
        if(st.substr(i,2)=="AC"){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
// CGL_1_B
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main(){
	double xx, yy, X, Y, x, y;
	int xp[2], yp[2], q;

	cin>>xp[0]>>yp[0]>>xp[1]>>yp[1];
	X = xp[1] - xp[0];
	Y = yp[1] - yp[0];

	cin>>q;
	for(int i=0;i<q;i++){
		cin>>xx>>yy;

		if(Y == 0){
			x = xx;
			y = 2*yp[0]-yy;
		}else if(X == 0){
			x = 2*xp[0]-xx;
			y = yy;
		}else{
			x = (X*X*xx-Y*Y*xx+2*X*Y*yy+2*Y*Y*xp[0]-2*X*Y*yp[0])/(X*X+Y*Y);
			y = -X/Y*(x-xx)+yy;
		}

		printf("%.10lf %.10lf\n", x, y);
	}

	return 0;
}

Measured memory_bytes: 1248
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define reads(s) string s; cin >> s;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, n) {cin >> a[i];}
#define readmat(a, n, m) int a[(n) + 1][(m) + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x);
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7; 

vvi adj(2e5), tns(2e5); vi topo, vis(2e5);

void dfs (int cur)
{
    vis[cur] = 1;
    for (int i : adj[cur]) if(!vis[i]) dfs(i);
    topo.pb(cur);
}
     
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    #ifndef ONLINE_JUDGE 
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
        freopen ("OUTPUT_ERROR.txt" , "w" , stderr);
    #endif

    //start from here

    readb(n, m)
    int x, y;

    fori (i, 1, m)
    {
        cin >> x >> y;
        adj[x].pb(y); tns[y].pb(x);
    }

    fori (i, 1, n)
    {
        if(!vis[i]) dfs(i);
    }

    reverse(all(topo));

    vi dp(n+1); int ans = 0;

    for (int i : topo)
    {
        for (int x : adj[i]) dp[x] = max(dp[x], dp[i] + 1);
    }

    fori (i, 1, n) ans = max(ans, dp[i]);

    print(ans)

    return 0;
}


Measured memory_bytes: 24108
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
  int N, M;
  cin >> N >> M;
  vi AC(N), WA(N);
  int ac = 0, wa = 0;
  rep(i, M)
  {
    int p;
    string S;
    cin >> p >> S;
    if (S == "AC")
    {
      if (AC.at(p - 1) == 0)
      {
        ac++;
        wa += WA.at(p - 1);
      }
      AC.at(p - 1) = 1;
    }
    else
    {
      WA.at(p - 1)++;
    }
  }
  cout << ac << " " << wa << endl;
}

Measured memory_bytes: 1024
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();

    println!("{} {} {}", a / b, a % b, (a as f64) / (b as f64));
}


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

int x,a,b;
cin >> x >> a >> b;

if(0<=a-b )cout << "delicious" << endl;
else{
  if(b-a <= x)cout << "safe" << endl;
  else cout << "dangerous" << endl;
}
  return 0;

}

Measured memory_bytes: 256