akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 3e3+5;
const lli INF = 1e18;
const lli MOD = 1e9+7;


vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	vi m(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

lli SUM(lli a, lli b, lli mod=MOD){
	return (a+b+mod)%mod;
}
lli PROD(lli a, lli b, lli mod=MOD){
	a%=mod; b%=mod;
	return a*b % mod;
}
int dx[4]={-1,0,0,1}, dy[4]={0,1,-1,0};

// ---- コーディングはここから！ ('-')7


typedef vvl Matrix;
Matrix ones(int n) {
	Matrix r(n,vl(n));
	fore(i,0,n)r[i][i]=1;
	return r;
}
Matrix operator*(Matrix &a, Matrix &b) {
	int n=sz(a),m=sz(b[0]),z=sz(a[0]);
	Matrix r(n,vl(m));
	fore(i,0,n)fore(j,0,m)fore(k,0,z)
		r[i][j]+=a[i][k]*b[k][j],r[i][j]%=MOD;
	return r;
}
Matrix be(Matrix b, lli e) {
	Matrix r=ones(sz(b));
	while(e){if(e&1LL)r=r*b;b=b*b;e/=2;}
	return r;
}


void solve(){
	lli n,k; cin>>n>>k;
	Matrix v(n,vl(n));
	fore(i,0,n)fore(j,0,n)cin>>v[i][j];
	auto res = be(v,k);
	lli rr = 0;
	fore(i,0,n)fore(j,0,n)rr=SUM(rr,res[i][j]);
	cout<<rr<<ENDL;
}

int main(){_
	//int t; cin>>t; while(t--)
	solve();
}


Measured memory_bytes: 3720
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
}


Measured memory_bytes: 3596
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a;
    cin >> a;
    cout << a[0] << a.length() - 2 << a[a.length() - 1];
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		String a = String.valueOf(n);
		
		char[] s = a.toCharArray();
		
		if(s[0] == '7'||s[1] == '7'||s[2] == '7') {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		}	
 	}



Measured memory_bytes: 35704
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    ll n, k;
    cin >> n >> k;
    n %= k;
    cout << min(n, abs(n - k)) << endl;
    return 0;
}




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

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    char d = a[0];
    char e = b[0];
    char f = c[0];
    d = toupper(d);
    e = toupper(e);
    f = toupper(f);
    cout << d << e << f << endl;
}


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

int main(){
  int n;	cin >> n;
  vector<int>	p(n);
  for(int i=0;i<n;i++){
    cin >> p.at(i);
  }
  
  vector<int> mi(n);
  int m=n;
  for(int i=0;i<n;i++){
    m=min(m,p.at(i));
    mi.at(i)=m;
  }
  
  int ans=0;
  for(int i=0;i<n;i++){
    if(p.at(i)>mi.at(i))	continue;
    ans++;
  }
  cout << ans;
}

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

int main() {
    string n;
    cin >> n;
    int digit_sum = 0;
    for (int i = 0; i < n.size(); i++) {
        digit_sum += (n[i] - '0');
    }
    cout << (digit_sum % 9 == 0 ? "Yes" : "No") << endl;
    return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;
    int plug = 1;
    int ans = 0;
    for (int i = 0; ; i++){
        if (plug >= B){
            break;
        }
        plug = plug + A - 1;
        ans ++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
"use strict"

const main = (input) => {
    const S = input.split("");
    if (S[0] == S[1] && S[1] == S[2] && S[2] == S[3]) {
        console.log("No");
    } else if (S[0] == S[1] && S[2] == S[3]) {
        console.log("Yes");
    } else if (S[0] == S[2] && S[1] == S[3]) {
        console.log("Yes");
    } else if (S[0] == S[3] && S[1] == S[2]) {
        console.log("Yes");
    } else {
        console.log("No");
    }
};

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

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>
#include <stack>
#include <cstring>
#include <cctype>
#include <random>

using namespace std;
typedef long long  ll;
const ll INF = 1000000007;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
	string n;
	cin >> n;
	reverse(n.begin(), n.end());
	switch (n[0]) {
	case '1':
	case '0':
	case '6':
	case '8':
		cout << "pon" << endl;
		break;
	case '2':
	case '4':
	case '5':
	case '7':
	case '9':
		cout << "hon" << endl;
		break;
	case '3':
		cout << "bon" << endl;
		break;

	}
	return 0;
}

Measured memory_bytes: 3580
using System;
 
class Program
{
    static void Main()
    {
        //int N = Int32.Parse(Console.ReadLine());
        //string a = Console.ReadLine();
        char a = Console.ReadLine()[0];
        
        if (Char.IsUpper(a))
        {
            Console.Write("A");
        }else{
            Console.Write("a");
        }

    }
}

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

int main(){
  int n;
  string s[155];
  while(1){
    cin>>n;
    if(n==0)break;
    int cnt=0;
    for(int i=0;i<n;i++) cin>>s[i];
    for(int i=0;i<n-1;i++){
      if((s[i+1]=="lu"&&s[i]=="ru")||(s[i]=="lu"&&s[i+1]=="ru")){
	i++;
	cnt++;
      }else if((s[i+1]=="ld"&&s[i]=="rd")||(s[i]=="ld"&&s[i+1]=="rd")){
	i++;
	cnt++;
      }
    }
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 2992
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "vector"
#include "string"
#include "map"
#include "unordered_map"
#include "algorithm"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	int cnt = 0;
	long long int gl = 0;
	vector<long long int>v(N);
	for (int i = 0; i < N; i++) {
		v[i] = i + 1;
		gl += v[i] << (i<<2);
	}
	for (int i = 0; i < N; i++)cin >> v[i];
	unordered_map<long long int,int>dis;
	long long int bag = 0;
	for (int i = 0; i < N; i++) {
		bag += (v[i] << (i<<2));
	}
	dis[bag] = 0;
	queue<long long int>Q;
	Q.push(bag);
	while (!Q.empty()) {
		long long int cn = Q.front();
		if (dis[cn] == 5)break;
	//	cout << cn << endl;
		Q.pop();
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				long long int cc = cn;
				for (int k = i; k < (i + j + 1) / 2; k++) {
					long long int a = (cc >> (k<<2)) & ((1 << 4)-1);
					long long int b = (cc >> ((i + j - k)<<2)) & ((1 << 4)-1);
		//			cout << i << " " << j << " " << a << " " << b << endl;
					cc += (b - a) << (k<<2);
					cc += (a - b) << ((i + j - k)<<2);
				}
				if (dis.find(cc) == dis.end()) {
					dis[cc] = dis[cn] + 1;
					Q.push(cc);
				}
				else if (dis[cc] > dis[cn] + 1) {
					dis[cc] = dis[cn] + 1;
					Q.push(cc);
				}
			}
		}
	}
	queue<long long int>QQ;
	unordered_map<long long int, int>ddis;
	ddis[gl] = 0;
	QQ.push(gl);
	while (!QQ.empty()) {
		long long int cn = QQ.front();
		if (ddis[cn] == 4)break;
	//		cout << cn << endl;
		QQ.pop();
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				long long int cc = cn;
				for (int k = i; k < (i + j + 1) / 2; k++) {
					long long int a = (cc >> (k << 2)) & ((1 << 4) - 1);
					long long int b = (cc >> ((i + j - k) << 2)) & ((1 << 4) - 1);
					//			cout << i << " " << j << " " << a << " " << b << endl;
					cc += (b - a) << (k << 2);
					cc += (a - b) << ((i + j - k) << 2);
				}
				if (ddis.find(cc) == ddis.end()) {
					ddis[cc] = ddis[cn] + 1;
					QQ.push(cc);
				}
				else if (ddis[cc] > ddis[cn] + 1) {
					ddis[cc] = ddis[cn] + 1;
					QQ.push(cc);
				}
			}
		}
	}
	int ans = 100;
	for (auto i : dis) {
		if (ddis.find(i.first) == ddis.end())continue;
		ans = min(i.second + ddis[i.first], ans);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 79616
#include <algorithm>
#include <iostream>

using namespace std;

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

    unsigned long long min_div_count = 1ULL << 60;
    for (int i = 0; i < N; i++) {
        unsigned long long ai;
        cin >> ai;

        unsigned long long div_count = 0;
        while (!(ai & 1) && div_count < min_div_count) {
            ai >>= 1;
            div_count++;
        }
        min_div_count = min(div_count, min_div_count);
    }

    cout << min_div_count << endl;
    return 0;
};


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

int32_t main() {
  int m, d;
  scanf("%d%d", &m, &d);

  int ans = 0;

  for (int i = 22; i <= d; i++) {
    int d1 = i / 10;
    int d10 = i % 10;

    if (d1 * d10 <= m && d1 >= 2 && d10 >= 2) {
      ans++;
    }
  }

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int32_t N, M;
  cin >> N >> M;
  vector<double> A(N);
  int sum = 0;
  for (auto& a : A) {
    cin >> a;
    sum += a;
  }
  sort(A.begin(), A.end(), greater<double>());
  for (int i = 0; i < M; i++) {
    if (A[i] < (double)sum / 4 / M) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}


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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;
        static long ans = 0;


        static void Main(string[] args)
        {
            var s = Console.ReadLine().Select(x => x).ToArray();
            var ans=Dfs(1, s, ""+s[0],0);

            Console.WriteLine(ans);

        }

        static long Dfs(long i,char[] s, string f,long sum)
        {
            if (i == s.Length )
            {
                sum = f.Split('+').Select(x => long.Parse("" + x)).Sum();
                return sum;
            }


            return Dfs(i + 1, s, f + "+" + s[i],0) + Dfs(i + 1, s, f + s[i],0);
        }



        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }
        
        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }

        
       
    }
}


Measured memory_bytes: 13396
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(void){
    // Your code here!
    int N, cnt = 0;
    int temp;
    vector<int> v;
    
    cin >> N;
    for(int i=0; i<N; i++){
        scanf("%d", &temp);
        v.push_back(temp);
    }
    
    for(int i=1; i<N-1; i++){
        if((v[i] - v[i-1]) * (v[i] - v[i+1]) < 0)   cnt++;
    }
    
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve() {
    int a,b,m;
    cin >> a >> b >> m;
    VI as(a), bs(b);
    REP(i,0,a) cin >> as[i];
    REP(i,0,b) cin >> bs[i];
    int x,y,c;
    int ans = *min_element(all(as)) + *min_element(all(bs));
    REP(i,0,m) {
        cin >> x >> y >> c;
        int sum = as[x-1] + bs[y-1] - c;
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <array>
#include <string>
#include <map>
#include <cmath>
//#include <iomainp>
using namespace std;

#define DB(x)
#define rep(i, n) for(int i = 0;i < n;i++)


int getIntSp(){
    string str;
    getline(cin,str,' ');
    return stoi(str);
}

int getIntLF(){
    string str;
    getline(cin,str);
    return stoi(str);
}



int main()
{
    int A,B;
    cin >> A >> B;
    
    int ary[3] = {1,2,3};
    
    ary[A-1] = 0;
    ary[B-1] = 0;
    
    rep(i,3){
        if( 0 != ary[i] ){
            cout << ary[i] << endl;
            return 0;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] array = str.split("");
        if (array[2].equals(array[3])){
            if (array[4].equals(array[5])){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
        }else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 23636
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int [] arr ={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	//	Arrays.sort(arr);
	   int k = scn.nextInt();
	     System.out.println(arr[k-1]);
	   

	}
	public static void res(){
		   
	}

}

Measured memory_bytes: 23508
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

#define debug(x) cout << #x << ": " << x << endl;
#define ll long long
#define mod 1000000007

#define COMMENT

int A[1<<20], B[1<<20], N;

int _xor(int a, int b) {
  return a ^ b;
}

string getBinary30(int num) {
  string out;
  for(int i = 29;i >= 0;i--) {
    char _bit = ((1<<i) & num) ? '1' : '0';
    out.push_back(_bit);
  }

  return out;
}

int lps[7000099];
string text;
string pattern;
vector<int> match_index;

void build_lps() {
    int N = pattern.size();
    for(int i = 2;i <= N;i++) {
        int prev = i-1;
        while(prev != 0) {
            if(pattern[lps[prev]] == pattern[i-1]) {
                lps[i] = lps[prev]+1;
                break;
            }
            prev = lps[prev];
        }
    }
}

void find_pattern() {
    int i = 0, j = 1;
    while(i < text.size()) {
        if(j == 1 && pattern[j-1] != text[i]) {
            i += 1;
        }
        else if(j == pattern.size() && pattern[j-1] == text[i]) {
            match_index.push_back(i+1-pattern.size());
            i++;
            j = lps[j]+1;
        }
        else if(pattern[j-1] == text[i]) {
            i++;j++;
        } else {
            j = lps[j-1]+1;
        }
    }
}

int main() {

//  freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);

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

  for(int i = 0;i < N;i++) {
    text += getBinary30(_xor(A[i], A[(i+1)%N]));
    pattern += getBinary30(_xor(B[i], B[(i+1)%N]));
  }

  text += text;

  build_lps();
  find_pattern();

  for(auto in: match_index) {
    // debug(in);
    if((in % 30) != 0) continue;

    if((in/30) < N) {
      cout << (in/30) << " " << _xor(A[in/30], B[0]) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 91344
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int N, M, Q;
int ans;
vector<int> a(51), b(51), c(51), d(51), A(12);

void dfs(int k, int n) {
    A[k] = n;
    if (k > N) return;
    if (k == N) {
        int res = 0;
        rep(i, Q) {
            if (A[b[i]] - A[a[i]] == c[i]) res += d[i];
        }
        chmax(ans, res);
    }
    repd(i, n, M + 1) {
        dfs(k + 1, i);
    }
}
int main()
{
    cin >> N >> M >> Q;
    
    rep(i, Q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    dfs(1, 1);

    cout << ans << endl;
    return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

ll H,W,K;
ll dp[101][9];

int main() {
    cin >> H >> W >> K;

    dp[0][1] = 1LL;
    for(ll h=0; h<H; h++) {
        for(ll w=1; w<=W; w++) {
            if(!dp[h][w]) continue;
            int lines[W];
            lines[0] = 0;
            ll count[3] = {0, 0, 0};
            for(int i=0;i<(1<<(W-1));i++) {
                for(int j=0;j<W-1;j++) {
                    if(i & (1 << j)) lines[j+1] = 1;
                    else lines[j+1] = 0;
                }

                bool valid = true;
                for(int j=1;j<=W-2;j++) {
                    if(lines[j] & lines[j+1]) {
                        valid = false;
                        break;
                    }
                }
                if(!valid) continue;

                if(w < W && lines[w]) {
                    count[2]++;
                } else if(w > 1 && lines[w-1]){
                    count[0]++;
                } else {
                    count[1]++;
                }
            }
            dp[h+1][w+1] += (dp[h][w] * count[2]) % MOD;
            dp[h+1][w+1] %= MOD;
            dp[h+1][w-1] += (dp[h][w] * count[0]) % MOD;
            dp[h+1][w-1] %= MOD;
            dp[h+1][w] += (dp[h][w] * count[1]) % MOD;
            dp[h+1][w] %= MOD;
        }
    }

    cout << dp[H][K] << endl;
}

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

int main() {
    int a,b;
    cin >> a >> b;
    if(1 != a && 1 != b){
        cout << 1 << endl;
    }
    else if(2 != a && 2 != b){
        cout << 2 << endl;
    }
    else if(3 != a && 3 != b){
        cout << 3 << endl;
    }
}


Measured memory_bytes: 256
//
// Created by kuribohkute on 20/04/2019.
//
#include <iostream>
using namespace std;
int n;
string s;
const int N = 200005;
int f[N], g[N];
int main () {
    cin >> n >> s;
    f[0] = 0;
    g[0] = 1;
    for (int i = 1; i < n; i++) {
        f[i] = g[i] = n;
        if (s[i] == '.' && s[i - 1] == '#') {
            f[i] = g[i - 1];
            g[i] = f[i - 1] + 1;
        }
        if (s[i] == '#' && s[i - 1] == '.') {
            f[i] = min(f[i], min(f[i - 1], g[i - 1]));
            g[i] = min(g[i], f[i - 1] + 1);
        }
        if (s[i] == '.' && s[i - 1] == '.') {
            g[i] = min(g[i], min(f[i - 1] + 1, g[i - 1] + 1));
            f[i] = min(f[i], f[i - 1]);
        }
        if (s[i] == '#' && s[i - 1] == '#') {
            f[i] = min(f[i], min(f[i - 1], g[i - 1]));
            g[i] = min(g[i], g[i - 1] + 1);
        }
    }
    cout << min(f[n - 1], g[n - 1]);
    return 0;
}


Measured memory_bytes: 2180
n = int(input())
d1 = {}
for i in range(n):
  s = input()
  if s not in d1.keys():
    d1[s] = 1
  else:
    d1[s] += 1
m = int(input())
for j in range(m):
  t = input()
  if t not in d1.keys():
    d1[t] = -1
  else:
    d1[t] -= 1
print(max(d1.values()) if max(d1.values()) > 0 else 0)

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

#define int long long int

void fileioe(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout); 
	freopen("error.txt","w",stderr);
}
#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
#define fioe() fileioe()
#else
#define fioe() 1
#endif
//!

bool ispall(string s){
	string x = s;
	reverse(x.begin(),x.end());
	return x == s;
}

int32_t main()
{
	GO
	//fioe();
	string s;
	cin>>s;
	int len = s.length();
	if(ispall(s) && ispall(s.substr(0,len/2)) && ispall(s.substr(len/2+1,len/2))){
		cout<<"Yes"<<endl;
	}	
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
a,b,c,k = map(int,input().split())
ans = 0
cur = min(k,a)
ans = ans + cur
k = k - cur
k = max(0,k)
cur = min(k,b)
k = k - cur
k = max(0,k)
cur = min(k,c)
ans = ans - cur

print(ans)

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

int main() {
  string memo;
  int num, temp;

  num = 0;
  while(cin >> memo) {
    temp = 0;
    for(int i = 0; i <= (int)memo.size(); i++){
      if(memo[i] - '0' >= 0 && memo[i] - '0' <= 10) {
        temp = temp * 10;
        temp += (memo[i] - '0');
      }
      else {
        num += temp;
        temp = 0;
      } 
    }   
  num += temp;
  }

  cout << num << endl;

  return 0;
}



Measured memory_bytes: 3188
import java.io.*;
import java.util.*;

public class Main{
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;
    static void solve(InputReader in, PrintWriter out){
        String s = in.ns();
        if(kai(s)&&kai(s.substring(0,(s.length()-1)/2))&&kai(s.substring((s.length()+3)/2-1,s.length()))){
            out.println("Yes");
        }else out.println("No");

    }
    public static boolean kai(String s){
        boolean flag = true;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i)!=s.charAt(s.length()-i-1)) flag = false;
        }
        return flag;
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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

using namespace std;
using VI = vector<int>;
using VPI = vector<pair<int, int>>;
using LL = long long;

#define FOR(a,n) for(int i=a;i<n;i++)
#define rFOR(a,n) for(int i=n-1;i>=a;i--)
#define IN(n,a) for(int i=0;i<n;i++) cin>>a[i]
#define pIN(n,t) for(int i=0;i<n;i++){int a,b; cin>>a>>b; t.emplace_back(a,b);}
#define SORT(a) sort(a.begin(), a.end())
#define ALL(a) a.begin(), a.end()

int main()
{
	LL a, b, k, ans1, ans2;
	cin >> a >> b >> k;
	if (a >= k)
	{
		ans1 = a - k;
		ans2 = b;
	}
	else
	{
		ans1 = 0;
		ans2 = b - (k - a);
	}

	if (ans1 < 0)ans1 = 0;
	if (ans2 < 0)ans2 = 0;

	cout << ans1 << " " << ans2;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let (n, m) = read_cols!(usize, usize);
    let mut a = read_vec::<i64>();

    assert_eq!(a.len(), m);

    a.sort();

    let mut dp = vec![None; 10001];
    dp[0] = Some(String::new());
    let result = a.iter().fold(dp, |dp, &aa| {
        let cost: usize = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6][aa as usize];
        dp.into_iter()
            .fold(Vec::<Option<String>>::new(), |mut dp, row| {
                if dp.len() < cost {
                    dp.push(row);
                    return dp;
                }
                let next = {
                    let prev = &dp[dp.len() - cost];
                    prev.as_ref()
                        .map(|prev| {
                            let candidate = aa.to_string() + prev;
                            match row {
                                None => Some(candidate),
                                Some(ref old) => {
                                    if old.len() < candidate.len() {
                                        Some(candidate)
                                    } else if old.len() > candidate.len() {
                                        Some(old.clone())
                                    } else {
                                        Some(max(old.clone(), candidate))
                                    }
                                }
                            }
                        })
                        .unwrap_or(row.clone())
                };
                dp.push(next);
                dp
            })
    });
    let ans = result[n].as_ref().unwrap();

    println!("{}", ans);
}


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

int main() {
    int N; cin >> N;
    vector<vector<int> > a(N, vector<int>(3));
    for(int i = 0; i < N; ++i) for(int j = 0; j < 3; ++j) cin >> a[i][j];
    
    vector<vector<long long> > dp(N+1, vector<long long>(3, 0));
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < 3; ++j) {
            for(int k = 0; k < 3; ++k) {
                if(j == k) continue;
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + a[i][k]);
            }
        }
    }
    
    long long res = 0;
    for(int j = 0; j < 3; ++j) res = max(res, dp[N][j]);
    cout << res << endl;
}


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

int main(){
  int count = 0;
  string s;
  int i;

  cin >> s;

  size_t n = s.length();

  for (i = 0; i < n; i++){
    if (i % 2 == 0){
      if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D'){
      }else{
        count = count + 1;
        break;
      }
    }else{
      if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D'){
      }else{
        count = count + 1;
        break;
    }
  }
}
  if (count == 0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}


Measured memory_bytes: 256
h, w = map(int, input().split())
A = [input() for i in range(h)]

updated = True
while updated:
    updated = False
    newA = []
    for i in range(len(A)):
        if len(set(A[i])) == 1 and A[i][0] == '.':
            updated = True
        else:
            newA.append(A[i])
    A = newA
    newA = []
    for j in range(len(A[0])):
        tmp = [A[i][j] for i in range(len(A))]
        if len(set(tmp)) == 1 and A[0][j] == '.':
            updated = True
        else:
            newA.append(tmp)
    A = [['.' for j in range(len(newA))] for i in range(len(newA[0]))]
    for i in range(len(newA)):
        for j in range(len(newA[i])):
            A[j][i] = newA[i][j]
#     print()
#     for i in range(len(A)):
#         print("".join(A[i]))
# print()

for i in range(len(A)):
    print("".join(A[i]))


Measured memory_bytes: 3192
k = int(input())
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t;
    cin >> t;
    vector<lli> v;
    lli m = 0, ans = 0;
    for1(i, 0, t)
    {
        lli k;
        cin >> k;
        if (m > k)
        {
            ans += (m - k);
        }
        m = max(m, k);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define STACK_SIZE 100  /* スタックデータ数の最大値 */

int stack[STACK_SIZE],top;
 
void push(int x){
    stack[++top] = x;
}
 
int pop(){
    top--;
    return stack[top + 1];
}

int main(void)
{
     int a, b;
    top = 0;
    char s[100];
 
    while(scanf("%s",s) != EOF){
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a + b);
        }else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        }else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        }else{
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
 
    return 0;
}


Measured memory_bytes: 2060
n = gets.to_i
a = gets.split.map(&:to_i)
if a.uniq.size == 1
  puts a[0].zero? ? 'Yes' : 'No'
elsif a.uniq.size == 2
  puts a.count(0) * 3 == n ? 'Yes' : 'No'
elsif a.uniq.size == 3
  b = Array.new(30, 0)
  a.each do |x|
    30.times do |i|
      b[i] += x[i]
    end
  end
  puts b.select{_1.odd?}.any? ? "No" : "Yes"
else
  puts 'No'
end

Measured memory_bytes: 23772
def find(x):
    if x != T[x][0]:
        while x!=T[x][0]:
            x = T[x][0]
    return x
def union(x,y):
    rt0 = find(x)
    rt1 = find(y)
    if T[rt0][1]>T[rt1][1]:
        T[rt1][0] = rt0
    elif T[rt0][1]==T[rt1][1]:
        T[rt1][0] = rt0
        T[rt0][1] += 1
    else:
        T[rt0][0] = rt1

N,M = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(M)]
T = {i:[i,0] for i in range(1,N+1)}
C = {i:1 for i in range(1,N+1)}
cnt = 0
a = (N*(N-1))//2
B = []
for j in range(M-1,-1,-1):
    B.append(a-cnt)
    x,y = A[j]
    if find(x)!=find(y):
        k1 = C[find(x)]
        k2 = C[find(y)]
        cnt = cnt-((k1*(k1-1))//2+(k2*(k2-1))//2)
        union(x,y)
        k3 = k1+k2
        C[find(x)] = k3
        cnt += (k3*(k3-1))//2
for j in range(M-1,-1,-1):
    print(B[j])

Measured memory_bytes: 109396
import math
A,B,H,M=map(int,input().split())

minutes=H*60+M

A_angle=360*minutes/(12*60)
A_angle=A_angle%360
B_angle=M*6
A_rad=math.radians(A_angle)
B_rad=math.radians(B_angle)
dlt_rad=abs(A_rad-B_rad)
C=math.sqrt(A**2+B**2-2*A*B*math.cos(dlt_rad))
print(C)

Measured memory_bytes: 9428
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>

using namespace std;

#define int long long
typedef long double ld;
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<vi>
#define viii vector<vii>
#define vpii vector<pii>
#define vb vector<bool>
#define vbb vector<vb>
#define vs vector<string>
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define in(a, x) for (int i = x; i < (a).size(); ++i) cin >> (a)[i]
#define out(a) for (auto qwe : a) cout << qwe << " "

const int INF = 1e9;
const int INF64 = 1e16; // todo 16 -> 18
const int MOD = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int P = 37;

const int mxn = 200000;

struct SegTree {
    vi t;
    vi d;
    int m = 1;

    SegTree(int n) {
        while (m < n) m <<= 1;
        t.assign(2 * m, 0);
        d.assign(2 * m, 0);
    }

    void push(int v) {
        t[v] += d[v];

        if (v < m) {
            d[v << 1] += d[v];
            d[(v << 1) + 1] += d[v];
        }

        d[v] = 0;
    }

    int getmax(int v, int tl, int tr, int l, int r) {
        push(v);

        if (tl > r || tr < l) return -INF64;

        if (tl >= l && tr <= r) {
            return t[v];
        }

        int mid = (tl + tr) >> 1;

        return max(getmax(v << 1, tl, mid, l, r),
                    getmax((v << 1) + 1, mid + 1, tr, l, r));
    }

    int getmax(int l, int r) {
        return getmax(1, 1, m, l, r);
    }

    void add(int v, int tl, int tr, int l, int r, int x) {
        push(v);

        if (tl > r || tr < l) return;

        if (tl >= l && tr <= r) {
            d[v] += x;
            push(v);
            return;
        }

        int mid = (tl + tr) >> 1;

        add(v << 1, tl, mid, l, r, x);
        add((v << 1) + 1, mid + 1, tr, l, r, x);

        if (v < m)
            t[v] = max(t[v << 1], t[(v << 1) + 1]);
    }

    void add(int l, int r, int x) {
        add(1, 1, m, l, r, x);
    }
};

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

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

    vector<pair<pii, int>> q(m);
    for (int i = 0; i < m; ++i) {
        cin >> q[i].ff.ss >> q[i].ff.ff >> q[i].ss;
    }

    sort(all(q));

    int ind = 0;

    SegTree t(n + 1);

    for (int i = 1; i <= n; ++i) {
        int mx = t.getmax(1, i);
        t.add(i, i, mx);

        while (ind < m && q[ind].ff.ff == i) {
            t.add(q[ind].ff.ss, q[ind].ff.ff, q[ind].ss);
            ++ind;
        }
    }

    cout << max(t.getmax(1, n), 0ll);
}

Measured memory_bytes: 16128
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	m := make(map[string]int)

	count := n
	var s string
	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		m[s]++
		if m[s] > 1 {
			count--
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 22128
#include <stdio.h>
#include <string.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool pal(const char *s) {
    const int n = strlen(s);
    rep (i, n) if (s[i] != s[n-1-i]) return false;
    return true;
}

int main() {
    int ans = 0;
    char s[128];
    while (scanf("%s", s) != EOF) if (pal(s)) ans++;
    printf("%d\n", ans);
    return 0;
}

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

int main(){
    int x;
    cin >> x;
    if(x % 7 == 1){
        cout << "fri" << endl;
    }
    if(x % 7 == 2){
        cout << "sat" << endl;
    }
    if(x % 7 == 3){
        cout << "sun" << endl;
    }
    if(x % 7 == 4){
        cout << "mon" << endl;
    }
    if(x % 7 == 5){
        cout << "tue" << endl;
    }
    if(x % 7 == 6){
        cout << "wed" << endl;
    }
    if(x % 7 == 0){
        cout << "thu" << endl;
    }
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define p_q priority_queue
#define MN 1000000009
#define top front

int n, m, b, d, t, p3[16], x, lst[3], dp[15000000];
queue<pii> q;
void bfs(){
    while(!q.empty()){
        b=q.top().x; d=q.top().y; q.pop();
        if (b==0 || b==p3[n]-1){
            if (m<d) break;
            cout << d << endl;
            return;
        }
        //cout << b << ' ' << d << endl;
        if (d>=dp[b]) continue;
        dp[b]=d;
        lst[2]=-1; lst[1]=-1; lst[0]=-1; t=b;
        for (int l=0; l<n; ++l){
            lst[t%3]=l; t/=3;
            //cout << l << ' ';
        }
        //cout << lst[0] << ' ' << lst[1] << ' ' << lst[2] << endl;
        for (int l=0; l<3; ++l){
            if (lst[l]!=-1){
                if (l!=1){
                    if (lst[1]<lst[l]){
                        t=b;
                        t+=p3[lst[l]]*(1-l);
                        q.push(mp(t, d+1));
                    }
                } else {
                    if (lst[1]>lst[0]){
                        t=b;
                        t-=p3[lst[l]];
                        q.push(mp(t, d+1));
                    }
                    if (lst[1]>lst[2]){
                        t=b;
                        t+=p3[lst[l]];
                        q.push(mp(t, d+1));
                    }
                }
            }
        }
    }
    cout << -1 << endl;
}
int main(){
    p3[0]=1; for (int l=1; l<16; ++l) p3[l]=p3[l-1]*3;
    while(cin >> n >> m){
        if (n==0) break;
        memset(dp, 0x3f3f3f3f, sizeof dp);
        while(!q.empty()) q.pop();
        b=0;
        for (int l=0; l<3; ++l){
            cin >> t;
            for (int l2=0; l2<t; ++l2){
                cin >> x;
                b+=p3[x-1]*l;
            }
        }
        q.push(mp(b, 0));
        bfs();
    }
    return 0;
}

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

int main() {
 ll n;
  cin>>n;
  vector<pair<ll,ll>> p(n);
  rep(i,n) {
    ll a,b;
    cin>>a>>b;
    p[i]=make_pair(b,a); 
  }
  /////////////
  bool ans=true;
  sort(all(p));//早い順
  ll cnt=0;
  rep(i,n){
      
    cnt+=p[i].second;
    if(p[i].first<cnt){//期限を超えた
       ans=false;
      break;
    }
    
    
  }
  
  
  
  
  
  
  
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
ll made()
{
	char s0;
	ll ans=0;
	s0=getchar();
	while(s0>='0'&&s0<='9')
	{
		ans=ans*10;
		ans+=s0-'0';
		s0=getchar();
	}
	return ans;
}
int main()
{
	ll a1=made();
	ll a2=made();
	int count=1;
	while(2*a1<=a2)
	{
		count++;
		a1=a1*2;
	}
	printf("%d\n",count);
}

Measured memory_bytes: 128
#C
n, m = map(int, input().split())
l = []
ans = 0
for i in range(m):
    l.append(list(map(int, input().split())))
for i in range(m):
    del l[i][0]
p = list(map(int, input().split()))
for i in range(2**n):
    for j in range(m):
        cnt_on = 0 
        for num in range(n):
            if ((i >> num) & 1) and (n-num in l[j]):
                cnt_on += 1
        if cnt_on % 2 != p[j]:
            break
    else:
        ans += 1        
print(ans)

Measured memory_bytes: 41584
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

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

	vector<int> a(N);
	vector<int> b(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}

	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());

	long long cnt = 0;
	for (int i = 0; i < b.size(); i++) {
		if (b[i] > a[0] && H > 0) {
			H -= b[i];
			cnt++;
		}
		else {
			break;
		}
	}
	
	if (H > 0) {
		cnt += ceil(double(H) / double(a[0]));
	}

	cout << cnt << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <array>

int main()
{
    int n;
    std::cin>>n;
    std::array<int, 20>p;
    for(int a=0; a<n; ++a){
        std::cin>>p.at(a);
    }
    int i=0;
    int j;
    for (j=1; j<n-1; ++j){
        if (p.at(j+1)==0){
            break;
        } else if (p.at(j-1)<=p.at(j) && p.at(j)<=p.at(j+1)){
            ++i;
        } else if (p.at(j+1)<=p.at(j) && p.at(j)<=p.at(j-1)){
            ++i;
        }
    }
    std::cout<<i<<std::endl;
    return 0;
}

Measured memory_bytes: 256