akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

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

ll x;

int main() {
	ios_base::sync_with_stdio(false);

	cin >> x;
	
	ll left = 1, right = (ll) 1e5;
	ll ans = -1;
	while(left <= right) {
		ll mid = (left + right) / 2;
		ll sum = (mid * (mid + 1)) / 2;
		if(x <= sum) {
			ans = mid;
			right = mid - 1;
		}
		else {
			left = mid + 1;
		}
	}

	cout << ans << '\n';

	return 0;
}



Measured memory_bytes: 256
import java.util.Arrays;

public class Main {


  private static void solve() {
    int n = ni();
    long[][] p = new long[n][2];
    for (int i = 0; i < n; i ++) {
      p[i][0] = nl();
      p[i][1] = nl();
    }
    Arrays.sort(p, (o1, o2) -> {
      long x = o1[0] + o1[1];
      long y = o2[0] + o2[1];
      return Long.compare(y, x);
    });
    
    long a = 0;
    long b = 0;
    int turn = 1;
    for (int i = 0; i < n; i ++) {
      if (turn == 1) {
        a += p[i][0];
      } else {
        b += p[i][1];
      }
      turn = turn ^ 1;
    }

    System.out.println(a - b);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

#define show(x) cout << #x << " = " << x << endl

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

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz=" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

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


constexpr ll MOD = 1e9 + 7;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int N, M;
vector<int> num;
vector<vector<int>> prefer;

bool ok(int n)
{
    vector<bool> canceled(M, false);
    vector<int> ind(N, 0);
    for (int i = 0; i < M; i++) {
        vector<int> num_(M, 0);
        for (int h = 0; h < N; h++) {
            num_[prefer[h][ind[h]]]++;
        }
        int maxi = -1;
        int max_ind = -1;
        for (int h = 0; h < M; h++) {
            if (maxi < num_[h]) {
                maxi = num_[h];
                max_ind = h;
            }
        }
        if (maxi <= n) {
            return true;
        }
        canceled[max_ind] = true;
        assert(max_ind >= 0);
        for (int h = 0; h < N; h++) {
            while (canceled[prefer[h][ind[h]]]) {
                ind[h]++;
            }
        }
    }
    return false;
}

int main()
{
    cin >> N >> M;
    num.resize(M, 0);
    prefer.resize(N, vector<int>(M));
    for (ll i = 0; i < N; i++) {
        for (ll j = 0; j < M; j++) {
            int a;
            cin >> a;
            a--;
            if (j == 0) {
                num[a]++;
            }
            prefer[i][j] = a;
        }
    }

    int inf = 0;
    int sup = N;
    while (inf < sup) {
        const int mid = (inf + sup) / 2;
        if (ok(mid)) {
            sup = mid;
        } else {
            if (inf == mid) {
                break;
            }
            inf = mid;
        }
    }
    cout << sup << endl;
    return 0;
}


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


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

#define mod 1000000007

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	vector<vector<int>> data(3, vector<int>(3));
	vector<vector<int>> ans(3, vector<int>(3, 0));
	rep(i, 3)rep(j, 3)cin >> data.at(i).at(j);
	int n;
	cin >> n;
	vector<int>b(n);
	rep(i, n) {
		int b;
		cin >> b;
		rep(j, 3)rep(k, 3) {
			if (data[j][k] == b)ans[j][k] = 1;
		}
	}
	string clear = "No";
	rep(i, 3) {
		if (ans[i][0] == 1 && ans[i][1] == 1 && ans[i][2] == 1) {
			clear = "Yes";
			break;
		}
		if (ans[0][i] == 1 && ans[1][i] == 1 && ans[2][i] == 1) {
			clear = "Yes";
			break;
		}
	}
	if (ans[0][0] == 1 && ans[1][1] == 1 && ans[2][2] == 1)	clear = "Yes";
	if (ans[0][2] == 1 && ans[1][1] == 1 && ans[2][0] == 1)	clear = "Yes";
	print(clear);

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 100000000

using namespace std;

int main()
{
    //COMinit();
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<llong> a(n+2,0);
    vector<llong> b(n+2,0);
    REP(i,n+1) cin>>a[i];
    REP(i,n) cin>>b[i];
    llong ans=0;
    for(int i=0; i<=n; i++)
    {
        if(a[i]>=b[i])
        {
            ans+=b[i];
        }
        else
            {
        llong cnt=a[i]+a[i+1];
        if(cnt>b[i])
        {
            ans+=b[i];
            a[i+1]=cnt-b[i];
        }
        else
            {
            ans+=cnt;
            a[i+1]=0;
            }
        }
    }

    cout<<ans<<endl;
    return  0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

    vector<int> h(N);
    for (int i = 0; i < N; ++i) {
        cin >> h[i];
    }

    int ans = 0;
    while (true) {
        bool is_end = all_of(begin(h), end(h), [](const auto& hi){ return hi == 0; });
        if (is_end) {
            break;
        }

        int l = 0;
        while (l < N && h[l] == 0) {
            ++l;
        }

        int r = l;
        while (r < N && h[r] != 0) {
            h[r]--;
            ++r;
        }

        ++ans;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n,h; cin>>n>>h;
    vector<int>a(n);
    vector<int>b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    priority_queue<pii,vector<pii>>que;
    rep(i,n)que.push(mp(b[i],i));
    pii maxi=mp(0,0);
    rep(i,n)if(maxi.first<a[i])maxi=mp(a[i],i);
    int sum=0;
    int ans=0;
    while(!que.empty()){
        pii now=que.top();
        que.pop();
        if(now.first<maxi.first)break;
        ans++;
        h-=now.first;
        if(h<=0)break;
    }
    int temp=0;
    if(h>0)temp=h/maxi.first+(h%maxi.first?1:0);
    cout<<temp+ans<<endl;
}


Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define inf 1e18
#define mod pow(10,9)+7
#define mii map<int,int>
#define pii pair<int,int>
#define setbits(x) __builtin_popcountll(x)
#define lcm(x,y)  (x*y)/__gcd(x,y)

int32_t main()
{
	//c_p_c();
	int t;
	cin >> t;
	int a[t];
	int temp[t];
	mii m;
	int i;
	for (i = 0; i < t; i++)
	{
		cin >> a[i];
		temp[i] = a[i];
	}
	sort(temp, temp + t);
	int max = temp[t - 1];
	for (i = 0; i < t - 1; i++)
	{
		m[temp[i]] = max;
	}
	m[temp[t - 1]] = temp[t - 2];

	// for (auto &it : m)
	// 	cout << it.first << " " << it.second << endl;
	for (i = 0; i < t; i++)
	{
		cout << m[a[i]] << endl;
	}
	return 0;
}

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

#define ff        first
#define ss        second
#define int       long long
#define pb        push_back
#define mp        make_pair
#define vi        vector<int>
#define pii       pair<int,int>
#define mii       map<int,int>
#define w(x)      int x; cin>>x; while(x--)
#define all(x)      (x).begin(),(x).end()
#define rep(i,a,b)  for(int i=(a);i<(b);i++)
#define mod       1000000007

void c()
{
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

int32_t main() {

    //c();
    string x,y; cin>>x>>y;
    int m=x.length();
    int n=y.length();

    int dp[m+1][n+1];

    rep(i,0,m+1) dp[i][0]=0;
    rep(j,1,n+1) dp[0][j]=0;

    for(int i=1;i<=m;++i)
        for(int j=1;j<=n;++j)
        {
            if(x[i-1]==y[j-1])
                dp[i][j] = 1+dp[i-1][j-1];
            else
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    int i=m,j=n; 
    vector<char> lcs;
    while(i>0 && j>0 )
    {
        if(x[i-1]==y[j-1])
           {
                lcs.pb(x[i-1]);
                i--;
                j--;
           }
        else
        {
            if(dp[i-1][j]>=dp[i][j-1])
                i--;
            else
                j--;
        }
    }

    reverse(all(lcs));
    for(auto a:lcs) cout<<a;            
    return 0;
}

Measured memory_bytes: 70656
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(c >= a && b >= c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
T meguru_search(T ok, T ng, function<bool(T)> check){
    while(max(ok, ng) - min(ok, ng) > T(1)){
        T mid = (ok + ng) / T(2);
        if(check(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    return ok;
}

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

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

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

    int k;
    cin >> k;

    auto check = [&](lint mid){
        vector<lint> v;
        while(mid){
            v.emplace_back(mid % 10LL);
            mid /= 10LL;
        }
        REVERSE(v);

        lint dp[12][2][2][10] = {0LL};
        dp[0][0][0][0] = 1;

        rep(i, v.size()){
            rep(j, 2){
                rep(k, 2){
                    rep(l, 10){
                        int s = 0;
                        int t = j ? 9 : v[i];
                        if(k){
                            chmax(s, l - 1);
                            chmin(t, l + 1);
                        }
                        REP(d, s, t + 1){
                            dp[i + 1][j || d < v[i]][k || d > 0][d] += dp[i][j][k][l];
                        }
                    }
                }
            }
        }

        lint sum = 0;
        rep(j, 2){
            rep(l, 10){
                sum += dp[v.size()][j][1][l];
            }
        }

        return sum >= k;
    };

    lint ans = meguru_search<lint>(3234566667LL, 0LL, check);
    cout << ans << endl;

    cout << flush;

    return 0;
}

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

int main(){
    int a, b;
    string op;
    
    while(1){
        cin >> a >> op >> b;
        if(op=="+"){
            cout << a+b << endl;
        }else if(op=="-"){
            cout << a-b << endl;
        }else if(op=="*"){
            cout << a*b << endl;
        }else if(op=="/"){
            cout << a/b << endl;
        }else{
            break;
        }
    }
    return 0;
    
}


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll a, b;
  cin >> a >> b;
  COUT(max(a+b, max(a-b, a*b)));
}

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

/*

3 2
*/


Measured memory_bytes: 3612
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    S = input_raw[0]
    dic = {}
    for s in S:
        if s not in dic:
            dic[s] = 1
        else:
            dic[s] += 1

    count = 1L
    for s in dic:
        count =  (count * long(dic[s] + 1)) % 1000000007L

    count = (count - 1) % 1000000007L
    print count


if __name__ == '__main__':
    main()


Measured memory_bytes: 32924
#include <iostream>
#include <sstream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <set>

struct TestData
{
  int testNum;
  std::string input;
  std::string expectedOutput;
};

struct TestResult
{
  std::string testOutput;
  bool testPassed;
};

void testSolution();
TestResult runTestCase(const TestData& testData);
std::string formatResult(const TestData& testData, const TestResult& testResult);
void solution(std::istream& is, std::ostream& os);

static const bool IS_TESTING = false;

// define test data
static const std::vector<TestData> testDatas = {
  {1, "3200\npink\n", "pink\n"},
  {2, "3199\npink\n", "red\n"},
  {3, "4049\nred\n", "red\n"},
};

int main()
{
  if (IS_TESTING)
    testSolution();
  else
    solution(std::cin, std::cout);

  return 0;
}

void testSolution()
{
  for (const auto& testData : testDatas) {
    auto testResult = runTestCase(testData);

    std::cout << formatResult(testData, testResult);
  }
}

TestResult runTestCase(const TestData& testData)
{
    std::istringstream iss {testData.input};
    std::ostringstream oss {};

    solution(iss, oss);

    auto testOutput = oss.str();
    auto testPassed = testData.expectedOutput.compare(testOutput) == 0;
    
    return {testOutput, testPassed};
}

std::string formatResult(const TestData& testData, const TestResult& testResult)
{
  std::ostringstream oss {};

  oss << "Test " << std::setw(2) << testData.testNum << ": "
    << (testResult.testPassed ? "Passed!" : "Failed!") << std::endl;
  
  oss << "\tExpected: " << testData.expectedOutput << "\tActual  : " << testResult.testOutput << std::endl;

  return oss.str();
}


// solution to the problem
void solution(std::istream& is, std::ostream& os)
{
  // read input
  int a;
  std::string s;
  is >> a >> s;

  if (a < 3200)
    os << "red" << std::endl;
  else
    os << s << std::endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  string O, E;
  cin >> O >> E;

  rep (i, E.size()) cout << O[i] << E[i];

  if (O.size() > E.size()) cout << O[O.size() - 1];

  cout << endl;

}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
/*
ЗАПУСКАЕМ 
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░ 
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>


using namespace std;
template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;}
template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;}
#define files(FILENAME) read(FILENAME); write(FILENAME)
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define left left228
#define right right228
#define y1 y1228
#define mp make_pair
#define pb push_back
#define y2 y2228
#define rank rank228
using ll = long long;
using ld = long double;
const string FILENAME = "input";
const int Mod = 998244353;


int sum(int a, int b) {
	return (a + b >= Mod ? a + b - Mod: a + b);
}

int mul(int a, int b) {
	return (ll)a * b % Mod;
}


int a, b, c, d;
int dp[3005][3005];


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//read(FILENAME);
 	cin >> a >> b >> c >> d;
 	dp[a][b] = 1;
 	for (int i = a; i <= c; i++) {
 		for (int j = b; j <= d; j++) {
 			int val = dp[i - 1][j - 1];
 			int cnt = mul(val, mul(i - 1, j - 1));
 			dp[i][j] = sum(dp[i][j], Mod - cnt);
 			dp[i + 1][j] = sum(dp[i + 1][j], mul(dp[i][j], j));
 			dp[i][j + 1] = sum(dp[i][j + 1], mul(dp[i][j], i));
 		}
 	}
 	cout << dp[c][d] << endl;
	return 0;	 	
}


Measured memory_bytes: 38768
import java.io.*;
import java.util.*;

public class Main {
    private static ArrayList<LinkedList<Integer>> graph;
    public static void main(String[] args) throws Exception{
        FastScanner scanner = new FastScanner();
        int V = scanner.nextInt();
        int E = scanner.nextInt();

        graph = new ArrayList<>(V);
        for(int i = 0; i < V; ++i){
            graph.add(new LinkedList<>());
        }

        for(int i = 0; i < E; ++i){
            int u = scanner.nextInt();
            int v = scanner.nextInt();
            graph.get(u).add(v);
        }

        boolean[] visited = new boolean[V];
        ArrayList<Integer> result = new ArrayList<>(V);

        for(int i = 0; i < V; ++i){
            if(!visited[i]){
                dfs(i, visited, result);
            }
        }

        PrintWriter printWriter = new PrintWriter(System.out);
        for(int i = V - 1; i >= 0; --i){
            printWriter.println(result.get(i));
        }
        printWriter.flush();
    }

    private static void dfs(int u, boolean[] visited, ArrayList<Integer> result){
        visited[u] = true;
        for(Integer v : graph.get(u)){
            if(!visited[v]){
                dfs(v, visited, result);
            }
        }

        result.add(u);
    }

    private static class FastScanner{
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

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

#define ll long long
//#define MULTI_TEST

string s;
int k;

void solve() {
	cin >> k;
	cin >> s;
	for(int i=0; i<s.size(); i++) {
		if(i == k) {
			cout << "...";
			break;
		}
		cout << s[i];
	}
}



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
#ifdef MULTI_TEST
	int t;
	cin >> t;
	while(t--) {
		solve();
		cout << "\n";
	}
#else
	solve();
	cout << "\n";
#endif

	return 0;
}


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

using namespace std;

int main() {
    while (true) {
        int h;
        cin >> h;
        if (h == 0)break;

        vector<vector<int>> ban(h, vector<int>(5));
        for (int i = 0; i < h; i++)
            for (int j = 0; j < 5; j++)cin >> ban[i][j];

        int ret = 0;
        while (true) {
            bool found = false;

            for (int i = 0; i < h; i++) {
                bool flag = true;
                for (int j = 0; flag && j < 5; j++) {
                    int x = ban[i][j];
                    for (int k = 5; k >= j + 3; k--) {
                        bool same = true;
                        for (int l = j; l < k; l++)
                            if (ban[i][l] != x || ban[i][l] < 0)same = false;

                        if (same) {
                            found = true;
                            flag = false;
                            ret += x * (k - j);
                            for (int l = j; l < k; l++)ban[i][l] = -1;
                            break;
                        }
                    }
                }
            }

            for (int i = 0; i < 5; i++) {
                vector<int> v;
                for (int j = h - 1; j >= 0; j--) if (ban[j][i] > 0)v.push_back(ban[j][i]);

                for (int j = 0; j < h; j++) {
                    if (j < v.size())ban[h - 1 - j][i] = v[j];
                    else ban[h - 1 - j][i] = -1;
                }
            }
            if (!found)break;
        }

        cout << ret << endl;
    }
    return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

const double EPS=1e-10;

int Signum(double x)
{
	return abs(x)<EPS?0:x>0?1:-1;
}

typedef complex<double> Point;
struct Circle{
	Point c;
	double r;
	Circle(){}
	Circle(Point c,double r):c(c),r(r){}
};

double Dot(Point p1,Point p2)
{
	return real(conj(p1)*p2);
}

double Cross(Point p1,Point p2)
{
	return imag(conj(p1)*p2);
}

int CCW(Point a,Point b,Point c)
{
	Point d1=b-a,d2=c-a;
	double sign=Signum(Cross(d1,d2));
	if(sign)
		return sign;
	if(Dot(d1,d2)<-EPS)
		return -2;
	if(norm(d1)<norm(d2)-EPS)
		return 2;
	return 0;
}

Point Proj(Point a,Point b)
{
	return b*Dot(a,b)/norm(b);
}

string solve(Point t,Point o,const vector<Circle>& cirs)
{
	int n=cirs.size();
	rep(i,n){
		double r=cirs[i].r;
		Point c=cirs[i].c;
		bool out_t=r<abs(c-t);
		bool out_o=r<abs(c-o);
		if(out_t^out_o)
			return "Safe";
		if(out_t && out_o){
			Point p=t+Proj(c-t,o-t);
			if(abs(p-c)<r+EPS && CCW(t,p,o)==2)
				return "Safe";
		}
	}
	return "Danger";
}

int main()
{
	for(int n,m;cin>>n,n;){
		vector<Circle> cirs(n);
		rep(i,n)
			cin>>real(cirs[i].c)>>imag(cirs[i].c)>>cirs[i].r;
		cin>>m;
		vector<Point> t(m),o(m);
		rep(i,m)
			cin>>real(t[i])>>imag(t[i])>>real(o[i])>>imag(o[i]);
		
		rep(i,m)
			cout<<solve(t[i],o[i],cirs)<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,T;
  cin >> A >> B >> T;
  int biscuit = 0;
  int t = A;
  while(t < T + 0.5){
    biscuit += B;
    t += A;
  }
  cout << biscuit << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
bool solve(string x) {
    string x0 = x;
    reverse(all(x0));
    return x0 == x;
}
signed main(void) {
    string s;
    cin >> s;
    int N = s.size();
    string s0 = "", s1 = "";
    rep(i, (N - 1) / 2) {
        s0 += s[i];
        s1 += s[(N + 1) / 2 + i];
    }
    bool ans = true;
    ans &= (s0 == s1);
    ans &= solve(s0);
    ans &= solve(s1);
    if(ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll k;
  cin >> k;
  ll target = 7;
  ll count = 1;
  ll ans = -1;
  // while(k <= target) {
  REP(i, k) {
    if (target % k == 0) {
      ans = count;
      break;
    }
    else {
      target = (target * 10 + 7) % k;
      count++;
      // COUT(count);
    }
  }
  COUT(ans);
}

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

/*
4 5
0 5
-2 4
3 4
4 -4
*/


Measured memory_bytes: 3644
#48 ABC128E
#イベントソート   
import sys
input = sys.stdin.readline

n,q=map(int,input().split())
stx=[list(map(int,input().split())) for _ in range(n)]
d=[int(input()) for _ in range(q)]

stx=sorted(stx,key=lambda x:x[2])

ans=[-1 for _ in range(q)]
skip=[-1 for _ in range(q)]

from bisect import bisect_left

for s,t,x in stx:
	left=bisect_left(d,s-x)
	right=bisect_left(d,t-x)
	while left<right:
		if skip[left]==-1:
			ans[left]=x
			skip[left]=right
			left+=1
		else:
			left=skip[left]
print('\n'.join(map(str,ans)))

Measured memory_bytes: 127692
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin(),(x).end()
#define lowbit(x) x&-x
#define pb push_back
#define ls (id<<1)
#define rs (id<<1|1)
#define Rint register int
#define UNI(x) sort(ALL(x)),x.resize(unique(ALL(x))-x.begin())
#define GETPOS(c,x) (lower_bound(ALL(c),x)-c.begin())
#define LEN(x) strlen(x)
#define MS0(x) memset((x),0,sizeof((x)))
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<pii> Vpii;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(ll &x) { scanf("%lld", &x); }
void _R(ull &x) { scanf("%llu", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const ll &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
const int MAXN=2e6+10,MAXM=4e6+10;
const int INF=INT_MAX,SINF=0x3f3f3f3f;
const ll llINF=LLONG_MAX;
const int MOD=1e9+7,mod=998244353;
const int inv2=5e8+4;
const int Lim=1<<20;

int n,a[MAXN],tot,ans[MAXN];
Vi g[MAXN];
multiset<int> s;

void dfs(int u,int f)
{
    auto it=s.lower_bound(a[u]);
    multiset<int> tmp;
    if(it==s.end())tot++;
    else {
        tmp.insert(*it);
        s.erase(it);
    }
    s.insert(a[u]);
    ans[u]=tot;
    for(auto v:g[u])if(v!=f)
    {
        dfs(v,u);
    }
    s.erase(s.find(a[u]));
    tot=ans[f];
    for(auto j:tmp)s.insert(j);
}

void solve()
{
    R(n);
    for(int i=1;i<=n;i++)R(a[i]);
    for(int i=1;i<n;i++)
    {
        int u,v;R(u,v);
        g[u].pb(v);g[v].pb(u);
    }
    dfs(1,0);
    for(int i=1;i<=n;i++)W(ans[i]);
}

int main()
{
    //freopen("in.txt","r",stdin);
    int t=1;
    //R(t);
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 95740
if __name__ == '__main__':
    """
    :param N: days
    :param M: num of homeworks
    :param A: days to finish each homework
    """
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    need = sum(A)
    if N >= need:
        print(N-need)
    else:
        print(-1)



Measured memory_bytes: 10036
#include <iostream>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

#define INF 1e15
#define MAXN 100005
#define MAXM 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

ll ans, k = 0, tmp;
int X;
vi A;
set<ll> st;
map<ll, ll> mp;

void solve(){
    while(true){
        tmp = k * k * k * k * k;
        if(tmp > X+INF) break;
        st.insert(tmp);
        mp[k] = tmp;
        k++;
    }

    // cout << k << endl;

    rep(j, k+1){
        for(int i = j; i <= k; ++i){
            // cout << mp[i] << " " << mp[j] << endl;
            if(mp[i] + mp[j] == X){
                cout << i << " " << -j << endl;
                return;
            }


            if(mp[i] - mp[j] == X){
                cout << i << " " << j << endl;
                return;
            }
        }
    }
}

int main(){
    cin >> X;

    solve();
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = k; i < n; i++) {
        if(a[i] > a[i - k]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4816
from collections import defaultdict as dd
N=int(input())
a = list(map(int,input().split()))

res = 0
dic=dd(int)

for i in range(1,N):
    tmp = a[i]-i
    dic[tmp] += 1
for i in range(N-1):
    tgt = -a[i]-i
    res += dic[tgt]
print(res)


Measured memory_bytes: 61424
#!/usr/bin/env python3
def main():
    S = input()

    lst = set(['A', 'C', 'G', 'T'])
    cnt = 0
    ans = 0
    for s in S:
        if s in lst:
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    ans = max(ans, cnt)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61892
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>

using namespace std;

const int MAX = 1300;
struct Info{int t,n,m,s;};
typedef pair<int,int> P;
vector<Info> V;
bool used[MAX];
int N,M;

int solve(int ts, int te, int m){

  int ans = 0;

  vector<P> login;
  vector<P> logout;

  for(int i = 0; i < V.size(); i++){
    if(V[i].m == m && V[i].s == 1)
      login.push_back(P(V[i].n,V[i].t));

    if(V[i].m == m && V[i].s == 0)
      logout.push_back(P(V[i].n,V[i].t));
  }

  sort(login.begin(),login.end());
  sort(logout.begin(),logout.end());
  
  for(int i = 0; i < login.size(); i++){
    int ss = max(ts,login[i].second);
    int ee = min(te,logout[i].second);
    //    fill(used+ss,used+ee,true);
    for(int i = ss; i < ee; i++)
      used[i] = true;

  }

  for(int i = ts; i < te; i++)
    if(used[i]) ans++;

  return ans;
}

void init(){
  V.clear();
  memset(used,false,sizeof(used));
}

int main(){

  while(cin >> N >> M && N+M){
    init();
    int r;
    cin >> r;
    while(r--){
      Info f;
      cin >> f.t >> f.n >> f.m >> f.s;
      V.push_back(f);
    }

    int q;
    cin >> q;
    while(q--){
      memset(used,false,sizeof(used));
      int ts,te,m;
      cin >> ts >> te >> m;
      cout << solve(ts,te,m) << endl;
    }

  }
  return 0;
}

Measured memory_bytes: 1248
#include <stdio.h>
    
int main() {
  int H , W,i,j;
    
  while(1){
      scanf("%d",&H);/*縦を入力*/
     scanf("%d",&W);/*横を入力*/
    if(H == 0 && W == 0) {/*WとHがともに真の場合*/
      break;  /*ループから抜ける*/
    }
    for(j=1; j<=H; j++) {
      for(i=1; i<=W; i++) {
    printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
    
}


Measured memory_bytes: 2624
#include <iostream>
using namespace std;
int main(void){
    int len;
    string s;
    cin >> s;
    len = s.length();
    if((len%2 == 0 && s[0] == s[len-1]) || (len%2 == 1 && s[0] != s[len-1]))puts("First");
    else puts("Second");
}


Measured memory_bytes: 512
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	#ifndef ONLINE_JUDGE
 //   	freopen("input.txt", "r", stdin);
  //  	freopen("output.txt", "w", stdout);
//	#endif
	int n;
	cin>>n;
	vi a(n);
	int k;
	cin>>k;
	rep(i,n)cin>>a[i];
	int grundy[k+1];
	grundy[0] = 0;
	repa(i,1,k+1){
		map<int,int> m;
		rep(j,n){
			if(i - a[j] < 0)continue;
			m[grundy[i-a[j]]]++;
		}
		int ans;
		rep(j,n+1){
			if(m[j] == 0){
				ans = j;
				break;
			}
		}
		grundy[i] = ans;
	}
	int ans = 0;
	if(grundy[k] == 0){
		cout<<"Second";
	}
	else {
		cout<<"First";
	}
	return 0;
}

Measured memory_bytes: 640
n = int(input())
S = list(map(int, input().split()))
count = 0

def merge(A, left, mid, right):
	global count
	n1 = mid - left
	n2 = right - mid
	L = A[left:mid]
	R = A[mid:right]
	L.append(10000000000)
	R.append(10000000000)
	i = 0
	j = 0
	for k in range(left, right):
		count += 1
		if L[i] <= R[j]:
			A[k] = L[i]
			i += 1
		else:
			A[k] = R[j]
			j += 1

def mergeSort(A, left, right):
	if left + 1 < right:
		mid = (left + right) // 2
		mergeSort(A, left, mid)
		mergeSort(A, mid, right)
		merge(A, left, mid, right)

mergeSort(S, 0, n)
print(" ".join(map(str, S)))
print(count)


Measured memory_bytes: 66768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int P[100], a = 0, b = 0, c = 0, ans;
    for(int i=0;i<N;i++)
        cin >> P[i];
    for(int i=0;i<N;i++){
        if(P[i]<=A)
            a++;
        else if(A+1<=P[i] && P[i]<=B)
            b++;
        else
            c++;
    }
    ans = min(a,b);
    cout << min(c,ans) << endl;
    return 0;
}

Measured memory_bytes: 256