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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<int32> a(n);
    map<int32,int32> amap;
    REP(i,n){
        cin >> a[i];
        amap[a[i]]++;
    }
    if(n % 3 != 0){
        if(amap[0] == n){
            Yes(true);
            return 0;
        }
        Yes(false);
        return 0;
    }
    int32 sum = 0;
    for(auto iter = amap.begin(); iter != amap.end(); ++iter){
        int32 f,s;
        tie(f,s) = *iter;
        if(s % (n / 3) != 0){
            Yes(false);
            return 0;
        }
        REP(i, s / (n / 3))sum ^= f;
    }
    if(sum != 0){
        Yes(false);
        return 0;
    }
    Yes(true);
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
// const ll mod = 998244353;
const ll MAX = 2100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }







void solve(){
    ll x;
    cin>>x;
    if(x>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);


    solve(); 


    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <queue>

using namespace std;

static const int MAX = 1000000;
static const int INFTY = (1 << 21);

int n;
vector<pair<int, int> > M[MAX];

void dijkstr(){
    int d[MAX];
    priority_queue<pair<int, int>,vector<pair<int, int> >, greater<pair<int, int> > > pq;
    fill(d, d+n, INFTY);
    
    pq.push(make_pair(0, 0));
    
    while(!pq.empty()){
        pair<int, int> f = pq.top(); pq.pop();
        int u = f.second;
        if(d[u] != INFTY) continue;
        d[u] = f.first;
        for(int i=0; i<M[u].size(); i++){
            pq.push(make_pair(f.first+M[u][i].first, M[u][i].second));
        }
    }
    
    for(int i=0; i<n; i++)
        cout << i << " " << d[i] << endl;
    
}


int main(int argc, const char * argv[]) {
    // input from txt
    /////////
    //write//
    /////////
    
    cin >> n;
    int u, k ,v, c;
    
    for(int i=0; i<n; i++){
        cin >> u >> k;
        for(int j=0; j<k; j++){
            cin >> v >> c;
            M[u].push_back(make_pair(c, v));
        }
    }
    
    dijkstr();
    
    return 0;
}



Measured memory_bytes: 35132
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

#define YES(condition) if(condition) cout << "YES" << endl; else cout << "NO" << endl
#define Yes(condition) if(condition) cout << "Yes" << endl; else cout << "No" << endl
#define POSS(condition) if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl
#define Poss(condition) if(condition)cout << "Possible" << endl; else cout << "Impossible" << endl
#define First(condition) if(condition)cout << "First" << endl; else cout << "Second" << endl
#define negative(condition, num) if(condition)cout << -1 << endl; else cout << num << endl
long power(long base, long exponent, long mod){ if(exponent % 2){ return power(base, exponent - 1, mod) * base % mod; }else if(exponent){ long root_ans = power(base, exponent / 2, mod); return root_ans * root_ans % mod; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define bitcount(n) __builtin_popcount(n)

int main(){
    int N;
    cin >> N;
    long sum = 0;
    map<long, long> sum_count;
    sum_count[0]++;
    for(int i = 1; i <= N; i++){
        long num;
        cin >> num;
        sum += num;
        sum_count[sum]++;
    }
    long ans = 0;
    for(auto i: sum_count){
        ans += i.second * (i.second - 1) / 2;
    }
    cout << ans << endl;
}



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

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,a,n) for(int i=0;i<n;i++)

using namespace std;

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

	int k;
	vector<int> a(5);
	for(int i=0;i < 5;i++){
		cin >> a[i];
	}
	cin >> k;
	string ans;
	bool f = false;
	for(int i = 0; i < 4; i++)
	{
		for(int j = i+1; j < 5; j++)
		{
			if(a[j]-a[i] > k)f = true;
		}
		
	}
	ans = f ? ":(":"Yay!";
	cout << ans << endl;
   
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

    int N,K;
    int i,j,kai;
    scanf("%d %d",&N,&K);

    int flag[N],l;

    for(l=0;l<N;l++){
        flag[l]=0;
    }

    for(i=0;i<K;i++){
        scanf("%d",&kai);
        int arr[kai];
        for(j=0;j<kai;j++){
            scanf("%d",&arr[j]);
            flag[arr[j]-1]=1;
        }
    }
    int count=0,m;
    for(m=0;m<N;m++){
        if(flag[m]==0){
            count++;
        }
    }

    printf("%d",count);
    return 0;

}

Measured memory_bytes: 1732
object Main extends App {

  import scala.io.StdIn._

  val n = readLine.trim.toInt
  val slimes = readLine.trim.split(' ').map(_.toInt)
  println(minMergeCost(slimes))
  def minMergeCost(slimes: Array[Int]): Long = {
    val memo = Array.tabulate(slimes.length){l ⇒ Array.tabulate(slimes.length - l){_ ⇒ -1L}}
    val sum = slimes.map{_.toLong}.also{arr ⇒
      for (i ← 1 until arr.length){
        arr(i) += arr(i - 1)
      }
    }
    def sumSize(left: Int, right: Int): Long = {
      if (left == 0) sum(right)
      else sum(right) - sum(left - 1)
    }
    def sub(left: Int, right: Int): Long = {
      if (left == right) 0L
      else if (memo(left)(right - left) >= 0) memo(left)(right - left)
      else {
        (left until right).map{split ⇒ sub(left, split) + sub(split + 1, right) + sumSize(left, split) + sumSize(split + 1, right)}.min.also{min ⇒ memo(left)(right - left) = min}
      }
    }
    sub(0, slimes.length - 1)
  }
  implicit class Extend[T](value: T){
    def also(func: T ⇒ Unit): T = {func(value); value}
    def let[A](func: T ⇒ A): A = func(value)
  }
}

Measured memory_bytes: 117708
#include<iostream>
#include<cstdlib>

using namespace std;

void CountingSort(int A[],int B[],int k,int n);

int main(){
	int n,*A,*B;
	cin>>n;
	A = new int[n]; B = new int[n];
	A = A-1; B = B-1;

	int k=0;
	for(int i=1;i<=n;i++){
		cin>>A[i];
		k = (k<A[i])? A[i]:k;
	}

	CountingSort(A,B,k,n);

	for(int i=1;i<=n;i++){
		if(i-1) cout<<" ";
		cout<<B[i];
	}
	cout<<endl;

	delete [] (A+1),delete [] (B+1);

}

void CountingSort(int A[],int B[],int k,int n){
	int *C; C = new int[k+1];
	for(int i=0;i<=k;i++) C[i] = 0;

	for(int j=1;j<=n;j++) C[A[j]]++;

	for(int i=1;i<=k;i++) C[i] = C[i]+C[i-1];

	for(int j=n;j>=1;j--){
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
	
	delete [] C;
}

Measured memory_bytes: 18328
#include "bits/stdc++.h"
using namespace std;

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	string s, t; read(s, t);
	int a = 0;
	rep(i, 0, sz(s)) a += (s[i] != t[i]);
	write(a);
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n, q;
  std::cin >> n >> q;
  std::vector<std::tuple<int64_t, bool, int64_t>> st(2 * n);
  for (int64_t i = 0; i < n; i++) {
    int64_t s, t, x;
    std::cin >> s >> t >> x;
    st[2 * i] = std::make_tuple(s - x, true, x);
    st[2 * i + 1] = std::make_tuple(t - x, false, x);
  }
  std::vector<std::pair<int64_t, int64_t>> d(q);
  for (int64_t i = 0; i < q; i++) {
    int64_t v;
    std::cin >> v;
    d[i] = std::make_pair(v, i);
  }
  std::sort(st.begin(), st.end());
  std::sort(d.begin(), d.end());

  std::vector<int64_t> ansd(q);

  int64_t ans = -1;
  auto itr = d.cbegin();
  std::set<int64_t> can;
  for (const auto &i : st) {
    if (std::get<1>(i)) {
      can.insert(std::get<2>(i));
    } else {
      can.erase(std::get<2>(i));
    }
    while (itr != d.cend() && itr->first < std::get<0>(i)) {
      ansd[itr->second] = ans;
      itr++;
    }
    if (can.empty()) {
      ans = -1;
    } else {
      ans = *can.cbegin();
    }
  }
  while (itr != d.cend()) {
    ansd[itr->second] = -1;
    itr++;
  }

  for (const auto i : ansd) {
    std::cout << i << std::endl;
  }

  return 0;
}


Measured memory_bytes: 24704
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define pi 3.14159265358979323846
#define endl '\n'
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main()
{
    double a,b,h,m;
    cin>>a>>b>>h>>m;

    double ang=min(360-abs(5.5*m-30*h),abs(5.5*m-30*h));
    double rad=pi*ang/double(180);
    double c=cos(rad);
    double dist_sq=a*a+b*b-2*a*b*c;
    double ans=sqrt(dist_sq);

    printf("%.12f\n",ans);
    return 0;
}


Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 200005;
ll sumA[maxn], sumB[maxn];
int ans,n, m, k, x;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) cin >> x, sumA[i] = sumA[i - 1] + x;
    for (int i = 1; i <= m; i++) cin >> x, sumB[i] = sumB[i - 1] + x;
    for (int i = 0; i <= n && sumA[i] <= k; i++) {
        int rem = k - sumA[i];
        int Index = upper_bound(sumB, sumB + m + 1, rem) - sumB;
        ans = max(ans, i + Index - 1);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 6780
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;

int abs(int num){
   if (num > 0)
      return num;
   else
      return -num;
}

int main(){
  int A,B;
  cin >> A >> B;
  vector<int> retu{1,3,1,2,1,2,1,1,2,1,2,1};
  if(retu.at(A-1) == retu.at(B-1)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

string s;
int n, k;
ll dp[1010][5][2];

ll dfs(int i = 0, int x = 0, bool l = true) {
  if (i == n) return x == k;
  if (x > k) return 0;
  ll &cc = dp[i][x][l];
  if (~cc) return cc;

  ll ans = 0;
  int u = l ? s[i]-'0' : 9;
  loop(d,0,u+1) {
    ans += dfs(i + 1, x + (d != 0), l && d == u);
  }
  return cc = ans;
}

int main() {
  cin >> s;
  cin >> k;
  n = s.size();
  memset(dp, -1, sizeof(dp));
  cout << dfs() << endl;
  return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  map<char, string> m;
  in(m['a'], m['b'], m['c']);
  char t = 'a';
  while (m[t].size()) {
    char tmp = m[t][0];
    m[t] = m[t].substr(1);
    t = tmp;
  }
  print((char)(t - 'a' + 'A'));
}


Measured memory_bytes: 256
#include <iostream>


using namespace std;


void print_arr(int arr[], int size)
{
    for (int i = 0; i < size - 1; i++)
        cout << arr[i] << " ";
    cout << arr[size - 1] << endl;
}


void bubble_sort(int A[], int N, int *cnt)
{
    for (int i = 0; i < N - 1; i++) {
        for (int j = 0; j < N - 1 - i; j++) {
            if (A[j] > A[j + 1]) {
                int t = A[j + 1];
                A[j + 1] = A[j];
                A[j] = t;
                (*cnt)++;
            }
        }
    }
}


int main(void)
{
    int N;
    int A[101];

    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];

    int cnt = 0;
    bubble_sort(A, N, &cnt);
    print_arr(A, N);
    cout << cnt << endl;

    return 0;
}



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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
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 A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  ios_base::sync_with_stdio(false);

  int x;
  cin >> x;

  if (x < 600)
    cout << 8;
  else if (x < 800)
    cout << 7;
  else if (x < 1000)
    cout << 6;
  else if (x < 1200)
    cout << 5;
  else if (x < 1400)
    cout << 4;
  else if (x < 1600)
    cout << 3;
  else if (x < 1800)
    cout << 2;
  else
    cout << 1;

  cout << '\n';
  return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define INF 1e9;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	map<int,int> m;
	for(int i=0;i<n;i++){
		cin>>a[i];
		m[a[i]]++;
	}
	int b[n];
	int len=0;
	foreach(m,itr){
		b[len]=itr->second;
		len++;
	}
	sort(b,b+len);
	int ans=0;
	for(int i=0;i<len-k;i++){
		ans+=b[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 11136
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 21:23:16 2020
"""

import sys
from collections import deque
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

#N = int(input())
N, X, Y = map(int,input().split())
#A = list(map(int,input().split()))

X -= 1
Y -= 1
ans = [0 for i in range(N)]

for i in range(N):
    q = deque([i])
    counta = 0
    visited = [False for i in range(N)]
    visited[i] = True
    while len(q) > 0:
        buf = []
        for j in range(len(q)):
            a = q.popleft()
            b1, b2 = a+1, a-1
            if b1 >= 0 and b1 < N and not visited[b1]:
                q.append(b1)
                ans[counta] += 1
                visited[b1] = True
            if b2 >= 0 and b2 < N and not visited[b2]:
                q.append(b2)
                ans[counta] += 1
                visited[b2] = True
            if a == X:
                b3 = Y
            elif a == Y:
                b3 = X
            else:
                b3 = i
            if b3 >= 0 and b3 < N and not visited[b3]:
                q.append(b3)
                ans[counta] += 1
                visited[b3] = True
        counta += 1
#        print(i,q,a,b1,b2)
#    print(ans)

for i in range(N-1):
    print(ans[i]//2)
            
        

Measured memory_bytes: 61148
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
end


arr = []
inputs.each do |a_i|
  arr << [a_i[0], (10 - a_i[0]%10)%10]
end

pd arr
arr.sort_by! {|e_i| e_i[1]}
pd arr

ans = 0
arr.size.times do |i|
  if i == arr.size - 1
    ans += arr[i][0]
  else
    ans += arr[i][0] + arr[i][1]
  end
end

puts ans

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

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

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

int main()
{
    int D;
    scanf("%d", &D);
    if(D==25)
    {
        printf("Christmas");
    }
    else if (D==24)
    {
        printf("Christmas Eve");
    }
    else if (D==23)
    {
        printf("Christmas Eve Eve");
    }
    else if (D==22)
    {
        printf("Christmas Eve Eve Eve");
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
 
 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long K = sc.nextLong();
        long ans;
        if(A<K) {
        	B=B-K+A;
        	if(B<0) {
        		B=0;
        	}
        	A=0;
        } else {
        	A=A-K;
        }
        
        System.out.println(A+" "+B);
        		
    }
}

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

int baisu(int x,int y,int z);

int main(){
  int L,R;
  cin>>L>>R;
  int s,t,u,v,x,y;
  s=L%673;
  t=L%3;
  u=R%673;
  v=R%3;
  x=L%2019;
  y=R%2019;
  if(R-L>=672)
    cout<<0<<endl;
  else if(R-L>=2){
    if(s>u)
      cout<<0<<endl;
    else{
      int count=0;
      vector<int> vec((R-L+1)*(R-L)/2);
      for(int i=L;i<R;i++){
        for(int j=i+1;j<R+1;j++){
          vec.at(count)=((i%2019)*(j%2019))%2019;
          count++;
        }
      }
      sort(vec.begin(),vec.end());
      cout<<vec.at(0)<<endl;
    }
  }
  else
    cout<<(x*y)%2019<<endl;
}

Measured memory_bytes: 640
import sys

N, M = [int(_) for _ in input().split()]
SC = [[int(_) for _ in input().split()] for i in range(M)]

if N == 1:
    start = 0
    end = 10
else:
    start = 10 ** (N - 1)
    end = 10 ** N

for i in range(start, end):
    ans = list(map(int, str(i)))
    valid = True
    for s, c in SC:
        if ans[s-1] != c:
            valid = False
            break
    if valid:
        print(i)
        sys.exit()

print(-1)


Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string seikai="keyence";
  string S;
  cin >>S;
  int N;
  N=S.size();
  bool a1=false;
  bool a2=false;
  bool a3=false;
  bool a4=false;
  bool a5=false;
  bool a6=false;
  bool a7=false;
  if(S[0]=='k'){
     a1=true;
    if(S[1]=='e'){
       a2=true;
      if(S[2]=='y'){
         a3=true;
        if(S[3]=='e'){
           a4=true;
          if(S[4]=='n'){
             a5=true;
            if(S[5]=='c'){
               a6=true;
              if(S[6]=='e'){
                 a7=true;
              }
             }
           }
         }
       }
     }
   }
  if(S[N-1]=='e'){
     a7=true;
    if(S[N-2]=='c'){
       a6=true;
      if(S[N-3]=='n'){
         a5=true;
        if(S[N-4]=='e'){
           a4=true;
          if(S[N-5]=='y'){
             a3=true;
            if(S[N-6]=='e'){
               a2=true;
              if(S[N-7]=='k'){
                 a1=true;
              }
             }
           }
         }
       }
     }
   }
  if(a1==true&&a2==true&&a3==true&&a4==true&&a5==true&&a6==true&&a7==true){
   cout<<"YES";
  }else{
    cout <<"NO"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}

int main(){
	int n;
	cin>>n;
	vi a(n);
	for(auto&i:a)cin>>i;
	sort(all(a));
	int m=a.back();
	a.pop_back();
	auto b=a;
	for(auto&i:b)i=min(i,m-i);
	int p=*max_element(all(b));
	if(find(all(a),p)==a.end()) p=m-p;
	cout<<m<<" "<<p<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  for (int i = 0; i < n; i++){
    if(a[i]%2 == 0){
      if(a[i] %3 == 0 || a[i] %5 == 0){
        continue;
      }else{
        cout << "DENIED\n";
        return 0;
      }
    }
  }
  cout << "APPROVED\n";
  return 0;
}

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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int n, k;
	cin >> n >> k;

	cout << (int)(log(n) / log(k)) + 1 << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;

  int c,d;
  cin >>a >> b>> c>> d;
  cout <<max(a*b,c*d) fin;
  
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



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

const long long INF = 1LL<<60;

int main() {
    int n;
    cin >> n;
    int h[100010];
    for (int i = 0; i < n; i++) cin >> h[i];

    long long dp[100010];
    for (int i = 0; i < 100010; i++) dp[i] = INF;

    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        if (i < n - 1) dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }

    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
  private static 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;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int[] a = sc.nextIntArray(n);
    int i = 0;
    int last = 0;
    while (true) {
      while (i < n && a[i] != last + 1) i++;
      if (i < n) last++;
      else break;
    }
    if (last == 0) System.out.println(-1);
    else System.out.println(n - last);
  }
}

Measured memory_bytes: 47316
#include <bits/stdc++.h>
using namespace std;
#define N 55
#define S 5005
#define ll long long
#define set(a,v) memset(a,v,sizeof(a))
int n,m,s,lim=5e3,c[N],d[N];bool vs[N];ll dp[N][S];
struct Edge {int v,a,b;};vector<Edge> e[N];queue<int> q;
void addE(int u,int v,int a,int b)
{
	e[u].push_back((Edge) {v,a,b});
	e[v].push_back((Edge) {u,a,b});
}
void SPFA()
{
	set(dp,0x3f);dp[1][s]=0;vs[1]=1;q.push(1);
	while(!q.empty())
	{
		int u=q.front();q.pop();vs[u]=0;
		for(int i=c[u];i<=lim;++i)
			dp[u][i]=min(dp[u][i],dp[u][i-c[u]]+d[u]);
		for(int i=0,v,a,b,fl;i<e[u].size();++i)
		{
			v=e[u][i].v;a=e[u][i].a;b=e[u][i].b;fl=0;
			for(int j=a;j<=lim;++j) if(dp[u][j]+b<dp[v][j-a])
				dp[v][j-a]=dp[u][j]+b,fl=1;
			if(fl && !vs[v]) vs[v]=1,q.push(v);
		}
	}
}
int main()
{
	scanf("%d %d %d",&n,&m,&s);s=min(s,lim);
	for(int i=1,u,v,a,b;i<=m;++i)
		scanf("%d %d %d %d",&u,&v,&a,&b),addE(u,v,a,b);
	for(int i=1;i<=n;++i) scanf("%d %d",&c[i],&d[i]);SPFA();
	for(int i=2;i<=n;++i)
	{
		ll res=1e18;
		for(int j=0;j<=lim;++j) res=min(res,dp[i][j]);
		printf("%lld\n",res);
	}return 0;
}

Measured memory_bytes: 5948
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <unordered_map>
#include <iomanip>

using namespace std;

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

	long double ans = 0;

	std::cout << std::fixed << std::setprecision(10);

	for (int i = 0; i < N; i++) {
		double num;
		cin >> num;
		ans += 1.0 / num;
		
	}
	cout << 1.0 / ans << endl;
}



Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

func init() {
	sc = bufio.NewScanner(os.Stdin)
	buffsize := 1000000
	buff := make([]byte, buffsize)
	sc.Buffer(buff, buffsize)
	sc.Split(bufio.ScanWords)
}

func loadint() (result int) {
	sc.Scan()
	result, _ = strconv.Atoi(sc.Text())
	return
}

func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func calc(n, m int) int {
	if n == 1 {
		return m
	}
	q := int(math.Sqrt(float64(m)))
	result := 1
	for i := q; i >= 1; i-- {
		if m%i == 0 {
			r := i
			if m/r >= n {
				if r > result {
					result = r
				}
			}
			r = m / i
			if i >= n {
				if r > result {
					result = r
				}
			}
		}
	}
	return result
}

func calc1(n, m int) int {
	result := 1
	a := 1
	for true {
		b := m - (a * (n - 1))
		if b < 1 {
			break
		}
		x := gcd(a, b)
		if x > result {
			result = x
		}
		a++
	}
	return result
}

func check() {
	for n := 2; n < 130; n++ {
		for m := n; m < 1000; m++ {
			result := calc(n, m)
			r1 := calc1(n, m)
			if r1 != result {
				fmt.Println(n, m, result, r1)
			}
		}
	}
}

func main() {
	n := loadint()
	m := loadint()
	// check()
	result := calc(n, m)
	fmt.Println(result)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
const int N=1e4+10;
int best[N];
int a[N][N];
struct paiir
{
    int a;
    int b;
};
std::vector<paiir> pairs;

int main(){

    
    int h,n;
    cin>>h>>n;
    pairs.resize(n);
    fo(i,n){
        cin>>pairs[i].a>>pairs[i].b;
    }
    best[0]=0; 
    FOR(i,1,h){
        FOR(j,0,n-1){
            if(i-pairs[j].a<=0) a[i][j]=0+pairs[j].b;
            else a[i][j]=best[i-pairs[j].a]+pairs[j].b;
        }
        int miin=a[i][0];
        FOR(k,1,n-1) miin=min(miin,a[i][k]);
        best[i]=miin;
    }

   /* FOR(i,1,h){
        FOR(j,0,n-1){
            cout<<a[i][j]<<" ";
        }
       
        cout<<endl;
    }*/

    cout<<best[h]<<endl;

}

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

int main() {
  int N, M, Q, l, r, p, q;
  cin >> N >> M >> Q;
  int s[N+1][N+1];
  for (int i=0; i<=N; i++) {
    for (int j=0; j<=N; j++) {
      s[i][j] = 0;
    }
  }
  for (int i=0; i<M; i++) {
    scanf("%d %d", &l, &r);
    s[l][r]++;
  }
  for (int i=1; i<=N; i++) {
    for (int j=1; j<=N; j++) {
      s[i][j] = s[i][j-1] + s[i-1][j] - s[i-1][j-1] + s[i][j];
    }
  }
  for(int i=0; i<Q; i++) {
    scanf("%d %d", &p, &q);
    cout << s[q][q] - s[q][p-1] - s[p-1][q] + s[p-1][p-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1920
n=int(input())
A=list(map(int,input().split()))

d={
    2:0,
    4:0,
    1:0
}

for a in A:
    if a%4==0:
        d[4]+=1
    elif a%2==0:
        d[2]+=1
    else:
        d[1]+=1

if d[2]>0:
    d[1]+=1

if d[1]<=d[4]+1:     # x4x4x4xみたいな感じ
    print("Yes")
else:
    print("No")

Measured memory_bytes: 15020
x = int(input())

n = []
# for i in range(x):
#     n[i] = int(input())
n = [int(e) for e in input().split()]

def cal(n):
    count = 0
    for i in range(len(n)):
        if n[i] % 2 == 0:
           if n[i] % 3 == 0 or n[i] % 5 == 0:
                count += 1
        else:
            count += 1
    if count == len(n):
        print("APPROVED")
    else:
        print("DENIED")

cal(n)


Measured memory_bytes: 3060
package main

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

func main() {

	var search_word string
	fmt.Scanln(&search_word)

	all_words := make(map[string]int)

	scanner := bufio.NewScanner(os.Stdin)

	for {
		scanner.Scan()
		in_string := scanner.Text()

		if in_string == "END_OF_TEXT" {
			break
		}

		words := strings.Split(in_string, " ")

		for _, word := range words {
			trimed_word := strings.Trim(word, "!?.,;:'\"*+-%#")
			all_words[u2l(trimed_word)] += 1
		}
	}

	num, _ := all_words[search_word]
	fmt.Println(num)
}


func u2l(word string) string {

	u2lword := ""
	for _, r := range word {
		if ('A' <= r) && (r <= 'Z') {
			r += 'a' - 'A'
		}
		u2lword += string(r)
	}
	return u2lword
}



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

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

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

#define M_PI       3.14159265358979323846

using namespace std;

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

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

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

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

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

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

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

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

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

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

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

int solve()
{
    int N, K;

    std::cin >> N >> K;

    int digits = 0;

    while (N > 0) {
        ++digits;
        N /= K;
    }

    return digits;
}

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

    return 0;
}

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

#define START   1
#define INIT    0
#define TRUE    1

int main() {

    int iCounter    = START;
    int x           = INIT;

    while (TRUE) {
        cin >> x;
        if (x == INIT) {
            break;
        }
        else {
            cout << "Case " << iCounter << ": " << x << endl;
            iCounter++;
        }
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<ll(n); i++)
#define REPR(i, n) for(ll i=n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=m; i<ll(n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int h,w,m; 
  cin >> h >> w >> m;
  vector<P> col(w), row(h);
  REP(i,w) col[i].second = i;
  REP(j,h) row[j].second = j;
  set<P> be;
  REP(k,m){
    int x,y;
    cin >> y >> x;
    y--, x--;
    row[y].first++, col[x].first++;
    be.emplace(y,x);
  }

  sort(ALL(col), greater<P>());
  sort(ALL(row), greater<P>());


  int tmp = col[0].first + row[0].first;
  REP(i,h){
    if(row[0].first>row[i].first) break;
    REP(j,w){
      if(col[0].first>col[j].first) break;
      
      auto [numh, y] = row[i];
      auto [numw, x] = col[j];
      if(be.count({y, x})==0){
        cout << tmp << '\n';
        return 0;
      }
    }
  }
  cout << tmp-1 << '\n';
  
  return 0;
}


Measured memory_bytes: 21944
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    for(int i=1; i<=b; i++){
        if(a*i%b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    
}



Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(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 REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>



int main() {
	ll n;
	cin >> n;
	cout << n * n * n << endl;
}
	


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

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

    int cnt = 0;
    for(int i = a; i <= b; i++){
        string tmp = to_string(i);
        if(tmp[0] == tmp[4] && tmp[1] == tmp[3]){
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007
using namespace std;
int main(){
    int a,b;    cin>>a>>b;
    if(a<b) cout<<"a < b"<<endl;
    if(a>b) cout<<"a > b"<<endl;
    if(a==b) cout<<"a == b"<<endl;
}


Measured memory_bytes: 3108
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    int k;
    cin >> n >> k;
    ld ans = 0;
    rep(i, n) {
        ld cnt = 1;
        int x = i+1;
        while(x < k) {
            x <<= 1;
            cnt /= 2;
        }
        ans += cnt;
    }
    ans /= ld(n);
    cout << ans << endl;
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int cn=0;
    for(int i=0;i<n;i++){
        int min=a[i];
        int num=i;
        for(int j=i;j<n;j++){
            if(min>a[j]){
                min=a[j];
                num=j;
            }
        }
        if(a[i]>min){
            swap(a[i],a[num]);
            cn++;
        }
    }
    for(int i=0;i<n;i++){
        if(i!=0) cout<<" ";
        cout<<a[i];
    }
    cout<<endl;
    cout<<cn<<endl;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 1e5 + 10;
int cnt[maxn];
map<ll, ll> M;
int f(int x)
{
	unordered_set<int> S;
	for(int i = 0, j = x; i <= j; ++i, --j)
		S.insert(i ^ j);
	return S.size();
}
ll F(ll x)
{
	//a(2k) = 2*a(k-1) + a(k); a(2k+1) = 2*a(k) + a(k-1)
	if(x == 0) return 1;
	if(x == 1) return 2;
	if(M.find(x) == M.end())
	{
		ll mid = x >> 1;
		if(x & 1) return M[x] = (2 * F(mid) + F(mid - 1)) % mod;
		else return M[x] = (2 * F(mid - 1) + F(mid)) % mod;
	}
	return M[x];
}
int main()
{
	/*
	const int n = 1422;
	for(int i = 0; i <= n; ++i) cnt[i] = f(i);
	for(int i = 1; i <= n; ++i) cnt[i] += cnt[i - 1], cout << i << ' ' << cnt[i] << endl;
	*/
	ll n;
	cin >> n;
	cout << F(n) << endl;
	return 0;
}

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

typedef long long ll;

int main()
{
    // 整数の入力
    int N;
    ll result = 0;
    cin >> N;
    vector<string> S[5];
    bool b[5];

    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        if (s[0] == 'M') {
            S[0].push_back(s);
        } else if (s[0] == 'A') {
            S[1].push_back(s);
        } else if (s[0] == 'R') {
            S[2].push_back(s);
        } else if (s[0] == 'C') {
            S[3].push_back(s);
        } else if (s[0] == 'H') {
            S[4].push_back(s);
        } else {
            // ignore
        }
    }

    //count
    int count = 0;
    for (int i = 0; i < 5; i++) {
        if (S[i].size() <= 0) {
            count++;
            b[i] = false;
        } else {
            b[i] = true;
        }
    }

    if (N - count <= 2) {
        cout << result << endl;
        return 0;
    }
  	
    if (b[0] && b[1] && b[2]) {
        result += S[0].size() * S[1].size() * S[2].size();
    } if (b[0] && b[1] && b[3]) {
        result += S[0].size() * S[1].size() * S[3].size();
    } if (b[0] && b[1] && b[4]) {
        result += S[0].size() * S[1].size() * S[4].size();        
    } if (b[0] && b[2] && b[3]) {
        result += S[0].size() * S[2].size() * S[3].size();    
    } if (b[0] && b[2] && b[4]) {
        result += S[0].size() * S[2].size() * S[4].size();
    } if (b[0] && b[3] && b[4]) {
        result += S[0].size() * S[3].size() * S[4].size();
    } if (b[1] && b[2] && b[3]) {
        result += S[1].size() * S[2].size() * S[3].size();
    } if (b[1] && b[2] && b[4]) {
        result += S[1].size() * S[2].size() * S[4].size();   
    } if (b[1] && b[3] && b[4]) {
        result += S[1].size() * S[3].size() * S[4].size();  
    } if (b[2] && b[3] && b[4]) {
        result += S[2].size() * S[3].size() * S[4].size();      
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 5748
from itertools import permutations
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    c1 = 0
    for per in permutations(range(1, n+1)):
        c1 += 1
        if per == p:
            break
    c2 = 0
    for per in permutations(range(1, n+1)):
        c2 += 1
        if per == q:
            break
    print(abs(c1-c2))


if __name__ == "__main__":
    main()


Measured memory_bytes: 39280