akhauriyash/Code-Regression huggingface dataset:
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define mod 1000000007
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;

int main(){
    FAST_IO ;
    for( int i = 1 ; i <= 5 ; i++ ){
        int x ; cin >> x ;
        if( x == 0 ){
            cout << i << endl ;
            return 0 ;
        }
    }
    return 0 ;
}


Measured memory_bytes: 3564
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int[] b = new int[n-1];
		for(int i = 0; i < n-1; i++) {
			b[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			if(i==0) {
				ans += b[i];
			}
			else if(i==n-1) {
				ans+=b[n-2];
			}
			else {
				ans += Math.min(b[i-1], b[i]);
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<deque>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<tuple>
#include<map>
#include<memory>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<double> VD;
typedef pair<int, int> P1;
typedef long long int ll;

//number
#define INF 1e9
#define NUM 1000000007

//itr
#define all(x) begin(x),end(x)

//repeat
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define RREPS(i,x) for(int i=((int)(x));i>=0;i--)

//max,min
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

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

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

//grid template
int x[] = { -1, 0, 1, 0 };
int y[] = { 0,-1,0,1 };
int xx[] = { -1,-1,1,1 };
int yy[] = { 1,-1,1,-1 };

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

	VI a(26);
	rep(i, s.size()) {
		a[s[i] - 'a']++;
	}

	rep(i, 26) {
		if (a[i] >= 2) {
			cout << "no" << endl;
			return 0;
		}
	}

	cout << "yes" << endl;
}


 

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


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

    vector<int> x(n);

    int cnt[100010] = {};
    int cnt2[100010] = {};
    int tmp[100010] = {};

    for(int i = 0;i < n;i++){
        cin >> x[i];
        cnt[x[i] % m]++;
        tmp[x[i]]++;
    }

    for(int i = 1;i <= 100010;i++){
        cnt2[i%m] += tmp[i]/2;
    }

    int ans = 0;
    for(int i = 1;i <= m/2;i++){
        int l = i;
        int r = m-i;
        if(l == r){
            ans += cnt[l] / 2;
        }else{
            if(cnt[l] < cnt[r]) swap(l, r);
            ans += cnt[r];
            int ho = cnt[l] - cnt[r];
            ans += min(ho/2, cnt2[l]);
        }
    }
    ans += cnt[0]/2;

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

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
//typedef long long ll;
int n,m,q,ans;
int a[100000], b[100000];
int s[100000], t[100000];
long long l,x[303][303],y[303][303], c[100000];
const long long  inf=1<<30;

int main(){
    int mod=1000000007;
    for (int i=0;i<303;i++) {
        y[i][i]=0;
        x[i][i]=0;
        for (int j=0;j<303;j++) {
            x[i][j]=inf;
            y[i][j]=inf;
        }
    }
    scanf("%d %d %lld",&n,&m,&l);
    for (int i=0;i<m;i++) {
        scanf("%d %d %lld",&a[i],&b[i],&c[i]);
        if (c[i]<=l) {
            x[a[i]][b[i]]=min(c[i],x[a[i]][b[i]]);
            x[b[i]][a[i]]=min(c[i],x[b[i]][a[i]]);
        }
    }
    for (int i=0;i<303;i++)  for (int j=0;j<303;j++)  for (int k=0;k<303;k++) {
                x[j][k]=min(x[j][k],x[j][i]+x[i][k]);
                x[k][j]=x[j][k];
    }
    for (int i=0;i<303;i++) for (int j=0;j<303;j++) {
        if (i!=j && x[i][j]<=l) {
            y[i][j]=1;
            y[j][i]=1;
        }
    }
    for (int i=0;i<303;i++) for (int j=0;j<303;j++) for (int k=0;k<303;k++) {
                y[j][k]=min(y[j][k],y[j][i]+y[i][k]);
                y[k][j]=y[j][k];
    }
    scanf("%d",&q);
    for (int i=0;i<q;i++) {
        int aa,bb;
        scanf("%d %d",&aa,&bb);
        if (y[aa][bb]<inf) {
            printf("%lld\n",y[aa][bb]-1);
        } else {
            printf("-1\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leadinz zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0){
        if(b&1)res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)return true;
    while(d!=n-1){
        x=(x*x)%n;
        d*=2;
        if(x==1)return false;
        if(x==n-1)return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)return false;
    if(n<=3)return true;
    ll d=n-1;
    while(d%2==0)d/=2;
    for(int i=0;i<k;i++){
        if(!miller_rabin(d,n))return false;
    }
    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    string s;
    cin>>n>>s;
    int cnt=0;
    int mx=0;
    for(auto x: s){
        if(x=='I')cnt++;
        if(x=='D')cnt--;
        mx=max(mx,cnt);
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 256
//you never give up.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define v32 vector<int>
#define v64 vector<ll>

using namespace std;

void solve()
{
    ll n;
    double d;
    cin >> n >> d;
    ll count = 0;

    while (n--)
    {
        double i, j;
        cin >> i >> j;
        double value = sqrt(pow(i, 2) + pow(j, 2));
        if (value <= d)
            count++;
    }
    cout << count << endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t = 1;
    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define prep(i, a, b) for (int i = a; i < b; i++)
#define prrep(i, a, b) for (int i = a; i >= b; i++)
#define mrep(i, a, b) for (int i = a; i >= b; --i)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

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

int main()
{
    int N; cin >> N;
    vector<int> A;
    prep (i, 0, N) {
        int in; cin >> in;
        A.push_back(in);
    }

    vector<int> left(N+1, 0), right(N+1, 0);
    prep (i, 0, N) left[i+1] = gcd(left[i], A[i]);
    mrep (i, N-1, 0) right[i] = gcd(right[i+1], A[i]);

    int res = 0;
    prep (i, 0, N) {
        res = max(res, gcd(left[i], right[i+1]));
    }

    cout << res << endl;
}

Measured memory_bytes: 1656
N = int(input())
C = [[0 for _ in range(10)] for _ in range(10)]

for i in range(1, N+1):
    STR = str(i)
    a = int(STR[0])
    b = int(STR[-1])
    C[a][b] += 1
    
ans = 0
for i in range(10):
    for j in range(10):
        ans += C[i][j] * C[j][i]
        
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
int S,h,m,s;
	scanf("%d",&S);
	h=(int)S/3600;
	m=(int)S%3600/60;
	s=(int)S-3600*h-m*60;
	printf("%d:%d:%d\n",h,m,s);

return 0;
}

Measured memory_bytes: 592
C = [list(map(int,input().split())) for _ in range(3)]
print('Yes' if C[0][0]-C[0][1] == C[1][0]-C[1][1] == C[2][0]-C[2][1] and C[0][1]-C[0][2] == C[1][1]-C[1][2] ==C[2][1]-C[2][2] else 'No')

Measured memory_bytes: 40336
import numpy as np

N, K = map(int, input().split())
B = np.zeros((2 * K, 2 * K), np.int32)

for _ in range(N):
    x, y, c = input().split()
    if c == "B":
        B[int(x) % (2 * K)][int(y) % (2 * K)] += 1
    else:
        B[int(x) % (2 * K)][(int(y) + K) % (2 * K)] += 1

SB = np.zeros((4 * K + 1, 4 * K + 1), np.int32)

SB[0*K+1:2*K+1, 0*K+1:2*K+1] = B
SB[0*K+1:2*K+1, 2*K+1:4*K+1] = B
SB[2*K+1:4*K+1, 0*K+1:2*K+1] = B
SB[2*K+1:4*K+1, 2*K+1:4*K+1] = B

np.cumsum(SB, 0, out=SB)
np.cumsum(SB, 1, out=SB)

ans = 0
cand = SB[1*K:3*K+1, 1*K:3*K+1].copy()
cand -= SB[0*K:2*K+1, 1*K:3*K+1]
cand -= SB[1*K:3*K+1, 0*K:2*K+1]
cand += SB[0*K:2*K+1, 0*K:2*K+1]
cand += SB[2*K:4*K+1, 2*K:4*K+1]
cand -= SB[1*K:3*K+1, 2*K:4*K+1]
cand -= SB[2*K:4*K+1, 1*K:3*K+1]
cand += SB[1*K:3*K+1, 1*K:3*K+1]
ans = np.max(cand)

print(ans)


Measured memory_bytes: 106056
N = int(input())
C=[input() for _ in range(N)]

ac = C.count("AC")
wa = C.count("WA")
tle = C.count("TLE")
re = C.count("RE")

print("AC x {}".format(ac))
print("WA x {}".format(wa))
print("TLE x {}".format(tle))
print("RE x {}".format(re))


Measured memory_bytes: 16292
//前置き
#pragma region

#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef  long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

#pragma endregion

//関数定義
#pragma region 
//偶数 ->　true :: 奇数　-> false
bool EVEN(ll a){
    return a%2-1;
}

//最大公約数
ll gcd(ll a, ll b) {  
    if (!b)  
        return a;  
    return gcd(b, a%b);  
}  

//最小公倍数
ll lcm(ll a, ll b) {  
    return a*b/gcd(a,b);  
} 

#pragma endregion

int main(){
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << double(w)*double(h)/2.0 << " " << (x*2 == w && y*2 == h) << endl;
}




Measured memory_bytes: 256
s = input()[::-1]

m = 0
d = 1
cnt = [0] * 2019

for c in s:
	m += int(c) * d
	m %= 2019
	d *= 10
	d %= 2019
	cnt[m] += 1

ans = 0
for i in range(2019):
	ans += cnt[i] * (cnt[i] - 1) // 2
	if i == 0:
		ans += cnt[i]

print(ans)


Measured memory_bytes: 9280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };



int main()
{
	cin.sync_with_stdio(false);

	int h, w;
	while (cin >> h >> w, h)
	{
		string s[32], pattern;
		rep (i, h)
			cin >> s[i];
		cin >> pattern;


		int dis[32][32];
		const int INF = 1 << 24;
		int sx, sy, gx, gy;
		for (int y = 0; y < h; ++y)
		{
			for (int x = 0; x < w; ++x)
			{
				dis[y][x] = INF;
				if (s[y][x] == 'A')
					sx = x, sy = y;
				else if (s[y][x] == 'B')
					gx = x, gy = y;
			}
		}

		queue<pint> q;
		q.push(pint(sx, sy));
		dis[sy][sx] = 0;
		while (!q.empty())
		{
			pint t = q.front(); q.pop();
			int x = t.first, y = t.second;

			int nc = dis[y][x] + 1;
			for (int i = 0; i < 4; ++i)
			{
				int nx = x + dx[i], ny = y + dy[i];
				if (0 <= nx && nx < w && 0 <= ny && ny < h
					&& s[ny][nx] != '#' && nc < dis[ny][nx])
				{
					q.push(pint(nx, ny));
					dis[ny][nx] = nc;
				}
			}
		}

		vector<int> pat;
		for (int i = 0; i < pattern.size(); ++i)
		{
			static const char* ps = "26845";
			pat.push_back(strchr(ps, pattern[i]) - ps);
		}
		int res = -1, x, y;
		for (int t = 1, p = 0; t < 10000; ++t, ++p %= pat.size())
		{
			if (pat[p] < 4)
			{
				int nx = gx + dx[pat[p]], ny = gy + dy[pat[p]];
				if (0 <= nx && nx < w && 0 <= ny && ny < h)
					gx = nx, gy = ny;
			}
			if (dis[gy][gx] <= t)
			{
				res = t, x = gx, y = gy;
				break;
			}
		}
		if (res != -1)
			printf("%d %d %d\n", res, y, x);
		else
			puts("impossible");
	}
}

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

int main() {
  int A, B, a, b, c, d, e, C, S;
  cin >> A >> B;
  S = 0;
  for (int i = A; i <= B; i++) {
    a = i / 10000;
    b = (i % 10000) / 1000;
    c = ((i % 10000) % 1000) / 100;
    d = (((i % 10000) % 1000) % 100) / 10;
    e = (((i % 10000) % 1000) % 100) % 10;
    C = 10000 * e + 1000 * d + 100 * c + 10 * b + a;
    if (i - C == 0) {
      S++;
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
PII a[100010];
set<int> st;
int res;
int main()
{
	cin >>n>>m;
	for (int i=0;i<n;i++)
	{
		cin >>a[i].S>>a[i].F;
		a[i].F*=-1;
	}
	m++;
	sort(a,a+n);
	for (int i=1;i<=m;i++) st.insert(i);
	int day=m,t=0;
	while (day && t!=n)
	{
		set<int>::iterator it=st.upper_bound(m-a[t].S);
		if (it==st.begin())
		{
			t++;
			continue;
		}
		it--;
		st.erase(it);
		res-=a[t].F;
		t++;
	}
	cout <<res;
	return 0;
}

Measured memory_bytes: 5760
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() {
    input! {
        n: usize, k: i64,
        P: [Usize1; n],
        C: [i64; n]
    }

    let mut ans = -1i64<<60;
    for i in 0..n {
        let mut now = i;
        let mut count = 0i64;
        let mut score = 0i64;
        let mut most = -1i64<<60;
        loop {
            count += 1;
            now = P[now];
            score += C[now];
            most = max(most, score);
            if count >= k || now == i {
                break;
            }
        }
        ans = max(ans, most);
        if score <= 0 || count >= k {
            continue;
        }
        let res = (k / count) * score;
        ans = max(ans, res - score + most);
        let mut now = i;
        let mut score = 0i64;
        let mut rem = 0i64;
        for _ in 0..k % count {
            now = P[now];
            score += C[now];
            rem = max(rem, score);
        }
        ans = max(ans, res + rem);
    }
    println!("{}", ans);
}


Measured memory_bytes: 2352
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define int long long
#define M 1000000007
signed main()
{
    rootdada;
    // #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    int n;
    cin >> n;
    int s = 0;
    rep(i, 1, n + 1)
    {
        if (i % 3 == 0 && i % 5 == 0)
        {
        }
        else if (i % 3 == 0)
        {
        }
        else if (i % 5 == 0)
        {
        }
        else
            s += i;
    }
    cout << s << endl;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;
typedef vector< vector<int> > vvi;

int main() {
	int n, m, s, g1, g2;
	while(cin >> n >> m >> s >> g1 >> g2, n) {
		int cost[101][101];
		rep(i,n+1) rep(j,n+1) cost[i][j] = 10000000;
		rep(i, m) {
			int a, b, c;
			cin >> a >> b >> c;
			cost[a][b] = c;
		}
		rep(i,n) cost[i+1][i+1] = 0;
		rep(k,n) rep(i,n) rep(j,n)
			cost[i+1][j+1] = min( cost[i+1][j+1], cost[i+1][k+1] + cost[k+1][j+1] );
		int res = 10000000;
		for(int k=1; k<=n; k++) {
			res = min(res, cost[s][k]+cost[k][g1]+cost[k][g2]);
		}
		cout << res << endl;
	}
	return 0;
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 4;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int n;
	cin >> n;
	vl l(n + 2);
	l[0] = 2;
	l[1] = 1;
	for (int i = 2; i <= n; i++) {
		l[i] = l[i - 1] + l[i - 2];
	}
	cout << l[n] << endl;
}

Measured memory_bytes: 256
int main(void){
  int A, B;

  scanf("%d %d", &A, &B);

  if(0 <= A && A <= 5){
      printf("%d", 0);
  }
  else if(6 <= A && A <= 12){
      printf("%d", B/2);
  }
  else{
      printf("%d", B);
  }
}



Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    int N;
    long long x;
    cin >> N >> x;

    vector<long long> A(N,0);
    for(auto &a: A){
        cin >> a;
    }

    long long ans=0;
    for(int i=0; i<N-1; i++){
        if(A[i]+A[i+1]>x){
            long long tmp = max((long long)0,A[i]+A[i+1]-x);
            A[i]-=max(tmp-A[i+1], (long long)0);
            A[i+1]-=min(tmp, A[i+1]);
            ans+=tmp;
        }
    }
    //cout_vec(A);
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N,K;
    cin >>N>>K;
    vector<char> D(K);
    rep(i,K){
        cin >> D.at(i);
    }
    bool NOK=true;
    rep2(i,N,100000){
        NOK=true;
        rep(j,K){
            string tmp = to_string(i);
            rep(k,tmp.size()){
                // cout << tmp.at(k) <<" " << D.at(j) << endl;
                if(tmp.at(k)==D.at(j)){
                //NG数字入ってる
                // cout << "kitayo" << endl;
                NOK=false;
                break;
                }
            }
            if(!NOK){
                break;
            }
        }
        if(NOK){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
    n: usize,
    x: [i32; n],
    );
    let mut min = 1000000000;
    for p in 0..101 {
        let cost = x.iter().map(|x| (x - p).pow(2)).sum();
        min = if min > cost { cost } else { min };
    }
    print!("{}", min);
}


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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    ll n; cin >> n;
    ll a[n];
    rep(i, n) a[i] = 0;
    ll in;
    rep(i, n-1){
        cin >> in;
        a[in-1]++;
    }

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

    return 0;
}

Measured memory_bytes: 5188
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;

tuple<int, int, int> f(vector<int> a) {
    std::unordered_map<int, int> u;
    for(auto it = a.begin(); it != a.end(); it++ )    {
        if (u.find(*it) == u.end()) {
            u[*it] = 1;
        } else {
            u[*it] ++;
        }
    }
    int z, zz;
    auto pr = *std::max_element
(
    std::begin(u), std::end(u),
    [] (const pair<int,int> & p1, const pair<int,int> & p2) {
        return p1.second < p2.second;
    }
);
    z = pr.first;
    zz = pr.second;
    u.erase(z);
    auto pr2 = std::max_element
(
    u.begin(),u.end(),
    [] (const pair<int,int> & p3, const pair<int,int> & p4) {
        return p3.second < p4.second;
    }
);
    if (pr2!=u.end()) {
        return make_tuple(z, zz, (*pr2).second);
    } else {
        return make_tuple(z, zz, 0);
    }

   
}
int main() {
    int n;
    cin>>n;
    vector<int> a;
    vector<int> b;
    for(auto i=0; i<n/2; i++) {
        int input;
        cin >> input;
        a.push_back(input);
        cin >> input;
        b.push_back(input);
    }
    auto t = f(a);

    int key=get<0>(t), v1=get<1>(t), v2=get<2>(t);
    auto t2 = f(b);
    int keyz=get<0>(t2), v1z=get<1>(t2), v2z=get<2>(t2);
    if (key == keyz) {
        cout << (min(n-v1-v2z, n-v2-v1z));
    } else {
        cout << n - v1 - v1z;
    }
}

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

using namespace std;

const int N = 2005, mod = 924844033;

int n, k, m;
int f[N], g[N][2], fac[N], ifac[N];
bool vis[N];

inline void Inc(int &u, const int v) { if((u += v) >= mod) u -= mod; }
int perm(int x, int y) { return 1LL * fac[x] * ifac[x - y] % mod; }
int comb(int x, int y) { return 1LL * perm(x, y) * ifac[y] % mod; }

int fpm(int x, int y) {
    int r = 1;
    while(y) {
        if(y & 1) r = 1LL * r * x % mod;
        x = 1LL * x * x % mod, y >>= 1;
    }
    return r;
}

int main() {
    scanf("%d %d", &n, &k), m = n / k / 2 + 1;
    f[0] = 1;
    for(int sp = 1; !vis[sp] && sp <= n; ++sp) {
        for(int i = 0; i <= m; ++i)
            g[i][0] = g[i][1] = 0;
        g[0][0] = 1;
        for(int p = sp; p <= n; p = p + k + k) {
            vis[p] = true;
            for(int i = m; ~i; --i) {
                if(p - k >= 1) { // fill p - k
                    Inc(g[i + 1][0], g[i][0]);
                }
                if(p + k <= n) { // fill p + k
                    Inc(g[i + 1][1], g[i][0]);
                    Inc(g[i + 1][1], g[i][1]);
                }
                // do nothing
                Inc(g[i][0], g[i][1]), g[i][1] = 0;
            }
        }
        for(int sa = n; sa >= 0; --sa) if(f[sa]) {
            for(int sb = 1; sb <= m; ++sb) if(g[sb][0] || g[sb][1]) {
                f[sa + sb] = (f[sa + sb] + 1LL * f[sa] * (g[sb][0] + g[sb][1])) % mod;   
            }
        }
    }
    
    fac[0] = 1;
    for(int i = 1; i <= n; ++i) fac[i] = 1LL * i * fac[i - 1] % mod;
    ifac[n] = fpm(fac[n], mod - 2);
    for(int i = n; i; --i) ifac[i - 1] = 1LL * i * ifac[i] % mod;

    for(int i = 0; i <= n; ++i)
        f[i] = 1LL * f[i] * fac[n - i] % mod;
    int ans = 0;
    for(int i = 0; i <= n; ++i) {
        if(i & 1) {
            ans = (ans - f[i] + mod) % mod;
        } else {
            ans = (ans + f[i]) % mod;
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;

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

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

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

const ll INF = 1<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int n, a, b;
ll v[50];

ll ncr(ll n, ll r) {
	ll res = 1, c = 1;
	
	for (ll i = n; i >= n - r + 1; i--) {
		res *= i;
		
		if (c != -1) res /= c++;
		if (c == r + 1) c = -1;
	}
	
	while (c != -1) {
		res /= c++;
		if (c == r + 1) c = -1;
	}
	
	return res;
}

int main() {
	cin >> n >> a >> b;
	REP(i, n) scanf("%lld", v + i);
	sort(v, v + n, greater<ll>());
	
	double ma = 0.0;
	REP(i, a) ma += v[i];
	ma /= a;
	
	printf("%.15lf\n", ma);
	
	ll last = v[a - 1];
	
	int cnt = 0, bec = 0;
	REP(i, n) if (v[i] == last) cnt++;
	
	REP(i, a) {
		if (v[i] == last) break;
		bec++;
	}
	
	int l = a - bec, r = cnt;
	
	ll ans = 0;
	
	if (last == v[0]) {
		REP(i, b) {
			if (bec + l + i > b) break;
			if (l + i > r) break;
			
			ans += ncr(r, l + i);
		}
	}
	else {
		ans += ncr(r, l);
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
 
using namespace std;
 
int main(){
	ll N,W;
	cin>>N>>W;
	ll wrr[N+1],vrr[N+1];
	ll sum=0;
	for(ll i=0;i<N;i++){
		cin>>wrr[i]>>vrr[i];
		sum+=vrr[i];
	}
	ll x=N*1000;
	ll dp[sum+1];
//	if(W>x){cout<<sum<<'\n';return 0;}
	for(ll i=0;i<=sum;i++)dp[i]=1000000000000;
	dp[0]=0;
	//}
//	for(ll i=0;i<=W;i++){
//		cout<<dp[i][0]<<'\n';
//	}
	for(ll i=0;i<N;i++){
		for(ll j=sum;j>=0;j--){
			if(j>=vrr[i]){
				dp[j]=min(dp[j],dp[j-vrr[i]]+wrr[i]);
				//cout<<i<<' '<<j<<' '<<dp[j]<<'\n';
			}
		}
	}
	ll ans=0;
	for(ll i=0;i<=sum;i++){
		if(dp[i]<=W)ans=i;
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int sq = sqrt(1e6);
	vector<int> ar(1e6+7, 1);
	ar[0] = ar[1] = 0;
	rep(i, 2, sq) {
		int j;
		if (ar[i]) {
			j = 2 * i;
			while (j <= 1e6) {
				ar[j] = 0;
				j = j + i;
			}
		}
	}
	int x;
	cin >> x;
	rep(i, x, 1e6 + 5) {
		if (ar[i]) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 4096
#こういう場合分けは通るのか？
iN,iM = [int(_) for _ in input().split()]
iD = iM // iN
if iM % iN == 0:
    print(iD)
elif 2*iN > iM :
    print(1)
else:
    aD = []
    iRtM = int(iM**0.5)
    if iRtM > iD:
        for i in range(iD,0,-1):
            if iM % i == 0:
                print(i)
                exit()
    else:
        aRet = []
        for i in range(1,iRtM+1):
            if iM % i ==0:
                if iRtM / 2 > i:
                    aRet.append(i)
                    if iD > iM // i :
                        print (iM // i)
                        exit()
                else:
                    print (i)
                    exit()
        print(max(aRet))


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



long long modpow(long long x,long long y,long long z){
  long long ans=1;
  while(y>0){
    if(y&1){
      ans*=x%z;
    }
    x*=x%z;
    x%=z;
    ans%=z;
    y>>=1;
  }
  return ans;
}

long long modC(long long x,long long y,long long z){
  long long X=1,Y=1,XY=1;
  for(long long i=x;i>=(x-y+1);i--){
    X*=i;
    X%=z;
  }
  for(long long i=1;i<=y;i++){
    Y*=i;
    Y%=z;
  }
  /*for(long long i=1;i<=(x-y);i++){
    XY*=i;
    XY%=z;
  }*/
  //cout<<Y;
  Y=modpow(Y,z-2,z);
  //XY=modpow(XY,z-2,z);
 // cout<<X<<Y<<XY;
  X*=Y;
  X%=z;
  //X*=XY;
 // X%=z;
  return X;
}





int main(){
  long long N,a,b,ans=1;
  cin>>N>>a>>b;
  ans=modpow(2,N,1000000007);
  //cout<<ans<<" ";
  ans=ans-modC(N,a,1000000007)-modC(N,b,1000000007)-1;
  while(ans<0){
    ans+=1000000007;
  }
  
  cout<<ans;
  //cout<<modpow(6,1000000005,100000007);
 // a=1000000007;
 // a*=a;
  //cout<<a;
  
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a[] = new int[N];
        int ans = 0;
 
        for(int i=0; i<N; i++){
            a[i] = sc.nextInt();
        }
 
        int x = 1;
        for(int i=0; i<N; i++){
            ans++;
            x = a[x-1];
            if(x==2){
                System.out.println(ans);
                break;
            }
            if(i==N-1)
                System.out.println(-1);
        }
    }
}

Measured memory_bytes: 51088
#include <bits/stdc++.h>
#define fastio (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastio;
    string a, b;
    cin >> a >> b;
    reverse(b.begin(), b.end());
    cout << ((a == b) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <queue>
using namespace std;
int main() {
    queue <int> q;
    int in;
    while (cin >> in) {
        if (in == 0) break;
        q.push(in);
    }
    int i = 1;
    while (!q.empty()) {
        cout << "Case " << i << ": " << q.front() << endl;
        q.pop();
        i++;
    }
    return 0;
}



Measured memory_bytes: 3072
n, a, b, c, d = gets.chomp!.split(" ").map(&:to_i)
s = "##{gets.chomp!}#"

if c < b # a < c < b < d
    if [
        s[a, c-a+1].include?("##"),
        s[b, d-b+1].include?("##")
    ].any?
        puts "No"
    else
        puts "Yes"
    end
elsif c < d # a < b < c < d
    if s[a, d-a+1].include?("##")
        puts "No"
    else
        puts "Yes"
    end
else # a < b < d < c
    if s[a, c-a+1].include?("##")
        puts "No"
    else
        head = b-1
        tail = d+1
        if s[head, tail-head+1].include?("...")
            puts "Yes"
        else
            puts "No"
        end
    end
end


Measured memory_bytes: 2556
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <stdio.h>
using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll sums=0, sum_1=0;
    for(ll i=0; i<N; i++){
        cin >> A[i];
        sums+=A[i];
        if(i%2==0) sum_1+=A[i];
    }
    sums/=2;
    vector<ll> X(N);
    X[0]=sum_1-sums;
    for(ll i=1; i<N; i++){
        X[i]=A[i-1]-X[i-1];
    }
    for(int i=0; i<(int)N-1; i++){
        cout << X[i]*2 << ' ';
    }
    cout << X[N-1]*2 << endl;


    
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int,int>> xy(n);
  for (int i=0; i<n; i++) {
    int x, y;
    cin >> xy[i].first >> xy[i].second;
  }
  double dist = 0;
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      double x = xy[i].first - xy[j].first;
      double y = xy[i].second - xy[j].second;
      dist += sqrt(x*x+y*y);
    }
  }
  dist /= (double)n;
  cout << setprecision(12) << dist << endl;
  return 0;
}

Measured memory_bytes: 256
/*たて a cm よこ b cm の長方形の面積と周の長さを求めるプログラム*/

#include <stdio.h>

int main(){
    
    int a,b;

    int area,length;
    
    do{
        scanf("%d %d",&a, &b);
    }while(a<1 || a>100 || b<1 || b>100); /*1 ≤ a, b ≤ 100を満たすまで繰り返される*/
    
    area = a*b;
    
    length = a*2+b*2;
    
    printf("%d %d\n",area, length);
    
    return 0;
}


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

int main(){
	int n,prevColor,wantColor;
	int color[10002];
	while(cin >> n,n){
		int ret = 0;
		color[0] = -1;
		color[n+1] = -2;
		for(int i=0;i<n;i++){	
			cin >> color[i+1];
		}
		for(int i=1;i<=n;i++){
			for(int cColor=1;cColor<=3;cColor++){
				if(cColor == color[i])continue;
				prevColor = color[i]; color[i] = cColor;
				
				int get = 0;
				
				int right = i , left = i;
				bool first = true;
				while(color[right] == color[left]){
					wantColor = color[right];
					int count = (first?-1:0); // <- ?
					first = false;
					bool leftStop = true , rightStop = true;
					while(leftStop || rightStop){
						if(rightStop && color[right] == wantColor){
							count++;
							right++;
						}else{
							rightStop = false;
						}
						
						if(leftStop && color[left] == wantColor){
							count++;
							left--;
						}else{
							leftStop = false;
						}
					}
					if(count < 4)break; // <- ?
					get += count;
					
				}
				
				if(get >= 4){
					ret = max(ret,get); // <- ?
				}
				color[i] = prevColor;
			}
		}
		cout << n-ret << endl;
	}
}

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

int main() {
    
    int a, b, c;
    cin >> a >> b >> c;
    
    int mx = max(max(a, b), c);
    int mi = min(min(a, b), c);
    
    //cout << mx << endl;
    
    
    cout << mx - mi << endl;
    
    
	return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#include<unordered_set>
#include <random>
#include <ctime>
#include <chrono>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const int MAX=2e5+1;
const ll MM=1e16;
const ll mod=1e9+7;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}

void solve()
{
    ll n,m,i,j,k,x;
    cin>>x>>n;
    vl p(n);
    set<ll> st;
    fn(i,n){cin>>p[i];st.insert(p[i]);}
    ll left=x,right=x;
    W(st.count(left) && st.count(right))
    left--,right++; 
    if(st.count(left))
    cout<<right<<endl;
    else
    {
      cout<<left<<endl;
    }
    
    
}

int main()
{
  boost;
  ll t=1;
//  cin>>t;
  while(t--)
  {
      solve();
  }
}


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

int main(){
  
  long long int n,k;
  cin >> n >> k;
  
  long long int kosuu;
  long long int pat=0;
  if (k%2==0) {
    kosuu=(n + (k / 2)) / k;
    pat+=kosuu*kosuu*kosuu;
    
  }
  kosuu=n/k;
  pat+=kosuu*kosuu*kosuu;
    
  cout << pat << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long dp[55][2505],ans;
int main()
{
	int n,m,x;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		for(int j=n;j>1;j--)
		{
			for(int k=2500;k>0;k--)
			{
				if(k-x<0)continue;
				dp[j][k]+=dp[j-1][k-x];
			}
		}
		dp[1][x]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(i*m>2500)break;
		//printf("%d %lld\n",i,dp[i][i*m]);
		ans+=dp[i][i*m];
	}
	printf("%lld",ans);
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
int (*rd)()=read<int>;
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;

const int N=1e6+5;
int n, prev[N], next[N], cnt[3];
char s[N];
int main() {
	int rev[3], rem=0;
	std::pair<int, char> hub[3]={{0, 0}, {0, 1}, {0, 2}};
	assert(scanf("%s", s)==1);
	n=std::unique(s, s+strlen(s))-s;
	for(int i=0; i<n; ++i) ++hub[s[i]-'A'].first;
	std::sort(hub, hub+3);
	for(int i=0; i<3; ++i) cnt[i]=hub[i].first, rev[hub[i].second]=i;
	for(int i=0; i<n; ++i) s[i]=rev[s[i]-'A'];
	for(int i=0, j=0; i<=n; ++i) {
		if(i==n||s[i]==0) {
			if(j<0) --rem;
			if(j>0&&i!=n&&i!=1) ++rem;
			j=0;
		} else if(s[i]==1) j=-1;
		else j|=1;
	}
	if(rem>0) {
		for(int i=2; i<n&&rem; ++i)
			if(s[i-2]==0&&s[i-1]==2&&s[i]==0) {
				s[i-2]=s[i-1]=-1;
				--rem, --cnt[0], --cnt[2];
			}
		n=std::remove(s, s+n, -1)-s;
	}
	rem=cnt[2]-cnt[1];
	for(int i=1; i<=n&&rem; ++i)
		if((i==1||i==n||s[i-2]+s[i]==1)&&s[i-1]==2) {
			s[i-1]=-1;
			--rem, --cnt[2];
		}
	n=std::remove(s, s+n, -1)-s;
	rem=cnt[1]-cnt[0];
	for(int i=1, j=0; i<n&&j<rem; ++i)
		if(s[i-1]+s[i]==3&&(i==2*j+1||i+1==n||s[i+1]==s[i-1])) {
			s[i-1]=s[i]=-1;
			--cnt[1], --cnt[2];
			++j;
		}
	n=std::remove(s, s+n, -1)-s;
	for(int i=0; i<n; ++i) s[i]=hub[s[i]].second+'A';
	s[n]=0;
	puts(s);
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == '1') ++counter;
    if (s[1] == '1') ++counter;
    if (s[2] == '1') ++counter;
    cout << counter << endl;
}

Measured memory_bytes: 3584
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String inputStr = sc.nextLine();

		String[] inputStrArray = inputStr.split(" ");
		int[] inputIntArray = new int[inputStrArray.length];

		try {
			for (int index = 0; index < inputIntArray.length; index++) {
				inputIntArray[index] = Integer.parseInt(inputStrArray[index]);
			}

			String inequality = "";
			if (inputIntArray[0] < inputIntArray[1]) {
				inequality = " < ";
			} else if (inputIntArray[0] > inputIntArray[1]) {
				inequality = " > ";
			} else {
				inequality = " == ";
			}
			System.out.println("a" + inequality + "b");
		} catch (NumberFormatException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}

	}

}



Measured memory_bytes: 26164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 200000
#define mod1 1000000007
#define mod2 1000000009
#define mod3 998244353
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
ll MAXI = 1e12;
int main()
{
    IO
	clock_t begin = clock();
    ll n;
    cin>>n;
    double dp[n+2][n+2];
    for(ll i=0;i<=n+1;i++)
    {
    	for(ll j=0;j<=n+1;j++)
    		dp[i][j] = 0;
    }
    dp[n+1][0] = 1;
    double a[n+1];
    for(ll i=1;i<=n;i++)
    	cin>>a[i];
    for(ll i=n;i>=1;i--)
    {
    	for(ll j=0;j<=(n - i + 1);j++)
    	{
    		dp[i][j] = dp[i+1][j]*(1 - a[i]) + (j>0?(dp[i+1][j-1] * a[i]):0);
    		// cout<<dp[i][j]<<' ';
    	}
    	// cout<<endl;
    }
    // for(ll i=1;i<=n;i++)
    // {
    // 	for(ll j=1;j<=(n - i + 1);j++)
    // 		cout<<dp[i][j]<<' ';
    // 	cout<<endl;
    // }
    double ans = 0;
    for(ll i=(n/2 + 1);i<=n;i++)
    	ans += dp[1][i];
    cout<<setprecision(10)<<ans<<endl;
    // cout<<double(clock() - begin)/CLOCKS_PER_SEC<<endl;
    return 0;
}

Measured memory_bytes: 74148
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int n;
    cin>>n;
    int a=n%10;
    int b=(n%100)/10;
    int c=(n%1000)/100;
    int d=(n%10000)/1000;
    int e=(n%100000)/10000;
    int f=(n%1000000)/100000;
    int g=(n%10000000)/1000000;
    int h=(n%100000000)/10000000;
    int i=(n%1000000000)/100000000;
    int j=(n%10000000000)/1000000000;
    if(n<10){
        cout<<a<<endl;
    }
    else{
        if(n<100){
            cout<<b*11+a*2<<endl;
        }
        else{
            if(n<1000){
                cout<<c*112+b*22+a*4<<endl;
            }
            else{
                if(n<10000){
                    cout<<d*1124+c*224+b*44+a*8<<endl;
                }
                else{
                    if(n<100000){
                        cout<<e*11248+d*2248+c*448+b*88+a*16<<endl;
                    }
                    else{
                        if(n<1000000){
                            cout<<f*112496+e*22496+d*4496+c*896+b*176+a*32<<endl;
                        }
                        else{
                            if(n<10000000){
                                cout<<g*1124992+f*224992+e*44992+d*8992+c*1792+b*352+a*64<<endl;
                            }
                            else{
                                if(n<100000000){
                                    cout<<h*11249984+g*2249984+f*449984+e*89984+d*17984+c*3584+b*704+a*128<<endl;
                                }
                                else{
                                    if(n<1000000000){
                                        cout<<i*112499968+h*22499968+g*4499968+f*899968+e*179968+d*35968+c*7168+b*1408+a*256<<endl;
                                    }
                                    else{
                                        cout<<j*1124999936+i*224999936+h*44999936+g*8999936+f*1799936+e*359936+d*71936+c*14336+b*2816+a*512<<endl;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

const int MAX = 200007;
const int MOD = 1000000007;

void solve() {
    char c;
    cin >> c;
    if (c >= 'a') {cout << 'a';}
    else {cout << 'A';}
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;}
    solve();
}

Measured memory_bytes: 3608
a,b,k = map(int,input().split())
ak = a+k
bk = b-k

if a+k>=b:
  for i in range(a,b+1):
    if i<ak or i>bk:
      print(i)
else:
  for i in range(a,a+k+1):
    if i<ak or i>bk:
      print(i)
  if i<b-k:
    for n in range(b-k,b+1):
      if n<b-k or n>bk:
        print(n)
  else:
    for j in range(i+1,b+1):
      if j<ak or j>bk:
        print(j)

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

int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}

int main(void){
    // Your code here!
    int N,V[20],C,S[20],sum=0;
    scanf("%d",&N);
    for(int i = 0; i < N; i++)
    {
        scanf("%d",&V[i]);
    }
    for(int i = 0; i < N; i++)
    {
        scanf("%d",&C);
        S[i] = V[i]-C;
    }
    qsort(S,N,sizeof(int),compare_int);
    for(int i = 0; i < N && S[i] > 0; i++)
    {
        sum += S[i];
    }
    printf("%d\n",sum);
}


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

#define INF 1001001001
#define MAX 1e18

const int mod = 998244353;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  ll ans = (ll)n*(n+1)/2;
  vector<int> sa = suffix_array(s);
  for (auto x : lcp_array(s,sa)) {
    ans -= x;
  };
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 15600