akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    int n, t;
    cin >> n >> t;
    vector<pair<int, int>> ab(n);
    rep(i, n) cin >> ab[i].first >> ab[i].second;

    sort(ab.begin(), ab.end());
    vector<vector<int>> dp(n + 1, vector<int>(t + 1, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= t; j++) {
            if (j - ab[i].first >= 0)
                dp[i + 1][j] = max(dp[i][j], dp[i][j - ab[i].first] + ab[i].second);
            else
                dp[i + 1][j] = dp[i][j];
        }
    }
    // for (auto v : dp) {
    //     for (int num : v) {
    //         cout << num << " ";
    //     }
    //     cout << endl;
    // }
    int ans = 0;
    for (int k = 0; k < n; k++) {
        ans = max(ans, dp[k][t - 1] + ab[k].second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> sum(n);
    sum[0] = a[0];
    for(int i = 1; i < n; i++) sum[i] = sum[i - 1] + a[i];

    ll mn = abs(sum[n - 1] - 2 * sum[0]);
    for(int i = 1; i < n - 1; i++){
        mn = min(mn, abs(sum[n - 1] - 2 * sum[i]));
    }
    cout << mn << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const LL INF=1<<17;



int main(){
    int N;
    cin >> N;
    set<string> st;
    string s[N];
    for(int i=0;i<N;i++){
        cin >> s[i];
        st.insert(s[i]);
    }    
    for(int i=0;i<N-1;i++){
        if(s[i][s[i].size()-1]!=s[i+1][0]){
            puts("No");
            return 0;
        }
    }
    if(st.size()!=N) puts("No");
    else puts("Yes");
    return 0;
}


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

struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }
	void init(int n) { par.assign(n, -1); }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N; 
	map<int, int>pi;//index,x
	vector<pair<int, int>>v(N);
	map<int, int>py;//y,x
	for (int n = 0; n < N; ++n) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		v[n] = {x,y};
		pi[n] = x;
		py[y] = x;
	}
	sort(v.begin(), v.end());
	UnionFind uf(N);
	priority_queue<int, vector<int>, greater<int> > q;
	for (int i = 0; i < N; ++i) {
		int y = v[i].second;
		int ysub = y;
		while (!q.empty()) {
			int y0 = q.top();
			q.pop();
			if (y0 > y) {
				q.push(y0);
				break;
			}
			else {
				ysub = min(ysub,y0);
				uf.merge(py[y], py[y0]);
			}
		}
		q.push(ysub);
	}
	for (int n = 0; n < N; ++n) {
		printf("%d\n", uf.size(pi[n]));
	}
	return 0;
}


Measured memory_bytes: 24188
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<stack>
#include<queue>
#include<map> 
#include<list>
#include<string>
#include<cstring>
#include<set>
#include<vector>
#define ll long long
#define memset(a,n) memset(a,n,sizeof(a))
#define mp make_pair 
#define pb push_back
using namespace std;
const int maxn = 1e6 + 100;

int main()
{
	int n,k;cin >> n >> k;
	int ans = n / (2 * k + 1);
	if(n % (2 * k + 1) != 0) ans++;
	cout << ans << endl;
}


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

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

  std::vector<int> dn(N);
  for (auto &d : dn) {
    std::cin >> d;
  }

  uint64_t sum = 0;
  for (size_t i = 0; i < N; ++i) {
    for (size_t j = i + 1; j < N; ++j) {
      if (i == j) continue;
      sum += dn[i] * dn[j];
    }
  }
  std::cout << sum << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int dp[50];
  dp[0]=dp[1]=1;
  for(int i=2; i<50; i++){
    dp[i] = dp[i-1]+dp[i-2];
  }
  //rep(i,50) cout << dp[i] << " ";
  int n;
  cin >> n;
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 3092
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int 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; }
// ---------------------------------------------------------------------------

int dp[4100][4100];
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S,T;
  while(cin >> S){
    cin >> T;
    int N = S.size();
    int M = T.size();
    for(int i=0; i<N+1; i++){
      for(int j=0; j<M+1; j++){
        dp[i][j] = 0;
      }
    }
    int ans = 0;
    for(int i=0; i<N; i++){
      for(int j=0; j<M; j++){
        if(S[i] == T[j]){
          chmax(dp[i+1][j+1],dp[i][j]+1);
          chmax(ans,dp[i+1][j+1]);
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}


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

using namespace std;

int main() {

	

	string s;
	int counta = 0, countb = 0, countc = 0;
	getline(cin, s);

	for(int i = 0; i < 3; i++) {
		if(s[i] == 'a') counta++;
		if(s[i] == 'b') countb++;
		if(s[i] == 'c') countc++;
	}

	if(counta == 1 && countb == 1 && countc == 1) printf("Yes\n");
	else printf("No\n");

	return 0;

}

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    int one = distance(A.begin(), find(A.begin(), A.end(), 1));
  
    int ans = (N-1) / (K-1);
    if ((N-1) % (K-1) != 0) {
        ans += 1;
    }
    print(ans);
}

signed main() {
    solve();
}


Measured memory_bytes: 1024
#include<iostream>
#include<memory.h>
using namespace std;
int arr[10],used[10];
void DFS(int pre,int cur)
{
   if(cur<10&&arr[pre]<arr[cur])
   {
	   used[cur]=1;
	   DFS(cur,cur+1);
   }
   else if(cur<10&&arr[pre]>=arr[cur])
	   DFS(pre,cur+1);
}
int main()
{
   int T,pre;
   bool judge;
   cin>>T;
   while(T--)
   {
     for(int i=0;i<10;i++)
		 cin>>arr[i];
	 for(int i=0;i<10;i++)
	 {
		 memset(used,0,sizeof(used));
		 used[i]=1;
	     DFS(i,i+1);
		 judge=false;
		 pre=0;
	     for(int j=0;j<10;j++)
		    if(used[j]==0)
				if(pre>=arr[j])
			{
				judge=true;
				break;
			}else pre=arr[j];
		 if(!judge)
		 {
			 cout<<"YES"<<endl;
			 break;
		 }
	 }
	 if(judge)cout<<"NO"<<endl;
   }

}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class Program
{


    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        int n = sc.intarr[0];
        if (n <= 999) wr.wri("ABC");
        else wr.wri("ABD");
    }


}
    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13268
/***********************************************************
?????卒????卒??????属????則贈
O(???N)
 ***********************************************************/

#include <vector>

std::vector<long long> compute_factors(long long n){
    std::vector<long long> factors;
    for (long long i = 2; i * i <= n; i++){
        while(n % i == 0){
            factors.push_back(i);
            n /= i;
        }
    }
    if (n > 1) factors.push_back(n);
    return factors;
}

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    ll n;
    while(cin >> n){
        vector<ll> factors = compute_factors(n);
        cout << n << ":";
        for (size_t i = 0; i < factors.size(); i++) cout << " " << factors[i];
        cout <<endl;
    }
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#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 pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }

  ll ans = 0;
  ll cur = 1;
  rep(i, 0, N) {
    if (a[i] != cur) {
      ans++;
      continue;
    }

    cur++;
  }

  if (cur == 1) {
    put(-1);
    return 0;
  }
  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;

ll ans;


long double pi = 3.14159265359;



ll gcd(ll a, ll b){ 
    if(b == 0) return a;
    return gcd(b,a%b);
}

vector<int> factorize(ll n){
    vector<int> resvec;
    for(ll i= 2;i*i <= n; ++i){
        if(n%i) continue;
        resvec.push_back(i);
        while(n%i == 0){
            n = n/i;
        }
    }
    if(n != 1) resvec.push_back(n);
    return resvec;
}

int main(){
    ll a,b;
    cin >> a >> b;
    ll g = gcd(a,b);
    // cout << g << endl;
    vector<int> v = factorize(g);
    ans = v.size() + 1;
    cout << ans << endl;

return 0;
}

Measured memory_bytes: 3604
N,B,C=map(int,input().split())
M=list(map(int,input().split()))
ans=0
for _ in range(N):
  L=list(map(int,input().split()))
  a=0
  for i in range(B):
      a+=M[i]*L[i]
  if a+C>0:
      ans+=1

print(ans)

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////
LL gcd(LL a, LL b) {
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}

void solve() {
	int N;
	LL X;
	cin >> N >> X;
	vector<LL> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		A[i] -= X;
		if (A[i] < 0) {
			A[i] = -A[i];
		}
	}
	if (N == 1) {
		cout << A[0] << endl;
		return;
	}
	LL ans = gcd(A[0], A[1]);
	for (int i = 2; i < N; ++i) {
		ans = gcd(ans, A[i]);
	}
	cout << ans << endl;
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n, a;
  cin >> n >> a;
  vl x(n);
  rep(i, n) {
    cin >> x[i];
  }

  constexpr ll limit = 51;
  vector<vector<vl>> dp(n+1, vector<vl>(limit, vl(limit*limit)));
  dp[0][0][0] = 1;
  rep(i, n) {
    rep(j, limit) {
      rep(k, limit*limit) {
        dp[i+1][j][k] += dp[i][j][k];
        if (j-1 >= 0 and k-x[i] >= 0) {
          dp[i+1][j][k] += dp[i][j-1][k-x[i]];
        }
      }
    }
  }

  ll ans = 0;
  for (ll i = 1; i*a < limit*limit and i < limit; i++) {
    ans += dp[n][i][i*a];
  }
  cout << ans << endl;
}


Measured memory_bytes: 54272
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  multiset<string> A;
  for (int i = 0; i < x; ++i) A.insert("a");
  for (int i = 0; i < y; ++i) A.insert("b");
  for (int i = 0; i < z; ++i) A.insert("c");
  for (int k = 1; k < x + y + z; ++k) {
    auto it1 = A.begin();
    auto it2 = prev(A.end());
    auto s = *it1 + *it2;
    A.erase(it1);
    A.erase(it2);
    A.insert(s);
  }
  cout << *A.begin() << endl;
  return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll X, Y;
  IN(X,Y);

  REP(i,X+1){
    ll t = i;
    ll k = X-i;
    if(t*4+k*2==Y){
      OUT("Yes");
      return 0;
    }
  }

  OUT("No");
  return 0;

  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>
#include <math.h>
#include <map>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

// ユークリッドの互除法
li gcd(li a,li b) {
    return a % b == 0 ? b : gcd(b, a % b);
}

// 素数判定
bool isPrime(li n) {
    for(li i = 0; i * i < n ; i++) {
        if (n % i == 0) return false;
    }
    return n != 1; // 1は例外
}

// 素因数分解
map<li, li> prime_factor(li n) {
    map<li, li> res;
    FOR(i, 0, sqrt(n)) {
        while(n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}
 
int main(void) {
    li N;
    cin >> N;
    li L[N];
    FOR(i, 0, N) {
        li tempL;
        cin >> tempL;
        L[i] = tempL;
    }

    li max = 0, maxIndex = 0, sumMinusMax = 0;
    FOR(i, 0, N) {
        sumMinusMax += L[i];
        if (max < L[i]) {
            max = L[i];
            maxIndex = i;
        }
    }

    li sum;
    sumMinusMax = sumMinusMax - max;
    
    if (max < sumMinusMax) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl; 
    }

    return 0;
}


Measured memory_bytes: 256
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
import math
n = int(input())

print(math.ceil(n/2))


Measured memory_bytes: 2940
N = int(input())
li = [[] for i in range(N)]
for i in range(N):
    a = int(input())
    for j in range(a):
        x, y = map(int, input().split())
        li[i].append((x-1, y))
num = (1<<N)-1
ans = 0
for i in range((1<<N)-1):
    ok = True
    for j in range(N):
        if (num>>j)&1:
            for xy in li[j]:
                (x, y) = xy
                if not (num>>x) & 1 == y:
                    ok = False
    if ok:
        cnt = 0
        for i in range(N):
            if num>>i&1:
                cnt += 1
        ans = max(ans, cnt)
    num -= 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int res = n % 10;
	if (res == 2 || res == 4 || res == 5 || res == 7 || res == 9) puts("hon");
	else if (res == 0 || res == 1 || res == 6 || res == 8) puts("pon");
	else puts("bon");
	return 0;
}

Measured memory_bytes: 3644
N = int(input())
 
def count_divisors(n):
    count = 0
    for i in range(1, n + 1):
        if n % i == 0:
            count += 1
    return count
 
ans = 0
for i in range(1, N + 1, 2):
    if count_divisors(i) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
long long dp[200010],ar[20010];
int main()
{
	long long n,i;
	scanf("%lld",&n);
	for(i=0;i<n;i++)
		scanf("%lld",ar+i);
	dp[n-1]=0;
	dp[n-2]=abs(ar[n-1]-ar[n-2]);
	for(i=n-3;i>=0;i--)
		dp[i]=min(dp[i+1]+abs(ar[i]-ar[i+1]),dp[i+2]+abs(ar[i]-ar[i+2]));
	printf("%lld\n",dp[0]);
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
int dp[105][100005];
int a[105],s[100005];
int n,k;
signed main(){
	scanf("%d%d",&n,&k);
	for(int i=0;i< n;i++)scanf("%lld",&a[i]);
	for(int j=0;j<=k;j++)dp[0][j]=0;
	for(int j=0;j<=n;j++)dp[j][0]=1;
	for(int i=1;i<=n;i++){
		s[0]=0;
		for(int j=1;j<=k+1;j++)s[j]=s[j-1]+dp[i-1][j-1];
		for(int j=1;j<=k;j++){
			dp[i][j]=s[j+1]-s[max(0ll,j-a[i-1])];
			dp[i][j] %=MOD;
		}
	}
	printf("%lld\n",dp[n][k]);
	return 0;
}

Measured memory_bytes: 80128
#include<bits/stdc++.h>
#define For(i,a,b) for(i=(a);i<=(b);++i)
#define Forward(i,a,b) for(i=(a);i>=(b);--i)
using namespace std;
template<typename T>inline void read(T &x)
{
	T s=0,f=1;char k=getchar();
	while(!isdigit(k)&&(k^'-'))k=getchar();
	if(!isdigit(k)){f=-1;k=getchar();}
	while(isdigit(k)){s=s*10+(k^48);k=getchar();}
	x=s*f;
}
void file()
{
	#ifndef ONLINE_JUDGE
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
	#endif
}
const int MAXN=11;
int n,ans,a[MAXN];
bool even;
void dfs(int x)
{
	if(x>n&&even)++ans;
	if(x>n)return;
	int i;
	For(i,-1,1)
	{
		a[x]+=i;
		if(!even&&a[x]%2==0)
		{
			even=true;
			dfs(x+1);
			even=false;
		}
		else dfs(x+1);
		a[x]-=i;
	}
}
int main()
{
	read(n);
	int i;
	For(i,1,n)read(a[i]);
	dfs(1);
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#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;

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

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    if (e - a > k) {
      cout << ":(\n";
    } else {
      cout << "Yay!\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n;
int a[200005];
int l[200005], r[200005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	for(int i = 1; i <= n; i++) l[i] = max(a[i], l[i-1]);
	for(int i = n; i >= 1; i--) r[i] = max(a[i], r[i+1]);
	
	for(int i = 1; i <= n; i++){
		cout << max(l[i-1], r[i+1]) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
//#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
    int H,W;
    cin>>H>>W;
    int cx,cy,dx,dy;
    cin>>cx>>cy>>dx>>dy;
    cx--;
    cy--;
    dx--;
    dy--;
    vector<vector<char> > S(H,vector<char>(W));
    vector<vector<int> > v(H,vector<int>(W,-1));
    for (int i=0;i<H;i++){
        for (int j=0;j<W;j++){
            cin>>S[i][j];
        }
    }
    typedef pair<int,int> pair;
    queue<pair> que1,que2;
    que1.push(pair(cx,cy));
    que2.push(pair(cx,cy));
    v[cx][cy]=0;
    int n=0;
    while(!que1.empty()){
        int x=que1.front().first;
        int y=que1.front().second;
        que1.pop();
        int vx[]={1,0,-1,0},vy[]={0,1,0,-1};
        for (int i=0;i<4;i++){
            if (x+vx[i]<H && x+vx[i]>=0 && y+vy[i]<W && y+vy[i]>=0 && S[x+vx[i]][y+vy[i]]=='.' && v[x+vx[i]][y+vy[i]]==-1){
                v[x+vx[i]][y+vy[i]]=n;
                que1.push(pair(x+vx[i],y+vy[i]));
                que2.push(pair(x+vx[i],y+vy[i]));
            }
            //if (x+vx[i]<H && x+vx[i]>=0 && y+vy[i]<W && y+vy[i]>=0 && S[x+vx[i]][y+vy[i]]=='.')    cout<<"hoge"<<x+vx[i]<<" "<<y+vy[i]<<" "<<n<<endl;
        }
        if (que1.empty()){
            n++;
            while (!que2.empty()){
                int a=que2.front().first;
                int b=que2.front().second;
                //cout<<a<<" "<<b<<endl;
                que2.pop();
                for (int i=-2;i<=2;i++){
                    for (int j=-2;j<=2;j++){
                        if (a+i<H && a+i>=0 && b+j<W && b+j>=0 && S[a+i][b+j]=='.' && v[a+i][b+j]==-1){
                            v[a+i][b+j]=n;
                            que1.push(pair(a+i,b+j));
                        }
                    }
                }
            }
            que2=que1;
        }
        if (v[dx][dy]!=-1){
            cout<<v[dx][dy]<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 8564
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	cout << 3 * N * N << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#define PII pair<int,int>
#define F first
#define S second
using namespace std;
double ans, pi=acos(-1.0);
PII a[200005], b[200005];
vector<int> v;

int main() {
	int x1, y1, x2, y2, n, M=1e9, bc=0;
	int i, t;
	scanf("%d%d%d%d%d", &x1, &y1, &x2, &y2, &n);
	for(i=0; i<n; i++) scanf("%d%d", &a[i].F, &a[i].S);
	if(x1>x2) swap(x1, x2), swap(y1, y2);
	if(y1>y2) {
		y1 = M-y1, y2 = M-y2;
		for(i=0; i<n; i++) a[i].S = M-a[i].S;
	}
	for(i=0; i<n; i++) {
		if(x1<=a[i].F && a[i].F<=x2 && y1<=a[i].S && a[i].S<=y2) b[bc++] = a[i];
	}
	sort(b, b+bc);
	for(i=0; i<bc; i++) {
		t = lower_bound(v.begin(), v.end(), b[i].S) - v.begin();
		if(t==v.size()) v.push_back(b[i].S);
		else v[t] = b[i].S;
	}
	ans = (x2-x1 + y2-y1) * 100.0 + v.size() * (5*pi - 20);
	if(v.size() == min(x2-x1, y2-y1)+1) ans += 5*pi;
	printf("%.15f", ans);
	return 0;
}

Measured memory_bytes: 4600
#include<iostream>
#include<bits/stdc++.h>
#include<climits>

#define forn(e,n,s) for(int i = e; i < n;i += s)
#define forr(e,n,s) for(int i = e; i >= n; i -= s)
#define PI 3.14159265358979323846264338327950L
#define ll long long

using namespace std;

const int MOD = 1e9+7;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout<<fixed;
  cout<<setprecision(20);

  #ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
  #endif
}


void solve(){
    string s;cin>>s;
    if(s.back()=='s') s += "es";
    else s+= 's';
    cout<<s;
}

int main(){
    go(); 

    // code here
    int t = 1;
    while(t--) solve();
   
}









Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <complex>
#include <cmath>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define X real()
#define Y imag()

using namespace std;
typedef complex<int> cld;
const cld imagine=cld(0,1);
typedef vector<cld> vcl;
vcl points;
bool point[5001][5001];
bool exist(cld c){
	if(c.X<0 || c.X>5000 || c.Y<0 || c.Y>5000)
	return false;
	if(point[c.X][c.Y])
	return true;
	return false;
}
int getSize(cld a,cld b ,cld c, cld d){
	int sx=a.X,sy=a.Y,ex=a.X,ey=a.Y;
	cld tar[]={b,c,d};
	REP(i,3){
		sx=min(sx,tar[i].X);
		sy=min(sy,tar[i].Y);
		ex=max(ex,tar[i].X);
		ey=max(ey,tar[i].Y);
	}
	cld dif=b-a;
	return (ex-sx)*(ey-sy)-abs(dif.X*dif.Y*2);
}
int squire(int a,int b){
	cld f=points[a],s=points[b];
	cld dif=s-f;
	cld t=s+(dif*imagine),fo=t+(-dif);
	if(exist(t) && exist(fo))
	return getSize(f,s,t,fo);
	return 0;
}
int main() {
	// your code goes here
	int n,tmp,tmpb;
	while(cin>>n && n){
	points.clear();
	REP(i,5001)
		REP(j,5001)
			point[i][j]=false;
	REP(i,n){
		cin >>tmp >> tmpb;
		points.push_back(cld(tmp,tmpb));
		point[tmp][tmpb]=true;
	}
	int maxim =0;
	REP(i,n)
		REP(j,i-1)
			maxim=max(maxim,squire(i,j));
	cout << maxim << endl;
	}
	return 0;
}

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

#define all(v)  begin(v), end(v)
#define endl    '\n';
#define int     long long
#define pii     pair<int, int>
#define sz(x)   (int) x.size()

void test_case() {
    int L, R, d;
    cin >> L >> R >> d;
    int cnt = 0;
    for (int i = L; i <= R; i++) {
        if (i % d == 0) cnt += 1;
    }
    cout << cnt << endl;
}

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

    int t = 1;
    // cin >> t;

    while (t--) { 
        test_case();
    }
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N, x;
  cin >> N >> x;
  vector<ll> a(N);
  REP(i, N) cin >> a[i];

  sort(a.begin(), a.end());

  int ans = -1;
  REP(i, N) {
    if (a[i] <= x) { ans = i + 1; x -= a[i]; }
    else break;
  }
  if (ans != -1) {
    if (ans == N && x != 0) cout << (N - 1) << endl;
    else cout << ans << endl;
  } else{
    cout << 0 << 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 rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    string s, t;
    cin >> s >> t;
    sort(all(s));
    sort(all(t), greater<char>());
    cout << ((s < t) ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
using namespace std;
	int main(){
int a,b,c,d;
double x;
cin>>a>>b;
c=a/b;
d=a%b;
x=1.00000*a/b;
cout<<c<<" "<<d<<" "<<fixed<<setprecision(5)<<x<<endl;
return 0;
	}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 0;

typedef long long int ll;

using namespace std;

int main(){
    string a,b;
    cin>>a>>b;
    int sA = SZ(a);
    int sB = SZ(b);
    if(a == b){
        cout<<"EQUAL";
    }else if(sA>sB){
        cout<<"GREATER";
    }else if(sA<sB){
        cout<<"LESS";
    }else{
        for(int i = 0;i<=sA;i++){
            if(a[i]>b[i]){
                cout<<"GREATER";
                break;
            }else if(a[i]<b[i]){
                cout<<"LESS";
                break;
            }
        }
    }       
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int Read() {
	int x = 0, f = 1; char ch = getchar();
	while(!isdigit(ch)) {if(ch == '-')  f = -1; ch = getchar();}
	while(isdigit(ch)) {x = (x << 3) + (x << 1) + ch - '0'; ch = getchar();}
	return x * f;
}
int a[100005], b[100005];
signed main() {
	int n = Read();
	for(int i = 1; i <= n; i++)  a[i] = Read(), b[i] = Read();
	int flag = 0;
	for(int i = 3; i <= n; i++) {
		if(a[i - 2] == b[i - 2] && a[i - 1] == b[i - 1] && a[i] == b[i])  flag = 1;
	}
	if(flag)  puts("Yes");
	else  puts("No");
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    vector<int> a(3);
    cin >> a;
    sort(ALL(a));
    int ans = INF;
    do {
        int tmp = 0;
        REPF(i, 1, 3) {
            tmp += abs(a[i] - a[i-1]);
        }
        chmin(ans, tmp);
    } while (next_permutation(ALL(a)));
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	char a;
	char b;
	scanf("%c",&a);
	if(a=='A')
	b='T';
	if(a=='T')
	b='A';
	if(a=='G')
	b='C';
	if(a=='C')
	b='G';
	printf("%c",b);
	return 0;
}

Measured memory_bytes: 128
import java.lang.*;
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
         
        HashMap<String,Integer> hm = new HashMap<>();
        
        int n1 = scan.nextInt();
        
        
        int[] arr = new int[n1];
        int index = 0;
        
        while(n1-- > 0){
            String temp = scan.next();
            if(hm.containsKey(temp)){
                arr[hm.get(temp)]++;
            }
            else{
                hm.put(temp,index);
                arr[index]++;
                index++;
            }
        }
        
        int n2 = scan.nextInt();
        while(n2-- > 0){
            String temp = scan.next();
            if(hm.containsKey(temp)){
                arr[hm.get(temp)]--;
            }
        }
        
        int max = 0;
        for(int i : arr){
            max = max > i ? max : i;
        }
        
        System.out.println(max);
    }
}


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

bool isheihou(int a){
    for(int i=0; i<=400; i++){
        if(a == i*i) return true;
    }
    return false;
}

int caldis2(int Y[], int Z[], int d){
    int sum = 0;
    REP(i, d) sum += (Y[i]-Z[i])*(Y[i]-Z[i]);
    return sum;
}

void solve(){
    int n, d;
    cin >> n >> d;
    int X[n][d];
    REP(i, n){
        REP(j, d){
            cin >> X[i][j];
        }
    }
    int cnt = 0;

    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int dis2 = caldis2(X[i], X[j], d);
            if(isheihou(dis2)) cnt++;
        }
    }

    cout << cnt << endl;
}

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

Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func divisor(n int) []int {
	res := []int{}
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return res
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	ans := 0
	for i := 1; i <= N; i++ {
		if i%2 == 0 {
			continue
		}
		if len(divisor(i)) == 8 {
			ans++
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {

    fast

    int n,m;
    cin>>n>>m;

    vector<long >arr(n,0);
    priority_queue<long >p;
    long temp;
    for(int i=0;i<n;i++){
        cin>>temp;
        p.push(temp);
    }

    while(m--){
        temp=p.top();
        p.pop();
        p.push(temp/2);
    }

    long long  sum=0;

    while(!p.empty()){
        sum+=p.top();
        p.pop();
    }

    cout<<sum;








	return 0;
}


/*
ll  modularExponentiation(ll x,ll n,ll M)
{

    ll result=1;

    while(n>0)
    {

	if(n%2==1)

 result=(result*x)%M;

  x=(x*x)%M;

  n=n/2;

}

  return result;
}



*/


Measured memory_bytes: 2168
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int s,c,n=0,gs=0,gc=0;
  double hc;
  while(scanf("%d,%d",&s,&c)!=EOF) {
	  gs+=s*c; gc+=c; n++;
  }
  printf("%d\n",gs);
  hc=0.5+(double)gc/n;
  printf("%d\n",(int)hc);
  return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <set>
#include <string>
using namespace std;
int main()
{
    set<string> str;
    int i;
    cin >> i;
    string command, operand;
    while (cin >> command)
    {
        if (command == "insert")
        {
            cin >> operand;
            str.insert(operand);
        }
        if (command == "find")
        {
            cin >> operand;

            if (str.count(operand))
            {
                cout << "yes" << endl;
            }
            else
            {
                cout << "no" << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 32568
import math

n = int(input())
lst = list(map(int, input().split()))
 
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
            
def judge(x, lst, n):
 
    length = len(lst)
    all_pair = (length*(length-1) // 2) + length
    
    lst_r = [-1 if i < x else 1 for i in lst]
    lst_accum = []
    a = 0
    for i in lst_r:
        a += i
        lst_accum.append(a)
    
    bit = Bit(n)
    lst_accum_sorted = {b: i for i, b in enumerate(sorted(lst_accum), start=1)}
    count = 0
    for j, b in enumerate(lst_accum):
        count += bit.sum(lst_accum_sorted[b]) + (b >= 0)
        bit.add(lst_accum_sorted[b], 1)
        
    if count >= math.ceil(all_pair/2):
        return True
    else:
        return False
 
    
sorted_lst = sorted(lst)
low = 0
high = len(lst) - 1
while high - low >1:
    t = (low+high) // 2
    i = sorted_lst[t]
    if judge(i, lst, n):
        low = t
    else:
        high = t
        
print(sorted_lst[high]) if judge(sorted_lst[high], lst, n) else print(sorted_lst[low])

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

int dp[100000][2];
int main(){
	int n,k;
	while(cin>>n>>k,n||k){
		int ans=0;
		bool white=false;
		fill_n((int*)dp,n*2,0);
		for(int j=0;j<k;j++){
			int tmp;
			cin>>tmp;
			if(tmp)dp[tmp-1][0]=1;
			else white=true;
		}
		for(int i=1;i<n;i++){
			if(dp[i][0]==0)continue;
			if(dp[i-1][0]){
				dp[i][0] = dp[i-1][0]+1;
				dp[i][1] = dp[i-1][1]+1;
			}

			if(1<i && white && dp[i-2][0]){
				dp[i][1] = max(dp[i][1],dp[i-2][0]+2);
			}
			ans = max(ans,max(dp[i][0],dp[i][1]));
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1940