akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<climits>
using namespace std;

bool stack_baggage(const vector<int>& weight, const int n, const int k, const int p){
    vector<int> track(k);
    int idx = 0;
    for(int i = 0; i < n; ++i){
        if(track[idx] + weight[i] > p){
            // 重量オーバーなので次のトラック
            if(++idx >= k){
                // 次のトラックがない
                return false;
            }
            else{
                // もう一度確認
                if(track[idx] + weight[i] > p){
                    return false;
                }
                track[idx] += weight[i];
            }
        }
        else{
            track[idx] += weight[i];
        }
    }
    return true;
}

int binary_search(const vector<int>& weight, const int n, const int k){

    int left = 0, right = INT_MAX;
    while(abs(left - right) > 1){
        int mid = (left + right) / 2;

        if(stack_baggage(weight, n, k, mid)){
            right = mid;
        }
        else{
            left = mid;
        }
    }
    return right;
}

int main(){

    int n, k;
    cin >> n >> k;
    vector<int> weight(n);
    for(int i = 0; i < n; ++i){
        cin >> weight[i];
    }

    cout << binary_search(weight, n, k) << endl;

    return 0;
}


Measured memory_bytes: 3504
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  int sum=0;
  for(int i=1;i<N;i++){
    for(int j=0;j<i;j++){
      sum+=d[i]*d[j];
    }
  }
  cout << sum << endl;
}
  

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

using namespace std;

typedef long long ll;
int main()
{
	int t=1;
	// cin >> t ;

	while(t--)
	{
		int n;cin>>n;

		int dp[n][3];
		
		cin>>dp[0][0]>>dp[0][1]>>dp[0][2];

		for(int i=1; i<n; i++)
		{
			int a,b,c;
			cin>>a>>b>>c;

			dp[i][0] = a + max(dp[i-1][1], dp[i-1][2]);
			dp[i][1] = b + max(dp[i-1][0], dp[i-1][2]);
			dp[i][2] = c + max(dp[i-1][1], dp[i-1][0]);
		}
		cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]))<<endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

 
//typedef tuple <int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<ll> vll;
 
#define siz(x) (int)(x).size()
#define Y second
#define X first
#define IN insert
#define PB push_back
#define P pop_back
#define PU push
#define PO pop
//#define F find
#define ED end()
#define MP( a, b) make_pair( a, b )
 
//#define MOD 1000000007ll
#define INF 1000000000
#define endl "\n"
#define rep(a,i,b) for (ll i = (a); i < (b); ++i)
#define reps(a,i,b) for (ll i = (a); i <= (b); ++i)
#define repd( num, i, ed ) for(ll (i)= (num)-1; (i) >= ed; --(i))
#define repkt( bg, i, num, kt ) for(ll (i)= (bg); (i) < (num) && (kt); ++(i))
#define repchar( i ) for(char (i)= 48; (i) <= 122; (i)++)   
#define in(n) scanf("%lld", &n)
#define out(n) printf("%lld\n", n)
#define outS(s) printf("%s\n", s)
#define setA(a,n) for(ll i= 0, j= sizeof(a)/sizeof(a[0]); i < j; ++i) a[i]= n;
#define repe(num,i,ed) for(ll (i)= (num); (i) >= ed; --(i))
// const int INF=0x3f3f3f3f;
const db PI=acos(-1);
const ll mod=1e9+7;
const ll N=2e6+5,K=105;
const int si=(1<<20);
const ll add=1e4;
const ll M=100+5;
const double INFdb=1e10;

int n;

int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
    cin>>n;
    vi c(n);
    for(int& x:c) cin>>x;
    sort(all(c));
    int ans=0;
    for(int i=0;i<n;++i)
    {
        ans=(ans+1ll*c[i]*(n-i+1)%mod)%mod;
    }
    for(int i=0;i<2*(n-1);++i)
    {
        ans=ans*2%mod;
    }
    cout<<ans;
    cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";                                                                          
    return 0;
}

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

int main() {
	string s;
	cin >> s;
	string k = "AC";
	string abc = "abcdefghijklmnopqrstuvwxyz";
	if(s.at(0) != 'A')
	{
		k = "WA";
	}
	else
	{
		int cc = 0;
		for(int i = 2;i < s.size()-1;i++)
		{
			if(s.at(i) == 'C')
			{
				cc++;
			}
		}
		if(cc != 1)
		{
			k = "WA";
		}
		else
		{
			for(int i = 1;i < s.size();i++)
			{
				if(i > 1 && s.at(i) == 'C')
				{
					continue;
				}
				int jc = 0;
				for(int j = 0;j < 26;j++)
				{
					if(s.at(i) == abc.at(j))
					{
						jc++;
					}
				}
				if(jc == 0)
				{
					k = "WA";
				}
			}
		}
	}
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

bool checksq(int n){
    if(n==0)return 1;
    for(int i=1;(i-1)*(i-1)<=n;i++)if(i*i==n)return 1;
    return 0;
}


int main(){
   int n,d;cin>>n>>d;
   int dist=0,ans=0;
   vector<vector<int> > v(n,vector<int> (d,0));
   for(int i=0;i<n;i++){
       for(int j=0;j<d;j++)cin>>v[i][j];
   }
   for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
       dist=0;
       for(int k=0;k<d;k++){
           dist+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
       }
       ans+=checksq(dist);
   }
   cout<<ans;
}

Measured memory_bytes: 256
N,C = map(int,input().split())
D = []
for i in range(C):
    D.append(list(map(int,input().split())))
G = []
for i in range(N):
    G.append(list(map(int,input().split())))

X = [[] for i in range(3)]
for i in range(N):
    for j in range(N):
        X[(i+j+2)%3].append(G[i][j])
ans = float('inf')

Costs = [[0 for i in range(C)] for j in range(3)]

for c in range(C):
    for i in range(3):
        for e in X[i]:
            Costs[i][c] += D[e-1][c]

for c1 in range(C):
    for c2 in range(C):
        if c1 == c2:
            continue
        for c3 in range(C):
            if c1 == c3 or c2 == c3:
                continue
            cost = 0
            for i,e in enumerate([c1,c2,c3]):
                cost += Costs[i][e]
            ans = min(cost,ans)
print(ans)


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define MX              200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define ull unsigned long long
#define ll long long
void codeforces()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    freopen("output.in", "w", stdout);
    #endif
}

int32_t main()
{
    //codeforces();
    // int t;cin>>t;
    // while(t--) {
        
    // }
    int n;cin>>n;
    vi a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    vi dp(n,INT_MAX);
    dp[0]=0;
    if(n==1){
        cout<<dp[0]<<endl;return 0;
    }
    for(int i=0;i<n;i++){
        int x=a[i];
        if(i+1<n){
            int y=a[i+1];
            y=abs(y-x);
            dp[i+1]=min(dp[i+1],y+dp[i]);
        }
        if(i+2<n){
            int y=a[i+2];
            y=abs(y-x);
            dp[i+2]=min(dp[i+2],y+dp[i]);
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
long double eps = 1e-9;
inline ll max(ll a, ll b)
{
	return (a>b?a:b);
}
inline ll min(ll a, ll b)
{
	return a<b?a:b;
}
ll mul(ll x, ll y)
{
	return ((x % mod)* (y%mod))%mod;
}

ll binpow(ll x, ll y)
{
    ll z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

inline ll inv(ll x)
{
    return binpow(x, mod - 2);
}
inline ll divide(ll x, ll y)
{
    return mul(x, inv(y));
}

inline ll add(ll x, ll y)
{
    return ((x%mod)+(y%mod))%mod;
}
ll dp[101][100010]
;int main()
{
    ll n, W;cin>>n>>W;
    ll w[n], v[n];
    ll mw = 0;
    for(ll i = 0;i<n;i++)cin>>w[i]>>v[i];
    for(ll i = w[0];i<= W;i++)
    {
       dp[0][i] = v[0];
    }
    for(ll i = 1;i<n;i++)
    {
        for(ll j = 1;j<=W;j++)
        {
            if(j - w[i] < 0)
            {
                dp[i][j] = dp[i - 1][j];continue;
            }
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
        }
    }
    
    cout<<dp[n - 1][W];
}

Measured memory_bytes: 78336
/*#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>*/
#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
#define mod 1e9 + 7;

int main(){
    ll b=0,c=0,d=0,ans=0,ret=M,n,m,h,w;
	string s;
	bool x = false;
	cin >> n >> h >> w;
	rep(i,n){
		cin >>b >> c;
		if(h <= b && w <= c) ans++;
	}
	cout << ans << endl;
    return 0;
}  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
int main(void) {
    int a, b; cin >> a >> b;
    string ans;
    if(a==1) a=14;
    if(b==1) b=14;

    if(a==b) ans = "Draw";
    else if(a < b) ans = "Bob";
    else ans = "Alice";
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 
const int mxN = 1e5 + 7;
vector<int> adj[mxN];
bool visited[mxN];

void dfs(int i){
	if(!visited[i]){
		visited[i] = 1;
		for(auto neigh : adj[i]) dfs(neigh);
	}
}

void solve(){
	int n,m; cin >> n >> m;
	map<int,int> mp;
	FOR(m){
		int x,y,z; cin >> x >> y >> z;
		--x,--y;
		adj[x].pb(y);
		adj[y].pb(x);
		++mp[x];
		++mp[y];
	}
	set<pair<int,int>> s;
	FOR(n){
		s.insert({mp[i],i});
	}
	
	auto itr = s.end();
	int ans = 0;
	while(itr != s.begin()){
		--itr;
		if(!visited[(*itr).second]){
			++ans;
			dfs((*itr).second);
		}
	}
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 21676
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.NoSuchElementException;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc = new FastScanner();
		char[] cs=sc.next().toCharArray();
		int ans=0;
		for (int i=0;i<cs.length;++i) {
			int j=i;
			while (j<cs.length && cs[j]=='R') ++j;
			ans=Math.max(ans,j-i);
		}
		System.out.println(ans);
	}
	
	void tr(Object...o) {System.out.println(Arrays.deepToString(o));}
}


Measured memory_bytes: 32396
#include<iostream>
#include <algorithm>
#include<string>
#include <numeric>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;

int main(void) {

    char n,a;
    cin>>n>>a;
    if(n<a)cout<<"<"<<endl;
    else if(n>a)cout<<">"<<endl;
    else cout<<"="<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();		
		int maxv = Integer.MIN_VALUE;
		int minv = sc.nextInt();
		
		for(int i = 1; i < n; i++) {
			int v = sc.nextInt();
			maxv = Math.max(maxv, v - minv);
			minv = Math.min(minv, v);
		}
		
		System.out.println(maxv);
	}
}


Measured memory_bytes: 99624
#include<bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define inf 1e18
#define fo(i,y,n,inc)	for(int i=y;i<n+y;i+=inc)
#define cin(t) int t;cin>>t
#define w(t) while(t--)
#define nl cout<<endl;
#define pb push_back
#define ft(i) (i&(-1*i))
#define arrIn(arr,size)		for(int i=0;i<size;i++){cin>>arr[i];}
#define arrOut(arr,size,seperater)	for(int i=0;i<size;i++){cout<<arr[i]<<seperater;}
using namespace std;

int max(int a, int b) {
	if (a > b)
		return a;
	return b;
}

int min(int a, int b) {
	if (a < b)
		return a;
	return b;
}

int powmd(int a, int b) {
	if (b == 1)	return a;
	if (b == 0)	return 1;

	int half = powmd(a, b / 2);
	int ans = half * half;
	ans %= mod;
	if (b & 1) {
		ans *= a;
	}
	ans %= mod;
	return ans;
}

void fastIO() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

int dp[500][500];
int arr[500];
int prefix[500];

int solve(int start, int end) {
	if (start >= end)	return 0;

	if (start == end - 1) {
		return arr[start] + arr[end];
	}

	if (dp[start][end] != -1)	return dp[start][end];

	int ans = inf;

	for (int i = start; i <= end - 1; i++) {
		ans = min(ans, solve(start, i) + solve(i + 1, end) + prefix[end] - prefix[start] + arr[start]);
	}
	return dp[start][end] = ans;
}

int32_t main() {

	fastIO();

	cin(n);
	arrIn(arr, n);
	prefix[0] = arr[0];
	fo(i, 1, n - 1, 1) {
		prefix[i] = prefix[i - 1] + arr[i];
	}
	memset(dp, -1, sizeof(dp));

	cout << solve(0, n - 1);
	nl;

	return 0;
}

// cout << "Case #" << i << ": " << answer << endl;

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

typedef struct card{
	char design;
	unsigned int num;
	int count;
}card;

int partition(card *A,int p,int r){
	unsigned int x = A[r].num;
	int i = p-1;
	int j = 0;
	card temp;
	for(j = p;j < r;j++){
		if(A[j].num <= x){
			i = i+1;
			memcpy(&temp,&A[i],sizeof(card));
			memcpy(&A[i],&A[j],sizeof(card));
			memcpy(&A[j],&temp,sizeof(card));
			
		}
	}
	memcpy(&temp,&A[i+1],sizeof(card));
	memcpy(&A[i+1],&A[r],sizeof(card));
	memcpy(&A[r],&temp,sizeof(card));
	
	return i+1;
}

void quicksort(card *A,int p,int r){
	int q = 0;
	if(p < r){
		q = partition(A,p,r);
		quicksort(A,p,q-1);
		quicksort(A,q+1,r);
	}
}

int main(int argc, char **argv){
	int n = 0;
	int i = 0;
	int r = 0;
	int flag = 0;
	char temp[3];
	scanf("%d",&n);

	card *A = malloc(sizeof(card) * n);

	for(i = 0;i < n;i++){
		scanf("%*c%c %d",&A[i].design, &A[i].num);
		A[i].count = i;
	}

	quicksort(A,0,n-1);
	for(i = 1;i < n;i++){
		if(A[i].num == A[i-1].num && A[i].count < A[i-1].count){
			flag = 1;
		}
	}

	if(flag == 1){
		printf("Not stable\n");
	}
	else{
		printf("Stable\n");
	}
	for(i = 0;i < n;i++){
		printf("%c %d\n",A[i].design, A[i].num);
	}
}



Measured memory_bytes: 2884
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

fn main() {
    let mut scan = Scan::new();

    let N = scan.word::<usize>();
    let K = scan.word::<usize>();

    let mut good = vec![false; N];
    for _ in 0..K {
        let d = scan.word::<usize>();
        for _ in 0..d {
            let a = scan.word::<usize>() - 1;
            good[a] = true;
        }
    }

    let count = (0..N).filter(|&i| !good[i]).count();

    println!("{}", count);
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
int main() {
  
  vector<int> eachtime(5);
  for(int &c : eachtime) {
    cin >> c;
  }


  int counter = 0, mintime = 643;
  int untilfive = 0;
  
  sort(eachtime.begin(), eachtime.end());
  
  
  
    do{
    
    for(int c : eachtime) {
      counter += c;
      untilfive++;
      
      if(untilfive == 5) {
        break;
      }
      
      if(counter %10 == 0) {
        continue;
      }
      
      else {
        counter += 10 - (counter %10);
      }
    }
      
      
    if(counter < mintime) {
      mintime = counter;
    }
    counter = 0;
    untilfive = 0;
      
  }while(next_permutation(eachtime.begin(), eachtime.end()));
  
  cout << mintime << endl;
}

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

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

vector<ll> di;

ll p5(ll z) {
    return z * z * z * z * z;
}


void make_divisors(ll n) {
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            di.push_back(i);
            // if (i != n / i) {
            di.push_back(n / i);
            // }
        }
    }
}

int main() {
    ll x = 100, b5, a, b;
    cin >> x;
    // make_divisors(x);
    // cout << di.size() << endl;
    ll tmp;
    bool finished = false;
    for (int i = -500; i <= 500; i++) {
       if(finished) break;
        for (int j = -500; j <= 500; j++) {
            if(p5(i)-p5(j)==x){
                a = i;
                b = j;
                finished = true;
                break;
            }
        }
    }

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define inv(x) power(x,Mod-2)
#define upd(a,b) a=add(a,b)
using namespace std;
typedef long long ll;
const int Mod=1e9+7;
int add(int a,const int b){a+=b;if(a>=Mod)a-=Mod;return a;}
int sub(int a,const int b){a-=b;if(a<0)a+=Mod;return a;}
int mul(const int a,const int b){return (ll)a*b%Mod;}
int power(int x,int cs)
{
	int ras=1;
	while(cs)
	{
		if(cs&1) ras=mul(ras,x);
		x=mul(x,x);cs>>=1;
	}
	return ras;
}
const int N=2010,V=N*N,pn=4e6+5;
int n,K;
int dp[N][N],zp[V],fp[V];
int C(int a,int b){return mul(zp[a],mul(fp[b],fp[a-b]));}
int main()
{
	int i,j,ans;
	zp[0]=fp[0]=1;
	for(i=1;i<=pn;i++) zp[i]=mul(zp[i-1],i);
	fp[pn]=inv(zp[pn]);
	for(i=pn-1;i>=1;i--) fp[i]=mul(fp[i+1],i+1);
	scanf("%d%d",&n,&K);
	if(K==1)
	{
		puts("1");return 0;
	}
	dp[0][0]=1;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<=i;j++)
		{
			dp[i][j]=mul(dp[i-1][j],C((K-1)*i+j-1,K-2));
			if(j>0) upd(dp[i][j],dp[i][j-1]);
		}
	}
	ans=mul(dp[n][n],zp[n]);
	printf("%d",ans);
	return 0;
}

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

#define int 		long long
#define vi 			vector <int>
#define si 			set <int>
#define pii 		pair<int,int>
#define fr(n) 		for(__typeof(n) i=0;i<n;i++)
#define rep(i,a,b) 	for(__typeof(b) i=a;i<b;i++)
#define repi(i,b,a) for(__typeof(a) i=b;i>=a;i--)
#define tr(a) 		for(auto it=a.begin();it!=a.end();it++)
#define pb 			push_back
#define mp 			make_pair
#define F 			first
#define S 			second
#define FAST 		ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define time_passed	1.0 * clock() / CLOCKS_PER_SEC

int ans=0,cnt=0;
int h,w,k;
char a[6][6];
int r[6],c[6];
int dp[64][64];

void fun(int rn,int cn)
{
	if(dp[rn][cn]>-1)
		return;
	cnt++;
	int sum=0;
	fr(h)
	{
		if((rn&(1<<i)) != 0)
			sum=sum+r[i];
	}
	fr(w)
	{
		if((cn&(1<<i)) != 0)
			sum=sum+c[i];
	}
	fr(h)
	{
		if((rn&(1<<i)) != 0)
		{
			rep(j,0,w)
			{
				if((cn&(1<<j)) != 0)
				{
					if(a[i][j]=='#')
						sum--;
				}
			}
		}
	}
	dp[rn][cn]=sum;
	fr(h)
	{
		if((rn&(1<<i)) == 0)
		{
			fun((1<<i) | rn,cn);
		}
	}
	fr(w)
	{
		cnt++;
		if((cn&(1<<i)) == 0)
		{
			fun(rn,(1<<i) | cn);
			cnt++;
		}
	}
}

void solve()
{
	cin>>h>>w>>k;
	memset(r,0,sizeof(r));
	memset(c,0,sizeof(c));
	memset(dp,-1,sizeof(dp));
	int b=0;
	fr(h)
	{
		rep(j,0,w)
		{
			cin>>a[i][j];
			if(a[i][j]=='#')
			{
				r[i]++;
				c[j]++;
				b++;
			}
		}
	}
	k=b-k;
	int rn,cn;
	rn=0,cn=0;
	fun(rn,cn);
	fr(64)
	{
		rep(j,0,64)
		{
			if(dp[i][j]==k)
				ans++;
		}
	}
	if(k<0)
		ans=0;
	cout<<ans<<endl;
}

signed main()
{
	FAST
	int test=1;
	//cin>>test;
	while(test--)
	{
		solve();
	}
	cerr<<endl<<"Time elapsed : "<<time_passed<<endl;
	return 0;
}

Measured memory_bytes: 3812
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
int b[100010];
int main()
{
	int i,j,k,n,m,x,y;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);
	}
	x=1;
	ll an=0;
	for(i=1;i<=n;i++)
	{
		an+=x*b[i];
		x=-x;
	}
	printf("%lld ",an);
	for(i=2;i<=n;i++)
	{
		printf("%lld ",(b[i-1]-an/2)*2);
		an=(b[i-1]-an/2)*2;
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

//最大公約数
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  if (y > x)
    return gcd(y, x);
  else
    return gcd(y, x % y);
}

int main() {
  ll a, b;
  cin >> a >> b;
  cout << a * b / gcd(a, b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (ll i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define int long long


signed main(){
    int n, m, k;
    cin >> n >> m >> k;
    int ans = 0;
    vector<int> a(n);
    vector<int> b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<ll> suma(n+1);
    vector<ll> sumb(m+1);
    rep(i, n) suma[i+1] = suma[i] + a[i];
    rep(i, m) sumb[i+1] = sumb[i] + b[i];

    rep(i, n+1) {
        if (suma[i]>k) continue;
        ll x = k - suma[i];
        auto it = upper_bound(whole(sumb), x);
        ll res = i;
        res += (it-sumb.begin()-1);
        chmax(ans, res);
    }
    
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n,prevH,H;
  bool flag = false;
  cin >> n;
  cin >> prevH;
  prevH -= 1;
  for(int i = 1;i < n;i++){
    cin >> H;
    if(H - 1 >= prevH){
      prevH = (H - 1);
    }else if(H == prevH){
      prevH = H;
    }else{
      flag = true;
      break;
    }
  }
  if(flag){
    cout << "No";
  }else{
    cout << "Yes";
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

int N, M;

int favor[31];

int main() {
   
    cin >> N >> M;
    
    vector<vector<int>>A;
    
    A.resize(N);
    
    
    for(auto i = 0; i<N; i++){
        
        int k = 0;
        cin >> k;
        
        for(auto j = 0; j<k; j++){
            int temp;
            cin >> temp;
            temp--;
            favor[temp]++;
        }
    }
    
    int ans = 0;
    
    for(auto i = 0; i<M;i++){
        
        if (favor[i] == N) ans++;
        
    }
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const ll INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A, ll x = 10){cout << fixed << setprecision(x) << A << endl;}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){
  ll res = x / gcd(x, y);
  res *= y;
  return res;
};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}


ll N;
ll A[300000];
pair<ll, ll> B[300000];
pair<ll, ll> update(pair<ll, ll> p, ll x){
  if(p.f < x){
    p.s = p.f;
    p.f = x;
  }else if(p.s < x){
    p.s = x;
  }
  return p;
}
void solve(){
  cin >> N;
  rep(i, 1<<N) cin >> A[i];
  rep(i, 1<<N) B[i] = {-1, -1};
  rep(i, 1<<N){
    for(ll j = i;; j = (j-1)&i){
      B[i] = update(B[i], A[j]);
      if(j == 0) break;
    }
  }
  ll ans = -1;
  for(ll i = 1; i < 1<<N; i++){
    ans = max(ans, B[i].f + B[i].s);
    cout << ans << endl;
  }
}


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


Measured memory_bytes: 11264
#include<stdio.h>
int main()
{
	int P, Q, R;
	scanf("%d %d %d", &P,&Q, &R);
	
	int a, b, c;
	
	if(P <= Q && Q <= R){
		a=P;
		b=Q;
		c=R;
	}
	
	else if (P > Q && P <= R){
		a = Q;
		b = P;
		c = R;
	}
	
	else if (P <= R && Q > R){
		a = P;
		b = R;
		c =Q;
	}
	
	else if (P <= Q && R < P){
		a = R;
		b = P;
		c = Q;
	}
	
	else if (P > Q && P > R){
		a = Q;
		b = R;
		c = P;
	}
	
	else{
		a = R;
		b = Q;
		c = P;
	}
	
	
	printf("%d", a+b);
	
	return 0;
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

int main(int argc, char const *argv[])
{
    int p = 2019;
    string s;
    cin >> s;
    int n = s.size();
    if (p != 2 && p != 5)
    {
        map<int, ll> mp;
        ll cur = 0;
        ll tmp = 1;
        mp[cur]++;
        for (int i = n - 1; i >= 0; i--)
        {
            cur += (tmp * (ll)(s[i] - '0'));
            cur %= p;
            mp[cur]++;
            tmp *= 10;
            tmp %= p;
            assert(tmp != 0);
        }
        ll ans = 0;
        rep(i, p)
        {
            if (mp[i] == 0)
                continue;
            ans += (ll)mp[i] * (mp[i] - 1) / 2;
        }
        cout << ans << endl;
    }
    else if (p == 2)
    {
        ll ans = 0;
        rep(i, n)
        {
            if ((s[i] - '0') % 2 == 0)
            {
                ans += i + 1;
            }
        }
        cout << ans << endl;
    }
    else if (p == 5)
    {
        ll ans = 0;
        rep(i, n)
        {
            if ((s[i] - '0') % 5 == 0)
            {
                ans += i + 1;
            }
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>



int main() {
	ll a;
	cin >> a;
	cout << (a - 2) * 180 << endl;
}

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

int main(){
  int n,k;
  cin >>n >>k;
  ll cnt = 1;
  rep(i,n){
    cnt*=k;
    if(i==0) k--;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque
import numpy as np
from math import factorial

n = int(input())

ps = deque(map(lambda x: int(x) - 1, input().split()))

qs = deque(map(lambda x: int(x) - 1, input().split()))

def l_to_num(l):
    ans = 0
    
    n = len(l)
    order = np.arange(n)
    n -= 1
    fn = factorial(n)
    for _ in list(range(n)):
        tmp = l.popleft()
        ans += order[tmp] * fn
        fn //= n
        order[tmp] = 1 << 31
        order[tmp+1:] -= 1
        n -= 1
    
    return ans

print(abs(l_to_num(ps) - l_to_num(qs)))

Measured memory_bytes: 12516
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 5;
int dp[maxn][20];
int x[maxn];

int main(){
    int N, L, Q, a, b;
    scanf("%d", &N);
    for(int i = 1; i <= N; i++){
        scanf("%d", &x[i]);
    }
    scanf("%d", &L);
    x[0] = x[1];
    for(int i = 1, l = 0; i <= N; i++){
        while(x[i] - x[l] > L) l++;
        dp[i][0] = l;
        for(int j = 1; j < 20; j++){
            dp[i][j] = dp[dp[i][j - 1]][j - 1];
        }
    }
    scanf("%d", &Q);
    while(Q--){
        scanf("%d%d", &a, &b);
        if(a < b) swap(a, b);
        int ans = 0;
        for(int d = 19; d >= 0; d--){
            if(dp[a][d] >= b){
                ans += (1 << d);
                a = dp[a][d];
            }
        }
        if(a != b) ans++;
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 9088
#include <stdio.h>

int main(){
  
  int l, r, ll, rr, minn;
  
  scanf("%d%d", &l, &r);

  ll = l % 2019;
  rr = r % 2019;
  
  minn = 2019;
  if(r - l > 2019) rr += 2019;

  for (int i=ll;i<rr;i++){
      for (int j=ll+i-ll+1;j<rr+1;j++){
          if(minn > i * j % 2019){
              minn = i * j % 2019;
          }
      }
  }
  printf("%d\n", minn);
  return 0;
}


Measured memory_bytes: 1728
//Volume5-0514
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Test {
	public int i,j,k,r;
	Test(int i,int j,int k,int r){
		this.i=i;
		this.j=j;
		this.k=k;
		this.r=r;
	}
}

class Main {

	private static ArrayList<Test> ar = new ArrayList<Test>();

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		while(true){

			int a=sc.nextInt(),
				b=sc.nextInt(),
				c=sc.nextInt();

			if(a==0&&b==0&&c==0){break;}

			int[] parts = new int[a+b+c+1];
			Arrays.fill(parts, 2);
			int   N     = sc.nextInt(),
			      i,j,k,r;

			ar.clear();
			while(N-- > 0){
				i=sc.nextInt();
				j=sc.nextInt();
				k=sc.nextInt();
				r=sc.nextInt();
				ar.add(new Test(i,j,k,r));
			}

			for(Test t:ar){
				if(t.r==1){
					parts[t.i]=1;
					parts[t.j]=1;
					parts[t.k]=1;
				}
			}

			for(Test t:ar){
				if(t.r==0){
					if      (parts[t.j]==1&&parts[t.k]==1){parts[t.i]=0;}
					else if (parts[t.i]==1&&parts[t.k]==1){parts[t.j]=0;}
					else if (parts[t.i]==1&&parts[t.j]==1){parts[t.k]=0;}
				}
			}

			for(int l=1;l<parts.length;l++){
				System.out.println(parts[l]);
			}
		}
	}
}

Measured memory_bytes: 28188
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<char,char> p2;
#define sz(a) ll(a.size())
void solve(){
	ll x;
	cin>>x;
	ll cnt=8;
	for(ll i=599;i<=1999;i+=200){
		if(x<=i){
			cout<<cnt;
			exit(0);
		}
		cnt--;
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++)
    solve();
}


Measured memory_bytes: 3656
#include<stdio.h>
 
int main(void){
 int n,a[1000],i,j,b,c,min;
 
 while(1){
  scanf("%d",&n);
 
  if(n==0){
   break;
  }
  for(i=0;i<n;i++){
   scanf("%d",&a[i]);
  }
  for(i=0;i<n-1;i++){
   for(j=n-1;j>i;j--){
    if(a[j-1]<a[j]){
     b=a[j-1];a[j-1]=a[j];a[j]=b;
    }
   }
  }
  min=a[0];
  for(i=0;i<n-1;i++){
   c=a[i]-a[i+1];
   if(min>c){
    min=c;
   }
  }
  printf("%d\n",min);
 }
}

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

int main () {
  int N;
  cin >> N;
  vector<long long> A(N+1);
  A.at(0) = 2;
  A.at(1) = 1;
  
  for(int i = 2; i < N+1; i++) {
    long long s;
    s = A.at(i-1) + A.at(i-2);
    A.at(i) = s;
  }
  
  cout << A.at(N) << endl;
}

  
 

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    double weight;
    while (scanf("%lf",&weight)!=EOF) {
        if (weight<=48.00) {
            printf("light fly\n");
        } else if (weight<=51.00) {
            printf("fly\n");
        } else if (weight<=54.00) {
            printf("bantam\n");
        } else if (weight<=57.00) {
            printf("feather\n");
        } else if (weight<=60.00) {
            printf("light\n");
        } else if (weight<=64.00) {
            printf("light welter\n");
        } else if (weight<=69.00) {
            printf("welter\n");
        } else if (weight<=75.00) {
            printf("light middle\n");
        } else if (weight<=81.00) {
            printf("middle\n");
        } else if (weight<=91.00) {
            printf("light heavy\n");
        } else {
            printf("heavy\n");
        }
    }
    return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int n, i;
  cin >> n >> i;
  cout << n - i + 1 << endl;
}


Measured memory_bytes: 256
class Dice:
  __table =[[0,1,2,3,4,5],[0,2,4,1,3,5],[0,4,3,2,1,5],[0,3,1,4,2,5],
            [1,5,2,3,0,4],[1,2,0,5,3,4],[1,0,3,2,5,4],[1,3,5,0,2,4],
            [2,5,4,1,0,3],[2,4,0,5,1,3],[2,0,1,4,5,3],[2,1,5,0,4,3],
            [3,5,1,4,0,2],[3,1,0,5,4,2],[3,0,4,1,5,2],[3,4,5,0,1,2],
            [4,2,5,0,3,1],[4,5,3,2,0,1],[4,3,0,5,2,1],[4,0,2,3,5,1],
            [5,1,3,2,4,0],[5,3,4,1,2,0],[5,4,2,3,1,0],[5,2,1,4,3,0]]
  __another = []
  def __init__(self,dice):
    self.dice = dice
    for t in self.__table:
      a = []
      for v in t:
        a.append(dice[v])      
      self.__another.append(a)
      
  def output(self):
    print(self.dice[0])
    
  def right_dise(self,a,b):
    for t in self.__another:
      if t[0] == a and t[1] == b:
        return t[2]

  def comparison(self,dice):
    result = 0
    for table_temp in self.__another:
      table_temp = ''.join(map(str,table_temp))
      dice = ''.join(map(str,dice))
      if table_temp == dice:
        print('Yes')
        result = 1
        break
    if result == 0:
      print('No')
  
  def comparison2(self,dice):
    for table_temp in self.__another:
      table_temp = ''.join(map(str,table_temp))
      dice = ''.join(map(str,dice))
      if table_temp == dice:
        return 1
    return 0

  def move(self,str):
    if str == 'N':
      temp = self.dice[0]
      self.dice[0] = self.dice[1]
      self.dice[1] = self.dice[5]
      self.dice[5] = self.dice[4]
      self.dice[4] = temp
    elif str == 'S':
      temp = self.dice[0]
      self.dice[0] = self.dice[4]
      self.dice[4] = self.dice[5]
      self.dice[5] = self.dice[1]
      self.dice[1] = temp
    elif str == 'E':
      temp = self.dice[0]
      self.dice[0] = self.dice[3]
      self.dice[3] = self.dice[5]
      self.dice[5] = self.dice[2]
      self.dice[2] = temp
    elif str == 'W':
      temp = self.dice[0]
      self.dice[0] = self.dice[2]
      self.dice[2] = self.dice[5]
      self.dice[5] = self.dice[3]
      self.dice[3] = temp      
  
num = int(input())
di1 = list(map(int,input().split()))
di = Dice(di1)
result = 0
for _ in range(num-1):
  di2 = list(map(int,input().split()))
  result += di.comparison2(di2)
  
if result > 0:
  print('No')
else:
  print('Yes')


Measured memory_bytes: 5628
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    H,W,K = map(int, readline().split())
    S = [list(map(int, readline().strip())) for j in range(H)]

    white = 0
    for line in S:
        white += sum(line)

    if white <= K:
        print(0)
        exit()

    # 横線の決め方を全探索
    ans = 10**5
    for pattern in range(2**(H-1)):
        # 初期化
        impossible = False
        x = 0
        ly = bin(pattern).count("1")
        y = [[0]*W]*(ly + 1)
        line = 0
        for i in range(H):
            y[line] = [y[line][j] + S[i][j] for j in range(W)]
            if (pattern >> i) & 1:
                line += 1

        # 各列の値を加算していく
        count = [0]*(ly + 1) 
        for j in range(W):
            for i in range(line+1):
                if y[i][j] > K :
                    impossible = True
                    break

                count[i] += y[i][j]
                if count[i] > K:
                    x += 1
                    for i in range(line+1):
                        count[i] = y[i][j] 
                    break
            if x + ly > ans or impossible:
                impossible = True
                break
        if impossible:
            x = 10**6

        ans = min(ans, x + ly)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define N 500050
#define M 200
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define clr(a) a.clear()
#define ll long long
#define SIZE N
#define MOD mod
using namespace std;
int mod = 1e9 + 7;
double art[N],n;
map< pair< pair< int,int > , pair< int , int > > , int  >ma;
int ar[N];
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++)
	    cin>>art[i];
	int ans = 0;
	int ten = 10, two = 2 , five = 5;
	double f = 1e10;
	for(int i=n-1;i>=0;i--){

	   art[i] *= f;
	   ar[i] = art[i];
	   if(ar[i]%ten){
	       ar[i] += (ten-(ar[i]%ten));
	   }
	   ar[i] /= ten;
	   int te = 0,tw = 0,fi = 0;
	   while(ar[i]%ten==0){
	       te++;
	       ar[i]/=ten;
	   }
	   while(ar[i]%two==0){
	       tw++;
	       ar[i]/=two;
	   }
	   while(ar[i]%five==0){
	       fi++;
	       ar[i]/=five;
	   }
	   for(auto j: ma){
	       int g = j.x.x.y;
	       int v = 0;
	       if(j.x.y.x==2)v = min(fi,j.x.y.y);
	       else v = min(tw,j.x.y.y);
	       g+= v;
	       if(g+te>=18)ans+= j.y;
	   }
	   if(tw)ma[{{ten,te},{two,tw}}]++;
	   else ma[{{ten,te},{five,fi}}]++;
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 6868
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(void)
{
  long long int n,m,count = 0;
  cin >> n >> m;
  
  vector<long long int> l(m),r(m);
  for(int i = 0; i < m; i++)
  {
    cin >> l[i] >> r[i];
  }
  
  sort(l.begin(),l.end(),greater<long long int>());
  sort(r.begin(),r.end());
  
  for(int i = l[0]; i <= r[0]; i++)
  {
    count++;
  }
  
  cout << count;
  
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int64 l; cin >> l;
		int64 r; cin >> r;
		int64 ans = 2020;
		for (int64 i = l; i < (l + 2020); ++i) {
			for (int64 j = r; j > (r - 2020); --j) {
				//数値の組み合わせを網羅しながら、それぞれの数を2019で割った余りをかける
				if (i < j) ans = min(ans, i % 2019 * j % 2019);
			}
		}
		cout << ans << endl;
    return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 256