akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var hw = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            var maps = new char[hw[0] + 2][];

            string def = "";

            for(int i = 0; i < hw[1] + 2; i++) {
                def += ".";
            }

            maps[0] = def.ToArray();

            for(int i = 0; i < hw[0]; i++) {
                // 文字列の入力
                var s = ("." + Console.ReadLine() + ".").ToArray();
                maps[i + 1] = s;
            }

            maps[hw[0] + 1] = def.ToArray();

            for(int i = 1; i < hw[0] + 1; i++) {
                for( int j = 1; j < hw[1] + 1; j++) {
                    if(maps[i][j] == '#') {
                        Console.Write('#');
                    } else {
                        var num = 0;
                        if(maps[i - 1][j - 1] == '#') {
                            num++;
                        }
                        if (maps[i - 1][j] == '#') {
                            num++;
                        }
                        if (maps[i - 1][j + 1] == '#') {
                            num++;
                        }
                        if (maps[i][j - 1] == '#') {
                            num++;
                        }
                        if (maps[i][j + 1] == '#') {
                            num++;
                        }
                        if (maps[i + 1][j - 1] == '#') {
                            num++;
                        }
                        if (maps[i + 1][j] == '#') {
                            num++;
                        }
                        if (maps[i + 1][j + 1] == '#') {
                            num++;
                        }
                        Console.Write(num);
                    }
                }
                Console.Write("\n");
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define p pair<int,int>
#define reverse(s) reverse(s.begin(), s.end());
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }



int main() {
	int m,n;
	cin >> m >> n;
	int min2 = INF;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		if (b <= n) {
			min2 = min(min2, a);
		}
	}
	if (min2 == INF) {
		cout << "TLE" << endl;
	}
	else {
		cout << min2 << endl;
	}
	return 0;
}



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

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

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

    int max = *max_element(X.begin(), X.end());

    int hp_min = 100000000;
    for (int i = 1; i <= max; i++) {
        int hp = 0;
        for (int j = 0; j < N; j++) {
            hp += pow(X[j] - i, 2);
        }

        if (hp < hp_min) {
            hp_min = hp;
        }
    }

    cout << hp_min << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, p;
    while(cin >> n >> p) {
        if(!n && !p) break;
        int ord = p;
        int turn = 0;
        int array[60] = {};
        while(1) {
            if(p != 0) {
                array[turn]++;
                p--;
            }
            else if(p == 0) {
                p += array[turn];
                array[turn] = 0;
            }

            if(array[turn] == ord) {
                cout << turn << endl;
                break;
            }
            turn = (turn + 1) % n;
        }
    }
    return 0;
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
  int q,k,p;
  vector<int> a;
  cin >> p;

  REP(i,p){
      cin >> k;
      if(k == 0){
          cin >> q;
          a.pb(q);
        }else if(k == 1){
            cin >> q;
            cout << a[q] << endl;
          }else{
              a.popb();
            }
    }
    return 0;
}


Measured memory_bytes: 3860
<?php
fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%s", $T);

$lenS = strlen($S);
$lenT = strlen($T);

$a = [];

for ($i = 0; $i < $lenS - $lenT + 1; $i++) {
    $partS = substr($S, $i, $lenT);
    $a[] = same($partS, $T);
}
printf("%d", $lenT - max($a));

function same($a, $b) {
    if (strlen($a) !== strlen($b)) return false;
    
    $array_a = str_split($a);
    $array_b = str_split($b);
    
    $ret = 0;
    
    for ($i = 0; $i < count($array_a); $i++) {
        if ($array_a[$i] === $array_b[$i]) {
            $ret++;
        }
    }
    
    return $ret;
}


Measured memory_bytes: 16288
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace AizuOnlineJudge
{
    //    1
    // 4 2 3 5
    //    6



    class Program
    {

        static void Main(string[] args)
        {
            var dice = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var dict = new Dictionary<int, int>();
            for(var i = 0; i < dice.Length; ++i)
            {
                dict.Add(dice[i], i);
            }

            var rtables = new int[][]
            {
                new int[]{ 3, 1, 2, 4 }, //1上, 6上(Rev)
                new int[]{ 5, 2, 0, 3 }, //2上, 5上(Rev)
                new int[]{ 0, 1, 5, 4 }, //3上, 4上(Rev)
                new int[]{ },
                new int[]{ },
                new int[]{ },
            };
            for(var i = 0; i < 3; ++i)
            {
                rtables[3 + i] = rtables[2 - i].Reverse().ToArray();
            }

            var ques = int.Parse(Console.ReadLine());
            for(var i = 0; i < ques; ++i)
            {
                var uf = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                int index_u = dict[uf[0]], index_f = dict[uf[1]];
                var arr = rtables[index_u];
                var result = -1; // from 0<=S<=100
                for(var k = 0; k < arr.Length - 1; ++k)
                {
                    if (arr[k] == index_f) result = dice[arr[k + 1]];
                }
                if (result < 0) result = dice[arr[0]];
                Console.WriteLine(result);
            }
        }
    }
}


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

using namespace std;
typedef long long ll;

const int N=2005,M=4000005,P=1E9+7;

int fac[M],ifac[M],n,K,m,dp[N][N];
inline int power(int a,int t){static int r;for(r=1;t;a=(ll)a*a%P,t>>=1)if(t&1)r=(ll)r*a%P;return r;}
inline int C(int n,int m){return(ll)fac[n]*ifac[m]%P*ifac[n-m]%P;}

int main(){
	scanf("%d%d",&n,&K);
	if(K==1)puts("1"),exit(0);
	m=n*K,fac[0]=1;
	for(int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%P;
	ifac[m]=power(fac[m],P-2);
	for(int i=m;i>=1;i--)ifac[i-1]=(ll)ifac[i]*i%P;
	dp[0][0]=1;
	for(int i=1;i<=n;i++)for(int j=0;j<=i;j++){
		if(j)dp[i][j]=dp[i][j-1];
		dp[i][j]=(dp[i][j]+(ll)dp[i-1][j]*C(i*(K-1)+j-1,K-2))%P;
	}
	printf("%d\n",(ll)dp[n][n]*fac[n]%P);
	return 0;
}

Measured memory_bytes: 46336
#include <bits/stdc++.h>
using namespace std;
#define clr(a, x) memset(a, x, sizeof(a))
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
#define X first
#define Y second
#define fastin                  \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-6;
int main() {
        ll n;
	    ll ans = 0;
        ll now = 1;
        ll r = 1;
        cin >> n;
            now = 1;
            r = 1;
            ans = 0;
            for(;now <= n; now = n /(n / now) + 1) {
            r = n / (n / now);
            if(n/(n / now) - 1 >= now && n/(n / now) - 1 <= r && n %(n / now) == 0)
            ans += n /(n / now) - 1;
            }
            cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

string s;

bool isbalanced(int l, int r){
    int p = 0;
    for(int i=l;i<r;i++){
        if(s[i]=='('){
            p++;
        }else if(s[i]==')'){
            p--;
            if(p<0)return false;
        }
    }
    if(p==0)return true;
    else return false;
}


bool isoperation(char ch){
    if(ch=='+' || ch=='-' || ch=='*' || ch=='/')return true;
    else return false;
}

void merge(set<int> &t, set<int> a, set<int> b, char op){
    for(auto elma: a){
        for(auto elmb: b){
            if(op=='+'){
                t.insert(elma+elmb);
            }else if(op=='-'){
                t.insert(elma-elmb);
            }else if(op=='*'){
                t.insert(elma*elmb);
            }else{
                assert(op=='/');
                if(elmb==0)continue;
                t.insert(elma/elmb);
            }
        }
    }
}

pii remove_bracket(int l, int r){
    int lc = 0, rc = 0;
    while(s[l+lc]=='(' && s[r-rc-1]==')'&&r-rc-1-l-lc>=2){
        lc++, rc++;
    }
    
    int p = 0;
    for(int i=l+lc;i<r-rc;i++){
        if(s[i]=='('){
            p++;
        }else if(s[i]==')'){
            p--;
            if(p<0){
                p++;
                lc--;
            }
        }
    }
    rc -= p;
    
    int v = min(lc,rc);
    return pii(l+v, r-v);
}

bool used[201][201]={};
set<int> dp[201][201];
set<int> dfs(int l, int r){
    if(used[l][r])return dp[l][r];
    used[l][r] = true;
    
    if( not isbalanced(l,r) ){
        return dp[l][r] = set<int>();
    }
    
    int ld, rd;
    tie(ld, rd) = remove_bracket(l,r);
    
    int num_of_op = 0;
    for(int i=ld;i<rd;i++){
        if( isoperation(s[i]) )num_of_op++;
    }
    if(num_of_op==0){
        return dp[l][r] = set<int>{stoi(s.substr(ld,rd-ld))};
    }

    for(int i=ld;i<rd;i++){
        if( isoperation(s[i]) ){
            merge(dp[l][r], dfs(ld,i), dfs(i+1,rd), s[i]);
        }
    }
    
    return dp[l][r];
}


signed main(){
    while(cin>>s&&s!="#"){
        rep(i,201)rep(j,201){
            used[i][j] = false;
            dp[i][j].clear();
        }
        cout<<dfs(0,s.size()).size()<<endl;
    }
}




Measured memory_bytes: 5212
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll L,n; cin >> L >> n;
    vector<ll> x(n); rep(i,n) cin >> x[i];

    ll ans = 0;
    rep(loop,2){
        //cout << "--------------------" << endl;
        vector<ll> rx(n);
        rep(i,n) rx[i] = L - x[n-1-i];
        vector<ll> sx(n+1,0),srx(n+1,0);
        for(int i=0;i<n;i++) sx[i+1] = sx[i] + x[i];        // sx[i] = x[0] + ... + x[i-1]
        for(int i=0;i<n;i++) srx[i+1] = srx[i] + rx[i];     // srx[i] = rx[0] + ... + rx[i-1]

        //cout << "x  " << x << endl;
        //cout << "sx " << sx << endl;
        //cout << "rx  " << rx << endl;
        //cout << "srx " << srx << endl;


        for(int i=0;i<n;i++){   // 反時計周りにi個の木を燃やし,燃やした後に方向を逆転しない
            //cout << "---------- " << i << endl;
            const int r = (n-i+1)/2;
            const int l = n - i - r;

            ll cur = 2*(sx[i+r] - sx[i]);
            cur += 2*srx[l];

            //cout << "right " << sx[i+r] - sx[i] << endl;
            //cout << "left  " << srx[l] << endl;
            //cout << "cur = " << cur << endl;

            if(l != r){ // 最後にr
                cur -= x[i+r-1];
            }else{      // 最後にl
                cur -= rx[l-1];
            }

            //cout << "cur " << cur << endl;
            ans = max(ans,cur);
        }

        //break;
        // 2回目は初手時計回り確定の処理をするが,座標を反転していけば同一処理を使いまわせる
        swap(x,rx);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6528
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

ll solve()
{
    ll N;

    std::cin >> N;

    return (N / 500ll) * 1000ll +  (N - (N / 500ll * 500ll)) / 5ll * 5ll;
}

int main()
{
    std::cout << solve() << std::endl;
    //solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int M=1e5+10;
int n,m,deg_in[M],ans;
int dp[M];
vector<int> G[M];
int dfs(int u)
{
    if(dp[u])
        return dp[u];
    int re=0;
    for(int v: G[u])
        re=max(re,dfs(v));
    return dp[u]=re+1;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0,u,v;i<m;i++)
        scanf("%d%d",&u,&v),G[u].push_back(v),deg_in[v]++;
    for(int i=1;i<=n;i++)
        if(!deg_in[i])
            ans=max(ans,dfs(i));
    printf("%d\n",ans-1);
    return 0;
}


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

int main(){
    int n, m;
    cin >> n >>m;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    double b = (double)sum / 4 / m;
    sort(a.begin(), a.end(), greater<int>());
    if(a[m - 1] >= b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
program main;
var 
    n, m, sum, i, count, comp : integer;
    a : array[1..100] of integer;

begin
    readln(n, m);

    sum := 0;
    for i := 1 to n do begin
        read(a[i]);
        sum += a[i];
    end;

    comp := sum div (4 * m);
    if ((sum mod (4 * m)) > 0) then
        comp := comp + 1;

    count := 0;
    for i := 1 to n do 
        if (a[i] >= comp) then
            count := count + 1;
    
    if (count >= m) then 
        writeln ('Yes')
    else 
        writeln ('No');
end.

Measured memory_bytes: 1376
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
  int n, m, x; cin >> n >> m >> x;
  vector<int> a(m); for(int i = 0; i < m; ++i) cin >> a[i];
  int cntZero=0, cntN = 0;
  for(int i = 0; i <= x; i++) {
    for(int j = 0; j < m; ++j) {
      if(i == a[j]) cntZero++;
    }
  }
  for(int i = x; i < n; i++) {
    for(int j = 0; j < m; ++j) {
      if(i == a[j]) cntN++;
    }
  }
  cout << min(cntZero, cntN) << endl;
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  vector<int> vx(5);
  int ans;
  for (int i = 0; i < 5; ++i) {
    cin >> vx[i];
    if (vx[i] == 0) {
      ans = i + 1;
    }
  }

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

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

class Point {
public:
  int x, y;
  Point(int x, int y) : x(x), y(y){};
};

int main() {
  while (1) {
    int n;
    cin >> n;
    if (n == 0)
      break;

    vector<Point> gold;
    int x, y;
    for (int i = 0; i < n; i++) {
      cin >> x >> y;
      gold.push_back(Point(x, y));
    }

    int m;
    cin >> m;
    char dir;
    int dist;
    int isVisited[22][22] = {};
    Point cur(10, 10);
    isVisited[10][10] = 1;
    for (int i = 0; i < m; i++) {
      cin >> dir >> dist;
      switch (dir) {
      case 'N':
        for (int j = 0; j < dist; j++) {
          isVisited[cur.x][++cur.y] = 1;
        }
        break;

      case 'S':
        for (int j = 0; j < dist; j++) {
          isVisited[cur.x][--cur.y] = 1;
        }
        break;

      case 'E':
        for (int j = 0; j < dist; j++) {
          isVisited[++cur.x][cur.y] = 1;
        }
        break;

      case 'W':
        for (int j = 0; j < dist; j++) {
          isVisited[--cur.x][cur.y] = 1;
        }
        break;
      }
    }

    int k;
    for (k = 0; k < gold.size(); k++) {
      if (isVisited[gold[k].x][gold[k].y] == 0) {
        break;
      }
    }

    if (k == gold.size()) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3080
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
int a,b,c;
int main() {
	cin>>a>>b>>c;
	cout<<min(c,b/a)<<endl;
}

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

int N;

const int MAX_SIZE = 1000000;
bool isPrime[MAX_SIZE];
void seive(){
	memset(isPrime, -1, sizeof(isPrime));
	isPrime[0] = isPrime[1] = false;
	for(int i=2; i*i<MAX_SIZE; i++)if(isPrime[i]){
		for(int j=i<<1; j<MAX_SIZE; j+=i){
			isPrime[j] = false;
		}
	}
}

int solve(){
	int ret = 0;
	for(int i=N+1; i<=2*N; i++)if(isPrime[i]){
		ret++;
	}
	return ret;
}

int main(){
	seive();
	while(scanf("%d\n",&N), N){
		printf("%d\n",solve());
	}
	return 0;
}

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

int N;
int a[101];
void print(){
	for (int i = 0; i < N; ++i){
		if (i != 0) cout << " ";
		cout << a[i];
	}
	cout << '\n';
}
void insertionSort(){
	for (int i = 1; i < N; ++i){
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v){
			a[j + 1] = a[j];
			--j;
		}
		a[j + 1] = v;
		print();
	}
}

int main(){
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> a[i];
	print();
	insertionSort();
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=998244353;



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











}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int h[n];
	long long a[n];
	for(int i=0;i<n;i++)
		cin >> h[i];
	for(int i=0;i<n;i++)
		cin >> a[i];
	set <int> s;
	long long b[n+1]={0};
	s.insert(0);
	long long m=0;
	for(int i=0;i<n;i++){
		set <int>::iterator it,t;
		it=s.upper_bound(h[i]);
		it--;
		b[h[i]]=a[i]+b[*it];
		it=s.upper_bound(h[i]);
		while(it!=s.end() and b[*it] <= b[h[i]]){
			t=it;
			it++;
			s.erase(t);
		}
		s.insert(h[i]);
		m=max(b[h[i]],m);
	}
	cout << m << endl;
}

Measured memory_bytes: 13568
def slove():
    import sys
    input = sys.stdin.readline
    k, s = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    for i in range(k + 1):
        for j in range(k + 1):
            n = s - i - j
            if 0 <= n <= k:
                cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()


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

int main(){
  int N, M;
  int P[1001], SUM[1000001];
  P[0] = 0;
  while(cin >> N >> M , N){

    for(int i = 1 ; i <= N ; i++ ){
      cin >> P[i];
    }
    int cnt = 0;
    for(int i = 0 ; i <= N ; i++ ){
      for(int j = N ; j >= i ; j-- ){
        if(P[i] + P[j] > M) continue;
        SUM[cnt++] = P[i] + P[j];
      }
    }
    sort( SUM, SUM + cnt);

   int ret = 0;
    for(int i = 0 ; i < cnt ; i++ ){
      ret = max( ret, SUM[i] + *(upper_bound( SUM, SUM + cnt, M - SUM[i]) - 1));
    }
    cout << ret << endl;
  }
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;

const int mod = 1e9+7;
const ll INF = 1e18;



int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> v(N);

    for(auto &i : v){
        cin >> i;
    }

    sort(v.begin(),v.end());
    int ans=0;
    for(int i =0  ; i < K ;i++){
        ans += v[i];
    }

    cout << ans;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

const long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

ll n,k;
vector<ll> G[100010];
bool used[100010];

ll dfs(ll now) {
  used[now] = 1;
  ll ans = 1;
  ll sz = sz(G[now]);
  if (now == 1) {
    ll tmp = k - 1;
    for (ll i = 0; i < sz; i++) {
      ans *= tmp--;
      ans %= MOD;
      ans *= dfs(G[now][i]);
      ans %= MOD;
    }
  } else {
    ll tmp = k - 2;
    for (ll i = 0; i < sz; i++) {
      if (used[G[now][i]]) continue;
      ans *= tmp--;
      ans %= MOD;
      ans *= dfs(G[now][i]);
      ans %= MOD;
    }
  }
//  cout << "*" << now << " " << ans << endl;
  return ans;
}

void solve() {
  cin >> n >> k;
  REP(i,n - 1) {
    ll a,b;
    cin >> a >> b;
    G[a].pb(b);
    G[b].pb(a);
  }
  cout << (dfs(1) * k) % MOD << endl;
}

int main(int argc, char *argv[]){

  /* Regular */
  int case_num = 1;
  if (argc > 1 && stoi(argv[1])) cin >> case_num;
  REP(case_no, case_num) {
    cerr << endl << "case " << case_no + 1 << endl;
    solve();
  }
  
  // /* AOJ */
  // solve();
  return 0;
}

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

#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ll long long int
 
using namespace std;

 
int main()
{

	     ll a[6];
	     for(int i=1;i<6;i++)
	     {
	          cin>>a[i];
	          if(a[i]==0)
	          cout<<i<<"\n"; 
	     }


	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
using namespace std;
int main(){
	int n,m;
	while(cin >>n>>m){
		if(!n && !m){break;}
		bool potato[1000] = {0};
		int p = 0, x;
		for(int i=0; i<n; i++){
			x = m;
			for(;;p++){
				if(!potato[p]){x--;}
				if(!x){potato[p] = true;break;}
				if(p>=n){p-=n;}
			}
		}
		cout<<p+1<<endl;
	}
	return 0;
}

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

using ll = long long;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SIZE(a) ((int)(a).size())

const int N = 2005;
const int M = N*N;

bitset<M> f;

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

	int n, sum = 0;
	cin >> n;
	vector<int> a(n);
	REP(i, n) cin >> a[i], sum += a[i];
	f[0] = 1;
	REP(i, n) f |= f << a[i];
	REP(i, sum+1) if (i+i >= sum && f[i]) {
		cout << i << '\n';
		return 0;
	}

	return 0;
}

Measured memory_bytes: 1792
n = int(input())
aa = sorted([int(input()) for i in range(n)])

start = 1
end = n - 1

left = aa[0]
right = aa[0]

ans = 0

while start <= end:
    s = [abs(left - aa[start]), abs(right - aa[start]), abs(left - aa[end]), abs(right - aa[end])]
    if s[0] >= max(s[1], s[2], s[3]):
        left = aa[start]
        start += 1
    elif s[1] >= max(s[2], s[3], s[0]):
        right = aa[start]
        start += 1
    elif s[2] >= max(s[3], s[0], s[1]):
        left = aa[end]
        end -= 1
    elif s[3] >= max(s[0], s[1], s[2]):
        right = aa[end]
        end -= 1
    ans += max(s)

print(ans)

Measured memory_bytes: 8284
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#define INF (long)1e9
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	if(min(b, d) - max(a, c) < 0)
	{
		cout << 0 << endl;
	}
	else
		cout << min(b, d) - max(a, c) << endl;
	return 0;
}



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

int main() {
int  N;
    cin >> N ;
string A;
bool a=false;
  for (int i = 0; i < N; ++i){
  cin >> A ;
    if(A=="Y") a=true;
  }
 if (a==true)  cout << "Four"<< endl;  
  else cout << "Three" << endl;
}


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

int main() {
  string s;
  int f = 1;
  cin >> s;
  for(int i = 0; i < s.length(); i++) {
    if(i % 2) {
      if(s.at(i) == 'R')
        f = 0;
    } else {
      if(s.at(i) == 'L')
        f = 0;
    }
  }
  cout << (f ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include<vector>
#include<cstring>
#include<set>
#include <cstdio>
#include<queue>
#include<map>
#define WHITE 0
#define GRAY  1
#define BLACK 2
#define endl '\n'
#define forup(i,a,n) for( int i =a; i < n; i++)
#define llforup(i,a,n) for( ll i =a; i < n; i++)
#define fordown(i,a,n) for( int i =a; i >= n; i--)
#define fornot(i,a,n) for( int i=a;!n;i++)
#define mod  (ll)(1e9+7)
#define ifempty(a)  if(!a)
using namespace std;
typedef long long ll;
inline int readnum()
{
	int p, data = 0; char ch = 0;
	while ((ch != '-') &&( ch < '0' || ch>'9') )//注意运算优先级，逻辑与大于逻辑非
		ch = getchar();//相当于正则表达式的搜索，跳过不需要的字符
	if (ch == '-')
		p = -1, ch = getchar();//不能与if平行放置，不懂为什么，可能是bug
	else p = 1;
	while (ch >= '0' && ch <= '9') data = data * 10 + ch - '0', ch = getchar();//搜索需要的字符
	return data * p;
}
inline int ReadPossitive()
{
	char ch; int data = 0;
	ch = getchar();
	while (ch == ' ' || ch == '\n')ch = getchar();
	while (ch != ' ' && ch != '\n' && ch != EOF)
	{
		data = data * 10 + ch - '0';
		ch = getchar();
	}
	return data;
}
//E-mail 374656045@qq.com
#define INF (1<<30)//最大范围是1<<31-1
struct edge { 
	int to; int value; 
	edge() {}
	edge(int to,int value):to(to),value(value){}//初始化列表，速度更快
};
class solve {
private:
	vector<edge>* G;
	int n;
	int s, t, value;
	int* distance;
public://采用邻接表建图,带权无向图
	solve()
	{
		initial();
		SetDistance();
		bfs(0);
		int maxv = 0, SpringBoard=0;
		forup(i, 0, n)
		{
			if (distance[i] > maxv)
			{
				maxv = distance[i];
				SpringBoard = i;
			}
		}
		SetDistance();
		bfs(SpringBoard);
		maxv = 0;
		forup(i, 0, n)
		{
			if (distance[i]>maxv)
			{
				maxv = distance[i];
			}
		}
		cout << maxv << endl;
	}
	void initial()
	{
		n = ReadPossitive();
		G = new vector<edge>[n];
		distance = new int[n];
		forup(i, 0, n-1)
		{
			s = ReadPossitive(); t = ReadPossitive(); value = ReadPossitive();
			G[s].push_back(edge(t, value));
			G[t].push_back(edge(s, value));
		}
	}
	inline void SetDistance()
	{
		forup(i, 0, n)
		{
			distance[i] = INF;
		}
	}
	void bfs(int s)//用dfs也可以
	{
		distance[s] = 0;
		queue<int>Q; Q.push(s);
		int parent;
		edge e;
		while(!Q.empty())
		{
			parent = Q.front(); Q.pop();
			forup(i, 0, G[parent].size())
			{
				e = G[parent][i];
				if (distance[e.to] == INF)//由于是树，可以保证每个点只有一个父节点。所以没有访问到的点distance一定是INF，也可以说每个结点仅被访问一次。
				{
					distance[e.to] = distance[parent] +e.value;//小dp，递推计算距离
					Q.push(e.to);
				}
			}
		}
	}
};
int main(void)
{
	ios_base::sync_with_stdio(0); cin.tie(0);//慎用，cin和scanf混用会导致非MSC++WA
#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve solution;
#ifdef DEBUG
	fclose(stdin);//关闭文件 
	fclose(stdout);//关闭文件 
#endif
	return 0;

}




Measured memory_bytes: 9932
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main() {
  int N, A, B;
  string S;
  cin >> N >> A >> B >> S;
  int num = 0, cnt = 0;
  rep(i, N) {
    if (S[i] == 'a') {
      if (num < A+B) {
        cout << "Yes" << endl;
        num++;
      } else
        cout << "No" << endl;
    } else if (S[i] == 'b') {
      if (num < A+B && cnt < B) {
        cout << "Yes" << endl;
        num++;
        cnt++;
      } else
        cout << "No" << endl;
    } else
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 896
import java.io.*;

public class Main {
	public static void main(String[] args)throws IOException{
		//System.out.println("Hello world");
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br =new  BufferedReader(is);
		
		int[] n = new int[10];
		for(int i = 0; i <10; i++){
			String str = br.readLine();
			n[i] = Integer.parseInt(str);
		}
		int[] max = new int[3];
		max[2] = n[0];
		for(int i = 0; i <10; i++){
			if(max[2] <= n[i]){
				max[2] = n[i];
				if(max[2] >= max[1]){
					int re = max[1];
					max[1] = max[2];
					max[2] = re;
					if(max[1] >= max[0]){
						int re2 = max[0];
						max[0] = max[1];
						max[1] = re2;
					}
				}
			}
			
		}
		
		for(int i = 0; i <3; i++){
			System.out.println(max[i]);
		}
		
	}

}

Measured memory_bytes: 9344
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
	ll x;
	cin>>x;
	return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 
 
vector <vector <int> > g;
vector <int> val;
vector <int> a;
 int dfs(vector <bool> &visited,int s);
 vector <int> test;
  vector <int> ans;
  void rerooting(int s,vector <bool> &visited);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll r=nxtl(),c=nxtl();
    if(r==1||c==1)
    {
        cout<<"1\n";
        return 0;
    }
    if(r*c%2==0)
        cout<<(r*c)/2<<endl;
    else
    cout<<((r*(c-1))/2)+(r+1)/2<<endl;

    return 0;   
}


 
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define FOR(x,st,n) for(int x = (st); x < (n); ++ x)
#define mem0(a) memset(a,0,sizeof(a))
#define mem_1(a) memset(a,-1,sizeof(a))
#define mem0x(a) memset(a,0x3f,sizeof(a))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN(a,b) (a)<(b)?(a):(b)
#define INF 0x7f7f7f7f
using namespace std;


typedef long long ll;
//typedef __int64_t i64;
typedef long long unsigned llu;
typedef pair<int,int> P;
typedef vector<P> vp;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
const int N = 50001;


int main(){
    
    int n,m,q;
    int a,b;//c,tmp,cur;

    //string opt;
    cin>>n>>m;
    b=0;
    while(m--){
        cin>>a;
        b+=a;
    }
    if(b>=n) cout<<"Yes\n";
    else cout<<"No\n";
    
   
    
    
    return 0;
}


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

unsigned euclidean_gcd(unsigned a, unsigned b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main(){
    int N;
    cin >> N;
    int hp_gcd;
    cin >> hp_gcd;
    for(int i=1;i<N;i++){
        int hp;
        cin>>hp;
        hp_gcd=euclidean_gcd(hp_gcd,hp);
    }
    cout << hp_gcd << endl;
    return 0;
}

Measured memory_bytes: 256
N, H = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)

max_a = A[0]

ans = 0
i = 0

T = [b for b in B if b > max_a]
for t in T:
    H -= t
    ans += 1
    if H <= 0:
        print(ans)
        exit()

ans += -(-H//max_a)
print(ans)


Measured memory_bytes: 12112
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main()
{
    int n;
    cin >> n;
    for (int m = n; m <= 999; m++)
    {
        if (m % 111 == 0)
        {
            cout << m << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
from itertools import product
import sys
sys.setrecursionlimit(10**9)

N, MOD = int(input()), 10 ** 9 + 7
dp = [[0] * 64 for _ in range(N+1)]
strs = [""] * 64
strs_d = {}
for i, s in enumerate(product("AGCT", repeat=3)):
    strs[i] = "".join(s)
    strs_d["".join(s)] = i

def check(s):
    assert len(s) == 4
    if "".join(s).count("AGC") >= 1:
        return False
    for i in range(3):
        s[i], s[i + 1] = s[i + 1], s[i]
        if "".join(s).count("AGC") >= 1:
            return False
        s[i], s[i + 1] = s[i + 1], s[i]
    return True

# dp[i][str] := N-i桁かつ末尾4桁がstr文字列のとき、作成可能な文字列の個数

dp[0] = [1] * 64
for i in range(1,1+N):
    for j, s in enumerate(strs):
        for ns in "AGCT":
            if check(list(s+ns)):
                dp[i][strs_d[s[1:]+ns]] += dp[i-1][j]
                dp[i][strs_d[s[1:]+ns]] %= MOD

if N == 3:
    print("61")
else:
    print(sum(dp[N-3])%MOD)



Measured memory_bytes: 68620
import java.io.*

val pw = PrintWriter(System.out)
const val MOD = 1000000007L
const val INF = 2147483647
const val LINF = 9223372036854775807L

fun main(args: Array<String>) {
    solve()
    pw.flush()
}

fun solve() {
    val c = next()
    val ans = c[0] + 1
    println(ans.toChar())


}

fun println(v: String) {
    pw.println(v)
}

fun print(v: String) {
    pw.print(v)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ").toMutableList()
fun nextIntList(index: Int = 0) = next().split(" ").map { it.toInt() + index }.toMutableList()
fun nextLongList(index: Long = 0L) = next().split(" ").map { it.toLong() + index }.toMutableList()
fun nextDoubleList() = next().split(" ").map { it.toDouble() }.toMutableList()

fun ary(n: Int, init: String = "") = Array(n) { init }
fun intAry(n: Int, init: Int = 0) = IntArray(n) { init }
fun longAry(n: Int, init: Long = 0L) = LongArray(n) { init }
fun doubleAry(n: Int, init: Double = 0.0) = DoubleArray(n) { init }
fun ary2(n: Int, m: Int, init: String = "") = Array(n) { Array(m) { init } }
fun intAry2(n: Int, m: Int, init: Int = 0) = Array(n) { IntArray(m) { init } }
fun longAry2(n: Int, m: Int, init: Long = 0) = Array(n) { LongArray(m) { init } }
fun doubleAry2(n: Int, m: Int, init: Double = 0.0) = Array(n) { DoubleArray(m) { init } }
fun ary3(n: Int, m: Int, k: Int, init: String = "") = Array(n) { Array(m) { Array(k) { init } } }
fun intAry3(n: Int, m: Int, k: Int, init: Int = 0) = Array(n) { Array(m) { IntArray(k) { init } } }
fun longAry3(n: Int, m: Int, k: Int, init: Long = 0L) = Array(n) { Array(m) { LongArray(k) { init } } }
fun doubleAry3(n: Int, m: Int, k: Int, init: Double = 0.0) = Array(n) { Array(m) { DoubleArray(k) { init } } }

fun abs(n: Int): Int = Math.abs(n)
fun abs(n: Long): Long = Math.abs(n)
fun abs(n: Double): Double = Math.abs(n)
fun max(vararg values: Int) = if (values.isEmpty()) -INF else values.max()!!
fun max(vararg values: Long) = if (values.isEmpty()) -LINF else values.max()!!
fun min(vararg values: Int) = if (values.isEmpty()) INF else values.min()!!
fun min(vararg values: Long) = if (values.isEmpty()) LINF else values.min()!!
fun swap(a: String, b: String) = Pair<String, String>(b, a)
fun swap(a: Int, b: Int) = Pair<Int, Int>(b, a)
fun swap(a: Long, b: Long) = Pair<Long, Long>(b, a)
fun swap(a: Double, b: Double) = Pair<Double, Double>(b, a)

fun gcd(a: Int, b: Int): Int = if (a % b == 0) b else gcd(b, (a % b))

Measured memory_bytes: 31776
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll A, B;
    cin >> A >> B;

    if(A <= 8 && B <= 8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }

    return 0;
}

Measured memory_bytes: 3524
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public void Sort(){

	}

	public void maain(){

	}

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????

		//1???????????\????????¢
	       StringBuilder buider = new StringBuilder();

	       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String n = br.readLine();
        int count = 0;
        int yard = 0;

        //
        int[] num = new int[Integer.parseInt(n)];

        String[] input2 = br.readLine().split(" ");

        for(int i = 0; i < num.length; i++){
        	num[i] = Integer.parseInt(input2[i]);
        }

        //
        for(int i = 0; i < num.length ; i++){

        	for(int j = num.length - 1 ; i + 1 <= j; j--){
    			
        		if(num[j] < num[j - 1]){

        			count++;
        			yard = num[j];
        			num[j] = num[j - 1];
        			num[j - 1] = yard;
        		}
        	}
        }

        //
        for(int i = 0; i < num.length; i++){

        	if(i == num.length - 1){
        		System.out.println(num[i]);
        		System.out.println(count);
        	}else{
            	System.out.print(num[i] + " ");
        	}
        }
	}
}

Measured memory_bytes: 24352
#include <stdio.h>
int main() {
  int a, b, c, n;
  scanf("%d %d %d", &a, &b, &c);
  for (int i = 0; i < 2; i++) {
    if (a > b) {
      n = b; b = a; a = n;
    }
    if (b > c) {
      n = c; c = b; b = n;
    }
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}

Measured memory_bytes: 1808
#include<stdio.h>
#include<map>
#include<string>
#include<string.h>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<math.h>
#include<stack>
#include<set>
#define INF 2147483647
#define loop(i, a, b) for(int i=a; i<=b; i++)
#define mem(arr) memset(arr, 0, sizeof(arr));
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
typedef vector<int> vec;
typedef priority_queue<int, vector<int>, greater<int> > pQ;
typedef queue<int> Q;
typedef set<int> S;
struct edge{
	int to, value;
};
void solve();
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 1, times)
	{
		solve();
		cout << '\n';
	}
	return 0;
}
const int n = 2e5;
vector<edge> tree[n + 50];
int a, b, c, d, e, f;
int arr[n + 50], arr1[n + 50], arr2[n + 50];
string str, str1, str2;

void solve()
{
	cin >> a;
	cin >> str;
	stack<char> S;
	S.push(str[0]);
	int cnt = 1;
	for(int i=1; i<a; i++)
	{
		if(str[i] == S.top()) continue;
		else
		{
			cnt ++;
			S.push(str[i]);
		}
	}
	cout << cnt << '\n';
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();


int main() {
    int n, m;
    cin >> n >> m;
    int run_all = (n-m) * 100 + 1900*m;
    cout << run_all * (1<<m) << endl;
    return 0;
}



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

red = []
blue = []

for i in range(N):
    red.append(input())

M = int(input())

for j in range(M):
    blue.append(input())
    

words = []
for i in range(N):
    if(red[i] not in words):
        words.append(red[i])

for j in range(M):
    if(blue[j] not in words):
        words.append(blue[j])

maximum = 0
for i in range(len(words)):
    money = red.count(words[i])-blue.count(words[i])
    maximum = max(money,maximum)

if maximum<=0:
    print(0)
else:
    print(maximum)

Measured memory_bytes: 3064
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int X,Y,W,H;
int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>X>>Y>>W>>H;
		int N;
		cin>>N;
		int cnt = 0;
		int lx =X +W;
		int ly =Y+H;
		for(int i = 0;i <N;i++){
			int x,y;
			cin>>x>>y;
			if(x>=X&&x<=lx&&y>=Y&&y<=ly){
				cnt++;
			}
		}
		cout <<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160