akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
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);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int d = in.readInt();
            int n = in.readInt();
            long p = MathUtil.pow(100, d, (int) 1e9 + 7);
            if (n == 100) n++;
            out.println(p * n);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            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 int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class MathUtil {
        public static long pow(long a, long b, long mod) {
            long ans = 1;
            while (b > 0) {
                if (b % 2 == 1) ans = (ans * a) % mod;
                a = (a * a) % mod;
                b /= 2;
            }
            return ans;
        }

    }
}



Measured memory_bytes: 22612
from copy import deepcopy
H, W, K = map(int, input().split())
board = [[0]*(W+1) for _ in range(H+1)]
for i in range(1,H+1):
    board[i] = list(map(int, list(input())))+[0]
def drop(board_copy):
    change = True
    score = 0
    p = 0
    while change:
        change = False
        for i in range(2,H+1):
            ser = 1
            for j in range(W):
                if board_copy[i][j]>0 and board_copy[i][j]==board_copy[i][j+1]:
                    ser += 1
                else:
                    if ser>=K:
                        score += 2**p*board_copy[i][j]*ser
                        change = True
                        for k in range(i,0,-1):
                            board_copy[k][j-ser+1:j+1] = board_copy[k-1][j-ser+1:j+1]
                    ser = 1
        p += 1
    return score
ans = 0
for h in range(1,H+1):
    for w in range(W):
        board_copy = deepcopy(board)
        for k in range(h,0,-1):
            board_copy[k][w] = board[k-1][w]
        ans = max(ans,drop(board_copy))
print(ans)

Measured memory_bytes: 53596
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N, W = ni()
    val (w, v) = na2(N)
    val dp = Array.ofDim[Long](2, W + 1)
    REP(N) { i =>
      import java.util
      val x = i % 2
      util.Arrays.fill(dp(x^1), 0)
      REP(W + 1) { j =>
        dp(x^1)(j) = max(dp(x^1)(j), dp(x)(j))
        if (j + w(i) <= W) dp(x^1)(j + w(i)) = max(dp(x^1)(j + w(i)), dp(x)(j) + v(i))
      }
    }
    val ans = dp(N % 2).max
    out.println(ans)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

Measured memory_bytes: 30140
from itertools import accumulate
n, k = map(int, input().split())
a = [0] + list(accumulate(map(int, input().split())))

btfl = []
for i in range(0, n):
    for j in range(i + 1, n + 1):
        btfl.append(a[j] - a[i])

# 解説AC
ans = 0
for i in range(50)[::-1]:
    num, cnt = ans + pow(2, i), 0
    for b in btfl:
        if num == num & b:
            cnt += 1
    if cnt >= k:
        ans = num
print(ans)


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

int n;
int a[3]; 
string s[100001];
string ans;

bool ok() {
  for (int i = 0; i < n; ++i) {
    int p = s[i][0] - 'A';
    int q = s[i][1] - 'A';
    if (a[p] == 0 && a[q] == 0) return false;
    int ch;
    if (a[p] == 0) {
      ch = p;
    } else if (a[q] == 0) {
      ch = q;
    } else {
      if (a[q] == 1) {
        int x = s[i + 1][0] - 'A';
        int y = s[i + 1][1] - 'A';
        if (q == x || q == y) {
          ch = q;
        } else {
          ch = p;
        }
      } else {
        ch = p; 
      }
    }
    
    ++a[ch];
    --a[p ^ q ^ ch];
    ans += 'A' + ch;
  }
  return true;
}

int main() {
  cin >> n >> a[0] >> a[1] >> a[2];
  for (int i = 0; i < n; ++i) cin >> s[i];
  s[n] = "AB";
  if (ok()) {
    cout << "Yes" << endl;
    for (int i = 0; i < n; ++i) {
      cout << ans[i] << endl;
    }
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 6860
class Node:
    def __init__(self, key, priority, left=None, right=None):
        self.key = key
        self.priority = priority
        self.left = left
        self.right = right


def rightRotate(t):
    s = t.left
    t.left = s.right
    s.right = t
    return s # 部分木の新しい根を返す


def leftRotate(t):
    s = t.right
    t.right = s.left
    s.left = t
    return s # 部分木の新しい根を返す


def insert(t, key, priority):
    # 葉に到達したらノードを生成して返す
    if t == None:
        return Node(key, priority)
    # 重複するキーを無視する
    if key == t.key:
        return t

    if key < t.key: # 左の子に移動
        # 帰ってきたノードを左の子にする
        t.left = insert(t.left, key, priority)
        # その子に優先度が高ければ、右回転で持ち上げる
        if t.priority < t.left.priority:
            t = rightRotate(t)
    else: # 右の子に移動
        # 帰ってきたノードを右の子にする
        t.right = insert(t.right, key, priority)
        # その子の優先度が高ければ左回転で持ち上げる
        if t.priority < t.right.priority:
            t = leftRotate(t)

    return t


def erase(t, key):
    if t == None:
        return None

    if key == t.key: # tが削除対象
        if (t.left == None) and (t.right == None): # tが葉
            return None
        elif t.left == None: # tがただ一つの右の子を持つ
            t = leftRotate(t)
        elif t.right == None:
            t = rightRotate(t) # tがただ一つの左の子を持つ
        else: # tが二つの子を持つ
            # 優先度が高い子を持ち上げる
            if t.left.priority > t.right.priority:
                t = rightRotate(t)
            else:
                t = leftRotate(t)
        return erase(t, key)

    # 対象を再帰的に探索
    elif key > t.key:
        t.right = erase(t.right, key)
    else:
        t.left = erase(t.left, key)
    return t


# 引数のkeyを持つノードの有無を探索
def find(t, key):
    if t.key == key:
        print("yes")
    elif t.key < key and t.right != None:
        find(t.right, key)
    elif t.key > key and t.left != None:
        find(t.left, key)
    else:
        print("no")
    return 0


def in_print(t):
    if t.left != None:
        in_print(t.left)
    print(" " + str(t.key), end='')
    if t.right != None:
        in_print(t.right)

# 中間巡回アルゴリズム
def pre_print(t):
    print(" " + str(t.key), end='')
    if t.left != None:
        pre_print(t.left)
    if t.right != None:
        pre_print(t.right)


def main():
    Treap = None
    p = []
    k = int(input())
    i = 0
    while i < k:
        try:
            p.append(list(map(str, input().split())))
            i = i + 1
        except:
            break;
    
    i = 0
    while i < k:
        if p[i][0] == 'insert':
            key = int(p[i][1])
            priority = int(p[i][2])
            Treap = insert(Treap, key, priority)
        elif p[i][0] == 'find':
            key = int(p[i][1])
            find(Treap, key)
        elif p[i][0] == 'delete':
            key = int(p[i][1])
            Treap = erase(Treap, key)
        else:
            in_print(Treap)
            print()
            pre_print(Treap)
            print()
        i = i + 1

if __name__ == '__main__':
    main()


Measured memory_bytes: 112128
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors


x=int(input())
divisors=make_divisors(x)
sq=int(-(-x**0.5//1))
for i in divisors:
    if i >= sq:
        print(int(x/i)+i-2)
        exit(0)

Measured memory_bytes: 3264
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N = sc.nextInt()
  val hashMap = scala.collection.mutable.HashMap.empty[Int, Int]
  (1 to N).foreach { _ =>
    val a = sc.nextInt()
    hashMap.update(a, hashMap.getOrElse(a, 0) + 1)
  }
  val max = hashMap.foldLeft(0) { case (acc, (a, count)) =>
    acc.max(hashMap.getOrElse(a - 1, 0) + count + hashMap.getOrElse(a + 1, 0))
  }
  println(max)
}


Measured memory_bytes: 62744
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N, X, T = rl()

c = N // X
if N % X > 0:
	c += 1
print(c * T)


Measured memory_bytes: 67976
#include "stdio.h"

int gcd(int, int);

int main()
{
    int K;
    scanf("%d", &K);
    long sum = 0;
    for (int i = 1; i < K + 1; i++)
    {
        for (int j = 1; j < K + 1; j++)
        {
            for (int k = 1; k < K + 1; k++)
            {
                sum += gcd(gcd(i, j), k);
            }
        }
    }
    printf("%ld\n", sum);
}

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


Measured memory_bytes: 1704
#include <cstdio>
#include <iostream>
using namespace std;
int read();
int z = 1000000000;
int main() {
    long long s;
    scanf("%lld", &s);
    if (s == 1ll * z * z) return printf("0 0 %d 0 0 %d\n", z, z), 0;
    long long x1 = z, x2 = 1, y2 = s / z + 1;
    long long y1 = x1 * y2 - s;
    printf("0 0 %lld %lld %lld %lld\n", x1, y1, x2, y2);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S; cin >> S;
  bool ans = true;
  if(S[0]==S[1]) ans= false;
  if(S[1]==S[2]) ans= false; 
  if(S[2]==S[3]) ans = false;
       
  if(ans==false) cout << "Bad" << endl;
  else cout << "Good" << endl;   
}

Measured memory_bytes: 3616
open Printf;;
open Scanf;;

let max2 (x, y) z = if x < z then (z, x) else if y < z then (x, z) else (x, y);;
    
let () =
  let n = scanf " %d" (fun x -> x) in
  let a = Array.init (1 lsl n) @@ fun x -> scanf " %d" (fun x -> x) in
  let dp = Array.make (1 lsl n) ((-1, -1), (-1, -1)) in
  for i = 0 to (1 lsl n) - 1 do
    dp.(i) <- ((a.(i), i), (-1, -1))
  done;
  for i = 0 to n - 1 do
    for j = 0 to (1 lsl n) - 1 do
      if (j land (1 lsl i)) = 0 then begin
          dp.(j lor (1 lsl i)) <- max2 dp.(j lor (1 lsl i)) (fst dp.(j));
          dp.(j lor (1 lsl i)) <- max2 dp.(j lor (1 lsl i)) (snd dp.(j))
        end
    done;
  done;
  let ans = ref min_int in
  for i = 1 to (1 lsl n) - 1 do
    let (x, _), (y, _) = dp.(i) in
    ans := max !ans (x + y);
    print_int !ans;
    print_newline ()
  done;
  


Measured memory_bytes: 34560
#include <bits/stdc++.h>
using namespace std;
#define mps 1000000007
int n,m;
vector <int> vec[100005];
int main()
{
    int u,v;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&u,&v);
        vec[u].push_back(v);
        vec[v].push_back(u);
    }
    for(int i=1;i<=n;i++)
    {
        if(vec[i].size()%2)
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 5504
#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 FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()

#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
#define uint64_t unsigned long long

#define int8_t signed char
#define int16_t signed short
#define int32_t signed int
#define int64_t signed long long



using namespace std;
// #define PI 3.14159265358979323846
// cout << fixed << setprecision(20);

int main(int argc, char const* argv[])
{
    int N = 0;
    int f[10001] = {};

    cin >> N;
    for(int x = 1; x <= sqrt(N); x++) {
    for(int y = 1; y <= sqrt(N); y++) {
    for(int z = 1; z <= sqrt(N); z++) {
      	int a = x*x + y*y + z*z + x*y + y*z + z*x;
      	if (a <= N) {
        	f[x*x + y*y + z*z + x*y + y*z + z*x] += 1;
        }
    }
    }
    }

    for(int i = 1; i <= N; i++) {
      cout << f[i] << endl;
    }

    return 0;
}




Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String s = mylist.get(0);
        String t = mylist.get(1);

        int cnt = 0;

        int j = 0;
        while (j < s.length()) {

            if (s.substring(j,j+1).equals(t.substring(j,j+1))) {
                cnt += 1;
            } 
            j++;

        }

        System.out.println(cnt);

    }

}


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

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


typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;

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

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n; cin>>n;
	vl A(n);
	F0R(i,n) cin>>A[i];
	ll Bno=1;
	bool flag=false;
	F0R(i,n)
	{
		if(A[i]==Bno)
		{
			Bno++;
			flag=true;
		}
	}
	if(flag)
	{
		cout<<n-Bno+1<<endl;
	}
	else
	{
		cout<<-1<<endl;
	}
    return 0;
}


Measured memory_bytes: 1792
n, m = map(int, input().split())
l,r = map(int, input().split())

for i in range(m-1):
    l2,r2 = map(int, input().split())
    if l<l2:
        l=l2
    if r>r2:
        r=r2
if r-l+1>0:
    print(r-l+1)
else:
    print(0)

Measured memory_bytes: 3060
#include<stdio.h>

int main() {
	int n;
	
	scanf("%d",&n);
	
	int i;
	for(i=0;n>=(4*i);i++) {
		if((n-4*i)%7==0) {
			printf("Yes");
			return 0;
		}
	}
	
	printf("No");
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;
    
    vector<vector<pair<ll, ll>>> v(n);  // v[i][j] : 人iのj番目の証言
    rep(i, n) {
        ll a;
        cin >> a;
        rep(j, a) {
            ll x, y;
            cin >> x >> y;
            x--;
            v[i].pb(make_pair(x, y));
        }
    }

    ll ans = 0;
    for(ll b = 0; b < (1<<n); b++) {  // bのiビット目が1のとき人i(iは0-index)は正直者。0のとき不親切な人

        vl w(n);  // w[i] : 1のとき人iは正直者
        ll now = 0;
        rep(i, n) {
            if( b & (1<<i) ) {
                w[i] = 1;
                now++;
            }
        }

        ll flag = 0;
        rep(i, n) {
            if(w[i]) {
                rep(j, v[i].size()) {
                    if( w[v[i][j].first] != v[i][j].second ) {
                        flag = 1;
                        break;
                    }
                }
            }
            if(flag) {
                break;
            }
        }

        if(flag) {
            continue;
        }

        chmax(ans, now);
    }

    out(ans);
    re0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

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

  string s; cin >> s;
  int n = SZ(s);
  int cnt = 0;
  int ans = 0;
  for(int i=0;i<n;++i) {
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      cnt++;
    } else {
      ans = max(ans, cnt);
      cnt = 0;
    }
  }
  ans = max(ans, cnt);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll N, vector<ll> a) {
  cout << *max_element(ALL(a)) - *min_element(ALL(a)) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> a(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &a[i]);
	}
	solve(N, a);
	return 0;
}


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

int main() {
  
 string str;
  getline(cin,str);
  int i;
  for(i=0;i<str.size();i++){
    if(str[i]>='a'&&str[i]<='z') {
      str[i]+='A'-'a';
    }
    else if(str[i]>='A'&&str[i]<='Z') {
      str[i]+='a'-'A';
    }
  }
    cout << str << endl;
  return 0;
}
  


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9+5;
const int mod = 998244353;

vector<int> fac(300001); //n!(mod M)
vector<int> ifac(300001); //k!^{M-2} (mod M)

long long fpow(long long a,long long n){
  long long ret=1;
  if(n==1) return a;
  if(n%2==0) {
      ret = fpow(a*a%mod, n/2) %mod ;
  }else {
      ret = (a%mod)*fpow(a*a%mod, n/2) %mod;
  }
  return ret %mod;
}
int comb(int a, int b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    int tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

int dp[3002][3002];
signed main(){
    string s , t;
    cin >> s >> t;
    rep(i, s.length()) {
        rep(j, t.length()) {
             if(s[i]==t[j]) {
                 dp[i+1][j+1] = dp[i][j]+1;
                 //cout << i<<" "<< j <<" "<<dp[i+1][j+1] << endl;
             }else {
                 dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
             }
        }
    }

    int ss = s.size();
    int tt = t.size();

    string ans;
    while(ss > 0 && tt > 0) {
        if(dp[ss][tt-1] == dp[ss][tt]) {
            --tt;
        }else if(dp[ss-1][tt] == dp[ss][tt]) {
            --ss;
        }else {
            --tt; --ss;
            ans += t[tt];
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 75264
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    dp = [[float('inf')] * (N * 1000 + 1) for _ in range(N+1)]
    dp[0][0] = 0

    for i, (cw, cv) in enumerate(zip(w, v)):
        for j in range(N * 1000 + 1):
            dp[i+1][j] = dp[i][j]
            if 0 <= (j - cv) and (dp[i][j - cv] + cw) <= W:
                dp[i+1][j] = min(dp[i+1][j], dp[i][j - cv] +  cw)

    return max([cv for cv, cw in enumerate(dp[-1]) if isfinite(cw)])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]"
    v = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    result = solve(N, W, w, v)
    print(result)

if __name__ == '__main__':
    main()

Measured memory_bytes: 183352
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define cl clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string sp=" ";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs  vector<string>
#define MX LLONG_MAX
#define MN LLONG_MIN
#define MOD 1000000007
#define vp(vi,x) cin>>x; vi.pb(x);
#define bsearch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,p,q,a,b,c=0;
    bool f=0,ff=0;
    string st;
    while(cin>>a>>b>>c)
    {
        if(b<a)swap(a,b);
        if(c<a)swap(a,c);
        if(c<b)swap(c,b);
        if(a==5&&b==5&&c==7)cout<<Y;
        else cout<<N;
    }
}




Measured memory_bytes: 3584
#include <stdio.h>

int main(){

  int x, y, num1, num2, temp;
  
  scanf("%d %d",&x, &y);
  
  if(x >= y){
    num1 = y;
    num2 = x;
  }
  else{
    num1 = x;
    num2 = y;
  }

  while(1){
    if(num2 % num1 == 0){
      break;
    }
    temp = num2 % num1;
    num2 = num1;
    num1 = temp;
  }
  
  printf("%d\n", num1);
  
  return 0;
}



Measured memory_bytes: 2124
n = int(input())
a = list(map(int,input().split()))
cnt2 = 0
cnt4 = 0

for x in a:
    if x%4==0:
        cnt4 += 1
    elif x%2==0:
        cnt2 += 1

if cnt4 + cnt2//2 >= n//2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 20044
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
  int n,q,k;
  int x;
  int cnt[100001];
  int max = -1;
  int i;

  scanf("%d %d %d", &n, &k, &q);

  for(i = 1;i <= 100000;i++) cnt[i] = 0;

  for(i = 0;i < q;i++){
    scanf("%d", &x);
    cnt[x]++;
  }

  if(k > q){
    for(i = 1;i <= n;i++) printf("Yes\n");
    return 0;
  }

  for(i = 1;i <= n;i++){
    if((q - k) >= cnt[i]) printf("No\n");

    else printf("Yes\n");
  }

  return 0;
}

Measured memory_bytes: 896
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception addd) {
					addd.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception addd) {
				addd.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	
	public static FastReader sc = new FastReader();
 
	static int mod = (int) (1e9+7),MAX=(int) (2e5);
    static List<Integer>[] edges;
  
	public static void main(String[] args) {
	   
	    int n = sc.nextInt();
	    int m = sc.nextInt();
	    int x = sc.nextInt();
	    int[][] tab = new int[n][m+1];
	    for(int i=0;i<n;++i) {
	    	for(int j=0;j<m+1;++j)
	    		tab[i][j] = sc.nextInt();
	    }
	  
	    long ans = Integer.MAX_VALUE;
	    for(int i=0;i<1<<n;++i) {
	    	int[] temp = new int[m+1];
	    	for(int j=0;j<n;++j) {
	    		if(((i>>j)&1) == 1) {
	    			for(int k=0;k<m+1;++k) temp[k]+=tab[j][k];
	    		}
	    	}
	    	boolean found = true;
	    	for(int k=1;k<m+1;++k) {
	    		if(temp[k] < x) found =false;
	    	}
	    	if(found) ans = Math.min(ans, temp[0]);
	    }
	    if(ans == Integer.MAX_VALUE) ans = -1;
	    out.print(ans);
		out.close();
   }
	
	
}



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

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

    string s;
    cin >> s;
    int v1 = 0, v2 = 0;
    for (int i = 0; i < s.size(); ++i) {
        v1 += s[i]-'0' != (i&1);
        v2 += s[i]-'0' != 1-(i&1);
    }
    cout << min(v1, v2) << "\n";
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N, M;
ll sum[8][1123];
ll x, y, z;
ll ans = 0;
ll num;

int main(){
	
	cin>>N>>M;
	fill( sum[0], sum[8], 0 );
	
	REP( i, N ){
		cin>>x>>y>>z;
		REP( j, 8 ){
			if( j & 1 ){ sum[j][i] += x;}
			else{	   sum[j][i] -= x;}
			if( j & 2 ){ sum[j][i] += y;}
			else{	   sum[j][i] -= y;}
			if( j & 4 ){ sum[j][i] += z;}
			else{	   sum[j][i] -= z;}
		}
	}
	
	REP( i, 8 ){
		sort( sum[i], sum[i]+N, greater<ll>() );
		num = 0;
		REP( j, M )num += sum[i][j];
		ans = max( ans, num );
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const long long mod = 1e9 + 7ll ;
 
long long modpower(long long a , long long b)
{
    if(b == 0)
        return 1ll ;
    long long x = modpower(a , b / 2ll) ;
    x = (x * x) % mod ;
    if(b & 1)
        return (x * a) % mod ;
    return (x % mod) ;
}
 
struct combination
{
    vector<long long>fact , inv ;
    combination(int sz) : fact(sz + 1) , inv(sz + 1)
    {
        fact[0] = 1ll ;
        inv[0] = 1ll ;
        for(long long i = 1 ; i <= sz ; ++i)
            fact[i] = (fact[i-1] * i) % mod ;
        inv[sz] = modpower(fact[sz] , mod - 2ll) ;
		for(long long i = sz-1; i >= 1; --i)
		    inv[i] = (inv[i+1] * (i+1)) % mod;
    }
    long long choose(int n , int k) const
    {
        if(k < 0 || n < k)
            return 0 ;
        return ((((fact[n] * inv[k]) % mod) * inv[n - k]) % mod) ;
    }
};

const int MAX = 2e5 + 10 ;

long long n , k ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>k ;
	combination comb(2e5+10) ;
	long long ans = 0ll ;
	for(long long i = 0 ; i <= min(k , n-1) ; ++i)
	{
		long long a = comb.choose(n , i) % mod ;
        long long b = comb.choose(n-1 , i) % mod ;
        long long c = (a * b) % mod ;
        ans = (ans + c) % mod ;
	}
	return cout<<ans<<"\n" , 0 ;
}		

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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> ii;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vii;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vector<ld>> vvld;
typedef vector<bool> vbl;
typedef vector<vbl> mbl;
const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vll a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.begin() + n), sort(b.begin(), b.begin() + n);
    if (n & 1)
    {
        cout << b[(n + 1) / 2 - 1] - a[(n + 1) / 2 - 1] + 1 << endl;
    }
    else
    {
        cout << b[n / 2 - 1] + b[n / 2] - a[n / 2 - 1] - a[n / 2] + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 6316
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N, M;
vector<int> s, c;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  s.resize(M);
  c.resize(M);
  for (int i = 0; i < M; i++) {
    int si, ci;
    cin >> si >> ci;
    si--;
    s[i] = si;
    c[i] = ci;
  }

  vector<int> ans(N, -1);
  for (int i = 0; i < M; i++) {
    if (ans[s[i]] == -1) {
      ans[s[i]] = c[i];
    } else {
      if (ans[s[i]] != c[i]) {
        cout << -1 << endl;
        return 0;
      }
    }
  }

  if (N == 1 && ans[0] == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (N == 1 && ans[0] == -1) {
    cout << 0 << endl;
    return 0;
  }

  if (ans[0] == 0) {
    cout << -1 << endl;
    return 0;
  }
  if (ans[0] == -1) {
    ans[0] = 1;
  }

  for (auto &e : ans) {
    if (e == -1) {
      cout << 0;
    } else {
      cout << e;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
# import math
# from functools import reduce

# def gcd(*numbers):
#     return reduce(math.gcd, numbers)

N = int(input())
if N <= 5:
    if N == 3: print('2 5 63')
    elif N == 4: print('2 5 20 63')
    elif N == 5: print('2 5 20 30 63')
else:
    flag = 0
    S = 0
    k = 0
    retList = list()
    Q = N // 4
    R = N % 4
    for q in range(Q):
        S += 4*6*q + 15
        retList.append(str(6*q+2))
        retList.append(str(6*q+3))
        retList.append(str(6*q+4))
        retList.append(str(6*q+6))
    if R == 0:
        pass
    elif R == 1:
        S += 6*Q + 2
        retList.append(str(6*Q + 2))
    elif R == 2:
        S += 2*6*Q + 5
        retList.append(str(6*Q + 2))
        retList.append(str(6*Q + 3))
    elif R == 3:
        S += 3*6*Q + 9
        retList.append(str(6*Q + 2))
        retList.append(str(6*Q + 3))
        retList.append(str(6*Q + 4))

    if S%6 == 0:
        pass
    elif S%6 == 2:
        retList.remove('8')
        S -= 8
        S += 6*(Q+1) + 6
        retList.append(str(6*Q + 6))
    elif S%6 == 3:
        retList.remove('9')
        S -= 9
        S += 6*(Q+1) + 6
        retList.append(str(6*Q + 6))
    elif S%6 == 5:
        retList.remove('9')
        S -= 9
        S += 6*(Q+1) + 4
        retList.append(str(6*Q + 4))
    # print(S%6)
    # print(len(retList))
    # retIntList = list(map(int, retList))
    # for a in retIntList:
    #     if gcd(S, a) <= 1:
    #         print(S)
    #         print(a)
    print(' '.join(retList))
    # print(gcd(*retIntList))

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	int n = s.l_ength();
	bool flag = true;
	for( int i = 0; i < n; ++i ){
		if( i%2 == 0 && s[i] == 'L' ) flag = false;
		if( i%2 == 1 && s[i] == 'R' ) flag = false;
	}
	if( flag ) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    ll match[10] = {0,2,5,5,4,5,6,3,7,6};
    vector<ll> a(m);
    for(i = 0;i < m;++i){
        cin >> a.at(i);
    }
    sort(all(a));
    vector<ll> dp(n+1,-1);
    dp.at(0) = 0;
    for(i = 0;i < n;++i){
        rep(j,m){
            if(i + match[a.at(j)] <= n){
                ll next = i + match[a.at(j)];
                dp.at(next) = max(dp.at(next), dp.at(i) + 1);
            }
        }
    }
    ll now = n;
    string ans;
    while(now){
        for(i = m-1;i >= 0;--i){
            if(now - match[a.at(i)] < 0) continue;
            if(dp.at(now - match[a.at(i)]) == dp.at(now) - 1){
                ans.push_back(a.at(i) + '0');
                now -= match[a.at(i)];
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3700
use v5.18;
use warnings;
use utf8;
sub line { chomp(my $str = <>); $str; }
sub split_line { (split / /, line) }

my ($min, $max) = split_line;
my ($ans, $b, $c) = (1, $min, $min);
while ($b * 2 <= $max) {
  $c = $b * 2;
  $b = $c;
  $ans++;
}
say $ans;


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


int main()
{
    map<char,string> m;
    m['1']="',.!?";
    m['2']="abcABC";
    m['3']="defDEF";
    m['4']="ghiGHI";
    m['5']="jklJKL";
    m['6']="mnoMNO";
    m['7']="pqrsPQRS";
    m['8']="tuvTUV";
    m['9']="wxyzWXYZ";


    string s;

    while(cin>>s)
    {
        char act = 'Z';
        int i = 0;
        if(s[s.size()-1]!='0') s=s+"0";
        for(int c=0;c<s.size();c++)
        {
            if(s[c]=='0')
            {
                if(act=='Z') cout<<" ";
                else cout<<m[act][((i-1)+m[act].size())%m[act].size()];
                act='Z';
                i=0;
            }
            else if(s[c]==act)
            {
                i++;
            }
            else
            {
                if(act!='Z')
                    cout<<m[act][((i-1)+m[act].size())%m[act].size()];
                act=s[c];
                i=1;
            }
        }
        cout<<endl;
    }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
const int r = 1e5 + 1;
int a[r], dp[r], n;
int solve(int idx){
    if (idx >= n - 1)
        return 0;
    if (dp[idx] != -1)
        return dp[idx];
    int ret = INT_MAX;
    if (idx == n - 2)
        ret = abs(a[idx] - a[idx + 1]) + solve(idx + 1);
    else
        ret = min(abs(a[idx] - a[idx + 1]) + solve(idx + 1), abs(a[idx] - a[idx + 2]) + solve(idx + 2));
    return dp[idx] = ret;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
     cout << solve(0) << '\n';
    return 0;
}


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

int n, a[200001];
long long s1[200001], s2[200001], ans = 0;

int main() {
    //freopen("test01.in", "r", stdin);
    //freopen("test01.out", "w", stdout);
    scanf("%d", &n);
    s1[0] = s2[0] = 0;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        s1[i] = s1[i-1] + a[i];
        s2[i] = s2[i-1] ^ a[i];
    }
    for (int i = 1, j = 1; i <= n; i++) {
        while (j <= n && s1[j] - s1[i-1] == (s2[j] ^ s2[i-1]))
            j++;
        ans += j - i;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define rep(i,n) for(i=0; i <n; i++)
bool is_prime(int n){   for(int i=2; i*i<=n; i++)   if(n%i==0)  return 0;   return 1;}



const int maxn = 10000005;
#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int divi[maxn];
signed main()
{
  	RAGE;
    int t=1;
    //  cin>>t;
    while(t--)
    {
        int n,i,j,k,m;
        cin>>n;
        int ans=0;
        for(i=1; i<=n; i++)
        {
            for(j=1; j*i<=n; j++)
                divi[j*i]++;
        }
        for(i=1; i<=n; i++)
            ans += divi[i]*i;
        cout<<ans;
    }    
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    double sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += 1.0 / a[i];
    }
    double ans = 1.0 / sum;
    printf("%.10f\n", ans);
    return 0;
}

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

const int INF = 1e9;

struct I {
  int n, a, b, c;
  vector<int> l;
};

int dfs(I& in, int a, int b, int c, int acc) { // cf. editorial.pdf
  if (acc == in.n)
    return min({a, b, c}) > 0
               ? abs(in.a - a) + abs(in.b - b) + abs(in.c - c) - 30
               : INF;
  else {
    int ret0 = dfs(in, a, b, c, acc + 1);
    int ret1 = dfs(in, a + in.l[acc], b, c, acc + 1) + 10;
    int ret2 = dfs(in, a, b + in.l[acc], c, acc + 1) + 10;
    int ret3 = dfs(in, a, b, c + in.l[acc], acc + 1) + 10;
    return min({ret0, ret1, ret2, ret3});
  }
}

int main() {
  I in{};
  cin >> in.n >> in.a >> in.b >> in.c;

  in.l.resize(in.n);
  rep(i, in.n) cin >> in.l[i];

  int ans = dfs(in, 0, 0, 0, 0);
  cout << ans << endl;
}

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

using namespace std;

int main(){

    int a,b,c;
    cin>>a>>b>>c;
    int x,y,z;
    x=a+b;
    y=b+c;
    z=a+c;
    cout<<min(x,min(y,z));



return 0;

}


Measured memory_bytes: 256
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


data = inpl()
begin = data[0] * 60 + data[1]
end = data[2] * 60 + data[3]
print(max(0, end - begin - data[-1]))


Measured memory_bytes: 68308
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef unsigned long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    ll a; string b;
    cin >> a >> b;
    if (b.find(".") != string::npos){
        b.erase(b.find("."),1);
    }
    ll bint = stol(b);

    ll ans = a*bint;
    cout << ans/100 << endl;


}



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

int D;
const int M = 26;
vector<int> C;
vector<vector<int>> S;
vector<int> T;

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

std::mt19937 mt{ std::random_device{}() };

int randint(int lower, int upper)
{
    std::uniform_int_distribution<int> dist(lower, upper);
    return dist(mt);
}

std::random_device seed_gen;
std::default_random_engine engine(seed_gen());

int randlogint(int lower, int upper, double mean, double sigma)
{
    int res = lower - 1;
    while(lower <= res && res <= upper)
    {
        std::lognormal_distribution<> dist(mean, sigma);
        res = dist(engine);
    }
    return res;
}

int calc_score()
{
    int ans = 0;
    vector<int> last(M, -1);
    for(int i=0; i<D; i++)
    {
        ans += S[i][T[i]];
        last[T[i]] = i;
        for(int j=0; j<M; j++)
        {
            ans -= C[j] * (i - last[j]);
        }
    }
    return ans;
}

int main()
{
    int tstart = clock();
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> D;
    C.resize(M);
    for(int i=0; i<M; i++) cin >> C[i];
    S.resize(D);
    for(int i=0; i<D; i++)
    {
        S[i].resize(M);
        for(int j=0; j<M; j++)
        {
            cin >> S[i][j];
        }
    }

    T.resize(D);
    vector<int> CNT(D, 0);
    vector<vector<int>> Greater(D, vector<int>(M));
    for(int i=0; i<D; i++)
    {
        vector<int> minS = S[i];
        sort(minS.begin(), minS.end(), greater<int>());
        for(int j=0; j<M; j++)
        {
            int k=0;
            for(k=0; k<M; k++)
            {
                if(S[i][k] == minS[j]) break;
            }
            Greater[i][j] = k;
        }
        T[i] = Greater[i][0];
        CNT[i]++;
    }
    int score = calc_score();
    while(1.0 * (clock() - tstart) / CLOCKS_PER_SEC < 1.95)
    {
        // cout << 1.0 * (clock() - tstart) / CLOCKS_PER_SEC << endl;
        int H = randint(0, D-1);
        int Q = Greater[H][randlogint(0, 25, 1., 1.5)];
        int tmp = T[H];
        T[H] = Q;
        int nscore = calc_score();
        if(score < nscore)
        {
            score = nscore;
        }
        else
        {
            T[H] = tmp;
        }
    }
    for(int i=0; i<D; i++)
    {
        cout << T[i] + 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 3808
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <climits>
#include <iomanip>
#include <cmath>

using namespace std;


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

	long long n;
	cin >> n;

	long long ans = 10e12;
	for (int i = 1; pow(i, 2) <= n; i++) {
		if (n % i == 0) {
			ans = min(ans, i + n / i - 2);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256