akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//C++14 (GCC 5.4.1)
int main() {
    int N,M;
    cin >>N>>M;

    vector<int> P(M);
    vector<int> Y(M);
    rep(i,M) cin >> P[i]>>Y[i];
    
    //-----------------------------------
    vector<vector<int>> Pind(N,vector<int>());
    vector<int> PWhK(M);
    rep(i,M){
        Pind[P[i]-1].push_back(i);
    }
    rep(j,N){
        sort(Pind[j].begin(),Pind[j].end(),[&](int a,int b){
          return  Y[a]<Y[b];
        });
        int len=Pind[j].size();
        rep(k,len){
            PWhK[Pind[j][k]]=k+1;
        }
    }
    rep(i,M){
        printf("%06d%06d\n",P[i],PWhK[i]);
    }

    return (0);
}

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


int main(){
  int n,m,i;
  cin >> n >> m;
  vector<int> broken(n+1);
  for(i=0;i<m;++i){
    int a;
    cin >> a;
    broken[a]=1;
  }
  vector<int> dp(n+2);
  const int mod =1000000007;

  dp[n]=1;
  for(i=n-1;i>=0;--i){
    if(broken[i]){
      dp[i]=0;
      continue;
    }
    dp[i]=(dp[i+1]+dp[i+2])%mod;
    }
    cout << dp[0] << endl;
    return 0;
  }


Measured memory_bytes: 1024
while True:
  a, op, b = input().split()

  if op == "?": 
    break
  elif op == "+":
    print(int(a) + int(b))
  elif op == "-":
    print(int(a) - int(b))
  elif op == "*":
    print(int(a) * int(b))
  else:
    print(int(int(a) / int(b)))


Measured memory_bytes: 5600
def searchDivisors(n):
    lstDivisors = []
    t = int(n ** .5)
    for a in range(1, t + 1):
        if n % a == 0:
            lstDivisors.append(a)
            b = n // a
            if b != a:
                lstDivisors.append(b)
    lstDivisors.sort()

    return lstDivisors


N = int(input())
ans = 0
lstDivisors = searchDivisors(N)


for i in lstDivisors:
    if i == 1:
        continue
    i -= 1
    if N // i == N % i:
        ans += i


print(ans)

Measured memory_bytes: 3268
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int m1, d1, m2, d2;
   cin >> m1 >> d1 >> m2 >> d2;

   if(m1 != m2) cout << 1 << endl;
   else cout << 0 << endl;


   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    int N, count = 0;
    cin >> N;
    int L[N];
    rep(i, N) cin >> L[i];
        sort(L,L+N);
    for (int a = 0; a < N - 2; a++){
        for (int b = a + 1; b < N - 1; b++){
            for (int c = b + 1; c < N; c++){
                if(L[c]<L[a]+L[b])count++;
                else continue;
            }
        }
    }
    cout<<count<<"\n";
}

Measured memory_bytes: 256
def main():
    n = int(input())
    t = [int(input()) for _ in range(5)]
    print(solve(n, t))

def solve(n, t):
    m = min(t)
    t = ceil_div(n, m) + len(t) - 1
    return t

def ceil_div(x, y):
    return (x + y - 1) // y

main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

    int N, M;
    cin >> N >> M;

    vector <int> A(N);
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<int>());

    vector <pair <int, int> > CB(M);
    for (int i = 0; i < M; i++){
        cin >> CB[i].second >> CB[i].first;
    }
    sort(CB.begin(), CB.end(), greater<pair<int, int> >());
    
    vector <int> C(N);

    int count = 0;
    bool f = true;
    for (int i = 0; i < M; i++){
        int sum = count;
        for (int j = 0; j < CB[i].second; j++){
            C[j + sum] = CB[i].first;
            count ++;
            if (count >= N){
                f = false;
                break;
            }
        }
        if (f == false){
            break;
        }
    }
    
    
    long long ans = 0;
    int a = 0, c = 0;
    for (int i = 0; i < N; i++){
        if (A[a] >= C[c]){
            ans += A[a];
            a++;
        }else{
            ans += C[c];
            c++;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

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

        int m = sc.nextInt();
        int d = sc.nextInt();

        int cnt = 0;

        int d10 = 0;
        int d1 = 0;

        for (int i = 1; i < m+1 ; i++) {
            for (int j = 1; j < d+1; j++) {
                d10 = j/10;
                d1 = j - d10*10;

                if( d1 * d10 == i && d10 >= 2 && d1 >=2 ){
                    cnt++;
                }
            }
        }

        System.out.println(cnt);
        sc.close();
    }
}

Measured memory_bytes: 22996
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;


namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       
         public static long GCM(long x,long y)
        {
            if (x < y)  GCM(y, x);


            while (y > 0)
            {
                var z = y;
                y = x % y;
                x = z;
            }
            
            return x;
        }



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            var a = Reads();
            var c = new long[(long)Math.Pow(10,5)+1];
            for (int i = 0; i < n; i++)
            {
                c[a[i]]++;
            }

            long ans = 0;
            for (int i = 0; i <=(long)Math.Pow(10,5)-2; i++)
            {
                ans = Math.Max(ans, c[i] + c[i + 1] + c[i + 2]);
            }
            WriteLine(ans);
           







            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 22112
#! env python
# -*- coding: utf-8 -*-

import os
import sys
from itertools import accumulate


# ac_py.main
# Date: 2020/06/14
# Filename: main 
# Author: acto_mini

def main():
    N = int(input())
    S = input()
    ans = 1000000000

    W = list()
    E = list()
    for i in range(N):
        flag = S[i] == "W"
        W.append(int(flag))
        E.append(int(not flag))

    #
    W_l = accumulate([0] + W[:-1])
    E_r = accumulate([0] + list(reversed(E[1:N])))

    for w, e in zip(W_l, reversed(list(E_r))):
        ans = min(ans, w + e)

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 95324
//the name of Allah
#include<stdio.h>
int main(){
int a,b,c,d,i,j;
scanf("%d%d%d%d",&a,&b,&c,&d);
i=a+b;
j=c+d;
if(i>j) printf("Left\n");
else if(i==j)printf("Balanced\n");
else printf("Right\n");

return 0;
}


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

int main(){
	string p, s, ws;
	cin >> s >> p;
	ws = s + s;

	if(ws.find(p) != string::npos){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


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

int main()
{
    ll n,k,no;
    vector <ll> v;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>no;
        v.push_back(no);
    }
    sort(v.begin(),v.end());
    ll st=0;
    for(ll i=0;i<n-k;i++)
    {
        st+=v[i];
    }
    cout<<st<<endl;
}



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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define ALL(a) a.begin(), a.end()
#define FOR(x,to) for(x=0;x<(to);x++)

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

int neighbours[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};

void solve() {
	char t[50][50];
	int h,w;
	cin >> h >> w;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cin >> t[i][j];
		}
	}

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (t[i][j] == '#') {
				bool ok = false;
				for (auto neighbour : neighbours) {
					int x = i+neighbour[0];
					int y = j+neighbour[1];
					
					if (x>=0&&x<h&&y>=0&&y<w&&t[x][y]=='#') {
						ok = true;
						break;
					}
				}
				if (!ok) {
					cout << "No\n";
					return;
				}
			}
		}
	}

	cout << "Yes\n";
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

int main() {
    int N;
    cin >> N;
    double _N = 4 / (double)N;
    LL h, n, w;
    for (h = 1; h <= 3500; h++) {
        for (n = 1; n <= 3500; n++) {
            double _h = 1 / (double)h;
            double _n = 1 / (double)n;
            w = 1 / (_N - _h - _n);
            if (w > 0 && N * (h * n + n * w + h * w) == 4 * h * n * w) {
                goto ok;
            }
        }
    }
    ok:
    printf("%lld %lld %lld\n", h, n, w);
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
#include<iostream>
#define mod 1000000007;
#define SIZE_INT sizeof(int) * 8
#define ll long long int 
using namespace std;

int main()
{
	ll n;
	cin>>n;
	while(n>1000)
	{
		n-=1000;
	}
	cout<<(1000-n);
}


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

int a[100001];
int abs(int x){ return x > 0 ? x : -x;}
int main(int argc, const char * argv[]) {
   
    int n;
    scanf("%d",&n);
    
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    
    
    sort(a,a+n);
    
    if(n&1){
        int diff = 2100000000;
        int l = a[n-1]/2;
        int r = a[n-1]/2+1;
        for(int i=0;i<n-1;i++){
        
            if(abs(l-diff) > abs(a[i]-l)){
                diff =a[i];
            }
            if(abs(r-diff) > abs(a[i]-r)){
                diff =a[i];
            }
            
        }
        printf("%d %d\n",a[n-1],diff);
        
    }else{
        int diff = 2100000000;
        int val = a[n-1]/2;
        for(int i=0;i<n-1;i++){
            if(abs(val-diff) > abs(a[i]-val)){
                diff =a[i];
            }
        }
        printf("%d %d\n",a[n-1],diff);
        
    }
    
    
    return 0;
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int,input().split()))
A.sort()
if N==2:
    print(max(A))
    exit()

ans = A.pop()
n = N-2
while A:
    a = A.pop()
    for _ in range(2):
        n -= 1
        ans += a
        if n==0:
            print(ans)
            exit()

Measured memory_bytes: 31340
import java.util.*;
 
class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int[] a = new int[n];
    for (int i=0; i<n; i++) {
      a[i] = Integer.parseInt(sc.next());
    }
    sc.close();
    
    int count=0;
    for (int i=0; i<n; i+=2) {
      if (a[i]%2 == 1) count++;
    }
    System.out.println(count);
  }
}

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

int main(){
  string s;
  cin >> s;
  if(s == "SUN") cout << 7 << endl;
  if(s == "MON") cout << 6 << endl;
  if(s == "TUE") cout << 5 << endl;
  if(s == "WED") cout << 4 << endl;
  if(s == "THU") cout << 3 << endl;
  if(s == "FRI") cout << 2 << endl;
  if(s == "SAT") cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

x,y=map(int,input().split())
if abs(x-y)<=1:
    print("Brown")
else:
    print("Alice")

Measured memory_bytes: 77376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a,b,c,d,n;
	cin>>a>>b>>c>>d>>n;
	ll a1=a*8,b1=b*4,c1=c*2;
	ll mi2=min({a1,b1,c1,d});
	ll ans=n/2*mi2;
	n%=2;
	ll a2=a*4,b2=b*2;
	ll mi3=min({a2,b2,c});
	ans+=n*mi3;
	cout <<ans;
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    for(int i=1;i<s.size()/2;i++){
        if(s.substr(0,(s.size()-2*i)/2) == s.substr((s.size()-2*i)/2,(s.size()-2*i)/2)){
            cout << s.size()-2*i<<endl;
            return 0;
        }
    }
    return 0;
}

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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > Matrix;



int main() {
	lli l, r, x, y, z;

	cin >> l >> r;

	if (r / 2019 > l / 2019) {
		cout << 0;
		return 0;
	}

	l %= 2019;
	r %= 2019;

	z = 2019;
	for (x = l; x < r; x++) {
		for (y = l + 1; y <= r; y++) {
			z = min(z, x*y % 2019);
		}
	}
	cout << z;
	

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
  int n,k,r,s,p;
  string t;
  cin >> n >> k >> r >> s >> p >>t;
  int point=0;
  vector<bool> b(n);
  rep(i,k){
    if(t.at(i)=='r')
       point+=p;
    if(t.at(i)=='s')
       point+=r;
    if(t.at(i)=='p')
       point+=s;
    b.at(i)=1;
  }
  for(int i=k;i<n;i++){
    if(t.at(i)==t.at(i-k)){
      if(b.at(i-k)==0){
      if(t.at(i)=='r')
       point+=p;
    if(t.at(i)=='s')
       point+=r;
    if(t.at(i)=='p')
       point+=s;
    b.at(i)=1;
    }
    else
      b.at(i)=0;
  }
    else{
      
      if(t.at(i)=='r')
       point+=p;
    if(t.at(i)=='s')
       point+=r;
    if(t.at(i)=='p')
       point+=s;
    b.at(i)=1;
    }
  }
  cout << point << endl;
}
      
    

Measured memory_bytes: 512
S = input()
if S == 'SSS':print(0)
if S == 'SSR':print(1)
if S == 'SRS':print(1)
if S == 'RSS':print(1)
if S == 'SRR':print(2)
if S == 'RRS':print(2)
if S == 'RSR':print(1)
if S == 'RRR':print(3)

Measured memory_bytes: 9044
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};


ll solve()
{
    ll H;
    std::cin >> H;

    ll exp = log2(H);
    ll n2 = std::pow(2, exp);

    return n2 + n2 - 1ll;
}

int main()
{
    cout << solve() << endl;

    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time

def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    V, E = MI()
    edges = []

    for i in range(E):
        edges.append(tuple(MI()))

    in_cnt = defaultdict(int)
    outs = defaultdict(list)
    for a, b in edges:
        in_cnt[b] += 1
        outs[a].append(b)

    res = []
    queue = deque([i for i in range(V) if in_cnt[i] == 0])
    while len(queue) != 0:
        v = queue.popleft()
        res.append(v)
        for nxt_v in outs[v]:
            in_cnt[nxt_v] -= 1
            if in_cnt[nxt_v] == 0:
                queue.append(nxt_v)

    for i in range(V):
        print(res[i])

if __name__ == '__main__':
    main()



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

int main(){
  int a,b,f=1;
  cin>>a>>b;
  if(b<2*a || b&1) f=0;
  b-=2*a;
  b/=2;
  if(b>a) f=0;
  cout<<(f?"Yes":"No");
}

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

int main() {
  int N;
  cin>>N;
  int amari=N%10;
  if(amari==3){
    cout<<"bon"<<endl;
  }
  else if(amari==0||amari==1||amari==6||amari==8){
    cout<<"pon"<<endl;
  }
  else{
    cout<<"hon"<<endl;
  }
}

Measured memory_bytes: 3624
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

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

#define v vector
#define ALL(x) x.begin(),x.end()
#define rALL(x) x.rbegin(),x.rend()
#define endl '\n'
#define F first
#define S second
#define DEBUG

template<typename T> void DBG(const char* name, T&& H) {
	cerr << name << " = " << H << ')' << endl;
}

template<typename T, typename... Args> void DBG(const char* names, T&& H, Args&&... args) {
	const char* NEXT = strchr(names+1, ',');
	cerr.write(names, NEXT-names) << " = " << H << " |";
	DBG(NEXT+1, args...);
}

#ifdef DEBUG
	#define dbg(...) cerr << __FUNCTION__ << ' ' <<__LINE__ << " : (", DBG(#__VA_ARGS__, __VA_ARGS__)
#else
	#define dbg(...)
#endif

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

const long long mod = 998244353;
const long double PI = acos(-1.0);
const long long INF = 1e18;
const int maxN = 2e5+1;

int N, K;
vector<int> logs(maxN);

bool can(int len) {
	int req = 0;
	for(int i = 0; i < N; i ++) {
		int cuts = logs[i]/len;
		if((logs[i] % len) == 0) cuts --;
		req += cuts;
	}
	return (req <= K);
}

void Solve() {
	cin >> N >> K;
	int maxLen = 0;
	for(int i = 0; i < N; i ++) {
		cin >> logs[i];
		maxLen = max(logs[i], maxLen);
	}
	int low = 1, mid, high = maxLen, ans = maxLen;
	while(low <= high) {
		mid = (low + high) / 2;
		if(can(mid)) {
			ans = mid;
			high = mid-1;
		}
		else low = mid+1;
	}
	cout << ans << endl;
}

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

	int tt = 1;
	while(tt --) {
		Solve();
	}
	
	return 0;
}

Measured memory_bytes: 3904
#include<stdio.h>
#include<string.h>
 
int main(void){
  int i=0,N=0;
  int c0=0,c1=0,c2=0,c3=0;  
  
  scanf("%d",&N);
  char s[N][4];
  
  for(i=0;i<N;i++){
    scanf("%s",s[i]);
    if(strcmp(s[i],"AC")==0)
      c0++;
    if(strcmp(s[i],"WA")==0)
      c1++;
    if(strcmp(s[i],"TLE")==0)
      c2++;
    if(strcmp(s[i],"RE")==0)
      c3++;
  }
  printf("AC x %d\n",c0);
  printf("WA x %d\n",c1);
  printf("TLE x %d\n",c2);
  printf("RE x %d\n",c3);
  return 0;
}

Measured memory_bytes: 2084
package main
 
import (
  "fmt"
)
 
func main() {
  var a1, a2, a3 int
  fmt.Scanf("%d %d %d", &a1, &a2, &a3)
 
  ans := 0
  max := a1
  min := a1
  if a2 >= a1 && a2 >= a3 {
    max = a2
  }
  if a3 >= a1 && a3 >= a2 {
    max = a3
  }
  if a2 <= a1 && a2 <= a3 {
    min = a2
  }
  if a3 <= a1 && a3 <= a2 {
    min = a3
  }
  
  ans = max - min
  fmt.Printf("%d\n", ans)
}

Measured memory_bytes: 1832
import collections
MOD = 998244353
def main():
    N = int(input())
    D = [int(_) for _ in input().split()]
    Dmax = max(D)
    cc = collections.Counter(D)
    if D[0] != 0: return 0
    if cc[0] != 1: return 0
    for i in range(Dmax+1):
        if cc[i] == 0: return 0
    output = 1
    for i in sorted(cc.keys()):
        if i in (0, 1): continue
        output *= pow(cc[i-1], cc[i], MOD)
        output %= MOD
    return output

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 19936
#include<stdio.h>
int minut(int a,int b)
{
	return b-a;
}
int main(void)
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(minut(a,b)==minut(b,c))
		printf("YES\n");
	else
		printf("NO\n");
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>void add(T &a, const T &b){a += b; a %= mod;}

signed main(){
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  bool zero = false;
  rep(i,n) if(a[i] == 0) zero = true;
  bool odd = false;
  rep(i,n) if(a[i] < 0) odd = not odd;
  int ans = 0; rep(i,n) ans += abs(a[i]);
  dump(ans);
  int minv = inf;
  if((not zero) and odd){
    rep(i,n) minv = min(minv, abs(a[i]));
    ans -= 2*minv;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

template <class T>
vector<T> divisor(T n) {
  vector<T> ret;
  for (T i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

void solve() {
  int N, C;
  cin >> N >> C;
  auto D = vect(C, vect(C, 0));
  cin >> D;
  auto c = vect(N, vect(N, 0));
  cin >> c;
  auto cnt = vect(3, vect(C, 0));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) { cnt[(i + j) % 3][c[i][j] - 1]++; }
  }
  int ans = INF;
  for (int a = 0; a < C; a++) {
    for (int b = 0; b < C; b++) {
      if (a == b) continue;
      for (int c = 0; c < C; c++) {
        if (a == c || b == c) continue;
        int diff = 0;
        for (int d = 0; d < C; d++) {
          diff += cnt[0][d] * D[d][a];
          diff += cnt[1][d] * D[d][b];
          diff += cnt[2][d] * D[d][c];
        }
        chmin(ans, diff);
      }
    }
  }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  //   int t;
  //   cin >> t;
  //   while (t--) solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC111
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] vs = ReadInts();
            int[][] evenCnts = new int[100005][];
            int[][] oddCnts = new int[100005][];
            for (int i = 0; i < 100005; i++)
            {
                evenCnts[i] = new int[2] { 0, i };
                oddCnts[i] = new int[2] { 0, i };
            }
            for (int i = 0; i < n; i += 2)
            {
                evenCnts[vs[i]][0]++;
            }
            for (int i = 1; i < n; i += 2)
            {
                oddCnts[vs[i]][0]++;
            }
            Array.Sort(evenCnts, (a, b) => b[0] - a[0]);
            Array.Sort(oddCnts, (a, b) => b[0] - a[0]);
            if (evenCnts[0][1] == oddCnts[0][1])
            {
                WriteLine(Min(n - evenCnts[0][0] - oddCnts[1][0],
                    n - evenCnts[1][0] - oddCnts[0][0]));
            }
            else
            {
                WriteLine(n - evenCnts[0][0] - oddCnts[0][0]);
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 32984
using System;

namespace ABC_20190810_A0137_p_x_Cs
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            int a = int.Parse(line[0]);
            int b = int.Parse(line[1]);

            int ans = a+b;
            if(ans<a-b) ans = a-b;
            if(ans<a*b) ans = a*b;

            Console.WriteLine(ans); 

        }
    }
}


Measured memory_bytes: 13140
n,k = map(int, input().split())
l = list(map(int,input().split()))
dp = [0]*n
dp[1] = abs(l[1] - l[0])

for i in range(2,n):
    c = float("inf")
    #1個前から飛んでく、2個前から、、、k個前から飛んでくる最小のコストを求める
    for j in range(min(k,i)):
        c = min(dp[i-(j+1)]+abs(l[i]-l[i-(j+1)]),c)
    dp[i] = c
print(dp[n-1])

Measured memory_bytes: 52460
#include <cstdio>
#include <string.h>

int main(void) {
    int h,w;
    scanf("%d%d",&h,&w);

    int cnt[30] = {0};
    for(int i=0; i<h; i++) {
        char s[200];
        scanf("%s", s);
        for(int j=0; j<w; j++)
            cnt[s[j]-'a']++;
    }
    int mod[4] = {0};
    for(int i=0; i<='z'-'a'; i++)
        mod[cnt[i]%4]++;

    if( (h%2==0) && (w%2==0) ) {
        if(mod[1]==0 && mod[2]==0 && mod[3]==0)
            puts("Yes");
        else
            puts("No");
        return 0;
    }
    if( (h%2==0) || (w%2==0) ) {
        if(mod[1]==0 && mod[3]==0 && ( (h%2==1)&&(mod[2]*2<=w) || (w%2==1)&&(mod[2]*2<=h) ))
            puts("Yes");
        else
            puts("No");
        return 0;
    }

    if(mod[1] + mod[3] == 1 && (mod[2] + mod[3])*2 <= w + h - 1)
        puts("Yes");
    else
        puts("No");
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	char number[1001];
	int num, i;

	for (;;){
		num = 0;
		scanf("%s", number);
		for (i = 0; i < 1001; i++){
			if (number[i] == '\0'){
				break;
			}else{
				num += number[i] - '0';
			}
		}
		if (num != 0){
			printf("%d\n", num);
		}else{
			break;
		}
	}

	return 0;
}

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

int main(){
    string s,t;
    long ans=0;
    cin >> s >> t;

    for(long l = 0;l<s.length();l++){
        if(s[l] != t[l]) ans++;
    }

    cout << ans << "\n";

    return 0;
}

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

const int N = (int) 2e6 + 10 ;
const int inf = (int) 2e9 ;

vector< pair< pair< int , int > , pair< int , int > > > answer ;
pair< int , int > arr[N] ;
int coin[700][700] ;

int main(){
//    freopen("in.txt" , "r" , stdin ) ;
    int r , c ; scanf("%d %d" , &r , &c ) ;
    for( int i = 1 ; i <= r ; i++ ) {
        for( int j = 1 ; j <= c ; j++ ) {
            scanf("%d" , &coin[i][j] ) ;
        }
    }
    int tot = 0 ;
    for( int col = 1 ; col <= c ; col++ ) {
        if( col % 2 == 1 ) {
            for( int row = 1 ; row <= r ; row++ ) {
                arr[++tot] = {row , col} ;
            }
        }
        else {
            for( int row = r ; row >= 1 ; row-- ) {
                arr[++tot] = {row , col} ;
            }
        }
    }
    for( int i = 1 ; i < tot ; i++ ) {
        int row = arr[i].first , col = arr[i].second ;
        if( coin[row][col] % 2 == 1 ) {
            answer.push_back( { arr[i] , arr[i + 1] } ) ;
            row = arr[i + 1].first , col = arr[i + 1].second ;
            coin[row][col] += 1 ;
        }
    }
    int len = answer.size() ;
    printf("%d\n" , len ) ;
    for( int i = 0 ; i < len ; i++ ) {
        auto pp = answer[i] ;
        pair< int , int > p , q ;
        p = pp.first , q = pp.second ;
        printf("%d %d %d %d\n" , p.first , p.second , q.first , q.second ) ;
    }
    return 0 ;
}


Measured memory_bytes: 7664
#include<stdio.h>
int main()
{
int x,y,z,d,temp,m;
scanf("%d %d %d %d",&x,&y,&z,&d);
if(x<z) m=z-x;
else m=x-z;
if(m<=d){ printf("Yes\n"); return 0; }
if(x>y){ temp=x; x=y; y=temp; }
	if(y>z){ temp=y; y=z; z=temp; }
	if(x>y){ temp=x; x=y; y=temp; }
  if(z-y<=d && y-x<=d) printf("Yes\n");
	else printf("No\n");
	}

Measured memory_bytes: 1616
#include<cstdio>
#include<algorithm>
int main(){
	int n;
	scanf("%d",&n);
	int a[n]={};
	int b[n]={};
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		b[a[i]-1]=i;
	}
	int x=0;
	int y=0;
	for(int i=0;i<n-1;i++){
		if(b[i+1]>b[i]){
			y++;
		}else{
			x=std::max(x,y);
			y=0;
		}
	}
	x=std::max(x,y);
	printf("%d\n",n-1-x);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
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;}

const int INF = 100000; 

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    cout << min({a+b, a+c, b+c}) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
ll dp[2][4];
int now = 0;
int t[3];
ll p2[32];
void CatandaVoyage() {
	int n,m;
	cin >> n >> m;
	vector<int> r[200010];
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		r[a].push_back(b);
	}

	for (size_t i = 0; i < r[1].size(); i++)
	{
		for (size_t j = 0; j < r[r[1][i]].size(); j++)
		{
			if (r[r[1][i]][j] == n) {
				cout << "POSSIBLE" << endl;
				return;
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;
}
int main() {
	CatandaVoyage();
	return 0;
}



Measured memory_bytes: 8576
S = input()
N = int(input())
for i in range(N):
    operate = input().split()
    if operate[0] == "replace":
        n = int(operate[1])
        m = int(operate[2])+1
        left_str = S[:n]
        right_str = S[m:]
        center_str = operate[3]
        S = left_str + center_str + right_str
    elif operate[0] == "reverse":
        n = int(operate[1])
        m = int(operate[2])+1
        left_str = S[:n]
        center_str = S[n:m]
        right_str = S[m:]
        center_str = center_str[::-1]
        S = left_str + center_str + right_str
    elif operate[0] == "print":
        n = int(operate[1])
        m = int(operate[2])+1
        left_str = S[:n]
        center_str = S[n:m]
        right_str = S[m:]
        print(center_str)


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

using namespace std;

int main()
{
    int m,n,ans=0,a,b;
    cin >> m >> n;
    cin >> a;
    for(int i=1;i<m;i++)
    {
        cin >> b;
        if(a+n>b)
        {
            ans+=b-a;
        }
        else
        {
            ans+=n;
        }
        a=b;
    }
    ans+=n;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
ID: jerrywcy
LINK:
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

typedef long long ll;

const int inf=0x3f3f3f3f;

ll n;
ll ans;

ll read(){
    ll f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

int main()
{
    n=read();
    ans=n*(n-1)/2;
    printf("%lld\n",ans);

	return 0;
}


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

 int main(){
  string A, B, C;
  string Aend, Bstart, Bend, Cstart;
  int An, Bn;

  cin >> A >> B >> C;
 
  An = A.size() -1;
  Bn = B.size() -1;

  Aend = A.substr(An);
  Bstart = B.substr(0,1);

  Bend = B.substr(Bn);
  Cstart = C.substr(0,1);

  if(Aend == Bstart && Bend == Cstart) cout << "YES" << endl;
   else cout << "NO" << endl; 

 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define pi 3.1415926535897932384626433832795028841971693993
#define MOD 998244353
#define sec setprecision
using namespace std;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	if (n == 0)
		return 1;
	else if (x == 1)return(1);
	else if (n % 2 == 0)
		return pow(x * x, (n / 2));
	else
		return x * pow(x, n - 1);
}
int ketasuu(ll h) {
	if (h < 0)return(-(ketasuu(-h)));
	else if (h < 10)return(1);
	else return(1 + ketasuu(h / 10));
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long com(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	string t;
	cin >> t;
	int k = t.size();
	int kotae = 0;
	rip(i, k) {
		if (t[i] == '?')t[i] = 'D';
	}
	cout << t << endl;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int n;
struct node
{
	int pos;
	int num;
}a[100005];
bool cmp(node x, node y)
{
	return x.num < y.num;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i].num;
		a[i].pos = i;
	}
	sort (a + 1, a + n + 1, cmp);
	for (int i = 1; i <= n; i++)cout << a[i].pos << " ";
	return 0;
} 

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


#define endl '\n'
#define all(v) v.begin(), v.end()
#define intvect vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)
#define boolv vector<bool>
#define ld long double
#define deb(x) cout << #x << " " << x << endl;
#define pb push_back
#define pob pop_back
#define F first
#define S second
#define ub upper_bound
#define bs binary_search
#define lb lower_bound
#define ull unsigned long long

        typedef unsigned long long int ll ;
        using namespace std;




int main(){
    ll n, i, flag = 0;
   cin >> n;
int x[n], y[n];
  fo(i, n) cin >> x[i] >> y[i];
  for(i=0; i<n-2; i++){
    if((x[i] == y[i] && x[i+1] == y[i+1]) && (x[i+2]==y[i+2])) flag = 1;
  }
if(flag) cout << "Yes";
else cout << "No";
}


Measured memory_bytes: 3572
#include <cstdio>

int N, x;

void receiveInput(){
  scanf("%d %d", &N, &x);
  return ;
}

int main(){
  receiveInput();
  int w = 2 * N - 1;
  if(x == 1 || x == w){
    printf("No\n");
  }else{
    printf("Yes\n");
    int a = 2;
    for(int i = 0; i < N - 2; i++){
      if(a == x) a++;
      printf("%d\n", a++);
    }
    printf("%d\n", 1);
    printf("%d\n", x);
    printf("%d\n", w);
    for(int i = N + 1; i < w; i++){
      if(a == x) a++;
      printf("%d\n", a++);
    }
  }  
  return 0;
}


Measured memory_bytes: 1408
import sys
if sys.platform =='ios':
	sys.stdin=open('input.txt')
	
x,y = map(int,input().split())

if x==1 and y==1:
	print(1000000)
	exit()
	
ans = 0

if x==1:
	ans = ans + 300000
elif x==2:
	ans = ans + 200000
elif x==3:
	ans = ans + 100000

if y==1:
	ans = ans + 300000
elif y==2:
	ans = ans + 200000
elif y==3:
	ans = ans + 100000

print(ans)


Measured memory_bytes: 38256
#include <stdio.h>
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

void visit(int);
void dfs();
int n,a[MAX+1][MAX+1],color[MAX+1],d[MAX+1],f[MAX+1],t=0;

int main(){
  int i,j,u,k,v;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }

  for(i=1;i<=n;i++){
    scanf("%d%d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      a[u][v]=1;
    }
  }

  dfs();

  for(i=1;i<=n;i++){
    printf("%d %d %d\n",i,d[i],f[i]);
  }
  return 0;
}

void visit(int u){
  int v;

  color[u]=GRAY;
  d[u]=++t;
  
  for(v=1;v<=n;v++){
    if(a[u][v]==0) continue;
    if(color[v]==WHITE) visit(v);
  }
  color[u]=BLACK;
  f[u]=++t;
}

void dfs(){
  int u;
  for(u=1;u<=n;u++){
    color[u]=WHITE;
  }
  t=0;

  for(u=1;u<=n;u++){
    if(color[u]==WHITE) visit(u);
  }
}


Measured memory_bytes: 2112
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
int main(void)
{
    string s, t;
    int N;
    cin >> s >> t;
    bool f = false;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != t[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3628
X = int(input())

fact = [True] * (10 ** 5 + 1000)
fact[0],fact[1] = False,False
for i in range(2,len(fact)):
  if fact[i]:
    for j in range(i * 2, len(fact), i):
      fact[j] = False
      
for i in range(X,len(fact)):
  if fact[i]:
    print(i)
    break

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	int n;
	cin >> n;
	for(int i = 3; i <= n; i++){
		int ok = 0;
		if(i % 3 == 0){
			ok = 1;
		}
		else{
			int x = i;
			while(x > 0){
				if(x % 10 == 3){
					ok = 1;
				}
				x /= 10;
			}
		}

		if(ok){
			cout << " " << i;
		}
	}
	cout << endl;
	return 0;
} 


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The Value Of " << #val << " is : " << val << '\n';
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int h, w, k, ans=0;
char arr[10][10];

int main(){
	IOS
	cin >> h >> w >> k;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> arr[i][j];
		}
	}
	for(int r=0;r<(1<<h);r++){
		for(int c=0;c<(1<<w);c++){
			int black=0;
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					if((arr[i][j]=='#') && (((r>>i)&1)==0) && (((c>>j)&1)==0)){
						black++;
					}
				}
			}
			if(black==k){
				ans++;
			}
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 3620
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    ss <- getLine
    let f (n, oc) nc
            | oc == nc  = (n, oc)
            | otherwise = (n + 1, nc)
    let ans = foldl' f (0, head ss) ss
    print (fst ans)

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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;

  int ans = 0;
  for (int i = 0; i < N - 2; i++) {
    if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C') {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np

n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(t) if x == n]
print(len(maxIndex))

Measured memory_bytes: 21780
s,_,*q=open(0)
a=['',s[:-1]]
p=1
for q in q:
  if q>'2':
    f=1if q<'2 2'else 0
    a[f^p]+=q[-2]
  else:p^=1
print(a[p^1][::-1]+a[p])

Measured memory_bytes: 18164
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>
const long long INF=1e18;

using namespace std;

int main(void) {
    string S;
    cin>>S;

    cout<<S[0]<<S[1]<<S[2]<<endl;
}


Measured memory_bytes: 3596
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.input()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

use std::collections::BTreeMap;
fn prime_factor(n: usize) -> BTreeMap<usize, usize> {
    let mut ret = BTreeMap::new();
    let mut n = n;
    let mut i: usize = 2;
    while i * i <= n {
        while n % i == 0 {
            *ret.entry(i).or_insert(0) += 1;
            n /= i;
        }
        i += 1;
    }

    if n != 1 {
        *ret.entry(n).or_insert(0) += 1;
    }
    ret
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: usize = sc.input();
    let factors = prime_factor(n);

    let mut ans: usize = 0;
    for (p, cnt) in factors {
        let mut cnt = cnt;
        let mut tmp = 0;
        let mut cur = 1;
        while cnt >= cur {
            cnt -= cur;
            cur += 1;
            tmp += 1;
        }
        ans += tmp;
    }

    println!("{}", ans);
}


Measured memory_bytes: 2164