akhauriyash/Code-Regression huggingface dataset:
s = list(input())
l = [chr(i) for i in range(ord("a"), ord("z") + 1)]
if len(s) == 26:
    for i in range(26)[-2::-1]:
        for j in range(25, i, -1):
            if s[i] < s[j]:
                s[i] = s[j]
                print("".join(s[:i+1]))
                exit()
    print(-1)
    exit()
for i in range(26)[-1::-1]:
    if l[i] in s:
        del l[i]
s.append(l[0])
print("".join(s))

Measured memory_bytes: 9104
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;



int main()
{
    string a;
    cin >> a;
    char k = a[a.length()-1];
    if (k == '3') {
        cout << "bon";
    }
    else if (k == '0' || k == '1' || k == '6' || k == '8') {
        cout << "pon";
    }
    else {
        cout << "hon";
    }
    
    return 0;
}


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

#define IOS std::cin.tie(0);std::ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>;

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())
#define END cout<<"\n"

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 1e6+1;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    IOS;
    CIN(N,K,R,S,P);SCIN(T);
    bool seen[NMAX];
    ll ans=0;
    rep(i,N){
        if(i-K>=0&&T[i]==T[i-K]&&seen[i-K])continue;
        if(T[i]=='r')ans+=P;
        if(T[i]=='p')ans+=S;
        if(T[i]=='s')ans+=R;
        seen[i]=true;
    }
    COUT(ans);

    return 0;
}

Measured memory_bytes: 592
#include<iostream>
using namespace std;
int main(){
    int n,i,t=0,b[200]={0};
    char a[10000];
    cin>>n;
    for(i=0;i<n;i++){
    cin>>a[i];
    b[a[i]]++;
    }
    for(i=0;i<200;i++)
        if(b[i]!=0)
         t++;
         if(t==3)
    cout<<"Three"<<endl;
      else
        cout<<"Four"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(i);
// sort(arr, arr+n, greater<int>());
// const long double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


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

Measured memory_bytes: 3656
def bfs(v):
    d=[-1]*n
    d[v]=0
    q=[v]
    c=1
    while q:
        q1=[]
        for i in q:
            for j in pt[i]:
                if d[j]==-1:
                    d[j]=c
                    q1.append(j)
        q=q1
        c+=1
    return d
n,x,y = map(int,input().split())
pt = [[i-1,i+1] for i in range(0,n)]
pt[0].remove(-1)
pt[n-1].remove(n)
pt[x-1].append(y-1)
pt[y-1].append(x-1)
cnt = [0]*(n)

for i in range(n-1):
  d = bfs(i)
  for j in range(i,n):
    cnt[d[j]] += 1

for k in range(1,n):
  print(cnt[k])


Measured memory_bytes: 3828
class Q1150
  @@field = nil;
  @@dp = nil;
  @@w = 0;
  @@h = 0;
  @@pos = Struct.new("Pos", :x, :y, :bRight)
  @@queue = Array.new
  LEFTFOOT = [[1,2],[1,1],[1,0],[1,-1],[1,-2],[2,1],[2,0],[2,-1],[3,0]]
  RIGHTFOOT = [[-1,2],[-1,1],[-1,0],[-1,-1],[-1,-2],[-2,1],[-2,0],[-2,-1],[-3,0]]
  MAX_COST = 100000000
  def climb x,y,bRight
    dir = bRight ? RIGHTFOOT : LEFTFOOT
    foot = bRight ? 1 : 0
    nfoot = bRight ? 0 : 1
    #puts "y = #{y}, x = #{x}, foot = #{foot}"
    dir.length.times do |i|
      nx = x + dir[i][0]
      ny = y + dir[i][1]
      if((0 <= nx && nx < @@w) && (0 <= ny && ny < @@h))
        if(@@field[ny][nx] == "T")
          @@dp[ny][nx][nfoot] = (@@dp[y][x][foot] < @@dp[ny][nx][nfoot]) ? @@dp[y][x][foot] : @@dp[ny][nx][nfoot]
        elsif("1" <= @@field[ny][nx] && @@field[ny][nx] <= "9") 
          n = @@field[ny][nx].to_i
          if(@@dp[y][x][foot] + n < @@dp[ny][nx][nfoot])
            @@dp[ny][nx][nfoot] = @@dp[y][x][foot] + n
            #puts "dp[#{ny}][#{nx}][#{nfoot}] = #{@@dp[ny][nx][nfoot]}"
            @@queue.push @@pos.new(nx,ny,!bRight)
          end
        end
      end
    end
  end
  def doIt
    arg = gets.split(" ").map{|x| x.to_i}
    while(0 < arg[0] + arg[1])
      @@w = arg[0]
      @@h = arg[1]
      @@field = Array.new(@@h)
      @@h.times do |i|
        #puts  i
        @@field[i] = gets.split(" ")
      end
      @@dp = Array.new(@@h).map!{Array.new(@@w).map!{Array.new(2, MAX_COST)}}
      #climing simulation
      @@h.times do |j|
        @@w.times do |i|
          if(@@field[j][i] == "S")
            #puts @@field[j][i]
            @@dp[j][i][0] = @@dp[j][i][1] = 0
            @@queue.push @@pos.new(i,j,true) 
            @@queue.push @@pos.new(i,j,false)
          end
        end     
      end
      #exec Dijkstra
      while(@@queue.length > 0)
        t = @@queue.shift
        climb t.x,t.y,t.bRight
      end
      #solve min
      min = MAX_COST
      @@h.times do |j|
        @@w.times do |i|
          if(@@field[j][i] == "T")
            min = @@dp[j][i][0] < min ? @@dp[j][i][0] : min
            min = @@dp[j][i][1] < min ? @@dp[j][i][1] : min
          end
        end     
      end
      puts(min == MAX_COST ? -1 : min)
      arg = gets.split(" ").map{|x| x.to_i}
    end
  end
end

Q1150.new.doIt

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

int main(){

	while (1){

		int i, j, w, h;
		cin >> w >> h;
		if (h == 0) break;



		for (i = 0; i < w; i++){
			for (j = 0; j < h; j++){

				cout << "#";

			}
			cout << endl;
		}

		cout << endl;
	}
	return 0;

}



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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

ll dp[100005];

int main(int argc, char* argv[]) {
  long long X;
  scanf("%lld", &X);

  vector<ll> m{100, 101, 102, 103, 104, 105};
  dp[0] = 1;
  rep(i, 0, 100004) {
    if (dp[i] == 0) continue;
    for (ll money : m) {
      if (i + money > 100000) continue;
      dp[i + money] = 1;
    }
  }

  if (dp[X] > 0) {
    put(1);
    return 0;
  }

  put(0);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

template <class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))


a = [0] + a + [0]
dist = [abs(a[i-1] - a[i]) for i in range(n+2)]

s = sum(dist)
for i in range(1, n+1):
  si = s + abs(a[i-1] - a[i+1]) - (abs(a[i-1] - a[i]) + abs(a[i+1] - a[i]))
  print(si)


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

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

    int n,d,x,t;
    vector <int> a;

    cin >> n;
    cin >> d >> x;

    for(int i=0;i<n;i++)
    {
        cin >> t;
        a.push_back(t);
    } 

    for(int i=0;i<n;i++)
    {
        double temp = (1.0*d)/(a[i]);
        x += ceil(temp);
    }

    cout << x << '\n';
    
    return 0;
}


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

 int main() {
     string s ;
     cin >> s ;
     string ans ="" ;
     for (int i = 0; i < s.size() ; ++i) {
         if(s[i]=='1') ans+="1";
         else if(s[i]=='0') ans+="0";
         else if(ans.size()>=1) ans.pop_back();
     }
     cout<<ans<<endl;
 }

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, c;
  cin >> a >> b >> c;
  if (a + b >= c) {
    cout << "No" << '\n';
    return 0;
  }
  ll left = 4 * a * b;
  ll right = (c - a - b) * (c - a - b);
  if (left < right) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
  return 0;
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int INF=1001001001;

struct edge{
    int to,cap,rev;
    edge(int a,int b,int c):to(a),cap(b),rev(c){}
};

int N,E,Q;

const int MAX_V=600;
vector<edge>G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,int cap){
    G[from].pb(edge(to,cap,G[to].size()));
    G[to].pb(edge(from,cap,G[from].size()-1));
}

int dfs(int v,int t,int f){
    if(v==t)return f;
    used[v]=true;
    for(int i=0;i<G[v].size();i++){
        edge &e=G[v][i];
        if(used[e.to]||e.cap==0)continue;
        int d=dfs(e.to,t,min(f,e.cap));
        if(d==0)continue;
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
    }
    return 0;
}

int max_flow(int s,int t,int lim){
    int f=0;
    while(lim){
        memset(used,0,sizeof(used));
        int ff=dfs(s,t,lim);
        if(ff==0)return f;
        f+=ff;
        lim-=ff;
    }
    return f;
}


int f;
void q1(int a,int b){
    add_edge(a,b,1);
    f+=max_flow(0,N-1,INF);
}

void q2(int a,int b){
    bool f1=false,f2=false;

    for(auto &e:G[a]){
        if(e.to!=b||e.cap==0)continue;
        if(e.cap==2)f2=true;
        e.cap=0;
    }
    for(auto &e:G[b]){
        if(e.to!=a||e.cap==0)continue;
        if(e.cap==2)f1=true;
        e.cap=0;
    }
    if(!f1&&!f2)return;

    if(f2)swap(a,b);


    int tmp=max_flow(a,b,1);

    if(tmp)return;

    add_edge(0,N-1,1);
    tmp=max_flow(a,b,1);
    assert(tmp);
    G[0].pop_back();
    G[N-1].pop_back();
    f--;
}

signed main(){

    cin>>N>>E>>Q;
    rep(i,E){
        int a,b;
        cin>>a>>b;
        a--;b--;
        add_edge(a,b,1);
    }

    f=max_flow(0,N-1,INF);


    while(Q--){
        int t,a,b;
        cin>>t>>a>>b;
        a--;b--;
        if(t==1){
            q1(a,b);
        }
        else{
            q2(a,b);
        }
        /*
        cout<<f<<"-------------"<<endl;
        for(int i=0;i<N;i++){
            for(auto &e:G[i]){
                cout<<i+1<<" "<<e.to+1<<" "<<e.cap<<endl;
            }
        }*/
        printf("%lld\n",f);

    }
    return 0;
}

Measured memory_bytes: 4300
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

int main(){
  int n,m,l; cin >> n >> m >> l;
  ll G[n][n];
  rep(i,n) rep(j,n) {
    if(i == j) G[i][i] = 0;
    else G[i][j] = G[j][i] = INF;
  }
  rep(i,m) {
    int a,b,c; cin >> a >> b >> c;
    a--; b--;
    G[a][b] = G[b][a] = c;
  }

  rep(k,n) rep(i,n) rep(j,n) chmin(G[i][j], G[i][k] + G[k][j]);
  
  ll ans[n][n];
  rep(i,n) rep(j,n) {
    if(i == j) ans[i][j] = 0;
    else ans[i][j] = ans[j][i] = INF;
  }

  rep(i,n) rep(j,n) if(G[i][j] <= l) ans[i][j] = ans[j][i] = 1;
  rep(k,n) rep(i,n) rep(j,n) chmin(ans[i][j], ans[i][k] + ans[k][j]);

  int Q; cin >> Q;
  vi s(Q),t(Q); rep(i,Q){cin >> s[i] >> t[i]; s[i]--; t[i]--;}
  rep(i,Q) cout << (ans[s[i]][t[i]] == INF ? -1 : ans[s[i]][t[i]]-1 ) << endl;
}

Measured memory_bytes: 2688
#include <iostream>
using namespace std;
int main(){
	int mount[10];
	for(int num=0;num<10;num++){
	 // cout << "Mount"<<num << endl;
	  cin >> mount[num];
    }
    for(int i=0;i<10;i++){
     for(int j=i+1;j<10;j++){
	  if(mount[i]<mount[j]){
	 	 int sub=mount[j];
	 	 mount[j]=mount[i];
	 	 mount[i]=sub;
	   }
     }
    }
   cout << mount[0] << endl;
   cout << mount[1] << endl;
   cout << mount[2] << endl;
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>

#define ll long long

using namespace std;

int main(){
    int S;
    cin >> S;//1245
    int x,y;
    x=S%100;
    y=S/100;
    if(x>12&&y==0){
        cout << "NA" << endl;
        return 0;
    }
    else if(y>12&&x==0){
        cout << "NA" << endl;
        return 0;
    }
    else if(x==0&&y==0){
        cout << "NA" << endl;
        return 0;
    }
    else if(x>12&&y>12){
        cout << "NA" << endl;
        return 0;
    }
    else if(x<=12&&x>0&&y<=12&&y>0){
        cout << "AMBIGUOUS" << endl;
        return 0;
    }
    else if(y<=12&&y>0){
        cout << "MMYY" << endl;
        return 0;
    }
    else if(x<=12&&x>0){
        cout << "YYMM" << endl;
        return 0;
    }
    return 0;
}


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

int main(){
    ll l,r;
    cin>>l>>r;
    if(l/2019<r/2019){
        cout<<0;
        return 0;
    }
    l%=2019;r%=2019;
    ll m=1e+9;
    for(int i=l; i<=r-1; i++){
        for(int j=i+1; j<=r; j++){
            m=((i*j)%2019<m)?((i*j)%2019):m;
        }
    }
    cout<<m;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int divisors(int a, int b, int c){
    int count = 0;
    int i;
    for (i = a; i <= b; i++){
        if(c % i == 0) 
            count += 1;
    }
    return count;
}

int main(void){
    int a = 0;
    int b = 0;
    int c = 0;
    scanf("%d %d %d", &a, &b, &c);
    printf("%d\n", divisors(a, b, c));

    return 0;
}



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

int main() {
	string S;
	cin >> S;
	int N = S.size();
	vector<int> V(N);
	for (int i = 0; i < N; i++) V[i] = S[i] - '0';
	reverse(V.begin(), V.end());
	vector<int> X(N + 1);
	int NOW = 1;
	long long ANS = 0;
	vector<long long> COUNT(2019, 0);
	for (int i = 0; i < N; i++) {
		X[i + 1] = (X[i] + V[i] * NOW) % 2019;
		NOW *= 10;
		NOW %= 2019;
	}
	for (int i = 0; i <= N; i++) {
		ANS += COUNT[X[i]];
		COUNT[X[i]]++;
	}
	cout << ANS << endl;
}

Measured memory_bytes: 5160
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vpii = vector<pair<int,int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int n;
  string s;
  cin >> n >> s;
  int cnt = 0;
  rep(i,n-2){
    if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') cnt++;
  }
  cout << cnt << endl;
          
  
  
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#define _GLIBCXX_DEBUG

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define endl '\n'
#define fcout cout << fixed << setprecision(15)

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

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

using ll    = long long;
using ld    = long double;
using Pii   = pair<int, int>;
using Pll   = pair<ll, ll>;

constexpr int MOD       = (int)1e9 + 7;
constexpr int INF_int   = (int)(1 << 30);
constexpr ll INF_ll     = (ll)1e18 + 1;
constexpr ld PI         = 3.141592653589793L;

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

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*追加部分*/



/*main関数*/

signed main() {
    int n, d, ans = 0; scanf("%d%d", &n, &d);
    rep(i, n){
        int x, y;
        scanf("%d%d", &x, &y);
        if(hypot(x, y) <= d) ans++;
    }

    printf("%d\n", ans);
return 0;
}


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

int main() {
	int N;
	int rate[9] = { 0 };
	int color = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int r;
		cin >> r;
		if (r > 3199) {
			rate[8]++;
		}
		else {
			rate[r / 400]++;
		}
	}
	for (int i = 0; i < 8; i++) {
		if (rate[i] != 0) color++;
	}

	int min, max;

	min = color;
	if (min == 0) min = 1;
	max = rate[8] + color;

	cout << min << " " << max << endl;

	return 0;
}

Measured memory_bytes: 256
def cmb(n, r, p): # 組み合わせの総数 109+7 で割ったあまりを求める Satoooh Blog 2020/02/27 4分 
    N = 10 ** 6  # N は必要分だけ用意する
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # factinv 計算用
    
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)

    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p



# 初期入力
X,Y = (int(x) for x in input().split())

# X+Y が3の倍数、かつY=2XとY=X/2の間にある必要あり
kotae =0
if (X+Y) %3 !=0 or X*2< Y or Y*2 <X :
    a =b =0
else: #a(1,2) + b(2,1)=(X,Y)  の連立法手式を解く　X,Yは入力値
    b=(2*X -Y)//3
    a=X-2*b

    # (1,2)と(2,1)の数がわかったので、その組み合わせ
    if b<a:
        a,b = b,a
    #kotae = kumiawase_num(a+b,a) 
    mod =10**9 +7
    kotae = cmb(a+b,a,mod ) 
    
print(kotae)

Measured memory_bytes: 122068
N, A, B = [int(x) for x in raw_input().split()]

def can(x):
  global A,B
  sum=0
  while x > 0:
    x, a = divmod(x, 10)
    sum += a
  if A <= sum <= B:
      return True    

res = 0
for i in xrange(1, N+1):
  if can(i):
    res += i

print res

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x, y) memset(x, y, sizeof(x))
#define Maxn 1000000 + 10
using namespace std;
int N;
int len[Maxn];
int result = 0;
int main()
{
    int f=0;
    int n;
    cin>>n;
    for(int i=1;i<10;i++)
    {
        for(int j=1;j<=i;j++)
        {
            if(i*j==n)
            {
                f=1;
            }
        }
    }
    if(f==0)
    cout<<"No"<<endl;
    else
    {
        cout<<"Yes"<<endl;
    }
    
    
}


Measured memory_bytes: 256
#include <cstdio>

int n,head[200001],nxt[400001],b[400001],k,ans2[200001];
void push(int s,int t){
	nxt[++k]=head[s];
	head[s]=k;
	b[k]=t;
}
void dfs(const int &x,const int &f,int mx,int skdmx,const int &down,bool update){
	if(x>mx)skdmx=mx,mx=x,update=1;
	else if(x>skdmx)skdmx=x,update=0;
	++ans2[x],--ans2[update?mx:down];
	for(int i=head[x];i;i=nxt[i])
		if(b[i]!=f)dfs(b[i],x,mx,skdmx,(x==mx)?b[i]:down,update),ans2[x]+=ans2[b[i]];
}
void getans(int x,int f,int sum){
	for(int i=head[x];i;i=nxt[i])
		if(b[i]!=f)sum+=ans2[b[i]];
	ans2[x]=++sum;
	for(int i=head[x];i;i=nxt[i])
		if(b[i]!=f)getans(b[i],x,sum-ans2[b[i]]);
}
int read(){
	int x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x;
}
void write(int x){
	if(x>9)write(x/10);
	putchar((x%10)+'0');
}
int main(){
	n=read();
	for(int i=1,u,v;i<n;++i){
		u=read(),v=read();
		push(u,v);
		push(v,u);
	}
	dfs(1,0,0,0,0,0);
	getans(1,0,-1);
	for(int i=2;i<=n;i++)write(ans2[i]),putchar(' ');
}

Measured memory_bytes: 21888
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll K;
	string s;
	while(cin>>s>>K) {
		REP(i, s.size()) {
			ll v = s[i]-'a';
			if(v==0) continue;
			ll rot = 26-v;
			if(rot<=K) {
				K-=rot;
				s[i]=(v+rot)%26+'a';
			}
		}
		if(K) s[s.size()-1] = (s[s.size()-1]-'a'+K)%26+'a';
		
		cout<<s<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 592
def _calc_sum(cache):
    sum_value = 0
    for v, indices in cache.items():
        sum_value += v * len(indices)
    return sum_value


def _main(N, A_list, Q, BC_list):
    cache = {}
    for i, a in enumerate(A_list):
        cache.setdefault(a, []).append(i)

    sum_value = _calc_sum(cache)

    for b, c in BC_list:
        indices = cache.get(b, [])
        cache[b] = []
        sum_value -= b * len(indices)
        cache.setdefault(c, []).extend(indices)
        sum_value += c * len(indices)
        print(sum_value)


def _entry():
    N = int(input())
    A_list = list(map(int, input().split()))
    Q = int(input())
    BC_list = []
    for i in range(Q):
        B, C = map(int, input().split())
        BC_list.append((B, C))
    _main(N, A_list, Q, BC_list)


if __name__ == "__main__":
    _entry()


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

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

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <climits>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS cin.tie(0);ios::sync_with_stdio(false)
#define MP_ make_pair
#define PB_ push_back
#define FIR first
#define SEC second
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZ(x) ((int)(x).size())
typedef long long int lli;
using namespace std;

int ctoi(char c)
{
  if( c >= '0' and c <= '9')
    {
      return (int)(c-'0');
    }

  return -1;
}

vector<string> split(string str, char ch)
{
  int first = 0;
  int last = str.find_first_of(ch);
  
  if(last == string::npos)
    {
      last = SIZ(str);
    }

  vector<string> result;

  while( first < SIZ(str) )
    {
      string Ssubstr(str, first, last - first);
      result.push_back(Ssubstr);
      first = last + 1;
      last = str.find_first_of(ch, first);

      if(last == string::npos)
	{
	  last = SIZ(str);
	}
    }
  
  return result;
}


lli sm = 0;


void Forloop( string S , int K , vector<int> ind )
{
  int N = SIZ(S);
  
  if( SIZ(ind) == N-1 )
    {
      string str = "";
      
      REP(i,N-1)
	{
	  str += S[i];

	  if( ind[i] )
	    {
	      str += "+";
	      
	    }
	  
	}

      str += S[N-1];
      

      vector<string> v = split(str,'+');

      REP( k , SIZ(v) )
	{
	  sm += stoll(v[k]);
	  
	}

     
      return;
      
    }

  REP(j,K)
    {
      vector<int> temp = ind;
      temp.push_back(j);
      Forloop(S,K,temp);
      
      
    }
}



/*--------------- the end of the template --------------------*/


int main()
{
  IOS; /* making cin faster */
  int N;

  string S;

  cin >> S;
  N = SIZ(S);

  if( N == 1 )
    {
      cout << S << endl;
      
    }
  else
    {
      vector<int> ind;
      Forloop(S,2,ind);

      printf("%lld\n",sm);
      
    }
  

}


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(){
    int N,K; cin >> N >> K;
    vector <int> A(N);
    rep(i,N) cin >> A[i];
    
    auto f=[&](int x){
        return 1+(x-1)*(K-1);
    };
    
    int ans=0;
    int x=1;
    while(1){
        if(f(x)>=N) break;
        ans++;
        x++;
    }
    cout << ans;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;



int main() {
	int n;
	cin >> n;
	map<char, ll> mp;
	rep(i, n) {
		string s;
		cin >> s;
		mp[s[0]]++;
	}
	ll ans = 0;
	ll m = mp['M'], a = mp['A'], r = mp['R'], c = mp['C'], h = mp['H'];
	ans += m * a * r;
	ans += m * a * c;
	ans += m * a * h;
	ans += m * r * c;
	ans += m * r * h;
	ans += m * c * h;
	ans += a * r * c;
	ans += a * r * h;
	ans += a * c * h;
	ans += r * c * h;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
const int N = 100005;
int dp[N][3];
int main() {
	int n,a[N],b[N],c[N];
	cin >> n;
	cin >> dp[0][0] >> dp[0][1] >> dp[0][2];
	for (int i = 1; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i];
		dp[i][0] += a[i]+ max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] += b[i] + max(dp[i - 1][2], dp[i - 1][0]);
		dp[i][2] += c[i] + max(dp[i - 1][1], dp[i - 1][0]);
	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]))<<endl;
}

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

bool tri(int x,int y,int z){
	return (x*x+y*y==z*z)?1:0;
}

int main(){
	int n;
	cin>>n;
	int a[3];
	for(int i=0;i<n;i++){
		cin>>a[0]>>a[1]>>a[2];
		sort(a,a+3);
		if (tri(a[0],a[1],a[2])) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

Measured memory_bytes: 1136
import copy
import sys
input = sys.stdin.readline
n,k = map(int, input().split())
data = []
bit_k = format(k, 'b')
len_k = len(bit_k)
for i in range(n):
    a, b = map(int, input().split())
    if a <= k:
        tmp = format(a, 'b')
        tmp = tmp.zfill(len_k)
        data.append([tmp,b])
def check_value(bit):
    res = 0
    for i in range(len(data)):
        flag = True
        dd = data[i][0]
        for j in range(len_k):
            if bit[j] == '0' and dd[j] == '1':
                flag = False
                break
        if flag:
            #print("tmp:{} bit{}".format(tmp, bit))
            res += data[i][1]
    return res
ans = check_value(bit_k)
tmp = []
for i in range(len_k):
    p = []
    if bit_k[i] == '1':
        p = tmp + ['0'] + ['1']*(len_k-1-i)
    else:
        tmp += bit_k[i]
        continue
    p = "".join(p)
    ans = max(ans, check_value(p))
    tmp += bit_k[i]
print(ans)


Measured memory_bytes: 77404
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
    string s;
    cin >> s;
    bool ok = false;
    if (s[0] == 'A')
    {
        int count = 0;
        for (int i = 2; i < s.size() - 1; i++)
        {
            if (s[i] == 'C')
            {
                count++;
            }
        }
        if (count == 1)
            ok = true;
    }
    if (ok)
        sort(s.begin(), s.end());
    else
    {
        printf("WA\n");
        return 0;
    }
    s = s.substr(2, s.size());
    rep(i, s.size())
    {
        if (isupper(s[i]))
        {
            printf("WA\n");
            return 0;
        }
    }
    printf("AC\n");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int tmp=a;
    a=b;
    b=tmp;
    tmp=a;
    a=c;
    c=tmp;
    printf("%d %d %d\n",a,b,c);
    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);
		StringBuilder sb = new StringBuilder();
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		int k = sc.nextInt();
		if (a[4] - a[0] <= k) {
			sb.append("Yay!");
		} else {
			sb.append(":(");
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

ll INF = 1000000007;

int main() {
	ll n, k;
	cin >> n >> k;
    ll sum=0;
    for(ll i=k;i<=n+1;i++){
      sum+=(n*(n+1)/2-(n-i)*(n-i+1)/2)-i*(i-1)/2+1;
      sum%=INF;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

int x;

int main() {
  cin >> x;
  if (x < 1200) {
    cout << "ABC";
  } else {
    cout << "ARC";
  }
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define maxn 1000010
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef pair<int,LL> pii;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int tot=1<<15;

int x,y;
int a[300]={0,300000,200000,100000,0,} ;

int main(){
	//freopen("test.txt","r",stdin);
	
	cin>>x>>y;
	int ans=0;
	if(x==1&&y==1) ans=400000;
	ans+=a[x]+a[y];
	cout<<ans<<endl;

	
	return 0;
} 

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

using namespace std;
constexpr int INF = std::numeric_limits<int>::max();
int main() {
  int N,K;
  cin >> N >> K;
  std::vector<int> height(N);
  for (auto &h : height) {
    cin >> h;
  }
  std::vector<int> cost(N,INF);
  cost[0] = 0;
  for(int i=1;i<N;++i){
    for(int k=1;k<=K;++k){
      if(i-k < 0) continue;
      cost[i] = min(cost[i],cost[i-k]+abs(height[i]-height[i-k]));
    }
  }
  cout << cost[N-1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, r;
    cin >> n >> r;
    if (n >= 10) cout << r << '\n';
    else cout << r + 100 * (10 - n) << '\n';
    return 0;
}


Measured memory_bytes: 256
import Data.List
import Control.Applicative

check :: [Int] -> String
check [a, b, c]
  | a^2 + b^2 == c^2 = "YES"
  | otherwise = "NO"

main = do
  getLine
  triangles <- fmap (sort . fmap read . words) . lines <$> getContents
  mapM_ (putStrLn . check) triangles


Measured memory_bytes: 4288
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

const int kMaxn = 5e3 + 5;

int main() {
  //
  int N, D;
  int ans = 0;
  cin >> N >> D;
  for (int i = 1; i <= N; i++) {
    int x, y;
    cin >> x >> y;
    ans += (1LL * x * x + 1LL * y * y <= 1LL * D * D);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3180
n = int(input())
a = list(map(int, input().split()))

l = [0] * (n + 1)
for i in range(n):
    if a[i] == i + 1:
        l[i] = 1
count = 0
for i in range(n):
    if l[i] == 1:
        l[i] = 0
        l[i + 1] = 0
        count += 1
print(count)

Measured memory_bytes: 20592
n,blue=map(int,input().split())
red=n-blue
mod=10**9+7
framod=[1]

def framod_calc(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
        framod.append(a)

def permmod(n, k, mod):
    if n<k: return 0
    a=framod[n]
    c=framod[n-k]
    return (a * pow(c, mod-2, mod)) % mod

def combmod(n, k, mod):
    if n<k: return 0
    a=framod[n]
    b=framod[k]
    c=framod[n-k]
    return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod

framod_calc(n+1, mod)

for i in range(1, blue+1):
    x=combmod(n-blue+1,i,mod)*combmod(blue-1,i-1,mod)
    print(x%mod)

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

signed main(){
	int N, i, ans = 0;;
	scanf("%lld", &N);
	vector<pair<int, int>> LR(N);
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &LR[i].first, &LR[i].second);
		LR[i].second++;
		ans = max(ans, LR[i].second - LR[i].first);
	}
	for(i = 0; i < N; i++){
		swap(LR[i].first, LR[i].second);
	}
	sort(LR.begin(), LR.end());
	for(i = 0; i < N; i++){
		swap(LR[i].first, LR[i].second);
	}
	vector<int> l1(N), r1(N), l2(N), r2(N);
	l1[0] = LR[0].first;
	r1[0] = LR[0].second;
	for(i = 1; i < N; i++){
		l1[i] = max(l1[i - 1], LR[i].first);
		r1[i] = min(r1[i - 1], LR[i].second);
	}
	l2[N - 1] = LR[N - 1].first;
	r2[N - 1] = LR[N - 1].second;
	for(i = N - 2; i >= 0; i--){
		l2[i] = max(l2[i + 1], LR[i].first);
		r2[i] = min(r2[i + 1], LR[i].second);
	}
	for(i = 1; i < N; i++){
		if(l1[i - 1] <= r1[i - 1] && l2[i] <= r2[i]){
			ans = max(ans, r1[i - 1] - l1[i - 1] + r2[i] - l2[i]);
		}
	}
	for(i = 1; i < N - 1; i++){
		int ll = max(l1[i - 1], l2[i - 1]);
		int rr = min(r1[i + 1], r2[i + 1]);
		if(ll <= rr){
			ans = max(ans, rr - ll + LR[i].second - LR[i].first);
		}
	}

	for(i = 0; i < N; i++){
		swap(LR[i].first, LR[i].second);
		LR[i].second *= -1;
	}
	sort(LR.begin(), LR.end());
	for(i = 0; i < N; i++){
		LR[i].second *= -1;
		swap(LR[i].first, LR[i].second);
	}
	l1[0] = LR[0].first;
	r1[0] = LR[0].second;
	for(i = 1; i < N; i++){
		l1[i] = max(l1[i - 1], LR[i].first);
		r1[i] = min(r1[i - 1], LR[i].second);
	}
	l2[N - 1] = LR[N - 1].first;
	r2[N - 1] = LR[N - 1].second;
	for(i = N - 2; i >= 0; i--){
		l2[i] = max(l2[i + 1], LR[i].first);
		r2[i] = min(r2[i + 1], LR[i].second);
	}
	for(i = 1; i < N; i++){
		if(l1[i - 1] <= r1[i - 1] && l2[i] <= r2[i]){
			ans = max(ans, r1[i - 1] - l1[i - 1] + r2[i] - l2[i]);
		}
	}

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
const int nmax=200005;
int v[nmax];
int main()
{  
     int n;
    cin>>n;
    for(int i=2; i<=n; i++)
    { 
        int x;
      cin>>x;
       if(x<i)v[x]++;
    }
  for(int i=1; i<=n; i++)
    cout<<v[i]<<"\n";
  
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin>>N;
    vector<string> s(N);
    for (int i=0;i<N;i++) cin>>s[i];
    int a=0,w=0,t=0,r=0;
    for (int i=0;i<N;i++){
        if (s[i]=="AC") a++;
        else if (s[i]=="WA") w++;
        else if (s[i]=="TLE") t++;
        else r++;
    }
    cout<<"AC"<<" "<<'x'<<" "<<a<<endl;
    cout<<"WA"<<" "<<'x'<<" "<<w<<endl;
    cout<<"TLE"<<" "<<'x'<<" "<<t<<endl;
    cout<<"RE"<<" "<<'x'<<" "<<r<<endl;
    return 0;
}

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

int main(){
  ll a,b;
  cin >>a >>b;
  ll cnt = 0;
  bool zero = false;
  for(ll i = a; i<=b; i++){
    if(i<0) cnt++;
    if(i==0) zero = true;
  }
  if(zero) cout << "Zero" << endl;
  else if(cnt%2 == 0) cout << "Positive" << endl;
  else cout << "Negative" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 101
#define INF 200000000
#define MAX 100

int A[N][N],color[N],f[N],d[N],q[MAX];
int n, time, head, tail, u;

void enqueue(x)
{
  q[tail] = x;
  if((tail+1)==MAX)
    tail = 0;
  else tail++;
}

int dequeue()
{
  int x;
  x = q[head];
  if((head+1)==MAX)
    head = 0;
  else
    head++;
  return x;
}

void bfs(int s)
{
  int i, Q;
  for(i=1 ; i<=n-s ; i++ ){
    color[u] = 0;
    d[u] = INF;
  }
  color[s] = 2;
  d[s] = 0;
  enqueue(1);
  while(head!=tail){
    u = dequeue();
    for(i=1 ; i<=n ; i++){
      if(A[u][i]!=0){
	if(color[i]==0){
	  color[i] = 2;
	  d[i] = d[u]+1;
	  enqueue(i);
	}
      }
    }
    color[u] = 3;
  }
}

int main()
{
  int i, j, k, a;
  scanf("%d",&n);
  for(i=0 ; i<=n ; i++ )
    for(j=0 ; j<=n ; j++ )
      A[i][j] = 0;
  
  for(i=1 ; i<=n ; i++ ){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j=1 ; j<=k ; j++ ){
      scanf("%d",&a);
      A[u][a] = 1;
    }
  }
  bfs(1);

  for( i=1 ; i<=n ;i++){
    if(i!=1 && (d[i]==0 || d[i]==INF)) printf("%d -1\n",i);
    else printf("%d %d\n",i,d[i]);
  }

  return 0;
}

Measured memory_bytes: 636
/*
Dont BLUNDER
*/
#include<bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
 
 */
//#define d long double
#define int long long
#define pii pair<int,int>
#define pb push_back
#define endl '\n'
#define pi acos(-1)
#define inf (int)1e18
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
int const mod1=998244353;
int const mod=1000000007;
#define l first
#define r second
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 #define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// *** Using PBDS ***
 /*typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
                os; */


 
int modexp(int x, int n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}
 
int modinv(int n)
{
	return modexp(n,mod-2);
}


signed main()
{
	int x,n;
	cin>>x>>n;
	int arr[n];
	int vis[1001];
	init(vis,0);
	for(int i=0;i<n;i++)
	{
	cin>>arr[i];
	vis[arr[i]]=1;
	}
	if(vis[x]==0)
	{
	    cout<<x;
	    return 0;
	}
	for(int i=1;i<=200;i++)
	{
	    int up=x+i;
	    int down=x-i;
	    if(down<=0)
	    {
	        cout<<down;
	        return 0;
	    }
	    else{
	        if(vis[down]==0)
	    {
	        cout<<down;
	        return 0;
	    }
	        
	    }
	    if(vis[up]==0)
	    {
	        cout<<up;
	        return 0;
	    }
	}
	


}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void){
    int p, q, r, min;
    scanf("%d %d %d", &p, &q, &r);
    min = p + q;
    if(min > q + r){min = q + r;}
    if(min > p + r){min = p + r;}
    printf("%d\n", min);
    return 0;
}

Measured memory_bytes: 128
def main():
    S = input()

    N = len(S)
    for i in range(N):
        if S[i] != S[N-i-1]:
            print("No")
            return

    M = (N-1)//2
    for i in range(M):
        if S[i] != S[N-i-1]:
            print("No")
            return

    L = (N+3)//2 - 1
    for i in range(L, N):
        if S[i] != S[N+L-i-1]:
            print("No")
            return

    print("Yes")


main()


Measured memory_bytes: 8612
#include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
#include <cmath>
using namespace std;

const long long int N = 100000000;

bool solve(long long int x){

  if(x==2) return true;
  if(x<2 || x%2==0) return false;

  for(int i=3; i<=sqrt(x); i+=2)
    if(x%i == 0) return false;
  return true;
}

int main(){

  int n,cnt=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int a=0;
    cin>>a;
    if(solve(a)) cnt++;
  }
  cout<<cnt<<endl;
 
  return 0;
}

Measured memory_bytes: 3088