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

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out,false);
        //essentially just interval scheduling
        int n = scanner.nextInt();
        int[][] ranges = new int[n][2];
        for(int i = 0; i < n; i++) {
            int l = scanner.nextInt();
            int d = scanner.nextInt();
            ranges[i][0] = l - d;
            ranges[i][1] = l + d;
        }
        Arrays.sort(ranges, new Comparator<int[]>() {
            public int compare(int[] o1, int[] o2) {
                return o1[1] - o2[1];
            }
        });
        int ans = 0;
        int prev = Integer.MIN_VALUE;
        for(int i = 0; i < n; i++) {
            if (ranges[i][0] >= prev) {
                ans++;
                prev = ranges[i][1];
            }
        }
        out.println(ans);
        out.flush();
    }
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 44604
M, D = map(int, input().split())

def is_seki(m, dd):
    d1 = dd % 10
    d10 = dd // 10
    return all([d1 >= 2, d10 >= 2, d1 * d10 == m])

res = 0
for m in range(1, M+1):
    for dd in range(1, D+1):
        if is_seki(m, dd):
            res += 1

print(res)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int x, y;

signed main() {
	cin >> x >> y;
	for (int i = 0; i <= x; i++)if (2 * i + 4 * (x - i) == y) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
)

var graph = make([][]bool, 8)

func dfs(v, N int, visited []bool) int {
	allVisited := true

	for i := 0; i < N; i++ {
		if visited[i] == false {
			allVisited = false
		}
	}

	if allVisited {
		return 1
	}

	var num int

	for i := 0; i < N; i++ {
		if graph[v][i] == false {
			continue
		}
		if visited[i] {
			continue
		}

		visited[i] = true
		num += dfs(i, N, visited)
		visited[i] = false
	}

	return num
}

func main() {
	var (
		N, M, A, B int
	)
	fmt.Scan(&N, &M)
	for i := 0; i < 8; i++ {
		graph[i] = make([]bool, 8)
	}
	for i := 0; i < M; i++ {
		fmt.Scan(&A, &B)
		graph[A-1][B-1], graph[B-1][A-1] = true, true
	}
	visited := make([]bool, 8)
	visited[0] = true

	fmt.Println(dfs(0, N, visited))
}


Measured memory_bytes: 1844
using System;
using System.Linq;

class Program {
    static void Main() {
        for (string line; (line = Console.ReadLine()) != "0";) {
            var n = int.Parse(line);
            var times = new int[n];

            for (var i = 0; i < n; i++) {
                times[i] = int.Parse(Console.ReadLine());
            }

            Array.Sort(times);

            var timeSum = Enumerable.Range(1, n - 1).Select(i => times.Take(i).Sum()).Aggregate(0L, (a, b) => a + b);
            Console.WriteLine(timeSum);
        }
    }
}

Measured memory_bytes: 9996
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;
char a,b;

int main(){
  cin >> a >> b;
  if(a>b) cout << ">" << endl;
  else if(a<b) cout << "<" << endl;
  else cout << "=" << endl;
  
  
  return 0;
}


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

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define REPISE (s,e) for(int i=s,i<e;i++)
#define REPJSE (s,e) for(int j=s,j<e;j++)

typedef long long ll;

using namespace std;

int main ()
{
  int A,B,C,Ad,Bd,Cd,res=0;

  scanf("%d %d %d",&A,&B,&C);

  while (A%2 == 0 && B%2 == 0 && C%2 == 0)
  {
    if (A == B && B == C)
    {
      res = -1;
      break;
    }
    Ad = A/2;
    Bd = B/2;
    Cd = C/2;
    A = Bd + Cd;
    B = Ad + Cd;
    C = Ad + Bd;
    res++;
  }

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


  return 0;
}

Measured memory_bytes: 3808
#include <stdio.h>

int main(){
  int i,j,v,N,l=0;
  int A[1000];
  scanf("%d",&N);
  for(i=0;i < N;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i < N-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);
  
  for(i=1;i <= N-1;i++){
    v=A[i];
    j=i-1;
    while(j >=0 && A[j] > v){
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
    }
    for(l=0;l < N-1;l++){
      printf("%d ",A[l]);
    }
    printf("%d\n",A[l]);
  }
  return 0;
}



Measured memory_bytes: 2140
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
/*２つの n 次元ベクトルが与えられるので、p がそれぞれ 1、2、3、∞ のミンコフスキー距離を求めるプログラムを作成してください。*/
using namespace std;
int main(){
	int n;
	double Dxy = 0;
	double Dxy2 = 0;
	double Dxy3 = 0;
	double DxyInf = 0;
	cin >> n;
	vector<double> x, y;
	for(int i = 0; i < n; i++){
		double tmpX;
		cin >> tmpX;
		x.push_back(tmpX);
	}
	for(int i = 0; i < n; i++){
		double tmpY;
		cin >> tmpY;
		y.push_back(tmpY);
	}
	for(int i = 0; i < n; i++){
		Dxy += (double)abs(x[i] - y[i]);	
		Dxy2 += pow(abs(x[i] - y[i]), 2);
		Dxy3 += pow(abs(x[i] - y[i]), 3);
		if(DxyInf < abs(x[i] - y[i])) DxyInf = abs(x[i] - y[i]);
	}
	cout << setprecision(20);	
	cout << Dxy << '\n';
	cout << pow(Dxy2, 1.0000 / 2.0000) << '\n';
	cout << pow(Dxy3, 1.0000 / 3.0000) << '\n';
	cout << DxyInf << '\n';
}



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

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

    int d, r;
    double f;

    d=a/b;
    r=a%b;
    f=1.0*a/b;

    cout << d << " " << r << " ";
    cout << fixed << setprecision(6) << f << endl;
    return 0;
}


Measured memory_bytes: 3284
ref = [[[10,8],[4,4]],[[10,2],[4,2]]]
r =10000001
p = [1]*r
p[0]= p[1] = 0
for i in range(int(r**0.5)):
	if p[i]:
		p[2*i::i] = [0]*len(p[2*i::i])
		
while 1:
	try:
		n = input()
		if n == 0: break
		n -= 1-n%2
		while any(not p[n-i] for i in [0,2,6,8]):
			n -= ref[p[n-2]][p[n-6]][p[n-8]]
		print n
	except:
		pass

Measured memory_bytes: 160492
#include <iostream>
using namespace std;
int main() {
	int n, num[200000],count=0,yeah=1;
	cin >> n;
	for (int j = 0; j < n; j++) {
		cin >> num[j];
	}
	for (int i = 0; i < n; i++) {
		if (num[i] == yeah) {
			yeah++;
		}
		else {
			count++;
		}
	}
	if (count == n) {
		count = -1;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	h, _ := strconv.Atoi(stringLineScan())
	w, _ := strconv.Atoi(stringLineScan())
	n, _ := strconv.Atoi(stringLineScan())
	c := 0
	ans := make([][]int, h)
	for i := 0; i < h; i++ {
		t := make([]int, w)
		ans[i] = t
	}
	for i := 1; i <= n; i++ {
		t, _ := strconv.Atoi(stringLineScan())
		for j := 0; j < t; j++ {
			ans[c/w][c%w] = i
			c++
		}
	}
	for i := 0; i < h; i++ {
		if i%2 == 0 {
			fmt.Println(strings.Trim(fmt.Sprint(ans[i]), "[]"))
		} else {
			t := make([]int, w)
			for j := 0; j < w; j++ {
				t[w-j-1] = ans[i][j]
			}
			fmt.Println(strings.Trim(fmt.Sprint(t), "[]"))
		}
	}
}


Measured memory_bytes: 1024
counts = []
for i in range(0,26):
    counts.append(0)

try:
    s = input()
    while(len(s)>0):
        for _ in s[:]:
            #print(_)
            if('a' <= _ and _ <= 'z'):
                counts[ord(_)-ord('a')]+=1
            elif('A' <= _ and _ <= 'Z'):
                counts[ord(_)-ord('A')]+=1
        s = input()
except EOFError:
    pass

for c in range(ord('a'), ord('z')+1):
    print('{} : {}'.format(chr(c), counts[c - ord('a')]))




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

int main(){
    int h, n;
    cin >> h >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int sum = accumulate(a.begin(), a.end(), 0);

    if(sum >= h){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
struct pai
{
    char huase[1];
    int shuzi;
} x[100005],v[100005];
bool f(pai a,pai b)
{
    return a.shuzi<b.shuzi;
}
pai L[100000/2+2],R[100000/2+2];
int fg(pai a[],int p,int r)
{
    pai x=a[r];
    int j=p,i=p-1;
    for(j;j<r;j++)
    {
        if(a[j].shuzi<=x.shuzi)
        {
            i++;
          swap(a[i],a[j]);
      /*int t=a[i];
      a[i]=a[j];
      a[j]=t;*/
        }
    }
    swap(a[i+1],a[r]);
    return i+1;
    /*int t=a[i+1];
    a[i+1]=a[j];
    a[j]=t;*/
}
void guibing(pai a[],pai b[],pai c[],int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++)
    {
        b[i]=a[left+i];
    }
    for(int i=0;i<n2;i++)
    {
        c[i]=a[mid+i];
    }
    b[n1].shuzi=c[n2].shuzi=1000000002;
    int i=0,j=0;
    for(int k=left;k<right;k++)
    {
        if(b[j].shuzi<=c[i].shuzi)
        {
            a[k]=b[j++];
        }
        else a[k]=c[i++];
    }

}
void guigingpai(pai a[],int left,int right)
{
    if(left+1<right)
    {
        int mid=(left+right)/2;
        guigingpai(a,left,mid);
        guigingpai(a,mid,right);
        guibing(a,L,R,left,mid,right);
    }
}
void qs(pai a[],int left,int right)
{
    if(left<right)
    {
        int q=fg(a,left,right);
        qs(a,left,q-1);
        qs(a,q+1,right);
    }
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        //cin>>x[i].huase;
        scanf("%s",&x[i].huase);
        scanf("%d",&x[i].shuzi);
        v[i].shuzi=x[i].shuzi;
        v[i].huase[0]=x[i].huase[0];
    }
    guigingpai(v,0,n);
    //stable_sort(v,v+n,f);
    qs(x,0,n-1);
   /* for(int i=0;i<n;i++)
    {
        printf("%s %d\n",v[i].huase,v[i].shuzi);
    }*/
    for(int i=0;i<n;i++)
    {
        if(x[i].huase[0]!=v[i].huase[0])
        {
             printf("Not stable\n");
             break;
        }

        if(i==n-1)
        {
            printf("Stable\n");
        }
    }
    for(int i=0;i<n;i++)
    {
        printf("%s %d\n",x[i].huase,x[i].shuzi);
    }
    return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define int long long int
using namespace std;
bool is_subsequence(string temp, string str) {
        int l1 = 3;
        int l2 = str.length();
        int j=0;

        for(int i=0;i<l2 && j<l1; i++) {
                if(temp[j] == str[i]) 
                        j++;
                if(j == l1)
                        return true;
        }
        return false;
}
void solve() {
        int n;
        cin >> n;
        string str;
        cin >> str;
        vector <string> s;
        
        for(char i='0';i<='9';i++) {
                for(char j='0';j<='9';j++) {
                        for(char k='0';k<='9';k++) {
                                string temp;
                                temp += i;
                                temp += j;
                                temp += k;
                                s.push_back(temp);
                        }
                }
        }
        int count = 0;
        set <string> s2;
        for(int i=0;i<1000;i++) {
                //cout << s[i] << endl;
                if(is_subsequence(s[i], str)) {
                        if(s2.find(s[i]) == s2.end()) {
                                //cout << s[i] << endl;
                                count++;
                        }
                }
        }
        cout << count << endl;
        return;

}
int32_t main() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        solve();
        return 0;
}



Measured memory_bytes: 384
n,h,w=map(int,input().split())
array1=[]
array2=[]
for i in range(n):
    a,b=map(int,input().split())
    array1.append(a)
    array2.append(b) 
cnt=0
for i in range(n):
    a=min(int(array1[i]/h),int(array2[i]/w))
    cnt=a+cnt
print(cnt)       

Measured memory_bytes: 3064
# N 回じゃんけんを行う,  K 回前のじゃんけんで出した手と同じ手を出すことはできない
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

# mod_N_list = [[] for i in range(K)]
# T_list = [[] for i in range(K)]
# T_list = []
# N_list = list(range(N))

ans = 0

for i in range(N):
    if T[i] == 'r':
        # 前回がrでは無かった時
        if i < K or T[i - K] != 'r':
            ans += P
        else:
            T = T[:i] + 'x' + T[i + 1:]

    elif T[i] == 's':
        # 前回がsでは無かった時
        if i < K or T[i - K] != 's':
            ans += R
        else:
            T = T[:i] + 'x' + T[i + 1:]

    elif T[i] == 'p':
        # 前回がpでは無かった時
        if i < K or T[i - K] != 'p':
            ans += S
        else:
            T = T[:i] + 'x' + T[i + 1:]

print(ans)

Measured memory_bytes: 3480
s1 = input()
s2 = input()
def delta(s1, s2):
    pv = list(range(len(s2)+1))
    for i, c1 in enumerate(s1):
        cv = [i+1]
        for j, c2 in enumerate(s2):
            cv.append(min(pv[j+1]+1, cv[j]+1, pv[j]+(c1 != c2)))
        pv = cv
    return pv[-1]

print(delta(s1, s2))

Measured memory_bytes: 6732
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

const int Maxn = 100005;

int n;
vector <int> neigh[Maxn];
int root;
int dp[Maxn];

bool Solve(int v, int p = -1)
{
	int lins = 0, tot = 0;
	for (int i = 0; i < neigh[v].size(); i++) {
		int u = neigh[v][i];
		if (u == p) continue;
		tot++;
		lins += Solve(u, v);
		dp[v] += dp[u];
	}
	if (tot == 0 || tot == 1 && lins == 1) return true;
	if (lins > 0) dp[v] += lins - 1;
	return false;
}

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		int a, b; scanf("%d %d", &a, &b);
		neigh[a].push_back(b);
		neigh[b].push_back(a);
	}
	if (n == 2) { printf("1\n"); return 0; }
	root = 0;
	for (int i = 1; i < n; i++)
		if (neigh[i].size() > neigh[root].size()) root = i;
	Solve(root);
	printf("%d\n", dp[root]);
	return 0;
}

Measured memory_bytes: 13824
def checker(s):
  for i in range(1, len(s)):
    if s[i] == s[i-1]:
      print "%d %d" % (i, i+1)
      return
    if i > 1 and s[i] == s[i-2]:
      print "%d %d" % (i-1, i+1)
      return
  print "-1 -1"

s = raw_input()
checker(s)

Measured memory_bytes: 5892
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
long long ans;
int n,a[1000005];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]),a[i]-=i;
	sort(a+1,a+n+1);
	for (int i=1;i<=n;i++)
		ans+=abs(a[i]-a[(n+1)/2]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

constexpr bool OPEN = true;
constexpr bool CLOSE = false;

int main() {

  uint N;
  vector<bool> S;

  int too_many_closes = 0;
  int max_too_many_closes = 0;

  cin >> N;

  for (uint i = 0; i < N; ++i) {

    char c;
    cin >> c;

    if (c == '(') {
      --too_many_closes;
      S.push_back(OPEN);

    } else {
      ++too_many_closes;
      S.push_back(CLOSE);

      if (max_too_many_closes < too_many_closes)
        max_too_many_closes = too_many_closes;
    }
  }

  for (int i = 0; i < max_too_many_closes; ++i)
    cout << '(';

  for (bool b : S) {
    if (b == OPEN)
      cout << '(';
    else
      cout << ')';
  }

  for (int i = 0; i < max_too_many_closes - too_many_closes; ++i)
    cout << ")";

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>

using ll = long long;

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    set<string> l1, l2, l3;
    for (auto &c:s) {
        for (auto &t2:l2) l3.insert(t2 + c);
        for (auto &t1:l1) l2.insert(t1 + c);
        l1.insert(string(1, c));
    }
    cout << l3.size() << '\n';
    return 0;
}

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

int a[11];

int main() {
	for(int i=0;i<4;i++) scanf("%d", &a[i]);
	sort(a, a+4);
	if (a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9) puts("YES");
	else puts("NO");
	
	return 0;
}

Measured memory_bytes: 128
N,K,*A=`dd`.split.map(&:to_i)
s = [0]
A.each{ |a| s << (s[-1] + a)}
ps = (0...N).map{ |i| (i...N).map{ |j| s[j+1]-s[i] } }.flatten
ans = 0
(0..40).reverse_each{ |k|
  b = 1 << k
  ns = ps.select{ |x| x & b > 0 }
  next if ns.size < K
  ans += b
  ps = ns
}
p ans


Measured memory_bytes: 16896
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i) 
const long long INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
bool comp(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	/
	/
	/
	*/
	ll n, k, q;
	cin >> n >> k >> q;
	ll temp = 0;
	vector<ll>ans(n,k - q);
	rep0(i, q) {
		cin >> temp;
		ans[temp - 1]++;
	}
	rep0(j, n) {
		if (ans[j] > 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}



	return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
int N=1000;

int lcs(char X[],char Y[]){
    int c[N+1][N+1];
    int l=strlen(X);
    int m=strlen(Y);
    int maxl=0,i,o;
    for(i=1;i<=l;i++)  c[i][0]=0;
    for(o=1;o<=m;o++)  c[0][o]=0;
    for(i=1;i<=l;i++){
        for(o=1;o<=m;o++){
            if(X[i-1] == Y[o-1]) c[i][o]=c[i-1][o-1]+1;
	    
            else  c[i][o]=c[i-1][o]>c[i][o-1]?c[i-1][o]:c[i][o-1];
	    
            maxl=maxl>c[i][o]?maxl:c[i][o];
        }
    }
    return maxl;
}


int main(void){
    char line1[1001],line2[1001];
    int k,o;
    scanf("%d",&k);
    for(o=0;o<k;o++){
        scanf("%s %s",line1,line2);
        printf("%d\n",lcs(line1,line2));
    }
    return 0;
}



Measured memory_bytes: 5612
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<numeric>
#include<limits>
#include <cstdint>
#include<stack>
#include<queue>
using namespace std;
#define ll long long int
#define rep(N) for(ll i=0;i<N;i++)
#define rep2(N1,N2) for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)for(ll k=0;k<N3;k++)
#define For(i,N) for(ll i=0;i<N;i++)

void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for (ll i = 0; i < x; i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k" << endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

ll keta(ll a) {
	ll i = 1;
	while (1) {
		if (a < pow((ll)10, i))
			return i;
		i++;
	}
}
vector<ll> v;
ll n, m;
//m進数全探索
ll inc(ll a = n - 1) {
	if (a == 0 && v[0] == m) {
		v[0] = -1;
		return v[0];
	}
	if (v[a] == m) {
		v[a] = 0;
		inc(a - 1);
		return v[a];
	}
	else {
		++v[a];
		return v[a];
	}
}

ll mod = 1e9+7;

ll modkai(ll a) {
	ll ret = 1;
	rep(a) {
		ret *= (i + 1);
		ret %= mod;
	}
	return ret;
}

ll modpowl(ll a, ll b) {
	if (b == 0) {

		return 1;
	}
	if (b == 1) {

		return a;
	}
	if (b >= 2) {
		if (b % 2 == 0) {
			ll c = modpowl((a*a) % mod, b / 2);
			c = c % mod;

			return c;
		}
		else {
			ll c = (modpowl((a*a) % mod, b / 2) % mod)*a;
			c = c % mod;

			return c;
		}
	}
}
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 (int 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;
}

ll llpow(ll a, ll b) {
	if (b == 0) {

		return 1;
	}
	if (b == 1) {

		return a;
	}
	if (b >= 2) {
		if (b % 2 == 0) {
			ll c = llpow((a*a), b / 2);
			c = c;

			return c;
		}
		else {
			ll c = (llpow((a*a), b / 2))*a;
			c = c;

			return c;
		}
	}
}
std::vector<ll> Eratosthenes(ll N)
{
	std::vector<bool> is_prime(N + 1);
	for (ll i = 0; i <= N; i++)
	{
		is_prime[i] = true;
	}
	std::vector<ll> P;
	for (ll i = 2; i <= N; i++)
	{
		if (is_prime[i])
		{
			for (ll j = 2 * i; j <= N; j += i)
			{
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

int main() {
	cout.precision(20);
	string s, t;
	cin >> s >> t;
	cout << t+s;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int i;
int a[10000],n=0,g;
double w,h;
while(scanf("%d,%lf,%lf",&g,&w,&h)!=-1){
if(w/h/h>=25){
a[n]=g;
n++;
}
}
for(i=0;i<n;i++)
printf("%d\n",a[i]);
return 0;
}

Measured memory_bytes: 636
#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 vvi vector<vector<int>>
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep2(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i,0,n)
#define rep1(i, n) rep1(i,1,n+1)

// #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; }

const string YES = "Yes";
const string NO = "No";

void func(std::string S){
    if(S == "AAA" || S == "BBB") cout << NO << endl;
    else cout << YES << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);
    cout << std::setfill('0') << std::setw(2);

    std::string S;
    std::cin >> S;
    func(S);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin >> n;
  double value[n];
  double msum;
  double bunshi = 1;
  double bunbo;
  for(int i=0; i<n; i++){
    cin >> value[i];
  }
  
  for(int i=0; i<n; i++){
    bunshi = bunshi*value[i];
  }
  
  for(int i=0; i<n; i++){
    bunbo += bunshi/value[i];
  }
  
  msum = bunshi/bunbo;
  cout << msum << endl;
  
  
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  
  vector<ll> b;
  rep(i, n - 1)
  {
    if((int)b.size() == 2) break;
    
    if(a[i] == a[i + 1])
    {
      b.emplace_back(a[i]);
      i++;
    }
  }
  if((int)b.size() < 2) cout << 0 << endl;
  else cout << b[0] * b[1] << endl;
  
  return 0;
}

Measured memory_bytes: 640
import java.util.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if(b-a==c-b){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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() {
	ll n,k;
	cin>>n>>k;
	vector<ll>ch;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		ch.push_back(x);
	}
    COMinit();
    // 計算例
    //cout << COM(100000, 50000) << endl;	
	sort(ch.begin(),ch.end());
	ll cnt1=0;
	for(ll i=0;i<n-1;i++){
		ll now=ch[i];
		ll sum=COM(n-(i+1),k-1);
		sum*=now;
		sum%=inf;
		if(sum<0){
			sum+=inf;
		}
		cnt1+=sum;
		cnt1%=inf;
		if(cnt1<0){
			cnt1+=inf;
		}
	}
	ll cnt2=0;
	reverse(ch.begin(),ch.end());
	for(ll i=0;i<n-1;i++){
		ll now=ch[i];
		ll sum=COM(n-(i+1),k-1);
		sum*=now;
		sum%=inf;
		if(sum<0){
			sum+=inf;
		}
		cnt2+=sum;
		cnt2%=inf;
		if(cnt2<0){
			cnt2+=inf;
		}
	}
	if(cnt2-cnt1<0){
		cout << cnt2-cnt1+inf;
	}
	else{
		cout << cnt2-cnt1;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 16188
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less   
using namespace __gnu_pbds;  
using namespace std;  
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> set1;
ll find(ll a,ll p[])
{
   //cout<<"find "<<a<<endl;
   if(a==p[a])
   return a;
   else return p[a]=find(p[a],p);

}
void join(ll a,ll b,ll p[],ll sz[])
{
   a=find(a,p);
   b=find(b,p);
   if(a!=b)
   {
      if(sz[a]<sz[b])
      swap(a,b);
      sz[a]+=sz[b];
      p[b]=a;
   }
}
ll power(ll a,ll b,ll mod)
{
   ll res=1;
   while(b>0)
   {
      if(b&1)
      res=(res*a)%mod;
      b=b/2;
      a=(a*a)%mod;
   }
   return res;
}
ll inverse(ll x, ll p)
{
   return power(x,p-2,p);
}
ll hash1(ll x,ll y)
{
   return x+y+x*y;
}
//ll f[200000]={0};
ll mod=1000000007;
/*void ini()
{
   f[0]=1;
   for(ll i=1;i<=200000;i++)
   f[i]=(i*f[i-1])%mod;
}*/



/*ll ncr(ll n,ll r)
{
   ll res=1;
   ll k=f[n];
   ll v=inverse(f[n-r],mod);
   ll u=inverse(f[r],mod);
   ll x=(u*v)%mod;
   k=(k*x)%mod;
   return k;
}*/
/*struct edge
{
   ll from;
   ll to;
};*/
ll f1(ll mask,ll dp[],ll m[][22],ll n)
{
  //   cout<<"mask "<<mask<<endl;
    ll ones=__builtin_popcountll(mask);
    if(dp[mask]!=-1)
    return dp[mask];
    else if(ones==1)
    {
        ll ind;
        for(ll i=0;i<n;i++)
        {
            ll powerof2=1<<i;
          //  cout<<"power "<<powerof2<<" mask "<<mask<<endl;
            ll z=mask&powerof2;
        //    cout<<" and result "<<z<<endl;
            if(z)
            {
                ind=i;
                break;
            }
        }
     //   cout<<ind<<endl;
        
        if(m[0][ind]==1)
        dp[mask]=1;
        else
        dp[mask]=0;
        return dp[mask];
    }
    else
    {
        dp[mask]=0;
    for(ll i=0;i<n;i++)
    {
        
        ll powerof2=1<<i;
       // ll p=__builtin_popcount(mask);
       ll u=powerof2&mask;
        if(u && m[ones-1][i])
        {
            ll submask=mask^powerof2;
            dp[mask]+=f1(submask,dp,m,n);
            dp[mask]=(dp[mask]%mod);
        }
    }
    return dp[mask];
    }
}


int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll n;
   cin>>n;
   ll a[22][22];
   for(ll i=0;i<n;i++)
   {
      for(ll j=0;j<n;j++)
      cin>>a[i][j];
   }
  // cout<<"here "<<endl;
   ll z=(ll)pow(2,n);
  // cout<<z<<endl;
   ll dp[z]={0};
   for(ll i=0;i<z;i++)
   dp[i]=-1;
   cout<<f1(z-1,dp,a,n)<<endl;
  // ll m=1<<5;
   //cout<<m<<endl;
   return 0;
}

Measured memory_bytes: 16768
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int main(){
    int N;
    cin>>N;
    
    int ans = 0;
    int count = 0;
    for(int i=1 ; i<=N ; i+=2){
        for(int j=1 ; j<=N ; j++){
            if (i%j == 0) count +=1;
        }
        if (count == 8) ans += 1;
        count = 0;
    }
    
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

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

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if(i*a+(h-i)*(w-a) == j*b+(w-j)*(h-b)){
                auto v = make_v(h, w, 0);
                vector<int> ans(w);
                for (int k = 0; k < h; ++k) {
                    int cnt = (k < i ? a : w-a);
                    for (int l = 0; l < w; ++l) {
                        if(l < j){
                            if(ans[l] < b && cnt) {
                                cnt--;
                                ans[l]++;
                                v[k][l]++;
                            }
                        }else {
                            if(ans[l] < h-b && cnt) {
                                cnt--;
                                ans[l]++;
                                v[k][l]++;
                            }
                        }
                    }
                }
                for (int k = 0; k < h; ++k) {
                    for (int l = 0; l < w; ++l) {
                        cout << v[k][l];
                    }
                    puts("");
                }
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 5120
#include <stdio.h>

int main(void)
{   
    int x,n;
    scanf("%d %d",&x,&n);

    int p[n];
    int i,j;
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
    }

    int ans_sei=x,ans_fu=x;
    while(1){

        for (j = 0; j < n; j++)
        {
            if (ans_fu == p[j])
            {
                ans_fu--;
                break;
            }
        }
        if (j == n)
        {
            printf("%d\n", ans_fu);
            return 0;
        }

        for(i=0;i<n;i++){
            if(ans_sei==p[i]){
                ans_sei++;
                break;
            }
        }
        if(i==n){
            printf("%d\n",ans_sei);
            return 0;
        }

        
    }


    return 0;
}


Measured memory_bytes: 2152
#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;}


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

    cout << pow(r, 2) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>

typedef long long ll;

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int a[105];
	int maxn=-1000,minn=1000;
	for(int i=0;i<n;i++){
		cin>>a[i];
		maxn = max(a[i],maxn);
		minn = min(a[i],minn);	
	}
		 
	int sum=0;
	int ans=1000000;
	for(int i=minn;i<=maxn;i++){
		sum=0;
		for(int j=0;j<n;j++){
			sum+=(a[j]-i)*(a[j]-i);
		}
		
		if(ans>sum) 
			ans=sum;
	}
	cout<<ans<<endl;

	return 0;
}




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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define loop(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

int main(){
  int a,b;cin >> a >> b;
  int ans=0;
  rep(i,2)
    ans += (a>b)?a--:b--;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        // 主処理
        String replacedS = s.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "");
        boolean judge = replacedS.length() == 0;
        String result = judge ? "YES" : "NO";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 28524
// AtCoder Begginer Contest 139 C
// https://atcoder.jp/contests/abc136/tasks/abc139_b

#include<iostream>
#include<vector>
using namespace std;
using uint = unsigned int;

int main() {
	uint N;
	cin >> N;
	
	vector<uint> H(N);
	for(uint i=0; i<N; i++) {
		cin >> H[i];
	}
	
	uint max = 0;
	uint tmp = 0;
	for(uint i=0; i<N-1; i++) {
		if(H[i] >= H[i+1]) {
			tmp++;
			if (tmp > max) {
				max = tmp;
			}
		} else {
			tmp = 0;
		}
	}
	
	cout << max << endl;
	
	return 0;
}

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

const int maxn=1e5+10;

int n,m;
LL a1,a[maxn],t[maxn],suf[maxn];

int main()
{
#ifdef h10
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	int i;
	LL k,x;
	scanf("%lld%d",&a[1],&n);
	a1=a[1];
	m=1;
	for (i=1;i<=n;i++)
	{
		scanf("%lld",&x);
		while (m&&x<=a[m]) m--;
		a[++m]=x;
	}
	n=m;

	t[n]=1;
	for (i=n;i>1;i--)
	{
		k=a[i];
		while (k>=a[1])
		{
			int l=1,r=i-1,mid;
			while (l<=r)
			{
				mid=(l+r)>>1;
				if (a[mid]<=k)
					l=mid+1;
				else
					r=mid-1;
			}
			t[r]+=t[i]*(k/a[r]);
			k%=a[r];
		}
		suf[k]+=t[i];
	}
	suf[a[1]]+=t[1];

	for (i=a1;i>=1;i--)
		suf[i]+=suf[i+1];
	for (i=1;i<=a1;i++)
		printf("%lld\n",suf[i]);

}


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

typedef long long ll;

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)
#define sz(x)        ((ll)(x).size())
#define inf          1<<25

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

char field[51][51];

int main() {
    int H, W;
    cin >> H >> W;
    
    rep(i, H) rep(j, W) cin >> field[i][j];
    
    rep(i, H) rep(j, W) {
        if (field[i][j] == '#') continue;
        
        int c = 0;
        rep(k, 8) {
            int y = i + dy[k];
            int x = j + dx[k];
            if (y < 0 or H - 1 < y) continue;
            if (x < 0 or W - 1 < x) continue;
            
            if (field[y][x] == '#') c++;
        }
        field[i][j] = '0' + c;
    }
    
    rep(i, H) {
        rep(j, W) cout << field[i][j];
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  ans=1
  if n==1:
    return m
  for i in range(1,int(math.sqrt(m)+1)):
    if m%i==0:
      if i*n>m:
        continue
      ans=max(ans,i)
      x=m//i
      if x*n>m:
        continue
      ans=max(ans,x)

  return ans

# main()
print(main())


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

public class Main  {
    public static void main (String[] args) {
    		try {
    			int i;
    			BufferedReader d = new BufferedReader(new InputStreamReader(System.in));
    			i = Integer.parseInt(d.readLine());
    			System.out.println(i*i*i);
    		}catch(IOException e){

    		}
    }
}



Measured memory_bytes: 24188
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, q;
    cin >> n >> q;
    auto a = make_vec<int>(n, 0);
    while (q--) {
        int com, t;
        cin >> com >> t;
        if (com == 0) {
            int x;
            cin >> x;
            a[t].pb(x);
        } else if (com == 1) {
            rep(i, sz(a[t])) {
                cout << a[t][i];
                if (i != sz(a[t])-1) cout << " ";
            }
            cout << endl;
        } else {
            a[t].clear();
        }
    }
}



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

typedef long long ll;
using namespace std;

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

	int m,n;
	string name[] = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
	int digits[19];
	while(true){
		cin >> m >> n;
		if(n == 0) break;
		memset(digits,0,sizeof(digits));
		digits[0] = 1;

		for (int i = 0;i < n;i++){
			for (int j = 0;j < 18;j++){
				digits[j] *= m;
			}
			for (int j = 0;j < 18;j++){
				digits[j+1] += digits[j]/10000;
				digits[j] %= 10000;
			}	
		}

		for (int i = 17;i >= 0;i--){
			if(digits[i] != 0) cout << digits[i] << name[i];
		}

		cout << endl;
	}

	return 0;

}



Measured memory_bytes: 3208
#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 reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e10
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> bool chmax(T &a, T &b){ if(a<b) { a=b; return 1; }}
template<typename T> bool chmin(T &a, T &b){ if(b<a) { a=b; return 1; }}
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> T vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> T arrdebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


vector<ll> v[100001];

int keta(ll num){
    int k = 0;
    while(num > 0){
        num /= 10;
        k++;
    }
    return k;
}

string addzero(ll num){
    string key = "";
    rep(i, 12-keta(num)){
        key += "0";
    }
    key += to_string(num);
    return key;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n, m;
    ll p[100001];
    ll y[100001];
    cin >> n >> m;
    rep(i, m){
        cin >> p[i] >> y[i];
        v[p[i]].push_back(y[i]);
    }

    rep(i, n){
        vsort(v[i+1]);
    }

    rep(i, m){
        auto it = lower_bound(v[p[i]].begin(), v[p[i]].end(), y[i]);
        ll keynum = p[i]*1e6 + distance(v[p[i]].begin(), it) + 1;
        cout << addzero(keynum) << endl;
    }
    
  	return 0;
}

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

long long int x,i,j;

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>x;
	for (i=-1000;i<1000;i++) for (j=-1000;j<1000;j++)
	if (i*i*i*i*i-j*j*j*j*j==x)
	{
		cout<<i<<" "<<j;return 0;
	}
	cout<<-1;
}


Measured memory_bytes: 3596
import java.math.*;
import java.util.*;
 
public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String a = sc.next();
		String b = sc.next();
		BigDecimal ba = new BigDecimal(a);
		BigDecimal bb = new BigDecimal(b);
		int c = ba.compareTo(bb);
		if (c>0) {
			System.out.println("GREATER");
		} else if (c<0) {
			System.out.println("LESS");
		} else {
			System.out.println("EQUAL");
		}
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>

constexpr const int maxElem = 10000;

void CountingSort( std::vector<int>& v ){
    std::vector<int> count( maxElem + 1 ); // 0-origin, C inlec
    for( auto& cElem : count ){
        cElem = 0;
    }

    int i = 1;
    for( ; i <= v.size(); ++i ){
        ++count[v[i]];
    }

    for( i = 1; i <= maxElem; ++i ){
        count[i] += count[i-1];
    }

    //----test----
    // for( const auto& elem : count ){
    //     std::cout << elem << " ";
    // }
    // std::cout << "\n";
    //------------

    std::vector<int> result( v.size() );
    for( i = v.size(); i > 0; --i ){
        result[count[v[i]]] = v[i];
        --count[v[i]];
    }
    v = std::move(result);
}


int main(){
    int n;
    std::cin.tie(0);
    std::cin >> n;

    std::vector<int> v( n + 1 );
    for( int i = 1; i <= n; ++i ){
        std::cin >> v[i];
    }

    CountingSort(v);

    for( int i = 2; i <= v.size(); ++i ){
        std::cout << v[i] << ( ( i != v.size() )? " " : "\n" );
    }
}


Measured memory_bytes: 18412
def main():
    s = input()
    last_s = s[1]
    second_last_s = s[0]
    if last_s == second_last_s:
        print(1,2)
        exit()
    l = len(s)
    for i in range(2,l):
        if second_last_s == s[i]:
            print(i-1,i+1)
            exit()
        elif last_s == s[i]:
            print(i,i+1)
            exit()
        last_s = s[i]
        second_last_s = s[i-1]

    print(-1,-1)





if __name__ == "__main__":
    main()

Measured memory_bytes: 67364
n, m, c = map(int, input().split())
b = list(map(int, input().split()))

ans = 0
for i in range(n):
  r = c
  a = list(map(int, input().split()))
  for ai, bi in zip(a, b):
    r += ai * bi
  if r > 0:
    ans += 1
print(ans)

Measured memory_bytes: 3060
s = str(input())
a = []

for i in s:
    if i == '0':
        a.append('0') 
    elif i == '1':
        a.append('1')
    elif i == 'B':
        if len(a) ==0:
            continue
        else:
            del a[-1]
        

print(''.join(a))

Measured memory_bytes: 9012