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

int N, M, X;
std::vector<int> C;
std::vector<std::vector<int>> A;
std::vector<int> proficiency;
int min_cost;

int main() {
  std::cin >> N >> M >> X;
  C.assign(N, 0);
  A.assign(N, std::vector<int>(M, 0));
  for (int i = 0; i < N; i++) {
    std::cin >> C[i];
    for (int j = 0; j < M; j++) {
      std::cin >> A[i][j];
    }
  }
  int count = 0;
  for (int bit_sequence = 0; bit_sequence < (1<<N); bit_sequence++) {
    int amount_price = 0;
    proficiency.assign(M, 0);
    bool is_ok = true;
    for (int i = 0; i < N; i++) {
      if (bit_sequence & (1<<i)) {
        amount_price += C[i];
        for (int j = 0; j < M; j++) {
          proficiency[j] += A[i][j];
        }
      }
    }
    for (int j = 0; j < M; j++) {
      if (proficiency[j] < X) {
        is_ok = false;
        break;
      }
    }
    if (is_ok) {
      if (count == 0) {
        min_cost = amount_price;
        ++count;
      }
      min_cost = std::min(min_cost, amount_price);
    }
  }
  std::cout << (min_cost ? min_cost : -1) << std::endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>

using namespace std;

int main() {
  string S;
  cin >> S;
  const char* result = "No";
  if ((S[2] == S[3]) && (S[4] == S[5])) {
    result = "Yes";
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    map<int, int> mp;
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]] ++;
    }
    for(auto p: mp) {
        sum += p.sc * (p.sc - 1) / 2;
    }
    rep(i, n) {
        cout << sum - mp[a[i]] * (mp[a[i]] - 1) / 2 + (mp[a[i]] - 1) * (mp[a[i]] - 2) / 2 << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 11136
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N, x;
    cin >> N >> x;

    vector<int> a(N);
    vector<int> mina(N);

    REP(i, N) {
        cin >> a[i];
        mina[i] = INF;
    }

    a.insert(a.end(), a.begin(), a.end());

    int ans = INF;
    REP(k, N) {
        int tmp = k * x;
        REP(i, N) {
            int t = N + i;
            mina[i] = min(mina[i], a[t - k]);
            tmp += mina[i];
        }
        ans = min(tmp, ans);
    }
    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int k;
	string s;
	cin >> k >> s;

	if (s.length() <= k) {
		cout << s << endl;
	}
	else {
		s = s.substr(0, k);
		s += "...";
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace std;
#define ll long long int
#define ld long double
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,
tree_order_statistics_node_update> in_set;
#define rep(n) for(ll i=0;i<(n);i++)
#define jrep(n) for(ll j=0;j<(n);j++)
#define all(a) (a).begin(), (a).end()
#define dpp(a) cout<<(a).first<<" "<<(a).second<<endl;
#define append push_back
#define mod 1000000007
#define ff first
#define ss second
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fast ios::sync_with_stdio(0);
ll pw(ll x,ll y,ll p=mod){ll r=1; x=x%p;while(y>0){ if(y&1)r=(r*x)%p;
y=y>>1;x=(x*x)%p;} return r; } vector<ll> uniq(vector<ll> arr)
{vector<ll>brr;sort(all(arr));brr.append(arr[0]);
for(auto i:arr)if(brr.back()!=i)brr.append(i);return brr;}
 
void solve(){
    ll a,b; cin>>a>>b;
    cout<<(a+b-1)/b<<endl;
}
 
int main(){
    ffast
    ll t=1;
    //cin>>t;
    rep(t) solve();
}
 
 
// *p.find_by_order(n) : nth value (0 indexed)
// p.order_of_key(7): index of 7 (0 indexed)


Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>

long long PRIME = 1e9 + 7;
using namespace std;


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

    int count = 0;
    int num = 1;

    for(int i = 0; i < N; ++i){
        long long a;
        cin >> a;

        if(a == num){
            num += 1;
        }
        else{
            ++count;
        }
    }

    if(count == N){
        cout << -1;
    }
    else{
        cout << count;
    }

}



Measured memory_bytes: 256
import queue

q = [1]
N, M = map(int, input().split())

ans = [-1 for i in range(N+1)]
path = [[] for i in range(N+1)]

for i in range(M):
  A, B = map(int, input().split())
  path[A].append(B)
  path[B].append(A)
COUNTER = 0
while len(q)>0 :
  now = q.pop(0)
  for p in path[now]:
    if ans[p]==-1:
      ans[p]=now
      q.append(p)
      #print(COUNTER, now,p)
      COUNTER+=1
      
print("Yes")
for i in ans[2:]:
  print(i)


Measured memory_bytes: 35196
// https://atcoder.jp/contests/diverta2019/tasks/diverta2019_e
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#define PB push_back
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
    x=0; char c=getchar(); int f=1;
    while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
    while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int mod=1e9+7,N=5e5+10;
void Add(int &x,int y) { x+=y; if(x>=mod) x-=mod; }
int f[2][N],a[N],n;
vector<int> b[1<<20];
int buc[N];
int dp[N],s1[N],s2[N];
int solve(vector<int> &p) {
    int m=p.size()-1,ans=0;
    for(int i=0;i<=m;++i) dp[i]=s1[i]=s2[i]=0;
    for(int i=1;i<=m;++i) {
        dp[i]=((buc[p[i]]*(ll)s1[i-1]-s2[i-1]+1)%mod+mod)%mod;
        s1[i]=(s1[i-1]+dp[i])%mod;
        s2[i]=(s2[i-1]+dp[i]*(ll)buc[p[i]]%mod)%mod;
        Add(ans,dp[i]);
    }
    return ans;
}
int main() {
    rd(n);
    for(int i=1;i<=n;++i) rd(a[i]),a[i]^=a[i-1];
    int ans=0;
    if(a[n]) {
        f[0][0]=1;
        for(int i=1;i<=n;++i) {
            f[0][i]=f[0][i-1];
            f[1][i]=f[1][i-1];
            if(a[i]==a[n]) Add(f[1][i],f[0][i-1]);
            if(a[i]==0) Add(f[0][i],f[1][i-1]);
        }
        ans=f[0][n-1];
    }
    else {
        for(int i=1;i<=n;++i) buc[i]=buc[i-1]+(a[i]==0);
        for(int i=0;i<(1<<20);++i) b[i].PB(0);
        for(int i=1;i<=n;++i)
            if(a[i]) b[a[i]].PB(i);
        for(int i=0;i<(1<<20);++i)
            if(b[i].size()>1) Add(ans,solve(b[i]));
        int t=1;
        for(int i=1;i<buc[n];++i) t=t*2ll%mod;
        Add(ans,t);
    }
    printf("%d",ans);
    return 0;
}

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


using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	long sum = 0;
	for (int i : v) {
		sum += i;
	}
	cout << sum - N << "\n";
}

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

int main(){
  int X;
  cin >>X;
    if(400<=X && X<=599){
    cout<<"8"<<endl;
    }
  else if(600<=X && X<=799){
    cout<<"7"<<endl;
    }
  else if(800<=X && X<=999){
    cout<<"6"<<endl;
    }
    else if(1000<=X && X<=1199){
    cout<<"5"<<endl;
    }
    else if(1200<=X && X<=1399){
    cout<<"4"<<endl;
    }
    else if(1400<=X && X<=1599){
    cout<<"3"<<endl;
    }
    else if(1600<=X && X<=1799){
    cout<<"2"<<endl;
    }
    else if(1800<=X && X<=1999){
    cout<<"1"<<endl;
    }
}

Measured memory_bytes: 3648
#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() {
	string n; cin >> n;
	if (n[0] == '7' || n[1] == '7' || n[2] == '7') cout << "Yes" << endl;
	else cout << "No" << endl;
	return;
}

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

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pipipii = pair<ll, pair<int, pii>>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

constexpr int n = 2'000;

int u[n][n], d[n][n], l[n][n], r[n][n];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; ++i){
        cin >> s[i];
    }
    for(int i = 0; i < h; ++i){
        for(int j = 1; j < w; ++j){
            if(s[i][j] == '.') l[i][j] = l[i][j-1] + (s[i][j-1] == '.');
            else l[i][j] = 0;
        }
        for(int j = w - 2; j >= 0; --j){
            if(s[i][j] == '.') r[i][j] = r[i][j+1] + (s[i][j+1] == '.');
            else r[i][j] = 0;
        }
    }
    for(int j = 0; j < w; ++j){
        for(int i = 1; i < h; ++i){
            if(s[i][j] == '.') u[i][j] = u[i-1][j] + (s[i-1][j] == '.');
            else u[i][j] = 0;
        }
        for(int i = h - 2; i >= 0; --i){
            if(s[i][j] == '.') d[i][j] = d[i+1][j] + (s[i+1][j] == '.');
            else d[i][j] = 0;
        }
    }
    int ans = 0;
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            ans = max(ans, u[i][j]+d[i][j]+l[i][j]+r[i][j]+1);
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 67072
#include <cstdio> //{{{
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>

#define ALL(c) (c).begin(), (c).end()
#define DUMP(x) std::cerr << #x << ':' << (x) << '\n';

typedef long long ll;

inline int in(){int x;scanf("%d",&x);return x;}
template<typename T, typename U>inline bool chmax(T&x,U a){if(x>=a)return 0;x=a;return 1;}
template<typename T, typename U>inline bool chmin(T&x,U a){if(x<=a)return 0;x=a;return 1;}
//}}}

#include <cassert>
#include <queue>

using namespace std;

using Col = vector<ll>;
using Mat = vector<Col>;

Mat mulMat(const Mat& x, const Mat& y) {
  const int XR = x.size(), XC = x[0].size(), YR = y.size(), YC = y[0].size();
  assert(XC == YR);
  Mat r(XR, Col(YC));
  for (int i = 0; i < XR; i++){
    for (int k = 0; k < XC; k++) {
      for (int j = 0; j < YC; j++) {
        r[i][j] += x[i][k] * y[k][j];
      }
    }
  }
  return r;
}
void binarize(Mat& x, ll thresh=1) {
  for (auto& c : x) {
    for (auto& v : c) {
      v = v >= thresh;
    }
  }
}
void mulMat_(Mat& x, const Mat& y) { x = mulMat(x, y); }

int main()
{
  int N = in(), M = in(), A = in() - 1, B = in() - 1, C = in() - 1;
  Mat adj(N, Col(N));
  for (int i = 0; i < M; i++) {
    int s = in() - 1, t = in() - 1;
    adj[t][s] = 1;
  }
  Mat adjA, adjB, adjC;
  adjA = adjB = adjC = adj;
  for (int i = 0; i < A; i++) mulMat_(adjA, adj), binarize(adjA);
  for (int i = 0; i < B; i++) mulMat_(adjB, adj), binarize(adjB);
  for (int i = 0; i < C; i++) mulMat_(adjC, adj), binarize(adjC);

  vector<int> shortest(N, 1 << 29);
  queue<int> Q;
  Q.push(N - 1);
  shortest[N - 1] = 0;
  int step = 0;
  vector<int> able(N);
  while (Q.size()) {
    step++;

    while (Q.size()) {
      int p = Q.front();
      Q.pop();
      Mat pos(1, Col(N));
      pos[0][p] = 1;
      auto pa = mulMat(pos, adjA);
      auto pb = mulMat(pos, adjB);
      auto pc = mulMat(pos, adjC);
      for (int i = 0; i < N; i++) {
        able[i] |= !!pa[0][i] << 0;
        able[i] |= !!pb[0][i] << 1;
        able[i] |= !!pc[0][i] << 2;
      }
    }
    for (int i = 0; i < N; i++) {
      if (able[i] == 7) {
        if (chmin(shortest[i], step)) Q.push(i);
      }
    }
  }
  if (shortest[0] > N) {
    puts("IMPOSSIBLE");
  }
  else {
    cout << shortest[0] << endl;
  }
  return 0;
}

Measured memory_bytes: 3324
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
#define deb(x) each(x.begin(),x.end(),(int& y){cout << y <<" ";})
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
#define EPS 1e(-9);
using namespace std;
typedef long long ll;

void Main(){

  int N; cin>>N;
  
  double xx[N],yy[N];
  char d[N];

  rep(i,N){
    cin>>xx[i]>>yy[i]>>d[i];
  }

  bool xst=false,yst=false,xad=false,yad=false,xsu=false,ysu=false;
  double x[6]; // stma,stmi,adma,admi,suma,sumi
  double y[6]; // stma,stmi,adma,admi,suma,sumi
  x[0]=x[2]=x[4]=y[0]=y[2]=y[4]=-INF;
  x[1]=x[3]=x[5]=y[1]=y[3]=y[5]=INF;

  rep(i,N){
    if(d[i]=='R'){
      xad=true;
      yst=true;
      maxi(x[2],xx[i]);
      mini(x[3],xx[i]);
      maxi(y[0],yy[i]);
      mini(y[1],yy[i]);
    }
    if(d[i]=='L'){
      xsu=true;
      yst=true;
      maxi(x[4],xx[i]);
      mini(x[5],xx[i]);
      maxi(y[0],yy[i]);
      mini(y[1],yy[i]);
    }
    if(d[i]=='U'){
      xst=true;
      yad=true;
      maxi(x[0],xx[i]);
      mini(x[1],xx[i]);
      maxi(y[2],yy[i]);
      mini(y[3],yy[i]);
    }
    if(d[i]=='D'){
      xst=true;
      ysu=true;
      maxi(x[0],xx[i]);
      mini(x[1],xx[i]);
      maxi(y[4],yy[i]);
      mini(y[5],yy[i]);
    }
  }

  vector<double> time;

  time.emplace_back(0);

  if(xad and xst){
    time.emplace_back(x[0]-x[2]); time.emplace_back(x[1]-x[3]);
  }
  if(xsu and xst){
    time.emplace_back(x[4]-x[0]); time.emplace_back(x[5]-x[1]);
  }
  if(xad and xsu){
    time.emplace_back((x[4]-x[2])/2); time.emplace_back((x[5]-x[3])/2);
  }

  if(yad and yst){
    time.emplace_back(y[0]-y[2]); time.emplace_back(y[1]-y[3]);
  }
  if(ysu and yst){
    time.emplace_back(y[4]-y[0]); time.emplace_back(y[5]-y[1]);
  }
  if(yad and ysu){
    time.emplace_back((y[4]-y[2])/2); time.emplace_back((y[5]-y[3])/2);
  }

  double ans=INF2;

  rep(i,time.size()){

    if(time[i]<0) continue;

    double minx=INF,maxx=-INF,miny=INF,maxy=-INF;

    if(xst){
      maxi(maxx,x[0]); mini(minx,x[1]);
    }
    if(xad){
      maxi(maxx,x[2]+time[i]); mini(minx,x[3]+time[i]);
    }
    if(xsu){
      maxi(maxx,x[4]-time[i]); mini(minx,x[5]-time[i]);
    }
    if(yst){
      maxi(maxy,y[0]); mini(miny,y[1]);
    }
    if(yad){
      maxi(maxy,y[2]+time[i]); mini(miny,y[3]+time[i]);
    }
    if(ysu){
      maxi(maxy,y[4]-time[i]); mini(miny,y[5]-time[i]);
    }

    mini(ans,(maxx-minx)*(maxy-miny));
  }

  cout<< ans <<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 1920
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;

inline bool cheak(ll x, ll y, ll xMax, ll yMax){ return x >= 0 && y >= 0 && xMax > x && yMax > y; }
inline ll toInt(string s) { ll v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }

#define For(i,a,b)	for(ll (i) = (a);i < (b);(i)++)
#define rep(i,n)	For(i,0,n)
#define rFor(i,a,b)	for(ll (i) = (a-1);i >= (b);(i)--)
#define rrep(i,n)	rFor(i,n,0)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll INF = 1e9 + 9;

const ll dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 };

int main(){

	int n;
	cin >> n;

	vector<P> v(n);

	rep(i, n){
		cin >> v[i].second >> v[i].first;
	}

	sort(all(v));
	bool f[200];
	clr(f);
	
	int ans = 0;
	For(i, 1, 32){

		ans += 50;
		rep(j, n){
			if (v[j].second <= i && v[j].first >= i){
				if (f[j] == false){
					f[j] = true;
					ans += 50; break;
				}
			}
		}

	}
	cout << ans << endl;

	return 0;
}

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

int main()
{
    int n; cin>>n;
    int res=0;
    for(int i=1; i<=n; i+=2) {
        int c=0;
        for(int j=1; j<=i; ++j) if (i%j==0) ++c;
        if (c==8) ++res;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
#define int LL
signed main()
{
	int n;
	cin>>n;
	vec a(n);
	rep(i,0,n)cin>>a[i];
	sort(all(a));
	int Min=INFLL,ans=-1;
	rep(i,0,n-1)
	{
		if(abs(a.back()-a[i]*2)<Min)
		{
			Min=abs(a.back()-a[i]*2);
			ans=a[i];
		}
	}
	cout<<a.back()<<" "<<ans<<endl;
	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define forn(i, z, n) for(int i = z; i < n; ++i)
using namespace std;

typedef long long int ll;

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> ns(n);
	for(ll &i : ns) cin >> i;

	vector<int> prv(n);
	forn(i, 0, n) {
		ll p = i-1;
		while(p != -1 && ns[p] < ns[i]) p = prv[p];
		prv[i] = p;
	}

	vector<int> nxt(n);
	forn(j, 0, n) {
		ll i = n-j-1;
		ll p = i+1;
		while(p != n && ns[p] > ns[i]) p = nxt[p];
		nxt[i] = p;
	}

	ll total = 0;
	ll grow = 0;
	vector<bool> inc(n);
	forn(i, 0, n) {
		if(i > 0 && ns[i-1] < ns[i]) grow++;
		else grow = 1;
		if(grow >= k) {
			total = 1;
			inc[i] = true;
		}
	}

	forn(i, k-1, n) {
		if(inc[i]) continue;
		if(i == k-1) {
			total++;
			continue;
		}
		if(i - prv[i] >= k && nxt[i-k] - (i-k) >= k) continue;
		total++;
	}
	cout << total << endl;
}

Measured memory_bytes: 3456
N = int(input())
A = map(int,input().split())

B = []
for i,a in enumerate(A):
    B.append(a-(i+1))
B.sort()
C = B[N//2-1:N//2+2]

MIN = 10**18
for j in C:
    ans = 0
    for i in B:
        ans += abs(i-j)

    MIN = min(ans,MIN)

print(MIN)

Measured memory_bytes: 26836
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<chrono>
#include<typeinfo>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds; 
#define lli long long int
#define fr(i,a,b) for(lli i=a;i<b;i++)
#define bfr(i,a,b) for(lli i=a;i>=b;i--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
#define tc int t;cin>>t;while(t--)
#define mod 1000000007LL
#define mod2 998244353LL
#define all(vec) vec.begin(),vec.end()  
#define ld long double
#define pb push_back
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 
lli pmod(lli x,lli y){lli res=1;while(y>0){if(y&1)res = ((res%mod)*(x%mod))%mod;y>>=1;x= ((x%mod)*(x%mod))%mod;}return res;} 
lli power(lli x,lli y){lli res=1;while(y>0){if(y&1)res=res*x;y>>=1;x=x*x;}return res;}

int main()
{
   
         

    fio
    
    string b="ACL";
    lli n;
    cin>>n;
    fr(i,0,n)cout<<b;
    

   






  
     

    


     

     


    
      




 

return 0;}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	long long A,B,c,l1=0,l2=0,l3=0,i,ans=0;
	cin >> A;
	vector<long long>s(A);
	for (i = 0;i < A;i++) {cin >> s[i]; l1+=s[i];}
    for (i = 0;i < A;i++) {
      l2+=s[i];
      if(l2>=l1/2){l3=l2-s[i];break;}
    }
    ans=min(abs(l1-l2*2),abs(l1-l3*2));
    cout<<ans<<endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> arr_h(n);
  for(int i = 0; i < n; i++) {
    cin >> arr_h.at(i);
  }

  int ret = 0, prev = -1, m = 0;
  for(int i = 0; i < n; i++) {
    if(prev >= arr_h.at(i)) {
      ret++;
      if(i == n - 1 && m < ret) {
        m = ret;
      }
    } else {
      if(m < ret) {
        m = ret;
      }
      ret = 0;
    }
    prev = arr_h.at(i);
  }
  cout << m << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <deque>
#include <set>
#include <unordered_map>
#include <complex>
#include <fstream>
using namespace std;
using ll = long long;
using ld = long double;
const int mxn = 22;
int a[mxn], b[mxn], c[mxn];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int ans = 0;

	int n; cin>>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-1; i++) cin>>c[i];

	int prev = -1;
	for(int i=0; i<n; i++) {
		int d = a[i];
		ans+=b[d-1];
		if(d-1==prev) ans+=c[prev-1];
		prev = d;
	}

	cout << ans << '\n';


	
	return 0;
}

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

typedef long long int LLI;

int n;
LLI debt = 100000;

int main() {
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    debt = debt/100*105;
    if (debt % 1000) debt = (debt/1000+1)*1000;
  }
  printf("%lld\n", debt);
}

Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
int f(int x){
    int res=0;
    while(x){
        res+=x%10;
        x/=10;
    }
    return res;
}
const int N=1e5;
int solve(int n){
    while(n%2==0)n/=2;
    while(n%5==0)n/=5;
    int ff=f(n);
    int ans=ff;
    if(n==1)return 1;
    // if(ff%9){
        int t=1;
        bitset<N+N> u,dp,ndp;
        forn(i,n){
            u[t]=1;
            (t*=10)%=n;
        }
        if(u[n-1]){
            upn(ans,2);
        }else{
            dp=u;
            for(int r=3;r<=20;++r){
                ndp.reset();
                forn(i,n){
                    if(u[i]){
                        ndp|=dp<<i;
                    }
                }
                ndp|=ndp>>n;
                for(int i=n;i<n+n;++i)ndp.reset(i);
                dp=ndp;
                if(dp[n-1]){
                    upn(ans,r);
                    break;
                }
            }
        }
    // }
    return ans;
}
int32_t main(){
    int n;
    cin>>n;
    cout<<solve(n)<<'\n';
    return 0;
}

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

int main()
{
  int H, W;
  cin >> H >> W;

  while( H != 0 or W != 0 ) {
    string block = "";
    for( int i = 0; i < H; i++ ) {
      for( int j = 0; j < W; j++ ) {
        block = ".";
        if( i == 0 or i == H - 1 ) {
          block = "#";
        }
        if( j == 0 or j == W - 1 ) {
          block = "#";
        }
        cout << block;
      }
      cout << endl;
    }
    cout << endl;

    cin >> H >> W;
  }

  return 0;
}

Measured memory_bytes: 3148
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        int n=sc.nextInt();
        int b[] = new int[n];
        long ans=0, m=0;


        for(int i=0; i<n; i++) {
            b[i] = sc.nextInt();
            if(b[i]==0){ans+=m/2; m=0;}
            else {m+=b[i];}
        }
        ans+=m/2;


        out.println(ans);
        out.flush();
    }



    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    }

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 36520
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <unordered_map>
#include <unordered_set>
int main() {
	int n; std::cin >> n;
	std::vector<int>num(n);
	for (auto& a : num) std::cin >> a;
	for (auto i = 0; i < 31; ++i) {
		auto d = (1 << i);
		int zero = 0;
		int one = 0;
		int zero_elem = 0;
		for (const auto& a : num) {
			if ((a & d) == 0) {
				++zero;
				zero_elem = a;
			}
			else ++one;
		}
		if (one != 0) {
			if (one != zero * 2) {
				std::cout << "No\n";
				return 0;
			}

			for (const auto& a : num) {
				if ((a & d) == 0) {
					if ((a % d) != (zero_elem % d)) {
						std::cout << "No\n";
						return 0;
					}
				}
			}
		}
	}
	std::cout << "Yes\n";
}


Measured memory_bytes: 640
/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!		                
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	lli n,m,i;
	cin>>n>>m;
	map<lli,lli> fre;
	set <lli> ms;
	set <lli> :: iterator it;
	L(i,1,n)
	{
		lli val;
		cin>>val;
		ms.insert(val);
		fre[val]++;
	}
	lli v1,v2;
	L(i,1,m)
	{
		cin>>v1>>v2;
		while(v1)
		{
			if((*ms.begin())<v2)
			{
				if(fre[*ms.begin()]<=v1)
				{
					lli val=(*ms.begin());
					lli fr=fre[val];
					fre.erase(val);
					ms.erase(ms.begin());
					ms.insert(v2);
					fre[v2]+=fr;
					v1-=fr;
				}
				else
				{
					fre[*ms.begin()]-=v1;
					ms.insert(v2);
					fre[v2]+=v1;
					v1=0;
				}
			}
			else
				break;
		}
	}
	lli sum=0;
	for(it=ms.begin();it!=ms.end();it++)
	{
		sum+=((*it)*fre[*it]);
	}
	cout<<sum<<endl;
//##########################################################
	return 0;
} 

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

int main(){
  int K,S;
  int ans=0;
  cin >> K >>S;
  for(int i=0;i<=K;i++){
    for(int j=0;(j<=K) && (i+j<=S);j++){
      if(S-(i+j)<=K) ans++;
    }
  }
  cout << ans<<endl;
}
  

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  string s;
  cin >> s;

  cout << (s[0] == s[2] ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int d[N];
vector<pair<int,int> >v[N];
int n;
int ans[N];
void dfs(int now,int pre,int sat){
    int x=0;
    for(auto k:v[now]){
        if(k.fi==pre)continue;

        ++x;

        if(x==sat)x++;
        ans[k.se]=x;
        dfs(k.fi,now,x);
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin>>n;int M=0;
    for(int i=1;i<n;i++){
        int s,t;
        cin>>s>>t;
        v[s].pb({t,i});
        v[t].pb({s,i});
        d[s]++;
        d[t]++;
        M=max(M,d[s]);
        M=max(M,d[t]);
    }
    cout<<M<<endl;
    dfs(1,0,0);
    for(int i=1;i<n;i++)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 11392
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);
//const ll mod = 998244353;

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

int main(void)
{
    long long x;
    cin >> x;
    cout << x/11*2 + (x%11 + 5)/6  << endl;
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	int sum = 0,min_KI = BIG_NUM,tmp;

	scanf("%d",&N);

	for(int loop = 0; loop < N; loop++){

		scanf("%d",&tmp);
		sum += tmp;

		if(tmp%2 == 1){
			min_KI = min(min_KI,tmp);
		}
	}

	if(sum%2 == 0){

		printf("%d\n",sum/2);

	}else{

		printf("%d\n",(sum-min_KI)/2);
	}

	return 0;
}



Measured memory_bytes: 3212
n=int(input())
s=[int(input())for i in range(n)]
total=sum(s)
a=[]
for i in range(n):
    if s[i]%10!=0:
        a.append(s[i])
if len(a)==0:
    a.append(total)
a.sort()
if total%10==0:
    print(total-a[0])
else:
    print(total)
        

        

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

ll dp[61][3];
const int mod=1000000007;
int main(){
    ll n;
    cin>>n;
    dp[60][0]=1;
    for(int i=59;i>=0;--i)rep(j,3)rep(k,3){
        ll v=+((n>>i)&1)-j+(k<<1);
        if(v>2) v=2;
        if(v>=0){
            dp[i][v]+=dp[i+1][k];
            dp[i][v]%=mod;
        }
    }
    ll ans=0;
    rep(i,3) ans+=dp[0][i];
    cout<<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), c = scanner.nextInt();
			int[][] d = new int[c][c], cost = new int[N][c];
			IntStream.range(0, c).forEach(i -> IntStream.range(0, c).forEach(j -> d[i][j] = scanner.nextInt()));
			IntStream.range(0, n).forEach(i -> IntStream.range(0, n).forEach(j -> {
				int now = scanner.nextInt() - 1;
				int index = (i + j) % N;
				IntStream.range(0, c).forEach(k -> cost[index][k] += d[now][k]);
			}));
			System.out.println(IntStream.range(0, c)
					.map(i -> IntStream.range(0, c).filter(j -> i != j)
							.map(j -> IntStream.range(0, c).filter(k -> (i != k) && (j != k))
									.map(k -> cost[0][i] + cost[1][j] + cost[2][k]).min().getAsInt())
							.min().getAsInt())
					.min().getAsInt());
		}
	}
}


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

using namespace std;

#define int long long

main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
		
	int cnt = 0;
	int p = 0;
	
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == 'A')
			p++;
		else
		{
			if(i + 1 < s.size() && s[i] == 'B' && s[i + 1] == 'C')
			{
				cnt += p;
				i++;
			}
			else
				p = 0;
		}
    }
	
	cout << cnt << endl;
}


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

int T,card[10];
string str;

bool check1(int a,int b,int c){
    if(a == b && b == c) return true;
    return false;
}

bool check2(int a,int b,int c){
    if(a+2 == b+1 && b+1 == c) return true;
    return false;
}

bool check3(int a,int b,int c){
    return check1(a,b,c) || check2(a,b,c);
}

bool check4(int card[10]){
    return check3(card[0],card[1],card[2])&&check3(card[3],card[4],card[5])
           &&check3(card[6],card[7],card[8]);
}

int judge(){
    sort(card,card+9);
    do{
        if(check4(card)) return 1;
        
    }while(next_permutation(card,card+9));
    return 0;
}

int main(){
    cin >> T;
    while(T--){
        for(int i = 0 ; i < 9 ; i++){
            cin >> card[i];
        }
        for(int i = 0 ; i < 9 ; i++){
            cin >> str;
            if(str == "G") card[i] += 10;
            else if(str == "B") card[i] += 20;
        }
        cout << judge() << endl;
    }

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

template <int mod>
struct ModInt {
  int x;
  ModInt(): x(0) {}
  ModInt(long long a) { x = a % mod; if (x < 0) x += mod; }
  ModInt &operator+=(ModInt that) { x = (x + that.x) % mod; return *this; }
  ModInt &operator-=(ModInt that) { x = (x + mod - that.x) % mod; return *this; }
  ModInt &operator*=(ModInt that) { x = (long long) x * that.x % mod; return *this; }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return ModInt(u);
  }
  #define op(o, p) ModInt operator o(ModInt that) { return ModInt(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  friend ostream& operator<<(ostream &os, ModInt m) { return os << m.x; }
};

using mint = ModInt<998244353>;

mint dp[3001][3001];

void solve() {
  int n, s;
  cin >> n >> s;
  vi32 a(n);
  cin >> a;
  rrep(i, n) {
    dp[i + 1][0] += 1;
    repc(j, s) {
      dp[i][j] += dp[i + 1][j];
      if (j + a[i] <= s) dp[i][j + a[i]] += dp[i + 1][j];
    }
  }
  mint ans = 0;
  repc(i, n) ans += dp[i][s];
  cout << ans << endl;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int m;
  m = N % 10;
  if (m == 2||m == 4|| m == 5 || m == 7|| m == 9){
     cout << "hon" << endl;
  }
  else if (m == 3) {
    cout << "bon" << endl;
  }
  else{
    cout << "pon" << endl;
  }
}

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

using namespace std;

#define MOD 1'000'000'007

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

	vector < int >a(M);
	for (int i = 0; i < M; i++) {
		cin >> a[i];
		a[i]--;
	}

	vector < int >route(N, 0);

	for (int i = 0, ai = 0; i < N; i++) {

		if (ai < M && i == a[ai]) {
			ai++;
			continue;
		}

		if (i == 0) {
			route[i] = 1;
		} else if (i == 1) {
			route[i] = 1 + route[i - 1];
		} else {
			route[i] = (route[i - 2] + route[i - 1]) % MOD;
		}
	}

	cout << route[N - 1] << endl;

	return 0;
}


Measured memory_bytes: 1024
# include <iostream>

//https://atcoder.jp/contests/abc079/tasks/abc079_a

using namespace std;

int main(){
    int N;

    cin >> N;

    int N1,N2,N3,N4;

    N1 = N / 1000           ;  // 9999 
    N2 = N % 1000   / 100   ;  // 999
    N3 = N % 100    / 10    ;  // 99
    N4 = N % 10     / 1     ;  // 9

    if(N1==N2 && N2 == N3){
        cout << "Yes" << endl;
    }
    else if(N2 == N3 && N3 == N4){
        cout << "Yes" << endl;
    } 
    else{
       cout << "No" << endl;
    }
    return 0;
}

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

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

sati = 0
for (index, a) in enumerate(A):
    sati += B[a-1]

    if(index+1 < N and A[index]+1 == A[index+1]):
        sati += C[A[index]-1]

print(sati)


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define INF 1000000000

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef long double ld;

//ある値がvector内の要素に含まれているか否か判定する
int vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance(vec.begin(), itr);
    if (index != vec.size()) { // 発見できたとき
        return 1;
    } else { // 発見できなかったとき
        return 0;
    }
}

////////////////////////// let's code! /////////////////////////////

int i, j, k;

///// variables frequent to use /////

struct node {
    vector<int> childs;
    int count = 0;
};

void dfs(vector<node> &nodes, int label, int addcount) {

    nodes[label].count += addcount;
    for (int child : nodes[label].childs) {
        dfs(nodes, child, nodes[label].count);
    }
}

int main() {

    string S, T;

    cin >> S >> T;

    int count = 0;

    REP(i, 3) {
        if (S[i] == T[i]) count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s,t,u;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  cin >> u;
  if(s == u){
    a--;
  }
  else if(t == u){
    b--;
  }
  
  cout << a << " " << b << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repz(i, z, n) for(decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for(decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(all(v)))
#define MIN(v) (*min_element(all(v)))
#define INF 1000000000000 //1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

using namespace std;
void debug_out(){ cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
  cout << H << " ";
  debug_out(T...);
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;
typedef unsigned long long ul;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
// 1E+9 +7
const ll mod = 1000000000+7;
int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int l;cin >> l;
  cout << fixed << setprecision(12) << double(l)*double(l)*double(l)/double(3.0)/double(3.0)/double(3.0) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
typedef long long LL;
using namespace std;
LL gcd(LL u, LL v) {
  LL r;
  while (0 != v) {
	  r = u % v; 
	  u = v; 
	  v = r; /* swap */
  }
  return u;
}
LL lcm(LL a, LL b){
	return  a*b/gcd(a, b);
}
struct X{
	char ch;
	LL index;
	X(){
		ch='0';
		index=0;
	}
};
int main(int argc, char* argv[])
{
	LL N,M;
	LL i;
	cin>>N>>M;
	
	string S,T;
	cin>>S;
	cin>>T;
	if (S[0]!=T[0]){
		cout<<-1<<endl;
		return 0;
	}

	LL L=lcm(N,M);
	map<LL,char> XS;
	map<LL,char>::iterator mit;
	LL ln=L/N;

	for (i=1;i<=N-1;i++){
		XS[i*ln]=S[i];
	}
	LL lm=L/M;
	for (i=1;i<=M-1;i++){
		LL k=i*lm;
		mit=XS.find(k);
		if (mit!=XS.end()){
			if ((*mit).second!=T[i]){
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	cout<<L<<endl;
	return 0;
}

Measured memory_bytes: 6144