akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ std::cin >> head; _cin(std::forward<Tail>(tail)...); }
void _cout(){ std::cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ std::cout << head; _cout(std::forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

using namespace std;
using ll = long long;

int main(void){
    Cin(string, s, t);
    string ans;
    while(!s.empty()){
        ans.push_back(s[0]);
        s.erase(s.begin());
        swap(s, t);
    }
    Cout(ans);
}


Measured memory_bytes: 256
n=int(input())

ans=9999999999999
for a in range(1,n):
    b=n-a
    a_sum=sum(list(map(int,list(str(a)))))
    b_sum=sum(list(map(int,list(str(b)))))
    ab_sum=a_sum+b_sum
    if(ans>ab_sum):
        ans=ab_sum
#        print(a,b,ab_sum)
print(ans)


Measured memory_bytes: 3060
s = input()
k = int(input())
d = 'abcdefghijklmnopqrstuvwxyz'
n = len(s)
lis = set()
for i in range(26):
    for j in range(len(s)):
        if s[j] == d[i]:
            for l in range(j, j+k+1):
                if l < n:
                    lis.add(s[j:l+1])
lis = list(lis)
lis.sort()
#print(lis)
#print(k)
print(lis[k-1])


Measured memory_bytes: 4848
#include <stdio.h>
int prime[100000]={0};
int main(){
    int i,j,k,flag,num,ber,outflag;
    while(1){
        scanf("%d",&i);
        if(i == 0){
            break;
        }
        num=0;
        ber=0;
        outflag=0;
        flag=0;
        for(j=2;j<=i/2;j++){
            for(k=2;k*j<=i;k++){
                prime[j*k]=1;
            }
        }
        for(j=i;j>=0;j--){
            if(prime[j] == 0 && outflag == 0){
                num=j;
                outflag=1;
            }
            if(ber - num == 2){
                break;
            }
            else if(prime[j] == 0 && outflag == 1){
                outflag=0;
                ber=j;
            }
            if(num - ber == 2){
                break;
            }
        }
        if(outflag == 1){
            printf("%d %d\n",num,ber);
        }
        else if(outflag == 0){
            printf("%d %d\n",ber,num);
        }
    }
    return (0);
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>
#include <sstream>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) x.begin(),x.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

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

    if(X >= 400 and X < 600)
        cout << 8 << endl;
    else if(X >= 600 and X < 800)
        cout << 7 << endl;
    else if(X >= 800 and X < 1000)
        cout << 6 << endl;
    else if(X >= 1000 and X < 1200)
        cout << 5 << endl;
    else if(X >= 1200 and X < 1400)
        cout << 4 << endl;
    else if(X >= 1400 and X < 1600)
        cout << 3 << endl;
    else if(X >= 1600 and X < 1800)
        cout << 2 << endl;
    else
        cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}


int dfs(int n,int N){
    if (n>N){
        return 0;
    }
    

    int ret;
    
    return ret;
}


int main(){
    int H,W;

    cin >> H >>W;

    char a[H][W];

    FOR(i,H){
        FOR(j,W){
            cin >> a[i][j];
        }
    }
    int noline[H];
    int nlp=0;
    bool lastenterd=false;
    FOR(i,H){
        bool x=true;
        FOR(j,W){
            if(a[i][j]=='#'){
                x=false;
            }
        }
        if(x){
            FOR(j,W){
                a[i][j]='^';
            }
            noline[nlp]=i;
            nlp++;
          
        }

    }
    FOR(j,W){
        bool x=true;
        FOR(i,H){
            if(a[i][j]=='#'){
                x=false;
            }
        }
        if(x){
            FOR(i,H){
                a[i][j]='^';
            }
        }

    }
    int maxnlp=nlp;
    noline[maxnlp]=-1;
    nlp=0;
    FOR(i,H){
        FOR(j,W){
            if(a[i][j]!='^'){
                cout<<a[i][j];
            }
        }
        //cout << "line at"<< i <<":"<<noline[i]<<endl;
        if(i!=noline[nlp]){
            cout<<endl;
            lastenterd=true;
        } else{
            if(nlp!=maxnlp){
                nlp++;    
            
            }
            
            lastenterd=false;
        }
    }
    /*if(!lastenterd){
        cout << endl;
    }*/
    return 0;

    


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, Q;
  cin >> N >> Q;
  vector<int> S(N), T(N), X(N);
  for (int i = 0; i < N; i++){
    cin >> S[i] >> T[i] >> X[i];
  }
  vector<int> D(Q);
  for (int i = 0; i < Q; i++){
    cin >> D[i];
  }
  map<int, pair<vector<int>, int>> mp;
  for (int i = 0; i < N; i++){
    S[i] -= X[i];
    T[i] -= X[i];
    S[i] = max(S[i], 0);
    if (T[i] > 0){
      mp[S[i]].first.push_back(X[i]);
      mp[T[i]].first.push_back(-X[i]);
    }
  }
  for (auto P : mp){
    mp[P.first].second = -1;
  }
  for (int i = 0; i < Q; i++){
    mp[D[i]].second = i;
  }
  vector<int> ans(Q);
  set<int> st;
  for (auto P : mp){
    for (auto x : P.second.first){
      if (x > 0){
        st.insert(x);
      } else {
        st.erase(-x);
      }
    }
    if (P.second.second != -1){
      int id = P.second.second;
      if (st.empty()){
        ans[id] = -1;
      } else {
        ans[id] = *(st.begin());
      }
    }
  }
  for (int i = 0; i < Q; i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 75652
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, N: int):

    if N >= B-1:
        x = B-1
        print(A*x//B-A*(x//B))
        return
    else:
        x = N
        print(A*x//B-A*(x//B))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9196
#include<stdio.h>
int main(void)
{
int x[200000];
int n, i, j;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", &x[i]);
}
int max=-1000000000, min=x[0];
for(j=1;j<n;j++){
if(x[j]-min>max)
max=x[j]-min;
if(min>x[j])
min=x[j];

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

Measured memory_bytes: 3488
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;

int main(){
  ll N;
  ll a[210000],ans=0,sum=0,sumX=0;
  cin>>N;

  for(ll i=0;i<N;i++){
     cin>>a[i];
  }


  ll right=0;
  for(ll left=0;left<N;left++){

    while(right<N && (sum+a[right])==(sumX^a[right])){ //rightを1個進めたときに条件を満たす
      //cout<<sum+a[right]<<" "<<sumX^a[right] <<endl;
      //cout<<right<<endl;
      sum+=a[right];
      sumX=sumX^a[right];
      right++;
      //実際にrightを1進める
      //cout<<sum<<" "<<sumX<<endl;
    }
    //cout<<left<<" "<<right<<endl;
    //cout<<sum<<" "<<sumX<<endl;
    //breakした状態でrightは条件を満たす最大なので何かする
    ans+=right-left;
    //leftをインクリメントする準備
    //ex: if(right==left) right++;
    sum-=a[left];
    sumX=sumX^a[left];
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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 (b<a) { a=b; return 1; } return 0; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  string s;
  cin>>s;
  ll n=s.size();

  ll cnt=0;
  vector<ll> vec(n+1,-1);
  vec[0]=0;

  for(int i=0;i<n;i++){
    auto c=s[i];
    if(c=='<'){
      vec[i+1] = (++cnt);
    }
    else{
      vec[i+1] = (cnt=0);
    }
  }
  cnt=0;
  vec[n]=max(0LL,vec[n]);
  for(int i=n-1;i>=0;i--){
    auto c=s[i];
    if(c=='>'){
      vec[i] = max((++cnt),vec[i]);
    }
    else{
      vec[i] = max((cnt=0),vec[i]);
    }
  }
  
  ll sum=0;
  ///*
  for(auto x:vec){
    sum+=x;
    //cout << x << " ";
  }
  //cout << endl;
  //*/
  cout << sum << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

Measured memory_bytes: 4740
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static readonly int MAX = 1000000;

        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            var memo = Enumerable.Range(0, MAX).ToArray();
            memo[0] = memo[1] = -1;

            int len = (int)Math.Sqrt(MAX);

            for (int i = 2; i < len; i++)
            {
                if (memo[i] == -1) continue;

                for (int j = i * i; j < MAX; j += i)
                {
                    memo[j] = -1;
                }
            }
            var primes = memo.Where(a => a != -1).ToArray();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                int res = 0;

                for (int i = 0; i < n; i++)
                {
                    string[] input = Console.ReadLine().Split(' ');
                    int p = int.Parse(input[0]);
                    int m = int.Parse(input[1]);
                    int s = p - m;
                    int t = p + m;

                    s = LowerBound(primes, s);
                    t = UpperBound(primes, t);
                    res += (t - s - 1);
                }
                sb.AppendLine(res.ToString());
            }
            Console.Write(sb);
        }

        static int LowerBound(int[] arr, int value)
        {
            int low = 0, high = arr.Length;

            while (low < high)
            {
                int mid = ((high - low) >> 1) + low;

                if (arr[mid] < value) low = mid + 1;
                else high = mid;
            }
            return low;
        }

        static int UpperBound(int[] arr, int value)
        {
            int low = 0, high = arr.Length;

            while (low < high)
            {
                int mid = ((high - low) >> 1) + low;

                if (arr[mid] <= value) low = mid + 1;
                else high = mid;
            }
            return low;
        }
    }
}

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

using namespace std;

int main() {
    char c;
    vector<int> t = {5, 7, 5};
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < t.at(i); ++j) {
            cin >> c;
            cout << c;
        }
        if (i - 2) cin >> c;
        cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int n, m; cin >> n >> m;
	cout << ((m - n) == 0 ? "Yes" : "No") << endl;
	return;
}

int main() {
	solve();
  return 0;
}

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

  #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 trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define mod 1000000007
  #define N 1005

int dp[N][N];

int main()
{




  int m,n;
  cin >> m >> n;

  char arr[m+1][n+1];
  for(int i = 1; i <= m; i++)
  {
    for(int j = 1; j <= n; j++)
    {
      cin >> arr[i][j];
    }
  }


  dp[1][1] = 1;

  bool ok = true;
  for(int i = 1; i <= n; i++)
  {
    if(arr[1][i] == '#')
    {
      ok = false;
    }  
    dp[1][i] = ok;
  }

  ok = true;

    for(int i = 1; i <= m; i++)
  {
    if(arr[i][1] == '#')
    {
      ok = false;
    }  
    dp[i][1] = ok;
  }



  for(int i = 1; i <= m; i++)
  {
    for(int j = 1; j <= n; j++)
    {
      if(arr[i][j] == '.')
      {
        dp[i][j] = max((dp[i-1][j]%mod + dp[i][j-1]%mod)%mod,dp[i][j]%mod)%mod;
      }
    }
  }


    cout << dp[m][n] << endl;



    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <tuple>
#include <unordered_set>
#include <unordered_map>

using namespace std;

int main(void) {
  string Sp, T;
  cin >> Sp >> T;
  string S = Sp;
  bool ans = false;

  vector<string> ansvec;
  for (int i = 0; i < Sp.size() - T.size() + 1; i++) {
    string SS = Sp;
    string Si = Sp.substr(i, T.size());
    bool flag = true;
    for (int j = 0; j < T.size(); j++) {
      if (Si[j] != '?' && Si[j] != T[j])
        flag = false;
    }
    // cout << Sp.substr(i, T.size()) << " <-- " << T << " " << flag << endl;
    if (flag) {
      ans = true;
      SS.replace(i, T.size(), T);
      replace(SS.begin(), SS.end(), '?', 'a');
      ansvec.push_back(SS);
    }
  }

  if (ansvec.size() == 0) {
    cout << "UNRESTORABLE" << endl;
  } else {
    sort(ansvec.begin(), ansvec.end());
    cout << ansvec[0] << endl;
  }
}


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


// --- DEBUG begin --- cut here ---
template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

template <class Head>
void dbgLog(Head&& head) {
  cerr << head << endl;
}

template <class Head, class... Tail>
void dbgLog(Head&& head, Tail&&... tail)
{
  cerr << head << " ";
  dbgLog(forward<Tail>(tail)...);
}

#if DEBUG
  #define DLOG(...)        dbgLog(__VA_ARGS__)
  #define DFMT(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DFMT(...)
  #define DCALL(func, ...)
#endif

// operator<< definitions for some classes

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

template <typename T>
ostream& operator<< (ostream& os, const vector<T>& v) {
  os << '[';
  for (auto it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  os << ']';

  return os;
}

template <typename T, typename T2, typename T3>
ostream& operator<< (ostream& os, const priority_queue<T, T2, T3>& orig) {
  priority_queue<T, T2, T3> pq(orig);
  bool first = true;
  os << '[';
  while (!pq.empty()) {
    T x = pq.top(); pq.pop();
    if (!first) os << ", ";
    os << x;
    first = false;
  }
  return os << ']';
}
// --- DEBUG end --- cut here ---



typedef pair<int, int> Pair;

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N; cin >> N;
  vector<int> A(N*N, -1);
  DLOG("A", A);
  vector<Pair> pos;
  for (int i = 0; i < N; i++) {
    int x; cin >> x; x--;
    pos.emplace_back(x, i);
    A.at(x) = i;
  }
  sort(pos.begin(), pos.end());
  DLOG("pos", pos);
  int cur = 0;
  DLOG("start", A);
  for (int i = 0; i < N; i++) {
    DLOG("i", i, "A", A);
    int p = pos.at(i).first;
    int y = pos.at(i).second;
    DLOG("p,y", p, y);
    for (int j = 0; j < y; j++) {
      while (cur < N*N && A.at(cur) >= 0) cur++;
      if (cur >= p) {
	cout << "No\n";
	return 0;
      }
      A.at(cur) = y;
    }
  }
  DLOG("half", A);
  cur = N*N - 1;
  for (int i = N-1; i >= 0; i--) {
    int p = pos.at(i).first;
    int y = pos.at(i).second;
    for (int j = 0; j < N - y - 1; j++) {
      while (cur >= 0 && A.at(cur) >= 0) cur--;
      if (cur <= p) {
	cout << "No\n";
	return 0;
      }
      A.at(cur) = y;
    }
  }
  DLOG("full", A);
  cout << "Yes\n";
  for (int i = 0; i < N*N; i++) {
    if (i > 0) cout << " ";
    cout << A.at(i) + 1;
  }
  cout << endl;


  return 0;
}



Measured memory_bytes: 2176
#include <cstdio>
using namespace std;

int parent[10000];

int find_parent(int x){
	if(x!=parent[x])	parent[x]=find_parent(parent[x]);
	return parent[x];
}

int main(){
	int n,q;	scanf("%d %d",&n,&q);
	for(int i=0;i<n;i++)	parent[i]=i;
	int com,x,y;
	while(q--){
		scanf("%d %d %d",&com,&x,&y);
		if(com==0){
			y=find_parent(y);
			x=find_parent(x);
			parent[y]=x;
		}
		else if(com==1){
			if(find_parent(x)==find_parent(y))	printf("1\n");
			else printf("0\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1052
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long LIS(vector<long> nums){
	long dp[100005];
	fill(dp, dp + nums.size(), INT_MAX);
	for (int i=0; i<nums.size(); ++i) {
		*lower_bound(dp, dp+nums.size(), nums[i]) = nums[i];
	}
	return lower_bound(dp, dp + nums.size(), INT_MAX) - dp;
}

int main(){
	long n;
	vector<long> nums;
	cin >> n;
	for(int i = 0; i < n; i++){
		long tmp;
		cin >> tmp;
		nums.push_back(tmp);
	}

	cout << LIS(nums) << endl;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main{
public static void main(String[]  args){
 Scanner stdIn = new Scanner(System.in);
 
 int d = stdIn.nextInt();
 int t = stdIn.nextInt();
 int s = stdIn.nextInt();

if ((double)d/s<=t){System.out.print("Yes");}
else if ((double)d/s>t) {System.out.print("No");}

  }
}


Measured memory_bytes: 35812
//Priority_queue

#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;

int main(void){
    priority_queue<int> Q;
    char com[10];
    int k;
    while(1){
       scanf("%s", com);
       
       if(com[0] == 'i') {
           scanf("%d", &k);
           Q.push(k);
       } else if(com[2] == 't'){
           cout << Q.top() << endl;
           Q.pop();
       } else {
           break;
       }
    }
    
    return 0;
}

Measured memory_bytes: 5404
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    string s;
    int t,x;
    while(1){
        cin>>s;
        if(s=="-")break;
        in(t);
        int sum=0;
        while(t--){
            in(x);
            sum+=x;
        }
        sum=sum%(s.length());
        cout<<s.substr(sum,s.length()-sum)+s.substr(0,sum)<<endl;
    }
}



Measured memory_bytes: 3236
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int lli;
#define MAX 100000
#define endl "\n"
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli A,B;
	cin>>A>>B;
	cout<<A*B<<endl;
}

Measured memory_bytes: 3652
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    int k;
    string s;
    cin>>k>>s;
    if (s.size()<=k)
        cout<<s;
    else
    {
        for (int i=0;i<k;i++)
            cout<<s[i];
        cout<<"...";
    }

}

Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int a,b,c,d[5];
int main(){
	cin>>a>>b>>c;
	d[1]=a+b;
	d[2]=b+c;
	d[3]=a+c;
	sort(d+1,d+4);
	cout<<d[1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int n;
	scanf ("%d", &n);
	int x;
	long long int sum = 0;
	
	for (x = 1; x <= n; x++){
		if (x % 3 != 0 && x % 5 != 0){
			sum += x;
		}
	}
	printf ("%lld\n", sum);
	
	return 0;
}

Measured memory_bytes: 1736
M, D = map(int, input().split())
ans = 0
for i in range(1, M + 1):
    for j in range(1, D + 1):
        d1, d10 = str(j).zfill(2)
        if int(d1) > 1 and int(d10) > 1 and i == int(d1) * int(d10):
            ans += 1
print(ans)


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

void insertSort(int* a , int n ){
	int j , v;
	for(int i=1 ; i<=n-1 ; i++ ){
		v=a[i];
		j = i-1;
		while( j>=0 && a[j]> v){
			a[j+1]=a[j];
			j--;
			a[j+1]=v;
		}
		for(int i=0 ; i < n-1 ; i++){
			cout << a[i] << " ";
		}
		cout << a[n-1] << endl;
	}
	return;
}

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

Measured memory_bytes: 1164
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
import java.util.HashMap;

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
 
        String s = sc.next();

        if(s.equals("ABC")){
            System.out.println("ARC");
        }
        else{
            System.out.println("ABC");
        }
    }
}

Measured memory_bytes: 35636
main=do
    (n:m:_)<-map read.words<$>getLine::IO[Int]
    s<-getLine
    t<-getLine
    print $ solve n m s t
--
solve n m s t = if chk ss tt then l else (-1)
    where
        l = lcm n m
        ss = zip [1,1+l`div`n..] s
        tt = zip [1,1+l`div`m..] t
--
chk (s:ss) [] = True
chk [] (t:tt) = True
chk aa@((a,sa):ss) bb@((b,tb):tt)
    | a < b = chk ss bb
    | a > b = chk aa tt
    | sa == tb = chk ss tt
    | otherwise = False

Measured memory_bytes: 8956
D=int(input())
*c,=map(int,input().split())
s=[]
for i in range(D):
    *x,=map(int,input().split())
    s.append(x)

dt=[]
last=[-1]*26
v=0
for d in range(D):
    news=[s[d][i]+c[i]*(d-last[i])*(d-last[i]-1)//2 for i in range(26)]
    maxi=0
    tmp=-float('inf')
    for i in range(26):
        if tmp<news[i]:
            maxi=i
            tmp=news[i]
    last[maxi]=d
    v+=s[d][maxi]
    for i in range(26):
        v-=c[i]*(d-last[i])
    dt.append(maxi+1)

def score(T):
    last=[-1]*26
    v=0
    for d in range(D):
        v+=s[d][T[d]-1]
        last[T[d]-1]=d
        for i in range(26):
            v-=c[i]*(d-last[i])
    return v

v0=max(score(dt)+10**6,0)

for d in range(0,D,13):
    y=-1
    newdt=dt+[]
    for i in range(26):
        if dt[d]!=i+1:
            newdt[d]=i+1
            v1=max(score(newdt)+10**6,0)
            if v0<v1:
                y=i+1
                v0=v1
    if y!=-1:
        dt[d]=y

for i in dt:
    print(i)

Measured memory_bytes: 74892
#include <bits/stdc++.h>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace std;
const int N=2e5+5,mod=(int)1e9+7;
int a[55]= {},A,nn;
ll dp[55][2505][55]= {};
ll solve(int idx,int sum,int n)
{
    if (idx>=nn)
        return (sum==A*n&&n>0);
    ll &ret=dp[idx][sum][n];
    if (ret!=-1)
        return ret;
    ret=0;
    ret+=solve(idx+1,sum+a[idx],n+1);
    ret+=solve(idx+1,sum,n);
    return ret;
}
int main()
{
#ifdef ONLINE_JUDGE
    FAST;
#endif
    cin>>nn>>A;
    lp(i,0,nn-1) cin>>a[i];
    clr(dp,-1);
    cout<<solve(0,0,0);
    return 0;
}

Measured memory_bytes: 59392
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		String com = "abcdefghijklmnopqrstuvwxyz";
		int num = com.indexOf(s);
		System.out.println(com.charAt(num+1));
	}

}

Measured memory_bytes: 21716
#横にn個入力
h, w = map(int, input().split())
#n...普通、a...横で入力された複数の要素を配列で取得
n = int(input())
a = input().split()
a = [int(m) for m in a]
s = []
for i in range(h):
    s.append([])
v = 0
for i in range(n):
    for j in range(1, a[i] + 1):
        if len(s[v]) < w:
            s[v].append(i + 1)
        else:
            v += 1
            s[v].append(i + 1)

oore=0
for t in s:
    for i in range(len(t)):
        if oore % 2 == 0:
            print(t[i], "", end = '')
        else:
            print(t[-(i + 1)], "", end = '')
        if i == len(t) - 1:
            print()
            oore += 1

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

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<vector<int>> adj(n + 1);
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	vector<int> signpost(n + 1);
	queue<int> que;
	que.push(1);
	while (!que.empty()) {
		int cur = que.front();
		que.pop();
		for (int ne : adj[cur]) {
			if (!signpost[ne] && ne != 1) {
				signpost[ne] = cur;
				que.push(ne);
			}
		}
	}
	cout << "Yes" << '\n';
	for (int i = 2; i <= n; i++) {
		cout << signpost[i] << '\n';
	}
}



Measured memory_bytes: 10284
#include <iostream>
#include <string>
#include <cstring>
#define MAX 100
using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
int mem[MAX][MAX];
int X, Y, num;
string map[MAX];

void dfs(int y, int x, char c) {
	if (x<0||y<0||x>=X||y>=Y) return;//out of range
	if (map[y][x] != c) return;//not explored, but differential char
	if (mem[y][x] != 0) return;//explored
	mem[y][x] = num;
	for (int i=0; i<4; i++)
		dfs(y+dy[i], x+dx[i], c);
}

int main() {
	while (cin >> Y >> X, X||Y) {
		num = 0;
		memset(mem, 0, sizeof(mem));
		for (int i=0; i<Y; i++)
			cin >> map[i];

		for (int y=0; y<Y; y++)
		for (int x=0; x<X; x++) {
			if (mem[y][x] != 0) continue;
			num++;
			dfs(y, x, map[y][x]);
		}

		cout << num << endl;
	}
	return 0;
}

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

signed main(){
  int N,K,X,Y;
  cin>>N>>K>>X>>Y;
  int pay=0;
  if(N<=K)pay=N*X;
  if(N>K)pay=K*X+Y*(N-K);
  cout<<pay<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char x,y,A,B,C,D,E,F;
	scanf("%c %c",&x,&y);
	A=10;
	B=11;
	C=12;
	D=13;
	E=14;
	F=15;
	if(x<y){
		printf("<\n");
	}
	else if(x>y){
		printf(">\n");
	}
	else{
		printf("=\n");
	}
	return 0;
}

		

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

vector<vector<int>> edges;
vector<int> length;
vector<int> active;
vector<int> a;

void dfs(int u, int parent) {
    auto p = lower_bound(active.begin(), active.end(), a[u]);
    bool back = false;
    int prev = 0;
    if (p == active.end()) {
        active.push_back(a[u]);
        back = true;
    } else {
        prev = *p;
        *p = a[u];
    }
    length[u] = active.size();
    for (int v: edges[u]) {
        if (v != parent) {
            dfs(v, u);
        }
    }
    if (back) {
        active.pop_back();
    } else {
        *p = prev;
    }
}
int main() {
    int n;
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    edges.resize(n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        edges[u - 1].push_back(v - 1);
        edges[v - 1].push_back(u - 1);
    }
    length.resize(n);
    active.reserve(n); // this is an important line!!!! RE or WA
    dfs(0, -1);
    for (int x: length) {
        cout << x << "\n";
    }
    return 0;
}


Measured memory_bytes: 29656
#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int a;
	for (int i=0; i<n; i++){
		cin >> a;
		if (a % 2 == 0){
			if ( (a % 3 != 0) && (a % 5 != 0) ) {
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
	return 0;
}


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

int main() {
   int n,r;
   cin>>n>>r;
   if(n>=10){
       cout<<r<<endl;
   }
   else{
       cout<<r+100*(10-n)<<endl;
   }
    return 0;
}




Measured memory_bytes: 256
while(True):
  t = list(input())
  if t == ["-"]:
    break
  m = int(input())
  for i in range(m):
    h = int(input())
    for j in range(h):
      t.append(t[j])
    for j in range(h):
      del t[0]
  for i in t:
    print(i, end="")
  print("")


Measured memory_bytes: 5628
#include "bits/stdc++.h"
using namespace std;
struct valt{
	long long p0, p1, sum1, mdiff;
	valt(){
		p0 = 0;
		p1 = 0;
		sum1 = 0;
		mdiff = 0;
	}
	valt(long long a, long long b){
		p0 = a; p1 = b;
		sum1 = p1;
		mdiff = p1 - p0;
	}
	valt operator + (valt other){
		valt ans;
		ans.sum1 = sum1 + other.sum1;
		ans.mdiff = max(mdiff, other.mdiff);
		return ans;
	}
};
const int delta = 2;
struct tree{
	long long values[delta];
	long long sum1;
	void add(valt a){
		sum1 += a.sum1;
		for(int e = 0; e < delta; e++){
			if(a.mdiff > values[e]){
				for(int f = delta-1; f > e; f--){
					values[f] = values[f-1];
				}
				values[e] = a.mdiff;
				break;
			}
		}
	}
	void rem(valt a){
		sum1 -= a.sum1;
		for(int e = 0; e < delta; e++){
			if(a.mdiff == values[e]){
				for(int f = e; f < delta-1; f++){
					values[f] = values[f+1];
				}
				values[delta-1] = 0;
				break;
			}
		}
	}
	valt getFull(){
		valt ans;
		ans.sum1 = sum1;
		ans.mdiff = values[0];
		return ans;
	}
};
const int maxn = 100100;
vector<int> tr[maxn];
tree mtree[maxn];
char s[maxn];
int ty[maxn], ms[maxn];
long long d[2][maxn];
int len[maxn];
void add(int cur, valt val){
	mtree[cur].add(val);
}
void rem(int cur, valt val){
	mtree[cur].rem(val);
}
void calc(int cur, int par, int sons){
	int ru = par != -1;
	int letdown = max(sons - 1, 0);
	valt incur = mtree[cur].getFull();
	d[0][cur] = sons + letdown + incur.sum1 - incur.mdiff + ((ty[cur] + letdown + ru)%2);
	d[1][cur] = 2 * sons + incur.sum1 + ((ty[cur] + sons + ru)%2);
}
void solve(int cur, int par){
	int sons = 0;
	for(int nxt : tr[cur]){
		if(nxt == par || ms[nxt]) continue;
		solve(nxt, cur);
		valt pnxt = valt(d[0][nxt], d[1][nxt]);
		add(cur, pnxt);
		sons++;
	}
	calc(cur, par, sons);
}
void fix(int cur, int par){
	if(par != -1){
		valt before = valt(d[0][cur], d[1][cur]);

		rem(par, before);
		calc(par, cur, len[par] - 1);

		add(cur, valt(d[0][par], d[1][par]));
		calc(cur, -1, len[cur]);

		add(par, before);

		calc(par, -1, len[par]);
	}
	for(int nxt : tr[cur]){
		if(nxt == par || ms[nxt]) continue;
		fix(nxt, cur);
	}
}
int deg[maxn];
int main(){
	int n;
	scanf("%d", &n);
	for(int e = 0; e < n - 1; e++){
		int x, y; scanf("%d %d", &x, &y); x--; y--;
		tr[x].push_back(y);
		tr[y].push_back(x);
		deg[x]++; deg[y]++;
	}
	scanf("%s", s);
	for(int e = 0; e < n; e++) ty[e] = s[e] == 'W';
	queue<int> q;
	for(int e = 0; e < n; e++) if(deg[e] == 1 && ty[e] == 0) q.push(e);
	while(!q.empty()){
		int u = q.front(); q.pop();
		ms[u] = 1;
		for(int v : tr[u]){
			if(ms[v]) continue;
			deg[v]--;
			if(deg[v] == 1 && ty[v] == 0) q.push(v);
		}
		tr[u].clear();
	}
	int pk = 0;
	while(pk < n && ms[pk]) pk++;
	if(pk == n){
		cout << 0 << endl;
		return 0;
	}
	for(int e = 0; e < n; e++) if(!ms[e]) for(int v : tr[e]) if(!ms[v]) len[e]++;
	solve(pk, -1);
	fix(pk, -1);
	long long ans = 1ll<<60;
	for(int e = 0; e < n; e++) if(!ms[e]) ans = min(ans, d[0][e]);
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 18176
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	int a,b,c;
	cin >> a;
	cin >> b;
	
	c = a-b;
	if (c < 0){
		printf("0");
	}
	else{
		printf("%d", c);
	}
	

	return 0;
}

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

long long n, k, m = 1;
const long long M = 1e9 + 7;
long long a[200000];

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

	for (int i = 0; i < n; i++)
		cin >> a[i];

	sort(a, a + n);

	if (a[n - 1] <= 0 && k % 2 == 1) {
		for (int i = 0; i < k; i++)
			m = m * (a[n - 1 - i] + M) % M;
	}
	else {
		int i = 0, j = 0, l = n - 1;

		while (i < k) {
			if (i == k - 1 || a[j] * a[j + 1] < a[l] * a[l - 1]) {
				m = m * a[l] % M;
				l--;
				i++;
			}
			else {
				m = m * (a[j] + M) % M * (a[j + 1] + M) % M;
				j += 2;
				i += 2;
			}
		}
	}

	cout << m << endl;
}


Measured memory_bytes: 5152
#include<bits/stdc++.h>
using namespace std;
int n,z,d,x;
string s;
int main(){
    cin>>n;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(z==0&&s[i]=='I'){
        	z=1;
		}
        if(s[i]=='I'){
        	x++;
		}
        if(z==1&&s[i]=='D'){
        	z=0;
        	if(x>d){
        		d=x;
			}
        }
        if(s[i]=='D'){
        	x--;
		}
    }
    if(x>d){
    	d=x;
	}
    cout<<d<<endl;
    return 0;
}

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

int sum(int data[], int n) {
    int total = 0;  
    for(int i = 0; i < n; ++i) {
        total += data[i];
    }  
    return total;
}

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

  char A[N], B[N], C[N];
  int arsum[N];

  for (int i = 0; i < N; ++i) { cin >> A[i]; }
  for (int i = 0; i < N; ++i) { cin >> B[i]; }
  for (int i = 0; i < N; ++i) { cin >> C[i]; }

  for (int i = 0; i < N; ++i) {
    if (A[i] == B[i] && B[i] == C[i]) { arsum[i] = 0; continue; }
    else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) { arsum[i] = 1; continue; }
    else { arsum[i] = 2; }
  }

  cout << sum(arsum, N) << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
X = list(map(int, input().split()))

Xp = [0]+[+x for x in X if x>=0]
Xm = [0]+[-x for x in reversed(X) if x< 0]

Np = len(Xp)-1
Nm = len(Xm)-1

ans = 10**10
for np in range(min(Np, K), max(0, K-Nm)-1, -1):
    nm = K-np
    time = min(Xp[np], Xm[nm]) + Xp[np] + Xm[nm]
    ans = min(ans, time)

print(ans)

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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (int i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (int i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
ll ans;
int cur;

int main () {               
    cin >> s;
    for (int i = 0 ;i < s.size(); i ++) {
    	if (s[i] == 'B') cur ++;
    	else ans += cur;
    }

    cout << ans;
    return Accepted;
}

// Coded By OB

Measured memory_bytes: 19072
#include <iostream>
#include<stdio.h>
using namespace std;

int main() {
double a,b,c,d,e,f,x,y;
while(cin>>a>>b>>c>>d>>e>>f){
	
 x = (double)((e*c-b*f) / (a*e-b*d));
  y = (double)((-(d*c)+a*f) / (a*e-b*d));
  if(x == 0){x = 0;}
  if(y == 0){y = 0;}
  printf("%.3f %.3f\n",x,y);
}
	return 0;
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n;
    cin >> n;
    cout << 2*n*M_PI << endl;
    return 0;
}


Measured memory_bytes: 3784
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}


const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    ll a, b, x;
    cin >> a >> b >> x;

    ll ans;
    if (a == 0){
        ans = b/x + 1;
    }
    else {
        ans = b/x - (a-1)/x;
    }

    cout << ans << endl;

}





//              g++ -std=c++1z


Measured memory_bytes: 256
S = input()
T = input()

ans=len(T)

itti=0
for i in range(len(S)-len(T)+1):
    cnt=0
    for j in range(i,i+len(T)):
        if S[j]==T[j-i]:
            cnt+=1
    itti = max(itti,cnt)

print(len(T)-itti)


Measured memory_bytes: 9108
#include<stdio.h>
#include<math.h>
int Sosu(int N){
  int i=3;
if(N==2)return 1;
if(N<2 || N%2==0)return 0;
while(i<=sqrt(N)){
  if(N%i==0)return 0;
  i=i+2;
}
return 1;
}
int main(void){
int N;
int n,i;
int S=0;
while(1){
scanf("%d",&n);
if(n>=1 && n<=10000)break;
}
for(i=0 ; i<n ; i++){
  while(1){
  scanf("%d",&N);
  if(N>=2 && N<=100000000)break;
  }
  S+=Sosu(N);
}
printf("%d\n",S);
return 0;
}


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

int main(){
	int S = 0;
	int h=0, m=0, s=0;
	cin >> S;
	h = S/3600; 
	m = (S - h*3600 ) / 60;
	s = S - h*3600 - m*60;
	cout  << h << ":" << m << ":" << s << endl;

	return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n){
        cin>>a;
        if(a%2==0)ans++;
    }
    Cout(ans);
    return 0;
}



Measured memory_bytes: 3208
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)
int H, A[MAX+1];

void maxHeapify(int i)
{
    int left = i * 2,
        right = i * 2 + 1,
        largest;
    if ( left <= H && A[left] > A[i] ) largest = left;
    else largest = i;
    if ( right <= H && A[right] > A[largest] ) largest = right;

    if ( largest != i ) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

void increaseKey(int i, int key)
{
    if ( key < A[i] ) return;
    A[i] = key;
    while ( i > 1 && A[i / 2] < A[i] ) {
        swap(A[i], A[i / 2]); // i / 2 is the parent of i.
        i /= 2;
    }
}

int Extract()
{
    int maxv;
    if ( H < 1 ) return -INFTY; // return a infinity which is an error when the size of heap is smaller than 1.
    maxv = A[1];
    A[1] = A[H--];
    maxHeapify(1);
    return maxv;
}
void Insert(int k)
{
    H++;
    A[H] = -INFTY;
    increaseKey(H, k);
}
int main(void)
{
    char command[10];
    int k;
    while ( 1 ) {
        scanf("%s", command);
        if (command[0] == 'e' && command[1] == 'n') break;
        if (command[0] == 'i' ) {
            scanf("%d", &k);
            Insert(k);
        } else {
            printf("%d\n", Extract());
        }
    }
    return 0;
}



Measured memory_bytes: 6600