akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	char str[1001] = { 0 };

	cin.getline(str, 1001);

	while (str[0] != '0') {
		int n = 0;

		for (unsigned int i = 0; i < strlen(str); i++) 
			n += str[i] - '0';

		cout << n << endl;

		cin.getline(str, 1001);
	}

    return 0;
}

Measured memory_bytes: 3100
#include <iostream>

using namespace std;

int main()
{
    int S,h,m,s;

    cin >> S;

    h = S/3600;
    m = (S - h*3600)/60;
    s = (S - h*3600 - m*60);

    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3088
#include <iostream>

using namespace std;

int main() {
    
    int width, height, x, y, r;

    cin >> width >> height >> x >> y >> r;

    if(0 <= x - r && 0 <= y - r) {
        if(width >= x + r && height >= y + r)
            cout << "Yes"<< endl;
        else
            cout << "No"<< endl;
    }else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3076
#include <stdio.h>
int main() {
    int n;
    char suit;
    int num;
    int cards[4][13];
    scanf("%d", &n);
    
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            cards[i][j] = 0;
        }
    }
    
    for (int i = 0; i < 2*n; i++) {
        scanf("%c %d", &suit, &num);
        switch (suit) {
            case 'S':
                cards[0][num-1] = 1;
                break;
            case 'H':
                cards[1][num-1] = 1;
                break;
            case 'C':
                cards[2][num-1] = 1;
                break;
            case 'D':
                cards[3][num-1] = 1;
                break;
        }
    }
    
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            if (cards[i][j] == 0)  {
                switch (i) {
                    case 0:
                        printf("S %d\n", j+1);
                        break;
                    case 1:
                        printf("H %d\n", j+1);
                        break;
                    case 2:
                        printf("C %d\n", j+1);
                        break;
                    case 3:
                        printf("D %d\n", j+1);
                        break;
                }
            }
        }
    }
}


Measured memory_bytes: 2056
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
long compare_int(const void *a, const void *b)
{
    return *(long*)a - *(long*)b;
}
int main()
{
    int n,i;
    long med;
    long a[200001],b[200001],ans=114514,sorrow;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%ld",&a[i]);
        b[i]=a[i]-(i+1);
    }
    qsort(b,n,sizeof(long),compare_int);
    for(i=0;i<n;i++){
    }
    if(n==1){
        printf("0");
    }else{sorrow=0;
    med=b[(n-1)/2];
            for(i=0;i<n;i++){
                            sorrow+=abs(b[i]-med);
                            }
                        ans=sorrow;
        printf("%ld",ans);
        }
    
    return 0;
}


Measured memory_bytes: 4860
#include <iostream>
#include <algorithm>

using namespace std;

int main(){

    int a,b,c,result;
    while(cin>>a>>b>>c,a){
        result = 0;
        for (int i = 1; i < c;i++){
            for (int j = 1; j <= c - i;j++){
                
                if(i<=0||j<=0){
                    break;
                }else{
                    
                    if((i*(100+a))/100+(j*((100+a))/100)==c){
                        //cout << i << " "<<j << endl;
                        result = max(result, (i * ((100 + b) )/ 100) + (j * ((100 + b)) / 100));
                    }
                }
            }
        }
        cout << result << endl;
    }
}



Measured memory_bytes: 3016
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;



int cnt[1000010];
int A[200020];
void solve() {
	int N; cin >> N;
	REP(i, N) {
		cin >> A[i];
		cnt[A[i]]++;
	}
	int ans = 0;
	REP(i, N) {
		int x = A[i];
		if (cnt[x] > 1)continue;
		bool found = false;
		if (A[i]!=1&&cnt[1])continue;
		for (int j = 2; j*j <= x; j++) {
			if (x%j == 0&&(cnt[j]||cnt[x/j])) {
				found = true;
				break;
			}
		}
		if (!found)ans++;
	}
	print(ans);
}




signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//mt.seed((int)(time(0)));
	//REP(_, 10000)test();
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 12880
#include<stdio.h>

int main()
{
	int n, m;
	
	scanf("%d %d", &n, &m);
	
	int sum = n + m + 1;
	
	char str[sum];
	
	scanf("%s", &str);
	
	int ctr = 0;
	for(int i = 0; i < sum; i++){
		if(i == n){
			if(str[i] != '-'){
				printf("No\n");
				return 0;
			}
		}else{
			if(str[i] >= '0' && str[i] <= '9'){
				++ctr;
			}
		}
	}
	if(ctr == n+m){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}

Measured memory_bytes: 1640
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> P;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int N, A, B, ans = 0;
    cin >> N >> A >> B;

    for (int i = 1; i < N + 1; i++) {
        int sum = 0, a = i;
        while (a > 0) {
           sum += a % 10;
           a /= 10;
        }
        if (sum >= A && sum <= B) {
            ans += i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=2e5+5,U=1e6+5,mo=998244353;
int inv[U],f[U],g[U],mu[U],n,i,j,ans,a[N];
int main(){
	for(i=1;i<U;++i)inv[i]=i==1?1:1ll*(mo-mo/i)*inv[mo%i]%mo;
	for(i=mu[1]=1;i<U;++i)for(j=i*2;j<U;j+=i)mu[j]-=mu[i];
	for(i=1;i<U;++i)for(j=1;i*j<U;++j)f[i*j]=(f[i*j]+1ll*mo+inv[i]*mu[j])%mo;
	scanf("%d",&n);for(i=1;i<=n;++i)scanf("%d",a+i),g[a[i]]=(g[a[i]]+a[i])%mo,ans=(ans+mo-a[i])%mo;
	for(i=1;i<U;++i){
		for(j=i*2;j<U;j+=i)g[i]=(g[i]+g[j])%mo;
		ans=(ans+1ll*g[i]*g[i]%mo*f[i]%mo)%mo;
	}
	ans=1ll*ans*inv[2]%mo;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int64_t i = 0; i < (int64_t)(n); i++)
#define NO_ENTRY -2
#define NOT_YET_ANSWERED -1

int myabs(int a, int b) {
  if ( a > b ) {
    return a - b;
  }
  else {
    return b - a;
  }
}

int main() {
  int H, W, D;
  cin >> H >> W >> D;
  vector<int> ii(H*W), jj(H*W);
  rep(i,H) {
    rep(j,W) {
      int A;
      cin >> A;
      ii.at(A-1) = i;
      jj.at(A-1) = j;
    }
  }
  vector<int> d(H*W, 0);
  for(int k = D; k < H*W; k++) {
    d.at(k) = d.at(k-D) 
      			+ myabs(ii.at(k), ii.at(k-D))
      			+ myabs(jj.at(k), jj.at(k-D))
      			;
  }
  
  int Q;
  cin >> Q;
  int L, R;
  rep(q,Q) {
    cin >> L >> R;
    int answer = d.at(R-1) - d.at(L-1);
    cout << answer << endl;
  }
}

Measured memory_bytes: 2176
#include <stdio.h>
int main()
{
  int i=0, l,  p, q, j=0;
  int d[50];
 
  while(1)
    {
      for ( i = 0; i < 50; i++)
    {
      d[i] = 0;
    }   
      scanf("%d %d", &l, &p);
      if( l == 0 && p == 0 ) break;
      q = p;
      while(1)
    {
          if ( i >= l ) i = 0;
      if ( p > 0 )
        {
          d[i] += 1;
          p--;
          if ( d[i] == q && p == 0)
        {
          break;
        }  
        }
      else if ( p == 0 )
        {
          p = d[i];
          d[i] = 0;
        }
      i++;
    }
      printf("%d\n", i);
    }
  return 0;
}

Measured memory_bytes: 2672
var     n:longint;
        a,b:array[1..1000]of longint;

procedure nhap;
var     i:longint;
begin
        readln(n);
        for i:=1 to n do read(a[i]);
end;

procedure xuli;
var     i:longint;
        dem,dem1:longint;
begin
        for i:=1 to n do
            begin
                if (a[i]>=1) and (a[i]<400) then inc(b[1]);
                if (a[i]>=400) and (a[i]<800) then inc(b[2]);
                if (a[i]>=800) and (a[i]<1200) then inc(b[3]);
                if (a[i]>=1200) and (a[i]<1600) then inc(b[4]);
                if (a[i]>=1600) and (a[i]<2000) then inc(b[5]);
                if (a[i]>=2000) and (a[i]<2400) then inc(b[6]);
                if (a[i]>=2400) and (a[i]<2800) then inc(b[7]);
                if (a[i]>=2800) and (a[i]<3200) then inc(b[8]);
                if a[i]>=3200 then inc(b[9]);
            end;
        dem:=0;
        for i:=1 to 8 do
            if b[i]>0 then inc(dem);
        if b[9]=0 then writeln(dem,' ',dem)
        else
            begin
                dem1:=dem+b[9];
                if dem=0 then  write('1 ',dem1)
                else writeln(dem,' ',dem1)
            end;
end;

procedure test;
var     i:longint;
begin
        assign(output,'at_03.inp');rewrite(output);
                randomize;
                n:=random(10);
                writeln(n+1);
                for i:=1 to n+1 do
                        write(random(4000)+1,' ');
        close(output);
end;

begin
        //test;
        //assign(input,'at_03.inp');reset(input);
        //assign(output,'at_04.out');rewrite(output);
                nhap;
                xuli;
end.



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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

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

    int a, b, c, d; cin >> a >> b >> c;
    d = a % b;
    string s = "NO";
    for(int i = 2; d != a * i % b; i++){
        if(a * i % b == c) s = "YES";
        //cout << a * i % b << endl;
    }
    cout << s;
}


Measured memory_bytes: 256
from collections import defaultdict, deque

N, M = map(int, input().split(' '))
edges = defaultdict(set)
for _ in range(M):
    a, b = map(int, input().split(' '))
    edges[a].add(b)
    edges[b].add(a)

queue = deque()
queue.append(1)
results = {}

while len(queue) > 0:
    x = queue.popleft()
    next_nodes = edges[x]
    for node in next_nodes:
        if node not in results.keys():
            results[node] = x
            queue.append(node)

print('Yes')
for i in range(2, N + 1):
    print(results[i])


Measured memory_bytes: 76424
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


/*
* Problem : Count Balls
* Acknowledgement : None
* Author : deathnaught_
* GitHub : www.github.com/DeathNaughT-GitHub
* Complexity : O(1)
*/

public class Main
{

    public static void main(String[] args) 
    {
        FastReader sc = new FastReader();

        String s = sc.next();
      	int count = 0;
      	for (int i = 0; i < 3; i++) {
          if (s.charAt(i) == 'B')
            count++;
        }
      	if (count == 0 || count == 3) {
          System.out.println("No");
          return;
        } 
        System.out.println("Yes");
    }

    static class FastReader 
    { 

        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 

		boolean hasNext()
		{
		    return st == null ? false : true;
		}

        char nextChar()
        {
            return next().charAt(0);
        }
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 

        int[] nextArray(int rows)
        {
            int arr[] = new int[rows];            
            for (int i = 0; i < rows; i++)
            arr[i] = nextInt();
            return arr;
        }

        long[] nextLongArray(int rows)
        {
            long arr[] = new long[rows];            
            for (int i = 0; i < rows; i++)
            arr[i] = nextLong();
            return arr;
        }

        char[] nextCharArray(int rows)
        {
            char arr[] = new char[rows];
            for (int i = 0; i < rows; i++)
            arr[i] = next().charAt(0);
            return arr;
        }

        int[][] nextMatrix(int rows, int columns)
        {
            int mat[][] = new int[rows][columns];
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                {
                    mat[i][j] = nextInt();
                }
            }
            return mat;
        }
    } 

}

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


int main(){


    int w, h, x, y;

    int t = 0;

    double s;


    cin >> w >> h >> x >> y;


    s = (double)w * (double)h / 2;


    if( 2 * x == w && 2 * y == h ) t = 1;


    cout << fixed << setprecision(9);

    cout << s << " " << t << endl;

    
    return 0;


    }


Measured memory_bytes: 256
// #include "frog_1.h"
#include <cmath>
#include <limits>
#include <vector>

#include <iostream>

using Memo = std::vector<int>;

int min_jump_cost(const std::vector<int>& stones)
{
    std::vector<int> dp(stones.size(), 0);
    dp[1] = std::abs(stones[1] - stones[0]);

    for (size_t i = 2; i < stones.size(); ++i) {
        dp[i] = std::min(std::abs(stones[i - 1] - stones[i]) + dp[i - 1],
                         std::abs(stones[i - 2] - stones[i]) + dp[i - 2]);
    }
    return dp.back();
}

int main(int argc, char* argv[])
{
    size_t n;
    std::cin >> n;
    std::vector<int> stones(n);
    for (size_t i = 0; i < n; ++i) {
        int height;
        std::cin >> height;
        stones[i] = height;
    }
    std::cout << min_jump_cost(stones) << std::endl;
    return 0;
}


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

int main() {
  int n; cin >> n;
  vector<int> c(n), s(n), f(n);
  for (int i = 0; i < n-1; i ++) cin >> c[i] >> s[i] >> f[i];

  int t;
  for (int i = 0; i < n; i ++) {
    t = 0;
    for (int j = i; j < n-1; j ++) {
      if (t < s[j]) t = s[j];
      else if (t % f[j] == 0);
      else t = t + f[j] - (t%f[j]);
      t += c[j];
    }
    cout << t << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    string a;
    cin >> a;
    int n = a.size();
    int dp[n + 2];
    fill(dp, dp + n + 2, INF);
    dp[n + 1] = 0;
    int nxt[n + 1][26];
    fill(nxt[0], nxt[n + 1], n);
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 26; j++) {
            nxt[i][j] = nxt[i + 1][j];
        }
        nxt[i][a[i] - 'a'] = i;
        for (int j = 0; j < 26; j++) {
            dp[i] = min(dp[i], dp[nxt[i][j] + 1] + 1);
        }
    }
    string ans;
    int cur = 0;
    while(cur < n){
        for (int i = 0; i < 26; i++){
            if(dp[cur] == dp[nxt[cur][i] + 1] + 1){
                ans.push_back('a' + i);
                cur = nxt[cur][i] + 1;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 24824
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 30
#define MAX_D 400

    /*
    いろいろ
    int x = rand()%100;
    double x = (double)rand()/RAND_MAX;
    mt19937 get_rand_mt;
    shuffle(vec.begin(), vec.end(), get_rand_mt);
    int dx[4] = {-1, 0, 1, 0};
    int dy[4] = {0, -1, 0, 1};
    char cc[4] = {'U','L','D','R'};
    */

int D;
int c[MAX_N];
int s[MAX_D][MAX_N];
int ma;
int ans[MAX_D];

int calc(){
    int las[26] = {};
    int res = 0;
    rep(i,D){
        res += s[i][ans[i]];
        las[ans[i]] = i;
        rep(j,26){
            res -= (i - las[j]) * c[j];
        }
    }
    return res;
}

int main() {
    srand((unsigned) time(NULL));
    clock_t start,end;
	start = clock();


    string fileNameIfs = "input_1.txt";
    const char* cstrIfs = fileNameIfs.c_str();
    ifstream ifs(cstrIfs);
    if(!ifs.is_open()){ // 標準入力する
        cin >> D;
        rep(i,26)cin >> c[i];
        rep(i,D)rep(j,26)cin >> s[i][j];
    }else{ // ファイル入力する
        ifs >> D;
        rep(i,26)ifs >> c[i];
        rep(i,D)rep(j,26)ifs >> s[i][j];
    }    
    

    rep(i,D){
        int max_s = -1;
        int arg = -1;
        rep(j,26){
            if(s[i][j] > max_s){
                max_s = s[i][j];
                arg = j;
            }
        }
        ans[i] = arg;
    }

    ma = calc();

    start = clock();
    while(true){
        int x = rand()%D;
        int y = rand()%26;

        int keep = ans[x];
        ans[x] = y;

        int tmp = calc();

        if(tmp >= ma){
            ma = tmp;
        }else{
            ans[x] = keep;
        }

        end = clock();
        if((double)(end-start)/CLOCKS_PER_SEC > 1.7)break;
    }


    rep(i,D){
        cout << ans[i] + 1 << endl;
    }

    string fileName = "sample_out1.txt";
    const char* cstr = fileName.c_str();
    ofstream ofs(cstr);
    rep(i,D){
        ofs << ans[i] + 1 << endl;
    }
    ofs.close();

    return 0;
}
 
 


Measured memory_bytes: 3724
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

x = ini()

if x == 0:
    print(1)
else:
    print(0)

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

int main(){
    int n, k;
    cin >> n >> k;
    int64_t h[300000];
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    std::sort(h, h + n, std::greater<>());
    int64_t ans = 0;
    for(int i=k; i<n; i++){
        ans += h[i];
    }
    cout << ans << endl;
    return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint n,m;
    cin >> n>>m;
    lint time = 1900 * m + (n - m) * 100;
    double ac = pow((0.5), m);
    double ans=0;
    ans = time / (ac);
    cout << ans <<"\n";

    return 0;
}

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

int main(){
  int x, a, b;
  cin >> x >> a >> b;
  
  if(abs(a - x) > abs(b - x)){
    cout << 'B' << endl;
  } else {
    cout << 'A' << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
///#pragma GCC optimize("Ofast")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
///#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
///#include<ext/pb_ds/assoc_container.hpp>
///#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
///using namespace __gnu_pbds;
///template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vii> vvii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll N = 10001;
const ll MOD = 1000000007;
const ll INF = LLONG_MAX;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rev(a) reverse(all(a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define space ' '
#define nl '\n'
#define PI acos(-1)

#define coutv(v) for(auto it:v)cout<<it<<space;cout<<nl;
#define cinv(v) for(auto &it:v)cin>>it;


int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int tc=1,cs=0;
    ///cin>>tc;
    while(tc--)
    {
        double r;
        cin>>r;
        cout<<fixed<<setprecision(20)<<2*PI*r<<nl;
    }
}


Measured memory_bytes: 3796
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main(){
  int N, M; 
  cin >> N >> M;
  vector<int> a(N);
  rep(i,N) cin >> a[i];
  map<int, ll> num;
  vector<int> s(N+1);
  num[0]++;
  for(int i=1; i<=N; i++){
    s[i] = (s[i-1]+a[i-1])%M;
    num[s[i]]++;
  }
  ll ans=0;
  for(auto it=num.begin(); it!=num.end(); it++)
    ans += it->second*(it->second-1)/2;
  cout << ans << endl;
}

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

int main() {
  int a,b,c,d;
  cin >>a>>b>>c>>d;
  string result;
  
  if (a+b==c+d) result = "Balanced";
  else if (a+b > c+d) result ="Left";
  else result = "Right";
 
  cout << result;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int  b[100000] ;
long dp[100000];

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


Measured memory_bytes: 1408
#include <algorithm>
#include <cstdio>
using namespace std;
int n = 0, k = 0;
int p[1007];
int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++i)
		scanf("%d", p + i);
	sort(p + 1, p + n + 1);
	int sum = 0;
	for (int i = 1; i <= k; ++i)
		sum += p[i];
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
struct SEG{
    ll seg[1<<19];
    SEG(void){for(int i=0;i<1<<19;i++)seg[i]=0;}
    void up(int a,ll x){
        a+=(1<<18)-1;
        seg[a]=max(seg[a],x);
        while(a){
            a=(a-1)/2;
            seg[a]=max(seg[a*2+1],seg[a*2+2]);
        }
    }
    ll que(int a,int b,int l,int r,int k){
        if(r<a||b<l)return 0;
        if(a<=l&&r<=b)return seg[k];
        return max(que(a,b,l,(l+r-1)/2,k*2+1),que(a,b,(l+r+1)/2,r,k*2+2));
    }
};
ll n,h[200005],a[200005];
SEG seg;
int main(void){
    scanf("%lld",&n);
    for(int i=0;i<n;i++)scanf("%lld",h+i);
    for(int i=0;i<n;i++)scanf("%lld",a+i);
    for(int i=0;i<n;i++){
        seg.up(h[i],seg.que(0,h[i]-1,0,(1<<18)-1,0)+a[i]);
    }
    printf("%lld\n",seg.que(0,n,0,(1<<18)-1,0));
}


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

int n, ch_cnt = 0;

int main() {
    cin >> n;
    int A[n];
    for (int i = 0; i < n; i++) cin >> A[i];
    
    for (int i = 0; i < n; i++) {
        int minj = i;
        
        for (int j = i + 1; j < n; j++) {
            if (A[j] < A[minj]) {
                minj = j;
            }
        }
        if (i != minj) ch_cnt++;
        swap(A[i], A[minj]);
    }
    
    for (int i = 0; i < n - 1; i++) cout << A[i] << " ";
    cout << A[n - 1] << endl;
    cout << ch_cnt << endl;
        
    return 0;
}


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

int main() {
  int N, c=0, l, r;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    c = c + r - l + 1;
  }
 
  cout << c << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
    int A,B,hasil;
    scanf("%d %d", &A, &B);
    
    if (A<10){
        hasil = B + 100 * (10 - A);
    }
    else{
        hasil = B;
    }
    
	printf("%d",hasil);
 
    return 0;
}

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

int main()
{
  int n; cin >> n;
  ll a[n];
  rep(i,n){
    cin >> a[i];
  }
  sort(a,a+n);
  int b,ans=0;
  bool p = false;
  rep(i,n){
    if(i==0){
      b = a[i];
      p = !p;
      continue;
    }
    if(a[i] == b) p = !p;
    else {
      if(p) ans++;
      p = true;
    }
    b = a[i];
  }
  if(p) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4420
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007ll
using namespace std;
int ara[200005];
ll bigmod(ll b, ll p)
{
    if(!p)return 1ll;
    ll ret= bigmod(b, p>>1);
    ret= (ret*ret)%mod;
    if(p&1ll)ret= (ret*b)%mod;
    return ret;
}
int main()
{
    int n, k, res= 1;
    scanf("%d %d", &n, &k);
    int neg= 0, z= 0;
    for(int i=1; i<=n; i++)
    scanf("%d", &ara[i]), z+= (ara[i]==0), neg+= (ara[i]<0);
    if(k==n || (neg==n && k&1))
    {
        sort(ara+1, ara+1+n, greater<int>());
        for(int i=1; i<=k; i++)
        res= (1LL*res*ara[i])%mod;
        if(res<0)res+= mod;
        printf("%d\n", res);
    }
    else if((n-z)<k || (z && (n-z)==k && (neg&1)) || (z && !(n-z-neg) && (k&1)))puts("0");
    else
    {
        vector<int>vp, vn;
        for(int i=1; i<=n; i++)
        if(ara[i]!=0)
        {
            if(ara[i]>0)vp.push_back(ara[i]);
            else vn.push_back(-ara[i]);
        }
        sort(vp.begin(), vp.end());
        sort(vn.begin(), vn.end());
        int lp= 0, ln= 0, c= 0;
        for(int i=1; i<=k; i++)
        {
            if(!vp.empty() && (vn.empty() || vp.back()>vn.back()))
            lp= vp.back(), vp.pop_back(), res= (1LL*res*lp)%mod;
            else ln= vn.back(), vn.pop_back(), res= (1LL*res*ln)%mod, c++;
        }
        if(c&1)
        {
            if(!vp.empty() && !vn.empty())
            {
                if(!lp)res= ((1LL*res*bigmod(ln, mod-2))%mod * 1LL*vp.back())%mod;
                else if((1LL*ln*vn.back())>(1LL*lp*vp.back()))
                res= ((1LL*res*bigmod(lp, mod-2))%mod * 1LL*vn.back())%mod;
                else res= ((1LL*res*bigmod(ln, mod-2))%mod * 1LL*vp.back())%mod;
            }
            else
            {
                if(vp.empty() && !vn.empty() && lp)res= ((1LL*res*bigmod(lp, mod-2))%mod * 1LL*vn.back())%mod;
                else if(!vp.empty() && ln)res= ((1LL*res*bigmod(ln, mod-2))%mod * 1LL*vp.back())%mod;
            }
            if(res<0)res+= mod;
        }
        printf("%d\n", res);
    }
    return 0;
}


Measured memory_bytes: 5112
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int N, res; cin >> N;
    int d[N];
    res = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }
    for (int i = 0; i < N - 1; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            res += (d[i] * d[j]);
        }
    }
    cout << res << endl;
	return 0;
}

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

using namespace std;

#define rep(i, a, b) for(auto (i)=a;i<b;i++)
#define list(i, N) for(auto (i)=0;i<N;i++)

typedef long long ll;
typedef vector <ll> vi;
typedef pair <ll, ll> pi;
#define mp make_pair
#define pb push_back
#define eb emplace_back

#define int ll
#define INF 1e18+5
#define mod 1000000007

template<class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int a, p; cin >> a >> p;
  	a *= 3;
  int sum = a+p;
  cout << sum/2 << "\n";

    return 0;
}

Measured memory_bytes: 384
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int L = s.length();
    
    for (int i=0;i<L-1;i++){
      if (s.charAt(i) ==s.charAt(i+1)){
        System.out.print(i+1);
        System.out.print(" ");
        System.out.print(i+2);
        return;
      }
    }
    for (int i=0;i<L-2;i++){
      if (s.charAt(i) ==s.charAt(i+2)){
        System.out.print(i+1);
        System.out.print(" ");
        System.out.print(i+3);
        return;
      }
    }
    System.out.println("-1 -1");

  }
}

Measured memory_bytes: 24180
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    int n, k;
    cin >> k >> n;
    int a[n];
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    int max_val = a[0];
    for (int i=0; i<n-1; i++) {
        if (max_val < abs(a[i] - a[i+1])) max_val = abs(a[i] - a[i+1]);
    }
    max_val = max(max_val, k-a[n-1]+a[0]);
    cout << k - max_val << endl; 
   
    return 0;
}

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

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

Measured memory_bytes: 256
#include <stdio.h>

int a[100000];

int lower_bound(int lb, int ub, int k) {
	int m;
	while (ub - lb > 1) {
		m = (lb + ub) >> 1;
		if (a[m] < k) {
			lb = m;
		}
		else {
			ub = m;
		}
	}
	return ub;
}

int upper_bound(int lb, int ub, int k) {
	int m;
	while (ub - lb > 1) {
		m = (lb + ub) >> 1;
		if (a[m] <= k) {
			lb = m;
		}
		else {
			ub = m;
		}
	}
	return ub;
}

int main(void)
{
	int n, q, k, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", a + i);
	}
	scanf("%d", &q);
	while (q--) {
		scanf("%d", &k);
		printf("%d %d\n", lower_bound(-1, n, k), upper_bound(-1, n, k));
	}
	return 0;
}



Measured memory_bytes: 2188
#include <iostream>
using namespace std;
static const int MAX=20;

int main(void){
    int n,ans=0;
    int p[MAX];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> p[i];
    }
    for(int i=1; i<n-1; i++){
        if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i+1]<p[i] && p[i]<p[i-1])) ans+=1;
    }
    cout << ans;
    return 0;
}

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

using namespace std;

typedef pair<int, int> P;

const int MAX_V = 100000;

vector<int> G[MAX_V];
int color[MAX_V];
vector<int> memo;

void bfs(int v, int d, int c, vector<bool>& used) {
	queue<P> que;
	que.push(P(v, d));
	while (!que.empty()) {
		int cur, dist;
		tie(cur, dist) = que.front();
		que.pop();
		if (memo[cur] >= dist) continue;
		used[cur] = true;
		if (color[cur] == 0) color[cur] = c;
		memo[cur] = dist;
		if (dist == 0) continue;
		for (int nex : G[cur]) {
			if (used[nex]) continue;
			que.push(P(nex, dist - 1));
		}
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	int q;
	cin >> q;

	vector<int> v(q), d(q), c(q);

	for (int i = 0; i < q; i++) {
		cin >> v[i] >> d[i] >> c[i];
		v[i]--;
	}

	memo.resize(n, -1);
	for (int i = q - 1; i >= 0; i--) {
		vector<bool> used(n, false);
		bfs(v[i], d[i], c[i], used);
	}

	for (int i = 0; i < n; i++) cout << color[i] << endl;
	return 0;
}

Measured memory_bytes: 8960
x = int(input())
if x >= 400 and x < 600:
    print(8)
elif x >= 600 and x < 800:
    print(7)
elif x >= 800 and x < 1000:
    print(6)
elif x >= 1000 and x < 1200:
    print(5)
elif x >= 1200 and x < 1400:
    print(4)
elif x >= 1400 and x < 1600:
    print(3)
elif x >= 1600 and x < 1800:
    print(2)
else:
    print(1)


Measured memory_bytes: 9116
#include <algorithm>
#include <iostream>
#include <limits>
#include <utility>
#include <vector>

using namespace std;


int main() {
  long N, W;
  cin >> N >> W;
  
  vector<pair<long, long>> weight_values;
  weight_values.reserve(N);
  
  for (size_t n = 0; n < N; ++n) {
    long w, v;
    cin >> w >> v;
    weight_values.push_back(make_pair(w, v));
  }
  vector<vector<long>> dp(N+1, vector<long>(100001, -1));
  for (vector<long>& vec : dp) vec[0] = 0;
  long ans = 0;

  for (size_t n = 0; n < N; ++n) {
    size_t idx = n % 2;
    for (long v = 1; v <= 100000; ++v) {
      long w = W + 1;
      if (weight_values[n].second <= v) {
        long pre = dp[n][v - weight_values[n].second];
        if (pre != -1) {
          long preval = numeric_limits<long>::max();
          if (dp[n][v] != -1) preval = dp[n][v];
    	  w = min(preval, pre + weight_values[n].first);
        } 
      }
      if (w == W +1 && dp[n][v] != -1) {
        w = dp[n][v];
      }
      if (w <= W) {
        ans = max(ans, v);
        dp[n+1][v] = w; 
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 80256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

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

        public static void swap(ref long x,ref long y)
        {
            var tmp = x;
            x = y;
            y = tmp;
        }
        

        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var n = Read();
            var work = new long[n][];
            for (int i = 0; i < n; i++)
            {
                var input = Reads();
                work[i] = new long[2];
                work[i][0] = input[0];
                work[i][1] = input[1];
            }
            Array.Sort(work, (a, b) => (int)(a[1] - b[1]));
            long time = 0;
            bool f = true;
            for (int i = 0; i < n; i++)
            {
                time += work[i][0];
                if (work[i][1] < time) f = false;
            }
            Console.WriteLine(f ? "Yes" : "No");


            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class86
    {
        static void Main()
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NM[0], M = NM[1];
            HashSet<int> a = new HashSet<int>();
            HashSet<int> b = new HashSet<int>();
            List<Tuple<int, int>> s = new List<Tuple<int, int>>();
            
            for(int i = 0; i < M; i++)
            {
                var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (r[0] == 1)
                {
                    if (!a.Contains(r[1])) a.Add(r[1]);
                    
                }
                else if (r[1] == N)
                {
                    if (!b.Contains(r[0])) b.Add(r[0]);
                }
            }
            foreach(int i in a)
                if (b.Contains(i))
                {
                    Console.WriteLine("POSSIBLE");return;
                }

            Console.WriteLine("IMPOSSIBLE");
        }
    }
}


Measured memory_bytes: 23576
N,M,K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)

a = [0]
b = [0]
A.each_with_index do |n,i|
  a << a[i] + n
end
B.each_with_index do |n,i|
  b << b[i] + n
end

ans = 0
j = M

0.upto(N) do |i|
  if a[i] > K
    break
  end

  while b[j] > K - a[i] do
    j -= 1
  end
  c = i + j
  ans = c if c > ans
end

puts ans


Measured memory_bytes: 44920
/*


*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define MAXIN 300000
#define gc() (SS==TT&&(TT=(SS=IN)+fread(IN,1,MAXIN,stdin),SS==TT)?EOF:*SS++)
typedef long long LL;
const int N=2e5+5;

LL s[N];
char IN[MAXIN],*SS=IN,*TT=IN;

inline int read()
{
	int now=0;register char c=gc();
	for(;!isdigit(c);c=gc());
	for(;isdigit(c);now=now*10+c-48,c=gc());
	return now;
}

int main()
{
	const int n=read(); LL X=read(),ans=X*n;
	for(int i=1,a; i<=n; ++i) s[i]=s[i-1]+(a=read()), ans+=5ll*a;
	for(int k=1; k<n; ++k)
	{
		LL tmp=X*k;
		for(int i=n,j,t=1; i; i=j,++t)
		{
			j=std::max(i-k,0);
			tmp+=(s[i]-s[j])*std::max(5ll,t*2+1ll);
			if(tmp>ans) break;
		}
		ans=std::min(ans,tmp);
	}
	printf("%lld\n",ans+X*n);

	return 0;
}

Measured memory_bytes: 2048
As = []
for i in range(5):
    x = int(input())
    if x%10 != 0:
        time_b = (x//10 + 1)*10
    else:
        time_b = (x//10 )*10

    amari  = x%10
    if amari == 0:
        amari = float('inf')
    As.append((amari, x, time_b))

As = sorted(As, key=lambda x:x[0])
#print(As)
#print([x[2] for x in As[1:] if x[2] != 0])
sumed = sum([x[2] for x in As[1:] if x[2] != 0 ])

print(sumed + As[0][1])

Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	Int n,sum;
	while(n=in()){
		if(n==1){
			cout<<"deficient number"<<endl;
			continue;
		}
		sum=1;
		Int div;
		for(div=2;div*div<n;div++){
			if(n%div==0){
				if(div*div==n) sum+=div;
				else sum+=div+n/div;
			}
		}
		if(sum<n)cout<<"deficient number"<<endl;
		else if(sum==n)cout<<"perfect number"<<endl;
		else cout<<"abundant number"<<endl;
	}
	return 0;
}

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

int a[111];
int main() {
    int n, m, s = 0, c = 0;
    cin >> n >> m;
    for(int i = 0; i < n; i++)
        cin >> a[i], s += a[i];
    for(int i = 0; i < n; i++)
        if(a[i] * m * 4 >= s)
            c++;
    cout << (c < m ? "No" : "Yes") << endl;
    return 0;
}


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

v=[int(i) for i in input().split()]
d=[]
ans=[]

for i in range(min(N,K)+1):
    for j in range(i+1):
                
        for k in range(j):
            d.append(v[k])

        for l in range(i-j):
            d.append(v[len(v)-(l+1)])
        
#        print(d)
        for m in range(K-i):
            if len(d)>=1:
                d.sort(reverse=True)
                if d[len(d)-1]<0:
                    d.pop()
#        print(d)
        ans.append(sum(d))
        d=[]

print(max(ans))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,a,b) \
for(ll i=ll(a);i<=ll(b);i++)
#define DEP(i,a,b) \
for(ll i=ll(a);i>=ll(b);i--)
#define TR(c, it) \
for (auto it = (c).begin(); it != (c).end(); it++)
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  
  int T;
  T=1;
  while(T--)
  {
      ll n,i,j,k,l,m,a,b,c,d,e,x,y;
      cin>>x>>n;
      ll p[n];
      m=102;
      REP(i,0,n-1)cin>>p[i];
      ll vis[102]={0};
      REP(i,0,n-1)vis[p[i]]=1;
      REP(i,0,101){
        if(vis[i]==0){
          if(abs(x-i)<m){
            j=i;
            m=abs(x-i);
          }
        }
      }
      cout<<j;
      
  }
  return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */


int main() {
    int a, b;
    cin >> a >> b;
    int bcnt;
    if(b < 10) bcnt = 1;
    else if(b < 100) bcnt = 2;
    else bcnt = 3;
    int ans = a * pow(10, bcnt) + b;
    rrep(i, ans) {
        if(i * i == ans) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    
    return 0;
}

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

int cnt[26];

int main() {
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int k; cin >> k;
    for (int i = 0; i < n; ++i) {
        string s; cin >> s;
        ++cnt[s[0] - 'A'];
    }
    int res = 0;
    while (true) {
        sort(cnt, cnt + 26);
        for (int i = 25; i >= 26 - k; --i) {
            if (cnt[i]-- == 0) {
                cout << res << endl;
                return 0;
            }
        }
        ++res;
    }
    return 0;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 998244353;
const double EPS = 1e-10;

const int mod = 998244353;
struct mint {
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
int main() {
    int N;
    cin >> N;
    vector<int> D(N, 0);
    int maxDist = -1;
    rep(i, N) {
        cin >> D[i];
        maxDist = max(maxDist, D[i]);
    }
    if (D[0] != 0) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> cntOfDist(100000 + 1, 0);
    rep(i, N) { cntOfDist[D[i]]++; }
    if ( cntOfDist[0] != 1) {
        cout << 0 << endl;
        return 0;
    }

    mint ans = 1;
    for (int dist = 1; dist <= maxDist; dist++) {
        mint cntPrev = cntOfDist[dist - 1];
        mint cntCur  = cntOfDist[dist];
        ans *= cntPrev.pow(cntCur.x);
    }
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 1024
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
ArrayDequeではpopとpushはStackと同じ操作になる
//import static java.lang.System.*; はしばらく使わなそう
最後にout.flush()をするのを忘れずに！
*/
//入力終了→Ctrl+D
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.geom.Point2D;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        PrintWriter out = new PrintWriter(System.out);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int d = sc.nextInt();
        int[][] a = new int[h][w];
        int[] point = new int[90001];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                a[i][j] = sc.nextInt();
                point[a[i][j]] = i * w + j;
            }
        }
        long[] ds = new long[h * w + 1];
        for (int i = 1; i <= h * w; i++) {
            if (i > d) ds[i] = ds[i - d] + abs(point[i] / w - point[i - d] / w) + abs(point[i] % w - point[i - d] % w);
        }
        int q = sc.nextInt();
        for (int i = 0; i < q; i++) {
            int l = sc.nextInt();
            int r = sc.nextInt();
            out.println(ds[r] - ds[l]);
        }
        out.close();
    }

    static class sc {
        static Scanner s = new Scanner(System.in);

        static String next() {
            return s.next();
        }

        static int nextInt() {
            return Integer.parseInt(s.next());
        }

        static long nextLong() {
            return Long.parseLong(s.next());
        }

        static double nextDouble() {
            return Double.parseDouble(s.next());
        }
    }
}

Measured memory_bytes: 64424
#include <iostream>
#include <string>

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

  s[0] = '2';
  s[1] = '0';
  s[2] = '1';
  s[3] = '8';



  std::cout << s << std::endl;


  return 0;
}


Measured memory_bytes: 256