akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <limits>

int64_t getMinValue(const int64_t a_value, const int64_t b_value, const int64_t c_value,
                    const int64_t a_required_num, const int64_t b_required_num) {
  int64_t total_min = std::numeric_limits<int64_t>::max();
  for (int64_t c_num = 0; c_num <= std::max(a_required_num, b_required_num) * 2; c_num += 2) {
    const int64_t a_num = std::max(0L, a_required_num - c_num / 2);
    const int64_t b_num = std::max(0L, b_required_num - c_num / 2);
    total_min = std::min(total_min, 
      a_num * a_value + b_num * b_value + c_num * c_value
    );
  }
  return total_min;
}

int main() {
  int a, b, c, x, y;
  std::cin >> a >> b >> c >> x >> y;
  std::cout << getMinValue(a, b, c, x, y) << std::endl;
  return 0;
}

Measured memory_bytes: 256
# -*- Coding: utf-8 -*-
a, b, c = map(int, input().split())
num_list = [a, b, c]

seven_cnt = 0
five_cnt = 0
for n in num_list:
  if n == 7:
    seven_cnt += 1
  elif n == 5:
    five_cnt += 1
if seven_cnt == 1 and five_cnt == 2:
  print('YES')
else:
  print('NO')
    
  

Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{

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

    lli ans = -inf;
    for(int l = 0; l <= n; l ++) {
        for(int r = 0; l + r <= n; r ++) {
            lli rem = k - l - r;
            if(rem < 0) {
                continue ;
            }
            vector<lli> v;
            for(int i = 0; i < l; i ++) {
                v.push_back(a[i]);
            }
            for(int i = 0; i < r; i ++) {
                v.push_back(a[n - 1 - i]);
            }
            sort(v.rbegin(), v.rend());
            while(v.size() and rem and v.back() < 0) {
                rem --;
                v.pop_back();
            }
            lli t = accumulate(v.begin(), v.end(), 0);
            ans = max(ans, t);
        }
    }

    cout<<ans;

    cout<<"\n";
    return ;
}

/*
*/

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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


Measured memory_bytes: 256
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.PrintWriter;

@SuppressWarnings("unchecked")
public class Main {
    static boolean f(String s, int tmp, char[] a) {
        int start = tmp - a.length;
        int end = tmp;

        boolean flg = true;

        int idx = 0;

        for (int i = start; i < end; i++) {
            if (start < 0) break;
            if (s.charAt(i) != a[idx]) {
                flg = false;
                break;
            }
            idx++;
        }

        return flg;
    }

    public static void main(String[] args) throws IOException {
        final String YES = "YES";
        final String NO = "NO";

        final char dream[] = {'d','r','e','a','m'};
        final char dreamer[] = {'d','r','e','a','m','e','r'};
        final char erase[] = {'e', 'r', 'a', 's', 'e'};
        final char eraser[] = {'e','r','a','s','e','r'};

        String s;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            s = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        boolean flg = false;

        int tmp = s.length();

        while (0 < tmp) {
            boolean result = false;

            flg = f(s, tmp, dream);
            result = result | flg;
            if (flg) {
                tmp -= dream.length;
                if (tmp == 0) break;
            }

            flg = f(s, tmp, dreamer);
            result = result | flg;
            if (flg) {
                tmp -= dreamer.length;
                if (tmp == 0) break;
            }

            flg = f(s, tmp, erase);
            result = result | flg;
            if (flg) {
                tmp -= erase.length;
                if (tmp == 0) break;
            }

            flg = f(s, tmp, eraser);
            result = result | flg;
            if (flg) {
                tmp -= eraser.length;
                if (tmp == 0) break;
            }

            if (!result) break;
        }

        out.println(flg ? YES : NO);

        out.flush();
    }
}


Measured memory_bytes: 25172
//OM
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <sstream>
#include <algorithm>
using  namespace  std;

#define  u first
#define  w second
#define  pb push_back
#define  mp make_pair
#define  PI (acos(-1.0))
#define  mem(a,b) memset(a,b,sizeof(a))
#define  Sort(x) sort(x.begin(),x.end())
#define  FOR(i, b, e) for(int i = b; i <= (int)(e); i++)
#define  FORR(i, b, e) for(int i = b; i >=(int)(e); i--)
#define  FORI(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define  pr(x) cout<<x<<"\n"
#define  prs(x) cout<<x<<" "
#define  pr2(x,y) cout<<x<<" "<<y<<"\n"
#define  pr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define  ppr(a) cout<<a.x<<" "<<a.y<<"\n"
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

typedef  long long ll;
typedef  pair <int, int> pii;
typedef  pair <double, double> pdd;
typedef  vector <int> vi;
typedef  vector <pii> vpii;


//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};
//int dy[]={0,1,1,1,0,-1,-1,-1};//8 Direction

#define  EPS 1e-9
#define  MAX 100007
#define  MOD 1000000007

vector<int> edge[MAX],cost[MAX];
int d[MAX],par[MAX];


void dijkstra(int s)
{
    memset(par,-1,sizeof(par));
    memset(d,63,sizeof(d));
    d[s]=0;
    priority_queue<pii,vector<pii>,greater<pii > >Q;
    Q.push(mp(s,0));
    while(!Q.empty())
    {
        pii top=Q.top();
        Q.pop();
        int u=top.u;
        for(int i=0; i<(int)edge[u].size(); ++i)
        {
            int v=edge[u][i];
            if(d[v]>d[u]+cost[u][i])
            {
                d[v]=d[u]+cost[u][i];
                par[v]=u;
                Q.push(mp(v,d[v]));
            }
        }
    }
}
int main()
{
    int n,e,s,i,n1,n2,w;
    int H,W;
    scanf("%d%d",&H,&W);
    FOR(i,0,9)
    {
        FOR(j,0,9)
        {
            n1=i,n2=j;
            scanf("%d",&w);
            edge[n2].push_back(n1);
            cost[n2].push_back(w);
        }
    }
    dijkstra(1);
    ll res=0;
    FOR(i,1,H){
        FOR(j,1,W){
            scanf("%d",&w);
            if(w!=-1){
                res+=d[w];
            }
        }
    }
    pr(res);
    return 0;
}



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

int dp[1001][1001];
int v[1001], w[1001];

int main(){
	int W;

	int k = 1;
	while (std::cin >> W, W){
		int n;

		std::cin >> n;
		char a;
		for (int i = 0; i < n; i++)std::cin >> v[i] >> a >> w[i];

		memset(dp, -1, sizeof(dp));

		dp[1][0] = 0;
		dp[1][w[0]] = v[0];
		for (int i = 1; i < n; i++){
			for (int j = 0; j <= W; j++){

				if (dp[i][j] != -1){
					dp[i + 1][j] = std::max(dp[i + 1][j], dp[i][j]);
					if (j + w[i] <= W)dp[i + 1][j + w[i]] = std::max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
				}
			}
		}

		int max = 0, id = 0;
		for (int i = 1; i <= W; i++){
			if (max < dp[n][i])max = dp[n][i], id = i;
		}
		std::cout << "Case " << k << ":" << std::endl << max << std::endl << id << std::endl;

		k++;
	}

	return 0;
}

Measured memory_bytes: 5088
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n,d;
    cin >> n >> d;
    vector<int> x[n];
    rep(i,n){
        rep(_,d){
            int t;
            cin >> t;
            x[i].push_back(t);
        }
    }
    int ans = 0;
    rep(j,n)rep(i,j){
        int sum = 0;
        rep(k,d){
            sum += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
        }
        for(int k=1;k*k<=sum;k++){
            if(k*k==sum)ans++;
        }
    }
    cout << ans << endl;
}

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

const int MOD = 1e9 + 7;

int main() {
    int H, W, K; cin >> H >> W >> K;
    if (W == 1) {
        cout << 1 << endl;
        return 0;
    }
    vector<vector<ll>> itok(W+1, vector<ll>(W+1, 0));
    for (int i = 1; i <= W; i++) {
        vector<vector<ll>> path(W+1, vector<ll>(2, 0));
        path[i-1][0] = 1; path[i-1][1] = 0;
        path[i][0] = 1; path[i][1] = 0;
        for (int j = i-2; 1 <= j; j--) {
            path[j][0] = path[j+1][0] + path[j+1][1];
            path[j][1] = path[j+1][0];
        }
        ll l = path[1][0] + path[1][1];
        for (int j = i+1; j < W; j++) {
            path[j][0] = path[j-1][0] + path[j-1][1];
            path[j][1] = path[j-1][0];
        }
        ll r = path[W-1][0] + path[W-1][1];
        itok[i][i] = l * r;
    }
    for (int i = 1; i < W; i++) {
        vector<vector<ll>> path(W+1, vector<ll>(2, 0));
        path[i][0] = 0; path[i][1] = 1;
        for (int j = i-1; 1 <= j; j--) {
            path[j][0] = path[j+1][0] + path[j+1][1];
            path[j][1] = path[j+1][0];
        }
        ll l = path[1][0] + path[1][1];
        for (int j = i+1; j < W; j++) {
            path[j][0] = path[j-1][0] + path[j-1][1];
            path[j][1] = path[j-1][0];
        }
        ll r = path[W-1][0] + path[W-1][1];
        itok[i][i+1] = l * r;
        itok[i+1][i] = l * r;
    }
    vector<vector<ll>> ans(H, vector<ll>(W+1, 0));
    ans[0][1] = itok[1][1]; ans[0][2] = itok[1][2];
    for (int i = 1; i < H; i++) {
        for (int j = 1; j <= W; j++) {
            if (j == 1) {
                ans[i][j] = (ans[i-1][j] * itok[j][j] + ans[i-1][j+1] * itok[j+1][j]) % MOD;
            } else if (j == W) {
                ans[i][j] = (ans[i-1][j-1] * itok[j-1][j] + ans[i-1][j] * itok[j][j]) % MOD;
            } else {
                ans[i][j] = (ans[i-1][j-1] * itok[j-1][j] + ans[i-1][j] * itok[j][j] + ans[i-1][j+1] * itok[j+1][j]) % MOD;
            }
        }
    }
    cout << ans [H-1][K] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define DEF_ELM_MAX 20001
char pStr[DEF_ELM_MAX];
 
typedef struct _PAIR {
    int indx;
    int diff;
} PAIR;
 
int S1[DEF_ELM_MAX];
PAIR S2[DEF_ELM_MAX];
 
int s1_top = 0;
 
int s1_pop()
{
    return S1[--s1_top];
}
 
void s1_push(int x)
{
    S1[s1_top++] = x;
}
 
int s2_top = 0;
 
PAIR s2_Top()
{
    return S2[s2_top-1];
}
 
PAIR s2_pop()
{
    return S2[--s2_top];
}
 
void s2_push(int indx, int diff)
{
    PAIR x;
    x.indx = indx;
    x.diff = diff;
 
    S2[s2_top++] = x;
}
 
/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void)
{
    int j;
    int i;
    int sum;
    int a;
    char c;
 //
    scanf("%s", pStr);
 
    sum = 0;
    i = 0;
    while ( (c = pStr[i]) != 0 ) {
        if ( c == '\\' ) {
            s1_push(i);
        } else if ( s1_top > 0 && c == '/') {
            j = s1_pop();
            a = i - j;
            sum += a;
            while ( s2_top > 0 && s2_Top().indx > j) {
                a += s2_pop().diff;
            }
            s2_push(j, a);
        }
        i++;
    }
 
    printf("%d\n", sum);
    printf("%d", s2_top);
    for ( i = 0 ; i < s2_top; i++ ) {
        printf(" ");
        printf("%d", S2[i].diff);   
    }
    printf("\n");   
 
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    vector<int> v(5);
    for(int i=0;i<5;i++){
        cin>>v[i];
    }
    int pos=-1,mm=10;
    for(int i=0;i<5;i++){
        if(v[i]%10!=0 && v[i]%10<mm){
            mm=v[i]%10;
            pos=i;
        }
    }
    int ans=0;
    for(int i=0;i<5;i++){
        if(i==pos || v[i]%10==0) ans+=v[i];
        else ans+=(v[i]+10-v[i]%10);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int64 A, B, K;
    cin >> A >> B >> K;
    int64 c = min(A, K);
    A -= c;
    K -= c;
    B -= K;
    if(B < 0) B = 0;
    cout << A << " " << B << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<deque>
using namespace std;
typedef long long ll;
int main()
{
	ll num;
	scanf("%lld", &num);
	num++;
	deque<int>v1, v2;
	vector<int>v;
	for (;;)
	{
		if (num == 1)break;
		v.push_back(num % 2);
		num /= 2;
	}
	int pt = 1;
	for (int i = int(v.size()) - 1; i >= 0; i--)
	{
		v1.push_back(pt);
		v2.push_back(pt);
		pt++;
		if (v[i])v1.push_back(pt), v2.push_front(pt), pt++;
	}
	printf("%d\n", v1.size() + v2.size());
	for (int i = 0; i < v1.size(); i++)printf("%d ", v1[i]);
	for (int i = 0; i < v2.size(); i++)printf("%d ", v2[i]);
	printf("\n");
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<functional> 
using namespace std;
const int M = 1e5 + 50;
struct node{
	int day,rwd;
}p[M];
bool cmp(struct node a,struct node b){
	if(a.day != b.day)return a.day < b.day;
	return a.rwd > b.rwd;
} 
int main(){
	int n,m;
	cin>>n>>m;
	for(int i = 0 ; i < n; i++){
		cin>>p[i].day>>p[i].rwd;
	}
	sort(p,p+n,cmp);
	priority_queue<int> q;
	int id = 0;
	long long ans = 0;
	for(int i = 0; i < m; i++){
		while(id<n && p[id].day<=i+1){
			q.push(p[id++].rwd);
		}
		if(!q.empty()){
			ans+=q.top();
			q.pop();
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
int n;
int main() {
	scanf("%d",&n);
	while(n--) {
		int a;
		scanf("%d",&a);
		if(a%2==0&&(a%3&&a%5)) {
			printf("DENIED\n");
			return 0;
		}
	}
	printf("APPROVED\n");
	return 0;
}

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

#define MAX 100000

vector<int> G[MAX];
int N;
bool visited[MAX];
int prenum[MAX], parent[MAX], lowest[MAX], timer;

void dfs( int current, int prev ) {
    
    prenum[current] = lowest[current] = timer;
    timer++;
    
    visited[current] = true;
    
    int next;
    
    for ( int i = 0; i < G[current].size(); i++ ) {
        
        next = G[current][i];
        
        if ( !visited[next] ) {
            
            parent[next] = current;
            
            dfs( next, current );
            
            lowest [current] = min( lowest[current], lowest[next] );
            
        } else if ( next != prev ) {
            
            lowest[current] = min( lowest [current], prenum[next] );
            
        }
    
    }

}


void art_points() {
    
    for ( int i= 0; i<N; i++ ) {
        
        visited[i] = false;
        
    }
    
    timer = 1;
    
    dfs(0, -1);
    
    set<int> ap;
    int np = 0;
    for( int i= 1; i< N; i++ ) {
        
        int p = parent[i];
        if ( p==0 ) {
            
            np++;
            
        } else if ( prenum[p] <= lowest[i] ) {
            
            ap.insert(p);
            
        }
    
    }
    
    if ( np > 1 ) {
        
        ap.insert(0);
        
    }
    
    for ( set<int>::iterator it = ap.begin(); it != ap.end(); it++ ) {
        
        cout << *it << endl;
        
    }
    
}

int main() {
    
    int m;
    cin >> N >>m;
    
    for( int i= 0; i<m; i++ ) {
        
        int s, t;
        cin >> s >> t;
        
        G[s].push_back(t);
        G[t].push_back(s);
        
    }
    
    art_points();
    
    return 0;
}



Measured memory_bytes: 6880
n=int(input())
dis=[]
for i in range(n):
  dis.append(list(map(int,input().split())))
import itertools
#print(dis)
l=[i for i in range(1,n+1)]

#for v in itertools.permutations(l,n):
#  print(v)
import math
p_list=itertools.permutations(l,n)
ans_l=[]
for mytuple in p_list:
  #print(mytuple)
  distance=0
  for k in range(1,n):
    now=mytuple[k]
    #print(now)
    bef=mytuple[k-1]
    #print(bef)
    distance+=math.sqrt((dis[now-1][0]-dis[bef-1][0])**2+(dis[now-1][1]-dis[bef-1][1])**2)
  #print(distance)
  ans_l.append(distance)
ans=sum(ans_l)/len(ans_l)
print("{:.11f}".format(ans)) 

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

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

    if(a >= k) cout << a - k << ' ' << b << endl;
    else if(a < k && a + b > k) cout << 0 << ' ' << a + b - k << endl;
    else cout << "0 0" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
template <class T1, class T2>void print(T1 a[], T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " ";} cout << endl;}
template <class T1, class T2>void print(vector<T1> a, T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " "; } cout << endl;}
ll modexpo(ll a, ll b, ll m) {if (b == 0) {return 1;} else if (a == 1) {return 1;} if (b % 2 == 0) {ll t = modexpo(a, b / 2, m); t = (t * t) % m; return t;} else {ll t = modexpo(a, b / 2, m); t = (t * t) % m; t = (t * a) % m; return t;}}



int main() {


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



	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	if (n == 1) {
		cout << 0;
		return 0;
	}
	int dp[n];

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

Measured memory_bytes: 1024
#include<stdio.h>



using lint = long long;
int main() {
	lint N;
	scanf("%lld", &N);
	for (lint h = 1; h <= 3500; h++) {
		for (lint n = 1; n <= 3500; n++) {
			lint p = 4 * h*n;
			lint q = N*n;
			lint r = N*h;
			lint s = p - q - r;
			if (s > 0 && (N*h*n) % s == 0) {
				printf("%lld %lld %lld",h,n, N*h*n / s);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        String result_a = null;
        String result_b = null;

        while (true) {
            String s = scan.next();

            if (s.equals("-")) {
                break;
            }

            int m = scan.nextInt();

            for (int i = 0; i < m; i++) {
                int h = scan.nextInt();
                result_a = s.substring(0,h);
                result_b = s.substring(h);

                s = result_b + result_a;


            }

            System.out.println(s);
        }

    }
}


Measured memory_bytes: 26484
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let kq: Vec<usize> = read_vec();
    let k = kq[0];
    let q = kq[1];
    let d: Vec<u64> = read_vec();
    let nxmv: Vec<Vec<u64>> = read_vec2(q);
    for i in 0..q {
        let n = nxmv[i][0];
        let m = nxmv[i][2];
        let mut x = nxmv[i][1] % m;
        let mut diffs = vec![];
        for j in 0..k {
            diffs.push(d[j] % m);
        }
        let mut c0 = 0;
        for j in 0..k {
            if (j as u64) < (n - 1) % k as u64 {
                let cnt = (n - 1) / (k as u64) + 1;
                if diffs[j] == 0 {
                    c0 += cnt;
                } else {
                    x += diffs[j] * ((n - 1) / (k as u64) + 1);
                }
            } else {
                let cnt = (n - 1) / (k as u64);
                if diffs[j] == 0 {
                    c0 += cnt;
                } else {
                    x += diffs[j] * ((n - 1) / (k as u64));
                }
            }
        }
        println!("{}", n - 1 - c0 - x / m);
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<algorithm>
#include<iostream>
#define N 200005
using namespace std;
int n,q,m;
long long Q,V[N],ans[N],a[N];
void CL(long long x,long long v)
{
	int P;
	P=lower_bound(a+1,a+m+1,x)-a-1;
	if (x<=a[1])
	{
		ans[1]+=v;
		ans[x+1]-=v;
		return;
	}
	V[P]+=v*(x/a[P]);
	CL(x%a[P],v);
}
int main()
{
	scanf("%d%d",&n,&q);
	m++;
	a[m]=n;
	for (int i=1;i<=q;i++)
	{
		scanf("%lld",&Q);
		while (Q<=a[m])
			m--;
		a[++m]=Q;
	}
	V[m]=1;
	for (int i=m;i>1;i--)
	{
		V[i-1]+=V[i]*(a[i]/a[i-1]);
		CL(a[i]%a[i-1],V[i]);
	}
	ans[0]=0;
	ans[1]+=V[1];
	ans[a[1]+1]-=V[1];
	for (int i=1;i<=n;i++)
	{
		ans[i]+=ans[i-1];
		printf("%lld\n",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 6164
#include <iostream>
using namespace std;
int arr[55];
int main()
{
	int n,b=1;
	scanf("%d",&n);
	bool neg=0;
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&arr[i]);
		if (abs(arr[i])>=abs(arr[b]))
		{
			b=i;
			neg=(arr[i]<0);
		}
	}
	printf("%d\n",2*n-1);
	for (int i=1;i<=n;i++)
	printf("%d %d\n",b,i);
	if (neg)
	{
		for (int i=n-1;i>0;i--)
		printf("%d %d\n",i+1,i);
	}
	else
	{
		for (int i=1;i<n;i++)
		printf("%d %d\n",i,i+1);
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>
#include <sstream>
#include <bitset>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
#define MOD ((int)1e9+7)
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

struct Combination {
	const int num=51e4;			//要素数
	const int mod=1e9+7;
	vector<ll> fact,inv,finv; //階乗,逆元,逆元の階乗.
	
	Combination():fact(num),inv(num),finv(num){
		fact[0]=fact[1]=1;
		inv[1]=1;
		finv[0]=finv[1]=1;
		for(int i=2;i<num;++i){
			fact[i]=fact[i-1]*i%mod;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	
	int nCk(int n,int k){
		if(n<k) return 0;
		if(n<0 or k<0) return 0;
		return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
	}
	int big_nCk(int n,int k){ //nが大きいとき
		ll res=1LL;
		for (int i = 0; i < k; i++) {
			res=res*(n-i)%mod;
		}
		res = res*finv[k]%mod;
		return res;
	}
	int nHk(int n,int k){return nCk(n+k-1,n-1);}//重複組み合わせ.
};

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

ll pow_mod(ll n, ll k, ll p) { // n^k(mod p)
	if (k == 0) {
		return 1;
	}
	ll res = pow_mod(n * n % p, k / 2, p);
	if (k & 1) {
		res = res * n % p;
	}
	return res;
}

bool vector_finder(std::vector<int> vec, int number) { // vector 内にnumberがあるかどうか
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance( vec.begin(), itr );
	if (index != vec.size()) { // 発見できたとき
		return true;
	}
	else { // 発見できなかったとき
		return false;
	}
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a * b % 2 == 0) {
		return cout << "Even\n", 0;
	} else {
		return cout << "Odd\n", 0;
	}
}

Measured memory_bytes: 3632
n = int(input())

num_list = [ int(v) for v in input().split() ]
min_num, max_num = min(num_list), max(num_list)
sum_num = sum(num_list)
square_sum_num = sum([ v**2 for v in num_list ])


ans = square_sum_num

for i in range(min_num,max_num+1):
	ans = min(ans, square_sum_num-2*i*sum_num+n*i**2)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M){
  if(N==M)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  solve(N, M);
  return 0;
}


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

using namespace std;
int main()
{
	string str;
	getline(cin, str);

	int n = stoi(str);

	vector<int> even;
	vector<int> odd;
	getline(cin, str);
	istringstream iss(str);

	for (int i = 0; i < n; i++) {
		iss >> str;
		int s = stoi(str);
		if (i % 2 == 1) {
			even.push_back(s);
		}
		else {
			odd.push_back(s);
		}
	}
	sort(even.begin(), even.end());
	sort(odd.begin(), odd.end());

	vector<int> even_cnt;
	vector<int> odd_cnt;
	int even_size = even.size();
	int odd_size = odd.size();
	int m = odd[0];
	int cnt = 0;

	int odd_max_val= 0;
	int odd_max_cnt= 0;

	for (int i = 0; i < odd_size; i++) {
		if (m == odd[i]) {
			cnt++;
		}
		else {
			if (cnt > odd_max_cnt) {
				odd_max_cnt = cnt;
				odd_max_val = m;
			}
			m = odd[i];
			odd_cnt.push_back(cnt);
			cnt = 1;
		}
		if (i == odd_size - 1) {
			if (cnt > odd_max_cnt) {
				odd_max_cnt = cnt;
				odd_max_val = m;
			}
			odd_cnt.push_back(cnt);
		}
	}
	m = even[0];
	cnt = 0;

	int even_max_val = 0;
	int even_max_cnt = 0;
	for (int i = 0; i < even_size; i++) {
		if (m == even[i]) {
			cnt++;
		}
		else {
			if (cnt > even_max_cnt) {
				even_max_cnt = cnt;
				even_max_val = m;
			}
			m = even[i];
			even_cnt.push_back(cnt);
			cnt = 1;
		}
		if (i == even_size - 1) {
			if (cnt > even_max_cnt) {
				even_max_cnt = cnt;
				even_max_val = m;
			}
			even_cnt.push_back(cnt);
		}
	}
	sort(odd_cnt.begin(), odd_cnt.end());
	sort(even_cnt.begin(), even_cnt.end());
	int odd_change;
	int even_change;

	int change;

	if (odd_max_val != even_max_val) {
		odd_change = odd_cnt.size() == 1 ? 0 : odd_size - odd_cnt[odd_cnt.size() - 1];
		even_change = even_cnt.size() == 1 ? 0 : even_size - even_cnt[even_cnt.size() - 1];
		change = odd_change + even_change;
	}
	else {
		// change odd
		int odd_change1 = odd_cnt.size() == 1 ? odd_cnt[0] : odd_size - odd_cnt[odd_cnt.size() - 2];
		int even_change1 = even_cnt.size() == 1 ? 0 : even_size - even_cnt[even_cnt.size() - 1];

		int odd_change2 = odd_cnt.size() == 1 ? 0 : odd_size - odd_cnt[odd_cnt.size() - 1];
		int even_change2 = even_cnt.size() == 1 ? even_cnt[0] : even_size - even_cnt[even_cnt.size() - 2];

		change = odd_change1 + even_change1 < odd_change2 + even_change2 ? odd_change1 + even_change1 : odd_change2 + even_change2;



	}




	cout << change << endl;
	return 0;

}

Measured memory_bytes: 2564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF=1e9+7;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	double A,B,H,M,rH,rM,Ax,Ay,Bx,By,e=1e-20;
	cin >> A >> B >> H >> M;
	H += e;
	M += e;

	rM = M*M_PI/30;
	rH = H*M_PI/6 + M*M_PI/360;

	// cout << (M/60)*360 << " " << (H/12)*360 << endl;

	Ax = cos(rH+e)*A;
	Ay = sin(rH+e)*A;
	Bx = cos(rM+e)*B;
	By = sin(rM+e)*B;

	// cout << Ax << " " << Ay << endl;
	// cout << Bx << " " << By << endl;

	cout << setprecision(100) << sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By)) << endl;
}

Measured memory_bytes: 4164
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

class combinationTable {
    vector<ll> factrial;
    vector<ll> factrialInverse;
    vector<ll> inverse;

public:
    combinationTable(ll n, ll mod)
        : factrial(n + 1)
        , factrialInverse(n + 1)
        , inverse(n + 1) {
        factrial[0] = factrial[1] = 1;
        factrialInverse[0] = factrialInverse[1] = 1;
        inverse[1] = 1;
        for (int i = 2; i <= n; i++) {
            factrial[i] = (factrial[i - 1] * i) % mod;
            inverse[i] = mod - (inverse[mod % i] * (mod / i)) % mod;
            factrialInverse[i] = (factrialInverse[i - 1] * inverse[i]) % mod;
        }
    }

    ll value(ll i, ll j) {
        return (factrial[i] * ((factrialInverse[j] * factrialInverse[i - j]) % MOD)) % MOD;
    }
};

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

    ll ans = 0;
    int x = h - a;
    int y = w - b;

    combinationTable comb(1000000, MOD);
    for (int i = 0; i < y; i++) {
        ll conbination = (comb.value(x - 1 + b + i, x - 1) * comb.value(a - 1 + y - 1 - i, a - 1)) % MOD;
        ans = (ans + conbination) % MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 23680
//999.cpp
#include<iostream>
#include<cmath>

using namespace std;

int main() {
  int n;
  cin >> n;
  int n3 = floor(n / 100);
  int n2 = floor((n % 100) / 10);
  int n1 = n % 10;

  while (n <= 999) {
    if (n3 == n2 && n2 == n1) {
      cout << n << endl;
      break;
    } 
    n = n + 1;
    n3 = floor(n / 100);
    n2 = floor((n % 100) / 10);
    n1 = n % 10;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (int) 1e9+7
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define vi vector<int>
ll xpow(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
	{
		ll k = xpow(a, b / 2);
		return k * k;
	}
	if (b % 2 != 0)
		return a * xpow(a, b - 1);
}
int main()
{

#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	fio;
	int a, b;
	cin >> a >> b;
	cout << a*b << endl;
}

Measured memory_bytes: 3648
#include<stdio.h>
#define M 100000
#define N -1

typedef struct{
  int parent;
  int left;
  int right;
}Node;

Node T[M];
int n,D[M],H[M];

void setD(int,int);
int setH(int);
int setS(int);
void hyoji(int);

int main(){
  int v,i,l,r,root = 0;

  scanf("%d",&n);

  for(i = 0; i < n; i++) T[i].parent = N;

  for(i = 0; i < n; i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].left = l;
    T[v].right = r;
    if(l != N) T[l].parent = v;
    if(r != N) T[r].parent = v;
  }

  for(i = 0; i < n; i++){
    if(T[i].parent == N) root = i;
  }

  setD(root,0);
  setH(root);

  for(i = 0; i < n; i++) hyoji(i);

  return 0;
}

void setD(int u, int d){
  if(u == N) return;
  D[u] = d;
  setD(T[u].left, d+1);
  setD(T[u].right, d+1);
}

int setH(int u){
  int h = 0,k = 0;
  if(T[u].left != N) h = setH(T[u].left)+1;
  if(T[u].right != N) k = setH(T[u].right)+1;
  return H[u] = (h > k ? h : k);
}

int setS(int u){
  if(T[u].parent == N) return N;
  if(T[T[u].parent].left != u && T[T[u].parent].left != N) return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != N) return T[T[u].parent].right;
  return N;
}

void hyoji(int u){
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",setS(u));
  int deg = 0;
  if(T[u].left != N) deg++;
  if(T[u].right != N) deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].parent == N) printf("root\n");
  else if(T[u].left == N && T[u].right == N) printf("leaf\n");
  else printf("internal node\n");
}




Measured memory_bytes: 2104
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

def solve(N: int):
    counts = [[0] * 10 for _ in range(10)]
    for i in range(10, N + 1):
        b = i % 10
        while i >= 10:
            i //= 10
        counts[i][b] += 1
    ret = 0
    for i in range(1, min(N + 1, 10)):
        ret += 1
        if counts[i][i] > 0:
            ret += counts[i][i] * 2
    for i in range(1, 10):
        for j in range(1, 10):
            ret += counts[i][j] * counts[j][i]
    print(ret)
    return

def solve_(N: int):
    def is_valid(n, a, b):
        if n % 10 != b:
            return False
        while n >= 10:
            n //= 10
        if n % 10 == a:
            return True
        return False
    ret = 0
    for i in range(1, 10):
        for x in range(1, N + 1):
            if is_valid(x, i, i):
                print(x, i, i)
                ret += 1
    print(' -------- ')
    for i in range(1, 10):
        for j in range(1, 10):
            for x in range(10, N + 1):
                if is_valid(x, i, j):
                    print(x, i, j)
                    ret += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n, m, c = map(int, input().split(' '))

B  = list(map(int, input().split(' ')))

cnt = 0
for i in range(n):
    A = list(map(int, input().split(' ')))
    
    x = 0 
    for i in range(m):
      x += A[i] * B[i]
    
    x += c
    
    if x > 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! scan {
  ($e:expr; $t:ty) => {
    $e.get::<$t>()
  };
  ($e:expr; $($t:ty), *) => {
    ($($e.get::<$t>(),)*)
  };
  ($e:expr => $i:expr; $t:ty) => {
    (0..$i).map(|_| $e.get::<$t>()).collect::<Vec<$t>>()
  };
  ($e:expr => $row:expr, $col:expr; $t:ty) => {
    (0..$i).map(|_| scan!($e => $col; $t)).collect::<Vec<$t>>()
  }
}

struct Scanner<R: Read> {
  reader: R
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
  fn new(reader: R) -> Scanner<R> {
    Scanner { reader: reader }
  }
  fn safe_get<T: FromStr>(&mut self) -> Option<T> {
    let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
      .skip_while(|c| c.is_whitespace())
      .take_while(|c| !c.is_whitespace())
      .collect::<String>();
    if token.is_empty() { None } else { token.parse().ok() }
  }
  fn get<T: FromStr>(&mut self) -> T {
    if let Some(v) = self.safe_get() { v } else {
      writeln!(stderr(), "Terminated with EOF").unwrap();
      std::process::exit(0);
    }
  }
}

trait Writable {
  fn write(&self, sep: &'static str) -> String;
}

impl<T: ToString> Writable for Vec<T> {
  fn write(&self, sep: &'static str) -> String {
    self.iter().map(|e| e.to_string()).collect::<Vec<String>>().join(sep)
  }
}

fn main() {
  let cin = stdin();
  let cin = cin.lock();
  let mut sc = Scanner::new(cin);
  let (n, k) = scan!(sc; f64, f64);
  let mut ans = 0.0;
  for i in 1..((n as i32) + 1) {
    let i = i as f64;
    let cnt = coin_toss(i, k);
    ans += pow(2.0, -cnt);
  }
  println!("{}", ans * 1.0 / n);
}

fn coin_toss(cur: f64, goal: f64) -> f64 {
  let mut ans = 0.0;
  let mut cur = cur;
  while cur < goal {
    cur *= 2.0;
    ans += 1.0;
  }
  ans
}

fn pow(val: f64, expo: f64) -> f64 {
  if expo == 0.0 {
    1.0
  }
  else {
    let mut ans = 1.0;
    for _ in 0..abs(expo as i32) {
      if expo < 0.0 {
        ans /= val;
      }
      else {
        ans *= val;
      }
    }
    ans
  }
}

fn abs(val: i32) -> i32 {
  if val > 0 { val } else { -val }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int INF = 1e9;
#define rep(i, ne) for (int i = 0; i < ne; ++i)

int N;
const int A = 1e6 + 5;
vector<int> s;
vector<int> a(A, 0);

void input() {
  cin >> N;
  s.resize(N);
  rep(i, N) {
    cin >> s[i];
    a[s[i]]++;
  }
}

int gcd(int x, int y) {
  if (x % y == 0) {
    return y;
  } else {
    return gcd(y, x % y);
  }
}

void solve() {
  bool pairwise = true;
  for (int i = 2; i < A; ++i) {
    int cnt = 0;
    for (int j = i; j < A; j += i) {
      cnt += a[j];
    }
    if (cnt > 1) {
      pairwise = false;
      break;
    }
  }

  if (pairwise) {
    cout << "pairwise coprime" << endl;
    return;
  }

  int g = 0;
  rep(i, N) { g = gcd(g, s[i]); }
  if (g == 1) {
    cout << "setwise coprime" << endl;
    return;
  }

  cout << "not coprime" << endl;
}

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

Measured memory_bytes: 11048
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

int solve(){
  int n;  cin >> n;
  vector<int> x(n);
  int p = 0;
  for(int i=0; i<n; i++){
    cin >> x[i];
    p += x[i];
  }
  p /= n;
  int ans = 0;
  for(int i=0; i<n; i++){
    ans += (x[i]-p)*(x[i]-p);
  }
  int tmp = 0;
  for(int i=0; i<n; i++){
    tmp += (x[i]-p+1)*(x[i]-p+1);
  }
  ans = min(ans, tmp);
  tmp = 0;
  for(int i=0; i<n; i++){
    tmp += (x[i]-p-1)*(x[i]-p-1);
  }
  ans = min(ans, tmp);
  cout << ans << endl;
}

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


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	ar := make([]int, n)
	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		ar[a-1]++
		ar[b-1]++
	}
	for _, v := range ar {
		fmt.Println(v)
	}
}


Measured memory_bytes: 512
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_N 10000
#define MAX_M 100

typedef long long int ll;
using namespace std;



int main(){

	double r;
	scanf("%lf", &r);

	printf("%f %f\n", r*r*M_PI, 2*r*M_PI);


	return 0;

}

Measured memory_bytes: 1236
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n = read::<i32>();
  let t = read::<f64>();
  let a = read::<f64>();

  let mut h = vec![];

  for _ in 0..n {
    let h_i = read::<f64>();

    let temp = (a - (t - (h_i * 0.006))).abs();
    h.push(temp);
  }

  let mut min_v: f64 = 100000.0;
  let mut ans = 0;

  for (i, v) in h.iter().enumerate() {
    if v < &min_v {
      min_v = *v;
      ans = i + 1;
    }
  }

  println!("{}", ans);

  // println!("{}", x + (y / 2))
}



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

int main(){
	int n,k;
	string s;
	cin>>n>>s>>k;
	char t;
	t=s[k-1];
	for(int i=0;i<n;i++){
		if(s[i]==t){
			cout<<t;
		}else{
			cout<<'*';
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define stp setprecision(15)
#define eps 0.000001
#define endl '\n'
#define ll lli
 
using namespace std ;
 
#define N 10000000 
#define lg 19
 
typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

int main() 
{ 
 
/////////////////////////////////////
    
    fastio;
 
/////////////////////////////////////    
    
    lli n,k;
    cin>>n>>k;

    lli sum=0;

    loopl(i,0,n)
    {
        lli x;
        cin>>x;

        if(x>=k) sum++;
    }
    cout<<sum;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int inf = 2e17;
const int mod = 1e9 + 7;

signed main() {
    char c;
    cin >> c;
    cout << (char)(c + 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N, K;
    cin >> N >> K;
    cout << N - K + 1 << '\n';
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() 
{
	int a,b,c;
	cin >> a >> b >> c;
	
	if ( a <= b && b <= c )
cout << a << " " << b << " " << c << endl;
	else if ( a <= c && c <= b )
cout << a << " " << c << " " << b << endl;
	else if ( b <= a && a <= c )
cout << b << " " << a << " " << c << endl;
	else if ( b <= c && c <= a )
cout << b << " " << c << " " << a << endl;
	else if ( c <= a && a <= b )
cout << c << " " << a << " " << b << endl;
	else
cout << c << " " << b << " " << a << endl;
	
	return 0;
}


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

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int ans[8]={0};
    int f=0;
    for(int i=0;i<n;i++){
        if(a[i]>=1 && a[i]<=399)ans[0]++;
        if(a[i]>=400 && a[i]<=799)ans[1]++;
        if(a[i]>=800 && a[i]<=1199)ans[2]++;
        if(a[i]>=1200 && a[i]<=1599)ans[3]++;
        if(a[i]>=1600 && a[i]<=1999)ans[4]++;
        if(a[i]>=2000 && a[i]<=2399)ans[5]++;
        if(a[i]>=2400 && a[i]<=2799)ans[6]++;
        if(a[i]>=2800 && a[i]<=3199)ans[7]++;
        if(a[i]>=3200)f++;
    }
    int mn=0;
    for(int i=0;i<8;i++){
        if(ans[i]>0)mn++;
    }
    int mx;
    mx=mn+f;
    //fuck man just missed something so silly
    if(mn==0 && f>0)cout<<1<<" "<<mx;
    else cout<<mn<<" "<<mx;
    
    return 0;
}

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

int main(){
  
  long long h,w;
  cin >> h >> w;
  long long a=h*w;
  if(h==1 || w==1){
    cout << 1 << endl;
  }
  else if(a%2==0) cout << a/2 << endl;
  else cout << (a-1)/2+1 << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.D
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var inputs = ReadLongs();
            var a = (double)inputs[0];
            var b = (double)inputs[1];
            var x = (double)inputs[2];

            if (a * a * b == x) return 0;

            if (2 * x <= a * a * b)
            {
                var tan = 2 * x / (a * b * b);
                return 90 - 360 * Math.Atan(tan) / (2 * Math.PI);
            }
            else
            {
                var tan = a * a * a / (2 * (a * a * b - x));
                return 90 - 360 * Math.Atan(tan) / (2 * Math.PI);
            }
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 13396
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a1 = sc.nextInt();
        int a2 = sc.nextInt();
        int a3 = sc.nextInt();
        sc.close();
        if (a1 + a2 + a3 <= 21) {
            System.out.println("win");
        } else {
            System.out.println("bust");
        }
    }
}


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

using namespace std;

int main()
{
	unsigned int n;
	vector<unsigned long long> a;

	cin >> n;
	a.resize(n);

	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}

	sort(a.begin(), a.end());

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

	cout << "YES";
	return 0;
}

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

int H, W;
//vector<vector<char>> t(H, vector<char>(W));
//vector<vector<char>> tt(H, vector<char>(W));
//vector<vector<int>> d(H, vector<int>(W));
char t[20][20];
char tt[20][20];
int d[20][20];
void t_copy(){
  rep(i, H){
    rep(j, W){
      tt[i][j] = t[i][j];
    }
  }
}
void initi(){
  rep(i, H){
    rep(j, W){
      d[i][j] = -1;
    }
  }
}
int main(){

  cin >> H >> W;

  rep(i, H){
    rep(j, W){
      cin >> t[i][j];
    }
  }
  int sy, sx;
  int gy, gx;


  int ans = -1;
  int ny, nx;
  int ty, tx;

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

  rep(y0, H){
    rep(x0, W){
      if(t[y0][x0] == '#'){
        continue;
      }
      t_copy();
      initi();
      sy = y0;
      sx = x0;
      queue<P> q;
      int maxdif = -1;
      q.push(P(sy, sx));
      d[sy][sx] = 0;
      while(q.size()){
        P p = q.front();
        q.pop();
        ny = p.first;
        nx = p.second;
        tt[ny][nx] = '#';
        rep(i, 4){
          ty = dy[i] + ny;
          tx = dx[i] + nx;
          if(ty >= 0 && ty < H && tx >= 0 && tx < W && d[ty][tx] == -1 && tt[ty][tx] == '.'){
            d[ty][tx] = d[ny][nx] + 1;
            q.push(P(ty, tx));
            maxdif = max(maxdif, d[ty][tx]);
          }
        }
      }
      ans = max(ans, maxdif);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256