akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.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; }

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

int main(){
    int h, w; cin >> h >> w;
    int c1, d1; cin >> c1 >> d1; c1--; d1--;
    int c2, d2; cin >> c2 >> d2; c2--; d2--;
    vector<vector<char>> mp(h,vector<char>(w));
    rep(i,h) rep(j,w) cin >> mp[i][j];
  vector<int> x1 = {1,0,-1,0};
  vector<int> y1 = {0,1,0,-1};
    
    priority_queue<PP, vector<PP>, greater<PP>> que;
    vector<vector<int>> dp(h,vector<int>(w,100100100));
    que.push(make_pair(0,make_pair(c1,d1)));
    while(!que.empty()){
        auto p = que.top(); que.pop();
        int x = p.second.first, y = p.second.second;
        int c = p.first;
        if(c > dp[x][y]) continue;
        rep(i,4){
            int nx = x + x1[i], ny = y + y1[i];
            if(0 <= nx && nx < h && 0 <= ny && ny < w && mp[nx][ny] == '.'){
                    if(dp[nx][ny] > c){
                        dp[nx][ny] = c;
                        que.push(make_pair(c,make_pair(nx,ny)));
                    }
                    
            }                 
        }
        for(int i = -2; i <= 2; i++){
            for(int j = -2; j <= 2; j++){
                int nx = x + i, ny = y + j;
                if(0 <= nx && nx < h && 0 <= ny && ny < w && mp[nx][ny] == '.'){
                    if(dp[nx][ny] > c+1){
                        dp[nx][ny] = c+1;
                        que.push(make_pair(c+1,make_pair(nx,ny)));
                    }
                }
            }
        }
    }
    cout << (dp[c2][d2] == 100100100 ? -1 : dp[c2][d2] ) << endl;
    return 0;
} 

Measured memory_bytes: 8680
N, Ma, Mb = map(int, input().split())

G = []
for i in range(N):
 a, b, c = map(int, input().split())
 G.append( (a,b,c) )

M = 1 + min(sum([ a for a, b, c in G ]),
            sum([ b for a, b, c in G ]) )
INF = 1000000000
dp = [INF] * (M * M)
dp[0] = 0
for a, b, c in G:
  i = M - a - 1
  while i >= 0:
    j = M - b - 1
    while j >= 0:
      dp[(i+a)*M+(j+b)] = min(dp[(i+a)*M+(j+b)], dp[i*M+j] + c)
      j -= 1
    i -= 1

ans = INF
x = 1
while Ma * x < M and Mb * x < M:
  ans = min(ans, dp[Ma * x * M + Mb * x])
  x += 1
if ans >= INF:
  ans = -1
print(ans)


Measured memory_bytes: 3924
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0
total = []
for a in range(N-2):
    for b in range(a+1, N-1):
        la = L[a]
        lb = L[b]
        ab = la + lb
        sa = abs(la-lb)
        first = bisect.bisect_left(L, ab) -1 
        second = bisect.bisect_right(L, sa)
        if first > second and first >= b+1:
            count += first - max(second, b+1) +1
print(count)




Measured memory_bytes: 50008
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, K;
  cin >> N >> K;
  vector<int>pl;
  vector<int>mn;
  pl.push_back(0);
  mn.push_back(0);
  for (int i = 0; i < N; i ++) {
    int a;
    cin >> a;
    if (a < 0) mn.push_back(-a);
    else pl.push_back(a);
  }
  int kj = min((int)mn.size(), K + 1);
  int n = (int)mn.size();
  sort(mn.begin(), mn.end());
  int m = (int)pl.size();
  int ans = 1e9;
  for (int i = 0; i < kj; i ++) {
    int j = K - i;
    if (j < m) ans = min(ans, min((pl[j] * 2) + mn[i], pl[j] + (mn[i] * 2)));
  }
  cout << ans << endl;
}



Measured memory_bytes: 1020
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	K := readInt()
	S := readInt()

	var ans int
	for x := 0; x <= K; x++ {
		for y := 0; y <= K; y++ {
			z := S - (x + y)
			if 0 <= z && z <= K {
				ans++
			}
		}
	}
	println(ans)
}

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


Measured memory_bytes: 640
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            int v = map.getOrDefault(a, 0);
            v++;
            map.put(a, v);
        }
        System.out.println(map.values().stream().mapToInt(Integer::intValue).sorted().limit(Math.max(map.size() - k, 0)).sum());
    }
}


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

int main() {
  char X, Y;
  cin >> X >> Y;

  string ans = "=";
  if (X < Y)
    ans = "<";
  else if (X > Y)
    ans = ">";
  else
    ans = "=";

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
 
using namespace std;
typedef long long Int;
#define INF (1LL<<60)
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
Int dp[20][54000];
Int table[54000];

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

	string N1,N2;
	cin >> N1>>N2;

	if(N1[0]==N2[2] && N1[2]==N2[0]&&N1[1]==N2[1])	cout<<"YES"<<endl;
	else	cout<<"NO"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

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

ll lcm(ll a, ll b) {
	return a*b/gcd(a,b);
}

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(llvec array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return -1LL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int main() {
	int n,k; cin>>n>>k;
	ll p[n];
	ll maxsum=0LL,tmpsum;
	for(int i=0; i<k; i++) {
		cin>>p[i];
		maxsum+=p[i];
      
	}
    tmpsum=maxsum;
	for(int i=k; i<n; i++) {
		cin>>p[i];
      tmpsum+=p[i]-p[i-k];
		chmax(maxsum,tmpsum);
	}
	cout<<fixed<<setprecision(12)<<(maxsum+k)/2.0<<endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;
class Main{
    public static void main(String[] argd){
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();
        int e = scan.nextInt();
        int k = scan.nextInt();

        int ar[] = {a,b,c,d,e};

        String flag = "Yay!";

        for(int i = 0; i < 5; i++){
            for(int j = 0; j < 5; j++){
                if(Math.abs(ar[i] - ar[j]) > k){
                    flag = ":(";
                }
            }
        }

        System.out.println(flag);

    }
}

Measured memory_bytes: 21588
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    sc.nextLine();
    String[] str = sc.nextLine().split(" ");
    Integer[] intStr = new Integer[str.length];
    for(int i=0;i<str.length;i++) {
        intStr[i] = Integer.parseInt(str[i]);
    }
    Arrays.sort(intStr);
    List<Boolean> list = new ArrayList<Boolean>();
    int max = intStr[intStr.length-1];
    for(int i=0;i<=max;i++) {
        list.add(true);
    }
    for(Integer num:intStr) {
        for(int j = num*2-1;j<=max;j+=num) {
            list.set(j, false);
        }
    }
    Map<Integer, Boolean> map = new HashMap<>();
    for(Integer num:intStr) {
        if(map.containsKey(num)) {
            map.put(num, false);
        }
        else {
            map.put(num, true);
        }
    }
    int cnt = 0;
    for(Integer num:intStr) {
        if(map.containsKey(num) && map.get(num)) {
            if(list.get(num-1)) {
                cnt++;
            }
        }
    }
    System.out.println(cnt);
  }
}

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	s += '!';
	int i = 0;
	int co=0;
	long long ans = 0;
	while (i < n) {
		if (s[i] == 'A') {
			vector<int> A(1,0);
			i++;
			int AC = 0;
			while (i < n) {
				if (s[i] == 'A') {
					A.push_back(AC);
					i++;
				}
				else if (s[i] == 'B') {
					if (s[i + 1] == 'C') {
						AC++;
						i += 2;
					}
					else
						break;
				}
				else
					break;
			}
			for (int j = 0;j < A.size();j++) {
				ans =(long long)ans+ AC - A[j];
			}
		}
		i++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1532
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

    	Scanner sc = new Scanner(System.in);

    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	int C = sc.nextInt();

    	int cnt = 0;

    	cnt = B / A;
    	cnt = (cnt > C) ? C : cnt;

		System.out.println(cnt);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
int main(){

    int N;
    cin >>N;
    
    vector<long long> vec(N);

    REP(i,N) cin >> vec[i];
    
    FOR(i,0,N-1){
        long long n=vec[i];
        long long m=vec[i+1];
        
        long long l=n%m;
        
        while(l!=0){
            n=m;
            m=l;
            l=n%m;
        }
    
        vec[i+1]=(vec[i]/m)*vec[i+1];
        
    }
    cout << vec[N-1]<<endl;
    
}


Measured memory_bytes: 256
using System;
using System.Linq;
class aoj
{
    static void Main()
    {
        for (int z = 0; z < 3; z++)
        {
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int h = a[0] * 3600 + a[1] * 60 + a[2];
            int h2 = a[3] * 3600 + a[4] * 60 + a[5];
            h = h2 - h;
            int s = h % 60;
            int m = (h - s) / 60;
            int l = m;
            m = m % 60;
            int ho = (l - m) / 60;
            Console.WriteLine(ho + " " + m + " " + s);
        }
    }
}

Measured memory_bytes: 9588
#![allow(non_snake_case)]
use proconio::input;
use proconio::marker::Chars;

#[rustfmt::skip]
fn main() { std::thread::Builder::new().stack_size(128 * 1024 * 1024).spawn(solve).unwrap().join().unwrap(); }

#[proconio::fastout]
fn solve() {
    input! {
        N: usize,
        S: Chars
    }

    let mut X = S.iter().filter(|&c| *c == 'R').count()
        * S.iter().filter(|&c| *c == 'G').count()
        * S.iter().filter(|&c| *c == 'B').count();

    for i in 0..N {
        for d in 0..N {
            let (j, k) = (i + d, i + 2 * d);
            X -= ((0..N).contains(&i)
                && (0..N).contains(&k)
                && S[i] != S[j]
                && S[j] != S[k]
                && S[k] != S[i]) as usize
        }
    }

    println!("{}", X)
}


Measured memory_bytes: 2256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

struct lect
{
    int xs, xe, ys, ye;
};

int main()
{
    int n;
    cin >> n;
    vector<lect> lects(n);
    rep(i, n)
    {
        cin >> lects[i].xs >> lects[i].ys >> lects[i].xe >> lects[i].ye;
    }
    vector<long long int> largeX;
    vector<long long int> largeY;
    rep(i, lects.size())
    {
        largeX.push_back(lects[i].xs);
        largeX.push_back(lects[i].xe);
        largeY.push_back(lects[i].ys);
        largeY.push_back(lects[i].ye);
    }
    SORT(largeX);
    SORT(largeY);
    largeX.erase(std::unique(largeX.begin(), largeX.end()), largeX.end());
    largeY.erase(std::unique(largeY.begin(), largeY.end()), largeY.end());
    map<long long int, long long int> compX;
    map<long long int, long long int> compY;
    map<long long int, long long int> invCompX;
    map<long long int, long long int> invCompY;
    rep(i, largeX.size())
    {
        compX[largeX[i]] = i;
        invCompX[i] = largeX[i];
    }
    rep(i, largeY.size())
    {
        compY[largeY[i]] = i;
        invCompY[i] = largeY[i];
    }
    int compArea[largeX.size() + 2][largeY.size() + 2];

    rep(x, largeX.size() + 2)
    {
        rep(y, largeY.size() + 2)
        {
            compArea[x][y] = 0;
        }
    }

    for (auto lec : lects)
    {
        compArea[compX[lec.xs] + 1][compY[lec.ys] + 1] += 1;
        compArea[compX[lec.xe] + 1][compY[lec.ys] + 1] -= 1;
        compArea[compX[lec.xs] + 1][compY[lec.ye] + 1] -= 1;
        compArea[compX[lec.xe] + 1][compY[lec.ye] + 1] += 1;
    }
    //make imos

    rep(x, largeX.size() + 2)
    {
        REP(y, 1, largeY.size() + 2)
        {
            compArea[x][y] += compArea[x][y - 1];
        }
    }
    REP(x, 1, largeX.size() + 2)
    {
        rep(y, largeY.size() + 2)
        {
            compArea[x][y] += compArea[x - 1][y];
        }
    }


    long long int ans = 0;
    REP(x, 1, largeX.size() + 1)
    {
        REP(y, 1, largeY.size() + 1)
        {
            if (compArea[x][y] == 0)
                continue;
            else
                ans += abs(invCompX[x] - invCompX[x - 1]) * abs(invCompY[y] - invCompY[y - 1]);
            if (compArea[x][y] > 1)
            {
                compArea[x][y] = 0;
            }
        }
    }


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


Measured memory_bytes: 66740
n=int(input())
an=list(map(int, input().split()))

def check(sign):
    a_cnt=0
    a_sum=0
    for a in an:
        a_sum+=a
        if a_sum*sign<=0:
            a_cnt+=abs(a_sum-sign)
            a_sum=sign
        sign*=-1

        # print(a_sum, a_cnt)

    return a_cnt

print(min(check(1),check(-1)))


Measured memory_bytes: 14332
A = []
A.append([int(x) for x in input().split()])
A.append([int(x) for x in input().split()])
A.append([int(x) for x in input().split()])

G = [[False] * 3 for i in range(3)]
N = int(input())
for i in range(N):
    b = int(input())
    for r in range(3):
        for c in range(3):
            if A[r][c] == b:
                G[r][c] = True

def check():
    # xxx
    for r in range(3):
        if all(G[r][c] for c in range(3)):
            return "Yes"
    for c in range(3):
        if all(G[r][c] for r in range(3)):
            return "Yes"
    if all(G[c][c] for c in range(3)):
        return "Yes"
    if G[0][2] and G[1][1] and G[2][0]:
        return "Yes"
    return "No"

print(check())




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

int main(){
    double l;
    cin >> l;
    double ans = l/3 * l/3 * l/3; 
    printf("%.7lf", ans);
    return 0;
}

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

int main()
{
	int h, w; cin >> h >> w;
	vector<string> a(h); for (auto& e : a) cin >> e;
	vector<int> r(h, 0), c(w, 0);

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '.') r[i]++, c[j]++;
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (r[i] != w and c[j] != h) cout << a[i][j];
		}
		if (r[i] != w) cout << endl;
	}
}


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

a,b = inpl()
print(int((a+b)/2+0.5))


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

int main() {
  int n;
  cin >> n;
  
  int count = 0;
  int ans = 0;
  for(int i=1; i<=n; i=i+2) {
    for(int j=1; j<=i; j++) {
      if(i%j==0) count++;
      if(j==i) {
        if(count==8) ans++;
        count = 0;
      }
    }
  }
  cout << ans << endl;
}

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



#define SIZE 200005

ll N;
ll A[SIZE];

int main(){

	scanf("%lld",&N);

	A[0] = 0;
	for(ll i = 1; i <= N; i++){

		scanf("%lld",&A[i]);
		A[i] += A[i-1];
	}

	ll ans = HUGE_NUM;

	for(ll i = 1; i <= N-1; i++){

		ans = min(ans,abs(A[i]-(A[N]-A[i])));
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 5340
#include <iostream>

int main(){
	int Num = 0;//要素数
	std::cin >> Num;//要素数取得

	int* Elem = new int[Num];
	for (int i = 0; i < Num; ++i){//データ入力
		std::cin >> Elem[i];
	}

	int v = 0, j = 0;
	for (int i = 1; i < Num; ++i){

		std::cout << Elem[0];//出力
		for (int c = 1; c < Num; ++c){
			std::cout << " " << Elem[c];
		}
		std::cout << std::endl;

		v = Elem[i];//ソート
		j = i - 1;
		while (j >= 0 && Elem[j]>v){
			Elem[j + 1] = Elem[j];
			--j;
		}
		Elem[j + 1] = v;
	}

	std::cout << Elem[0];//出力
	for (int c = 1; c < Num; ++c){
		std::cout << " " << Elem[c];
	}
	std::cout << std::endl;

	delete[] Elem;
	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N,K;
  cin>>N>>K;
  vector<int> x(N);
  rep(i,N) cin>>x[i];
  int D=pow(10,9);
  rep(i,N-K+1) D=min(D, min(abs(x[i]),abs(x[i+K-1]))+abs(x[i]-x[i+K-1]));
  cout<<D<<endl;
  return 0;
}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.length()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>())
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////
	int n;
	cin >> n;
	cout << "ABC" << n << endl;

	
//////////////////////////////////////////////
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string>
#include<math.h>
#include<string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
   ll a,b=100;
   cin>>a;
   int sum=0;
   while(b<a){
    b+=(ll)b*0.01;
    sum++;
   }
   printf("%d\n",sum);
   return 0;
}


Measured memory_bytes: 3752
import java.util.Scanner;

public class Main {

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

		int[] f = new int[26];

		for (int i = 0; i < s.length(); i++) {
			f[s.charAt(i) - 'a'] = 1 - f[s.charAt(i) - 'a'];
		}

		for (int x : f) {
			if (x == 1) {
				System.out.println("No");
				System.exit(0);
			}
		}
		System.out.println("Yes");
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
struct mon
{
	int x,h;
	bool operator<(const mon k)const
	{
		return x<k.x;
	}
}a[N];
int n,d,t,p,las,ans;
vector<pair<int,int>>v;
main()
{
	scanf("%lld%lld%lld",&n,&d,&t);
	for(int i=1;i<=n;i++)
		scanf("%lld%lld",&a[i].x,&a[i].h);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		while(las<v.size()&&v[las].first<a[i].x)
		{
			p-=v[las].second;
			las++;
		}
		int k=(a[i].h+t-1)/t-p;
		if(k<=0)
			continue;
		p+=k;
		ans+=k;
		v.push_back(make_pair(a[i].x+2*d,k));
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 8176
# coding: utf-8
# Your code here!
from heapq import heappush, heappop, heapify
n=int(input())
G=[[]for i in range(n)]
d=[]
for i in range(n):
    a,b=map(int,input().split())
    d.append((a,b,i))
d=sorted(d,key=lambda x:x[0])
for i in range(n-1):
    G[d[i][2]].append((d[i+1][0]-d[i][0],d[i+1][2]))
    G[d[i+1][2]].append((d[i+1][0]-d[i][0],d[i][2]))
d=sorted(d,key=lambda x:x[1])
for i in range(n-1):
    G[d[i][2]].append((d[i+1][1]-d[i][1],d[i+1][2]))
    G[d[i+1][2]].append((d[i+1][1]-d[i][1],d[i][2]))
used = [0 for i in range(n)]
que = [(c, w) for c, w in G[0]]
used[0] = 1
heapify(que)

ans = 0
while que:
    cv, v = heappop(que)
    if used[v]:
        continue
    used[v] = 1
    ans += cv
    for c, w in G[v]:
        if used[w]:
            continue
        heappush(que, (c, w))
print(ans)

Measured memory_bytes: 78272
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;


int main(){
    ll A,B,Q,s[100010],t[100010],x[100010],sh,sl,th,tl,ans;
    cin >>A>>B>>Q;
    for(int i=1;i<A+1;i++) cin >>s[i];
    for(int i=1;i<B+1;i++) cin >>t[i];
    rep(i,Q) cin >>x[i];
    s[0] =(-LLINF);
    s[A+1] =LLINF;
    t[0] =(-LLINF);
    t[B+1] =LLINF;
    rep(i,Q){
        sh=*lower_bound(s,s+A+2,x[i]);
        sl=*(lower_bound(s,s+A+2,x[i])-1);
        th=*lower_bound(t,t+B+2,x[i]);
        tl=*(lower_bound(t,t+B+2,x[i])-1);
        ll ans0=min(sh-x[i]+abs(sh-th),sh-x[i]+abs(sh-tl));
        ll ans1=min(x[i]-sl+abs(th-sl),x[i]-sl+abs(sl-tl));
        ll ans2=min(th-x[i]+abs(sh-th),th-x[i]+abs(sl-th));
        ll ans3=min(x[i]-tl+abs(tl-sh),x[i]-tl+abs(tl-sl));
        ans =min(min(ans0,ans1),min(ans2,ans3));
        cout <<ans <<endl;
    }
    return 0;
}

Measured memory_bytes: 3712
n = gets.to_i
f = []
p = []
n.times do
  f << gets.split.map(&:to_i)
end
n.times do
  p << gets.split.map(&:to_i)
end
ans = []
(1..2**10-1).each do |i|
  a = i.to_s(2).rjust(10, '0').split(//).map(&:to_i)
  score = 0
  n.times do |j|
    score += p[j][a.zip(f[j]).count([1,1])]
  end
  ans << score
end
p ans.max

Measured memory_bytes: 3836
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define Min(a,b) a=min(a,b);
#define Max(a,b) a=max(a,b);
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N 500010
ll n;string s;

vector<ll> v;
ll mu[N],le[N],ri[N];
ll Calc(){
    lol(i,v.size())mu[i]=le[i]=ri[i]=0;
    for(ll i=0;i<v.size()-1;i++){
	Max(mu[i+1],mu[i]);
	Max(mu[i+1],ri[i]);
	Max(mu[i+1],le[i]);
	
	Max(le[i+1],mu[i]+v[i]);
	//Max(le[i+1],ri[i]);
	Max(le[i+1],le[i]+v[i]-1);
	
	Max(ri[i+1],mu[i]+v[i+1]);
	Max(ri[i+1],ri[i]+v[i+1]-1);
	if(v[i]>1){
	    Max(ri[i+1],le[i]+v[i+1]);
	}
    }
    ll pos=v.size()-1;
    ll res=max(mu[pos],max(le[pos],ri[pos]));
    return res;
}
ll Solve(){
    if(v.size()==0)return 0;
    if(v.size()==1){
	v.clear();
	return 0;
    }
    //lol(i,v.size())cout<<mu[i]<<" ";cout<<endl;
    //lol(i,v.size())cout<<le[i]<<" ";cout<<endl;
    //lol(i,v.size())cout<<ri[i]<<" ";cout<<endl;
    ll res=Calc();
    //for(auto x:v)cout<<x<<" ";cout<<"ans="<<res<<endl;
    reverse(v.begin(),v.end());
    Max(res,Calc());
    v.clear();
    return res;
}
int main(){
    cin>>n;
    cin>>s;s+="00";
    ll ans=0,len=0;
    lol(i,s.size()){
	if(i&&s[i]=='0'&&s[i-1]=='0'){
	    ans+=Solve();
	    continue;
	}
	if(s[i]=='0'){
	    if(len)
	    v.push_back(len);
	    len=0;
	}
	if(s[i]=='1')len++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4996
#include <bits/stdc++.h>
using namespace std;
string s;
map<string, int> mp;
int N;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin >>N;
    string bef = "";
    for(int i = 1; i <= N; i++){
        cin >>s;
        if(i == 1){
            mp[s] = 1;
        }
        else{
            if(mp[s] || bef[bef.length() - 1] != s[0]){
                puts("No");
                return 0;
            }
            mp[s] = 1;
        }
        bef = s;
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
   ll n, m, c, num;
   cin >> n >> m >> c;
   vl b(m);
   for(auto &it: b) cin >> it;
   int ans = 0;
   for(int i = 0; i < n; ++i) {
        ll temp = 0;
        for(int j = 0; j < m; ++j) {
            cin >> num;
            temp += (num*b[j]);
        }
        if((temp + c) > 0) ++ans;
   }
   cout << ans;
}


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

using namespace std;
typedef long long ll;
int main(){
	string s;
	ll sum = 0;
	cin>>s;
	int l = s.length();
	for(int i=0;i<l;i++){
		sum += (s[i]-'0');
	}
	if(sum % 9 ==0) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>

using namespace std;
long long gcd(long long a, long long b);

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

int main()
{
    long long a, b;
    std::cin >> a >> b;
    long long n = a;
    long long m = b;

    long long num = gcd(n, m);

    long long lcd = (a * b) / num;
    std::cout << lcd;

    return EXIT_SUCCESS;
}


Measured memory_bytes: 504
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(c >= a && c <= b) System.out.println("Yes");
        else if(c >= b && c <= a) System.out.println("Yes");
        else System.out.println("No");

        sc.close();
 
    }
 
}


Measured memory_bytes: 22868
def calc_dp():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))

    dp = [0]*N
    for i in range(1,N):
        start = max(0,i-K)
        dp[i] = min([dp[j] + abs(h[j]-h[i]) for j in range(start,i)])
    print(dp[-1])

if __name__ == "__main__":
    calc_dp()

Measured memory_bytes: 13928
from fractions import gcd

N, M = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a = set(a)

c = set()
l = 1
for ai in a:
    l *= ai // gcd(l, ai)
    if 0.5 * l > M:
        ans = 0
        break
    j = 0
    while True:
        if (ai >> j) % 2 == 0:
            j += 1
        else:
            c.add(j)
            break
    if len(c) > 1:
        ans = 0
        break
else:
    ans = (M + l // 2) // l

print(ans)


Measured memory_bytes: 16368
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll INF = numeric_limits<ll>::max()/2;

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

    int h,w,d;cin>>h>>w>>d;
    map<int,P> mp; // Li -> P(xi, yi)
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int a;cin>>a;
            mp[a]=P(i,j);
        }
    }
    vector<ll> dis(100000,INF);
    for(int i=1;i<=d;i++) dis[i]=0;
    for(int i=d+1;i<=h*w;i++){
        P st=mp[i-d],gt=mp[i];
        int dif=abs(st.first-gt.first)+abs(st.second-gt.second);
        dis[i]=dis[i-d]+dif;
    }
    int q;cin>>q;
    for(int i=0;i<q;i++){
        int l,r;cin>>l>>r;
        cout<<dis[r]-dis[l]<<endl;
    }
}


Measured memory_bytes: 7552
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<tgmath.h>
#include<queue>
using namespace std;
#define P pair<int,int>
#define iP pair<int,P>
#define lld long long

int main(){
    int N,X,Y;
    lld ans[2001];
    cin >> N >> X >> Y;
    X--; Y--;
    memset(ans,0,sizeof(ans));
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            int diff = j-i;
            if(i <= X && Y <= j){
                diff = min(diff,(X-i)+1+(j-Y));
                ans[diff]++;
            } else if(X <= i && i <= Y && Y <= j){
                diff = min(diff,(i-X)+1+(j-Y));
                ans[diff]++;
            } else if(i <= X && X <= j && j <= Y){
                diff = min(diff,(X-i)+1+(Y-j));
                ans[diff]++;
            } else if(X <= i && j <= Y){
                diff = min(diff,(i-X)+1+(Y-j));
                ans[diff]++;
            } else if(Y < i || j < X){
                ans[diff]++;
            } else {
                cout << "ELL" << " " << i+1 << " " << j+1 << endl;
            }
            //cout << i+1 << " " << j+1 << " " << diff << endl;
        }
    }
    for(int i=1;i<N;i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

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

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

  long long ans=n-1;
  for(int i=1; i<=sqrt(n); ++i){
    if(n%i==0 && ans>i-1+n/i-1)ans=i-1+n/i-1;
  }

  cout<<setprecision(13)<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if(n >= m){
            System.out.println(0);
            return;
        }
        int[] al = new int[200001];
        int min = Integer.MAX_VALUE;
        int max = -Integer.MAX_VALUE;
        for(int i = 0; i < m; i++){
            int j = sc.nextInt()+100000;
            al[j] += 1;
            min = Math.min(min,j);
            max = Math.max(max,j);
        }
        Queue<Integer> q = new PriorityQueue<>(Collections.reverseOrder());
        int cnt = 0;
        for(int i = min; i <= max; i++){
            if(al[i] == 0){
                cnt++;
            }else{
                if(cnt != 0){
                    q.add(cnt);
                    cnt = 0;
                }
            }
        }
        int ans = max-min-n;
        while(n - 1 > 0 && q.size() > 0){
            ans -= q.poll();
            n--;
        }
        System.out.println(ans+1);
    }
    
}

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

int main(){
    int lake, num, le=0;
    cin >> lake >> num;

    vector<int> v(num);
    for(int i=0; i<num; i++){
        cin >> v[i];
    }
    
    for(int i=1; i<num; i++){
        le = max(le, v[i]-v[i-1]);
    }

    le = max(le, lake - v[num-1] + v[0]);

    cout << lake - le << endl;
    return 0;
}

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

int main()
{
    string n;
    bool a = false;
    cin >> n;
    if (n[0] == '7') a = true;
    if (n[1] == '7') a = true;
    if (n[2] == '7') a = true;

    cout << (a ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<math.h>
#include<climits>
#include<set>
#define debug(x) cout <<#x<<" = "<<x<<endl
#define debug2(x, y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define gg cout <<"---------------QAQ---------------"<<endl
#define fi first
#define SZ(x) (int)x.size()
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, ll> Pii;
template<class T> inline void read(T &x){
    x=0; char c=getchar(); int f=1;
    while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
    while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 2e5+10, maxn = 1e6+5;
void FAST(){ios::sync_with_stdio(false);cin.tie(0);}
const ll mod =  1e9+7;

int n, m, k;
ll x;

void solve()
{
    scanf("%lld", &x);
    ll ans = 100, cnt = 0;
    while(ans < x)
    {
        cnt++;
        ans += ans/100;
    }
    printf("%lld\n", cnt);
}


int main()
{

//    int _; scanf("%d", &_); while(_--)
//    while(~scanf("%d", &n))
//    while(scanf("%d", &n)&&n)
    solve();
    return 0;
}


Measured memory_bytes: 3816
X = input().split()
N = int(X[0])
M = int(X[1])
sc = []
 
 #リストscの[偶数]には桁、[奇数]には数字
for r in range(M):
  sc += input().split()

#scをint化
insect = [int(i) for i in sc]

#ループ開始の数字を10^(N-1)にセット
k = 1
for r in range(N-1):
	k = k*10

l = 10*k
ans = -1

if k == 1:
	k = 0
	
#k～10*k - 1について
for r in range(k, l, 1):

	#１文字ずつ見たいのでとりあえずリスト化
	U = list(str(r))
	t = 0

	#左から●番目の文字が▲と一致していれば t をインクリメント
	for s in range(M):
		if U[insect[2*s]-1] == str(insect[2*s+1]):
			t += 1
	#tが条件の数と一致したらansにそのときのrを代入し、ループから抜ける
	if t == M:
		ans = r
		break



#そのときのansの値を出力

print(ans)

Measured memory_bytes: 3064
import numpy as np
N = int(input())
queue = [list(map(int, input().split())) for _ in range(N)]


max_N = 100100
prime = list(np.ones(max_N, dtype=int))
a = list(np.zeros(max_N, dtype=int))
b = list(np.zeros(max_N+1, dtype=int))

prime[0], prime[1] = 0, 0
for i in range(2, max_N):
    if i == 0:
        continue
    for j in range(i*2, max_N, i):
        prime[j] = 0

for i in range(1, max_N):
    if i % 2 == 0:
        continue
    if prime[i] == 1 and prime[int((i + 1) / 2)] == 1:
        a[i] = 1
for i in range(0, max_N):
    b[i + 1] = a[i] + b[i]

for i in queue:
    print(b[i[1]+1]-b[i[0]])


Measured memory_bytes: 50748
import java.util.Scanner;


public class Main{

	public static void main(String args[]){

		long MOD=1000000007L;

		Scanner sc = new Scanner(System.in);

		String s=sc.next();
		char c[]=s.toCharArray();
		int k=c.length;
		int count=0;
		long p3[]=new long[k+1];
		long p2[]=new long[k+1];
		p2[0]=1L;
		p3[0]=1L;
		for(int i=1;i<=k;++i){
			p3[i]=p3[i-1]*3%MOD;
			p2[i]=p2[i-1]*2%MOD;
		}

		long ans=0L;

		for(int i=0;i<k;++i){
			if(c[i]=='1'){
				ans = (ans + p3[k-i-1]*p2[count])%MOD;
				++count;
			}
		}
		ans=(ans+p2[count])%MOD;
		System.out.println(ans);
	}
}

Measured memory_bytes: 26304
from collections import Counter
import sys
MOD = 998244353


def main():
    n, *d =  map(int, sys.stdin.buffer.read().split())
    D = Counter(d)
    if D[0] != 1:
        print(0)
    else:
        ans = 1
        for i in d[1:]:
            ans = ans*D[i-1]%MOD
        print(ans % MOD)


if __name__ == '__main__':
    main()


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

using namespace std;

long long tokei[111111];
long long tokeiRev[111111];
long long han[111111];
long long hanRev[111111];

int main()
{
	long long n,c;cin >> n >> c;
	vector<pair<long long,long long>> susi;
	vector<pair<long long,long long>> reversed_susi;
	
	for(int i = 0;i < n;i++){
		long long x,v;
		cin >> x >> v;
		susi.push_back(make_pair(x,v));
		reversed_susi.push_back(make_pair(c-x,v));
	}
	
	sort(susi.begin(),susi.end());
	sort(reversed_susi.begin(),reversed_susi.end());
	
	//for(int i = 0;i < n;i++)cout << "(" << susi[i].first << ',' << susi[i].second << ")" << ' ';cout << endl;
	//for(int i = 0;i < n;i++)cout << "(" << reversed_susi[i].first << ',' << reversed_susi[i].second << ")" << ' ';cout << endl;
	
	long long sum = 0;
	long long hansum = 0;
	for(int i = 1;i <= n;i++){
		sum += susi[i-1].second;
		hansum += reversed_susi[i-1].second;
		tokei[i] = max(tokei[i-1],sum - susi[i-1].first);
		tokeiRev[i] = max(tokeiRev[i-1],sum - 2 * susi[i-1].first);
		han[i] = max(han[i-1],hansum - reversed_susi[i-1].first);
		hanRev[i] = max(hanRev[i-1],hansum - 2 * reversed_susi[i-1].first);
	}
	
	//for(int i = 0;i <= n;i++)cout << tokei[i] << ' ';cout << endl;
	//for(int i = 0;i <= n;i++)cout << tokeiRev[i] << ' ';cout << endl;
	//for(int i = 0;i <= n;i++)cout << han[i] << ' ';cout << endl;
	//for(int i = 0;i <= n;i++)cout << hanRev[i] << ' ';cout << endl;
	
	long long answer = 0;
	
	for(int i = 0;i <= n;i++){
		answer = max(answer,tokei[i] + hanRev[n-i]);
		answer = max(answer,tokeiRev[i] + han[n-i]);
	}
	
	cout << answer << endl;
		
	
	return 0;
}

Measured memory_bytes: 6756
//stack


#include<stdio.h>
#define N 100


void workspace(char *);

void push(int*,int *,int);
int pop(int*,int *);

int char2i(char);
//char i2char(int);

int stack[N];
int count = 0;
int main()
{
  int i=0;
  char input[N];

  //input data
  
  while(scanf("%s",input) == 1) {
    workspace(input);
  }

  //output data
  
    

  printf("%d\n",/*char2i(workspace(input))*/pop(stack,&count));

  return 0;
  
}

void  workspace(char *input)
	       
{
  int i,sum=0;
  int first,second;
  if('1' <= input[0] && '9' >= input[0])
    {
      for(i = 0; input[i] != '\0'; i++)
	{
	  sum=10*sum+char2i(input[i]);
	}
      push(stack,&count,sum);
    }



  else{
    if(input[0] == '+')
      {
	second = pop(stack,&count);
	first = pop(stack,&count);

	push(stack,&count,first + second);
      }
    else if(input[0] == '-')
      {
	second = pop(stack,&count);
	first = pop(stack,&count);

	push(stack,&count,first - second);
      }
    else if(input[0] == '*')
      {
	second = pop(stack,&count);
	first = pop(stack,&count);

	push(stack,&count,first * second);
      }	  
  }

      
}



void push(int *stack,int *count,int m)
{
  stack[(*count)++] = m;
}

int pop(int *stack,int *count)
{
  return stack[--(*count)];
}

int char2i(char m)
{
  return m - '0';
}

/*char i2char(int i)
{
  return i + '0';
  }*/



Measured memory_bytes: 2052
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n;
    std::cin>>n;
    std::vector<int> a(n);
    for(int i = 0;i < n;i++){
        std::cin>>a[i];
    }

    std::sort(a.begin(), a.end(), std::greater<int>());
    int res = 0;
    for(int i = 0;i < n - 1;i++){
        res += a[i] - a[i + 1];

    }
    std::cout<<res<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define MN 200000
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,m,a[MN+5],vis[MN+5];
int main()
{
	n=read();m=read();
	if(m==1||m==n*2-1) return 0*puts("No");
	if(m==2) a[n]=2,a[n+1]=1;
	else if(m==n*2-2) a[n]=m,a[n+1]=m+1;
	else a[n]=m,a[n+1]=1,a[n+2]=m+1,a[n-1]=m+2;
	for(int i=1;i<n*2;++i) vis[a[i]]=1;
	puts("Yes");
	for(int i=1,j=1;i<n*2;++i)
	{
		while(vis[j]) ++j;
		if(!a[i])a[i]=j++;
		printf("%d\n",a[i]);
	}
	return 0;
}



Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define v(n) int n; cin>>n;
using namespace std;

int main() {
	int a, b, x;
	cin >> a >> b;
	x = 0;
	rep(i, a) {
		int q;
		cin >> q;
		if (b <= q) x++;
		}
	cout << x << endl;
	}

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

#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FORD(i, b, a) for (int i = b; i >= a; --i)
#define FORE(i, v) for (__typeof (v.begin()) i = v.begin(); i != v.end(); ++i)
#define FORR(i, v) for (__typpeof (v.rbegin()) i = v.rbegin(); i != v.rend(); ++i)
#define sz(v) (int) v.size()
#define all(v) v.begin(), v.end()
#define sqr(x) 1ll * (x) * (x)
#define EPS 1e-9

template <class T> int getBit(T x, int k) { return x >> k & 1; }
template <class T> T onBit(T x, int k) { return x  (T(1) << k); }
template <class T> T offBit(T x, int k) { return x & (~(T(1) << k)); }

const int N = 1e5 + 10;

int n;
int cnt[N];

void load() {
  scanf("%d", &n);
  REP(i, n) {
    int x; scanf("%d", &x);
    cnt[x]++;
  }
}

void process() {
  int answer = 0;
  REP(i, N) {
    int cur = cnt[i];
    if (i > 0) cur += cnt[i - 1];
    if (i < N - 1) cur += cnt[i + 1];
    answer = max(answer, cur);
  }
  printf("%d\n", answer);
}

int main() {
//  freopen("input.in", "r", stdin);
  //freopen("output.out", "w", stdout);

  load();
  process();

  return 0;
}


Measured memory_bytes: 640
/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
//#define int long long
#define double long double
#define endl '\n'
#define PI 3.14159265359

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

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
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...);
}
#else
#define trace(...)
#endif

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

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 310;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int) 998244353;
int n , a[maxn];
double dp[maxn][maxn][maxn];
int c1 = 0 , c2 = 0 , c3 = 0;

signed main() {
    
    fio;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        c1 += (a[i] == 1);
        c2 += (a[i] == 2);
        c3 += (a[i] == 3);
    }
    
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            for(int k = 0; k <= n; k++){
                int tot = i + j + k;
                if(tot == 0) continue;
                if(i > 0) dp[i][j][k] = (dp[i - 1][j + 1][k] + 1.0L) * i / tot;
                if(j > 0) dp[i][j][k] += (dp[i][j - 1][k + 1] + 1.0L) * j / tot;
                if(k > 0) dp[i][j][k] += (dp[i][j][k - 1] + 1.0L) * k / tot;
                dp[i][j][k] += (n - tot) * 1.0L / tot;
            }
        }
    }
    
    cout.precision(17);
    cout << fixed << dp[c3][c2][c1] << endl;
    
    
    
    
    return 0;
    
}


Measured memory_bytes: 452864
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll mod = 998244353;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 4000000;
ll n, m, fact[maxn + 300], inv[maxn + 300];
ll bp(ll a, ll p) {
	ll res = 1;
	while (p) {
		if (p & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		p >>= 1;
	}
	return res;
}
void setup() {
	fact[0] = 1;
	for (int i = 1; i <= maxn; i++)
		fact[i] = (fact[i - 1] * i) % mod;
	inv[maxn] = bp(fact[maxn], mod - 2);
	for (int i = maxn; i--;)
		inv[i] = (inv[i + 1] * (i + 1)) % mod;
}
ll nck(ll n, ll k) {
	ll t = (fact[n] * inv[n - k]) % mod;
	return (t * inv[k]) % mod;
}
ll solve(ll S, ll N) {
	return nck(S + N - 1, N - 1);
}
#define M(x) ((x)%mod)
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	setup();
	cin >> n >> m;
	ll ans = 0;
	for (int odd = 0; odd <= min(n, m); odd++) {
		if ((3 * m - odd) % 2 == 0)
			ans = (ans + solve((3 * m - odd) / 2, n) * nck(n, odd)) % mod;
	}
	for (int odd = 0; odd <= min(n, m); odd++) {
		if ((m - odd) % 2 == 0)
			ans = (mod + ans - M(n*M((solve((m - odd) / 2, n) * nck(n, odd))))%mod) % mod;
	}
	for (int odd = 0; odd <= min(n-1, m); odd++) {
		if ((m - odd) % 2 == 0)
			ans = (ans + M(n*M(solve((m - odd) / 2, n-1) * nck(n-1, odd)))) % mod;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 62720
while True:
    try:
        a = []
        b = []
        a = list(map(int, input()))

        while len(a) != 1:
            for j in range(len(a)-1):
                b.append(a[j]+ a[j+1])
            
            a = b
            b = []

        ans = a[-1] % 10
        print(ans)

    except EOFError:
        break


Measured memory_bytes: 5592