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

namespace patch {
  template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
}
int main() {
  int H,W;
  cin >> H >> W;
  string str[H];
  for(int i=0; i<H; i++) {
    cin >> str[i];
  }

  int count = 0;
  string temp;
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(str[i][j] == '.') {
	count = 0;
	for(int k=0; k<3; k++) {
	  for(int l=0; l<3; l++) {
	    if(i-1+k >= 0 && i-1+k < H && j-1+l >=0 && j-1+l < W) {
	      if(str[i-1+k][j-1+l] == '#')
		count++;
	    }
	  }
	}
	temp = patch::to_string(count); 
	str[i][j] = temp[0];
      }
    }
  }

  for(int i=0; i<H; i++) {
    cout << str[i] << endl;
  }
  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[] x = new int [n];
        int[] y = new int [n];
        int[] a = new int [n];
        for (int i = 0 ; i < n ; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            a[i] = sc.nextInt();
        }

        int minX = 0;
        int maxX = w;
        int minY = 0;
        int maxY = h;
        for (int i = 0 ; i < n ; i++) {
            if (a[i] == 1) {
                minX = Math.max(minX, x[i]);
            } else if (a[i] == 2) {
                maxX = Math.min(maxX, x[i]);
            } else if (a[i] == 3) {
                minY = Math.max(minY, y[i]);
            } else {
                maxY = Math.min(maxY, y[i]);
            }
        }
        if (minX >= maxX || minY >= maxY) {
            System.out.println(0);
        } else {
            System.out.println((maxX - minX) * (maxY - minY));
        }
    }

}

Measured memory_bytes: 24020
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
using ll = long long;

int main() {
#ifdef LOCAL
    freopen("in", "r", stdin);
    //    freopen("out", "w", stdout);
#endif
    ios::sync_with_stdio(0), cin.tie(0);
    ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    
    ll ans = 0;
    ll z = min(x, y);
    
    if (a + b > 2 * c) {
        ans += 2 * c * z;
        x -= z;
        y -= z;
    } else {
        ans += a * z;
        ans += b * z;
        x -= z;
        y -= z;
    }
    
    if (x < y) {
        swap(x, y);
        swap(a, b);
    }
    
    if (a > 2 * c) {
        ans += 2 * c * x;
    } else {
        ans += a * x;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define cs const 
#define int long long
#define mid ((l+r)>>1)
#define low(i) (i&(-i))
#define ls (now<<1)
#define rs (now<<1|1)
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define drep(i, x, y) for(int i=x; i>=y; --i)
cs int ff = 1e6+1;
cs int mod = 1e9+7;
int n;
char s[ff], a[ff];
void init()
{
	cin >> s; cin >> n;
	int len = strlen(s), top = 0;
	rep(i, n+1, n+len)
		a[i] = s[top], top++;
	int head = n+1, tail = n+len, tag = 0;
	rep(i, 1, n)
	{
		
		int typ, f; char p;
		scanf("%lld", &typ);
		if( typ == 1 )
			tag = tag ^ 1;
		else
		{
			scanf("%lld", &f); cin >> p; f--;
			if( f ^ tag ) tail++, a[tail] = p;
			else head--, a[head] = p;
		}
	}
	if( !tag )
		rep(i, head, tail)
			cout << a[i];
	else
		drep(i, tail, head)
			cout << a[i];
	cout << endl;
}
signed main()
{
	init();
} 

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
using namespace std;

typedef pair<int, int> P;

int N;
vector<vector<int>> G;
vector<bool> visited;
vector<P> E;
int res;
map<P, int> m;

void dfs(int u, int c) {
    visited[u] = true;
    res = max(res, (int)G[u].size());

    int edgeColor = 1;
    for (int v : G[u]) {
        if (visited[v]) continue;
        if (edgeColor == c) edgeColor++;
        m[P(u, v)] = edgeColor;
        dfs(v, edgeColor);
        edgeColor++;
    }
}

int main() {
    cin >> N;
    G.resize(N);
    visited.resize(N);
    E.resize(N - 1);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
        E[i] = P(a, b);
    }

    dfs(0, 0);

    cout << res << endl;
    for (P p : E) {
        cout << m[p] << endl;
    }
    return 0;
}





Measured memory_bytes: 13056
#include <string>
#include <iostream>
#include <sstream>

using namespace std;

long long mstoll(string str)
{
	long long ret = 0;
	for (int i = 0; i < str.length(); i++){
		ret *= 10;
		ret += (str[i] - '0');
	}
	return ret;
}

bool ok(string s)
{
	// cout << s << endl;
	for (auto &c : s){
		if (c == '+' || c == '='){
			c = ' ';
		}
	}

	stringstream ss(s);
	string a, b, c;
	ss >> a >> b >> c;
	// cout << a << " " << b << " " << c << endl;
	if (a.length() >= 2u && a[0] == '0') return false;
	if (b.length() >= 2u && b[0] == '0') return false;
	if (c.length() >= 2u && c[0] == '0') return false;

	return ((mstoll(a) + mstoll(b)) == mstoll(c));
}

int main(void)
{
	string str;

	while (cin >> str){
		for (int i = 0; i < 10; i++){
			string s = str;
			for (auto &c : s){
				if (c == 'X'){
					c = i + '0';
				}
			}
			if (ok(s)){
				cout << i << endl;
				goto END;
			}
		}
		cout << "NA" << endl;
		END:;
	}

	return 0;
}

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

int main() {
  string s;
  cin >> s;
  ll ans =0;
//  cout << s.size() << endl;
  ll cnt=0;
  rep(i,0,s.size()){
    if(i%2==0 && s[i]=='0') cnt++;    
    if(i%2==1 && s[i]=='1') cnt++;
  }
  ans = cnt;
  cnt=0;
//  cout << ans << endl;
  rep(i,0,s.size()){
    if(i%2==0 && s[i]=='1') cnt++;    
    if(i%2==1 && s[i]=='0') cnt++;
  }
  ans = min(ans,cnt);

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define all(v) v.begin(), v.end()

const ll mod=1000000007;

int countBits(int in){
  int res=0;
  for(int i=0;i<10;i++){
    int msk=1<<i;
    if((in&msk)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string outputYesNo(bool ans){
  return (ans?"Yes":"No");
}
int main() {
    string s;cin>>s;
    if(s[1]=='B')s[1]='R';
    else s[1]='B';
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 3596
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABiscuitGenerator solver = new ABiscuitGenerator();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABiscuitGenerator {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), t = in.nextInt();

            out.println((t / a) * b);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ



//-------------------------------------------------


int main()
{
  int n ;
  cin >> n ;
  ll ans = 0 ;
  vector<ll> vec(n) ;
  REP(i,n){
    cin >>vec.at(i) ;
  }
  vector<ll> diff(n+1) ;
  diff.at(0) = 0 ;
  REP(i,n){
    diff.at(i+1) = vec.at(i)+diff.at(i) ;
  }
  sort(ALL(diff)) ;
  ll cou = 1 ;
  REP(i,n){
    if(diff.at(i)!=diff.at(i+1)){
      cou = 1 ;
    }
    if(diff.at(i)==diff.at(i+1)){
      ans += cou ;
      cou++ ;
    }
  }
  cout <<ans <<endl;
  
  
  return 0 ;
}

Measured memory_bytes: 3328
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    static int mod = 1000000007;
    static BigInteger bmod = new BigInteger("1000000007");

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }
        k = Math.min(k, n);
        Arrays.sort(a);
        long res = 0;
        for(int i=0; i<n-k; i++) {
            res += a[i];
        }

        System.out.println(res);
    }



}


Measured memory_bytes: 65676
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    //辞書順最小やから後ろの方にt入れたい
    int c = (int)t.size() - 1;
    
    for (int i = (int)s.size() - 1; i >= 0; --i) { //tの末尾始めるいち
        int flg = 0; int c = 0;
        for (int j = (int)t.size() - 1; j >= 0; --j) {
            //cout << s[i - c] << " " << t[j] << endl;
            if (!(s[i - c] == t[j] || s[i - c] == '?')) {
                flg = 1;
                break;
            }
            c++;
        }
        //cout << i << " " << flg << endl;
        if (flg == 0) {
            c = 0;
            rrep(j, i - (int)t.size() + 1, i + 1) {
                s[j] = t[c]; c++;
            }
            rep(j, s.size()) if (s[j] == '?') s[j] = 'a';
            cout << s << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
}



Measured memory_bytes: 256
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  string s;
  cin >> s;
  if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) {
    cout << "Yes" << endl;
  } else if(s[0] == s[2] && s[1] == s[3] && s[0] != s[3]) {
    cout << "Yes" << endl;
  } else if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
s = input()
n = len(s)

li = []
p = 0
for i in range(n):
    if s[i] != s[p]:
        li.append(s[p:i])
        p = i
else:
    li.append(s[p:])

ans = []
for i in range(len(li)):
    if li[i][0] == 'L':
        if i == 0:
            ans.append(len(li[i]))
    else:
        if i == len(li) - 1:
            ans.append(len(li[i]))
        else:
            rc = len(li[i])
            lc = len(li[i + 1])
            l = (rc + 1) // 2 + lc // 2
            r = lc + rc - l
            ans += [0] * (rc - 1) + [l, r] + [0] * (lc - 1)
print(*ans, sep=' ')


Measured memory_bytes: 8048
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String O,E;
		O = scn.next();
		E = scn.next();

		String res = "";
		for(int i=0;i<O.length();i++){
			res += O.charAt(i);
			if(i<E.length()){
				res += E.charAt(i);
			}
		}

		System.out.println(res);
    }
}

Measured memory_bytes: 23892
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b)//还有沙子是会倒完的（不然要a干什么）
    printf("%d\n",a-b);//回车了解一下？
    else
    printf("0\n");//是0，不是空，em··· 大佬的是错的。。。
    return 0;
}

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

#define For(i, j, k) for (int i = j; i <= k; i++)

using namespace std;

int n, S;
int A[110];

int main() {

	scanf("%d%d", &n, &S);
	For(i, 1, n) scanf("%d", &A[i]);
	sort(A + 1, A + n + 1);

	int ans = 0;
	For(i, 1, n) {
		S -= A[i];
		if (S >= 0) ++ans;
		else break;
	}
	if (S > 0) --ans;
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
# /bin/ruby
n = gets().to_i
ary = gets.split(' ').map do |e|
  e.to_i
end

c = 0
ary.each_with_index do |e, i|
  c += 1 if e != i + 1
end

if c == 0 or c == 2
  puts "YES"
else
  puts "NO"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, D, count=0;
  cin >> N;
  vector<int> vec1(N);
  vector<int> vec2(N);
  for(int i=0; i<N; i++) {
    cin >> vec1.at(i);
  }
  for(int i=0; i<N; i++) {
    cin >> vec2.at(i);
  }
  for(int i=0; i<N; i++) {
    D=vec1.at(i)-vec2.at(i);
    if(D>0) {
      count+=D;
    }
  }
  cout << count;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;



int main(){
    ll n,p;
    cin >> n >> p;
    string s;
    cin >> s;
    if(p==2 || p==5){
        ll ans=0;
        rep(i,n){
            ll num=s[n-1-i]-'0';
            if(num%p==0){
                ans+=n-i;
            }
        }
        cout << ans << endl;
        return 0;
    }
    vector<ll> sum(n+1),cnt(p);
    vector<ll> q(n);
    ll val=1;
    rep(i,n){
        q[i]=val;
        val*=10;
        val%=p;
    }
    rep(i,n){
        ll num=s[n-1-i]-'0';
        sum[i+1]=sum[i]+num*q[i];
        sum[i+1]%=p;
    }
    rep(i,n+1){
        cnt[sum[i]]++;
    }
    ll ans=0;
    rep(i,p){
        if(cnt[i]>=2){
            ans+=cnt[i]*(cnt[i]-1)/2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6800
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)

	sc.Scan()
	nStrings, _ := strconv.Atoi(sc.Text())

	counts := make(map[string]int64)
	for i := 0; i < nStrings; i++ {
		sc.Scan()
		runes := []rune(sc.Text())
		sort.Sort(Runes(runes))
		counts[string(runes)] += 1
	}

	nCombies := int64(0)
	for _, cnt := range counts {
		if cnt > 1 {
			nCombies += countCombies(cnt)
		}
	}

	fmt.Println(nCombies)
}

func countCombies(total int64) int64 {
	return total * (total - 1) / 2
}

type Runes []rune

func (s Runes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s Runes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s Runes) Len() int {
	return len(s)
}


Measured memory_bytes: 11264
#include<stdio.h>
#include<string.h>


int point( char *str )
{
	int p = sizeof str / sizeof( char ) ;

	int i = p ;


	p *= p ;

	while( i-- )
	{
		p += str[ i ] ;
	}


	return p ;
}



int main()
{
	char str[ 128 ] ;

	char longest[ 128 ] ,much[ 128 ] ;


	int cnt[ 1000 ] = { 0 } ;

	int max_len = 0 ,max_cnt = 0 ;


	while( scanf( "%s" ,str ) > 0 )
	{
		if( max_len < strlen( str ) )
		{
			max_len = strlen( str ) ;


			sprintf( longest ,"%s" ,str ) ;
		}


		++cnt[ point( str ) ] ;


		if( max_cnt < cnt[ point( str ) ] )
		{
			max_cnt = cnt[ point( str ) ] ;


			sprintf( much ,"%s" ,str ) ;
		}
	}


	printf( "%s %s\n" ,much ,longest ) ;


	return 0 ;
}

Measured memory_bytes: 556
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#print("A=",A)
#print("B=",B)

count = 0
for i in range(N+1):
    if i == 0:
        taosita = B[i]-max((B[i]-A[i]),0)
        count = taosita
        B[i]= B[i]-taosita
#        print("i=0")
    elif i!=N:
        #1つ前の勇者
        taosita1 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita1
        A[i] = A[i]-taosita1
        #今回の勇者
        taosita2 = B[i]-max((B[i]-A[i]),0)
        count =count + taosita2
        B[i]= B[i]-taosita2
    if i == N:
        #1つ前の勇者
        taosita3 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita3
#        A[i] = A[i]-taosita1
print(count)

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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

inline vector<int> digit(unsigned long long n) {
  vector<int> ret;
  do { ret.push_back(n % 10); n /= 10; } while (n > 0);
  return ret;
}

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

  i64 n;
  cin >> n;
  auto d = digit(n);
  int S = 0;
  for (auto e : d) S += e;
  cout << (n % S == 0 ? "Yes" : "No") << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    s[3] = '8';
    cout << s;
}


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

int main() {
    int64_t N;
    cin >> N;
    vector<int64_t> A(N);
    set<int64_t> st;
    for (int64_t& a : A) {
        cin >> a;
        st.insert(a);
    }

    int64_t counter = 0;
    map<int64_t, int64_t> mp;
    for (int64_t e : st) {
        mp[e] = counter++;
    }

    int64_t num = 0;
    for (int64_t i = 0; i < N; i++) {
        A[i] = mp[A[i]];
        num += (i + A[i]) % 2;
    }

    cout << num / 2 << endl;
}

Measured memory_bytes: 12032
w, n = int(input()), int(input())
p = list(range(1, w + 1))
l = [list(map(int, input().split(","))) for i in range(n)]
for j in l: p[j[0] - 1], p[j[1] - 1] = p[j[1] - 1], p[j[0] - 1]
k = [print(v) for v in p]

Measured memory_bytes: 7484
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> A(3);
  cin >> A[0] >> A[1] >> A[2];
  sort(A.begin(),A.end());
  if (A[0] == 5 && A[1] == 5 && A[2] == 7) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}

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

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


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   bool a = 1;
   for (auto e : v ) {
      os << (a ? "" : " "); 
      os << e;
      a = 0;
   }
   os << "]";
   return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
   os << "(" << p.first << " " << p.second << ")";
   return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
   os << "{";
   bool a = 1;
   for (auto e : st) {
      os << (a ? "" : " ");
      os << e;
      a = 0;
   }
   os << "}";
   return os;
}

// std::multiset Debug
template<typename T>
ostream& operator<<(ostream& os, const multiset<T>& st) {
   os << "{";
   bool a = 1;
   for (auto e : st) {
      os << (a ? "" : " ");
      os << e;
      a = 0;
   }
   os << "}";
   return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
   os << "{";
   bool a = 1;
   for (auto e : mp) {
      os << (a ? "" : " ");
      os << e.first << ":" << e.second;
      a = 0;
   }
   os << "}";
   return os;
}

// std::tuple Debug
template<int N, class Tuple>
void out(ostream& os, const Tuple& t){}
template<int N, class Tuple, class H, class ...Ts>
void out(ostream& os, const Tuple& t) {
   if (N) os << " ";
   os << get<N>(t);
   out<N+1,Tuple,Ts...>(os, t);
}
template<class ...Ts>
ostream& operator<<(ostream& os, const tuple<Ts...>& t) {
   os << "(";
   out<0,tuple<Ts...>,Ts...>(os, t);
   os << ")";
   return os;
}

// Debug
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl


struct edge { int to, cost; };
ostream& operator<<(ostream& os, const edge& e) {
   os << "(" << e.to << ", " << e.cost << ")";
   return os;
}

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

int main()
{
   LL W, H, x, y; cin >> W >> H >> x >> y;

   cout << (double)(W * H) / 2 << " " << (W == 2*x && H == 2*y ? 1 : 0) << endl;

   return 0;
}


Measured memory_bytes: 256
from collections import Counter
from itertools import combinations

n = int(input())
l = [input()[0] for _ in range(n)]
lc = Counter(l)

con = []
for c in 'MARCH':
  if c in lc:
    con.append(lc[c])

ans = 0
for a, b, c in combinations(con, 3):
  ans += a*b*c
  
print(ans)

Measured memory_bytes: 10080
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    char last=0;
    int coun=0;
    while(n--){
        char c;
        cin>>c;
        if(last!=c){
            last=c;
            coun++;
        }

    }
    cout<<coun<<endl;

    return 0;
}


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

int main()
{
	int a,b;
	
	cin>>a>>b;
	
	if(a+b>=a-b && a+b>=a*b) cout<<a+b<<endl;
	else
	  if(a-b>=a+b && a-b>=a*b) cout<<a-b<<endl;
	else
	  cout<<a*b<<endl;
	
	return 0;
 } 

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool cmp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    CIN(N);
    int ans=0;
    rep(i,N){
        int l=IN_int();
        int r=IN_int();
        ans+=r-l+1;
    }
    printf("%d\n",ans);
        
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python
class Ternary:
	def __init__(self,n): 
		self.n=n
	def __int__(self):
		return self.n
	def __neg__(self):
		return Ternary(2-int(self))
	def __mul__(self,o):
		return Ternary(min(int(self),int(o)))
	def __add__(self,o):
		return Ternary(max(int(self),int(o)))

import sys, itertools
from functools import reduce
R=[0,1,2]
while True:
	s=sys.stdin.readline().rstrip()
	if s=='.': break
	r=0
	for (a,b,c) in itertools.product(R,repeat=3):
		t=reduce(lambda t,e:t.replace(e[0],'Ternary(%d)'%e[1]),[['0',0],['1',1],['2',2],['P',a],['Q',b],['R',c]],s)
		if int(eval(t))==2: r+=1
	print(r)



Measured memory_bytes: 4812
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return y; else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x);y>>=1;if(y<=0)break;x=(x*x);}return res;}

int main(){
    int h,a;
    cin>>h>>a;
    int sum=0,x;
    for(int i=0;i<a;i++){
        cin>>x;
        sum+=x;
    }
    if(sum>=h){cout<<"Yes";}
    else
    {
        cout<<"No";
    }
    cout<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

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

  int n;
  cin >> n;

  vector<double> p(n+1, 0);
  rep(i, n) cin >> p[i+1];

  vector<vector<double>> dp(n+1, vector<double>(n+1, 0));  // i 枚投げて表が j 枚出る確率
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j > 0) dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i];
      else dp[i][j] = dp[i-1][j] * (1 - p[i]);
    }
  }

  double ans = 0;
  for (int j = n/2 + 1; j <= n; j++) ans += dp[n][j];

  printf("%.10f\n", ans);

  return 0;
}


Measured memory_bytes: 73752
use std::vec::Vec;
use std::cmp;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let (n, k): (usize, usize) = {
        let v: Vec<usize> = read_vec();
        (v[0], v[1])
    };
    let h: Vec<i64> = read_vec();
    let mut c: Vec<i64> = Vec::new();
    c.push(0);

    for i in 1..n {
        let mut m = 0;
        if i > k {
            m = i - k;
        }
        let mut temp = c[i-1] + (h[i] - h[i-1]).abs();
        for j in m..i {
            temp = cmp::min(temp, c[j] + (h[i] - h[j]).abs());
        }
        c.push(temp);
    }
    println!("{}", c[n-1]);
 }


Measured memory_bytes: 8444
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;

void solve() {
	int n; cin >> n;
	int k; cin >> k;
	vector<int> a(n + 1);
	vector<int> cnt_a(n + 1);
	set<int> diff_a;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		diff_a.insert(a[i]);
		cnt_a[a[i]]++;
	}
	int need = diff_a.size() - k;
	sort(cnt_a.begin(), cnt_a.end());
	int ans = 0;
	int slide = cnt_a.size() - diff_a.size();
	for (int i = slide; i < (slide + need); ++i) {
		ans += cnt_a[i];
	}
	cout << ans << endl;
	return;
}

int main() {
	solve();
  return 0;
}

Measured memory_bytes: 11136
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, a;
vector<vector<pair<int,int> > > x;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >>n;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        vector<pair<int,int> > v;
        for(int j=0;j<a;j++){
            int tempx, tempy;
            cin>>tempx>>tempy;
            tempx--;
            v.push_back(make_pair(tempx,tempy));
        }
        x.push_back(v);
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++){
        int sum=0;
        bool check=false;
        for(int j=0;j<n;j++){
            if(!(i&(1<<j)))continue;
            for(int k=0;k<x[j].size();k++){
                if(x[j][k].second){
                    if(!((1<<x[j][k].first)&i)) check=true;
                }
                else{
                    if(((1<<x[j][k].first)&i)) check=true;
                }
            }
        }
        if(!check){
            for(int j=0;j<n;j++){
                if((i&(1<<j)))sum++;
            }
            //cout<<sum<<"\n";
        }
        ans=max(ans,sum);
    }
    cout<<ans<<"\n";
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,st,en) for(i=st;i<=en;i++)
#define repv(i,en,st) for(i=en;i>=st;i--)
#define fout cout<<fixed<<setprecision(7)
#define bi(n) __builtin_popcount(n)
#define bil(n) __builtin_popcountll(n)


typedef long long ll;
typedef pair<int,int> pii;
const int N = 3010;
ll mod = 1e9+7;
ll fmod(ll b,ll exp){
    ll res =1;
    while(exp){if(exp&1ll)res=(res*b)%mod;
    b =(b*b)%mod;exp/=2ll;
    }
    return res;
}
ll A[N];
ll dp[N][N];


int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t=1,n,i,j,m;
    cin>>n;
    rep(i,1,n)cin>>A[i];
    rep(i,1,n)dp[i][1]=A[i];
    rep(i,1,n-1)dp[i][2]=(max(A[i],A[i+1])-min(A[i],A[i+1]));
    rep(j,3,n)
    {
        rep(i,1,n-j+1)
        {
            int en = i+j-1;
            dp[i][j]= max(A[i]-dp[i+1][j-1],A[en]-dp[i][j-1]);
        }
    }
    cout<<dp[1][n]<<"\n";

    
    return 0;
}


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

using namespace std;

int main()
{

    for(;;){
        int n;
        cin >> n;
        if(n == 0) break;

        vector<int> s(n);
        int sum = 0;
        for(int i = 0; i < n; i++){
            cin >> s.at(i);
            sum += s.at(i);
        }
        double m = (double)sum / (double)n;
        double a = 0.0;
        for(int i = 0; i < n; i++){
            double si = s.at(i);
            a += (si - m) * (si - m) / n;
        }
        printf("%.8f\n", sqrt(a));
    }

}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
int N;
int s=INF, tot=0, tmp;
int main() {
    scanf("%d", &N);
    for(int i=0;i<N;i++) {
        scanf("%d", &tmp);
        if(tmp%10 != 0) s = min(s, tmp);
        tot += tmp;
    }
    
    if(tot%10!=0) printf("%d\n", tot);
    else if(s != INF) printf("%d\n", tot-s);
    else printf("0\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;

int main(){
    int D, N;
    cin >> D >> N;
    if(N != 100){
        int base = pow(100, D);
        cout << base*N << endl;
    }
    else{
        int base = pow(100, D);
        cout << base*N+base << endl;
    }
    return 0;
}


Measured memory_bytes: 256
!!!**********************************************************************
program main
!!!**********************************************************************  

  integer   :: r, a
  ! real      ::
  ! character ::
  
!!!----------------------------------------------------------------------

  read ( *, * ) r
  a =  3*r*r  
  write ( unit = *, fmt = '(I0)' ) a
  
!!!**********************************************************************  
end program main
!!!**********************************************************************

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

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);
};
//fixed << setprecision(2)

//小文字=大文字+32

int main() {
	int n;
	cin >> n;
	vector<int>h(n);
	rep(i, n) {
		cin >> h[i];
	}
	int tmp = 0;
	int ans = 0;
	rep(i, n - 1) {
		if (h[i] >= h[i + 1]) {

			tmp++;
		}
		else {
		ans=max(ans, tmp);
			tmp = 0;
		}
	}
		ans=max(ans, tmp);
		cout << ans; 



}
	



Measured memory_bytes: 3736
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include <iomanip>
#include<utility>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
#define S 21 
llfor;ll mod=1000000007;
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;ans%=mod;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)*fact(n-r)/fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
/*行列のコピー*/void matcpy(ll a[S][S],ll b[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)b[i][j]=a[i][j];/*(aをbに)*/i=t;}
/*行列のリセット*/void matrst(ll a[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)a[i][j]=0;i=t;}
/*行列の2乗*/void matpow(ll a[S][S]){ll ans[S][S];matrst(ans);ll t=i,k;rep(i,0,S)rep(j,0,S)rep(k,0,S)ans[i][j]+=a[i][k]*a[k][j];matcpy(ans,a);i=t;}
/*行列の乗算*/void matmul(ll a[S][S],ll b[S][S], ll as[S][S]){ll t=i,k;matrst(as);rep(i,0,S)rep(j,0,S)rep(k,0,S)as[i][j]+=a[i][k]*b[k][j];i=t;}
//ll ans=0;
////////////////////////////////////////////////////////////
int main(){
 ll mod=1e9+7;
 ll n;
 cin>>n;
 vector<ll>b;
 ll a;
 rep(i,0,n){
  cin>>a;
  push(b,a);
 }
 reverse(all(b));
 bool flag;
 vector<ll>c;
 ll cnt=0;
 while(!b.empty()){
  flag=false;
  rep(i,0,n){
   if(b[i]+i==n-cnt){
    push(c,b[i]);
    b.erase(b.begin()+i);
    cnt++;
    flag=true;
    break;
   }
   //cout<<i<<" "<<b[i]<<" "<<endl;
  }
  if(!flag){
   puts("-1");
   return 0;
  }
 }
 reverse(all(c));
 rep(i,0,n){
  pr(c[i]);
 }
return 0;}

Measured memory_bytes: 3636
fun main(args: Array<String>) {
    abc112d()
}

fun abc112d() {
    val (n, m) = readLine()!!.split(' ').map { it.toLong() }

    for (i in m / n downTo 1) {
        if (m % i != 0L) continue

        if ((m / i) / n >= 1) return println(i)
    }
}


Measured memory_bytes: 38340
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;


void solve()
{
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	k--;
	cout<<a[k]<<endl;

}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;

int main() {
 
    cin.sync_with_stdio(0); cin.tie(0); 
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        int n,m;cin>>n>>m;
        if(n==m){
            cout<<"Yes";
        }
        else
            cout<<"No";
    }
    return 0;   
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
using ll = long long;
using namespace std;

uintmax_t combination(int n, int r) {
	if (r * 2 > n) r = n - r;
	uintmax_t dividend = 1;
	uintmax_t divisor = 1;
	for (unsigned int i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;

	ll devide = pow(10, 9) + 7;
	ll count = 1;
	vector<int>alpha(26);
	rep(i, n) {
		ll a = s[i];
		a -= 97;
		alpha[a]++;
	}

	rep(i, 26) {
		if (alpha[i] >= 1) {
			count *= (alpha[i] + 1);
			count %= devide;
		}
	}


	cout << count-1 << endl;

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
int main(){
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	#endif
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	cout<<fixed<<setprecision(10);
	int n;
	cin>>n;
	ld a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	ld num=1;
	for(int i=0;i<n;i++){
		num*=a[i];
	}
	ld den=0;
	for(int i=0;i<n;i++){
		ld s=1;
		for(int j=0;j<n;j++){
			if(i==j) continue;
			s*=a[j];
		}
		den+=s;
	}
	cout<<num/den;
}

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

int main() {
  int town_num, road_num;
  cin >> town_num >> road_num;
  vector<int> road_nums(town_num + 1, 0);
  for (int i = 0; i < road_num; i++) {
    int town1, town2;
    cin >> town1 >> town2;
    road_nums[town1] += 1;
    road_nums[town2] += 1;
  }
  for (int i = 1; i < town_num + 1; i++) {
    cout << road_nums[i] << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>                                                                                                                                         
                                                                                                                                                           
int main(void)                                                                                                                                             
{                                                                                                                                                          
        int x, y, z, ans;                                                                                                                                  
                                                                                                                                                           
        scanf("%d %d %d", &x, &y, &z);                                                                                                                     
        x -= z;                                                                                                                                            
        ans = x / (y + z);                                                                                                                                 
        printf("%d\n", ans);                                                                                                                               
        return 0;                                                                                                                                          
} 

Measured memory_bytes: 128