akhauriyash/Code-Regression huggingface dataset:
#define CIN_ONLY 1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const double PI = 3.14159265358979323846;

string p[500];
string r[500];
string b[500];

int main()
{
	if (CIN_ONLY) {
		ios::sync_with_stdio(0);
		cin.tie(0);
	}
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; ++i) {
		cin >> p[i];
		r[i] = b[i] = p[i];
	}
	for (int i = 0; i < h; ++i) {
		r[i][0] = '#';
		b[i][w - 1] = '#';
	}
	for (int i = 0; i < h; ++i) {
		if (i % 2) {
			for (int j = 1; j < w; ++j) {
				b[i][j] = '#';
			}
		} else {
			for (int j = 0; j < w - 1; ++j) {
				r[i][j] = '#';
			}
		}
	}
	for (int i = 0; i < h; ++i) {
		cout << r[i] << '\n';
	}
	cout << '\n';
	for (int i = 0; i < h; ++i) {
		cout << b[i] << '\n';
	}
	return 0;
}



Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
const int maxn=121345;
typedef pair<long long,long long> pll;
int n,a[maxn],b[maxn];
vector<pll> vec;
inline bool cmp(pll p1,pll p2) {
    return abs(p1.first+p1.second)>abs(p2.first+p2.second);
}
int main()
{
    scanf("%d",&n);
    for (int i=0;i<n;++i) {
        scanf("%d%d",&a[i],&b[i]);
        vec.push_back(pll(a[i],b[i]));
    }
    sort(vec.begin(),vec.end(),cmp);
    long long res=0;
    for (int i=0;i<(int)vec.size();++i)
        if (i&1) res-=vec[i].second;
        else res+=vec[i].first;
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 2932
using System;
using System.Linq;

namespace _0278
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int a = Math.Max(5, x[2]); int b = Math.Max(2, x[3]);
                Console.WriteLine(Math.Min(x[0] * x[2] + x[1] * x[3], (x[0] * a + x[1] * b) * 0.8));
            }
        }
    }
}

Measured memory_bytes: 9680
x,y=map(int,input().split())
ans=abs(y)-abs(x)
if x*y<0:ans=abs(ans)+1
if x*y==0:
  if x<y:ans=y-x
  elif x>y:ans=abs(ans)+1
elif ans>0:
  if x<0 and y<0:ans+=2
elif ans<0:
  if x>0 and y>0:ans=abs(ans)+2
  else:ans=abs(ans)
print(ans)

Measured memory_bytes: 9200
#include<stdio.h>
#include<algorithm>
using namespace std;
int z,n,k,g;
int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i=0; i<n; i++){
		int t;
		scanf("%d",&t);
		z = max(z,t);
		g = gcd(g,t);
	}
	puts(k <= z && k % g == 0 ? "POSSIBLE" : "IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] a = new int[26];
        
        for(int i = 0; i <s.length(); i++){
            a[s.charAt(i) - 97] = 1;
        }
        
        char res = 0;
        
        for(int i = 0; i < 26; i++){
            if(a[i] == 0){
                res=(char)(i+97);
                break;
            }
        }
        
        System.out.println(res == 0 ? "None" : res);
    }
}


Measured memory_bytes: 23996
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/

/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    cout << N*(N+1)/2 << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const int INF = 2000000000; //2e9
const int large_P = 1000000007; //1e9 + 7


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

	if (N % 2 == 1) {
		//cout << "hacked" << endl;
	}
	else {
		//cout << "hacked" << endl;
	}

	if (M % 2 == 1) {
		//cout << "hacked" << endl;
	}
	else {
		//cout << "hacked" << endl;
	}


	if (N % 2 == 1) {
		rep(i, M) {
			cout << i + 1 << " " << N - (i + 1) << endl;
		}
	}
	else {
		if (M % 2 == 1) {
			rep(i, M / 2) cout << i + 1 << " " << M - i << endl;
			rep(i, M / 2 + 1) cout << M + i + 1 << " " << 2 * M + 1 - i << endl;
		}
		else {
			rep(i, M / 2) cout << i + 1 << " " << M + 1 - i << endl;
			rep(i, M / 2) cout << M + i + 2 << " " << 2 * M + 1 - i << endl;
		}
	}


	


}

Measured memory_bytes: 3648
#include <stdio.h>

int main()
{
    int a, b, c, plus, minus, times;
    scanf("%d %d", &a, &b);
    plus = a + b;
    minus = a - b;
    times = a * b;

    if (plus >= minus && plus >= times) {
        printf("%d\n", plus);
    } else if (minus >= plus && minus >= times) {
        printf("%d\n", minus);
    } else if (times >= plus && times >= minus) {
        printf("%d\n", times);
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
const int MOD = 1e9+7;
int n, c, a;
string s;
bool r;
ll ans = 1;
int main(){
	cin >> n >> s;
	if(s[0] == 'W') return puts("0")*0;
	rep(i,n*2){
		if(!i) r = true;
		else r = s[i-1] == s[i] ? !r : r;
		if(r){
			c++;
			a++;
		}else (ans *= c--) %= MOD;
	}
	rep(i,n) (ans *= i+1) %= MOD;
	printf("%lld\n", a == n ? ans : 0);
}

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

int main(){
    long long n,i,array[10000],max,min,total=0;
    
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> array[i];
    }
    max = array[0];
    min = array[0];
    for(i = 0; i < n; i++){
        if(max < array[i]) max = array[i];
        if(min > array[i]) min = array[i];
        total += array[i];
    }
    cout << min << " " << max << " " << total << endl;
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
ll digitPoor(ll n)
{
    assert(INT_MAX == 2147483647);
    assert(n >= 0);

    if (n < 10)         return 1;
    if (n < 100)        return 2;
    if (n < 1000)       return 3;
    if (n < 10000)      return 4;
    if (n < 100000)     return 5;
    if (n < 1000000)    return 6;
    if (n < 10000000)   return 7;
    if (n < 100000000)  return 8;
    if (n < 1000000000) return 9;
    return 10;
}
struct p{
  ll x;
  bool b;
};
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
    ll X,Y;
    cin>>X>>Y;
    
    
    ll x3=(2*X-Y);
    ll y3=(2*Y-X);
    if(x3>=0&&y3>=0&&x3%3==0&&y3%3==0){
        x3/=3;y3/=3;
        //s(x3,y3);
        ll x=1,y=1,u=1;
        REP1(i,x3){
            x=(x*i)%MOD;
        }
        REP1(i,y3){
            y=(y*i)%MOD;
        }
        REP1(i,x3+y3){
            u=(u*i)%MOD;
        }
        //s(x,y,u);
        cout<<(u*modinv(x*y,MOD)%MOD);
    }else{
        cout<<0;
    }
    
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			Map<Integer, Long> map = new TreeMap<Integer, Long>();
			List<Integer> list = new ArrayList<Integer>();
			for(int i = 0; i < n; i++) {
				int e = sc.nextInt();
				long p = sc.nextInt();
				long q = sc.nextInt();
				long t = p * q;
				if(map.containsKey(e)) {
					map.put(e, map.get(e) + t);
				}else {
					map.put(e, t);
					list.add(e);
				}
			}
			boolean flag = true;
			StringBuilder sb = new StringBuilder();
			for(int k : list) {
				if(map.get(k) >= 1000000) {
					sb.append(k).append("\n");
					flag = false;
				}
			}
			if(flag) {
				System.out.println("NA");
			}else {
				System.out.print(sb.toString());
			}
		}
		sc.close();
	}
}


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

using namespace std;

struct BipartiteMatching {
    vector< vector< int > > graph;
    vector< int > match, alive, used;
    int timestamp;

    BipartiteMatching(int n) : graph(n), alive(n, 1), used(n, 0), match(n, -1), timestamp(0) {}

    void add_edge(int u, int v) {
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    bool dfs(int idx) {
        used[idx] = timestamp;
        for(auto &to : graph[idx]) {
        int to_match = match[to];
        if(alive[to] == 0) continue;
        if(to_match == -1 || (used[to_match] != timestamp && dfs(to_match))) {
            match[idx] = to;
            match[to] = idx;
            return true;
        }
        }
        return false;
    }

    int bipartite_matching() {
        int ret = 0;
        for(int i = 0; i < graph.size(); i++) {
        if(alive[i] == 0) continue;
        if(match[i] == -1) {
            ++timestamp;
            ret += dfs(i);
        }
        }
        return ret;
    }

    void output() {
        for(int i = 0; i < graph.size(); i++) {
        if(i < match[i]) {
            cout << i << "-" << match[i] << endl;
        }
        }
    }
};

int main(void) {
    int N;
    cin >> N;
    vector< pair<int,int> > X(N);
    vector< pair<int,int> > Y(N);
    for(int i=0; i<N; i++) {
        cin >> X[i].first >> X[i].second;
    }
    for(int j=0; j<N; j++) {
        cin >> Y[j].first >> Y[j].second;
    }

    BipartiteMatching bm(2*N);
    for(int i=0; i<N; i++) {
        for(int j=0; j<N; j++) {
            if(X[i].first < Y[j].first && X[i].second < Y[j].second) {
                bm.add_edge(i, j+N);
            }
        }
    }

    cout << bm.bipartite_matching() << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        string s = sc.NextString();
        int k = sc.NextInt();
        var set = new HashSet<string>();
        int l = 5;
        while (l > 0)
        {
            for (int i = 0; i < s.Length - l + 1; i++)
            {
                set.Add(s.Substring(i, l));
            }
            l--;
        }
        var list = set.ToList();
        list.Sort();
        Console.WriteLine(list[k - 1]);
    }
}


class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


Measured memory_bytes: 13664
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{

    // keyence2020-B

    int N; cin >> N;
    vector<pair<ll, ll>> XL(N);
    REP(i,N){
        ll x,l; cin >> x >> l;
        XL[i] = {x-l, x+l};
    }

    sort(XL.begin(), XL.end(), [](pair<ll, ll>a, pair<ll, ll>b){return a.second < b.second;});

    int ans=0;
    ll current = -INF;
    REP(i,N){
        if(current > XL[i].first) continue;
        ++ans;
        current = XL[i].second;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
int N,L;
ll K;
void add(ll &x,ll y){
	x=min(x+y,K);
}
ll pro(ll x,ll y){
	if(x==0||y==0) return 0;
	if(x>K/y) return K;
	return x*y;
}
string s[100];
int n[100];
ll way_[2400];
ll *way=way_+300;
ll dp[100][200];
int main(){
	cin>>N>>L>>K;
	rep(i,N) cin>>s[i];
	rep(i,N) n[i]=s[i].size();
	way[0]=1;
	rep(i,L){
		rep(j,N) if(i+n[j]<=L) add(way[i+n[j]],way[i]);
	}
	string ans;
	dp[0][n[0]-1]=1;
	rep(i,L){
		ll nx[26]={};
		rep(j,N){
			rep(k,n[j]){
				if(k==n[j]-1){
					rep(l,N) add(nx[s[l][0]-'a'],pro(dp[j][k],way[L-i-n[l]]));
				}else{
					add(nx[s[j][k+1]-'a'],pro(dp[j][k],way[L-i-n[j]+k+1]));
				}
			}
		}
		ll sum=0;
		int A=-1;
		rep(j,26){
			ll tmp=sum;
			sum+=nx[j];
			if(sum>=K){
				K-=tmp;
				A=j;
				break;
			}
		}
		if(A<0){
			assert(i==0);
			puts("-");
			return 0;
		}
		ans+='a'+A;
		ll ndp[100][200]={};
		rep(j,N){
			rep(k,n[j]){
				if(k==n[j]-1){
					rep(l,N) if(s[l][0]-'a'==A) add(ndp[l][0],dp[j][k]);
				}else{
					if(s[j][k+1]-'a'==A) add(ndp[j][k+1],dp[j][k]);
				}
			}
		}
		rep(j,N) rep(k,n[j]) dp[j][k]=ndp[j][k];
	}
	cout<<ans<<endl;
}

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

using namespace std;

class Dice{
private:
  void roll(int a,int b,int c,int d){
    swap(x[a],x[b]);
    swap(x[b],x[d]);
    swap(x[c],x[d]);
  }
public:
  int x[6];
  void roll_N(){ roll(0,1,4,5); }
  void roll_E(){ roll(0,3,2,5); }
  void roll_S(){ roll(0,4,1,5); }
  void roll_W(){ roll(0,2,3,5); }
};

int main(){
  Dice die;
  for(int i = 0 ; i < 6 ; i++){
    cin >> die.x[i];
  }
  char ch;
  while(cin >> ch){
    if(ch == 'N'){
      die.roll_N();
    }else if(ch == 'E'){
      die.roll_E();
    }else if(ch == 'S'){
      die.roll_S();
    }else{
      die.roll_W();
    }
  }
  cout << die.x[0] << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>

int main(){
  int a,b,c;
  int k=0;
   scanf("%d %d %d",&a,&b,&c);
   
   for(int x=a;x<=b;x++){
 

    if(c%x==0){
      k++;
    }
  }
  printf("%d\n",k);
  
  return 0;
}



Measured memory_bytes: 2092
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
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; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N, ans = 0;
    in >> N;
    vector<ll> B(N-1);
    REP_IN(i , N-1, B[i]);
    /*
    ans += B[N-2];
    for(ll i = N-2; i >= 0; i--){
        if(B[i] <= B[i-1]){
            ans += B[i];
        }else{
            ans += B[i-1];
        }
    }
    */

    ans += B[0];
    ans += B[N-2];
    REP(i, N-2){
        if(B[i] <= B[i+1]){
            ans += B[i];
        }else{
            ans += B[i+1];
        }
    }

    out << ans << endl;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for ia in range(A+1):
    for ib in range(B+1):
        for ic in range(C+1):
            if 500*ia+100*ib+50*ic == X:
                cnt = cnt + 1

print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 998244353;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 3e3 + 100;

int n, a[N], s;
int dp[N][N];

int solve(int idx, int s){
   if(s == 0)
      return n - (idx) + 1;
   if(s < 0)
      return 0;
   if(idx >= n)
      return 0;
   int &ans = dp[idx][s];
   if(ans != -1)
      return ans;
   ans = solve(idx+1, s) + solve(idx+1, s - a[idx]);
   ans %= mod;
   return ans;
}

void solve(){
   cin>>n>>s;

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

   memset(dp, -1, sizeof dp);

   int ans = 0;
   for (int i = 0; i < n; ++i)
   {
      ans += solve(i, s);
      ans %= mod;
   }

   cout<<ans;
}

int32_t main(){_
   
   int t = 1;
   //cin >> t;

   while(t--){
     solve();
     cout << endl;
   }
   

   return 0;
}

Measured memory_bytes: 75520
/////////////////////////////////TEST CASES////////////////////////////////////
/*
*/
/////////////////////////////////////CODE//////////////////////////////////////		
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = a ; i > b ; i--)
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PI 3.14159265
typedef long long ll;
#define vl vector<ll> 
#define IN(inp) ll inp;cin>>inp;
#define pb push_back
#define all(a) a.begin(),a.end()
#define FR(i,a) for(auto i:a)
#define what(A) cout<<#A<<" is "<<A<<endl;
ll MAX = 100000000000;
ll MOD = 1000000007;
void solve()
{
	IN(n)IN(x)IN(t);
	cout << ((n / x)+(n%x==0?0:1)) * t << endl;
}
int main()
{
	fastio
		//freopen("input.txt", "rt", stdin);
		//freopen("output.txt", "wt", stdout);
		ll test = 1;
	//cin >> test;
	while (test--)
	{
		solve();
	}
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
//------------------------------------------------------------------------


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

  int n; cin >> n;

  if(n%2==0) cout << n/2 << endl;
  else cout << n/2 + 1 << endl;

  return 0;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector < vector<int> > to(N),cost(N);
    for(int i=0;i<N-1;i++){
        int a,b,w;
        cin >> a >> b >> w;
        a--,b--;
        to[a].push_back(b); cost[a].push_back(w);
        to[b].push_back(a); cost[b].push_back(w);
    }

    vector<int> ans(N,-1);
    queue<int> q;

    ans[0]=0;
    q.push(0);

    while(!q.empty()){
        int v= q.front();
        q.pop();

        for(int i=0;i<to[v].size();i++){
            int u = to[v][i];
            int w = cost[v][i];
            if(ans[u]!=-1)continue;
            ans[u]=(ans[v]+w)%2;
            q.push(u);
        }

    }

    for(int i=0;i<N;i++){
        cout << ans[i] << endl;
    }



}

Measured memory_bytes: 11904
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int N, K;
vector<int> A(200100);

bool ok(int x) {
    ll cnt = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] > x) cnt += (A[i] - 1) / x;
    } 
    if (cnt <= K) return true;
    return false; 
}

int main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++) cin >> A[i];
    int l = 0, r = 1000000000;
    while(r - l > 1) {
        int m = (l + r) / 2;
        if (ok(m)) r = m;
        else l = m;
    }
    cout << r << endl;
}

Measured memory_bytes: 3944
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, x;
            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            c = (x - a) % b;
            Console.WriteLine(c);
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

#include <bitset>
const int PRIME_SIZE = 1000000;
int psize;
bitset<PRIME_SIZE + 1> bprime;
int prime[PRIME_SIZE / 10 + 1000];
int Eratosthenes(int n) {
  psize = 0;
  bprime.set();
  bprime[0] = bprime[1] = false;
  for (int i = 2; i <= n; i++) {
    if (!bprime[i]) { continue; }
    prime[psize++] = i;
    if ((long long)i * i > n) { continue; }
    for (int j = i * i; j <= n; j += i) {
      bprime[j] = false;
    }
  }
  return psize;
}

int n;
char strs[20][3000];
int vs[20][3000];
int lens[20];
int ans[3000];

int decode(int c1, int c2) {
  if (isalpha(c1)) { c1 += 10 - 'A'; }
  else { c1 -= '0'; }
  if (isalpha(c2)) { c2 += 10 - 'A'; }
  else { c2 -= '0'; }
  return c1 * 16 + c2;
}

char temp[10];
char *encode(int v) {
  temp[0] = v / 16;
  temp[1] = v  % 16;
  temp[2] = 0;
  if (temp[0] >= 10) { temp[0] += 'A' - 10; }
  else { temp[0] += '0'; }
  if (temp[1] >= 10) { temp[1] += 'A' - 10; }
  else { temp[1] += '0'; }
  return temp;
}

void Compress(int *vs, int &len) {
  int temp[3000];
  REP(k, psize) {
    while (true) {
      if (len < prime[k]) { goto next; }
      if (len % prime[k] != 0) { break; }
      REP(j, len) {
        if (j % prime[k] == 0) {
          temp[j / prime[k]] = vs[j];
          continue;
        }
        if (vs[j] != 0) { goto next; }
      }
      memcpy(vs, temp, sizeof(temp));
      len /= prime[k];
    }
next:;
  }
}

int main() {
  Eratosthenes(1024);
  int test;
  scanf("%d", &test);
  while (test--) {
    scanf("%d", &n);
    REP(i, n) {
      scanf("%s", strs[i]);
      lens[i] = strlen(strs[i]);
      for (int j = 0; j < lens[i]; j += 2) {
        vs[i][j / 2] = decode(strs[i][j], strs[i][j + 1]);
      }
      lens[i] /= 2;
      Compress(vs[i], lens[i]);
    }
    int v = 1;
    REP(i, n) {
      v *= lens[i] / __gcd(v, lens[i]);
      if (v > 1024) {
        puts("Too complex.");
        goto end;
      }
    }
    MEMSET(ans, 0);
    REP(i, n) {
      REP(j, lens[i]) {
        int index = j * v / lens[i];
        ans[index] |= vs[i][j];
      }
    }
    Compress(ans, v);
    REP(i, v) {
      printf("%s", encode(ans[i]));
    }
    puts("");
end:;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <string>
#define MAX 100007
#define scn1(a) scanf("%d", &a);
#define scn2(a, b) scanf("%d %d", &a, &b);
#define scn3(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define lscn1(a) scanf("%lli", &a);
#define lscn2(a, b) scanf("%lli %lli", &a, &b);
#define lscn3(a, b, c) scanf("%lli %lli %lli", &a, &b, &c);
#define prnt(a) printf("%d\n", a);
#define for0(i, n) for(i=0;i<n;i++)
#define for1(i, n) for(i=1;i<=n;i++)
typedef unsigned long long int ll;
using namespace std;


int main()
{
//	#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//	#endif
	int tt=1;
//	scn1(tt);
	while(tt--)
    {
        int n;
        scn1(n);
        int ans=0;
        for(int i=1; i<10; i++)
        {
            int x=n/i;
            if(x*i==n && x<=9)
            {
                ans=1;
                break;
            }
        }
        if(ans) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int input_S;
    int upperS, lowerS;
    scanf("%d", &input_S);

    upperS = input_S / 100;
    lowerS = input_S % 100;

    if( (upperS > 0 && upperS <= 12)
        && !(lowerS > 0 && lowerS <= 12)){
            printf("MMYY");
    }else if( !(upperS > 0 && upperS <= 12)
        && (lowerS > 0 && lowerS <= 12)){
            printf("YYMM");
    }else if( (upperS > 0 && upperS <= 12)
        && (lowerS > 0 && lowerS <= 12)){
            printf("AMBIGUOUS");
    }
    else{
        printf("NA");
    }
}

Measured memory_bytes: 128
/*
AizuOnline A0106
Discounts of Buckwheat
*/
#include <stdio.h>
#include <limits.h>
#define DEBUG 0

int shopA(int x)
{
  return((x % 5)*380 + (x / 5)*1520);
}
int shopB(int x)
{
  return((x % 4)*550 + (x /4)*1870);
}
int shopC(int x)
{
  return((x % 3)*850 + (x /3)*2244);
}
main()
{
  int total_w;
  int total_p;
  int a,b,c;
  int minval;
  int z,z2;


  while(EOF != scanf("%d",&total_w) && total_w > 0)
    {
      minval = INT_MAX;
      for(c=0;c <= total_w/500;c++)
        {
          z =(total_w-500*c)/300;
          for(b=0;b <=z;b++)
            {
              z2=(total_w-500*c-300*b);
              if(z2 % 200)
                continue;
              a = z2/200;
              total_p = shopA(a)+shopB(b)+shopC(c);
#if DEBUG
              printf("%d %d %d %d\n",a,b,c,total_p);
#endif
              if(minval > total_p)
                minval = total_p;
            }
        }
      printf("%d\n",minval);
    }

return(0);
}

Measured memory_bytes: 0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ATOrT solver = new ATOrT();
        solver.solve(1, in, out);
        out.close();
    }

    static class ATOrT {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            out.println(Math.min(n * a, b));
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22740
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i <= n; i ++)
	{
		int q = n - i * 4;	
		if(q < 0)
			continue;
		if(q % 7 == 0)
			return cout << "Yes", 0;
	}
	cout << "No";





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;   //author: madmin2619/mintu_agarwal
     
#define nfs() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define pf push_front
#define forin(i, n) for(int i=0;i<n;i++)
#define tr(c, it) for(auto it=c.begin();it!=c.end();it++)
#define sz(c) c.size()
#define all(c) c.begin(),c.end()
#define ff first
#define ss second
#define m_p(x, y) make_pair(x, y)
     
const int M = 1e10l + 7;
const int N = 1e5+1;     
int32_t main(){
    nfs()
    int t, n, i, j, k, W;
    int dp[N];
    for(i=0;i<N;i++)
    	dp[i]=M;
    cin >> n >> W;
    int p[n], w[n];
    for(int i=0;i<n;i++)
    	cin >> w[i] >> p[i];
    dp[0]=0;
    for(int i=0;i<n;i++){
    	for(j=N-1;j>=p[i];j--){
    		if((dp[j-p[i]]+w[i]) < dp[j]){
    			dp[j] = dp[j-p[i]] + w[i];
    		}
    	}
    }
  	for(i=N-1;i>=0;i--){
  		if(dp[i] <= W){
  			break;
  		}
  	}
  	cout << i << "\n";
    return 0;
}

Measured memory_bytes: 1152
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <complex>
#include <cstdio>

using namespace std;
typedef long long ll;

int main()
{
	ll H, W;
	int N;
	cin >> H >> W >> N;
	map<pair<int, int>, int> box;
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		a -= 2, b -= 2;
		for (int x = -1; x < 2; x++) {
			for (int y = -1; y < 2; y++) {
				int nx = a + x;
				int ny = b + y;
				if (nx >= 0 && ny >= 0 && nx < H-2 && ny < W-2) {
					box[make_pair(nx, ny)]++;
				}
			}
		}
	}
	vector<ll> ans(10);
	for (const auto& b : box) {
		ans[b.second]++;
	}
	ll zero = (H - 2)*(W - 2);
	for (const auto& i : ans) {
		zero -= i;
	}
	ans[0] = zero;
	for (const auto& i : ans) {
		cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 56576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int in() {int x; cin>>x; return x;}
ll lin() {ll x; cin>>x; return x;}
string sin() {string x;cin>>x;return x;}
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

bool ifprime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=2;i*i<=x;i++){if(x%i==0)return false;}
    return true;
}

int main(){
    int N=in();
    int ans=0;
    int h, f;
    rep(i, N){
        cin>>h;
        if(i==0){
            ans+=h;
        }
        else if(f<h){
            ans+=h-f;
        }
        f=h;
    }
    cout<<ans<<endl;
}

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

int main(){
    int A, B, C, X, Y;
    int total = 0;
    cin >> A >> B >> C >> X >> Y;

    if(A+B <= 2*C){
      total = A*X + B*Y;
    }else if((A >= 2*C)&&(X >= Y)){
        total += 2*X*C;
    }else if((B >= 2*C)&&(X < Y)){
        total += 2*Y*C;
    }else{
      if(X >= Y){
        total += 2*Y*C;
        total += A*(X - Y);
      }else{
        total += 2*X*C;
        total += B*(Y - X);
      }
    }
    printf("%d\n",total);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(b - a == c - b) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define lp(i, n) rep(i, n)
#define foreach(i, n) for(auto &i:(n))
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll<(x))
#define MOD ((ll)1e9+7)
using namespace std;

signed main(){
	string s; cin>>s;
	int N=s.size();
	int sum=0;
	map<int, int> cnt;
	cnt[sum]++;
	string cur="";
	vector<int> ans;
	ans.push_back(0);

	stack<pair<int, int>> S;
	for(int i=0;i<N;i++){
		if(s[i]!='(' and s[i]!=')'){
			sum-=(cur.back()=='('? 1:-1);
			int j=(cur.back()=='('? 1:2);
			while(j--){
				pair<int, int> p=S.top(); S.pop();
				cnt[p.first]-=p.second;
			}
			cur.pop_back();
			ans.pop_back();
			cout<<ans.back()<<endl;
			continue;
		}
		if(s[i]=='('){
			sum++;
			cnt[sum]++; S.push({sum, 1});
			cur+=s[i];
			ans.push_back(ans.back());
		}else{
			S.push({sum, -cnt[sum]}); cnt[sum]=0;
			sum--;
			cur+=s[i];
			ans.push_back(ans.back());
			ans.back()+=cnt[sum];
//			cout<<sum<<' '<<cnt[sum]<<endl;
			cnt[sum]++;  S.push({sum, 1});
		}
		cout<<ans.back()<<endl;
	}
	return 0; 
}




Measured memory_bytes: 23748
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jenish
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CMaximalValue solver = new CMaximalValue();
        solver.solve(1, in, out);
        out.close();
    }

    static class CMaximalValue {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int arr[] = new int[n];
            arr[n - 1] = 0;
            int b[] = new int[n - 1];
            in.scanInt(b);
            arr[0] = b[0];
            arr[0 + 1] = b[0];
            for (int i = 1; i < n - 1; i++) {
                arr[i] = Math.min(arr[i], b[i]);
                arr[i + 1] = b[i];
            }


            long sum = 0;
            for (int i = 0; i < n; i++) sum += arr[i];
            out.println(sum);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public void scanInt(int[] A) {
            for (int i = 0; i < A.length; i++) A[i] = scanInt();
        }

    }
}



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

int main(){
  int x[5000], y[5000], min[5000], max[5000] ,end, i;
  for(i=0; i<5000; i++){
    cin>>x[i]>>y[i];
    if (x[i] == 0 and y[i] == 0){
      end = i;
      break;
    }
    else if (x[i] < y[i]){
      min[i] = x[i];
      max[i] = y[i];
    }
    else{
      min[i] = y[i];
      max[i] = x[i];
    }
  }
  for(i=0; i<end; i++){
    cout<<min[i]<<" "<<max[i]<<endl;
  }
  return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define LONGLONGMAX 9223372036854775807
#define LONGLONGMIN -9223372036854775807
#define INTMAX 32767
#define INTMIN -32767
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
int n,m,ans=0; std::vector<int> h;
int main(){
  cin >> n;
  h.resize(n);
  for (size_t i = 0; i < n; i++) {
    cin >> h[i];
    if(i==0 || h[i] >= m){
      ans++;
      m = h[i];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool dp[2][16005];
int main(void)
{
    char str[8005];
    int x,y;
    scanf("%s",str);
    scanf("%d %d",&x,&y);
    int l = strlen(str);
    int id = 0;
    int cn = 0;
    int ans[8005];
    str[l++] = 'T';
    for(int i = 0; i < l; i++)
    {
        if(str[i] == 'T')
        {
            ans[cn++] = i - id;
            id = i + 1;
        }
    }
    memset(dp,0,sizeof(dp));
    dp[0][8000+ans[0]] = true;
    id = 0;
    for(int i = 2; i < cn; i+=2)
    {
        int ic = id+1;
        ic%=2;
        for(int j = 0; j <= 16000; j++)
            if(dp[id][j])dp[ic][j-ans[i]] = true,dp[ic][j+ans[i]] = true;
        memset(dp[id],0,sizeof(dp[id]));
        id = ic;
    }
    if(!dp[id][x+8000])
    {
        printf("No\n");
    }
    else
    {
        memset(dp,0,sizeof(dp));
        dp[0][8000] = true;
        id = 0;
        for(int i = 1; i < cn; i+=2)
        {
            int ic = id+1;
            ic%=2;
            for(int j = 0; j <= 16000; j++)
                if(dp[id][j])dp[ic][j-ans[i]] = true,dp[ic][j+ans[i]] = true;
            memset(dp[id],0,sizeof(dp[id]));
            id = ic;
        }
        if(dp[id][y+8000])
            printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

using P = pair<int, PII>;

/* -----  2017/09/20  Problem: ACPC2017_day3_e  / Link:   ----- */
/* ------??????------



-----?????????????????§----- */
/* -----?§£??¬???-----



----?§£??¬???????????§---- */

LL N;
struct BIT2D {
	int _H, _W;
	VVI data;
	BIT2D(int h, int w) {
		_H = h; _W = w;
		data = VVI(_W + 1, VI(_H + 1, 0));
	}
	void add(int a, int b, int val) {
		for (int x = a; x <= _W; x += x&-x) {
			for (int y = b; y <= _H; y += y&-y) {
				data[x][y] += val;
			}
		}
	}
	int _sum(int a, int b) {
		int ret = 0;
		for (int x = a; x > 0; x -= x & -x) {
			for (int y = b; y > 0; y -= y & -y) {
				ret += data[x][y];
			}
		}
		return ret;
	}
	int sum(int lx, int ly, int rx, int ry) {
		return _sum(rx, ry) - _sum(lx - 1, ry) - _sum(rx, ly - 1) + _sum(lx - 1, ly - 1);
	}
};

LL ans = 0LL;
int H, W, T, Q;

int main() {

	scanf("%d%d%d%d", &H, &W, &T, &Q);
	BIT2D yet(max(W, H) + 1, max(W, H) + 1);// 1index
	BIT2D done(max(W, H) + 1, max(W, H) + 1);// 1index


	queue<P> que;
	FOR(i, 0, Q) {
		int t, c, h1, w1, h2, w2;
		scanf("%d%d%d%d", &t, &c, &h1, &w1);

		while (!que.empty()) {
			P p = que.front();
			if (p.first + T <= t) {
				que.pop();
				int Y = p.second.first, X = p.second.second;
				yet.add(Y, X, -1);
				done.add(Y, X, 1);
			}
			else break;

		}

		if (c != 2) {
			if (c == 0) {
				if (yet.sum(h1, w1, h1, w1) == 0 && done.sum(h1, w1, h1, w1) == 0) {
					yet.add(h1, w1, 1);
					que.push({ t,PII(h1,w1) });
				}
			}
			else {//c ==1
				if (done.sum(h1, w1, h1, w1) == 1) {
					done.add(h1, w1, -1);
				}
			}
		}
		else {
			scanf("%d%d", &h2, &w2);
			printf("%d %d\n", done.sum(h1, w1, h2, w2), yet.sum(h1, w1, h2, w2));
		}

	}



	return 0;
}

Measured memory_bytes: 35528
/* Coached by Dukkha */
#include <stdio.h>

#define N 100000

int main() {
	static int hh[N];
	int n, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &hh[i]);
	for (i = n - 2; i >= 0; i--)
		if (hh[i] > hh[i + 1])
			hh[i]--;
	for (i = 0; i < n - 1; i++)
		if (hh[i] > hh[i + 1]) {
			printf("No\n");
			return 0;
		}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i >= 0; i--)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int N,X;
    cin >> N >> X;
    int D = 0;
    int ans = 1;
    rep(i,N)
    {
        int L;
        cin >> L;
        D += L;
        if(D<=X){
            ans ++;
        }
    }
    cout << ans << endl;
    
    return 0;
}

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

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

    int cnt[200001] = {};
    int a[n];
    int ma = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        cnt[a[i]]++;
        ma = max(ma, a[i]);
    }

    for(int i = 0; i < n; i++){
        cnt[a[i]]--;
        if(ma == a[i] && cnt[a[i]] == 0){
            for(int j = a[i];;j--){
                if(cnt[j] > 0){
                    cout << j << endl;
                    break;
                }
            }
        }else{
            cout << ma << endl;
        }
        cnt[a[i]]++;
    }

    return 0;
}

Measured memory_bytes: 3200
// Template Matching
#include <iostream>
using namespace std;

int n,m;
char a[50][50],b[50][50];

int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++)for(int j=0;j<n;j++) cin>>a[i][j];
    for(int i=0;i<m;i++)for(int j=0;j<m;j++) cin>>b[i][j];
    for(int x=0;x<=n-m;x++){
        for(int y=0;y<=n-m;y++){
            bool ok=true;
            for(int i=0;i<m;i++){
                for(int j=0;j<m;j++){
                    if(a[x+i][y+j]!=b[i][j]){
                        ok=false;
                        i=m;
                        break;
                    }
                }
            }
            if(ok){
                cout<<"Yes\n";
                return 0;
            }
        }
    }
    cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
n, m, c = map(int, input().split())

B = list(map(int, input().split()))
num = 0
for _ in range(n):
    A = list(map(int, input().split()))
    total = 0
    for i in range(m):
        total += A[i] * B[i]
    if total + c > 0:
        num += 1
print(num)

Measured memory_bytes: 38384