akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<long long> p(a), q(b), r(c);
  for(int i = 0; i < a; i++) cin >> p.at(i);
  for(int i = 0; i < b; i++) cin >> q.at(i);
  for(int i = 0; i < c; i++) cin >> r.at(i);
  sort(p.begin(), p.end());
  sort(q.begin(), q.end());
  sort(r.begin(), r.end());
  reverse(p.begin(), p.end());
  reverse(q.begin(), q.end());
  reverse(r.begin(), r.end());
  vector<long long> take(0);
  for(int i = 0; i < x; i++) take.push_back(p.at(i));
  for(int i = 0; i < y; i++) take.push_back(q.at(i));
  sort(take.begin(), take.end());
  for(int i = 0; i < min(x+y, c); i++) {
    if(take.at(i) >= r.at(i)) break;
    take.at(i) = r.at(i);
  }
  long long taste = 0;
  for(int i = 0; i < x+y; i++) taste += take.at(i);
  cout << taste << endl;
  cout << endl;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

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

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

  vi x(5);
  REP(i, 5) cin >> x[i];
  REP(i, 5) {
    if(x[i] == 0) {
      cout << i+1 << endl;
      return 0;
    }
  }

}
























Measured memory_bytes: 3648
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <queue>

using namespace std;

#define ll long long
#define MAX_N 20000
#define LERGE_NUM 30000LL


class Main {
public:
	vector<vector<ll> > getArrays(vector<int> perm) {
		vector<ll> as;
		vector<ll> bs;
		int n = perm.size();

		for (int i = 0;i < n;i++) {
			as.push_back(i * LERGE_NUM + 1);
			bs.push_back((n - i + 1) * LERGE_NUM);
		}

		for (int i = 0;i < n;i++) {
			bs[perm[i]-1] += i;
		}

		vector<vector<ll> > ans;
		ans.push_back(as);
		ans.push_back(bs);

		return ans;
	}
};


int main()
{
	Main m;
	int n;
	vector<int> as;

	cin >> n;
	for (int i = 0;i < n;i++) {
		int inp;
		cin >> inp;
		as.push_back(inp);
	}

	auto ans = m.getArrays(as);

	for (int i = 0;i < n;i++) {
		cout << ans[0][i];
		if (i < n - 1) cout << " ";
	}
	cout << endl;

	for (int i = 0;i < n;i++) {
		cout << ans[1][i];
		if (i < n - 1) cout << " ";
	}

    return 0;
}



Measured memory_bytes: 1268
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cstring>
using namespace std;
int main(void){
	int i,abcp[3],abcl[3],p;
	char abc[3][101],x;
	for(i=0;i<3;i++) cin>>abc[i];
	abcl[0]=strlen(abc[0]); abcl[1]=strlen(abc[1]); abcl[2]=strlen(abc[2]);
	p=0; abcp[0]=0; abcp[1]=0; abcp[2]=0;
	while(1){
		if(abcp[p]==abcl[p]) break;
		x=abc[p][abcp[p]];
		abcp[p]++;
		if(x=='a') p=0;
		if(x=='b') p=1;
		if(x=='c') p=2;
	}
	if(p==0) cout<<'A'<<endl;
	if(p==1) cout<<'B'<<endl;
	if(p==2) cout<<'C'<<endl;
	return 0;
}

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

using namespace std;

class Rectangle{
public:
  int h;
  int w;
  Rectangle(int _h,int _w) : h(_h), w(_w) {}
};

int main(){
  int h, w;
  vector<Rectangle> data;
  while(!cin.eof()){
    cin >> h >> w;
    if(h == 0 && w == 0) break;
    data.push_back(Rectangle(h, w));
  }

  for (vector<Rectangle>::size_type i = 0; i < data.size(); i++)
  {
    for(int j = 0; j < data[i].h; j++){
      for(int k = 0; k < data[i].w; k++){
        if((j + k) % 2 == 0){
          cout << "#";
        }else{
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  


  return 0;
}


Measured memory_bytes: 3096
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

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


int gcd(int a, int b){
    if(!b) return a;
    if(a % b) return gcd(b, a % b);
    return b;
}

int main(){
    int N, M, Q; std::cin >> N >> M >> Q;
    // a[i][j] 区間がi<=x<=jの電車
    std::vector<std::vector<int>> a(N+1, std::vector<int>(N+1, 0)),
                                  s(N+1, std::vector<int>(N+1, 0));
    {
        int L, R; 
        for(int i(0); i < M; ++i){
            std::cin >> L >> R;
            ++a[L][R];
        }
    }
    for(int i(0); i < N; ++i){
        for(int j(0); j < N; ++j){
            s[i+1][j+1] = s[i][j+1] + s[i+1][j] - s[i][j] + a[i+1][j+1];
        }
    }
    {
        int l, r;
        for(int i(0); i < Q; ++i){
            std::cin >> l >> r;
            std::cout << s[r][r] + s[l-1][l-1] - s[l-1][r] - s[r][l-1] << "\n";
        }
    }
    return 0;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, K;
    cin >> N >> K;
    Vl X(N);
    for (ll i = 0; i < N; i++) {
        cin >> X[i];
    }
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        ans += min(X[i], K - X[i]) * 2;
    }
    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <tuple>

int main() {
  size_t N;
  scanf("%zu", &N);

  std::vector<std::tuple<std::string, int, size_t>> v;
  for (size_t i = 0; i < N; ++i) {
    char buf[32];
    int p;
    scanf("%s %d", buf, &p);
    v.emplace_back(buf, -p, i+1);
  }
  std::sort(v.begin(), v.end());

  for (auto const& vi: v) {
    printf("%zu\n", std::get<2>(vi));
  }
}


Measured memory_bytes: 256
import math
import heapq

def dijkstra(s,path):
    inf = float('inf')
    n = len(path)

    # 距離をinfで初期化
    d = [inf for i in range(n)]
    d[s] = 0

    # sへの距離は0
    q = [(0,s)]
    heapq.heapify(q)

    # 距離が最小の頂点から更新していけば良い
    while q:
        c,p = heapq.heappop(q)

        # 頂点pまでの距離がheap内のpまでの距離より小さい場合、continue
        if d[p]<c:
            continue

        # 頂点pから伸びる、全ての辺の距離を確認
        for cost,to in path[p]:
            # 頂点pから行ける頂点の距離がpまでの距離とpからの距離の和より小さい場合 -> 距離を更新し、heapに追加
            if d[to] > d[p] + cost:
                d[to] = d[p]+cost
                heapq.heappush(q,(d[to], to))
    return d

xs,ys,xt,yt = map(int,input().split())
n = int(input())
barrier = [list(map(int, input().split())) for i in range(n)]

barrier = [[xs,ys,0]] + barrier + [[xt,yt,0]]
n+=2

path = [[] for i in range(n)]

for i in range(n):
    for j in range(i+1,n):
        length = max(math.sqrt((barrier[i][0]-barrier[j][0])**2 + (barrier[i][1]-barrier[j][1])**2)-barrier[i][2]-barrier[j][2],0)
        path[i].append([length,j])
        path[j].append([length,i])

d = dijkstra(0,path)

print(d[-1])

Measured memory_bytes: 171520
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

int main(){
	int n;
	cin >> n;
	int dp[n], h[n];
	
	for(int i = 0; i<n; i++)
		cin >> h[i];
	
	dp[n-1] = 0;
	dp[n-2] = abs(h[n-1] - h[n-2]);
	
	for(int i = n-3; i>=0; i--)
		dp[i] = min(abs(h[i] - h[i+1]) + dp[i+1], abs(h[i] - h[i+2]) + dp[i+2]);
	
	cout << dp[0] << endl;
	return 0;
}

Measured memory_bytes: 4320
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int num, i, a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a != c)
		printf("1\n");
	else
		printf("0\n");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
bool inline  isPalindromic(int n){
    vi digits(5);
    rep(i, 0, 5){
        digits[i]=n%10;
        n/=10;
    }
    if(digits[0]==digits[4] and digits[1]==digits[3]){
        return true;
    }
    return false;
}
int main( ) {
    //freopen("B.01.in","r",stdin);
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    vi digits(5);
    int a,b,all=0;
    // cin >> a >> b;
    scanf("%d %d",&a,&b);
    rep(i, a, b+1){
        if(isPalindromic(i)){
            all++;
        }
    }
    // cout << all << endl;
    printf("%d\n",all);
    return 0;
}

Measured memory_bytes: 3788
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std; 

int h[20],ans=0;
int dp[20][160][2];

int getsum(int idx,int n,int sum,int flag){
    ans = max(ans,sum);
    if (idx>n) return sum;
    if (dp[idx][sum][flag] != -1)  return dp[idx][sum][flag];
    int limit=9,res=0;
    if (!flag) limit=h[idx];
    for (int i=0;i<=limit;i++){
        if (i<limit or flag) {
            res = max(res,getsum(idx+1,n,sum+i,1));
        }
        else {
            res = max(res,getsum(idx+1,n,sum+i,0));
        }
    }
    dp[idx][sum][flag]=res;
    return res;
}

inline void solve(){
    ans=0;
    string  s; 
    cin >> s ; 
    for (int i=0;i<sz(s);i++) h[i+1]=s[i]-'0';
    memset(dp,-1,sizeof(dp));
    getsum(1,sz(s),0,0);
    cout << ans << endl;
    
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}



Measured memory_bytes: 3648
#pragma warning(disable:4996)
#include<cstdio>
#include<cstdlib>
#include<cstring>

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

Node *nil;

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

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

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");
}

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 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;
}

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: 33832
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    string A, B;
    cin >> A >> B;
    if(A.size() > B.size()) {
        cout << "GREATER" << endl;
    } else if(A.size() < B.size()) {
        cout << "LESS" << endl;
    } else {
        cout << (A > B ? "GREATER" : (A < B ? "LESS" : "EQUAL")) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

int main()
{
	int a, b;
	string op;
	int res;

	cin >> a >> op >> b;
	if (op == "+") {
		res = a + b;
	}
	else {
		res = a - b;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#pragma GCC optimize(2)
#define int long long
#define MAXN 2000000
#define INF (1e13 + 7)
#define MANX MAXN

using namespace std;

inline int read()
{
	int x = 0, f = 1; char c = getchar();
	while (c > '9' || c < '0') { if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9') { x = x * 10 + (c ^ 48); c = getchar(); }
	return f * x;
}

signed main()
{
	int n = read();
	cout << (1000 - n % 1000) % 1000;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, N) for (int i=0; i<(int)N; i++)
#define rep1(i, N) for (int i=1; i<(int)N; i++)

using namespace std;

int a,b;



int main() {
  cin >> a >> b;
  
  int ans = -1;
  if (a < 10 && b < 10) ans = a*b;
  cout << ans;
  
}

Measured memory_bytes: 256
import sys
iN = int(input())

aA = sorted([int(_) for _ in sys.stdin.readlines()])

#とりあえず公式の解法で解答作りまっす

if iN % 2 == 0:
    iH = iN // 2
    print( -2 * sum(aA[0:iH-1]) - aA[iH-1] + aA[iH] + 2* sum(aA[iH+1:]))
else:
    iH = (iN -1) //2
    iBigStart = -2 * sum(aA[0:iH]) + aA[iH] + aA[iH+1] + 2 * sum(aA[iH+2:])
    iSmallStart = -2 * sum(aA[0:iH-1]) - aA[iH-1] -aA[iH] + 2* sum(aA[iH+1:])
    print(max(iBigStart,iSmallStart))

exit()


Measured memory_bytes: 14244
#include <bits/stdc++.h>
using namespace std;
string lcs(string s,string t)
{  int n=s.size();
   int m=t.size();
    int arr[n+1][m+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                arr[i][j]=0;
                continue;
            }
            if(s[i-1]==t[j-1])
            {
                arr[i][j]=arr[i-1][j-1]+1;
            }
            else
            {
                arr[i][j]=max(arr[i-1][j],arr[i][j-1]);
            }
        }
    }
    int l=n;
    int r=m;
    string ans;
 

    while(l>0 and r>0)
    { 
       
        if(arr[l][r]==arr[l-1][r])
        {
            l--;
        }
        else
        if(arr[l][r]==arr[l][r-1])
        {
            r--;
        }
        else
        if(arr[l][r]==(arr[l-1][r-1]+1))
        {
            ans+=s[l-1];
            l--;
            r--;
        }
    }
reverse(ans.begin(),ans.end());
return ans;
}
int main() 
{
    string s,t;
    cin>>s>>t;
    cout<<lcs(s,t)<<"\n";
}


Measured memory_bytes: 35456
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){return *(ll *)b - *(ll *)a;}

int main(void){
    ll n,k,i,ans=0;
    scanf("%lld%lld",&n,&k);
    ll a[n],count[200000];
    for(i=0;i<200000;i++){
        count[i]=0;
    }
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
        count[a[i]-1]++;
    }
    qsort(count,n,sizeof(ll),compare);
    for(i=k;i<200000;i++){
        if(count[i]==0) break;
        ans+=count[i];
    }
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;

int main(void) {
  int n, m, k;
  cin >> n >> m >> k;

  for(int i = 0; i <= n; i++) {
    for(int j = 0; j <= m; j++) {
      if(i * (m - j) + j * (n - i) == k) {
	cout << "Yes" << endl;
	return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

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

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

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

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

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

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL l,r;
    cin>>l>>r;
    //2019 = 3 * 673
    if(r - l >= 2019){
        PUTS(0);
        return 0;
    }
    LL ans = 200000;
    FOR(i,l,r)FOR(j,i+1,r+1){
        ans = min(ans, (i*j) % 2019);
    }
    PUTS(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long m=1e9+7;
typedef long long ll;
ll power(ll a,ll b){
    if(b==0) return 1;
    ll temp= power(a,b/2)%m;
    if(b%2==0) return (temp*temp)%m;
    else return (((a*temp)%m)*temp)%m;
}
int main(){
    ll  n;
    cin>>n;
    ll x=(power(10,n) -2*power(9,n) +2*m +power(8,n))%m;
  //  cout<<power(10,n) <<endl<<power(9,n)<<endl<<power(8,n);
      cout<<x;
  
  


}

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

int main(){
  int n;
  cin >> n;
  vector<pair<int,bool>>a(n,make_pair(0,true));
  vector<int>num(n,0);
  for(int i=0;i<n;i++){
    cin >> a.at(i).first;
    num.at(a.at(i).first-1)++;
  }
  bool ok=true;
  for(int i=0;i<n;i++)
    if(a.at(i).first>i+1)
      ok=false;
  //cout << (ok?"1$":"-1$") << endl;
  if(ok){
    int i=1,l=0,k=0;
    while(i<=n){
      if(a.at(n-i).second){
        if(a.at(n-i).first==1||(l-a.at(n-i).first>=-1&&l+1>=k+a.at(n-i).first)){
          cout << a.at(n-i).first << /*"&" << n-i <<*/ endl;
          a.at(n-i).second=false;
          i=0,k=0;
          l++;
        }
      }else{
        k++;
      }
      i++;
      bool br=true;
      for(int j=0;j<n;j++)
        br&=!a.at(j).second;
      if(br) break;
    }
  }else{
    cout << -1 << endl;
  }
  return 0;
}



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

#define INF 100000

int getmin(int n, int m, int *c);

int main(void){
  int i, ans, n, m, *c;

  scanf("%d%d", &n, &m);
  c = (int *)malloc(sizeof(int) * m);
  for(i = 0; i < m; i++){
    scanf("%d", &c[i]);
  }
  ans = getmin(n, m, c);
  printf("%d\n", ans);
  free(c);
  return 0;
}

int getmin(int n, int m, int *c){
  int i, j, k;
  int *min = (int *)malloc(sizeof(int) * (n+1));

  for(i = 0; i <= n; i++){
    k = INF;
    for(j = 0; j < m; j++){
      if(i - c[j] >= 0){
	if(min[i-c[j]] < k){
	  k = min[i-c[j]];
	}
      }
    }
    if(k == INF){
      min[i] = 0;
    }else{
      min[i] = k+1;
    }
  }
  k = min[n];
  free(min);
  return k;
}

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

int main() {
  int N;
  cin >> N;
  int min_count = 1000000000;
  
  for (int i = 0; i < N ; i++){
    int A;
    cin >> A;
    
    int temp_count = 0;
    while(A % 2 == 0){
      A = A / 2;
      //cout << A << endl;
      temp_count++;
    }
    
    if(min_count>temp_count){
      min_count = temp_count;
    }
  }
  cout << min_count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  string T;
  string U;
  int A=0;
  int B=0;
  cin>> S >> T >> A >> B >> U;
  
  if(S == U){
  A=A-1;
  }
  else if(T == U){
  B=B-1;
  }
  cout<< A << " " <<  B <<endl;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    W, H, N = map(int, input().split())
    xmin, xmax, ymin, ymax = 0, W, 0, H
    for i in range(N):
        x, y, a = map(int, input().split())
        if a == 1:
            xmin = max(xmin, x)
        elif a == 2:
            xmax = min(xmax, x)
        elif a == 3:
            ymin = max(ymin, y)
        elif a == 4:
            ymax = min(ymax, y)

    if (xmax <= xmin) or (ymax <= ymin):
        ans = 0
    else:
        ans = (xmax - xmin) * (ymax - ymin)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
////////////////////////////////////////
int main() {
	int H, W;
	cin >> H >> W;
	char G[51][51];
	int d[51][51];
	int count = 0;//'.'の数
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> G[i][j];
			d[i][j] = INF;
			if (G[i][j] == '.')count++;
		}
	}
	queue<pii>Q;
	d[0][0] = 0;
	Q.push({ 0,0 });
	while (!Q.empty()) {
		int y = Q.front().first;
		int x = Q.front().second;
		Q.pop();
		for (int i = 0; i < 4; ++i) {
			int ny = y + dy[i];
			int nx = x + dx[i];
			if (0 <= ny && ny < H && 0 <= nx && nx < W&&G[ny][nx] == '.'&&d[ny][nx] == INF) {
				Q.push({ ny,nx });
				d[ny][nx] = d[y][x] + 1;
			}
		}
	}
	if (d[H - 1][W - 1] == INF)cout << -1 << endl;
	else {
		cout << count - d[H - 1][W - 1] - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define 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 srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
    int to;
    ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

int main() {
    COME_LET_THE_GAMES_BEGIN();
    int A, B;
    string S;
    cin >> A >> B >> S;
    bool flag = 1;
    for (int i = 0; i < S.length(); i++) {
        if (i == A) {
            if (S[i] != '-')flag = 0;
            continue;
        }
        if (S[i] >= '0' && S[i] <= '9') {

        } else {
            flag = 0;
        }
    }
    if (flag)cout << "Yes";
    else cout << "No";
    cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<String> possibilities = new ArrayList<>();
        possibilities.add("0");
        possibilities.add("1");
        for (int i = 0; i < 9; i++) {
            possibilities = genOpen(possibilities);
        }
        
        possibilities.remove(0);
        int n = scanner.nextInt();
        String f[] = new String[n];
        for (int i = 0; i < f.length; i++) {
            f[i] = "";
            for (int j = 0; j < 10; j++) {
                f[i] += scanner.nextInt();
            }
        }
        int[][] p = new int[n][11];
        for (int i = 0; i < p.length; i++) {
            for (int j = 0; j < p[i].length; j++) {
                p[i][j] = scanner.nextInt();
            }
        }
        long max = Long.MIN_VALUE;
        for (String pos: possibilities) {
            long profit = 0;
            for (int i = 0; i < f.length; i++) {
                profit += p[i][similar(pos, f[i])];
            }
            if (profit > max) max = profit;
        }
        System.out.println(max);
    }

    private static ArrayList<String> genOpen(ArrayList<String> possible){
        ArrayList<String> other = new ArrayList<>();

        for (String aPossible : possible) {
            other.add(aPossible + "0");
            other.add(aPossible + "1");

        }
        return other;
    }

    private static int similar(String x, String y){
        int ans = 0;
        for (int i = 0; i < x.length(); i++) {
            if (x.charAt(i) == '1' && y.charAt(i) == '1') ans++;
        }
        return ans;
    }
}

Measured memory_bytes: 26464
///created: 4/Jul/2019 18:18:11

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
const int modulo = 1e9 + 7;

#ifdef LOCAL_DEBUG_NTV1612
template<class __Ty>
string to_string(__Ty a) {
	string res = "[ ";
	bool f = true;
	for (auto &p : a) { res += (f ? string("") : string(", ")) + to_string(p); f = false;	}
	return res + " ]";
}
void _debug() { fprintf(stderr, "\n"); }
template<typename __Ty_head, typename... __Ty_tail>
void _debug(__Ty_head head, __Ty_tail... tail) { fprintf(stderr, "%s ", to_string(head).c_str()); _debug(tail...); }
#define debug(...) fprintf(stderr, "DEBUG [%s]: ", #__VA_ARGS__), _debug(__VA_ARGS__)
#else
#define debug(...) 0
#endif

template<class __Ty> bool mini(__Ty& a, __Ty b) { return a > b ? ((a = b) | 1) : (0); }
template<class __Ty> bool maxi(__Ty& a, __Ty b) { return a < b ? ((a = b) | 1) : (0); }
template<class __Ty> __Ty add(__Ty a, __Ty b) { return (a + b) % (__Ty(modulo)); }
template<class __Ty> __Ty sub(__Ty a, __Ty b) { __Ty m(modulo); return ((a - b) % m + m) % m; }

int a[501][501], h, w, sum = 0;
bool vs[601][601] = {0};
vector<ii> ans[2];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> h >> w;
	for (int i = 1; i <= h; ++i)
		for (int j = 1; j <= w; ++j)
			cin >> a[i][j];
	vector<tuple<int, int, int, int> > res;
	for (int i = 1; i <= h; ++i) {
		for (int j = 1; j < w; ++j) {
			if (a[i][j] % 2 != 0) {
				ans[0].push_back(ii(i, j));
				ans[1].push_back(ii(i, j + 1));
				res.push_back(make_tuple(i, j, i, j + 1));
				a[i][j]--;
				a[i][j + 1]++;
			}
		}
		if (i < h && a[i][w] % 2 != 0) {
			a[i][w]--;
			a[i + 1][w]++;
			ans[0].push_back(ii(i, w));
			ans[1].push_back(ii(i + 1, w));
			res.push_back(make_tuple(i, w, i + 1, w));
		}
	}
	cout << ans[0].size() << '\n';
	for (int i = 0; i < int(ans[0].size()); ++i) {
		for (int j = 0; j < 2; ++j) {
			if (j == 0) {
				assert(!vs[ans[j][i].first][ans[j][i].second]);
				vs[ans[j][i].first][ans[j][i].second] = true;
			}
			assert(1 <= ans[j][i].first && ans[j][i].first <= h);
			assert(1 <= ans[j][i].second && ans[j][i].second <= w);
//			cout << ans[j][i].first << ' ' << ans[j][i].second << ' ';
		}
		int a, b, c, d;
		tie(a, b, c, d) = res[i];
		assert(ans[0][i].first == a && ans[0][i].second == b && ans[1][i].first == c && ans[1][i].second == d);
		cout << ans[0][i].first << ' ' << ans[0][i].second << ' ' << ans[1][i].first << ' ' << ans[1][i].second << '\n';
	}
	int cnt = 0;
	for (int i = 1; i <= h; ++i)
		for (int j =1; j <= w; ++j)
			cnt += a[i][j] % 2;
	assert(cnt <= 1);	
	return 0;
}


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

int main() {
    long long x, a, b, ans;
    scanf("%lld", &x);
    a = x / 11;
    b = x % 11;
    b = (b + 5) / 6;
    ans = a * 2 + b;
    printf("%lld\n", ans);
    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

struct Combination
{
    void init(ll n)
    {
        mNumTbl.resize(n + 1);
        mInverseNumTbl.resize(n + 1);
        mNumTbl[0] = 1;
        mInverseNumTbl[0] = 1;
        FOR(i, n + 1, 1)
        {
            mNumTbl[i] = (mNumTbl[i - 1] * i) % MOD;
        }
        FOR(i, n + 1, 1)
        {
            mInverseNumTbl[i] = modpow(mNumTbl[i]);
        }
    }

    ll get(ll n, ll r)
    {
        if (n < r || n < 0)
            return 0;
        return (((mNumTbl[n] * mInverseNumTbl[r]) % MOD) * mInverseNumTbl[n - r]) % MOD;
    }

    //! バイナリ方で累乗を計算
    ll modpow(ll n)
    {
        ll s = 1, p = n;
        for (ll i = 0; (1 << i) <= MOD - 2; ++i, p = (p * p) % MOD)
        {
            if (((MOD - 2) & (1 << i)) == 0)
                continue;
            s *= p;
            s %= MOD;
        }
        return s;
    }

    vector<ll> mInverseNumTbl;
    vector<ll> mNumTbl;
};

int main()
{
    ll N, K;
    cin >> N >> K;
    ll b = K;
    ll r = N - K;
    Combination comb;
    comb.init(5000);

    FOR(i, K + 1, 1)
    {
        ll c = comb.get(r + 1, i);
        ll h = comb.get(b-1,i-1);//comb.get(i + b - 1, i);
        cout << c * h % MOD << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
long long n, m, a[123], w[12];
int main()
{
	while(cin >> n >> m && m && n)
	{
		for(int i = 0; i < n; i++)
			cin >> a[i];
		for(int i = 0; i < m; i++)
			cin >> w[i];
		unordered_set<long long>st;
		st.insert(0);
		for(int i = 0; i < m; i++)
		{
			unordered_set<long long>st1;
			for(auto r : st)
			{
				st1.insert(r+w[i]);
				st1.insert(abs(r-w[i]));
			}
			for(auto r : st1)
				st.insert(r); 
		}
		int cnt = 0;
		long long ans = -1;
		vector<long long>newa;
		for(int i = 0; i < n; i++)
			if(st.find(a[i]) == st.end())
				newa.push_back(a[i]);
		cnt = newa.size();
		
		if(!cnt)
			ans = 0;
		else if(cnt <= 2*st.size())
		{
			set<long long>neww;
			for(auto r : st)
			{
				neww.insert(r+newa[0]);
				neww.insert(abs(r-newa[0]));
			}
			for(auto r : neww)
			{
				int cnt1 = 0;
				for(auto rr : newa)
					if(st.find(rr+r) != st.end() || st.find(abs(rr-r)) != st.end())
						cnt1++;
//					else
//						break;
				if(cnt1 == cnt)
				{
					ans = r;
					break;
				}
			}
		}
		cout << ans << endl;	
	}
}


Measured memory_bytes: 6892
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long

struct XX{
    ll la;
    ll lb;
    ll ra;
    ll rb;
    ll q;
};

class xxGreater {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.q) == (riRight.q)){
            return riLeft.q < riRight.q;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
            //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.q) < (riRight.q);
    }
};


//map<long long,long long> prime_f(long long n){
//    map<long long,long long>res;
//    for(int i=2;i*i<=n;i++){
//        while(n%i==0){
//            ++res[i];
//            n/=i;
//        }
//    }
//    if(n!=1)res[n]=1;
//    return res;
//}

int asum(string P){
    int sum=0;
    int strength=1;
    for(int i=0;i<P.size();i++){
        if(P.substr(i,1)=="S"){
            sum+=strength;
        }else{
            strength*=2;
        }
    }
    return sum;
}

int main(int argc, const char * argv[])
{
    //scanf("%s",S);
    //scanf("%d",&N);
    //scanf("%lld %lld",&target1,&target2);
    //sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
    //getline(cin, target);
    //ifstream ifs( "1_06.txt" );//テスト用
    //ifs >> a;
    //ここから
    
    //入力高速化
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int a[100000];
    int b[100000];
    for(int i=0;i<n;i++){
        cin >> a[i];
        b[i]=a[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    for(int i=0;i<n-1;i++){
            a[i]=min(a[i],a[n-1]-a[i]);
    }
    sort(a,a+n);
    int ans1=a[n-1];
    int ans2=a[n-2];
    int f=0;
    for(int i=0;i<n-1;i++){
        if(ans2==b[i]){
            f=1;
            break;
        }
    }
    
    if(f!=1){
        ans2=a[n-1]-ans2;
    }
    cout << ans1 << " " << ans2 << endl;
    
    //ここまで
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    
    return 0;
}



Measured memory_bytes: 1024
N = int(input())
n = len(str(N))
# 深さ優先で生成
# 3,5,7が含まれること、Nより小さいことをチェックしてカウント
def dfs(cur, st, n):
    if cur==n:
        if int(st)<=N and ('3' in st and'5' in st and'7'  in st):
            # print((('3'and'5'and'7') in st), st)
            return +1
        else:
            return +0
    else:
        ret1 = dfs(cur+1, st+'3', n)
        ret2 = dfs(cur+1, st+'5', n)
        ret3 = dfs(cur+1, st+'7', n)
        return ret1 + ret2 + ret3

s = 0
for i in range(3, n+1):
    s += dfs(0, '', i)
print(s)

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    char cha[n];
    for(int i=0;i<n;i++){
        cin>>cha[i];
        if(i==k-1)cha[i]=cha[i]+'a'-'A';
    }
    for(int i=0;i<n;i++){
        cout<<cha[i];
    }
    cout<<endl;


	return 0;
}


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


int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = 100000;
  for (ll i = l; i <= l + min(5000LL, r-l); i++) {
    for (ll j = i+1; j <= l + min(5000LL, r-l); j++) {
      ans = min(ans, (i*j)%2019);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
 *  author : Atul Anand   
 *  created on : Wed Apr 01 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        int X = in.nextInt();
        while(true){
            if(isPrime(X)){
                break;
            }
            X++;
        }
        println(X);
        in.close();
        out.close();
    }

    // O(sqrt(n))
    public static boolean isPrime(int n){
        if(n < 2){
            return false;
        }
        if(n == 2){
            return true;
        }
        if(n % 2 == 0){
            return false;
        }

        for(int i = 3; i*i <= n; i += 2){
            if(n % i == 0){
                return false;
            }
        }

        return true;
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
int main() {
 int N;
 cin >> N;
  
 vector<int64_t> L(87);
 L.at(0) = 2;
 L.at(1) = 1;
  
 if (N > 1){
  for (int i=2; i<N+1; i++)
    L.at(i) = L.at(i-1) + L.at(i-2);
 }
  cout << L.at(N) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
#define float long double 
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
signed main(){
	IOS;
	int n , k ; 
	cin >> n>> k; 
	vector<int>arr(n);
	for(int& i : arr) cin >> i;
	vector<bool>dp(k+1,false);
	for(int stones = 0 ; stones <= k ;stones++){
		for(int a : arr){
			if(stones-a>=0 and dp[stones-a] == false)
				dp[stones] = true;
		}
		debug() << imie(range(dp.begin(),dp.end()));
	}
	cout << (dp[k]?"First":"Second") << endl; 
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main (){
    int x,i;
    
    for(i=0;i<10000;i++){
    cin>>x;
 if(x>0){
     cout<<"Case"<<" "<<i+1<<":"<<" "<<x<<endl;
 }
 else{cout<<""<<endl;}
    }
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main() {
  int n,W,w[110],v[110];cin>>n>>W;rep(i,n)cin>>w[i]>>v[i];int dp[110][110000];rep(i,110)repd(j,1,110000)dp[i][j] = INF;
  repd(i,1,v[0]+1)dp[0][i] = w[0];
  repd(i,1,n){
    rep(j,110000)dp[i][j] = (j-v[i]>=0 ? min(dp[i-1][j], dp[i-1][j-v[i]] + w[i]) : dp[i-1][j]);
  }
  int ans = 0;
  rep(i,110000)if(dp[n-1][i]<=W)ans = i;
  cout << ans << endl;
}

Measured memory_bytes: 94720
#include<stdio.h>
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int city[51]={0};
    int a,b;
    int i;
    for(i = 0; i < m; i++){
        scanf("%d%d",&a,&b);
        city[a]++;
        city[b]++;
    }
    for(i = 1; i <= n; i++)
        printf("%d\n",city[i]);
    return 0;
}


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

ll dp[100][2];
int main()
{
	ll n,k;
	cin >> n >> k;
	ll K = k;
	vector<ll> a(n),b;
	for(int i = 0;i<n;i++)cin >> a[i];
	while(k)
	{
		b.emplace_back(k%2);
		k/=2;
	}
	reverse(b.begin(),b.end());
	ll bn = b.size();
	dp[0][0] = 0;
	dp[0][1] = 1LL<<(bn-1);

	for(int i = 1;i<bn;i++)
	{
		if(b[i]==0)//未満は1と0に分岐、そうじゃなければ、0
		{
			dp[i][1] = dp[i-1][1];
			ll hoge = dp[i-1][0];
			ll sum = 0;
			for(int j = 0;j<n;j++) sum += a[j] ^ hoge;
			ll sum2 = 0;
			ll hoge2 = dp[i-1][0] + (1LL<<(bn - i -1));
			for(int j = 0;j<n;j++) sum2 += a[j] ^ hoge2;
			if(sum2 > sum) dp[i][0] = hoge2;
			else dp[i][0] =  hoge;
		}
		else{
			ll sum[2]={}, bit[2] = {};
			//まず、dp[i][0]の3つの候補を決める
			bit[0] = dp[i-1][0];
			for(int j = 0;j<n;j++) sum[0] += a[j] ^ bit[0];
			if(sum[1]<sum[0]){sum[1] = sum[0];bit[1] = bit[0];}sum[0] = 0;bit[0] = dp[i-1][0] + (1LL<<(bn - i - 1));
			for(int j = 0;j<n;j++)sum[0] += a[j] ^bit[0];
			if(sum[1]<sum[0]){sum[1] = sum[0];bit[1] = bit[0];}sum[0] = 0;bit[0] = dp[i-1][1];
			for(int j = 0;j<n;j++)sum[0] += a[j] ^bit[0];
			if(sum[1]<sum[0]){sum[1] = sum[0];bit[1] = bit[0];}
			dp[i][0] = bit[1];
			dp[i][1] = dp[i-1][1] + (1LL<<(bn-i-1));
		}
	}
	ll ans[2] = {};
	if(K==0)
	{
		dp[0][0] = dp[0][1] = 0;
		bn=1;
	}
	//cout << bn << endl;
	//cout << dp[bn-1][1]<< ' ' << dp[bn-1][0] << endl;
	//for(int i = 0;i<2;i++){for(int j = 0; j<bn;j++){cout << dp[j][i] << ' ';}cout << endl;}
	for(int i = 0;i<n;i++)
	{
		ans[1] += a[i]^dp[bn-1][1];
		ans[0] += a[i]^dp[bn-1][0];

	}
	cout << max(ans[1],ans[0])<<endl;
}


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

#define _max(_x, _y) ((_x)>(_y)?(_x):(_y))
#define _min(_x, _y) ((_x)>(_y)?(_y):(_x))
#define _abs(_x) ((_x)>0?(_x):(-(_x)))

int main(void)
{
long H, A, index, ans;

  scanf("%ld %ld", &H, &A);
  ans = 0;
  while (H > 0) {
    H -= A;
    ans++;
  }
  printf("%ld\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
        int n;
        scanf("%d",&n);
        printf("AB");
        if (n<=999) printf("C\n");
              else printf("D\n");
        return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, K, A[100010], ans(0);
    cin >> N >> K;
    for (int i = 1; i <= N; i++)
    {
        cin >> A[i];
    }
    while (1 + (K - 1) * ans < N)
        ans++;
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void){
  long long int N,A,B;
  long long int i;
  long long int h[100000];
  long long int K;
  long long int left,right;
  long long int sum;

  scanf("%lld %lld %lld",&N,&A,&B);
  //printf("%d\n", N);

  for(i=0;i<N;++i){
    scanf("%lld",&h[i]);
    //printf("h[%lld]=%lld\n", i,h[i]);
  }

  left=0;
  right=1000000000;
  //K=(right+left)/2;

  //printf("%d\n", K);

  while(left!=right-1){
    K=(right+left)/2;
    sum=0;
    for(i=0;i<N;i++){
      if(h[i]-K*B > 0){
        sum += (h[i]-K*B)%(A-B) ? (h[i]-B*K)/(A-B)+1 : (h[i]-B*K)/(A-B);
      }
    }
    if(sum <= K){
      right=(right+left)/2;
    }else{
      left=(right+left)/2;
    }
    //printf("%lld,%lld\n", left,right);

    /*if(left==right-1){
      break;
    }*/
  }

  printf("%lld\n", right);

  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define int long long
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
//cout << std::fixed << std::setprecision(15);
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e9;
const long long MOD = 1e9+7;
signed main(){
    double n,a; cin >> n >> a;
    cout<<ceil(n/a)<<endl;
}

Measured memory_bytes: 256
x=input()
x =x.split(" ")
c = [int(str) for str in x]
a=c[0]
b=c[1]
if a+b>=a-b and a+b>=a*b:
  print(a+b)
elif a-b>=a+b and a-b>=a*b:
  print(a-b)
elif a*b>=a+b and a*b>=a-b:
  print(a*b)




Measured memory_bytes: 3060