akhauriyash/Code-Regression huggingface dataset:
s=list(input())
o=['R','U','D']
e=['L','U','D']
for i in range(len(s)):
    if (i+1)%2==0:
        if s[i] not in e:
            print("No")
            exit()
    else:
        if s[i] not in o:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
int main(){
    int N;
    cin >>N;
    vector<int> slime(N);
    int kosuu=1;
    cin >> slime.at(0);
    int former;
    former = slime.at(0);
    int ans = 0;
    for(int i = 1; i < N; i++){
        cin >> slime.at(i);
        if(former==slime.at(i)){
            kosuu++;
        }
        if(former != slime.at(i)){
            kosuu = kosuu/2;
            ans=ans+ kosuu;
            kosuu = 1;
        }
        former = slime.at(i);
    }
    ans = ans+kosuu/2;
    cout<<ans<<endl;
}

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

int64_t gcd(int64_t x, int64_t y) {
  if (x % y == 0) {
    return y;
  }else {
    return gcd(y, x % y);
  }
}

int main() {
  int64_t a, b;
  int64_t c, d;
  cin >> a >> b >> c >> d;
  int64_t count = 0, counta_1 = 0, countb = 0;//答え、cでもdでも割り切れない1～a(b)の数
  //1～bのb個の数でc,dの倍数でないもの=b-(cの倍数)-(dの倍数)+(cかつdの倍数)
  int64_t lcm = c * d / gcd(c, d);
  countb = b - b / c - b / d + b / lcm;
  counta_1 = (a - 1) - (a - 1) / c - (a - 1) / d + (a - 1) / lcm;
  count = countb - counta_1;
  cout << count;
}

Measured memory_bytes: 256
fn main() {
    let s = readln::<String>();
    let mut stack = Vec::new();
    for c in s.chars() {
        if let Some(d) = stack.pop() {
            if d == 'S' && c == 'T' {
            } else {
                stack.push(d);
                stack.push(c);
            }
        } else {
            stack.push(c);
        }
    }
    println!("{}", stack.len());
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashSet;

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n { vs.push(readln()); }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
impl<T> FromLn for Vec<T> where T: FromLn {
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int N; cin >> N;
  vector<int> a(N);
  rep(i,N)  cin >> a.at(i);
  for(int i=N-1;i>0;i--){
    int diff = a[i-1] - a[i];
    if(diff>=1){
      if(diff==1) {
        a[i-1]--;
      }else{
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");

}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

int main() {
	string S, T;
	cin >> S >> T;

	ll N = S.size();
	ll M = T.size();

	vector<ll> sumS(N + 1,0);
	repn(i, N) sumS[i] += sumS[i - 1] + S[i - 1] - 'A' + 1;

	vector<ll> sumT(M + 1, 0);
	repn(i, M) sumT[i] += sumT[i - 1] + T[i - 1] - 'A' + 1;

	ll q;
	cin >> q;

	repn(i, q) {
		ll a, b, c, d;
		cin >> a >> b >> c >> d;

		if ((sumS[b] - sumS[a - 1]) % 3 == (sumT[d] - sumT[c - 1]) % 3) { cout << "YES"; }
		else { cout << "NO"; }

		cout << endl;
	}

	system("PAUSE");

}





Measured memory_bytes: 2680
n=gets.to_i
cnts={}
n.times{
    s=gets.chomp
    if(cnts.has_key?(s))
        cnts[s]+=1
    else
        cnts[s]=1
    end
}
m=gets.to_i
m.times{
    t=gets.chomp
    if(cnts.has_key?(t))
        cnts[t]-=1
    end
}
puts [0,cnts.max{|x,y|x[1]<=>y[1]}[1]].max

Measured memory_bytes: 1788
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        int m = Integer.parseInt(s.substring(5, 7));
        System.out.println(m <= 4 ? "Heisei" : "TBD");
        scan.close();
    }
}

Measured memory_bytes: 27000
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

#define R register

int N, K;
string s, rev, tmp, str;

int main() {
	cin >> N >> K >> s;
	rev = s, reverse(rev.begin(), rev.end());
	tmp = s + rev, reverse(tmp.begin(), tmp.end());
//cout << tmp << endl;
	str = tmp.substr(0, N);
	for(R int i = 1; i < N; ++i) {
		rev = tmp.substr(i, N);
		if(rev < str) str = rev;
	}
	reverse(str.begin(), str.end());
//cout << str << endl;
	for(R int i = 1, j, k; i < K; ++i) {
		for(j = N - 2; ~j; --j) if(str[j] != str[N - 1]) break;
		str = str + str.substr(j + 1, N);
//cout << str << endl;
		k = str.length();
		str = str.substr(k - N, N);
		if(j == -1) break;
//cout << str << endl;
	}
	reverse(str.begin(), str.end());
 	cout << str;
 	return 0;
}


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

using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  if(K>N*(N-1)/2-(N-1)){
    cout << -1 << endl;
    return 0;
  }
  cout << N*(N-1)/2-K << endl;
  for(int i=2;i<=N;i++){
    cout << 1 << " " << i << endl;
  }
  int cnt=N-1;
  for(int s=2;s<N; s++){
    for(int g=s+1;g<=N;g++){
      if(cnt==N*(N-1)/2-K) return 0;
      cout << s << " " << g << endl;
      cnt++;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n" 
using namespace std; 
typedef long long int ll; 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
    #endif
    ll n,cnt=0;
    cin>>n;
    for(ll i=1; i<=n; i++)
    {
        if((i%3!=0) && (i%5!=0))
        cnt+=i;
    }
    cout<<cnt<<"\n"; 
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

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

    LL d = c-a-b;

    if(d > 0 && d*d>4*a*b)cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main(){

    int n;
    int a,b;
    int i,j;
    char t;
char t1[1000];
char t2[1000];
char t3[8];
    scanf("%s",&t1);
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",&t3);
        if(strcmp(t3,"replace")==0){
            scanf("%d %d %s",&a,&b,&t2);
            for(j=0;j<b-a+1;j++){
                t1[a+j]=t2[j];
            }
        }
        else if(strcmp(t3,"reverse")==0){
            scanf("%d %d",&a,&b);
            for(;a<b;){
                t=t1[a];
                t1[a]=t1[b];
                t1[b]=t;
                a++;
                b--;
            }
        }
        else if(strcmp(t3,"print")==0){
            scanf("%d %d",&a,&b);
            for(j=a;j<b+1;j++){
                printf("%c",t1[j]);
            }
             printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#define rep(i,N) for(int i=0;i<N;i++)

long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


int main(){

double x1,y1,x2,y2,x3,y3;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
double s=abs((x1-x3)*(y2-y3)-(x2-x3)*(y1-y3))/2;
double l1=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

double l2=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));

double l3=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));


double lmax=max(l1,l2);
lmax=max(lmax,l3);
double high=2*s/lmax;
double ans=s/((l1+l2+l3)/2+high);
printf("%2.12f",ans);
 return 0;
}
/*
0 0
1 1
2 0

0.292893218813

3 1
1 5
4 9

0.889055514217
*/

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int a,b,c,d,g1,g2;
    cin >> a >> b >> c >> d;
    g1=(a+d-1)/d;
    g2=(c+b-1)/b;
    if(g1>=g2)
        cout << "Yes";
    else
        cout << "No";
}



Measured memory_bytes: 3616
N,K = map(int,input().split())
P = list(map(int,input().split()))
ls = [0] * (N + 1)

for i in range(N):
  ls[i+1] += ls[i] + (P[i] + 1) / 2
  
ans = 0
for j in range(N-K+1):
  tmp = ls[K+j] - ls[j]
  ans = max(ans, tmp)
  
print(ans)

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

int main()
{
	int a, b, c, d, e;
	int A, B, C = 0;

	cin >> A >> B;
	
	for(int i = A; i <= B; i++){
		a = i / 10000;
		b = i % 10000 / 1000;
		c = i % 1000 / 100;
		d = i % 100 / 10;
		e = i % 10;

		if (a == e && b == d) {
			C++;
		}
	}
	cout << C << endl;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

bool isprime(int num){
    for (int i = 2; i*i <=num; i++)
    {
        if(num%i==0){
            return false;
        }
    }
    return true;
}

signed main(){
    int x;
    cin >> x;
    for (int i = x; i <= 2e5; i++)
    {
        if (isprime(i))
        {
            cout << i << endl;
            return 0;
        }
   }
   
   
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ul N, M;
  cin >> N >> M;
  vector<ul> H(N + 1, 0);
  vector<ul> Ha(N + 1, 0);
  for (ul ii = 1; ii <= N; ++ii) cin >> H[ii];
  ul A, B;
  REP(ii, M) {
    cin >> A >> B;
    Ha[A] = max(Ha[A], H[B]);
    Ha[B] = max(Ha[B], H[A]);
  }
  int cnt = 0;
  for (ul ii = 1; ii <= N; ++ii) {
    cnt += H[ii] > Ha[ii];
  }
  cout << cnt << endl;
  return 0;
}


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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
		public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long Q = inputArray[1];
			var S = retreiveStringArray()[0].Select(x=>x).ToArray();

			var questions = createLongTuppleList(Q);

			var ruiseki = new int[N];

			var pre = 'x';

			for (int i = 0; i < N; i++) {
				var c = S[i];

				if (i==0) {
					ruiseki[i] = 0;
					pre = c;
					continue;
				}

				if (pre == 'A' && c == 'C') {
					ruiseki[i] = ruiseki[i - 1] + 1;
				}
				else {
					ruiseki[i] = ruiseki[i - 1];
				}
				pre = c;
			}

			foreach (var q in questions) {

				var ans = ruiseki[q.Item2-1] - ruiseki[q.Item1 - 1];

				Console.WriteLine(ans);
			}


		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}



Measured memory_bytes: 50100
#include<bits/stdc++.h>
using namespace std;
int n,m,x[110],num;
int main(){
	cin>>n>>m;
	for (int i=0;i<n;i++) cin>>x[i];
	for (int i=0;i<n;i++){
		num+=x[i];
		if (num>m){
			cout<<i+1<<endl;
			return 0;
		}
	}
	cout<<n+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> a(n+1,0);
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)a[i]+=a[i-1];
    vector<int> v;
    for(int i=0;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            v.push_back(a[j]-a[i]);
        }
    }
    int res=0;
    for(int b=60;b>=0;b--){
        int cnt=0;
        int now=(1ll<<b);
        for(auto it:v)if(it&now)cnt++;
        if(cnt>=k){
            res+=now;
            vector<int> vv;
            for(auto it:v){
                if(it&now){
                    vv.push_back(it);
                }
            }
            v=vv;
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 6384
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

int p = 786433;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}




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

    int n;
    cin>>n>>p;

    init();

    vector<vector<int>> dp(3*n+1, vector<int>(6*n+1)); //balance = 1s - 2s
    dp[0][3*n] = 1;
    for (int tot = 1; tot<=3*n; tot++)
    {
        for (int balance = 0; balance<=6*n; balance++)
        {
            if (balance>0)                  dp[tot][balance] = add(dp[tot][balance], dp[tot-1][balance-1]);                 //take 1
            if (tot>=2 && balance<6*n)      dp[tot][balance] = add(dp[tot][balance], mul(dp[tot-2][balance+1], (tot-1)));   //take 2
            if (tot>=3)                     dp[tot][balance] = add(dp[tot][balance], mul(dp[tot-3][balance], (tot-1)*(tot-2)));   //take 3
        }
    }

    /*for (int i = 0; i<=3*n; i++)
    {
        cout<<"tot: "<<i<<endl;
        for (auto it: dp[i]) cout<<it<<' ';
        cout<<endl;
    }*/

    int res = 0;

    for (int i = 3*n; i<=6*n; i++) res = add(res, dp[3*n][i]);

    cout<<res;

}




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

using namespace std;


int main(){
   int N,Q;
   cin >> N >> Q;
   string S;
   cin >> S;
   int sum[N+1];
   sum[0] = 0;
   for(int i=0; i+1<N; i++){
      if(S[i]=='A'&&S[i+1]=='C'){
         sum[i+1]=sum[i]+1;
      }
      else{
         sum[i+1] = sum[i];
      }
   }
   for(int i=0;i<Q;i++){
      int l, r;
      cin >> l >> r;
      r--;
      l--;
      cout << sum[r]-sum[l] << endl;
   }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
#define fst first
#define snd second
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


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

  V l(k+1, -INF), r(k+1, INF);
  int j = 0;
  rep(i, n) {
    if (s[i] == 'o' && l[j]+c < i) {
      l[j+1] = i;
      ++j;
    }
    if (j > k) break;
  }

  j = 0;
  drep(i, n) {
    if (s[i] == 'o' && r[j]-c > i) {
      r[j+1] = i;
      ++j;
    }
    if (j > k) break;
  }

  rep(i, k) {
    if (l[i+1] == r[k-i]) cout << (l[i+1]+1) << endl;
  }
  return 0;
}


Measured memory_bytes: 3332
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int N, T;
  cin >> N >> T;
  vector<int> D(N);
  for(int i = 0; i < N; ++i){
    cin >> D[i];
  }
  sort(D.begin(),D.end());
  long long int ans = 1, MOD = 1000000007;
  for(int i = N-1; i >= 0; --i){
    int d = D[i];
    int c = upper_bound(D.begin(),D.end(),d+T)-D.begin();
    ans *= (c-i);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3156
package main

import "fmt"

func main() {
	var n, k, b int
	fmt.Scan(&n, &k)
	var a []int
	for i := 0; i < k; i++ {
		fmt.Scan(&b)
		a = append(a, b)
	}
	var prev, score int
	score = a[0]
	for i := k; i < n; i++ {
		prev = a[i%k]
		fmt.Scan(&b)
		score = b
		if score > prev {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
		a[i%k] = b
	}
}


Measured memory_bytes: 10212
n,k=map(int,input().split())
LI=list(range(1,n+1))
kari=n+1
for i in range(1,k+1):
  d=int(input())
  li=list(map(int,input().split()))
  for x in range(1,n+1):
    if li.count(x)!=0:
      if LI.count(x)!=0:
        LI.remove(x)
print(len(LI))
      
      
    

Measured memory_bytes: 9080
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
using namespace std;
int main()
{
	int flag = 1;
	int flag1 = 0;
	char s[20];
	scanf("%s", s);
	for (int i = 0; s[i] != '\0'; i++)
	{
		if (i == 0)
		{
			if(s[i] != 'A')flag = 0;
		}
		else if (s[i] == 'C'&&i >= 2 && s[i + 1] != '\0')
		{
			if (flag1 == 0)
			{
				flag1 = 1;
			}
			else flag = 0;
		}
		else
		{
			if (s[i] > 'z' || s[i] < 'a')flag = 0;
		}
	}
	if (flag1 == 0)flag = 0;
	if (flag == 0)printf("WA");
	else printf("AC");
	return 0;
}

Measured memory_bytes: 256
/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>

using namespace std;

int toNum(char s) {
	if(s == 'S') return 0;
	if(s == 'H') return 1;
	if(s == 'C') return 2;
	if(s == 'D') return 3;
	return 0;
}

int main() {
	bool cards[4][13] = {};
	int n;
	cin >> n;
	for(int i=0; i<n; i++) {
		char s;
		int r;
		cin >> s >> r;
		cards[toNum(s)][r-1] = true;
	}
	for(int i=0; i<13; i++) {
		if(cards[0][i] == false) {
			cout << "S " << i+1 << endl;
		}
	}
	for(int i=0; i<13; i++) {
		if(cards[1][i] == false) {
			cout << "H " << i+1 << endl;
		}
	}
	for(int i=0; i<13; i++) {
		if(cards[2][i] == false) {
			cout << "C " << i+1 << endl;
		}
	}
	for(int i=0; i<13; i++) {
		if(cards[3][i] == false) {
			cout << "D " << i+1 << endl;
		}
	}
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
 
int main() {
    fast();
   /* ll t;
    cin>>t;
    while(t--)			
    {
        
    }*/
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>>v(n+1);
    ll ans[n+1];
    for(int i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    ans[1]=1;
    queue<ll>q;
    q.push(1);
    bool vis[n+1]={false};
    //ll path[n+1];
//    path[0]=0;
    while(!q.empty())
    {
        ll x;
        x=q.front();
        q.pop();
        vis[x]=true;
        for(ll i=0;i<v[x].size();i++)
        {
            if(!vis[v[x][i]])
            {
                ans[v[x][i]]=x;
                q.push(v[x][i]);
                vis[v[x][i]]=true;
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    for(ll i=2;i<=n;i++)
    {
        cout<<ans[i]<<endl;
    }
}



Measured memory_bytes: 13116
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define foru(i,a,n) for(ll i=(a); i<=(n); ++i)
#define ford(i,n,a) for(ll i=(n); i>=(a); --i)
using namespace std;
const int inf = 1e9;
const int N = 3030;
ll n, a[N], dp[N][N][2], vis[N][N][2];

ll sol(int L, int R, int player){
	if(L==R){
		if(player == 1) return a[L]; else return -a[L];
	}
	if(vis[L][R][player]) return dp[L][R][player];

	vis[L][R][player] = 1;
	ll opt1 = sol(L+1, R, player^1);
	ll opt2 = sol(L, R-1, player^1);
	if(player)
		return dp[L][R][player] = max(a[L] + opt1, a[R] + opt2);
	else
		return dp[L][R][player] = min(-a[L] + opt1, -a[R] + opt2);
}

int main() {
	//freopen("a.in","r",stdin);
	ios::sync_with_stdio(0);
	cin >>n;
	foru(i,1,n) cin >>a[i];

	memset(vis, 0, sizeof(vis));

	//sol(1,n,0) bat dau tu player 1 chon la bai tu a[1]..a[n]
	cout <<sol(1, n, 1);
    
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
	return 0;
}

Measured memory_bytes: 287232
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
int n, d[200010], dp[200010]={0,0,1}, mx, mxu;
vector<int> adj[200010];
void dfs(int p, int u, int d) {
	if(d >= mx) mx = d, mxu = u;
	for(int v : adj[u])
		if(v != p) dfs(u, v, d+1);
}
int main() {
	scanf("%d", &n);
	for(int i=3; i<=n; i++)
		dp[i] = !(dp[i-1] || dp[i-2]);
	for(int i=0; i<n-1; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	dfs(1,1,0);
	mx = 0;
	dfs(mxu,mxu,0);
	puts(dp[mx+1] ? "Second" : "First");
	return 0;
}

Measured memory_bytes: 22016
x,y = map(int,input().split())

if x == y:
	print(-1)
	exit()

i =2

if x < y :
	while x*i % y == 0:
		i = i + 1	
	print(x*i)
	
else:
	if x%y==0:
		print(-1)
	else:
		while x*i % y == 0:
			i = i + 1	
		print(x*i)
		





Measured memory_bytes: 38384
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
ansn = 0
ans0 = 0
for i in range(x, n):
    if i in a:
        ansn += 1

for i in range(x, 0, -1):
    if i in a:
        ans0 += 1

print(min(ansn,ans0))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define P pair<int, int>
#define dvec vector<vector<ll>>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b){if (a < b) { a = b; return true; } return false;}
template<class T> inline bool chmin(T& a, T b){if (a > b) { a = b; return true; } return false;}
ll INF = 1e+18;
int iINF = 1e9;

int N;
vector<double> arr;
vector<vector<double>> dp;

void
rec(int n, int front)
{
  if(n == 0) return;
  
  rec(n - 1, front - 1);

  for(int i = n; i > 0; --i){
    dp[n][i] += dp[n - 1][i - 1] * arr[n - 1];
    dp[n][i - 1] += dp[n - 1][i - 1] * (1.0 - arr[n - 1]);
  }
}


int main()
{
  cin >> N;
  arr.resize(N);
  rep(i, 0, N) cin >> arr[i];
  dp.assign(N + 1, vector<double>(N + 1, 0));
  dp[0][0] = 1.0;

  rec(N, N);

  double ans = 0.0;
  repe(i, N / 2 + 1, N){
    ans += dp[N][i];
  }
  
  printf("%.10f\n", ans);
}


Measured memory_bytes: 73736
S = input()
N = len(S)

arr = [0] * N

R = 0
for i in range(N-1):
    if S[i] == "R":
        R += 1
    if S[i+1] == "L":
        arr[i+1] += R // 2
        arr[i] += -(-R // 2)
        R = 0

L = 0

for i in range(N-1,0,-1):
    if S[i] == "L":
        L += 1
    if S[i-1] == "R":
        arr[i-1] += L // 2
        arr[i] += -(-L // 2)
        L = 0
    
print(*arr)

Measured memory_bytes: 6400
public class Main {

  private static void solve() {
    int n = ni();
    int[] a = new int[n + 2];
    for (int i = 1; i <= n; i++) {
      a[i] = ni();
    }
    long all = 0;

    for (int i = 1; i <= n + 1; i++) {
      all += Math.abs(a[i - 1] - a[i]);
    }

    for (int i = 1; i <= n; i++) {
      long now = all - Math.abs(a[i - 1] - a[i]) - Math.abs(a[i] - a[i + 1])
          + Math.abs(a[i - 1] - a[i + 1]);
      out.println(now);
    }
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = System.getProperty("debug");
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 46312
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

//A reward for a Carpentor
public class Main {

	public static int n;
	public static int m;

	public static int[] dist;
	public static int[][] cost;

	public static int dijkstra(int s, int t){
		dist = new int[n+1];
		Arrays.fill(dist, Integer.MAX_VALUE);
		dist[s] = 0;
		PriorityQueue<Integer> q = new PriorityQueue<Integer>(n, new Comparator<Integer>(){
			public int compare(Integer o1, Integer o2) {
				return dist[o1]-dist[o2];
			}
		});
		q.add(s);
		while(!q.isEmpty()){
			int v = q.poll();
			if(v == t)return dist[t];
			for(int i=1;i<=n;i++){
				if(cost[v][i]!=Integer.MAX_VALUE){
					int w = dist[v]+cost[v][i];
					if(w<dist[i]){
						dist[i] = w;
						q.add(i);
					}
				}
			}
		}
		return -1;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		sc.nextLine();
		cost = new int[n+1][n+1];
		for(int[] a:cost)Arrays.fill(a, Integer.MAX_VALUE);
		for(int i=0;i<m;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			int c = Integer.parseInt(s[2]);
			int d = Integer.parseInt(s[3]);
			cost[a][b] = c;
			cost[b][a] = d;
		}
		String[] s = sc.nextLine().split(",");
		int a = Integer.parseInt(s[0]);
		int b = Integer.parseInt(s[1]);
		int c = Integer.parseInt(s[2]);
		int d = Integer.parseInt(s[3]);
		System.out.println(c-d-dijkstra(a, b)-dijkstra(b, a));
	}
}

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

using namespace std;

int main()
{
    int cnt = 0;
    string s;
    cin >> s;
    int l = s.size();
    for(int i = 0; i < l; i++)
    {
        if(s[i] == '+')
            cnt++;
        else if(s[i] == '-')
            cnt--;
    }
    cout << cnt <<'\n';
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define MAX 100000
typedef long long ll;

int n,k;
ll T[MAX];
int check(ll p)
{
	int i = 0;
	for (int j = 0; j < k; ++j)
	{
		ll s = 0;
		while(s+T[i] <= p)
		{
			s+=T[i];
			i++;
			if(i==n) return i;
		}
	}
	return i;
}
int slove()
{
	ll left = 0;
	ll right = 100000 * 10000;
	while(left < right)
	{
		ll mid = left+(right-left)/2;
		int v = check(mid);
		if(v >= n) right = mid;
		else left = mid+1;
	}
	return right;
}

int main(int argc, char const *argv[])
{
	cin>>n>>k;
	for (int i = 0; i < n; ++i)
	{
		cin>>T[i];
	}
	ll ans = slove();
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pair = pair<int, int>;
using Vec = vector<int>;
using Graph = vector<Vec>;

int		main(void)
{
	string s;
	cin >> s;
	if (s == "ABC")
		cout << "ARC" << endl;
	else
		cout << "ABC" << endl;
}


Measured memory_bytes: 3592
import sys
import numpy as np

n, a, *x = map(int, sys.stdin.read().split())

def main():
    m = 2500
    dp = np.zeros((n + 1, m + 1), dtype=np.int64)
    dp[0, 0] = 1
    for i in range(n):
        ndp = np.copy(dp)
        ndp[1:, x[i]:] += dp[:-1, :m-x[i]+1]
        dp = ndp
    i = np.arange(1, n + 1)
    print(np.sum(dp[i, i * a]))

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 14556
import math
from collections import Counter

def prime_factorize(n):
    factor = []
    thre = int(math.sqrt(n)) + 1
    for num in range(2,thre):
      if num%2 == 0 and num != 2:
        continue
      while n % num == 0:
        n //= num
        factor.append(num)
    if n != 1:
      factor.append(n)
    return Counter(factor)

def func(n):
  i = 1
  tmp = 0
  while True:
    tmp += i
    if tmp > n:
      i -= 1
      break
    elif tmp == n:
      break
    i += 1
  return i

N = int(input())

result = 0
for key, value in prime_factorize(N).items():
    result += func(value)

print(result)

Measured memory_bytes: 9480
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

//kannondou??¨??¢?´¢
ll n;

ll solve(int now) {
	if (now == 0)return 1;
	if (now < 0)return 0;
	ll res = 0;
	res = solve(now - 1) + solve(now - 2) + solve(now - 3);
	return res;
}

int main() {
	while (cin >> n&&n) {
		cout << solve(n) / 3650 + 1 << endl;
	}
}

Measured memory_bytes: 3072
#include<stdio.h>
int main(){
  int a, b, i=0, k=0, x=0, z;
  double y;
  while( scanf("%d,%d",&a,&b) != EOF ){
    x=x+(a*b);  /*合計金額の加算*/
    i=i+b;   /*売れた個数の加算*/
    k=k+1;
  }

  y=(double)i/k;  /*売れた個数の平均の計算*/
  y=y+0.5;
  y=(int)y;

  printf("%d\n",x);
  printf("%.0f\n",y);
  return 0;
}

Measured memory_bytes: 628
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 

fn main() {
    input!{
    	n: usize,
    	k: i32,
    	h: [i32; n]
    }
    let mut ans: i32 = 0;
    for i in h {
    	if i >= k {
    		ans += 1;
    	}
    }
    println!("{}",&ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c; cin >> a >> b >> c;
	int x, y; cin >> x >> y;
	int ans = 0;
	if (a + b > 2 * c) {
		ans += min(x, y)*2*c;
		int tmp = min(x, y);
		x -= tmp; y -= tmp;
	}
	if (a <= 2 * c) {
		ans += a * x;
	}
	else {
		ans += c * 2 * x;
	}
	if (b <= 2 * c) {
		ans += b * y;
	}
	else {
		ans += c * 2 * y;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") 
///#pragma GCC target("avx2")
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <functional>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <climits>
#include <numeric>

using namespace std;
#define open_streams ifstream fin("olympiad.in");ofstream fout("olympiad.out")
#define close_streams fin.close();fout.close()
#define speed cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0)
#define ll long long
#define ull unsigned long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define UNIQ(a) a.resize(unique(all(a)) - a.begin())
#define eps 1e-6
//const double PI = M_PI;
const int INF = INT_MAX;
const ll limit = 1LL * 1e12;
const int MOD = 1e9 + 711;
const int MOD2 = 1e9 + 933;
//---------------------------------------------------------------------------
const int mod = 1e9 + 7;
const int maxn = 1e6 + 100;



signed main() {
	speed;
	int n, k;
	cin >> n >> k;
	vector<int> a(n+1);
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	vector<double> d(n+1);
	double ans = 0, cur = 0;
	for (int i = 1; i <= n; ++i) {
		d[i] = (a[i] + 1.0) / 2.0;
		if (i < k) {
			cur += d[i];
		}
	}
	for (int i = k; i <= n; ++i) {
		cur += d[i] - d[i - k];
		ans = max(ans, cur);
	}
	cout << fixed << setprecision(10) << ans;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const int MOD = 998244353;

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int n, k; cin >> n >> k;
	vector<int> l(k), r(k);
	REP(i, k) cin >> l[i] >> r[i];

	vector<int> dp(n + 1, 0);
	dp[1] = 1;
	vector<int> s(n + 1, 0);
	s[1] = 1;
	for (int i = 2; i <= n; i++) {
		REP(j, k) {
			int li = i - r[j];
			int ri = i - l[j];
			if (ri < 0) continue ;
			li = max(li, 1);
			dp[i] += (((s[ri] - s[li - 1]) % MOD) + MOD) % MOD;
			dp[i] %= MOD;
		}
		s[i] = (s[i - 1] + dp[i]) % MOD;
	}
	cout << dp[n] << '\n';
    return 0;
}


Measured memory_bytes: 4756
from functools import reduce
from operator import xor

N, *A = map(int, open(0).read().split())
x = reduce(xor, A)

memo = set(a ^ (a - 1) for a in A)

ans = 0
K = x.bit_length()
for k in reversed(range(K)):
    if (x >> k) & 1:
        t = (2 << k) - 1
        if t in memo:
            x ^= t
            ans += 1

if x == 0:
    print(ans)
else:
    print(-1)

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

int main()
{
    int arr[3] , a[]={5,5,7},i,found=0;
    for(i=0; i<3;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+3);
    for(i=0; i<3;i++)
    {
        if(a[i]==arr[i])
        {
            found++;
        }

    }
    if(found==3)
    {
        cout<<"YES";
    }
    else cout<<"NO";


    return 0;
}


Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] data = Console.ReadLine().Split(' ');
                int h = Convert.ToInt32(data[0]);
                int w = Convert.ToInt32(data[1]);

                if (h == 0 && w == 0) { break; }

                for (int x = 0; x < h; x++)
                {
                    if(x == 0 || x == h-1)
                    {
                        Console.WriteLine(new String('#', w));
                    }
                    else
                    {
                        string sharp = new String('.', w);
                        sharp = Regex.Replace(sharp, @"^\.", "#");
                        sharp = Regex.Replace(sharp, @"\.$", "#");
                        Console.WriteLine(sharp);
                    }
                }

                Console.WriteLine(string.Empty);
            }
        }
    }
}

Measured memory_bytes: 11280
#include <iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
    int  i=0,j=0;
    int a[10]={};


        for(i=0;i<10;i++){
            cin >>a[i];
        }
    sort(a,a+10);
        for(i=9;i>6;i--){
            cout << a[i] << endl;
        }


    //cout << endl;

return 0;

}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

bool isPrime[55556];
void func(int x){

  for(int i = x * 2 ; i <= 55555 ; i += x)
    isPrime[i] = false;
 
}

int main(void){

    for(int i = 2 ; i <= 55555 ; i++)
      	isPrime[i] = true;
  
    FOR(i , 2 , 27779)
      if(isPrime[i]) func(i);

    int N;    cin >> N;
    int cnt = N;
    vector<int> ans;
    for(int i = 11; cnt != 0 ; i++){
      
      if(i % 5 == 1 && isPrime[i]){
	 	ans.push_back(i);
	 	cnt -= 1;
      }
      
    }

    REP(i , N)  SCOUT(ans[i]);
    cout << endl;

    return 0;
}


Measured memory_bytes: 256