akhauriyash/Code-Regression huggingface dataset:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)
def comb(n,r):
    if r > n:
        return 0
    else:
        return factorial(n)//(factorial(n-r)*factorial(r))
n,a,b = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)
max_mean = sum(v[0:a])/a
print(max_mean)
#選び方の総数を求める
c = Counter(v)
i = 0
num = 0
ans = 0
while num<a:
    if num+c[v[i]]>=a:
        num += c[v[i]]
    else:
        num += c[v[i]]
        i += 1
num -= c[v[i]]

if i > 0:
        ans += comb(c[v[i]],a-num)
        print(ans)
else:
    for j in range(a,b+1):
        if c[v[0]] >=j:
            ans += comb(c[v[0]],j)
    print(ans)

Measured memory_bytes: 39024
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
const int MOD = 1e9 + 7;
const int INF = 1e18;

void solve(){
 int n;
 cin >> n;
 string s;
 cin >> s;
 string s1 = "";
 string s2 = "";
 for (int i = 0; i < (n / 2); i++)
   s1 += s[i];
 for (int i = n / 2; i < n; i++)
   s2 += s[i];
 if (s1 == s2) 
   cout << "Yes" << endl;
 else
   cout << "No" << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  map<int, int> amap;
  int A[N];
  int maxnum = 0, minnum = inf;
  for(int i=0;i<N;++i) {
    cin>>A[i];
    maxnum = max(maxnum, A[i]);
    minnum = min(minnum, A[i]);
    amap[A[i]]++;
  }
  bool can;
  if(minnum==(maxnum+1)/2) can = true;
  else can = false;
  if(!can) {
    cout<<"Impossible"<<endl;
    return 0;
  }
  for(int i=minnum;i<=maxnum;++i) {
    if(i==minnum) {
      if(maxnum%2==0) {
        if(amap[i]!=1) can = false;
      }
      else {
        if(amap[i]!=2) can = false;
      }
    }
    else if(i==maxnum) {
      if(amap[i]<2) can = false;
    }
    else {
      if(amap[i]<2) can = false;
    }
  }
  if(can) cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
}



Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main() {
	char s[1000][1000];
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}
	int cnt = 0;
	//縦
	for (int i = 0; i < h; i++) {
		cnt = 0;
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '.') cnt++;
			if (cnt == w) {
				for (int l = i; l < h - 1; l++) {
					for (int k = 0; k < w; k++) {
						s[l][k] = s[l + 1][k];
					}
				}
				i--;
				h--;
			}
 		}
	}
	for (int i = 0; i < w; i++) {
		cnt = 0;
		for (int j = 0; j < h; j++) {
			if (s[j][i] == '.') cnt++;
			if (cnt == h) {
				for (int l = i; l < w - 1; l++) {
					for (int k = 0; k < h; k++) {
						s[k][l] = s[k][l + 1];
					}
				}
				i--;
				w--;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << s[i][j];
		}
		cout << endl;
	}


}

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

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

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let mut ab = (0..n)
        .map(|_| (read::<usize>(), read::<usize>()))
        .collect::<Vec<_>>();
    let mut cd = (0..n)
        .map(|_| (read::<usize>(), read::<usize>()))
        .collect::<Vec<_>>();
    ab.sort();
    cd.sort();
    let ab = ab;
    let cd = cd;

    let mut used = vec![0; n];

    for (c, d) in cd {
        let mut candidate = None;
        for r in 0..n {
            if used[r] > 0 {
                continue;
            }

            let (a, b) = ab[r];
            if let Some((_, y, _)) = candidate {
                if a < c && y < b && b < d {
                    candidate = Some((a, b, r))
                }
            } else if a < c && b < d {
                candidate = Some((a, b, r));
            }
        }
        if let Some((x, y, r)) = candidate {
            used[r] = 1;
        }
    }
    let ans = used.into_iter().filter(|&x| x > 0).count();
    println!("{}", ans);
}


Measured memory_bytes: 4352
// E.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		string s;
		cin >> s;
		if (s.empty()) return 0;
		int len = (int)s.length();
		vector<int> v(len + 1);
		for (int i = 0; i < len; ++i) {
			v[i + 1] = s[i] - '0';
		}
		int dp[1000002][2] = {};
		for (int i = 0; i <= len; ++i) {
			dp[i][0] = v[i];
			dp[i][1] = dp[i][0] + 1;
			if (i > 0) {
				dp[i][0] = min(dp[i - 1][0] + v[i], dp[i - 1][1] + 10 - v[i]);
				dp[i][1] = min(dp[i][0] + 1, dp[i - 1][1] + 10 - v[i] - 1);
			}
		}
		cout << dp[len][0] << endl;
	}
	return 0;
}


Measured memory_bytes: 13060
#include "bits/stdc++.h"

using namespace std;

int main() {
  int n; cin >> n;
  string s; cin >> s;
  
  if (n % 2) {
    cout << "No" << endl;
    return 0;
  }
  
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n / 2 + i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }





void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    
    double n; cin >> n;
    cout << setprecision(10)<< n*2*pi << endl;
    
    
    
    
}



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



Measured memory_bytes: 3848
#include<bits/stdc++.h>
using namespace std;
#define int long
main(){
  int n,r=0;
  cin>>n;
  vector<int> b(n-1),a(n,1e6);
  for(auto& i:b)cin>>i;
  for(int i=0;i<n-1;++i){
    a[i]=min(a[i],b[i]);
    a[i+1]=min(a[i+1],b[i]);
  }
  for(auto i:a)r+=i;
  cout<<r;
}

Measured memory_bytes: 256
def main():
    N, M = list(map(int, input().split(' ')))
    shops = list()
    for _ in range(N):
        A, B = list(map(int, input().split(' ')))
        shops.append((A, B))
    shops.sort()
    drink = 0
    money = 0
    for s in shops:
        rest = M - drink
        cnt = min([rest, s[1]])
        drink += cnt
        money += cnt * s[0]
        if drink == M:
            break
    print(money)


if __name__ == '__main__':
    main()

Measured memory_bytes: 16992
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N;
	cin>>N;
	vector<int> a(N);
	FDS(i,N){
		cin>>a[i];
	}
	int A=0,B=0,C=0;
	FDS(i,N){
		if(a[i]%4==0){
			C++;
		}
		else if (a[i]%2==0){
			B++;
		}
		else{
			A++;
		}
	}
	
	if(B>=1){
    	if(C>=A){
    		cout<<"Yes"<<endl;
    	}
    	else{
    		cout<<"No"<<endl;
    	}
	}
	if(B==0){
	    if(C+1>=A){
		cout<<"Yes"<<endl;
	    }
	    else{
		cout<<"No"<<endl;
	    }
	}
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define push push_back
#define pop pop_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    int N=in<int>();
    pair<int, int> Pi[200000];
    rep(i, N) {
        int buff = in<int>();
        Pi[i] = make_pair(buff, i);
    }

    sort(Pi, Pi+N);

    int right = 1;
    int ans = 1;
    for(int left = 0; left < N; left++) {
        while (right < N && (right <= left || (Pi[right].second > Pi[right-1].second))) {
           // (rightを進めたり部分列の和積を変えたりする)
           right++;
        }

        // rightが伸びきった部分列でansに答えを追記
        ans = max(ans, right-left);

        if (right == left) {
            right++; // 追いついたらrightを進める
        } else {
            // (leftを進めることによる部分列の変更など)
        }
    }

    cout << N - ans << endl;

    return 0;
}


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

using pii = pair<int, int>;
using vi = vector<int>;
using ll = long long;

constexpr int INF = 1e9;

struct edge {
    int to, cost, jump;
};

using edges = vector<edge>;
using graph = vector<edges>;

void add_edge(graph& g, int from, int to, int cost, int jump) {
    g[from].push_back(edge{to, cost, jump});
}

int main() {
    int n, m;
    while(cin >> n >> m, n) {
        vector<tuple<int, int, int>> v;
        for(int i = 0; i < n; ++i) {
            int k; cin >> k;
            for(int j = 0; j < k; ++j) {
                int x, d;
                cin >> x >> d;
                v.emplace_back(i, x, d);
            }
        }
        graph g(v.size() + 2);
        int s = v.size(), t = s + 1;
        for(int i = 0; i < v.size(); ++i) {
            int y1, x1, d1;
            tie(y1, x1, d1) = v[i];
            for(int j = 0; j < v.size(); ++j) {
                if(i == j) {
                    continue;
                }
                int y2, x2, d2;
                tie(y2, x2, d2) = v[j];
                if(1 <= y2 - y1 && y2 - y1 <= 2) {
                    add_edge(g, i, j, (d1 + d2) * abs(x1 - x2), y2 - y1 == 2);
                }
            }
            if(y1 <= 1) {
                add_edge(g, s, i, 0, y1 == 1);
            }
            if(n - 2 <= y1) {
                add_edge(g, i, t, 0, y1 == n - 2);
            }
        }
        
        int res = INF;
        vector<vector<int>> d(g.size(), vector<int>(m + 1, INF));
        d[s][m] = 0;
        using state = tuple<int, int, int>;
        priority_queue<state, vector<state>, greater<state>> que;
        que.emplace(0, m, s);
        while(!que.empty()) {
            int cur_d, cnt, v;
            tie(cur_d, cnt, v) = que.top();
            que.pop();
            if(v == t) {
                res = cur_d;
                break;
            }
            if(d[v][cnt] < cur_d) {
                continue;
            }
            for(auto& e : g[v]) {
                if(cnt - e.jump >= 0 && d[e.to][cnt - e.jump] > d[v][cnt] + e.cost) {
                    d[e.to][cnt - e.jump] = d[v][cnt] + e.cost;
                    que.emplace(d[e.to][cnt - e.jump], cnt - e.jump, e.to);
                }
            }
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 5648
## Nの正の公約数をリストで返す（ソートしたい場合は#外す）
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

N, M = map(int, input().split())

lst = make_divisors(M)
for i in range(len(lst)):
  if M // lst[i] >= N:
    print(lst[i])
    exit()

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

int main(void){
    std::vector<int> a,b;
    int x,y,z;
    while(std::cin>>x>>y){
      a.push_back(x);
      b.push_back(y);
    }
    for(int i=0;i<a.size();i++){
     int c=0;
     z=a[i]+b[i];
      while(z!=0){
        z = z/10;
        ++c;
      }
      std::cout<<c<<"\n";
    }
    return 0;
  }

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

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

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            long[] ab = ReadLongs();
            long a = ab[0];
            long b = ab[1];
            var aPrimes = PrimeFactors(a);
            var bPrimes = PrimeFactors(b);
            int res = 1;
            foreach(long val in aPrimes)
            {
                if (bPrimes.Contains(val)) res++;
            }
            WriteLine(res);
        }

        static HashSet<long> PrimeFactors(long n)
        {
            var res = new HashSet<long>();
            long tmp = n;

            for (long i = 2; i * i <= n; i++)
            {
                if (tmp % i == 0)
                {
                    res.Add(i);
                    while (tmp % i == 0) tmp /= i;
                }
            }
            if (tmp != 1) res.Add(tmp);//最後の素数も返す

            return res;
        }

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


Measured memory_bytes: 13280
/** ------------------------------------------------------------------------ **/
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<typename T> using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> using ordered_map =
tree<T1, T2, less<T1>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using hash_set = gp_hash_table<T, null_type>;
template<typename T1, typename T2> using hash_map = gp_hash_table<T1, T2>;

mt19937 rng(time(nullptr));
mt19937_64 rng64(time(nullptr));

#define rep(i, s, t) for (int i = s; i < int(t); ++i)
#define for_iter(i, c) for (auto i = c.begin(); i != c.end(); ++i)
#define for_const_iter(i, c) for (auto i = c.cbegin(); i != c.cend(); ++i)

#define sc	scanf
#define pr	printf
#define ff	first
#define ss	second
#define mp	make_pair
#define pb	push_back
#define eb	emplace_back
#define range(c)	c.begin(), c.end()
#define const_range(c)	c.cbegin(), c.cend()
#define lowbit(x)	((x) & -(x))
#define pop_count	__builin_popcount
#define pop_count64	__builtin_popcountll
#define tail_count	__builtin_ctz
#define tail_count64	__builtin_ctzll
#define lead_count	__builtin_clz
#define lead_count64	__builtin_clzll

template<typename T1, typename T2>
ostream& operator<< (ostream& os, const pair<T1, T2>& p) {
	return os << "<" << p.ff << "," << p.ss << ">";
}
#define container_ostream(container)				\
template<typename... T>						\
ostream& operator<< (ostream& os, const container<T...>& c) {	\
	if (c.empty()) return os << "{ }";			\
	auto iter = c.cbegin();					\
	os << "{ " << *iter;					\
	while (++iter != c.cend()) os << ", " << *iter;		\
	return os << " }";					\
}
container_ostream(vector)
container_ostream(set)
container_ostream(map)

void dbg() { cerr << endl;}
template<typename Head, typename... Tail> void dbg(Head h, Tail... t) {
	cerr << " " << h;
	dbg(t...);
}

#ifdef LOCAL
#define debug(...) cerr << "[ "#__VA_ARGS__" ] :", dbg(__VA_ARGS__)
#else
#define debug(...) 0
#endif

typedef long long i64;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n;
	cin >> n;
	vector<pii> ba(n);
	rep(i, 0, n) cin >> ba[i].ss;
	rep(i, 0, n) cin >> ba[i].ff;
	sort(range(ba));
	vi a(n), b(n), c(n), d(n + 1);
	rep(i, 0, n) a[i] = ba[i].ss, b[i] = ba[i].ff;
	rep(i, 0, n) c[i] = b.end() - lower_bound(const_range(b), a[i]), ++d[c[i]];
	rep(i, 0, n) d[i + 1] += d[i];
	debug(a);
	debug(b);
	debug(c);
	rep(i, 0, n) if (d[i] > i) return cout << "No" << endl, 0;
	rep(i, 0, n) if (d[i] < i) return cout << "Yes" << endl, 0;
	rep(i, 0, n) a[i] = n - c[i];
	int cnt = 1;
	for (int i = a[0]; i; i = a[i]) ++cnt;
	cout << (cnt == n ? "No" : "Yes") << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll a[214514],b[214514];

int main() {
	ll k,n;
	cin>>k>>n;
	ll sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i){
			b[i]=a[i]-a[i-1];
			sum+=b[i];
		}
	}
	b[0]=a[0]+k-a[n-1];
	sum+=b[0];
	sort(b,b+n);
	sum-=b[n-1];
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3328
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        long n=nl();
        long x=nl();
        long t=nl();
        pn((int)Math.ceil((double)n/x)*t);
    }
    static long mod=(long)1e9+7l;
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-- > 0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 32920
<?php

$n = trim(fgets(STDIN));
if ($n < 4){
  echo 1;
  exit;
} 

$ans = 0;
for($i=2; $i<=floor(sqrt($n)); $i++){
  $p = $i;
  $pp = $p**2;
  if ($pp < $n){
    while($pp*$p<=$n){
      $pp *= $p;
    }
  }
  $ans = max($ans,$pp);
}
echo $ans;
?>

Measured memory_bytes: 4604
#include<bits/stdc++.h>
#define QS ios_base::sync_with_stdio(false);
typedef long long ll;
const ll INF = 1e18;
const int MOD = 1e9+7;
using namespace std;

int a[1003], b[1003], c[1003];
int dp[5003];
int main(){
//freopen("output.txt", "w", stdout);
    QS
    int n, m; cin >> n >> m;
    for(int i = 0; i < m; ++i){
        cin >> a[i] >> b[i];
        int tmp = 0;
        for(int j = 0; j < b[i]; ++j){
            int t; cin >> t;
            t--;
            t = 1<<t;
            tmp = tmp|t;
        }
        c[i] = tmp;
    }
    for(int i = 1; i < 5001; ++i){
            dp[i] = MOD;
    }

    int N = 1<<n;
    for(int j = 0; j < N; ++j){
        for(int i = 0; i < m; ++i){
            int t = j|c[i];
            //cout << t << '\n';
            dp[t] = min(dp[t], dp[j]+a[i]);
        }
    }
    if(dp[N-1] == MOD) dp[N-1] = -1;
    cout << dp[N-1];
}



Measured memory_bytes: 256
import heapq
n, k = map(int, input().split())
v = list(map(int, input().split()))

y = min(n, k)

ans = 0

for i in range(y):
    cnt = 0
    heap = []
    for j in range(i+1):
        if v[j] < 0:
            heap.append(v[j])
            ans = max(ans, cnt)
        cnt += v[j]
        ans = max(ans, cnt)

    rest = k - i - 1
    right = n - i - 1
    for r in range(min(rest, right)+1):
        index = -1
        cnt2 = cnt
        heap2 = heap[:]
        for _ in range(r):
            cnt2 += v[index]
            if v[index] < 0:
                heap2.append(v[index])
            index -= 1

        ans = max(ans, cnt2)
        rest2 = rest - r
        heap2.sort()
        for o in range(rest2):
            if o >= len(heap2):
                break
            cnt2 -= heap2[o]
            ans = max(ans, cnt2)

print(ans)

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

using namespace std;
typedef long long ll;

int main()
{
   vector<int> v(5);
   for(int i=0;i<5;i++){
       cin >> v[i];
   } 
   for(int i=0;i<5;i++){
       if(v[i] == 0){
           cout << i+1 << endl;
       }
   } 
}

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


int bubblesort(int data[], int n) {
	bool flag = 1;
	int temp;
	int count = 0;
	while(flag) {
		flag = 0;
		for (int i = n - 1; i > 0; i--) {
			if (data[i] < data[i-1]) {
				count++;
				temp = data[i];
				data[i] = data[i-1];
				data[i-1] = temp;
				flag = 1;
			}
		}
	}
	return count;
}


int main() {
	int n;
	cin >> n;
	int data[100];
	for (int i = 0; i < n; i++) {
		cin >> data[i];
	}

	int c;
	c = bubblesort(data, n);
	for (int j = 0; j < n; j++) {
		cout << data[j];
		if (j < n-1) cout << " ";
	}
	cout << endl << c << endl;

	return 0;
}

Measured memory_bytes: 3120
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  S[K-1] += 0x20;
  cout << S << endl;
  return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


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

  int n, m;
  cin >> n >> m;
  int b = m / n;
  int d = -1;
  for(int i = 1; i*i <= m; i++) {
    if(m % i == 0) {
      if(i <= b) chmax(d,i);
      if(m/i <= b) chmax(d,m/i);
    }
  }
  cout << d << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int k,s;
    cin >> k >> s;
    ll ans = 0;
    for(int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            if(s-i-j >= 0 && s-i-j <= k) ans++;
        }
    } 
    cout << ans << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



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

	int n;
	cin >> n;
	for(double i = 1; i <= n; i++) {
		double d = i * 1.08;
		int t = d;
		if(t == n) {
			cout << i << endl;
			return 0;
		}
		//cout << t << " ";
	}
	cout << ":(" << endl;
	return 0;
}


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

int main(){
  int n; cin >> n;
  int d1 = n/100;
  int d2 = (n%100)/10;
  int d3 = (n%10);
  if(d1 == 7 || d2 == 7 || d3 == 7) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3676
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = sc.next();
        }

        HashMap<String, Integer> m = new HashMap<String, Integer>();
        for (int i = 0; i < N; i++) {
            String s = S[i];
            if (m.containsKey(s)) {
                m.put(s, m.get(s) + 1);
            } else {
                m.put(s, 1);
            }
        }

        int max = 0;
        Set<String> set = new TreeSet<String>();
        for (Map.Entry e : m.entrySet()) {
            int cnt = (int) e.getValue();
            if (max < cnt) {
                set.clear();
                max = cnt;
            }
            if (max == cnt) {
                set.add((String)e.getKey());
            }
        }

        for (String s : set) {
            System.out.println(s);
        }

        return;
    }

}


Measured memory_bytes: 83960
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int vector_finder(vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  vi r,g,b;
  rep(i,n){
    if(s[i]=='R')r.push_back(i);
    if(s[i]=='G')g.push_back(i);
    if(s[i]=='B')b.push_back(i);
  }
  ll ans =0;
  rep(i,n){
    char first = s[i];
    rep2(j,i+1,n){
      if(s[j]!=first){
        char second = s[j];
        if(first=='R'){
          if(second=='G'){
            ans+=b.end()-upper_bound(been(b),j);
          }
          if(second=='B'){
            ans+=g.end()-upper_bound(been(g),j);
          }
        }
        if(first=='G'){
          if(second=='R'){
            ans+=b.end()-upper_bound(been(b),j);
          }
          if(second=='B'){
            ans+=r.end()-upper_bound(been(r),j);
          }
        }
        if(first=='B'){
          if(second=='G'){
            ans+=r.end()-upper_bound(been(r),j);
          }
          if(second=='R'){
            ans+=g.end()-upper_bound(been(g),j);
          }
        }
      }
    }
  }
  for(int i = 0;i<n;i++){
    for(int j =0;j+i+i<n;j++){
      if(s[j]!=s[j+i]&&s[j]!=s[j+i+i]&&s[j+i]!=s[j+i+i])ans--;
    }
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, T;
    cin >> N >> T;
    vector<int> c(N), t(N);
    rep(i, N) cin >> c[i] >> t[i];
    
    int ans = 100100100;
    rep(i, N) {
        if (t[i] <= T) ans = min(ans, c[i]);
    }
    if (ans == 100100100) cout << "TLE" << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

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

		solve(sc, out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out){
		int l = sc.nextInt()+sc.nextInt();
		int r = sc.nextInt()+sc.nextInt();
		
		if(l == r) {
			out.println("Balanced");
		}else if(l < r){
			out.println("Right");
		}else{
			out.println("Left");
		}
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

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

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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

int main(){
  int N;
  long D;
  long x,y;
  cin>>N>>D;
  int count=0;
  for(int i=0;i<N;i++){
    cin>>x>>y;
    if(sqrt(x*x+y*y)<=D)
      count++;
  }
  cout<<count;
}

Measured memory_bytes: 3684
import numpy as np
import math
N ,D =  map(int  , input().split(" "))

x = np.array(input().split(" ") , dtype="int32")
ans = 0
for i in range(N-1):
    x = np.append(x, np.array(input().split(" ") , dtype="int32"))
x = x.reshape(N , D)
for i in range(N):
    for n in range(i+1 , N):
        dist = np.linalg.norm(x[i] - x[n])
        if math.ceil(dist)==math.floor(dist):
            ans += 1
print(ans)

Measured memory_bytes: 12508
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int MAXN = 500005;
const int mod = 1e9 + 7;

int cnt[MAXN];
int main(){
	int n; string s;
	cin >> n >> s;
	for(auto &i : s) cnt[i]++;
	lint ans = 1;
	for(int i='a'; i<='z'; i++){
		ans *= cnt[i] + 1;
		ans %= mod;
	}
	ans += mod - 1;
	ans %= mod;
	cout << ans << endl;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
int main(void)
{
	int N, T, h[1010] = { 0 }, ans, i;
	double A, a, hikaku = 100000.0;
	scanf("%d%d%lf", &N, &T, &A);
	for (i = 1; i <= N; i++)scanf("%d", &h[i]);
	for (i = 1; i <= N; i++) {
		a = T - h[i] * 0.006;
		if (hikaku > fabs(A - a)) {
			hikaku = fabs(A - a);
			ans = i;
		}
	}
	printf("%d", ans);
	return 0;
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    i64 n, m, c;
    cin >> n >> m >> c;
    vector<i64> b(m);
    vector<vector<i64>> a(n, vector<i64>(m));
    for(auto& x : b)
        cin >> x;
    for(auto& x : a)
        for(auto& y : x)
            cin >> y;
    i64 ans = 0;
    for(int i = 0; i < n; ++i){
        i64 sum = 0;
        for(int j = 0; j < m; ++j)
            sum += b[j] * a[i][j];
        if(sum + c > 0)
            ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		if (a * b < c * d) {
			System.out.println(c * d);
		} else {
			System.out.println(a * b);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std ;
#define N 100010
long long int n,t,a[N];
long long int mmax(long long int a,long long b){
	return a > b ? a : b;
} 
int main() {
    scanf("%lld%lld",&n,&t);
    for(long long int i=1;i<=n;i++) scanf("%lld",&a[i]);
	unsigned long long int ans = 0,mx = 0,tot = 0 ;
    for(long long int i = n ; i  ; i -- ) {
        mx = mmax(a[i],mx);
        ans = mmax(mx - a[i],ans);
    }
    mx = 0;
    for(long long int i = n;i;i--) {
        mx = mmax(a[i],mx);
        if(mx - a[i] == ans) tot++;
    }
    printf("%lld\n",tot);
    return 0;
}

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

int main() {
   int N;
   cin >> N;
   bool finished=false;
   for (int i=1; i<10; i++) {
       for (int j=1; j<10; j++) {
           if (N==i*j) {
               cout << "Yes" << endl;finished=true;break;
           }
           if (i==9 && j==9) cout << "No" << endl;
       }
       if (finished) break;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    vi a(3); for(auto& e : a) cin >> e;
    sort(_all(a));

    string res = "No";
    if((a[0] == a[1] and a[1] != a[2]) or
       (a[0] != a[1] and a[1] == a[2])){
        res = "Yes";
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
N, L, T= map(int,input().split())
X = []
W = []

for i in range(N):
    x,w = map(int,input().split())
    X.append(2*x)
    W.append(2*(1-w)+1)

pos = [((x+2*T*w) % (2*L))//2 for x,w in zip(X,W)]

meet = 0
for i in range(1,N):
    if W[0] != W[i]:
        if W[0] == 1:
            R = 2*T - (X[i] - X[0])//2
        else:
            R = 2*T - (2*L - (X[i] - X[0]))//2
        if R >= 0:
            meet += 1 + R//L
M = (meet * W[0]) % N

aM_pos = pos[0]
pos.sort()

aM_idx = pos.index(aM_pos)
if pos.count(aM_pos) == 2 and W[0] == 1:
    aM_idx += 1

a0_idx = (aM_idx-M) % N
ans = pos[a0_idx:]+pos[:a0_idx]

for ant in ans:
    print(ant)







Measured memory_bytes: 53212
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	    ll n;
	    cin>>n;
	    string str;
	    while(n >= 1){
	        ll x = n%26;
	        n = n/26;
	        if(x==0){
	            str.push_back('z');
	         n--;   
	        }else{
	            str.push_back(x+'a'-1);
	        }
	    }
	    reverse(str.begin(),str.end());
	    cout<<str<<"\n";
	return 0;
}

Measured memory_bytes: 3580
h,w,m=map(int,input().split())
a=dict()
b=dict()
points=set()
for i in range (m):
    x,y=map(int,input().split())
    points.add((x,y))
    if x in a:
        a[x]+=1
    else:
        a[x]=1
    if y in b:
        b[y]+=1
    else:
        b[y]=1
m1=max(a.values())
m2=max(b.values())
s1=set()
s2=set()
for i in a:
    if a[i]==m1:
        s1.add(i)
for i in b:
    if b[i]==m2:
        s2.add(i)
r=set()
for i in points:
    if i[0] in s1 and i[1] in s2:
        r.add(i)
if len(r)==len(s1)*len(s2):
    print(m1+m2-1)
else:
    print(m1+m2)

Measured memory_bytes: 107036
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = std::numeric_limits<T>::max() / 10;
std::mt19937 mt{std::random_device{}()};
int main()
{
    ll N;
    std::cin >> N;
    ll P;
    std::cin >> P;
    std::map<ll, int> mp;
    std::vector<bool> isp(1000001, true);
    for (int i = 2; i <= 1000000; i++) {
        if (not isp[i]) { continue; }
        for (int j = 2; i * j <= 1000000; j++) { isp[i * j] = false; }
    }
    for (int i = 2; i <= 1000000; i++) {
        if (not isp[i]) { continue; }
        while (P % i == 0) { mp[i]++, P /= i; }
    }
    if (P > 1) { mp[P] = 1; }
    ll ans = 1;
    for (const auto& p : mp) {
        const int n = p.second / N;
        for (int i = 0; i < n; i++) { ans *= p.first; }
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong() - 1;
		long b = sc.nextLong();
		long x = sc.nextLong();
		sc.close();

		if (a == -1) {
			System.out.println(b / x + 1);
		} else {
			System.out.println(b / x - a / x);
		}
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define Yes(n) cout<<((n)?"Yes\n":"No\n")
#define pb push_back
using namespace std;
using ll = long long;

template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T abs(T x){return max(x,-x);}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm(T m,T n) {return m*n/gcd(m,n);}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm<T>(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
vector<string> split(const string&s,char d){vector<string>r;stringstream ss(s);string k;while(getline(ss,k,d))if(!k.empty())r.pb(k);return r;}

// Template ends here

int main() {
    int n, a, b; string s; cin >> n >> a >> b >> s;
    int cnt = 0, overseas_students = 0;
    
    for (char x: s) {
        bool pass = 0;

        switch (x) {
        case 'a':
            pass = cnt < (a + b);
            break;

        case 'b':
            pass = (cnt < (a + b)) && (overseas_students < b);
            overseas_students += pass;
            break;

        default:
            break;
        }
        
        Yes(pass); cnt += pass;
    }
    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int cnt=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(a%2==1)cnt++;
  }
  if(cnt%2==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD=1e9+7;
int main()
{
    string s; cin>>s;
    int c[100010];
    int n=s.size();
    c[0]=0;
    for(int i=0; i<n; i++){
        if(s[i]=='a') c[i+1]=(c[i]+1)%3;
        else c[i+1]=(c[i]+2)%3;
    }
    int nx[100010];
    int p[3][100010];
    for(int j=0; j<3; j++) p[j][n]=n;
    int imx=-1;
    for(int i=n-1; i>=0; i--){
        for(int j=0; j<3; j++) p[j][i]=p[j][i+1];
        p[c[i]][i]=i;
        if(imx==-1 && i<n-1 && s[i]==s[i+1]) imx=i;
        if(s[i]=='a') nx[i]=p[(c[i]+2)%3][i];
        else nx[i]=p[(c[i]+1)%3][i];
    }
    int dp[100010]={};
    int ans=0;
    for(int i=0; i<n; i++){
        int x=(c[n]-c[i]+3)%3;
        if(x!=0) (ans+=dp[i])%=MOD;
        if(x!=0 && (i==n-1 || i<=imx)) (++ans)%=MOD;
        else if(i>0 && i-1==imx && s[i]==s[i-1]) (ans+=(n-i-1)/2)%=MOD;
        (dp[i+1]+=dp[i])%=MOD;
        (dp[nx[i]]+=dp[i]+1)%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2816
// #include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <cstring>
#include <queue>
#define MAXN 200005
#define INF (1e9+7) 
#define ll long long
using namespace std;

int N,M,d[55],a,b,cnt;
vector<int> v[55];
queue<int> q;
int main(){
	scanf("%d%d",&N,&M);
	for(int i = 0;i<M;i++){
		scanf("%d%d",&a,&b);
		d[a]++,d[b]++;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for(int i = 1;i<=N;i++){
		if(d[i] == 1){
			q.push(i);
		}
	}
	while(!q.empty()){
		int t = q.front();
		//printf("%d\n",t);
		q.pop();
		d[t]--;
		cnt++;
		for(int i = 0;i<v[t].size();i++){
			d[v[t][i]]--;
			if(d[v[t][i]] == 1){
				q.push(v[t][i]);
			}
		}
	}
	printf("%d\n",min(cnt,N-1));
} 

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[105];
	while (~scanf("%s", s))
	{
		int len = strlen(s);
		printf("%c%d%c\n", s[0], len-2, s[len-1]);
	}
	return 0;
}

Measured memory_bytes: 128