akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	while (1){
		cin >> n;
		if (n == 0) break;
		int ans = 0;
		string Step = "null";
		string nextStep;
		for (int i = 0; i < n; i++){
			cin >> nextStep;
			if (nextStep == "lu"){
				if (Step == "ru") ans++;
			}
			else if(nextStep == "ru"){
				if (Step == "lu") ans++;
			}
			else if (nextStep == "ld"){
				if (Step == "rd") ans++;
			}
			else if (nextStep == "rd"){
				if (Step == "ld") ans++;
			}
			Step = nextStep;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define lli long long
const lli MOD = 998244353LL;
const int mxsz = 100055;
using namespace std;


int main(){
	ios::sync_with_stdio (false);
	int n;
	cin >> n;
	vector<int> l, r;
	l.push_back(0);
	r.push_back(0);
	for(int i = 1; i <= n; i++){
		int a, b;
		cin >> a >> b;
		l.push_back(a);
		r.push_back(b);	
	}
	sort(l.begin(), l.end());
	sort(r.begin(), r.end());
	reverse(l.begin(), l.end());
	lli ans = 0;
	for(int i = 0 ; i <= n; i++){
		ans = max(ans, ans + (lli)l[i] - (lli)r[i]);
	}
	cout << 2LL * ans;
	return 0;
}

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

int main(){
  int N; cin >> N;
  string S; cin >> S;
  int count=0;
  int left=0,right=N-1;
  while(left<right){
    if(S[left]=='W'&&S[right]=='R'){
      count++;
      left++;
      right--;
    }else if(S[left]=='W'){
      right--;
    }else if(S[right]=='R'){
      left++;
    }else{
      left++;
      right--;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3728
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[]v=new int[N];
		for(int i=0;i<N;i++)v[i]=sc.nextInt();
		Arrays.sort(v);
		double ans=v[0];
		for(int i=1;i<N;i++)ans=(ans+v[i])/2;
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextInt()
    val aa = listOfInt()
    val bb = listOfInt()
    val cc = listOfInt()

    var ans = 0
    var prevIndex = -2
    (1..n).forEach {
        var index = aa[it - 1] - 1
        ans += bb[index]
        if (prevIndex + 1 == index) ans += cc[index - 1]
        prevIndex = index
    }
    println(ans)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

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

long long sum;
int n,m,a,p;
priority_queue< int >q;

int main()
{

	scanf("%d%d",&n,&m);

	for(int i=1; i<=n; i++)
		scanf("%d",&a),q.push(a);
		
	for(int i=1; i<=m; i++)
		p = q.top(),q.pop(),p /= 2,q.push(p);

	while(!q.empty())
		p = q.top(),q.pop(),sum += p;

	printf("%lld\n",sum);
	
	return 0;
}

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

int main() {
    string red, blue, discard;
    int a,b;
    cin >> red >> blue;
    cin >> a >> b;
    cin >> discard;
    if(discard == red) a--;
    else b--;
    cout << a << ' ' << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){

  int minA=-1;
  int maxZ=999999;
  string s;
  cin>>s;
  for(int i=0;i<=(int)s.length()-2;i++){
  
    if(s[i]=='A'){
      minA=i+1;
      break;
    }
  }
  for(int j=(int)s.length()-1;j>=0;j--){
  
    if(s[j]=='Z'){
    
      maxZ=j+1;
      break;
    }
  }
  cout<<maxZ-minA+1;
}

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n;
int h[N], e[N], ne[N], idx;
int match[N];
bool st[N];
PII point[N];

void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ;
}

bool find(int u)
{
	for (int i = h[u]; ~i; i = ne[i])
	{
		int j = e[i];
		if (!st[j])
		{
			st[j] = true;
			if (match[j] == 0 || find(match[j]))
			{
				match[j] = u;
				return true;
			}
		}
	}
	
	return false;
}

int main()
{
	memset(h, -1, sizeof h);
	
	cin >> n;
	for (int i = 1; i <= n; i ++ ) cin >> point[i].F >> point[i].S;
	for (int i = n + 1; i <= 2 * n; i ++ ) cin >> point[i].F >> point[i].S;
	
	for (int i = 1; i <= n; i ++ )
		for (int j = n + 1; j <= 2 * n; j ++ )
			if (point[i].F < point[j].F && point[i].S < point[j].S)
				add(i, j);
				
	int res = 0;
	for (int i = 1; i <= n; i ++ )
	{
		memset(st, 0, sizeof st);
		if (find(i)) res ++ ;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	int a, b;
	cin >> a >> b;

	cout << max({a+b, a-b, a*b}) << endl; 

}


Measured memory_bytes: 256
// Author -- Frame

#include<bits/stdc++.h>

#define lowbit(x) ((x)&(-(x)))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
#define SZ(x) ((int)x.size())
#define mkpr std::make_pair
#define pb push_back

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef std::pair<int,int> pi;
typedef std::pair<ll,ll> pl;

const int inf=0x3f3f3f3f,Inf=0x7fffffff;
const ll INF=0x3f3f3f3f3f3f3f3f;

Finline uint rnd()
{
	static uint seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
template <typename _Tp>_Tp gcd(const _Tp &a,const _Tp &b){return (!b)?a:gcd(b,a%b);}
template <typename _Tp>Finline _Tp abs(const _Tp &a){return a>=0?a:-a;}
template <typename _Tp>Finline _Tp max(const _Tp &a,const _Tp &b){return a<b?b:a;}
template <typename _Tp>Finline _Tp min(const _Tp &a,const _Tp &b){return a<b?a:b;}
template <typename _Tp>Finline void chmax(_Tp &a,const _Tp &b){(a<b)&&(a=b);}
template <typename _Tp>Finline void chmin(_Tp &a,const _Tp &b){(b<a)&&(a=b);}
template <typename _Tp>Finline void read(_Tp &x)
{
	char ch(getchar());
	bool f(false);
	while(ch<48||ch>57) f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();
	while(ch>=48&&ch<=57) x=(((x<<2)+x)<<1)+(ch&15),ch=getchar();
	if(f) x=-x;
}
template <typename _Tp,typename... Args>Finline void read(_Tp &t,Args &...args){read(t);read(args...);}
template <typename _Tp,typename... Args>Finline _Tp min(const _Tp &a,const _Tp &b,const Args &...args){return a<b?min(a,args...):min(b,args...);}
template <typename _Tp,typename... Args>Finline _Tp max(const _Tp &a,const _Tp &b,const Args &...args){return a<b?max(b,args...):max(a,args...);}
Finline int read_str(char *s)
{
	char ch(getchar());
	while(ch==' '||ch=='\r'||ch=='\n') ch=getchar();
	char *tar=s;
	*tar=ch,ch=getchar();
	while(ch!=' '&&ch!='\r'&&ch!='\n'&&ch!=EOF) *(++tar)=ch,ch=getchar();
	return tar-s+1;
}

const int N=305;
int C[N][N],dp[N][N],sum[N][N],mod;
template<typename _Tp1,typename _Tp2>Finline void add(_Tp1 &a,_Tp2 b){(a+=b)>=mod&&(a-=mod);}
int main()
{
	int n,k;read(n,k,mod);
	for(int i=0;i<N;++i) for(int j=C[i][0]=1;j<=i;++j) C[i][j]=C[i-1][j-1],add(C[i][j],C[i-1][j]);
	for(int i=0;i<=k;++i) dp[1][i]=1,sum[1][i]=k-i+1;
	for(int i=2;i<=n+1;++i)
	{
		for(int j=0;j<=k;++j)
		{
			for(int p=1;p<i;++p)
			{
				add(dp[i][j],1ll*C[i-2][p-1]*sum[p][j+1]%mod*dp[i-p][j]%mod);
			}
		}
		for(int j=k;j>=0;--j) sum[i][j]=dp[i][j],add(sum[i][j],sum[i][j+1]);
	}
	printf("%d\n",dp[n+1][0]);
	return 0;
}


Measured memory_bytes: 4736
import sys
input=sys.stdin.readline

def main():
    _ = int(input())
    A = list(map(int, input().split()))

    D = dict()
    for a in A:
        if a in D:
            D[a] += 1
        else:
            D[a] = 1

    ans = len(D.items())
    e = 0
    for d in D.items():
        if d[1]%2 == 0:
            e += 1
    if e%2 == 1:
        ans -= 1

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 18148
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> a(N);
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		sum += a[i];
	}

	int cnt = 0;
	for (int i = 0; i < N; ++i) {
		if (a[i] * 4 * M >= sum) { ++cnt; }
	}

	cout << (cnt >= M ? "Yes" : "No") << endl;

	return 0;
}


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

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

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            Array.Sort(array);
            List<int> cnts = new List<int>();
            cnts.Add(1);
            for(int i = 1; i < n; i++)
            {
                if (array[i] == array[i - 1])
                {
                    cnts[cnts.Count-1]++;
                }
                else
                {
                    cnts.Add(1);
                }
            }
            cnts.Sort();
            int[] cans = new int[n+1];
            cans[0] = n;
            int now = 0;
            int sum = 0;
            for(int i = 1; i <=n; i++)
            {
                while (now < cnts.Count && cnts[now] == i-1)
                {
                    now++;
                }
                if (now < cnts.Count)
                {
                    sum += cnts.Count - now;
                }
                cans[i] = sum / i;
            }
            now = n;
            for(int i = 1; i <= n; i++)
            {
                while (cans[now] < i) now--;
                WriteLine(now);
            }
        }

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


Measured memory_bytes: 39464
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int main(){

  int x, a, b;
  cin >> x >> a >> b;
  cout << (abs(x-a) < abs(x-b) ? "A": "B") << endl;

  return 0;
}



//


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

const int INF = 1<<28;

int main() {
  for(int w, d; cin >> w >> d && (w|d); ) {
    vector<int> h1(w+1, INF), h2(d+1, INF+1);
    for(int i = 0; i < w; ++i) cin >> h1[i];
    for(int i = 0; i < d; ++i) cin >> h2[i];
    sort(h1.begin(), h1.end());
    sort(h2.begin(), h2.end());
    int res = 0;
    for(int i = 0, j = 0; i < w || j < d; ) {
      if(h1[i] == h2[j]) {
        res += h1[i];
        ++i; ++j;
      } else if(h1[i] < h2[j]) {
        res += h1[i++];
      } else {
        res += h2[j++];
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

int main(){
    ll n, q;
    string s;
    cin >> n >> s>> q;
    vector<set<int>> is(26);
    rep(i, n) is[s[i] - 'a'].insert(i);
    rep(qi, q) {
        int ty;
        cin >> ty;
        if (ty == 1) {
            int i; char c;
            cin >> i >> c;
            --i;
            is[s[i]-'a'].erase(i);
            s[i] = c;
            is[s[i]-'a'].insert(i);
        } else {
            int l, r;
            cin >> l >> r;
            --l;
            int ans = 0;
            rep(i, 26) {
                auto it = is[i].lower_bound(l);
                if (it != is[i].end() && *it < r) ++ans;
            }
            printf("%d\n", ans);
        }
    }
    return 0;
}

Measured memory_bytes: 26244
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-02-22 22:10:21
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

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

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

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

  int cnt = 0;

  while (n > 0) {
    ++cnt;
    n /= k;
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	vector<int> a(n, 0);
	vector<int> ans(n, 0);
	rep(i, n)
	{
		if (i < n - 1)
		{
			if (s[i] == 'R' && s[i + 1] == 'L')	a[i] = 1;
			if (s[i] == 'L' && s[i + 1] == 'R')	a[i] = -1;
		}
		if (i == n - 1) a[i] = -1;
	}
	int l = 0, r = 0, i = 0, last1 = 0;
	while (l < n)
	{
		if (a[i] == 1)last1 = i;
		if (a[i]== -1)
		{
			r = i;
			int even = 0, odd = 0;
			for (int j = l; j <= r; j++)
			{
				int d = abs(last1 - j);
				if (d % 2 == 0) even++;
				else odd++;
			}
			ans[last1] = even;
			ans[last1 + 1] = odd;
			l = r + 1;
		}
		i++;
	}
	rep(i, n)cs(ans[i]);
	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;

int main() {
	char s[3][3];
	rep(i, 3) {
		rep(j, 3) {
			cin >> s[i][j];
		}
	}
	cout << s[0][0] << s[1][1] << s[2][2] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip> //do setprecision
#include <ctime>
#include <complex>
using namespace std;



int main(void){
	int n,N,i,j=0;
	string s,temp;
	cin >> n;
	cin >> N;
	for(i=n;i<=N;i++){
		s=to_string(i);
		temp=s;
		reverse(s.begin(),s.end());
		if(temp==s){
			j++;
		}
	}
	cout << j << endl;
}

Measured memory_bytes: 256
RATE_RANGE = 400
TOTAL_COLOR_NUM = 8
MAX_RATE = 3200
N = input()
a = map(int, raw_input().split())
# discretize rate (0 ~ 8)
rainbow_color_num = 0
kind_num = set()
for _a in a:
  if _a >= MAX_RATE:
    rainbow_color_num += 1
  else:
    kind_num.add(_a / RATE_RANGE)
print max(1, len(kind_num)), len(kind_num) + rainbow_color_num

Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<ll, ll> > vec;

int main() {
  ll N;
  vector<ll> a;
  ll max_abs = -1, idx;

  cin >> N;
  for (ll i = 0; i < N; i++) {
    ll t;
    cin >> t;
    a.push_back(t);
    if(abs(t) > max_abs) {
      max_abs = abs(t);
      idx = i;
    }
  }

  bool plus = (a[idx] >= 0 ? true : false);

  for (ll i = 0; i < N; i++) {
    a[i] += a[idx];
    vec.push_back({idx + 1, i + 1});
  }

  if (plus) {
    for (ll i = 0; i < N - 1; i++) {
      a[i + 1] += a[i];
      vec.push_back({i + 1, i + 2});
    }
  } else {
    for (ll i = N -1;  i >= 1; i--) {
      a[i - 1] += a[i];
      vec.push_back({i + 1, i});
    }
  }

  cout << vec.size() << endl;
  for (auto itr = vec.begin(); itr != vec.end(); itr++) {
    cout << itr->first << " " << itr->second << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int h,w,i,j,k,l,a;
  char s[100][100];

  scanf("%d %d",&h,&w);

  for(i=0;i<h;i++)
    scanf("%s",s[i]);

  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      a=0;
      if(s[i][j]=='#')
        printf("#");
      else{
        for(k=-1;k<2;k++){
          for(l=-1;l<2;l++){
            if(i+k>=0&&i+k<=h&&j+l>=0&&j+l<=w&&s[i+k][j+l]=='#')
              a++;
          }
        }
        printf("%d",a);
      }
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <list>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <iomanip>
#include <queue>
#include <map>
#include <unordered_map>
typedef long long ll;
using namespace std;

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

	std::vector<std::string> s(N);

	std::unordered_map<std::string, int> mp;

	for(int i=0; i<N; i++){
		std::cin >> s[i];
		std::sort(s[i].begin(),s[i].end()); //1つのstringのソート
		
	}

	std::sort(s.begin(),s.end()); //vector<string>全体のソート

/*
	for(int i=0; i<N; i++){
		cout << s[i] << endl;	
	}
*/

//	cout << *s[0].begin() << " " << *s[0].end() << endl;

	ll answer = 0;
	for(int i=0; i<N; i++){

/*
		cout << "size: "<< mp.size() << endl;
		cout << mp[s[i]] << endl;
*/
		if( mp[s[i]]==0 ){
			mp[s[i]]++;
		}else if(mp[s[i]] >= 1){
			answer+= mp[s[i]];
			mp[s[i]]++;
		}

	}

	std::cout << answer << std::endl;


}

Measured memory_bytes: 12964
#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, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    vector<ll> c(m);
    rep(i, m){
        cin >> a[i] >> b[i];
        ll s = 0;
        rep(j, b[i]){
            int d;
            cin >> d;
            d--;
            s += (1 << d);
        }
        c[i] = s;
    }
    int INF = 1001001001;
    vector<vector<int>> dp(m+1, vector<int>((1 << n), INF));
    dp[0][0] = 0;
    rep(i, m){
        rep(j, (1 << n)){
            dp[i+1][j] = min(dp[i][j], dp[i+1][j]);
            ll t = 0;
            rep(k, n){
                if((1 & (j >> k)) || (1 & (c[i] >> k)))t += (1 << k);
            }
            dp[i+1][t] = min(dp[i+1][t], dp[i][j] + a[i]);
        }
    }
    if(dp[m][((ll)1<<n)-1] == INF)cout << -1 << endl;
    else cout << dp[m][((ll)1<<n)-1] << endl;
}

Measured memory_bytes: 16384
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;

int main(void){
    int n;
    cin>>n;
    
    int a[n+1];
    a[n]=-1000;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    sort(a,a+n);
    
    int ans=0;
    for(int i=0;i<n;i++){
        int count=1;
        for(int j=i+1,k=0;j<n+1;j++,k++){
            if(a[i]==a[j]){
                count++;
            }else{
                i+=k;
                break;
            }
        }
        //cout<<a[i]<<" "<<count<<endl;
        if(a[i]!=count){
            if(count-a[i]>0)ans+=count-a[i];
            else ans+=count;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string.h>
using namespace std;
#define MAX_V 500
#define INF 1e9
#define f(i,n) for(int i=0;i<n;i++)
#define memu memset(used,0,sizeof(used))
int G[MAX_V][MAX_V],V,E,Q,F,T,m,a,b;
bool used[MAX_V];
void add_edge(int from,int to){
    G[from][to]=1;
    G[to][from]=1;
}
void erase_edge(int from,int to){
    G[from][to]=0;
    G[to][from]=0;
}
int dfs(int v,int t,int f){
    if(v==t)return f;
    used[v]=true;
    f(i,V){
        int &c = G[v][i];
        if(!used[i]&&c>0){
            int d=dfs(i,t,min(f,c));
            if(d>0){
                c-=d;
                G[i][v]+=d;
                return d;
            }
        }
    }
    return 0;
}
int max_flow(int s,int t){
    int flow=0;
    while(1){
        memu;
        int f=dfs(s,t,INF);
        if(f==0)return flow;
        flow += f;
    }
}
int main(){
    cin>>V>>E>>Q;
    f(i,E){
        cin>>F>>T;
        add_edge(F-1,T-1);
    }
    int now=max_flow(0,V-1);
    f(i,Q){
        cin>>m>>a>>b;
        a--,b--;
        if(m==1){
            add_edge(a, b);
            now+=max_flow(0,V-1);
        } else {
            int c=G[a][b];
            erase_edge(a, b);
            if(c>1){
                swap(a,b);
            }
            if(c!=1){
                memu;
                int f=dfs(a,b,1);
                if(f==0){
                    memu;
                    dfs(a, 0, 1);
                    memu;
                    dfs(V-1,b,1);
                    now--;
                }
            }
        }
        cout<<now<<endl;
    }
}

Measured memory_bytes: 2164
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

LL dp[100005] = {0};
VL topo_nodes;
vector<VL> link(100005);

bool visited[100005] = {0};
void dfs(LL i){
    if(visited[i])return;
    visited[i] = true;
    for(LL x : link[i]){
        dfs(x);
    }
    topo_nodes.PB(i);
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n,m;
    cin>>n>>m;
    REP(i,m){
        LL x,y;
        cin>>x>>y;
        link[x-1].PB(y-1);
    }

    REP(i,n){
        dfs(i);
    }
    reverse(ALL(topo_nodes));

    for(LL i : topo_nodes){
        for(LL x : link[i]){
            dp[x] = max(dp[x], dp[i] + 1);
        }
    }

    PUTS(*max_element(dp, dp+n));
}

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

int a,b,c,x;

int main(){

    int z;
    cin >> a >> b >> c >> x;

    for (int i = 0; i <= a; ++i) {
        for(int j = 0; j <= b; ++j){
            for (int k = 0; k <= c; ++k){
                if(x == (i * 500 + j * 100 + k * 50)) z++;



                }
            }
        }
    cout << z << endl;
    return 0;
    }




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

int main()
{
    int N;
    int Alice = 0;
    int Bob = 0;
    cin >> N;

    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        int z;
        cin >> z;
        a.push_back(z);
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    for (int i = 0; i < N; i++)
    {
        if (i % 2 == 0)
            Alice += a.at(i);
        else
            Bob += a.at(i);
    }

    cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
using namespace std;
#define ll long long
int main(void)
{
	ll n,nn,j,k,e;
	cin>>n;
	nn=n;j=0;k=0;e=1;while(nn>=10){k++;nn/=10;j=j*10+9;e*=10;}
	if(nn*e+j<=n)cout<<nn+k*9;
	else cout<<nn-1+k*9;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
a = 0
if N == 1 or N % 2 == 1:
    print("No")
else:
    for i in range(N//2):
        if S[i] != S[i+(N//2)]:
            a = a+1
    if a == 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 2940
N = int(input())
pos = [list(map(int,input().split())) for _ in range(N)]
posx = 0
posy = 0
disx = 0
disy = 0
dis  = 0
time = 0
for n in range(N):
    disx = abs(pos[n][1]-posx)
    disy = abs(pos[n][2]-posy)
    dis = disx + disy
    if((pos[n][0]-time)-dis)<0:
        print("No")
        exit()
    else:
        if ((pos[n][0]-time)-dis)%2!=0:
            print("No")
            exit()
        else:
            time = pos[n][0]
            posx = pos[n][1]
            posy = pos[n][2]
print("Yes")


Measured memory_bytes: 27324
import math,time
N = int(input())
S = input()

ans = 0
for i in range(1000):
    locknum = str(i).zfill(3)
    a = S.find(locknum[0])
    b = S.find(locknum[1],a+1)
    c = S.find(locknum[2],b+1)
    if a!=-1 and b!=-1 and c!=-1:
        # print(i)
        ans +=1


             
print(ans)

Measured memory_bytes: 3060
s = gets.chomp.chars
l = s[0..1].join.to_i
r = s[2..3].join.to_i
if l < 1 || l > 12#左側が月になり得ない場合
  if r < 1 || r > 13#右側も月になり得なければダメ
    puts "NA"  
  else
    puts "YYMM"
  end
else
  if r < 1 || r > 12#右側が月になり得ない場合
    puts "MMYY"
  else
    puts "AMBIGUOUS"
  end
end

Measured memory_bytes: 14292
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;
 
int main()
{
    NFS
 	ll h,sum=0,c=1;
 	cin>>h;
 	while(1)
 	{
 		if(h==1)
 		{
 			sum+=c;
 			break;
 		}
 		sum+=c;
 		c*=2;h/=2;
 	}
 	cout<<sum;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    long long N, a[100005], p, i, j, M, x;
    scanf("%lld", &N);
    for (i=1; i<=N; i++) a[i]=0;
    M=0;
    for (i=1; i<=N; i++) {
        scanf("%lld", &x);
        if ((i==1 && x!=0) || (i!=1 && x==0)) {
            printf("%d", 0);
            return 0;
        }
        a[x]++;
        if (x>M) M=x;
    }
    x=1;

    for (i=0; i<=M-1; i++) {
        p=1;
        for (j=1; j<=a[i+1]; j++) {
            p*=a[i];
            if (p>=998244353) p%=998244353;
        }
        x*=p;
        // printf("%lld: %lld\n", i, p);
        if (x>=998244353) x%=998244353;
    }

    printf("%lld", x);

    return 0;
}


Measured memory_bytes: 896
n = int(input())
s=[]
for i in range(n):s.append(input())
m = int(input())
t=[]
for i in range(m):t.append(input())
cnt,ans=0,0
for i in range(n):
    temp=s[i]
    for j in range(n):
        if temp==s[j]:
            cnt+=1
    for j in range(m):
        if temp == t[j]:
            cnt-=1
    ans = max(ans,cnt)
    cnt=0
print(ans)


Measured memory_bytes: 3064
def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    x,a=map(int, input().split())
    if x < a:
        print(0)
    else:
        print(10)



main()

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;

#define LET(name, value) __typeof(value) name = value
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for (LET(i, (c).begin()); i != (c).end(); ++i)

struct Edge {
  int s, t, w;
  Edge(int s, int t, int w): s(s), t(t), w(w) {}
  bool operator<(const Edge& rhs) const { return w < rhs.w; }
};

struct UnionFind {
  vector<int> data;
  UnionFind(int size): data(size, -1) {}
  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) { swap(x, y); }
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
};

int minimum_spanning_tree(vector<Edge>& edges) {
  sort(ALL(edges));
  UnionFind uf(edges.size());
  int w = 0;
  REP(i, edges.size()) {
    Edge e = edges[i];
    int r1 = uf.root(e.s), r2 = uf.root(e.t);
    if (r1 != r2) {
      uf.merge(r1, r2);
      w += e.w;
    }
  }
  return w;
}

vector<Edge> edges;

int main() {
  int s, d;
  while (scanf("%d%d", &s, &d), s|d) {
    edges.clear();
    REP(i, s) REP(j, d) {
      int w; scanf("%d", &w);
      if (w > 0) { edges.push_back(Edge(i, s+j, w)); }
    }
    REP(i, d-1) FOR(j, i+1, d) {
      int w; scanf("%d", &w);
      if (w > 0) { edges.push_back(Edge(s+i, s+j, w)); }
    }
    REP(i, s) FOR(j, i+1, s) {
      edges.push_back(Edge(i, j, 0));
    }
    printf("%d\n", minimum_spanning_tree(edges));
  }
}

Measured memory_bytes: 0
a=list(map(int,input().split()))
N=a[0]
K=a[1]
h=[]
for i in range(N):
    h.append(int(input()))
h.sort()
min=abs(h[K-1]-h[0])
for i in range(N-K+1):
    if abs(h[i]-h[i+K-1]) < min:
        min=abs(h[i]-h[i+K-1])
print(str(min))

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

int n=0;
int m=0;
int a[1000];
int b[1000];
int c[1000];
int d[1000];
int ushi;
int uma;
int main(){
  cin>>n>>m;
  for(int i;i<n;i++){
    cin>>a[i];}
  for(int j;j<m;j++){
    cin>>b[j];}
  for(int k=0;k<n;k++){
    for(int l=0;l<m;l++){
      if(d[l]==0&&a[k]<=b[l]){
	c[k]++;
	d[l]=1;
      }
    }
  if(c[k]>ushi){
    ushi=c[k];
    uma=k;
  }
  }
  cout<<uma+1<<endl;
}

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

int main() {
  int n;
  cin >> n;
  map<string, int> s;
  rep(i, n) {
    string st;
    cin >> st;
    s[st]++;
  }
  int maxv = 0;
  for(auto x : s) {
    int v = x.second;
    maxv = max(v, maxv);
  }
  for(auto it = s.begin(); it != s.end(); it++) {
    if(it->second == maxv) {
      cout << it->first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 19212
#include <iostream>

using namespace std;

int buf[101][101] = {0};

int main(int argc, const char * argv[])
{
	int r, c;
	cin >> r >> c;

	// read
	for(int row = 0; row < r; ++row)
	{
		for(int column = 0; column < c; ++column)
		{
			cin >> buf[row][column];
		}
	}

	// calculate
	for(int row = 0; row < r; ++row)
	{
		for(int column = 0; column < c; ++column)
		{
			buf[row][c] += buf[row][column];
		}
	}
	for(int column = 0; column < c + 1; ++column)
	{
		for(int row = 0; row < r; ++row)
		{
			buf[r][column] += buf[row][column];
		}
	}
	
	// write
	for(int row = 0; row < r + 1; ++row)
	{
		for(int column = 0; column < c + 1; ++column)
		{
			cout << buf[row][column];
			if(column != c)
			{
				cout << " ";
			}
			else
			{
				cout << endl;
			}
		}
	}
	
    return 0;
}

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

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

const ll INF = 1LL << 60;

int main()
{
  ll H; cin >> H;
  ll N; cin >> N;
  vector<ll> A(N);
  vector<ll> B(N);
  for (int i=0; i<N; i++){
    cin >> A[i];
    cin >> B[i];
  }
  vector<vector<ll>> dp(N+1, vector<ll>(H+10, INF));
  for (int i=0; i<N+1; i++) {
    dp[i][0] = 0;
  }
  for (int i=0; i<N; i++) {
    for (int j=1; j<H+1; j++) {
      dp[i+1][j] = min(dp[i][j] , dp[i+1][max(0LL, j-A[i])] + B[i]);
    }
  }
  cout << dp[N][H] << endl;

  return 0;
}


Measured memory_bytes: 78720
#include <stdio.h>

int main(void)
{int i,h,a,b,c,k,l,m,N,K,j,v,g,flag,sum;
scanf("%d%d%d",&a,&b,&c);
if(((a==b)&&(b!=c))||((a==c)&&(a!=b))||((b==c)&&(b!=a)))
printf("%d",2);
else if((a==b)&&(b==c))
printf("%d",1);
else printf("%d",3);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
#define MOD 1000000007

int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;

    bool state;
    int a;
    ll ans=1;
    if(s[0]==t[0]){
        ans*=3;
        state=true;
        a=1;
    }else{
        ans*=6;
        state=false;
        a=2;
    }
    for(int i=a;i<s.size();i++){
        if(s[i]==t[i]){
            if(state){
                ans*=2;
            }else{
                ans*=1;
            }
            state=true;
        }else{
            if(state){
                ans*=2;
            }else{
                ans*=3;
            }
            state=false;
            i++;
        }
    }
    cout << ans%MOD << endl;
}

Measured memory_bytes: 3592
//package atcoder;
 
import java.util.*;
//import java.math.BigDecimal;
 
public class Main{
	static boolean[] targetNumbers;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H1 = sc.nextInt();
		int M1 = sc.nextInt();
		int H2 = sc.nextInt();
		int M2 = sc.nextInt();
		int K = sc.nextInt();
		int okizi = 0;
		int okihun = 0;
		if(M2>=M1) {
			okizi = H2-H1;
			okihun = M2-M1;
		}
		if(M2<M1) {
			okizi = H2-H1-1;
			okihun = 60-(M1-M2);
		}
		int yoyu = okizi*60+okihun;
		System.out.println(yoyu-K);
	}
}

Measured memory_bytes: 35748
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
	long long n,f,i;
	f=0;
	string s,s1,s2,s3;
	cin>>s;
	n=s.length();
	s1=s.substr(0,(n-1)/2);
	s2=s.substr((n+1)/2,(n-1)/2);
	for (i=0;i<n;i++)
	{
		if (s[i]!=s[n-i-1])
		{
			f=1;
		}
	}
	n=n/2;
	for (i=0;i<n;i++)
	{
		if (s1[i]!=s1[n-i-1])
		{
			f=1;
		}
	}	
	for (i=0;i<n;i++)
	{
		if (s2[i]!=s2[n-i-1])
		{
			f=1;
		}
	}	
	if (f==0)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
import math

LIMIT = 10 ** 9

def solve():
  S = int(input())

  if S == 10 ** 18:
    print('0 0 0 1000000000 1000000000 0')
    exit()

  if S <= LIMIT:
    print('0 0 1 0 0 ' + str(S))
    exit()
  else:
    a = S % LIMIT
    b = (S - a) // LIMIT + 1
    c = LIMIT - a
    print('0 0 1 1000000000 ' + str(b) + ' ' + str(c))

solve()

Measured memory_bytes: 3060
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let mut a = 0;
    let mut b = 0;
    for c in input.next().chars() {
        match c {
            'S' => a |= 1,
            'N' => a |= 2,
            'E' => b |= 1,
            'W' => b |= 2,
            _ => panic!(),
        }
    }
    println!("{}", if a % 3 == 0 && b % 3 == 0 { "Yes" } else { "No" });
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next(&mut self) -> String {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap();
    }

    fn next_i64(&mut self) -> i64 {
        return self.next().parse::<i64>().unwrap();
    }
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  double R;
  cin>>R;
  cout<<fixed<<setprecision(10)<<R*2*3.141592<<endl;
  return 0;
}


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

using namespace std;

int main(){
    long long int N,A,B,u=1e9,l=-1;
    cin >> N >> A >> B;
    A -= B;
    vector<long long int> h(N);
    for(int i=0;i<N;i++){
        cin >> h[i];
    }

    while(1<u-l){
        long long int mid = (u+l)/2,ans=0;

        for(int i=0;i<N;i++){
            long long int tmp = h[i] - B*mid;
            if(0<tmp){
                ans += (tmp+A-1)/A;
            }
        }

        if(ans<=mid){
            u = mid;
        }else{
            l = mid;
        }
    }

    cout << u << endl;
}

Measured memory_bytes: 4048
s=input()
for i in range((len(s)-1)//2):
    if s[i]!=s[-i-(len(s)//2)-2]:
        print('No')
        exit()
if s[0:len(s)//2]!=s[len(s)//2+1:-1]+s[-1]:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 3060
ii=lambda:int(input())
miis=lambda:map(int,input().split())
lmiis=lambda:list(map(int,input().split()))

n=int(input())
p=lmiis()

ans=0
min=10**9
for i in p:
  if i<=min:
    ans+=1
    min=i

print(ans)

Measured memory_bytes: 24744
import sys
import itertools

N,M,Q = map(int, input().split())
A = []
B = []
C = []
D = []
for i in range(Q):
    a,b,c,d = map(int,input().split())
    A.append(a)
    B.append(b)
    C.append(c)
    D.append(d)

num = list(range(1,M+1))
ans = 0
for tpl in itertools.combinations_with_replacement(num,N):
    point = 0
    for i in range(Q):
        if tpl[B[i]-1] - tpl[A[i]-1] == C[i]:
            point += D[i]
    
    ans = max(ans,point)

print(ans)

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

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

  int x;
  cin >> x;

  int cnt=0;
  
  for(int i=0; i<=a; i++)
  {
    for(int j=0; j<=b; j++)
    {
      for(int k=0; k<=c; k++)
      {
        if((500*i)+(100*j)+(50*k)==x) cnt++;
      }
    }
  }

  cout << cnt;
}


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

using namespace std;

//#define int long long
#define FOR(i, j, k) for(int i = j; i < (int)k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

const int MOD = 1e9 + 7;
const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};

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

int ball[10];

bool dfs(int n, int b, int c) {
    if(n == 10) return true;
    if(b < ball[n]) return dfs(n + 1, b = ball[n], c);
    if(c < ball[n]) return dfs(n + 1, b, c = ball[n]);
    return false;
}

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

    int n;
    cin >> n;
    rep(i, n) {
        rep(i, 10) cin >> ball[i];
        dfs(0, 0, 0) ? cout << "YES" : cout << "NO";
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 100005, M = 105;
int dp[N], n;
int A[M];

int f(int i){
    if(i < 0)return 1;
    if(i == 0)return 0;
    int &ans = dp[i];
    if(ans != -1)return ans;
    ans = 0;
    forn(k, 0, n){
        ans |= !f(i-A[k]);
    }
    return ans;
}


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

  int k;
  cin >> n >> k;
  forn(i, 0, n)cin >> A[i];

  memset(dp, -1, sizeof dp);
  int ans = f(k);
  if(ans) cout << "First";
  else cout << "Second";
  cout << endl;



}





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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;


int main(){
  
  string s;
  cin >> s;
  int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
  for(int i=0;i<(1<<3);i++){
    int sum=a;
    char pm[3]={};
    rep(j,3){
      if(i&(1<<j)){
        sum+=s[j+1]-'0';
        pm[j]='+';
      }
      else{
        sum-=s[j+1]-'0';
        pm[j]='-';
      }
    }
    if(sum==7){
      cout<<a<<pm[0]<<b<<pm[1]<<c<<pm[2]<<d<<'='<<7<<endl;
      return 0;
    }
  }
}
  



Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

using namespace std;

int main() {
  string s;
  cin >> s;
  int sum[3] = {0, 0, 0};
  for(int i = 0; i < s.size(); i++) sum[s[i] - 'a']++;
  int mi = min(min(sum[0], sum[1]), sum[2]);
  int ma = max(max(sum[0], sum[1]), sum[2]);
  if(ma - mi < 2) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;

ll func(ll v){
 ll cnt = 0;
 ll ans = 0;
 while( v != 0 ){
  cnt = 0;
  for(ll i=0;i<64;i++) if( (v>>i)&1 ) cnt++;
  v %= cnt;
  ans++;
 }
 return ans;
}

int main(){
 int n;
 string s;
 cin>>n>>s;
 ll cnt = 0;
 for(ll i=0;i<n;i++){
  if( s[i] == '1' ) cnt++;
 }

 ll vp = 0,vu = 0;
 vector<ll> bp(n,1),bu(n,1);
 for(ll i=n-1;i>=1;i--){
  bp[i-1] = (bp[i]*2)%(cnt+1);
  if( cnt-1 != 0 )
  bu[i-1] = (bu[i]*2)%(cnt-1);
 }
 for(ll i=n-1;i>=0;i--){
 //  cout<<i<<' '<<"OK"<<endl;
   if( s[i] == '1' ){
    vp += bp[i];
    vp %= cnt+1;
    if(cnt-1 != 0 ){
     vu += bu[i];
     vu %= cnt-1;
    }
   }
 }
 
 for(ll i=0;i<n;i++){
  if( s[i] == '1' ){
   ll c = cnt-1;
   if( c == 0 ){
    cout<<c<<endl;
    continue;
   }
   ll v = (vu-bu[i]+c)%c;
   cout<<func(v)+1<<endl;
  }else{
   ll c = cnt+1;
   ll v = (vp+bp[i])%c;
   cout<<func(v)+1<<endl;
  }
 }
    return 0;
}


Measured memory_bytes: 6824
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) REP(i,(vec).size()) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    int A, B;
    char op;
    cin >> A >> op >> B;
    YESNO(op == '+', A + B, A - B);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
int main(void){
    int n,k,p,r;
    ll cnt = 0;
    cin >> n >> k;
    if(k == 0){
        cnt -= n;
    }
    for(int b = 1;b <= n;b++){
        r = (n%b);
        p = (n/b);
        cnt += (p*max(b-k,0)+max(r+1-k,0));
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main () {
	long long L[87];
	L[0] = 2;
	L[1] = 1;
	int N;
	scanf ("%d", &N);

	for (int i=2; i<=N; i++)
		L[i] = L[i-1] + L[i-2];

	printf ("%lld\n", L[N]);
	return 0;
}


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

int main() {
  int N, M, K, A;
  cin >> N >> M;
  vector<int> V(M, 0);

  for (int i=0; i<N; i++) {
    cin >> K;
    for (int j=0; j<K; j++) {
      cin >> A;
      V[A-1]++;
    }
  }
  
  int C=0;
  for (int i=0; i<M; i++) {
    if (V[i]==N) {
      C++;
    }
  }
  cout << C << endl;
}



Measured memory_bytes: 3624
n, m = map(int, input().split())
l = []

for _ in range(m):
    l.append(list(map(int, input().split())))

l.sort(key=lambda x:x[1])

last = -1
ans = 0
for a, b in l:
    if a < last:
        continue
    last = b
    ans += 1

print(ans)

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

int main(){
  ll h;
  cin >>h;
  ll ans = 1;
  while(ans*2<=h) ans *= 2;
  cout << ans*2 - 1 << endl;
  return 0;
}

Measured memory_bytes: 256