akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int N;
vector<vector<int>> F;
vector<vector<ll>> P;

void input() {
  cin >>N;
  F.assign(N, vector<int>(10, 0));
  rep(i, N) rep(j, 10) cin >>F[i][j];
  P.assign(N, vector<ll>(11, 0));
  rep(i, N) rep(j, 11) cin >>P[i][j];
}

int main() {
  input();
  ll res = -10000000000000000;
  for (int S=1; S<(1<<10); S++){
    // joisino店が開いている時間帯の集合
    ll resS = 0;
    for (int i=0; i<N; i++){
      // 各々の店について両方が営業している時間帯の個数をカウント
      int cnt = 0;
      for (int d=0; d<10; d++) if ((S & (1<<d)) && F[i][d]) cnt++;
      resS += P[i][cnt];
    }
    chmax(res, resS);
  }

  cout <<res <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <numeric> //lcm


#define ERROR() cout << "ERROR!!" << endl; return 0;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1000000000; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

inline bool maxch(int &a, int b) { if (a < b) {a = b; return true;} else return false;}


int main() {
  int a[3][3];
	bool bb[3][3];
	rep(i,3) rep(j,3) { cin >> a[i][j]; bb[i][j] = false;} 

	int n;
	cin >> n;

	rep(i, n) {
	  int b;
		cin >> b;
		rep(j, 3) rep(k, 3) {
			if (a[j][k] == b) bb[j][k] = true;
		}
	}
	 bool ans = false;
	rep(i, 3) {
		ans = ans || bb[i][0] && bb[i][1] && bb[i][2];
		ans = ans || bb[0][i] && bb[1][i] && bb[2][i];
	}

	ans = ans || bb[0][0] && bb[1][1] && bb[2][2];
	ans = ans || bb[0][2] && bb[1][1] && bb[2][0];

	string str;
	if (ans) str = "Yes";
	else str = "No";

	cout << str << endl;

}




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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  string S;
  cin >> S;
  vector< pair< char, int > > st;
  for(auto &p : S) {
    if(st.empty() || st.back().first != p) {
      st.emplace_back(p, 0);
    }
    st.back().second++;
  }
  int64 ret = 0;
  for(int i = 0; i < st.size(); i++) {
    if((i == 0 || st[i - 1].first == '<') && st[i].first == '>') {
      ret += max(st[i].second, i == 0 ? 0 : st[i - 1].second);
    }
  }
  if(st.back().first == '<') {
    ret += st.back().second;
  }
  for(auto &p : st) {
    while(p.second--) ret += p.second;
  }
  cout << ret << endl;
}






Measured memory_bytes: 3352
n = int(input())
ans = 0
a = 0
b = 0
ba = 0
for i in range(n):
    aaa = input()
    ans += aaa.count('AB')
    if aaa[0]=='B' and aaa[-1]=='A':
        ba += 1
    elif aaa[0]=='B':
        b += 1
    elif aaa[-1]=='A':
        a += 1
if ba != 0:
    if a>=1 and b>=1:
        ans += (ba+1+min(a-1,b-1))
    elif a==0 and b==0:
        ans += (ba-1)
    else:
        ans += ba
if ba == 0:
    ans += min(a,b)
    
print(ans)        

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void){
    int h,w;
    scanf("%d %d",&h,&w);
    char s[h][w+1];
    int i,j;
    for(i=0;i<h;i++){
        scanf("%s",s[i]);
    }
    int r_c[h],l_c[w];
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if(s[i][j] == '#'){
                r_c[i] = 1;
                break;

            }
            else if(j==w-1){//ここでindex iの行を取り除く
                r_c[i] = -1;
            }
        }
    }
    for(j=0;j<w;j++){
        for(i=0;i<h;i++){
            if(s[i][j] == '#'){
                l_c[j] = 1;
                break;
            }
            else if(i == h-1){
                l_c[j] = -1;
            }
        }
    }
    for(i=0;i<h;i++){
        if(r_c[i] == -1){
            continue;
        }
        for(j=0;j<w;j++){
            if(l_c[j] == -1){
                continue;
            }
            printf("%c",s[i][j]);
        }
        printf("\n");
    }

    return 0;
}

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

using namespace std;

using ll = long long;

const long long MOD = 1e9 + 7;
const int INF = 1e9 + 7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    vector<int> cnt(N, 0);
    int parity = N % 2;
    ll ans = 1;
    for (int i = 0; i < N; ++i) {
        if (A[i] % 2 == parity) {
            ans = 0;
            break;
        }
        ++cnt[A[i]];
        if (cnt[A[i]] > 2) ans = 0;
        if (cnt[0] > 1) ans = 0;
    }
    int n = N / 2;
    for (int i = 0; i < n; ++i) ans *= 2, ans %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 5010

/* Binary Indexed Tree(0-index) */

template <typename Type = int>
struct BIT{
  int bit_size;
  vector<Type> data;

  void init(int n){
    bit_size = n;
    data.assign(n+2, 0);
  }

  //add x to kth value
  void add(int k, Type x){
    k++;
    while(k <= bit_size){
      data[k] += x;
      if (data[k] >= mod) data[k] -= mod;
      k += k & (-k);
    }
  }

  //sum of [0,k)
  Type query(int k){
    ll rec = 0;
    while(k > 0){
      rec += data[k];
      k -= k & (-k);
    }
    return rec % mod;
  }

  //sum of [a, b)
  Type query(int a, int b){
    return query(b) - query(a);
  }
};

int s[SIZE];
BIT<int> bit[SIZE];
vector<pair<int,int>> history[SIZE];

int main(){
  int N, M;

  cin >> N >> M;

  s[0] = 0;
  for (int i=0; i<N; i++)
    cin >> s[i+1];


  for (int i=0; i<=N; i++) {
    bit[i].init(N+1);
  }

  bit[0].add(0, 1);
  history[0].push_back({0, 1});

  for (int i=0; i<N; i++) {
    vector<pair<int,int>> vec;

    for (int j=0; j<=i; j++) {
      int x = bit[j].query(s[i+1]);
      vec.push_back({i-j, x});

      if (s[i] > s[i+1]) {
        for (auto p : history[j]) {
          bit[j].add(p.first, mod-p.second);
        }
        history[j].clear();
      }
    }

    for (auto p : vec) {
      bit[p.first].add(s[i], p.second);
      history[p.first].push_back({s[i], p.second});
    }
  }

  ll ans = 0;
  for (int i=N-M; i<=M; i++) {
    ans += bit[i].query(N+1);
  }

  cout << ans % mod << endl;

  return 0;
}



Measured memory_bytes: 222860
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			System.out.println(lcm(a, b));
		}
	}

	private static long lcm(long m, long n) {
	    return m * n / gcd(m, n);
	}

	private static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
using lint  = long long;

signed main(){
  lint N, H; cin >> N >> H;
  vector<lint> a(N), b(N);
  for(lint i = 0; i < N; i++) cin >> a[i] >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  lint k = a[N - 1];
  lint id = lower_bound(b.begin(), b.end(), k) - b.begin();
  lint ans = 0, sum = 0;
  for(lint i = N - 1; i >= id; i--){
    if(sum >= H){
      cout << ans << endl;
      return 0;
    }
    sum += b[i]; ans++;
  } 
  ans += ceil(double(H - sum) / double(k));
  cout << ans << endl;
}

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

const int K = 15000;

int a[90][90];
int b[90][90];
int f[85][85][30010];

int main() {
    int h, w;
    scanf("%d%d", &h, &w);
    for(int i=1; i<=h; i++)
        for(int j=1; j<=w; j++)
            scanf("%d", &a[i][j]);
    for(int i=1; i<=h; i++)
        for(int j=1; j<=w; j++)
            scanf("%d", &b[i][j]);
    f[0][1][K] = 1;
    for(int i=1; i<=h; i++) {
        for(int j=1; j<=w; j++) {
            for(int k=0; k<=2*K; k++) {
                int val = k+a[i][j]-b[i][j];
                if(val>=0 && val<=2*K) {
                    f[i][j][k] |= f[i-1][j][val];
                    if(j>1)
                        f[i][j][k] |= f[i][j-1][val];
                }
                val = k-a[i][j]+b[i][j];
                if(val>=0 && val<=2*K) {
                    f[i][j][k] |= f[i-1][j][val];
                    if(j>1)
                        f[i][j][k] |= f[i][j-1][val];
                }
            }
        }
    }
    int ans = 1e9;
    for(int k=0; k<=2*K; k++) {
        if(f[h][w][k])
            ans = min(ans, abs(k-K));
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 798976
#include <bits/stdc++.h>
using namespace std;
const long long INF=1LL<<60;
const long long mod=998244353;
const int MAXN=1000005;
long long n,m,k;
long long fac[MAXN],invfac[MAXN],inv[MAXN];
long long quickpow(long long x,long long y)
{
    long long ans=1;
    while(y)
    {
        if(y&1)
        {
            ans=(x*ans)%mod;
        }
        x=(x*x)%mod;
        y>>=1;
    }
    return ans;
}
void init(int n)
{
    invfac[0]=1;
    fac[0]=1;
    inv[1]=1;
    for(int i=2;i<=n;++i) inv[i]=((mod-mod/i)*inv[mod%i])%mod;
    for(int i=1;i<=n;++i) fac[i]=fac[i-1]*i%mod,invfac[i]=invfac[i-1]*inv[i]%mod;
}
long long C(int n,int m)
{
    return fac[n]*invfac[m]%mod*invfac[n-m]%mod;
}
int main()
{
    init(400000);
    scanf("%lld %lld %lld",&n,&m,&k);
    long long ans=0;
    for(int i=0;i<=k;++i)
    {
        ans+=C(n-1,i)*m%mod*quickpow(m-1,n-i-1);
        ans%=mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 13220
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


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

  int n,m;
  cin>>n>>m;
  vi a(m);
  int c[1100]={};

  rep(i,m){
    int b;
    cin>>a[i]>>b;
    int s=0;
    rep(i,b){
      int d;
      cin>>d;
      d--;
      s+=(1<<d);
    }
    c[i]=s;
  }

  int dp[(1<<15)];
  rep(i,(1<<15)){
    dp[i]=INF;
  }
  dp[0]=0;


  rep(i,(1<<n)){
    if(dp[i]==INF) continue;
    rep(j,m){
      dp[i|c[j]]=min(dp[i|c[j]],dp[i]+a[j]);
      //cout<<i<<' '<<j<<' '<<(i|c[j])<<' '<<c[j]<<endl;
    }
  }

  rep(i,1<<n){
    //cout<<dp[i]<<endl;
  }

  cout<<(dp[(1<<n)-1]==INF?-1:dp[(1<<n)-1])<<endl;

}

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

#define ll long long
#define met(a, x) memset(a,x,sizeof(a))
#define inf 0x3f3f3f3f
#define ull unsigned long long
#define mp make_pair

using namespace std;
const int mod = 998244353;
const int N = 3e5 + 10;
const int M = 1e6 + 10;
ll a[N];

bool cmp(ll x, ll y) {
    return x > y;
}

ll C[300][300];

void init() {
    met(C, 0);
    C[0][0] = 1;
    for (int i = 1; i <= 50; i++) {
        C[i][0] = 1;
        for (int j = 1; j <= i; j++)
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    init();
    int n, l, r;
    while (cin >> n >> l >> r) {
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        sort(a + 1, a + 1 + n, cmp);
        double ans=0;
        for(int i=1;i<=l;i++){
            ans+=a[i]*1.0;
        }
        ans/=l;
        int num=0,cnt=0;
        for(int i=1;i<=n;i++){
            if(a[i]==a[l]){
                num++;
                if(i<=l){
                    cnt++;
                }
            }
        }
        ll sum=0;
        if(cnt==l){
            for(int i=l;i<=r;i++){
                sum+=C[num][i];
            }
        }else{
            sum+=C[num][cnt];
        }
        cout<<fixed<<setprecision(10)<<ans<<endl<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<int>> vvi;
const int MOD = 1e9 + 7;
const int INF = 2e9;
#define pb push_back
#define mp make_pair
#define mt make_tuple
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
    int n;
    cin >> n;
    int ans = 0;
    vector<int> p(n);
    for (int i = 0; i < n; i++){
        cin >> p[i];
    }
    for (int i = 1; i < n - 1; i++){
        if(p[i-1] < p[i] && p[i] < p[i+1]){
            ans++;
        }
        else if(p[i+1] < p[i] && p[i] < p[i-1]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]) {
    val sc = new java.util.Scanner(System.in)
    val a, b = sc.nextInt
    val d:Int = a / b
    val r:Int = a % b
    val f:Double = a.toDouble / b
    println("%d %d %f".format(d, r, f))

  }
}

Measured memory_bytes: 45260
using namespace std;
#include<bits/stdc++.h>
#define st first
#define nd second
#define FORE(i,a,b) for(int i=(a),b_=(b);i<=b_;++i)
#define FORD(i,a,b) for(int i=(a),b_=(b);i>=b_;--i)
#define TR(c, it) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++)

const int MOD = 1e9 + 7 ;
const int MAXN = 1e5 + 5 ;
const int N = 1e5 + 1 ;
int n , m ;
long long fact[MAXN] ;
int main()
{
#define TASK "NAME"
    // freopen(TASK".inp","r",stdin);
    // freopen(TASK".out","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    fact[0] = 1 ;
    for(int i = 1 ; i <= N ; ++i) fact[i] = (fact[i - 1] * i) % MOD ;
    cin >> n >> m ;
    if (m > n + 1 || n > m + 1) cout << 0 << endl ;
    else {
        if (m == n + 1 || n == m + 1) cout << ( fact[n] * fact[m] ) % MOD << endl ;
        else if (m == n) {
            cout << (2 * fact[n] * fact[m]) % MOD << endl ;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
//#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,n,f=0,mini=INF;
    ll sum=0,maxi=0;
    string str,sub;
    ll h,w;
    ll m,k,d;
    ll x;
    cin>>n;
    vector<ll> v(n);
    rep(i,n)cin>>v[i];
    cin>>a;
    vector<ll> r(a);
    rep(i,a)cin>>r[i];
    sort(v.begin(),v.end());
    sort(r.begin(),r.end());
    ll ptr=0;
    rep(i,a){
        //cout<<v[ptr]<<" "<<r[i]<<" "<<endl;
        
        if(v[ptr]==r[i]) {
            ptr++;
            //continue;
        }else if(v[ptr]>r[i]){
            cout<<"NO"<<endl;
            return 0;
        }else{
            ptr++;
            i--;
        }
        if(ptr==n+1){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 3328
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Q = sc.nextInt();
        String S = sc.next();

        int[] l = new int[Q];
        int[] r = new int[Q];
        for (int i = 0; i < Q; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }

        // 累積和
        int[] cum = new int[N + 1];
        for (int i = 1; i < N; i++) {
            if (isAC(S, i - 1)) {
                cum[i] = 1;
            }
        }

        for (int i = 1; i <= N; i++) {
            cum[i] += cum[i - 1];
        }

        for (int i = 0; i < Q; i++) {
            int ans = cum[r[i]] - cum[l[i] - 1];
            if(r[i] != N && isAC(S, r[i] - 1)){
                ans--;
            }
            out.println(ans);
        }
    }

    public static boolean isAC(String s, int index) {
        if(s.charAt(index) == 'A' && s.charAt(index + 1) == 'C'){
            return true;
        }
        return false;
    }
}

Measured memory_bytes: 83272
import java.util.*

fun main(args:Array<String>){
    val (n,k,q) = readLine()!!.split(" ").map{it.toInt()}
    var a = Array<Int>(n){0}
    for(i in 1 .. q){
        val b = readLine()!!.toInt()
        a[b - 1]++
    }
    var ans = Array<Boolean>(n){false}
    for(i in 0 until n){
        if(q - a[i] < k) ans[i] = true
    }
    ans.forEach{
        println(if(it) "Yes" else "No")
    }
}

Measured memory_bytes: 45788
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        var A = Reader.String().Select(c => c - 'a').ToArray();
        for (int c = 0; c < 26; c++)
        {
            var x = new List<int>();
            for (int i = 0; i < A.Length; i++)
                if (A[i] == c)
                    x.Add(i + 1);
            for (int i = 0; i + 1 < x.Count; i++)
                if (x[i + 1] - x[i] <= 2)
                {
                    Console.WriteLine(x[i] + " " + x[i + 1]);
                    return;
                }
        }
        Console.WriteLine("-1 -1");
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    public static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string[] Split(string s) { return s.Split(separator, op); }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 6744
#include <iostream>

using namespace std;

int n, a[100100], b[100100], c[100100];

int main()
{
    cin >> n;
    cin >> a[1] >> b[1] >> c[1];
    for(int i=2; i<=n; i++)
    {
        int x, y, z;
        cin >> x >> y >> z;
        a[i] = x + max(b[i-1], c[i-1]);
        b[i] = y + max(a[i-1], c[i-1]);
        c[i] = z + max(a[i-1], b[i-1]);
    }
    cout << max(a[n], max(b[n], c[n])) << '\n';
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main (){
    int a ,b ;
    char op;
    cin >> a >> op >> b;
    while (op != '?') {
        if(op == '+') {
            cout<< a + b << endl;
        }else if (op== '-') {
            cout<< a - b << endl;
        }else if (op== '*') {
            cout<< a * b << endl;
        }else if (op== '/') {
            cout<< a / b << endl;
        }
        cin >> a >> op >> b;
    }
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
    int a, b, t;
    cin >> a >> b >> t;

    cout << t / a * b << '\n';

    return 0;
}


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

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

if x<y :
    if ( 0<=x  or  y<=0):
        print(abs(y-x))
    else:
        print(abs(abs(y)-abs(x))+1)

    exit()


if y<x and 0<=y:
    if y==0:
        print(abs(y-x)+1)
    else:
        print(abs(y-x)+2)
    exit()

if y<x and x<=0:
    if x==0:
        print(abs(y-x)+1)
    else:
        print(abs(y-x)+2)
    exit()


print(abs(abs(y)-abs(x))+1)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
p=list(map(int,input().split()))
for i in range(n):
    a=p[i]
    p[i]=a*(a+1)//2/a
#print(p)
s=sum(p[:k])
ans=s
for i in range(n-k):
    s=s+p[k+i]-p[i]
    ans=max(ans,s)
print(ans)


Measured memory_bytes: 67824
#include<cstdio>
#include<cstdlib>
#include<cstring> //atoi

struct Node
{
    int key;
    Node *next, *prev;
};

Node *nil;

void init(){
    //Node????????????????????¢??????????¢????
    nil = (Node *)malloc(sizeof(Node));
    //??¢???????????????: ?????????????????°????????????????????¢?????????
    nil->next = nil;
    nil->prev = nil;
}

void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node* listSearch(int key){
    Node *cur = nil->next;
    while(cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t){
    if(t==nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    deleteNode(listSearch(key));
}

void printList(){
    Node *cur = nil->next;
    int isf = 0;
    while(1){
        if(cur==nil) break;
        if(isf++ > 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}
int main(){
    int key,n,i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (int i = 0; i < n; ++i)
    {
        scanf("%s%d", com, &key);
        if(com[0] == 'i'){insert(key); np++; size++;}
        else if(com[0] == 'd'){
            if(strlen(com)>6){
                if(com[6]=='F') deleteFirst();
                else if(com[6]=='L') deleteLast();
            }
            else{
                deleteKey(key); nd++;
            }
            size--;
        }
    }

    printList();

    return 0;
}

Measured memory_bytes: 32216
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	int N,M; cin>>N>>M;
	vector<int> X(N),Y(N),Z(N);
	for(int i=0;i<N;i++)cin>>X[i]>>Y[i]>>Z[i];
	int ans=0;
	for(int bit=0;bit<8;bit++){
		vector<int> tmp(N);
		for(int i=0;i<N;i++){
			if(bit & (1<<0))tmp[i]+=X[i];
			else tmp[i]-=X[i];
			if(bit & (1<<1))tmp[i]+=Y[i];
			else tmp[i]-=Y[i];
			if(bit & (1<<2))tmp[i]+=Z[i];
			else tmp[i]-=Z[i];
		}
		sort(tmp.begin(),tmp.end());
		reverse(tmp.begin(),tmp.end());
		int a=0;
		for(int i=0;i<M;i++)a+=tmp[i];
		a=abs(a);
		ans=max(a,ans);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

bool IsPrime[100020];
int dp[100020];

int main(){
  int q;
  cin >> q;
  int l[q],r[q];
  rep(i,q)cin >> l[i] >> r[i];
  for(int i=2;i<100002;i++)IsPrime[i]=true;
  for(int i=2;i*i<=100002;i++){
   if(IsPrime[i]){
    for(int j=2*i;j<=100002;j+=i){
     IsPrime[j]=false; 
    }
   }
  }
  for(int i=3;i<100020;i++){
    dp[i]=dp[i-1];
   if(i%2==1 && IsPrime[i] && IsPrime[(i+1)/2])dp[i]++; 
  }
  for(int i=0;i<q;i++){
   cout << dp[r[i]]-dp[l[i]-1] << endl; 
  }
return 0;}

Measured memory_bytes: 1920
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

vector<bool> visited(100010);
vector<vector<int>> tree(100010);
vector<vector<int>> G(100010);
vector<int> outdeg(100010);
vector<P> ansedge;

set<P> edge;

void make_tree(int cv){
    visited[cv] = true;

    for(auto nv : G[cv]){
        if(!visited[nv]){
            edge.erase(minmax(cv,nv));
            tree[cv].emplace_back(nv);
            tree[nv].emplace_back(cv);
            make_tree(nv);
        }
    }

    return ;
}

void dfs(int cv, int par){

    for(auto nv : tree[cv]){
        if(nv == par) continue;

        dfs(nv, cv);
    }

    if(cv == 0) return ;

    if(outdeg[cv] % 2){
        ansedge.emplace_back(cv, par);
        outdeg[cv]++;
    }
    else{
        ansedge.emplace_back(par, cv);
        outdeg[par]++;
    }

    return ;
}

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

    int n, m; cin>>n>>m;
    for(int i=0; i<m; i++){
        int a, b; cin>>a>>b;
        a--, b--;
        edge.emplace(minmax(a, b));
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    if(m % 2){
        cout << -1 << endl;
        return 0;
    }

    make_tree(0);

    for(auto i : edge){
        outdeg[i.first]++;
        ansedge.emplace_back(i);
    }

    dfs(0, -1);

    for(auto i : ansedge){
        cout << i.first + 1 << " " << i.second + 1 << endl;
    }
}

Measured memory_bytes: 26228
import sys
import datetime

def main():
    for line in sys.stdin:
        line = line.rstrip()
        lst = line.split('/')
        year = int(lst[0])
        month = int(lst[1])
        day = int(lst[2])

        d = datetime.date(year, month, day)
        if (d <= datetime.date(2019, 4, 30)):
            print('Heisei')
        else:
            print('TBD')

    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 3440
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,k;
	cin>>h>>w>>k;
	char c[314][314];
	for(int y=0;y<h;y++)for(int x=0;x<w;x++)cin>>c[y][x];
	int nb=0;
	int in=1;
	string ans("");
	string preans("");
	for(int y=0;y<h;y++)
	{
		ans="";
		int f=(c[y][0]=='#');
		ans+=to_string(in);
		for(int x=1;x<w;x++)
		{
			if(c[y][x]=='#'&&f==0)f=1;
			else if(c[y][x]=='#')in++,f=1;
			ans+=" ";
			ans+=to_string(in);
		}
		if(f==0)
		{
			nb++;
		}
		else
		{
			for(int i=0;i<=nb;i++)cout<<ans<<endl;
			in++;
			nb=0;
			preans=ans;
		}
	}
	if(nb>0)for(int i=0;i<nb;i++)cout<<preans<<endl;
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[105];
	cin >> s;
	int i = 0;
	while(s[i] != 'C')i ++;
	if(i >= strlen(s))
	cout << "No";
	else
	{
		i++;
		while(s[i] != 'F')i++;
		if(i >= strlen(s))
		cout << "No";
		else cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    string s;
    cin >> s;
    vi cnt(3,0);
    rep(i,s.size()){
        cnt[s[i] - 'a']++;
    }
    bool ok = abs((max({cnt[0],cnt[1],cnt[2]}) - min({cnt[0],cnt[1],cnt[2]}))) <= 1;
    cout << (ok? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <deque>
using namespace std;

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

int main(){
  bool access[100000+1];
  int n;
  int edge[100000+1];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>edge[i];
  }
  int p=1;
  bool flg=true;
  int ans=0;
  while(p!=2){
    if(access[p]){
      flg=false;
      break;
    }
    access[p]=true;
    p=edge[p];
    ans++;
  }
  cout<<(flg?ans:-1)<<endl;
  return 0;
}


Measured memory_bytes: 768
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!(p: [i32; 3]);
    let m: i32 = p.iter().cloned().max().unwrap();
    puts!("{}\n", p.iter().sum::<i32>() - m);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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


int main(void) {
	string S;
	cin >> S;

	unsigned int len = S.length();
	unsigned int bitmax = (unsigned int)pow(2, len-1);
	long long ans = 0;
	for (unsigned int i = 0; i <= (bitmax-1); i++) {
		bool plus_pos[10] = {false};
		for (int j = 0; j < 9; j++) {
			if (((i>>j)&1)==1) { plus_pos[j+1] = true; }
			else               { plus_pos[j+1] = false; }
		}

		long long val = 0;
		for (unsigned int str_pos = 0; str_pos < S.length(); str_pos++) {
			if (plus_pos[str_pos]) {
				ans += val;
				val = 0;
			}
			val = val * 10 + (int)((unsigned char)S[str_pos] - (unsigned char)'0');
		}
		ans += val;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin>>vec.at(i);
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    int x=vec.at(0)/2;
    for(int i=1;i<N;i++){
        x+=vec.at(i);
    }
    cout<<x<<endl;
}

Measured memory_bytes: 3604
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N, i = li_input()
    print(N - i + 1)


main()


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

int main(void)
{
    int i, j;
    int n;
    int list[5000];
    int bucket[5000];
    char exist[10001];
    int num;
    int temp;
    
    while (scanf("%d", &n) && n){
        num = 0;
        memset(exist, 0, sizeof(exist));
        memset(bucket, 0, sizeof(bucket));
        
        for (i = 1; i < n; i++){
            temp = i * i % n;
            if (!exist[temp]){
                exist[temp] = 1;
                list[num++] = temp;
            }
        }
        
        for (i = 0; i < num; i++){
            for (j = 0; j < num; j++){
                if (i == j){
                    continue;
                }
                temp = list[i] - list[j];
                if (temp < 0){
                    temp += n;
                }
                if (temp > (n - 1) / 2){
                    temp = n - temp;
                }
                bucket[temp]++;
            }
        }
        
        for (i = 1; i <= (n - 1) / 2; i++){
            printf("%d\n", bucket[i]);
        }
    }
    
    return (0);
}

Measured memory_bytes: 460
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


#define rep(i,r,l) for(int i = r; i < l; i++)
#define elif else if

int nextint(void){int n;scanf("%d",&n);return n;}
void printint(int d){printf("%d\n",d);}


int main(void){ 

    int x=nextint();
    printf("%d",10-x/200);

    return 0;
}



Measured memory_bytes: 1732
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

namespace patch{
    template <typename T> string to_string(const T& n){
        ostringstream stm;
        stm << n;
        return stm.str();
    }
}

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

    int n; cin>>n;

    /*
    string S = patch::to_string(n);

    int ans = 0;
    for(int i=1; i<=n; i++){
        string A = patch::to_string(i);
        char Ah = A[0], At = A[A.size() - 1];

        if(At == '0') continue;

        if(Ah == At && atoi(At) <= n) ans++;

        for(int j=2; j<=S.size(); j++){
            if(j < S.size()) ans += pow(9, (S.size() - j));
            else{
                vector<vector<int>> dp(10, vector<int>(2, -1));

            }
        }
    }

    cout << ans << endl;

    */

    vector< vector< vector<int> > > P2num(10, vector< vector<int>>(10, vector<int>()));
    for(int i=1; i<=n; i++){
        string A = patch::to_string(i);
        int Ah = A[0] - '0', At = A[A.size() - 1] - '0';

        P2num[Ah][At].emplace_back(i);
    }

    int ans = 0;
    for(int i=1; i<=n; i++){
        string A = patch::to_string(i);
        int Bt = A[0] - '0', Bh = A[A.size() - 1] - '0';

        ans += P2num[Bh][Bt].size();
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1536
s = input()
ls = len(s)

cnt = {"a": 0, "b": 0, "c": 0}

for i in s:
    cnt[i] += 1

ab = abs(cnt["a"] - cnt["b"])
ac = abs(cnt["a"] - cnt["c"])
bc = abs(cnt["b"] - cnt["c"])

f = (ab <= 1) and (ac <= 1) and (bc <= 1)

print("YES" if f else "NO")


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define ll 	long long
#define pb push_back
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> A(n);
	for(int i=0;i<n;i++){
		int a;
		cin >> a;
		A[a-1] = i + 1;
	}
	for(int i=0;i<n;i++){
		cout << A[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 3720
#include<stdio.h>
int main(){
	int a,b,d,r; 
	double f;
	scanf("%d%d",&a,&b);
	
	d=a/b;
	r=a%b;
	f=1.0*a/b;
	printf("%d %d %lf\n",d,r,f);
	

return 0;
}

Measured memory_bytes: 636
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int n, a, b;

signed main(){
	scanf("%ld %ld %ld", &n, &a, &b);
	printf("%ld %ld\n", std::min(a, b), std::max(0l, a+b-n));
	return 0;
}


Measured memory_bytes: 256
n,m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

ans = 0
a_all = sum(a)

for x in a:
    if x >= a_all / (4*m):
        ans += 1
        
if ans >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
N = int(input())
a = [int(x) for x in input().split()]
# a = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3]

target = 1
res = 0
flag = False

for x in a:
	if x == target:
		target += 1
		flag = True
	else:
		res += 1

if flag:
	print(res)
else:
	print(-1)

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

int main() {
  int a[3];
  for(int i = 0; i < 3; i++){
    cin >> a[i];
  }
  sort(a,a+3);
  int ans = 0;
  for(int i = 1; i < 3; i++){
    ans += abs(a[i-1] - a[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if ( a >=1 && a <=100 && b >=1 && b <=100 && c >=1 && c <=100 ){

        if ( a==b && b==c && a==c)

        cout << 1;

        else if ( a==b && b!=c && a!=c)
        cout << 2;

        else if ( a==c && a!=b && c!=b)
            cout << 2;

        else if ( b==c && a!=b && c!=a)
            cout << 2;

    else if ( a!=b && b!=c && a!=c)
        cout<< 3;
    }else
        cout << "enter valid number";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int r,c,i,j,k;
	int s[101][101] = {{0}};

	scanf("%d %d",&r, &c);
	for(i = 0;i < r;i++){
		for(j = 0;j < c;j++){
			scanf("%d",&s[i][j]);
		}
	}
        for(i = 0;i < r;i++){
		for(j = 0;j < c;j++){
			s[i][c] += s[i][j];
			s[r][j] += s[i][j];
		}
	}
	for(i = 0;i < r;i++){
		s[r][c] += s[i][c];
	}
	for(i = 0;i <= r;i++){
		for(j = 0;j <= c;j++){
			printf("%d",s[i][j]);
			if(j < c){
				printf(" ");
			}
			if(j == c){
				printf("\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 652
fn readline() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_string()
}
fn readnums() -> Vec<i64> {
    readline().split(" ").map(|x| x.parse().unwrap()).collect()
}

fn main() {
    let (n, m) = match readnums().as_slice() {
        &[n, m] => (n, m),
        _ => panic!(),
    };

    let hs = readnums();
    let mut hs_sorted = (&hs).into_iter().enumerate().collect::<Vec<_>>();
    hs_sorted.sort_unstable_by(|(_, a), (_, b)| b.cmp(a));

    let mut path = vec![std::collections::HashSet::<usize>::new(); n as usize];

    for _ in 0..m {
        let (a, b) = match readnums().as_slice() {
            &[a, b] => (a as usize - 1, b as usize - 1),
            _ => panic!(),
        };
        path[a].insert(b);
        path[b].insert(a);
    }

    let mut great = vec![true; n as usize];
    let mut answer = 0;

    for (i, _) in hs_sorted {
        if !great[i] {
            continue;
        }

        let mut gr = 1;
        for j in &path[i] {
            great[*j] = false;
            if !(&hs[i] > &hs[*j]) {
                gr = 0;
            }
        }

        answer += gr;
    }

    println!("{:?}", answer)
}


Measured memory_bytes: 15676
x,k,d=map(int,input().split())
x=abs(x)
y=x-k*d
if y>=0:
  print(y)
  exit()
z=x%(2*d)
if k&1:
  a=abs(z-d)
  print(a)
else:
  a=min(abs(z-2*d),z)
  print(a)
  

Measured memory_bytes: 61804