akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a, b;
  cin >> a >> b;
  vi v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  int c[3] = {0};
  for (int i = 0; i < n; i++) {
    if (v[i] <= a) {
      c[0]++;
    } else if (v[i] <= b) {
      c[1]++;
    } else {
      c[2]++;
    }
  }
  cout << min(min(c[0], c[1]), c[2]) << endl;
  return 0;
}


Measured memory_bytes: 256
N=parse(Int,readline())
function add_s(s,maxs)
    if length(s)==N
        println(s)
    else
        for i in 1:(maxs+1)
            add_s(s*string(Char('a'+i-1)),(i > maxs) ? i : maxs)
        end
    end
end

add_s("a",1)

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

using namespace std;

int main()
{
  string s;
  cin >> s;
  
  int q;
  cin >> q;
  
  bool isReverse = false;
  string pre="";
  string post="";
  for(int i=0;i<q;i++)
  {
    int t;
    cin >> t;
    
    if(t==1)
    {
      isReverse = !isReverse;
      continue;
    }
    
    if(t==2)
    {
      int f;
      char c;
      cin >> f >> c;
      bool addToFront = f == 1;
      if(isReverse) addToFront = !addToFront;
      if(addToFront)
      {
        pre = c + pre;
      }
      else
      {
        post = post + c;
      }
    }
  }
  
  s = pre + s + post;
  if(isReverse) reverse(s.begin(), s.end());
  
  cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 1512
#include "bits/stdc++.h"
using namespace std;
const int maxn = 100100;
int u[maxn];
void init(){
	for(int e = 0; e < maxn; e++) u[e] = e;
}
int find(int x){
	if(x == u[x]) return x;
	return u[x] = find(u[x]);
}
int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	vector<int> a(n);
	for(int & v : a) cin >> v;
	init();
	for(int e = 0; e < m; e++){
		int x, y; scanf("%d %d", &x, &y);
		x--; y--;
		u[find(x)] = find(y);
	}
	int x = 0;
	for(int e = 0; e < n; e++){
		if(find(e) == find(a[e]-1)) x++;
	}
	cout << x << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T>inline int bs(int g,int k,T c){while(abs(k-g)>1){int m=(g+k)/2;(c(m)?k:g)=m;}return k;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}

int dp[100010];

int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    

    int n;
    cin >> n;
    fill_n(dp, 100010, 1<<30);
    dp[0] = 0;
    vector<int> h(n);
    cin >> h;
    for(int i = 0; i < n; ++i){
        //if(i+1 < n) dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
        //if(i+2 < n) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i]-h[i+2]));
        if(i >= 1) dp[i] = min(dp[i], dp[i-1] + abs(h[i]-h[i-1]));
        if(i >= 2) dp[i] = min(dp[i], dp[i-2] + abs(h[i]-h[i-2]));
    }
    cout << dp[n-1] << '\n';

    
    
    return 0;
}


Measured memory_bytes: 1024
import itertools
N = int(input())
A = [[0]+list(map(int, input().split())) for i in range(2)]
B = [list(itertools.accumulate(A[i])) for i in range(2)]

ans = 0
for j in range(1, N+1):
  n = B[0][j] + B[1][-1] - B[1][j-1]
  ans = max(ans, n)

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<stdbool.h>
#include<tgmath.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define miin(a, b, c) min((a), min((b), (c)))
#define maax(a, b, c) max((a), max((b), (c)))
#define mod 1000000007
#define INF 2002002002LL
const int NIL = -1;

int n,a,b,c=0,t;

main(){
    scanf("%d%d%d", &n, &a, &b);
    for(int i=0; i<n; i++){
        scanf("%d", &t);
        if(a <= t && t < b)c++;
    }
    printf("%d\n", n - c);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
  int n,i,k,x;cin >> n;
  int prime[997] = {};
  for(i=1;i<=n;i++){
    x = i;
    for(k=2;k<=x;k++){
      while(x%k==0){
        prime[k-1]++;x /= k;
      }
    }
  }
  long long ans = 1;
  for(i=0;i<997;i++) ans = (ans*(prime[i]+1))%1000000007;
  cout << ans << endl;
}
      

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;
 
int main(){
  int x; cin >> x;
  if(x==7 || x==5 || x==3) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using ll = long long;

int main() {
	FASTIO
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, 1e15));
	for (int i = 0; i < n; i++) {
		dp[i][i] = 0;
	}
	for (int len = 2; len <= n; len++) {
		for (int i = 0; i + len - 1 < n; i++) {
			int j = len + i - 1;
			ll u = 0;
			for(int r = i ; r <= j ; r++){
				u += a[r];
			}
			for (int k = i; k < len + i - 1; k++) {

				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j] + u );
//				clog << i << ' ' << j << ' ' << k << ' ' << dp[i][j] << ' ' << dp[i][k] << ' ' << dp[k + 1][j] << endl;

			}
		}
	}
	cout << dp[0][n - 1] << endl;

}
//
//
//2 3 4
//2 3 4
//5 7
//11 or 9
//dp[i][j] = dp[i][k] + dp[k + 1][j] k = i...j
//j = i + len

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<vector<P>> items(N);
    rep(i, N) {
        ll a;
        cin >> a;
        rep(j, a) {
            ll x, y;
            cin >> x >> y;
            items[i].push_back({x, y});
        }
    }
    ll ans = 0;
    rep(i, 1 << N) {
        vector<bool> honest(N, false);
        ll cnt = 0;
        rep(j, N) {
            if ((1<<j) & i) {
                cnt ++;
                honest[j] = true;
            }
        }
        bool ok = true;
        rep(j, N) {
            bool h = honest[j];
            if (!h) continue;
            vector<P> item = items[j];
            for (P p : item) {
                ll x = p.first - 1;
                if (p.second) {
                    if (honest[x]) {
                        continue;
                    }else {
                        ok = false;
                    }
                }else {
                    if (honest[x]) {
                        ok = false;
                    }else {
                        continue;
                    }
                }
            }
        }
        if (ok) ans = max(ans, cnt);
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> ii;

signed main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	int x; cin >> x;
	
	int g = __gcd(x, 360LL);
	cout << 360 / g;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,k,n) for(ll i= (ll) k;i< (ll) n;i++)
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)((v).size())
#define pb push_back
#define ft first
#define sd second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long long INF = 1e18L + 1;
const int IINF = 1e9 + 1;

using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define DBG(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int main()
{
#ifndef LOCAL
	ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  	ll n; cin >> n;
	string s; cin >> s;
	vector<pair<ll, ll> > events;
	vector<ll>cs;
	ll cnt = 0, prev = -1;
	rep(i, 0, n){
		if(s[i] == 'D'){
			if(prev != -1){
				events.pb({prev, cnt});
			}
			prev = i;
			cnt = 0;
		} else if(s[i] == 'M'){
			cnt++;
		} else if(s[i] == 'C'){
			if(prev != -1){
				events.pb({prev, cnt});
				prev = i;
			}
			cnt = 0;
			cs.pb(i);
		}
	}
	if(prev != -1){
		events.pb({prev, cnt});
	}
	ll q; cin >> q;
	rep(_, 0, q){
		ll k; cin >> k;
		ll j0 = 0, j1 = 0;
		ll mcnt = 0, contr = 0, dcnt = 0, res = 0;
		//DBG(k);
		for(auto& i : cs){
			while(j1 < SZ(events) and events[j1].ft < i){
				ll j = events[j1].ft, ms = events[j1].sd;
				//DBG(j1, j, ms);
				if(s[j] == 'D'){
					dcnt++;
					mcnt += ms;
					contr += dcnt * ms;
					j1++;
				} else{
					mcnt += ms;
					contr += dcnt * ms;
					j1++;
				}
				//DBG(dcnt, mcnt, contr);
			}
			while(j0 != j1 and (i - events[j0].ft >= k or s[events[j0].ft] == 'C')){
				ll j = events[j0].ft, ms = events[j0].sd;
				//DBG(j0, j, ms);
				if(s[j] == 'D'){
					dcnt--;
					contr -= mcnt;
					mcnt -= ms;
					j0++;
				} else{
					mcnt -= ms;
					j0++;
				}
				//DBG(dcnt, mcnt, contr);
					
			}
			res += contr;
		}
		cout << res << "\n";
	}
    return 0;
}


Measured memory_bytes: 35340
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    int n;
    cin >> n;
    string S,T;
    cin >> S >> T;
    for(int i = 0; i < n;i++){
        cout << S[i] << T[i];
    }
    cout << endl;

    return 0;
}

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

int main(){
  int64_t N;
  cin >> N;
  int64_t ans=0;
  for(int i=1;i<=N;i++){
    if((i%3!=0)&&(i%5!=0)){
      ans+=i;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
	int i;
	for ( i = 0; i < n; i++ ){
	  if ( i > 0 ) printf(" ");
	  printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N){
	int i, j, v;
	for (i=1; i<N; ++i){
		v = A[i];
		j = i-1;
		while (j>=0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		trace(A, N);
	}
}

int main(){
	int n, i, j;
	int A[100];
	scanf("%d", &n);

	for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);

	trace(A, n);

	insertionSort(A, n);



	return 0;
}


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

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a>b) cout << "a > b\n";
    else if(a==b) cout << "a == b\n";
    else if(a<b)  cout << "a < b\n";
    
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int c[500010];
vector<int> v[500010];
const int MAX_N = 500010;

int bit[MAX_N], n;

int sum(int i) {
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void add(int i, int x) {
    while (i <= n) {
        bit[i] += x;
        i += i & -i;
    }
}
typedef pair<int, int> P;
map<P, int> mp;
vector<int> q[500010];
int cnt[500010] = {};
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;
    n = N;
    rep(i, N) cin >> c[i];
    rep(i, N) {
        v[c[i]].push_back(i + 1);
        if(v[c[i]].size() == 1) {
            add(i + 1, 1);
        }
    }
    int L[500010], R[500010];
    rep(i, Q) {
        int l, r;
        cin >> l >> r;
                L[i] = l;
        R[i] = r;
        l--;
        q[l].push_back(r);

    }
    rep(i, N) {
        for(auto &e: q[i]) {
            //cout << sum(e) - sum(i) << endl;
            //cout << i + 1 << " " << e << endl;
            mp[{i + 1, e}] = sum(e) - sum(i);
        }
        //if(i == 0) break;
        cnt[c[i]]++;
        add(i + 1, -1);
        if(cnt[c[i]] <v[c[i]].size())  
            add(v[c[i]][cnt[c[i]]], 1);
    }
    rep(i, Q) {
        cout << mp[{L[i], R[i]}] << endl;
    }

    return 0;
}


Measured memory_bytes: 103704
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VLL a(3*n);
  INPUT(a);
  SORT(a);
  LL ans = 0, idx = 3*n-2;
  REP(i, n)
  {
    ans += a[idx];
    idx -= 2;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
using System;

class ABC070A
{
	static public void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		long[] T = new long[N];
		for(int i=0; i < N; i++)
		{
			T[i] = long.Parse(Console.ReadLine());
		}
		long lcm = T[0];
		for(int i=1; i < N; i++)
		{
			lcm = lcm / gcd(lcm, T[i]) * T[i];
		}

		Console.WriteLine(lcm);
	}

	static long gcd(long a, long b)
	{
		if(a < b)
		{
			long tmp = a;
			a = b;
			b = tmp;
		}
		long r = a % b;

		while(r != 0)
		{
			a = b;
			b = r;
			r = a % b;
		}

		return b;
	}
}


Measured memory_bytes: 13140
import java.util.Scanner;

	public class Main {

		static long mod = 1000000007;

		public static void main(String[] args) {
			// AtCoder_C
			Scanner sc = new Scanner(System.in);
			int N = sc.nextInt();
    	    // Scannerクラスのインスタンスをクローズ
    		sc.close();

    		long ans=0;

			for(int A=1; A<N; A++) {
				ans += (N-1)/A;
			}

			System.out.println(ans);
    	}
    }

Measured memory_bytes: 35936
def main(n, m):
    a = [int(input()) for i in range(n)]
    b = [int(input()) for i in range(m)]
    suma = sum(a)
    sumb = sum(b)
    ans = []
    for ai in a:
        for bi in b:
            if suma - ai + bi == sumb - bi + ai:
                ans.append((ai, bi))
    if ans == []:
        print(-1)
        return
    ans.sort(key=lambda x: x[0] + x[1])
    print(ans[0][0],ans[0][1])


while 1:
    n, m = map(int, input().split())
    if n == m == 0:
        break
    main(n, m)


Measured memory_bytes: 6372
n = readline.split(' ').map(&:to_i)[0]
s = readline.split('')
cnt = 0
(0..n-1).each do |i|
  if s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'
    cnt += 1
  end
end

puts cnt

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    string s;
    cin >> s;
    bool ok = true;
    rep(i,s.length()){
        if(i%2==0 && s[i] == 'L') ok = false;
        if(i%2==1 && s[i] == 'R') ok = false;
    }
    if(ok) cout << "Yes" << endl;
    if(!ok) cout << "No" << endl;
}

Measured memory_bytes: 3572
#include <cstdio>
#include<cmath>
int main(){
    char s[1201];
    
    scanf("%[^\n]",s);
    
    for(int i = 0;s[i] != '\0';i++){
        char c = s[i];
        
        if(c >=65 && c <= 90){
            s[i] = c + 32;
        }
        else if(c >= 97 && c <= 122){
            s[i] = c - 32;
        }
    }
    printf("%s\n",s);

}



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

int main() {
  string S;
  cin >> S;
  int N=S.size();
  string A=S, B=S;
  int ans;
  if (N==1) {
    ans=0;
  }
  else if (N%2==0) {
    for (int i=0; i<N; i+=2) {
      A.at(i)='0';B.at(i)='1';
      A.at(i+1)='1';B.at(i+1)='0';
    }
  }
  else {
    A.at(0)='0';B.at(0)='1';
    for (int i=1; i<N; i+=2) {
      A.at(i)='1';B.at(i)='0';
      A.at(i+1)='0';B.at(i+1)='1';
    }
  }
  int da=N, db=N;
  for (int i=0; i<N; i++) {
    if (S.at(i)==A.at(i)) {
      da--;
    }
    if (S.at(i)==B.at(i)) {
      db--;
    }
  }
  cout << min(da,db) << endl;
}


Measured memory_bytes: 512
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    s = s_input()

    print('Yes' if '9' in s else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 77124
{-# LANGUAGE OverloadedStrings #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.Map.Strict               as M
import           Data.Char
import Data.Bits


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las


solve :: Int -> [Int] -> Int
solve n xs = let
    lTor = IM.fromList $ zip [1..] $ scanl' gcd (head xs) (tail xs)
    rTol = IM.fromList $ zip [1..] $ scanr gcd (last xs) (init xs)
    getGe 1 = rTol IM.! 2
    getGe i 
        | i >= n = lTor IM.! (i - 1)
        | otherwise = gcd (lTor IM.! (i - 1)) (rTol IM.! (i + 1))
    in
    maximum $ getGe <$> [1..n]

main = do
    n <- readInt
    xs <-  readInts
    print $ solve n xs






Measured memory_bytes: 44540
mojiretsu = input()
lett = list(mojiretsu)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]
anslisT = [x for x in jud if jud.count(x) == 1]

if anslist == ['Yes']:
    print('Yes')
elif anslisT == ['Yes']:
    print('Yes')
else:
    print('No')

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

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

const int mod = 1e9+7;

int n,m;
int x[1000100],y[1000100];

int powmod(int n,int p,int m){
  if(p==0)return 1;
  if(p%2==0){
    int t=powmod(n,p/2,m);
    return t*t%m;
  }
  return n*powmod(n,p-1,m);
}
int ans;

int calc(int *x,int n){
  int sum=0;
  for(int i=1;i<=n;i++){
    int y=((i*(n-i))%mod)*(x[i]-x[i-1])%mod;
    sum=(sum+y)%mod;
  }
  return sum;
}
signed main(){
  cin>>n>>m;
  rep(i,n){
    cin>>x[i];
  }
  rep(i,m){
    cin>>y[i];
  }


  cout<<(calc(x,n)*calc(y,m))%mod<<endl;

}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                      \
  ifstream in("loadtolb/abc106_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  ll ans = 0;
  for (int i = 1; i <= N; i += 2) {
    ll cnt = 0;
    repi(j, 1, i + 1) {
      if (i % j == 0) {
        cnt++;
      }
    }
    if (cnt == 8) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main(void) {
    int N,K; cin >> N >> K;
    int cnt[N+10] = {};

    for(int i=1; i<=K; i++) { //どの種類のお菓子か
        int d; cin >> d;
        for(int j=1; j<=d; j++) {
            int a; cin >> a; //だれがもってるか
            cnt[a]++;
        }
    }

    int ans = 0;
    for(int i=1; i<=N; i++) {
        if(cnt[i]==0) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3604
#define n 262144
L[n],p;F[n],X[n];i;long D[n*4],Z[n*4],A[n],x;long f(a,k,l,r,b){return(Z[k]+=(b=a>l|-r<~i)?0:x)+(D[k]=l<=i&a<r&b?fmax(f(a,2*k,l,b),f(a,2*k+1,b=l+r>>1,r)):D[k]);}main(j){for(gets(L);~scanf("%d%d%ld",L+j,&p,A+j);F[p]=j++)X[j]=F[p];for(;p?:(p=F[++i],f(i,1,0,n),n/i);p=X[p])x=A[p],x=f(L[p],1,0,n);printf("%ld",x);}

Measured memory_bytes: 17152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n;
ll a[110];
int main(){
	scanf("%lld",&n);
	rep(i,0,n)scanf("%lld",a+i);
	sortdown(a,n);
	ll s=0;
	rep(i,1,n)s+=a[i];
	puts(a[0]<s?"Yes":"No");
}



Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			int i = 1;
			while (true) {
				String str = reader.readLine();
				if ("0".equals(str)) {
					break;
				}
				System.out.println("Case " + i + ": " + str);
				i++;
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 31780
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


class Solver:

    def __init__(self, n, students):
        self.n = n
        self.students = students
        self.ordered = self.make_ordered() # var[i] = (active, pos), dec ordered
        self.dp = self.make_dp_container() # var[l][r] = max ans

    def make_ordered(self):
        ordered = [None] * self.n
        for i, active in enumerate(self.students):
            pos = i
            #pos = i + 1
            ordered[i] = (active, pos)
        ordered = sorted(ordered, key=lambda tpl: tpl[0])
        ordered = list(reversed(ordered))
        return ordered

    def make_dp_container(self):
        dp = [None] * (self.n + 1)
        for i, _ in enumerate(dp):
            dp[i] = [0] * (self.n + 1)
        return dp

    def run(self):
        for s, (active, pos) in enumerate(self.ordered):
            for l in range(s + 1):
                v = active * abs(pos - l)
                self.update(s + 1, l + 1, self.dp[s][l] + v)
                r = s - l
                r_key = self.n - 1 - r
                v = active * abs(pos - r_key)
                self.update(s + 1, l, self.dp[s][l] + v)
        #print('self.dp') # debug
        #print(self.dp) # debug
        ans = max(self.dp[-1])
        return ans

    def update(self, s, l, value):
        self.dp[s][l] = max(self.dp[s][l], value)


if __name__ == '__main__':
    n = int(input())
    students = list(map(int, input().split()))
    ans = Solver(n, students).run()
    #print('ans') # debug
    print(ans)

    #print('\33[32m' + 'end' + '\033[0m') # debug


Measured memory_bytes: 101976
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;
typedef long long ll;
const int N = 300005 , Mod = 1e9 + 7 , G = 3 , INF = 0x3f3f3f3f;
double PI = acos(-1);

struct Virt{
    double x , y;
    Virt(double _x = 0.0 , double _y = 0.0):x(_x) , y(_y){}
};

Virt operator + (Virt x , Virt y){return Virt(x.x + y.x , x.y + y.y);}
Virt operator - (Virt x , Virt y){return Virt(x.x - y.x , x.y - y.y);}
Virt operator * (Virt x , Virt y){return Virt(x.x * y.x - x.y * y.y , x.x * y.y + x.y * y.x);}

int read(){
	int x = 0 , f = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-') f = -1 ; ch = getchar();}
	while(ch >= '0' && ch <= '9'){x = x * 10 + ch - '0'; ch = getchar();}
	return x * f;
}

ll f[N][2][2][3]; // i Îª³¤¶È , j ÎªÄ¿Ç°ºÏ·¨ÐÔ , k ÎªÏÖÔÚµÄ 0 µÄÆæÅ¼ÐÔ , l ÎªÉÏÒ»¸ö 0 µÄÆæÅ¼ÐÔ 
ll cnt[N];
char s[N];

int main(){
	scanf("%s",s + 1);
	int n = strlen(s + 1); ll ans = 0;
	f[1][0][0][0] = cnt[n + 1] = 1;
	for(int i = n ; i >= 1 ; i--)
		cnt[i] = (cnt[i + 1] * ((s[i] == '?') + 1)) % Mod;
	for(int i = 1 ; i <= n ; i++){
		if(s[i] != '1'){
			for(int j = 0 ; j < 2 ; j++){
				for(int k = 0 ; k < 2 ; k++){
					for(int l = 0 ; l < 3 ; l++){
						f[i + 1][j][k][(l & 1) + 1] = (f[i + 1][j][k][(l & 1) + 1] + f[i][j][k][l]) % Mod;
					}
				}
			}
		}
		if(s[i] != '0'){
			for(int j = 0 ; j < 2 ; j++){
				for(int k= 0 ; k < 2 ; k++){
					if(!j && !k){
						f[i + 1][1][1][0] = (f[i + 1][1][1][0] + f[i][j][k][0]) % Mod;
					} else if(j & k){
						ans = (f[i][j][k][0] * cnt[i + 1] + ans) % Mod;
					} else {
						f[i + 1][!j][k][0] = (f[i + 1][!j][k][0] + f[i][j][k][0]) % Mod;
					}
					f[i + 1][j][k][0] = (f[i + 1][j][k][0] + f[i][j][k][1]) % Mod;
					f[i + 1][!j][k][0] = (f[i + 1][!j][k][0] + f[i][j][k][2]) % Mod;
				}
			}
		}
	}
	printf("%lld\n",(ans + f[n + 1][1][1][0]) % Mod);
	return 0;
}

Measured memory_bytes: 30976
#include<bits/stdc++.h>
using namespace std;
int n,K,sl,fh;
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
int main()
{
	n=rd();K=rd();
	if(K==1) puts("0");
	else n-=K,printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  vector<int> r(N+1,0),g(N+1,0),b(N+1,0);
  for(int i=N-1;i>=0;i--){
    r[i]=r[i+1];
    g[i]=g[i+1];
    b[i]=b[i+1];
    if(S[i]=='R')r[i]++;
    if(S[i]=='G')g[i]++;
    if(S[i]=='B')b[i]++;
  }
  // for(auto e:r)cerr<<e<<" ";
  // cerr<<endl;
  // for(auto e:g)cerr<<e<<" ";
  // cerr<<endl;
  // for(auto e:b)cerr<<e<<" ";
  // cerr<<endl;
  lint ans=0;
  REP(i,N)FOR(j,i+1,N)if(S[i]!=S[j]){
    if(S[i]!='R' and S[j]!='R'){
      ans+=r[j+1];
      if(2*j-i<N and S[2*j-i]=='R')ans--;
    }
    if(S[i]!='G' and S[j]!='G'){
      ans+=g[j+1];
      if(2*j-i<N and S[2*j-i]=='G')ans--;
    }
    if(S[i]!='B' and S[j]!='B'){
      ans+=b[j+1];
      if(2*j-i<N and S[2*j-i]=='B')ans--;
    }
    // cerr<<S[i]<<S[j]<<ans<<endl;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3648
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
m = map(int,read().split())
LRC = zip(m,m,m)

R_to_L = [[] for _ in range(N+1)]
R_to_C = [[] for _ in range(N+1)]

for l,r,c in LRC:
    R_to_L[r].append(l)
    R_to_C[r].append(c)

INF = 10**18

class MinSegTree():
    def __init__(self,N):
        self.Nelem = N
        self.size = 1<<(N.bit_length()) # 葉の要素数
        
    def build(self,raw_data):
        # raw_data は 0-indexed
        INF = 10**18
        self.data = [INF] * (2*self.size)
        for i,x in enumerate(raw_data):
            self.data[self.size+i] = x
        for i in range(self.size-1,0,-1):
            x = self.data[i+i]; y = self.data[i+i+1]
            self.data[i] = x if x<y else y
    
    def update(self,i,x):
        i += self.size
        self.data[i] = x
        i >>= 1
        while i:
            x = self.data[i+i]; y = self.data[i+i+1]
            self.data[i] = x if x<y else y
            i >>= 1
    
    def get_value(self,L,R):
        # [L,R] に対する値を返す
        L += self.size
        R += self.size + 1
        # [L,R) に変更
        x = 10**18
        while L < R:
            if L&1:
                y = self.data[L]
                if x > y: x = y
                L += 1
                
            if R&1:
                R -= 1
                y = self.data[R]
                if x > y: x = y
            L >>= 1; R >>= 1
        return x

dp = MinSegTree(N+1)
dp.build([INF]  * (N+1))

dp.update(1,0)

for r in range(2,N+1):
    x = INF
    for l,c in zip(R_to_L[r], R_to_C[r]):
        y = dp.get_value(l,r-1) + c
        if x>y:
            x=y
    dp.update(r,x)
    if r == N:
        answer = x

if answer == INF:
    answer = -1
print(answer)


Measured memory_bytes: 46344
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = parseInt(input);
answer = "NO";
if(input == 7 || input == 5 || input == 3) answer = "YES"
	console.log(answer);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<bits/stdc++.h>
#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 vi vector<int>
#define vb vector<bool>
#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 ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
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%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; }
void show(ll x){cout<<x<<" ";}
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 int long long 
#define lb lower_bound
#define mkp make_pair
//#define d double
void solve(){
	ll n;
	cin>>n;
	vpl vec(n);
	rep(i,0,n ) cin>>vec[i].f>>vec[i].se;
	Sort(vec);
	double sum=0;
	do{
		for(int i=0;i<n-1;i++){
			sum+=sqrt(pw(vec[i+1].f-vec[i].f,2)+pw(vec[i+1].se-vec[i].se,2));
		}
	}while(next_permutation(all(vec)));
	for(int i=2;i<=n;i++) sum/=i;
	cout<<setprecision(10)<<fixed<<sum;
	
	
	
 
}
int32_t main(){
int t=1;
//cin>>t;
while(t--){
	solve();
}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ITP1_10_C
{
    class Program
    {
        static void Main(string[] args)
        {
            double member;
            var result = new List<double>();
            while ((member = double.Parse(Console.ReadLine())) != 0.0)
            {
                
                double[] input = Console.ReadLine().Split(' ').Select(x => 
                
                Convert.ToDouble(x)).ToArray();
                double ave = input.Sum() / member;
                double disp = 0.0;

                foreach (var i in input)
                    disp += Math.Pow((i - ave), 2);

                result.Add(Math.Sqrt(disp / member));
            }
            foreach (var r in result) Console.WriteLine(r.ToString("f5"));
        }
    }
}

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

int a,b;

int main(){
    cin>>a>>b;
    if(a>=b){
        for(int i=0;i<a;i++){
            cout<<b;
        }
    }
    if(a<b){
        for(int i=0;i<b;i++){
            cout<<a;
        }
    }
    cout<<endl;
}

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

int main() {
  int a,b,c,x; ll ans=0;
  cin>>a>>b>>c>>x;
  for(int i=0; i*500<=x && i<=a; i++){
    for(int j=0; i*500+j*100<=x && j<=b; j++){
      if((x-i*500-j*100)/50<=c){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.split.map(&:to_i)
a.size.times do |i|
    if a[i]%2 == 0
        if a[i]%3 == 0 || a[i]%5 == 0
        else 
            puts "DENIED"
            exit 
        end
    end
end
puts "APPROVED"

Measured memory_bytes: 1788
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;

bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}


signed main() {
    ll q;
    cin >> q;
    
    vll s(100002);
    s[0] = 0;
    
    rrep(i, 100000) {
        int a = 0;
        if (isPrime(i) == 1 && isPrime((i+1)/2) == 1) {
            a++;
        }
        s[i] = s[i-1] + a;
    }
    
    rep(i, q) {
        ll l, r;
        cin >> l >> r;
        mes(s[r]-s[l-1]);
    }
    
    
}

Measured memory_bytes: 4032
#include<stdio.h>
int main(){
  long long n,m,x,ans=0,s[100010],f[100010]={},lc,ls,nokori,sum=0,i,a;
  scanf("%lld %lld %lld",&n,&x,&m);
  int d[10]={1,2,3,4,2,6,7,1};
  f[x]=1;
  s[x]=x;
  sum=x;
  for(i=2;i<=n;i++){
    a=(x*x)%m;
    //a=d[x];
    sum=s[x]+a;
    if(f[a])break;
    f[a]=i;
    s[a]=sum;
    x=a;
  }
  ls=sum-s[a];
  lc=i-f[a];
  nokori=n-i;
  if(lc==0){
    printf("%lld\n",x*n);
    return 0;
  }
  //printf("%lld\n",i);
  //printf("%lld %lld %lld %lld %lld\n",ls,lc,sum,nokori,f[a]);
  //if(nokori<0)nokori=0;
  ans=sum+(nokori/lc)*ls;
  nokori=nokori%lc;
  x=a;
  //printf("%lld\n",x);
  for(i=0;i<nokori;i++){
    a=(x*x)%m;
    //a=d[x];
    ans+=a;
    x=a;
  }
  printf("%lld\n",ans);
  return 0;
}


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

int main() {
  int n;string s;cin>>n>>s;int o=0;
  for(int i=0;i<n-2;i++){
    if(s.at(i)=='A'&&s[i+1]=='B'&&s[i+2]=='C')o++;
  }cout<<o<<endl;
}


Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) printf("Case #%d: ",i);
using namespace std;
typedef long long int ll;
typedef complex<double> com;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main(){
	int n; cin >> n;
	vector<int> a(100010,0);
	rep(i, 0, n) {
		int p; cin >> p;
		a[p]++;
	}
	int ans = 0;
	rep(i, 0,100000) {
		ans = max(ans, a[i] + a[i + 1] + a[i + 2]);
	}
	printf("%d", ans);
	return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int ans = inf;
	for (int j = 0; j <= 200000; ++j) {
		if (j % 2 != 0) continue;
		int d = j * c;
		int na = j / 2, nb = j / 2;
		if (na < x) d += a * (x - na);
		if (nb < y) d += b * (y - nb);
		ans = min(ans, d);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main(){
        vector <int> p;
        int N;
        cin>>N;
        for(int i=0;i<N;i++){
                int pp;
                cin>>pp;
                p.push_back(pp);
        }
        int res=0;
        for(int i=0;i<N;i++){
                if(p[i]==i+1){
                        if(p[i+1]!=i+1){
                                res++;
                                swap(p[i], p[i+1]);
                                continue;
                        }
                        int j;
                        for(j=i;j<N;j++){
                                if(p[j]==i+1){
                                        res++;
                                }
                                else{
                                        break;
                                }
                        }
                        swap(p[i], p[j]);
                }
        }
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
long long arr[100001];
int main()
{
    int n,cnt=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    int mx=0;
    for(int i=1;i<=n;i++)
    {
        if(arr[i-1]>=arr[i])
       {
        cnt++;}
        if(mx<cnt)
                  {mx=cnt;}
        if(arr[i-1]<arr[i])
              {
                  //cout<<arr[i-1]<<arr[i]<<endl;
                 // cout<<cnt<<endl;
                  cnt=0;
        }
    }
    cout<<mx<<endl;

}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;
// ついでに有理数型
using rat = boost::rational<bint>;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()

void solve(long long N, long long X, long long T){
	cout << roundup(N,X)*T << endl;
}

int main(){
    long long N;
  scanf("%lld",&N);
  long long X;
  scanf("%lld",&X);
  long long T;
  scanf("%lld",&T);
    solve(N, X, T);
    return 0;
}


Measured memory_bytes: 3696