akhauriyash/Code-Regression huggingface dataset:
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] A = new int[N+1];

		HashMap<Integer, Integer>map = new HashMap<Integer, Integer>();
		for (int i=1; i<=N; i++){
			int param = sc.nextInt();
			map.put(param, i);
		}
		StringBuffer sb = new StringBuffer();
		for (int i=1; i<=N; i++){
			if (sb.length() > 0){
				sb.append(" ");
			}
			sb.append(map.get(i));
		}
		System.out.println(sb.toString());

	}
}

Measured memory_bytes: 70172
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  string S;
  cin >> S;
  ll n = S.size();
  REVERSE(S);

  ll M = 2019;
  ll x = 1;
  ll tot = 0;
  vll cnt(M);
  ll ans = 0;
  rep(i, n) {
    cnt[tot]++;
    tot += (S[i] - '0') * x;
    tot %= M;
    ans += cnt[tot];
    x = x * 10 % M;
  }

  COUT(ans);
  return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  array<int, 210000> dp;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int p;
    cin >> p;
    dp[p] = dp[p - 1] + 1;
    ans = max(ans, dp[p]);
  }
  cout << n - ans << endl;
}

Measured memory_bytes: 1024
d, t, s = input().split() 

d=int(d)
t=int(t)
s=int(s)

if d == 0:
    print ('error')
    
elif t == 0:
    print ('error')
        
elif s == 0:
    print ('error')

else:
    
    if (s*t) >= d :
        print ('Yes')
    
    else:
        print ('No')


Measured memory_bytes: 9100
#include <cstdio>
int main(){
    char a[17];
    scanf("%s",a);
    int cnt = 0;
    char b [17]= "CODEFESTIVAL2016";
    for(int i = 0;i < 17;i++){
        if(a[i]!=b[i])cnt++;
    }
    printf("%d",cnt);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

// えびちゃんの make_vector (ここから)
template <typename Tp, size_t N>
std::vector<Tp> make_vector_detail(std::vector<size_t>& sizes, typename std::enable_if<(N == 1), const Tp&>::type x) {
  return std::vector<Tp>(sizes[0], x);
}
template <typename Tp, size_t N>
auto make_vector_detail(std::vector<size_t>& sizes, typename std::enable_if<(N > 1), const Tp&>::type x) {
  size_t size = sizes[N-1];
  sizes.pop_back();
  return std::vector<decltype(make_vector_detail<Tp, N-1>(sizes, x))>(size, make_vector_detail<Tp, N-1>(sizes, x));
}

template <typename Tp, size_t N>
auto make_vector(const size_t(&sizes)[N], const Tp& x) {
  std::vector<size_t> s(N);
  for (size_t i = 0; i < N; ++i) s[i] = sizes[N-i-1];
  return make_vector_detail<Tp, N>(s, x);
}
// えびちゃんの make_vector (ここまで)

signed main(){
    
    int n, k; cin >> n >> k;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    if(n == 1){
        cout << max(0LL, v[0]) << endl;
        return 0;
    }
    
    vector<vector<vector<int> > > dp(k + 1, vector<vector<int> > (n, vector<int> (n, -INF)));
    dp[0][0][n - 1] = 0;
    for(int i = 0; i < k; i++){
        for(int l = 0; l < n; l++){
            for(int r = l; r < n; r++){
                if(dp[i][l][r] == -INF) continue;

                if(r - 1 >= 0) dp[i + 1][l][r - 1] = max(dp[i + 1][l][r - 1], dp[i][l][r] + v[r]);
                if(l + 1 < n) dp[i + 1][l + 1][r] = max(dp[i + 1][l + 1][r], dp[i][l][r] + v[l]);
                if(i + 2 <= k && l + 1 < n) dp[i + 2][l + 1][r] = max(dp[i + 2][l + 1][r], dp[i][l][r]);
                if(i + 2 <= k && r - 1 >= 0) dp[i + 2][l][r - 1] = max(dp[i + 2][l][r - 1], dp[i][l][r]);


            }
        }
    }

    int ans = 0;
    for(int i = 0; i <= k; i++) for(int l = 0; l < n; l++) for(int r = 0; r < n; r++) ans = max(ans, dp[i][l][r]);
    cout << ans << endl;
    

    return 0;
}


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

class Solve {
private:
	int product[3][3]{
		{0, 0, 0},
		{0, 1, 1},
		{0, 1, 2}
	};
	int sum[3][3]{
		{0, 1, 2},
		{1, 1, 2},
		{2, 2, 2}
	};
	int denial[3]{2, 1, 0};

	std::string formula;
	int variant[3]{};
	int f_i{};

	int calcVal()
	{
		if (formula[f_i] == '(')
			return interpretBinaryOperation();
		else if (formula[f_i] == '-')
		{
			f_i++;
			return denial[calcVal()];
		}
		else if ('P' <= formula[f_i] && formula[f_i] <= 'R')
		{
			f_i++;
			return variant[formula[f_i - 1] - 'P'];
		}
		else
		{
			f_i++;
			return formula[f_i - 1] - '0';
		}
	}

	int interpretBinaryOperation()
	{
		f_i++;
		int left{calcVal()};
		int ope{};
		if (formula[f_i] == '*') ope = 1;
		f_i++;
		int right{calcVal()};
		f_i++;

		if (ope) return product[left][right];
		else return sum[left][right];
	}

public:
	bool is_last_query{};
	Solve()
	{
		std::cin >> formula;
		if (formula[0] == '.')
		{
			is_last_query = true;
			return;
		}
		int count{};
		for (variant[0] = 0; variant[0] < 3; variant[0]++)
			for (variant[1] = 0; variant[1] < 3; variant[1]++)
				for (variant[2] = 0; variant[2] < 3; variant[2]++)
				{
					f_i = 0;
					if (calcVal() == 2)
						count++;
				}
		printf("%d\n", count);
	}

};

int main()
{
	while (!Solve().is_last_query);

	return 0;
}


Measured memory_bytes: 3264
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

namespace Flow
{
	const int MAXN = 205;
	const int MAXM = 50005;
	const int INF = 0x3f3f3f3f;

	struct Edge
	{
		int p, v, w;
	} e[MAXM];

	int e_cnt, S, T, V, ql, qr, q[MAXN], hed[MAXN], dis[MAXN], cur[MAXN];

	inline void Init(int n)
	{
		V = n;
		for (int i = 0; i < V; i ++)
			hed[i] = 0;
		e_cnt = 1;
	}

	inline void Addedge(int x, int y, int w)
	{
		e[++ e_cnt] = {y, hed[x], w}; hed[x] = e_cnt;
		e[++ e_cnt] = {x, hed[y], 0}; hed[y] = e_cnt;
	}

	inline bool Bfs()
	{
		for (int i = 0; i < V; i ++)
			dis[i] = 0;
		dis[q[ql = 0] = S] = qr = 1;
		while (ql ^ qr)
		{
			int x = q[ql ++];
			for (int i = hed[x]; i; i = e[i].v)
				if (e[i].w && !dis[e[i].p])
					dis[q[qr ++] = e[i].p] = dis[x] + 1;
		}
		return dis[T];
	}

	inline int Dfs(int x, int f)
	{
		if (x == T)
			return f;
		int ret = 0, t = 0;
		for (int &i = cur[x]; i; i = e[i].v)
			if (e[i].w && dis[e[i].p] == dis[x] + 1)
			{
				t = Dfs(e[i].p, min(f, e[i].w));
				f -= t; ret += t; e[i].w -= t; e[i ^ 1].w += t;
				if (!f)
					return ret;
			}
		return dis[x] = -1, ret;
	}

	inline int Dinic()
	{
		int ret = 0;
		while (Bfs())
		{
			for (int i = 0; i < V; i ++)
				cur[i] = hed[i];
			ret += Dfs(S, INF);
		}
		return ret;
	}
}

const int MAXN = 10000005;

int n, l, r, tp, p_cnt, a[105], st[205], p[MAXN];
bool chk[MAXN];

inline void Init(int n)
{
	chk[1] = 1;
	for (int i = 2; i <= n; i ++)
	{
		if (!chk[i])
			p[++ p_cnt] = i;
		for (int j = 1; i * p[j] <= n; j ++)
		{
			chk[i * p[j]] = 1;
			if (i % p[j] == 0)
				break;
		}
	}
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read();
	for (int i = 1; i <= n; i ++)
		a[i] = Read();
	for (int l = 1, r = 1; l <= n; l = r)
	{
		for (r ++; a[r] == a[r - 1] + 1; r ++);
		st[++ tp] = a[l], st[++ tp] = a[r - 1] + 1;
	}
	n = tp;
	Flow::Init(n + 2), Flow::T = n + 1;
	for (int i = 1; i <= n; i ++)
		if (st[i] & 1)
			Flow::Addedge(0, i, 1), l ++;
		else
			Flow::Addedge(i, n + 1, 1), r ++;
	Init(st[n]);
	for (int i = 1; i <= n; i ++)
		if (st[i] & 1)
			for (int j = 1; j <= n; j ++)
				if (!(st[j] & 1))
					if (!chk[abs(st[j] - st[i])])
						Flow::Addedge(i, j, 1);
	int ret = Flow::Dinic(), ans = ret;
	l -= ret, r -= ret;
	if (l & 1)
		ans += 3, l --, r --;
	ans += l + r;
	return printf("%d\n", ans), 0;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,m,n) for(ll i=m;i<=n;i++)
int main() {
  ll x;
  cin >> x;
  FOR(i,0,1000) FOR(j,-1000,1000) {
    if (pow(i, 5) - pow(j, 5) == x) {
      printf("%d %d\n", i, j);
      return 0;
    }
  }
}

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

int a[222222];

int main(){
    int n;
    cin >> n;
    for(int i=1; i <= n; i++) cin >> a[i];

    if(n % 2 == 1){
        int i = n;
        while(i > 0){
            cout << a[i] << " ";
            i -= 2;
        }
        i = 2;
        while(i < n){
        //i += 2;
        if(i+2 > n) cout << a[i] << endl;
        else cout << a[i] << " ";
        i += 2;
    }
}

    else if(n % 2 == 0){
        int j = n;
        while(j > 0){
            cout << a[j] << " ";
            j -= 2;
        }
        j = 1;
        while(j < n){
            if(j + 2 > n) cout << a[j] << endl;
            else cout << a[j] << " ";
            //cout << a[j] << " ";
            j += 2;
        }
    }

    return 0;
}


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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;

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

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  rep(i,N){
    cin>>A.at(i);
  }
  int m=N;
  while(m>1){
    sort(A.begin(),A.end());
    vec B;
    REP(i,1,A.size()){
      if(A.at(i)%A.at(0)!=0){
        B.push_back(A.at(i)%A.at(0));
      }
      //cout<<A.at(i)<<" ";
    }
  //  cout<<endl;
    B.push_back(A.at(0));
    m=B.size();
    A=B;
  }

  cout<<A.at(0)<<endl;

}


Measured memory_bytes: 1276
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int,input().split()))
inf = []
for i in range(M):
  x,y, c = map(int, input().split())
  inf.append((x,y,c))
ans = min(a)+min(b)
for i in range(M):
  x,y,c = inf[i]
  ans = min(ans,a[x-1]+b[y-1]-c)
print(ans)

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

typedef long long ll;
bool check(string x){
  if(x.size() % 2 != 0){
    return false;
  } 

  string s1 = x.substr(0, x.size()/2);
  string s2 = x.substr(x.size()/2, x.size()/2);
  // cerr << s1 << " " << s2 << endl;
  
  return s1 == s2;
}
int main(){
  string S;
  cin >> S;
  for(int i = 1; i < S.size(); i++){
    string x = S.substr(0, S.size()-i);
    // cerr << "x: " << x << endl;
    if(check(x)){
      cout << x.size() << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    ll A,B,C;
    cin >> A >> B >> C;
    ll out = B/A;
    if(out>C) out=C;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main()
        {
            int a, b, i, j, k;
            string ab;
            bool gflag = false;

            k = int.Parse(Console.ReadLine());
            ab = Console.ReadLine();

            i = ab.IndexOf(" ");

            if (i >= 0)
            {
                a = int.Parse(ab.Substring(0, i));
                b = int.Parse(ab.Substring(i + 1));

                for (j = a; j <= b; j++)
                {
                    if ((j % k) == 0)
                    {
                        gflag = true;
                        break;
                    }
                }
            }
            if (gflag)
            {
                Console.WriteLine("OK");
            }
            else
            {
                Console.WriteLine("NG");
            }

        }
    }
}

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

int main() {
  int x;
  int C=1;
  for (int i=0; i<5; i++) {
    cin >> x;
    if (x==0) {
      cout << i+1 << endl;
      break;
    }
    C++;
  }
}

Measured memory_bytes: 3608
mod = 10**9+7
n, X = map(int, input().split())
s = [int(x) for x in input().split()]
s = sorted(s, reverse=True)

dp = [[0 for _ in range(X+1)] for _ in range(n)]
dp[-1][X] = 1

for i in range(n):
    for x in range(X+1):
        dp[i][x % s[i]] += dp[i-1][x]
        dp[i][x % s[i]] %= mod
        dp[i][x] += dp[i-1][x]*(n-i-1)
        dp[i][x] %= mod

dp[-1][X] -= 1
ans = 0

for x in range(X+1):
    ans += dp[n-1][x]*x
    ans %= mod

print(ans)


Measured memory_bytes: 257672
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 
 
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    ll n;
    cin>>n;
    ll N=n*(n+1)/2;
    ll a[100010];
    ll sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum%N!=0){
        cout<<"NO"<<endl;
        return 0;
    }
    sum/=N;
    ll b[100010]={};
    rep(i,n-1){
        b[i]=a[i+1]-a[i]-sum;
    }
    ll cnt=0;
    rep(i,n-1){
        if(b[i]<=0&&b[i]%n==0){
            cnt+=(-b[i]/n);
        }
        else{
            cout<<"NO"<<endl;
            return 0;
        }
    }
    if(cnt<=sum){
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;

    return 0;
}

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

int main(){
  string s; cin>>s;
  
  deque<char> dq;
  for (int i=0; i<s.size(); i++){
    dq.push_back(s.at(i));
  }
  
  int rev=0;
  int q; cin>>q;
  for (int j=0; j<q; j++){
    int t; cin>>t;
    if (t==1) rev+=1;
    else {
      int f;
      char c; 
      cin>>f>>c;
      
      if (rev%2==0){
        if (f==1) dq.push_front(c);
        else dq.push_back(c);
      }
      else {
        if (f==2) dq.push_front(c);
        else dq.push_back(c);      
      }
    }
  }
  if (rev%2==1) reverse(dq.begin(), dq.end());
  for (auto d : dq) cout<<d;
  cout<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
#define itn int
#define tin int
#define tni int
bool dbg = false;
int N, D;
void solve()
{
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> D;
    cout << (N / (2 * D + 1) + (int)(N % (2 * D + 1) != 0)) << endl;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> COR;
typedef pair<ll, COR> delta;
#define print(x) cout<<(x)<<endl
#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007




int main() {
	int a, p; cin >> a >> p;
	int sum = p;
	sum += a * 3;
	print(sum / 2);








	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  int count = 1;
  
  for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  for (int j = 0; j < d.size() - 1; j++) {
    if(d.at(j) > d.at(j + 1)) {
      count += 1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3536
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

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

	int N,M,ans = 0;
	string s, t;
	map<string, int> mp;
	cin >> N;
	REP(i, N) {
		cin >> s;
		mp[s]++;
	}
	cin >> M;
	REP(i, M) {
		cin >> t;
		mp[t]--;
	}

	for(auto x:mp){
		ans = max(ans, x.second);
	}
	cout << ans << endl;
	
	return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD M

ll N, M = 1;

ll moddiv(ll a,ll b){
    a %= MOD;
    b %= MOD;
    for(ll m=MOD-2;m>0;m/=2){
        if(m&1){
            a=a*b%MOD;
        }
        b=b*b%MOD;
    }
    return a;
}


ll Fa[101010],iFa[101010];
void init(){
    ll i = 0;
    Fa[0] = 1;
    fornum(i,0,100000){
        Fa[i + 1] = Fa[i] * (i + 1) % MOD;
    }
    iFa[100000] = moddiv(1, Fa[100000]);
    for (i = 100000; i > 0;--i){
        iFa[i - 1] = iFa[i] * i % MOD;
    }
}
ll inv(ll a){
    if(a<=0)
        return 1;
    return iFa[a] * Fa[a - 1] % MOD;
}

ll dp[6060][20202];
ll i, j, k;

int main(){
    scanf("%lld%lld", &N,&M);
    init();
    dp[0][10000] = Fa[N * 3];

    fornum(i, 0, N * 3)
    {
        fornum(j, 10000 - i, 10001 + i)
        {
            (dp[i + 1][j + 1] += dp[i][j] * inv(i + 1)) %= MOD;
            (dp[i + 2][j - 1] += dp[i][j] * inv(i + 2)) %= MOD;
            (dp[i + 3][j] += dp[i][j] * inv(i + 3)) %= MOD;
        }
    }
    ll ans = 0;
    fornum(i,10000,20000){
        (ans += dp[N * 3][i]) %= MOD;
    }
    printf("%lld\n", (ll)ans);

    return 0;
}

Measured memory_bytes: 948096
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

long long is_Prime(long long x){
    if(x<2){
        return 0;
    }
    long long xx = sqrt(x);
    xx = min(x-1,xx+100);
    for(long long i=2;i<=xx;i++){
        if(x%i==0){
            return 0;
        }
    }
    return 1;
}


int main() {
    int x;
    cin >> x;
    while(is_Prime(x) == 0){
        x++;
    }
    cout << x << endl;
    return 0;
}
 
 


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

using namespace std;

#define MAX_LENGTH 100
#define MOD 1000000007

int N;
long long memo[110][6][6][6][6];

// A = 0, C = 1, G = 2, T = 3
long long count(int cur, int c3, int c2, int c1, int input) {
  if (memo[cur][c3][c2][c1][input] != -1) {
    return memo[cur][c3][c2][c1][input];
  }

  // ?AGC
  if (c2 == 0 && c1 == 2 && input == 1) {
    return 0;
  // AG?C
  } else if (c3 == 0 && c2 == 2 && input == 1) {
    return 0;
  // ?GAC
  } else if (c2 == 2 && c1 == 0 && input == 1) {
    return 0;
  // ?ACG
  } else if (c2 == 0 && c1 == 1 && input == 2) {
    return 0;
  // A?GC
  } else if (c3 == 0 && c1 == 2 && input == 1) {
    return 0;
  }

  if (cur == N) {
    return 1;
  }

  long long ans = 0;

  for (int i = 0; i < 4; i++) {
    ans += count(cur+1, c2, c1, input, i);
  }

  memo[cur][c3][c2][c1][input] = ans % MOD;

  return memo[cur][c3][c2][c1][input];
}


int main() {
  memset(memo, -1, sizeof(memo));
  cin >> N;
  cout << count(0, 3, 3, 3, 3) << endl;

  return 0;
}


Measured memory_bytes: 1408
//Header files
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;

//Short data-types declaration
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<vector<int> > vii;  
typedef vector<vector<long long> >vll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vbb;

//Macros
#define MK make_pair
#define EB emplace_back
#define PB push_back
#define F first
#define S second
#define rep(i,start,end) for(int i=(int)start;i<(int)end;i++)

void solve()
{
	int n;
	cin>>n;
	vl a(n);
	ll x=0;
	rep(i,0,n)
	{
		cin>>a[i];
		x^=a[i];
	}
	rep(i,0,n)
	{
		cout<<(x^a[i])<<" ";
	}
	cout<<endl;
}
int main()
{
	auto start = high_resolution_clock::now();
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	while(t--)
		solve();
	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start); 
	cerr<<duration.count()<<" microseconds\n";
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;

#define TT template<typename T>
#define TTF template<typename T, typename F>
#define ET(T) typename T::value_type
TT inline T sq(T x){return x*x;}
TT inline T In(){T x;cin>>x;return x;}
TT inline void Out(T&x){cout<<x;}
TT inline void sort(T&v){sort(begin(v),end(v));}
TT inline void revs(T&v){reverse(begin(v),end(v));}
TT inline void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT inline int ubnd(T&v,ET(T)&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT inline int lbnd(T&v,ET(T)&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF inline void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF inline void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
#undef TT
#undef TTF
#undef ET

inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}

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

struct Edge {
  int f, t, w, c;
  Edge(int f, int t, int w, int c=0) : f(f), t(t), w(w), c(c) {}
  bool operator<(const Edge& e) const {
    return w != e.w ? w > e.w : (f != e.f ? f < e.f : (t != e.t ? t < e.t : c < e.c));
  }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int dijkstra(const Graph& g, int s, int t, int c){
  int vis[128][16] = {};
  priority_queue<Edge> pq;
  for (pq.push(Edge(-2, s, 0)); !pq.empty(); pq.pop()){
    Edge e = pq.top();
    if (e.c > c) continue;
    if (vis[e.t][e.c]++) continue;
    if (e.t == t) return e.w;
    for (const auto& ee : g[e.t]){
      pq.push(Edge(e.t, ee.t, e.w + ee.w, e.c));
      pq.push(Edge(e.t, ee.t, e.w + ee.w / 2, e.c + 1));
    }
  }
  return -1;
}

int main()
{
  int c, n, m, s, d;
  while (cin >> c >> n >> m >> s >> d, c || n || m || s || d){
  Graph g(n + 1);
  for (int i = 0; i < m; i++){
    int a, b, f;
    cin >> a >> b >> f;
    g[a].push_back(Edge(a, b, f));
    g[b].push_back(Edge(b, a, f));
  }
  cout << dijkstra(g, s, d, c) << endl;
  }
  return (0);
}

// priority_queue queue deque front stringstream max_element min_element insert count make_tuple

Measured memory_bytes: 1336
#include<stdio.h>
#define MAX 2000000

int size, A[MAX+1];

void maxHeapify(int i){
  int l, r, largest, t;
  l = 2*i;
  r = 2*i+1;
  if ( l <= size && A[l] > A[i] ) largest = l;
  else largest = i;
  if ( r <= size && A[r] > A[largest] ) largest = r;
  if ( largest != i ){
    t = A[i]; A[i] = A[largest]; A[largest] = t;
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if ( size < 1 ) return;
  maxv = A[1];
  A[1] = A[size--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  int tmp;
  if ( key < A[i] ) return;
  A[i] = key;
  while ( i > 1 && A[i/2] < A[i] ){
    tmp = A[i];
    A[i] = A[i/2];
    A[i/2] = tmp;
    i = i/2;
  }
}

void insert(int key){
  size++;
  A[size] = -1000000001;
  increaseKey(size, key);
}

main(){
  int key;
  char com[20];
  while(1){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &key);
      insert(key);
    } else if ( strcmp(com, "extract") == 0  ){
      printf("%d\n", extract());
    } else break;
  }
  
  return 0;
}



Measured memory_bytes: 5572
(* Vicfred
 * https://atcoder.jp/contests/abc136/tasks/abc136_b
 * implementation
 * *)
Scanf.scanf "%d\n" @@ fun n ->
    Printf.printf "%d\n" @@
    Array.fold_left ( + ) 0 @@
    Array.init n @@ fun i -> if (String.length @@ string_of_int @@ i + 1) mod 2 = 1 then 1 else 0



Measured memory_bytes: 6136
from copy import deepcopy
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = []
x = []
for i in range(m):
    tmpp,tmpx = map(int,input().split())
    p.append(tmpp)
    x.append(tmpx)
for j in range(len(p)):
    tmplist = deepcopy(t)
    tmplist[p[j]-1] = x[j]
    print(sum(tmplist))

Measured memory_bytes: 3700
#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    int n;
    double* x;
    double* y;
    double D1, D2, D3, Di;

    cin >> n;
    
    x = new double[n];
    y = new double[n];

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

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

    for(int i = 0; i < n; i++){
        D1 += fabs(x[i] - y[i]);
    }
    
    for(int i = 0; i < n; i++){
        D2 += pow(x[i] - y[i], 2);
    }
    D2 = sqrt(D2);

    for(int i = 0; i < n; i++){
        D3 += pow(fabs(x[i] - y[i]), 3);
    }
    D3 = pow(D3, 1.0/3.0);
    
    Di = 0;
    for(int i = 0; i < n; i++){
        if(Di < (fabs(x[i] - y[i]))){
            Di = fabs(x[i] - y[i]);
        }
    }
    

    printf("%.6f\n", D1);
    printf("%.6f\n", D2);
    printf("%.6f\n", D3);
    printf("%.6f\n", Di);

    delete [] x;
    delete [] y;
        
    return 0;
}



Measured memory_bytes: 3416
using System;

class Program {
    static void Main( string[] args )
    {
        string[] s = Console.ReadLine().Split( ' ' );
        int a = int.Parse( s[ 0 ] );
        int b = int.Parse( s[ 1 ] );
        Console.WriteLine( ( a * b ) + " " + ( ( a + b ) * 2 ) );
    }
}

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

int main() {
    int N;
    cin >> N;
    vector<int64_t> A(N);
    vector<int64_t> B(N-1);
    
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    
    for (int i = 0; i < N-1; i++){
        B.at(i) = A.at(i+1) - A.at(i);
    }
    
    queue<int> q;
    
    for (int i = 0; i < N-1; i++){
        if (B.at(i)!=0){
            q.push(B.at(i));
        }
    }
    
    int M = q.size();
    
    int count = 1;
    
    if (M > 1){
        vector<int64_t> C(M);
        vector<int64_t> D(M-1);
        
        for (int i = 0; i < M; i++){
            C.at(i) = q.front();
            q.pop();
        }
        
        
        for (int i = 0; i < M - 1; i++){
            D.at(i)=C.at(i)*C.at(i+1);
            if (D.at(i)<0){
                count++;
                i++;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3840
#include <cstdio>
int readint() {
	char ch = getchar_unlocked();
	int res = 0;
	while('0' <= ch && ch <= '9') {
		res = res * 10 + (ch - '0');
		ch = getchar_unlocked();
	}
	return res;
}
char buf[1024];
void writeint(int x, char endch) {
	int ptr = 0, g;
	while(x > 0) {
		g = x / 10;
		buf[ptr++] = x - g * 10;
		x = g;
	}
	if(ptr == 0) {
		buf[ptr++] = 0;
	}
	while(ptr--) {
		putchar_unlocked(buf[ptr] + '0');
	}
	putchar_unlocked(endch);
}
int cnt[10002];
int main() {
	int N = readint();
	for(int i = 0; i < N; ++i) {
		++cnt[readint() + 1];
	}
	for(int i = 0; i < 10001; ++i) {
		cnt[i + 1] += cnt[i];
	}
	int rem = N;
	for(int i = 0; i < 10001; ++i) {
		int g = cnt[i + 1] - cnt[i];
		for(int j = 0; j < g; ++j) {
			writeint(i, (--rem) ? ' ' : '\n');
		}
	}
	return 0;
}


Measured memory_bytes: 2664
/*
    author: blue_matrix
*/
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
# define M_PI           3.14159265358979323846
#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
#define ll long long

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

    double r;
    cin>>r;
    double ans=2*M_PI*r;
    cout<<fixed<<setprecision(10)<<ans;
    return 0;
}

Measured memory_bytes: 3788
/*
1. I'm the Future Red Coder :)
2. Hopefully, I'll be Yellow Soon.
*/
#include<bits/stdc++.h>
#define mod 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
ll power(ll a,ll b,ll m=mod) {
    if (b==0) return 1;
    ll c = power(a,b>>1,m);
    c = (c*c)%m;
    if (b&1) return (c*a)%m;
    return c;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}
/*struct node {
    int l,r,nq;
};
bool compare(const node& a,const node& b) {
    if (a.r != b.r) return a.r<b.r;
    return a.l<b.l;
}*/
/* ******* DSU START ****** */
/*
const int dsusize = (int)1e5+5;
struct node {
    int data;
    int rk,pn;
}dsu[dsusize];
//ll fans;
void initialize(int n) {
    REP(i,1,n) {
        dsu[i].data = 1;
        dsu[i].rk = 0;
        dsu[i].pn = i;
    }
}
int fnd(int i) {
    if (dsu[i].pn != i) dsu[i].pn = fnd(dsu[i].pn);
    return dsu[i].pn;
}
void unn(int i,int j) {
    i = fnd(i);
    j = fnd(j);
    if (i!=j) {
        //fans -= dsu[i].data*dsu[j].data;
        if (dsu[i].rk>dsu[j].rk) {
            dsu[j].pn = i;
            dsu[i].data += dsu[j].data;
        }
        else {
            dsu[i].pn = j;
            dsu[j].data += dsu[i].data;
            if (dsu[i].rk==dsu[j].rk) {
                dsu[j].rk++;
            }
        }
    }
}
*/
/* ******* DSU END****** */

const int N = (int)2e5+5;
const int Q = 250;
string s;
ll dp[N][13];
void solve() {
    cin>>s;
    int n = s.size();
    s = s+"a";
    reverse(all(s));
    dp[0][0] = 1;
    REP(i,1,12) {
        dp[0][i] = 0;
    }
    int rem,pten = 1;
    REP(i,1,n) {
        REP(j,0,12) {
            if (s[i]!='?') {
                rem = (((int)(s[i]-'0'))*pten)%13;
                rem = (j-rem+26)%13;
                dp[i][j] = dp[i-1][rem];
            }
            else {
                dp[i][j] = 0;
                REP(k,0,9) {
                    rem = (k*pten)%13;
                    rem = (j-rem+26)%13;
                    dp[i][j] += dp[i-1][rem];
                    dp[i][j] %= mod;
                }
            }
        }
        pten = (pten*10)%13;
    }
    cout<<dp[n][5];
}
int main() {
    //freopen("class_treasurer.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 10624
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

struct Point{
	double x,y;
	Point(){}
	Point(double _x,double _y){
		x=_x; y=_y;
	}
};

struct Line{
	double x[2],y[2];
	Line(){}
	Line(Point p,Point q){
		x[0]=p.x; x[1]=q.x;
		y[0]=p.y; y[1]=q.y;
	}
};

void RevXY(Point &p){
	swap(p.x,p.y);
}

void RevXY(Line &l){
	for(int i=0;i<2;i++) swap(l.x[i],l.y[i]);
}

bool Is_SameSide(Line l,Point p,Point q){
	//printf("%lf,%lf - %lf,%lf\np(%lf,%lf),q(%lf,%lf)\n",l.x[0],l.y[0],l.x[1],l.y[1],p.x,p.y,q.x,q.y);
	if(l.x[1]==l.x[0]){
		RevXY(l); RevXY(p); RevXY(q);
	}
	double a,b;
	a = (l.y[1]-l.y[0])/(l.x[1]-l.x[0]);
	b = l.y[0]-a*l.x[0];
	//printf("%lf,%lf - %lf,%lf : y = %lfx+(%lf)\np(%lf,%lf),q(%lf,%lf)\n",l.x[0],l.y[0],l.x[1],l.y[1],a,b,p.x,p.y,q.x,q.y);
	if((p.y-(a*p.x+b))*(q.y-(a*q.x+b))>0) return true;
	else return false;
}

int main(){
	Point S[4];
	while(scanf("%lf,%lf",&S[0].x,&S[0].y)!=EOF){
		Point sum = Point(S[0].x,S[0].y);
		for(int i=1;i<4;i++){
			scanf(",%lf,%lf",&S[i].x,&S[i].y);
			sum.x += S[i].x; sum.y += S[i].y;
		}
		bool ans=true;
		for(int i=0;i<4;i++){
			if(Is_SameSide(Line(S[i],S[(i+2)%4]),S[(i+1)%4],Point((sum.x-S[(i+1)%4].x)/3,(sum.y-S[(i+1)%4].y)/3))==true){
				ans = false;
			}
		}
		if(ans) puts("YES");
		else puts("NO");
	}
}

Measured memory_bytes: 1192
#include <iostream>
#include <string>

using namespace std;

int score(int r, int s, int p, char c) {
  switch (c) {
  case 'r':
    return p;
  case 's':
    return r;
  case 'p':
    return s;
  }
  return 0;
}

int main() {
  int n, k;
  int r, s, p;
  string t;

  cin >> n >> k >> r >> s >> p >> t;

  int sum = 0;

  for (int i = 0; i < n; ++i) {
    if (i < k) {
      sum += score(r, s, p, t[i]);
    }
    else {
      if (t[i] == t[i-k])
        t[i] = 'u';
      sum += score(r, s, p, t[i]);
    }
  }

  cout << sum << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

int c[2000], w[2000], rui[2000];
int f[2000][2000], dp[2000];
signed main(){
	int n;
	scanf("%lld", &n);
	rrep(i,n){
		int x, y;
		scanf("%lld%lld", &x, &y);
		c[i] = x;w[i] = y;
	}
	rrep(i,n)rui[i] = rui[i-1]+w[i];
	drep(i,n,1)repi(j,i,n+1){
		if(i == j)f[i][j] = 1;
		if(f[i][j] == 0)continue;
		if(j+1 <= n and rui[j]-rui[i-1] <= c[j+1])f[i][j+1] = 1;
		if(i-1 >= 1 and rui[j]-rui[i-1] <= c[i-1])f[i-1][j] = 1;
	}
	
	fill(dp, dp+2000, INF);
	dp[0] = 0;
	rrep(i,n)rrep(j,n)if(f[i][j])chmin(dp[j], dp[i-1]+1);
	printf("%lld\n", dp[n]);
	return 0;
}








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

typedef long long ll;

using namespace std;

ll h[51] = {};
ll p[51] = {};

ll f(int n, ll x) {
    if (n == 0) {
        return 1;
    } else if (x <= 1) {
        return 0;
    } else if (x <= h[n - 1] + 1) {
        return f(n - 1, x - 1);
    } else if (x == h[n - 1] + 2) {
        return p[n - 1] + 1;
    } else if (x <= 2 * h[n - 1] + 2) {
        return f(n - 1, x - (h[n - 1] + 2)) + p[n - 1] + 1;
    } else {
        return 2 * p[n - 1] + 1;
    }
}

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

    h[0] = 1, p[0] = 1;
    for (int i = 1; i <= N; i++) {
        h[i] = 2 * h[i - 1] + 3;
        p[i] = 2 * p[i - 1] + 1;
    }

    cout << f(N, X) << endl;
}

Measured memory_bytes: 256
from operator import mul
from functools import reduce
import bisect

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


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

A.sort()
mx = A[N-1]
A.pop()
# print(A)
_r = bisect.bisect_right(A, mx/2)
_l = bisect.bisect_left(A, mx/2)
if N == 2:
    # A = A[::-1]
    A = [mx, A[0]]
    print(*A)
    exit()
# print(mx/2)
# print(_r, _l)
if _r > N-2:
    _r = N-2
if _l > N-2:
    _l = N-2

if abs(A[_l-1]-(mx/2)) > abs(A[_l]-(mx/2)):
    print(mx, A[_l])
else:
    print(mx, A[_l-1])

Measured memory_bytes: 14932
#include <bits/stdc++.h>
using namespace std;
int main(){
  int d;
  cin >> d;
  if (d == 25) cout << "Christmas" << endl;
  else if (d == 24) cout << "Christmas Eve" << endl;
  else if (d == 23) cout << "Christmas Eve Eve" << endl;
  else if (d == 22) cout << "Christmas Eve Eve Eve" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n; 
    cin >> n;
    string s[4] = {"AC", "WA" , "TLE" , "RE"};
    ll ans[4] = {0};
    string t;
    for(int i=0;i<n;i++){
    	cin >> t;
    	for(int j=0;j<4;j++){
    		if(t == s[j]) ans[j]++;
    	}
    }
    for(int i=0;i<4;i++){
    	cout << s[i] << " x ";
    	cout << ans[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3644
function Main(input)
{
  input = input.split("\n");
  /*
  for(let i=0;i<input.length;i+=1)
  {
    console.log(solver(input[i]));
  }
  */
  console.log(solver(input[0]));
}

function solver(arg)
{
  const pattern=/s$/;
  return pattern.test(arg)?
  	arg+"es":arg+"s";
}
  



Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 29612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <math.h>
using namespace std;

int main(void) {

	// TODO: submit前にprintf-debugの削除確認！
	int N;
	cin >> N;

	vector<pair<int, int>> q;
	for(int i=0; i<N; i++) {
		int a, b;
		cin >> a >> b;
		q.push_back(make_pair(b, a));
	}
	sort(q.begin(), q.end());
	bool flg = true;
	long long int sum = 0;
	for(int i=0; i<N; i++) {
		sum += q[i].second;
		if(q[i].first < sum) {
			flg = false;
			break;
		}
	}

	if(flg) {
		cout << "Yes";
	} else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int cnt[100005];
int main(){
	int n,ans=0;
	cin>>n;
	for(int i=0;i<n;++i){
		int x;
		cin>>x;
		++cnt[x];
		++cnt[x+1];
		++cnt[x+2];
	}
	for(int i=0;i<100005;++i)
		ans=max(ans,cnt[i]);
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 640
import java.util.*;
import java.io.*;
import java.lang.*;
// ArrayList<Integer>[] arr=new ArrayList[n];
public class Main{	
public static void main(String[] args) throws FileNotFoundException, IOException{
        Scanner s = new Scanner(System.in);
         StringBuilder sb=new StringBuilder();
         BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
         int n=s.nextInt(),w=s.nextInt();
        int[][] arr=new int[n+1][2];
        long[][] dp=new long[n+1][w+1]; 
        //dp[i][j] holds given set of i points what is max_value we can get from a 
        //subset of given points satisfying the constrain ∑(x co-ord of points)<=j  (1<=k<=i)
        for(int i=1;i<=n;i++){
            arr[i][0]=s.nextInt(); arr[i][1]=s.nextInt();
        }

       /* for(int i=1;i<=n;i++){
            for(int j=1;j<=w;j++){
                if(arr[i][0]>j){
                    dp[i][j]=dp[i-1][j];
                }
                else{
                    dp[i][j]=Math.max(dp[i-1][j],arr[i][1]+dp[i-1][j-arr[i][0]]);
                }
            }
        }*/

        for(int i=1;i<=n;i++){
            for(int j=1;j<=w;j++){
                if(arr[i][0]>j){
                    dp[i][j]=dp[i-1][j];
                }
                else{
                    dp[i][j]=Math.max(dp[i-1][j],arr[i][1]+dp[i-1][j-arr[i][0]]);
                }
            }
        }
        System.out.println(dp[n][w]);
    }
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{	ll N, X, M;
	cin >> N >> X >> M;
	vecl(A);
	pb(A, 0);
	ll ans = 0;
	map<int, int> K;

	while (true) {
		if (A.size()>N) {
			break;
		}
		if (K[X]!=0) {
			int n = A.size() - K[X];
			ans += (N - A.size()+1) / n * (A[A.size() - 1] - A[K[X]-1]);
			if((N - A.size() + 1) % n>0)
			ans += (A[K[X]-1+(N - A.size()+1) % n] - A[K[X]-1]);
			break;
		}
		pb(A, X );
		A[A.size() - 1] += A[A.size() - 2];
		K[X] = A.size() - 1;
		ans += X;
		X *= X;
		X %= M;
	}
	ce(ans)
    return 0;
}



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

int main()
{
        int a;
        cin >> a;
        while (true) {
                int x, y, z;
                x = a / 100;
                y = (a - x * 100) / 10;
                z = a - x * 100 - y * 10;
                if (x == y && y == z)
                        break;
                a++;
        }
        cout << a << endl;

        return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	//#endif
	ll n,x;
	cin>>n>>x;
	cout<<(n*500 >= x ? "Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256