akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const ll N = 3005;
int dp[N][N], n, m;
int main(){
    string s, t;
    cin >> s >> t;
    n = s.size(), m = t.size();
    s = "#" + s;
    t = "#" + t;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(s[i] == t[j]){
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }else{
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
            }
        }
    }
    string ans;
    while(n > 0 && m > 0){
        if(s[n] == t[m]){
            ans += s[n];
            n --;
            m --;
        }else{
            if(dp[n][m] == dp[n - 1][m]){
                n --;
            }else{
                m --;
            }
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}   

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
bool is_8div(int n){
  int cnt = 0;
  for(int i = 1; i <= n; ++i){
    if(n % i == 0) cnt++;
  }
  if(cnt == 8) return true;
  else return false;
}
int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 1; i <= n; ++i){
    if(i % 2 != 0){
      if(is_8div(i)) ans++;
    }
  }
  cout << ans << endl;
}

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

int main()
{
  long long a, b, x;
  cin >> a >> b >> x;
  if (a != 0){
    cout << (b / x + 1) - ((a - 1) / x + 1) << '\n';
  }
  else {
    cout << b / x + 1 << '\n';
  }
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}

debug dbg;

class AEntranceExamination {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    double t, x;
	    in >> t >> x;
	    out << fixed << setprecision(10) << t/x << endl;
	}
};


int main() {
	AEntranceExamination solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
X,K,D = map(int,input().split())

if abs(X)>=K*D:
    if X>0:
        print(abs(X-K*D))
    else:
        print(abs(X+K*D))
else:
    if X>0:
        print(abs(X-(abs(X)//D+(K-abs(X)//D)%2)*D))
    else:
        print(abs(X+(abs(X)//D+(K-abs(X)//D)%2)*D))

Measured memory_bytes: 9212
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)
a=set(a)
ans=0
for aa in a:
  t=0
  t+=c[aa-1]
  t+=c[aa]
  t+=c[aa+1]
  ans=max(ans,t)
print(ans)
  


Measured memory_bytes: 14068
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramB
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var w = int.Parse(inputs[0]);
            var h = int.Parse(inputs[1]);
            var n = int.Parse(inputs[2]);

            var left = 0;
            var right = w;
            var bottom = 0;
            var top = h;

            for (var i = 0; i < n; i++)
            {
                var inputs1 = Console.ReadLine().Split(" ");
                var x = int.Parse(inputs1[0]);
                var y = int.Parse(inputs1[1]);
                var a = int.Parse(inputs1[2]);

                switch (a)
                {
                    case 1:
                        left = Math.Max(left, x);
                        break;
                    case 2:
                        right = Math.Min(right, x);
                        break;
                    case 3:
                        bottom = Math.Max(bottom, y);
                        break;
                    case 4:
                        top = Math.Min(top, y);
                        break;
                }
            }

            var nw = right - left;
            var nh = top - bottom;
            if (nw < 0 || nh < 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                var result = Math.Max(0, nw * nh);
                Console.WriteLine(result);
            }
        }
    }
}


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

int main()
{
    int N;
    long long Y;
    cin >> N >> Y;
    rep(i, N)
    {
        rep(j, N)
        {
            int k = (Y - (i * 10000 + j * 5000));
            if (k % 1000 == 0 && (i + j + k / 1000) == N && k / 1000 >= 0)
            {
                cout << i << " " << j << " " << k / 1000 << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define int long long
#define ld long double
#define sb __builtin_popcount
#define vi vector<int>
#define vc vector<char>
#define ii pair<int, int>
#define pq priority_queue<ii, vector<ii>, greater<ii>>
#define vii vector<ii>
#define sz(a) int((a).size())
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <=n; i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define in(a, b) (b.find(a) != string::npos)
#define minin(a) *min_element(all(a))
#define maxin(a) *max_element(all(a))
#define X first
#define Y second
#define fill(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define rall(v) reverse(v.begin(), v.end())
#define el "\n"
#define mx3(a, b, c) max(max(a, b), c)
#define mn3(a, b, c) min(min(a, b), c)
#define S(v) accumulate(all(v), (ll)0)
#define SP(n) cout.precision(n)
#define PI = atan(1.0) * 4.0;
#define MOD = 1e9 + 7;
void start() {
    fio;
    SP(10);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {
    start();
    char c;
    cin>>c;
    if(c>='a' && c<='z')cout<<"a"<<el;
    else cout<<"A"<<el;
    return 0;
}


Measured memory_bytes: 3648
import copy
n = int(input())

numbers = list(map(int, input().split()))
numbers1 = copy.copy(numbers)
counter = 0
counter2 = 0
sum_in = 0
sum_in1 = 0

for i in range(len(numbers)):
    sum_in += numbers[i]
    if i % 2 == 0:
        if sum_in <= 0:
            sub = abs(sum_in) + 1
            sum_in += sub
            numbers[i] += sub
            counter += sub
    else:
        if sum_in >= 0:
            sub = abs(sum_in) + 1
            sum_in -= sub
            numbers[i] -= sub
            counter += sub

for i in range(len(numbers1)):
    sum_in1 += numbers1[i]

    if i % 2 != 0:
        if sum_in1 <= 0:
            sub = abs(sum_in1) + 1
            sum_in1 += sub
            numbers1[i] += sub
            counter2 += sub
    else:
        if sum_in1 >= 0:
            sub = abs(sum_in1) + 1
            sum_in1 -= sub
            numbers1[i] -= sub
            counter2 += sub

print(min([counter2, counter]))

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

int main(int argc, void **arg)
{
    long long n, d;
    long long x[10][10];
    long long i, j, k;
    long long cnt = 0;

    memset(x, 0, sizeof(x));

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

    for (i = 0; i < n; i++)
    {
        for (j = 0; j < d; j++)
        {
            scanf("%lld", &x[i][j]);
        }
    }

    for (i = 0; i < n - 1; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            double tmp = 0;

            for (k = 0; k < d; k++)
            {
                tmp += pow((double)(x[i][k] - x[j][k]), 2.0);
            }
            tmp = sqrt(tmp);

            if( tmp == (double)((long)tmp) ) {
                cnt++;
            }
        }
    }

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

    return 0;
}


Measured memory_bytes: 128
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
//
//		  _____       _           _        _
//		 / ____|     | |         (_)      | |
//		| (___   __ _| |__  _   _ _       | | __ _ _ __   __ _
//		 \___ \ / _` | '_ \| | | | |  _   | |/ _` | '_ \ / _` |
//		 ____) | (_| | |_) | |_| | | | |__| | (_| | | | | (_| |
//		|_____/ \__,_|_.__/ \__,_| |  \____/ \__,_|_| |_|\__,_|
//		                        _/ |
//		                       |__/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define int long long int
#define double long double
#define PI acos(-1)

void print1d(const vector<int>& vec) {for (auto val : vec) {cout << val << " ";} cout << endl;}

void print2d(const vector<vector<int>>& vec) {for (auto row : vec) {for (auto val : row) {cout << val << " ";} cout << endl;}}


void Kahn(vector<vector<int>>& adj, vector<int>& indegree, int n, vector<vector<int>>& parent){
	queue<int> q; 
	for(int i = 1; i < n + 1; i++)
		if( indegree[i] == 0 )
			q.push(i);

	vector<int> order;

	while(!q.empty()){
		int u = q.front();
		q.pop();
		order.push_back(u);// topo sort

		for(auto v: adj[u]){
			indegree[v]--;
			if(indegree[v] == 0)
				q.push(v);
		}
	}

	if((int)order.size() != n)
		cout << "NOT a DAG. Cycle is present in the graph" <<endl;
	else{
		// print1d(order);

		vector<int> dp(n + 1);
		dp[order[0]] = 0;

		for (int i = 1; i < n ; ++i){
			int node = order[i];
			dp[node] = 0;

			for(auto u: parent[node]){
				dp[node] = max(dp[node], dp[u] + 1);
			}
		}

		// print1d(dp);
		cout << *max_element(dp.begin(), dp.end()) << endl;

	}


}


signed main() {
 
	crap;
 	
 	int nodes,edges;
 	cin>>nodes>>edges;

 	vector<vector<int>> adj(nodes + 1);
 	vector<vector<int>> parent(nodes + 1);
 	vector<int> indegree(nodes + 1);

 	for(int i = 0; i < edges; i++){
 		int a,b;
 		cin>>a>>b;

 		adj[a].push_back(b);
 		parent[b].push_back(a);
 		indegree[b]++;
 	}

 	// print2d(parent);

 	Kahn(adj, indegree, nodes, parent);

	return 0;
}

Measured memory_bytes: 13688
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;

int n;
pair<long long,long long> arr[1005];

int main(){
    cin >> n;
    long long nowMinFir = 1 , nowMinSec = 1;
    arr[0].first = arr[0].second = 1;
    for(int i=1 ; i<=n ; i++){
        cin >> arr[i].first >> arr[i].second;
        long long mulFir = nowMinFir / arr[i].first;
        long long mulSec = nowMinSec / arr[i].second;
        long long mul = max(mulFir,mulSec);
        if(mul * arr[i].first < nowMinFir || mul * arr[i].second < nowMinSec)
            mul++;
        nowMinFir = mul * arr[i].first;
        nowMinSec = mul * arr[i].second;
    }
    cout << nowMinFir + nowMinSec << "\n";
}



Measured memory_bytes: 256
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n,m,s,t;
vvi edges;
double E;
signed main(){
    I(n); I(m);
    edges.resize(n);
    REP(i,m){
        I(s); I(t);
        s--; t--;
        edges[s].pb(t);
    }
    vector<double> ev(n);
    REPN(i,n-1){
        double temp = 0.0;
        for(auto ch: edges[i]) temp += ev[ch];
        ev[i] = 1.0 + temp / sz(edges[i]);
    }
    REP(i,n) cerr << ev[i] << " "; cerr <<  endl;

    E = ev[0];
    REPN(i,n-1){
        if (sz(edges[i]) == 1) continue;
        auto memoe = ev;

        double temp = 0.0;
        double maxe = 0.0;
        for(auto ch: edges[i]){
            temp += ev[ch];
            maxe = max(maxe, ev[ch]);
        }
        ev[i] = 1.0 + (temp - maxe) / (sz(edges[i]) - 1);
        // cerr << i << " " << ev[i] << endl;
        REPN(j, i){
            double temp = 0.0;
            for(auto ch: edges[j]) temp += ev[ch];
            ev[j] = 1.0 + temp / sz(edges[j]);
        }
        E = min(E, ev[0]);
        ev = memoe;
    }
    printf("%.9f\n", E);
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main() {
  int a[4][3][10];
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 10; k++)
        a[i][j][k] = 0;
  int n;
  cin >> n;
  while (n) {
    n--;
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    a[b-1][f-1][r-1] += v;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 10; k++) {
        cout << " " << a[i][j][k];
      }
      cout << endl;
    }
    if (i < 3)
    cout << "####################" << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
import heapq
N, M, init_silver = map(int, input().split())
MAX_COST = 2500
init_silver = min(init_silver, MAX_COST)

G = [[] for _ in range(N)]
for i in range(M):
    u, v, silver_cost, time_cost = map(int, input().split())
    u, v = u - 1, v - 1
    G[u].append([v, silver_cost, time_cost])
    G[v].append([u, silver_cost, time_cost])

change_rate, change_cost = [], []
for i in range(N):
    rate, cost = map(int, input().split())
    G[i].append([i, -rate, cost])
    change_rate.append(rate)
    change_cost.append(cost)


# dp[i][silver] := 頂点iにいて銀貨をsilver枚持っているような状況を作るために必要な最小時間
dp = [[float('inf')] * (MAX_COST + 1) for _ in range(N)]
dp[0][init_silver] = 0

# 優先度付きキュー: (time, node, silver)
hq = [(0, 0, init_silver)]
while hq:
    time, node, silver = heapq.heappop(hq)

    # self_loop_silver = min(silver + change_rate[node], MAX_COST)
    # self_loop_cost = time + change_cost[node]
    # if self_loop_cost < dp[node][self_loop_silver]:
    #     dp[node][self_loop_silver] = self_loop_cost
    #     heapq.heappush(hq, (time + change_cost[node], node, self_loop_silver))

    for to, silver_cost, time_cost in G[node]:
        remain_silver = min(silver - silver_cost, MAX_COST)
        if remain_silver < 0:
            continue

        dp_next_value = time + time_cost
        if dp[to][remain_silver] <= dp_next_value:
            continue

        dp[to][remain_silver] = dp_next_value
        heapq.heappush(hq, (dp_next_value, to, remain_silver))

print(*[min(d) for d in dp[1:]], sep="\n")


Measured memory_bytes: 24296
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(H,W);
    Cinii(h,w);
    cout << H*W - h*W - w*H + h*w << nn;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    const double BTC = 380000.0;
    double x, ans = 0.0;
    rep(i, n) {
        string str;
        cin >> x >> str;
        if(str == "JPY") ans += x;
        else ans += x * BTC;
    }
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }

int ans=0;
int n,m;
int visited_cnt=0;
vector<int> visited;
vector<vector<int>> G;

void dfs(int now){
  visited[now]=1;
  visited_cnt++;
  if(visited_cnt==n) ans++;
  for(int i=0; i<G[now].size(); i++){
    int next=G[now][i];
    if(visited[next]==0) dfs(next);
  }
  visited[now]=0;
  visited_cnt--;
}

int main(int argc, char const *argv[]) {
  cin >> n >> m;
  G=vector<vector<int>>(n);
  visited=vector<int>(n,0);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--,b--;
    G[a].pb(b),G[b].pb(a);
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}


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

int main() {
int64_t n,k,x,y,z,a,b,t;
  a=0;
  b=0;
  x=0;
  y=0;
  z=0;
  t=998244353;
cin>>n>>k;
vector<int64_t> vec(n+1);
vector<int64_t> sta(k);
vector<int64_t> end(k);
vec.at(0)=1;  
for(int64_t i=0;i<k;i++){
cin>>a;
cin>>b;
sta.at(i)=a;
end.at(i)=b; 
}
for(int64_t i=1;i<n+1;i++){
vector<int64_t> ska(k);
vector<int64_t> eka(k);
for(int64_t j=0;j<k;j++){
ska.at(j)=sta.at(j);
eka.at(j)=end.at(j);
} 
for(int64_t j=0;j<k;j++){
if(ska.at(j)>i){ska.at(j)=0;}
  if(eka.at(j)+1>i){eka.at(j)=0;}
}  
  for(int64_t j=0;j<k;j++){
  if(ska.at(j)!=0){x=(x+vec.at(i-ska.at(j))+t*2)%t;}
    if(eka.at(j)!=0){x=(x-vec.at(i-eka.at(j)-1)+t*2)%t;}
  }
  vec.at(i)=(x+t*2)%t;
}
 cout<<vec.at(n-1)<<endl; 
  
} 

Measured memory_bytes: 4836
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll dp[81][1000][2];// max profit by sell/buy j stocks if possibl


const ll INF = 1e9;
void solve(){
	int n;
	cin >> n;
	ll a[n];
	forn(i,0,n) cin >> a[i];
	ll ans = 1000;
	for(int i =0;i<n-1;i++){
		ll stocks = 0;
		stocks = ans/a[i];
		if(a[i]<a[i+1]) ans+= (a[i+1]-a[i])*stocks;
	}
	cout << ans << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 3632
package main
 
import (
	"fmt"
)
 
func main() {
  var c string
  fmt.Scanf("%s", &c)
  
  ans := "consonant"
  if c == "a" {
    ans = "vowel"
  }
  if c == "i" {
    ans = "vowel"
  }
  if c == "u" {
    ans = "vowel"
  }
  if c == "e" {
    ans = "vowel"
  }
  if c == "o" {
    ans = "vowel"
  }
  
  fmt.Printf("%s\n", ans)
}

Measured memory_bytes: 1832
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <climits>

using namespace std;


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

	bool frag = false;
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			if (i * j == n) frag = true;
		}
	}
	
	if (frag)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3616
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //------------------------------
    V<int>a(3);cin>>a[0]>>a[1]>>a[2];
    sort(all(a));
    cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

































Measured memory_bytes: 3124
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ret = 0;
    ret += n / 500 * 1000;
    n -= (n/500) * 500;
    ret += n / 5 * 5;
    cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

using mint = modint998244353;

const mint m10 = 10;
struct S {
    mint x;
    int sz;
    mint p;
};
struct F {
    bool valid;
    mint x;
};
S op(S l, S r) {
    if (r.sz == 0) return l;
    if (l.sz == 0) return r;
    return S{r.p * l.x + r.x, l.sz + r.sz, l.p * r.p};
}
S e() { return S{0, 0}; }
const mint m9inv = mint(1) / mint(9);
S mapping(F l, S r) { 
    if (l.valid) {
        if (r.sz == 0) return r;
        mint t = (r.p - mint(1)) * m9inv * l.x;
        return S{t, r.sz, r.p};
    } else {
        return r;
    }
}
F composition(F l, F r) {
    if (!l.valid) return r;
    else return l;
}
F id() { return F{false, 0}; }


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<S> init_vec(n);
    rep(i, n) init_vec[i] = {1, 1, 10};
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(init_vec);
    
    while(q--) {
        int l, r, d;
        cin >> l >> r >> d;
        l--;
        seg.apply(l, r, {true, d});
        cout << seg.all_prod().x.val() << endl;
    }
}

Measured memory_bytes: 13792
#include<iostream>
using namespace std;
int main(void){
    int d;
    cin>>d;
    
    if (d==22){cout<<"Christmas Eve Eve Eve"<<endl;}
    else if(d==23){cout<<"Christmas Eve Eve"<<endl;}
    else if(d==24){cout<<"Christmas Eve"<<endl;}
    else{cout<<"Christmas"<<endl;};
}

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

const int V = 100010, N = 105;
long long w[N], v[N], dp[V], totv = 0;
int n, m;

int main() {
    memset(dp, 0x7f, sizeof(dp)); dp[0] = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
    	cin >> w[i] >> v[i];
    	totv += v[i];
	}
    for (int i = 1; i <= n; i++)
    	for (int j = totv; j >= v[i]; j--) {
			dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
		}			
	for (int i = totv; i >= 0; i--)
		if (dp[i] <= m) {
			cout << i; break;
		}
    return 0;
}

Measured memory_bytes: 1024
# include "iostream"
# include "bitset"
# include "cstdio"

using namespace std;

const int maxm=2e3+10;

int N,Sum;
int A[maxm];
bitset<maxm*maxm> LH;

int main(){
	register int i;
	scanf("%d",&N);
	LH[0]=1;
	for(i=1;i<=N;i++){
		scanf("%d",A+i);
		LH|=LH<<A[i];
		Sum+=A[i];
	}
	for(i=(Sum+1)>>1;;i++){
		if(LH[i]==1){
			printf("%d",i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf =1 << 28;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

using Edge = tuple<int, int>;

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

    int n, m; cin >> n >> m;
    vi sv(m), tv(m), costs(m);

    vector<vi> min_dist(n, vi(n, inf));
    rep(i, n) min_dist[i][i] = 0;
    rep(i, m){
        int a, b, c; cin >> a >> b >> c;
        a--, b--;
        min_dist[a][b] = min_dist[b][a] = c;
        sv[i] = a, tv[i] = b, costs[i] = c;
    }

    rep(k, n){
        rep(i, n){
            rep(j, n){
                chmin(min_dist[i][j], min_dist[i][k] + min_dist[k][j]);
            }
        }
    }

    int res = m;
    rep(i, m){
        [&]{
            int a = sv[i], b = tv[i], c = costs[i];
            rep(v, n){
                rep(loop, 2){
                    if(min_dist[v][a] + c == min_dist[v][b]){
                        res--;
                        return;
                    }
                    swap(a, b);
                }
            }
        }();
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<algorithm>
#define ll long long
#define lowbit(x) x&-x
using namespace std;
int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a<b?b:a;}
int ab(int x){return x>0?x:-x;}
//int MO(int x){return x>=MOD?x-MOD:x;}
//void insert(int u,int v){tot++;e[tot].v=v;e[tot].from=first[u];first[u]=tot;}
/*------------------------------------------------------------*/
const int inf=0x3f3f3f3f,maxn=200010;

int n,A[maxn],B[maxn],cx[40][maxn],dx[maxn],ans=0;

int main(){
    n=read();
    for(int i=1;i<=n;i++)A[i]=read();
    for(int i=1;i<=n;i++)B[i]=read();
    for(int k=0;k<28;k++){
    	if(!k)for(int i=1;i<=n;i++)cx[k][i]=((1<<k)&B[i]);else
    	for(int i=1;i<=n;i++)cx[k][i]=cx[k-1][i]^((1<<k)&B[i]);
    }
    for(int k=0;k<28;k++)sort(cx[k]+1,cx[k]+n+1);//
    for(int k=1;k<=28;k++){
    	for(int i=1;i<=n;i++){
    		dx[i]^=(1<<(k-1))&A[i];
    		int x=lower_bound(cx[k-1]+1,cx[k-1]+n+1,((1<<k)-dx[i]))-cx[k-1];
    		//if(x!=n+1)printf("k=%d i=%d x=%d\n",k,i,n-x+1);
    		ans^=(((n-x+1)%2)<<k);
    	}
    }
    //printf("%d\n",ans);
    int a,b,c,d;
    for(int k=0;k<=28;k++){
    	a=b=c=d=0;
    	for(int i=1;i<=n;i++)if((1<<k)&A[i])b++;else a++;
    	for(int i=1;i<=n;i++)if((1<<k)&B[i])d++;else c++;
    	//printf("k=%d a=%d b=%d c=%d d=%d %lld\n",k,a,b,c,d,((1ll*a*d%2+1ll*b*c%2)%2));
    	ans^=(((1ll*a*d%2+1ll*b*c%2)%2)<<k);
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 27648
import java.io.*
import java.util.*

fun solve(N: Long, M: Long){
    // cが少ない or cが多い
    val ans = if(N >= M/2) M/2 else N + (M-2*N)/4
    println(ans)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    val M = sc.next().toLong()
    solve(N, M)
}



Measured memory_bytes: 31396
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
double dist(ll x1,ll y1, ll x2,ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n, k;
	cin >> n >> k;
	vector<ll> arr(n + 1, 0);
	f(i, 1, n + 1)
	{
		cin >> arr[i];
	}
	ll cycle = 1;
	ll pt = 1;
	vector<ll> route;
	vector<bool> visited(n+1, false);
	while (visited[pt]==false)
	{
		visited[pt] = true;
		cycle += 1;
		route.push_back(pt);
		pt = arr[pt];
	}
	ll init = 0;
	f(i, 0, route.size())
	{
		if (route[i] == pt)
		{
			cycle = route.size() - i;
			init = i;
		}
	}
	if (k < init)
	{
		cout << route[k];
		return 0;
	}
	else
	{
		k -= init;
		k %= cycle;
		pt = route[init];
		while (k > 0)
		{
			k -= 1;
			pt = route[++init];
		}
		cout << pt;
	}
	return 0;
}


Measured memory_bytes: 6864
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;


namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       
         public static long GCM(long x,long y)
        {
            if (x < y)  GCM(y, x);


            while (y > 0)
            {
                var z = y;
                y = x % y;
                x = z;
            }
            
            return x;
        }

        



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var kab = Reads();
            var k = kab[0];
            var a = kab[1];
            var b = kab[2];
            if (b - a >= 2)
                WriteLine((k-a+1) % 2 == 0 ? a+(b - a) * (k-a+1) / 2 : a+(b - a) * ((k - a + 1) / 2) + 1);
            else
                WriteLine(1 + k);



            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 201001;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    int s = 0;
    for (int d = 1; d <= n; d++) {
        if (d % 3 != 0 && d % 5 != 0) {
            s += d;
        }
    }
    cout << s;
}


Measured memory_bytes: 3648
a = input().split(" ")
cnt=0
for i in range(int(a[0])):
 b = input().split(" ")
 if((int(b[0])*int(b[0])) + (int(b[1])*int(b[1])) <= int(a[1])*int(a[1])):
   cnt = cnt+1
print(cnt)

Measured memory_bytes: 69832
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;

int main() {
	int a1, a2, a3;
	cin >> a1 >> a2 >> a3;
	if (a1+a2+a3 >= 22)
		cout << "bust" << endl;
	else
		cout << "win" << endl;
}


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

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            long a = Long.parseLong(in.next());
            int k = digit(a);
            int c = (int) (a / Math.pow(10, k - 1));
            long tmp = (long) ((c + 1) * Math.pow(10, k - 1));
            int ans = (c - 1) + 9 * (k - 1);
            if (tmp - 1 <= a) {
                ans = c + 9 * (k - 1);
            }
            out.println(ans);
        }

        int digit(long n) {
            int res = 0;
            while (n > 0) {
                n /= 10;
                res++;
            }
            return res;
        }

    }
}



Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
const int MAX_N = 1e5 + 10;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q; cin >> n >> q;
    priority_queue<pair<int, int>> result;
    vector<int> cnt(n + 1, 0);
    vector<pair<int, int>> ans;
    for(int i = 0; i < q; i++)
    {
        int a, v; cin >> a >> v;
        cnt[a] += v;
        result.push(make_pair(cnt[a], -a));
        while(not result.empty())
        {
            pair<int, int> p = result.top();
            if(p.first == cnt[-p.second])
            {
                ans.push_back(make_pair(-p.second, p.first));
                break;
            }
            result.pop();
        }
    }
    for(int i = 0; i < ans.size(); i++) cout << ans[i].first << " " << ans[i].second << endl;
    return 0;
}




Measured memory_bytes: 8392
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a[] = new int[n];
        for (int i=0;i<n;i++){
            a[i] = in.nextInt();
        }
        int ans[] = new int[n+1];
        ans[a[0]]=1;
        for(int i=0;i<n;i++){
            ans[a[i]]=ans[a[i]-1]+1;
        }
        int max = 0;
        for(int i=1;i<=n;i++){
            if (ans[i]>max){
                max = ans[i];
            }
        }
        System.out.println(n-max);
    }
}


Measured memory_bytes: 87532
#include <bits/stdc++.h>
typedef long long int ll;
#define MOD 1000000007
#define MAXN 200001
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
using namespace std;

int main() {
    ll r;
    cin >> r;
    long double pi=3.141592653589793238;
    long double cir=2*pi*r;
    cout << fixed <<setprecision(10)<<cir;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr,0,sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t  main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int a, b, m;
        cin >> a >> b >> m;
        int mn1 = INF, mn2 = INF;
        int ref[a];
        for(int i = 0; i < a; i++){
            cin >> ref[i];
            mn1 = min(mn1, ref[i]);
        }
        int mic[b];
        for(int i = 0; i < b; i++){
            cin >> mic[i];
            mn2 = min(mn2, mic[i]);
        }
        int ans = INF;
        while(m--){
            int x, y, c;
            cin >> x >> y >> c;
            ans = min(ans, ref[x - 1] + mic[y - 1] - c);
        }
        ans = min(ans, mn1 + mn2);
        cout << max(0LL, ans) << '\n';
    } 
}

Measured memory_bytes: 33152
import numpy as np
h, n = map(int,input().split())
a = np.zeros(n,dtype=int)
b = np.zeros(n,dtype=int)
for i in range(n):
    ai ,bi = map(int,input().split())
    a[i] = ai
    b[i] = bi

mh = np.zeros(10001,dtype=int)
for i in range(1,h+1):
    mh[i] = (mh[i-a]+b).min()

print(mh[h])


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

int main(void) {
    int a, b;
    int d, r;
    double f;
    
    cin >> a >> b;
    
    d = a / b;
    r = a % b;
    f = (double)a / b;
    
    printf("%d %d %.6lf", d, r, f);
    cout << endl;
    return 0;
}



Measured memory_bytes: 3236
N = int(input())

x = [0] * (55555 + 10)
ans = []
for i in range(2, 55556):
    if x[i] == 0:
        t = i
        while t < 55556:
            x[t] = 1
            t += i
        if i % 5 == 1:
            ans.append(i)
            if len(ans) == N:
                break
print(*ans)


Measured memory_bytes: 3444
N=int(input())
count = 0
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()　#小さい順位欲しいとき
    return divisors
for i in range(1,N+1):
    if len(make_divisors(i))==8 and i%2==1:
        count += 1
print(count)
    

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

int main( void )
{
    ll n;
    cin >> n;
    
    ll a[n];
    for ( ll i = 0; i < n; i++ )
        cin >> a[i];
    
    ll ans = 0,crush = 1;
    
    for ( ll i = 0; i < n; i++ )
    {
        if ( a[i] == crush )
            crush++;
        else
            ans++;
    }
    
    if ( ans == n )
        ans = -1;
        
        cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
ll dp2[300000][60]={};
int main() {
	int n,m;
	cin>>n>>m;
	if(n>=m){
		rep(i,n)printf("%d",m);
	}
	if(n<m){
		rep(i,m)printf("%d",n);
	}
	return 0;
}


Measured memory_bytes: 3968
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int N,sa = 0;
    ArrayList<Integer> L = new ArrayList<Integer>();
    N = s.nextInt();
    for(int i = 0; i < N ;i++){
      L.add(s.nextInt());
    }
    Collections.sort(L);
    sa = L.get(N - 1) - L.get(0);
    System.out.printf("%d",sa);
  }
}

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

int main()
{
    int n;
    int order1, value;
    list<int> l;
    list<int>::iterator itr = l.end();

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> order1;

        switch( order1 )
        {
            case 0:
                cin >> value;
                itr = l.insert( itr, value );           //insertは挿入した値を指すようになる。
                break;
            case 1:
                cin >> value;
                if( value >= 0 )
                    for( int i = 0; i < value; i++ )
                        itr++;
                else
                    for( int i = value; i < 0; i++ )
                        itr--;
                break;
            case 2:
                itr = l.erase( itr );                   //eraseは削除した要素の次の要素を指すようになるから、itrに入れておく
                break;
        }   
    }

    for( list<int>::iterator i = l.begin(); i != l.end(); i++ )
        cout << *i << endl;
    
    return 0;
}


Measured memory_bytes: 18596
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#define IN1
#define OUT1
template<typename T>void scan(T &x)
{
    char ch;
    bool f=0;
    x=0;
    ch=getchar();
    while(!isdigit(ch)&&ch!='-')
        ch=getchar();
    if(ch=='-') f=1,ch=getchar();
    while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    if(f==1) x=-x;
}
int n;
int main()
{
    #ifdef IN
    	freopen("A.in","r",stdin);
    	#ifdef OUT
    	    freopen("A.out","w",stdout);
    	#endif
    #endif
    scan(n);
    if(n==25) printf("Christmas\n");
    else if(n==24) printf("Christmas Eve\n");
    else if(n==23) printf("Christmas Eve Eve\n");
    else if(n==22) printf("Christmas Eve Eve Eve\n");
    return 0;
}

Measured memory_bytes: 256