akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
using namespace std;
int N,K;
bool is_ca[10010] = {};
double T,U,V,L,D[210],dp[10010][210] = {};

int main(){
    cin >> N >> K >> T >> U >> V >> L;
    for(int i=1;i<=N;i++){
        cin >> D[i];
    }
    double ti = 0;
    bool ca = false;
    int next_ca = 1,cnt = 0,off_pos = 0;
    for(int i=0;i<L;i++){
        if(D[next_ca]==i){
            cnt++; next_ca++;
        }
        if(!ca && cnt>0){
            ca = true;
            cnt--;
            off_pos = i+T*V;
        }
        if(cnt==K+1){
            off_pos = i+T*V;
            cnt--;
        }else if(off_pos==i){
            if(cnt>0){
                cnt--; off_pos = i+T*V;
            }else ca = false;
        }
        if(!ca) ti += 1.0/U;
        else ti += 1.0/V;
    }
    cout << fixed;
    cout << setprecision(10) << ti << endl;
}


Measured memory_bytes: 3288
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        System.out.println( solve(N, A) );
    }

    private static String solve(int N, int[] A) {
        int[] colors = new int[9];
        int GRAY = 0;
        int TEA = 1;
        int GREEN = 2;
        int MIZU = 3;
        int BLUE = 4;
        int YELLOW = 5;
        int ORANGE = 6;
        int RED = 7;
        int OVER = 8;
        for (int i = 0; i < N; i++) {
            int a = A[i];

            if( a <= 399 ) colors[GRAY]++;
            else if( a <= 799 ) colors[TEA]++;
            else if( a <= 1199 ) colors[GREEN]++;
            else if( a <= 1599 ) colors[MIZU]++;
            else if( a <= 1999 ) colors[BLUE]++;
            else if( a <= 2399 ) colors[YELLOW]++;
            else if( a <= 2799 ) colors[ORANGE]++;
            else if( a <= 3199 ) colors[RED]++;
            else colors[OVER]++;
        }

        int minColor = 0;
        for (int c = GRAY; c <= RED; c++) {
            if( colors[c] != 0 ) {
                minColor ++;
            }
        }

        // OVERが何人いても同じ色を選べばよい
        int min = Math.max(minColor, 1);

        // overの人が全員異なる色を選ぶとよい
        int max = minColor + colors[OVER];

        return min + " " + max;
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
typedef long long ll;

int main()
{
    ll n;
    cin >> n;
    vector<char> p;
    

    while (n > 0)
    {
        n--;
        p.push_back(char((n % 26 + 97)));
        n /= 26;
    }

    for (int i = p.size() - 1; i >= 0; i--)
    {
        cout << p[i];
    }

    cout << "\n";
}


Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		while (true) {
			String[] str = br.readLine().split(" ");
			int H = Integer.parseInt(str[0]);
			int W = Integer.parseInt(str[1]);
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if ((i + j) % 2 == 0) {
						sb.append("#");
					} else {
						sb.append(".");
					}
				}
				sb.append("\n");
			}
			sb.append("\n");
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 25468
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 * Longest Path
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)))) {
            int N = sc.nextInt();
            int M = sc.nextInt();

            List<List<Integer>> g = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                g.add(new ArrayList<>());
            }

            for (int i = 0; i < M; i++) {
                int x = sc.nextInt() - 1;
                int y = sc.nextInt() - 1;

                g.get(y).add(x);
            }

            int[] dp = new int[N];

            int max = 0;
            for (int i = 0; i < N; i++) {
                int d = solve(i, dp, g);

                max = Math.max(max, d);
            }

            System.out.println(max);
        }
    }

    static int solve(int x, int[] dp, List<List<Integer>> g) {
        if (dp[x] != 0) {
            return dp[x];
        }

        for (Integer e : g.get(x)) {
            dp[x] = Math.max(dp[x], solve(e, dp, g) + 1);
        }

        return dp[x];
    }

}


Measured memory_bytes: 107492
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
int v[10][10];
int vis[10][10];
char s[MAXN];
int main(){
    REP(i,1,3)REP(j,1,3)cin>>v[i][j];
    cin>>n;
    REP(i,1,n){
        int a;
        cin>>a;
        REP(j,1,3)REP(k,1,3)if(v[j][k]==a)vis[j][k]=1;
    }
    int flag=0;
    REP(i,1,3){
        int flagg=1;
        REP(j,1,3){
            if(vis[i][j]==0)flagg=0;
        }
        flag|=flagg;
        flagg=1;
        REP(j,1,3){
            if(vis[j][i]==0)flagg=0;
        }
        flag|=flagg;
    }
    int flagg=1;
    REP(i,1,3)if(!vis[i][i])flagg=0;
    flag|=flagg;
    flagg=1;
    REP(i,1,3)if(!vis[4-i][i])flagg=0;
    flag|=flagg;
    if(flag)cout<<"Yes";
    else cout<<"No";
}

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

using namespace std;
using ll = long long;

template<typename T>
vector<bool> is_prime(T n) {
    vector<bool> prime(n + 1, true);
    prime.at(0) = prime.at(1) = false;

    for(T i = 2; i * i <= n; ++i) {
        if(prime.at(i)) {
            for(T j = i * i; j <= n; j += i) prime.at(j) = false;
        }
    }
    
    return prime;
}

template<typename T>
vector<T> primes(T n) {
    vector<T> prime(n + 1);
    iota(prime.begin() + 2, prime.end(), 2);

    for(T i = 2; i * i <= n; ++i) {
        if(prime.at(i)) {
            for(T j = i * i; j <= n; j += i) prime.at(j) = 0;
        }
    }
    prime.erase(remove(prime.begin(), prime.end(), 0), prime.end());

    return prime;
}

template<typename T>
vector<T> prime_factorization(T n) {
    vector<T> factors, prime = primes(static_cast<T>(sqrt(n + 1)));
    T i = 0;

    while(n != 1) {
        if(i == prime.size()) {
            factors.emplace_back(n);
            break;
        }
        if(n % prime.at(i) == 0) {
            factors.emplace_back(prime.at(i));
            n /= prime.at(i);
        } else {
            ++i;
        }
    }

    return factors;
}

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

    ll n;

    cin >> n;

    vector<ll> factors = prime_factorization(n);
    map<ll, int> factor_map;

    for(ll i: factors) {
        factor_map[i]++;
    }

    int ans = 0;

    for(pair<ll, int> p: factor_map) {
        for(int j = 1; true; ++j) {
            p.second -= j;
            if(p.second >= 0) ++ans;
            else break;
        }
    }

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

    return 0;
}

Measured memory_bytes: 11140
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n, m = map(int, input().strip().split())
    g1 = []
    g2 = []
    for i in range(n):
        g1.append(input().strip())
    for i in range(m):
        g2.append(input().strip())

    for row in range(n-m+1):
        for col in range(n-m+1):
            if g1[row][col] == g2[0][0] and [g1[row+i][col+j] == g2[i][j] for i in range(m) for j in range(m)] == [True for _ in range(m**2)]:
                print("Yes")
                return
            else:
                pass    # 
    print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 62568
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define sp std::fixed<<std::setprecision
#define MOD 1000000007
#define MAX 1e18
#define N 1000005
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n , d , cnt = 0;
    cin >> n >> d;
    ll a[n][d];
    for( int i = 0 ; i < n ; i++ )
    {
        for( int j = 0 ; j < d ; j++ )
        {
            cin >> a[i][j];
        }
    }
    for( int i = 0 ; i < n ; i++ )
    {
        for( int j = i + 1 ; j < n ; j++ )
        {
            ll sum = 0;
            for( int k = 0 ; k < d ; k++ )
            {
                sum += ( a[i][k] - a[j][k] ) * ( a[i][k] - a[j][k] );
            }
            ld sq = sqrt(sum);
            //cout << sq << endl;
            if( ceil(sq) - sq == 0 )
                cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
int main()
{
	char a, b,c;
	a=getchar();
	b=getchar();
	c=getchar();
	if (a == c)
	{
		printf("H\n");
	}
	else
	{
		printf("D\n");
	}
	system("pause");
}


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

int main(){
  int A, B;
  cin >> A >> B;
  int a1, a2, a4, a5;
  int x = 0;
  
  for (int i = A; i < B + 1; i++){
    a1 = i % 10;
    a2 = ((i - i % 10) / 10) % 10;
    a4 = ((i - i % 1000) / 1000) % 10;
    a5 = ((i - i % 10000) / 10000) % 10;
    if (a1 == a5 && a2 == a4){
      x++;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a, b, c, d, e, f, w[3100], s[3100], res1, res2;
double ans;
int main(void){
    // Your code here!
    cin >> a >> b >> c >> d >> e >> f;
    for (int i = 0; i <= 30; i++) {
        for (int j = 0; j <= 30; j++) {
            if ((a * i + b * j) * 100 > f) continue;
            w[(a * i + b * j) * 100] = 1;
        }
    }
    for (int i = 0; i <= f; i++) {
        for (int j = 0; j <= f; j++) {
            if (i * c + j * d > f) continue;
            s[c * i + d * j] = 1;
        }
    }
    for (int i = 1; i <= f; i++) {
        for (int j = 0; j <= f; j++) {
            if (s[j] == 0 || w[i] == 0) continue;
            if (i + j > f) continue;
            if (i * e / 100 < j) continue;
            if (ans <= ((double) j * 100) / (i + j)) {
                ans = ((double) j * 100) / (i + j);
                res1 = i + j, res2 = j;
            }
        }
    }
    cout << res1 << ' ' << res2 << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define all(c) (c).begin(), (c).end()

template<typename T>
inline bool chmin(T& t, T f) { if (t <= f) return false; t = f; return true; }

template<typename T>
inline bool chmax(T& t, T f) { if (t >= f) return false; t = f; return true; }

bool valid(vector<string>& sc, vector<vector<int>>& range, string& bagg) {
    int used = 0;
    rep(k, bagg.size()) {
        int l = bagg[k] - 'A';
        used |= 1 << l;
        for (int i = range[l][0]; i <= range[l][1]; ++i) {
            for (int j = range[l][2]; j <= range[l][3]; ++j) {
                if (sc[i][j] == '.' || !(used >> (sc[i][j] - 'A') & 1)) return false;
            }
        }
    }
    return true;
}

char const *check(int H, int W, vector<string>& sc) {
    int used = 0;
    vector<vector<int>> range(26, {H, 0, W, 0});
    string bagg = "";
    rep(i, H) rep(j, W) if (sc[i][j] != '.') {
        int l = sc[i][j] - 'A';
        if (used >> l & 1) {
            chmin(range[l][0], i);
            chmax(range[l][1], i);
            chmin(range[l][2], j);
            chmax(range[l][3], j);
        }
        else {
            used |= 1 << l;
            bagg += sc[i][j];
            range[l][0] = range[l][1] = i;
            range[l][2] = range[l][3] = j;
        }
    }
    sort(all(bagg));
    do {
        if (valid(sc, range, bagg)) return "SAFE";
    } while (next_permutation(all(bagg)));
    return "SUSPICIOUS";
}

int main() {
    int n;
    cin >> n;
    while (n--) {
        int H, W;
        cin >> H >> W;
        vector<string> sc(H);
        for (auto& e: sc) cin >> e;
        cout << check(H, W, sc) << endl;
    }
    return 0;
}

Measured memory_bytes: 1236
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextLong();
            var ans = "";
            while (n > 0)
            {
                var nn = n - 1;
                var tmp = nn % 26;
                var s = ((char)(tmp + 'a')).ToString();
                ans = s + ans;
                n = nn / 26;
            }
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}

Measured memory_bytes: 27512
import java.util.Scanner;

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

        int N = sc.nextInt();
        int M = sc.nextInt();

        System.out.println(solve(N, M));

        sc.close();
    }

    static int solve(int N, int M) {
        return (M * 1900 + (N - M) * 100) * (1 << M);
    }
}

Measured memory_bytes: 21716
#include<stdio.h>

int main(){
   int N,R,IN;
   scanf("%d %d",&N,&R);
   if(N < 10){
      IN = R+(100*(10-N));
      printf("%d\n",IN);
   } else {
      IN = R;
       printf("%d\n",IN);
   }
   return 0;
}


Measured memory_bytes: 1668
from itertools import accumulate
N,*A=map(int, open(0).read().split())
if N==0:
    if A[0]==1:
        print(1)
    else:
        print(-1)
    exit()
if A[0]!=0:
    print(-1)
    exit()
R=[0]*(N+2)
R[0]=1
ans=0
for i in range(N+1):
    R[i]-=A[i]
    if R[i]<0:
        print(-1)
        exit()
    R[i+1]=min(R[i]*2,10**17)
B=list(accumulate(A[::-1]))[::-1]
ans+=sum(min(R[i]+A[i],B[i])for i in range(N+1))
print(ans)


Measured memory_bytes: 23404
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

int main(void) {
    vector<int> table(14);
    table[1] = 12;
    table[2] = 0;
    table[3] = 1;
    table[4] = 2;
    table[5] = 3;
    table[6] = 4;
    table[7] = 5;
    table[8] = 6;
    table[9] = 7;
    table[10] = 8;
    table[11] = 9;
    table[12] = 10;
    table[13] = 11;

    int a, b;
    cin >> a >> b;
    if (table[a] == table[b]) {
        cout << "Draw" << endl;
    } else if (table[a] > table[b]) {
        cout << "Alice" << endl;
    } else {
        cout << "Bob" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 500000
#define INF 1000000001

void merge(int *,int,int,int);
void mergeSort(int *,int,int);

int count;

int main(){
  int num,n[N],i;

  scanf("%d",&num);

  for(i=0;i<num;i++)  scanf("%d",&n[i]);

    mergeSort(n,0,num);

  for(i=0; i<num-1; i++) printf("%d ",n[i]);
  printf("%d\n%d\n",n[i],count);

  return 0;
}


void merge(int *A,int left,int mid,int right){
  int L[N],R[N],i,j,k,n1,n2;

  n1 = mid-left;
  n2 = right-mid;
  for(i=0; i<n1; i++) L[i]=A[left+i];
  for(i=0; i<n2; i++) R[i]=A[mid+i];

  L[n1]=INF;
  R[n2]=INF;

  i=0;
  j=0;

  for(k=left; k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }
    else{
      A[k]=R[j];
      j++;
      count++;
    }
  }
}

void mergeSort(int *A,int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

Measured memory_bytes: 5580
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
/*---------------------------------------*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int a, b, h; cin >> a >> b >> h;
  cout << (a+b)*h/2 << "\n";
  return 0;
}


Measured memory_bytes: 256
N, M, X = map(int, input().split())
A = list(map(int, input().split()))

to_0 = 0
if A[-1] < X:
    to_0 = M
    to_N = 0
elif A[0] < X < A[-1]:
    for i in A:
        if i < X:
            to_0 += 1
    to_N = M - to_0
elif X < A[0]:
    to_0 = 0
    to_N = M
print(min(to_0, to_N))

Measured memory_bytes: 3188
using System;
using System.Linq;
using System.Collections.Generic;
class program{
  static long mod = 1000000007;
  static void Main(){
    int n = int.Parse(Console.ReadLine());
    var ct = new Dictionary<(long, long), int[]>();
    int zeros = 0;
    for(int i = 0; i < n; i++){
      long[] ab = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
      
      if(ab[0] == 0 && ab[1] == 0){
        zeros++;
        continue;
      }
      if(ab[0] == 0)
        ab[1] = 1;
      else if(ab[1] == 0)
        ab[0] = -1;
      else{
        if(ab[1] < 0){
          ab[1] = -ab[1];
          ab[0] = -ab[0];
        }
        long absa = ab[0]>0 ? ab[0]:-ab[0];
        long g = absa > ab[1] ? Gcd(absa,ab[1]):Gcd(ab[1],absa);
        ab[0] /= g;
        ab[1] /= g;
      }
      bool mainus = ab[0] < 0;
      (long, long) key = mainus ? (ab[1], -ab[0]) : (ab[0], ab[1]);
      if (ct.TryGetValue(key, out var v)) v[mainus ? 1 : 0]++;
      else ct.Add(key, mainus ? new[] { 0, 1 } : new[] { 1, 0 });
    }
    long ans = 1;
    foreach (var item in ct.Values) 
      ans = ans*(ModPow(item[0]) + ModPow(item[1]) - 1) % mod;
    Console.WriteLine((ans + zeros - 1 + mod) % mod);
  }
  static long Gcd(long n,long m) {
    while(m>0){
      var r = n%m;
      n = m;
      m = r;        
    }
    return n;
  }
  
  static long ModPow(long n)
  {
    long ret = 1;
    long a = 2;
    while (n > 0){
      if (n % 2 == 1) ret = ret * a % mod;
      a = a*a%mod;
      n /= 2;
    }
    return ret;
  }
}


Measured memory_bytes: 68576
S = input()
leng = len(S) - 1
count = 0
for i in range(2 ** leng):
    op = [''] * leng
    for j in range(leng):
        if ((i >> j) & 1):
            op[-1 * (j + 1)] = '+'
    
    formula = ''
    for num, i in zip(S, op + ['']):
        formula += num + i
    count += eval(formula)
print(count)

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

int main() {
    int N_given;
    cin >> N_given;
    int H_given[N_given];
    rep(i,N_given){
        cin >> H_given[i];
    }
    
    int dp[N_given];
    
    dp[0] = 0;
    rep(i,N_given-1){
        if(i != 0){
            dp[i+1] = min(dp[i]+abs(H_given[i+1]-H_given[i]),dp[i-1]+abs(H_given[i+1]-H_given[i-1]));
        }else{
            dp[1] = dp[0] + abs(H_given[1] - H_given[0]);
        }
    }
    
    cout << dp[N_given-1] << endl;
}


Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> 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; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(),A.end());
    int sum = 0;
    for(int i=0; i<K; i++){
        sum += A[i];
    }
    cout << sum << "\n";
    return 0;
}


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

string S;
stack<char> st;

int ans;

int main() {
    cin >> S;

    for(char c : S) {
        if (st.empty())
        {
            st.push(c);
            continue;
        }

        if (c==st.top())
        {
            st.push(c);
        } else {
            st.pop();
            ans += 2;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define dl double
#define mp make_pair
#define pb push_back
using namespace std;

//***********************************************************************

// hash struct for unordered_map
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int MAXNUM = 5e3+5;
vector <int>vis(MAXNUM);
vector<int> pr;
void sieve() {
	pr.push_back(2);
	for(ll i=3;i<MAXNUM;i+=2) if(!vis[i]) {
		pr.push_back(i);
		for(ll j=i*i;j<MAXNUM;j+=2*i) vis[j]=true;
	}
}
//************************************************************************

void solve()
{
    ll a;
    cin >>a;
    cout << a*(1+a*(1+a)) << endl;
}


int main()
{ 
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	ll t;
	//cin >> t;
	t=1;
	while(t--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 3676
#include<stdio.h>

int main(int argc, char const *argv[]) {
  int r,c,i,j;
  int a[128][128]={0};
  scanf("%d %d", &r, &c);
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      scanf("%d", &a[i][j]);
      a[i][c]+=a[i][j];
    }
  }
  for (i = 0; i <= c; i++) {
    for (j = 0; j < r; j++) {
      a[r][i]+=a[j][i];
    }
  }
  for (i = 0; i <= r; i++) {
    for (j = 0; j <= c; j++) {
      printf("%d", a[i][j]);
      if (j < c) {
        printf(" ");
      }
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 676
n = int(input())
l = list(map(int, input().split()))

cnt = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
                if l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]:
                    cnt += 1

print(cnt)


Measured memory_bytes: 68172
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A,B,accept=0;
        String S;
        A=sc.nextInt();
        B=sc.nextInt();
        S=sc.next();
        for(int a=0;a<A+B+1;a++){
            if(S.charAt(a)=='-') accept++;
        }
        if(S.charAt(A)=='-'&&accept==1) System.out.println("Yes");
        else System.out.println("No");
    }
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, M;
    vector<string> A, B;
    cin >> N >> M;
    A.resize(N);
    B.resize(M);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    rep(i, N - M + 1) {
        rep(j, N - M + 1) {
            rep(x, M) {
                rep(y, M) {
                    if(A[i + x][j + y] != B[x][y]) goto aaa;
                }
            }
            cout << "Yes" << endl;
            return 0;
            aaa:;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
class Item:
	def __init__(self,v,w):
		self.v=v
		self.w=w
		self.r=v/w
	def __str__(self):
		s='v='+str(self.v)
		s+=',w='+str(self.w)
		s+=',r='+str(self.r)
		return s

n,w=map(int,input().split())
items=[]
for i in range(n):
	vi,wi=map(int,input().split())
	items.append(Item(vi,wi))
	
items.sort(key=lambda x:x.r,reverse=True)

total=0
remain = w
for i in range(n):
	v = items[i].v
	w = items[i].w
	r = items[i].r
	if w <= remain:
		total += v
		remain -= w
	else:
		total += r * remain
		break
			
print(total)



Measured memory_bytes: 32556
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <ctime>
#include <complex>

#define enp 	printf("**Entry Point**\n")
#define A		first
#define B		second
#define MP		make_pair

using namespace std;

typedef long long ll;

const int INF = 0x6fffffff;
const int MINF = 0x80000000;
const ll mod = 100003;
const int cons = 100001;
const double pi = 3.141592653589793;



int main()
{
	double n, x;
	cin >> n >> x;

	double ans = n;
	double t = x;
	n = n - x;
	while (t > 0.00001)
	{
		double num = floor(n / t);

		if(abs(num*t - n) < 0.00001)ans += (2 * num - 1)*t;
		else ans += (2 * num)*t;

		x = n - num*t;
		n = t;
		t = x;
	}

	printf("%0.0lf\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    long long N, H;
    cin >> N >> H;
    vector<long long> a(N), b(N);
    REP(i, N) { cin >> a[i] >> b[i]; }
    vector<pair<long, long>> sord(N);
    REP(i, N) { sord[i] = make_pair(-b[i], -a[i]); }
    sort(sord.begin(), sord.end());
    int max_a = *max_element(a.begin(), a.end());
    int cnt = 0;
    int index = 0;
    while(H > 0) {
        if(max_a >= -1 * sord[index].first) {
            H -= max_a;
        } else {
            H -= (-1) * sord[index].first;
            index++;
        }
        cnt++;
    }
    cout << cnt << endl;
}

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

const int divisor = 1000000007;

int main(){
	// 100000!までの数をdivisorで割った余りを格納しておく
	long long* factmodary = new long long[100001];
	long long fact = 1;
	for (int i = 1; i <= 100000; i++){
		fact *= i;
		fact %= divisor;
		factmodary[i] = fact;
	}

	int* word = new int[100000] {0};

	for (;;){
		int N, R;
		cin >> N;
		if (N == 0) break;
		cin >> R;
		
		//まず0番目の単語を入れておく
		for (int i = 0; i < N; i++) word[i] = i + 1;

		for (int i = 0; i < R; i++){
			int s, t;
			cin >> s >> t;
			/* swap */
			int tmp = word[s - 1]; word[s - 1] = word[t - 1]; word[t - 1] = tmp;
		}

		//word[i]をkey, word[i]より小さい数がそれ以前にいくつ使われていたかをvalueとして格納するmap
		map<int, int> bubblehist;
		bubblehist[word[0]] = 0;

		long long ans = factmodary[N-1] * (word[0] - 1);

		for (int i = 1; i < N; i++){
			int facttime = word[i] - 1;
			int bubblenum;
			map<int, int>::iterator it = bubblehist.lower_bound(word[i]);

			if (it != bubblehist.end()){
				bubblenum = it->second;
				it--;
			}
			else {
				it--;
				bubblenum = it->second + 1;
			}
			pair<int, int> p;
			p.first = word[i];
			p.second = bubblenum;
			map<int, int>::iterator it2 = bubblehist.insert(it, p);
			//word[i]より大きい数はすべてvalueが1増える
			for (++it2; it2 != bubblehist.end(); it2++) (it2->second)++;

			facttime -= bubblenum;
			ans += factmodary[N - (i + 1)] * facttime;
			ans %= divisor;
		}
		cout << (int)ans << "\n";
	}

	delete[] word;
	delete[] factmodary;
	return 0;
}

Measured memory_bytes: 6816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;
const int MAX = 1e5 + 10;
const double exps = 1e-8;

inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a > b ? b : a; }
int n, a[N];
map<int, int> m;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", a + i), m[a[i]]++;
    ll sum=0;
    for (auto it = m.begin(); it != m.end(); ++it) {
        ll p = 1ll * it->second;
        if (p > 1) {
            sum += p * (p - 1) / 2;
        }
    }
    for (int k = 1; k <= n; ++k) {
        printf("%lld\n", sum-m[a[k]]+1);
    }
}

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

int main() {
    int n,m; scanf("%d%d" , &n , &m);
    int L = -1, R = n + 1;
    bool pos = true;
    for (int i = 0 ; i < m ; i++) {
        int l,r; scanf("%d%d" , &l , &r);
        if (r < L || l > R) pos = false;
        L = max(L , l), R = min(R , r);
    }
    printf(pos ? "%d\n" : "0\n" , R - L + 1);
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        int[] a = new int[n];
        
        int wlmax = 0;
        int whmax = w;
        int hlmax = 0;
        int hhmax = h;
        int sum = 0;
        
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            a[i] = sc.nextInt();
            
            if (a[i] == 1) {
                if (wlmax < x[i]) {
                    wlmax = x[i];
                }
            } else if (a[i] == 2) {
                if (whmax > x[i]) {
                    whmax = x[i];
                }
            } else if (a[i] == 3) {
                if (hlmax < y[i]) {
                    hlmax = y[i];
                }
            } else if (a[i] == 4) {
                if (hhmax > y[i]) {
                    hhmax = y[i];
                }
            } 
        }
        w = whmax - wlmax;
        h = hhmax - hlmax;
        if (w <= 0 || h <= 0) {
            sum = 0;
        } else {
           sum = w * h; 
        }
        System.out.println(sum);
    }
}

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

int main(){
        int a,b;
        while(1){
                scanf("%d",&a);
                if(!a)
                        break;
                b=0;
                for(;;){
                        if(a==1){
                                printf("%d\n",b);
                                break;
                        } else if(a%2){
                                a=a*3+1;
                                b++;
                        }else{
                                a/=2;
                                b++;
                        }
                }
        }
        return 0;
}

Measured memory_bytes: 1172
import math
N, K = map(int, input().split())
p = 0
for i in range(1,N+1):
  if i < K:
    times = math.ceil(math.log2(K/i))
    p = p + (1/N)*(1/2)**times
  else:
    p = p + (1/N)
print(p)
  


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

int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t)cout << "Yes" << endl;
  else cout << "No" << endl;
  

	return 0;
}


Measured memory_bytes: 256
import collections

n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

d = collections.defaultdict(int)
for ai in a:
    d[ai - 1] += 1

for i in range(n):
    if k - (q - d[i]) > 0:
        print('Yes')
    else:
        print('No')


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

//GCD,LCM
ll gcd(ll a, ll b){ return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return a/gcd(a,b)*b;}

int main()
{

    const double pie = 3.1415926535;
    double x;
    cin>>x;

    cout<<fixed<<setprecision(10);
    cout<<x*2*pie<<endl;


    return 0;
}

Measured memory_bytes: 3764
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int D;
	scanf("%d", &D);
	int c[26], s[D][26], t[D], last[26], bst = 0, ans[D];
	for (int i = 0; i < 26; ++i) scanf("%d", &c[i]);
	for (int i = 0; i < D; ++i) {
		for (int j = 0; j < 26; ++j) scanf("%d", &s[i][j]);
	}
	fill_n(ans, D, 0);
	for (int h = 0; h < 13; ++h) {
		fill_n(last, 26, -1);
		for (int i = 0; i < D; ++i) {
			int x = 0, opt = 0;
			for (int j = 0; j < 26; ++j) {
				if (c[j] * (i - last[j] + h) + s[i][j] > x) x = c[j] * (i - last[j] + h) + s[i][j], opt = j;
			}
			last[opt] = i;
			t[i] = opt;
		}
		fill_n(last, 26, -1);
		int sc = 0;
		for (int i = 0; i < D; ++i) {
			last[t[i]] = i;
			sc += s[i][t[i]];
			for (int j = 0; j < 26; ++j) sc -= c[j] * (i - last[j]);
		}
		if (sc > bst) {
			bst = sc;
			for (int i = 0; i < D; ++i) ans[i] = t[i];
		}
	}
	for (int i = 0; i < D; ++i) printf("%d\n", ans[i] + 1);
	return 0;
}

Measured memory_bytes: 1768
from itertools import chain
n=int(input())
c=list(range(2*n))
for _ in[0]*int(input()):
    k=int(input())
    c=c[k:]+c[:k]if k else list(chain.from_iterable(zip(c[:n],c[n:])))
for x in c:print(x+1)


Measured memory_bytes: 5676
import numpy as np
def main():
	
	n = int(input())
	sum = 0
	l = np.zeros(n)
	for i in range(n):
		buf = int(input())
		l[i] = buf
		sum += buf
	
	print(int(sum-np.max(l)/2))
		
	
		
main()# your code goes here

Measured memory_bytes: 21496
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
//No change above here

const ll maxi = 2 * 1e5 + 5;
ll mod = 5;
double pi = 3.141592653589793238;

//function for power
ll power(ll x, ll n) {
	ll res = 1;
	x %= mod;
	while (n) {
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

ll sum_digits(ll n)
{
	ll ret = 0;
	while (n)
	{
		ret += n % 10;
		n /= 10;
	}
	return ret;
}

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

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

ll max_subarray(vector<int>& v)
{
	if (v.empty())
		return 0;
	ll glob = v[0], loc = v[0];
	for (int i = 1; i < v.size(); ++i)
	{
		loc = max(v[i] + 0LL, loc + v[i]);
		glob = max(loc, glob);
	}
	return glob;
}

long long num_digits(long long x)
{
	long long ans = 0;
	while (x)
	{
		++ans;
		x /= 10;
	}
	return ans == 0 ? 1 : ans;
}

vector<int> topological_sort(vector<vector<int>>& graph, int n, vector<int>& indegree)
{
	vector<int> ans;
	stack<int> s;
	for (int i = 0; i < n; ++i)
		if (indegree[i] == 0)
			s.push(i);
	while (!s.empty())
	{
		int x = s.top();
		s.pop();
		ans.push_back(x);
		for (auto& adj : graph[x])
			if (--indegree[adj] == 0)
				s.push(adj);
	}
	return ans;
}

ll dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll p, q;
bool valid(ll i, ll j) { return i >= 1 && i <= p && j >= 1 && j <= q; }


//declare needed things here


int main()
{
	IOS;
	ll k,x=7,c=1;
	cin >> k;
	bool found = false;
	while (c <= k)
	{
		if (x % k == 0)
		{
			found = true;
			break;
		}
		x = (x % k) * 10 + 7;
		++c;
	}
	if (found)
		cout << c << endl;
	else
		cout << "-1" << endl;
	return 0;
}


Measured memory_bytes: 3628
n,x,m=map(int,input().split())

def f(ai,m):
    return (ai*ai)%m

if x==0:
    print(0)
elif x==1:
    print(n)
elif m==1:
    print(0)
else:
    chk=[-1]*m
    asum00=[0]*m
    ai,asum=x,0
    for icnt in range(m):
        asum00[icnt]=asum
        if chk[ai]!=-1:
            icnt0=chk[ai]
            break
        chk[ai]=icnt
#        asum00[icnt]=asum
        asum+=ai
        ai=f(ai,m)
    asum0=asum00[icnt0]
        
    icntk=icnt-icnt0
    n0=n-1-icnt0
#    if icntk!=1:
    nk=n0//icntk
    nr=n0%icntk
#    else:
#        nk=n0
#        nr=-1
    asumk=asum-asum0
       
    ans=asum00[icnt0+nr+1]+asumk*nk
    print(ans)       


Measured memory_bytes: 65792
#include<iostream>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=550;

typedef long long ll;
int mp[N][N], dp[N][N];

int main()
{
    int n,m,q;
    cin>>n>>m>>q;

    while(m--)
    {
        int a,b;
        cin>>a>>b;
        mp[a][b] ++;
    }

    for(int i=n;i>=1;i--)
        for(int j=1; j<=n; j++)
        {
            dp[i][j] = mp[i][j] + dp[i+1][j] + dp[i][j-1] - dp[i+1][j-1];
            //printf("(%d,%d):%d\n",i,j,dp[i][j]);
        }

    while(q--)
    {
        int a,b;
        cin>>a>>b;
        cout<<dp[a][b]<<endl;
    }



    return 0;
}

Measured memory_bytes: 3072
n, k = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(n)]
INF = 10 ** 19

xy.sort()

ans = INF
for i in range(n):
	for j in range(i + k - 1, n):
		width = xy[j][0] - xy[i][0]

		y = [xy[idx][1] for idx in range(i, j + 1)]
		y.sort()

		for e1, e2 in zip(y, y[k-1:]):
			height = e2 - e1
			area = width * height
			ans = min(ans, area)

print(ans)


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

typedef long long lint;
typedef unsigned long long ulint;
const lint MOD=998244353;

lint fact[300001],factinv[300001];

int gcd(lint a,lint b){
    if(a<b) return gcd(b,a);
    if(a%b==0) return b;
    return gcd(b,a%b);
}
pair<lint,lint> euc(lint a,lint b){
    if(a==1) return make_pair(1,0);
    if(b==1) return make_pair(0,1);
    if(a<b){
        auto r=euc(b,a);
        return make_pair(r.second,r.first);
    }
    if(a%b==1){
        return make_pair(1,-a/b);
    }
    lint q=a/b;
    auto r=euc(b,a%b);
    return make_pair(r.second,r.first-q*r.second);
}
lint comb(lint n,lint r){
    return fact[n]*factinv[r]%MOD*factinv[n-r]%MOD;
}
lint powm(lint x,lint e){
    if(e==0) return 1;
    if(e==1) return x%MOD;
    return powm(x*x%MOD,e/2)*(e%2==1?x:1)%MOD;
}

int main(){
    lint N,A,B,K;
    cin >> N >> A >> B >> K;

    fact[0]=1;
    for(int i=1;i<=N;i++) fact[i]=i*fact[i-1]%MOD;
    for(int i=0;i<=N;i++) factinv[i]=powm(fact[i],MOD-2);

    if(A<B){
        lint tmp=A;
        A=B;
        B=tmp;
    }
    lint C=gcd(A,B);
    if(K%C!=0){
        cout << 0 << endl;
        return 0;
    }
    A/=C;
    B/=C;
    K/=C;
    pair<lint,lint> p=euc(A,B);
    lint x=p.first,y=p.second;
    assert(A*x+B*y==1);
    x*=K; y*=K;
    
    if(x>0){
        lint cnt=x/B+1;
        x-=B*cnt;
        y+=A*cnt;
    }
    while(x<0){
        x+=B;
        y-=A;
    }

    assert(A*x+B*y==K && x>=0 && x-B<0);

    lint ans=0;
    while(0<=x && x<=N){
        if(0<=y && y<=N){
            ans+=comb(N,x)*comb(N,y)%MOD;
            ans%=MOD;
        }
        x+=B;
        y-=A;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 998244353;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> dp(N*3);
    vector<ll> cnt(N*3);
    vector<ll> L(K),R(K);
    dp[1] = 1;
    rep(i,K) cin >> L[i] >> R[i];
    ll now = 0;
    rep(i,N){
        if(i != 0) now += cnt[i+1];
        dp[i+1] += now;
        dp[i+1] %= MOD;
        now %= MOD;
        rep(j,K){
            cnt[i+1+L[j]] += dp[i+1];
            if(cnt[i+1+L[j]] < 0) cnt[i+1+L[j]] += MOD;
            else cnt[i+1+L[j]] %= MOD;
            cnt[i+2+R[j]] -= dp[i+1];
            if(cnt[i+2+R[j]] < 0) cnt[i+2+R[j]] += MOD;
            cnt[i+2+R[j]] %= MOD;
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 12704
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 100000000000000009
#define MOD 1000000007
using P = pair<int,int>;
signed main(){
  int n;
  cin >> n;
  vector<P> road(n);
  rep(i,n){
    int a,b;
    cin >> a >> b;
    road[i].first = a + b;
    road[i].second = a - b;
  }
  sort(road.begin(),road.end());
  int cur = -INF;
  int ans = 0;
  rep(i,n){
    if(cur <= road[i].second){
      ans++;
      cur = road[i].first;
    }
  }
  cout << ans << endl;
}


      
    
  
  
  
  
  
  



Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int x;
	cin >> x;
	if(x == 3 || x == 5 || x == 7){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256