akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
int main(){
    int tall[15]={0},N;
    double t;
    cin>>N;
    while(N--){
        cin>>t;
        if(t<165)tall[1]++;
        if(165<=t&&t<170)tall[2]++;
        if(170<=t&&t<175)tall[3]++;
        if(175<=t&&t<180)tall[4]++;
        if(180<=t&&t<185)tall[5]++;
        if(185<=t)tall[6]++;
    }
    for(int i=1;i<7;i++){
        cout<<i<<":";
        while(tall[i]--){
            cout<<"*";
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 100000
using namespace std;
bool isPrime(int x)
{
	if(x < 2) return false;
	if(x == 2) return true;
	if(x % 2 == 0) return false;
	for(int i=3; i*i<=x; i+=2)
	{
		if(x % i == 0) return false;
	}
	return true;
}
int main()
{
	double m, a, b;
	while(cin >> m >> a >> b)
	{
		int ans_p,ans_q,area = 0;
		if(m == 0 && a == 0 && b == 0) break;
		double inf = a/b;
		for(int i=2; i<=m; i++)
		{
			long tmp_area = 0, p, q;
			if(!isPrime(i)) continue;
			for(int j=i; j<=m/i; j++)
			{
				//cout << i << " " << j  << endl;
				if((double)i/j < inf || (double)i/j > 1.0) continue;
				if(!isPrime(j)) continue;
				if(i*j > m) break;
				tmp_area = i*j;
				//cout << i << " " << j << " " << tmp_area << endl;
				p = i;
				q = j;
			}
			if(tmp_area >= area)
			{
				area = tmp_area;
				ans_p = p;
				ans_q = q;
			}
		}
		cout << ans_p << " " << ans_q << endl;
	}
	return 0;
}



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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define forn(i,n) for(int i=0;i<int(n);++i)
#define vet(a) for(auto&i:a)cout<<i<<" "
#define out(a) cout<<a<<endl

typedef long long int ll;

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

	int t;
	cin>>t;
	int nAc=0,nWa=0,nTle=0,nRe=0;
	while(t--){
		string s;
		cin>>s;
		if(s=="AC")++nAc;
		if(s=="WA")++nWa;
		if(s=="TLE")++nTle;
		if(s=="RE")++nRe;
	}
	cout<<"AC x "<<nAc<<endl;
	cout<<"WA x "<<nWa<<endl;
	cout<<"TLE x "<<nTle<<endl;
	cout<<"RE x "<<nRe<<endl;

	return 0;
}

Measured memory_bytes: 3640
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
    long long int n,k;
    cin>>n>>k;
    long long int a=n%k;
    //cout<<a<<endl;;
    cout<<std::min(a,k-a);
    
 

    return 0;
}


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

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

	vector<long long> a(n), num(n + 1, 0);

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

	long long sum = 0;
	for (long long j = 1; j <= n; j++) {
		if (2 <= num[j]) {
			sum += num[j] * (num[j] - 1) / 2;
		}	
	}

	for (long long i = 0; i < n; i++) {

		long long tmp_ans;
		long long tmp = num[a[i]];

		tmp_ans = sum;
		tmp_ans -= tmp*(tmp - 1) / 2;
		tmp_ans += (tmp - 1)*(tmp - 2) / 2;
		
		cout << tmp_ans << endl;
	}

	return 0;
}

Measured memory_bytes: 5760
n = int(input())
A = list(map(int, input().split()))

cnt = 0
flg = True
while flg:
    for i, item in enumerate(A):
        if item % 2 == 0:
            A[i] = int(item / 2)
        else:
            flg = False
            break
    if flg:
        cnt += 1
print(cnt)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, ll> p;
 
#define MOD 1000000007
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int X;
    cin >> X;
    X -= 400;

    X /= 200;

    cout << 8 - X << endl;
}

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

using namespace std;

typedef long long ll;

int main(){
	ios::sync_with_stdio(false);
	int w, left, right;
	cin >> w >> left >> right;
	if(left > right)
		swap(left, right);
	int ans = max(0, right - (left + w));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
 
 
public class Main{
	
	public int num;
	public int vol;
 
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}
 
 
 
	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}
 
 
	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}
 
 
	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}
 
 
	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 long N=sc.nextLong(),M=sc.nextLong();
	 long result=0;
	 if(N*2<=M) {
		 result+=N;
		 M-=N*2;
		 result+=M/4;
		 
	 }else {
		 result+=M/2;
	 }
	 System.out.println(result);
	 
 }
	
 
 
}

Measured memory_bytes: 21844
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    int[] distTo = null;
    int[] parentOf = null;

    public Main(ArrayList<ArrayList<Edge>> G){
        distTo = new int[G.size()];
        Arrays.fill(distTo, Integer.MAX_VALUE);
        parentOf = new int[G.size()];

        PriorityQueue<SDto> pq = new PriorityQueue<>();

        pq.add(new SDto(0, 0, -1));
        while (!pq.isEmpty()) {

            SDto optim = pq.poll();

            if (optim.d < distTo[optim.v]) {
                distTo[optim.v] = optim.d;
                parentOf[optim.v] = optim.from;
                for (Edge e : G.get(optim.v)) {
                    if (optim.from != e.v) { // prevent go back
                        pq.add(new SDto(e.v, distTo[optim.v] + e.c, optim.v));
                    }
                }

            }
        }

    }

    private static class SDto implements Comparable<SDto> { // Shortest distance to vertex
        int v, d, from;

        SDto(int v, int d, int from) {
            this.v = v;
            this.d = d;
            this.from = from;
        }

        @Override
        public int compareTo(SDto that) {
            if(this.d > that.d) return 1;
            else if(this.d < that.d) return -1;
            return 0;
        }


    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();

        ArrayList<ArrayList<Edge>> G = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            G.add(new ArrayList<>());
        }

        for (int i = 0; i < n; i++) {
            int u = in.nextInt();
            int k = in.nextInt();
            for (int j = 0; j < k; j++) {
                int v = in.nextInt(), c = in.nextInt();
                G.get(i).add(new Edge(v, c));
//                G.get(v).add(new Edge(i, c));
            }
        }

        Main dijkstra = new Main(G);

        for (int i = 0; i < G.size(); i++) {
            System.out.printf("%d %d\n", i, dijkstra.distTo[i]);
        }
    }
}

class Edge {
    int v, c;

    Edge(int v, int c) {
        this.v = v;
        this.c = c;
    }

    @Override
    public String toString() {
        return String.format("(v=%d, c=%d)", v, c);
    }
}


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

const int MAXN = 2e5;
int N;
string S;
int cnt[2][MAXN];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> S;
	N = int(S.size());
	for (int z = 0; z < 2; z++) {
		assert(S[0] == 'R');
		assert(S[N-1] == 'L');
		int last = 0;
		for (int i = 0; i < N; i++) {
			if (S[i] == 'R') {
				last = i;
			} else {
				int tgt = last + (i - last) % 2;
				cnt[z][tgt]++;
			}
		}

		reverse(S.begin(), S.end());
		for (auto& c : S) c ^= 'L' ^ 'R';
	}
	reverse(cnt[1], cnt[1] + N);
	for (int i = 0; i < N; i++) {
		cout << cnt[0][i] + cnt[1][i] << " \n"[i == N-1];
	}

	return 0;
}


Measured memory_bytes: 1488
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) cout << "Yes";
    else if (s[3] == s[1]  && s[1] == s[2])cout << "Yes";
    else cout << "No";
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

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

int main(){
  string X;
  cin >> X;
  int64_t ans=0;
  int64_t n=0;
  for(int i=0;i<X.size();i++){
    if(X.at(i)=='S'){
      n++;
    }else{
      if(n>0){
        ans++;
        n--;
      }
    }
  }
  ans=X.size()-2*ans;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3660
def leap?(y)
  return true if y % 400 == 0
  return false if y % 100 == 0
  return y %4 == 0
end

### main

ans = []

while true
  a, b = gets.chomp.split(" ").map{|s| s.to_i}
  break if a == 0 && b == 0

  lys = []
  for y in (a..b)
    lys.push y if leap?(y)
  end

  ans.push (lys.length > 0) ? lys.join("\n") : "NA"
end

puts ans.join("\n\n")

Measured memory_bytes: 6112
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <sstream>
#include <climits>
#include <fstream>
#include <cmath>

using namespace std;

/// ********* debug template by Bidhan Roy *********

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

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const unordered_set< T > &v ) {
    os << "[";
    typename unordered_set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const unordered_map< F, S > &v ) {
    os << "[";
    typename unordered_map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    } 
    return os << "]";
}

#define debug(x) cerr << #x << " = " << x << endl;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<bool> VB;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<LL> VLL;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<VB> VVB;
typedef vector<VI> VVI;
typedef vector<VC> VVC;
typedef vector<VLL> VVLL;
typedef vector<VD> VVD;
typedef vector<VS> VVS;

// TEMPLATE DEFINITIONS END

int n;
int x;

void read_input(){
    cin >> n;
}

void solve(){
    for(int i=0;i<n;i++){
        cin >> x;
        if(x % 2 == 0 && x % 3 != 0 && x % 5 != 0){
            cout << "DENIED\n";
            return;
        }
    }

    cout << "APPROVED\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    read_input();
    solve();
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var (D, X) = Slice2<long>();
            for (var i = 0; i < N; ++i)
            {
                var a = Sarray()[0];
                X += (D + a - 1) / a;
            }
            WriteLine(X);
        }

        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28216
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();

		if (k == 1) {
			System.out.println(0);
		} else {
			System.out.println(n - k);
		}
	}
}


Measured memory_bytes: 21844
N = int(input())
dist = []
dist2 = []
for _ in range(N):
    x, y = [int(x) for x in input().split()]
    dist.append(x + y)
    dist2.append(x - y)
dist.sort()
dist2.sort()
ans = dist[N - 1] - dist[0]
ans2 = dist2[N - 1] - dist2[0]
print(max(ans, ans2))

Measured memory_bytes: 25544
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  ll a, b, c;
  cin >> a >> b >> c;
  if(a + b >= c){
    cout << b + c << endl;
  }else{
    cout << a + b + b + 1 << endl;
  }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,1,0,-1};
int main(){
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(false);

    int N,M;cin>>N>>M;
    int a[N],sum=0;
    rep(i,N){
        cin>>a[i];
        sum+=a[i];
    }
    int ans=0;
    rep(i,N){
        if(a[i]*4*M>=sum)ans++;
    }
    if(ans>=M)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
A, B, C, D = map(int, input().split())

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

allnum =  B -A +1
E = lcm(C, D)

Cnum = (B//C) - ((A-1)//C)
Dnum = (B//D) - ((A-1)//D)
Enum = (B//E) - ((A-1)//E)

num = allnum - Cnum - Dnum + Enum
print(int(num))


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

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

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

// borrowed from neal's code
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int n; cin >> n;
    vector<ll> a(n + 1);
    vector<ll> ps(n + 1, 0);
    vector<ll> dp(n + 1, 0); // dp[i] = choose floor(i / 2) with greatest sum among first i elements

    for (int i = 1; i <= n; ++i) {
    	cin >> a[i];
    }
    ps[1] = a[1];
    for (int i = 2; i <= n; ++i) 
    	ps[i] = ps[i - 2] + a[i];

    dp[1] = 0;
    for (int i = 2; i <= n; ++i) {
    	if (i & 1) {
    		dp[i] = max(dp[i - 1], dp[i - 2] + a[i]);
    	} else {
    		dp[i] = max(dp[i - 2] + a[i], ps[i - 1]);
    	}
    }

    cout << dp[n] << "\n";
}

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

int a[100000][3];

int F[100000][3];

int main(){
	int n;
	cin>>n;
	
	for(int i = 0;i<n;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	
	F[0][0] = a[0][0];
	F[0][1] = a[0][1];
	F[0][2] = a[0][2];
	
	for(int day = 1; day < n; day++){
		F[day][0] = a[day][0] + max(F[day-1][1], F[day-1][2]);
		F[day][1] = a[day][1] + max(F[day-1][0], F[day-1][2]);
		F[day][2] = a[day][2] + max(F[day-1][0], F[day-1][1]);
	}
	
	int answer = max({F[n-1][0] , F[n-1][1] , F[n-1][2]});
	cout<<answer;
	
	return 0;
}


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

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

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

    int ai = 5;
    for(int i = 0; i < n; i++)
    {
        while (!isPrime(ai + 1)) {
            ai += 5;
        }
        cout << ai + 1 << " ";
        ai += 5;
    }
    cout << endl;
}

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

#define int long long
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define DESYNC ios::sync_with_stdio(0); cin.tie(0);
#define deb(x) cerr << ">> " << #x << " : " << x << "\n";
#define print(a) for(auto &x : a) cout << x << " "; cout << "\n";

const int inf = 1e18 + 5;
const int N = 2e5 + 50;

// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

void solve()
{
    int k;
    cin >> k;
    int ans = -1;
    int div = 0;
    for(int i = 0; i < k; i++)
    {
        div = div * 10 + 7;
        if(div % k == 0)
        {
            // deb("hi");
            ans = i + 1;
            break;
        }
        div = div % k;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3604
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		List <Long> list = new LinkedList<Long>();
		ListIterator<Long> listIter = list.listIterator();
		try (Scanner sc = new Scanner (System.in)){
			int times = sc.nextInt();
			long x,d;
			for (int i=0; i < times; i++) {
				int query = sc.nextInt();
				switch (query) {
				//insert(x)
				case 0:
					x = sc.nextLong();
					listIter.add(x);
					listIter.previous();
					break;
					//move(d)
				case 1:
					d = sc.nextLong();
					if (d > 0) {
						for (int j=0; j<d; j++) {
							listIter.next();   //後ろに移動
						}
					} else if (d < 0){
						long a = -d;  //絶対値にする
						for (int j=0; j<a; j++) {
							listIter.previous();   //前に移動
						}
					}
					break;
					//erase()
				case 2:
					listIter.next();  //最後にnext()またはprevious()で返された要素が削除されるため、先に後ろにずらす
					listIter.remove();
					break;
				}
			}
			ListIterator<Long> ite = list.listIterator();
			while (ite.hasNext()) {
				System.out.println(ite.next());
			}
		}
	}
}


Measured memory_bytes: 307952
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

/////////////         qsortのラッピング

int qsort_int_compare_ascend(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int qsort_int_compare_descend(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
void ascendOrder(int size, int *array) {//昇順
	qsort(array, size, sizeof(int), qsort_int_compare_ascend);
}
void descendOrder(int size, int *array) {//降順
	qsort(array, size, sizeof(int), qsort_int_compare_descend);
}

int N;
int *num;
vector<int> *o;

int func(int n) {
	if (n < 0 || n >= N) { return 0; }
	if (num[n] == 0) { return 0; }
	int *x = new int[num[n]];
	for (int i = 0; i < num[n]; i++) {
		x[i] = func(o[n][i]);
	}

	descendOrder(num[n], x);
	for (int i = 0; i < num[n]; i++) {
		x[i] += i + 1;
	}
	descendOrder(num[n], x);
	return x[0];
}
int main() {
	cin >> N;
	num = new int[N];
	o = new vector<int>[N];

	for (int i = 0; i < N; i++) {
		num[i] = 0;
	}
	for (int i = 1; i < N; i++) {
		int a; cin >> a;
		a--;
		// i番目の人はa番目の人に負けた
		num[a] ++;
		o[a].push_back(i);
	}

	cout << func(0) << endl;

	return 0;
}

Measured memory_bytes: 13952
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private int N;
	private List<String> A;

	int cnt = 0;

	private void mainrun() {
		scan = new Scanner(System.in);

		N = scan.nextInt();
		A = new ArrayList<>();
		for(int i = 0;i < N ; i++) {
			A.add(scan.next() + " ");
		}

		bobbleSort();

		for(String num: A) {
			System.out.print(num);
		}

		System.out.println(cnt);

	}

	private void bobbleSort() {
		boolean flag = true;

		while(flag) {
			flag = false;
			for(int j = N - 1;j > 0;j--) {
				if(Integer.parseInt(A.get(j).trim()) < Integer.parseInt(A.get(j -1).trim())) {
					String tmp = A.get(j);
					A.set(j, A.get(j-1));
					A.set(j-1, tmp);

					cnt++;
					flag = true;

				}
			}

		}

		A.set(A.size() - 1, A.get(A.size() - 1).trim() + "\n");
	}
}


Measured memory_bytes: 28636
import java.util.Scanner;
import java.util.Stack;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			int N = cin.nextInt();
			int[] a = {1024,512,256,128,64,32,16,8,4,2,1};
			boolean first = true;
			Stack<Integer> s = new Stack<Integer>();
			for(int i = 0; i < a.length; i++){
				if(N >= a[i]){


					s.push(a[i]);
					N -= a[i];
				}
			}
			while(!s.isEmpty()){
				if(!first){
					System.out.print(" " );
				}
				first=false;
				System.out.print(s.pop());
			}
			System.out.println();
		}

	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    ll s, e;
    if(a%x){
        s = a / x + 1;
    }else{
        s = a / x;
    }
    e = b / x;
    cout << e - s + 1 << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
 
int solve(int, int);
 
int *array, n;
 
int main(){
  int i, m, M;
  scanf("%d",&n);
  array = malloc(n * sizeof(int));
  for(i = 0; i < n; i++){
    scanf("%d",&array[i]);
  }
  scanf("%d",&m);
  for(i = 0; i < m; i++){
    scanf("%d",&M);
    if(solve(0, M)){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }
   
  return 0;
}
 
int solve(int i, int M){
  if(M == 0){
    return 1;
  }
  if(i >= n){
    return 0;
  }
  return solve(i + 1, M) || solve(i + 1, M - array[i]);
}


Measured memory_bytes: 2104
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }


int main() {
	int N, i, j, dp[100001];
	scanf("%d", &N);

	dp[0] = 0;
	for (i = 1; i <= N; i++) {
		dp[i] = i;
		for (j = 0; pow(6, j) <= i; j++) {
			dp[i] = Min(dp[i], dp[i - (int)pow(6, j)] + 1);
		}
		for (j = 0; pow(9, j) <= i; j++) {
			dp[i] = Min(dp[i], dp[i - (int)pow(9, j)] + 1);
		}
	}
	printf("%d\n", dp[N]);

#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 512
//defalt
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
typedef pair<int, int> P_i;
typedef pair<double,double> P_d;
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j)
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*
ビット bit に i 番目のフラグが立っているかどうか	if (bit & (1<<i))
ビット bit に i 番目のフラグが消えているかどうか	if (!(bit & (1<<i)))
ビット bit に i 番目のフラグを立てる	bit｜= (1<<i)
ビット bit に i 番目のフラグを消す	bit &= ~(1<<i)
ビット bit に何個のフラグが立っているか	__builtin_popcount(bit)
ビット bit に i 番目のフラグを立てたもの	bit｜(1<<i)
ビット bit に i 番目のフラグを消したもの	bit & ~(1<<i)
*/

int counter(int x) {
  if(x == 0) return 0;
  return counter(x >> 1) + (x & 1);
}

using Graph = vector<vector<P_i>>;
int ans=0;
bool ok=true;

signed main(){
  int N;
  cin >> N;
  Graph G(N);
  rep(i,N){
    int A;
    cin >> A;
    rep(j,A){
      int x,y;
      cin >> x >> y;
      x--;
      G[i].push_back(make_pair(x,y));
    }
  }
  rep(s,1<<N){
    ok=true;
    //cout << "s:" << bitset<3>(s) << endl;
    rep(i,N){//一桁ずつチェック
      if(!(s & (1<<i))) continue;
      rep(j,G[i].size()){
        if(((s >> G[i][j].first) & 1) ^ G[i][j].second) ok=false;
      }
    }
    if(ok){
      chmax(ans,counter(s));
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
import math

#必要な素数を全列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0

    while True:
        prime = min(A)

        if prime > math.sqrt(limit):
            break

        P.append(prime)

        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1

    for a in A:
        P.append(a)

    return set(P)

max_n = 10**5

primes = eratosthenes(max_n)
# print(primes)

a = [0] * (max_n+1)
for i in range(1, max_n + 1):
    if i in primes and (i+1)//2 in primes:
        a[i] = a[i-1] + 1
    else:
        a[i] = a[i-1]
# print(a)

Q = int(sys.stdin.readline().strip())
for _ in range(Q):
    l, r = map(int, sys.stdin.readline().strip().split())
    print(a[r] - a[l-1])


Measured memory_bytes: 8360
using System;
using System.Collections.Generic;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var N = NM[0]; var M = NM[1];
            var connections = new List<int>[N + 1];
            for (int i = 0; i < N + 1; i++) connections[i] = new List<int>();
            for (int i = 0; i < M; i++)
            {
                var ab = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                connections[ab[0]].Add(ab[1]);
                connections[ab[1]].Add(ab[0]);
            }

            var sign = new int[N + 1];
            for (int i = 0; i < N + 1; i++) sign[i] = -1;
            sign[1] = 0;
            var queue = new Queue<int>();
            queue.Enqueue(1);
            while (queue.Count > 0)
            {
                var current = queue.Dequeue();
                foreach (int r in connections[current])
                {
                    if (sign[r] == -1)
                    {
                        sign[r] = current;
                        queue.Enqueue(r);
                    }
                }
            }

            Console.WriteLine("Yes");
            for (int i = 2; i < N + 1; i++) Console.WriteLine(sign[i]);
        }
    }
}


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

ll gcd(ll x, ll y){
    if(x < y)swap(x, y);
    if(y == 0) return x;
    return gcd(x%y, y);
}

int main(){
    ll n, x;
    cin >> n >> x;

    vector<ll> city(n+1);
    city[0] = x;
    for(int i = 1; i <= n; i++){
        cin >> city[i];
    }
    sort(city.begin(), city.end());

    vector<ll> dif(n+1);
    for(int i = 1; i <= n; i++){
        dif[i] = city[i] - city[i-1];
    }

    ll ans = dif[1];
    for(int i = 2; i <= n; i++){
        ans = gcd(ans, dif[i]);
    }

    cout << ans << endl;

    return 0;

}



Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
ll di(ll x){
  ll res=0;
  for(int i=0;i<62;i++){
    if(((x>>i)&1)==1) res=i;
  }
  return res+1;
}
const ll mod=1e9+7;
ll get_dp(ll L,ll R,ll D){
  ll dl=di(L),dr=di(R);
  if(dl>D||dr<D) return 0;
  ll dp[64][2][2]={0};
  if(dl==D){
    if(dr==D) dp[0][1][1]=1;
    else dp[0][1][0]=1;
  }
  else{
    if(dr==D) dp[0][0][1]=1;
    else dp[0][0][0]=1;
  }

  for(int i=1;i<D;i++){
    ll bl=((L>>(D-i-1))&1),br=((R>>(D-i-1))&1);
    if(bl==1){
      if(br==1){
        dp[i][0][0]=dp[i-1][0][0]*3+dp[i-1][0][1];
        dp[i][0][1]=dp[i-1][0][1]*2;
        dp[i][1][0]=dp[i-1][1][0];
        dp[i][1][1]=dp[i-1][1][1];
      }
      else{
        dp[i][0][0]=dp[i-1][0][0]*3;
        dp[i][0][1]=dp[i-1][0][1];
        dp[i][1][0]=dp[i-1][1][0];
      }
    }
    else{
      if(br==1){
        dp[i][0][0]=dp[i-1][0][0]*3+dp[i-1][0][1]+dp[i-1][1][0];
        dp[i][0][1]=dp[i-1][0][1]*2+dp[i-1][1][1];
        dp[i][1][0]=dp[i-1][1][0]*2+dp[i-1][1][1];
        dp[i][1][1]=dp[i-1][1][1];
      }
      else{
        dp[i][0][0]=dp[i-1][0][0]*3+dp[i-1][1][0];
        dp[i][0][1]=dp[i-1][0][1];
        dp[i][1][0]=dp[i-1][1][0]*2;
        dp[i][1][1]=dp[i-1][1][1];
      }
    }
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++) dp[i][j][k]%=mod;
    }
  }
  ll res=0;
  for(int j=0;j<2;j++){
    for(int k=0;k<2;k++) res+=dp[D-1][j][k];
  }
  return res%mod;
}
int main(){
  ll l,r;
  cin>>l>>r;
  ll ans=0;
  for(int i=1;i<62;i++){
    ans+=get_dp(l,r,i);
    ans%=mod;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int absolute(int n1, int n2) {
    if (n1 >= n2) {
        return n1 - n2;
    } else {
        return n2 - n1;
    }
}

int main(void) {
    int array[3];

    scanf("%d", &array[0]);
    scanf("%d", &array[1]);
    scanf("%d", &array[2]);

    for (int i=0; i<2; i++) {
        int max = i;
        for (int j=i; j<3; j++) {
            if (array[max] < array[j]) {
                max = j;
            }
        }
        if (max != i) {
            int hoge;
            hoge = array[i];
            array[i] = array[max];
            array[max] = hoge;
        }
    }

    printf("%d\n", absolute(array[0], array[1]) + absolute(array[1], array[2]));
}


Measured memory_bytes: 128
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		double bunsi=1;
		for(int i=0;i<n;i++){
			bunsi*=a[i];
		}
		double bunbo=0;
		for(int i=0;i<n;i++){
			bunbo+=bunsi/a[i];
		}
		System.out.println(bunsi/bunbo);
	}
	
}

Measured memory_bytes: 23892
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    char s[5050];
    scanf("%s", s);
    int len = strlen(s);
    int k;
    scanf("%d", &k);
    vector<string> v;
    for(int i=0;i<len;i++){
        string q;
        for(int j=i, a = 0;j<len && a<5;j++, a++){
            q+=(s[j]);
            v.push_back(q);
        }
    }
    sort(v.begin(), v.end());
    auto end = unique(v.begin(), v.end());
    v.erase(end, v.end());
    printf("%s", v[k-1].c_str());
    return 0;
}


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

int main(void) {
    int64_t K;
    string S;
    cin >> K >> S;
    if(S.size() > K) {
        cout << S.substr(0,K) << "...\n";
    } else {
        cout << S << "\n";
    }

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n;
ll T, E, x[maxn], dp[maxn], seg[4 * maxn], lazy[4 * maxn];

inline void pushDown(int u, int l, int r)
{
	if (r - l > 1)
	{
		seg[2 * u] += lazy[u];
		seg[2 * u + 1] += lazy[u];
		lazy[2 * u] += lazy[u];
		lazy[2 * u + 1] += lazy[u];
	}
	lazy[u] = 0;
}

void update(int u, int l, int r, int b, int e, ll val)
{
	if (lazy[u])
		pushDown(u, l, r);
	if (b <= l && r <= e)
	{
		seg[u] += val;
		lazy[u] += val;
		pushDown(u, l, r);
		return;
	}
	int mid = (l + r) / 2;
	if (b < mid)
		update(2 * u, l, mid, b, e, val);
	if (e > mid)
		update(2 * u + 1, mid, r, b, e, val);
	seg[u] = min(seg[2 * u], seg[2 * u + 1]);
}

void updateSet(int u, int l, int r, int x, ll val)
{
	if (lazy[u])
		pushDown(u, l, r);
	if (r - l == 1)
	{
		seg[u] = val;
		return;
	}
	int mid = (l + r) / 2;
	if (x < mid)
		updateSet(2 * u, l, mid, x, val);
	else
		updateSet(2 * u + 1, mid, r, x, val);
	seg[u] = min(seg[2 * u], seg[2 * u + 1]);
}

ll query(int u, int l, int r, int b, int e)
{
	if (lazy[u])
		pushDown(u, l, r);
	if (b <= l && r <= e)
	{
		//cerr << "QUERY " << l << ' ' << r << ':' << seg[u] << endl;
		return seg[u];
	}
	int mid = (l + r) / 2;
	ll res = inf;
	if (b < mid)
		res = min(res, query(2 * u, l, mid, b, e));
	if (e > mid)
		res = min(res, query(2 * u + 1, mid, r, b, e));
	return res;
}

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

	fill(seg, seg + 4 * maxn, inf);

	cin >> n >> E >> T;
	for (int i = 0; i < n; i++)
		cin >> x[i];
	int pos = 0;
	for (int i = 0; i < n; i++)
	{
		if (pos)
			update(1, 0, n + 2, 0, pos + 1, 2 * (x[i] - x[i - 1]));
		updateSet(1, 0, n + 2, i + 1, T + dp[i]);
		while (2 * (x[i] - x[pos]) >= T)
		{
			updateSet(1, 0, n + 2, pos + 1, 2 * (x[i] - x[pos]) + dp[pos]);
			pos++;
		}
		//cerr << "___________ " << i + 1 << endl;
		dp[i + 1] = query(1, 0, n + 2, 0, i + 2);
	}
	for (int i = 0; i <= n; i++)
		cerr << '_' << dp[i];
	cerr << endl;
	cout << dp[n] + E << endl;
}



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

int main()
{
  vector<int> a(5);
  vector<int> r(5);
  int i;
  for(i = 0; i < 5; i++)
  {
    cin >> a.at(i);
    r.at(i) = (a.at(i)-1)%10;
  }
  int min = 10;
  int check;
  for(i = 0; i < 5; i++)
  {
    if(min > r.at(i))
    {
      check = i;
      min = r.at(i);
    }
  }
  int ans = 0;
  for(i = 0; i < 5; i++)
  {
    if(i == check)
    {
      ans += a.at(i);
    }
    else if(a.at(i) %10 != 0)
    {
      ans += a.at(i) - a.at(i) % 10 + 10;
    }
    else
    {
      ans += a.at(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::cmp::min;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let input = get_vec_input();
    let n: usize = input[0];
    let k: usize = input[1];
    let mut lights: Vec<i64> = get_vec_input();

    for _ in 0..k {
        // let mut tmp_lights: Vec<i64> = vec![0i64; n];
        // for i in 0..n {
        //     let light = lights[i];
        //     let start = i as i64 - light;
        //     let end = i as i64 + light;
        //     let range = start..end + 1;

        //     range
        //         .filter(|x| *x >= 0 && *x < n as i64)
        //         .for_each(|x| tmp_lights[x as usize] += 1);
        // }
        let mut tmp_lights: Vec<i64> = vec![0i64; n + 1];
        for i in 0..n {
            let start = max(0, i as i64 - lights[i]) as usize;
            let end = min(n as i64 - 1, i as i64 + lights[i]) as usize;
            tmp_lights[start] += 1;
            tmp_lights[end + 1] -= 1;
        }
        for i in 0..n - 1 {
            tmp_lights[i + 1] += tmp_lights[i];
        }
        tmp_lights.pop();

        lights = tmp_lights.clone();
        if lights
            .iter()
            .filter(|&x| *x == n as i64)
            .collect::<Vec<_>>()
            .len()
            == n
        {
            break;
        }
    }
    lights.iter().for_each(|x| print!("{} ", x));
}

#[allow(dead_code)]
fn get_digit(value: i64) -> i64 {
    let mut digit = 0i64;
    let mut value = value;
    while value != 0 {
        value /= 10;
        digit += 1;
    }
    digit
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}


Measured memory_bytes: 8132
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100100100;//10^17
const ll MOD = 1000000007;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


ll mpow(ll x, ll n){//繰り返し二乗法 計算量O(logN)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans * x % MOD;
        x = x * x % MOD;
        n  = n >> 1;
    }
    return ans;
}

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



int main(){
    long double a, b, x;
    cin >> a >> b >> x;
    if(x <= a * a * b * 0.5){
        double theta = atan(2.0 * x / (a * b * b));
        cout << setprecision(12) << 90.0 - (theta * 180 / M_PI)  << endl;
    }else{
        double theta = atan((2.0 * a * a * b - 2.0 * x) / (a * a * a));
        cout << fixed << setprecision(12) << theta * 180 / M_PI << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divCeil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << endl; exit(0);}

int main()
{
  int N;
  cin >> N;
  vector<double> V(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> V.at(i);
  }

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

  double ans = V.front();
  for (ll i = 1; i < N; i++)
  {
    ans = (ans + V.at(i)) / 2.0;
  }

  cout << fixed << setprecision(10) << ans << endl;
}

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

int main() {
string s; cin>>s;
string t; cin>>t;
int count=0;
for(int i=0;i<s.length();i++)
{
	if(t[i]!=s[i])
	{
		t[i]=s[i];
		count++;
	}
}

cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3916
import queue
h,w = map(int,input().split())
s = [list(input()) for i in range(h)]
q = queue.Queue()
ma = [[0]*w for i in range(h)]
dyx = [[0,1],[0,-1],[1,0],[-1,0]]
white = 0
black = 0
for i in range(h):
    white += s[i].count(".")
black = h*w - white
q.put([0,0])
s[0][0] = "#"
flag = True
while flag:
    newq = queue.Queue()
    while not q.empty():
        y,x = q.get()
        for dy,dx in dyx:
            if 0 <= y + dy< h and 0 <= x +dx <w and s[y+dy][x+dx] != "#":
                s[y+dy][x+dx] = "#"
                newq.put([y+dy,x+dx])
                ma[y+dy][x+dx] = ma[y][x] +1
            if y+dy == h-1 and x+dx == w-1:
                flag = False
    q = newq
    if q.empty():
        break
if ma[h-1][w-1] == 0:
    print(-1)
else:print(white - ma[h-1][w-1]-1)


Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> pii;
int main() {
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
}


Measured memory_bytes: 3604