akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		double a = scanner.nextDouble(),b = scanner.nextDouble();
		if(a > b){
			System.out.println("GREATER");
		}else if(a < b){
			System.out.println("LESS");
		}else{
			System.out.println("EQUAL");
		}
	}

}


Measured memory_bytes: 21332
import java.util.*;


class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        double[] x = new double[n];
        String[] u = new String[n];
        double sum = 0;
        for(int i = 0; i < n; i++){
            x[i] = sc.nextDouble();
            u[i] = sc.next();
            if(u[i].equals("JPY")){
                sum = sum + x[i];
            }else{
                sum = sum + x[i] * 380000;
            }
             
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 23124
class CSR:
    def __init__(self, n: int, edges: list):
        self.start = [0] * (n+1)
        self.elist = [0] * len(edges)
        for e in edges:
            self.start[e[0]+1] += 1
        
        for i in range(1, n+1):
            self.start[i] += self.start[i-1]
        
        counter = self.start[::] # copy
        for e in edges:
            self.elist[counter[e[0]]] = e[1]
            counter[e[0]] += 1


class SccGraph:
    def __init__(self, n: int = 0):
        self.__n = n
        self.__edges = []
    
    def __len__(self):
        return self.__n
    
    def add_edge(self, s: int, t: int):
        assert 0 <= s < self.__n and 0 <= t < self.__n
        self.__edges.append([s, t])
    
    def __scc_ids(self):
        g = CSR(self.__n, self.__edges)
        now_ord = group_num = 0
        visited = []
        low = [0] * self.__n
        order = [-1] * self.__n
        ids = [0] * self.__n
        parent = [-1] * self.__n
        for root in range(self.__n):
            if order[root] == -1:
                stack = [root, root]
                while stack:
                    v = stack.pop()
                    if order[v] == -1:
                        visited.append(v)
                        low[v] = order[v] = now_ord
                        now_ord += 1
                        for i in range(g.start[v], g.start[v+1]):
                            t = g.elist[i]
                            if order[t] == -1:
                                stack += [t, t]
                                parent[t] = v
                            else:
                                low[v] = min(low[v], order[t])
                    
                    else:
                        if low[v] == order[v]:
                            while True:
                                u = visited.pop()
                                order[u] = self.__n
                                ids[u] = group_num
                                if u == v:
                                    break
                                
                            group_num += 1
                        
                        if parent[v] != -1:
                            low[parent[v]] = min(low[parent[v]], low[v])
        
        for i, x in enumerate(ids):
            ids[i] = group_num - 1 - x
        
        return group_num, ids
    
    def scc(self):
        group_num, ids = self.__scc_ids()
        counts = [0] * group_num
        for x in ids:
            counts[x] += 1
        
        groups = [[] for _ in range(group_num)]
        for i, x in enumerate(ids):
            groups[x].append(i)
        
        return groups


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int,readline().split())
data = list(map(int,read().split()))
sg = SccGraph(N)

it = iter(data)
for a, b in zip(it, it):
    sg.add_edge(a,b)

scc = sg.scc()
print(len(scc))
for group in scc:
    print(len(group), end=' ')
    print(*group)

Measured memory_bytes: 202748
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim A As Integer = NextInt()
        Dim B As Integer = NextInt()
        Dim C As Integer = NextInt()
        Dim X As Integer = NextInt()

        Dim ans As Integer

        For i As Integer = 0 To A
            For j As Integer = 0 To B
                For k As Integer = 0 To C
                    If 500 * i + 100 * j + 50 * k = X Then
                        ans += 1
                    End If
                Next k
            Next j
        Next i

        WriteLine(ans)
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 19920
N=int(input())
dict={}

for i in range(N):
    s,p=input().split()
    if s not in dict:
        dict[s]=[[int(p),i+1]]
    else:
        dict[s].append([int(p),i+1])

List=sorted(dict.items(),key=lambda x: x[0])

for d in List:
    k,L=d
    L.sort(key=lambda x:x[0],reverse=True)
    for l in L:
        print(l[1])


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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

void printVec(vector<int> &vec)
{
	for (auto &e : vec)
	{
		cout << e << " ";
	}
	cout << endl;
}

int func(long long A, long long B)
{
	// cout << fixed << setprecision(8);
	ll num = lcm(A, B);
	cout << num << endl;

	return 0;
}

int main()
{
	long long A;
	scanf("%lld", &A);
	long long B;
	scanf("%lld", &B);

	func(A, B);

	return 0;
}


Measured memory_bytes: 256
s = gets.chomp

case s
when 'SUN'
  puts 7
when 'MON'
  puts 6
when 'TUE'
  puts 5
when 'WED'
  puts 4
when 'THU'
  puts 3
when 'FRI'
  puts 2
when 'SAT'
  puts 1
end


Measured memory_bytes: 1788
/*
  Lower bound: first element that is greater-or-equal.
  int i=lower_bound(a,a+n,x)-a;
  Upper bound: first element that is strictly greater.
  #include<boost/multiprecision/cpp_int.hpp>
  namespace mp=boost::multiprecision;
  mp::cpp_int u=1; for(unsigned i=1;i<=n;i++) u*=i;
*/
#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define I (int)
const int mod=(int)1e9+7;
const long long INF = 1000000000000000000LL;
const int WASTE=(int)2e5;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //#define int long long
   	int n,k;
   	cin>>n>>k;
   	int a[n];
   	int z[I 2e5+5];
   	mem(z,0);
   	for(int x=0;x<n;x++)
   		cin>>a[x],z[a[x]]++;
   	vector<pair<int,int>>v;
   	for(int x=1;x<=2e5;x++){
   		if(z[x])
   			v.push_back({z[x],x});
   	}
   	int ans=0;
   	sort(v.begin(),v.end());
   	for(int x=0;x<v.size();x++){
   		if(v.size()-x<=k)
   			break;
   		ans+=v[x].first;
   	}
   	cout<<ans;
    return 0;
}

Measured memory_bytes: 3956
#S = input()
#S, W2 = input().split()
N = int(input())
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))

#D1 = []
#D2 = [[]] * 4
#D1 = [0] * 5
#D2 = [[0] * 5 for i in range(4)]
#D3 = [[[0] * 5 for i in range(4)] for i in range(3)]

K = {}

for i in range(N):
  S = input()
  if S in K:
    K[S] = K[S] + 1
  else:
    K[S] = 1
#

print(len(K))


Measured memory_bytes: 35100
/*
 * 0301.cc: Baton Relay Game
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int MAX_M = 200000;

/* typedef */

struct Ring {
  int i;
  bool ng;
  struct Ring *l, *r;
};

/* global variables */

Ring rs[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) {
    rs[i].i = i;
    rs[i].ng = false;
    rs[i].l = &rs[(i + n - 1) % n];
    rs[i].r = &rs[(i + 1) % n];
  }

  Ring *cpt = rs;
  int rn = n;

  for (int i = 0; i < m; i++) {
    int ai;
    cin >> ai;

    int maxj = ai % rn;
    if (ai & 1)
      for (int j = 0; j < ai; j++) cpt = cpt->l;
    else
      for (int j = 0; j < ai; j++) cpt = cpt->r;

    cpt->ng = true;
    cpt->l->r = cpt->r;
    cpt->r->l = cpt->l;
    cpt = cpt->r;
    rn--;
  }

  while (qn--) {
    int qi;
    cin >> qi;
    printf("%d\n", rs[qi].ng ? 0 : 1);
  }
  
  return 0;
}

Measured memory_bytes: 5832
import java.io.*;
import java.util.*;
import java.lang.Math;

public class Main {

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

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

        public long nextLong() {return Long.parseLong(next());}

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i] = sc.nextInt();
        for(int i=1;i<=n;i++) {
            if(a[i-1] != i) cnt++;
        }
        pw.println(cnt <= 2 ? "YES" : "NO");
        pw.close();
    }
}


Measured memory_bytes: 23252
import java.util.Scanner

object Main extends App{
  val sc = new Scanner(System.in)

  val a = sc.nextInt
  val b = sc.nextInt
  val c = sc.nextInt

  val res = if(c % gcd(a,b) == 0) "YES" else "NO"

  println(res)

  def gcd(a: Int, b: Int): Int ={
    (a,b) match{
      case (x,y) if y == 0 => x
      case (x,y) if x < y  => gcd(y, x)
      case (x,y)           => gcd(y, x % y)
    }
  }
}


Measured memory_bytes: 25520
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <sstream>

using namespace std;
using ll = long long;
using ld = long double;
template <class T> using vec = std::vector<T>;
template <class T> using vvec = std::vector<std::vector<T>>;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

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

    int N; cin >> N;
    vec<ll> A(N + 1); REP(i, 0, N + 1) cin >> A[i];
    vec<ll> B(N); REP(i, 0, N) cin >> B[i];

    ll result = 0;
    REP(i, 0, N)
    {
        ll v = min(A[i], B[i]);
        result += v;
        A[i] -= v;
        B[i] -= v;

        v = min(A[i + 1], B[i]);
        result += v;
        A[i + 1] -= v;
        B[i] -= v;
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;

const int inf = 1e9 + 5;
const long double PI = 3.141592653589793;

void solve(){
  char c;
  cin >> c;
  c+=1;
  cout << c;
  return;
}  
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}

Measured memory_bytes: 3608
N,X=map(int,input().split())
x=list(map(int,input().split()))

dx=[abs(X-i) for i in x]
l=len(dx)

def gcd(a,b):
    return a if b==0 else gcd(b,a%b)

if l==1:
    k=dx[0]
else:
    for i in range(l-1):
        if i==0:
            k=dx[0]
        k=gcd(k,dx[i+1])

print(k)


Measured memory_bytes: 14252
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#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;

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

    ll cnt = 0;
    bool ok = false;
    rep(i, n) {
        ll d1, d2;
        cin >>d1 >> d2;
        if(d1 == d2) {
            cnt++;
        }
        else {
            cnt = 0;
        }
        if(cnt >= 3) {
            ok = true;
        }
    }

    if(ok) {
        out("Yes");
    }
    else {
        out("No");
    }
    
    re0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>

using namespace std;

int main() {
    string left = "qwertasdfgzxcvb";
    string tmp;
    while (cin >> tmp && tmp != "#") {
        int j,n=0,pos; //1??§??????
        for(int i=0;i<tmp.length();i++) {
            char b = tmp[i];
            for(j=0;j<15;j++){
                if (b==left[j]) break;
            }
            if (i==0) {
                if (j==15) {
                    pos = 1;
                } else pos = 0;
            } else {
                if (pos == 1 && j != 15) {n++; pos = 0;}
                if (pos == 0 && j == 15) {n++; pos = 1;}
            }
        }
        cout << n << endl;
    }
}

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

using namespace std;

int N, R;
vector<int> WordInfo;
int Used[100001];
long long Factorial[100001];


void calculateFactorial() {

	Factorial[0] = 1;
	for (int i = 1; i < 100001; ++i) {
		Factorial[i] = (i*(Factorial[i - 1] % 1000000007)) % 1000000007;
	}
}

int getUsedCount(int currentNum) {
	int cnt;

	cnt = 0;
	while (currentNum > 0) {
		cnt += Used[currentNum];
		currentNum -= currentNum&(-currentNum);
	}

	return cnt;
}

void updateUsedCount(int currentNum) {
	while (currentNum <= N) {
		++Used[currentNum];
		currentNum += currentNum&(-currentNum);
	}
}

void solve() {
	int cnt, currentNum;
	long long sum;

	sum = 0;
	for (int i = 0; i < N; ++i) {
		currentNum = WordInfo[i];
		cnt = currentNum - 1 - getUsedCount(currentNum);
		//cout << "cnt=" << cnt << endl;
		sum = (sum % 1000000007 + cnt * Factorial[N - 1 - i]) % 1000000007;
		//cout << "sum=" << sum << endl;
		updateUsedCount(currentNum);
	}
	cout << sum << endl;
}

int main() {
	int s, t;

	calculateFactorial();
	while (cin >> N, N) {
		WordInfo.clear();
		for (int i = 0; i < N; ++i) {
			WordInfo.push_back(i + 1);
		}
		/*cout << "before:" << endl;
		for (int i = 0; i < N; ++i) {
			cout << WordInfo[i] << " ";
		}
		cout << endl;*/
		cin >> R;
		for (int i = 0; i < R; ++i) {
			cin >> s >> t;
			swap(WordInfo[s - 1], WordInfo[t - 1]);
		}
		/*cout << "after:" << endl;
		for (int i = 0; i < N; ++i) {
			cout << WordInfo[i] << " ";
		}
		cout << endl;*/

		memset(Used, 0, sizeof(Used));
		solve();
	}

	return 0;
}



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

int main() {

    string s;
    cin>>s;
    if(s=="Sunny") {
        printf("Cloudy");
    }
    else if(s=="Cloudy") {
        printf("Rainy");
    }
    else if(s=="Rainy") {
        printf("Sunny");
    }
  
 return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	fsc := NewFastScanner()
	X, A, B := fsc.NextInt(), fsc.NextInt(), fsc.NextInt()
	if IntAbs(X-A) <= IntAbs(X-B) {
		fmt.Println("A")
	} else {
		fmt.Println("B")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdlib>
#include <climits>

using namespace std;

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

  int maxv = INT_MIN;
  int winner = INT_MAX;
  for( int i = 0; i < n; i++ ) {
    int a, v;
    cin >> a >> v;
    if( maxv < v ) {
      winner = a;
      maxv = v;
    } else if( maxv == v ) {
      winner = min( a, winner );
    }
  }
  cout << winner << " " << maxv << endl;

  return EXIT_SUCCESS;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (U == S)
  {
    cout << A - 1 << " " << B << endl;
  }
  else
  {
    cout << A << " " << B - 1 << endl;
  }
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())

inc_x = x2 - x1
inc_y = y2 - y1
l = max(abs(inc_x), abs(inc_y))

if x1 == x2 and y1 > y2:
    print(x2 + l, y2, x1 + l, y1)
elif x1 == x2:
    print(x2 - l, y2, x1 - l, y1)
elif y1 == y2:
    print(x2, y2 - l, x1, y1 - l)
else:
    print(x2 - inc_y, y2 + inc_x, x1 - inc_y, y1 + inc_x)

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

int main()
{
	int a, b;
	char op;
	while(1){
	cin >> a >> op >> b;
		if (op == '?') break;
		if (op == '+') {
			cout << a + b << endl;
		}
		else if (op == '-') {
			cout << a - b << endl;
		}
		else if (op == '*') {
			cout << a*b << endl;
		}
		else if (op == '/') {
			cout << a / b << endl;
		}
	}
return		0;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 305;

int n, m;
bitset<N> val;

int grid[N][N];

map<int, int> cnt;
vector<pii> loc[N];

int main() {
	cin.tie(0)->sync_with_stdio(0);
    cin >> n >> m;
    val.set();
    rep(i, 0, n) {
        rep(j, 0, m) {
            cin >> grid[i][j];
            if (!j) {
                ++cnt[grid[i][j]];
                loc[grid[i][j]].push_back({i, j});
            }
        }
    }

    int ans = n;
    for (int i = 0; i < m; ++i) {
        int mi, mc = 0;
        for (auto j : cnt) {
            if (j.second > mc) {
                mi = j.first;
                mc = j.second;
            }
        }
        
        val[mi] = false;
        if (mc) ans = min(ans, mc);
        for (auto j : loc[mi]) {
            int x = j.first, y = j.second + 1;
            for (; y < m; ++y) {
                if (val[grid[x][y]]) {
                    loc[grid[x][y]].push_back({x, y});
                    ++cnt[grid[x][y]];
                    break;
                }
            }
        }
        cnt[mi] = 0;
    }
    cout << ans;
}


Measured memory_bytes: 4860
#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

_, M = map(int, raw_input().split())
lst = []

for i in range(M):
    a, b = map(int, raw_input().split())
    lst.append((b, a))

lst.sort()
pos = 0
ans = 0

for p in lst:
    if p[1] > pos:
        ans += 1
        pos = p[0] - 1

print ans

Measured memory_bytes: 18680
import java.lang.String.*;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		String s=sc.next();
		if(s.endsWith("s")) {
			System.out.println(s+"es");
		}
		else {
			System.out.println(s+"s");
		}
		
		
		sc.close();
	}
}

Measured memory_bytes: 38536
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b; cin >> a >> b;
  cout << a*b << endl;

  return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>

int main(int argc, char* argv[]) {
    int num = 0,
        odds = 0;

    scanf("%d", &num);

    int i = 1, tmp = 0;
    for(int i=1; i <= num; ++i) {
        if(i % 2 != 0) tmp += 1;
    }

    double probability = tmp*1.0 / num;
    printf("%lf\n", probability);
    
    return 0;
}

Measured memory_bytes: 128
n, = (int(x) for x in input().split())

nstr = str(n)
ans = ""
for i in range(3):
    if nstr[i] == "1":
        ans += "9"
    elif nstr[i] == "9":
        ans += "1"
    else:
        ans += nstr[i]

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 typedef long long ll;
 
int main() {
int a,b,c;
a=0;
b=0;
c=0;
string s;
cin>>s;
string ans="YES";
int lo=s.size();
for(int i=0;i<lo;i++){
if(s[i]=='a')a++;
else if(s[i]=='b')b++;
else c++;
}
if(max({a,b,c})-min({a,b,c})>1)ans="NO";
cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
// Welcome to my source code!

const int RATE = 380000.0;

int main() {
    int n;
    cin >> n;
    double x, sum;
    string u;
    for (int i = 0; i < n; i++) {
        cin >> x >> u;
        if (u == "BTC") sum += x * RATE;
        else sum += x;
    }
    cout << setprecision(16) << sum << endl;
}

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

int main(void) {
    int T;
    cin >> T;
    while (T -- > 0) {
        int n, d;
        cin >> n >> d;
        priority_queue<int, vector<int>, greater<int>> pq;
        pq.push(d);

        int ans = d;
        for (int i = 1; i < n; ++ i) {
            int cur = pq.top(); pq.pop();
            ans -= cur;
            pq.push(127);
            pq.push(127^cur);
            ans += 127 + (cur ^ 127);
        }

        cout << ans << endl;
    }

    return 0;
}

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

int main(){
    int H, W, A, B, i, j;

    cin >> H >> W >> A >> B;
    int array[H][W];
    for(i = 0; i < H; i++){
        for(j = 0; j < A; j++){
            if(i < B)array[i][j] = 0;
            else array[i][j] = 1;
        }
        for(j = A; j < W; j++){
            if(i < B)array[i][j] = 1;
            else array[i][j] = 0;
        }
    }
    for(i = 0; i < H; i++){
        for(j = 0; j < W; j++){
            printf("%d", array[i][j]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;

using P = pair<int,int>; using vp = V<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
//////////////////

void solve(){
  ins(S);
  each(x , S) x = 'x';
  out(S);
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const LL MOD=1e9+7;



int main(){
    LL M,K;
    cin>>M>>K;
    LL cnt=1;
    LL max=1;
    while(cnt<=M){
        cnt++;
        max*=2;
    }
    if(K==0){
        REP(i,max){
            cout<<i<<" "<<i<<" ";
        }
        cout<<endl;
    }else if((M==1&&K==1)||K>=max){
        cout<<-1<<endl;
    }else{
        vector<int>res;
        REP(i,max){
            if(i!=K)res.PB(i);
        }
        res.PB(K);
        REP(i,max){
            if(max-i-1!=K)res.PB(max-i-1);
        }
        res.PB(K);
        REP(i,SZ(res))cout<<res[i]<<" ";
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 2932
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    s = input()
    t = input()

    for _ in range(len(s)):
        if s == t:
            print('Yes')
            exit()
        else:
            s = s[-1] + s[:-1]
    print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 61832
#include<stdio.h>

int main (void){
  int a,b,c,d = 0;

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

  if(a % 2 == 0){
    for(int i = 0 ; i < ((a + 1) * 125 / 10 ) - (a * 125 / 10) + 1; i++){
      c = a * 125 / 10 + i;
      d = c / 10;
      if(b == d){
        printf("%d\n",c);
        return 0;
      }
    }
  }else{
    for(int i = 0 ; i < ((a + 1) * 125 / 10 ) - (a * 125 / 10) -1; i++){
      c = a * 125 / 10 + 1 + i;
      d = c / 10;
      if(b == d){
        printf("%d\n",c);
        return 0;
      }
    }
  }
  printf("-1\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

vector<vector<ll>> pascals_triangle(int n) {
    vector<vector<ll>> combi(n + 1, vector<ll>(n + 1));
    REP(i, n + 1) REP(j, i + 1) {
        if (j == 0 || j == i) combi[i][j] = 1LL;
        else combi[i][j] = combi[i - 1][j - 1] + combi[i - 1][j];
    }
    return combi;
}

ll gcd(ll m, ll n) {
    return n != 0 ? gcd(n, m % n) : m;
}

ll lcm(ll m, ll n) {
    // If both m and n are large numbers, the result is overflow without parentheses.
    return m * (n / gcd(m, n));
}

void solve() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    if (h == 1) {
        cout << string(a, '0') << string(w - a, '1') << endl;
        return;
    } else if (w == 1) {
        REP(i, h) {
            if (i < b) cout << "0" << endl;
            else cout << "1" << endl;
        }
        return;
    }
    REP(i, h) {
        REP(j, w) {
            if (i < b and j < a or i >= b and j >= a) cout << "0";
            else cout << "1";
        }
        cout << endl;
    }
}


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

int main(void) {
    int n;
    int a, b;
    cin >> n;
    cin >> a >> b;
    for (int i = a; i < b+1; i++) {
        if (i % n == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <functional>
#include <unordered_map>
#define int long long 
#define pi pair<int,int> 
#define endl "\n"
using namespace std ;

const int inf = 1e15 ;
const int size = 3e3 + 5 ;
int  n , m ;
int dp[size][size];
string out = "",s,t;
void print(int ans , int i , int j )
{

    if( i == 0 || j == 0 || ans == 0 ) return ;
    for(int row = i ; row >= 1 ; row-- )
    {
         for(int col = j ; col >=1 ; col--)
         {
             if(dp[row][col] == ans && s[row-1] == t[col-1]) 
             {
                 out = s[row-1] + out ;
                 print(ans-1,row-1,col-1) ;
                 return ;
             }
         }
    }
    print(ans,i-1,j) ;
    return  ;

}



int32_t main() 
{


     /*#ifndef ONLINE_JUDGE 
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
     #endif*/
     cin >> s >> t ;
     n = s.size() ; 
     m = t.size() ;
     for(int i = 1 ; i <= n ; i++ )
     {
         for(int j = 1 ; j <=m ; j++ )
         {
              if(s[i-1] == t[j-1])
              {
                 dp[i][j] = dp[i-1][j-1] + 1 ;
              }
              else 
              {
                 dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
              }
         }
     }
     int ans = dp[n][m] ;
     print(ans,n,m);
     cout<<out<<endl;
     return 0 ;
}


Measured memory_bytes: 71040
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    LL H;
    cin >> H;

    LL count = 1;
    LL ans = 0;
    while (1 < H) {
        ans += count;
        H /= 2;
        count *= 2;
    }
    ans += count;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// Undone
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
public class Program {
  public static void Main() {
    int[] ABC = ReadIntArray();
    if (ABC[2]-1 <= ABC[0] + ABC[1]) {
      Console.WriteLine(ABC[1] + ABC[2]);
    } else {
      Console.WriteLine(ABC[0] + ABC[1]*2 + 1);
    }
  }

  private static int ReadInt() { return int.Parse(Console.ReadLine()); }
  private static double ReadDouble() { return double.Parse(Console.ReadLine()); }
  private static long ReadLong() { return long.Parse(Console.ReadLine()); }
  private static char ReadChar() { return Console.ReadLine()[0]; }
  private static string[] ReadStringArray() { return Console.ReadLine().Split(' '); }
  private static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
  private static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
  private static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
  private static char[] ReadCharArray() { return Console.ReadLine().ToArray(); }
}


Measured memory_bytes: 13396
#include<stdio.h>
#include<stdio.h>
#define MAX_V  1000000
int prime[MAX_V+1];
int a[MAX_V];
int data[30];
int n,count=0,k=0;

int main(void)
{
  int i, k, v;
  for(i = 2; i <= MAX_V; i++)
    prime[i] = 1;

  for(i = 2; i*i <= MAX_V; i++)
    if(prime[i])
      {
        for(k = 2 * i; k <= MAX_V; k += i)
           prime[k] = 0;
      }
  int isprime = prime[n];

  for (int i = 1; i < MAX_V; i++)
    {
      prime[i] = prime[i] + prime[i-1];

    }
  while(scanf("%d",&n)!=EOF)
  {
    printf("%d\n",prime[n]);
  }

}

Measured memory_bytes: 5648
import java.util.*;

public class Main {
	int N;
	List<Long> a;
	long gcd;

	Main() {
		Scanner in = new Scanner(System.in);
		N = in.nextInt();
		a = new ArrayList<>(N);
		for (int i = 0; i < N; ++i) {
			a.add(in.nextLong());
		}
		in.close();
		gcd = a.get(0);
	}

	void calc() {
		for (int i = 1; i < a.size(); ++i) {
			gcd = gcd(a.get(i), gcd);
		}
	}

	long gcd(long x, long y) {
		if (y == 0) {
			return 0L;
		}
		if (x < y) {
			return gcd(y, x);
		}
		if (x == y) {
			return x;
		}
		long c = x % y;
		if (c == 0) {
			return y;
		}
		return gcd(y, c);
	}

	public static void main(String[] args) {
		Main ins = new Main();
		ins.calc();
		if (ins.gcd % 2 == 1L) {
			System.out.println("first");
		} else {
			System.out.println("second");
		}
	}
}

Measured memory_bytes: 62456
#include<iostream>
#include<algorithm>
#include<queue>
#include<algorithm>
using namespace std;
int H,W;
string s[100];
int d[101][101];
int dx[2]={0,1},dy[2]={1,0};
main()
{
	cin>>H>>W;
	for(int i=0;i<H;i++)cin>>s[i];
	for(int i=0;i<=H;i++)for(int j=0;j<=W;j++)d[i][j]=1e9;
	d[0][0]=0;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)
	{
		queue<pair<int,int> >P;
		P.push(make_pair(i,j));
		int nxt=d[i][j]+(s[i][j]=='#'?1:0);
		bool used[101][101]={};
		used[i][j]=true;
		while(!P.empty())
		{
			int x=P.front().first,y=P.front().second;
			P.pop();
			for(int r=0;r<2;r++)
			{
				int tx=x+dx[r],ty=y+dy[r];
				if(d[tx][ty]>nxt)d[tx][ty]=nxt;
				if(!used[tx][ty])
				{
					used[tx][ty]=true;
					if(tx<H&&ty<W&&s[tx][ty]==s[x][y])P.push(make_pair(tx,ty));
				}
			}
		}
	}
	cout<<min(d[H][W-1],d[H-1][W])<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    int n;cin>>n;
    string ans="No";
    for(int i=0;i<=25;i++){
        for(int j=0;j<=14;j++){
            if(i*4+j*7==n)ans="Yes";
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3612
#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 L, R, d, ans = 0;
    cin >> L >> R >> d;
    for (int i = L; i <= R; i++) {
        if (i % d == 0) ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3628
import math  # noqa: F401
from collections import deque  # noqa: F401
from typing import Deque, Dict, List, Optional, Tuple, Union  # noqa: F401


def main(A: int, B: int, C: int, K: int):
    for _ in range(K):
        if A >= B:
            B *= 2
            continue
        if B >= C:
            C *= 2

    if C > B > A:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    A, B, C = map(int, input().split())
    K = int(input())
    main(A, B, C, K)


Measured memory_bytes: 10268
import numpy as np
n = int(input())
mod = 10**9+7
a = np.array(list(map(int,input().split())))
ans = 0
for i in range(60):
    #aをiビット右にずらす、iは60桁目まで、&1で対象のビットが1のもの以外を0にその数をカウントする。
    b = np.count_nonzero(a >>i&1)
    ans += ((2**i)*(n-b)*b)%mod
print(ans%mod)

Measured memory_bytes: 48804
import java.util.Scanner;

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

        while(sc.hasNext()) {
        	str += sc.nextLine();
        }
        str = str.toLowerCase();

        char[] alphabet = new char[] {'a','b','c','d','e','f','g','h','i','j','k',
        							  'l','m','n','o','p','q','r','s','t','u','v',
        							  'w','x','y','z'};

        int[] ans = new int[alphabet.length];

        for(int i = 0; i < str.length(); ++i) {
        	for(int j = 0; j < alphabet.length; j++) {
        		if(str.charAt(i) == alphabet[j]) {
        			ans[j]++;
        		}
        	}
        }

        for(int i = 0; i < alphabet.length; i++) {
        	System.out.println(String.format("%s : %d", alphabet[i], ans[i]));
        }

    }
}


Measured memory_bytes: 26300
use std::io::*;
use std::str::FromStr;

fn main(){
    let mut s: Vec<char> = read::<String>().chars().collect();
    if s[0] != 'A' {
        println!("{}", "WA");
        return
    }
    s[0] = 'a';
    let mut count: u32 = 0;
    for i in 2..(s.len()-1) {
        if s[i] == 'C' {
            count += 1;
            s[i] = 'c';
        }
    }
    if count != 1 {
        println!("{}", "WA");
        return
    }
    let mut ans = true;
    for c in s {
        if c < 'a' || 'z' < c {
            ans = false;
        }
    }
    println!("{}", if ans {"AC"} else {"WA"});
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

Measured memory_bytes: 4352
// By Debajit Chakraborty
#include<bits/stdc++.h>
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MP make_pair
#define pb push_back
#define ff first
#define ss second
#define sz(x) x.size()
#define all(c) c.begin(),c.end()
#define int long long
#define fr(i,j,x) for(int i=j;i<x;i++)
#define rep(i,j,x) for(int i=j;i<=x;i++)
#define rev(i,j,x) for(int i=j;i>=x;i--)
#define mem(x,val) memset(x,val,sizeof(x))
#define endl '\n'
#define vi vector<int>
#define pii pair<int,int>
 
const int mod=1e9+7;
const int N=2e5+10;
const int INF=1e8;

// int n,c[N],q,l,r;
// set<int>t[4*N];

// void build(int i,int l,int r){
//     if(l==r){
//         t[i].insert(c[l]);
//         return;
//     }
//     int mid=(l+r)/2;
//     build(i*2,l,mid);
//     build(i*2+1,mid+1,r);
//     t[i].insert(t[2*i].begin(),t[2*i].end()); 
//     t[i].insert(t[2*i+1].begin(),t[2*i+1].end()); 
// }


// set<int> query(int index,int l,int r,int lq,int rq){
//     set<int> left, right, result; 
//     if(l>rq || lq>r){
//         return result;
//     }
//     if(lq<=l && r<=rq){
//         return t[index];
//     }
//     int mid=(l+r)/2;
//     left = query(2*index,l,mid,lq,rq); 
//     result.insert(left.begin(), left.end()); 
  
//     right = query(2*index+1,mid+1,r,lq,rq); 
//     result.insert(right.begin(), right.end());
//     return result;
// }


// void solve(){
//     cin>>n>>q;
//     rep(i,0,n-1){
//         cin>>c[i];
//     }
//     build(1,0,n-1);
//     set<int>now;
//     while(q--){
//         cin>>l>>r;
//         now=query(1,0,n-1,l-1,r-1);
//         cout<<now.size()<<endl;
//     }
// }

int n,k,lo,hi,mid,ans,a[N];

int chk(int x){
    int cnt=0;
    rep(i,1,n){
        cnt+=(a[i]-1)/x;
    }
    return (cnt<=k);
}

void solve(){
    cin>>n>>k;
    hi=0;
    rep(i,1,n){
        cin>>a[i];
        hi=max(hi,a[i]);
    }
    lo=1;
    ans=hi;
    while(lo<=hi){
        mid=(lo+hi)/2;
        if(chk(mid)){
            ans=mid;
            hi=mid-1;
        }
        else{
            lo=mid+1;
        }
    }
    cout<<ans<<endl;
}


int32_t main()
{
    SPEED;
    int T=1;
    //cin>>T;
    int t1=1;
    while(true)
    {  
        //cout<<"Case #"<<t1<<": ";
        //cout<<endl;
        solve();
        t1++;
        if(t1>T)
            break;
    }
}   


Measured memory_bytes: 5144
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

memo = [0, 0, 0, 1]

for i in range(4, N + 1):
    memo.append(memo[i - 1] + memo[i - 3])
    
print(memo[N] % (10**9 + 7))

Measured memory_bytes: 9200
#pragma GCC target ("avx2")
#pragma GCC optimize "trapv"
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define input(a,n) for(ll i1=0;i1<n;i1++)cin>>a[i1]
#define ll long long
#define pi 2 * acos(0.0)
#define usll unordered_set<ll>
#define sll set<ll>
#define vll vector<ll>
#define mll map<ll,ll>
#define pll pair<ll,ll>
#define umll unordered_map<ll,ll>
#define S second
#define sz size()
#define all(v) v.begin(),v.end()
#define Y cout<< "YES"<< "\n"
#define N cout<< "NO"<< "\n"
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define ld long double
#define mod 1000000007
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    ll n=s.sz;
    ll m=t.sz,c=0,ans=INT_MAX;
    for(ll i=0;i<n-m+1;i++)
    {
        c=0;
        for(ll j=0;j<m;j++)
        {
            if(s[i+j]!=t[j])
            {
                c++;
            }
        }
        ans=min(ans,c);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3660