akhauriyash/Code-Regression huggingface dataset:
package main

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

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

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

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	k := r.nextInt()

	s := 0
	for i := 1; i <= k; i++ {
		for j := 1; j <= k; j++ {
			g := gcd(i, j)
			for l := 1; l <= k; l++ {
				s += gcd(g, l)
			}
		}
	}

	fmt.Fprintln(stdout, s)
}


Measured memory_bytes: 1764
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    int l, r, d; cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; i++) {
        if (i % d == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
# encoding: utf-8
N, Y = map(int, input().split())

# 9 * a + 4 * b = (Y // 1000) - N
target = Y // 1000 - N
ans = [-1, -1, -1]
for b in range(N + 1):
    for a in range(N + 1):
        if 9 * a + 4 * b > target: continue
        elif a + b > N: continue
        elif 9 * a + 4 * b == target:
            ans = [a, b, N - (a + b)]
            break
    if 9 * a + 4 * b == target: break

print(ans[0], ans[1], ans[2])

Measured memory_bytes: 3064
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

B = INT()
S = input()
K = INT()

ans = ""
for x in S:
	if x != S[K-1]:
		ans += "*"
	else:
		ans += S[K-1]
print(ans)

Measured memory_bytes: 5144
n = int(input())
exps = [0] * 1003

for i in range(2, n+1):
    t = i
    div = 2
    while div*div <= i:
        if t % div == 0:
            exps[div] += 1
            t //= div
        else:
            div += 1
    if t != 1:
        exps[t] += 1

ans = 1
mod = int(1e9) + 7

for i in range(2, n+1):
    ans *= (exps[i] + 1)
    ans %= mod

print(ans)

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

double solve() {
    ll A, B, H, M;
    cin >> A >> B >> H >> M;
    double x1 = A*cos((H+M/60.0)/12.0*2*M_PI), y1 = A*sin((H+M/60.0)/12.0*2*M_PI);
    double x2 = B*cos(M/60.0*2*M_PI), y2 = B*sin(M/60.0*2*M_PI);
    double dx = x1 - x2, dy = y1 - y2;
    double ans = sqrt(dx*dx+dy*dy);
    return ans;
}

int main() {
    cout.setf(ios::fixed);
    cout.precision(16);
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

using namespace std;


typedef long long ll;

int main() {
	ll n, k;

	cin >> n >> k;

	vector<ll> h(n, 0);
	for (ll i = 0; i < n; i++) {
		cin >> h[i];
	}

	vector<ll> sol(n, INT_MAX);

	sol[0] = 0;
	for (ll i=1; i < n; i++) {
		for (ll j = i-1; j >= max(0ll, i-k); j--) {
			sol[i] = min(sol[i], sol[j] + abs(h[i] - h[j]));
		}
	}

	cout << sol[n-1] << endl;
	return 0;
}


Measured memory_bytes: 4816
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n, k, s; cin>>n>>k>>s;

    vector<int> ans(n);
    for(int i=0; i<k; i++) ans[i] = s;
    for(int i=k; i<n; i++){
        if(s == 1) ans[i] = 2;
        else ans[i] = s - 1;
    }

    for(int i=0; i<n; i++){
        cout << ans[i] << " \n"[i == n - 1];
    }

    return 0;
}

Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DFTRobot solver = new DFTRobot();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFTRobot {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            int[] x = new int[2];
            x[0] = in.nextInt();
            x[1] = in.nextInt();

            List<Integer>[] steps = new List[2];
            steps[0] = new ArrayList<>();
            steps[1] = new ArrayList<>();

            int cur = 0, dir = 0;
            for (char c : s) {
                if (c == 'T') {
                    steps[dir].add(cur);
                    cur = 0;
                    dir = (dir + 1) % 2;
                } else {
                    cur++;
                }
            }
            steps[dir].add(cur);

            x[0] -= steps[0].get(0);
            steps[0].set(0, 0);

            boolean answer = true;
            for (int i = 0; i < 2; i++) {
                answer &= possible(steps[i], x[i]);
            }

            out.println(answer ? "Yes" : "No");
        }

        private static boolean possible(List<Integer> steps, int x) {
            HashSet<Integer> possible = new HashSet<>();
            possible.add(0);

            for (int s : steps) {
                HashSet<Integer> newPossible = new HashSet<>();
                for (int p : possible) {
                    newPossible.add(p + s);
                    newPossible.add(p - s);
                }
                possible = newPossible;
            }

            return possible.contains(x);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 138088
#include<cstdio>
using namespace std;

const int N=110;
int n,m,a[N][N],f[N][N];

inline int max(int x,int y) {return x>y?x:y;}
int main()
{
	n=2; scanf("%d",&m);
	for (int i=1; i<=n; ++i) for (int j=1; j<=m; ++j)
		scanf("%d",&a[i][j]);
	f[1][1]=a[1][1];
	for (int i=1; i<=n; ++i) for (int j=1; j<=m; ++j)
		f[i][j]=max(f[i-1][j],f[i][j-1])+a[i][j];
	printf("%d",f[n][m]);
	return 0;
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
class work implements Comparable{
  int limittime;
  int spendtime;
 
  public int compareTo(Object other){
    work otherwork = (work)other;
    return limittime - otherwork.limittime;
  }
}
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
 		int n = sc.nextInt();
		
		work[] works = new work[n];
		for(int i = 0; i < n; i++){
			work newwork = new work();
			newwork.spendtime = sc.nextInt();
			newwork.limittime = sc.nextInt();
			works[i] = newwork;
		}
		Arrays.sort(works);
		
		int nowtime = 0;
		boolean check = true;
		for(int i = 0; i < n; i++){
			nowtime += works[i].spendtime;
			if(nowtime > works[i].limittime){
				check = false;
			}
			
		}
		
		if(check){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 33136
def push():
    n = int(input())
    a = [int(input()) for i in range(n)]
    f = [0]*n
    c = 0
    
    p = a[0]
    f[0] = 1
    
    while 1:
        f[p-1] = 1
        c += 1
        if p == 2:
            return c
        p = a[p-1]
        if f[p-1] == 1:
            return -1
print(push())

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

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

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

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

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

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

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

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

fn main() {
    input! {
        a: i32
    }

    println!("{}", a + a * a + a * a * a);
}


Measured memory_bytes: 2156
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
typedef long long int ll;
int main()
{
  ll n,i;
  cin>>n;
  ll a[n];
  ll b[n];
  for(i=0;i<n;i++)
  {
      cin>>a[i];
      b[i]=a[i];
  }
  sort(a,a+n);
  ll p,q;
  if(n==1)
  {
      cout<<a[0];
  }
  else
  {
      p=a[n-1];
      q=a[n-2];
      for(i=0;i<n;i++)
      {
          if(b[i]!=p)
          {
              cout<<p<<"\n";
          }
          else
          {
              cout<<q<<"\n";
          }
      }
  }


}


Measured memory_bytes: 4736
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int s = scanner.nextInt(), m, h;
		s -= (h = (int) (s / 3600)) * 3600;
		s -= (m = (int) (s / 60)) * 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 26180
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int a[4];
string op ="+-*";

int cal(int x,int y,int c){
  switch(c){
  case 0:
    return x+y;
  case 1:
    return x-y;
  case 2:
    return x*y;
  }
}

int main()
{
  while(cin>>a[0]>>a[1]>>a[2]>>a[3],a[0]||a[1]||a[2]||a[3]){
    sort(a,a+4);
    bool flag = true;
    do{
      for(int i = 0;i < 3;i++){//演算子は3*3*3通り
	for(int j = 0;j < 3;j++){
	  for(int k = 0;k < 3;k++){
	    if( cal(cal(cal(a[0],a[1],i),a[2],j),a[3],k) ==10){
	      cout <<"(("<<a[0]<<" "<<op[i]<<" "<<a[1]<<")"<<" "<<op[j]<<" "<<a[2]<<")"<<" "<<op[k]<<" "<<a[3]<<endl;
	      flag = false;
	      i = j = k = 3;
	      break;
	    }
	    if( cal((cal(a[0],cal(a[1],a[2],j),i)),a[3],k) == 10){
	      cout <<"("<<a[0]<<" "<<op[i]<<" ("<<a[1]<<" "<<op[j]<<" "<<a[2]<<"))"<<" "<<op[k]<<" "<<a[3]<<endl;
	      flag = false;
	      i = j = k = 3;
	      break;
	    }
	    if( cal(cal(a[0],a[1],i),cal(a[2],a[3],k),j) ==10){
	      cout <<"("<<a[0]<<" "<<op[i]<<" "<<a[1]<<") "<<op[j]<<" ("<<a[2]<<" "<<op[k]<<" "<<a[3]<<")"<<endl;
	      flag = false;
	      i = j= k= 3;
	      break;
	    }if( cal(a[0],cal(cal(a[1],a[2],j),a[3],k),i) ==10){
	      cout <<a[0]<<" "<<op[i]<<" "<<"(("<<a[1]<<" "<<op[j]<<" "<<a[2]<<") "<<op[k]<<" "<<a[3]<<")"<<endl;
	      flag =false;
	      i = j = k = 3;
	      break;
	    }
	    if( cal(a[0],cal(a[1],cal(a[2],a[3],k),j),i) ==10){
	      cout <<a[0]<<" "<<op[i]<<" "<<"("<<a[1]<<" "<<op[j]<<" ("<<a[2]<<" "<<op[k]<<" "<<a[3]<<"))"<<endl;
	      flag = false;
	      i = j = k = 3;
	      break;
	    }
	  }
	}
      }
    }while(next_permutation(a,a+4)&&flag);
    if(flag){
      cout <<0<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1224
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

// #include <bits/extc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp> // tree
// #include <ext/pb_ds/hash_policy.hpp> // hash
// #include <ext/pb_ds/trie_policy.hpp> // trie
// #include <ext/pb_ds/priority_queue.hpp> // priority_queue
// using namespace __gnu_pbds;

#include <bits/stdc++.h>
using namespace std;

#define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define X first
#define Y second
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define Push push_back

using lli = long long;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
using Double = long double;
template<typename T>
using Vector = vector<vector<T>>;
template<typename T>
using Prior = priority_queue<T>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;

const lli mod = 1E9 + 7;
const Double PI = 3.1415926535846;
const Double eps = 1e-8;

lli fastPow(lli base, lli exp, lli module = mod) {
	lli ans = 1;
	base %= module;
	while (exp) {
		if (exp & 1) ans = ans * base % module;
		base = base * base % module;
		exp >>= 1;
	}
	return ans;
}

bool millerRabin(lli n, lli a) {
	/*
	 * n < 4,759,123,141		3 : {2, 7, 61}
	 * n < 1,122,004,669,633	4 : {2, 13, 23, 1662803}
	 * n < 3,474,749,660,383	6 : {p in [2, 13]}
	 * n < 2^64					7 : 
	 * {2, 325, 9375, 28178, 450775, 9780504, 1795265022}
	 *
	 * else, random everytime gives a 75% of correction
	 */
	
	if (n < 2) return 0;
	if ((a = a%n) == 0) return 1;
	if (n & 1 ^ 1) return n == 2;
	
	lli lowb = (n - 1) & -(n - 1);
	lli tmp = (n - 1) / lowb; // lowbit of (n-1)
	lli t = __lg(lowb);
	lli x = 1;
	
	for (; tmp; tmp /= 2, a = a*a%n) {
		if (tmp & 1) x = x * a % n;
	}
	
	if (x == 1 or x == n - 1) return 1;
	
	while (--t) {
		if ((x = x*x%n) == n - 1) return 1;
	}
	
	return 0;
}

bool MR_PrimeFilter(lli n) {
	vector<lli> v[4];
	v[0] = {2, 7, 61};
	v[1] = {2, 13, 23, 1662803};
	v[2] = {2, 3, 5, 7, 11, 13};
	v[3] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
	
	if (n < 4759123141LL) {
		for (lli x : v[0]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 1122004669633LL) {
		for (lli x : v[1]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 3474749660383LL) {
		for (lli x : v[2]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	for (lli x : v[3]) {
		if (!millerRabin(n, x)) return false;
	}
	return true;
}

void solve() {
	int a, b;
	cin >> a >> b;
	
	if (a == 1 and b == 1) {
		cout << 1000000 << "\n";
	}
	else {
		cout << 100000 * (8 - min(a, 4) - min(b, 4)) << "\n";
	}
}

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

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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(a > 0 || c > 0){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std; 
using   ll=long long;
#define fast           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl           "\n"
#define F(i,n)         for(ll i=0;i<n;i++)
#define rep(i,a,b)     for(ll i=a;i<b;i++)
#define repp(i,a,b)    for(ll i=a;i>=b;i--)
#define pb             push_back
#define mp             make_pair
#define vll            vector<ll>
#define f              first
#define s              second
#define pll            pair<ll,ll>
#define ALL(v)         v.begin(),v.end()
#define ALLR(v)        v.rbegin(),v.rend()
#define pii            3.14159265358979323
#define MAX            1000001
int digit(ll n)
{
    ll cnt=0;
    while(n>0)
    {
        cnt++;
        n/=10;
    }
    return cnt;
}
void solve(){
 
    
    ll n,ans=0;
 
    cin>>n;
 
    ll temp=digit(n);
 
    if(temp%2)
    {
        if(temp==1)    ans=n;
        if(temp==3)    ans=n-90;
        if(temp==5)    ans=n-9999+909;
    }
    else
    {
        if(temp==2)   ans=9;
        if(temp==4)   ans=909;
        if(temp==6)   ans=90909;
    }
 
    cout<<ans;
 
 
 
}
 
signed main(){
 
    fast;
 
    solve();
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define per(i,n) for ((i)=n;(i)>=(1);(i)--)
using namespace std;
int n,a,b,i,j,stk[4005],ans[4005],tp;
char s[15];
void query(int x,int y){printf("? %d %d\n",x-1,y-1);fflush(stdout);scanf("%s",s);}
int main()
{
	scanf("%d%d",&a,&b);
	if(a<=b)
	{
		puts("Impossible");
		return 0;
	}
	n=a+b;
	rep(i,n)
	{
		if(!tp) stk[++tp]=i;
		else
		{
			query(stk[tp],i);
			if(s[0]=='Y') stk[++tp]=i; else tp--;
		}
	}
	rep(i,n)
	{
		query(stk[tp],i);
		if(s[0]=='Y') ans[i]=1;
	}
	printf("! ");
	rep(i,n) printf("%d",ans[i]);
	puts(""); 
	return 0;
}

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

int main() {
    int a,b,c;
    int count = 0;
    cin >> a >> b >> c;
    
    for(int i=a; i<=b; i++) {
        if(c % i == 0) {
            count++;
        }
    }
    
    cout << count << endl;
}


Measured memory_bytes: 3084
import math
x = int(input())


def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  m = int(math.sqrt(n)) + 1
  for p in range(3, m, 2):
      if n % p == 0:
        return False
  return True

while isPrime(x)==False:
    x += 1

print(x)


Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << max(max(a + b, a + a - 1), b + b - 1)  << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.math.*;
class Main{
    public static void main(String[] args){
    BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
    try {
	while(true){
	int n = Integer.valueOf(sc.readLine());
	if(n==0) break;
	int[] sum = new int[7];
	for(int i=0; i<n; i++){
	int j = Integer.valueOf(sc.readLine());
	if(j>60) j = 60;
	sum[j/10]++;
	}
	for(int i=0; i<7; i++)	
	System.out.println(sum[i]);
	}
    }catch(Exception e){
        System.out.println("Error");
    }
    }
}

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

S = (N - 1) * (N - 2) // 2

if K > S:
    print(-1)
else:
    D = S - K
    M = (N - 1) + D
    print(M)
    for i in range(2, N + 1):
        print('{} {}'.format(1, i))
    a, b = 2, 3
    for i in range(D):
        print('{} {}'.format(a, b))
        b += 1
        if b == N + 1:
            a += 1
            b = a + 1


Measured memory_bytes: 42728
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
#define intt long long

int main() {
	std::string S; std::cin >> S;
	intt N = S.size();
	intt ans = 0;
	for (int bit = 0; bit < (1 << N - 1); ++bit) {
		intt total = 0;
		for (int i = 0; i < N - 1; ++i) {
			total *= 10;
			total += S[i] - '0';
			if (bit & (1 << i)) {
				ans += total;
				total = 0;
			}
		}
		total *= 10;
		total += S.back() - '0';
		ans += total;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 3624
#include<stdio.h>
#define STLING_MAX 1200
#define ALPHABET 26
#define ASCII_A 65
#define ASCII_Z 90
#define ASCII_a 97
#define ASCII_z 122
#define SHARE_L_S 0x1f
#define DIFF 1
#define LOOP_RESET 0
#define ARRY_RESET 0
#define COUNT_RESET 0
#define COUNT 1
#define RESET 0
unsigned short s_scan_sentence(unsigned char * str, unsigned short length_max);
void s_count_alphabet(unsigned char * str, unsigned short * num_check, unsigned short length);

int main(){
	unsigned short usW_D_length;                	/* 文字列長格納の変数 */
	unsigned char ubW_D_str[STLING_MAX];        	/* 文字列格納の配列 */
	unsigned short usW_D_num_check[ALPHABET];   	/* アルファベットの数を記録する配列 */
	unsigned short usW_C_i;                     	/* ループ変数 */
	
	/* 文字列配列の初期化 */
	for(usW_C_i = LOOP_RESET;usW_C_i < STLING_MAX;usW_C_i++){
		ubW_D_str[usW_C_i] = ARRY_RESET;
	}
	/* アルファベットの数を記録する配列の初期化 */
	for(usW_C_i = LOOP_RESET;usW_C_i < ALPHABET;usW_C_i++){
		usW_D_num_check[usW_C_i] = ARRY_RESET;
	}
	
	/* 文字列入力 */
	usW_D_length = s_scan_sentence(ubW_D_str, STLING_MAX);
	
	/* アルファベットの数をカウント */
	s_count_alphabet(ubW_D_str, usW_D_num_check, usW_D_length);
	
	/* カウントした結果を出力 */
	for(usW_C_i = LOOP_RESET;usW_C_i < ALPHABET;usW_C_i++){
		/* a : (aの個数) の形式で出力 */
		printf("%c : %d\n", (usW_C_i + ASCII_a), *(usW_D_num_check + usW_C_i));
	}
	
	return RESET;
}

/* 関数名：文字列入力 */
/* 概要：文字列を入力する。その長さを返す */
/* 引数：文字列を格納する配列の先頭アドレス、その配列の大きさ */
/* 戻り値：入力された文字列の長さ */
unsigned short s_scan_sentence(unsigned char * str, unsigned short length_max)
{
	unsigned short usW_C_count_text = COUNT_RESET;  	/* 文字列長カウンタ */
	unsigned short usW_C_i;                         	/* ループ変数 */

	/* 文字列の入力 */
	for(usW_C_i = LOOP_RESET;usW_C_i < length_max;usW_C_i++){
		scanf("%c", str + usW_C_i);
		/* 入力終了の処理 */
		if(*(str + usW_C_i) == EOF){
			break;
		}
		/* 文字数をカウント */
		usW_C_count_text++;
	}

	/* 文字列長を返す */
	return usW_C_count_text;
}

/* 関数名：アルファベットカウント */
/* 概要：渡された文字列に各アルファベットが何文字含まれるか調べる */
/* 引数：文字列が格納された配列の先頭アドレス、アルファベットの数を記録する配列の先頭アドレス、文字列の長さ */
/* 戻り値：なし */
void s_count_alphabet(unsigned char * str, unsigned short * num_check, unsigned short length)
{
	unsigned short usW_C_i; 	/* ループ変数 */
	unsigned char ubW_D_sub;	/* 計算用変数 */
	
	/* 文字列中に各アルファベットが何文字含まれるか調べる */
	for(usW_C_i = LOOP_RESET;usW_C_i < length;usW_C_i++){
		/* アルファベットの場合カウント */
		if(((ASCII_A <= *(str + usW_C_i)) && (*(str + usW_C_i) <= ASCII_Z)) || ((ASCII_a <= *(str + usW_C_i)) && (*(str + usW_C_i) <= ASCII_z))){
			/* アルファベットを配列の添え字として使える形に加工 */
			ubW_D_sub = (*(str + usW_C_i) & SHARE_L_S) - DIFF;
			/* 文字列中に含まれていたアルファベットをカウント */
			*(num_check + ubW_D_sub) += COUNT;
		}
	}
}




Measured memory_bytes: 2040
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

    int n;
    cin >> n;

    vector<int> a(n);

    vector<int> res(n);

    rep(i,n){
        cin >> a[i];
    }

    rep(i, 32){
        int cnt = 0;
        rep(j, n){
            if(1ll << i & a[j]){
                ++cnt;
            }
        }
        if(cnt & 1){
            rep(j,n){
                if((1ll << i & a[j]) == 0){
                    res[j] |= 1ll << i;
                }
            }
        }else{
            rep(j,n){
                if(1ll << i & a[j]){
                    res[j] |= 1ll << i;
                }
            }
        }
    }

    rep(i,n){
        cout << res[i] << (i == n-1 ? '\n' : ' ');
    }

    return 0;
}



Measured memory_bytes: 6324
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int arr[100];
int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    int cnt = 0;
    for (int i = 0; i < m; ++i) {
        scanf("%d", arr + i);
        if (arr[i] & 1) ++cnt;
    }
    if (m == 1) {
        if (arr[0] == 1) {
            printf("1\n1\n1\n");
            return 0;
        }
        printf("%d\n2\n%d 1\n", arr[0], arr[0] - 1);
        return 0;
    }
    if (cnt > 2) {
        printf("Impossible\n");
        return 0;
    }
    for (int i = 0; i < m; ++i) {
        if (arr[i] & 1) {
            swap(arr[0], arr[i]);
            break;
        }
    }
    for (int i = m; --i; ) {
        if (arr[i] & 1) {
            swap(arr[m - 1], arr[i]);
            break;
        }
    }
    for (int i = 0; i < m; ++i) printf("%d ", arr[i]);
    printf("\n%d\n", m - (arr[0] == 1));
    if (arr[0] - 1) printf("%d ", arr[0] - 1);
    for (int i = 1; i + 1 < m; ++i) printf("%d ", arr[i]);
    printf("%d\n", arr[m - 1] + 1);
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

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

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

int main(){
  ll n; cin >> n; vl num(n);
  
  rep(i,n) cin >> num[i];
  
  sort(all(num));
  
  cout << abs(num[n-1] - num[0]) << endl;
  
  
}

Measured memory_bytes: 3664
n=int(input())
dp=[0]*101
dp[4]=1
dp[7]=1
for i in range(101):
  if dp[i]==1 and i+4<101:
    dp[i+4]=1
  if dp[i]==1 and i+7<101:
    dp[i+7]=1

if dp[n]==0:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int cards[4][13];
int main(){
    int n;
    cin >> n;
    char c;
    int cn;
    for (int i = 0; i < n; i++){
        cin >> c >> cn;
        switch (c){
            case 'S':
                cards[0][cn-1] = 1;
                break;
            case 'H':
                cards[1][cn-1] = 1;
                break;
            case 'C':
                cards[2][cn-1] = 1;
                break;
            case 'D':
                cards[3][cn-1] = 1;
                break;
        }
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 13; j++){
            if(!cards[i][j]) {
                char s;
                switch(i){
                    case 0: s = 'S'; break;
                    case 1: s = 'H'; break;
                    case 2: s = 'C'; break;
                    case 3: s = 'D'; break;
                }
                cout << s << " " << j+1 << endl;
            }
        }
    }
}

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

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

    vector<long long> A(n);
    vector<long long> B(n);
  
    ios::sync_with_stdio(false);
  
    for(long long i=1; i<n; i++){
        cin >> A.at(i);
        B.at(A.at(i)-1)++;
    }

    for(long long i=0; i<n; i++){
        cout << B.at(i) << endl;
    }
  
    return 0;
}


Measured memory_bytes: 6428
#include <iostream>
#include <vector>
#include <tuple>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
 
 
    int x,y,z;
    cin >> x >> y >> z;
    
    cout << z << " " << x << " " << y << endl;
   
}


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

using namespace std;

#define pb push_back
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;

int main() {
  ll n, k, sum = 0, ans = 1; in(n); in(k);
  vl a(n);
  rep(i,n) {
    cin >> a[i];
    sum += a[i];
  }
  vl fac;
  REP(i,1,sqrt(sum)+1) {
    if (sum % i == 0) {
      fac.pb(i);
      fac.pb(sum/i);
    }
  }
  sort(rall(fac));
  for (auto d : fac) {
    vl rs;
    rep(i,n) {
      ll r = a[i] % d;
      if (r != 0) rs.pb(r);
    }
    if (rs.empty()) {
      ans = d;
      continue;
    }
    sort(all(rs));
    ll len = rs.size();
    vl dp1(rs), dp2(rs);
    rep(i,len) dp2[i] = d - dp2[i];
    rep(i,len-1) {
      dp1[i+1] += dp1[i];
      dp2[i+1] += dp2[i];
    }
    rep(i,len-1) {
      if (dp1[i] == dp2[len-1]-dp2[i] && dp1[i] <= k) {
        cout << d << endl;
        return 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
	int n,x,ans=0;
	cin >> n;
	while(n--){
		cin >> x;
		while(x%2 == 0){
			ans++;
			x >>= 1;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[200005],b[200005],f[200005],t[200005];
int find_(int x)
{
	if(f[x]!=x)
	f[x]=find_(f[x]);
	return f[x];
}
bool cmp(int x,int y)
{
	return x>y;
}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	f[i]=i;
	for(int i=1;i<=m;i++)
	{
		cin>>a[i]>>b[i];
		int xx=find_(a[i]);
		int yy=find_(b[i]);
		if(xx!=yy)
		f[yy]=xx;
	}
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		t[find_(i)]++;
	}
	sort(t+1,t+1+n,cmp);
	cout<<t[1]<<endl;
	return 0;
}

Measured memory_bytes: 6960
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define ll long long 
#define mp make_pair
#define pb push_back
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const long double PI = acos(-1.0);
const ll Mod=1000000007;
const ll Maxi=1e18;
const ll Mini=-1e18;

int main()
{
   IOS;
  // #ifndef ONLINE_JUDGE
 // freopen("input.txt","r",stdin);
 //  #endif
  ll ti;
  //cin>>ti;
  ti=1;
  
  while(ti>0)
  {
   string s;
   cin>>s;
   ll i;
   ll n=s.length();
   //cout<<n<<endl;
   ll ans=0;
   for(i=0;i<(n/2);i++)
   {
    if(s[i]!=s[n-i-1])
      ans++;
   }
   cout<<ans;
   ti--;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
struct st{
  int l,r;
  double d;
  st(){}
  st(int l,int r,double d):l(l),r(r),d(d){}
  bool operator<(const st a)const{
    return d>a.d;
  }
};
signed main(){
  int n;
  while(cin>>n,n){
    int x[n],y[n];
    for(int i=0;i<n;i++) cin>>x[i]>>y[i];
    vector<int> v;
    for(int i=0;i<n;i++) v.push_back(y[i]);
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    map<int,int> m;
    for(int i=0;i<(int)v.size();i++) m[v[i]]=i;
    vector<double> dist;
    vector<int> height;
    height.push_back(0);
    for(int i=0;i<n-1;i++){
      double py=y[i];
      if(y[i]<y[i+1]){
	double len=x[i+1]-x[i];
	double sub=y[i+1]-y[i];
	for(int j=m[y[i]]+1;j<=m[y[i+1]];j++){
	  double nx=(double)(v[j]-py)/sub*len;
	  dist.push_back(sqrt(nx*nx+(v[j]-py)*(v[j]-py)));
	  height.push_back(v[j]);
	  py=v[j];
	}
      }else if(y[i]>y[i+1]){
	double len=x[i+1]-x[i];
	double sub=y[i]-y[i+1];
	for(int j=m[y[i]]-1;j>=m[y[i+1]];j--){
	  double nx=(double)(py-v[j])/sub*len;
	  dist.push_back(sqrt(nx*nx+(v[j]-py)*(v[j]-py)));
	  height.push_back(v[j]);
	  py=v[j];
	}
      }else{
	dist.push_back(x[i+1]-x[i]);
	height.push_back(y[i+1]);
      }
    }
    int c=height.size();
    map<P,double> dp;
    priority_queue<st> q;
    dp[P(0,c-1)]=0;
    q.emplace(0,c-1,0);
    double ans=1e10;
    int al[]={1,1,1,0,0,0,-1,-1,-1};
    int ar[]={1,0,-1,1,0,-1,1,0,-1};
    while(!q.empty()){
      st p=q.top();q.pop();
      int l=p.l,r=p.r;
      double d=p.d;
      if(dp[P(l,r)]<d) continue;
      if(l==r){
	ans=min(ans,d);
	continue;
      }
      for(int k=0;k<9;k++){
	int nl=l+al[k],nr=r+ar[k];
	if(nl>nr||nl<0||nl>=c||nr<0||nr>=c) continue;
	if(height[nl]!=height[nr]) continue;
	double nd=d;
	if(al[k]== 1) nd+=dist[l];
	if(al[k]==-1) nd+=dist[l-1];
	if(ar[k]== 1) nd+=dist[r];
	if(ar[k]==-1) nd+=dist[r-1];
	if(!dp.count(P(nl,nr))||dp[P(nl,nr)]>nd){
	  dp[P(nl,nr)]=nd;
	  q.emplace(nl,nr,nd);
	}
      }
    }
    printf("%.12f\n",ans);
  }
  return 0;
}

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

int main() {
  long long H,W;
  cin>>H>>W;
  if(H*W%2==0&&(W!=1&&H!=1)){cout<<H*W/2<<endl;}
  else if(W==1||H==1){cout<<1<<endl;}
  else{cout<<(H*W/2+1)<<endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  ll x,y; cin>>x>>y;
  if(abs(x-y)<=1) cout << "Brown" << endl;
  else cout << "Alice" << endl;
  return 0;
}


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

class Main{
    void run() throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int num = Integer.parseInt(in.readLine());
        int[] menber = new int[num];
        for(int i = 0;i < num;i++){
            menber[i] = Integer.parseInt(in.readLine());
        }
        int count = 0;
        int ans = -2000000000;
        int minv = menber[0];
        for(int i = 1;i < num;i++){
            if(ans <= menber[i] - minv)
                ans = menber[i] - minv;
            if(minv >= menber[i])
                minv = menber[i];
        }
        System.out.println(ans);
    }
    public static void main(String[] args) throws IOException{
        Main ma = new Main();
        ma.run();
    }
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end

int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(){
   int n; scanf("%d",&n);
   printf("%d\n",a[n-1]);
   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int Member[200002];

int main(void)
{

#ifdef WIN32
	freopen("input.txt", "r", stdin);
	setbuf(stdout, NULL);
#endif

	int N;
	scanf("%d", &N);

	for (int n = 1; n < N; n++)
	{
		int t;
		scanf("%d", &t);
		Member[t]++;
	}

	for (int n = 1; n <= N; n++)
		printf("%d\n", Member[n]);
	
	return 0;
}

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

int main() {
    int N;
    int D;
    cin >> N;
    cin >> D;
    int X[N][D];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < D; j++) {
            cin >> X[i][j];
        }
    }
    int n = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < i; j++) {
            int aho = 0;
            for (int k = 0; k < D; k++) {
                aho += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            int ahoSqrt = (int) sqrt(aho);
            if (ahoSqrt * ahoSqrt == aho) {
                n++;
            }
        }
    }
    cout << n << endl;
    return 0;
}


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

using namespace std;

const int N = 1e5 + 5;
int n, a, b;
char s[N];

int main() {
  cin >> n >> a >> b;
  cin >> s + 1;
  int cur = 0, os = 0;
  for (int i = 1; i <= n; ++i) {
    if (s[i] == 'a') {
      if (cur < a + b) {
        cur++;
        printf("Yes\n");
      }
      else printf("No\n");
    }
    else if (s[i] == 'b') {
      if (cur < a + b && os < b) {
        os++;
        cur++;
        printf("Yes\n");
      }
      else printf("No\n");
    }
    else {
      printf("No\n");
    }
  }
  return 0;
}


Measured memory_bytes: 3720
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        998244353
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update>
ll add(ll x,ll y,ll mod=hell) { x += y; if(x >= mod) x -= mod; return x;}
 ll sub(ll x,ll y,ll mod=hell) { x -= y; if(x < 0) x += mod; return x;}
 ll mul(ll x,ll y,ll mod=hell) { return (x * 1ll * y) % mod;} 
ll dp[3005][3005];
void solve()
{
  ll n,s;
  cin>>n>>s;
  ll a[n];
  rep(i,0,n) cin>>a[i];
  ll ans=0;
  rep(i,0,n)
  {
    dp[i+1][a[i]]=add(0LL,i+1);
    rep(j,1,3005) {
      if(j+a[i]<3005)
        dp[i+1][j+a[i]]=add(dp[i+1][j+a[i]],dp[i][j]);
      dp[i+1][j]=add(dp[i+1][j],dp[i][j]);
    }
    ans=add(ans,dp[i+1][s]);
  }
  // rep(i,1,n+1)
  // {
  //   rep(j,1,s+1) cout<<dp[i][j]<<' ';
  //   cout<<endl;
  // }
  cout<<ans;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 70784
n = int(input())
A = [int(input()) for i in range(n)]
le = 0
B=[]
for i in range(n):
    B.append([A[i],i])

B.sort()

for i in range(n):
    if i == B[-1][1]:
        print(B[-2][0])
    else:
        print(B[-1][0])

Measured memory_bytes: 88536