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

int main(){
	 bool *is_prime = new bool[10000000];
	
	is_prime[0] = is_prime[1] = false;
	for(int i = 2; i < 10000000; i++){
		is_prime[i] = true;
	}
	for(int i = 2; i * i < 10000000; i++){
		if(is_prime[i]){
			for(int j = i * i; j < 10000000; j+=i){
				is_prime[j] = false;
			}
		}
	}
	
	while(true){
		int n;
		cin >> n;
		if(n == 0){
			break;
		}
		for(int i = n; i > 2; i--){
			if(is_prime[i] && is_prime[i - 2] && is_prime[i - 6] && is_prime[i - 8]){
				cout << i << endl;
				break;
			}
		}
	}
	delete[] is_prime;
	return 0;
}

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

bool a[60000]{};
int main() {
	for (int b = 2; b <60000; b++) {
		if (!(a[b])) {	
			for (int c = b * 2; c <60000; c += b)a[c] = true;
		}
   }
	int e;
	while (cin >> e, e) {
		int s = 0;
		for (int f = 2; f <= e / 2; f++) {
			if (!a[f] && !a[e - f])s++;
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 105

struct LOC{

	int X,Y;
};

int N;
int A,B,C,D;
LOC loc[NUM];

bool in_area(LOC a){

	return a.X >= A && a.X <= C && a.Y >= B && a.Y <= D;
}

int calc_to_area(LOC a){

	if(a.X < A){ //左

		if(a.Y < B){ //左上

			return abs(A-a.X)+abs(B-a.Y);

		}else if(a.Y > D){ //左下

			return abs(A-a.X)+abs(D-a.Y);

		}else{//左

			return abs(A-a.X);
		}

	}else if(a.X > C){ //右

		if(a.Y < B){ //右上

			return abs(C-a.X)+abs(B-a.Y);

		}else if(a.Y > D){ //右下

			return abs(C-a.X)+abs(D-a.Y);

		}else{//右

			return abs(C-a.X);
		}


	}else{ //真ん中

		if(a.Y < B){ //上

			return abs(B-a.Y);

		}else if(a.Y > D){ //下

			return abs(D-a.Y);

		}else{//中

			return 0;
		}
	}
}


void func(){


	scanf("%d %d %d %d",&A,&B,&C,&D);

	for(int i = 0; i <= N; i++){

		scanf("%d %d",&loc[i].X,&loc[i].Y);
	}

	int ans = 0;

	for(int i = 0; i < N; i++){

	   int from = i;
	   int to = i+1;
	   int cost;

	   if(in_area(loc[from]) == true && in_area(loc[to]) == true){

			cost = 0;

		}else if(in_area(loc[from]) == true && in_area(loc[to]) == false){

			cost = calc_to_area(loc[to]);

		}else if(in_area(loc[from]) == false && in_area(loc[to]) == true){

			cost = calc_to_area(loc[from])-1;

		}else{ //in_area(loc[from]) == false && in_area(loc[to]) == false

			cost = abs(loc[from].X-loc[to].X)+abs(loc[from].Y-loc[to].Y); //直接
			cost = min(cost,calc_to_area(loc[from])+calc_to_area(loc[to])-1); //安全地帯経由
		}

	    ans += cost;
	}

	printf("%d\n",ans);
}

int main(){

	while(true){

		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}




Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {
	private Scanner sc;

	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		while (sc.hasNextLine()) {
			int nico = Integer.parseInt(sc.nextLine());
			if (nico == -1) break;
			
			double x = 1.0;
			double y = 0.0;
			
			for (int i = 1; i < nico; i++) {
				if (x != 0.0) {
					double rad = Math.atan(y / x);
					if (x > 0.0) {
						x = x - Math.sin(rad);
						y = y + Math.cos(rad);
					} else {
						x = x + Math.sin(rad);
						y = y - Math.cos(rad);
					}
				} else {
					if (y > 0.0) x = x - 1.0;
					else x = x + 1.0;
				}
			}

			System.out.println(x);
			System.out.println(y);
		}
	}
}

Measured memory_bytes: 25808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;

int main() {
  ll n,m,k,t,b[2];
  cin >> n >> m >> k >> t >> b[0] >> b[1];
  int c[n];ll d[n];
  for(int i=0; i<n; i++) c[i]=1<<29,d[i]=INF;
  queue<int> que2;
  for(int i=0; i<k; i++) {
    int x;
    scanf("%d",&x);
    x--;
    c[x]=0;
    que2.push(x);
  }
  vector<int> v[n];
  for(int i=0; i<m; i++) {
    int x,y;
    scanf("%d%d",&x,&y);
    x--,y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  while(!que2.empty()) {
    int x=que2.front();que2.pop();
    for(int i=0; i<v[x].size(); i++) {
      int y=v[x][i];
      if(c[y]<=c[x]+1) continue;
      c[y]=c[x]+1;
      que2.push(y);
    }
  }
  priority_queue<P,vector<P>,greater<P> > que;
  que.push(P(0,0));
  d[0]=0;
  while(!que.empty()) {
    P p=que.top();que.pop();
    ll x=p.second,cost=p.second;
    if(d[x]<cost) continue;
    for(int i=0; i<v[x].size(); i++) {
      int y=v[x][i];
      ll cc=d[x]+(c[y]>t?b[0]:b[1]);
      if(!c[y]) continue;
      if(d[y]>cc) {
        d[y]=cc;
        que.push(P(cc,y));
      }
    }
  }
  cout << d[n-1]-(c[n-1]>t?b[0]:b[1]) << endl;
  return 0;
}

Measured memory_bytes: 8824
from copy import deepcopy
from collections import defaultdict
d = defaultdict(list)
N = int(input())
for i in range(N):
    s, p = map(str, input().split())
    d[s].append([int(p), i+1])
dic = deepcopy(d)
key = sorted(d)
for x in key:
    dic[x].sort(reverse=True)
    for y in dic[x]:
        print(y[1])

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

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

#define endl "\n"

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	int n,k;
	cin>>n>>k;
	int a[n+1];
	
	for(int i=1; i<=n; i++)
		cin>>a[i];
	
	sort(a+1,a+n+1);
	int sum=0;
	for(int i=1; i<=k; i++)
		sum+=a[i];
	
	cout<<sum<< endl;
	return 0;
}

Measured memory_bytes: 3624
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
#n, m = map(int, input().split())

acCount = 0
waCount = 0
check = [0] * n
waCheck = [0] * n

for i in range(m):
    p, s = map(str, input().split())
    # print(p,s)
    p = int(p)
    if (check[p - 1] == 0):
        if (s == 'WA'):
            waCheck[p - 1] += 1

        else:
            acCount += 1
            waCount += waCheck[p - 1]

            check[p - 1] = 1
    else:
        continue

print(acCount, waCount)


Measured memory_bytes: 10392
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
using namespace std;

int main(){
    ll x;
    cin>>x;
    vector<bool> used(1e6,false);
    V prime;
    for(int i=2;i<1e6;i++){
        if(used[i])continue;
        prime.push_back(i);
        for(int k=i;k<1e6;k+=i){
            used[k]=true;
        }
    }
    cout<<*lower_bound(prime.begin(), prime.end(),x)<<endl;
}

Measured memory_bytes: 1528
# 0, 1, 2, 3, ... の重ね合わせで書けるかどうか。多分。証明してないけど。

n = int(input())

nums = [int(input()) for i in range(n)]

if nums[0] != 0:
    print(-1)
    exit()

ans = 0
for i in range(1, n):
    if nums[i] > nums[i-1] + 1:
        print(-1)
        exit()
    elif nums[i] == nums[i-1] + 1:
        # 直前と同じ山に含まれる
        ans += 1
    else:
        # 直前とは違う、新たな山を作る必要がある
        ans += nums[i]

print(ans)


Measured memory_bytes: 11048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

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

void solve(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];

    ll cnt=0;
    rep(i,n){
        if(isPrime(a[i]))cnt++;
    }
    cout<<cnt<<endl;
}

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



Measured memory_bytes: 3212
#include <stdio.h>
#include <string.h>
int main(){
  int i,j;
  char s[80];
  int len;
  int flag;
  while(gets(s)!=0){
    len=strlen(s);
    flag=0;
    for(i=0;i<26;i++){
      for(j=0;j<len;j++){
	if(s[j]!=' ' && s[j]!='.'){
	  if(s[j]=='z')s[j]='a';
	  else s[j]++;
	}
      }
      for(j=0;j<len-4;j++){
	if(s[j]=='t' && s[j+1]=='h' && s[j+2]=='e'){flag++;break;}
	if(s[j]=='t' && s[j+1]=='h' && s[j+2]=='a' && s[j+3]=='t'){flag++;break;}
	if(s[j]=='t' && s[j+1]=='h' && s[j+2]=='i' && s[j+3]=='s'){flag++;break;}
      }
    
      if(flag){printf("%s\n",s);break;}
    }
  }
  memset(s,'\0',sizeof(s));
  return 0;
}

Measured memory_bytes: 524
yk  = input()
js  = input()
def caonima(yk, js):
    res = 0
    if len(yk) != len(js):
        return
    for i in range(len(yk)):
        if yk[i] == js[i]:
            res += 1
    return res
c = caonima(yk,js)
print(c)

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

bool kaibun(string S){
   string revS;
   revS = S;
   reverse(revS.begin(), revS.end());
   if (S == revS)
      return true;
   else
      return false;
}

int main(){
   string S;
   cin >> S;
   int N;
   N = S.size();

   if (kaibun(S) && kaibun(S.substr(0, (N-1)/2)) && kaibun(S.substr((N+1)/2, (N-1)/2)))
      cout << "Yes" << endl;
   else
      cout << "No" << endl;
}


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

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

  int x = N, y = 0;
  while(x > 0) {
    y += x % 10;
    x /= 10;
  }
  string rep;
  int z;
  z = N % y;
  if (z == 0) {
    rep = "Yes";
  } else {
    rep = "No";
  }
  cout << rep << endl;
}


Measured memory_bytes: 3596
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int main(){
	
	string a;
	getline(cin,a);
	
	rep(i,a.size()){
		if(a[i]<='z' && 'a'<=a[i]){
			a[i] += 'A'-'a';
		}
	}
	
	cout<<a<<endl;
}

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

class MyClass
{
    public static void Main(string[] args)
    {
        var A = int.Parse(Console.ReadLine());
        var B = int.Parse(Console.ReadLine());
        var C = int.Parse(Console.ReadLine());
        var D = int.Parse(Console.ReadLine());
        var E = int.Parse(Console.ReadLine());
        var t = 0;
        if (A < 0)
        {
            t += -A * C + D;
            A = 0;
        }
        t += (B - A) * E;
        Console.WriteLine(t);
    }
}


Measured memory_bytes: 17948
#include <iostream>
using namespace std;
int a, b, c, ans;
int main(void){
    // Your code her
    cin >> a >> b >> c;
    if (a + b == c) ans++;
    if (b + c == a) ans++;
    if (c + a == b) ans++;
    cout << (ans ? "Yes" : "No") << endl;
}


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

int main()
{
    while(true)
    {
        string nums;
        cin >> nums;
        if (nums=="0")
        {
            break;
        }
        else
        {
            int len=nums.size();
            //cout << nums.size()<<endl;
            int sum=0;
            for (int i=0; i<len; i++)
            {
                int num = nums.at(i) - '0';
                sum+=num;
                //cout << nums.at(i) << endl;
            }
            cout << sum << endl;
        }
    }
}


Measured memory_bytes: 3144
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
using namespace std;
int a[114514], cnt[114514];
signed main() {
	int n, m, ans = 0;
	cin >> n >> m;
	rep(i, m)cin >> a[i];
	sort(a, a + m);
	for (int i = 0; i < m - 1; i++)cnt[i] = a[i + 1] - a[i];
	sort(cnt, cnt + m - 1);
	for (int i = 0; i < m - 1-(n-1); i++)ans += cnt[i];
	cout << ans << endl;
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

#define fir fisrt
#define sec second

int n;

int main(){
	scanf(" %d", &n);
	if(n == 1) printf("Hello World\n");
	else{
		int a, b;
		scanf(" %d %d", &a, &b);
		printf("%d\n", a + b);
	}
}

Measured memory_bytes: 256
N = int(input())
num = {s: 0 for s in list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")}
for i in range(N):
    s = input()
    num[s[0]] += 1

patterns = [
    "MAR",
    "MAC",
    "MAH",
    "MRC",
    "MRH",
    "MCH",

    "ARC",
    "ARH",
    "ACH",

    "RCH"
]
ans = 0
for pat in patterns:
    ans += num[pat[0]]*num[pat[1]]*num[pat[2]]
print(ans)

Measured memory_bytes: 74636
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	q := scanInt()

	a := stxs{}
	for i := 0; i < n; i++ {
		s := scanInt()
		t := scanInt()
		x := scanInt()

		a = append(a, stx{s - x, 0, x})
		a = append(a, stx{t - x, 1, x})
	}

	sort.Sort(a)
	del := map[int]int{}
	pq := &priorityQueue{}
	heap.Init(pq)

	p := 0
	for i := 0; i < q; i++ {
		d := scanInt()
		for p < len(a) && a[p].t <= d {
			if a[p].f == 0 {
				heap.Push(pq, a[p].x)
			} else {
				del[a[p].x]++
			}
			p++
		}

		for len(*pq) != 0 && del[(*pq)[0]] > 0 {
			del[(*pq)[0]]--
			heap.Pop(pq)
		}

		if len(*pq) == 0 {
			fmt.Fprintln(wr, -1)
		} else {
			fmt.Fprintln(wr, (*pq)[0])
		}
	}

}

type stx struct {
	t, f, x int
}

type stxs []stx

func (a stxs) Len() int      { return len(a) }
func (a stxs) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a stxs) Less(i, j int) bool {
	return a[i].t < a[j].t
}

type priorityQueue []int

func (pq priorityQueue) Len() int            { return len(pq) }
func (pq priorityQueue) Swap(i, j int)       { pq[i], pq[j] = pq[j], pq[i] }
func (pq priorityQueue) Less(i, j int) bool  { return pq[i] < pq[j] }
func (pq *priorityQueue) Push(x interface{}) { *pq = append(*pq, x.(int)) }
func (pq *priorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	x := old[n-1]
	*pq = old[0 : n-1]
	return x
}


Measured memory_bytes: 41984
import java.util.*;


class Schedule{
    int t;
    int x;
    int y;

    Schedule (int t, int x, int y){
        this.t = t;
        this.x = x;
        this.y = y;
    }

    int getT(){
        return this.t;
    }
    int getX(){
        return this.x;
    }
    int getY(){
        return this.y;
    }

    static int getDistance(Schedule s1, Schedule s2){
        int d = Math.abs(s1.getX() - s2.getX()) + Math.abs(s1.getY() - s2.getY());
        return d;
    }

    static int getTimeDifference(Schedule s1, Schedule s2){
        int d = Math.abs(s1.getT() - s2.getT());
        return d;
    }

}


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

        ArrayList<Schedule> s = new ArrayList<Schedule>();
        s.add(new Schedule(0, 0, 0));

        for (int i = 0; i < n; i++){
            int t = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            Schedule newS = new Schedule(t, x, y);
            s.add(newS);
        }

        String ans = "Yes";
        for (int i = 0; i < s.size()-1; i++){
            Schedule s1, s2;
            s1 = s.get(i);
            s2 = s.get(i+1);
            int dist = Schedule.getDistance(s1, s2);
            int timeDiff = Schedule.getTimeDifference(s1, s2);

            if(dist <= timeDiff && (dist % 2 == timeDiff % 2)){
                continue;
            }
            ans = "No";
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 92912
#include<iostream>
#include<string>
#include <vector>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
#define PI 3.141592653589793
using vll = vector<ll>;
using Graph = vii;
const ll MOD = 1e9 + 7;

int n;
ll dp[100005];
int h[10000];

int main() {
	string s, t;
	cin >> s >> t;
	cout << t << s << endl;
}

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

namespace AtCoderConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            // 標準入力から1行取得
            string input = Console.ReadLine();

            // DとNを取得
            int d = int.Parse(input.Split(' ')[0]);
            int n = int.Parse(input.Split(' ')[1]);

            // 要素数100の配列を宣言
            int[] array = new int[100];

            // 配列に値を格納
            for(int i = 0; i < 100; i++)
            {
                if (d == 0)
                {
                    array[i] = (i + 1);
                }
                else if (d == 1)
                {
                    array[i] = 100 * (i + 1);
                }
                else
                {
                    array[i] = 10000 * (i + 1);
                }
            }
            if (d == 0)
            {
                // 100で0回割り切れる（1回も割り切れない）100番目の数は101
                array[99] = 101;
            }
            if (d == 1)
            {
                array[99] = 10100;
            }
            if(d == 2)
            {
                array[99] = 1010000;
            }

            // 標準出力に出力
            Console.WriteLine(array[n - 1]);
        }
    }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

signed main(){
    int H, A;
    cin >> H >> A;
    cout << (int)ceil((double)H/A) << endl;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (register ll i = (a); i <= (b); ++i)
#define per(i, a, b) for (register ll i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (register int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 5e3 + 100 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const double eps = 1e-7 ;
template <class T = int> T read()
{
	T f = 1, a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	return a * f ;
}

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

ll n;

ll f[maxn][maxn];

ll vis[1001000], prime[maxn << 1], tot;

void init()
{
	rep(i, 2, 1000000)
	{
		if(vis[i]) continue;
		prime[++ tot] = i;
		// printf("prime : %lld\n", i);
		if(tot >= 10000) return;
		rep(j, 2, 1000000)
		{
			if(i * j >= 1000000) break;
			vis[i * j] = 1;
		}
	}
}

signed main()
{
	// freopen("main.out", "w", stdout);
	scanf("%lld", &n);
	if(n == 2) return puts("2 3\n9 4"), 0;
	init();
	ll cnt = 0;
	rep(i, 2, n << 1)
	{
		++ cnt;
		rep(j, 1, i - 1) f[j][i - j] = prime[cnt];
		++ i;
	}
	rep(i, - n / 2, n / 2)
	{
		++ cnt;
		rep(j, max(1ll, - i * 2 + 1), min(n, n - i * 2)) f[j][j + i * 2] *= prime[cnt];
	}
	rep(i, 1, n) rep(j, 1, n)
	{
		ll tmp = 1;
		if(f[i][j]) goto end;
		rep(k, 0, 3)
		{
			int x = i + dx[k], y = j + dy[k];
			if(x <= 0 || y <= 0 || x > n || y > n) continue;
			tmp = tmp / __gcd(tmp, f[x][y]) * f[x][y];
		}
		f[i][j] = tmp + 1;
		end:;
		printf("%lld%c", f[i][j], " \n"[j == n]);
	}
	// printf("%lld\n", maxx);
	return 0;
}

Measured memory_bytes: 52224
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x; cin >> x;
    x /= 200;
    cout << 10 - x << "\n";
    return 0;
}

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

#define FORA(i, n, ii, s) for(int i=s;i<n;i+=ii)
#define FOR(i, n) for(int i=0;i<n;i++)
#define FORD(i, n) for(int i=n;i>=0;i--)
#define FORF(i, n, s) for(int i=s;i<n;i++)
#define MIN(x, y) ((x<y)?x:y)
#define MAX(x, y) ((x>y)?x:y)
#define ll long long
#define il long
#define ii pair<int,int>
#define vll vector<ll>
#define vi vector<int>
#define v11 vector<ii>
#define MOD (int)(1e9 + 7)
#define INF (int)(1e9)
#define INFLL (ll)(1e18)

using namespace std;

int main() {
	int n;
	cin>>n;
	int a[n];
	FOR(i,n) cin>>a[i];
	ll l=2,r=2;
	bool fl = true;
	FORD(i,n-1){
		if(ceil(double(l)/a[i])*a[i] <= r){
			l = ceil(double(l)/a[i])*a[i];
			if(r%a[i]== 0)
			r = ceil(double(r)/a[i]+1)*a[i] - 1;
			else	
			r = ceil(double(r)/a[i])*a[i] - 1;
		}else{
			fl = false;
			break;
		}
	}
	if(fl){
		cout<<l<<" "<<r<<endl;
	}else{
		cout<<-1<<endl;
	}
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 1000000007
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000


int main(void) {
	int n, k; cin >> n >> k;
	vint a(n);
	rep(i, n) {
		cin >> a[i];
	}
	k = min(1000, k);


	rep(time, k) {


		vint b(n);
		rep(i, n) {
			if (a[i] == 0) {
				continue;
			}
			if (i + a[i] + 1 < n) {
				b[i + a[i] + 1]--;
			}
			if (i - a[i] < 0) {
				b[0]++;
			}
			else {
				b[i - a[i]]++;
			}
		}
		int res = 0;
		rep(i, n) {
			res += b[i];
			if (a[i] == 0) {
				a[i] = res + 1;
			}
			else {
				a[i] = res;
			}
		}
	}

	rep(i, n) {
		cout << a[i] << ' ' << endl;
	}
	return 0;
}

Measured memory_bytes: 4844
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define per(i,x,y) for (int i=(x);i>=(y);i--)
#define ll long long
using namespace std;
#define N 20
#define M 70005
#define mod 1000000007
int n,m,now,ans,a[N],f[2][M],fac[M],inv[M];
int ksm(int x,int p){
	int ret=1;
	for (;p;p>>=1,x=(ll)x*x%mod) if (p&1) ret=(ll)ret*x%mod;
	return ret;
}
void init(int n){
	fac[0]=1;
	rep (i,1,n) fac[i]=(ll)fac[i-1]*i%mod;
	inv[n]=ksm(fac[n],mod-2);
	per (i,n-1,0) inv[i]=(ll)inv[i+1]*(i+1)%mod;
}
int C(int n,int m){
	if (n<m) return 0;
	return (ll)fac[n]*inv[m]%mod*inv[n-m]%mod;
}
void upd(int &x,int y){x+=y;x-=x>=mod?mod:0;}
int cal(int x){return __builtin_popcount(x);}
int main(){
	init(70000);
	scanf("%d%d",&n,&m);
	rep (i,1,m) scanf("%d",&a[i]);
	sort(a+1,a+1+m,greater<int>());
	f[0][0]=1;now=0;
	rep (i,1,m){
		now^=1;memset(f[now],0,sizeof(f[now]));int tmp;
		rep (j,0,(1<<n)-1) if (tmp=f[now^1][j]){
			upd(f[now][j],tmp);//a[i]不作为某个区间最小值
			rep (k,0,n-1)
				if (!(j>>k&1))
					upd(f[now][j|1<<k],(ll)tmp*C((1<<n)-j-a[i],(1<<k)-1)%mod*fac[1<<k]%mod);
		}
	}
	ans=0;
	rep (i,0,(1<<n)-1){
		f[now][i]=(ll)f[now][i]*fac[(1<<n)-1-i]%mod;
		if (cal(i)&1) upd(ans,mod-f[now][i]);else upd(ans,f[now][i]);
	}
	ans=(ll)ans*ksm(2,n)%mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1280
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

int weight(int r, int d, int x) { return r * x - d; }

int main() {
    int r, d, x;
    cin >> r >> d >> x;

    rep(i, 10) {
        x = weight(r, d, x);
        cout << x << endl;
    }
}

Measured memory_bytes: 256
<?php
fscanf(STDIN,"%d",$n);
$a_li = explode(" ",trim(fgets(STDIN)));
$sum = array_sum($a_li);
$count_val = array();
foreach($a_li as $a){
  $count_val[$a]++;
}
//print_r($count_val);
fscanf(STDIN,"%d",$q);
for($i=0;$i<$q;$i++){
	fscanf(STDIN,"%d%d",$b,$c);
   	$sum = ($sum+($c-$b)*$count_val[$b]);
  	echo $sum."\n";
  	$count_val[$c] += $count_val[$b];
  	$count_val[$b] = 0;
    //print_r($count_val);
}


Measured memory_bytes: 28136
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

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

    ll n;
    cin>>n;
    ll x,y;
    cin>>x>>y;
    vector<ll> adj[n+1];
    ll dis[n+1];
    for(ll i=0;i<n-1;++i)
    {
        ll a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dis[y]=0;
    queue<ll> q;
    q.push(y);
    ll vis[n+1]={0};
    vis[y]=1;
    while(!q.empty())
    {
        ll v=q.front();
        q.pop();
        for(auto u:adj[v])
        {
            if(vis[u]){continue;}
            vis[u]=1;
            q.push(u);
            dis[u]=1+dis[v];
        }
    }

    ll ans=0;
    for(ll i=0;i<=n;++i){vis[i]=0;}
    ll time[n+1]={0};
    q.push(x);
    vis[x]=1;
    time[x]=0;
    while(!q.empty())
    {
        ll v=q.front();
        q.pop();
        for(auto u:adj[v])
        {
            if(vis[u]){continue;}
            time[u]=1+time[v];
            vis[u]=1;
            if(time[u]>dis[u]){continue;}
            if(time[u]==dis[u]){ans=max(ans,time[u]);continue;}
            q.push(u);
            if(adj[u].size()>1){
                ans=max(ans,dis[u]);
            }
            else{
                ans=max(ans,dis[u]-1);
            }
        }
    }
    cout<<ans;

    return (0);
}


Measured memory_bytes: 8832
#include <iostream>
using namespace std;
int main(){
	int shuffle;
	string str;
	while(cin>>str&&str!="-"){
		cin>>shuffle;
		for(int i=0;i<shuffle;i++){
			int h;
			cin>>h;
			string tmp=str.substr(0,h);
			str.erase(0,h);
			str+=tmp;

		}
		cout<<str<<endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

// for(auto && i : Range(l,r))
// -> i = [l..r)
class Range {
private: struct It{ int x; int operator*(){return x;}
 bool operator!=(It& lhs){ return x<lhs.x;} void operator++(){++x;} }; It l,r;
public: Range(int n):l({0}),r({n}){} Range(int i,int n):l({i}),r({n})
 {}It& begin(){return l;} It& end(){return r;} };

void solve(istream& cin) {
    ll N;
    cin >> N;
    auto D = [](ll a){
        int k = 0;
        while(a > 0){k++; a/= 10;}
        return k;
    };
    auto F = [&D](ll a, ll b){
        if(a > b) return D(a);
        return D(b);
    };
    int mini = 1000;
    for (ll i = 1; i*i <= N; ++i) {
        if (N % i == 0) {
            mini = min(mini, F(i, N/i));
        }
    }
    cout << mini << endl;
}

int main(int argc, char *argv[]) {
    string FileName("C2"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());
    cerr << sub << endl;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {
        string inFile = "sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

class Point{
	int x;
	int y;
	int z;
	Point(int a,int b,int c){
		this.x = a;
		this.y = b;
		this.z = c;
	}
}
public class Main {

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

		int H = sc.nextInt();
		int W = sc.nextInt();

		String[][] S = new String[H][W];

		int white = 0;
		for(int i = 0 ; i < H ; i++){
			String tmp = sc.next();
			for(int j = 0 ; j < W ; j++){
				S[i][j] = tmp.substring(j, j+1);

				if(S[i][j].equals(".")){
					white++;
				}
			}
		}

		sc.close();
/*

		for(int i = 0 ; i < H ; i++){
			for(int j = 0 ; j < W ; j++){
				System.out.print(S[i][j] + " ");
			}
			System.out.println("");
		}
*/

		int sx = 0;
		int sy = 0;
		int gx = W-1;
		int gy = H-1;

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

		int[][] memo = new int[H][W];

		memo[sy][sx] = 1;

		Queue<Point> queue = new ArrayDeque<Point>();
		queue.add(new Point(sx,sy,0));

		int route = 10000 ;
		while(!queue.isEmpty()){
			Point p = queue.poll();

			for(int i = 0 ; i < 4 ; i++){
				int x = p.x + dx[i];
				int y = p.y + dy[i];
				int z = p.z + 1;

				if(x>=0 && x < W && y>=0 && y < H){
					if(!S[y][x].equals("#") && memo[y][x] == 0){
						queue.add(new Point(x,y,z));
						memo[y][x] = 1;
					}
				}
			}
			if(p.x == gx && p.y == gy){
				route = Math.min(route, p.z);
			}
		}
		if(route == 10000){
			System.out.println(-1);
		}
		else{
			System.out.println(white-route-1);
		}

	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;
int main() {

  int n;
  cin >> n;
  vec3 x(n);
  vec2 u(n);
  for(int i = 0; i < n; i++) {
    cin >> x.at(i) >> u.at(i);
  }

  int y = 0;
  double c = 0;
  for(int i = 0; i < n; i++) {
    if(u.at(i) == "JPY") {
      y = y + x.at(i);
    } else {
      c = c + x.at(i);
    }
  }
  double ans = y + (c * 380000.0);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

int main(){
    ll n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];

    sort(all(a));

    ll v = 1;

    rep(i,n-1){
        if(a[i] != a[i+1]){
            v++;
        }
    }

    if(v %2 == 0) v--;

    cout << v << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

ll N;
ll x[200000];
ll y[200000];
ll b[2]={1,-1};

int main(){
    cin>>N;
    rep(i,N) cin>>x[i]>>y[i];

    ll ans=0;
    rep(i,2){
        rep(j,2){
            vector<ll> v(N);
            rep(k,N){
                v[k]+=x[k]*b[i];
                v[k]+=y[k]*b[j];
            }
            sort(v.begin(),v.end());
            ans=max(ans,v[N-1]-v[0]);
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 8312
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    if A>8 or B>8:
        print(':(')
    else:
        print('Yay!')
    return


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n; cin >> n;
  vector<int> h(n); REP(i,n) cin >> h[i];

  int ok=true;
  h[0]--;
  for (int i = 1; i < n; i++) {
    int d = h[i] - h[i-1];
    if (d > 0) h[i]--;
    else if (d == 0) continue;
    else ok=false;
  }
  Yes(ok);
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
   #include <vector>
    using namespace std;
#define MAX 100005
    vector <int> adj[MAX];
    bool visited[MAX];

    void dfs(int s) {
        visited[s] = true;
        for(int i = 0;i < adj[s].size();++i)    {
         if(visited[adj[s][i]] == false)
             dfs(adj[s][i]);
        }
    }

    void initialize() {
        for(int i = 0;i < MAX;++i)
         visited[i] = false;
    }

    int main() {
        int nodes, edges, x, y, connectedComponents = 0;
        cin >> nodes;                       //Number of nodes
        cin >> edges;                       //Number of edges
        for(int i = 0;i < edges;++i) {
         cin >> x >> y;     
     //Undirected Graph 
         adj[x].push_back(y);                   //Edge from vertex x to vertex y
         adj[y].push_back(x);                   //Edge from vertex y to vertex x
        }

        initialize();                           //Initialize all nodes as not visited

        for(int i = 1;i <= nodes;++i) {
         if(visited[i] == false)     {
             dfs(i);
             connectedComponents++;
         }
        }
        cout<<connectedComponents-1;
        return 0;
    }

Measured memory_bytes: 9688
//#include "stdafx.h"
#include <iostream>

using namespace std;

char map[101][101];
int direction[4][2] = { {0,1},{1,0},{0,-1},{-1,0} };

int row, col;
char now;

void DFS(int x, int y) {
	map[x][y] = '.';
	
	int nextX, nextY;
	
	for (int i = 0; i < 4; i++) {
		nextX = x + direction[i][0];
		nextY = y + direction[i][1];

		if (nextX >= 0 && nextY >= 0 && nextX < row && nextY < col && map[nextX][nextY] == now) {
			DFS(nextX, nextY);
		}
	}
}

int main() {
	int sum;
	while (cin >> row >> col) {
		if (row == 0 && col == 0)break;
		for (int i = 0; i < row; i++)
			cin >> map[i];

		sum = 0;
		for (int i = 0; i < row; i++) {
			for (int j = 0; j < col; j++) {
				if (map[i][j] != '.') {
					now = map[i][j];
					sum++;
					DFS(i, j);
				}
			}
		}
		cout << sum << endl;
	}

}


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

int main (){
    int a,b,c;
    cin >>a>>b>>c;
    vector<int> s(3);
    int tmp,i,j;
    s.at(0) = abs(a-b);
    s.at(1) = abs(b-c);
    s.at(2) = abs(c-a);
    for(i=0;i<3;i++){
        for(j=1;j<3-i;j++){
            if(s.at(i)<s.at(i+j)){
                tmp = s.at(i);
                s.at(i) = s.at(i+j);
                s.at(i+j) = tmp;
            }
        }
    }
    cout << s.at(1)+s.at(2) <<endl;

    return 0;
}

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

using namespace std;

int main(void){
  int a,b,i,h=1;
  cin >> a >> b;
  if(b==1){
    printf("0\n");
    return 0;
  }
  for(i=0;i<=20;i++){
    h = h+a-1;
    if(h>=b) break;
  }
  cout << i+1 << endl;
  return 0;
}

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

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

typedef long long ll;

using namespace std;

int INF = 1e9;

int main(){
  int w, c;
  cin >> w >> c;
  if(w/2 < c) cout << 0 << endl;
  else cout << w - 2*c << endl;
}


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

int main()
{
    string s;  cin>>s;
     string hit;
     for(int i=1;i<=5;i++){
        hit+="hi";
        if(hit==s){
            cout<<"Yes"<<endl;   return 0;
        }


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


Measured memory_bytes: 3600
/***************************************************************
	File name: b.cpp
	Author: huhao
	Create time: Wed 13 Nov 2019 09:23:26 AM CST
***************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=r*10+c-48;
		c=getchar();
	}
	return r*t;
}
#include<queue>
#define i64 long long
const int N=100010;
i64 na,nb,nc,n;
struct piii
{
	i64 a,b,c;
	piii(i64 A=0,i64 B=0,i64 C=0){a=A; b=B; c=C;}
}p[N];
inline i64& Max(i64& a,i64 b){return a<b?a=b:a;}
namespace bf
{
	const int N=110;
	i64 f[N][N][N];
	int main()
	{
		fr(i,0,na) fr(j,0,nb) fr(k,0,nc)
		{
			if(i) Max(f[i][j][k],f[i-1][j][k]+p[i+j+k].a);
			if(j) Max(f[i][j][k],f[i][j-1][k]+p[i+j+k].b);
			if(k) Max(f[i][j][k],f[i][j][k-1]+p[i+j+k].c);
		}
		printf("%lld\n",f[na][nb][nc]);
		return 0;
	}
}
namespace thinking_peach
{
	int cmp(piii a,piii b){return a.a-a.b>b.a-b.b;}
	i64 spre[N],ssuf[N],ans,pre[N],suf[N],d;
	priority_queue<i64> q;
	int main()
	{
		sort(p+1,p+n+1,cmp);
		fr(i,1,n) spre[i]=spre[i-1]+p[i].a;
		fd(i,n,1) ssuf[i]=ssuf[i+1]+p[i].b;
		while(!q.empty()) q.pop();
		d=0;
		fr(i,1,na) q.push(p[i].c-p[i].a);
		fr(i,na+1,n)
		{
			q.push(p[i].c-p[i].a);
			d+=q.top();
			q.pop();
			pre[i]=spre[i]+d;
		}
		while(!q.empty()) q.pop();
		d=0;
		fd(i,n,n-nb+1) q.push(p[i].c-p[i].b);
		fd(i,n-nb,1)
		{
			q.push(p[i].c-p[i].b);
			d+=q.top();
			q.pop();
			suf[i]=ssuf[i]+d;
		}
		pre[na]=spre[na]; suf[n-nb+1]=ssuf[n-nb+1];
		fr(i,na,n-nb) Max(ans,pre[i]+suf[i+1]);
		printf("%lld\n",ans);
		return 0;
	}
}
int main()
{
	na=read(); nb=read(); nc=read(); n=na+nb+nc;
	fr(i,1,n)
	{
		i64 a=read(),b=read(),c=read();
		p[i]=piii(a,b,c);
	}
	return thinking_peach::main();
}

Measured memory_bytes: 8312
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string> 
#include <vector> 
using namespace std;

int main(){
/* 2014 ??????1
int a[2],ans;
cin >> a[0] >> a[1];
ans = a[0] * a[1];
cout << ans << endl;
*/
/* 2014 ??????2
int a[6],ans = 0;
cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
if(a[0] + a[1] * 5 + a[2] * 10 + a[3] * 50 + a[4] * 100 + a[5] * 500 >= 1000) ans = 1;
cout << ans << endl;
*/
/* 2014 ??????3
int a,i = 0;
cin >> a;
int b[a],c[a],ans[a];
while(a > i){
	cin >> b[i] >> c[i];
	ans[i] =  b[i] % c[i];
	if(ans[i] == 0) ans[i] = c[i];
	i++;
}
i = 0;
while(a > i){
cout << ans[i] << endl;
i++;
}
*/
/* 2014 ??????4*/
int a[3],i = 1,keta;
cin >> a[0];
int n[a[0]],m[a[0]];
while (a[0] >= i){
	cin >> n[i] >> m[i];
	i++;
}
i = 1;
cin >> a[1];
int o[a[1]],p[a[1]];
while (a[1] >= i){
	cin >> o[i] >> p[i];
	i++;
}
i = 1;
int ii,c,aa,iii,aaa;
aa = a[0] + a[1];
a[3] = a[1];
aaa = aa;
int ans[aa][2],hh[aa],mm[aa],chk,count;
count = 1;
while(aa >= i){
	ii = 1;
	chk = 1;
	if(a[0] >= i){
		while(i - 1 >= ii){
			if(n[i] == hh[ii] and m[i] == mm[ii]){
				chk = 0;
				//cout << n[i] << hh[ii] << m[i] << mm[ii];
			}
			ii++;
		}
		if(chk == 1){ 
			hh[count] = n[i];
			mm[count] = m[i];
			count++;
		}
	}else{
		while(i - 1 >= ii){
			if(o[i - a[0]] == hh[ii] and p[i - a[0]] == mm[ii]){
				chk = 0;
				//cout << o[i] << hh[ii] << p[i] << mm[ii];
			}
			ii++;
		}
		if(chk == 1){ 
			hh[count] = o[i - a[0]];
			mm[count] = p[i - a[0]];
			count++;
		}		

	}
	//cout << hh[i] << " " << hh[ii] << " " << mm[i] << " " << mm[ii] << " " << chk << endl;
	i++;
}
aa = count - 1;


i = 1;
while(aa >= i){
	ii = 1;
	c = 1;
		while(aa >= ii){
				if(hh[i] > hh[ii] or hh[i] == hh[ii] and mm[i] > mm[ii] and i != ii){
					c++;
				}
		ii++;
		}
	ans[c][0] = hh[i];
	ans[c][1] = mm[i];
	//cout << c  << endl;
 i++;
}
i = 1;
while(aa >= i){
	if(aa == i){
		if(ans[i][1] < 10){
			cout << ans[i][0] << ":" << "0" << ans[i][1] << endl;;
		}else{
			cout << ans[i][0] << ":" << ans[i][1] << endl;;
		}

	}else{
		if(ans[i][1] < 10){
			cout << ans[i][0] << ":" << "0" << ans[i][1] << " ";
		}else{
			cout << ans[i][0] << ":" << ans[i][1] << " ";
		}
	}
	i++;
}

/*int N,M,p,i = 1,min,ii = 1;
cin >> M >> N >> p;
int d[M],ans = 0,a;
while(M > i){
	cin >> d[i];
	i++;
}
i = 1;
while(M > i){
min = N + 1;
	while(M > ii){
		if(d[ii] <= N){
			a = d[ii] + N -  p ;
			if(min > p - d[ii] and 0 < p - d[ii]){
				min = p - d[ii];
				d[ii] = N + 1;
			}
			if(min > d[ii] - p and 0 < d[ii] - p){
				min = p - d[ii];
				d[ii] = N + 1;
			}
			if(min > a and 0 >= a){
				min = a;
				d[ii] = N + 1;
			}
		}
		ii++;
	}
	ans = ans + 100 * min;
i++;

}
cout << ans << endl;*/
}

Measured memory_bytes: 1168
#include<iostream>
#define T 1261
using namespace std;main(){int N,M,r,q,t[T],n[T],m[T],s[T],i,c,a;for(;cin>>N>>M>>r,N;){for(i=r;i-->0;)cin>>t[i]>>n[i]>>m[i]>>s[i];for(cin>>q;q-->0;cout<<a<<endl){cin>>N>>M>>c;int P[T]={0};for(i=r;i-->0;)if(m[i]==c)P[t[i]]+=s[i]-1?-1:1;for(a=i=0;++i<T;)P[i]+=P[i-1];for(i=N;i<M;i++)a+=P[i]>0;}}}

Measured memory_bytes: 0
f = lambda: map(int,input().split())


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


n,k = f()
a = list(f())
g = a[0]
for i in range(1,n):
    g = gcd(g,a[i])
print('POSSIBLE' if k<=max(a) and gcd(k,g)==g else 'IMPOSSIBLE')



Measured memory_bytes: 14480
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()




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

	string s;
	cin >> s;

	if (s == "SSS")cout << 0 << endl;
	else if (s == "RRR")cout << 3 << endl;
	else if (s == "SRR" || s=="RRS")cout << 2 << endl;
	else cout << 1 << endl;


	return 0;
}


Measured memory_bytes: 3648
// Union-Find木のテスト
//  ランクあり版

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

struct UnionFind {
  vector<int> par;	// 親ノード
  vector<int> rank;	// ランク（経路圧縮しなかった場合の木の高さ。rootノードでのみ有効な値が入っている）
  UnionFind( int n ) {
    init(n);
  }
  void init( int n ) {
    par.resize(n);
    rank.resize(n);
    for(int i=0; i<n; ++i )  par[i] = i;
    for(int i=0; i<n; ++i )  rank[i] = 0;
  }
  int root( int a ) {
    int pa = par[a];
    if ( pa == a ) return a;
    return par[a] = root(pa);
  }
  bool merge( int a, int b ) {
    int ra = root(a);
    int rb = root(b);
    if ( ra == rb ) return false;
    if ( rank[ra] < rank[rb] ) swap(ra,rb);
    if ( rank[ra] == rank[rb] ) rank[ra]++;
    par[rb] = ra;
    return true;
  }
  bool isSame( int a, int b) {
    return (root(a) == root(b));
  }
  int CountRoot( int n ) {
    int cnt = 0;
    for (int i=0; i<n; ++i )
      if ( i == par[i] ) cnt++;
    return cnt;
  }
};

int main() {
  int N,M;
  cin >> N >> M;
  UnionFind uf(N);
  REP(i,M) {
    int x,y,z;
    cin >> x >> y >> z;
    x--; y--;
    uf.merge(x,y);
  }
  
  cout << uf.CountRoot(N) << endl;
  
}



Measured memory_bytes: 1024