akhauriyash/Code-Regression huggingface dataset:
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const [a, b]: number[] = input[0].split(' ').map((x: string): number => +x);

if(b === 1){
    console.log(0)
}else if(a >= b){
    console.log(1)
}else{
    const bb = b-a;
    let ans: number = 1;
    let tmp: number = 0;
    for(let i = 0; true; i++){
        tmp += (a-1);
        ans++
        if(tmp >= bb){
            console.log(ans);
            break;
        }
    }
}


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

using ll = long long;
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
#define repi(n) for (int i = 0; i < n; i++)
#define repj(n) for (int j = 0; j < n; j++)
#define repk(n) for (int k = 0; j < n; k++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define repv(itr) for (auto&& v : itr)
#define swap(x, y)    \
  {                   \
    auto ___temp = x; \
    x = y;            \
    y = ___temp;      \
  }

const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  ll p = min(a, min(b, min(c, min(d, e))));
  cout << 4 + (n + p - 1) / p << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
 
#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}
 
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
 
using namespace std;
 
typedef pair<int,int> pii;
 
int main(){
  int n;
  cin >> n;

  map<int ,int> mp;
  int i = 1;
  
  mp[n] = 1;
  int val = n;

  while(true){
    if(val % 2 == 0){
      val = val / 2;
    }else{
      val = 3 * val + 1;
    }

    if(mp[val] == 1){
      cout << i+1 << endl;
      break;
    }
    mp[val] = 1;
    i++;
  }
  return 0;
}
 



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int V;
int A[100001], B[100001];
int K;
int U[100001], R[100001];
vector<int> G[100001];

int find(int x) {
  if (U[x] == x) return x;
  return U[x] = find(U[x]);
}

void unite(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return;
  if (R[x] < R[y]) swap(x, y);
  U[y] = x;
  R[x] += R[y];
  R[y] = 0;
  K--;
}

bool same(int x, int y) {
  return find(x) == find(y);
}

void add_edge(int x, int y) {
  G[x].pb(y);
  G[y].pb(x);
  unite(x, y);
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  int g = 0;
  rep(i, N) {
    cin >> A[i];
    g ^= A[i];
  }
  A[N] = g;

  g = 0;
  rep(i, N) {
    cin >> B[i];
    g ^= B[i];
  }
  B[N] = g;

  vector<int> as, bs;
  rep(i, N+1) {
    as.pb(A[i]);
    bs.pb(B[i]);
  }
  sort(all(as));
  sort(all(bs));
  if (as != bs) {
    cout << -1 << "\n";
    return 0;
  }
  rep(i, N+1) assert(as[i] == bs[i]);
  uniq(as);
  V = as.size();
  rep(i, N+1) {
    A[i] = lower_bound(all(as), A[i]) - as.begin();
    B[i] = lower_bound(all(as), B[i]) - as.begin();
  }
  //rep(i, N+1) cout<<A[i]<<","; cout<<"\n";
  //rep(i, N+1) cout<<B[i]<<","; cout<<"\n";
  K = V;
  rep(i, V) U[i] = i, R[i] = 1;

  int edges = 0;
  rep(i, N) {
    if (A[i] == B[i]) continue;
    add_edge(A[i], B[i]);
    edges++;
  }
  rep(i, V) if (G[i].empty()) K--;

  int s = B[N], t = A[N];
  assert(same(s, t));
  if (G[s].empty()) K++;
  assert(K > 0);

  cout << edges+K-1 << "\n";
  return 0;
}


Measured memory_bytes: 8052
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;
    
int main(){
    int n, a;
    cin >> n;
    
    a = n % 10;
    if (a == 3) cout << "bon" << endl;
    else if (a == 2 || a==4 || a==5 || a==7 || a==9) cout << "hon" << endl;
    else cout << "pon" << endl;  
    return 0;
}

Measured memory_bytes: 3588
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define x first
#define y second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

char s[110];
int a[26];

int main()
{
	int n,m;scanf("%d%d",&n,&m);
	for (int i=0;i<n;i++)
	{
		scanf("%s",s);
		for (int j=0;j<m;j++) a[s[j]-'a']++;
	}
	int s1=0,s2=0;
	for (int i=0;i<26;i++)
	{
		if (a[i]%2==1) s1++;
		if (a[i]%4==2) s2++;
	}
	if (s1>1||(s1==1&&(n%2==0||m%2==0))) {puts("No");return 0;}
	int t=0;
	if (n%2==1) t+=m/2;
	if (m%2==1) t+=n/2;
	if (s2>t) {puts("No");return 0;}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
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

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K, A, B;
    cin >> K >> A >> B;
    if (K <= A - 1 || B - A <= 2) {
        cout << 1 + K << endl;
    } else {
        K -= A - 1;
        cout << (B - A) * (K / 2) + (K % 2 == 1) + A << endl;
    }


    return 0;
}


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

int main(void){
    int num[26] = {0};
    int i;
    char ch;
    int result = scanf("%c",&ch);
    while(result != EOF){
        ch = tolower(ch);
        if(ch - 'a' > -1 && ch - 'a' < 26){
            num[ch - 'a'] += 1;
        }
        result = scanf("%c",&ch);
    }
    for(i = 0;i<26;i++){
        printf("%c : %d\n",'a' + i,num[i]);
    }
    return 0;
}

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  int ans=0,count=0;
  for(int i=0;i<n;i++){
    if(s[i]=='I'){
      count++;
      ans=max(ans,count);
    }
    else count--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = gets.to_i
nums = []
n.times { nums << gets.to_i }
hash = Hash.new(0)
reverse_hash = Hash.new(0)
nums.each do |num|
  hash[num] = hash[num - 1] + 1
end
nums.reverse.each do |num|
  reverse_hash[num] = reverse_hash[num + 1] + 1
end
useful_count = [hash.values.max, reverse_hash.values.max].max
puts n - useful_count


Measured memory_bytes: 34356
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
typedef long long ll;
//
int main(){
   string s;
   cin>>s;
   map<char,int> p;
   for(auto e:s)p[e]++;
   bool ans=true;
   for(auto e:s){
      if(p[e]%2!=0) ans=false;
   }
   if(ans)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}

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

int n,x;


int main(){
    while(1){
        int count0=0;
        cin>>n>>x;
        if(n==0 && x==0){
            break;
        }

        for(int i=1;i<=n;++i){
            for(int j=i+1;j<=n;++j){
                for(int k=j+1;k<=n;++k){
                    if(i+j+k==x)count0++;
                }
            }
        }
        cout<<count0<<endl;
    }
    

    return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n; cin>>n;
  vector<ll> a(n+1);
  vector<ll> b(n);
  rep(i, n+1) cin>>a.at(i);
  rep(i, n) cin>>b.at(i);
  
  ll cnt=0;
  rep(i, n) {
    if (a.at(i)>=b.at(i)) cnt+=b.at(i);
    else if (a.at(i)<b.at(i)&&b.at(i)<=a.at(i)+a.at(i+1)) {
      cnt+=b.at(i);
      a.at(i+1)-=b.at(i)-a.at(i);
    }
    else if (a.at(i)+a.at(i+1)<b.at(i)) {
      cnt+=a.at(i)+a.at(i+1);
      a.at(i+1)=0;
    }
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<iostream>
#include<vector>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;

int main(){
	string S;
	cin >> S;
	long long int ans=0;
	int a;
	a = 0;
	int i=0;
	while (i < S.size()) {
		
			if (S[i] == 'A') {
				a++;
				i++;

			}
			else if (i+1<S.size()&&S[i] == 'B' && S[i + 1] == 'C') {
				ans = ans + a;
				i = i+2;

			}
			else {
				a = 0;
				i++;
			}
		
	
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

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

int N;
ll a,b;
ll sum,m=INF;

int main(){

  cin >> N;
  rep(i,0,N){
    cin >> a >> b;
    if(a > b){
      m = min(m,b);
    }
    sum += a;
  }
  sum -= m;
  if(m==INF) sum = 0;
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include <algorithm>
using namespace std;
int main()
{
    int N,X,count=0,y=0;
    cin >> N >> X;
    int L[100];
    for(int i =0; i < N; i++)
    {
        cin >> L[i];
    }
    while(y<=X)
    {
        y+=L[count];
        count++;
    }
    cout << count;
}


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

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

typedef long long ll;
using namespace std;

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

  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;

  int ans = 1000;
  ans = min(ans, abs(A2 - A1) + abs(A3 - A2));
  ans = min(ans, abs(A3 - A2) + abs(A1 - A3));
  ans = min(ans, abs(A1 - A3) + abs(A2 - A1));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n,  m = map(int, input().split())
np = [input() for _ in range(n)]
mp = [input() for _ in range(m)]
for i in range(n-m+1):
  for j in range(n-m+1):
    f = True
    for k in range(m):
      if np[i+k][j:j+m] != mp[k]:
        f = False
    if f:
      print("Yes")
      exit(0)
else:
  print("No")


Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
    int N;
    scanf("%d", &N);

    int b[101]={0}, count=0;
    for (int i = 0; i < N; i++) {
        int d;
        scanf("%d", &d);
        b[d]++;
    }

    for (int i = 1; i <= 100; i++) {
        if (b[i] > 0) {
            count++;
        }
    }

    printf("%d\n", count);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int N,M;
int main(){
    cin >> N >> M;
    vector<int> a(N);
    rep(i,M){
        int n,m;cin >> n >> m;
        n--,m--;
        a[n]++;
        a[m]++;
    }
    int ans = 1;
    for(auto &i:a){
        if(i&1) ans = 0;
    }
    cout << (ans?"YES":"NO") << endl;
}

Measured memory_bytes: 640
N = int(input())
C_0 = C_1 = C_2 = C_3 = 0
for i in range(N):
  c = input()
  if c == 'AC':
    C_0 += 1
  elif c == 'WA':
    C_1 += 1
  elif c == 'TLE':
    C_2 += 1
  else:
    C_3 += 1

print('AC x ' + str(C_0))
print('WA x ' + str(C_1))
print('TLE x ' + str(C_2))
print('RE x ' + str(C_3))

Measured memory_bytes: 74760
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int main(){
  int n; cin>>n;
  //string s; cin>>s;
  int c=0;
  rep(i,n){
    int a;
    cin>>a;
    if(a%2==1&&i%2==0){
      c++;
    }
  }
  cout<<c;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << min(A, B) + min(C, D) << endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const ll mod = 1000000007;
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
int t[100000];
int main() {
	int N, v, a;
	scanf("%d", &N);
	rep(i, 0, N)scanf("%d", &v), t[v]++;
	a = N % 2 == 0;
	if (a == 0 && t[0] != 1) {
		puts("0");
		return 0;
	}
	rep(i, 0, N / 2) {
		if (a && t[a + i * 2] != 2) {
			puts("0");
			return 0;
		}
	}
	printf("%lld\n", mpower(2, N / 2));
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()

using namespace std;

typedef long long ll;

int N;
ll S[200005];
ll ans = 1000000000000000000;

int main() {
  scanf("%d", &N);
  rep(i, 1, N+1) {
    int a;
    scanf("%d", &a);
    S[i] = S[i-1] + a;
  }
  
  rep (i, 1, N) {
    ll s = S[i];
    ll t = S[N] - S[i];
    ans = min<ll>(ans, abs(s-t));
  }
  
  printf("%lld", ans);
  return 0;

}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

struct Product {
    Product(string name, double effi) : name_(name), efficiency_(effi) {}

    string name_;
    double efficiency_;
};

int main (int argc, char *argv[]) {
    double N, P, A, B, C, D, E, F, S, M;
    string L;
    vector<Product> pv;

    while (cin>>N, N) {
        for (int i = 0; i < N; ++i) {
            cin>>L>>P>>A>>B>>C>>D>>E>>F>>S>>M;
        
            double total_time = A + B + C + ((D + E) * M);
            double total_value = S * F * M - P;
            double efficiency = total_value / total_time;
            
            pv.push_back(Product(L, efficiency));
        }

        sort(pv.begin(), pv.end(), [](const auto& lhs, const auto& rhs) -> bool {
            if (lhs.efficiency_ != rhs.efficiency_) {
                return lhs.efficiency_ > rhs.efficiency_;
            }
            else {
                return lhs.name_ < rhs.name_;
            }
        });

        for (auto e : pv) {
            cout<<e.name_<<endl;
        }
        cout<<"#"<<endl;
        pv.clear();
    }

    return 0;
}

Measured memory_bytes: 3264
#include<bits/stdc++.h>
#define INF 200000
using namespace std;

bool sosuu[INF];
int main() {
	memset(sosuu, true, sizeof(sosuu));
	sosuu[0] = sosuu[1] = false;
	for (int a = 2; a < INF; a++) {
		if (sosuu[a]) {
			for (int b = a * 2; b < INF; b+=a)sosuu[b] = false;
		}
	}
	int x, y;
	while (cin >> x >> y, (x+1)|(y+1)) {
		int s[20000];
		fill(s, s + (y+1)*(y+1), 1 << 29);
		int sum = 0, l = 0;
		for (int z = x+1; l <= y; z++) {
			if (sosuu[z]) {
				l++;
				int r = l;
				for (int i = z; r <= y; i++) {
					if (sosuu[i]) {
						r++;
						s[sum] = z + i;
						sum++;
					}
				}
			}
		}
		sort(s, s + (y + 1)*(y + 1));
		cout << s[y-1] << endl;
	}
}

Measured memory_bytes: 3332
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end
n = gets.to_i
array = gets.chomp.split("")

# first_W = []
count = 0
# 0.upto(array.length - 1) do |i|
#   if array[i] == "W"
#     first_W.push(i) 
#   else
#     if first_W.length > 0
#       wi = first_W.shift
#       array[wi] = "R"
#       array[i] = "W"
#       first_W.unshift(i)
#       count += 1
#     end
#   end
#   # binding.pry
# end

# puts count

left = 0
right = n - 1

while left <= right do
  if array[right] == "W"
    right -= 1
  elsif array[right] == "R"
    if array[left] == "W"
      array[left] = "R"
      array[right] = "W"
      count += 1
      left += 1
      right -= 1
    elsif array[left] == "R"
      left += 1
    end
  end
end

puts count

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


using std::cerr;
using std::cin;
using std::cout;
using std::pair;
using std::string;
using std::vector;
//region
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (b); i >= (b); --i)
#define rep(i, n) for (unsigned i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n)-1; i >= 0; --i)
#define repr1(i, n) for (int i = (n); i > 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define sz(x) (int((x).size()))
#define mset(v, n) std::memset((v), n, sizeof(v))
#define BIT(N) (1LL << (N))
#define each(i, v) for (auto&& i : (v))
#define unless(f) if(!(f))
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using vint = vector<int>;
using vlong = vector<ll>;
using vstr = vector<string>;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpll = vector<pll>;
using vvi = vector<vint>;
using vvl = vector<vlong>;
vector<string> split(const string &s, const string &delim) {
  vector<string> res;
  uint pos = 0;
  while (true) {
    const size_t found = s.find(delim, pos);
    if (found < 0) {
      res.push_back(s.substr(pos));
      break;
    }
    res.push_back(s.substr(pos, found - pos));
    pos = found + delim.size();
  }
  return res;
}
template<typename T> string join(vector<T> &vec, const string &sep) {
  size_t size = vec.size();
  if (!size) return "";
  std::stringstream ss;
  for (int i = 0; i < size - 1; i++)
    ss << vec[i] << sep;
  ss << vec[size - 1];
  return ss.str();
}
template<typename T> std::istream &operator>>(std::istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template<typename Iter> inline void print(const Iter &first, const Iter &last, const std::string &d, bool endline) {
  cout << *first;
  for (Iter iter = first + 1; iter < last; ++iter) {
    cout << d << *iter;
  }
  if (endline) cout << "\n";
}
constexpr ll powmod(ll a, ull b, uint p) {
  ll res = 1;
  while (b > 0) {
    if (b % 2) res = res * a % p;
    a = a * a % p;
    b >>= 1u;
  }
  return res;
}
template<class T> bool chmax(T &a, const T &b) { return a < b ? (a = b, true) : false; }
template<class T> bool chmin(T &a, const T &b) { return a > b ? (a = b, true) : false; }
template <typename T> void bsort(vector<T>& v) { std::sort(v.begin(), v.end()); }
template <typename T> void rsort(vector<T>& v) { std::sort(v.begin(), v.end(), std::greater<T>()); }
struct iii {
    iii() {
      cin.tie(nullptr); cout.tie(nullptr);
      std::ios::sync_with_stdio(false);
      cout << std::fixed << std::setprecision(16);
    }
} init;
//endregion

void solve();

int main() {
  int t = 1;
  // scanf("%d", &t);
  // cin >> t;
  rep(i, t) solve();
  return 0;
}

void solve() {
  string S, T;
  cin >> S >> T;

  int ans=0;
  rep(i,S.size())ans+=S[i]==T[i];
  printf("%d\n",ans);
  return;
}


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 int;
const long long int INF = 1001001001001001LL;
const int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;


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

    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    vector<int> dp(n, inf);
    dp[0] = 0;
    rep(i, n) {
        rep(j, k) {
            int nj = i-(j+1);
            if(nj >= 0) dp[i] = min( dp[i], dp[nj] + abs(h[i] - h[nj]) );
        }
    }
    
    cout << dp[n-1] << endl;
    
    return 0;
}

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

const int maxn = 200010;
int nxt[26][maxn];
int dp[maxn];

int main() {
    string s;
    cin >> s;
    int n = s.size();
    rep(c, 26) nxt[c][n] = n + 1;
    for (int i = n - 1; i >= 0; --i) {
        rep(c, 26) nxt[c][i] = nxt[c][i + 1];
        nxt[s[i] - 'a'][i] = i;
    }

    for (int i = n - 1; i >= 0; --i) {
        int m = -1;
        rep(c, 26) chmax(m, nxt[c][i]);
        if (m == n + 1) {
            dp[i] = 0;
        } else {
            dp[i] = dp[m + 1] + 1;
        }
    }

    string ans;
    int len = dp[0] + 1;
    int p = 0;

    while (len--) {
        rep(c, 26) {
            if (nxt[c][p] == n + 1 || dp[nxt[c][p] + 1] == len - 1) {
                ans.pb('a' + c);
                p = nxt[c][p] + 1;
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 21636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,M,i,A,B;cin>>N>>M;
  vector<deque<ll>>PASS(N,deque<ll>());
  REP(i,M){
    cin>>A>>B;
    PASS.at(A-1).push_back(B-1);
    PASS.at(B-1).push_back(A-1);
  }
  queue<ll>X;X.push(0);
  vector<bool>seen(N,true);
  vector<ll>ans(N);
  while(X.size()>0){
    A=X.front();X.pop();
    seen.at(A)=false;
    REP(i,PASS.at(A).size())if(seen.at(PASS.at(A).at(i))){
      X.push(PASS.at(A).at(i));
      seen.at(PASS.at(A).at(i))=false;
      ans.at(PASS.at(A).at(i))=A;
    }
  }
  cout<<"Yes"<<endl;
  REP(i,N-1)cout<<ans.at(i+1)+1<<endl;
  return 0;
}

Measured memory_bytes: 72896
#include<stdio.h>
int main(void){
  int i=0,j=0;
  char s[11];
  char t[11];
  scanf("%s",&s);
  while(s[i]!='\0'){
    if(s[i]!='B'){
      t[j]=s[i];
      j++;
    }else{
      if(j<1){
        j=j-j;
      }else{
        j=j-1;
      }
    }
    i++;
  }
  t[j]='\0';
  printf("%s\n",t);
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if((a + b) == c || (a + c) == b || (b + c) == a){
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((abs(a - b) <= d && abs(b - c) <= d) || (abs(a - c) <= d)) {
        cout << "Yes";
        return 0;
    } else {
        cout << "No";
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#define INF 999999
int route[100][100];
int node[11];
int route_num;

int main()
{
	while(1)
	{
		scanf("%d",&route_num);
		if(route_num==0)
			break;

		int min_cost=INF;
		int min_node=0;
		int node_num=0;
		for(int i=0;i<100;i++)
			for(int j=0;j<100;j++)
				route[i][j]=INF;

		for(int i=0;i<route_num;i++)
		{
			int from,to,cost;
			scanf("%d%d%d",&from,&to,&cost);
			route[from][to] = route[to][from] = cost;
			if(node_num < to)
				node_num=to;
			if(node_num < from)
				node_num=from;
		}

		for(int x=0;x<=node_num;x++)
		{
			for(int i=0;i<=node_num;i++)
				node[i]=INF;
			node[x]=0;

			while(1)
			{
				bool flag=false;
				for(int i=0;i<=node_num;i++)
				{
					for(int j=0;j<=node_num;j++)
					{
						if(node[i]!=INF && route[i][j]!=INF && node[j] > node[i]+route[i][j])
						{
							node[j]=node[i]+route[i][j];
							flag=true;
						}
					}
				}
				if(!flag)
					break;
			}
			int temp=0;
			for(int i=0;i<=node_num;i++)
				temp+=node[i];
			if(min_cost > temp)
			{
				min_cost=temp;
				min_node=x;
			}
		}
		printf("%d %d\n",min_node,min_cost);
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long

int main()
{
	int a[101]; int n; cin>>n;
	int s[101],p[101];
	for(int i=0;i<n;i++) cin>>a[i];
	p[0]=a[0];
	for(int i=1;i<n;i++) p[i]=a[i]+p[i-1];
	s[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--) s[i]=a[i]+s[i+1];

	int sum=1000000;

	for(int i=0;i<n-1;i++) sum=min(sum,abs(p[i]-s[i+1]));
	cout<<sum;	
}

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

using namespace std;
typedef long long ll;

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

int main() {

    string S;
    cin >> S;
    ll N = S.length();
    ll out = 0;
    rep(i,N){
        ll tmp = 0;
        if(S[i]=='A'||S[i]=='C'||S[i]=='G'||S[i]=='T'){
            tmp++;
            for(ll j=i+1;j<N;j++){
                if(S[j]=='A'||S[j]=='C'||S[j]=='G'||S[j]=='T') tmp++;
                else break;
            }
            if(tmp>out) out = tmp;
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
import math
N = 1
while True:
    n = int(input())
    if n == 0:
        break
    N = math.factorial(n)
    
    m = 0    
    while True:
        if N % 5 != 0:
            break
        else:
            N = N // 5
            m = m + 1
            
    print(m)


Measured memory_bytes: 5784
#include <bits/stdc++.h>
using namespace std;
const long INF=1000000000000;

//関数
class union_find{
    vector<long> parent, tree_size;
    public:
    union_find(long n) : parent(n), tree_size(n,1){
        for(int i=0;i<n;i++) parent.at(i)=i;
    }
    long find(long x){
        while(parent.at(x)!=x) x=parent.at(x)=parent.at(parent.at(x));
        return x;
    }
    bool marge(long a,long b){
        a=find(a);
        b=find(b);
        if(a==b) return false;
        if(tree_size.at(a)<tree_size.at(b)) swap(a,b);
        tree_size.at(a)+=tree_size.at(b);
        parent.at(b)=a;
        return true;
    }
};



int main() {
    
    
    //入力
    long N,M;
    cin>>N>>M;
    vector<long> a(M),b(M);
    for(int i=0;i<M;i++){
        cin>>a.at(i)>>b.at(i);
        a.at(i)--;
        b.at(i)--;
    }
    
    //計算
    
    long ans=0;
    for(int m=0;m<M;m++){
        union_find uf(N);
        for(int i=0;i<M;i++){
            if(i!=m) uf.marge(a.at(i),b.at(i));
        }
        
        
        for(int i=1;i<N;i++){
            if(uf.find(i)!= uf.find(0)){
                ans++;
                break;
            }
        }
    }
    
    //出力
    cout<<ans<<endl;
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        _: usize,
        mut c: Chars,
    }

    let mut count = 0;
    let mut i = 0; // 左端
    let mut j = c.len() - 1; // それ以上先にRがない右端

    while i < j && i < c.len() - 1{
        // もし左端がWでなければ後ろから順にRを探しに行く
        if c[i] == 'W' {
            while j > i {
                if c[j] == 'R' {
                    c[i] = 'R';
                    c[j] = 'W';
                    count += 1;
                    break;
                }
                j -= 1;
            }
        }
        i += 1;
    }
    println!("{}", count);
}


Measured memory_bytes: 3028
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)//rep(i,回数){処理}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    ll x, k, d; cin >> x >> k >> d;
    ll ans;
    x = abs(x);//原点からーや＋であっても同じ
    //往復せずに終わる場合
    if (x / d > k) {
        ans = x - d * k;
    }
    //往復する場合
    else {
        ll e = x / d;//往復するまでの回数
        k = k - e;//往復できる回数
        x = x - e * d;//今の座標は？
        if (k % 2 == 1) { x = abs(x - d); }
        ans = x;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
n=int(input())
da=list(map(int,input().split()))
chco=0
for i in range(n):
    minj=i
    for j in range(i,n):
        if da[j]<da[minj]:
            minj=j
    if i!=minj:
        x=da[i]
        da[i]=da[minj]
        da[minj]=x
        chco+=1
for i in range(n):
    if i==n-1:
        print(da[i])
    else:
        print(da[i],end=' ')
print(chco)


Measured memory_bytes: 5600
# coding: utf-8
A,B=map(int, input().split())
ans=[]
if A>B:
    ans.append(A)
    A-=1
else:
    ans.append(B)
    B-=1

if A>B:
    ans.append(A)
else:
    ans.append(B)
    
print(sum(ans))

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;

const int N=1e6+20;

int n,x,lp[N],g;
bool vis[N],ok=true;

int main()
{
	for(int i=2;i<N;i++)
		if(lp[i]==0)
			for(int j=i;j<N;j+=i)
				if(lp[j]==0) lp[j]=i;

	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&x);
		g=__gcd(g,x);

		set <int> s;
		while(x>1) s.insert(lp[x]),x/=lp[x];

		for(auto i:s)
		{
			if(vis[i]) ok=false;
			vis[i]=true;
		}
	}

	if(ok) printf("pairwise coprime");
	else puts(g==1?"setwise coprime":"not coprime");
}

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

int a;
char s[11];

int main(){
  scanf("%d", &a);
  scanf("%s", s);
  
  if(a>=3200){
    printf("%s", s);
  } else {
    printf("red");
  }
 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    string s;
    int c = 0;
    cin >> s;
    rep(i, 3){
      if(s[i] == '1'){
        c += 1;
      }
    }
    printf("%d\n", c);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
 
#define sec second
#define fir first
#define mo  998244353
#define inf 1e18
#define rep(i, s, n) for (ll i = s; i < n; i = i + 1)
#define rrep(i,s,n) for(ll i=s;i>=n;i--)								
 
ll mod(ll n) { return (n % (ll)mo + (ll)mo)%(ll)mo;}
ll gcd(ll a,ll b) {if (b == 0) return a;return gcd(b, a % b);}

int main(){
	string s;cin>>s;
	ll n = s.length();
	vector <ll> cnt(2019,0);
	cnt[0]=1;
	ll ans=0;
	ll t=1;
	ll num=0;
	rrep(i,n-1,0){
		num = (num + t*(s[i] - '0'))%2019;
		t = (t*10)%2019;
		ans += cnt[num]++;
		
	}
	cout<<ans<<endl;
}


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

#define FOR(i, a, n) for(int i = a; i < n; ++i)
#define logarr(arr) for(auto i : arr) { cout << i << " "; } cout << "\n";
#define ll long long
#define sc(a) scanf("%d", &a);
#define scl(a) scanf("%lld", &a);


void solve() {
 
    ll n; scl(n);
    string alpha = "abcdefghijklmnopqrstuvwxyz";
    string ans = "";

    while (n > 0) {
        n--;    
        ans += alpha[n%26];
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << "\n";

}


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

	int t = 1;
	// sc(t);
	while(t--) {
		solve();
	}

	return 0;

}
// g++ -std=c++17 -o solve solve.cpp


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

using namespace std;

int main()
{
    int n,k,i;
    double x;
    cin>>n>>k;
    vector<double> arr;
    for(int i=0;i<n;i++) {
        cin>>x;
        arr.push_back((x+1.0)/2.0);
    }
    double sum=0;
    vector<double> sumarr(n,0);
    for(int i=0;i<n;i++) {
        sum+=arr[i];
        sumarr[i] = sum;
    }
    double ans = 0;
    for(int i=k-1;i<n;i++) {
        ans = max(ans,sumarr[i]-sumarr[i-k]);
    }
    cout<<setprecision(25)<<ans;
   return 0;
}

Measured memory_bytes: 3440
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    if (x>=30)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3608
k=int(input())
A=[0]*k
f=0
for i in range(k):
  if i==0:
    A[i]=7%k
  else:
    A[i]=(10*A[i-1]+7)%k
  
  if A[i]==0:
    f=1
    print(i+1)
    exit()
if not f:
  print(-1)

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n,q;
  cin >> n >> q;
  string s;
  cin >> s;
  vl rui(n);
  REP(i,n){
    if(i==0){
      rui[i] = 0;
      continue;
    }
    rui[i] = rui[i-1];
    if(s[i]=='C'&&s[i-1]=='A') rui[i]++;
  }
  REP(i,q){
    ll l,r;
    cin >> l >> r;
    l--;
    r--;
    if(l==0){
      cout << rui[r] << endl;
      continue;
    }
    cout << rui[r]-rui[l] << endl;
  }
  return 0;
}


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

f=0
if S[0]=="A":
    f+=1
    
if S.count("C")==1:
    f+=10
    
if S.count("A")==1:
    f+=100
    
for i in range(N):
    if S[i]=="C":
        if i>=2 and i<=N-2:
            f+=1000
            break

Uc=0        
for i in range(N):
    if S[i]==S[i].upper():
        Uc+=1
        
if Uc==2:
    f+=10000
    
if f==11111:
    print("AC")
else:
    print("WA")
    
        
  

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int a[N];
int main(){
	int n;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	sort(a,a+n);
	for(int i=0;i<n;i++)if(a[i]==a[i+1])return puts("NO"),0;
	puts("YES");
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << "(" << p.first << " " << p.second << ")"; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template< typename T, typename V > typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) { t = v; }
template< typename T, typename V > typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

string LCS_recon(string s, string t) {
  int n = s.size(), m = t.size();
  vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i] == t[j]) {
        dp[i + 1][j + 1] = dp[i][j] + 1;
      } else {
        dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
      }
    }
  }
  string r;
  int i = n, j = m;
  while (i && j) {
    if (dp[i][j] == dp[i - 1][j]) i--;
    else if (dp[i][j] == dp[i][j - 1]) j--;
    else r = s[i - 1] + r, i--, j--;
  }
  return r;
}

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  string s,t;
  cin >> s >> t;
  cout << LCS_recon(s,t) << endl;

  return 0;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,d,n,cnt;
  bool b;
  while(1){
    cin>>a>>d>>n;
    if(a==0 && d==0 && n==0) break;
    cnt=0;
    while(cnt!=n){
      b=true;
      if(a<2 || a%2==0) b=false;
      if(a==2) b=true;
      for(int i=3;i<=sqrt(a);i++){
	if(a%i==0){
	  b=false;
	  break;
	}
      }
      if(b) cnt++;
      a+=d;
    }
    cout<<a-d<<endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int main()
{
   int A,B,C;
   cin >> A >> B >> C;
   int k,i,j,l;
   cin >>k;
   if (B<=A){
       for(i=1;i<=k;i++){
           B = B*2;
           if (B>A){
               j = i;
               break;
           }
       }
   }
   if (C<=B){
       for(l=j+1;l<=k;l++){
           C = C*2;
           if(C>B){
               break;
           }
       }
   }
   if (B>A && C>B) cout << "Yes";
   else cout << "No";
   return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<string>s(n);
  for(int i=0; i<n; i++){
    string si;
    cin >> si;
    sort(si.begin(), si.end());
    s[i]=si;
  }
  sort(s.begin(), s.end());
  long cnt=1, ret=0;
  for(int i=1; i<n; i++){
    if(s[i-1]==s[i])cnt++;
    else {
      ret += cnt*(cnt-1)/2;
      cnt=1;
    }
  }
  ret += cnt*(cnt-1)/2;
  cout << ret;
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    string S;
    string T = "";
    cin >> S;
    
    reverse(S.begin(), S.end());
    string box[4] = {"dream", "dreamer", "erase", "eraser"};
    for (int i=0; i<4; i++) reverse(box[i].begin(), box[i].end());
    bool can = true;
    
    for(int i=0; i<S.size();){
        bool flag = false;
        int index = 0;
        for(int j=0;j<4;j++){
            string d = box[j];
            if(S.substr(i, d.size())==box[j]){
                index = d.size();
                flag = true;
                i += d.size();
                break;
            }
        }
        if(!flag){
            can = false;
            break;
        }
    }
    
    if (can)cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 512
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <vector>
#define ll long long
#define INF 1000000001;
using namespace std;
struct Edge{int from, to, cost;};

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

    int ans = 0;
    REP(i,n){
        int l,r;
        cin >> l >> r;
        ans += (r-l+1);
    }
    

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


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

int MAX_N=262144;
vector<int64_t> seg(MAX_N*2-1,1);
int64_t qu(int a,int b,int k,int l, int r){
  if(r<=a||b<=l){
    return 0;
  }
  else if(a<=l&&r<=b){
    return seg[k];
  }
  else{
    int64_t X=qu(a,b,k*2+1,l,(l+r)/2);
    int64_t Y=qu(a,b,k*2+2,(l+r)/2,r);
    if(X==0){
      return Y;
    }
    else if(Y==0){
      return X;
    }
    else{
      return gcd(X,Y);
    }
  }
}

int main() {
  int N;
  cin>>N;
  int64_t Z=1;
  for(int i=0;i<N;i++){
    cin>>seg[MAX_N-1+i];
  }
  for(int i=MAX_N-2;i>=0;i--){
    seg[i]=gcd(seg[i*2+1],seg[i*2+2]);
  }
  for(int i=0;i<N;i++){
    int64_t A,B;
    A=qu(0,i,0,0,MAX_N);
    B=qu(i+1,N,0,0,MAX_N);
    if(i==0){
      A=B;
    }
    else if(i!=N-1){
      A=gcd(A,B);
    }
    Z=max(Z,A);
  }
  cout<<Z<<endl;
  
}

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

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

    int c[n], s[n], f[n];
    c[n-1] = s[n-1] = f[n-1] = 0;
    for(int i = 0; i < n-1; i++)  cin >> c[i] >> s[i] >> f[i];

    for(int i = 0; i < n-1; i++){
        int ans = 0;
        for(int j = i; j < n-1; j++){
            if(ans <= s[j])  ans = s[j];
            else            ans = (ans-s[j]+f[j]-1)/f[j]*f[j] + s[j];
            ans += c[j];
        }
        cout << ans << endl;
    }

    cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
n,m = map(int, (input().split()))
h = list(map(int, input().split()))
root = [[] for i in range(n)]
count = 0
for i in range(m):
  a,b = map(int, input().split())
  root[a-1].append(h[b-1])
  root[b-1].append(h[a-1])
for i in range(n):
  if root[i] == []:
    count += 1
  elif h[i] > max(root[i]):
    count += 1
print(count)

Measured memory_bytes: 23000
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			String alpha = sc.next();
			
			int next = (int)alpha.charAt(0) + 1;
			
			char c = (char)next;
			
			System.out.println(String.valueOf(c));
		}
	}
}

Measured memory_bytes: 22996