akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<set>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cassert>
#include<climits> 

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define MAX 300002
 
using namespace std;
typedef unsigned long long ull;

int n,m,L,R,keta;
char s[MAX],o[5];
set<ull> ans;
const ull B = 9973ULL;
const ull inv = 9063375710536127837ULL;
ull H,Bmax[MAX];

 

int main()
{
 
  //cout << ULLONG_MAX << endl;
  //cout << mod_inv(1000000007ULL,18446744073709551616ULL) << endl; 

  Bmax[0] = 1ULL;
  REP(i,1,MAX)Bmax[i] = Bmax[i-1] * B;
  L = R = keta = 0;
  scanf("%d %d",&n,&m);
  scanf("%s",&s[0]);
  H = s[0];


  rep(_,m)
    {
      scanf("%s",&o[0]);
 
      if(o[0] == 'R')
	{
	  if(o[1] == '+')
	    {
	      H = H * B + s[++R];
	    }
	  else
	    {

	      H = (H - s[R--]) * inv;
	    }
	}
      else
	{
	  if(o[1] == '+')
	    {
	      H = H - Bmax[R-L] * s[L++];
	    }
	  else
	    {
	      H = H + Bmax[R+1-L] * s[L-1];
	      L--;
	    }
	}
  
      ans.insert(H);
    } 
  
  cout << ans.size() << endl;
 
  return 0;
}

Measured memory_bytes: 17904
S = input()
T = ""
B = ""
f = 1
for _ in range(int(input())):
    L = list(input().split())
    if L[0] == "1":
        f *= -1
    else:
        if f == 1:
            if L[1] == "1":
                T += L[2]
            else:
                B += L[2]
        else:
            if L[1] == "1":
                B += L[2]
            else:
                T += L[2]

if f == 1:
    print(T[::-1]+S+B)
else:
    print(B[::-1]+S[::-1]+T)


Measured memory_bytes: 9928
import sys
sys.setrecursionlimit(10 ** 6)
S = input()
def func(i):
    if i >= len(S):
        return True
    if (S[i:i+5] == 'dream' or S[i:i+5] == 'erase') and func(i + 5):
        return True
    if (S[i:i+7] == 'dreamer') and func(i + 7):
        return True
    if (S[i:i+6] == 'eraser') and func(i + 6):
        return True
    return False

print('YES' if func(0) else 'NO')


Measured memory_bytes: 17096
//this is a copy



#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int H, W, K, A[309][309], num;
int cnt[309];
char c[309][309];

void solve(int cl, int cr) {
	vector<int> P;
	for (int i = cl; i <= cr; i++) {
		for (int j = 1; j <= W; j++) {
			if (c[i][j] == '#') P.push_back(j);
		}
	}
	sort(P.begin(), P.end());

	for (int i = 0; i < P.size(); i++) {
		int v1 = 1, v2 = W;
		if (i >= 1) v1 = P[i - 1] + 1;
		if (i < (int)P.size() - 1) v2 = P[i];

		num++;
		for (int j = cl; j <= cr; j++) {
			for (int k = v1; k <= v2; k++) A[j][k] = num;
		}
	}
}

int main() {
	cin >> H >> W >> K;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> c[i][j];
			if (c[i][j] == '#') cnt[i]++;
		}
	}

	vector<int> vec;
	for (int i = 1; i <= H; i++) { if (cnt[i] >= 1) vec.push_back(i); }
	for (int i = 0; i < vec.size(); i++) {
		int v1 = 1, v2 = H;
		if (i >= 1) v1 = vec[i - 1] + 1;
		if (i < (int)vec.size() - 1) v2 = vec[i];

		solve(v1, v2);
	}

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (j >= 2) cout << " "; cout << A[i][j];
		}
		cout << endl;
	}
	return 0;
}


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

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

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

	ll res = 0;
	int n = N / 2;
	if (N % 2 == 0) {
		ll x = 0, y = 0;
		for (int i = 0; i < N; ++i) {
			if (i == n - 1) { x += a[i]; }
			else if (i < n - 1) { x += (a[i] * 2); }
			else if (i == n) { y += a[i]; }
			else { y += (a[i] * 2); }
		}
		res = y - x;
	} else {
		ll x = 0, y = 0;
		for (int i = 0; i < N; ++i) {
			if (i < n) { x += (a[i] * 2); }
			else if (i < n + 2) { y += a[i]; }
			else { y += (a[i] * 2); }
		}
		res = y - x;

		ll tmp = 0;
		x = 0, y = 0;
		sort(a.begin(), a.end(), greater<ll>());
		for (int i = 0; i < N; ++i) {
			if (i < n) { y += (a[i] * 2); }
			else if (i < n + 2) { x += a[i]; }
			else { x += (a[i] * 2); }
		}
		tmp = y - x;
		res = max(res, tmp);
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1024
word = input('')

ans = 'WA'

if  (word[0] == 'A'):
    tmp = word[2:-1]
    number_c = 0
    for i in range(len(tmp)):
        if  tmp[i] == 'C':
            number_c += 1
            serial_c = i+2
    if  number_c == 1:
        word_del = word[0:serial_c] + word[serial_c+1:]
        word_del = word_del[1:]
        
        if  word_del.islower():
            ans = 'AC'
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <tuple>
#include <vector>
#include <string>

template <class... Ts> using tuple_t = std::tuple<Ts...>;
template <class T, class U> using map_t = std::map<T, U>;
template <class T, class U> using pair_t = std::pair<T, U>;
template <class T> using vector_t = std::vector<T>;
template <class T> using set_t = std::set<T>;
using string_t = std::string;

string_t circ(string_t s){
	auto sn = s.substr(1);
	sn.append(1,s[0]);
	return sn;
}

int main() {
	string_t S,T;
	std::cin>>S>>T;
	for(int i=0;i<S.size();++i)
	{
		if(S==T){
			std::cout<<"Yes"<<std::endl;
			return 0;
		}
		S=circ(S);
	}
	std::cout<<"No"<<std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

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

int main() {

    int n ;
    cin >> n ;
    vector<int> l(n) ;
    rep(i,n) cin >> l[i] ;
    int ans = 0 ;
    rep(i,n)rep(j,n)rep(k,n){
        if(i<j && j<k){
            if(l[i]==l[j]) continue ;
            if(l[i]==l[k]) continue ;
            if(l[k]==l[j]) continue ;
            if((ll) l[i]+l[j]+l[k] > max(max(l[i], l[j]), l[k])*2) ans++ ;
        }
    }

    cout << ans << endl ;


    return 0 ;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace C {
	class Program {
		static void Main(string[] args) {
			Console.ReadLine();
			var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
			var dict = new Dictionary<int, bool>();

			bool f = true;
			for(int i = 0; i < input.Length; ++i) {
				if (dict.ContainsKey(input[i])) {
					f = false;
					break;
				}

				dict[input[i]] = true;
			}

			if (f) Console.WriteLine("YES");
			else Console.WriteLine("NO");
		}
	}
}


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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	string base = "abcdefghijklmnopqrstuvwxyz";
	string ss;
	cin >> ss;

	int ans = INF;
	for (int ii = 0; ii < base.size(); ii++) {
		int tmp = 0;
		string s = ss;
		char org = base[ii];
		while (true) {
			bool ok = true;
			for (int i = 0; i < s.size(); i++) {
				if (s[i]!=org) {
					ok = false;
				}
			}
			if (ok||s.size()==1) {
				break;
			}

			for (int i = 0; i < s.size()-1; i++) {
				if (s[i+1]==org) {
					s[i] = org;
				}

			}
			s.erase(s.size()-1);

			tmp++;
		}
		ans = std::min(ans, tmp);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n;
  int a[2][100] = {};
  int t2 = 0;
  int M, t;
  cin >> n;
  for (int i=0;i<n;i++) {
    int tmp;
    cin >> tmp;
    a[0][i] = tmp;
  }
  for (int i=0;i<n;i++) {
    int tmp;
    cin >> tmp;
    a[1][i] = tmp;
    t2 += tmp;
  }
  t2 += a[0][0];
  M = t2;
  for (int i=0;i<n-1;i++) {
    t2 += a[0][i+1] - a[1][i];
    if (t2 > M) M = t2;
  }
  cout << M << endl;
  return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int t,k,j,i,d,c,a,b;
    cin>>a;
    b=a;
    int s=0;
    while(a>0)
    {
        t = a%10;
        s=s + t;
        a=a/10;
    }
    if(b%s==0)
        cout<<"Yes"<<endl;
    else
    cout<<"No\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define cs(ans); cout<<setprecision(6)<<fixed<<ans<<endl;
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e16)
#define inf 1e16
#define f first
#define se second
const ll mod=1e9+7;
using namespace std;
using namespace __gnu_pbds; 
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
ll pwm(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
template<typename T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//st.order_of_key(num)->number of elements < num
//st.find_by_order(i)->iterator of ith element in sorted order starting from zero
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define int long long int
//Binary_Search->dp->greedy
//auto check = [&](ll x){};
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
char move[]={'D','R','U','L'};
int X[]={2,1,-1,-2,-2,-1,1,2}; 
int Y[]={1,2,2,1,-1,-2,-2,-1}; 
struct comp{
	bool operator()(const pair<int,int>&a,const pair<int,int>&b) const {
		if(a.first>b.first) return true;
		if(a.first<b.first) return false; 
		if(a.second<b.second) return true;
		return false;
	}
};	
void solve(){
	//ifstream fin("input.txt");
	//ofstream fout("output.txt");
	int k;
	scanf("%d",&k);
	rep(i,0,k) cout<<"ACL";
	
	
	
	
	
	
	
	
}	
int32_t main(){
int t=1;
//scanf("%d",&t);
while(t--){
	solve();     
}
return 0;
}    


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>

#define REP(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

double a, b;

void solver() {
    cin >> a >> b;
    //cout << (int) (a / b) << " " << (int) a % (int) b << " " << a / b << endl;
    printf("%d %d %lf", (int) (a / b), (int) a % (int) b, (a / b));
}

int main() {
    solver();
    return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n; cin >> n;
    vector<pair<ld, ld>> a;
    for (int i = 0; i < n; i++) {
        ld x, y; cin >> x >> y;
        a.emplace_back(x, y);
    }
    sort(a.begin(), a.end());
    ld tot = 0;
    ld div = 1;
    for (ld i = 2; i <= n; i++) {
        div *= i;
    }
    do {
        ld x = a[0].first, y = a[0].second;
        for (int i = 1; i < n; i++) {
            ld X = a[i].first, Y = a[i].second;
            tot += sqrt((x - X) * (x - X) + (y - Y) * (y - Y));
            x = X, y = Y;
        }
    } while(next_permutation(a.begin(), a.end()));
    cout << tot / div << "\n";
}


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

using namespace std;

void solve() {
        long long n,d;
        cin >> n >> d;
        int ans = 0;
        while (n--) {
                long long x,y;
                cin >> x >> y;
                if (x * x + y * y <= d * d) {
                        ans++;
                }

        }
        cout << ans << endl;
}


int main() {
#ifdef QWERTY
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
#endif
        ios_base::sync_with_stdio(false);


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

        for (int i = 1; i <= t; i++) {
//                cout << "Case #" << i << ':' << endl;
                solve();
        }


        return 0;
}

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

using namespace std;

constexpr int N = 100000;

vector<int> g[N + 1];
int h[N + 1];

int main() {
	int n, m, ans, u, v, i;

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

	for (i = 1; i <= n; i++) {
		scanf("%d", h + i);
	}

	for (i = 1; i <= m; i++) {
		scanf("%d%d", &u, &v);

		g[u].push_back(v);
		g[v].push_back(u);
	}

	ans = 0;

	for (u = 1; u <= n; u++) {
		for (i = 0; i < g[u].size(); i++) {
			v = g[u][i];

			if (h[v] >= h[u]) {
				break;
			}
		}

		if (i == g[u].size()) {
			ans++;
		}
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 9300
n=int(input())
h=list(map(int,input().split()))
h=h[::-1]
count=1
if n==1:
  print('Yes')
else:
  for i in range(n-1):
    if h[i]<h[i+1]:
      h[i+1]-=1
      if h[i]<h[i+1]:
        print('No')
        break
      else:
        count+=1
    else:
      count+=1
  if count==n:
    print('Yes')

Measured memory_bytes: 14396
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	vll v(n);
	rep(i,n) cin>>v[i];
	ll ans = 0;
	ll a = 1;
	rep(i,n){
		if(v[i] < a) continue;
		if(a==1){
			ans += v[i]-1;
			a = 2;
			continue;
		}
		ll b = v[i] / a;
		ll c = v[i] % a;
		if(c == 0){
			if(b == 1){
				a++;
				continue;
			}
			ans += b-1;
			continue;
		}
		else{
			ans += b;
			continue;
		}
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 1024
h, w = map(int, input().split())
c = [[int(i) for i in input().split()] for _ in range(10)]
a = [[int(i) for i in input().split()] for _ in range(h)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j], c[i][k] + c[k][j])
ans = 0
for a_ in a:
    for ai in a_:
        if ai == 1 or ai == -1: continue
        else: ans += c[ai][1]
print(ans)

Measured memory_bytes: 3316
fun main(args: Array<String>) {
    agc037a()
}

fun agc037a() {
    val s = readLine()!!

    // dp[i文字目まで使用][前の文字を使う？(0/1)] = 答えの最大値
    val dp = Array(s.length) { LongArray(2) { 0 } }
    dp[0][0] = 1

    for (i in 1..s.lastIndex) {
        dp[i][0] = 1 + if (s[i] == s[i - 1]) dp[i - 1][1] else Math.max(dp[i - 1][0], dp[i - 1][1])
        dp[i][1] = if (i in 3..s.lastIndex && s.slice(i - 1..i) == s.slice(i - 3..i - 2)) {
            1 + dp[i - 2][0]
        } else {
            1 + if (i >= 2) Math.max(dp[i - 2][0], dp[i - 2][1]) else 0
        }
    }

    val answer = dp.last().max()

    println(answer)
}


Measured memory_bytes: 61004
let s = read_line()
let a = Array.make 2019 0

let rec f i d n ans =
  if i = -1 then ans
  else
    let j = int_of_char s.[i] - int_of_char '0' in
    let n = (j * d + n) mod 2019 in
    let an = a.(n) in
    a.(n) <- an + 1;
    f (i - 1) (10 * d mod 2019) n (ans + an)

let () =
  a.(0) <- 1;
  let l = String.length s - 1 in
  let ans = f l 1 0 0 in
  Printf.printf "%d\n" ans


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e15;

int main(){
    int N;
    cin >> N;
    if(N == 3){
        cout << 2 << ' ' << 3 << ' ' << 25 << endl;
        exit(0);
    }
    int n = min(15000, N-N%2), a = N-n;
    int b = n/3, c = n%3;
    rep(i, b) cout << 6*i+2 << ' ' << 6*i+3 << ' ' << 6*i+4 << endl;
    if(c == 1) cout << 6*b+3 << endl;
    elif(c == 2) cout << 6*b+2 << ' ' << 6*b+4 << endl;
    rep2(i, 1, a+1) cout << 6*i << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int n;
	cin >> n;

	ll sum = 0;
	for (int i = 0; i <= n; i++) {
		if ((i % 3 && i % 5) && (i % 3) && (i % 5)) {
			sum += i;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
string S;
int main(){
    cin>>S;
    int a{(int)count(S.begin(),S.end(),'a')},b{(int)count(S.begin(),S.end(),'b')},c{(int)count(S.begin(),S.end(),'c')};
    int min_n{min(a,min(b,c))},max_n{max(a,max(b,c))};
    if(max_n>min_n+1)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <queue>
#include <cmath>
#include <random>
#include <fstream>
#include <string>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <stack>

#define REP(i, N) for(int i = 0; i< N; i++)
using namespace std;
#define ll long long
const int INF = 1 << 29;
const ll llINF = 10000000000000000;

const int MOD = 1000000007;

#define MAX_N 100100
typedef pair<int, int> P;
typedef pair<ll, ll> llP;

int main(){
    int eight[5] = {105, 135, 165, 189, 195};
    int N;
    int kazu = 0;
    cin >> N;
    REP(i, 5){
        if(N >= eight[i])kazu++;
    }
    printf("%d\n", kazu);
}


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

int main(){
    double pai=3.141592653589;
    char chk[10], t[1000];
    int ans=0;
    string ask,tmp;
    scanf("%s",&chk);
    ask=chk;
    transform(ask.begin(),ask.end(),ask.begin(),::toupper);
    for(;;){
        scanf("%s",&t);
        tmp=t;
        if(tmp=="END_OF_TEXT") break;
        transform(tmp.begin(),tmp.end(),tmp.begin(),::toupper);
        if(tmp==ask){
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3300
x,n=map(int,input().split())
if n!=0:
     p=list(map(int,input().split()))
     ans = 10000
     for i in range(102):
          if i not in p:
               if abs(x-i)<abs(x-ans):
                    ans = i
     print(ans)
else:
     print(x)

Measured memory_bytes: 61964
import itertools

n, m, q = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(q)]


ans = 0
for iter in itertools.combinations_with_replacement(range(1, m+1), n):
    score = 0
    for i in range(q):
        a, b, c, d = L[i]
        if iter[b-1]-iter[a-1]==c:
            score += d

    ans = max(ans, score)

print(ans)

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

int main(){
	ull n,k;
	cin>>n>>k;
	int a[n];
	bool y=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		a[i]--;
		if(a[i]==0)y=1;
	}
	ll cunt=0;
	vector<int> ret;
	ret.push_back(0);
	bool b[n];
	memset(b,0,sizeof(b));
	b[0]==1;
	while(1){
		if(b[a[cunt]]==1)break;
		b[a[cunt]]=1;
		ret.push_back(a[cunt]);
		//cout<<a[cunt]<<"'";
		cunt=a[cunt];
	}
	int z=-1;
	for(int i=0;i<ret.size();i++){
		if(ret[i]==a[cunt])z=i;
	}
	int m=ret.size()-z;
	if(k<z)cout<<ret[k]+1<<endl;
	else{
		cout<<ret[(k-z)%m+z]+1<<endl;
	}
}


Measured memory_bytes: 5232
import java.io.*;
import java.util.*;
import java.util.stream.*;

class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		int num =0;
		num = a;
		a = b;
		b = num;
		num = a;
		a = c;
		c = num;
		System.out.println(a + " " + b + " " + c);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
const bool debug =0;

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void write(long long x){
    static const long long maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    long long len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(long long i=len-1;i>=0;--i) putchar(s[i]);
}

const long long MAXN = 110000;

long long fa[ MAXN ];
long long n,m,q;

struct kt{
long long a,b,c;
}Q[ MAXN ];


long long get_fa(long long x){
return (fa[x]==x)?(x):(fa[x]=get_fa(fa[x]));
}

void Merge(long long a,long long b){
a=get_fa(a);
b=get_fa(b);
if ( a!=b )
    fa[a]=b;
}

int main(){
    read(n);read(m);read(q);
    for (long long i=1;i<=q;i++)
    {
        read(Q[i].a);
        read(Q[i].b);
        read(Q[i].c);
        Q[i].a++;
        Q[i].b++;
    }
    for(long long i=1;i<=n;i++)
        fa[i]=i;

    for (long long i=1;i<=q;i++)
        if( Q[i].c==0 )
            Merge(Q[i].a , Q[i].b );

    bool flag=0;
    for (long long i=1;i<=q;i++)
        if( Q[i].c==1 )
        {
            flag=1;
            long long x=get_fa(Q[i].a);
            long long y=get_fa(Q[i].b);
            if ( x==y )
            {
                puts("No");
                return 0;
            }
        }

    long long cnt=0;
    for (long long i=1;i<=n;i++)
    {
        long long x=get_fa(i);
        if ( x==i )
            cnt++;
    }


    long long MIN=n-1;
    if ( flag )
        MIN++;

    long long MAX = n-cnt + 1ll*cnt*(cnt-1)/2;

    if ( ( m>=MIN ) && ( m<=MAX ) )
        puts("Yes");
    else
        puts("No");
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int mp[55][55];
int h, w;

int work(int r, int c)
{
	int t = 0;
	if (mp[r - 1][c - 1] == 2 && (r - 1 >= 1) && (c - 1 >= 1)) t++;
	if (mp[r - 1][c] == 2 && (r - 1 >= 1)) t++;
	if (mp[r - 1][c + 1] == 2 && (r - 1 >= 1) && (c + 1 <= w)) t++;
	if (mp[r][c - 1] == 2 && (c - 1 >= 1)) t++;
	if (mp[r][c + 1] == 2 && (c + 1 <= w)) t++;
	if (mp[r + 1][c - 1] == 2 && (r + 1 <= h) && (c - 1 >= 1)) t++;
	if (mp[r + 1][c] == 2 && (r + 1 <= h)) t++;
	if (mp[r + 1][c + 1] == 2 && (r + 1 <= h) && (c + 1 <= w)) t++;
	return t;
}

int main()
{
	char s[55], c;
	cin >> h >> w;
	memset(mp, 0, sizeof(0));
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> c;
			if (c == '.')
				mp[i][j] = 1;
			else mp[i][j] = 2;
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (mp[i][j] == 1) {
				printf("%d",work(i,j));
			}
			else printf("#");
		}
		printf("\n");
	}
	return 0;
}


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

#define MOD 1000000007

int n;
string mas[2];

int main() {

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

    double ans = 1, d = 1;
    int y, x;
    if(mas[0][0] == mas[1][0]){
        y = 0, x = 1;
        ans *= 3;
    }
    else {
        y = 0, x = 2;
        ans *= 6;
    }
    while(x < n) {
        if(y == 0) {
            if(mas[0][x] == mas[1][x]) { // tate
                // left
                if(mas[0][x - 1] == mas[1][x - 1]) { // tate
                    ans = fmod(ans * 2, MOD);
                } else { // yoko
                    ans *= 1;
                }
                y = 0, x++;
            } else { // yoko
                ans = fmod(ans * 2, MOD);
                y++;
            }
        }
        else {
            if(mas[0][x - 1] != mas[1][x - 1]) {
                d *= 2;
                ans = fmod(ans * 1.5, MOD);
            }
            y = 0, x += 2;
        }
    }
    //cout << d << endl;
    cout << (int)ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int tate[1000];
  int yoko[1000];
  int a=0;
  int i,j,l;

  i=0;
  for (;;) {
	scanf("%d%d",&tate[i],&yoko[i]);
	if (tate[i]==0 && yoko[i]==0) break;
	a++;
	i++;
  }

  for (i=0; i<a; i++) {
	for (j=0; j<tate[i]; j++) {
	  for (l=0; l<yoko[i]; l++) {
		printf("#");
	  }
	  printf("\n");
	}
	printf("\n");
  }
  return 0;
}

Measured memory_bytes: 580
#include <stdio.h>
#include <string.h>

int main(){
  int a;
  char c[10001];
  scanf("%d", &a);
  scanf("%s", &c);
  
  //int l = strlen(c);
  for(int i=0; i<strlen(c); i++){
    //printf("%d", i);
    int p = (int)c[i] + a;
    while((char)p>'Z'){
      p-=26;
    }
    c[i]=(unsigned char)p;
  }
  printf("%s", c);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ld double
    #define vv vector<ll>
    #define pp pair<ll,ll>
    #define ff first
    #define ss second
    #define vp vector<pp>
    #define pb push_back
    #define mp make_pair
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define maxn 105
    const ll mod=1e9+7;
    #define N 2750135
    bool prime[N];
    ll p[N];
    ll n,m;
    void isprime()
    {
        memset(prime,true,N);
        memset(p,-1,sizeof(p));
        for(ll i=2;i<N;i++)
        {
            if(p[i]==-1)
            {
            	p[i]=i;
                for(ll j=i*i;j<N;j+=i)
                {
                    if(p[j]==-1)
                    {
                    	p[j]=i;
					}
                }
            }
        }
    }
    ll power(ll a,ll n)
    {
        ll ans=1;
        a=a%mod;
        while(n>0)
        {
            if(n&1)
            {
                ans=(ans*a)%mod;
            }
            n=n>>1;
            a=(a*a)%mod;
        }
        return ans;
    }
    ll gcd(ll a,ll b)
    {
        if(b==0)
        return a;
        
        return gcd(b,a%b);
    }
    

    int main()
    {
    	fast;
        ll n;
        cin>>n;
        ll a[n];
        ll sum=0;
        ll z=0;
        for(ll i=0;i<n;i++)
        {
        	cin>>a[i];
        	sum=sum+a[i];
        	if(i!=n-1 && i%2==0)
        	{
        	   z=z+a[i];	
			}
		}
		sum=sum/2;
		ll ans[n];
		ans[n-1]=(sum-z);
		for(ll i=n-2;i>=0;i--)
		{
			ans[i]=a[i]-ans[i+1];
		}
		for(ll i=0;i<n;i++)
		{
			cout<<ans[i]*2<<" ";
		}
        
		return 0;
	}

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

int main(){
  int n;
  int i,j;
  cin >> n;
  vector<int> h(n);
  for(i=0; i<n; i++){
    cin >> h[i];
  }
  int counter = 1;
  for(i=1; i<n; i++){
    for(j=0; j<i && h[i]>=h[j]; j++){
      if(j==i-1)
        counter++;
    }
  }
  cout << counter << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)

using namespace std;
typedef long long int ll;
typedef pair<int,int> PI;

int N;
int W[100];
int main(void){
    cin >> N;
    int s=0, e=0;
    REP(i, N){
        cin >> W[i];
        e += W[i];
    }
    int res = INF;
    REP(i,N){
        e -= W[i];
        s += W[i];
        res = min(res, abs(s-e));
    }
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
 
int main()
{
  int n;
  cin >> n;
  int x[n], y[n];
  double D[4]={};
  for(int i=0;i<n;i++)
    cin >> x[i];
  for(int i=0;i<n;i++)
    cin >> y[i];
  D[0] = fabs(x[0]-y[0]);
  for(int i=0;i<n;i++)
    {
      D[1] += abs(x[i]-y[i]);
      D[2] += (x[i]-y[i])*(x[i]-y[i]);
      D[3] += fabs((x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]));
      fabs(x[i]-y[i]) >= D[0] ? ( D[0] = fabs(x[i]-y[i]) ):(0);
    }
  D[2] = sqrt(D[2]);
  D[3] = pow(D[3], (double)1/3);
 
  cout << fixed << setprecision(6)
       << D[1] << endl
       << D[2] << endl
       << D[3] << endl
       << D[0] << endl;
}

Measured memory_bytes: 1280
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <list>
#include <map>
#include <memory>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define ll long long
using namespace std;
const int INF = 0x7fffffff;
const int maxn = 100000;
vector<int> bb, ww;
int main()
{
	int n;
	string s;
	cin >> n >> s;
	int imin = 0;
	int b, w;
	int i = 0;
	while (s[i] == '.') ++i;
	while (i < n) {
		if (s[i] == '#') {
			b = 0;
			while (s[i] == '#') {
				++b;
				++i;
			}
			bb.push_back(b);
		}
		else {
			w = 0;
			while (s[i] == '.') {
				++w;
				++i;
			}
			ww.push_back(w);
			imin += w;
		}
	}
	if (bb.size() > ww.size()) bb.pop_back();
	int ans = imin;
	for (int i = 0; i < bb.size(); ++i)
	{
		imin = imin + bb[i] - ww[i];
		if (imin < ans)
			ans = imin;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
ans = ""
loop do
  m, f, r = gets.chomp.split.map(&:to_i)
  break if m == -1 && f == -1 && r == -1
  ans = ""
  if m == -1 || f == -1
    ans = "F"
  elsif m + f >= 80
    ans = "A"
  elsif m + f >= 65
    ans = "B"
  elsif m + f >= 50
    ans = "C"
  elsif m + f >= 30
    ans = "D"
    if r >= 50
      ans = "C"
    end
  else
    ans = "F"
  end
  puts ans
end



Measured memory_bytes: 6872
inpl = lambda: list(map(int,input().split()))
N = int(input())
S = input()

W = S.count('.')
cur = W
ans = cur
for i in range(N):
    if S[i] == '.':
        cur -= 1
        if cur < ans:
            ans = cur
    else:
        cur += 1
print(ans)

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

int main() {
    string s;
    int count = 0;
    cin >> s;

    for (int i = 0; i < 3; i++)
    {
        if (s.at(i) == '1') {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3620
ans' 0 = []
ans' i =
  let r = i `mod` 3
      s = i `div` 3
  in
    if r /= 2
    then r:(ans' s)
    else if r == 2
         then (-1:(ans' (s+1)))
         else ( 1:(ans' (s-1)))

ans i =
  map (\x -> case x of
               0  -> '0'
               1  -> '+'
               -1 -> '-' ) $ reverse $ ans' i

main = do
  l <- getLine
  let i = read l :: Int
      o = ans i
  putStrLn o
      

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long n;
    cin>>n;
    long long result = 0;
    for(int i=1;i<=n;i++) {
        if(i%3 == 0 || i%5 == 0 ) {
            continue;
        }
        else {
            result += i;
        }
    }
    cout<<result;
}


Measured memory_bytes: 3636
#include <cmath>
#include <iostream>
#include <vector>
#include <iomanip>

const double kEpsilon = 1e-10;
inline bool equals(double a, double b)
{
    return fabs(a - b) < kEpsilon;
}

class Point
{
  public:
    double x, y;

    Point() = default;
    Point(double x, double y) : x(x), y(y)
    {
    }

    Point operator+(const Point &p)
    {
        return Point(x + p.x, y + p.y);
    }
    Point operator-(const Point &p)
    {
        return Point(x - p.x, y - p.y);
    }
    Point operator*(const double k)
    {
        return Point(x * k, y * k);
    }

    double SquaredNorm()
    {
        return x * x + y * y;
    }
    double abs()
    {
        return sqrt(this->SquaredNorm());
    }

    bool operator<(const Point &p) const
    {
        return x != p.x ? x < p.x : y < p.y;
    }
    bool operator==(const Point &p) const
    {
        return fabs(x - p.x) < kEpsilon && fabs(y - p.y) < kEpsilon;
    }

    double dot(const Point &p) const
    {
        return x * p.x + y * p.y;
    }
    double cross(const Point &p) const
    {
        return x * p.y - y * p.x;
    }
};

Point projection(Point &p1, Point &p2, Point &p)
{
    auto q = p2 - p1;
    auto a = q.dot(p - p1) / q.SquaredNorm();
    return p1 + q * a;
}

int main()
{

    Point p1, p2, p, r;

    std::cin >> p1.x >> p1.y >> p2.x >> p2.y;

    int n;
    std::cin >> n;

    for (size_t i = 0; i < n; ++i)
    {
        std::cin >> p.x >> p.y;
        r = projection(p1, p2, p);
        auto s = r*2 - p;
        std::cout << std::setprecision(20);
        std::cout << s.x << " " << s.y << std::endl;
    }
}



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

#define MAX 1000

int X, Y, Z, K;
long long A[MAX];
long long B[MAX];
long long C[MAX];

int main() {
	cin >> X >> Y >> Z >> K;
	for( int i = 0; i < X; i++ ) {
		cin >> A[i];
	}
	for( int i = 0; i < Y; i++ ) {
		cin >> B[i];
	}
	for( int i = 0; i < Z; i++ ) {
		cin >> C[i];
	}

	sort( A, A + X, greater<long long>() );
	sort( B, B + Y, greater<long long>() );
	sort( C, C + Z, greater<long long>() );
	priority_queue<tuple<long long, int, int, int>> que;
	que.push( make_tuple( A[0] + B[0] + C[0], 0, 0, 0 ) );
	vector<long long> v;
	map<int, int> m;
	while( v.size() < K ) {
		tuple<long long, int, int, int> t = que.top();
		que.pop();
		v.push_back( get<0>(t) );
		int a = get<1>(t);
		int b = get<2>(t);
		int c = get<3>(t);
		if( a + 1 < X ) {
			int hash = (a + 1)*MAX*MAX + b*MAX + c;
			if( m[hash] == 0 ) {
				que.push( make_tuple( A[a + 1] + B[b] + C[c], a + 1, b, c ) );
				m[hash] = 1;
			}
		}
		if( b + 1 < Y ) {
			int hash = a*MAX*MAX + (b + 1)*MAX + c;
			if( m[hash] == 0 ) {
				que.push( make_tuple( A[a] + B[b + 1] + C[c], a, b + 1, c ) );
				m[hash] = 1;
			}
		}
		if( c + 1 < Z ) {
			int hash = a*MAX*MAX + b*MAX + c + 1;
			if( m[hash] == 0 ) {
				que.push( make_tuple( A[a] + B[b] + C[c + 1], a, b, c + 1 ) );
				m[hash] = 1;
			}
		}
	}

	for( int i = 0; i < K; i++ ) {
		cout << v[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%10==3)cout<<"bon";
	else if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon";
	else cout<<"hon"; 
	return 0;
}

Measured memory_bytes: 3592
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl


int main() {
	int a, b;
	char A, B;
	cin >> A >> B;
	a = (int)A;
	b = (int)B;
	if (a > b) wrln(">");
	if (a < b)wrln("<");
	if (a == b)wrln("=");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){

	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

// gcd(a,b)
int gcd(int a,int b){
	int ret;
	ret = (b == 0) ? a : gcd(b, a % b);
	return ret;
}

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

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
	return temp;
}

void nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[]){
	int num[2],gp[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
	scanf("%d%d",&num[0],&num[1]);
    if(gp[num[0]] == gp[num[1]])	puts("Yes");
    else puts("No");
  	return 0;
}

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

#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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;

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

    ll ans = 0;
    if (N == 1) ans = M;
    else {
        repd(i, 1, M + 1) {
            ll st = i * (N - 1);
            ll res = M - st;
            if (i > res) {
                break;
            }
            if (res % i == 0) {
                ans = max(ans, i);
            }
        }
    }

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

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N; cin >> N;
    vector<vector<int>> as(2, vector<int>(N));
    for (int i = 0; i < 2; ++i)
    {
        for (auto &aij : as[i])
        {
            cin >> aij;
        }
    }
    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        int tmp = 0;
        for (int j = 0; j <= i; ++j) tmp += as[0][j];
        for (int j = i; j < N; ++j) tmp += as[1][j];
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

const ll mod = 1000000007;
//const ll mod = 998244353;

const int MAX_N = 200010;
ll fact[MAX_N],fact_inv[MAX_N],inv[MAX_N];

ll pow_mod(ll a,ll b) {
    ll ret;
    if (b < 0) ret = pow_mod(a,mod+b-1);
    else if (b == 0) ret = 1;
    else if (b == 1) ret = a;
    else {
        ll c = pow_mod(a,b/2);
        if (b%2) ret = (c*c)%mod*a%mod;
        else ret = c*c%mod;
    }
    return ret;
}

void create_table(int n) {
    fact[0] = 1;fact[1] = 1;
    for (int i = 2;i <= n;++i) fact[i] = fact[i-1]*i%mod;
    fact_inv[n] = pow_mod(fact[n],mod-2);
    for (int i = n;i > 0;--i) fact_inv[i-1] = fact_inv[i]*i%mod;
    for (int i = 1;i <= n;++i) inv[i] = fact_inv[i]*fact[i-1]%mod;
}

ll combi(ll a, ll b) {
    return fact[a]*fact_inv[b]%mod*fact_inv[a-b]%mod;
}

int main() {
    int b,w;
    cin >> b >> w;
    create_table(200000);
    ll x = 0,y = 0;
    for (int i = 1;i <= b+w;++i) {
        if (i <= min(b,w)) cout << pow_mod(2,-1) << "\n";
        else {
            ll ret = 0;
            ret += y;
            ret += (1-x-y)%mod*pow_mod(2,-1)%mod;
            ret %= mod;
            cout << (ret+mod)%mod << "\n";
            // cout << x << " " << y << " " << i << endl;
        }
        if (i >= b) {
            x += pow_mod(2,-i)*combi(i-1,b-1)%mod;
            x %= mod;
        }
        if (i >= w) {
            y += pow_mod(2,-i)*combi(i-1,w-1)%mod;
            y %= mod;
        }
    }
    // cout << pow_mod(2,-3) << endl;
}

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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

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

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}

Measured memory_bytes: 21736
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin>>n;
	if(n%2==0) cout<<n/2-1;
	else cout<<n/2;
}

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

using namespace std;

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

typedef unsigned long long ull;

template<class A, class B> B convert(A a) {
  stringstream ss;
  ss << a;
  B b;
  ss >> b;
  return b;
}

ull cnt(ull k) {
  ull res = k ? 1 : 0;
  res += k / 3 * 4;
  res += k / 5 * 4;
  int s = 0;
  int u[] = {0, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 6, 6, 7, 8};
  for (ull t = 1; t <= k; t *= 10) {
    ++s;
    ull tt = min(t * 10, k);
    res += ((tt / 15 * 8 + u[tt % 15]) - (t / 15 * 8 + u[t % 15])) * s;
  }
  return res;
}

string fb;

int main() {
  for (ull i = 1; i <= 1000; ++i) {
    if (i % 15 == 0) fb += "FizzBuzz";
    else if (i % 3 == 0) fb += "Fizz";
    else if (i % 5 == 0) fb += "Buzz";
    else fb += convert<ull, string>(i);
  }
  ull s;
  cin >> s;
  --s;
  if (s < fb.size()) {
    cout << fb.substr(s, 20) << endl;
    return 0;
  }
  ull l = 1, u = s;
  while (true) {
    ull m = (l + u) / 2;
    ull c = cnt(m);
    if (c < s && s < c + 100) {
      string f;
      for (ull i = m + 1; i <= m + 100; ++i) {
	if (i % 15 == 0) f += "FizzBuzz";
	else if (i % 3 == 0) f += "Fizz";
	else if (i % 5 == 0) f += "Buzz";
	else f += convert<ull, string>(i);
      }
      cout << f.substr(s - c, 20) << endl;
      return 0;
    }
    if (c < s) l = m;
    else u = m;
  }
}

Measured memory_bytes: 1236
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		double a,b,c;
		cin>>a>>b>>c;
		if(pow(a,2)+pow(b,2)==pow(c,2))
		{
			cout<<"YES"<<endl;
			continue;
		}
		if(pow(a,2)+pow(c,2)==pow(b,2))
		{
			cout<<"YES"<<endl;
			continue;
		}
		if(pow(b,2)+pow(c,2)==pow(a,2))
		{
			cout<<"YES"<<endl;
			continue;
		}
		cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 1228