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

int main(void) {
	char c[1];
	
	scanf("%s",c);
	if(!strcmp(c,"a")  || !strcmp(c,"i")  ||!strcmp(c,"u")  ||!strcmp(c,"e")||!strcmp(c,"o") ){
		printf("vowel\n");
	}else{
		printf("consonant\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t a,b,k;
  scanf("%ld%ld%ld",&a,&b,&k);
  a=a-k;
  if(a>=0){
    printf("%ld %ld",a,b);
  }else{
    b=b+a;
    if(b<0) b=0;
    printf("0 %ld",b);
  }
  return 0;
}


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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int a[n], i, sum = 0;
    for(i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    int pop = 0;
    for(i = 0; i < n; i++) {
        if (a[i]*4*m >= sum)
            pop ++;
    }
    if(pop >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3592
n = gets.to_i
ss = $<.map(&:chop).grep(/^[MARCH]/).group_by { |s| s[0] }
if ss.size < 3
  puts 0
else
  ss = ss.map { |s| s[1].size }.combination(3).to_a
  p ss.map { |s| s.inject(:*) }.inject(:+)
end

Measured memory_bytes: 12756
def max_score(str, r, s, p):
    run_str, run_length, max_score = str[0], 1, 0
    score = {'r': p, 's': r, 'p': s}
    for next in range(1, len(str)):
        if run_str == str[next]:
            run_length += 1
        else:
            max_score += -(-run_length // 2) * score[run_str]
            run_str = str[next]
            run_length = 1
    max_score += -(-run_length // 2) * score[run_str]
    return max_score
    
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
sum_max_score = 0
for i in range(k):
    sum_max_score += max_score(t[i::k], r, s, p)
print(sum_max_score)

Measured memory_bytes: 3316
n , k = list(map(int, input().split()))
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
min = h[-1]
for i in range(n - k + 1):
    if min > h[i + k - 1] - h[i]:
        min = h[i + k - 1] - h[i]
print(min)

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

public class Main{
  static void judge(String a, String b){
    if(a.equals(b)){
      System.out.println("Bad");
      System.exit(0);
    }
  }


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


    String[] s = sc.next().split("");
    //System.out.println(StringTolist(s));
    for(int i=0; i<s.length-1;i++){
      judge(s[i],s[i+1]);
    }

     System.out.println("Good");
   

  }
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    YES(x == 3 || x == 5 || x == 7);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
 
    long ans = 0;
 
    //i について全探索する
    for (int i = 0; i < N; i++)
    {
        //A[i+1] ... A[N] の値を更新する
        sum -= A[i];
        if (sum < 0) sum += mod;
 
        ans += A[i] * sum;
        ans %= mod;
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 4048
#include <iostream>
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#define ll long long 
#define pb push_back
#define pf push_front

using namespace std;

void solve(){
    ll int n; cin>>n;
    ll int a[n]; for(int i=0; i<n; i++) cin>>a[i];
    ll int sum=a[0];
    for(int i=1; i<n; i++) sum=sum^a[i];
    for(int i=0; i<n; i++){
        cout<<(-~(sum^a[i]))-1<<" ";
    }
    cout<<endl;

}

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

Measured memory_bytes: 5240
#include <stdio.h>

int main(){
  int A,B,C,D;
  scanf("%d %d %d %d",&A,&B,&C,&D);
  int i;
  for(i = 1 ; i <= 1000 ; i++){
    C = C - B;
    if(C <= 0){
      printf("Yes");
      break;
    }
    A = A - D;
    if(A <= 0){
      printf("No");
      break;
    }
  }
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int i=0;
    for(;i<s.size();i++){
        if(s[i]=='C')break;
    }
    for(i++;i<s.size();i++){
        if(s[i]=='F'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    cost = 0
    for i in range(n-1):
        if a[i] == a[i+1]:
            cost += 1
            a[i+1] = -1
    print(cost)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
from collections import deque

H, W = list(map(int, input().split()))
S = [input() for _ in range(H)]

move = [(-1, 0), (1, 0), (0, -1), (0, 1)]
visited = [[False for _ in range(W)] for _ in range(H)]


def bfs(i, j):
    # print('探索from', i, j)
    # i,jで指定されたマスが属するregionに含まれる黒白の個数をかける
    if visited[i][j]:
        return 0
    else:
        cnt1, cnt2 = 0, 0
        que = deque([(i, j)])
        while que:
            # print(que)
            i, j = que.popleft()
            # print('now', i, j)
            if S[i][j] == '#':
                cnt1 += 1
            else:
                cnt2 += 1
            visited[i][j] = True
            # print(visited)
            # print(cnt1, cnt2)

            # 周りを探索
            for (dh, dw) in move:
                if ((-1 < (i + dh) < H) and (-1 < (j + dw) < W)):
                    # print(i + dh, j + dw)
                    if not visited[i + dh][j + dw]:
                        if S[i][j] != S[i + dh][j + dw]:
                            visited[i + dh][j + dw] = True
                            que.append((i + dh, j + dw))

        return cnt1 * cnt2


ans = 0
for i in range(H):
    for j in range(W):
        ans += bfs(i, j)
        # print('in for loop', i, j, ans)


print(ans)


Measured memory_bytes: 4852
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    S = input().rstrip()
    n = len(S)
    res = 0

    for s in range(1<<(n-1)):
        l = 0
        for i in range(n-1):
            if (s>>i) & 1:
                res += int(S[l:i+1])
                l = i+1
        res += int(S[l:])
    print(res)

if __name__ == '__main__':
    main()

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

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var answer = 0;
            var prev = "";
            var current = "";
            for (var i = 0; i < s.Length; i++)
            {
                current += s[i];
                if (current != prev)
                {
                    prev = current;
                    current = "";
                    answer++;
                }
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 15832
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n,z,w; cin >> n >> z >> w;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  if(n==1){
    cout << abs(a[0]-w) << endl;
  }else cout << max(abs(a[n-1]-w),abs(a[n-2]-a[n-1])) << endl;
  
  return 0;
}

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

#define llint long long int

using namespace std;

int main()
{
    int N;

    cin >> N;

    vector<llint> koutaiwa(N + 1);

    for (int i = 1; i <= N; i++)
    {
        llint A;

        cin >> A;

        if (i % 2 == 1)
        {
            koutaiwa[i] += koutaiwa[i - 1] + A;
        }
        else
        {
            koutaiwa[i] += koutaiwa[i - 1] - A;
        }
    }
    for (int i = 1; i <= N; i++)
    {
        if (i == 1)
        {
            cout << koutaiwa[N] << " ";
        }
        else if (i % 2 == 0)
        {
            cout << 2 * koutaiwa[i - 1] - koutaiwa[N] << " ";
        }
        else
        {
            cout << 2 * (-koutaiwa[i - 1]) + koutaiwa[N] << " ";
        }
        if (i == N)
        {
            cout << endl;
        }
    }
}

Measured memory_bytes: 4020
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double xa,ya,xb,yb,xc,yc,xp,yp;
		double abc, abp, bcp, cap;

		while(sc.hasNext()){
			xa = sc.nextDouble();
			ya = sc.nextDouble();
			xb = sc.nextDouble();
			yb = sc.nextDouble();
			xc = sc.nextDouble();
			yc = sc.nextDouble();
			xp = sc.nextDouble();
			yp = sc.nextDouble();			
			abc = calculate_area(xa,ya,xb,yb,xc,yc);
			abp = calculate_area(xa,ya,xb,yb,xp,yp);
			bcp = calculate_area(xb,yb,xc,yc,xp,yp);
			cap = calculate_area(xc,yc,xa,ya,xp,yp);

//			System.out.println(abc +"\n"+ abp +"\n"+ bcp +"\n"+ cap);

			if( -0.001 < abc-(abp+bcp+cap) && abc-(abp+bcp+cap) < 0.001){
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

	static double calculate_area(double x1, double y1, double x2, double y2, double x3, double y3){
		double result;
		result = 0.5 * ((x3-x1)*(y2-y1)-(y3-y1)*(x2-x1));
		if(result < 0) result*=-1;
		return result;
	}
}

Measured memory_bytes: 23212
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <utility>

#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
 
 
using namespace std;
int main() {
  int n,k; cin >> n >> k;
  ll x[n];
  for(int i=0;i<n;i++){
    cin >> x[i];
  }

  int fst=n;
  rep(m,n){
    if(x[m] >= 0){
      fst = m;
      break;
    }
  }
  ll ans = (ll)pow(10,13)+1;
  if(n-fst >= k){
    ans = x[fst + k - 1];
  }
  if(x[fst] == 0){
    if(fst + 1>=k){
      ans = min (ans, -x[fst - k +1]);
    }
  } else {
    if(fst >= k){
      ans = min (ans, -x[fst - k]);
    }
  }
  
  for(int p=fst;p<n;p++){
    if(p+1-k >= 0){
      ans = min (ans, 2*x[p] - x[p-k+1]);
                 }
                 }
    for(int q=fst-1;q>=0;q--){
      if(n-q >= k){
        ans = min(ans,-2*x[q]+x[k+q-1]);
                  }
                  }
                 cout << ans;
                 
                 
  
    
 
 return 0;
}

Measured memory_bytes: 1152
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func isBomb(x int64, y int64, h int64, w int64, ss []string) bool {
	if x < 0 || w <= x || y < 0 || h <= y {
	return false
	}
	return ss[y][x] == '#'
}

func solve(h int64, w int64, ss []string) []string {
	rb := make([][]byte, h)
	for y := int64(0); y < h; y ++ {
		rb[y] = []byte(ss[y])
		for x := int64(0); x < w; x ++ {
			if isBomb(x, y, h, w, ss) {
				continue
			}
			n := 0
			if isBomb(x - 1, y - 1, h, w, ss) {
				n ++
			}
			if isBomb(x + 0, y - 1, h, w, ss) {
				n ++
			}
			if isBomb(x + 1, y - 1, h, w, ss) {
				n ++
			}
			if isBomb(x - 1, y + 0, h, w, ss) {
				n ++
			}
			if isBomb(x + 1, y + 0, h, w, ss) {
				n ++
			}
			if isBomb(x - 1, y + 1, h, w, ss) {
				n ++
			}
			if isBomb(x + 0, y + 1, h, w, ss) {
				n ++
			}
			if isBomb(x + 1, y + 1, h, w, ss) {
				n ++
			}
			rb[y][x] = "012345678"[n]
		}
	}
	ret := make([]string, h)
	for y := int64(0); y < h; y ++ {
		ret[y] = string(rb[y])
	}
	return ret
}

func main() {
	defer out.Flush()

	h := nextInt()
	w := nextInt()
	ss := nextStrings(h)
	res := solve(h, w, ss)
	for _, r := range(res) {
		fmt.Fprintln(out, r)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1788
n = int(input())
t = []

for i in range(n):
    a,b = map(int,input().split())
    t.append((a,b))

t = sorted(t,key=lambda x: x[1])

ans = 0
for k,v in t:
    ans += k
    if ans > v:
        print("No")
        exit()

print("Yes")

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

int main(){
	int a,b,c,d,e;
	cin>>a;
	b=a/1000;
	c=a/100-b*10;
	d=(a/10-c*10)%10;
	e=a%10;

	if (b==c||c==d||d==e){
		cout<<"Bad"<<'\n';
	}
	else
		cout<<"Good"<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
ll n,m,v,i,k;
bool cmp(int a,int b){
  return a > b;
}
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>k;
  ll a[200005] = {0};
  rep(i,n){
    cin>>m;
    a[m]++;
  }
  sort(a+1,a+200001,cmp);
  ll cnt= 0 ;
  repl(i,k+1,200001) cnt += a[i];
  cout<<cnt<<endl;

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


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

bool* visited;
int result = 0;
int v;
int e;
struct Info
{
	int num;
	int dist;
	Info(int i, int j)
	{
		num = i;
		dist = j;
	}
};
void initvst(int n)
{
	visited = new bool[n];
	for (int i = 0; i < n; i++)
	{
		visited[i] = false;
	}
}

bool operator < (const Info& v1,const Info& v2)
{
	return v1.dist > v2.dist;
}

int main()
{
	cin >> v >> e;
	initvst(v);
	int* h = new int[e];
	int* t = new int[e];
	int* w = new int[e];
	priority_queue<Info> q;
	for (int i = 0; i < e; i++)
		cin >> h[i] >> t[i] >> w[i];
	int start = h[0];
	for (int i = 0; i < e; i++)
	{
		if (h[i] == start)
		{
			Info vtx(t[i], w[i]);
			q.push(vtx);
		}
		if (t[i] == start)
		{
			Info vtx(h[i], w[i]);
			q.push(vtx);
		}
	}
	visited[h[0]] = true;
	while (!q.empty())
	{
		Info top = q.top();
		q.pop();
		if (visited[top.num])
			continue;
		visited[top.num] = true;
		result = result + top.dist;
		for (int i = 0; i < e; i++)
		{
			if (h[i] == top.num && (!visited[t[i]]))
			{
				Info vtx(t[i], w[i]);
				q.push(vtx);
			}
			if (t[i] == top.num && (!visited[h[i]]))
			{
				Info vtx(h[i], w[i]);
				q.push(vtx);
			}
		}
	}
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 5060
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    string N; cin >> N;
    int sum=0;
    for(int i=0;i<N.size();i++){
        sum += (int)(N[i]-'0');
    }
    cerr << sum << endl;
    if(sum%9==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
 
#define A_MAX 1000000
#define A_MAX_HALF 500000

using namespace std;

int min_factor[A_MAX + 1];
int q[A_MAX + 1];
int a[A_MAX + 1];
vector<int> primes{ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 };
int N;
 
int main() {
 
    for (int i = 2; i <= A_MAX_HALF; ++i) {
        if (!min_factor[i]) {
            min_factor[i] = i;
        }
        int min_factor_i = min_factor[i];
        for (int p : primes) {
            int n = i * p;
            if (n > A_MAX) {
                break;
            }
            min_factor[n] = p;
            if (p == min_factor_i) {
                q[n] = q[i];
                break;
            } else {
                q[n] = i;
            }
        }
    }
 
 
    char c = getchar_unlocked();
    while (c > 47) {
        N = 10 * N + c - 48;
        c = getchar_unlocked();
    }
 
    for (int i = 0; i < N; ++i) {
        int x = 0;
        c = getchar_unlocked();
        while (c > 47) {
            x = 10 * x + c - 48;
            c = getchar_unlocked();
        }
        ++a[x];
    }
 
    int is_pairwise_coprime = 1;
    for (int n = A_MAX; n > 1; --n) {
        int an = a[n];
        if (an) {
            if (an > 1) {
                if (an == N) {
                    printf("not coprime\n");
                    return 0;
                }
                is_pairwise_coprime = 0;
            }
            a[min_factor[n]] += an;
            a[q[n]] += an;
        }
    }
    if (is_pairwise_coprime) {
        printf("pairwise coprime\n");
    } else {
        printf("setwise coprime\n");
    }
 
    return 0;
}

Measured memory_bytes: 15356
#include <cstdio>
#include <algorithm>
static const int MAXN = 1e5 + 4;

int n;
int a[MAXN];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    std::sort(a, a + n);

    int count = std::unique(a, a + n) - &a[0];
    printf("%d\n", count - (count % 2 == 0 ? 1 : 0));

    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<algorithm>
using namespace std;
int tree[400005],S[100005];

int up(int x, int y)
{
    return (x-1)/y+1;
}

int down(int x, int y)
{
    return x/y;
}

int main()
{
    int n,m,l,r,i,j,R,Ri,Li;
    scanf("%d %d", &n, &m);
    for(i=1;i<=n;i++){
        scanf("%d %d", &l, &r);
        R=0;
        while(R*R<=l)R++;
        R--;
        Ri=m;
        for(j=1;j<=R;j++){
            Ri=min(Ri,r/j);
            Li=up(l,j);
            S[Ri+1]--;
            S[Li]++;
            Ri=Li-1;
        }
        for(j=1;j<=Ri;j++){
            if(r/j>(l-1)/j)S[j]++,S[j+1]--;
        }
    }
    for(i=1;i<=m;i++){
        S[i]+=S[i-1];
        printf("%d\n", S[i]);
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

long long a[262144] = {0};

int num_bit(int n){
   int res = 0;
   while(n!=0){
      res += (n&1);
      n >>= 1;
   }
   return res;
}

int s[262144];
int t[262144];

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

   int m = 1 << n;

   long long max_ans = 0;

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

      int bit = num_bit(i);
      if(bit == 0){
         continue;
      }
      else{
         if(a[i] > a[0]){
            s[i] = i;
            t[i] = 0;
         }
         else{
            s[i] = 0;
            t[i] = i;
         }

         if(bit > 1){
            for(int k=0; k<n; k++){
               int mask = 1 << k;

               if(mask & i){
                  if(a[s[i]] < a[s[mask^i]]){
                     t[i] = s[i];
                     s[i] = s[mask^i];
                  }
                  if(s[i] != s[mask^i] && a[t[i]] < a[s[mask^i]]){
                     t[i] = s[mask^i];
                  }
               }
            }
         }
         if(max_ans < a[s[i]] + a[t[i]])
            max_ans = a[s[i]] + a[t[i]];

         //cout << max_ans << " "<<s[i]<<" "<<t[i]<<endl;
         cout << max_ans <<endl;
      }
   }

   return 0;
}


Measured memory_bytes: 7168
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back


int main(){
    int N; cin >> N;
    map<string, int> mp;
    rep(i, N) {
        string S; cin >> S;
        mp[S]++;
    }

    int MAX = 0;
    for(auto& p : mp) MAX = max(MAX, p.second);
    for(auto& p : mp) {
        if(p.second == MAX) cout << p.first << endl;
    }
    
}

Measured memory_bytes: 25216
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() { 

    int d, t, s;
    cin >> d >> t >> s;
    if (d <= t * s) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}




Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ST first
#define ND second
#define ll long long
#define ld long double
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using namespace std;

const ll  INF = 1e9 + 9;
const ll  MOD = 1e9 + 7;
const long long LINF = (ll)1e18 + 3;
 
// secik.insert({x, t++});
// secik.erase(secik.lower_bound({x,-1}));
// *secik.find_by_order(x)).first << "\n";
// secik.order_of_key(x)
 
//random_device device;
//mt19937 gener(device());
//uniform_int_distribution<ll > gen(0,n-1);
//gen(gener); // generate random number

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

	ll n,m,k; cin >> n >> m >> k;
	vector<ll> tab1(n+1), tab2(m+1), sum1(n+1), sum2(m+1);
	for(int i = 1; i <= n; i++) cin >> tab1[i];
	for(int i = 1; i <= m; i++) cin >> tab2[i];

	for(int i = 1; i <= n; i++){
		sum1[i] = sum1[i-1] + tab1[i];
	}

	for(int i = 1; i <= m; i++){
		sum2[i] = sum2[i-1] + tab2[i];
	}
	
	int res = 0;
	
	for(int i = 0; i <= n; i++){
		if(sum1[i] <= k){
			ll rest = k - sum1[i];
			int tmpres = i;
			int l = 0, r = m + 1;
			while(l + 1 < r){
				int mid = (l+r)/2;
				if(sum2[mid] <= rest) l = mid;
				else r = mid;
			}
			tmpres += l;
			res = max(res,tmpres);
		}
	}
	
	cout << res;













	
}

Measured memory_bytes: 9528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 5;

int main()
{
  int n, x, y;
  cin >> n >> x >> y;
  x--, y--;
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    vector<int> dist(n, INF);
    queue<int> q;
    q.push(i);
    dist[i] = 0;
    auto push = [&](int v, int d) {
      if (dist[v] != INF) return;
      dist[v] = d;
      q.push(v);
    };
    while(!q.empty()) {
      int v = q.front(); q.pop();
      int d = dist[v];
      if (v - 1 >= 0) push(v - 1, d + 1);
      if (v + 1 < n) push(v + 1, d + 1);
      if (v == x) push(y, d + 1);
      if (v == y) push(x, d + 1);
    }
    for (int i = 0; i < n; i++) {
      ans[dist[i]]++;
    }
  }
  for (int i = 1; i < n; i++) {
    cout << ans[i] / 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
use strict;
use POSIX qw(floor ceil);

sub euclid_div {
    my ($divident, $divisor) = @_;
    my ($quotient, $remainder);

    if ($divident % $divisor == 0 || $divisor >= 0) {
        $quotient = floor($divident / $divisor);
        $remainder = $divident % $divisor;
    } else {
        $quotient = ceil($divident / $divisor);
        $remainder = $divident % $divisor - $divisor;
    }

    return ($quotient, $remainder);
}

sub convert {
    my $n = $_[0];

    if ($n == 0) {
        return "0";
    }
    
    my ($quo, $rem) = euclid_div($n, -2);
    if ($quo == 0) {
        return $rem;
    } else {
        return convert($quo, -2) . $rem;
    }
}

my $n = <STDIN>;
print(convert($n), "\n");


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


string s;

void solve()
{
    cin >> s;
    if (s[0]==s[1]&&s[1]==s[2]) nout("No");
    else nout("Yes");
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

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

vector<pair<long long,long long> > v;
set<int> s;

main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		long long a;
		scanf("%lld",&a);
		v.push_back(make_pair(a,i+1));
	}
	sort(v.begin(),v.end());
	long long ans=0;
	ans+=(((v[0].second-1)*(n-v[0].second))+(n))*1;
	//printf("%lld\n",ans);
	s.insert(v[0].second);
	for(int i=1;i<n;i++)
	{
		long long nw=v[i].first;
		long long po=v[i].second;
		set<int>::iterator it=s.lower_bound(po);
		int lm,rm;
		if(it==s.end())
		{
			it--;
			lm=*it;
			lm++;
			rm=n;
		}
		else
		{
			rm=*it;
			rm--;
			if(it==s.begin())
			{
				lm=1;
			}
			else
			{
				it--;
				lm=*it;
				lm++;
			}
		}
		//printf("%d %d\n",lm,rm);
		ans+=(((po-lm)*(rm-po))+(rm-lm+1))*nw;
		//printf("%lld\n",(((po-lm)*(rm-po))+(rm-lm+1))*nw);
		s.insert(po);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 13676
#include<stdio.h>
int main(void){
	char str;
	while(1){
		scanf("%c",&str);
		if(str >= 'A' && str <= 'Z') str += 0x20;
		else if(str >= 'a' && str <= 'z') str -= 0x20;
		printf("%c",str);
		if(str == '\n') break;
	}
	return 0;
}

Measured memory_bytes: 524
#include <stdio.h>

int main(void)
{
    int a, b, price;

    scanf("%d %d", &a, & b);

    if (a <= 5)
    {
        price = 0;
    }else if (a >= 6 && a <= 12)
    {
        price = b / 2;
    }else
    {
        price = b;
    }
    
    printf("%d", price);

    return 0;
}

Measured memory_bytes: 128
import itertools

n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0 for _ in range(n - 1)]
for i, j in itertools.combinations(range(n), 2):
    d = min(abs(i - j), abs(i - x) + abs(j - y) + 1, abs(i - y) + abs(j - x) + 1)
    ans[d - 1] += 1
for num in ans:
    print(num)

Measured memory_bytes: 9156
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)


#define MOD 1000000007

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

    vector<ll> Ap;
    vector<ll> An;
    ll A;
    rep(i, N){
        cin >> A;
        if(A >= 0){
            Ap.push_back(A);
        }else{
            An.push_back(-1 * A);
        }
    }
    sort(Ap.begin(), Ap.end(), greater<ll>());
    sort(An.begin(), An.end(), greater<ll>());

    ll ApP = 0, AnP = 0;
    ll ans = 1;
    if(K == N){
        //pick all
        if(An.size() % 2 == 1){
            ans *= -1;
        }
        rep(i, Ap.size()){
            ans = (ans * Ap[i]) % MOD;
        }
        rep(i, An.size()){
            ans = (ans * An[i]) % MOD;
        }
    }else if(Ap.empty() && K % 2 == 1){
        //pick smaller and * (-1)
        ans *= -1;
        rep(i, K){
            ans = (ans * An[An.size() - i - 1]) % MOD;
        }
    }else{
        //ans is always positive
        ll i = 0;
        while(i < K){
            if(i == K - 1){
                if(AnP % 2 == 1){
                    ans = (ans * An[AnP]) % MOD;
                }else{
                    ans = (ans * Ap[ApP]) % MOD;
                }
                i++;
            }else{
                if(ApP > (ll)Ap.size() - (ll)2){
                    if((K - i + AnP) % 2 == 0){
                        ans = (ans * An[AnP]) % MOD;
                        AnP++;
                    }else{
                        ans = (ans * Ap[ApP]) % MOD;
                        ApP++;
                    }
                    i++;
                }else{
                    if(AnP > (ll)An.size() - (ll)2){
                        ans = (ans * Ap[ApP]) % MOD;
                        ApP++;
                        i++;
                    }else{
                        if(Ap[ApP] * Ap[ApP + 1] > An[AnP] * An[AnP + 1]){
                            ans = (ans * Ap[ApP]) % MOD;
                            ApP++;
                            i++;
                        }else{
                            ans = (ans * An[AnP]) % MOD;
                            AnP++;
                            i++;
                            ans = (ans * An[AnP]) % MOD;
                            AnP++;
                            i++;
                        }
                    }
                }
            }
        }
    }

    if(ans < 0){
        ans += MOD;
    }
    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 5336
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n)cin >> a[i];
	vector<int> sum(n+1);
	rep(i,n)sum[i+1] = sum[i] + a[i];
	map<int,int> mp;
	int ret = 0;
	rep(i,n+1){
		ret += mp[sum[i]];
		mp[sum[i]]++;

	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 18660
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Program {
    internal static void Main(string[] args) {
        var inp = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var A = inp[0];
        var B = inp[1];
        WriteLine(A * B - (A + B - 1));
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int n, i, j, sz;
vector<int> a, b;
int main()
{
	cin >> n;
	if (n == 3) {
		printf("2 5 63");
		return 0;
	}
	for (i = 0, j = 3; i < n / 2 && j < 29997; i++, j += 12) {
		a.push_back(j);
		a.push_back(j + 6);
	}
	for (i = 0, j = 2; i < n - a.size(); i++, j += 2) b.push_back(j);
	sz = b.size();
	if (b.empty() || sz % 3 == 1) {
		a.pop_back();
		a.pop_back();
		b.push_back(j);
		b.push_back(j + 2);
	}
	for (i = 0; i < a.size(); i++) printf("%d ", a[i]);
	for (i = 0; i < b.size(); i++) printf("%d ", b[i]);
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long N;
  in(N);
  vector<long>v(N);
  ins(v);
  sort(all(v));
  double ans=(v[0]+v[1])/2.0;
  up(i,2,N-1){
    ans=(ans+v[i])/2.0;
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

const double PI = 3.141592;

int main() {
    double R;
    double two = 2.0;
    cin >> R;
    cout << (R * PI * two) << endl;
}


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

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

Measured memory_bytes: 3636
/*
author: Hayato Kawakita
date: 
vertict:
URL:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2182&lang=jp
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }

string s;

void solve() {
  int ans = 0;
  vector<int> cnt(11, 0);

  rep(i, s.length()) {
    int res = s[i] - '0';
    vector<int> nxtcnt(11, 0);
    rep(j, 11)  nxtcnt[(j * 10 + res) % 11] = cnt[j];
    if (res) nxtcnt[res]++;
    ans += nxtcnt[0];
    cnt = nxtcnt;
  }
  cout << ans << '\n';
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  while (1) {
    cin >> s;
    if (s == "0") break;

    solve();
  }

  




  
  return 0;
}


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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int n,m;
vector<int>v[N];
int a[N<<1],L[N],R[N];
LL A[N<<1];
int cnt,x;
LL p;
void dfs(int now,int pre){
	a[++cnt]=now;
	L[now]=cnt;
	for(auto k:v[now]){
		if(k==pre)continue;
		dfs(k,now);
	}
	a[++cnt]=now;
	R[now]=cnt;
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=2;i<=n;i++){
		int s,t;
		cin>>s>>t;
		v[s].pb(t);
		v[t].pb(s);
	}
	dfs(1,0);
	for(int i=1;i<=m;i++){
		cin>>x>>p;
		A[L[x]]+=p;
		A[R[x]+1]-=p;
	}
	for(int i=1;i<=cnt;i++)A[i]+=A[i-1];
	for(int i=1;i<=n;i++){
		cout<<A[L[i]]<<' ';
	}
	return 0;
}

Measured memory_bytes: 28928
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    int n,t,min=1001;
    cin >> n >> t;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
        if(b[i]<=t){
            if(a[i]<=min){
                min=a[i];
            }
        }
    }
    if(min==1001){
        cout << "TLE";
    }else{
        cout << min;
    }
}

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

using namespace std;

const int INF = 1e9;
struct Ford_fulkerson{
    struct edge{int to,cap,rev;};
    int n;
    vector<vector<edge> > graph;
    vector<int> vis;
    
    Ford_fulkerson(int _n):n(_n),graph(n),vis(n){}
    
    void addEdge(int from,int to,int cap){
        graph[from].push_back((edge){to,cap,(int)graph[to].size()});
        graph[to].push_back((edge){from,0,(int)graph[from].size()-1});
    }
    int dfs(int v,int t,int f){
        if(v==t)return f;
        vis[v]=true;
        for(int i=0;i<(int)graph[v].size();i++){
            edge& e = graph[v][i];
            if(!vis[e.to]&&e.cap>0){
                int d = dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    graph[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    int maxFlow(int s,int t){
        int flow=0;
        for(;;){
            for(int i=0;i<n;i++)vis[i]=false;
            int f = dfs(s,t,INF);
            if(f==0)return flow;
            flow+=f;
        }
    }
    
};

int main(){
    int H,W,C,M,Nw,Nc,Nm;
    while(cin >> H >> W >> C >> M >> Nw >> Nc >> Nm){
        if(H==-1)break;
        int s = 0;
        int t = H+(W*2)+(C*2)+(M*2)+1;
        int nw1 = t+1,nw2=nw1+1;
        int nc1 = nw2+1,nc2=nc1+1;
        int nm1 = nc2+1,nm2=nm1+1;
        Ford_fulkerson ff(nm2+10);

        for(int i=1;i<=W;i++){
            int n;
            cin >> n;
            for(int j=0;j<n;j++){
                int k;
                cin >> k;
                ff.addEdge(k,H+i,1);//勇者ー＞戦士
            }
        }
        for(int i=1;i<=C;i++){
            int n;
            cin >> n;
            for(int j=0;j<n;j++){
                int k;
                cin >> k;
                ff.addEdge(H+W+k,H+(2*W)+i,1);//戦士ー＞僧侶
            }
        }
        for(int i=1;i<=M;i++){
            int n;
            cin >> n;
            for(int j=0;j<n;j++){
                int k;
                cin >> k;
                ff.addEdge(H+(2*W)+C+k,H+(2*W)+(2*C)+i,1);//僧侶ー＞魔法使い
            }
        }

        for(int i=1;i<=H;i++){
            ff.addEdge(s,i,1);//s->勇者
            ff.addEdge(i,nw1,1);//勇者ー＞戦士選ばない
        }
        ff.addEdge(nw1,nw2,Nw);//戦士選ばない組がNw組
        for(int i=1;i<=W;i++){
            ff.addEdge(H+i,H+W+i,1);//選抜
            ff.addEdge(H+W+i,nc1,1);//戦士ー＞僧侶選ばない
        }
        ff.addEdge(nc1,nc2,Nc);//僧侶選ばない組がNc組
        for(int i=1;i<=C;i++){
            ff.addEdge(nw2,H+(2*W)+i,1);//戦士選ばないー＞僧侶
            ff.addEdge(H+(2*W)+i,H+(2*W)+C+i,1);//選抜
            ff.addEdge(H+(2*W)+C+i,nm1,1);//僧侶ー＞魔法使い選ばない
        }
        ff.addEdge(nm1,nm2,Nm);//魔法使い選ばない組がNm組
        for(int i=1;i<=M;i++){
            ff.addEdge(nc2,H+(2*W)+(2*C)+i,1);//僧侶選ばないー＞魔法使い
            ff.addEdge(H+(2*W)+(2*C)+i,H+(2*W)+(2*C)+M+i,1);//選抜
            ff.addEdge(H+(2*W)+(2*C)+M+i,t,1);//魔法使いー＞t
        }
        ff.addEdge(nm2,t,Nm);

        cout << ff.maxFlow(s,t) << endl;
    }
    return 0;
}


Measured memory_bytes: 3172
r, c = map(int, input().split())

a = []
for i in range(r):
    a.append(list(map(int, input().split())))
    a[i].append(sum(a[i]))

a.append([])
for j in range(c + 1):
    s = 0
    for i in range(r):
        s += a[i][j]
    a[-1].append(s)

for i, ai in enumerate(a):
    print(*ai)


Measured memory_bytes: 6228