akhauriyash/Code-Regression huggingface dataset:
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int N; cin >> N;
	ll sum = 0;
	ll mi = LLINF;
	ll ok = true;
	rep(i, N){
		ll a, b; cin >> a >> b;
		sum += a;
		if(a > b){
			mi = min(mi, b);
		}
		if(a != b) ok = false;
	}
	if(ok){
		cout << 0 << endl;
	}
	else{
		cout << sum - mi << endl;
	}


	return 0;
}


Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;

#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define vt vector
#define vll vt<ll>
#define pll pair<ll,ll>
#define vpll vt<pll>
#define vvll vt<vll>
#define all(v) v.begin(),v.end()
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define go_t int testcases; cin>>testcases; ffo(caseno,1,testcases)

#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"

#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';

const ll mod = 1e9 + 7;
const ll N = 1e6 + 6;
const ll maxN = 2e5 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

ll powerM(ll x, ll y, ll M = mod) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

// Ashishgup

ll n, ans;
ll a[maxN];
ll h[maxN];
ll bit[maxN];

void update(ll idx, ll val)
{
	while (idx <= n)
	{
		bit[idx] = max(bit[idx], val);
		idx += idx & -idx;
	}
}

ll pref(ll idx)
{
	ll ans = 0;
	while (idx > 0)
	{
		ans = max(ans, bit[idx]);
		idx -= idx & -idx;
	}
	return ans;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in1.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	FIO
	cin >> n;
	FOR(i, n) {
		cin >> h[i + 1];
	}
	FOR(i, n) {
		cin >> a[i + 1];
	}
	for (ll i = 1; i <= n; i++)
	{
		ll maxPrev = pref(h[i] - 1);
		maxPrev += a[i];
		ans = max(ans, maxPrev);
		update(h[i], maxPrev);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 8348
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    S = in_s()
    N = len(S)

    cnt = 0
    for i in range(N):
        cnt += int(S[i])

    if cnt % 9 == 0:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67928
#include <iostream>
#include <cmath>

using namespace std;

int main(){

    int  N;

    cin >> N;

    int temp = N%10;

    switch(temp){
        case 0:
        case 1:
        case 6:
        case 8:
            cout<< "pon"<<endl;
            break;
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout<< "hon"<<endl;
            break;

        case 3:
            cout<< "bon"<<endl;
            break;
        default:
            break;
    }
}



Measured memory_bytes: 3636
import collections
n = int(input())
s = []
for i in range(n):
  s.append(input())
m = int(input())
t = []
for i in range(m):
  t.append(input())
first = collections.Counter(s)
list1 = list(first.items())
second = collections.Counter(t)
list2 = list(second.items())
list3 = list(second.keys())
ans = 0
for i in list1:
  if i[0] in list3:
    tmp = i[1]-list2[list3.index(i[0])][1]
  else:
    tmp = i[1]
  if tmp > ans:
    ans = tmp
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, s, n) for(int i = s; i < n; i++)
using namespace std;

vector<vector<int>> x;

double distance(vector<int>& v1, vector<int>& v2) {
    double dis = 0;
    rep(i, v1.size()) {
        dis += (v1[i] - v2[i]) * (v1[i] - v2[i]);
    }
    return sqrt(dis);
}

int main(void) {
    int n, d;
    cin >> n >> d;
    x.resize(10, vector<int>(10 , 0));
    rep(i, n) {
        rep(j, d) {
            cin >> x[i][j];
        }
    }

    int cnt = 0;
    rep(i, n) {
        reps(j, i, n) {
            if (i == j) continue;
            double dis = distance(x[i], x[j]);
            cnt += dis == ceil(dis);
        }
    }

    cout << cnt << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

int main() {
  std::string str;
  std::cin >> str;
  int counter = 0;
  for (int i = 0; i < str.size(); i++) {
    if (counter == 0 && str[i] == 'C') counter++;
    if (counter == 1 && str[i] == 'F') counter++;
  }
  if (counter == 2) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x, y;
  cin >> x >> y;
  
  if(x == 4 || x == 6 || x == 9 || x == 11) x = 1;
  else if(x == 2) x = 2;
  else x = 3;
  
  if(y == 4 || y == 6 || y == 9 || y == 11) y = 1;
  else if(y == 2) y = 2;
  else y = 3;
  
  if(x == y) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 384
// luogu-judger-enable-o2
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int n , k , ans = 1 , i;

int main()

{
	cin >> n >> k;
	
	for( i = 1 ; i <= n ; i++ )
	{
		ans = ans + min( ans , k );
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x

void sort2vectors(vector<int> &av, vector<int> &bv)
{
        int n = av.size();
        vector<int> p(n), av2(n), bv2(n);
        iota(p.begin(), p.end(), 0);
        sort(p.begin(), p.end(), [&](int a, int b) { return av[a] < av[b]; });
        for (int i = 0; i < n; i++) {
                av2[i] = av[p[i]];
                bv2[i] = bv[p[i]];
        }
        av = av2;
        bv = bv2;
}

int main() {

  int N, a;

  cin >> N;

  vector<int> A(N), B(N);

  REP(i, N){
    cin >> a;
    A[i] = a;
    B[i] = i+1;
  }

  sort2vectors(A, B);

  REP(i, N){
    cout << B[i] <<" ";
  }
  cout << endl;

}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 2176
#include <algorithm>
#include <cstring>
#include <iostream>

bool valid(int a, int b, int c) {
    return a <= b + c && b <= c + a + 1 && c <= a + b + 1;
}

void calc(int rear, int front, int west, int east, int north, int south, int limit, char* buffer) {
    bool same = true;
    for (int i = 0; i < limit; i++) {
        int a = rear + front;
        int b = west + east;
        int c = north + south;
        char y;
 
        int temp = rear;
        if (east > 0 && valid(b - 1, c, a)) {
            rear = east - 1;
            east = front;
            front = west;
            west = temp;
            y = 'E';
        } else if (north > 0 && valid(c - 1, a, b)) {
            rear = north - 1;
            north = front;
            front = south;
            south = temp;
            y = 'N';
        } else if (south > 0 && valid(c - 1, a, b)) {
            rear = south - 1;
            south = front;
            front = north;
            north = temp;
            y = 'S';
        } else {
            rear = west - 1;
            west = front;
            front = east;
            east = temp;
            y = 'W';
        }

        if (same) {
            char x = buffer[i];
            if (x < y) {
                return;
            }
            same = x == y;
        }
        buffer[i] = y;
    }
}

char* find(int target[6], int limit) {
    char* buffer = new char[limit + 1];
    std::memset(buffer, 'Z', limit);
    buffer[limit] = '\0';

    std::sort(target, target + 6);
    do {
        if (valid(target[0] + target[1], target[2] + target[3], target[4] + target[5])) {
            calc(target[0], target[1], target[2], target[3], target[4], target[5], limit, buffer);
        }
    } while (std::next_permutation(target, target + 6));

    return buffer;
}

int main() {
    int target[6];
    while (true) {
        bool nonzero = false;
        for (int i = 0; i < 6; i++) {
            std::cin >> target[i];
            nonzero = nonzero || target[i];
        }
        if (!nonzero) {
            break;
        }

        int p, q;
        std::cin >> p >> q;

        char* result = find(target, q);
        if (result[0] == 'Z') {
            std::cout << "impossible" << std::endl;
        } else {
            std::cout << &result[p - 1] << std::endl;
        }
        delete[] result;
    }
    return 0;
}

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

const int maxn=5001*5001;
int aPrices[3], bPrices[3];
ll dp[3][maxn];

ll go(int choice, ll money, bool aBetter) {
	if (choice==3) return money;
	if (dp[choice][money]!=-1) return dp[choice][money];

	//don't take it
	ll best=go(choice+1, money, aBetter);
	
	//take it
	if (((aPrices[choice]<bPrices[choice]) == aBetter) && money>=min(aPrices[choice], bPrices[choice]))
		best=max(best, max(aPrices[choice], bPrices[choice])+go(choice, money-min(aPrices[choice], bPrices[choice]), aBetter));
	return dp[choice][money]=best;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	for (int i=0; i<3; i++)
		for (int j=0; j<maxn; j++)
			dp[i][j]=-1;
	int money; cin>>money;
	for (int i=0; i<3; i++) cin>>aPrices[i];
	for (int i=0; i<3; i++) cin>>bPrices[i];
	for (int m=0; m<money; m++)
		for (int c=3; c>=0; c--)
			go(c, m, true);
	ll midMoney=go(0, money, true);
	for (int i=0; i<3; i++)
		for (int j=0; j<maxn; j++)
			dp[i][j]=-1;
	for (int m=0; m<midMoney; m++)
		for (int c=3; c>=0; c--)
			go(c, m, false);

	ll endMoney=go(0, midMoney, false);
	cout<<endMoney<<'\n';

	return 0;
}


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

int arcnt[3];
bool dp[2009][20009];

bool fn(int n,int y){
	if(n<0 || y<0) return false;
	if(n==0&&y!=0) return dp[n][y]=false;
	if(n!=0&&y==0) return dp[n][y]=false;
	if(dp[n][y]==0) return dp[n][y];
	if(n==0 && y==0) return dp[n][y]=true;
	if(fn(n-1,y-10)==true){
		arcnt[0]++;
		return true;
	}
	if(fn(n-1,y-5)==true){
		arcnt[1]++;
		return true;
	}
	if(fn(n-1,y-1)==true){
		arcnt[2]++;
		return true;
	}
	return dp[n][y]=false;
}

int main(){
	int n,y;
	memset(dp,true,sizeof(dp));
	cin>>n>>y;
	y=y/1000;
	int arr[] = {10,5,1};
	if(fn(n,y)){
		cout<<arcnt[0]<<' '<<arcnt[1]<<' '<<arcnt[2];
	}
	else{
		cout<<"-1 -1 -1";
	}
	return 0;
}


Measured memory_bytes: 39552
n, a, b = map(int, input().split())
sum_all = 0
for i in range(1, n + 1):
    m = str(i)
    sum_m = 0
    for j in range(len(m)):
        sum_m += int(m[j])
    if a <= sum_m <= b:
        sum_all += i
print(sum_all)

Measured memory_bytes: 3060
N, M = list(map(int, input().split()))
mod = 10 ** 9 + 7
pro_N = 1
pro_M = 1
if abs(N - M) > 1:
    print(0)
else:
    for i in range(N):
        pro_N = pro_N * (i + 1) % mod
    for j in range(M):
        pro_M = pro_M * (j + 1) % mod
    if abs(N - M) == 1:
        print((pro_N * pro_M) % mod)
    else:
        print((pro_N * pro_M * 2) % mod)


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  string s; std::cin >> s;
  string ss; rep(i, s.size() / 2) ss += "hi";
  std::cout << (s == ss ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int fw(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}
int bw(const void *a, const void *b)
{
    return *(int *)b - *(int *)a;
}
int main()
{
    int n, m;
    int len, ans;
    int x[100010];
    int dif[100010];
    scanf("%d %d", &n, &m);
    if (n >= m)
    {
        printf("0");
        return 0;
    }
    for (int i = 0; i < m; i++)
    {
        scanf("%d", &x[i]);
    }
    qsort(x, m, sizeof(int), fw);
    len = x[m - 1] - x[0];
    for (int i = 0; i < m - 1; i++)
    {
        dif[i] = x[i + 1] - x[i];
    }
    qsort(dif, m - 1, sizeof(int), bw);
    ans = len;
    for (int i = 0; i < n - 1; i++)
    {
        ans -= dif[i];
    }
    printf("%d", ans);
    return 0;
}

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

#define FOR( i, m, n )	for( int (i) = (m); (i) < (n); i++ )
#define REP( i, n )		FOR( i, 0, n )
#define ALL( x )		(x).begin(), (x).end()

int main() {
	int n, q; cin >> n >> q;

	deque<pair<string, int>> p;
	int time; string name;
	REP( i, n ) {
		cin >> name >> time;
		p.emplace_back( make_pair( name, time ) );
	}

	int elapse = 0;
	pair<string, int> t;
	while( p.empty() == 0 ) {
		t = p.front(); p.pop_front();
		elapse += min( t.second, q );
		t.second -= min( t.second, q );
		if( t.second > 0 ) p.push_back( t );
		else cout << t.first << " " << elapse << endl;
	}

}


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

using namespace std;

const int MAX = 1e8;

int main()
{
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	
	string ans;
	
	for (int i=sy; i<ty; ++i) {
		ans+='U';
	}
	
	for (int i=sx; i<tx; ++i) {
		ans+='R';
	}
	
	for (int i=ty; i>sy; --i) {
		ans += 'D';
	}
	
	for (int i=tx; i>sx; --i) {
		ans += 'L';
	}
	
	ans += 'L';
	for (int i=sy; i<ty+1; ++i ) {
		ans += 'U';
	}
	
	for (int i=sx-1; i<tx; ++i) {
		ans += 'R';
	}
	ans += 'D';
	
	ans += 'R';
	for (int i=ty; i>sy-1; --i) {
		ans += 'D';
	}
	
	for (int i=tx+1; i>sx; --i) {
		ans += 'L';
	}
	ans += 'U';
	
	cout << ans;
	
	return 0;
}


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

int main()
{
  int n,n1,n10,n100;

  cin >> n;

  n100 = n/100;
  n10 = n/10-n100*10;
  n1 = n-n100*100-n10*10;

  if(n1==7 || n10==7 || n100==7){
    cout << "Yes\n";
  }
  else{
    cout << "No\n";
  }
  
  return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;

  const int nmmax = 50;
  char A[nmmax][nmmax], B[nmmax][nmmax];

  rep(y, N) {
    rep(x, N) {
      cin >> A[y][x];
    }
  }

  rep(y, M) {
    rep(x, M) {
      cin >> B[y][x];
    }
  }

  bool exist = false;
  rep(ly, N) {
    rep(lx, N) {
      if (ly+M-1>=N || lx+M-1>=N) continue;
      
      bool match = true;
      rep(y, M) {
        rep(x, M) {
          if (A[ly+y][lx+x] != B[y][x]) match = false;
        }
      }
      if (match) exist = true;
    }
  }

  if (exist)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
 
using namespace std;
 
const int INF=1e9 +5;
 
signed main()
{
    int n;
    cin>>n;
    
    int arr[n];
    
    for(int i=0;i<n;i++)
        cin>>arr[i];
        
    int dp[n];
    
    fill(dp,dp+n,INF);
    
    dp[0]=0;
    
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+2;j++)
        {
            if(j<n)
                dp[j]=min (dp[j] , dp[i] + abs(arr[j]-arr[i]) );
        }
    }
    
    cout<<dp[n-1];
    
    return 0;
}

Measured memory_bytes: 5180
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        GetEverything solver = new GetEverything();
        solver.solve(1, in, out);
        out.close();
    }

    static class GetEverything {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            long[] a = new long[m];
            int[] cc = new int[m];

            for (int i = 0; i < m; i++) {
                a[i] = in.nextLong();
                int b = in.nextInt();
                int c = 0;
                for (int j = 0; j < b; j++) {
                    c += (1 << in.nextInt() - 1);
                }
                cc[i] = c;
            }

            // dp[鍵mまでつかった][箱の状態] = 最小コスト
            long[][] dp = new long[m + 1][(1 << n) + 1];
            for (int i = 0; i <= m; i++) {
                Arrays.fill(dp[i], Integer.MAX_VALUE);
            }

            dp[0][0] = 0;
            // 使う鍵
            for (int i = 0; i < m; i++) {
                // 箱の状態
                for (int j = 0; j < (1 << n); j++) {
                    // 鍵を使わない
                    dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j]);

                    // 鍵を使った箱の状態
                    int status = j | cc[i];
                    dp[i + 1][status] = Math.min(dp[i + 1][status], dp[i][j] + a[i]);
                }
            }


            if (dp[m - 1][(1 << n) - 1] == Integer.MAX_VALUE) {
                out.println(-1);
                return;
            }
            out.println(dp[m][(1 << n) - 1]);
        }

    }
}



Measured memory_bytes: 81752
#include <bits/stdc++.h>
#include <map> // pair
using namespace std;
#define PI 3.14159265359

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}
//---------------------------------------------------------------
int main(){
  double A,B,H,M;
  cin>>A>>B>>H>>M;

  double R = 2*M_PI * (abs(H*5+5*(M/60)-M)/60);
  double ans = B*B+A*A-2*A*B*cos(R);
  ans = sqrt(ans);


  prt_dbl(15,ans);




}


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

long long n,m,A[10000],i;

int main()
{
    cin>>n>>m;
    for (i=0;i<m;i++)
    {
        cin>>A[i];
        n=n-A[i];
    }
    if (n<0) cout<<"-1";
    else cout<<n;
    return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        for(;;){
                int ans=0;
            char c;
                for(;;){
                        scanf("%c",&c);
                        if(c=='\n'){
                                break;
                        }else{
                                ans+=c-'0';
                        }
                }
                if(ans) printf("%d\n",ans);
                if(!ans) break;
        }
        return 0;
}

Measured memory_bytes: 1120
#include<stdio.h>
    void changeString(int N,char *p){
      while(*p){
        if(*p+N<='Z') *p=*p+N;
        else *p=*p+N-26;
        printf("%c",*p);
        p++;
      }
      return;
    }
    int main(){
      int N;
      char c[10001];
      scanf("%d",&N);
      scanf("%s",c);
      changeString(N,c);
      printf("\n");
      return 0;
    }

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


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

    if(b%a == 0)cout<<a+b<<endl;
    else cout<<b-a<<endl;
        
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define N 131072
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
int main(){
    char c[200005];
    scanf("%s",c);
    LL cnt=0;
    int temp=0;
    for(int i = 0;c[i]!=0;i++){
        if(c[i]=='A')temp++;
        else if(c[i]=='B'&&c[i+1]=='C'){
            cnt+=temp,i++;
        }
        else{
            temp=0;
        }
    }
    printf("%lld\n",cnt);
}
/*
0.5 0.5
0.5 0.25
0.25 0.125
0.25
*/

Measured memory_bytes: 384
fn main() {
    let a = read_i64();
    let b = read_i64();
    let h = read_i64();
    println!("{}", solve(a, b, h));
}

fn solve(a: i64, b: i64, h: i64) -> i64 {
    (a + b) * h / 2
}

fn read_i64() -> i64 {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf);
    buf.trim().parse().unwrap()
}

fn read_vec_i64() -> Vec<i64> {
    use std::str::FromStr;
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim().split(' ').map(|s| i64::from_str(s).unwrap()).collect()
}


Measured memory_bytes: 4352
#include <iostream>
#include <limits.h>
using namespace std;

int main(void){
	int n;
	int r;
	int max = -2000000000;
	int min;

	cin >> n;

	cin >> r;
	min = r;
	for(int i=1; i<n; i++){
		cin >> r;
		if(r - min > max){
			max = r - min; 
		}
		if(min > r) min = r;
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
 
#define LL long long
 
int main(){
    LL n;
    cin>>n;
    LL c=0;
    vector<LL>monsters(n+1);
    vector<LL>heros(n);
    for(LL i=0;i<=n;i++){
        cin>>monsters[i];
    }
    for(LL i=0;i<n;i++){
        cin>>heros[i];
    }
    for(LL i=0;i<n;i++){
        if(heros[i]<=monsters[i]){
            c+=heros[i];
        }
        else{
            c+=monsters[i];
            heros[i]-=monsters[i];
            if(heros[i]<=monsters[i+1]){
                c+=heros[i];
                monsters[i+1]-=heros[i];
            }
            else{
                c+=monsters[i+1];
                monsters[i+1]=0;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
    long long x,y;scanf("%lld%lld",&x,&y);
    if(x==1||y==1){
        printf("1\n");
        return 0;
    }

    long long ans=x*y;
    printf("%lld\n",ans%2==1?ans/2+1:ans/2);
    return 0;
}

Measured memory_bytes: 128
#define ll long long
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
//#include<bits/stdc++.h>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
ll pi = acos(-1) ;
ll z =  1000000007 ;
ll inf = 100000000000000000 ;
ll p1 = 37 ;
ll p2 = 53 ;
ll mod1 =  202976689 ;
ll mod2 =  203034253 ;
ll fact[100] ;
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll power(ll a ,ll b , ll p){if(b == 0) return 1 ; ll c = power(a , b/2 , p) ; if(b%2 == 0) return ((c*c)%p) ; else return ((((c*c)%p)*a)%p) ;}
ll inverse(ll a ,ll n){return power(a , n-2 , n) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
ll min(ll a , ll b){if(a < b) return a ; return b ;}
ll left(ll i){return ((2*i)+1) ;}
ll right(ll i){return ((2*i) + 2) ;}
ll ncr(ll n , ll r){if(n < r) return 0 ; return ((((fact[n] * inverse(fact[r] , z)) % z) * inverse(fact[n-r] , z)) % z);}
void swap(ll&a , ll&b){ll c = a ; a = b ; b = c ; return ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
//__builtin_popcount(n) -> returns number of set bits in n


void solve()
{
    
    ll k  , ans = 0;
    cin >> k ;
    //cout << k << endl ;
    for(ll a = 1; a <= k ; a++)
    {
        for(ll b = 1; b <= k ; b++)
        {

            for(ll c = 1; c <= k ; c++)
            {
                //cout << a << ' ' << b << ' ' << c << endl ;
                ll e = gcd(a , b) ;
                ans += gcd(c , e) ;
                //cout << ans << endl ;
            }
        }
    }
    cout << ans << endl ;
    return ;
}
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif*/
   
    ll t ;
    //cin >> t ;
    t = 1 ;
    while(t--)
    {
        solve() ;
    }
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define mkp make_pair
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<<endl;}}
#define print1d(mat,n){for(int i=0;i<(int)(n);i++)cout<<mat[i]<<" ";cout<<endl;}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define printpair(v) for(auto val: v){cout<<val.fi<<":"<<val.se<<", ";}cout<<endl;
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<endl;
#define init(v,x) for (auto &itr:v){itr=x;}
#define ln length()
const int mod = 998244353;
#define sz size()
const int inf = 1e18;
vector<int> adj[100005];
int dp[100005];
void dfs(int s){
    dp[s]=1;
    int ma=0;
    rr(adj[s]){
        if(dp[val]==-1){
            dfs(val);
            if(dp[val]>ma){
                ma=dp[val];
            }
        }
        else{
            if(dp[val]>ma){
                ma=dp[val];
            }
        }
    }
    dp[s]+=ma;
}
void solve() {
    clr(dp,-1);
    int n,m;
    int a,b;
    cin>>n>>m;
    rep(i,0,m){
        cin>>a>>b;
        adj[a].pub(b);
    }
    vector<int> v;

    rep(i,1,n+1){
        if(dp[i]==-1)
        dfs(i);
    }
    cout<<*max_element(dp+1,dp+n+1)-1<<endl;

}

int32_t main(){
    fastIO
#ifndef ONLINE_JUDGE
    freopen(R"(C:\Users\swast\CLionProjects\untitled\input.txt)", "r", stdin);
#endif
    int t=1;
//    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 11760
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int n;
vi ans;
//struct Edge { int to, cost;};
struct Edge { int to, id;};
vector<vector<Edge>> g; // main()でg.resize(n)

void dfs(int v, int c=-1, int p=-1) {
  // 頂点をみてるときにやること
  int k = 1;
  rep(i,g[v].size()) {
    int u = g[v][i].to, ei = g[v][i].id;
    if (u == p) continue;
    // 辺をみてるときにやること
    if (k == c) k++;
    ans[ei] = k++;
    dfs(u,ans[ei],v);
    // 辺をみてるときにやること    
  }
  // 頂点をみてるときにやること  
}

int main () {
  cin >> n;
  g.resize(n);
  ans = vi(n-1);
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back((Edge){b,i});
    g[b].push_back((Edge){a,i});
  }
  dfs(0);
  int mx = 0;
  rep(i,n) {
    mx = max(mx, sz(g[i]));
  }
  cout << mx << endl;
  rep(i,ans.size()) printf("%d\n", ans[i]);
  return 0;
}

Measured memory_bytes: 8320
n, capa, k = list(map(int, input().split()))

times = [int(input()) for _ in range(n)]
times.sort()

ans = 0
t_first_arrived = times[0]
num_first_arrived = 0

for i in range(n):
	if (times[i] > t_first_arrived + k):
		ans += 1
		t_first_arrived = times[i]
		num_first_arrived = i

	elif i >= num_first_arrived + capa:
		ans += 1
		t_first_arrived = times[i]
		num_first_arrived = i

ans += 1

print(ans)

Measured memory_bytes: 7488
import math
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

D = [0,0,0,0]
dis = []
for i in range(n):
    D[0] += abs(x[i]-y[i])
    D[1] += (x[i]-y[i])**2
    D[2] += abs((x[i]-y[i]))**3
    dis.append(abs(x[i]-y[i]))

D[1] = math.sqrt(D[1])
D[2] = math.pow(D[2],1/3)
D[3] = max(dis)

for i in range(4):
    print(D[i])

Measured memory_bytes: 7796
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  char b;
  cin >> b;
  if (b == 'A')
    cout << "T" << endl;
  else if (b == 'C')
    cout << "G" << endl;
  else if (b == 'G')
    cout << "C" << endl;
  else
    cout << "A" << endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())

l=[[] for j in range(n)]
for i in range(m):
  p,y=map(int,input().split())
  l[p-1].append([y,i])
for j in range(n):
  l[j].sort(key=lambda x:x[0])
lis=[]
for j in range(n):
  for t in range(len(l[j])):
    pre='0'*(6-len(str(j+1)))+str(j+1)
    y='0'*(6-len(str(t+1)))+str(t+1)
    b=pre+y
    lis.append([b,l[j][t][1]])
lis.sort(key=lambda x:x[1])
for li in lis:
  print(li[0])

Measured memory_bytes: 48716
#include<iostream>
using namespace std;
short a[21],b[21],c[20];
int main()
{
	short n,i;
	cin>>n;
	for(i=1;i<=n;++i)
		cin>>a[i];
	for(i=1;i<=n;++i)
		cin>>b[i];
	for(i=1;i<n;++i)
		cin>>c[i];
	int ans=0;
	for(i=1;i<=n;ans+=b[a[i]]+c[(a[i]-1)*(a[i]-a[i-1]==1)],++i);
	cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int gcd(int x,int y) {//??????????????????????????????
	int r;
	if (x < y)swap(x, y);
	while (y > 0) {
		r = x%y;
		x = y;
		y = r;
	}
	return x;
}

int main() {
	unsigned long long  a, b, c;
	while (cin >> a >> b) {
		c = gcd(a, b);
		cout << c <<" "<<a*b/c<< endl;
	}
	return 0;
}

Measured memory_bytes: 2992
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int f(int n){int s=0;while(n!=0){s+=n%10;n/=10;}return s;}

signed main() {
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  int ans = INF,a,b,memo;;
  rep(i,1,n/2+2){
    a=i;
    b=n-i;
    memo=f(a)+f(b);
    //cout << a << ' '<<b<<' '<<f(a) << ' '<<f(b) << endl;
    ans = min(memo,ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n, m, ary[105][105], a[105];
	while(scanf("%d %d", &n, &m) != EOF)
	{
		for(int i = 0; i < n; i++)
		{
			int sum = 0;
			for(int j = 0; j < m; j++)
			{
				scanf("%d", &ary[i][j]);
				sum += ary[i][j];
			}
			ary[i][m] = sum;
		}
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j <= m; j++)
			{
				printf("%d", ary[i][j]);
				if(j != m)
				{
					printf(" ");
				}
			}
			puts("");
		}
		for(int i = 0; i <= m; i++)
		{
			int sum = 0;
			for(int j = 0; j < n; j++)
			{
				sum += ary[j][i];
			}
		    printf("%d", sum);
			if(i != m)
			{
				printf(" ");
			}
	    }
	    puts("");
	}
	return 0;
	
}


Measured memory_bytes: 2708
#include <cstdio>
#include <cstdlib>
#include <cstring>

struct Node{
    int key;
    Node *prev, *next;
};

Node *nil;

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;

    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node* listSearch(int key){
    Node *cur = nil->next;
    while(cur != nil && cur->key != key){
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t){
    if(t == nil){ return; }
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deletekey(int key){
    deleteNode(listSearch(key));
}

void printList(){
    Node *cur = nil->next;
    int isf = 0;
    while(1){
        if(cur == nil){ break; }
        if(isf++ > 0){ printf(" "); }
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

int main()
{
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;

    scanf("%d", &n);
    init();

    for(i = 0; i < n; i++){
        scanf("%s%d", com, &key);

        if(com[0] == 'i'){ insert(key); np++; size++; }
        else if(com[0] == 'd'){
            if(strlen(com) > 6){
                if(com[6] == 'F'){ deleteFirst(); }
                else if(com[6] = 'L'){ deleteLast(); }
            }else{
                deletekey(key);
                nd++;
            }
            size--;
        }
    }

    printList();

    return 0;
}


Measured memory_bytes: 33860
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll a[7];
    for(int i = 0; i < 7; i++) cin >> a[i];
    ll ans = a[0] / 2 * 2 + a[1] + a[3] / 2 * 2 + a[4] / 2 * 2;
    if(a[0] % 2 + a[3] % 2 + a[4] % 2 == 2 && min(a[0], min(a[3], a[4])) > 0) ans++;
    if(a[0] % 2 + a[3] % 2 + a[4] % 2 == 3) ans += 3;
    cout << ans << endl;
}


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

vector<int> fibonacci_list(45,0);

int fibonacci(int n){
    int f;
    if(fibonacci_list.at(n)!=0){
        f=fibonacci_list.at(n);
    }else{
        f=fibonacci(n-1)+fibonacci(n-2);
        fibonacci_list.at(n)=f;
    }
    return f;
}

int main(){
    fibonacci_list.at(0)=1;
    fibonacci_list.at(1)=1;
    int n;
    cin >> n;
    cout << fibonacci(n) << endl;
    return 0;
}


Measured memory_bytes: 3072
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    def num2alpha(num):
        if num<=26:
            return chr(64+num)
        elif num%26==0:
            return num2alpha(num//26-1)+chr(90)
        else:
            return num2alpha(num//26)+chr(64+num%26)
    i = I()
    print(num2alpha(i).lower())
    return


if __name__ == "__main__":
    solve()


Measured memory_bytes: 67224
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define re(i , n) for(Long i = 0; i < (Long)n ; i++)
#define rer(i, a, b) for (Long i = a, to = b; i < to; i++)

using namespace std;
typedef long long Long;
const Long MX=2e5 + 1;
const Long MOD=1000000007;
const Long MX2=9223372036854775806;
vector<Long> v(200),n(200);



int main(){
	ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	Long n;cin>>n;
	vector<Long> v(n),a(n),b(n);
	re(i,n){
		cin>>v[i];
		a[i]=i-v[i];
		b[i]=i+v[i];
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	Long conta=0;
	re(i,n){
		bool is_present=binary_search(b.begin(),b.end(),a[i]);
		if(is_present){
			vector<Long>::iterator it1=lower_bound(b.begin(),b.end(),a[i]);
			vector<Long>::iterator it2=upper_bound(b.begin(),b.end(),a[i]);
			conta+=it2-it1;
		}
	}
	cout<<conta;
}

Measured memory_bytes: 7952
#include<stdio.h>

int main(void){
	int n, i;
	int x = 100000;
	scanf("%d", &n);

	for(i = 0; i < n; i++){
		x = x + x*0.05;
		if((x % 1000) != 0){
			x = x - (x % 1000) + 1000;
		}
	}

	printf("%d\n", x);

	return 0;
}

Measured memory_bytes: 592
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

int H, W;
int a[82][82];
int b[82][82];

constexpr size_t MX = 82 * 160;

bitset<MX * 2> dp[82][82];

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

    read(H, W);
    rep(i, 0, H) rep(j, 0, W) read(a[i][j]);
    rep(i, 0, H) rep(j, 0, W) read(b[i][j]);

    const auto diff = [&](int i, int j) { return abs(a[i][j] - b[i][j]); };

    dp[0][0][MX + diff(0, 0)] = true;
    dp[0][0][MX - diff(0, 0)] = true;

    rep(i, 0, H) rep(j, 0, W) {
        const int d1 = diff(i + 1, j);
        dp[i + 1][j] |= dp[i][j] << d1;
        dp[i + 1][j] |= dp[i][j] >> d1;

        const int d2 = diff(i, j + 1);
        dp[i][j + 1] |= dp[i][j] << d2;
        dp[i][j + 1] |= dp[i][j] >> d2;
    }

    int ans = 0;
    auto &f = dp[H - 1][W - 1];
    while (!f[MX - ans] && !f[MX + ans]) ++ans;
    print(ans);

    return 0;
}


Measured memory_bytes: 21632
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define gt first
#define gc second.first
#define gr second.second
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,g;
	while(scanf("%d",&n)!=EOF){
		g = 1;
		while(n > 0){
			if(n%2){
				cout << g << ((n/2)?" ":"\n");
			}
			n /= 2;
			g *= 2;
		}
	}
}



Measured memory_bytes: 3124
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
s.sort()
total = sum(s)
if total % 10 != 0:
    print(total)
else:
    i = 0
    while i <= n - 1:
        if s[i] % 10 == 0:
            i += 1
        else:
            total -= s[i]
            break
    else:
        total = 0
    print(total)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1000000007;
const long long INF = 1LL << 60;
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int l,r;
    cin >> l >> r;
    int ans = INF;
    if(r - l >= 2019){
        ans = 0;
    }else{
        for(int i = l; i < r; i++){
            for(int j = i + 1; j < r + 1; j++){
                ans = min(ans,i * j % 2019);
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(void) {
	long long A, B, M;
	cin >> A >> B >> M;
	vector<long long> a;
	vector<long long> b;
	for(int i = 0; i < A; ++i) {
		long long t;
		cin >> t;
		a.push_back(t);
	}
	for(int i = 0; i < B; ++i) {
		long long t;
		cin >> t;
		b.push_back(t);
	}
	vector<long long> v;
	for(int i = 0; i < M; ++i) {
		long long x, y, c;
		cin >> x >> y >> c;
		v.push_back(a[x - 1] + b[y - 1] - c);
	}
	sort(v.begin(), v.end());
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	cout << min(v[0], a[0] + b[0]) << '\n';
	return 0;
}



Measured memory_bytes: 3316
N = int(input())
A = input()
Aa = A.split()
base = int(Aa[0])
times = N+1
y = 0
while base%2 == 0:
  y += 1
  base /= 2

if y != 0:
  for i in Aa[1:times]:
    i = int(i)
    x = 0
    while i%2 == 0:
      x += 1
      i /= 2
    if y >= x:
      y = x
        
print(y)
    


Measured memory_bytes: 3064
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define ll long long 
#define fi first
#define se second

//CHECK FOR N = 1 OR OTHER DUMB TESTS 

using namespace std;

int n;
long double a[100100];

int main() {
	//ifstream cin("tst.in");
	//ofstream out("tst.out");
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
			
	long double jos = 0;
	for (int i = 1; i <= n; i++)
		jos += 1.0 / a[i];
	
	cout << 1.0 / jos;		
			
	return 0;
}

Measured memory_bytes: 256