akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
  scanf("%d %d %d", a1, a2, a3);
  return 0;
}

enum type {
    COMMAND_UPDATE,
    COMMAND_FIND_MIN,
};

// 65536*2
#define NUM_MAX (1<<17)
#define QUERY_MAX 100000
#include <limits.h>
#define INF INT_MAX

void init_segtree(int *seg, int num) {
    int i;
    for(i = 0; i < num*2; i++) seg[i] = INF;
}

struct range {
    int start;
    int end;
};

int is_contain(struct range elem, struct range box) {
    return box.start <= elem.start && elem.end <= box.end;
}

int is_overlap(struct range r1, struct range r2) {
    return r1.start <= r2.end && r2.start <= r1.end;
}

int find_min(int *seg, struct range r, int node, struct range cur) {
#ifdef DEBUG
    printf("find_min: %d: %d-%d <= %d-%d\n", node, r.start, r.end, cur.start, cur.end);
#endif
    if(!is_overlap(cur, r)) return INF;
    if(is_contain(cur, r)) {
        return seg[node];
    } else {
        struct range left = {cur.start, (cur.start+cur.end)/2};
        struct range right = {(cur.start+cur.end)/2 + 1, cur.end};
        int v1 = find_min(seg, r, node*2, left);
        int v2 = find_min(seg, r, node*2+1, right);
        return min(v1, v2);
    }
}

void update(int *seg, int num, int idx, int x) {
    int node = num+idx;
#ifdef DEBUG
    printf("update(seg, %d, %d, %d) -> update node: %d\n", num, idx, x, node);
#endif
    seg[node] = x;
    while((node = node/2)) {
        int left = node*2;
        int right = node*2+1;
        seg[node] = min(seg[left], seg[right]);
    }
#ifdef DEBUG
    int i;
    for(i = num; i < 2*num; i++) {
        printf(" %d", seg[i] == INF ? -1 : seg[i]);
    }
    putchar('\n');
#endif
    return;
}

#define ROOT_NODE 1

int main(void) {
    int _num, queries;
    get_int2(&_num, &queries);
    int num = 1;
    while(_num > num) num*=2;
#ifdef DEBUG
    printf("num: %d\n", num);
#endif
    static int ans[QUERY_MAX];
    int aidx = 0;
    int i;
    struct range whole = {0, num-1};
    static int seg[NUM_MAX*2];
    init_segtree(seg, num);
    for(i = 0; i < queries; i++) {
        int type; int arg1, arg2;
        get_int3(&type, &arg1, &arg2);
        switch(type) {
            case COMMAND_UPDATE:
                {
                    int idx = arg1; int x = arg2;
                    update(seg, num, idx, x);
                }
                break;
            case COMMAND_FIND_MIN:
                {
                    struct range r = {arg1, arg2};
                    ans[aidx++] = find_min(seg, r, ROOT_NODE, whole);
                }
                break;
            default:
                break;
        }
    }

    for(i = 0; i < aidx; i++) {
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 3016
from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque([(Ch, Cw)])
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]

while True:
  # 移動A
  stemp = set()
  while len(d) != 0:
    Th, Tw = d.popleft()
    # s.add((Th, Tw))
    stemp.add((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
        d.append(_p)
        visited[_h][_w] = 1
  # 移動B
  ans += 1
  for Th,Tw in stemp:
    for i in range(-2, 3) :
      for j in range(-2, 3) :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
          visited[Th][Tw] = 1
  if len(d) == 0:
    print('-1')
    exit()


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

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var w = Array.ConvertAll(line, int.Parse);
        Array.Sort(w);  Array.Reverse(w);
        var a = new List<int>();
        var b = new List<int>();
        var p = 0;
        while (true)
        {
            if (p > n - 1) break;
            a.Add(w[p]);
            p++;
            if (p > n - 1) break;
            b.Add(w[p]);
            p++;
        }
        Console.WriteLine(a.Sum() - b.Sum());
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <stdlib.h>
#define N 100
#define Y 1000
int main(){
  int i,j,k,v,A[N],n;
  scanf("%d",&n);
  if(n>N)exit(8);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(A[i]>Y || A[i]<0)exit(8);
  }
  for(i=1;i<=n;i++){
    for(k=0;k<n;k++){
      if(k==n-1)printf("%d",A[k]);
      else printf("%d ",A[k]);
    }
    printf("\n");
    v=A[i];
    j=i-1;
    while (j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
    }
  }
  return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define nl ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()

using namespace std;

int main() {
    nl // 163 braces

    int ab, bc, ca;
    cin >> ab >> bc >> ca;
    cout << ab*bc/2;

    return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>
int main(void){
    int H, W, i;
    for(i=0; i>=0; i++){
        scanf("%d" "%d", &H, &W);
        if( H==0 && W==0){
            break;
        }
        int j, k;
        for(j=0; j<H; j++){
            for(k=0; k<W; k++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2036
<?php
fscanf(STDIN, "%d", $N);
fscanf(STDIN, "%d", $K);
$x = explode(" ", trim(fgets(STDIN)));

$ans = 0;
foreach ($x as $v) {
    $ans += min($v, $K - $v);
}

echo ($ans * 2) . "\n";


Measured memory_bytes: 4728
#include <iostream>

using namespace std;

int main()
{
    string str = "";
    int min_n = 10000;
    cin >> str;
    for (int i = 0; i < str.length() - 2; i++)
    {
        string substr = str.substr(i, 3);
        int n = abs(stoi(substr)-753);
        if(min_n > n){
            min_n = n;
        }
    }
    cout << min_n;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		int x=scanner.nextInt();
		int m[]=new int [n];
		
		for(int i=0;i<n;i++) {
			m[i]=scanner.nextInt();
			x-=m[i];
		}
		Arrays.sort(m);
		
		System.out.println(x/m[0]+n);
	}
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
#define itn int

int main(void){
    int n;
    cin >> n;
    int a[n];
    long long sum = 0;
    
    for(int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i]-1;
    }
    
    cout << sum << endl;
}

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

 int main (void) {
    int x;
    
    //printf("1~3000までの整数を入力してください\n");
     scanf("%d",&x);
    
    if(x<1 || x>3000){
    printf("1~3000までの整数を入力してください");
    exit(0);
    }
      
    if(x<1200){
    printf("ABC\n");
    return 0;
    }else{
    printf("ARC\n");
    return 0;
    }
   }

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

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

    if (abs(a - b) % 2 != 0)
    {
        cout << "IMPOSSIBLE" << endl;
    }
    else
    {
        cout << (a + b) / 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        for (int i = 0; i < n; i++) {
            if (array[i] % 2 == 0 && array[i] % 3 != 0 && array[i] % 5 != 0) {
                System.out.println("DENIED");
                return;
            }
        }
        
        System.out.println("APPROVED");
        
    }
} 

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define _boost ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define fi first
#define se second
#define clz __builtin_clz
#define clzll __builtin_clzll
#define bp __builtin_popcount
#define _unique(x) sort((x).begin(),(x).end()),(x).erase(unique((x).begin(), (x).end()),(x.end()))
#define all(x) (x).begin(),(x).end()
#define _rand(i,j) uniform_int_distribution<int>(i, j)(rng___)
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;
template < typename _T, typename _T2> string to_string(pair<_T,_T2> x) {return "<"+to_string(x.fi)+", "+to_string(x.se)+">";}
template < typename _T> string to_string(vector<_T> vec) {string s="[ "; for(auto el:vec)s+=to_string(el)+", "; s[s.size()-1]=']';s[s.size()-2]=' '; return s;}
template < typename _T> string to_string(set<_T> vec) {string s="{ "; for(auto el:vec)s+=to_string(el)+", "; s[s.size()-1]='}';s[s.size()-2]=' '; return s;}
template < typename _T, typename _T2> string to_string(map<_T,_T2> vec) {string s="{ "; for(auto el:vec)s+="mp["+to_string(el.fi)+"]= "+to_string(el.se)+", "; s[s.size()-1]='}';s[s.size()-2]=' '; return s;}
template < typename _T > inline void _DBG(const char *s, _T x){cerr << s << " = " << to_string(x) << "\n";}
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a){while(*s != ',') cerr << *s++;cerr << " = " << to_string(x) << "\n";_DBG(s + 1, a...);}
#ifdef LOCAL
#define _print(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define _print(...) ;//cout<<2;//(__VA_ARGS__)
#endif
mt19937 rng___(chrono::steady_clock::now().time_since_epoch().count());


const LL MOD = 998244353;//1e9+7;
const LL LLINF = 1e18+7;
const int N=1e5+8;


int main()
{
    _boost;
    int n,w;
    cin>>n>>w;
    vector<PLL> items(n);
    for(int i=0;i<n;i++)cin>>items[i].fi>>items[i].se;
    vector<LL> besttake(N,LLINF);
    besttake[0]=0;
    LL maxi=0;
    for(int i=0;i<n;i++)
    {
        for(int j=N-1-items[i].se;j>=0;j--)
        {
            besttake[j+items[i].se]=min(besttake[j+items[i].se],besttake[j]+items[i].fi);
            if(besttake[j+items[i].se]<=w)maxi=max(maxi,j+items[i].se);
        }
    }
    cout<<maxi;
}




Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	
	int a, b;
	char op;
	
	
	while(1){
		
		scanf("%d %c %d",&a ,&op ,&b);
		
			if(op == '?')break;
			
			if(op == '+'){
				printf("%d\n",a + b);
			}
	
			if(op == '-'){
				printf("%d\n",a - b);
			}
	
			if(op == '*'){
				printf("%d\n",a * b);
			}
	
			if(op == '/'){
				printf("%d\n",a / b);
			}
	
		
	}
	
	
	return 0;
}
// int ??´??°
// char ??????
// double ???????°???°???
/*d = a / b;
r = a % b;
f = 1.0 * a / b;
// f = (double)a / b;*/

Measured memory_bytes: 600
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
char in[4];
int main(){
	scanf("%s",in);std::sort(in,in+3);if(in[0]=='a'&&in[1]=='b'&&in[2]=='c')printf("Yes\n");else printf("No\n");
}

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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        s: chars
    }
    let n = s.len();
    let mut ans = 0;
    for i in 0..n {
        let pre = if i == 0 {
            0
        } else {
            i - 1
        };
        for j in i + 1..n + 1 {
            let pos = if j == n {
                0
            } else {
                n - j - 1
            };
            let t = s[i..j].iter().cloned().collect::<String>().parse::<usize>().unwrap();
            ans += t * (1 << (pre + pos));
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys 
import random
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
D = int(readline())
C = list(map(int,readline().split()))
score = []
t = []
for i in range(D):
    s = list(map(int,readline().split()))
    max_ind = s.index(max(s)) + 1
    t.append(max_ind)
    score.append(s)

M = 100

d = [random.randint(1, D) for i in range(M)]
q = [random.randint(1, 26) for i in range(M)]
max_S = -float('inf')
for i in range(0,M,2):
    t[d[i]-1] = q[i]
    t[d[i+1]-1] = q[i+1]
    S = 0
    last = [0] * 26
    for day in range(D):
        select = t[day]-1
        S += score[day][select]
        last[select] = day+1
        for i in range(26):
            S -= C[i] * (day+1-last[i]) 
    if S > max_S:
        ans = t
        max_S = S
print('\n'.join(str(n) for n in ans))

Measured memory_bytes: 9920
import java.util.*;
import java.io.*;

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        double N = in.nextInt();
        if(N%2==0)
        {
            System.out.println((N/2)/N);
        }
        else
            {
                System.out.println(((N+1)/2)/N);
            }






        }







    }

















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

#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(v,a,b) for(int v=(a); v<=(b); v++)
#define fr(v,a,b) for(int v=(a); v>=(b); v--)
#define rng(v,a,b) for(int v=(a); v<(b); v++)

using namespace std;
typedef long long ll;
template<typename T> T& chmax(T& a, T b) { a = a > b ? a : b; return a;}
template<typename T> T& chmin(T& a, T b) { a = a < b ? a : b; return a;}
const int maxn=2e5+5;
int a[maxn];
int f[maxn];
int main()
{
	boost;
	int n; cin >> n;
	fo(i,1,n) cin >> a[i];
	fr(i,n,1) {
		fo(j,2,n/i) f[i] += f[i*j];
		if(a[i]) f[i] = (f[i]&1)^1;
		else f[i] = f[i]&1;
	}
	int m = 0;
	fo(i,1,n) if(f[i]) m++;
	cout << m << '\n';
	fo(i,1,n) if(f[i]) cout << i << ' ';
	return 0;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    char c[] = s.toCharArray();

    for (int i = 0 ; i < s.length() ; i++ ) {
      int a = (int)c[i] - 'A';
      a = (a + n) % 26;
      c[i] = (char)('A' + a);
      System.out.print(c[i]);
    }


  }
}


Measured memory_bytes: 26580
import static java.util.Arrays.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	void solve() {
		int ans = 0;
		while (sc.hasNext()) {
			String s = sc.next();
			s = s.replaceAll("[^0-9]", " ");
			String[] ss = s.split(" ");
			for (int i = 0; i < ss.length; i++) {
				try {
					ans += Integer.parseInt(ss[i]);
				} catch (NumberFormatException e) {}
			}
		}
		out.println(ans);
	}

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

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 18544
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPll(i, n) for (decltype(n) i = 0; i < n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007 //1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool> vecbool;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<string> vecstr;
typedef vector<vecint> vec2int;
typedef vector<vecbool> vec2bool;
int dx[4]{-1, +1, 0, 0};
int dy[4]{0, 0, -1, +1};
//////////////////////////////////////////
int main()
{
  int n; cin >> n;
  string s; cin >> s;
  stack<char > st, st2;
  int left = 0;
  int right = 0;
  REP(i,n){
    if(s[i] == '('){
      st.push('(');
    }else{
      if(!st.empty()){
        st.pop();
      }
    }
  }
  left = st.size();
  for(int i = n - 1; i >= 0; i --){
    if(s[i] == ')'){
      st2.push(')');
    }else{
      if(!st2.empty()){
          st2.pop();
        }
      }
  }
  right = st2.size();
  cout << string(right,'(') + s + string(left, ')') << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int H= sc.nextInt() , A = sc.nextInt();
        out.println((H+A-1)/A);

        out.flush();
        out.close();
    }


    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }


        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }


        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}

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

using namespace std;
int n,k;
vector<pair<int,int>> ed;

void pt()
{
    printf("%d\n",(int)ed.size());
    for(int i=0;i<ed.size();++i)
        printf("%d %d\n",ed[i].first+1,ed[i].second+1);
}

int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<n;++i) ed.push_back(pair<int,int>(0,i));
    if(n<3){
        if(k!=0){
            printf("-1\n");return 0;
        }
    }else{
        int nk = (n-1)*(n-2)/2;
        if(nk<k){
            printf("-1\n");return 0;
        }
        if(nk>k)
            {
                for(int i=1;i<n&&nk>k;++i)
                {
                    for(int j=i+1;j<n&&nk>k;++j)
                    {
                        ed.push_back(pair<int,int>(i,j));--nk;
                    }
                }
            }
    }
    pt();
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

class Node{
	int key;
	int parent = -1;
	int left = -1;
	int right = -1;

	public Node(int key){
		this.key = key;
	}

	public int getDegree(){
		int d = 2;
		if(this.left == -1)
			d--;
		if(this.right == -1)
			d--;
		return d;
	}
}

class Tree{
	Node[] nodes;
	int root = -1;

	public Tree(int n){
		nodes = new Node[n]; // Node???????????????
	}

	public void delete(int key){
		int x;
		if((x = find(root, key)) != -1)
			delete(x, key);
	}
	private void delete(int x, int key){
		if(nodes[x].getDegree() == 0){
			if(root == x)
				root = -1;
			else if(nodes[nodes[x].parent].left == x) // x???left??????
				nodes[nodes[x].parent].left = -1;
			else
				nodes[nodes[x].parent].right = -1;
		}else if(nodes[x].getDegree() == 1){
			int c;
			if(nodes[x].left == -1)
				c = nodes[x].right;
			else
				c = nodes[x].left;

			if(root == x)
				root = c;
			else if(nodes[nodes[x].parent].left == x)
				nodes[nodes[x].parent].left = c;
			else
				nodes[nodes[x].parent].right = c;

			nodes[c].parent = nodes[x].parent;
		}else{
			int c = leftIn(nodes[x].right);
			nodes[x].key = nodes[c].key;
			delete(c, nodes[c].key);
		}
	}
	private int leftIn(int x){
		if(nodes[x].left == -1)
			return x;
		else
			return leftIn(nodes[x].left);
	}

	public void find(int key){
		if(find(root, key) == -1)
			System.out.println("no");
		else
			System.out.println("yes");
	}
	private int find(int x, int key){
		if(x == -1)
			return -1;
		else if(nodes[x].key == key)
			return x;
		else if(key < nodes[x].key)
			return find(nodes[x].left, key);
		else
			return find(nodes[x].right, key);
	}

	public void printPreorder(){
		printPre(root);
		System.out.println();
	}
	private void printPre(int id){
		if(id == -1)
			return;
		System.out.print(" " + nodes[id].key);
		printPre(nodes[id].left);
		printPre(nodes[id].right);
	}

	public void printInorder(){
		printIn(root);
		System.out.println();
	}
	private void printIn(int id){
		if(id == -1)
			return;
		printIn(nodes[id].left);
		System.out.print(" " + nodes[id].key);
		printIn(nodes[id].right);
	}

	public void insert(int i, int key){
		nodes[i] = new Node(key);
		insert(i);
	}
	private void insert(int z){
		int y = -1;
		int x = root;
		while(x != -1){
			y = x;
			if(nodes[z].key < nodes[x].key)
				x = nodes[x].left;
			else
				x = nodes[x].right;
		}
		nodes[z].parent = y;

		if(y == -1)
			root = z;
		else if(nodes[z].key < nodes[y].key)
			nodes[y].left = z;
		else
			nodes[y].right = z;
	}
}

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();

		Tree t = new Tree(n);

		for(int i = 0; i < n; i++){
			String s = scan.next();
			if(s.equals("insert"))
				t.insert(i, scan.nextInt());
			else if(s.equals("find"))
				t.find(scan.nextInt());
			else if(s.equals("delete"))
				t.delete(scan.nextInt());
			else{
				t.printInorder();
				t.printPreorder();
			}
		}

		scan.close();
		System.exit(0);
	}
}

Measured memory_bytes: 214704
n, k = gets.split.map(&:to_i)
sum = 0.0
1.upto(n) do |i|
  val = i
  count = 0.0
  while(val < k)
    val *= 2
    count += 1.0
  end
  mom = 2.0**count 
  sum += 1.0/mom
end

puts sprintf( "%.9f", sum / n ) 

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << v.first << " " << v.second;
    return ostr;
}

int nCr(int n, int r) {
    int result = 1;
    rep(i, r) {
        result *= (n - i);
    }
    rep(i, r) {
        result = result / (i + 1);
    }

    return result;
}

int main() {
    int N, W; cin >> N >> W;
    vector<int> w(N), v(N); rep(i, N) cin >> w[i] >> v[i];

    vector<vector<int64>> dp(N+1, vector<int64>(W+1, 0));
    rep(i, N) {
        dp[i+1] = dp[i];
        rep(j, W) {
            if (w[i] + j <= W) {
                dp[i+1][w[i]+j] = max(dp[i+1][w[i]+j], dp[i][j] + v[i]);
            } else {
                dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            }
        }
    }

    cout << dp[N][W] << endl;
}


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

int GCD(int a, int b) {
	int r = a % b;
	while(r!=0){
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

//typedef long long signed int ll
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(obj) (obj).begin(),(obj).end()

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long signed int A, B,C, D;
	cin >> A >> B >> C >> D;
	long long signed int countA, countB,LCM;
	LCM = C * D / GCD(C, D);
	countA = (A - 1) / C + (A - 1) / D - ((A - 1) / LCM);
	countB = (B  / C) + (B / D) - (B / LCM);
	cout<<B - A-(countB-countA)+1<<endl;
	return 0;
}

Measured memory_bytes: 256
// https://misteer.hatenablog.com/entry/AGC027-B
#include <iostream>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    ll N, X;
    cin >> N >> X;

    ll sum[N + 1];
    sum[0] = 0;
    for (int i = 1; i <= N; ++i) {
        ll x;
        cin >> x;
        sum[i] = sum[i - 1] + x;
    }

    ll ans = INF;
    for (ll t = 1; t <= N; ++t) {
        // ゴミ捨てとゴミ拾いに消費するエネルギー
        ll cost = (N + t) * X;

        ll now = N;  // 右端

        cost += sum[now] * 5;
        now -= t * 2;
        while (now > 0) {
            cost += sum[now] * 2;
            now -= t;

            // オーバーフロー対策
            if (cost < 0) {
                cost = INF;
                break;
            }
        }
        ans = min(ans, cost);
    }

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

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

int main() {
	string s,t;
	cin >> s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),std::greater<char>());
	if (s<t){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

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

int main(){
    int n,x;
    cin >> n >> x;
    vector<int> m(n,0);
    for(int i = 0; i < n; i++){
        cin >> m[i];
    }
    sort(m.begin(),m.end());
    for(int i = 0; i < n; i++){
        x -= m[i];
    }
    cout << n+x/m[0] << endl;
}

Measured memory_bytes: 256
S = gets.chomp
flag = 0
for i in 0..(S.length-1)
    if(i%2 == 0)
        if S[i] == 'R' || S[i] == 'U'|| S[i] == 'D'
        else
            flag = 1
            break
        end
    else
        if S[i] == 'L' || S[i] == 'U'|| S[i] == 'D'
        else
            flag = 1
            break
        end
    end
end
if flag == 1
    puts "No"
else
    puts "Yes"
end

Measured memory_bytes: 1788
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>

using namespace std;

template <class T>
using lp_queue=priority_queue<T, deque<T>, greater<T>>;

using Weight=long long;
static const Weight INF=1LL<<57;

struct Edge {
    size_t src, dst;
    Weight weight;
    Edge() {}
    Edge(size_t src, size_t dst, Weight weight=1):
        src(src), dst(dst), weight(weight)
    {}
};

bool operator<(const Edge &e, const Edge &f) {
    if (e.weight != f.weight) {
        return e.weight > f.weight;
    } else {
        return e.src!=f.src? e.src<f.src : e.dst<f.dst;
    }
}

using Edges=vector<Edge>;
using Vertex=vector<Edge>;
using Graph=vector<Vertex>;

void join(Graph &g, size_t s, size_t d, Weight w=1) {
    // non-directed
    g[s].push_back(Edge(s, d, w));
    g[d].push_back(Edge(d, s, w));
}

void connect(Graph &g, size_t s, size_t d, Weight w=1) {
    // directed
    g[s].push_back(Edge(s, d, w));
}

vector<Weight> shortest_distance(const Graph &g, size_t s) {
    /* Dijkstra */
    size_t V=g.size();
    vector<Weight> d(V, INF); d[s]=0;

    lp_queue<pair<Weight, size_t>> q; q.push(make_pair(0, s));
    while (!q.empty()) {
        pair<Weight, size_t> p=q.top(); q.pop();
        size_t v=p.second;
        if (d[v] < p.first) continue;

        for (const Edge &e: g[v])
            if (d[e.dst] > d[v] + e.weight) {
                d[e.dst] = d[v] + e.weight;
                q.push(make_pair(d[e.dst], e.dst));
            }
    }
    return d;
}

Weight get_diameter(const Graph &g) {
    vector<Weight> d=shortest_distance(g, 0);
    size_t f=max_element(d.begin(), d.end())-d.begin();

    d = shortest_distance(g, f);
    return *max_element(d.begin(), d.end());
}

int main() {
    size_t V, E;
    scanf("%zu", &V);
    E = V-1;

    Graph g(V);
    for (size_t i=0; i<E; ++i) {
        size_t s, t;
        Weight w;
        scanf("%zu %zu %lld", &s, &t, &w);

        join(g, s, t, w);
    }

    printf("%lld\n", get_diameter(g));
    return 0;
}

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

int main(void) {
	set<int> S;
	int q, com, value;
	cin >> q;
	while (q--) {
		cin >> com >> value;
		switch (com) {
			case 0:
				S.insert(value);
				cout << S.size() << endl;
				break;
			case 1:
				if (S.find(value) != S.end()) {
					cout << "1\n";
				} else {
					cout << "0\n";
				}
				break;
			case 2:
				S.erase(value);
				break;
		}
	}
}


Measured memory_bytes: 12448
#include <stdio.h>

int main(void)
{
	int r, c, i, j;
	static int s[101][101];

	scanf("%d%d", &r, &c);

	for (i = 0; i <= r; i++)
	{
		for (j = 0; j<c; j++)
		{
			scanf("%d", &s[i][j]);
			printf("%d ", s[i][j]);
			s[i][c] += s[i][j];
			s[r][j] += s[i][j];
		}
		printf("%d\n", s[i][c]);
	}

	return 0;
}


Measured memory_bytes: 2044
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;



int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    vector<long> a(n);
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &a[i]);
    }

    long cnt=0;
    for(i=1; i<n; i++) {
        if(a[i-1] == a[i]) {
            cnt++;
            i++;
        }
    }
    printf("%ld\n", cnt);

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
  int N;
  cin >> N;
  int res = 0;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    res += a - 1;
  }
  printf("%d\n", res);
}

Measured memory_bytes: 3224
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    int k,n,mina=101,now=0,x;
    cin>>n;
    for(k=0;k<n;k++)
    {
        cin>>x;
        now+=x;
        if(x%10!=0 && x<mina)
            mina=x;
    }
    if(now%10!=0)cout<<now;
    else if(mina==101)cout<<0;
    else cout<<now-mina;
}


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

int main() {
    int n;
    cin >> n;
    int count[10][10] = {0};
    for(int i=1; i<=n; i++) {
        string s = to_string(i);
        count[s[0] - '0'][s[s.size()-1] - '0']++;
    }
    ll ans = 0;
    for (int i=1; i<10; i++) {
        for (int j=1; j<10; j++) {
            ans += count[i][j] * count[j][i];
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int>d(N);
    int ans=0;
    for(int i=0;i<d.size();i++){
     cin>>d.at(i);
    }
    sort(d.begin(),d.end());
     cout<<d.at(N/2)-d.at(N/2-1)<<endl;
}

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

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

	int n, m;
	cin >> n >> m;

	vector<vector<int> > a(n, vector<int>(m + 2));
	for(int i = 0; i < n; ++i) {
		for(int j = 1; j <= m; ++j) {
			cin >> a[i][j];
			if(i) a[i][j] = !a[i][j];
		}
	}

	int ans = 0;
	for(int i = 0; i < n; ++i) {
		int left = 1, right = m;
		while(left <= right) {
			if(a[i][left]) {
				++ans;
				++left;
				a[i][left] = !a[i][left];
			}
			else {
				ans += a[i][right];
				--right;
				a[i][right] = !a[i][right];
			}
		}
	}

	cout << ans << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1268
#include<bits/stdc++.h>
using namespace std;
int main(){
    string inp;
    cin >> inp;
    int N = inp.length();
    int MASU[N]={0};
    int flagR=0,flagL=0;
    int numR=0,numL=0;
    int border;
    for(int i=0; i<N; i++){
        if(inp.at(i)=='R'){
            if(flagR==0){
                flagR=1;
            }
            if(flagL==1){
                MASU[border-1]+=numL/2;
                MASU[border]+=(numL/2)+(numL%2);
                numL=0;
                flagL=0;
            }
            numR++;
        }else{
            if(flagL==0){
                border=i;
                flagL=1;
                MASU[border-1]+=(numR/2)+(numR%2);
                MASU[border]+=numR/2;
                numR=0;
                flagR=0;
            }
            numL++;
        }
        if(i==N-1){
            MASU[border-1]+=numL/2;
            MASU[border]+=(numL/2)+(numL%2);
            numL=0;
            flagL=0;
        }
    }
    for(int i=0; i<N; i++){
        cout << MASU[i] << " ";
    }
    return 0;
}

Measured memory_bytes: 1024
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

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

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

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

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

fn main() {
    input! {
        N: usize,
        A: [i64; N],
    }
    use std::collections::HashSet;
    let mut set = HashSet::new();
    for i in 0..N {
        if set.contains(&A[i]) {
            set.remove(&A[i]);
        } else {
            set.insert(A[i]);
        }
    }
    println!("{}", set.len());
}


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

using namespace std;

int main(void) {
    int H, W, K;
    cin >> H >> W >> K;
    W += 2;
    vector< vector<int> > grid(H, vector<int>(W));
    for(int i=0; i<H; i++) {
        string S;
        cin >> S;
        S.insert(0, "0");
        S.push_back('0');
        for(int j=0; j<W; j++) {
            grid[i][j] = S[j] - '0';
        }
        partial_sum(grid[i].begin(), grid[i].end(), grid[i].begin());
    }

    int ans = (H-1)*(W-1);
    for(int bit=0; bit<(1<<(H-1)); bit++) {
        int tmp = 0;
        vector< vector<int> > cp = grid;
        for(int i=0; i<H-1; i++) {
            if((bit>>i & 1) == 0) {
                for(int j=0; j<W; j++) {
                    cp[i+1][j] += cp[i][j];
                }
            } else {
                ++tmp;
            }
        }
        int l = 0;
        bool ok = true;
        for(int r=1; r<W; r++) {
            int m = 0;
            for(int i=0; i<H; i++) {
                m = max(m, cp[i][r] - cp[i][l]);
            }
            if(m > K) {
                if(r-l == 1) {
                    ok = false;
                    break;
                } else {
                    ++tmp;
                    l = r-1;
                    --r;
                }
            }
        }
        if(ok) {
            ans = min(ans, tmp);
        }
    }

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


Measured memory_bytes: 384
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0], 10);
  var m = parseInt(input[0].split(" ")[1], 10);
  var a = new Array(n);
  var b = new Array(n);
  var c = new Array(m);
  var d = new Array(m);
  var s = new Array(n);
  var x = new Array(m);
  var s1;


  for (i=0; i<n; i++){
    a[i]=parseInt(input[i+1].split(" ")[0], 10);
    b[i]=parseInt(input[i+1].split(" ")[1], 10);
    var y = new Array(m);
    for(j=0; j<m; j++){
      c[j]=parseInt(input[j+n+1].split(" ")[0],10);
      d[j]=parseInt(input[j+n+1].split(" ")[1],10);
      y[j]=Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]);
      if(j==0){
        x[i]=y[j];
        s[i]=j+1;
      }else{
        if(y[j]<x[i]){
          x[i]=y[j];
          s[i]=j+1;
        }

      }
    }
  }
  for(i=0; i<n; i++){
    if(i==0){
      s1=s[i];
    }else{
      s1=s1+"\n"+s[i];
    }
  }
    console.log('%s', s1);
  }
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7612
#include<bits/stdc++.h>
int n,m;
char str[502][502];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%s",str[i]+1);
	for(int i=1;i<=n;++i) {putchar('#'); for(int j=2;j<=m-1;++j) putchar(str[i][j]=='#'||(i&1)==1?'#':'.'); puts(".");} puts("");
	for(int i=1;i<=n;++i) {putchar('.'); for(int j=2;j<=m-1;++j) putchar(str[i][j]=='#'||(i&1)==0?'#':'.'); puts("#");}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

ll gcd(ll a, ll b)
{
    if(a < b){
        swap(a, b);
    }
    if(a % b == 0){
        return b;
    }
    return gcd(a % b, b);
}

int main() {
    //cout.precision(10);
    int n;
    ll k;
    cin >> n >> k;
    ll a[100100];
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    ll check = a[1];
    for(int i = 2; i <= n; i++){
        check = gcd(check, a[i]);
    }
    for(int i = 1; i <= n; i++){
        if(a[i] < k){
            continue;
        }
        if((a[i] - k) % check == 0){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;

    return 0;
}

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

using namespace std;

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

    int ans = 100001;
    for (int i = 0; i <= N; i++) {
        int count = 0;
        int res = i;

        while (res > 0) {
            count += res%6;
            res /= 6;
        }

        res = N - i;
        while (res > 0) {
            count += res%9;
            res /= 9;
        }
        
        ans = min(ans, count);
    }

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

Measured memory_bytes: 384
takahashi_hp, takahashi_attack, aoki_hp, aoki_attack = map(int, input().split())
a = 0
hps = [aoki_hp, takahashi_hp]
attacks = [takahashi_attack, aoki_attack]


def attack(hp, attack, is_takahashi):
    hp -= attack
    if hp <= 0:
        if is_takahashi:
            print("No")
        else:
            print("Yes")
        exit()
    return hp


def generator():
    global a
    a += 1
    yield a % 2 == 0


while True:
    is_takahashi = generator().__next__()
    hps[is_takahashi] = attack(hps[is_takahashi], attacks[is_takahashi], is_takahashi)


Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	ll n,k; cin>>n>>k;
	ll cnt=0;
	vector<vector<ll>> a;
	rep(i,n){
		ll x,y; cin>>x>>y;
		VL z; z.PB(x), z.PB(y); a.PB(z);
	}
	sort(ALL(a));
	rep(i,n){
		cnt+=a[i][1];
		if(cnt>=k){
			cout<<a[i][0]<<endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 6836
#include<stdio.h>

int NnumberSunuke, KkindOfOkashi;
int NoSunuke[100];

int okashi;
int tempSunuke;

int answer = 0;

int main(void){

    for(int index=0; index<100; index++){
        NoSunuke[index] = 1;
    }

    scanf("%d%d", &NnumberSunuke, &KkindOfOkashi);

    for(int i=0; i<KkindOfOkashi; i++){
        scanf("%d", &okashi);
        for(int j=0; j<okashi; j++){
            scanf("%d", &tempSunuke);
            NoSunuke[tempSunuke-1] = 0;
        }
    }


    for(int index=0; index<NnumberSunuke; index++){
        answer += NoSunuke[index];
    }

    printf("%d\n",answer);

    return 0;
}

Measured memory_bytes: 1732
# -*- coding: utf-8 -*-

import io
import sys
import math

def format_multi_line_answer(lst):
    ans = ""
    ans += f"{len(lst)}\n"  # Line count
    for y in lst:
        ans += f"{y}\n"
    return ans

def solve(l,r,d):
    # implement process
    s = 0
    for i in range(l,r+1):
        if i%d==0: s+=1
    return s


def main():
    # input
    l,r,d = map(int, input().split())

    # process
    ans = str( solve( l,r,d) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
1 100 1
"""
_EXPECTED = """\
100

"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Measured memory_bytes: 9096